## Reasoning about Termination of Pure Prolog Programs (1993)

Venue: | Information and Computation |

Citations: | 126 - 14 self |

### BibTeX

@ARTICLE{Apt93reasoningabout,

author = {Krzysztof R. Apt and Dino Pedreschi},

title = {Reasoning about Termination of Pure Prolog Programs},

journal = {Information and Computation},

year = {1993},

volume = {106},

pages = {109--157}

}

### Years of Citing Articles

### OpenURL

### Abstract

We provide a theoretical basis for studying termination of (general) logic programs with the Prolog selection rule. To this end we study the class of left terminating programs. These are logic programs that terminate with the Prolog selection rule for all ground goals. We offer a characterization of left terminating positive programs by means of the notion of an acceptable program that provides us with a practical method of proving termination. The method is illustrated by giving a simple proof of termination of the quicksort program for the desired class of goals. Then we extend this approach to the class of general logic programs by modifying the concept of acceptability. We prove that acceptable general programs are left terminating. The converse implication does not hold but we show that under the assumption of nonfloundering from ground goals every left terminating general program is acceptable. Finally, we prove that various ways of defining semantics coincide for acceptable gen...

### Citations

1921 |
Foundations of Logic Programming
- Lloyd
- 1987
(Show Context)
Citation Context ...e SLDNFresolution with the leftmost selection rule. Finally, in Section 7 we assess the proposed proof method and discuss related work. Preliminaries We use standard notation and terminology of Lloyd =-=[Llo87]-=- or Apt [Apt90] with the exception that general logic programs are called in Lloyd [Llo87] normal logic programs. In particular, we use the following abbreviations for a (general) logic program P (or ... |

762 |
Introduction to Metamathematics
- Kleene
(Show Context)
Citation Context ...starting at ? in the standard way and denote them by T # ff. We use below Fitting's approach to the semantics of general programs. Fitting [Fit85] uses a 3-valued logic based on a logic due to Kleene =-=[Kle52]-=-. In Kleene's logic there are three truth values: t for true, f for false and u for undefined. A Herbrand interpretation for this logic (called a 3-valued Herbrand interpretation) is defined as a pair... |

644 |
The art of prolog
- Sterling, Shapiro
- 1986
(Show Context)
Citation Context ... restriction to such programs leads to a simple to use method of proving termination that is applicable to an overwhelming class of pure Prolog programs considered in the book of Sterling and Shapiro =-=[SS86]-=-. To show that a program exhibits a proper termination behaviour we first show that it is left terminating and then that it terminates for certain types of non-ground inputs. Our method of showing the... |

634 |
Towards a theory of declarative knowledge
- Apt, Blair, et al.
- 1988
(Show Context)
Citation Context ...I and I is total, then I + is the unique fixpoint of T P . Proof. By Corollary 6.3. 2 The fixpoints of the operator T P are of interest for us because of the following result of Apt, Blair and Walker =-=[ABW88]. The-=-orem 6.5 A Herbrand interpretation I is a model of comp(P ) iff it is a fixpoint of T P . 2 Corollary 6.6 If I is a Herbrand model of comp(P ) then \Phi P " ! ` (I; B P \Gamma I). Proof. Suppose ... |

610 |
Assigning meaning to programs
- Floyd
- 1967
(Show Context)
Citation Context ...ethod of proving left termination will allow us to identify for each program such a class of non-ground goals. Let us consider now how to prove that a program is left terminating. Starting from Floyd =-=[Flo67]-=- the classical proofs of program termination have been based on the use of well-founded orderings. This approach has been successfully used in the area of logic programming (see e.g. Bezem [Bez89], Ca... |

469 | Termination of rewriting
- Dershowitz
- 1987
(Show Context)
Citation Context ... a for b 2 Z; where X;Y;Z are finite multisets of elements of W , and then define the multiset ordering over (W; !) as the transitive closure of the relation OE. It is well-known (see e.g. Dershowitz =-=[Der87]-=-) that multiset ordering over a well-founded ordering is again well-founded. Thus it can be iterated while maintaining well-foundedness. What we need in our case is two fold iteration. We start with t... |

435 |
Logic Programming
- Apt
- 1990
(Show Context)
Citation Context ...on with the leftmost selection rule. Finally, in Section 7 we assess the proposed proof method and discuss related work. Preliminaries We use standard notation and terminology of Lloyd [Llo87] or Apt =-=[Apt90]-=- with the exception that general logic programs are called in Lloyd [Llo87] normal logic programs. In particular, we use the following abbreviations for a (general) logic program P (or simply a (gener... |

262 |
Non-monotonic Logic and Temporal Projection
- Hanks, McDermott
- 1987
(Show Context)
Citation Context ...programs. Indeed, in Apt and Bezem [AB90] the usefulness of this concept was demonstrated by proving termination of a general program which formalizes the Yale Shooting problem of Hanks and McDermott =-=[HM87]-=-. However, as we shall see in Section 5 of this paper, there exist natural left terminating general programs which are not acyclic. Thus the concept of acyclicity is of limited applicability when cons... |

176 |
Acyclic programs, in
- Apt, Bezem
- 1990
(Show Context)
Citation Context ... C to any literals occurring to the right of :A in the body of C. The concept of an acceptable general program also generalizes that of an acyclic program studied in Cavedon [Cav89] and Apt and Bezem =-=[AB90]-=-. Finally, note that this concept calls for the use of a model of comp(P \Gamma ) and thus assumes consistency of comp(P \Gamma ). This seems to indicate that its applicability is limited. However, we... |

75 |
Termination Proofs for Logic Programs
- Plumer
- 1990
(Show Context)
Citation Context ... generated, and then it is verified if they indeed hold. Termination of the programs studied in the Section 3 and 5 is beyond the scope of their method. This approach was improved in Plumer [Plu90b], =-=[Plu90a]-=-, who allowed a more general form of the inequalities and the way sizes of the arguments are measured. This resulted in a more powerful method. The quicksort program studied in Section 3 can be handle... |

68 |
Efficient tests for top-down termination of logical rules
- Ullman
- 1988
(Show Context)
Citation Context ...tting: j[xjxs]j = jxsj + 1; jf(x 1 ; : : :; x n )j = 0 if f 6= [ : j : ]: It is useful to note that for a list xs, jxsj equals its length. The function j j is called listsize in Ullman and Van Gelder =-=[UvG88]-=-. Consider now the following program QS (for quicksort): (qs 1 ) qs([], []) /. (qs 2 ) qs([X --- Xs], Ys) / f(X, Xs, X1s, X2s), qs(X1s, Y1s), qs(X2s, Y2s), a(Y1s, [X --- Y2s], Ys). (f 1 ) f(X, [], [],... |

51 |
Studies in pure Prolog: Termination
- Apt, Pedreschi
- 1990
(Show Context)
Citation Context ...egration). Second author's work was partly supported by ESPRIT Basic Research Action 3012 (Compulog) and by the Italian National Research Council -- C.N.R.. This paper is based on our previous papers =-=[AP90]-=- and [AP91]. 1 Introduction Background Prolog is a programming language based on logic programming. However, the use of a fixed selection rule combined with the depth first search in the resulting sea... |

48 |
Characterizing termination of logic programs with level mappings
- Bezem
- 1989
(Show Context)
Citation Context ... Prolog programs from the point of view of termination it is useful to notice that some programs terminate for all ground goals for all selection rules. Such programs are extensively studied in Bezem =-=[Bez89]-=- where they are called terminating programs. These are usually programs whose termination depends on a simple reduction in one or more arguments. Examples of terminating programs are append, member, N... |

44 |
Proving termination of logic programs by exploiting term properties. TAPSOFT91
- Bossi, Cocco, et al.
- 1991
(Show Context)
Citation Context ...t j j be a level mapping. A goal /A is called rigid w.r.t. j j if j j is constant on the set [A] of ground instances of A. This definition is inspired by the considerations of Bossi, Cocco and Fabris =-=[BCF91]-=- where level mappings applied to non-ground atoms are studied. Obviously, rigid goals are bounded. The following lemma is an analogue of Lemma 2.5 of Bezem [Bez89]. Lemma 2.12 Let P be a program that ... |

40 |
Automatic Generation of Mode Declarations for Prolog Programs (draft
- Mellish
- 1981
(Show Context)
Citation Context ...sing pure Prolog. The same remark applies to general non-floundering programs. For a further analysis of left terminating programs we first introduce the following notions, essentially due to Mellish =-=[Mel81]-=-. Given an n-ary relation symbol p, by a mode for p we mean a function d p from f1; : : :; ng to the set f+; \Gammag. We write d p in a more suggestive form p(d p (1); : : :; d p (n)). Modes indicate ... |

36 |
On the SUP-INF method for proving Presburger formulas
- Shostak
- 1977
(Show Context)
Citation Context ... be reduced to checking the validity of universal formulas in an extension of Presburger arithmetic by the min and max operators. The validity problem for such formulas is decidable. In fact, Shostak =-=[Sho77]-=- presented for this class a decision algorithm which is exponential. This is substantially lower than the complexity of the decision procedure for Presburger arithmetic. To illustrate this point, cons... |

33 |
Proving termination in general Prolog programs
- Apt, Pedreschi
- 1991
(Show Context)
Citation Context ...Second author's work was partly supported by ESPRIT Basic Research Action 3012 (Compulog) and by the Italian National Research Council -- C.N.R.. This paper is based on our previous papers [AP90] and =-=[AP91]-=-. 1 Introduction Background Prolog is a programming language based on logic programming. However, the use of a fixed selection rule combined with the depth first search in the resulting search trees m... |

29 |
Continuity, consistency and completeness properties for logic programs
- Cavedon
- 1989
(Show Context)
Citation Context ... usually of the form "generate and test" or "divide and conquer". In this paper we provide a framework to study left terminating programs. To this end we refine the ideas of Bezem =-=[Bez89] and Cavedon [Cav89]-=- and use their concept of a level mapping. This is a function assigning natural numbers to ground atoms. Our main tool is the concept of an acceptable program. Intuitively, a program P is acceptable i... |

28 |
Proving Termination Properties of Prolog Programs: A Semantic Approach
- Baudinet
- 1992
(Show Context)
Citation Context ...Gg no infinite LD-derivation to the left of the leftmost successful derivation exists, and is universally terminating w.r.t. the leftmost selection rule if the LD-tree for P [ fGg is finite. Baudinet =-=[Bau88]-=- presented a method for proving existential termination of (general) Prolog program in which with each program a system of equations is associated whose least fixpoint is the meaning of the program. B... |

24 |
Characterization of terminating logic programs
- Vasak, Potter
- 1986
(Show Context)
Citation Context ...ntroduced. Related work Of course the subject of termination of Prolog programs has been studied by others. Without aiming at completeness we mention here the following related work. Vasak and Potter =-=[VP86]-=- identified two forms of termination for logic programs -- existential and universal one and characterized the class of universal terminating goals for a given program with selected selection rules. H... |

23 |
A Kripke-Kleene semantics for general logic programs
- Fitting
- 1985
(Show Context)
Citation Context ...complete lattice) we define the downward ordinal powers of T starting at ? in the standard way and denote them by T # ff. We use below Fitting's approach to the semantics of general programs. Fitting =-=[Fit85]-=- uses a 3-valued logic based on a logic due to Kleene [Kle52]. In Kleene's logic there are three truth values: t for true, f for false and u for undefined. A Herbrand interpretation for this logic (ca... |

22 |
Termination proofs for logic programs based on predicate inequalities
- PLÜMER
- 1990
(Show Context)
Citation Context ...ymbols are generated, and then it is verified if they indeed hold. Termination of the programs studied in the Section 3 and 5 is beyond the scope of their method. This approach was improved in Plumer =-=[Plu90b]-=-, [Plu90a], who allowed a more general form of the inequalities and the way sizes of the arguments are measured. This resulted in a more powerful method. The quicksort program studied in Section 3 can... |

17 |
A new sldnf-tree
- Martelli, Tricomi
- 1992
(Show Context)
Citation Context ...ation for fp / :pg [ f / pg diverges because the goal / p is resolved to / :p and the subsequent construction of the subsidiary LDNF-tree for fp / :pg [ f / pg diverges. Recently Martelli and Tricomi =-=[MT92]-=-, and later Apt and Doets [AD92], proposed two formalizations of the above revision of the (S)LDNF-resolution. Summarizing, by termination of a general Prolog program we actually mean termination of t... |

10 | A methodology for proving termination of logic programs
- Wang, Shyamasundar
- 1994
(Show Context)
Citation Context ...ctural induction. In her proposal negation is treated indirectly by dealing with termination in presence of the cut operator using which negation can be simulated. Recently, Bal Wang and Shyamasundar =-=[BS91]-=- provided a method of proving universal termination based on a concept of so-called U-graph in which the relevant connections through unification between the atoms of the goal and of the program are r... |

8 | A Theory of First-Order Built-In’s of Prolog
- Apt, Marchiori, et al.
- 1992
(Show Context)
Citation Context ...-in's considerably complicate the matters and call for new insights. Termination of programs that use first order built-in's (so var, nonvar, ground etc.) is studied in Apt, Marchiori and Palamidessi =-=[APM92]-=- where for this purpose a new declarative semantics based on non-ground atoms is introduced. Related work Of course the subject of termination of Prolog programs has been studied by others. Without ai... |

4 |
A new definition of SLDNF-resolution. ILLC Prepublication Series CT-92-03
- Apt, Doets
- 1992
(Show Context)
Citation Context ...rges because the goal / p is resolved to / :p and the subsequent construction of the subsidiary LDNF-tree for fp / :pg [ f / pg diverges. Recently Martelli and Tricomi [MT92], and later Apt and Doets =-=[AD92]-=-, proposed two formalizations of the above revision of the (S)LDNF-resolution. Summarizing, by termination of a general Prolog program we actually mean termination of the underlying interpreter. By ch... |

1 |
Partial automation of termination proofs for Prolog programs
- Pedreschi, Pieramico
- 1992
(Show Context)
Citation Context ...wing formula of Presburger arithmetic: x 1 + x 2 + 1 = xsx 1 + x 2 = z ) x + 1 ? z + 1: This approach to partial automation of the termination proofs is described in detail in Pedreschi and Pieramico =-=[PP92]-=-. In particular, they implemented the above sketched procedure for checking left termination and verified mechanically that the quicksort program QS is left terminating. Finally, let us mention that i... |