Existence of an efficient universal machine for the ambient cost model
ProvedMIPRE.Cost.exists_efficient_universalFix the ambient cost model of the formalization: programs run on values (binary trees), (in Lean c.Runs v r t) says that on input halts with result at cost , so that for the unique such , and ; every program is encoded as a value (encode c, the tree serialization Prog.toData) of size , and pairs are encoded by . A program is closed (WellScoped 1) when it reads only its input, variable .
An efficient universal machine (UniversalMachine) is a structure consisting of a closed program and a polynomial such that:
- (simulation, with time bound) for every program , input , result and cost with , there is a cost with ;
- (no spurious halting) for every , , and with , there is a cost with .
The theorem states that such a machine exists:
that is, there are a closed program and a polynomial with for all (both sides defined or undefined together, with the same value) and whenever the right-hand side is defined.
This is blueprint lem:universal-tm (the efficient universal Turing machine, [MNY, Lemma 2.1]), the first result of the efficient computability toolkit. It is the universal machine used by the efficient Kleene recursion theorem (efficient_fixed_point, blueprint lem:kleene) and, through it, by the recursive compression lemma; the compression pipeline's deciders use its clocked companion exists_clocked_universal.
Formalization Note: The blueprint states the bound with a polynomial in three arguments ; the Lean uses a single polynomial in their sum, which is equivalent. The structure is stated as data (program and polynomial as fields) rather than as an existential so that downstream definitions can name them; the theorem only asserts that the type is inhabited, and its witness is the self-interpreter selfUniversal of Cost/Universal.lean (program univProg, polynomial univPoly with ). The input is the pair encoded as , and the sizes are node counts of the encodings, which are the bit-lengths of their preorder serializations.
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 open MIPRE open MIPRE.Cost open Polynomial
theorem MIPRE.Cost.exists_efficient_universal : Nonempty UniversalMachine := by sorry