A General Framework for Automatic Termination Analysis of Logic Programs

Abstract. This paper describes a general framework for automatic termination analysis of logic programs, where we understand by “termination” the finiteness of the LD-tree constructed for the program and a given query. A general property of mappings from a certain subset of the branches of an infinite LD-tree into a finite set is proved. From this result several termination theorems are derived, by using different finite sets. The first two are formulated for the predicate dependency and atom dependency graphs. Then a general result for the case of the query-mapping pairs relevant to a program is proved (cf. [29, 21]). The correctness of the TermiLog system described in [22] follows from it. In this system it is not possible to prove termination for programs involving arithmetic predicates, since the usual order for the integers is not well-founded. A new method, which can be easily incorporated in TermiLog or similar systems, is presented, which makes it possible to prove termination for programs involving arithmetic predicates. It is based on combining a finite abstraction of the integers with the technique of the query-mapping pairs, and is essentially capable of dividing a termination proof into several cases, such that a simple termination function suffices for each case. Finally several possible extensions are outlined.

[1]  Michael Codish,et al.  A Semantic Basis for the Termination Analysis of Logic Programs , 1999, J. Log. Program..

[2]  Patrick Cousot,et al.  Abstract Interpretation and Application to Logic Programs , 1992, J. Log. Program..

[3]  Alexander Serebrenik,et al.  TermiLog: A System for Checking Termination of Queries to Logic Programs , 1997, CAV.

[4]  Jeffrey D. Ullman,et al.  Efficient tests for top-down termination of logical rules , 1988, JACM.

[5]  Andy King,et al.  Inferring Argument Size Relationships with CLP(R) , 1996, LOPSTR.

[6]  Krzysztof R. Apt,et al.  From logic programming to Prolog , 1996, Prentice Hall International series in computer science.

[7]  Juliana Freire,et al.  The XSB Programmer’s Manual , 1800 .

[8]  Krzysztof R. Apt,et al.  Logic Programming , 1990, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[9]  Leon Sterling,et al.  The Art of Prolog , 1987, IEEE Expert.

[10]  Allen Van Gelder,et al.  Deriving constraints among argument sizes in logic programs , 1990, PODS '90.

[11]  Donald E. Knuth Textbook Examples of Recursion , 1991, Artificial and Mathematical Theory of Computation.

[12]  Annalisa Bossi,et al.  Preserving Universal Termination through Unfold/Fold , 1994, ALP.

[13]  Jan Maluszynski,et al.  Directional Types and the Annotation Method , 1997, J. Log. Program..

[14]  Manuel V. Hermenegildo,et al.  Effectiveness of Global Analysis in Strict Independence-Based Automatic Parallelization , 1994, ILPS.

[15]  Richard A. O'Keefe,et al.  The Craft of Prolog , 1990 .

[16]  Nachum Dershowitz,et al.  Orderings for term-rewriting systems , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[17]  Danny De Schreye,et al.  Termination of Logic Programs: The Never-Ending Story , 1994, J. Log. Program..

[18]  Wolfgang Thomas,et al.  Handbook of Theoretical Computer Science, Volume B: Formal Models and Semantics , 1990 .

[19]  Frédéric Mesnard,et al.  CLP(Q) for Proving Interargument Relations , 1992, META.

[20]  Yehoshua Sagiv,et al.  Automatic Termination Analysis of Logic Programs , 1997, ICLP.

[21]  Lutz Plümer Termination Proofs for Logic Programs , 1990, Lecture Notes in Computer Science.

[22]  Yehoshua Sagiv A Termination Test for Logic Programs , 1991, ISLP.

[23]  Alexander Serebrenik,et al.  Unfolding the Mystery of Mergesort , 1997, LOPSTR.

[24]  Yehoshua Sagiv,et al.  Inference of Inequality Constraints in Logic Programs. , 1991, PODS 1991.

[25]  Hisao Tamaki,et al.  Unfold/Fold Transformation of Logic Programs , 1984, ICLP.

[26]  Saumya K. Debray,et al.  A Simple Code Improvement Scheme for Prolog , 1992, J. Log. Program..

[27]  Christian Holzbaur OFAI clp(Q,R) Manual , 1995 .

[28]  Zohar Manna,et al.  PROPERTIES OF PROGRAMS AND PARTIAL FUNCTION LOGIC , 1969 .

[29]  Juliana Freire,et al.  The XSB Programmer's Manual Version 1.7.1 , 1994 .

[30]  Danny De Schreye,et al.  Automatic Inference of Norms: A Missing Link in Automatic Termination Analysis , 1993, ILPS.

[31]  Michael Codish,et al.  Type Dependencies for Logic Programs Using ACI-Unification , 2000, ISTCS.

[32]  J. Lloyd Foundations of Logic Programming , 1984, Symbolic Computation.

[33]  Robert W. Floyd,et al.  Assigning Meanings to Programs , 1993 .

[34]  Nachum Dershowitz Orderings for Term-Rewriting Systems , 1979, FOCS.

[35]  Danny De Schreye,et al.  Deriving of Linear Size Relations by Abstract Interpretation , 1992, PLILP.

[36]  Michael J. Maher,et al.  Constraint Logic Programming: A Survey , 1994, J. Log. Program..

[37]  Danny De Schreye,et al.  Deriving Termination Proofs for Logic Programs, Using Abstract Procedures , 1991, ICLP.

[38]  R. K. Shyamasundar,et al.  Methodology for Proving the Termination of Logic Programs , 1991, STACS.