Abstract
Many approaches proposed in the literature for proving the correctness of unfold/fold transformations of logic programs make use of measures associated with program clauses. When from a program P 1 we derive a program P 2 by applying a sequence of transformations, suitable conditions on the measures of the clauses in P 2 guarantee that the transformation of P 1 into P 2 is correct, that is, P 1 and P 2 have the same least Herbrand model. In the approaches proposed so far, clause measures are fixed in advance, independently of the transformations to be proved correct. In this paper we propose a method for the automatic generation of clause measures which, instead, takes into account the particular program transformation at hand. During the application of a sequence of transformations we construct a system of linear equalities and inequalities over nonnegative integers whose unknowns are the clause measures to be found, and the correctness of the transformation is guaranteed by the satisfiability of that system. Through some examples we show that our method is more powerful and practical than other methods proposed in the literature. In particular, we are able to establish in a fully automatic way the correctness of program transformations which, by using other methods, are proved correct at the expense of fixing in advance sophisticated clause measures.
Similar content being viewed by others
References
Apt KR (1990) Introduction to logic programming. In: van Leeuwen J (ed.) Handbook of theoretical computer science. Elsevier, Amsterdam, pp 493–576
Bossi A, Cocco N (1994) Preserving universal termination through unfold/fold. In: Proceedings ALP ’94, Lecture notes in computer science, vol 850. Springer, Berlin, pp 269–286
Bossi A, Cocco N, Etalle S (1992) On safe folding. In: Proceedings PLILP ’92, Leuven, Belgium, Lecture notes in computer science, vol 631. Springer, Berlin, pp 172–186
Burstall RM, Darlington J (1977) A transformation system for developing recursive programs. J ACM 24(1): 44–67
Bezem M (1989) Characterizing termination of logic programs with level mappings. In: Lusk EL, Overbeek RA (eds) Proceedings of the North American Conference on Logic Programming, Cleveland, Ohio, USA. MIT Press, Cambridge, pp 69–80
Cook J, Gallagher JP (1994) A transformation system for definite programs based on termination analysis. In: Fribourg L, Turini F (eds.) Proceedings of LOPSTR ’94 and META’94, Pisa, Italy, Lecture notes in computer science, vol 883. Springer, Berlin, pp 51–68
Dershowitz N (1987) Termination of rewriting. J Symb Comput 3(1–2): 69–116
Dix J (1995) A classification theory of semantics of normal logic programs: II weak properties. Fundam Inform XXII(3): 257–288
Etalle S, Gabbrielli M (1996) Transformations of CLP modules. Theor Comput Sci 166: 101–146
Fuhs C, Giesl J, Middeldorp A, Schneider-Kamp P, Thiemann R, Zankl H (2007) SAT solving for termination analysis with polynomial interpretations. In: Proceedings of the 10th International Conference on Theory and Applications of Satisfiability Testing, SAT ’07, Lisbon, Portugal, May 28–31, 2007. Lecture notes in computer science, vol 4501. Springer, Berlin, pp 340–354
Gergatsoulis M, Katzouraki M (1994) Unfold/fold transformations for definite clause programs. In: Hermenegildo M, Penjam J (eds) Proceedings sixth International Symposium on Programming Language Implementation and Logic Programming, PLILP ’94. Lecture notes in computer science, vol 844. Springer, Berlin, pp 340–354
Jaffar J, Maher M (1994) Constraint logic programming: a survey. J Logic Program 19/20: 503–581
Kanamori T, Fujita H (1986) Unfold/fold transformation of logic programs with counters. Technical Report 179, ICOT, Tokyo, Japan
Kott L (1978) About transformation system: a theoretical study. In: 3ème Colloque International sur la Programmation, Paris (France). Dunod, Paris, pp 232–247
Kott L (1982) The McCarthy’s induction principle: ‘oldy’ but ‘goody’. Calcolo 19(1): 59–69
Lankford DS (1979) On proving term rewriting systems are noetherian. MTP 3, Lousiana Technical University
Lloyd JW (1987) Foundations of logic programming, 2nd edn. Springer, Berlin
Lau K-K, Ornaghi M, Pettorossi A, Proietti M (1995) Correctness of logic program transformation based on existential termination. In: Lloyd JW (ed.) Proceedings of the 1995 International Logic Programming Symposium, ILPS ’95. MIT Press, Cambridge, pp 480–494
Maher MJ (1987) Correctness of a logic program transformation system. IBM Research Report RC 13496, T. J. Watson Research Center
Maher MJ (1993) A transformation system for deductive database modules with perfect model semantics. Theor Comput Sci 110: 377–403
MAP transformation system (2011). http://www.iasi.cnr.it/~proietti/system.html
McCarthy J (1963) Towards a mathematical science of computation. In: Popplewell CM (ed.) Information processing: Proceedings of IFIP, vol 1962. North Holland, Amsterdam, pp 21–28
Nguyen MT, De Schreye D, Giesl J, Schneider-Kamp P (2011) Polytool: polynomial interpretations as a basis for termination analysis of logic programs. Theory Pract Logic Program 11(1): 33–63
Pettorossi A, Proietti M (1999) Synthesis and transformation of logic programs using unfold/fold proofs. J Logic Program 41(2–3): 197–230
Pettorossi A, Proietti M (2008) Totally correct logic program transformations via well-founded annotations. High Order Symb Comput 21: 193–234
Pettorossi A, Proietti M, Senni V (2007) Automatic correctness proofs for logic program transformations. In: Dahl V, Niemelä I (eds.) Proceedings of the 23rd International Conference on Logic Programming, ICLP ’07. Lecture notes in computer science, vol 4670. Springer, pp 364–379
Pettorossi A, Proietti M, Senni V (2010) Transformations of logic programs on infinite lists. Theory Practice Logic Program 10(4–6):383–399 (Special Issue on the 26th International Conference on Logic Programming, ICLP ’10, Edinburgh, Scotland, UK)
Roychoudhury A, Narayan Kumar K, Ramakrishnan CR, Ramakrishnan IV (2002) Beyond Tamaki-Sato style unfold/fold transformations for normal logic programs. Int J Found Comput Sci 13(3):387–403
Roychoudhury A, Narayan Kumar K, Ramakrishnan CR, Ramakrishnan IV (2004) An unfold/fold transformation framework for definite logic programs. ACM Trans Program Lang Syst 26:264–509
Sands D (1996) Total correctness by local improvement in the transformation of functional programs. ACM Toplas 18(2): 175–234
Seki H (1991) Unfold/fold transformation of stratified programs. Theor Comput Sci 86: 107–139
Seki H (2009) On negative unfolding in the answer set semantics. In: Hanus M (ed) Logic-based Program Synthesis and Transformation, 18th International Symposium, LOPSTR ’08, Valencia, Spain, July 17–18, 2008, Revised Selected Papers. Lecture notes in computer science, vol 5438. Springer, Berlin, pp 168–184
Seki H (2010) On inductive and coinductive proofs via unfold/fold transformations. In: De Schreye D (ed) Proceedings of the 19th International Symposium on Logic-based Program Synthesis and Transformation, LOPSTR ’09, Coimbra, Portugal, September 9–11, 2009. Lecture notes in computer science, vol 6037. Springer, Berlin, pp 82–96
Seki H (2011) Proving properties of co-logic programs by unfold/fold transformations. In: Vidal G (ed) Preliminary Proceedings of the 21th International Symposium on Logic-based Synthesis and Transformation, LOPSTR ’11, July 18–20, 2011, Odense, Denmark. University of Southern Denmark, pp 112–126
Simon L, Mallya A, Bansal A, Gupta G (2006) Coinductive logic programming. In: Etalle S, Truszczyński M (eds) Proceedings of the 22nd International Conference on Logic Programming, ICLP ’06, Seattle, WA, USA, August 17–20, 2006. Lecture notes in computer science, vol 4079. Springer, Berlin, pp 330–345
Sato T, Tamaki H (1985) Examples of logic program transformation and synthesis. Case studies of transformation and synthesis of logic programs done up to February’85. Unpublished manuscript, Ibaraki University, Japan
Tamaki H, Sato T (1984) Unfold/fold transformation of logic programs. In: Tärnlund S-Å (ed) Proceedings of the Second International Conference on Logic Programming, ICLP ’84, Uppsala, Sweden, 1984. Uppsala University, pp 127–138
Tamaki H, Sato T (1986) A generalized correctness proof of the unfold/fold logic program transformation. Technical Report 86-4, Ibaraki University, Japan
Wand M (1980) Continuation-based program transformation strategies. J ACM 27(1): 164–180
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by Peter Höfner, Robert van Glabbeek and Ian Hayes
This paper is an extended version of: Pettorossi A, Proietti M, Senni V (2007) Automatic correctness proofs for logic program transformations. In: Dahl V, Niemelä I (eds) Proceedings of the 23rd international conference on logic programming (ICLP ’07). Lecture Notes in Computer Science, vol 4670, pp 364–379[PPS07].
Rights and permissions
About this article
Cite this article
Pettorossi, A., Proietti, M. & Senni, V. Constraint-based correctness proofs for logic program transformations. Form Asp Comp 24, 569–594 (2012). https://doi.org/10.1007/s00165-012-0233-8
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00165-012-0233-8