ΛProlog
λProlog, also written lambda Prolog, is a logic programming language featuring polymorphic typing, modular programming, and higher-order programming. These extensions to Prolog are derived from the higher-order hereditary Harrop formulas used to justify the foundations of λProlog. Higher-order quantification, simply typed λ-terms, and higher-order unification gives λProlog the basic supports needed to capture the λ-tree syntax approach to higher-order abstract syntax, an approach to representing syntax that maps object-level bindings to programming language bindings. Programmers in λProlog need not deal with bound variable names: instead various declarative devices are available to deal with binder scopes and their instantiations.
History
Since 1986, λProlog has received numerous implementations. As of 2023, the language and its implementations are still actively being developed.The Abella theorem prover has been designed to provide an interactive environment for proving theorems about the declarative core of λProlog.
Programming in λProlog
Two unique features of λProlog include implications and universal quantification. Implication is used for local scoping of predicate definitions while universal quantification is used for local scoping of variables, as in the following implementation of reverse depending on an auxiliary rev predicate:reverse L K :- pi rev \
S :- rev T ))
=> rev L nil.
?- reverse L.
Success:
L = 3 :: 2 :: 1 :: nil
A common use of these scoping constructs is to simulate scope often seen in an inference-rule presentation of a logic. For example, proof search in natural deduction may be encoded as follows:
pv Pf P :- hyp Pf P.
pv :- pv P1 A, pv P2 B.
pv :- pi p \ =>.
pv A :- sigma B \ hyp P.
pv B :- sigma A \ hyp P.
pv B :- sigma A \ hyp P1, pv P2 A.
?- pi p q r \ pv ).
Success:
Pf = W1\ W2\ W3\ impI ))
Tutorials and texts
- and have written the book, published by Cambridge University Press in June 2012.
- has written in a 1997 tutorial on .
- has written a tutorial on for the 1998 PLILP Conference.
- has written Lambda-Prolog de A à Z... ou presque. It is available as,, and .
Implementations
- is currently the oldest implementation still being maintained. This compiler project is led by and various of his colleagues and students.
- has been developed by and . It is implemented in OCaml and is available . The system is described in a that appeared LPAR 2015. ELPI is also available as a : see Enrico Tassi's on this plugin.
- The prover can be used to prove theorems about λProlog programs and specifications.