Skip to main content
QUICK REVIEW

[Paper Review] Combinatorics of $λ$-terms: a natural approach

Maciej Bendkowski, Katarzyna Grygiel|arXiv (Cornell University)|Sep 24, 2016
Advanced Algebra and LogicComputer Science6 citations
TL;DR

This paper establishes a natural combinatorial model for $\lambda$-terms using unary de Bruijn indices, where each constructor (abstraction, application, zero, successor) contributes size one. It proves that plain $\lambda$-terms, neutral forms, and zigzag-free or black-white binary trees are equinumerous via constructive bijections, and shows that asymptotically almost all $\lambda$-terms contain any fixed subterm, implying strongly normalising and typeable terms are negligible in density.

ABSTRACT

We consider combinatorial aspects of $λ$-terms in the model based on de Bruijn indices where each building constructor is of size one. Surprisingly, the counting sequence for $λ$-terms corresponds also to two families of binary trees, namely black-white trees and zigzag-free ones. We provide a constructive proof of this fact by exhibiting appropriate bijections. Moreover, we identify the sequence of Motzkin numbers with the counting sequence for neutral $λ$-terms, giving a bijection which, in consequence, results in an exact-size sampler for the latter based on the exact-size sampler for Motzkin trees of Bodini et alli. Using the powerful theory of analytic combinatorics, we state several results concerning the asymptotic growth rate of $λ$-terms in neutral, normal, and head normal forms. Finally, we investigate the asymptotic density of $λ$-terms containing arbitrary fixed subterms showing that, inter alia, strongly normalising or typeable terms are asymptotically negligible in the set of all $λ$-terms.

Motivation & Objective

  • To develop a natural size model for $\lambda$-terms using unary de Bruijn indices, where each syntactic constructor contributes one to the size.
  • To establish constructive bijections between $\lambda$-terms and combinatorial structures like black-white trees and zigzag-free binary trees.
  • To analyze the asymptotic density of key $\lambda$-term classes—neutral, normal, head normal, strongly normalising, and typeable forms—within the full set of $\lambda$-terms.
  • To demonstrate that in this model, strongly normalising and typeable $\lambda$-terms are asymptotically negligible, contrasting with prior models where they had positive density.

Proposed method

  • Define a combinatorial class of $\lambda$-terms with size measured as the number of constructors (abstraction, application, zero, successor), each contributing one to the total.
  • Derive a holonomic generating function equation for the counting sequence of plain $\lambda$-terms using recursive decomposition.
  • Construct explicit size-preserving bijections between $\lambda$-terms and black-white binary trees, and between $\lambda$-terms and zigzag-free binary trees.
  • Establish a bijection between neutral $\lambda$-terms and Motzkin trees, enabling the use of exact-size samplers for Motzkin trees to sample neutral $\lambda$-terms.
  • Use analytic combinatorics to analyze the dominant singularity of generating functions and derive asymptotic growth rates for various $\lambda$-term classes.
  • Prove that the generating function for $\lambda$-terms containing any fixed subterm $M$ has a radius of convergence strictly larger than that of the full $\lambda$-term generating function, implying asymptotic density 1.

Experimental results

Research questions

  • RQ1What is the combinatorial structure of $\lambda$-terms under a natural size model based on unary de Bruijn indices?
  • RQ2Are there explicit bijections between $\lambda$-terms and well-known combinatorial classes such as black-white trees or zigzag-free binary trees?
  • RQ3What is the asymptotic density of neutral, normal, head normal, and strongly normalising $\lambda$-terms in the set of all $\lambda$-terms under this model?
  • RQ4How does the asymptotic density of $\lambda$-terms containing a fixed subterm $M$ behave, and what does this imply about the prevalence of non-normalising or non-typeable terms?
  • RQ5How do the asymptotic properties of $\lambda$-terms in this natural size model compare to those in models where variable size is ignored or treated differently?

Key findings

  • The counting sequence for $\lambda$-terms in the unary de Bruijn model matches that of black-white binary trees and zigzag-free binary trees, with explicit size-preserving bijections established.
  • Neutral $\lambda$-terms are in bijection with Motzkin trees, enabling the use of exact-size samplers for Motzkin trees to generate neutral $\lambda$-terms of any given size.
  • The generating function for $\lambda$-terms containing any fixed subterm $M$ has a radius of convergence strictly larger than that of the full $\lambda$-term generating function, implying that such terms have asymptotic density 1.
  • Strongly normalising $\lambda$-terms, normal forms, and typeable terms all have asymptotic density 0 in the set of all $\lambda$-terms under this model.
  • The asymptotic growth rate of $\lambda$-terms in neutral, normal, and head normal forms is determined via analytic combinatorics, with explicit constants derived from singularity analysis.
  • The model contradicts earlier results showing positive density of strongly normalising terms, as the natural size model penalizes variable index distance, making long-distance bindings unlikely.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.