Efficient Kleene recursion theorem: a polynomial-time map on programs has a fixed point, with polynomial time transfer
ProvedMIPRE.Cost.efficient_fixed_pointPrograms of the ambient cost model (Prog) read their input as variable ; a program is closed (p.WellScoped 1) if it reads no other variable; (p.Runs v r t) says that run on the input halts with result at cost in the timed big-step semantics, and is the number of nodes of the datum . Programs are encoded as data by their tree serialization , with . A polynomial-time map on programs (PolyTimeFun Prog Prog) is a function together with a closed program computing from within an explicit polynomial bound .
Statement. For every polynomial-time map on programs there exist a program and a polynomial such that
- is closed;
- for all : , that is, and compute the same partial function, ;
- for all : if , then there is with .
This is the efficient Kleene recursion theorem (blueprint lem:kleene, [MNY, Lemma 2.3]), the last piece of the efficient computability toolkit after the universal machine (lem:universal-tm) and the s-m-n theorem (lem:smn). The recursive compression lemma and the compressibility criterion apply it to the map to obtain the self-referential decider that computes ; clause 3 is what makes a polynomial-time, hence succinct, description at every level of the recursion.
Formalization Note: The fixed point is the explicit program kleeneFix U F for the two-argument program (kleeneProg), built from a universal machine obtained from exists_efficient_universal, and the polynomial is with the constant of kleeneFix_runs_of. The map acts on programs rather than on bit strings as in the paper, programs being their own descriptions in this model. Departure from [MNY, Lemma 2.3], recorded in the source: the paper states the runtimes of and as polynomially equivalent; only the direction "runs of bound runs of " is used by the recursive compression argument, and only it follows from the time-transfer clause of the universal machine. The converse would require a universal machine that is never faster than the simulated program, a clause deliberately omitted from UniversalMachine to keep that obligation minimal.
import Mathlib.Algebra.Polynomial.Eval.Defs import Mathlib.Computability.Primrec.List import Mathlib.Data.List.Basic import Mathlib.Data.Nat.Bits import Mathlib.Data.Nat.Notation import Mathlib.Data.Nat.Size import Mathlib.Logic.Denumerable import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring import Definitions.Def_MIPRE_Foundations_Cost_Basic import Definitions.Def_MIPRE_Foundations_Cost_Encoding import Definitions.Def_MIPRE_Foundations_Cost_PolyTime import Definitions.Def_MIPRE_Foundations_Cost_Closure import Definitions.Def_MIPRE_Foundations_Cost_Loops import Definitions.Def_MIPRE_Foundations_Cost_Unary import Definitions.Def_MIPRE_Foundations_Cost_Toolkit import Definitions.Def_MIPRE_Foundations_Cost_Machine import Definitions.Def_MIPRE_Foundations_Cost_Codable import Definitions.Def_MIPRE_Foundations_Cost_MachineData import Definitions.Def_MIPRE_Foundations_Cost_Interpreter import Definitions.Def_MIPRE_Foundations_Cost_MachineBound import Definitions.Def_MIPRE_Foundations_Cost_Universal import Definitions.Def_MIPRE_Foundations_Cost_Kleene open MIPRE open MIPRE.Cost open Polynomial
theorem MIPRE.Cost.efficient_fixed_point (F : PolyTimeFun Prog Prog) :
∃ (e : Prog) (p : Polynomial ℕ),
e.WellScoped 1 ∧
(∀ v r, (∃ t, e.Runs v r t) ↔ ∃ t, (F e).Runs v r t) ∧
∀ v r t, (F e).Runs v r t → ∃ t' ≤ p.eval (v.size + t), e.Runs v r t' := by sorry