13 research outputs found
On completeness of logic programs
Program correctness (in imperative and functional programming) splits in
logic programming into correctness and completeness. Completeness means that a
program produces all the answers required by its specification. Little work has
been devoted to reasoning about completeness. This paper presents a few
sufficient conditions for completeness of definite programs. We also study
preserving completeness under some cases of pruning of SLD-trees (e.g. due to
using the cut).
We treat logic programming as a declarative paradigm, abstracting from any
operational semantics as far as possible. We argue that the proposed methods
are simple enough to be applied, possibly at an informal level, in practical
Prolog programming. We point out importance of approximate specifications.Comment: 20 page
Correctness and completeness of logic programs
We discuss proving correctness and completeness of definite clause logic
programs. We propose a method for proving completeness, while for proving
correctness we employ a method which should be well known but is often
neglected. Also, we show how to prove completeness and correctness in the
presence of SLD-tree pruning, and point out that approximate specifications
simplify specifications and proofs.
We compare the proof methods to declarative diagnosis (algorithmic
debugging), showing that approximate specifications eliminate a major drawback
of the latter. We argue that our proof methods reflect natural declarative
thinking about programs, and that they can be used, formally or informally, in
every-day programming.Comment: 29 pages, 2 figures; with editorial modifications, small corrections
and extensions. arXiv admin note: text overlap with arXiv:1411.3015. Overlaps
explained in "Related Work" (p. 21
Classes of Terminating Logic Programs
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.Comment: 50 pages. The following mistake was corrected: In figure 5, the first
clause for insert was insert([],X,[X]