Automated Termination Analysis for Logic Programs by Term Rewriting

  • Peter Schneider-Kamp
  • Jürgen Giesl
  • Alexander Serebrenik
  • René Thiemann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4407)


There are two kinds of approaches for termination analysis of logic programs: “transformational” and “direct” ones. Direct approaches prove termination directly on the basis of the logic program. Transformational approaches transform a logic program into a term rewrite system (TRS) and then analyze termination of the resulting TRS instead. Thus, transformational approaches make all methods previously developed for TRSs available for logic programs as well. However, the applicability of most existing transformations is quite restricted, as they can only be used for certain subclasses of logic programs. (Most of them are restricted to well-moded programs.) In this paper we improve these transformations such that they become applicable for any definite logic program. To simulate the behavior of logic programs by TRSs, we slightly modify the notion of rewriting by permitting infinite terms. We show that our transformation results in TRSs which are indeed suitable for automated termination analysis. In contrast to most other methods for termination of logic programs, our technique is also sound for logic programming without occur check, which is typically used in practice. We implemented our approach in the termination prover AProVE and successfully evaluated it on a large collection of examples.


Logic Program Logic Programming Function Symbol Ground Term Output Position 
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.
    G. Aguzzi and U. Modigliani. Proving termination of logic programs by transforming them into equivalent term rewriting systems. In Proc. 13th FST & TCS, LNCS 761, pages 114–124, 1993.Google Scholar
  2. 2.
    Apt, K.R.: From Logic Programming to Prolog. Prentice-Hall, Englewood Cliffs (1997)Google Scholar
  3. 3.
    Apt, K.R., Etalle, S.: On the unification free Prolog programs. In: Borzyszkowski, A.M., Sokolowski, S. (eds.) MFCS 1993. LNCS, vol. 711, pp. 1–19. Springer, Heidelberg (1993)Google Scholar
  4. 4.
    Arts, T., Giesl, J.: Termination of term rewriting using dependency pairs. Theoretical Computer Science 236, 133–178 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Arts, T., Zantema, H.: Termination of logic programs using semantic unification. In: Proietti, M. (ed.) LOPSTR 1995. LNCS, vol. 1048, pp. 219–233. Springer, Heidelberg (1996)Google Scholar
  6. 6.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge (1998)Google Scholar
  7. 7.
    Bruynooghe, M., Codish, M., Gallagher, J., Genaim, S., Vanhoof, W.: Termination analysis of logic programs through combination of type-based norms. In: ACM Transactions on Programming Languages and Systems, ACM Press, New York (To appear, 2006)Google Scholar
  8. 8.
    Chtourou, M., Rusinowitch, M.: Méthode transformationelle pour la preuve de terminaison des programmes logiques. Unpublished manuscript (1993)Google Scholar
  9. 9.
    Codish, M., Lagoon, V., Stuckey, P.: Testing for termination with monotonicity constraints. In: Gabbrielli, M., Gupta, G. (eds.) ICLP 2005. LNCS, vol. 3668, pp. 326–340. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  10. 10.
    Codish, M., Taboch, C.: A semantic basis for termination analysis of logic programs. Journal of Logic Programming 41(1), 103–123 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Colmerauer, A.: Prolog and infinite trees. In: Clark, K.L., Tärnlund, S. (eds.) Logic Programming, Academic Press, London (1982)Google Scholar
  12. 12.
    De Schreye, D., Decorte, S.: Termination of logic programs: The never-ending story. Journal of Logic Programming 19/20, 199–260 (1994)CrossRefGoogle Scholar
  13. 13.
    De Schreye, D., Serebrenik, A.: Acceptability with general orderings. In: Kakas, A.C., Sadri, F. (eds.) Computational Logic: Logic Programming and Beyond. LNCS (LNAI), vol. 2407, pp. 187–210. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  14. 14.
    Dershowitz, N.: Termination of rewriting. J. Symb. Comp. 3, 69–116 (1987)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Ganzinger, H., Waldmann, U.: Termination proofs of well-moded logic programs via conditional rewrite systems. In: Rusinowitch, M., Remy, J.-L. (eds.) Conditional Term Rewriting Systems. LNCS, vol. 656, pp. 216–222. Springer, Heidelberg (1993)Google Scholar
  16. 16.
    Giesl, J., Thiemann, R., Schneider-Kamp, P.: The dependency pair framework: Combining techniques for automated termination proofs. In: Baader, F., Voronkov, A. (eds.) LPAR 2004. LNCS (LNAI), vol. 3452, pp. 301–331. Springer, Heidelberg (2005)Google Scholar
  17. 17.
    Giesl, J., Schneider-Kamp, P., Thiemann, R.: AProVE 1.2: Automatic termination proofs in the DP framework. In: Furbach, U., Shankar, N. (eds.) IJCAR 2006. LNCS (LNAI), vol. 4130, pp. 281–286. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  18. 18.
    Huet, G.: Résolution d’équations dans les langages d’ordre 1, 2, ...ω. PhD (1976)Google Scholar
  19. 19.
    Krishna Rao, M., Kapur, D., Shyamasundar, R.: Transformational methodology for proving termination of logic programs. J. Log. Prog. 34(1), 1–42 (1998)zbMATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Lagoon, V., Mesnard, F., Stuckey, P.J.: Termination analysis with types is more accurate. In: Palamidessi, C. (ed.) ICLP 2003. LNCS, vol. 2916, pp. 254–268. Springer, Heidelberg (2003)Google Scholar
  21. 21.
    Leuschel, M., Sørensen, M.H.: Redundant argument filtering of logic programs. In: Gallagher, J.P. (ed.) LOPSTR 1996. LNCS, vol. 1207, pp. 83–103. Springer, Heidelberg (1997)Google Scholar
  22. 22.
    Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: TermiLog: A system for checking ter- mination of queries to logic programs. In: Grumberg, O. (ed.) CAV 1997. LNCS, vol. 1254, pp. 444–447. Springer, Heidelberg (1997)Google Scholar
  23. 23.
    Marchiori, M.: Logic programs as term rewriting systems. In: Rodríguez-Artalejo, M., Levi, G. (eds.) ALP 1994. LNCS, vol. 850, pp. 223–241. Springer, Heidelberg (1994)Google Scholar
  24. 24.
    Marchiori, M.: Proving existential termination of normal logic programs. In: Nivat, M., Wirsing, M. (eds.) AMAST 1996. LNCS, vol. 1101, pp. 375–390. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  25. 25.
    Mesnard, F., Bagnara, R.: cTI: A constraint-based termination inference tool for ISO-Prolog. Theory and Practice of Logic Programming 5(1-2), 243–257 (2005)zbMATHCrossRefGoogle Scholar
  26. 26.
    Mesnard, F., Ruggieri, S.: On proving left termination of constraint logic programs. ACM Transaction on Computational Logic 4(2), 207–259 (2003)CrossRefMathSciNetGoogle Scholar
  27. 27.
    Nguyen, M.T., De Schreye, D.: Polynomial interpretations as a basis for termination analysis of logic programs. In: Gabbrielli, M., Gupta, G. (eds.) ICLP 2005. LNCS, vol. 3668, pp. 311–325. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  28. 28.
    Ohlebusch, E.: Termination of logic programs: Transformational methods revisited. Appl. Algebra in Engineering, Communication and Computing 12, 73–116 (2001)zbMATHCrossRefMathSciNetGoogle Scholar
  29. 29.
    Ohlebusch, E., Claves, C., Marché, C.: TALP: A tool for the termination analysis of logic programs. In: Bachmair, L. (ed.) RTA 2000. LNCS, vol. 1833, pp. 270–273. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  30. 30.
    van Raamsdonk, F.: Translating logic programs into conditional rewriting systems. In: Proc. 14th ICLP, pp. 168–182. MIT Press, Cambridge (1997)Google Scholar
  31. 31.
    Serebrenik, A., De Schreye, D.: Proving termination with adornments. In: Bruynooghe, M. (ed.) Logic Based Program Synthesis and Transformation. LNCS, vol. 3018, pp. 108–109. Springer, Heidelberg (2004)Google Scholar
  32. 32.
    Serebrenik, A., De Schreye, D.: Inference of termination conditions for numerical loops in Prolog. Theory and Practice of Logic Programming 4, 719–751 (2004)zbMATHCrossRefMathSciNetGoogle Scholar
  33. 33.
    Smaus, J.-G.: Termination of logic programs using various dynamic selection rules. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 43–57. Springer, Heidelberg (2004)Google Scholar

Copyright information

© Springer Berlin Heidelberg 2007

Authors and Affiliations

  • Peter Schneider-Kamp
    • 1
  • Jürgen Giesl
    • 1
  • Alexander Serebrenik
    • 2
  • René Thiemann
    • 1
  1. 1.LuFG Informatik 2, RWTH Aachen, Ahornstr. 55, 52074 AachenGermany
  2. 2.Dept. of Mathematics and Computer Science, TU Eindhoven, P.O. Box 513, 5600 MB EindhovenThe Netherlands

Personalised recommendations