A theory of totally correct logic program transformations

We address the problem of proving total correctness of transformation rules for definite logic programs. We consider a general transformation rule, called clause replacement, which consists in transforming a program <i>P</i> into a new program <i>Q</i> by replacing a set Γ<sup>1</sup> of clauses occurring in <i>P</i> by a new set Γ<sup>2</sup> of clauses, provided that Γ<sup>1</sup> and Γ<sup>2</sup> are equivalent in the least Herbrand model <i>M</i>(<i>P</i>) of the program <i>P</i>.We propose a general method for proving that clause replacement is totally correct, that is, <i>M</i>(<i>P</i>)=<i>M</i>(<i>Q</i>). Our method consists in showing that the transformation of <i>P</i> into <i>Q</i> can be performed by: (i) adding extra arguments to predicates, thereby constructing from the given program <i>P</i> an annotated program α(<i>P</i>), (ii) applying clause replacements and transforming the annotated program α(<i>P</i>) into a <i>terminating</i> annotated program β(<i>Q</i>, and (iii) erasing the annotations from β(<i>Q</i>), thereby getting <i>Q</i>.Our method does not require that either <i>P</i> or <i>Q</i> terminates and it is parametric w.r.t. the annotations. By providing different definitions for these annotations, we can easily prove the total correctness of many versions of the unfolding, folding, and goal replacement rules proposed in the literature.

[1]  Zohar Manna,et al.  Axiomatic approach to total correctness of programs , 1973, Acta Informatica.

[2]  Manolis Gergatsoulis,et al.  Unfold/Fold Transformations For Definite Clause Programs , 1994, PLILP.

[3]  Marc Bezem,et al.  Characterizing Termination of Logic Programs with Level Mappings , 1989, NACLP.

[4]  Gordon D. Plotkin,et al.  A structural approach to operational semantics , 2004, J. Log. Algebraic Methods Program..

[5]  Krzysztof R. Apt,et al.  Introduction to Logic Programming , 1988 .

[6]  David Sands From SOS rules to proof principles: an operational metatheory for functional languages , 1997, POPL '97.

[7]  Michael J. Maher Correctness of a Logic Program Transformation System , 1987 .

[8]  Hisao Tamaki,et al.  Unfold/Fold Transformation of Logic Programs , 1984, ICLP.

[9]  Sandro Etalle,et al.  On Safe Folding , 1992, PLILP.

[10]  Helmut A. Partsch,et al.  Specification and transformation of programs , 1990 .

[11]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[12]  Alberto Pettorossi,et al.  Transforming Inductive Definitions , 1999, ICLP.

[13]  Nachum Dershowitz,et al.  Termination of Rewriting , 1987, J. Symb. Comput..

[14]  C. R. Ramakrishnan,et al.  An unfold/fold transformation framework for definite logic programs , 2004, TOPL.

[15]  Sandro Etalle,et al.  Simultaneous Replacement in Normal Programs , 1996, J. Log. Comput..

[16]  Bruno Courcelle,et al.  Infinite trees in normal form and recursive equations having a unique solution , 1979, Mathematical systems theory.

[17]  Michael J. Maher,et al.  The Semantics of Constraint Logic Programs , 1998, J. Log. Program..

[18]  Helmuth Partsch,et al.  Specification and Transformation of Programs - A Formal Approach to Software Development , 1990, Texts and Monographs in Computer Science.