OAI/Computability/MaxCut/Machines/RuntimeSpace.lean
91 declarations, 0 contain sorry, 0 declared as axioms
Intermediate tape-space bounds derived from actual successful machine prefixes, and their use in the separately checked physical finalizer.
- def
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.configurationLengthline 20Source documentation
All stacks are counted, even when their symbol types differ.
def configurationLength (tm : FinTM2) (cfg : tm.Cfg) : Nat := …
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.initial_configurationLengthline 23 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.step_configurationLengthline 33 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.execution_configurationLengthline 43Source documentation
Every successfully executed prefix bounds the space in its actual endpoint.
theorem execution_configurationLength (tm : FinTM2) {start finish : tm.Cfg} {budget : Nat} (run : StateTransition.EvalsToInTime tm.step start (some finish) budget) : configurationLength tm finish ≤ configurationLength tm start + budget * (Fintype.card tm.K * Runtime.programPushBound tm) := …Mentions: OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.configurationLength
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.prefix_configurationLengthline 51 - def
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.spacePolynomialline 58 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.spacePolynomial_evalline 61 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.prefix_length_polynomialline 66 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.totalLength_eq_configurationLengthline 76Source documentation
This equality only identifies the actual endpoint stacks with a Boolean finalizer's stacks. It makes no execution or time assumption.
theorem totalLength_eq_configurationLength (tm : FinTM2) (finish : tm.Cfg) (base : tm.K → List Bool) (sameLengths : ∀ k, (base k).length = (finish.stk k).length) : SourceRuntimeFinish.totalLength base = configurationLength tm finish := by …Mentions: OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeFinish.totalLength, OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.configurationLength
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.finishCost_le_of_prefixline 84Source documentation
The actual physical finalizer's cost is bounded by the space reached by the actual prefix. Repeated cleanup keys remain permitted.
theorem finishCost_le_of_prefix (tm : FinTM2) (input : List (tm.Γ tm.k₀)) {finish : tm.Cfg} {budget : Nat} (run : StateTransition.EvalsToInTime tm.step (initList tm input) (some finish) budget) (clearKeys : List tm.K) (accumulator output : tm.K) (keepAccumulator : accumulator ∉ clearKeys) (keepOutput : output ∉ clearKeys) (covers : ∀ k, k ≠ accumulator → k ≠ output → k ∈ clearKeys) (base : tm.K → List Bool) (outputEmpty : base output = []) (sameLengths : ∀ k, (base k).length = (finish.stk k).length) : SourceRuntimeFinish.finishCost clearKeys accumulator base ≤ input.length + budget * (Fintype.card tm.K * Runtime.programPushBound tm) + clearKeys.length + 2 := by …Mentions: OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeFinish.finishCost
- def
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.completedTimeline 100 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.completedTime_evalline 104 - def
OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeSpace.prefixAndFinishInTimeline 113Source documentation
Composition retains both actual execution witnesses. The cleanup witness is supplied by
SourceRuntimeFinish.finishInTimein the caller's real program.def prefixAndFinishInTime (tm : FinTM2) (input : List (tm.Γ tm.k₀)) (time : Polynomial Nat) {middle finish : tm.Cfg} (prefixRun : StateTransition.EvalsToInTime tm.step (initList tm input) (some middle) (time.eval input.length)) (clearKeys : List tm.K) (accumulator output : tm.K) (keepAccumulator : accumulator ∉ clearKeys) (keepOutput : output ∉ clearKeys) (covers : ∀ k, k ≠ accumulator → k ≠ output → k ∈ clearKeys) (base : tm.K → List Bool) (outputEmpty : base output = []) (sameLengths : ∀ k, (base k).length = (middle.stk k).length) (finishRun : StateTransition.EvalsToInTime tm.step middle (some finish) (SourceRuntimeFinish.finishCost clearKeys accumulator base)) : StateTransition.EvalsToInTime tm.step (initList tm input) (some finish) …Mentions: OAI.MaxCutGames.Foundations.Hastad.SourceRuntimeFinish.finishCost
- inductive
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.ExtraTapeline 144 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.ExtraTape.enumListline 147 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.ExtraTape.enumList_getElem?_ctorIdx_eqline 149 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.ExtraTape.enumList_nodupline 153 - instance
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.(instance at line 155)line 155 - inductive
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Phaseline 158 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Phase.enumListline 161 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Phase.enumList_getElem?_ctorIdx_eqline 164 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Phase.enumList_nodupline 168 - instance
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.(instance at line 170)line 170 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Tapeline 174 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Symbolsline 175 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Labelline 176 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.Stateline 177 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.extraTapesline 179 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.auxProgramline 185 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.programline 206 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machineline 210 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputTapesline 228 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputTapes_inputline 231 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputTapes_counterline 235 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputConfigline 238 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.embeddedline 242 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.temporaryTapesline 247 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.temporaryConfigline 250 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputTapes_update_input_inline_MachineRepeatline 254 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputTapes_update_counter_inline_MachineRepeatline 266 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.oneStep_inline_MachineRepeatline 275 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.parseStep_trueline 283 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.parseStep_falseline 292 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.parseTraceline 301 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.guardStep_someline 327 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.guardStep_noneline 336 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.bodyExecutionline 345Source documentation
Lift the actual certified body run while preserving the remaining counter.
def bodyExecution (counter : List (M.Γ M.k₀)) (word : List (M.Γ M.k₀)) (result : List (M.Γ M.k₁)) (budget : Nat) (run : TM2OutputsInTime M word (some result) budget) : StateTransition.EvalsToInTime (machine M input output).step (embedded M counter (initList M word)) (some (embedded M counter (haltList M result))) budget := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machine, OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.embedded
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.bodyToTemp_tapes_inline_MachineRepeatline 355 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.tempToBody_tapes_inline_MachineRepeatline 371 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.finalToTemp_tapes_inline_MachineRepeatline 383 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.tempToOutput_tapes_inline_MachineRepeatline 395 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.bodyToTempline 406 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.tempToBodyline 422 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.finalToTempline 437 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.tempToOutputline 449 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.bodyReturnline 463Source documentation
Transfer the literal body output back to the input, preserving its order.
def bodyReturn (result : List (M.Γ M.k₁)) (counter : List (M.Γ M.k₀)) : StateTransition.EvalsToInTime (machine M input output).step (embedded M counter (haltList M result)) (some (inputConfig M .guard (result.map (fun b => input.symm (output b))) counter)) (2*(result.length+1)) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machine, OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.embedded, OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputConfig
- def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.finishline 476Source documentation
Zero remaining iterations still run the actual final transfers and halt with every tape other than the designated output empty.
def finish (word : List (M.Γ M.k₀)) : StateTransition.EvalsToInTime (machine M input output).step (inputConfig M .guard word []) (some (haltList (machine M input output) word)) (2*word.length+3) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machine, OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputConfig
- def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopBudgetline 490Source documentation
Running time after the parser: actual body budgets, two transfers per body result, one guard per iteration, and the final transfer and empty guard.
def loopBudget : Nat → (Nat → List Bool) → (Nat → Nat) → Nat | 0, words, _ => 2*(words 0).length+3 | count+1, words, budgets => budgets 0 + 2*(words 1).length+3 + loopBudget count (fun i => words (i+1)) (fun i => budgets (i+1)) - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopExecutionline 495 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.inputConfig_init_inline_MachineRepeatline 533 - def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.executeSequenceline 545 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopBudget_eq_sumline 574Source documentation
Explicit sum form of the actual repeat budget.
theorem loopBudget_eq_sum (count : Nat) (words : Nat → List Bool) (budgets : Nat → Nat) : loopBudget count words budgets = (∑ i ∈ Finset.range count, (budgets i + 2*(words (i+1)).length+3)) + 2*(words count).length+3 := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopBudget
- def
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.executeSequenceSumline 586Source documentation
The sum of supplied body budgets and explicit linear transfer overheads.
def executeSequenceSum (count : Nat) (words : Nat → List Bool) (budgets : Nat → Nat) (runs : ∀ i, i < count → TM2OutputsInTime M ((words i).map input.symm) (some ((words (i+1)).map output.symm)) (budgets i)) : TM2OutputsInTime (machine M input output) ((encodeWord count ++ words 0).map input.symm) (some ((words count).map input.symm)) (count+1 + ((∑ i ∈ Finset.range count, (budgets i+2*(words (i+1)).length+3)) + 2*(words count).length+3)) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machine, OAI.MaxCutGames.Foundations.Complexity.encodeWord
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopBudget_leline 600Source documentation
A uniform bound along the executed sequence is enough to bound the actual repeat runtime. No polynomial growth of an arbitrary iteration is asserted.
theorem loopBudget_le (count : Nat) (words : Nat → List Bool) (budgets : Nat → Nat) (bodyBound lengthBound : Nat) (hb : ∀i, i<count → budgets i ≤ bodyBound) (hl : ∀i, i≤count → (words i).length ≤ lengthBound) : loopBudget count words budgets ≤ count*(bodyBound+2*lengthBound+3)+2*lengthBound+3 := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.loopBudget
- def
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.FiniteAlphabetline 636Source documentation
Every physical tape has a finite alphabet. Together with
M.kFin, this also makes the disjoint union of all physical tape alphabets finite.def FiniteAlphabet (M : FinTM2) : Prop := ∀ k, Finite (M.Γ k)
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.input_finiteline 639Source documentation
This one alphabet is already finite in the underlying machine record.
theorem input_finite (M : FinTM2) : Finite (M.Γ M.k₀) := by …
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.of_homogeneousline 643 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.of_boolline 650Source documentation
All concrete Boolean-stack machines satisfy the stronger alphabet condition.
theorem of_bool (M : FinTM2) (alphabet : ∀ k, M.Γ k = Bool) : FiniteAlphabet M := …
Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.FiniteAlphabet
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.of_equivline 653 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.symbols_finiteline 658 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.sequential_machineline 666Source documentation
The first two tape groups retain their original alphabets. The sole new bridge tape uses the second machine's already finite input alphabet.
theorem sequential_machine (first second : FinTM2) (relabel : first.Γ first.k₁ → second.Γ second.k₀) (fallback : second.Γ second.k₀) (hfirst : FiniteAlphabet first) (hsecond : FiniteAlphabet second) : FiniteAlphabet (MachineSequential.machine first second relabel fallback) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.FiniteAlphabet, OAI.MaxCutGames.Foundations.Complexity.MachineSequential.machine
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.composeline 679Source documentation
Preservation for the machine actually stored in the polynomial-time composition certificate, with its actual relabeling bridge.
theorem compose {α β γ αΓ βΓ γΓ : Type} {ea : α → List αΓ} {eb : β → List βΓ} {ec : γ → List γΓ} {f : α → β} {g : β → γ} (first : TM2ComputableInPolyTime ea eb f) (second : TM2ComputableInPolyTime eb ec g) (fallback : βΓ) (hfirst : FiniteAlphabet first.tm) (hsecond : FiniteAlphabet second.tm) : FiniteAlphabet (MachineSequential.compose first second fallback).tm := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.FiniteAlphabet, OAI.MaxCutGames.Foundations.Complexity.MachineSequential.compose
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.composeBitsline 690 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.repeat_machineline 701Source documentation
Counter, temporary, and output tapes of the actual repeat machine all use the body's finite input alphabet; body tapes retain their original alphabets.
theorem repeat_machine (body : FinTM2) (input : body.Γ body.k₀ ≃ Bool) (output : body.Γ body.k₁ ≃ Bool) (hbody : FiniteAlphabet body) : FiniteAlphabet (MachineRepeat.machine body input output) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineFiniteAlphabet.FiniteAlphabet, OAI.MaxCutGames.Foundations.Complexity.MachineRepeat.machine
- def
OAI.MaxCutGames.Explicit.MachineUniformRun.outputBitsline 722 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.afterScaleline 725 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.afterEmitline 729 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.scaleInTimeline 733 - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.repeated_templateline 755 - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.template_outputline 766 - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.template_copiedLengthline 778 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.emitInTimeline 785 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.prefixPolynomialline 802 - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.input_lengthline 805 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.prefixInTimeline 809 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.timePolynomialline 826 - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.haltList_eqline 829 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.finishStartInTimeline 837 - def
OAI.MaxCutGames.Explicit.MachineUniformRun.outputInTimeline 849Source documentation
The complete actual run, including the physical cleanup and output reversal.
noncomputable def outputInTime (C n q Q : Nat) (body : List Bool) : TM2OutputsInTime (machine C) (encodeWords [n, q, Q] ++ body) (some (outputBits C n q Q body)) ((timePolynomial C).eval (encodeWords [n, q, Q] ++ body).length) := by …Mentions: OAI.MaxCutGames.Explicit.MachineUniformRun.outputBits, OAI.MaxCutGames.Explicit.MachineUniformRun.timePolynomial
- def
OAI.MaxCutGames.Explicit.MachineUniformRun.computationline 884Source documentation
A fixed actual program works for every game and every alphabet size.
noncomputable def computation {q : Nat} (C : Nat) (hC : 0 < C) : TM2ComputableInPolyTime gameBits gameBits (UniformTarget.construct (q := q) C hC) where … - theorem
OAI.MaxCutGames.Explicit.MachineUniformRun.finiteAlphabetline 905