Skip to main content

Applying Static Analysis Techniques for Inferring Termination Conditions of Logic Programs

  • Conference paper
  • First Online:
Book cover Static Analysis (SAS 2001)

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

Included in the following conference series:

Abstract

We present the implementation of cTI, a system for universal left-termination inference of logic programs.

Termination inference generalizes termination analysis/checking. Traditionally, a termination analyzer tries to prove that a given class of queries terminates. This class must be provided to the system, requiring user annotations. With termination inference such annotations are no longer necessary. Instead, all provably terminating classes to all related predicates are inferred at once.

The architecture of cTI is described1 and some optimizations are discussed. Running times for classical examples from the termination literature in LP and for some middle-sized logic programs are given.

A preliminary version of this paper was presented at the Workshop on Parallelism and Implementation Technology for Constraint Logic Programming Languages (ed. Ines de Castro Dutra), CL’2000, London.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

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

    Article  MathSciNet  Google Scholar 

  2. K. R. Apt and D. Pedreschi. Modular termination proofs for logic and pure Prolog programs. In G. Levi, editor, Advances in Logic Programming Theory, pages 183–229. Oxford University Press, 1994.

    Google Scholar 

  3. K.R. Apt. From Logic Programming to Prolog. Prentice Hall, 1997.

    Google Scholar 

  4. K.R. Apt and D. Pedreschi. Studies in pure Prolog: Termination. In J.W. Lloyd, editor, Proc. of the Symp. in Computational Logic, pages 150–176. Springer, 1990.

    Google Scholar 

  5. B. De Backer and H. Beringer. A clp language handling disjunctions of linear constraints. In Proc. of ICLP’93, pages 550–563. MIT Press, 1993.

    Google Scholar 

  6. F. Benoy and A. King. Inferring argument size relationships with CLP(R). In J. P. Gallagher, editor, Logic Program Synthesis and Transformation, volume 1207 of LNCS. Springer-Verlag, 1997.

    Google Scholar 

  7. F. Bueno, D. Cabeza, M. Carro, M. Hermenegildo, P. López-Garcia, and G. Puebla. The Ciao Prolog System. Reference Manual. The Ciao System Documentation Series-TR CLIP3/97.1, School of Computer Science, Technical University of Madrid (UPM), August 1997. System and on-line version of the manual available at http://clip.dia.fi.upm.es/Software/Ciao/.

  8. F. Bueno, M. Garcia de la Banda, and M. Hermenegildo. Effectiveness of global analysis in strict independence-based automatic program parallelization. In Proc. of the 1994 Intl. Symp. on Logic Programming, pages 320–336. MIT Press, 1994.

    Google Scholar 

  9. M. Carlsson. Boolean constraints in SICStus Prolog. Technical Report T91:09, Swedish Institute of Computer Science, 1994.

    Google Scholar 

  10. M. Codish. Worst-case groundness analysis using positive boolean functions. Journal of Logic Programming, 41(1):125–128, 1999.

    Article  MATH  MathSciNet  Google Scholar 

  11. M. Codish and C. Taboch. A semantics basis for termination analysis of logic programs. Journal of Logic Programming, 41(1):103–123, 1999.

    Article  MATH  MathSciNet  Google Scholar 

  12. S. Colin, F. Mesnard, and A. Rauzy. Constraint logic programming and mu-calculus. ERCIM/COMPULOG Workshop on Constraints, 1997.

    Google Scholar 

  13. P. Cousot and R. Cousot. Abstract interpretation: a unifed lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. of the 4th Symp. on Principles of Programming Languages, pages 238–252. ACM, 1977.

    Google Scholar 

  14. P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. Journal of Logic Programming, 13(2,3):103–179, 1992.

    Article  MATH  MathSciNet  Google Scholar 

  15. P. Cousot and R. Cousot. Comparing the Galois connection and widening/narrowing approaches to abstract interpretation. In Proc. of PLILP’92, volume 631 of LNCS. Springer-Verlag, 1992.

    Google Scholar 

  16. P. Cousot and N. Halbwachs. Automatic discovery of linear restraints among variables of a program. In Proc. of the 5th Symp. on Principles of Programming Languages, pages 84–96. ACM, 1978.

    Google Scholar 

  17. S. K. Debray, P. Lopez-Garcia, M. Hermenegildo, and N.-W. Lin. Estimating the computational cost of logic programs. In B. Le Charlier, editor, LNCS, volume 864, pages 255–265. Springer-Verlag, 1994. Proc. of SAS’94.

    Google Scholar 

  18. S. Decorte. Enhancing the power of termination analysis of logic programs through types and constraints. PhD thesis, Katholieke Universiteit Leuven, 1997.

    Google Scholar 

  19. S. Decorte, D. De Schreye, and H. Vandecasteele. Constraint-based termination analysis of logic programs. ACM Transactions on Programming Languages and Systems, 21(6):1136–1195, 1999.

    Article  Google Scholar 

  20. P. Deransart, A. Ed-Dbali, and L. Cervoni. Prolog: The standard, reference manuel. Springer-Verlag, 1996.

    Google Scholar 

  21. P. Deransart, G. Ferrand, and M. Téguia. NSTO programs (not subject to occur-check). Proc. of the Int. Logic Programming Symp., pages 533–547, 1991.

    Google Scholar 

  22. D. DeSchreye and S. Decorte. Termination of logic programs: the never-ending story. Journal of Logic Programming, 19-20:199–260, 1994.

    Article  MathSciNet  Google Scholar 

  23. M. Handjieva. Stan: a static analyzer for CLP(R) based on abstract interpretation. In R. Cousot and D. Schmidt, editors, Proc. of SAS’96, volume 1145 of LNCS. Springer-Verlag, 1996.

    Google Scholar 

  24. C. Holzbaur. OFAI clp(q,r) manual, edition 1.3.3. Technical Report TR-95-09, Austrian Research Institute, 1995.

    Google Scholar 

  25. J. Jaffar and J-L. Lassez. Constraint logic programming. In Proc. of the 14th Symp. on Principles of Programming Languages, pages 111–119. ACM, 1987.

    Google Scholar 

  26. J. Jaffar and M. J. Maher. Constraint logic programming: a survey. Journal of Logic Programming, 19:503–581, 1994.

    Article  MathSciNet  Google Scholar 

  27. K.-K. Lau, M. Ornaghi, A. Pettorossi, and M. Proietti. Correctness of logic program transformation based on existential termination. In J. W. Lloyd, editor, Proc. of the 1995 Intl. Logic Programming Symp, pages 480–494. MIT Press, 1995.

    Google Scholar 

  28. G. Levi and F. Scozzari. Contributions to a theory of existential termination for definite logic programs. In M. Alpuente and M. I. Sessa, editors, Proc. of the GULP-PRODE’95 Joint Conf. on Declarative Programming, pages 631–641, 1995.

    Google Scholar 

  29. N. Lindenstrauss and Y. Sagiv. Automatic termination analysis of logic programs. In L. Naish, editor, Proc. of the 14th Intl. Conf. on Logic Programming, pages 63–77. MIT Press, 1997.

    Google Scholar 

  30. N. Lindenstrauss, Y. Sagiv, and A. Serebrenik. Unfolding the mystery of mergesort. In N. Fuchs, editor, Proc. of LOPSTR’97, volume 1463 of LNCS. Springer-Verlag, 1998.

    Google Scholar 

  31. J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, 1987.

    Google Scholar 

  32. M. Marchiori. Proving existential termination of normal logic programs. In Proc. of AMAST, volume 1101 of LNCS, pages 375–390, 1996.

    Google Scholar 

  33. F. Mesnard. Inferring left-terminating classes of queries for constraint logic programs by means of approximations. In M. J. Maher, editor, Proc. of the 1996 Joint Intl. Conf. and Symp. on Logic Programming, pages 7–21. MIT Press, 1996.

    Google Scholar 

  34. F. Mesnard. Entailment and projection for CLP(B) and CLP(Q) in SICStus Prolog. 1st Intl. Workshop on Constraint Reasoning for Constraint Programming, 1997.

    Google Scholar 

  35. F. Mesnard and S. Ruggieri. On proving left termination of constraint logic programs. Technical report, Université de La Réunion, 2001. Submitted for publication.

    Google Scholar 

  36. U. Neumerkel. GUPU: A Prolog course environment and its programming methodology. In M. Maher, editor, Proc. of JICSLP’96, page 549. MIT Press, 1996. http://www.complang.tuwien.ac.at/ulrich/gupu/.

  37. L. Plümer. Termination proofs for logic programs. LNAI, 446, 1990.

    Google Scholar 

  38. S. Ruggieri. Verification and Validation of Logic Programs. PhD thesis, Università di Pisa, 1999.

    Google Scholar 

  39. H. Sağlam. A Toolkit for Static Analysis of Constraint Logic Programs. PhD thesis, University of Bristol, 1997.

    Google Scholar 

  40. A. Schrijver. Theory of linear and integer programming. Wiley, 1986.

    Google Scholar 

  41. K. Sohn and A. Van Gelder. Termination detection in logic programs using argument sizes. In Proc. of the 1991 Intl. Symp. on Principles of Database Systems, pages 216–226. ACM, 1991.

    Google Scholar 

  42. Z. Somogyi, F. Henderson, and T. Conway. The execution algorithm of Mercury, an efficient purely declarative Logic Programming language. The Journal of Logic Programming, 29(1–3):17–64, 1996.

    Article  MATH  Google Scholar 

  43. C. Speirs, Z. Somogyi, and H. Søndergaard. Termination analysis for Mercury. In P. van Hentenrick, editor, Proc. of the 1997 Intl. Symp. on Static Analysis, volume 1302 of LNCS. Springer-Verlag, 1997.

    Google Scholar 

  44. J. D. Ullman and A. Van Gelder. Efficient tests for top-down termination of logical rules. Communications of the ACM, pages 345–373, 1988.

    Google Scholar 

  45. T. Vasak and J. Potter. Characterization of terminating logic programs. In Proc. of the 1986 Intl. Symp. on Logic Programming, pages 140–147. IEEE, 1986.

    Google Scholar 

  46. K. Verschaetse. Static termination analysis for definite Horn clause programs. PhD thesis, Dept. Computer Science, K.U. Leuven, 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2001 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mesnard, F., Neumerkel, U. (2001). Applying Static Analysis Techniques for Inferring Termination Conditions of Logic Programs. In: Cousot, P. (eds) Static Analysis. SAS 2001. Lecture Notes in Computer Science, vol 2126. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-47764-0_6

Download citation

  • DOI: https://doi.org/10.1007/3-540-47764-0_6

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-42314-0

  • Online ISBN: 978-3-540-47764-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics