On Logic Programming Representations of Lambda Terms: de Bruijn Indices, Compression, Type Inference, Combinatorial Generation, Normalization

We introduce a compressed de Bruijn representation of lambda terms and define its bijections to standard representations. Compact combinatorial generation algorithms are given for several families of lambda terms, including open, closed, simply typed and linear terms as well as type inference and normal order reduction algorithms. We specify our algorithms as a literate Prolog program. In the process, we rely in creative ways on unification of logic variables, cyclic terms, backtracking and definite clause grammars.

[1]  Pierre Lescanne,et al.  Counting and generating lambda terms , 2012, Journal of Functional Programming.

[2]  Danièle Gardy,et al.  Lambda-terms of Bounded Unary Height , 2011, ANALCO.

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

[4]  Charalambos A. Charalambides,et al.  Enumerative combinatorics , 2018, SIGA.

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

[6]  David A. Schmidt,et al.  The Essence of Computation , 2002 .

[7]  René David,et al.  Some properties of random lambda terms , 2009, Log. Methods Comput. Sci..

[8]  Peter Sestoft Demonstrating Lambda Calculus Reduction , 2001, MFPS.

[9]  Dale Miller,et al.  Unification of Simply Typed Lamda-Terms as Logic Programming , 1991, ICLP.

[10]  Fairouz Kamareddine,et al.  Reviewing the Classical and the de Bruijn Notation for [lambda]-calculus and Pure Type Systems , 2001, J. Log. Comput..

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

[12]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[13]  N. J. A. Sloane,et al.  The On-Line Encyclopedia of Integer Sequences , 2003, Electron. J. Comb..

[14]  Pawel M. Idziak,et al.  How big is BCI fragment of BCK logic , 2013, J. Log. Comput..

[15]  Viggo Stoltenberg-hansen,et al.  In: Handbook of Logic in Computer Science , 1995 .

[16]  Alwen Tiu,et al.  Programming in Higher-Order Logic , 2009 .

[17]  Christophe Raffalli,et al.  Asymptotically almost all \lambda-terms are strongly normalizing , 2009 .

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

[19]  Richard Statman,et al.  Lambda Calculus with Types , 2013, Perspectives in logic.