19,027 research outputs found
A general theorem on the total correctness of programs in a category
AbstractIn [7], we presented a completeness theorem for proving partial correctness of programs in a large class of categories. This theorem generalized a classical result of S.Cook [5] for the language of while-programs.Here we address the total correctness of programs. Again, we use the semantics based on partially additive categories, which was introduced by M.A.Arbib and E.G.Manes [3,4,6]. Our theorems generalize the non categorical results of K.R.Apt [1,2]. They are valid for a large class of partially additive categories, including the category of sets and partial functions and the category of sets and relations, i.e. for deterministic and nondeterministic programs
While Loops in Coq
While loops are present in virtually all imperative programming languages.
They are important both for practical reasons (performing a number of
iterations not known in advance) and theoretical reasons (achieving Turing
completeness). In this paper we propose an approach for incorporating while
loops in an imperative language shallowly embedded in the Coq proof assistant.
The main difficulty is that proving the termination of while loops is
nontrivial, or impossible in the case of non-termination, whereas Coq only
accepts programs endowed with termination proofs. Our solution is based on a
new, general method for defining possibly non-terminating recursive functions
in Coq. We illustrate the approach by proving termination and partial
correctness of a program on linked lists.Comment: In Proceedings FROM 2023, arXiv:2309.1295
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
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
Loop Analysis by Quantification over Iterations
We present a framework to analyze and verify programs containing loops by using a first-order language of so-called extended expressions. This language can express both functional and temporal properties of loops. We prove soundness and completeness of our framework and use our approach to automate the tasks of partial correctness verification, termination analysis and invariant generation. For doing so, we express the loop semantics as a set of first-order properties over extended expressions and use theorem provers and/or SMT solvers to reason about these properties. Our approach supports full first-order reasoning, including proving program properties with alternation of quantifiers. Our work is implemented in the tool QuIt and successfully evaluated on benchmarks coming from software verification
Fifty years of Hoare's Logic
We present a history of Hoare's logic.Comment: 79 pages. To appear in Formal Aspects of Computin
- …