Backward run of the Kleene two-argument program : a halting run comes from a run of on
ProvedMIPRE.Cost.Prog.kleeneProg_halts_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.
Statement. Let be a universal machine, a polynomial-time map on programs and a program, and write . If for some cost , then
This is the backward half of the fixed-point construction for the efficient Kleene recursion theorem (blueprint lem:kleene, [MNY, Lemma 2.3]): the fixed point halts only when its image does, with the same result. It enters kleeneFix_halts_iff, hence the input/output equivalence clause of efficient_fixed_point.
Formalization Note: The conclusion carries no time bound, by design: bounding the runs of by those of would need a universal machine that is never faster than the program it simulates, a lower-bound clause that the formalization's UniversalMachine does not include (see the departure recorded at efficient_fixed_point).
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 MIPRE.Cost.Prog open Polynomial
theorem MIPRE.Cost.Prog.kleeneProg_halts_of (U : UniversalMachine) (F : PolyTimeFun Prog Prog) (x : Prog)
{v r : Data} {T : ℕ} (h : (kleeneProg U.univ F).Runs (.cons (encode x) v) r T) :
∃ t, (F (hardcode x (encode x))).Runs v r t := by sorry