A treatment of higher-order features in logic programming

The logic programming paradigm provides the basis for a new intensional view of higher-order notions. This view is realized primarily by employing the terms of a typed lambda calculus as representational devices and by using a richer form of unification for probing their structures. These additions have important meta-programming applications but they also pose non-trivial implementation problems. One issue concerns the machine representation of lambda terms suitable to their intended use: an adequate encoding must facilitate comparison operations over terms in addition to supporting the usual reduction computation. Another aspect relates to the treatment of a unification operation that has a branching character and that sometimes calls for the delaying of the solution of unification problems. A final issue concerns the execution of goals whose structures become apparent only in the course of computation. These various problems are exposed in this paper and solutions to them are described. A satisfactory representation for lambda terms is developed by exploiting the nameless notation of de Bruijn as well as explicit encodings of substitutions. Special mechanisms are molded into the structure of traditional Prolog implementations to support branching in unification and carrying of unification problems over other computation steps; a premium is placed in this context on exploiting determinism and on emulating usual first-order behaviour. An extended compilation model is presented that treats higher-order unification and also handles dynamically emergent goals. The ideas described here have been employed in the Teyjus implementation of the $\lambda$Prolog language, a fact that is used to obtain a preliminary assessment of their efficacy.

[1]  Gopalan Nadathur,et al.  Higher-Order Logic Programming , 1986, ICLP.

[2]  Alonzo Church,et al.  A formulation of the simple theory of types , 1940, Journal of Symbolic Logic.

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

[4]  G. Nadathur An Explicit Substitution Notation in a lambda Prolog Implementation , 1998 .

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

[6]  Frank Pfenning,et al.  Partial polymorphic type inference and higher-order unification , 1988, LISP and Functional Programming.

[7]  Krzysztof R. Apt,et al.  Contributions to the Theory of Logic Programming , 1982, JACM.

[8]  Amy P. Felty,et al.  Implementing tactics and tacticals in a higher-order logic programming language , 1993, Journal of Automated Reasoning.

[9]  Andrew W. Appel,et al.  Lightweight Lemmas in λ Prolog , 1999 .

[10]  Olivier Ridoux,et al.  The Compilation of Prolog and its Execution with MALI , 1993 .

[11]  Claude Kirchner,et al.  Higher-order unification via explicit substitutions , 1995, Proceedings of Tenth Annual IEEE Symposium on Logic in Computer Science.

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

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

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

[15]  Andrew W. Appel,et al.  Lightweight Lemmas in lProlog , 1999, ICLP 1999.

[16]  Gopalan Nadathur,et al.  System Description: Teyjus - A Compiler and Abstract Machine Based Implementation of lambda-Prolog , 1999, CADE.

[17]  Frank Pfenning,et al.  An Empirical Study of the Runtime Behavior of Higher-Order Logic Programs , 1992 .

[18]  Pierre Lescanne,et al.  λν, a calculus of explicit substitutions which preserves strong normalisation , 1996, Journal of Functional Programming.

[19]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

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

[21]  John Hannan,et al.  Compiler verification in LF , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[22]  Peter B. Andrews Resolution in type theory , 1971, Journal of Symbolic Logic.

[23]  Gopalan Nadathur,et al.  A Notation for Lambda Terms: A Generalization of Environments , 1998, Theor. Comput. Sci..

[24]  Pierre-Louis Curien,et al.  The Categorical Abstract Machine , 1987, Sci. Comput. Program..

[25]  Gopalan Nadathur,et al.  The Type System of a Higher-Order Logic Programming Language , 1992, Types in Logic Programming.

[26]  Dale Miller,et al.  From operational semantics to abstract machines , 1992, Mathematical Structures in Computer Science.

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

[28]  Gopalan Nadathur,et al.  Explicit substitutions in the reduction of lambda terms , 2003, PPDP '03.

[29]  Claude Kirchner,et al.  Unification via Explicit Substitutions: The Case of Higher-Order Patterns , 1996, JICSLP.

[30]  Luigia Carlucci Aiello,et al.  An Efficient Interpreter for the Lambda-Calculus , 1981, J. Comput. Syst. Sci..

[31]  Jon Fairbairn,et al.  TIM: A simple, lazy abstract machine to execute supercombinatorics , 1987, FPCA.

[32]  Dale Miller,et al.  A Logic Programming Language with Lambda-Abstraction, Function Variables, and Simple Unification , 1991, J. Log. Comput..

[33]  Gopalan Nadathur,et al.  Choices in Representation and Reduction Strategies for Lambda Terms in Intensional Contexts , 2004, Journal of Automated Reasoning.

[34]  Peter Henderson,et al.  A lazy evaluator , 1976, POPL.

[35]  John Field,et al.  On laziness and optimality in lambda interpreters: tools for specification and analysis , 1989, POPL '90.

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

[37]  Fairouz Kamareddine,et al.  Extending a lambda-Calculus with Explicit Substitution which Preserves Strong Normalisation Into a Confluent Calculus on Open Terms , 1997, J. Funct. Program..

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

[39]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[40]  Gopalan Nadathur,et al.  Scoping Constructs in Logic Programming: Implementation Problems and their Solutions , 1995, J. Log. Program..

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

[42]  Gopalan Nadathur,et al.  System description : Teyjus : A compiler and abstract machine based implementation of λprolog , 1999 .

[43]  Zhong Shao,et al.  Implementing typed intermediate languages , 1998, ICFP '98.

[44]  Gopalan Nadathur,et al.  A Fine-Grained Notation for Lambda Terms and Its Use in Intensional Operations , 1996, J. Funct. Log. Program..

[45]  de Ng Dick Bruijn Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem , 1972 .

[46]  Alberto Martelli,et al.  An Efficient Unification Algorithm , 1982, TOPL.

[47]  Gopalan Nadathur,et al.  Tradeoffs in the Intensional Representation of Lambda Terms , 2002, RTA.