Proving Termination for Logic Programs by the Query-Mapping Pairs Approach

  • Naomi Lindenstrauss
  • Yehoshua Sagiv
  • Alexander Serebrenik
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3049)

Abstract

This paper describes a method for proving termination of queries to logic programs based on abstract interpretation. The method uses query-mapping pairs to abstract the relation between calls in the LD-tree associated with the program and query. Any well founded partial order for terms can be used to prove the termination. The ideas of the query-mapping pairs approach have been implemented in SICStus Prolog in a system called TermiLog, which is available on the web. Given a program and query pattern the system either answers that the query terminates or that there may be non-termination. The advantages of the method are its conceptual simplicity and the fact that it does not impose any restrictions on the programs.

Keywords

Logic Program Abstract Interpretation Predicate Symbol Query Pattern Galois Connection 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Apt, K.R.: From Logic Programming to Prolog. Prentice-Hall, Englewood Cliffs (1997)Google Scholar
  2. 2.
    Apt, K.R., Bezem, M.: Acyclic Programs. New Generation Computing 9, 335–363 (1991)CrossRefGoogle Scholar
  3. 3.
    Apt, K.R., Luitjes, I.: Verification of logic programs with delay declarations. In: Alagar, V.S., Nivat, M. (eds.) AMAST 1995. LNCS, vol. 936, pp. 66–90. Springer, Heidelberg (1995)Google Scholar
  4. 4.
    Apt, K.R., Pedreschi, D.: Reasoning about Termination of Pure Prolog Programs. Information and Computation 106, 109–157 (1993)MATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Apt, K.R., Pedreschi, D.: Modular Termination Proofs for Logic and Pure Prolog Programs. In: Advances in Logic Programming Theory, pp. 183–229. Oxford University Press, Oxford (1994)Google Scholar
  6. 6.
    Arts, T.: Automatically proving termination and innermost normalisation of term rewriting systems. PhD thesis, Universiteit Utrecht (1997)Google Scholar
  7. 7.
    Bagnara, R., Ricci, E., Zaffanella, E., Hill, P.M.: Possibly not closed convex polyhedra and the Parma Polyhedra Library. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, pp. 213–229. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  8. 8.
    Baudinet, M.: Proving termination properties of Prolog programs: a semantic approach. Journal of Logic Programming 14, 1–29 (1992)MATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Benoy, F., King, A.: Inferring argument size relationships with CLPR(R). In: Gallagher, J.P. (ed.) LOPSTR 1996. LNCS, vol. 1207, pp. 204–223. Springer, Heidelberg (1997)Google Scholar
  10. 10.
    Benyamini, Y., Lindenstrauss, J.: Geometric Nonlinear Functional Analysis, vol. 1&48. AMS Colloquium Publications, Providence (2000)MATHGoogle Scholar
  11. 11.
    Bezem, M.: Characterizing termination of logic programs with level mappings. In: Lusk, E.L., Overbeek, R.A. (eds.) Logic Programming, Proceedings of the North American Conference 1989, pp. 69–80. MIT Press, Cambridge (1989)Google Scholar
  12. 12.
    Bezem, M.: Strong termination of logic programs. J. Logic Programming 15, 79–97 (1993)MATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Börger, E.: Unsolvable decision problems for Prolog programs. In: Börger, E. (ed.) Computation Theory and Logic. LNCS, vol. 270, pp. 37–48. Springer, Heidelberg (1987)Google Scholar
  14. 14.
    Bossi, A., Cocco, N., Etalle, S., Rossi, S.: On modular termination proofs of general logic programs. Theory and Practice of Logic Programming 2(3), 263–291 (2002)MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Bossi, A., Gabrielli, M., Levi, G., Martelli, M.: The s-semantics approach: theory and Applications. J. Logic Programming 19/20, 149–198 (1994)CrossRefGoogle Scholar
  16. 16.
    Brodsky, A., Sagiv, Y.: Inference of monotonicity constraints in Datalog programs. In: Proceedings of the Eighth ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems, pp. 190–199 (1989)Google Scholar
  17. 17.
    Brodsky, A., Sagiv, Y.: Inference of inequality constraints in logic programs. In: Proceedings of the Tenth ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems, pp. 227–240 (1991)Google Scholar
  18. 18.
    Bueno, F., García de la Banda, M., Hermenegildo, M.: Effectiveness of Global Analysis in Strict Independence-Based Automatic Program Parallelization. In: International Symposium on Logic Programming, pp. 320–336. MIT Press, Cambridge (1994)Google Scholar
  19. 19.
    Codish, M., Bruynooghe, M., Garc´ıa de la Banda, M.J., Hermenegildo, M.V.: Exploiting Goal Independence in the Analysis of Logic Programs. Journal of Logic Programming 32(3), 247–262 (1997)MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Codish, M., Demoen, B.: Analyzing Logic Programs using “Prop”-ositional Logic Programs and a Magic Wand. In: Proceedings International Logic Programming Symposium, Vancouver (1993)Google Scholar
  21. 21.
    Codish, M., Demoen, B.: Collection of benchmarksGoogle Scholar
  22. 22.
    Codish, M., Genaim, S., Bruynooghe, M., Gallagher, J., Vanhoof, W.: One Loop at a Time. In: 6th International Workshop on Termination (2003)Google Scholar
  23. 23.
    Codish, M., Taboch, C.: A semantic basis for termination analysis of logic programs. Journal of Logic Programming 41(1), 103–123Google Scholar
  24. 24.
    Cousot, P., Cousot, R.: Abstract interpretation and application to logic programs. J. Logic Programming 13, 103–179 (1992)MATHCrossRefMathSciNetGoogle Scholar
  25. 25.
    Decorte, S., De Schreye, D.: Automatic Inference of Norms: a Missing Link in Automatic Termination Analysis. In: Miller, D. (ed.) Logic Programming: Proceedings of the 1993 International Symposium, MIT Press, Cambridge (1993)Google Scholar
  26. 26.
    Decorte, S., De Schreye, D.: Demand-driven and constraint-based automatic left-termination analysis for Logic Programs. In: Proceedings of the 1997 International Conference on Logic Programming, MIT Press, Cambridge (1997)Google Scholar
  27. 27.
    Decorte, D., De Schreye, D., Vandecasteele, H.: Constraint-based termination analysis of logic programs. ACM TOPLAS 21(6), 1137–1195 (1999)CrossRefGoogle Scholar
  28. 28.
    Dershowitz, N.: Orderings for term-rewriting systems. Theoretical Computer Science 17, 279–301 (1982)MATHCrossRefMathSciNetGoogle Scholar
  29. 29.
    Dershowitz, N., Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: A general framework for automatic termination analysis of logic programs. Applicable Algebra in Engineering, Communication and Computing 12, 1–2 (2001)CrossRefMathSciNetGoogle Scholar
  30. 30.
    De Schreye, D., Decorte, S.: Termination of Logic Programs: the Never-Ending Story. J. Logic Programming 19/20, 199–260 (1994)CrossRefGoogle Scholar
  31. 31.
    De Schreye, D., Serebrenik, A.: Acceptability with general orderings. Computational Logic. 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
  32. 32.
    De Schreye, D., Verschaetse, K., Bruynooghe, M.: A framework for analyzing the termination of definite logic programs with respect to call patterns. In: Proc. of the Int. Conf. on Fifth Generation Computer Systems, pp. 481–488. IOS Press, Amsterdam (1992)Google Scholar
  33. 33.
    Devienne, P., Lebègue, P., Routier, J.C.: Halting problem of one binary Horn clause is undecidable. In: Enjalbert, P., Wagner, K.W., Finkel, A. (eds.) STACS 1993. LNCS, vol. 665, pp. 48–57. Springer, Heidelberg (1993)Google Scholar
  34. 34.
    Falaschi, M., Levi, G., Palamidessi, C.: Declarative modeling of the operational behavior of logic languages. Theoretical Computer Science 69, 289–318 (1989)MATHCrossRefMathSciNetGoogle Scholar
  35. 35.
    Fischer, J.: Termination analysis for Mercury using convex constraints. Master’s thesis, University of Melbourne, Department of Computer Science and Software Engineering (2002)Google Scholar
  36. 36.
    García de la Banda, M.J., Mariott, K., Stuckey, P., Søndergaard, H.: Differential methods in logic programming analysis. Journal of Logic Programming 35(1), 1–38 (1998)MATHCrossRefMathSciNetGoogle Scholar
  37. 37.
    Genaim, S., Codish, M.: Inferring termination conditions for logic programs using backwards analysis. In: Nieuwenhuis, R., Voronkov, A. (eds.) LPAR 2001. LNCS (LNAI), vol. 2250, pp. 685–694. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  38. 38.
    Gori, R.: An abstract interpretation approach to termination of logic programs. In: Parigot, M., Voronkov, A. (eds.) LPAR 2000. LNCS (LNAI), vol. 1955, pp. 362–380. 1955, Heidelberg (2000)CrossRefGoogle Scholar
  39. 39.
    Graham, R.L.: Rudiments of Ramsey theory. Regional conference series in mathematics, vol. 45. American Mathematical Society, Providence (1980)Google Scholar
  40. 40.
    Krishna Rao, M., Kapur, D., Shyamansundar, R.: Transformational methology for proving termination of logic programs. Journal of Logic Programming 34, 1–41 (1998)MATHCrossRefMathSciNetGoogle Scholar
  41. 41.
    Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The Size-Change Principle for Program Termination. In: ACM Symposium on Principles of Programming Languages 2001, pp. 81–92 (2001)Google Scholar
  42. 42.
    Lindenstrauss, N.: Homepage, http://www.cs.huji.ac.il/~naomil
  43. 43.
    Lindenstrauss, N., Sagiv, Y.: Checking Termination of Queries to Logic Programs (1996), http://www.cs.huji.ac.il/~~naomil/
  44. 44.
    Lindenstrauss, N., Sagiv, Y.: Automatic Termination Analysis of Logic Programs. In: Naish, L. (ed.) Proceedings of the 14th International Conference on Logic Programming, pp. 63–77. MIT Press, Cambridge (1997)Google Scholar
  45. 45.
    N. Lindenstrauss and Y. Sagiv. Automatic Termination Analysis of Logic Programs — version with Appendix. http://www.cs.huji.ac.il/~naomil/ Google Scholar
  46. 46.
    N. Lindenstrauss, Y. Sagiv and A. Serebrenik. TermiLog: A System for Checking Termination of Queries to Logic Programs. In Computer Aided Verification, 9th International Conference, ed. O. Grumbach, LNCS 1254, 63–77, Springer Verlag, 1997. Google Scholar
  47. 47.
    Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: Unfolding the Mystery of Mergesort. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, pp. 206–225. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  48. 48.
    Lloyd, J.W.: Foundations of Logic Programming, 2nd edn. Springer, Heidelberg (1987)MATHGoogle Scholar
  49. 49.
    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
  50. 50.
    Mesnard, F., Bagnara, R.: cTI: A constraint-based termination inference tool for ISO-Prolog. In: TPLP (2004) (to appear)Google Scholar
  51. 51.
    Mesnard, F., Neumerkel, U.: Applying static analysis techniques for inferring termination conditions of logic programs. In: Cousot, P. (ed.) SAS 2001. LNCS, vol. 2126, pp. 93–110. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  52. 52.
    Mesnard, F., Ruggieri, S.: On proving left termination of constraint logic programs. ACM Transactions on Computational Logic 4(2), 207–259 (2003)CrossRefMathSciNetGoogle Scholar
  53. 53.
    Muthukumar, K., Bueno, F., Garc´ıa de la Banda, M.J., Hermenegildo, M.V.: Automatic compile-time parallelization of logic programs for restricted, goal level, independent and parallelism. Journal of Logic Programming 38(2), 165–218 (1999)MATHCrossRefMathSciNetGoogle Scholar
  54. 54.
    Nilsson, N.J.: Principles of Artificial Intelligence. Tioga Publishing Company (1980)Google Scholar
  55. 55.
    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
  56. 56.
    O’Keefe, R.A.: The Craft of Prolog. MIT Press, Cambridge (1990)Google Scholar
  57. 57.
    Pedreschi, D., Ruggieri, S., Smaus, J.-G.: Classes of terminating logic programs. Theory and Practice of Logic Programming 2(3), 369–418 (2002)MATHCrossRefMathSciNetGoogle Scholar
  58. 58.
    Plümer, L.: Termination Proofs for Logic Programs. LNCS (LNAI), vol. 446. Springer, Heidelberg (1990)MATHGoogle Scholar
  59. 59.
    Plümer, L.: Automatic Termination Proofs for Prolog Programs Operating on Nonground Terms. In: International Logic Programming Symposium, MIT Press, Cambridge (1991)Google Scholar
  60. 60.
    Ramakrishnan, R., Bancilhon, F., Silberschatz, A.: Safety of recursive Horn clauses with infinite relations. In: Proceedings of the ACM SIGACT-SIGMODSIGART Symposium on Principles of Database Systems (1987)Google Scholar
  61. 61.
    Ramkumar, B., Kalé, L.V.: Compiled execution of the reduce-OR process model on multiprocessors. In: Lusk, E.L., Overbeek, R.A. (eds.) Logic Programming, Proceedings of the North American Conference, pp. 313–331. MIT Press, Cambridge (1989)Google Scholar
  62. 62.
    Ramsey, F.P.: On a Problem of Formal Logic. Proc. of London Math. Soc. 30, 264–286 (1928)CrossRefGoogle Scholar
  63. 63.
    Reddy, U.S.: Transformation of logic programs into functional programs. In: Proceedings of the 1984 International Conference on Logic Programming, pp. 187–196. IEEE-CS, Los Alamitos (1984)Google Scholar
  64. 64.
    Ruggieri, S.: Decidability of logic program semantics and application to testing. Journal of Logic Programming 46(1-2), 103–137 (2000)MATHCrossRefMathSciNetGoogle Scholar
  65. 65.
    Ruggieri, S.: ∃-universal termination of logic programs. Theoretical Computer Science 254(1-2), 273–296 (2001)MATHCrossRefMathSciNetGoogle Scholar
  66. 66.
    Sagiv, Y.: A termination test for logic programs. In: International Logic Programming Symposium, MIT Press, Cambridge (1991)Google Scholar
  67. 67.
    Santos Costa, V., Warren, D.H.D., Yang, R.: Andorra-I: A parallel Prolog system that transparently exploits both And- and Or-parallelism. In: Proceedings of the Third ACM SIGPLAN Symposium on Principles & Practice of Parallel Programming (PPOPP), pp. 83–93. ACM Press, New York (1991)CrossRefGoogle Scholar
  68. 68.
    SICStus Prolog User’s Manual. Swedish Institute of Computer ScienceGoogle Scholar
  69. 69.
    Smaus, J.-G.: Modes and Types in Logic Programming. PhD thesis,University of Kent at Canterbury (1999)Google Scholar
  70. 70.
    Smaus, J.-G.: Proving termination of input-consuming logic programs. In: De Schreye, D. (ed.) Proceedings of the International Conference on Logic Programming, pp. 335–349. MIT Press, Cambridge (1999)Google Scholar
  71. 71.
    Sohn, K., Van Gelder, A.: Termination Detection in Logic Programs using Argument Sizes. In: Proceedings of the Tenth ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems, pp. 216–226 (1991)Google Scholar
  72. 72.
    Speirs, C., Somogyi, Z., Søndergaard, H.: Termination Analysis for Mercury. In: Van Hentenryck, P. (ed.) SAS 1997. LNCS, vol. 1302, pp. 157–171. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  73. 73.
    Sterling, L., Shapiro, E.: The Art of Prolog. MIT Press, Cambridge (1986)MATHGoogle Scholar
  74. 74.
  75. 75.
    Tick, E., Banerjee, C.: Performance evaluation of Monaco compiler and runtime kernel. In: Warren, D.S. (ed.) Proceedings of the Tenth International Conference on Logic Programming, pp. 757–773 (1993)Google Scholar
  76. 76.
    Ullman, J.D., Van Gelder, A.: Efficient tests for top-down termination of logical rules. JACM 35(2), 345–373 (1988)CrossRefGoogle Scholar
  77. 77.
    Van Emden, M.H.: An Interpretation Algorithm for Prolog Programs. In: Campbell, J.A. (ed.) Implementations of Prolog (1984)Google Scholar
  78. 78.
    Van Gelder, A.: Deriving constraints among argument sizes in logic programs. Annals of Mathematics and Artificial Intelligence 3, 361–392 (1991)MATHCrossRefMathSciNetGoogle Scholar
  79. 79.
    Van Gelder, A.: Personal communicationGoogle Scholar
  80. 80.
    Vasak, T., Potter, J.: Characterisation of terminating logic programs. In: Proceedings of the 1986 Symposium on Logic Programming, pp. 140–147 (1986)Google Scholar
  81. 81.
    Verschaetse, K.: Static termination analysis for definite Horn clause programs. PhD thesis, Department of Computer Science, K. U. Leuven, Belgium (1992)Google Scholar
  82. 82.
    Verschaetse, K., Decorte, S., De Schreye, D.: Automatic Termination Analysis. In: LOPSTR, pp. 168–183 (1992)Google Scholar
  83. 83.
    Verschaetse, K., De Schreye, D.: Deriving Termination Proofs for Logic Programs, using Abstract Procedures. In: Proc. of the 8th ICLP, pp. 301–315 (1991)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Naomi Lindenstrauss
    • 1
  • Yehoshua Sagiv
    • 1
  • Alexander Serebrenik
    • 2
  1. 1.School of Computer Science and EngineeringThe Hebrew UniversityJerusalemIsrael
  2. 2.École Polytechnique (STIX)Palaiseau CedexFrance

Personalised recommendations