Counting and generating lambda terms
Katarzyna Grygiel, Pierre Lescanne (LIP)

TL;DR
This paper investigates the combinatorial properties of lambda calculus terms, providing formulas for counting and generating them, and analyzing their typical structures and typability distribution through theoretical and experimental methods.
Contribution
It introduces new formulas for counting lambda terms, designs algorithms for their random generation, and analyzes their structural and typability properties.
Findings
Number of closed lambda terms of a given size is characterized by new formulas.
Random generators for lambda terms are developed and tested.
Typability among lambda terms is very rare, with most terms starting with an abstraction.
Abstract
Lambda calculus is the basis of functional programming and higher order proof assistants. However, little is known about combinatorial properties of lambda terms, in particular, about their asymptotic distribution and random generation. This paper tries to answer questions like: How many terms of a given size are there? What is a "typical" structure of a simply typable term? Despite their ostensible simplicity, these questions still remain unanswered, whereas solutions to such problems are essential for testing compilers and optimizing programs whose expected efficiency depends on the size of terms. Our approach toward the afore-mentioned problems may be later extended to any language with bound variables, i.e., with scopes and declarations. This paper presents two complementary approaches: one, theoretical, uses complex analysis and generating functions, the other, experimental, is…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
