Debugging Logic Programs Using Specifications
نویسندگان
چکیده
Logic programming has gained in popularity" in recent years. This style of programming, using Horn clauses to express procedural information, allows one to reason easily about the effects of executing program statements. We present a methodology for reasoning about the relationship between logic programs and their specifications, to help debug erronneous programs. To Mlow for debugging, the specifications must describe the relationships between the values of input and output variables. Since Horn clauses are a powerful subset of firstorder logic, a program's specifications can oftentimes be written in Prolog itself and executed by the Prolog interpreter or compiler directly. (Whereas specifications are intended to emphasize clarity and simplicity, in implementing programs, efficiency is a major consideration.) The debugger follows the pattern of Shapiro's ([12]). We focus on the use of executable specifications to generate test cases for bug discovery, locate bugs when test data cause a program to fail, and guide deductive and inductive bug correction ([3]). We also ask that specifications provide information on the well-founded ordering of input arguments for recursive procedures. (A well-founded ordering ~is a transitive and irreflexive binary relation on elements of a set S such that the S has no infinite descending sequences.) The ordering specifies, for each recursive call, which arguments should be decreasing. This is used for detecting looping. Programs, for our purposes, are presumed to obey their Horn clause declarative semantics, i.e., extra-logical features, such as cuts, clause order, and subgoM order, may affect efficiency and termination, but not correctness. We also presume that specifications faithfully reflect the intended requirements of a program. To obtain the desired effect, it is sometimes necessary to use impure features, i.e., non-logical control structures, of Prolog.
منابع مشابه
Supporting the Specification of Logic Programs
specification provides a formal logic semantics for the The system described here was designed to assist in the specification, implementation, and maintenance of correct and efficient logic programs, encouraging the separation of logic and control concerns by providing an environment that maintains separate declarative and control specifications. While the support environment consists of many s...
متن کاملComplete Heap Verification with Mixed Specifications
We present GRASShopper, a tool for compositional verification of heap-manipulating programs against user-provided specifications. What makes our tool unique is its decidable specification language, which supports mixing of assertions expressed in separation logic and first-order logic. The user of the tool can thus take advantage of the succinctness of separation logic specifications and the di...
متن کاملA Framework for Assertion-Based Debugging in Constraint Logic Programming
A b s t r a c t . We propose a general framework for assertion-based debugging of constraint logic programs. Assertions are linguistic constructions which allow expressing properties of programs. We define assertion schemas which allow writing (partial) specifications for constraint logic programs using quite general properties, including user-defined programs. The framework is aimed at detecti...
متن کاملEfficient Detection of Incompleteness Errors in the Abstract Debugging of Logic Programs
Abstract debugging of logic programs is an extension of declarative debugging, where we deal with specifications of operational properties, which can be characterized as abstractions of SLD-trees (observables). We introduce a simple and efficient method to detect incompleteness errors, which is based on the application of the immediate consequences operator to the specification. The method is p...
متن کاملOn-the-Fly Model Checking of Program Runs for Automated Debugging
In this paper, an on-the-fly algorithm is developed for model checking of temporal logic safety properties on partially ordered occurrence net structures. This algorithm is used for the automated debugging of parallel programs. During the monitoring of a program run, a state action net is constructed from the program trace. Temporal specifications are evaluated on-the-fly with respect to this n...
متن کامل