OAI/Computability/MaxCut/Machines/MachineSingleOrbitProgram.lean
84 declarations, 0 contain sorry, 0 declared as axioms
Physical postprocessing of the two-side address codec. The program reads
2*C,q,m, writes C,q,m, and replaces each row u,C+v,table by u,v,table.
Only the fixed alphabet size q occurs in finite control. All input-dependent
integers reside on unary tapes. Six Bool tapes suffice.
- inductive
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Tapeline 20 - abbrev
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Tape.enumListline 24 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Tape.enumList_getElem?_ctorIdx_eqline 27 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Tape.enumList_nodupline 31 - instance
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.(instance at line 33)line 33 - abbrev
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Stateline 37 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.initialStateline 39 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.clearKeysline 41 - inductive
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Labelline 43 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.copyFieldline 53Source documentation
Consume one complete unary field, including its delimiter, appending its reverse to the output accumulator. All other tapes are unchanged.
def copyField {q : Nat} (loopLabel exitLabel : Label q) : TM2.Stmt (fun _ : Tape => Bool) (Label q) State := …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Label, OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.Tape, OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.State
- def
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.programline 61 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.machineline 97 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.finite_workAlphabetline 108 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.accumulator_not_mem_clearKeysline 113 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.output_not_mem_clearKeysline 114 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitProgram.clearKeys_coversline 116 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapesline 129 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_inputline 137 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_capacityline 138 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_savedline 139 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_remainingline 140 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_accumulatorline 141 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tapes_outputline 142 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.update_tapesline 144 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.cfgline 151 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.copyStep_trueline 155 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.copyStep_falseline 164 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.copyFieldTraceline 174Source documentation
The physical field copy takes one transition for each input bit.
theorem copyFieldTrace {q : Nat} (loopLabel exitLabel : Label q) (atLoop : program q loopLabel = copyField loopLabel exitLabel) (n : Nat) (suffix c s r a o : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[n + 1] (some (cfg loopLabel register (encodeWord n ++ suffix) c s r a o)) = some (cfg exitLabel none suffix c s r ((encodeWord n).reverse ++ a) o) := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.cfg
- theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.tableTraceline 192Source documentation
All permutation fields are copied with a finite delimiter counter.
theorem tableTrace {q : Nat} (completed : Fin (q + 1)) (words : List Nat) (hcount : completed.val + words.length = q) (suffix c s r a o : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[(encodeWords words).length + 1] (some (cfg (.table completed) register (encodeWords words ++ suffix) c s r a o)) = some (cfg .guard none suffix c s r ((encodeWords words).reverse ++ a) o) := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitStreams.cfg
- theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.halfStep_firstline 233 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.halfStep_secondline 239 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.halfStep_falseline 245 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.halfTraceline 252Source documentation
Consume two unary input marks per output mark, storing the new capacity.
theorem halfTrace {q : Nat} (n : Nat) (suffix c s r a o : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[2 * n + 1] (some (cfg .halfFirst register (encodeWord (2 * n) ++ suffix) c s r a o)) = some (cfg .alphabet none suffix (List.replicate n true ++ c) s r ((encodeWord n).reverse ++ a) o) := by … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.countStep_trueline 273 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.countStep_falseline 279 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.countTraceline 286Source documentation
Copy the occurrence count while also storing its physical unary counter.
theorem countTrace {q : Nat} (n : Nat) (suffix c s r a o : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[n + 1] (some (cfg .count register (encodeWord n ++ suffix) c s r a o)) = some (cfg .guard none suffix c s (List.replicate n true ++ r) ((encodeWord n).reverse ++ a) o) := by … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.initial_configurationline 303 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.initialStepline 310 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitHeader.headerTraceline 319Source documentation
Read
2*C,q,m, writeC,q,m, and leave the physical unary capacity and occurrence counters ready for the row loop. The bound counts real transitions.theorem headerTrace (q C m : Nat) (suffix : List Bool) : (advance (TM2.step (program q)))^[2 * C + q + m + 4] (some (initList (machine q) (encodeWord (2 * C) ++ encodeWord q ++ encodeWord m ++ suffix))) = some (cfg .guard none suffix (encodeWord C) [] (encodeWord m) (encodeWords [C, q, m]).reverse []) := by … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.subtractStep_zeroline 365 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.subtractStep_succline 373 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.subtractTraceline 384Source documentation
The scan consumes precisely the capacity prefix of the target field.
theorem subtractTrace (q n : Nat) (suffix saved remaining accumulator output : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[n + 1] (some (cfg .subtract register (List.replicate n true ++ suffix) (encodeWord n) saved remaining accumulator output)) = some (cfg .restore none suffix (encodeWord 0) (List.replicate n true ++ saved) remaining accumulator output) := by … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.restore_tapesline 399 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.restoreTraceline 407Source documentation
The real saved-prefix transfer restores
C, empties scratch, and takesC + 1transitions.theorem restoreTrace (q n : Nat) (suffix remaining accumulator output : List Bool) : (advance (TM2.step (program q)))^[n + 1] (some (cfg .restore none suffix (encodeWord 0) (List.replicate n true) remaining accumulator output)) = some (cfg .target none suffix (encodeWord n) [] remaining accumulator output) := by … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitSubtract.removeOffsetTraceline 426Source documentation
The complete target-offset removal preserves every other tape. In particular the capacity is reusable and the
vfield delimiter is untouched.theorem removeOffsetTrace (q C v : Nat) (suffix remaining accumulator output : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[2 * (C + 1)] (some (cfg .subtract register (encodeWord (C + v) ++ suffix) (encodeWord C) [] remaining accumulator output)) = some (cfg .target none (encodeWord v ++ suffix) (encodeWord C) [] remaining accumulator output) := by … - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubleConstraintline 451 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubleInstanceline 456 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rowBitsline 461 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubledRowBitsline 464 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rowsBitsline 467 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubledRowsBitsline 470 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rowBits_eqline 473 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubledRowBits_eqline 478 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rowsBits_nilline 483 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubledRowsBits_nilline 484 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rowsBits_consline 487 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubledRowsBits_consline 491 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.gameBits_eqline 496 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.doubled_gameBits_eqline 501 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.input_length_eqline 507 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.vertices_le_input_lengthline 515 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitCodec.rows_le_input_lengthline 520 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.joinTraceline 535 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowCostline 539 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowTraceline 542 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.guardStep_succline 578 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.guardStep_zeroline 586 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowsCostline 594 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowsCost_consline 597 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowsTraceline 605Source documentation
The actual counted loop visits every row once and preserves its order. No complete-loop execution is supplied as an input hypothesis.
theorem rowsTrace {C q : Nat} (cs : List (Constraint C q)) (suffix accumulator output : List Bool) (register : Option Bool) : (advance (TM2.step (program q)))^[rowsCost cs] (some (cfg .guard register (doubledRowsBits cs ++ suffix) (encodeWord C) [] (encodeWord cs.length) accumulator output)) = some (cfg .finishStart none suffix (encodeWord C) [] (encodeWord 0) ((rowsBits cs).reverse ++ accumulator) output) := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitRows.rowsCost
- theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitFinish.haltList_eqline 647 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitFinish.finishStartInTimeline 654 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitFinish.timePolynomialline 662 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitFinish.completePrefixline 667Source documentation
This helper consumes a proved prefix trace. The final runtime theorem supplies that trace from the concrete header and complete row traversal.
def completePrefix (q : Nat) (input : List Bool) (prefixTime : Polynomial Nat) (base : Tape → List Bool) (execution : StateTransition.EvalsToInTime (machine q).step (initList (machine q) input) (some ⟨some .finishStart, initialState, base⟩) (prefixTime.eval input.length)) (outputEmpty : base .output = []) : TM2OutputsInTime (machine q) input (some (base .accumulator).reverse) ((timePolynomial q prefixTime).eval input.length) := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitFinish.timePolynomial
- def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.finalTapesline 715 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixCostline 718 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixTraceline 722Source documentation
The complete prefix is obtained from the actual header and row traces.
theorem prefixTrace {q : Nat} (I : Instance q) : (advance (TM2.step (program q)))^[prefixCost I] (some (initList (machine q) (gameBits (doubleInstance I)))) = some ⟨some .finishStart, initialState, finalTapes I⟩ := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixCost, OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.finalTapes
- def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixPolynomialline 750 - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixCost_leline 753 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.prefixInTimeline 762 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.timePolynomialline 771 - def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.fullRunInTimeline 775Source documentation
Literal init-to-halt execution, with every non-output tape empty at halt.
def fullRunInTime {q : Nat} (I : Instance q) : TM2OutputsInTime (machine q) (gameBits (doubleInstance I)) (some (gameBits I)) ((timePolynomial q).eval (gameBits (doubleInstance I)).length) := by …Mentions: OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.timePolynomial
- def
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.computableInPolyTimeline 784Source documentation
A proved polynomial-time codec conversion, without an assumed time bound, an output-size certificate, or an unbounded integer in finite machine state.
def computableInPolyTime (q : Nat) : TM2ComputableInPolyTime (fun I : Instance q => gameBits (doubleInstance I)) gameBits id where … - theorem
OAI.MaxCutGames.Explicit.MachineSingleOrbitRuntime.workAlphabetFiniteline 799