OFFSET
0,5
COMMENTS
Natural size measure lambda terms as follows: all symbols are assigned size 1, namely applications, abstractions, successor symbols in de Bruijn indices and 0 symbol in de Bruijn indices (i.e., a de Bruijn index n is assigned size n+1).
Here we count the closed terms of natural size n, where "closed" means that there is no free index (no free bound variable).
LINKS
Pierre Lescanne, Table of n, a(n) for n = 0..299
Maciej Bendkowski, Katarzyna Grygiel, Pierre Lescanne, Marek Zaionc, A Natural Counting of Lambda Terms, SOFSEM 2016: 183-194.
Maciej Bendkowski, K Grygiel, P Tarau, Random generation of closed simply-typed lambda-terms: a synergy between logic programming and Boltzmann samplers, arXiv preprint arXiv:1612.07682 [cs.LO], 2016-2017.
FORMULA
L(0,m) = 0.
L(n+1,m) = (Sum_{k=0..n} L(k,m)*L(n-k,m)) + L(n,m+1) + [m >= n+1], where [p(n,m)] = 1 if p(n,m) is true and [p(n,m)] = 0 if p(n,m) is false then one considers the sequence (L(n,0)).
MATHEMATICA
L[0, _] = 0; L[n_, m_] := L[n, m] = Sum[L[k, m]*L[n-k-1, m], {k, 0, n-1}] + L[n-1, m+1] + Boole[m >= n];
a[n_] := L[n, 0];
Table[a[n], {n, 0, 31}] (* Jean-François Alcover, May 23 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre Lescanne, Jul 14 2016
STATUS
approved