Results 1  10
of
18
Transformation of Logic Programs
 Handbook of Logic in Artificial Intelligence and Logic Programming
, 1998
"... Program transformation is a methodology for deriving correct and efficient programs from specifications. In this chapter, we will look at the so called 'rules + strategies' approach, and we will report on the main techniques which have been introduced in the literature for that approach, i ..."
Abstract

Cited by 40 (4 self)
 Add to MetaCart
Program transformation is a methodology for deriving correct and efficient programs from specifications. In this chapter, we will look at the so called 'rules + strategies' approach, and we will report on the main techniques which have been introduced in the literature for that approach, in the case of logic programs. We will also present some examples of program transformation, and we hope that through those examples the reader may acquire some familiarity with the techniques we will describe.
A SelfApplicable Partial Evaluator for the Logic Programming Language Godel
"... Partial evaluation is a program specialisation technique that has been shown to have great potential in logic programming, particularly for the specialisation of metainterpreters by the socalled “Futamura Projections”. Metainterpreters and other metaprograms are programs which use another progra ..."
Abstract

Cited by 39 (1 self)
 Add to MetaCart
(Show Context)
Partial evaluation is a program specialisation technique that has been shown to have great potential in logic programming, particularly for the specialisation of metainterpreters by the socalled “Futamura Projections”. Metainterpreters and other metaprograms are programs which use another program as data. In this thesis we describe a partial evaluator for metaprograms in the logic programming language Gödel. Gödel is a declarative, generalpurpose language which provides a number of higherlevel programming features, including extensive support for metaprogramming with a ground representation. The ground representation is a standard tool in mathematical logic in which object level variables are represented by ground terms at the metalevel. The ground representation is receiving increasing recognition as being essential for declarative metaprogramming, although the computational expense that it incurs has largely precluded its use in the past. This thesis extends the basic techniques of partial evaluation to the facilities of Gödel. Particular attention is given to the specialisation of the inherent overheads of metaprograms which use a ground representation and the foundations of a methodology for Gödel metaprograms are laid down. The soundness of the partial evaluation techniques is proved and these techniques are incorporated into a declarative partial evaluator. We describe the implementation and provide termination and correctness proofs for the partial evaluator SAGE, an automatic program specialiser based upon sound finite unfolding that is able to specialise any Gödel metaprogram (or indeed, any Gödel program at all). A significant illustration of the success of our techniques for specialising metaprograms which use a ground representation is provided by the selfapplication of this partial evaluator. We use the partial evaluator to specialise itself with respect to a range of metaprograms. By virtue of its selfapplicability SAGE has been used to produce a compilergenerator, which we believe shall prove to be an immensely powerful and useful tool for metaprogramming.
Conjunctive Partial Deduction in Practice
 Proceedings of the International Workshop on Logic Program Synthesis and Transformation (LOPSTR'96), LNCS 1207
, 1996
"... . 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 ..."
Abstract

Cited by 28 (21 self)
 Add to MetaCart
. 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/foldlike program transformations such as tupling and deforestation within fully automated partial deduction. However, its merits greatly surpass that limited context: Also other major efficiency improvements are obtained through considerably improved sideways information propagation. In this extended abstract, we investigate 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 indeed pays off in practice, thoroughly beating its conventional precursor on a wide...
Constrained Partial Deduction and the Preservation of Characteristic Trees
 NEW GENERATION COMPUTING
, 1997
"... Partial deduction strategies for logic programs often use an abstraction operator to guarantee the finiteness of the set of goals for which partial deductions are produced. Finding an abstraction operator which guarantees finiteness and does not lose relevant information is a difficult problem. I ..."
Abstract

Cited by 21 (16 self)
 Add to MetaCart
Partial deduction strategies for logic programs often use an abstraction operator to guarantee the finiteness of the set of goals for which partial deductions are produced. Finding an abstraction operator which guarantees finiteness and does not lose relevant information is a difficult problem. In earlier work Gallagher and Bruynooghe proposed to base the abstraction operator on characteristic paths and trees, which capture the structure of the generated incomplete SLDNFtree for a given goal. In this paper we exhibit the advantages of characteristic trees over purely syntactical measures: if characteristic trees can be preserved upon generalisation, then we obtain an almost perfect abstraction operator, providing just enough polyvariance to avoid any loss of local specialisation. Unfortunately, the abstraction operators proposed in earlier work do not always preserve the characteristic trees upon generalisation. We show that this can lead to important specialisation losses as well as to nontermination of the partial deduction algorithm. Furthermore, this problem cannot be adequately solved in the ordinary partial deduction setting. We therefore extend the expressivity and precision of the Lloyd and Shepherdson partial deduction framework by integrating constraints. We provide formal correctness results for the so obtained generic framework of constrained partial deduction. Within this new framework we are, among others, able to overcome the above mentioned problems by introducing an alternative abstraction operator, based on so called pruning constraints. We thus present a terminating partial deduction strategy which, for purely determinate unfolding rules, induces no loss of local specialisation due to the abstraction while ensuring correctness o...
Partial Deduction of the Ground Representation and its Application to Integrity Checking
 Proceedings of ILPS'95, the International Logic Programming Symposium
, 1995
"... Integrity constraints are very useful in many contexts, such as, for example, deductive databases, abductive and inductive logic programming. However, fully testing the integrity constraints after each update or modification can be very expensive and methods have been developed which simplify the in ..."
Abstract

Cited by 19 (12 self)
 Add to MetaCart
(Show Context)
Integrity constraints are very useful in many contexts, such as, for example, deductive databases, abductive and inductive logic programming. However, fully testing the integrity constraints after each update or modification can be very expensive and methods have been developed which simplify the integrity constraints. In this paper, we pursue the goal of writing this simplification procedure as a metaprogram in logic programming and then using partial deduction to obtain precompiled integrity checks for certain update patterns. We argue that the ground representation has to be used to write this metaprogram declaratively. We however also show that, contrary to what one might expect, current partial deduction techniques are then unable to specialise this metainterpreter in an interesting way and no precompilation of integrity checks can be obtained. In fact, we show that partial deduction (alone) is not able to perform any (sophisticated) specialisation at the objectlevel for meta...
Controlling generalization and polyvariance in partial deduction of normal logic programs
 ACM Transactions on Programming Languages and Systems
, 1998
"... Given a program and some input data, partial deduction computes a specialized program handling any remaining input more efficiently. However, controlling the process well is a rather difficult problem. In this article, we elaborate global control for partial deduction: for which atoms, among possibl ..."
Abstract

Cited by 16 (0 self)
 Add to MetaCart
Given a program and some input data, partial deduction computes a specialized program handling any remaining input more efficiently. However, controlling the process well is a rather difficult problem. In this article, we elaborate global control for partial deduction: for which atoms, among possibly infinitely many, should specialized relations be produced, meanwhile guaranteeing correctness as well as termination? Our work is based on two ingredients. First, we use the concept of a characteristic tree, encapsulating specialization behavior rather than syntactic structure, to guide generalization and polyvariance, and we show how this can be done in a correct and elegant way. Second, we structure combinations of atoms and associated characteristic trees in global trees registering “causal ” relationships among such pairs. This allows us to spot looming nontermination and perform proper generalization in order to avert the danger, without having to impose a depth bound on characteristic trees. The practical relevance and benefits of the work are illustrated through extensive experiments. Finally, a similar approach may improve upon current (online) control strategies for program transformation in general such as (positive) supercompilation of functional programs. It also seems valuable in the context of abstract interpretation to handle infinite domains of infinite height with more precision.
Specialising the ground representation in the logic programming language Gödel
 PROCEEDINGS OF LOPSTR 93
, 1994
"... Metaprograms form a class of logic programs of major importance. In the past it has proved very difficult to provide a declarative semantics for metaprograms in languages such as Prolog. These problems have been identified as largely being caused by the fact that Prolog fails to handle the necessa ..."
Abstract

Cited by 14 (0 self)
 Add to MetaCart
(Show Context)
Metaprograms form a class of logic programs of major importance. In the past it has proved very difficult to provide a declarative semantics for metaprograms in languages such as Prolog. These problems have been identified as largely being caused by the fact that Prolog fails to handle the necessary representation requirements adequately. The ground representation is receiving increasing recognition as being necessary to adequately represent metaprograms. However, the expense it incurs has largely precluded its use to date. The logic programming language Gödel is a declarative successor to Prolog. Gödel provides considerable support for metaprogramming, in the form of a ground representation. Using this representation, Gödel metaprograms have the advantage of having a declarative semantics and can be optimised by program specialisation, to execute in a time comparable to equivalent Prolog metaprograms which use a nonground representation.
Regular Approximations of Logic Programs and Their Uses
, 1992
"... Regular approximations of logic programs have a variety of uses, including static analysis for debugging, program specialisation, and machine learning. An algorithm for computing a regular approximation of a normal program is given, and some applications are discussed. The analysis of a “magic set ” ..."
Abstract

Cited by 9 (5 self)
 Add to MetaCart
(Show Context)
Regular approximations of logic programs have a variety of uses, including static analysis for debugging, program specialisation, and machine learning. An algorithm for computing a regular approximation of a normal program is given, and some applications are discussed. The analysis of a “magic set ” style of transformation of a program P can be used to derive more precise approximations than can be obtained from P itself. The approximation algorithm given here can also be applied to Prolog programs. 2 1
A Theory of Logic Program Specialization and Generalization for Dealing with Input Data Properties
 Proceedings of the Dagstuhl Seminar on Partial Evaluation, Lecture Notes in Computer Science 1110
, 1996
"... . We address the problem of specializing logic programs w.r.t. the contexts where they are used. We assume that these contexts are specified by means of computable properties of the input data. We describe a general method by which, given a program P , we can derive a specialized program P 1 such ..."
Abstract

Cited by 8 (3 self)
 Add to MetaCart
(Show Context)
. We address the problem of specializing logic programs w.r.t. the contexts where they are used. We assume that these contexts are specified by means of computable properties of the input data. We describe a general method by which, given a program P , we can derive a specialized program P 1 such that P and P 1 are equivalent w.r.t. every input data satisfying a given property. Our method extends the techniques for partial evaluation of logic programs based on Lloyd and Shepherdson 's approach, where a context can only be specified by means of a finite set of bindings for the variables of the input goal. In contrast to most program specialization techniques based on partial evaluation, our method may achieve superlinear speedups, and it does so by using a novel generalization technique. 1 Introduction Program specialization is a technique which can be used for deriving from a given program, a new and hopefully more efficient program, by exploiting the knowledge of the context in w...