The step function on encoded configurations agrees with the evaluation machine
ProvedMIPRE.Cost.Machine.stepData_toDataThe evaluation machine of the ambient cost model is a small-step abstract machine (of CEK type) whose configurations consist of a control (either "evaluate the program " or "return the value "), an environment (a list of values) and a stack of continuation frames (cons1, cons2, let1, loop1, recording the pending work of a , a or a ). Its transition function is , with final configurations (a returned value and an empty stack) fixed.
Configurations are encoded as data: a configuration is , where the control is ("evaluate ", with the tree encoding of ) or ("return "), and the environment and the stack are -chains, each frame being with tags to in unary. This encoding is , in Lean Cfg.toData. On data, a function is defined directly, using only the first-order operations , , , unary decoding and list indexing, by cases on the encoded control and the encoded top frame.
For every configuration ,
The lemma transports the machine to data. It is the basis of two results: that evaluation in the ambient model is partial recursive in Mathlib's sense (the step on data is primitive recursive, Cost/Partrec.lean), and that the step can be implemented by a program of the model itself (stepProg, Cost/Interpreter.lean), which is the engine of the self-interpreter and hence of the efficient universal machine (blueprint lem:universal-tm).
Formalization Note: stepData is a total function on all data, defined by nested conditionals on Data.unaryToNat of tag fields and on Data.getList for variable lookup; the lemma only concerns its values on well-formed encodings . Programs are encoded by Prog.toData with constructor tags to in unary, and the control, frame and configuration encodings are those of Cost/MachineData.lean. The iterated form stepData^[N] (toData c) = toData (step^[N] c) follows immediately.
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 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_Machine import Definitions.Def_MIPRE_Foundations_Cost_Codable import Definitions.Def_MIPRE_Foundations_Cost_MachineData open MIPRE open MIPRE.Cost open MIPRE.Cost.Machine
theorem MIPRE.Cost.Machine.stepData_toData (c : Cfg) : stepData c.toData = (step c).toData := by sorry