Radó's busy beaver functions for partial recursive codes #
Radó's busy beaver function Σ(n) is the largest number of ones that a halting n-state Turing
machine leaves on a blank tape, and his shift function S(n) is the largest number of steps such a
machine takes Radó, On non-computable functions, Sections V and VI. Each eventually
exceeds every computable function, so neither is computable.
This file formalizes the two functions for Mathlib's acceptable numbering Nat.Partrec.Code,
started on the input 0 (the analogue of the blank tape). The size of a code c is its Gödel
number encode c under Mathlib's Denumerable Code instance. Since encode is a bijection onto
ℕ, exactly n + 1 codes have size at most n, so the maxima below range over finite sets.
bbOutput nis the largest outputc.eval 0of a codecwithencode c ≤ nthat halts on0.bbFuel nis the largest fuelevalnFuel c 0(the least fuel with which Mathlib's clocked evaluatorCode.evalnsucceeds, seeCslibFrontier.Computability.BlumComplexity.Fuel) of such a code. The fuel is the cost measure ofevaln, not the step count of a machine.
Both maxima are attained, because the code Code.zero (of size 0) halts.
For a computable f, let H m = ∑_{i < m} f i. The domination proof adapts Radó's argument: H
plays the role of his majorant F, and the recursion theorem replaces his double application
F(F(x)) and machine chaining to absorb the program's own size. By the recursion theorem
(Nat.Partrec.Code.fixed_point₂) there is a code G that, on input k, outputs
H (encode (w (k + 1))), where w k is the code succ ∘ G ∘ const k. The code w k halts on 0
with output H (encode (w (k + 1))) + 1, which exceeds f n whenever n < encode (w (k + 1)),
and it needs at least as much fuel as its output. Since encode (w k) grows without bound, every
large n satisfies encode (w k) ≤ n < encode (w (k + 1)) for some k, so
f n < bbOutput (encode (w k)) ≤ bbOutput n, and likewise for bbFuel.
Independently, fuel bbFuel n suffices for every halting code of size at most n, so a
computable upper bound on bbFuel would decide the halting problem
(not_exists_computable_bbFuel_le). This is the unrelativized corollary of
Aaronson, Proposition 1, which solves the halting problem with oracle access to
any upper bound on the shift function. The two functions bound each other up to computable changes
of size: bbOutput n < bbFuel (4 * n ^ 2 + 14), and bbFuel n ≤ bbOutput (h n) for a computable
h. So a computable upper bound on bbOutput would also decide the halting problem.
The model differs from Radó's: programs are partial recursive codes measured by Gödel number, not
Turing machines measured by their number of states, and the output is a number rather than a count
of ones. The closest analogues in the literature are Aaronson's busy beaver functions for an
arbitrary programming language L whose programs are bit strings
Aaronson, Section 1: BB_L(n) is the largest number of steps of a halting program
of at most n bits, and a variant defined through Kolmogorov complexity is the largest m with
K_L(m) ≤ n, that is, the largest output of such a program. Aaronson states Propositions 1 and 2
for Turing machines, noting in Section 2 that they hold for any universal model of computation. The
results transfer to Turing machines only through a translation between the two program classes,
which this file does not provide. Within the model, coarser size measures are covered: whenever
n ≤ σ n, the function n ↦ bbOutput (σ n) still dominates every computable function
(eventually_lt_bbOutput_comp). For example, Nat.size (encode c) ≤ ℓ exactly when
encode c ≤ 2 ^ ℓ - 1, so the busy beaver function indexed by bit length is
ℓ ↦ bbOutput (2 ^ ℓ - 1).
Main definitions #
Cslib.BusyBeaver.bbOutput: the busy beaver function, output version.Cslib.BusyBeaver.bbFuel: the busy beaver function, fuel version.
Main results #
Cslib.BusyBeaver.le_bbOutput,Cslib.BusyBeaver.exists_mem_eval_bbOutput,Cslib.BusyBeaver.le_bbFuel,Cslib.BusyBeaver.exists_mem_evalnFuel_bbFuel: the functions are the maxima of finite nonempty sets.Cslib.BusyBeaver.monotone_bbOutput,Cslib.BusyBeaver.monotone_bbFuel: monotonicity.Cslib.BusyBeaver.eventually_lt_bbOutput,Cslib.BusyBeaver.eventually_lt_bbFuel: domination, every computable function is eventually below both functions [Rad62].Cslib.BusyBeaver.not_computable_bbOutput,Cslib.BusyBeaver.not_computable_bbFuel: neither function is computable.Cslib.BusyBeaver.dom_eval_iff_isSome_evaln_bbFuel: a code of size at mostnhalts on0exactly whenevalnsucceeds with fuelbbFuel n.Cslib.BusyBeaver.computablePred_dom_eval_of_bbFuel_le,Cslib.BusyBeaver.not_exists_computable_bbFuel_le: a computable upper bound onbbFueldecides halting, so none exists.Cslib.BusyBeaver.bbOutput_lt_bbFuel,Cslib.BusyBeaver.exists_computable_bbFuel_le_bbOutput: the two functions bound each other up to computable changes of size.Cslib.BusyBeaver.not_exists_computable_bbOutput_le: no computable function boundsbbOutput.
References #
- T. Radó, On non-computable functions, Sections V (Theorem) and VI
- S. Aaronson, The Busy Beaver Frontier, Section 1 (
BB_L), Section 2, Propositions 1 and 2 - G. Boolos, J. Burgess, R. Jeffrey, Computability and Logic, Section 4.2, "The Productivity Function", a textbook treatment for Turing machines (locator from the table of contents; the text was not checked)
Busy beaver, output version [Rad62]: the largest output on input 0 of a code with
Gödel number at most n that halts on 0.
Busy beaver, fuel version [Rad62]: the largest fuel evalnFuel c 0 needed by a code
c with Gödel number at most n that halts on 0. This is the analogue of Radó's shift function
for the evaluator Code.evaln; the fuel is not the step count of a machine.
Every output of a halting code of size at most n is at most bbOutput n.
Some code of size at most n outputs bbOutput n on input 0.
The fuel needed by a halting code of size at most n is at most bbFuel n.
Some code of size at most n needs fuel exactly bbFuel n on input 0.
Radó's theorem for partial recursive codes [Rad62] [Aar20]: every computable
function is eventually below bbOutput.
Radó's theorem for the fuel version [Rad62]: every computable function is eventually
below bbFuel.
Domination survives any reindexing σ of sizes with n ≤ σ n, computable or not. For
σ ℓ = 2 ^ ℓ - 1 this is domination for the busy beaver function indexed by bit length.
Fuel bbFuel n suffices for every halting code of size at most n: such a code halts on 0
exactly when evaln succeeds with fuel bbFuel n.
A computable upper bound on bbFuel decides whether a code halts on 0. This is the
unrelativized corollary of Aaronson, Proposition 1, which solves the halting
problem with oracle access to any upper bound.
No computable function bounds bbFuel from above, since it would decide the halting problem
(ComputablePred.halting_problem). This is a second proof that bbFuel is not computable.
A computable upper bound on bbOutput decides whether a code halts on 0, through
exists_computable_bbFuel_le_bbOutput and computablePred_dom_eval_of_bbFuel_le.