3,777 research outputs found
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 which components of traditional termination
analysis are combined with backwards analysis to obtain an analyser for
termination inference. We identify a condition on the components of the
analyser which guarantees that termination inference will infer all modes which
can be checked to terminate. The application of this methodology to enhance a
traditional termination analyser to perform also termination inference is
demonstrated
Inference of termination conditions for numerical loops in Prolog
We present a new approach to termination analysis of numerical computations
in logic programs. Traditional approaches fail to analyse them due to non
well-foundedness of the integers. We present a technique that allows overcoming
these difficulties. Our approach is based on transforming a program in a way
that allows integrating and extending techniques originally developed for
analysis of numerical computations in the framework of query-mapping pairs with
the well-known framework of acceptability. Such an integration not only
contributes to the understanding of termination behaviour of numerical
computations, but also allows us to perform a correct analysis of such
computations automatically, by extending previous work on a constraint-based
approach to termination. Finally, we discuss possible extensions of the
technique, including incorporating general term orderings.Comment: To appear in Theory and Practice of Logic Programming. To appear in
Theory and Practice of Logic Programmin
A Backward Analysis for Constraint Logic Programs
One recurring problem in program development is that of understanding how to
re-use code developed by a third party. In the context of (constraint) logic
programming, part of this problem reduces to figuring out how to query a
program. If the logic program does not come with any documentation, then the
programmer is forced to either experiment with queries in an ad hoc fashion or
trace the control-flow of the program (backward) to infer the modes in which a
predicate must be called so as to avoid an instantiation error. This paper
presents an abstract interpretation scheme that automates the latter technique.
The analysis presented in this paper can infer moding properties which if
satisfied by the initial query, come with the guarantee that the program and
query can never generate any moding or instantiation errors. Other applications
of the analysis are discussed. The paper explains how abstract domains with
certain computational properties (they condense) can be used to trace
control-flow backward (right-to-left) to infer useful properties of initial
queries. A correctness argument is presented and an implementation is reported.Comment: 32 page
Non-Termination Inference of Logic Programs
We present a static analysis technique for non-termination inference of logic
programs. Our framework relies on an extension of the subsumption test, where
some specific argument positions can be instantiated while others are
generalized. We give syntactic criteria to statically identify such argument
positions from the text of a program. Atomic left looping queries are generated
bottom-up from selected subsets of the binary unfoldings of the program of
interest. We propose a set of correct algorithms for automating the approach.
Then, non-termination inference is tailored to attempt proofs of optimality of
left termination conditions computed by a termination inference tool. An
experimental evaluation is reported. When termination and non-termination
analysis produce complementary results for a logic procedure, then with respect
to the leftmost selection rule and the language used to describe sets of atomic
queries, each analysis is optimal and together, they induce a characterization
of the operational behavior of the logic procedure.Comment: Long version (algorithms and proofs included) of a paper submitted to
TOPLA
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]
- …