The cost charged at a machine step is at most the size of the encoded configuration
ProvedMIPRE.Cost.Machine.stepCost_le_sizeThe evaluation machine of the ambient cost model charges, at each of its steps, the cost of the evaluation rule that the step implements: from a configuration in evaluation mode the charge is for a program (the value is copied), for , for , , and , and for ; from a configuration in return mode it is when the top frame is a loop1 frame (the loop rule is charged when the body's value is dispatched) and otherwise. Summing these charges along a run reproduces exactly the cost of the big-step derivation.
For every configuration ,
where is the data encoding Cfg.toData c of the configuration.
The lemma is a bookkeeping step of the clocked universal machine (blueprint lem:universal-tm): the clocked loop subtracts from its remaining budget with the unary subtraction program, whose cost is quadratic in its arguments, and this inequality lets that cost be bounded in terms of the size guard on configurations alone.
Formalization Note: stepCost is the function of Cost/Machine.lean; the encoding contains the encoded environment as a -chain, so the size of any environment entry is dominated by it, and the program is encoded as , so is dominated as well. The inequality holds with no hypothesis on .
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 MIPRE.Cost.Machine open Polynomial open MIPRE.Cost.Prog
theorem MIPRE.Cost.Machine.stepCost_le_size (c : Cfg) : stepCost c ≤ (Cfg.toData c).size := by sorry