Busy Beaver for lambda calculus: Difference between revisions
(→Champions: Proper credit for discovery) |
(Removed the link as it is already given above) |
||
(40 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
'''Busy Beaver for lambda calculus''' ('''BBλ''') is a variation of the [[Busy Beaver]] problem for [https://en.wikipedia.org/wiki/Lambda_calculus lambda calculus] invented by John Tromp. BBλ(n) = the maximum normal form size of any closed lambda term of size n. If you are not familiar with lambda calculus and beta-reduction, | '''Busy Beaver for lambda calculus''' ('''BBλ''') is a variation of the [[Busy Beaver]] problem for [https://en.wikipedia.org/wiki/Lambda_calculus lambda calculus] invented by John Tromp. BBλ(n) = the maximum normal form size of any closed lambda term of size n. Like the traditional Busy Beaver functions, it is uncomputable (and in fact grows faster than any computable function). If you are not familiar with lambda calculus and beta-reduction, it is recommended to start with that article. | ||
Size is measured in bits using [https://tromp.github.io/cl/Binary_lambda_calculus.html Binary Lambda Calculus] which is a binary prefix-free encoding for all closed lambda calculus terms. | Size is measured in bits using [https://tromp.github.io/cl/Binary_lambda_calculus.html Binary Lambda Calculus] which is a binary prefix-free encoding for all closed lambda calculus terms. | ||
Line 12: | Line 12: | ||
Note: That unlike for Turing machines, evaluating lambda terms is non-deterministic. Specifically, there may be multiple beta-reductions possible in a given term. However, if a term can be reduced to a normal form, that normal form is unique. It is not possible to reduce the original term to any different normal form. A term is '''strongly normalizing''' if any choice of beta-reductions will lead to this normal form and '''weakly normalizing''' if there exist divergent reduction paths which never reach the normal form. | Note: That unlike for Turing machines, evaluating lambda terms is non-deterministic. Specifically, there may be multiple beta-reductions possible in a given term. However, if a term can be reduced to a normal form, that normal form is unique. It is not possible to reduce the original term to any different normal form. A term is '''strongly normalizing''' if any choice of beta-reductions will lead to this normal form and '''weakly normalizing''' if there exist divergent reduction paths which never reach the normal form. | ||
== Proof of Uncomputability == | |||
The proof that BBλ(n) is uncomputable is very similar to Radó's original proof that Σ(n) is uncomputable. Proof by contradiction: | |||
Assume BBλ is computable and so there exists a term ''f'' which computes it on [[wikipedia:Church_encoding|Church numerals]]. In other words: for all <math>n \in \N</math>: <math>(f \; C_n)</math> beta reduces to normal form <math>C_{BB\lambda(n)}</math> (where <math>C_n</math> denotes the Church numeral ''n''). Denote the binary lambda encoded size of ''f'' as ''k''. Consider the term <math>f \; (C_2 \; C_n)</math> which has size <math>5n + k + 26</math> bits. This term reduces to <math>C_{BB\lambda(n^2)}</math> which has size <math>5 \cdot BB\lambda(n^2) + 6</math> bits. But for sufficiently large n, <math>n^2 > 5n + k + 26</math> and so <math>5 \cdot BB\lambda(n^2) + 6 > BB\lambda(5n + k + 26)</math>. But this is a contradiction, we've found a <math>5n + k + 26</math> bit term which reduces to a normal form larger than <math>BB\lambda(5n + k + 26)</math>. | |||
Thus BBλ(n) is uncomputable. A variation of this argument shows that BBλ(n) eventually dominates all computable functions. | |||
== Binary Lambda Encoding == | == Binary Lambda Encoding == | ||
Line 53: | Line 60: | ||
!BBλ(n) | !BBλ(n) | ||
!Champion | !Champion | ||
!# Beta reductions | |||
!Normal form | !Normal form | ||
!Discovered By | !Discovered By | ||
|- | |- | ||
|21 || = 22 || <code>(\1 1) (1 (\2))</code> | | |21 || = 22 || <code>\(\1 1) (1 (\2))</code> | ||
|1|| <code>\(1 (\2)) (1 (\2))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
| | |22 || = 24 || <code>\(\1 1) (1 (\\1))</code><code>\(\1 1 1) (1 1)</code> | ||
|1 | |||
1 | |||
| <code>\(1 (\\1)) (1 (\\1))</code> <code>\(1 1) (1 1) (1 1)</code>||John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|23 || = 26 || <code>(\1 1) (1 (\\2))</code> || <code>(1 (\\2)) (1 (\\2))</code> || John Tromp & Bertram Felgenhauer | |23 || = 26 || <code>\(\1 1) (1 (\\2))</code> | ||
|1|| <code>\(1 (\\2)) (1 (\\2))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|24 || = 30 || <code>(\1 1 1) (1 (\1))</code> || <code>(1 (\1)) (1 (\1)) (1 (\1))</code> || John Tromp & Bertram Felgenhauer | |24 || = 30 || <code>\(\1 1 1) (1 (\1))</code> | ||
|1|| <code>\(1 (\1)) (1 (\1)) (1 (\1))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|25 || = 42 || <code>\(\1 1) (\1 (2 1))</code> || <code>\1 (\1 (2 1)) (1 (1 (\1 (2 1))))</code> || John Tromp & Bertram Felgenhauer | |25 || = 42 || <code>\(\1 1) (\1 (2 1))</code> | ||
|3|| <code>\1 (\1 (2 1)) (1 (1 (\1 (2 1))))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|26 || = 52 || <code>(\1 1) (\\2 (1 2))</code> || <code>\\2 (\\2 (1 2)) (1 (2 (\\2 (1 2))))</code> || John Tromp & Bertram Felgenhauer | |26 || = 52 || <code>(\1 1) (\\2 (1 2))</code> | ||
|3|| <code>\\2 (\\2 (1 2)) (1 (2 (\\2 (1 2))))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|27 || = 44 || <code>\\(\1 1) (\1 (2 1))</code> || <code>\\1 (\1 (2 1)) (1 (1 (\1 (2 1))))</code> || John Tromp & Bertram Felgenhauer | |27 || = 44 || <code>\\(\1 1) (\1 (2 1))</code> | ||
|3|| <code>\\1 (\1 (2 1)) (1 (1 (\1 (2 1))))</code> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|28 || = 58 || <code>\(\1 1) (\1 (2 (\2))))</code> || || John Tromp & Bertram Felgenhauer | |28 || = 58 || <code>\(\1 1) (\1 (2 (\2))))</code> | ||
|3|| <code>\1 (\\1 (3 (\2))) (1 (\2 (\\1 (4 (\2)))))</code>|| John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
| 29 || = 223|| <code>\(\1 1) (\1 (1 (2 1)))</code>|| ||John Tromp & Bertram Felgenhauer | | 29 || = 223|| <code>\(\1 1) (\1 (1 (2 1)))</code> | ||
|4|| <pre> | |||
\B (B (1 B)) | |||
where: | |||
B = (A (A (1 A))) | |||
A = (1 (\1 (1 (2 1)))) | |||
</pre>||John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|30 | |30 | ||
|= 160 | |= 160 | ||
|<code>(\1 1 1) (\\2 (1 2))</code> | |<code>(\1 1 1) (\\2 (1 2))</code> and | ||
| | <code>(\1 (1 1)) (\\2 (1 2))</code> | ||
|7 | |||
5 | |||
|<pre> | |||
\\2 B A (1 (2 B A)) | |||
where: | |||
B = (\\2 A (1 (2 A))) | |||
A = (\\2 (1 2)) | |||
</pre> | |||
|John Tromp & Bertram Felgenhauer | |John Tromp & Bertram Felgenhauer | ||
|- | |- | ||
Line 85: | Line 115: | ||
|= 267 | |= 267 | ||
|<code>(\1 1) (\\2 (2 (1 2)))</code> | |<code>(\1 1) (\\2 (2 (1 2)))</code> | ||
| | |6 | ||
|<pre> | |||
\\2 A (2 A (C (2 A))) | |||
where: | |||
C = (2 A (2 A (1 B (2 A)))) | |||
B = (\3 A (3 A (1 (3 A)))) | |||
A = (\\2 (2 (1 2))) | |||
</pre> | |||
|John Tromp & Bertram Felgenhauer | |John Tromp & Bertram Felgenhauer | ||
|- | |- | ||
Line 91: | Line 128: | ||
|= 298 | |= 298 | ||
|<code>\(\1 1) (\1 (1 (2 (\2))))</code> | |<code>\(\1 1) (\1 (1 (2 (\2))))</code> | ||
| | |||
| | | | ||
|John Tromp & Bertram Felgenhauer | |John Tromp & Bertram Felgenhauer | ||
Line 97: | Line 135: | ||
|= 1812 | |= 1812 | ||
|<code>\(\1 1) (\1 (1 (1 (2 1))))</code> | |<code>\(\1 1) (\1 (1 (1 (2 1))))</code> | ||
| | |5 | ||
|<pre> | |||
\C (C (C (1 C))) | |||
where: | |||
C = (B (B (B (1 B))) | |||
B = (A (A (A (1 A))) | |||
A = (1 (\1 (1 (1 (2 1))))) | |||
</pre> | |||
|John Tromp & Bertram Felgenhauer | |John Tromp & Bertram Felgenhauer | ||
|- | |- | ||
|34 || <math>= 5 \left(2^{2^{2^2}}\right) + 6 = 327\,686</math> | |34 || <math>= \ 5 \left(2^{2^{2^2}}\right) + 6 = 327\,686</math> | ||
| <code>(\1 1 1 1) (\\2 (2 1))</code> || <math>C(2^{2^{2^2}})</math> || John Tromp & Bertram Felgenhauer | | <code>(\1 1 1 1) (\\2 (2 1))</code> and | ||
<code>(\1 (1 1) 1) (\\2 (2 1))</code> | |||
| || <math>C(2^{2^{2^2}})</math> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|35 || <math>= 5 \left(3^{3^3}\right) + 6 > 3.8 \times 10^{13}</math> | |35 || <math>= 5 \left(3^{3^3}\right) + 6 > 3.8 \times 10^{13}</math> | ||
| <code>(\1 1 1) (\\2 (2 (2 1)))</code> || <math>C(3^{3^3})</math> || John Tromp & Bertram Felgenhauer | | <code>(\1 1 1) (\\2 (2 (2 1)))</code> | ||
| || <math>C(3^{3^3})</math> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|36 || <math>= 5 \left(2^{2^{2^3}}\right) + 6 > 5.7 \times 10^{77}</math> | |36 || <math>= 5 \left(2^{2^{2^3}}\right) + 6 > 5.7 \times 10^{77}</math> | ||
| <code>(\1 1 1 1 | | <code>(\1 1) (\1 (1 (\\2 (2 1))))</code> | ||
| || <math>C(2^{2^{2^3}})</math>|| John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|37 || || || || | |37 || <math> = BB\lambda(35)+2</math> | ||
| <code>\(\1 1 1) (\\2 (2 (2 1)))</code> | |||
| || <math>\lambda x. C(3^{3^3})</math>||mxdys, tromp, dyuan, sligocki | |||
|- | |- | ||
|38 || <math>\ge 5 \left(2^{2^{2^{2^2}}}\right) + 6 > 10^{10^4}</math> | |38 || <math>\ge 5 \left(2^{2^{2^{2^2}}}\right) + 6 > 10^{10^4}</math> | ||
| <code>(\1 1 1 1 1) (\\2 (2 1))</code> || <math>C(2^{2^{2^{2^2}}})</math> || John Tromp & Bertram Felgenhauer | | <code>(\1 1 1 1 1) (\\2 (2 1))</code> and | ||
<code>(\1 (1 1) 1 1) (\\2 (2 1))</code> | |||
| || <math>C(2^{2^{2^{2^2}}})</math> || John Tromp & Bertram Felgenhauer | |||
|- | |- | ||
|39 || <math>\ge 5 \left(3^{3^{3^3}}\right) + 6 > 10^{10^{12}}</math> | |39 || <math>\ge 5 \left(3^{3^{3^3}}\right) + 6 > 10^{10^{12}}</math> | ||
| <code>(\1 1 1 1) (\\2 (2 (2 1)))</code> || <math>C(3^{3^{3^3}})</math> || John Tromp & Bertram Felgenhauer | | <code>(\1 1 1 1) (\\2 (2 (2 1)))</code> | ||
| || <math>C(3^{3^{3^3}})</math> || John Tromp & Bertram Felgenhauer | |||
|- | |||
|40 || <math> > (2\uparrow\uparrow)^{15} 33 > 10 \uparrow\uparrow\uparrow 16</math> | |||
| <code>(\1 1 1) (\1 (\\2 (2 1)) 1)</code> | |||
| || <math>\lambda x.T(k)</math> where <math>T(0)=x,\;T(n+1)=T(n)\;C(2)\;T(n)</math> and <math>k > (2\uparrow\uparrow)^{15} 33</math> || mxdys and racheline | |||
|- | |||
|41 || <math>\ge 5 \left(3^{3^{85}}\right) + 6 > 10^{10^{40}}</math> | |||
| <code>(\1 (\1 1) 1) (\\2 (2 (2 1)))</code> | |||
| || <math>C(3^{3^{85}})</math>||mxdys | |||
|- | |||
|42 ||<math> \ge BB\lambda(40)+2</math> | |||
|<code>\(\1 1 1) (\1 (\\2 (2 1)) 1)</code> | |||
| || || | |||
|- | |||
|43 ||<math> > 2 \uparrow\uparrow\uparrow 2 \uparrow\uparrow\uparrow 2 \uparrow\uparrow 8</math> | |||
|<code>(\1 1) (\1 (\1 (\\2 (2 1)) 2))</code> | |||
| || <math>\lambda x.T(k)</math> where <math>T(0)=x,\;T(n+1)=T(n)\;(\lambda y.y\;C(2)\;T(n))</math> and <math>k > 2 \uparrow\uparrow\uparrow 2 \uparrow\uparrow\uparrow 2 \uparrow\uparrow 8</math>||mxdys | |||
|- | |||
|44 || <math> > 10 \uparrow\uparrow\uparrow 10 \uparrow\uparrow\uparrow 16</math> | |||
| <code>(\1 1 1 1) (\1 (\\2 (2 1)) 1)</code> | |||
| || <math>\lambda x.T(k)</math> where <math>T(0)=x,\;T(n+1)=T(n)\;C(2)\;T(n)</math> and <math>k > (2\uparrow\uparrow)^{(2\uparrow\uparrow)^{15} 33 - 1} 33</math> || | |||
|- | |||
|45 || <math> \ge BB\lambda(43)+2</math> | |||
| <code>\(\1 1) (\1 (\1 (\\2 (2 1)) 2))</code> | |||
| || || | |||
|- | |||
|46 || <math> \ge BB\lambda(44)+2</math> | |||
| <code>\(\1 1 1 1) (\1 (\\2 (2 1)) 1)</code> | |||
| || || | |||
|- | |||
|47 || | |||
| | |||
| || || | |||
|- | |||
|48 || <math> > 10 \uparrow\uparrow\uparrow 10 \uparrow\uparrow\uparrow 10 \uparrow\uparrow\uparrow 16</math> | |||
| <code>(\1 1 1 1 1) (\1 (\\2 (2 1)) 1)</code> | |||
| || <math>\lambda x.T(k)</math> where <math>T(0)=x,\;T(n+1)=T(n)\;C(2)\;T(n)</math> and <math>k > (2\uparrow\uparrow)^{(2\uparrow\uparrow)^{(2\uparrow\uparrow)^{15} 33 - 1} 33 - 1} 33</math> || | |||
|- | |- | ||
| | |49 | ||
| <code>(\1 1 (\1 1 | |<math>> f_{\omega+1}\left(\frac{2 \uparrow\uparrow 6}{2}\right) > \text{Graham's number}</math> | ||
|<code>(\1 1) (\1 (1 (\\1 2 (\\2 (2 1)))))</code> | |||
| | |||
|<math>C(N) \text{ for } N \approx f_{\omega+1}\left(\frac{2 \uparrow\uparrow 6}{2}\right)</math> | |||
|[https://github.com/tromp/AIT/blob/master/fast_growing_and_conjectures/melo.lam Gustavo Melo] | |||
|- | |- | ||
|... | |... | ||
| | |||
| | | | ||
| | | | ||
Line 126: | Line 221: | ||
| | | | ||
|- | |- | ||
| | |1850 | ||
| <code> | |> Loader's number | ||
|<code>too large to show</code> | |||
| | | | ||
| | | | ||
|[https://codegolf.stackexchange.com/questions/176966/golf-a-number-bigger-than-loaders-number/274634#274634 John Tromp] | |||
|} | |||
Where <math>C(n)</math> represents the Church numeral ''n'' (<math>\lambda f x. f^n(x)</math>) written as <code>\\2 (2 ... (2 1)...)</code> with ''n'' 2s in this text representation. | |||
== Oracle Busy Beaver == | |||
While BBλ grows uncomputably fast, one can define functions that grow much faster. | |||
Let's define a higher order busy beaver function BBλ<sub>1</sub> by providing oracle access to BBλ. | |||
This is done by enriching the set of terms and possible reduction steps considered in the BB definition. | |||
A 1-closed term is a term in de Bruijn notation that is closed with 1 additional lambda in front. Any variable bound to that lambda is a free variable '''f''' in the term. | |||
An oracle reduction step reduces '''f''' t, where t is a closed normal form of size s, to Church numeral BB(s). | |||
Note that this is almost identical to the oracle steps in Barendregt and Klop's "Applications of infinitary lambda calculus", except that they require t itself to be church numeral s, while we prefer to make oracle steps as widely applicable as possible, while the domain of BBλ already consists of term sizes. | |||
Now let BBλ<sub>1</sub> be the maximum beta/oracle normal form size of any 1-closed lambda term of size n, or 0 if no 1-closed term of size n exists. This appears as sequence [[oeis:A385712|A385712]] in the OEIS. | |||
The following table shows values of BBλ<sub>1</sub> up to 22 plus a lower bound for 28, with larger values expressed in terms of function <math>f(n) = 6 + 5 \times BB \lambda(n)</math>: | |||
{| class="wikitable" | |||
|+ | |||
!n | |||
!champion | |||
!BBλ<sub>1</sub> | |||
|- | |||
|1 | |||
| | | | ||
|0 | |||
|- | |||
|2 | |||
|<code>1</code> | |||
|1 | |||
|- | |||
|3 | |||
| | | | ||
|0 | |||
|- | |||
|4 | |||
|<code>\1</code> | |||
|4 | |||
|- | |- | ||
| | |5 | ||
| <code>(\1 (\1 (\1 1) 1) 1) (\\2 (2 1))</code> || || | |<code>\2</code> | ||
|5 | |||
|- | |||
|6 | |||
|<code>\\1</code> | |||
|6 | |||
|- | |||
|7 | |||
|<code>\\2</code> | |||
|7 | |||
|- | |||
|8 | |||
|<code>1 (\1)</code> | |||
|<math>f(4) = 26</math> | |||
|- | |||
|9 | |||
|<code>\\2</code> | |||
|9 | |||
|- | |||
|10 | |||
|<code>1 (\\1)</code> | |||
|<math>f(6) = 36</math> | |||
|- | |||
|11 | |||
|<code>1 (\\2)</code> | |||
|<math>f(7) = 41</math> | |||
|- | |||
|12 | |||
|<code>1 (1 (\1))</code> | |||
|<math>f^{2}(4) = 266</math> | |||
|- | |||
|13 | |||
|<code>1 (\\2)</code> | |||
|<math>f(9) = 51</math> | |||
|- | |||
|14 | |||
|<code>1 (1 (\\1))</code> | |||
|<math>f^{2}(6) = f(36) = 25 \times 2^{2^{2^{3}}}+36 > 2.85 \times 10^{78}</math> | |||
|- | |||
|15 | |||
|<code>1 (1 (\\2))</code> | |||
|<math>f^{2}(7) = f(41) \geq 25 \times 3^{3^{85}}+36 > 10^{10^{40}}</math> | |||
|- | |||
|16 | |||
|<code>1 (1 (1 (\1)))</code> | |||
|<math>f^{3}(4) = f(266)</math> | |||
|- | |||
|17 | |||
|<code>1 (1 (\\\2))</code> | |||
|<math>f^2(9) = f(51)</math> | |||
|- | |||
|18 | |||
|<code>1 (\1) 1 (\1)</code> | |||
|<math>f^4(4) </math> | |||
|- | |||
|19 | |||
|<code>1 (1 (1 (\\2)))</code> | |||
|<math>f^3(7)</math> | |||
|- | |||
|20 | |||
|<code>1 (\\1) 1 (\1)</code> | |||
|<math>f^6(4)</math> | |||
|- | |||
|21 | |||
|<code>1 (\\2) 1 (\1)</code> | |||
|<math>f^7(4)</math> | |||
|- | |||
|22 | |||
|<code>1 (1 (\1)) 1 (\1)</code> | |||
|<math>f^{52}(4)</math> | |||
|- | |- | ||
|... | |... | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |28 | ||
|<code>1 (\1) 1 (\1) 1 (\1)</code> | |||
|<code>(\1 1 (\ | |<math>\ge f^{BB \lambda(f^3(4))}(4)</math> | ||
| | |||
|} | |} | ||
We can generalize BBλ<sub>1</sub> to BBλ<sub>α</sub> for ordinals α by using oracle function BBλ<sub>α-1</sub> for successor ordinal a, and oracle function (\n -> BBλ<sub>α[n]</sub>(n)) for limit ordinal α, assuming well-defined fundamental sequences up to α. Because of limited oracle inputs, all oracle busy beavers have identical values up to n=11. | |||
== See Also == | == See Also == | ||
Line 159: | Line 356: | ||
* [https://tromp.github.io/cl/Binary_lambda_calculus.html Binary Lambda Calculus]. John Tromp. | * [https://tromp.github.io/cl/Binary_lambda_calculus.html Binary Lambda Calculus]. John Tromp. | ||
* https://github.com/tromp/AIT/tree/master/BB | * https://github.com/tromp/AIT/tree/master/BB | ||
[[category:Functions]] |
Latest revision as of 11:29, 15 August 2025
Busy Beaver for lambda calculus (BBλ) is a variation of the Busy Beaver problem for lambda calculus invented by John Tromp. BBλ(n) = the maximum normal form size of any closed lambda term of size n. Like the traditional Busy Beaver functions, it is uncomputable (and in fact grows faster than any computable function). If you are not familiar with lambda calculus and beta-reduction, it is recommended to start with that article.
Size is measured in bits using Binary Lambda Calculus which is a binary prefix-free encoding for all closed lambda calculus terms.
Analogy to Turing machines
We evaluate terms by applying beta-reductions until they reach a normal form. As an analogy to Turing machines:
- Lambda terms are like TM configurations (tape + state + position).
- Applying beta-reduction to a term is like taking a TM step.
- A term is in normal form if no beta-reductions can be applied. This is like saying the term has halted.
- A term may or may not be reducible to a normal form. If it is, this is like saying the term halts.
- Determining whether a term is reducible to a normal form is an undecidable problem equivalent to the halting problem.
Note: That unlike for Turing machines, evaluating lambda terms is non-deterministic. Specifically, there may be multiple beta-reductions possible in a given term. However, if a term can be reduced to a normal form, that normal form is unique. It is not possible to reduce the original term to any different normal form. A term is strongly normalizing if any choice of beta-reductions will lead to this normal form and weakly normalizing if there exist divergent reduction paths which never reach the normal form.
Proof of Uncomputability
The proof that BBλ(n) is uncomputable is very similar to Radó's original proof that Σ(n) is uncomputable. Proof by contradiction:
Assume BBλ is computable and so there exists a term f which computes it on Church numerals. In other words: for all : beta reduces to normal form (where denotes the Church numeral n). Denote the binary lambda encoded size of f as k. Consider the term which has size bits. This term reduces to which has size bits. But for sufficiently large n, and so . But this is a contradiction, we've found a bit term which reduces to a normal form larger than .
Thus BBλ(n) is uncomputable. A variation of this argument shows that BBλ(n) eventually dominates all computable functions.
Binary Lambda Encoding
A lambda term using De Bruijn indexes is defined inductively as:
- Variables: For any , Var(n) is a term. It represents a variable bound by the lambda expression n above this one (the De Bruijn index). It is typically written simply as
n
. - Lambdas: For any term T, Lam(T) is a term. It represents a unary function with function body T. It is typically written or
\T
. - Applications: For any terms T, U, App(T, U) is a term. It represents applying function T to argument U. It is typically written
(T U)
.
We can think of this as a tree where each variable is a leaf, a lambda is a node with one child and applications are nodes with 2 children. A term is closed if every variable is bound. In other words, for every Var(n) leaf node, there exists n Lam() nodes above it in the tree of the term.
Encoding (blc()) is defined recursively:
For example, the Church numeral 2: = \\(2 (2 1))
= Lam(Lam(App(Var(2), App(Var(2), Var(1))))
is encoded as 00 00 01 110 01 110 10
or simply 0000011100111010
(spaces are not part of the encoding, only used for demonstration purposes) and thus has size 16 bits.
Text Encoding conventions
For human readability, a text encoding and set of conventions is used in this article. As described earlier we encode a lambda term as:
- Var(n) ->
n
- Lam(T) ->
(\T)
- App(T, U) ->
(T U)
However, parentheses are also dropped in certain cases by convention:
- The outermost parentheses are dropped:
Lam(1)
->\1
andApp(1, 2)
->1 2
. - Parentheses are dropped immediately inside a Lam:
Lam(Lam(1))
->\\1
andLam(App(1, 1))
->\1 1
. - Parentheses are dropped in nested Apps using left associativity:
App(App(1, 2), 3)
->1 2 3
. (Note: parentheses are still required forApp(1, App(2, 3))
->1 (2 3)
).
This is the convention used in John Tromp's code and so is used here for consistency.
Champions
There are no closed lambda terms of size 0, 1, 2, 3 or 5 and so BBλ(n) is not defined for those values. The smallest closed lambda term is \1
which has size 4.
For the rest of n ≤ 20: BBλ(n) = n is trivial and can be achieved via picking any n bit term already in normal form. For example \\...\1
and \\...\2
with k lambdas has size 2k+2 and 2k+3 respectively (for k ≥ 1 and k ≥ 2 respectively).
n | BBλ(n) | Champion | # Beta reductions | Normal form | Discovered By |
---|---|---|---|---|---|
21 | = 22 | \(\1 1) (1 (\2))
|
1 | \(1 (\2)) (1 (\2)) |
John Tromp & Bertram Felgenhauer |
22 | = 24 | \(\1 1) (1 (\\1)) \(\1 1 1) (1 1)
|
1
1 |
\(1 (\\1)) (1 (\\1)) \(1 1) (1 1) (1 1) |
John Tromp & Bertram Felgenhauer |
23 | = 26 | \(\1 1) (1 (\\2))
|
1 | \(1 (\\2)) (1 (\\2)) |
John Tromp & Bertram Felgenhauer |
24 | = 30 | \(\1 1 1) (1 (\1))
|
1 | \(1 (\1)) (1 (\1)) (1 (\1)) |
John Tromp & Bertram Felgenhauer |
25 | = 42 | \(\1 1) (\1 (2 1))
|
3 | \1 (\1 (2 1)) (1 (1 (\1 (2 1)))) |
John Tromp & Bertram Felgenhauer |
26 | = 52 | (\1 1) (\\2 (1 2))
|
3 | \\2 (\\2 (1 2)) (1 (2 (\\2 (1 2)))) |
John Tromp & Bertram Felgenhauer |
27 | = 44 | \\(\1 1) (\1 (2 1))
|
3 | \\1 (\1 (2 1)) (1 (1 (\1 (2 1)))) |
John Tromp & Bertram Felgenhauer |
28 | = 58 | \(\1 1) (\1 (2 (\2))))
|
3 | \1 (\\1 (3 (\2))) (1 (\2 (\\1 (4 (\2))))) |
John Tromp & Bertram Felgenhauer |
29 | = 223 | \(\1 1) (\1 (1 (2 1)))
|
4 | \B (B (1 B)) where: B = (A (A (1 A))) A = (1 (\1 (1 (2 1)))) |
John Tromp & Bertram Felgenhauer |
30 | = 160 | (\1 1 1) (\\2 (1 2)) and
|
7
5 |
\\2 B A (1 (2 B A)) where: B = (\\2 A (1 (2 A))) A = (\\2 (1 2)) |
John Tromp & Bertram Felgenhauer |
31 | = 267 | (\1 1) (\\2 (2 (1 2)))
|
6 | \\2 A (2 A (C (2 A))) where: C = (2 A (2 A (1 B (2 A)))) B = (\3 A (3 A (1 (3 A)))) A = (\\2 (2 (1 2))) |
John Tromp & Bertram Felgenhauer |
32 | = 298 | \(\1 1) (\1 (1 (2 (\2))))
|
John Tromp & Bertram Felgenhauer | ||
33 | = 1812 | \(\1 1) (\1 (1 (1 (2 1))))
|
5 | \C (C (C (1 C))) where: C = (B (B (B (1 B))) B = (A (A (A (1 A))) A = (1 (\1 (1 (1 (2 1))))) |
John Tromp & Bertram Felgenhauer |
34 | (\1 1 1 1) (\\2 (2 1)) and
|
John Tromp & Bertram Felgenhauer | |||
35 | (\1 1 1) (\\2 (2 (2 1)))
|
John Tromp & Bertram Felgenhauer | |||
36 | (\1 1) (\1 (1 (\\2 (2 1))))
|
John Tromp & Bertram Felgenhauer | |||
37 | \(\1 1 1) (\\2 (2 (2 1)))
|
mxdys, tromp, dyuan, sligocki | |||
38 | (\1 1 1 1 1) (\\2 (2 1)) and
|
John Tromp & Bertram Felgenhauer | |||
39 | (\1 1 1 1) (\\2 (2 (2 1)))
|
John Tromp & Bertram Felgenhauer | |||
40 | (\1 1 1) (\1 (\\2 (2 1)) 1)
|
where and | mxdys and racheline | ||
41 | (\1 (\1 1) 1) (\\2 (2 (2 1)))
|
mxdys | |||
42 | \(\1 1 1) (\1 (\\2 (2 1)) 1)
|
||||
43 | (\1 1) (\1 (\1 (\\2 (2 1)) 2))
|
where and | mxdys | ||
44 | (\1 1 1 1) (\1 (\\2 (2 1)) 1)
|
where and | |||
45 | \(\1 1) (\1 (\1 (\\2 (2 1)) 2))
|
||||
46 | \(\1 1 1 1) (\1 (\\2 (2 1)) 1)
|
||||
47 | |||||
48 | (\1 1 1 1 1) (\1 (\\2 (2 1)) 1)
|
where and | |||
49 | (\1 1) (\1 (1 (\\1 2 (\\2 (2 1)))))
|
Gustavo Melo | |||
... | |||||
1850 | > Loader's number | too large to show
|
John Tromp |
Where represents the Church numeral n () written as \\2 (2 ... (2 1)...)
with n 2s in this text representation.
Oracle Busy Beaver
While BBλ grows uncomputably fast, one can define functions that grow much faster.
Let's define a higher order busy beaver function BBλ1 by providing oracle access to BBλ.
This is done by enriching the set of terms and possible reduction steps considered in the BB definition.
A 1-closed term is a term in de Bruijn notation that is closed with 1 additional lambda in front. Any variable bound to that lambda is a free variable f in the term.
An oracle reduction step reduces f t, where t is a closed normal form of size s, to Church numeral BB(s).
Note that this is almost identical to the oracle steps in Barendregt and Klop's "Applications of infinitary lambda calculus", except that they require t itself to be church numeral s, while we prefer to make oracle steps as widely applicable as possible, while the domain of BBλ already consists of term sizes.
Now let BBλ1 be the maximum beta/oracle normal form size of any 1-closed lambda term of size n, or 0 if no 1-closed term of size n exists. This appears as sequence A385712 in the OEIS.
The following table shows values of BBλ1 up to 22 plus a lower bound for 28, with larger values expressed in terms of function :
n | champion | BBλ1 |
---|---|---|
1 | 0 | |
2 | 1
|
1 |
3 | 0 | |
4 | \1
|
4 |
5 | \2
|
5 |
6 | \\1
|
6 |
7 | \\2
|
7 |
8 | 1 (\1)
|
|
9 | \\2
|
9 |
10 | 1 (\\1)
|
|
11 | 1 (\\2)
|
|
12 | 1 (1 (\1))
|
|
13 | 1 (\\2)
|
|
14 | 1 (1 (\\1))
|
|
15 | 1 (1 (\\2))
|
|
16 | 1 (1 (1 (\1)))
|
|
17 | 1 (1 (\\\2))
|
|
18 | 1 (\1) 1 (\1)
|
|
19 | 1 (1 (1 (\\2)))
|
|
20 | 1 (\\1) 1 (\1)
|
|
21 | 1 (\\2) 1 (\1)
|
|
22 | 1 (1 (\1)) 1 (\1)
|
|
... | ||
28 | 1 (\1) 1 (\1) 1 (\1)
|
We can generalize BBλ1 to BBλα for ordinals α by using oracle function BBλα-1 for successor ordinal a, and oracle function (\n -> BBλα[n](n)) for limit ordinal α, assuming well-defined fundamental sequences up to α. Because of limited oracle inputs, all oracle busy beavers have identical values up to n=11.
See Also
- https://oeis.org/A333479
- The largest number representable in 64 bits. 24 Nov 2023. John Tromp.
- Binary Lambda Calculus. John Tromp.
- https://github.com/tromp/AIT/tree/master/BB