Statistical properties of lambda terms

We present a quantitative, statistical analysis of random lambda terms in the de Bruijn notation. Following an analytic approach using multivariate generating functions, we investigate the distribution of various combinatorial parameters of random open and closed lambda terms, including the number of redexes, head abstractions, free variables or the de Bruijn index value profile. Moreover, we conduct an average-case complexity analysis of finding the leftmost-outermost redex in random lambda terms showing that it is on average constant. The main technical ingredient of our analysis is a novel method of dealing with combinatorial parameters inside certain infinite, algebraic systems of multivariate generating functions. Finally, we briefly discuss the random generation of lambda terms following a given skewed parameter distribution and provide empirical results regarding a series of more involved combinatorial parameters such as the number of open subterms and binding abstractions in closed lambda terms.

[1]  Paul Tarau,et al.  On Uniquely Closable and Uniquely Typable Skeletons of Lambda Terms , 2017, LOPSTR.

[2]  Philippe Flajolet,et al.  A Calculus for the Random Generation of Labelled Combinatorial Structures , 1994, Theor. Comput. Sci..

[3]  Zbigniew Golebiewski,et al.  On the Number of Lambda Terms With Prescribed Size of Their De Bruijn Representation , 2016, STACS.

[4]  Zbigniew Golebiewski,et al.  Enumerating lambda terms by weighted length of their De Bruijn representation , 2018, Discret. Appl. Math..

[5]  J. Roger Hindley,et al.  Lambda-Calculus and Combinators in the 20th Century , 2009, Logic from Russell to Church.

[6]  Clemens Heuberger,et al.  Hwang's Quasi-Power-Theorem in Dimension Two , 2007 .

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

[8]  S. Lalley Finite Range Random Walk on Free Groups and Homogeneous Trees , 1993 .

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

[10]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[11]  M. Drmota Systems of functional equations , 1997 .

[12]  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 .

[13]  Stanley Burris,et al.  Characteristic Points of Recursive Systems , 2009, Electron. J. Comb..

[14]  Alan R. Woods Coloring rules for finite trees, and probabilities of monadic second order sentences , 1997 .

[15]  Pierre Lescanne,et al.  A Natural Counting of Lambda Terms , 2016, SOFSEM.

[16]  M. Drmota Random Trees: An Interplay between Combinatorics and Probability , 2009 .

[17]  Bernhard Gittenberger,et al.  On the asymptotic number of BCK(2)-terms , 2014, ANALCO.

[18]  Jue Wang Generating Random Lambda Calculus Terms , 2005 .

[19]  John Tromp Binary Lambda Calculus and Combinatory Logic , 2006, Kolmogorov Complexity and Applications.

[20]  Hsien-Kuei Hwang,et al.  On Convergence Rates in the Central Limit Theorems for Combinatorial Structures , 1998, Eur. J. Comb..

[21]  Pierre Lescanne,et al.  Counting and generating terms in the binary lambda calculus , 2015, J. Funct. Program..

[22]  Edward A. Bender,et al.  Central and Local Limit Theorems Applied to Asymptotic Enumeration II: Multivariate Generating Functions , 1983, J. Comb. Theory, Ser. A.

[23]  O. Bodini,et al.  Pointed versus singular Boltzmann samplers: a comparative analysis , 2015 .

[24]  Michael Drmota,et al.  Infinite Systems of Functional Equations and Gaussian Limiting Distributions , 2012 .

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

[26]  Michal H. Palka Random Structured Test Data Generation for Black-Box Testing , 2014 .

[27]  Philippe Flajolet,et al.  Random maps, coalescing saddles, singularity analysis, and Airy phenomena , 2001, Random Struct. Algorithms.

[28]  Olivier Bodini,et al.  Polynomial tuning of multiparametric combinatorial samplers , 2017, ANALCO.

[29]  Guy Louchard,et al.  Boltzmann Samplers for the Random Generation of Combinatorial Structures , 2004, Combinatorics, Probability and Computing.

[30]  Danièle Gardy,et al.  Enumeration of Generalized BCI Lambda-terms , 2013, Electron. J. Comb..

[31]  Philippe Flajolet,et al.  Analytic Combinatorics , 2009 .

[32]  Higher dimensional quasi-power theorem and Berry–Esseen inequality , 2016, Monatshefte für Mathematik.

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

[34]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2011, SIGP.

[35]  A. Joyal Une théorie combinatoire des séries formelles , 1981 .

[36]  Pierre Lescanne,et al.  On counting untyped lambda terms , 2011, Theor. Comput. Sci..

[37]  Yves Bertot,et al.  Interactive Theorem Proving and Program Development: Coq'Art The Calculus of Inductive Constructions , 2010 .

[38]  Michèle Soria,et al.  Algorithms for combinatorial structures: Well-founded systems and Newton iterations , 2011, J. Comb. Theory, Ser. A.

[39]  Pierre Lescanne,et al.  Combinatorics of λ-terms: a natural approach , 2016, ArXiv.

[40]  Danièle Gardy,et al.  Asymptotics and random sampling for BCI and BCK lambda terms , 2013, Theor. Comput. Sci..

[41]  Josef Kittler,et al.  Combinatorial Algorithms , 2016, Lecture Notes in Computer Science.