Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

λ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.

λProlog
ParadigmLogic programming
Designed byDale Miller and Gopalan Nadathur
First appeared1987[1]
Typing disciplinestrongly typed
LicenseGNU General Public License v3
Websitewww.lix.polytechnique.fr/Labo/Dale.Miller/lProlog/
Major implementations
Teyjus, ELPI
Influenced by
Prolog
Influenced
Makam

History

edit

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

edit

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 revappend function:

rev XS YS :- pi revapp \ 
  (pi ys \ revapp [] ys ys) =>
  (pi x xs ys zs \ revapp [x|xs] ys zs :- revapp xs [x|ys] zs) =>
  (revapp XS [] YS).

?- rev [1,2,3] L.

Success:
  L = [3, 2, 1]

A common use of these scoping constructs is to simulate scope in the style of natural deduction:

pv Pf P :- hyp Pf P.
pv (andI P1 P2) (and A B) :- pv P1 A, pv P2 B.
pv (impI P) (imp A B) :- pi p \ (hyp p A) => (pv (P p) B).
pv (andE1 P) A :- sigma B \ hyp P (and A B).
pv (andE2 P) B :- sigma A \ hyp P (and A B).
pv (impE P1 P2) B :- sigma A \ hyp P1 (imp A B), pv P2 A.

?- pi p q r \ pv (Pf p q r) (imp p (imp (and q r) (and (and p q) r))).

Success:
Pf = W1\ W2\ W3\ impI (W4\ impI (W5\ andI (andI W4 (andE1 W5)) (andE2 W5)))

See also

edit

References

edit
  1. ^ "FAQ: What implementations of lambda Prolog are available?". www.lix.polytechnique.fr. Retrieved 2019-12-16.

Tutorials and texts

edit
edit

Implementations

edit


  1. ^ Nadathur, Gopalan; Dustin Mitchell (1999). System Description: Teyjus - A Compiler and Abstract Machine Based Implementation of lambda Prolog. LNAI. Vol. 1632. pp. 287–291. doi:10.1007/3-540-48660-7_25. ISBN 978-3-540-66222-8. {{cite book}}: |journal= ignored (help)