OAI/Computability/MaxCut/Machines/RawInitialMachineCleanup.lean
80 declarations, 0 contain sorry, 0 declared as axioms
Actual cleanup of all six clause-field tapes followed by the global unary index increment. The output accumulator, unread input, and other caller tapes are preserved, and no additional finish instruction is assumed.
- theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineCleanup.trace_trans_inline_RawInitialMachineCleanupline 19 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineCleanup.incrementIndexTraceline 24Source documentation
The index increment is exactly the one push in the actual global program.
theorem incrementIndexTrace (base : Tape → List Bool) (state : State) : (MachineComposition.advance (TM2.step program))^[1] (some ⟨some .incrementIndex, state, base⟩) = some ⟨some .guard, state, Function.update base .index (true :: base .index)⟩ := by … - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineCleanup.cleanupTraceline 31Source documentation
Clear six actual field tapes, increment the index, and return to the guard.
theorem cleanupTrace {n : ℕ} (base : Tape → List Bool) (c : Target.Clause n) (suffix : List Bool) (i : ℕ) (hempty : ∀ j, base (.field j) = []) (hindex : base .index = encodeWord i) (incoming : State) : (MachineComposition.advance (TM2.step program))^[ (encodeWords (Complexity.clauseWords c)).length + 7] (some ⟨some (.cleanupField 0), incoming, recordTapes base c suffix⟩) = some ⟨some .guard, (incoming.1, none), Function.update (Function.update base .input suffix) .index (encodeWord (i + 1))⟩ := by …Mentions: OAI.MaxCutGames.Foundations.Target.Clause, OAI.MaxCutGames.Foundations.Complexity.clauseWords
- def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineCleanup.cleanupInTimeline 114 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineBody.trace_trans_inline_RawInitialMachineBodyline 136 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineBody.guardTrace_succline 140 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineBody.guardTrace_zeroline 155 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineBody.bodyTraceline 169 - def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.tapes_inline_RawInitialMachineFinishline 224 - def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.finishTapesline 232 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.trace_trans_inline_RawInitialMachineFinishline 235 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.trueRelationWordsline 239 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.dummyBits_lengthline 246 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.update_reversed_inline_RawInitialMachineFinishline 254 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.cleanupTrace_inline_RawInitialMachineFinishline 260 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.resetReverseTrace_inline_RawInitialMachineFinishline 309 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.update_finish_inline_RawInitialMachineFinishline 340 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.copyFinishTrace_inline_RawInitialMachineFinishline 344 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.closeDummyTailTrace_inline_RawInitialMachineFinishline 360 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.closeDummyReverseTrace_inline_RawInitialMachineFinishline 369 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.dummyRelationTrace_inline_RawInitialMachineFinishline 378 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.dummyTraceline 390Source documentation
The three actual prefix scans and three emitting transitions append the complete dummy row.
theorem dummyTrace (n m : Nat) (rev : List Bool) (state : State) : (MachineComposition.advance (TM2.step program))^[2 * n + 4 * m + 9] (some ⟨some (.scan .dummyVariables), state, finishTapes n m rev⟩) = some ⟨some (.cleanupFinal 0), (state.1, none), finishTapes n m ((encodeWords (RawInitialRows.dummyWords n m)).reverse ++ rev)⟩ := by …Mentions: OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.finishTapes, OAI.MaxCutGames.Foundations.PCP.RawInitialRows.dummyWords
- theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.finishTraceline 428Source documentation
Exact final execution, including all tape cleanup and the canonical halt state.
theorem finishTrace (n m : Nat) (rev : List Bool) (state : State) : (MachineComposition.advance (TM2.step program))^[ 3 * n + 5 * m + 17 + (encodeWords (RawInitialRows.dummyWords n m)).length + rev.length] (some ⟨some (.scan .dummyVariables), state, finishTapes n m rev⟩) = some (haltList machine (rev.reverse ++ encodeWords (RawInitialRows.dummyWords n m))) := by …Mentions: OAI.MaxCutGames.Foundations.PCP.RawInitialRows.dummyWords, OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.finishTapes
- def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineFinish.finishInTimeline 446 - def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.finalSignsline 469 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.trace_trans_inline_RawInitialMachineLoopline 474 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.empty_loopTapesline 478 - theorem
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.loopTraceline 485Source documentation
The complete actual loop: every clause is read once, emits six rows, and leaves clean field tapes before the next guard. The final zero guard is included.
theorem loopTrace {n : Nat} (i : Nat) (cs : List (Clause n)) (rev : List Bool) (state : State) : (MachineComposition.advance (TM2.step program))^[loopTime i cs] (some ⟨some .guard, state, loopTapes n i cs.length (clauseInput cs) rev⟩) = some ⟨some (.scan .dummyVariables), (finalSigns state.1 cs, none), finishTapes n (i + cs.length) ((encodeWords (clauseOutput n i cs)).reverse ++ rev)⟩ := by …Mentions: OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.finalSigns
- def
OAI.MaxCutGames.Foundations.PCP.RawInitialMachineLoop.loopInTimeline 509 - theorem
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.trace_trans_inline_MachineRawInitialTableline 530 - def
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.prefixBitsline 534 - theorem
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.outputBitsline 538 - theorem
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.machineTraceline 545 - def
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.outputsInTimeline 571 - def
OAI.MaxCutGames.Foundations.PCP.MachineRawInitialTable.computableInPolyTimeline 579 - abbrev
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Bufferline 611 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.readUnarySlotsline 619Source documentation
Read fixed register slots from the actual unary 0/1 word encoding. Each slot consumes one symbol for false and two symbols for true.
def readUnarySlots (source : K) : List (Fin N) → TM2.Stmt (fun _ : K => Bool) Λ (σ × Buffer N) → TM2.Stmt (fun _ : K => Bool) Λ (σ × Buffer N) | [], next => next | i :: slots, next => .pop source (fun state head => (state.1, Function.update state.2 i (head.getD false))) (.branch (fun state => state.2 i) (.pop source (fun state _ => state) (readUnarySlots source slots next)) (readUnarySlots source slots next))Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Buffer
- def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBitsline 630 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBits_eq_encodeWordsline 633 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBits_length_leline 640 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.statementPushBound_readUnarySlotsline 650 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.stepAux_readUnarySlotsline 662Source documentation
Exact stack and register semantics, retaining every unread suffix bit.
theorem stepAux_readUnarySlots (source : K) (slots : List (Fin N)) (next : TM2.Stmt (fun _ : K => Bool) Λ (σ × Buffer N)) (ambient : σ) (bits buffer : Buffer N) (tapes : K → List Bool) (suffix : List Bool) : TM2.stepAux (readUnarySlots source slots next) (ambient, buffer) (Function.update tapes source (unaryBits slots bits ++ suffix)) = TM2.stepAux next (ambient, MachineFixedBlockMap.fill slots bits buffer) (Function.update tapes source suffix) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Buffer, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.readUnarySlots, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBits, OAI.MaxCutGames.Foundations.Complexity.MachineFixedBlockMap.fill
- theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.stepAux_readUnaryAllline 686 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBlockMapAtline 701Source documentation
A fixed table lookup or fixed pattern permutation can follow immediately after the physical unary decoding, with one genuine finite TM2 transition.
def unaryBlockMapAt {M : Nat} (source destination : K) (F : Buffer N → Buffer M) (exit : Option Λ) : TM2.Stmt (fun _ : K => Bool) Λ (σ × Buffer N) := …Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Buffer
- theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.stepAux_unaryBlockMapAtline 709 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.step_unaryBlockMapAtline 724 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBlockInTimeline 737 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.unaryBits_relationline 754 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.readerStateEquivline 767Source documentation
Merely rearranges finite registers to match the affine-emitter state. No tape content or unbounded integer is moved into the internal state.
def readerStateEquiv (σ : Type) (N : Nat) : (((σ × Unit) × Option Bool) × Buffer N) ≃ (((σ × Buffer N) × Unit) × Option Bool) where …Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Buffer
- abbrev
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Stateline 778 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.readRelationAtline 780 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.stepAux_readRelationAtline 785 - inductive
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tapeline 806 - abbrev
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tape.enumListline 811 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tape.enumList_getElem?_ctorIdx_eqline 814 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tape.enumList_nodupline 818 - instance
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.(instance at line 820)line 820 - abbrev
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Ambientline 824 - abbrev
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Planline 825 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.valuesline 827 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headerPlanline 831Source documentation
Output variable count and output clause count, in the checked CNF codec.
def headerPlan : Plan := …
Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Plan
- theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headerPlan_lengthline 835 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headerPlan_bitsline 838 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.sourceline 846 - inductive
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Labelline 849 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.guardline 861 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.programline 870Source documentation
The actual finite program. All graph-dependent naturals remain on unary stacks. The only buffered graph data is one fixed 4096-bit relation table.
def program (headerPlan rowPlan : Plan) : Label headerPlan.length rowPlan.length → TM2.Stmt (fun _ : Tape => Bool) (Label headerPlan.length rowPlan.length) (State Unit) | .copyFirst => Reduction.MachineTransfer.loopAt .input .scratch id false .copyFirst (some .copySecond) | .copySecond => MachineCopy.forkLoop .scratch .input .archive false .copySecond (some .startVertices) | .startVertices => Hastad.SourceMachine.fieldStart .vertices .readVertices | .readVertices => Hastad.SourceMachine.fieldLoop .input .vertices .readVertices (some .startDarts) | .startDarts => Hastad.SourceMachine.fieldStart .darts .readDarts | .readDarts => Hastad.SourceMachine.fieldLoop .input .darts .readDarts (some .seedIndex) | .seedIndex => .push .rowIndex (fun _ => false) …Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headerPlan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.rowPlan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Plan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Label, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tape, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.State, OAI.MaxCutGames.Reduction.MachineTransfer.loopAt, OAI.MaxCutGames.Foundations.Complexity.MachineCopy.forkLoop, OAI.MaxCutGames.Foundations.Hastad.SourceMachine.fieldStart, OAI.MaxCutGames.Foundations.Hastad.SourceMachine.fieldLoop
- def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.machineline 917 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headRolesline 928 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headRoles_injectiveline 932 - def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headPhaseInTimeline 937Source documentation
The head-access call is part of this concrete program, with its actual finite labels and framed tape effects. Its data are read from the table.
def headPhaseInTime (headerPlan rowPlan : Plan) (base : Tape → List Bool) (table : GenericGraphTables.Table 64) (e : Fin table.darts) (hTable : base .archive = GenericGraphTables.tableBits table) (hReverse : base .reverseIndex = encodeWord (Lookup.headIndex table e).val) (hHead : base .head = []) (hScratch : base .scratch = []) (ambient : Ambient) : StateTransition.EvalsToInTime (TM2.step (program headerPlan rowPlan)) ⟨some .headTableFirst, ((ambient, ()), none), base⟩ (some ⟨some .readRelation, ((ambient, ()), none), Lookup.headLookupTapes headRoles base table e⟩) (Lookup.headTimePolynomial.eval (GenericGraphTables.tableBits table).length) := …Mentions: OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headerPlan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.rowPlan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Plan, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Tape, OAI.MaxCutGames.Foundations.Complexity.encodeWord, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.Ambient, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.program, OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.headRoles
- def
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.workingTapesline 953 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.workingTapes_operandsline 966 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.update_working_inputline 973 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.update_working_tailline 980 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.update_working_headline 987 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.update_working_accumulatorline 994 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.update_working_rowIndexline 1001 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.source_ne_scratchline 1009 - theorem
OAI.MaxCutGames.Foundations.Complexity.FinalCNFMachine.Program.source_ne_accumulatorline 1012