Abstract
This article makes two contributions to the work on semantics-based termination analysis for logic programs. The first involves a novel notion of type-based norm where for a given type, a corresponding norm is defined to count in a term the number of subterms of that type. This provides a collection of candidate norms, one for each type defined in the program. The second enables an analyzer to base termination proofs on the combination of several different norms. This is useful when different norms are better suited to justify the termination of different parts of the program. Application of the two contributions together consists in considering the combination of the type-based candidate norms for a given program. This results in a powerful and practical technique. Both contributions have been introduced into a working termination analyzer. Experimentation indicates that they yield state-of-the-art results in a fully automatic analysis tool, improving with respect to methods that do not use both types and combined norms.
- Apt, K. R. 1990. Introduction to logic programming. In Handbook of Theoretical Computer Science, vol. B: Formal Models and Semantics, J. van Leeuwen, ed. Elsevier, Amsterdam, and MIT Press, Cambridge, MA. 495--574. Google Scholar
Digital Library
- Apt, K. R. 1997. From Logic Programming to Prolog. Prentice Hall. Google Scholar
Digital Library
- Apt, K. R. and Pedreschi, D. 1993. Reasoning about termination of pure Prolog programs. Inf. Comput. 106, 1 (Sept.), 109--157. Google Scholar
Digital Library
- Benoy, F. and King, A. 1996. Inferring argument size relationships with CLP(R). In Proceedings of the 6th International Workshop on Logic Program Synthesis and Transformation (LOPSTR). 204--223. Google Scholar
Digital Library
- Bossi, A., Cocco, N., Etalle, S., and Rossi, S. 2002. On modular termination proofs of general logic programs. Theory Pract. Logic Program. 2, 3, 263--291. Google Scholar
Digital Library
- Bossi, A., Cocco, N., and Fabris, M. 1991. Proving termination of logic programs by exploiting term properties. In Proceedings of the International Joint Conference on Theory and Practice of Software Development (TAPSOFT), vol. 2. S. Abramsky and T. Maibaum Eds. Lecture Notes in Computer Science, vol. 494. Springer Verlag, Berlin. 153--180. Google Scholar
Digital Library
- Bossi, A., Cocco, N., and Fabris, M. 1992. Typed norms. In Proceeedings of the 4th European Symposium on Programming (ESOP), B. Krieg-Brückner, ed. Lecture Notes in Computer Science, vol. 582. Springer Verlag, Berlin. 73--92. Google Scholar
Digital Library
- Brodsky, A. and Sagiv, Y. 1989. Inference of monotonicity constraints in Datalog programs. In Proceedings of the 8th ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems. 190--199. Google Scholar
Digital Library
- Bruynooghe, M., Codish, M., Genaim, S., and Vanhoof, W. 2002. Reuse of results in termination analysis of typed logic programs. In Proceedings of the 9th International Static Analysis Symposium, M. Hermenegildo and G. Puebla, eds. Lecture Notes in Computer Science, vol. 2477. Springer Verlag. 477--492. Google Scholar
Digital Library
- Bruynooghe, M., Codish, M., Genaim, S., and Vanhoof, W. 2003. A note on the reuse of the results of a termination analysis based on polymorphic types. Tech. Rep., Katholieke Universiteit Leuven, Department of Computer Science. Rep. CW 383. http://www.cs.kuleuven.ac.be/publicaties/rapporten/cw/CW383.abs.html.Google Scholar
- Bruynooghe, M., Gallagher, J. P., and Van Humbeeck, W. 2005. Inference of well-typings for logic programs with application to termination analysis. In Proceedings of the 12th International Static Analysis Symposium (SAS). C. Hankin and I. Siveroni Eds. Lecture Notes in Computer Science, vol. 3672, Springer Verlag, 35--51. Google Scholar
Digital Library
- Bruynooghe, M., Vanhoof, W., and Codish, M. 2001. Pos(T): Analyzing dependencies in typed logic programs. In Proceedings of the Perspectives of System Informatics, 4th International Andrei Ershov Memorial Conference, (PSI). Lecture Notes in Computer Science, vol. 2244. Springer Verlag. 406--420. Google Scholar
Digital Library
- Codish, M. and Genaim, S. 2003. Proving termination one loop at time. In Proceedings of the 13th International Workshop on Logic Programming Environments, F. Mesnard and A. Serebrenik, eds. http://www.cs.kuleuven.ac.be/publicaties/rapporten/cw/CW371.abs.html.Google Scholar
- Codish, M., Genaim, S., Bruynooghe, M., Gallagher, J., and Vanhoof, W. 2003. One loop at a time. In 6th International Workshop on Termination. http://www.dsic.upv.es/rdp03/wst/proceedings.html.Google Scholar
- Codish, M. and Taboch, C. 1999. A semantic basis for the termination analysis of logic programs. J. Logic Program. 41, 1, 103--123.Google Scholar
Cross Ref
- Cousot, P. and Halbwachs, N. 1978. Automatic discovery of linear restraints among variables of a program. In Proceedings of the 5th Annual ACM Symposium on Principles of Programming Languages. 84--96. Google Scholar
Digital Library
- De Schreye, D. and Verschaetse, K. 1995. Deriving linear size relations for logic programs by abstract interpretation. New Gen. Comput. 13, 2, 117--154.Google Scholar
Cross Ref
- De Schreye, D., Verschaetse, K., and Bruynooghe, M. 1992. A framework for analyzing the termination of definite logic programs with respect to call patterns. In Proceedings of the International Conference on 5th Generation Computer Systems (Japan). 481--488.Google Scholar
- Decorte, S., De Schreye, D., and Fabris, M. 1993. Automatic inference of norms: A missing link in automatic termination analysis. In Logic Programming - Proceedings of the International Symposium (Vancouver, Canada), D. Miller, ed. MIT Press (Cambridge, MA.) 420--436. Google Scholar
Digital Library
- Decorte, S., De Schreye, D., and Fabris, M. 1996. Integrating types in termination analysis. Tech. Rep. CW 222, K.U. Leuven, Department of Computer Science.Google Scholar
- Decorte, S., De Schreye, D., and Fabris, M. 1997. Exploiting the power of typed norms in automatic inference of interargument relations. Tech. Rep. CW 246, K.U. Leuven, Department of Computer Science.Google Scholar
- Dershowitz, N. 1995. 33 examples of termination. In French Spring School of Theoretical Computer Science Advanced Course on Term Rewriting (Font Romeux, France, May), H. Comon and J.-P. Jouannaud, eds. Lecture Notes in Computer Science, vol. 909. Springer Verlag. 16--26. Google Scholar
Digital Library
- Dershowitz, N., Lindenstrauss, N., Sagiv, Y., and Serebrenik, A. 2001. A general framework for automatic termination analysis of logic programs. App. Algebra Eng. Commun. Comput. 12, 1--2, 117--156.Google Scholar
Cross Ref
- Dershowitz, N. and Manna, Z. 1979. Proving termination with multiset orderings. Commun. ACM 22, 465--476. Google Scholar
Digital Library
- Gabbrielli, M. and Giacobazzi, R. 1994. Goal independency and call patterns in the analysis of logic programs. In Proceedings of the 9th ACM Symposium on Applied Computing. ACM Press, New York, 394--399. Google Scholar
Digital Library
- Gallagher, J. and Puebla, G. 2002. Abstract interpretation over non-deterministic finite tree automata for set-based analysis of logic programs. In Proceedings of the Practical Aspects of Declarative Languages, 4th International Symposium (Portland, OR, Jan. 19--20), S. Krishnamurthi and C. R. Ramakrishnan, eds. Lecture Notes in Computer Science, vol. 2257. Springer, Verlag. 243--261. Google Scholar
Digital Library
- Gallagher, J. P. and de Waal, D. A. 1994. Fast and precise regular approximations of logic programs. In Proceedings of the 11th International Conference on Logic Programming (Santa Margherita Ligure, Italy), P. Van Hentenryck, ed. MIT Press, Cambridge, MA. 599--613. Google Scholar
Digital Library
- Genaim, S. and Codish, M. 2005. Inferring termination conditions for logic programs using backwards analysis. Theory Pract. Logic Program. 5, 1--2, 75--91. Google Scholar
Digital Library
- Genaim, S., Codish, M., Gallagher, J., and Lagoon, V. 2002. Combining norms to prove termination. In Proceedings of the 3rd International Workshop on Verification, Model Checking and Abstract Interpretation, A. Cortesi, ed. Lecture Notes in Computer Science, vol. 2294. Springer Verlag. 126--138. Google Scholar
Digital Library
- Graham, R. L., Rothschild, B. L., and Spencer, J. H. 1980. Ramsey Theory. Wiley-Interscience Series in Discrete Mathematics. John Wiley, New York.Google Scholar
- Hill, P. M. and Topor, R. W. 1992. A semantics for typed logic programs. In Types in Logic Programming, F. Pfenning, ed. MIT Press, Cambridge, MA.Google Scholar
- Karr, M. 1976. Affine relationships among variables of a program. Acta Inf. 6, 133--151.Google Scholar
Digital Library
- King, A., Shen, K., and Benoy, F. 1997. Lower-Bound time-complexity analysis of logic programs. In Proceedings of the International Symposium on Logic Programming, J. Maluszynski, ed. MIT Press, Cambridge, MA. 261--276. Google Scholar
Digital Library
- Lagoon, V. 2004. Analysis of typed logic programs. Ph.D. thesis, the University of Melbourne, Australia.Google Scholar
- Lagoon, V., Mesnard, F., and Stuckey, P. 2003. Termination analysis with types is more accurate. In Proceedings of the 19th International Conference on Logic Programming, C. Palamidessi, ed. Lecture Notes in Computer Science, vol. 2916. Springer Verlag. 254--268.Google Scholar
- Lagoon, V. and Stuckey, P. 2001. A framework for analysis of typed logic programs. In Proceedings of the 5th International Symposium on Functional and Logic Programming (FLOPS). Lecture Notes in Computer Science, vol. 2024. Springer Verlag. 296--310. Google Scholar
Digital Library
- Lee, C. S. 2002. Program termination analysis and termination of offline partial evaluation. Ph.D. thesis, University of Western Australia.Google Scholar
- Lee, C. S., Jones, N. D., and Ben-Amram, A. M. 2001. The size-change principle for program termination. ACM SIGPLAN Not. 36, 3, 81--92. In Proceedings of the Symposium on Principles of Programming Languages (POPL). Google Scholar
Digital Library
- Lindenstrauss, N. and Sagiv, Y. 1997. Automatic termination analysis of logic programs. In Proceedings of the 14th International Conference on Logic Programming (Leuven, Belgium), L. Naish, ed. MIT Press, Cambridge, MA. 63--77.Google Scholar
- Lloyd, J. 1987. Foundations of Logic Programming, 2nd ed. Springer-Verlag, Berlin. Google Scholar
Digital Library
- Marriott, K. and Søndergaard, H. 1993. Precise and efficient groundness analysis for logic programs. ACM Lett. Program. Lang. Syst. 2, 1-4, 181--196. Google Scholar
Digital Library
- Martin, J., King, A., and Soper, P. 1996. Typed norms for typed logic programs. In Logic Programming Synthesis and Transformation, 6th International Workshop (LOPSTR), J. P. Gallagher, ed. Lecture Notes in Computer Science, vol. 1207. Springer Verlag, 224--238. Google Scholar
Digital Library
- Mesnard, F. 1996. Inferring left-terminating classes of queries for constraint logic programs. In Proceedings of the Joint International Conference and Syposium on Logic Programming (Bonn, Germany), M. J. Maher, ed. MIT Press, Cambridge, MA. 7--21.Google Scholar
- Mesnard, F. and Neumerkel, U. 2001. Applying static analysis techniques for inferring termination conditions of logic programs. In Static Analysis, 8th International Symposium, P. Cousot, ed. Lecture Notes in Computer Science, vol. Springer Verlag. 2126. 93--110. Google Scholar
Digital Library
- Mycroft, A. and O'Keefe., R. 1984. A polymorphic type system for Prolog. Artif. Intell. 23, 3, 295--307. Google Scholar
Digital Library
- Ramsey, F. 1930. On a problem of formal logic. In Proceedings of the London Mathematical Society, vol. 30. 264--286.Google Scholar
Cross Ref
- Serebrenik, A. and De Schreye, D. 2001. Non-Transformational termination analysis of logic programs, based on general term-orderings. In Logic Based Program Synthesis and Transformation, 10th International Workshop (LOPSTR). (London, UK, Jul. 24--28), K.-K. Lau, ed. Lecture Notes in Computer Science, vol. 2042. Springer Verlag. 69--85. Google Scholar
Digital Library
- Somogyi, Z., Henderson, F., and Conway, T. 1996. The execution algorithm of Mercury, an efficient purely declarative logic programming language. J. Logic Program. 29, 1--3, 17--64.Google Scholar
Cross Ref
- Sterling, L. and Shapiro, E. 1994. The Art of Prolog, 2nd ed. MIT Press, Cambridge, MA. Google Scholar
Digital Library
- Taboch, C., Genaim, S., and Codish, M. 2002. Terminweb: Semantic based termination analyser for logic programs. http://www.cs.bgu.ac.il/~mcodish/TerminWeb.Google Scholar
- Vanhoof, W. and Bruynooghe, M. 2002. When size does matter. In Logic Based Program Synthesis and Transformation, 11th International Workshop (LOPSTR), A. Pettorossi, ed. Lecture Notes in Computer Science, vol. 2372. Springer Verlag. 129--147. Google Scholar
Digital Library
- Vaucheret, C. and Bueno, F. 2002. More precise yet efficient type inference for logic programs. In Proceedings of the 9th International Static Analysis Symposium. M. Hermenegildo and G. Puebla, eds. Lecture Notes in Computer Science, vol. 2477. Springer Verlag. 102--116. Google Scholar
Digital Library
Index Terms
Termination analysis of logic programs through combination of type-based norms
Recommendations
Denotational abstract interpretation of logic programs
Logic-programming languages are based on a principle of separation “logic” and “control.”. This means that they can be given simple model-theoretic semantics without regard to any particular execution mechanism (or proof procedure, viewing execution as ...
Inferring termination conditions for logic programs using backwards analysis
This paper focuses on the inference of modes for which a logic program is guaranteed to terminate. This generalises traditional termination analysis where an analyser tries to verify termination for a specified mode. Our contribution is a methodology in ...
Sharing and groundness dependencies in logic programs
We investigate Jacobs and Langen's Sharing domain, introduced for the analysis of variable sharing in logic programs, and show that it is isomorphic to Marriott and Søndergaard's Pos domain, introduced for the analysis of groundness dependencies. Our ...








Comments