Partial Evaluation in Logic Programming

Abstract This paper gives a theoretical foundation for partial evaluation in logic programming. Let P be a normal program, G a normal goal, A a finite set of atoms, and P ′ a partial evaluation of P wrt A . We study, for both the declarative and procedural semantics, conditions under which P ′ is sound and complete wrt P for the goal G . We identify two relevant conditions, those of closedness and independence. For the procedural semantics, we show that, if P ′ ∪ { G } is A -closed and A is independent, then P ′ is sound and complete wrt P for the goal G . For the declarative semantics, we show that, if P ′ ∪ { G } is A -closed, then P ′ is sound wrt P for the goal G . However, we show that, unless strong conditions are imposed, we do not have completeness for the declarative semantics. A practical consequence of our results is that partial evaluators should enforce the closedness and independence conditions.

[1]  Peter Sestoft,et al.  An experiment in partial evaluation: the generation of a compiler generator , 1985, SIGP.

[2]  J. Lloyd Foundations of Logic Programming , 1984, Symbolic Computation.

[3]  Erik Sandewall,et al.  A Partial Evaluator, and its Use as a Programming Tool , 1976, Artif. Intell..

[4]  Henryk Jan Komorowski,et al.  A specification of an abstract Prolog machine and its application to partial evaluation , 1981 .

[5]  Paul A. Strooper,et al.  Complete Sets of Frontiers in Logic-Based Program Transformation , 1988, META.

[6]  Raf Venken A Prolog Meta-Interpreter for Partial Evaluation and its Application to Source to Source Transformation and Query-Optimisation , 1984, ECAI.

[7]  Kenneth Kunen,et al.  Signed Data Dependencies in Logic Programs , 1989, J. Log. Program..

[8]  John W. Lloyd,et al.  A Completeness Theorem for SLDNF Resolution , 1989, J. Log. Program..

[9]  Ehud Shapiro,et al.  Meta interpreters for real , 1988 .

[10]  Shmuel Safra,et al.  Meta Interpreters For Real (Invited Paper) , 1986, IFIP Congress.

[11]  S. C. Kleene,et al.  Introduction to Metamathematics , 1952 .

[12]  John W. Lloyd,et al.  Properties of a Pruning Operator , 1990, Journal of Logic and Computation.

[13]  John W. Lloyd,et al.  A Partial Evaluation Procedure for Logic Programs , 1990, NACLP.

[14]  Akikazu Takeuchi,et al.  Partial Evaluation of Prolog Programs and its Application to Meta Programming , 1986, IFIP Congress.

[15]  Andrei P. Ershov,et al.  Mixed Computation: Potential Applications and Problems for Study , 1982, Theor. Comput. Sci..

[16]  Mark Wallace,et al.  A Treatment of Negation during Partial Evaluation , 1989, META.

[17]  John C. Shepherdson,et al.  Negation as Failure: A Comparison of Clark's Completed Data Base and Reiter's Closed World Assumption , 1984, J. Log. Program..

[18]  Stephen Owen,et al.  Issues in the Partial Evaluation of Meta-Interpreters , 1989, META.

[19]  Leon Sterling,et al.  Incremental Flavor-Mixing of Meta-Interpreters for Expert System Construction , 1986, SLP.

[20]  John C. Shepherdson Unsolvable Problems for SLDNF Resolution , 1991, J. Log. Program..

[21]  Neil D. Jones,et al.  Mix: A self-applicable partial evaluator for experiments in compiler generation , 1989, LISP Symb. Comput..