Classes of Terminating Logic Programs

Dino Pedreschi,Salvatore Ruggieri,Jan-Georg Smaus
DOI: https://doi.org/10.48550/arXiv.cs/0106050
2002-07-22
Abstract:Termination of logic programs depends critically on the selection rule, i.e. the rule that determines which atom is selected in each resolution step. In this article, we classify programs (and queries) according to the selection rules for which they terminate. This is a survey and unified view on different approaches in the literature. For each class, we present a sufficient, for most classes even necessary, criterion for determining that a program is in that class. We study six classes: a program strongly terminates if it terminates for all selection rules; a program input terminates if it terminates for selection rules which only select atoms that are sufficiently instantiated in their input positions, so that these arguments do not get instantiated any further by the unification; a program local delay terminates if it terminates for local selection rules which only select atoms that are bounded w.r.t. an appropriate level mapping; a program left-terminates if it terminates for the usual left-to-right selection rule; a program exists-terminates if there exists a selection rule for which it terminates; finally, a program has bounded nondeterminism if it only has finitely many refutations. We propose a semantics-preserving transformation from programs with bounded nondeterminism into strongly terminating programs. Moreover, by unifying different formalisms and making appropriate assumptions, we are able to establish a formal hierarchy between the different classes.
Logic in Computer Science,Programming Languages
What problem does this paper attempt to address?
This paper attempts to solve the problem of termination in logic programs. Specifically, it classifies logic programs and queries according to different selection rules and studies the impact of these selection rules on termination. The following are the main problems and goals of this paper: 1. **Definition and Classification of Termination**: - Termination means that under a given selection rule, all derivations of a logic program and a query are finite. - The paper divides logic programs into several categories, each corresponding to different termination conditions. For example: - **Strong Termination**: Terminates for all selection rules. - **Input Termination**: Terminates only when the selection rule selects atoms that are sufficiently instantiated in the input position. - **Local Delay Termination**: Terminates only when the selection rule selects atoms that are bounded with respect to a level mapping. - **Left - Termination**: Terminates only when using a left - to - right selection rule. - **∃-Termination**: There exists some selection rule that makes it terminate. - **Bounded Nondeterminism**: There are only a finite number of successful derivations. 2. **Impact of Selection Rules**: - Selection rules determine which atom is selected in each resolution step. Different selection rules lead to different termination behaviors. - By introducing multiple selection rules, the paper explores their impact on the termination of logic programs and proposes sufficient or necessary conditions for each category. 3. **Formal Description of Termination**: - The paper provides declarative characterisations for each category of termination, using level mappings and Herbrand models to provide proof obligations. - These characteristics help determine whether a program belongs to a certain termination category and provide a basis for automated termination proofs. 4. **Relationships between Categories**: - The paper establishes formal hierarchical relationships between different termination categories, showing that the termination of some categories is stronger or weaker than that of other categories. - For example, strong termination is the most restrictive category, while bounded nondeterminism is one of the most lenient categories. In summary, the main purpose of this paper is to systematically study and classify the termination of logic programs under different selection rules, provide formal termination characteristics, and establish relationships between different termination categories. This helps in understanding the behavior of logic programs and provides theoretical support for designing efficient logic programming languages and systems.