`clockRun` returns the timeout value when the program does not halt within the cost budget
ProvedMIPRE.Cost.Machine.clockRun_of_notLet be a program of the ambient cost model and an input, and let be the initial configuration of the evaluation machine for on . Let be the specification of the clocked interpreter loop started on the -th configuration of the run with further iterations, cost budget and size guard : it is the flagged value of the current configuration if that is final, and otherwise either (when , when the cumulative cost would exceed , or when the next configuration exceeds the guard) or the value at the next configuration with one fewer iteration.
Suppose that does not halt on within cost : there are no and with . Then for all with ,
This is the timeout half of the identification of the clocked loop's value with the budgeted result clockedResult (clockRun_eq; the other half is clockRun_of_final), used by the clocked universal machine of blueprint lem:universal-tm.
Formalization Note: The hypothesis is stated with Prog.Runs c v r t, that is, a derivation in the one-element environment , and the cost is the cost of the big-step semantics, not a number of machine steps. The guard plays no role in the conclusion. The condition is what the recursion of clockRun maintains; at it is trivial.
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.clockRun_of_not (c : Prog) (v : Data) (k Θ : ℕ)
(hno : ¬ ∃ r t, t ≤ k ∧ c.Runs v r t) :
∀ b n, costSum ⟨.ev c, [v], []⟩ n ≤ k → clockRun ⟨.ev c, [v], []⟩ k Θ b n = .nil := by sorry