Scoping Constructs in Logic Programming: Implementation Problems and their Solutions

The inclusion of universal quantification and a form of implication in goals in logic programming is considered. These additions provide a logical basis for scoping, but they also raise new implementation problems. When universal and existential quantifiers are permitted to appear in mixed order in goals, the devices of logic variables and unification that are employed in solving existential goals must be modified to ensure that constraints arising out of the order of quantification are respected. Suitable modifications that are based on attaching numerical tags to constants and variables and on using these tags in unification are described. The resulting devices are amenable to an efficient implementation and can, in fact, be assimilated easily into the usual machinery of the Warren Abstract Machine (WAM). The provision of implications in goals results in the possibility of program clauses being added to the program for the purpose of solving specific subgoals. A naive scheme based on asserting and retracting program clauses does not suffice for implementing such additions for two reasons. First, it is necessary to also support the resurrection of an earlier existing program in the face of backtracking. Second, the possibility for implication goals to be surrounded by quantifiers requires a consideration of the parameterization of program clauses by bindings for their free variables. Devices for supporting these additional requirements are described as also is the integration of these devices into the WAM. Further extensions to the machine are outlined for handling higher-order additions to the language. The ideas presented here are relevant to the implementation of the higher-order logic programming language λProlog.

[1]  Gopalan Nadathur,et al.  Implementation Techniques for Scoping Constructs in Logic Programming , 1991, ICLP.

[2]  Gopalan Nadathur,et al.  A representation of Lambda terms suitable for operations on their intensions , 1990, LISP and Functional Programming.

[3]  Frank Pfenning,et al.  A Semi-Functional Implementation of a Higher-Order Logic Programming Language , 1990 .

[4]  Elsa L. Gunter Extensions to Logic Programming Motivated by the Construction of a Generic Theorem Prover , 1989, ELP.

[5]  Gopalan Nadathur,et al.  Uniform Proofs as a Foundation for Logic Programming , 1991, Ann. Pure Appl. Log..

[6]  Evelina Lamma,et al.  The Design of an Abstract Machine for Efficient Implementation of Contexts in Logic Programming , 1989, International Conference on Logic Programming.

[7]  Gopalan Nadathur,et al.  Implementing Logic Programming Languages with Polymorphic Typing , 1991 .

[8]  Gopalan Nadathur,et al.  A Logic Programming Approach to Manipulating Formulas and Programs , 1987, SLP.

[9]  Gopalan Nadathur,et al.  Implementing Polymorphic Typing in a Logic Programming Language , 1994, Comput. Lang..

[10]  Hassan Aït-Kaci,et al.  Warren's Abstract Machine: A Tutorial Reconstruction , 1991 .

[11]  Dale Miller,et al.  Extending Definite Clause Grammars with Scoping Constructs , 1990, ICLP.

[12]  Gérard P. Huet,et al.  A Unification Algorithm for Typed lambda-Calculus , 1975, Theor. Comput. Sci..

[13]  Gopalan Nadathur,et al.  Implementation Considerations for Higher-Order Features in Logic Programming , 1993 .

[14]  Amy P. Felty,et al.  Specifying and implementing theorem provers in a higher-order logic programming language , 1989 .

[15]  Frank Pfenning,et al.  Higher-order abstract syntax , 1988, PLDI '88.

[16]  John Hannan,et al.  Investigating a proof-theoretic meta-language for functional programs , 1990 .

[17]  Peter Lee,et al.  Topics in advanced language implementation , 1991 .

[18]  Gopalan Nadathur,et al.  Towards a WAM model for ?Prolog , 1989 .

[19]  Olivier Ridoux,et al.  Naïve Reverse Can be Linear , 1991, ICLP.

[20]  Gopalan Nadathur,et al.  Higher-order Horn clauses , 1990, JACM.

[21]  Dale Miller,et al.  A Logical Analysis of Modules in Logic Programming , 1989, J. Log. Program..

[22]  William F. Clocksin,et al.  Programming in Prolog , 1987, Springer Berlin Heidelberg.

[23]  G. Nadathur,et al.  A Notation for Lambda Terms II: Refinements and Applications , 1994 .

[24]  Dale Miller,et al.  Lexical Scoping as Universal Quantification , 1989, ICLP.

[25]  Dale A. Miller,et al.  AN OVERVIEW OF PROLOG , 1988 .