Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Soundness of the budgeted evaluator: whatever it returns is a genuine run

Proved
MIPRE.Cost.Machine.runs_of_runForD

by thomasvidick · Oct 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

computabilitycost-modellist-programsmip-remipre-formalization

The ambient cost model has programs Prog (de Bruijn variables, nil, constants, cons, elim, let_ and loop) acting on binary trees Data, with a timed big-step semantics Eval env p r t: in the environment env, ppp halts with result rrr at cost ttt. p.Runs x r t is Eval [x] p r t, the run of ppp on the single input xxx. Machine.runForD pd x k is the computable budgeted evaluator: from the datum pd encoding a program and the input xxx, it iterates the machine's step function 3k3k3k times from the initial configuration and returns some of the result if the configuration reached is final, and none otherwise. Let ppp be a program, xxx and rrr data and kkk a natural number, and assume runForD (encode p) x k = some r. Then

∃ t∈N,p.Runs x r t.\exists\, t \in \mathbb{N},\qquad p.\mathrm{Runs}\ x\ r\ t .∃t∈N,p.Runs x r t.

This is one of the two directions of the correctness of the budgeted evaluator; with its converse runForD_eq_some (a run of cost at most kkk is found) it gives runForD_eq_some_iff, the decision procedure that lets the tabulations of verifier games fill in their acceptance tables by budgeted runs.

Formalization Note No bound on the cost ttt is asserted; the conclusion is existential in the cost. encode p is Prog.toData p, the program as data. The budget 3k3k3k and the step function are internal to runForD; the hypothesis is an equation between values of type Option Data. The arguments p, x, r, k are implicit and the proposition is MIPRE.Cost.Machine.runs_of_runForD.

Preamble
import Mathlib.Algebra.Polynomial.Eval.Defs
import Mathlib.Computability.Partrec
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_Basic_B
import Definitions.Def_MIPRE_Foundations_Cost_Encoding
import Definitions.Def_MIPRE_Foundations_Cost_Encoding_B
import Definitions.Def_MIPRE_Foundations_Cost_PolyTime
import Definitions.Def_MIPRE_Foundations_Cost_Closure
import Definitions.Def_MIPRE_Foundations_Cost_Machine
import Definitions.Def_MIPRE_Foundations_Cost_Machine_B
import Definitions.Def_MIPRE_Foundations_Cost_Loops
import Definitions.Def_MIPRE_Foundations_Cost_Loops_B
import Definitions.Def_MIPRE_Foundations_Cost_Codable
import Definitions.Def_MIPRE_Foundations_Cost_Codable_B
import Definitions.Def_MIPRE_Foundations_Cost_MachineData
import Definitions.Def_MIPRE_Foundations_Cost_MachineData_B
import Definitions.Def_MIPRE_Foundations_Cost_Unary
import Definitions.Def_MIPRE_Foundations_Cost_MachineBound
import Definitions.Def_MIPRE_Foundations_Cost_MachineBound_B
import Definitions.Def_MIPRE_Foundations_Cost_Partrec
import Definitions.Def_MIPRE_Foundations_Cost_Partrec_B
import Definitions.Def_MIPRE_Foundations_Cost_BoundedEval

open MIPRE
open MIPRE.Cost
open MIPRE.Cost.Machine
Formal statement
theorem MIPRE.Cost.Machine.runs_of_runForD {p : Prog} {x r : Data} {k : ℕ} (h : runForD (encode p) x k = some r) :
    ∃ t, p.Runs x r t := by sorry
Source
https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/Foundations/Cost/BoundedEval.lean#L76-L89

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me