Explicit time transfer of the Kleene fixed point : runs of bound runs of
ProvedMIPRE.Cost.kleeneFix_runs_ofPrograms of the ambient cost model (Prog) read their input as variable and are closed (WellScoped 1) when they read no other variable; (p.Runs x 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 a datum . Programs are encoded as data by their tree serialization , with (esize), and (hardcode p d) is the s-m-n map, running on the pair of the literal and its input. A universal machine (UniversalMachine) is a closed program with a polynomial such that (i) whenever there is with (time_le), and (ii) whenever there is with (halts_of). A polynomial-time map on programs (PolyTimeFun Prog Prog) is a function with a closed program and an explicit polynomial such that for some , for every .
The two-argument program of the fixed-point construction is (kleeneProg): on an input it forms the pair , applies the s-m-n program smnProg to obtain , applies to obtain , pairs the result with and runs on that pair. The fixed point of through is
and the fixed part of its overhead is the number (kleeneOverhead U F)
Statement. If , then there is a cost with and
This is the quantitative core of the efficient Kleene recursion theorem (blueprint lem:kleene, [MNY, Lemma 2.3]); efficient_fixed_point packages the right-hand side into a single polynomial in . The construction and its overhead are exposed as definitions (kleeneFix, kleeneOverhead) because the polynomial-time halting reduction needs the overhead of the fixed point of a family of maps to be bounded uniformly in , which only the explicit form shows.
Formalization Note: The overhead decomposes as the universal machine's polynomial at the argument ; for the three copies of the input made along the way (by the hardcoding prefix, the final pairing and the call of ); and the constant , which gathers seven copies of ( each), the time of computing from , two copies of and units of rule costs. Only this direction — runs of bound runs of — is formalized; see efficient_fixed_point for the departure from [MNY].
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.kleeneFix_runs_of (U : UniversalMachine) (F : PolyTimeFun Prog Prog) {v r : Data}
{t : ℕ} (h : (F (kleeneFix U F)).Runs v r t) :
∃ t' ≤ U.bound.eval (v.size + t + esize (F (kleeneFix U F))) + 3 * v.size +
kleeneOverhead U F,
(kleeneFix U F).Runs v r t' := by sorry