22,771 research outputs found
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
Proving Correctness and Completeness of Normal Programs - a Declarative Approach
We advocate a declarative approach to proving properties of logic programs.
Total correctness can be separated into correctness, completeness and clean
termination; the latter includes non-floundering. Only clean termination
depends on the operational semantics, in particular on the selection rule. We
show how to deal with correctness and completeness in a declarative way,
treating programs only from the logical point of view. Specifications used in
this approach are interpretations (or theories). We point out that
specifications for correctness may differ from those for completeness, as
usually there are answers which are neither considered erroneous nor required
to be computed.
We present proof methods for correctness and completeness for definite
programs and generalize them to normal programs. For normal programs we use the
3-valued completion semantics; this is a standard semantics corresponding to
negation as finite failure. The proof methods employ solely the classical
2-valued logic. We use a 2-valued characterization of the 3-valued completion
semantics which may be of separate interest. The presented methods are compared
with an approach based on operational semantics. We also employ the ideas of
this work to generalize a known method of proving termination of normal
programs.Comment: To appear in Theory and Practice of Logic Programming (TPLP). 44
page
Logic + control: An example
We present a Prolog program - the SAT solver of Howe and King - as a (pure) logic program with added control. The control consists of a selection rule (delays of Prolog) and pruning the search space. We construct the logic program together with proofs of its correctness and completeness, with respect to a formal specification. Correctness and termination of the logic program are inherited by the Prolog program; the change of selection rule preserves completeness. We prove
that completeness is also preserved by one case of pruning; for the other an informal justification is presented.
For proving correctness we use a method, which should be well known but is often neglected. For proving program completeness we employ a new, simpler variant of a method published previously. We point out usefulness of approximate specifications. We argue that the proof
methods correspond to natural declarative thinking about programs, and that they can be used, formally or informally, in every-day programming
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
Quantum Hoare logic with classical variables
Hoare logic provides a syntax-oriented method to reason about program
correctness, and has been proven effective in the verification of classical and
probabilistic programs. Existing proposals for quantum Hoare logic either lack
completeness or support only quantum variables, thus limiting their capability
in practical use.
In this paper, we propose a quantum Hoare logic for a simple while language
which involves both classical and quantum variables. Its soundness and relative
completeness are proven for both partial and total correctness of quantum
programs written in the language. Remarkably, with novel definitions of
classical-quantum states and corresponding assertions, the logic system is
quite simple and similar to the traditional Hoare logic for classical programs.
Furthermore, to simplify reasoning in real applications, auxiliary proof rules
are provided which support the introduction of disjunction and quantifiers in
the classical part of assertions, and of super-operator application and
superposition in the quantum part. Finally, a series of practical quantum
algorithms, in particular the whole algorithm of Shor's factorisation, are
formally verified to show the effectiveness of the logic
Labelled variables in logic programming: Foundations
none4noWe define a new notion of truth for logic programs extended with labelled variables, interpreted in non-Herbrand domains. There, usual terms maintain their Herbrand interpretations, whereas diverse domain-specific computational models depending on the local situation of the computing device can be expressed via suitably-tailored labelled models. After some introductory examples, we define the theoretical model for labelled variables in logic programming (LVLP). Then, we present both the fixpoint and the operational semantics, and discuss their correctness and completeness, as well as their equivalence.openRoberta Calegari; Enrico Denti; Agostino Dovier; Andrea OmiciniRoberta Calegari; Enrico Denti; Agostino Dovier; Andrea Omicin
- …