Abstract
We consider the replacement transformation operation, a very general and powerful transformation, and study under which conditions it preserves universal termination besides computed answer substitutions. With this safe replacement we can significantly extend the safe unfold/fold transformation sequence presented in [11]. By exploiting typing information, more useful conditions can be defined and we may deal with some special cases of replacement very common in practice, namely switching two atoms in the body of a clause and the associativity of a predicate. This is a first step in the direction of exploiting a Pre/Post specification on the intended use of the program to be transformed. Such specification can restrict the instances of queries and clauses to be considered and then relax the applicability conditions on the transformation operations.
Preview
Unable to display preview. Download preview PDF.
References
K. R. Apt. Introduction to Logic Programming. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B: Formal Models and Semantics. Elsevier, Amsterdam and The MIT Press, Cambridge, 1990.
K. R. Apt. Declarative programming in Prolog. In D. Miller, editor, Proceedings of the 1993 International Symposium on Logic Programming, pages 12-35. The MIT Press, 1993.
K. R. Apt and B. Marchiori. Reasoning about Prolog programs: from modes through types to assertions. Formal Aspects of Computing, 6(6A):743–765, 1994.
K. R. Apt and D. Pedreschi. Studies in Pure Prolog: termination. In J.W. Lloyd, editor, Proceedings of the Simposium in Computational Logic, pages 150–176, Berlin, 1990. Springer-Verlag.
K. R. Apt and D. Pedreschi. Proving termination of general Prolog programs. In T. Ito and A. Meyer, editors, Proceedings of the International Conference on Theoretical Aspects of Computer Software, Lecture Notes in Computer Science 526, pages 265–289, Berlin, 1991. Springer-Verlag.
K. R. Apt and Pellegrini. On the occur-check free Prolog programs. Technical Report TRCS-R9238, CWI, Amsterdam, The Netherlands, 1992.
M. Baudinet. Logic Programming Semantics: Techniques and Applications. PhD thesis, Stanford University, Stanford, California, 1989.
R.S. Bird. The Promotion and Accumulation Strategies in Transformational Programming. TOPLAS ACM, 6 4):487–504, 1984.
A. Bossi and N. Cocco. Verifying correctness of logic programs. In J. Diaz and F. Orejas, editors, TAPSOFT '89, Barcelona, Spain, March 1989, (Lecture Notes in Computer Science, vol. 352), pages 96–110. Springer-Verlag, 1989.
A. Bossi and N. Cocco. Basic Transformation Operations which preserve Computed Answer Substitutions of Logic Programs. Journal of Logic Programming, 16:47–87, 1993.
A. Bossi and N. Cocco. Preserving universal termination through unfold/fold. In G. Levi and M Rodriguez-Artalejo, editors, Proceedings ALP'94, Madrid, Spain, September 1994.
A. Bossi, N. Cocco, and S. Etalle. Transforming Normal Programs by Replacement. In A. Pettorossi, editor, Meta Programming in Logic — Proceedings META '92, volume 649 of Lecture Notes in Computer Science, pages 265–279. Springer-Verlag, Berlin, 1992.
A. Bossi, N. Cocco, and S. Etalle. Simultaneous Replacement in Normal Programs. Journal of Logic and Computation, 6(1):79–120, 1996.
A. Bossi, N. Cocco, and S. Etalle. Transformation of Left Terminating Programs: The Reordering Problem. In M. Proietti, editor, Proceedings LOPSTR'95, volume 1048 of Lecture Notes in Computer Science, pages 33–45. Springer-Verlag, Berlin, 1996.
A. Bossi, N. Cocco, and M. Fabris. Norms on terms and their use in proving universal termination of a logic program. Theoretical Computer Science, 124:297–328, 1994.
D.R. Brough and C.J. Hogger. Compiling Associativity into Logic Programs. Journal of Logic Programming, 4:345–359, 1987.
L. Colussi and E. Marchiori. Proving correctness of logic programs using axiomatic semantics. In Proceedings ICLP'91, pages 629–644. MIT Press, 1991.
J. Cook and J.P. Gallagher. A transformation system for definite programs based on termination analysis. In G. Levi and M. Rodriguez-Artalejo, editors, LOPSTR'94. Springer-Verlag, 1994.
W. Drabent and J. Maluszynski. Inductive assertion method for logic programs. Theoretical Computer Science, 59:133–155, 1988.
U. S. Reddy F. Bronsard, T. K. Lakshman. A framework of directionalities for proving termination of logic programs. In K. R. Apt, editor, Proceedings of the Joint International Conference and Symposium on Logic Programming, pages 321–335. The MIT Press, 1992.
P.A. Gardner and J.C. Shepherdson. Unfold/fold transformations of logic programs. In J-L Lassez and editor G. Plotkin, editors, Computational Logic: Essays in Honor of Alan Robinson. MIT Press, 1991.
T. Kawamura and T. Kanamori. Preservation of Stronger Equivalence in Unfold/Fold Logic Programming Transformation. In Proc. Int'l Conf. on Fifth Generation Computer Systems, pages 413–422. Institute for New Generation Computer Technology, Tokyo, 1988.
H. Komorowski. Partial evaluation as a means for inferencing data structures in an applicative language: A theory and implementation in the case of Prolog. In Ninth ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico, pages 255–267. ACM, 1982.
J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, 1987. Second edition.
J. W. Lloyd and J. C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11:217–242, 1991.
M.J. Maher. Correctness of a logic program transformation system. IBM Research Report RC13496, T.J. Watson Research Center, 1987.
K. Marriot and H. Sondergaard. Difference-list Transformation for Prolog. New Generation Computing, 11:125–177, 1993.
N.Jones and A. Mycroft. Stepwise development of operational and denotational semantics for Prolog. In International Symposium on Logic Programming, Atlantic City, NJ, (U.S.A.), pages 289–298, 1984.
A. Pettorossi and M. Proietti. Transformation of Logic Programs: Foundations and Techniques. Journal of Logic Programming, 19(20):261–320, 1994.
A. Pettorossi and M. Proietti. Transformation of Logic Programs. In J.A. Robinson editors D.M. Gabbay, C.J. Hogger, editor, Handbook of Logic and Artificial Intelligence. Oxford University Press, 1995.
L. Pluemer. Termination proofs for logic programs, volume 446 of Lecture Notes in Artificial Intelligence. Springer-Verlag, Berlin, 1990.
M. Proietti and A. Pettorossi. The synthesis of eureka predicates for developing logic programs. In N. Jones, editor, ESOP'90, (Lecture Notes in Computer Science, Vol. 432), pages 306–325. Springer-Verlag, 1990.
M. Proietti and A. Pettorossi. Unfolding, definition, folding, in this order for avoiding unnesessary variables in logic programs. In Maluszynski and M. Wirsing, editors, PLILP 91, Passau, Germany (Lecture Notes in Computer Science, Vol.528), pages 347–358. Springer-Verlag, 1991.
M. Proietti and A. Pettorossi. Synthesis of Programs from Unfold/Fold Proofs. In Y. Deville, editor, LOPSTR'93, pages 141–158, 1994.
T. Sato. An equivalence preserving first order unfold/fold transformation system. In Second Int. Conference on Algebraic and Logic Programming, Nancy, France, October 1990, (Lecture Notes in Computer Science, Vol. 463), pages 175–188. Springer-Verlag, 1990.
H. Seki. Unfold/fold transformation of stratified programs. Journal of Theoretical Computer Science, 86:107–139, 1991.
H. Tamaki and T. Sato. Unfold/Fold Transformations of Logic Programs. In StenÅke Tärnlund, editor, Proc. Second Int'l Conf. on Logic Programming, pages 127–139, 1984.
K. Verschaetse. Static termination analysis for definite Horn clause programs. PhD thesis, Dept. Computer Science, K. U. Leuven, 1992.
K. Verschaetse and D. De Schreye. Deriving termination proofs for logic programs, using abstract procedures. In Proc. Eighth Int'l Conf. on Logic Programming, pages 301–315, 1991.
J. Zhang and P. W. Grant. An Automatic Difference-list Transformation Algorithm for Prolog. In Proceedings of the European Conference on Artificial Intelligence,ECAI'88, pages 320–325. Pitman, 1988.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bossi, A., Cocco, N. (1997). Replacement can preserve termination. In: Gallagher, J. (eds) Logic Program Synthesis and Transformation. LOPSTR 1996. Lecture Notes in Computer Science, vol 1207. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-62718-9_7
Download citation
DOI: https://doi.org/10.1007/3-540-62718-9_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-62718-0
Online ISBN: 978-3-540-68494-7
eBook Packages: Springer Book Archive