Skip to main content

1997 | Buch

Logic Program Synthesis and Transformation

6th International Workshop, LOPSTR'96 Stockholm, Sweden, August 28–30, 1996 Proceedings

herausgegeben von: John Gallagher

Verlag: Springer Berlin Heidelberg

Buchreihe : Lecture Notes in Computer Science

insite
SUCHEN

Über dieses Buch

This book constitutes the strictly refereed post-workshop proceedings of the Sixth International Workshop on Logic Program Synthesis and Transformation, LOPSTR'96, held on board a ship sailing from Stockholm to Helsinki, in August 1996.
The 17 revised full papers were carefully selected from a total of initially 27 submissions. The topics covered range over the areas of synthesis of programs from specifications, verification, transformation, specialization, and analysis of programs, and the use of program schemata in program development.

Inhaltsverzeichnis

Frontmatter
Refining specifications to logic programs
Abstract
The refinement calculus provides a framework for the stepwise development of imperative programs from specifications. In this paper we study a refinement calculus for deriving logic programs. Dealing with logic programs rather than imperative programs has the dual advantages that, due to the expressive power of logic programs, the final program is closer to the original specification, and each refinement step can achieve more. Together these reduce the overall number of derivation steps.
We present a logic programming language extended with specification constructs (including general predicates, assertions, and types and invariants) to form a wide-spectrum language. General predicates allow non-executable properties to be included in specifications. Assertions, types and invariants make assumptions about the intended inputs of a procedure explicit, and can be used during refinement to optimize the constructed logic program. We provide a semantics for the extended logic programming language and derive a set of refinement laws. Finally we apply these to an example derivation.
I. J. Hayes, R. G. Nickson, P. A. Strooper
Symbolic verification with gap-order constraints
Abstract
Finite state automata with counters are useful for modelling systems with discrete parameters. The calculation of state invariants is an important tool in the analysis of such systems. Previous authors have presented techniques for the calculation of state invariants based on their approximation by convex polyhedra or periodic sets.
In this paper we present a new method for the calculation of invariants for finite state automata with counters, based on their representation by gap-order constraints. This method differs from previous approaches by exploiting existing techniques for the calculation of least fixed points. The use of least fixed points reduces the need for approximation and allows the generation of non-convex invariants. We do not need to specify the initial inputs to the automaton, but can leave them as uninstantiated parameters, or partially specify them using gap-order constraints. Our method not only provides a new tool for program analysis, but is also an interesting application of logic programming techniques.
Laurent Fribourg, Julian Richardson
Specification-based automatic verification of Prolog programs
Abstract
The paper presents an analyzer for verifying the correctness of a Prolog program relative to a specification which provides a list of input/output annotations for the arguments and parameters that can be used to establish program termination. The work stems from Deville's methodology to derive Prolog programs that correctly implement their declarative meaning. In this context, we propose an algorithm that combines, adapts, and sometimes improves various existing static analyses in order to verify total correctness of Prolog programs with respect to formal specifications. Using the information computed during the verification process, an automatic complexity analysis can be also performed.
Agostino Cortesi, Baudouin Le Charlier, Sabina Rossi
Logic program specialisation: How to be more specific
Abstract
Standard partial deduction suffers from several drawbacks when compared to top-down abstract interpretation schemes. Conjunctive partial deduction, an extension of standard partial deduction, remedies one of those, namely the lack of side-ways information passing. But two other problems remain: the lack of success-propagation as well as the lack of inference of global success-information. We illustrate these drawbacks and show how they can be remedied by combining conjunctive partial deduction with an abstract interpretation technique known as more specific program construction. We present a simple, as well as a more refined integration of these methods. Finally we illustrate the practical relevance of this approach for some advanced applications, where it surpasses the precision of current abstract interpretation techniques.
Michael Leuschel, Danny De Schreye
Conjunctive partial deduction in practice
Abstract
Recently, partial deduction of logic programs has been extended to conceptually embed folding. To this end, partial deductions are no longer computed of single atoms, but rather of entire conjunctions; Hence the term “conjunctive partial deduction”.
Conjunctive partial deduction aims at achieving unfold/fold-like program transformations such as tupling and deforestation within fully automated partial deduction. However, its merits greatly surpass that limited context: Also other major efficiency gains can be obtained through considerably improved side-ways information propagation.
In this paper, we present a first investigation of conjunctive partial deduction in practice. We describe the concrete options used in the implementation(s), look at abstraction in a practical Prolog context, include and discuss an extensive set of benchmark results. ¿ From these, we can conclude that conjunctive partial deduction can indeed pay off in practice, beating its conventional precursor on a number of small to medium size programs. However, controlling it in a perfect way proves far from obvious, and a range of challenging open problems remain as topics for further research.
Jesper Jørgensen, Michael Leuschel, Bern Martens
Redundant argument filtering of logic programs
Abstract
This paper is concerned with the problem of removing redundant arguments from logic programs. Such arguments can be removed without affecting correctness, in a certain sense. Most program specialisation techniques, even though they filter arguments and remove clauses, fail to remove a substantial number of redundant arguments, yielding in some cases rather inefficient residual programs. We formalise the notion of a redundant argument and show that one cannot effectively remove all redundant arguments. We then give a safe, effective approximation of the notion of a redundant argument and describe several simple and efficient algorithms based on the approximative notion. We conduct extensive experiments with our algorithms on mechanically generated programs illustrating the practical benefits of our approach.
Michael Leuschel, Morten Heine Sørensen
Replacement can preserve termination
Abstract
We consider the replacement transformation operation, a very general and powerful transformation, and study under which conditions it preserves universal termination besides computed answer substitutions. With this safe replacement we can significantly extend the safe unfold/fold transformation sequence presented in [11]. By exploiting typing information, more useful conditions can be defined and we may deal with some special cases of replacement very common in practice, namely switching two atoms in the body of a clause and the associativity of a predicate. This is a first step in the direction of exploiting a Pre/Post specification on the intended use of the program to be transformed. Such specification can restrict the instances of queries and clauses to be considered and then relax the applicability conditions on the transformation operations.
Annalisa Bossi, Nicoletta Cocco
A transformation tool for pure Prolog programs
Abstract
This paper describes an interactive tool for transforming pure Prolog programs. The choice of (pure) Prolog semantics induces a number of conditions that have to be satisfied before a particular transformation step can be applied. The transformation tool has been developed using a programming environment based on algebraic specification. The paper describes the tool and reports on the design decisions, the implemented transformation steps, and the user interface.
Jacob Brunekreef
Enhancing partial deduction via unfold/fold rules
Abstract
We show that sometimes partial deduction produces poor program specializations because of its limited ability in (i) dealing with conjunctions of recursively defined predicates, (ii) combining partial evaluations of alternative computations, and (iii) taking into account unification failures. We propose to extend the standard partial deduction technique by using versions of the definition rule and the folding rule which allow us to specialize predicates defined by disjunctions of conjunctions of goals. We also consider a case split rule to take into account unification failures. Moreover, in order to perform program specialization via partial deduction in an automatic way, we propose a transformation strategy which takes as parameters suitable substrategies for directing the application of every transformation rule.
Finally, we show through two examples that our partial deduction technique is superior to standard partial deduction. The first example refers to the automatic derivation of the Knuth-Morris-Pratt string matching algorithm, and the second example refers to the construction of a parser for a given regular expression. In both examples, the specialized programs are derived starting from naive, non-deterministic initial programs, whereas standard partial deduction can derive similar specialized programs only when complex, deterministic initial programs are provided.
Alberto Pettorossi, Maurizio Proietti, Sophie Renault
Abstract specialization and its application to program parallelization
Abstract
Program specialization optimizes programs for known values of the input. It is often the case that the set of possible input values is unknown, or this set is infinite. However, a form of specialization can still be performed in such cases by means of abstract interpretation, specialization then being with respect to abstract values (substitutions), rather than concrete ones. This paper reports on the application of abstract multiple specialization to automatic program parallelization in the &-Prolog compiler. Abstract executability, the main concept underlying abstract specialization, is formalized, the design of the specialization system presented, and a non-trivial example of specialization in automatic parallelization is given.
Germán Puebla, Manuel Hermenegildo
Reductions of petri nets and unfolding of propositional logic programs
Abstract
We present in this paper a new method for computing the reachability set associated with a Petri net. The method proceeds, first, by coding the reachability problem into a predicate defined by a logic program with arithmetic constraints, then by transforming the encoding program. Each transition of the Petri net is encoded as a clause. The guards appearing in the clauses correspond to the enabling conditions of the corresponding transitions. In order to characterize arithmetically the least model of the transformed program, we define a system of two reduction rules which apply iteratively to the program. When the process of reduction terminates with success, it generates a formula of Presburger arithmetic, which contains the components of the initial marking as parameters. In the particular case of a BPP-net (i.e., a Petri net where every transition has exactly one input place), the process is guaranteed to succeed, thus providing us with an exact and generic characterization of the reachability set. We show finally how unfolding of propositional logic programs can be viewed as transformation of BPP-nets.
Laurent Fribourg, Hans Olsén
Inferring argument size relationships with CLP()
Abstract
Argument size relationships are useful in termination analysis which, in turn, is important in program synthesis and goal-replacement transformations. We show how a precise analysis for inter-argument size relationships, formulated in terms of abstract interpretation, can be implemented straightforwardly in a language with constraint support like CLP(\(\mathcal{R}\)) or SICStus version 3. The analysis is based on polyhedral approximations and uses a simple relaxation technique to calculate least upper bounds and a delay method to improve the precision of widening. To the best of our knowledge, and despite its simplicity, the analysis derives relationships to an accuracy that is either comparable or better than any existing technique.
Florence Benoy, Andy King
Typed norms for typed logic programs
Abstract
As typed logic programming becomes more mainstream, system building tools like partial deduction systems will need to be mapped from untyped languages to typed ones. It is important, however, when mapping techniques across that the new techniques should exploit the type system as much as possible. In this paper, we show how norms, which play a crucial role in termination analysis, can be generated from the prescribed types of a logic program. Interestingly, the types highlight restrictions of earlier norms and suggest how these norms can be extended to obtain some very general and powerful notions of norm which can be used to measure any term in an almost arbitrary way. We see our work on norm derivation as a contribution to the termination analysis of typed logic programs which, in particular, forms an essential part of offline partial deduction systems.
Jonathan C. Martin, Andy King, Paul Soper
Partial deduction in the framework of structural synthesis of programs
Abstract
The notion of partial deduction known from logic programming is defined in the framework of Structural Synthesis of Programs (SSP). Partial deduction for unconditional computability statements in SSP is defined. Completeness and correctness of partial deduction in the framework of SSP are proven. Several tactics and stopping criteria are suggested.
Mihhail Matskin, Jan Komorowski, John Krogstie
Extensible logic program schemata
Abstract
Schema-based transformational systems maintain a library of logic program schemata which capture large classes of logic programs. One of the shortcomings of schema-based transformation approaches is their reliance on a large (possibly incomplete) set of logic program schemata that is required in order to capture all of the minor syntactic differences between semantically similar logic programs. By defining a set of extensible logic program schemata and an associated set of logic program transformations, it is possible to reduce the size of the schema library while maintaining the robustness of the transformational system. In our transformational system, we have defined a set of extensible logic program schemata in λProlog. Because λProlog is a higher-order logic programming language, it can be used as the representation language for both the logic programs and the extensible logic program schemata. In addition to the instantiation of predicate variables, extensible logic program schemata can be extended by applying standard programming techniques (e.g., accumulating results), introducing additional arguments (e.g., a second list to append to the end of the primary list), combining logic program schemata which share a common primary input, and connecting logic program schemata which are connected via a result of one schema being an input to the other schema. These extensions increase the robustness of logic program schemata and enhance traditional schema-based transformational systems.
Timothy S. Gegg-Harrison
Specialising meta-level compositions of logic programs
Abstract
Meta-level compositions of object logic programs are naturally implemented by means of meta-programming techniques. Metainterpreters defining program compositions however suffer from a computational overhead that is due partly to the interpretation layer present in all meta-programs, and partly to the specific interpretation layer needed to deal with program compositions. We show that meta-interpreters implementing compositions of object programs can be fruitfully specialised w.r.t. meta-level queries of the form Demo(E,G), where E denotes a program expression and G denotes a (partially instantiated) object level query. More precisely, we describe the design and implementation of a declarative program specialiser that suitably transforms such metainterpreters so as to sensibly reduce — if not to completely remove — the overhead due to the handling of program compositions. In many cases the specialiser succeeds in eliminating also the overhead due to meta-interpretation.
Antonio Brogi, Simone Contiero
Forms of logic specifications: A preliminary study
Abstract
There is no universal agreement on exactly what form a specification should take, what part it should play in synthesis, and what its precise relationship with the specified program should be. In logic programming, the role of specification is all the more unclear since logic programs are often used as executable specifications. In this paper we take the view that specifications should be set in the context of the problem domain, which we call a framework. We conduct a preliminary study of two useful forms of logic specifications: if-and-only-if and partial specifications. First we set up a three-tier formalism for synthesis, the top-tier being a framework. Then within this formalism we define these two forms of specifications, and discuss their roles in synthesis.
Kung-Kiu Lau, Mario Ornaghi
Synthesis of proof procedures for default reasoning
Abstract
We apply logic program development technology to define abstract proof procedures, in the form of logic programs, for computing the admissibility semantics for default reasoning proposed in [2].
The proof procedures are derived from a formal specification. The derivation guarantees the soundness of the proof procedures. The completeness of the proof procedures is shown by employing a technique of symbolic execution of logic programs to compute (an instance of) a relation implied by the specification.
Phan Minh Dung, Robert A. Kowalski, Francesca Toni
Backmatter
Metadaten
Titel
Logic Program Synthesis and Transformation
herausgegeben von
John Gallagher
Copyright-Jahr
1997
Verlag
Springer Berlin Heidelberg
Electronic ISBN
978-3-540-68494-7
Print ISBN
978-3-540-62718-0
DOI
https://doi.org/10.1007/3-540-62718-9