English

Enumerating Lambda Terms by Weighted Length of Their De Bruijn Representation

Combinatorics 2017-07-10 v1 Logic

Abstract

John Tromp introduced the so-called 'binary lambda calculus' as a way to encode lambda terms in terms of 0-1-strings using the de Bruijn representation along with a weighting scheme. Later, Grygiel and Lescanne conjectured that the number of binary lambda terms with mm free indices and of size nn (encoded as binary words of length nn and according to Tromp's weights) is o(n3/2τn)o(n^{-3/2} \tau^{-n}) for τ1.963448\tau \approx 1.963448\ldots. We generalize the proposed notion of size and show that for several classes of lambda terms, including binary lambda terms with mm free indices, the number of terms of size nn is Θn3/2ρn\Theta{n^{-3/2} \rho^{-n}} with some class dependent constant ρ\rho, which in particular disproves the above mentioned conjecture. The methodology used is setting up the generating functions for the classes of lambda terms. These are infinitely nested radicals which are investigated then by a singularity analysis. We show further how some properties of random lambda terms can be analyzed and present a way to sample lambda terms uniformly at random in a very efficient way. This allows to generate terms of size more than one million within a reasonable time, which is significantly better than the samplers presented in the literature so far.

Keywords

Cite

@article{arxiv.1707.02101,
  title  = {Enumerating Lambda Terms by Weighted Length of Their De Bruijn Representation},
  author = {Olivier Bodini and Bernhard Gittenberger and Zbigniew Gołębiewski},
  journal= {arXiv preprint arXiv:1707.02101},
  year   = {2017}
}

Comments

19 pp, 3 figures

R2 v1 2026-06-22T20:40:31.134Z