Skip to main content

Transformation of left terminating programs: The reordering problem

  • Conference paper
  • First Online:
Book cover Logic Program Synthesis and Transformation (LOPSTR 1995)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1048))

Abstract

An Unfold/Fold transformation system is a source-to-source rewriting methodology devised to improve the efficiency of a program. Any such transformation should preserve the main properties of the initial program: among them, termination. When dealing with logic programs such as PROLOG programs, one is particularly interested in preserving left termination i.e. termination wrt the leftmost selection rule, which is by far the most widely employed of the search rules. Unfortunately, the most popular Unfold/Fold transformation systems ([TS84, Sek91]) do not preserve the above termination property. In this paper we study the reasons why left termination may be spoiled by the application of a transformation operation and we present a transformation system based on the operations of Unfold, Fold and Switch which — if applied to a left terminating programs — yields a program which is left terminating as well.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. K. R. Apt and M. Bezem. Acyclic programs. In D. H. D. Warren and P. Szeredi, editors, Proceedings of the Seventh International Conference on Logic Programming, pages 617–633. The MIT Press, 1990.

    Google Scholar 

  2. K.R. Apt and E. Marchiori. Reasoning about Prolog programs: from modes through types to assertions. Formal Aspects of Computing, 1994. In print. Also Technical report CS-R9358, CWI, Amsterdam, The Netherlands. Available via anonymous ftp at ftp.cwi.nl, or via xmosaic at http://www.cwi.nl/cwi/publications/index.html.

    Google Scholar 

  3. K. R. Apt and D. Pedreschi. Studies in Pure Prolog: termination. In J. W. Lloyd, editor, Symposium on Computational Logic, pages 150–176. Springer-Verlag, 1990.

    Google Scholar 

  4. K. R. Apt and D. Pedreschi. Reasoning about termination of pure Prolog programs. Information and Computation, 106(1):109–157, 1993.

    Google Scholar 

  5. K. R. Apt. Introduction to Logic Programming. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B: Formal Models and Semantics, pages 495–574. Elsevier, Amsterdam and The MIT Press, Cambridge, 1990.

    Google Scholar 

  6. M. Baudinet. Logic Programming Semantics: Techniques and Applications. PhD thesis, Stanford University, Stanford, California, 1989.

    Google Scholar 

  7. A. Bossi and N. Cocco. Preserving universal termination through unfold/fold. In G. Levi and M. Rodríguez-Artalejo, editors, Proc. Fourth Int'l Conf. on Algebraic and Logic Programming, volume 850 of Lecture Notes in Computer Science, pages 269–286. Springer-Verlag, Berlin, 1994.

    Google Scholar 

  8. A. Bossi, N. Cocco, and S. Etalle. Transformation of Left Terminating Programs: The Reordering Problem. Technical Report CS96-1, Dip. Matematica Applicata e Informatica, Università Ca' Foscari di Venezia, Italy”, 1996.

    Google Scholar 

  9. 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.

    Google Scholar 

  10. R.M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, January 1977.

    Google Scholar 

  11. A. Bossi and S. Etalle. Transforming Acyclic Programs. ACM Transactions on Programming Languages and Systems, 16(4):1081–1096, July 1994.

    Google Scholar 

  12. J. Cook and J.P. Gallagher. A transformation system for definite programs based on termination analysis. In F. Turini, editor, Proc. Fourth Workshop on Logic Program Synthesis and Transformation. Springer-Verlag, 1994.

    Google Scholar 

  13. K.L. Clark and S. Sickel. Predicate logic: a calculus for deriving programs. In Proceedings of IJCAI'77, pages 419–120, 1977.

    Google Scholar 

  14. S. Decorte, D. De Schreye, and M. Fabris. Automatic Inference of Norms: a Missing Link in Automatic Termination Analysis. In D. Miller, editor, Proc. 1993 Int'l Symposium on Logic Programming. The MIT Press, 1993.

    Google Scholar 

  15. S. Etalle and M. Gabbrielli. Transformations of CLP Modules. Technical Report CS-R9515, CWI, Amsterdam, 1994.

    Google Scholar 

  16. C.J. Hogger. Derivation of logic programs. Journal of the ACM, 28(2):372–392, April 1981.

    Google Scholar 

  17. 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.

    Google Scholar 

  18. T. Kawamura and T. Kanamori. Preservation of Stronger Equivalence in Unfold/Fold Logic Programming Transformation. Theoretical Computer Science, 75(1&2):139–156, 1990.

    Google Scholar 

  19. 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.

    Google Scholar 

  20. J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, 1987. Second edition.

    Google Scholar 

  21. Mycroft A. N.Jones. 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.

    Google Scholar 

  22. L. Plümer. Termination Proofs for Logic Programs. Lecture Notes in Artificial Intelligence 446. Springer-Verlag, 1990.

    Google Scholar 

  23. M. Proietti and A. Pettorossi. Semantics preserving transformation rules for prolog. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM '91). ACM press, 1991.

    Google Scholar 

  24. H. Seki. Unfold/fold transformation of stratified programs. Theoretical Computer Science, 86(1):107–139, 1991.

    Google Scholar 

  25. H. Seki. Unfold/fold transformation of general logic programs for the Well-Founded semantics. Journal of Logic Programming, 16(1&2):5–23, 1993.

    Google Scholar 

  26. 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.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Maurizio Proietti

Rights and permissions

Reprints and permissions

Copyright information

© 1996 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bossi, A., Cocco, N., Etalle, S. (1996). Transformation of left terminating programs: The reordering problem. In: Proietti, M. (eds) Logic Program Synthesis and Transformation. LOPSTR 1995. Lecture Notes in Computer Science, vol 1048. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60939-3_3

Download citation

  • DOI: https://doi.org/10.1007/3-540-60939-3_3

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60939-1

  • Online ISBN: 978-3-540-49745-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics