cfahlgren1/math / lean /OAI /Computability /MaxCut /Machines /PoweringRuntimeBudget.lean
cfahlgren1's picture
download
raw
4.34 kB
import Mathlib
import OAI.Computability.MaxCut.Machines.PoweringMachineGlobal
namespace OAI
/-!
# Finishing cost from the actual preceding machine execution
Every stack can grow by at most the fixed program's push bound in one
transition. Consequently an actual bounded execution from the standard input
configuration supplies the uniform stack bound needed by the finishing phase.
The bound below uses the same global machine for that preceding execution; no
separate tape-size hypothesis or numerical simulation is substituted for it.
-/
namespace MaxCutGames.Foundations.Complexity.PoweringRuntimeBudget
open Turing
/-- Uniform stack growth along an actual execution, from any initial configuration. -/
theorem stackLength_le_of_execution (tm : FinTM2) (start finish : tm.Cfg)
(initialBound priorBudget : Nat)
(initial : ∀ k, (start.stk k).length ≤ initialBound)
(prior : StateTransition.EvalsToInTime tm.step start (some finish) priorBudget)
(k : tm.K) :
(finish.stk k).length ≤ initialBound + priorBudget * Runtime.programPushBound tm := by
have grown := Runtime.executionSizeBound tm.step (fun cfg => (cfg.stk k).length)
(Runtime.programPushBound tm) (Runtime.stepStackLength tm k) prior
exact grown.trans (Nat.add_le_add_right (initial k) _)
/-- Standard input initialization bounds every initial stack by the input length. -/
theorem stackLength_le_from_input (tm : FinTM2) (input : List (tm.Γ tm.k₀))
(finish : tm.Cfg) (priorBudget : Nat)
(prior : StateTransition.EvalsToInTime tm.step (initList tm input)
(some finish) priorBudget) (k : tm.K) :
(finish.stk k).length ≤ input.length + priorBudget * Runtime.programPushBound tm :=
stackLength_le_of_execution tm (initList tm input) finish input.length priorBudget
(Runtime.initialStackLength tm input) prior k
/-- Cleanup's concrete tape count is the size of the global tape enumeration. -/
abbrev tapeCount (radius : Nat) : Nat :=
4 + (11 + PoweringMachineRowBody.capacity radius + 1)
/-- The actual global prefix execution supplies every finishing stack bound.
The physical header premises are used by `PoweringMachineFinish.traceAt`; this
arithmetic consequence of that prefix is valid for any two proposed header values. -/
theorem finish_steps_le_of_execution (d radius : Nat) (input : List Bool)
(before : (PoweringMachineGlobal.machine d radius).Cfg)
(priorBudget vertices darts : Nat)
(prior : StateTransition.EvalsToInTime (PoweringMachineGlobal.machine d radius).step
(initList (PoweringMachineGlobal.machine d radius) input) (some before) priorBudget) :
PoweringMachineFinish.steps (PoweringMachineGlobal.enumeration radius)
(PoweringMachineGlobal.outputTape radius) before.stk vertices darts ≤
2 * (vertices + darts) + 6 + tapeCount radius *
(input.length + priorBudget * Runtime.programPushBound
(PoweringMachineGlobal.machine d radius) + vertices + darts + 3) := by
exact PoweringMachineFinish.steps_le_uniform (PoweringMachineGlobal.enumeration radius)
(PoweringMachineGlobal.outputTape radius) before.stk vertices darts
(input.length + priorBudget * Runtime.programPushBound (PoweringMachineGlobal.machine d radius))
(stackLength_le_from_input (PoweringMachineGlobal.machine d radius) input before priorBudget prior)
/-- Total transitions of the actual prefix plus the exact finishing cost. -/
theorem total_steps_le_of_execution (d radius : Nat) (input : List Bool)
(before : (PoweringMachineGlobal.machine d radius).Cfg)
(priorBudget vertices darts : Nat)
(prior : StateTransition.EvalsToInTime (PoweringMachineGlobal.machine d radius).step
(initList (PoweringMachineGlobal.machine d radius) input) (some before) priorBudget) :
prior.steps + PoweringMachineFinish.steps (PoweringMachineGlobal.enumeration radius)
(PoweringMachineGlobal.outputTape radius) before.stk vertices darts ≤
priorBudget + (2 * (vertices + darts) + 6 + tapeCount radius *
(input.length + priorBudget * Runtime.programPushBound
(PoweringMachineGlobal.machine d radius) + vertices + darts + 3)) :=
Nat.add_le_add prior.steps_le_m
(finish_steps_le_of_execution d radius input before priorBudget vertices darts prior)
end MaxCutGames.Foundations.Complexity.PoweringRuntimeBudget
end OAI

Xet Storage Details

Size:
4.34 kB
·
Xet hash:
f0ab589c82bd65428ed7817f5003d6336a22ee1891cc7ccc0c32552b3efc7bd3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.