Unfolding the Mystery of Mergesort

  • N. Lindenstrauss
  • Y. Sagiv
  • A. Serebrenik
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1463)


This paper outlines a fully automatic transformation for proving termination of queries to a class of logic programs, for which existing methods do not work directly. The transformation consists of creating adorned clauses and unfolding. In general, the transformation may improve termination behavior by pruning infinite branches from the LD-tree. Conditions are given under which the transformation preserves termination behavior. The work presented here has been done in the framework of the TermiLog system, and it complements the algorithms described in [12].


Logic Program Original Program Query Pattern Springer Lecture Note Strongly Connect Component 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    K. R. Apt. From Logic Programming to Prolog. Prentice Hall, 1997.Google Scholar
  2. 2.
    K. R. Apt and D. Pedreschi. Modular Termination Proofs for Logic and Pure Prolog Programs. In Advances in Logic Programming Theory, 183–229. Oxford University Press, 1994.Google Scholar
  3. 3.
    F. Benoy and A. King. Inferring Argument Size Relationships with CLP(R). LOPSTR’96. Springer Lecture Notes in Computer Science.Google Scholar
  4. 4.
    A. Bossi and N. Cocco. Preserving Universal Termination Through Unfold/Fold. ALP’94, 269–286. Springer Lecture Notes in Computer Science 850, 1994.Google Scholar
  5. 5.
    A. Brodsky and Y. Sagiv. Inference of Monotonicity Constraints in Datalog Programs. Proceedings of the Eighth ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems, 1989, 190–199.Google Scholar
  6. 6.
    M. Codish and C. Taboch. A Semantic Basis for Termination Analysis of Logic Programs. ALP’97.Google Scholar
  7. 7.
    P. Cousot and R. Cousot. Abstract Interpretation and Application to Logic Programs. J. Logic Programming, 13:103–179, 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    D. De Schreye and S. Decorte. Termination of Logic Programs: the Never-Ending Story. J. Logic Programming, 19–20:199–260, 1994.Google Scholar
  9. 9.
    M. Falaschi, G. Levi, M. Martelli and C. Palamidessi. Declarative Modeling of the Operational Behaviour of Logic Programs. Theoretical Computer Science, 69(3):289–318, 1989.zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    A. Levy and Y. Sagiv. Constraints and Redundancy in Datalog. PODS’92, 67–80. ACM, 1992.Google Scholar
  11. 11.
    N. Lindenstrauss and Y. Sagiv. Checking Termination of Queries to Logic Programs. Available at Scholar
  12. 12.
    N. Lindenstrauss and Y. Sagiv. Automatic Termination Analysis of Logic Programs. ICLP’97. MIT Press, 1997.Google Scholar
  13. 13.
    N. Lindenstrauss and Y. Sagiv. Automatic Termination Analysis of Logic Programs (with Detailed Experimental Results). Available at Scholar
  14. 14.
    N. Lindenstrauss, Y. Sagiv, A. Serebrenik. TermiLog: A System for Checking Termination of Queries to Logic Programs. CAV’97. Springer Lecture Notes in Computer Science, 1997.Google Scholar
  15. 15.
    L. Plümer. Termination Proofs for Logic Programs. Springer Verlag, LNAI 446, 1990.Google Scholar
  16. 16.
    Y. Sagiv. A termination test for logic programs. In International Logic Programming Symposium. MIT Press, 1991.Google Scholar
  17. 17.
    SICStus Prolog User’s Manual, Release 3 # 3. Swedish Institute of Computer Science, 1995.Google Scholar
  18. 18.
    J. D. Ullman. Principles of Database and Knowledge-Base Systems, Vol. II. Computer Science Press, 1989.Google Scholar
  19. 19.
    J. D. Ullman and A. Van Gelder. Efficient Tests for Top-Down Termination of Logical Rules. Journal of the ACM, 35, 1988, 345–373.CrossRefGoogle Scholar
  20. 20.
    A. Van Gelder. Deriving Constraints among Argument Sizes in Logic Programs. Annals of Mathematics and Artificial Intelligence, 3:361–392, 1991.zbMATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    K. Verschaetse, S. Decorte and D. De Schreye. Automatic Termination Analysis. LOPSTR 92, ed. K. K. Lau and T. Clement. Workshops in Computing Series, Springer, 1992.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • N. Lindenstrauss
    • 1
  • Y. Sagiv
    • 1
  • A. Serebrenik
    • 1
  1. 1.Dept. of Computer ScienceHebrew UniversityJerusalemIsrael

Personalised recommendations