Enumerating lambda terms by weighted length of their De Bruijn representation

2018 
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 free indices and of size (encoded as binary words of length and according to Tromp’s weights) is for . We generalize the proposed notion of size and show that for several classes of lambda terms, including binary lambda terms with free indices, the number of terms of size is with some class dependent constant , 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.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    0
    References
    0
    Citations
    NaN
    KQI
    []