2,122 research outputs found
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]
Intensional and Extensional Semantics of Bounded and Unbounded Nondeterminism
We give extensional and intensional characterizations of nondeterministic
functional programs: as structure preserving functions between biorders, and as
nondeterministic sequential algorithms on ordered concrete data structures
which compute them. A fundamental result establishes that the extensional and
intensional representations of non-deterministic programs are equivalent, by
showing how to construct a unique sequential algorithm which computes a given
monotone and stable function, and describing the conditions on sequential
algorithms which correspond to continuity with respect to each order.
We illustrate by defining may and must-testing denotational semantics for a
sequential functional language with bounded and unbounded choice operators. We
prove that these are computationally adequate, despite the non-continuity of
the must-testing semantics of unbounded nondeterminism. In the bounded case, we
prove that our continuous models are fully abstract with respect to may and
must-testing by identifying a simple universal type, which may also form the
basis for models of the untyped lambda-calculus. In the unbounded case we
observe that our model contains computable functions which are not denoted by
terms, by identifying a further "weak continuity" property of the definable
elements, and use this to establish that it is not fully abstract
Synthesis of Strategies Using the Hoare Logic of Angelic and Demonic Nondeterminism
We study a propositional variant of Hoare logic that can be used for
reasoning about programs that exhibit both angelic and demonic nondeterminism.
We work in an uninterpreted setting, where the meaning of the atomic actions is
specified axiomatically using hypotheses of a certain form. Our logical
formalism is entirely compositional and it subsumes the non-compositional
formalism of safety games on finite graphs. We present sound and complete
Hoare-style calculi that are useful for establishing partial-correctness
assertions, as well as for synthesizing implementations. The computational
complexity of the Hoare theory of dual nondeterminism is investigated using
operational models, and it is shown that the theory is complete for exponential
time
Stochastic Invariants for Probabilistic Termination
Termination is one of the basic liveness properties, and we study the
termination problem for probabilistic programs with real-valued variables.
Previous works focused on the qualitative problem that asks whether an input
program terminates with probability~1 (almost-sure termination). A powerful
approach for this qualitative problem is the notion of ranking supermartingales
with respect to a given set of invariants. The quantitative problem
(probabilistic termination) asks for bounds on the termination probability. A
fundamental and conceptual drawback of the existing approaches to address
probabilistic termination is that even though the supermartingales consider the
probabilistic behavior of the programs, the invariants are obtained completely
ignoring the probabilistic aspect.
In this work we address the probabilistic termination problem for
linear-arithmetic probabilistic programs with nondeterminism. We define the
notion of {\em stochastic invariants}, which are constraints along with a
probability bound that the constraints hold. We introduce a concept of {\em
repulsing supermartingales}. First, we show that repulsing supermartingales can
be used to obtain bounds on the probability of the stochastic invariants.
Second, we show the effectiveness of repulsing supermartingales in the
following three ways: (1)~With a combination of ranking and repulsing
supermartingales we can compute lower bounds on the probability of termination;
(2)~repulsing supermartingales provide witnesses for refutation of almost-sure
termination; and (3)~with a combination of ranking and repulsing
supermartingales we can establish persistence properties of probabilistic
programs.
We also present results on related computational problems and an experimental
evaluation of our approach on academic examples.Comment: Full version of a paper published at POPL 2017. 20 page
Exploring the Boundaries of Monad Tensorability on Set
We study a composition operation on monads, equivalently presented as large
equational theories. Specifically, we discuss the existence of tensors, which
are combinations of theories that impose mutual commutation of the operations
from the component theories. As such, they extend the sum of two theories,
which is just their unrestrained combination. Tensors of theories arise in
several contexts; in particular, in the semantics of programming languages, the
monad transformer for global state is given by a tensor. We present two main
results: we show that the tensor of two monads need not in general exist by
presenting two counterexamples, one of them involving finite powerset (i.e. the
theory of join semilattices); this solves a somewhat long-standing open
problem, and contrasts with recent results that had ruled out previously
expected counterexamples. On the other hand, we show that tensors with bounded
powerset monads do exist from countable powerset upwards
A New Proof Rule for Almost-Sure Termination
An important question for a probabilistic program is whether the probability
mass of all its diverging runs is zero, that is that it terminates "almost
surely". Proving that can be hard, and this paper presents a new method for
doing so; it is expressed in a program logic, and so applies directly to source
code. The programs may contain both probabilistic- and demonic choice, and the
probabilistic choices may depend on the current state.
As do other researchers, we use variant functions (a.k.a.
"super-martingales") that are real-valued and probabilistically might decrease
on each loop iteration; but our key innovation is that the amount as well as
the probability of the decrease are parametric.
We prove the soundness of the new rule, indicate where its applicability goes
beyond existing rules, and explain its connection to classical results on
denumerable (non-demonic) Markov chains.Comment: V1 to appear in PoPL18. This version collects some existing text into
new example subsection 5.5 and adds a new example 5.6 and makes further
remarks about uncountable branching. The new example 5.6 relates to work on
lexicographic termination methods, also to appear in PoPL18 [Agrawal et al,
2018
Computable decision making on the reals and other spaces via partiality and nondeterminism
Though many safety-critical software systems use floating point to represent
real-world input and output, programmers usually have idealized versions in
mind that compute with real numbers. Significant deviations from the ideal can
cause errors and jeopardize safety. Some programming systems implement exact
real arithmetic, which resolves this matter but complicates others, such as
decision making. In these systems, it is impossible to compute (total and
deterministic) discrete decisions based on connected spaces such as
. We present programming-language semantics based on constructive
topology with variants allowing nondeterminism and/or partiality. Either
nondeterminism or partiality suffices to allow computable decision making on
connected spaces such as . We then introduce pattern matching on
spaces, a language construct for creating programs on spaces, generalizing
pattern matching in functional programming, where patterns need not represent
decidable predicates and also may overlap or be inexhaustive, giving rise to
nondeterminism or partiality, respectively. Nondeterminism and/or partiality
also yield formal logics for constructing approximate decision procedures. We
implemented these constructs in the Marshall language for exact real
arithmetic.Comment: This is an extended version of a paper due to appear in the
proceedings of the ACM/IEEE Symposium on Logic in Computer Science (LICS) in
July 201
- …