OAI/Computability/MaxCut/Machines/MachineBinaryRenameLoop.lean
91 declarations, 0 contain sorry, 0 declared as axioms
The actual cursor loop for sparse-name renaming. A finite three-position slot counts completed clauses. Each nonempty cursor test calls the checked literal machine, then pushes one variable-count bit. Every third literal also pushes one clause-count bit. No instruction counts an unbounded list in finite control.
All nine literal-machine tapes retain their meanings. Tapes 9 and 10 are the variable and clause counters. The original token stream is preserved; the cursor is exhausted, the six work tapes are restored, and the output contains the reversed concatenation of exactly the emitted literal words.
- abbrev
OAI.MaxCutGames.BinaryRenameLoop.Tokenline 24 - def
OAI.MaxCutGames.BinaryRenameLoop.nextSlotline 26 - def
OAI.MaxCutGames.BinaryRenameLoop.clauseIncrementline 28 - def
OAI.MaxCutGames.BinaryRenameLoop.finalSlotline 30 - def
OAI.MaxCutGames.BinaryRenameLoop.completedClausesline 34 - theorem
OAI.MaxCutGames.BinaryRenameLoop.finalSlot_threeline 38 - theorem
OAI.MaxCutGames.BinaryRenameLoop.completedClauses_threeline 41 - theorem
OAI.MaxCutGames.BinaryRenameLoop.finalSlot_triplesline 45 - theorem
OAI.MaxCutGames.BinaryRenameLoop.completedClauses_triplesline 50 - def
OAI.MaxCutGames.BinaryRenameLoop.outputBodyline 55 - theorem
OAI.MaxCutGames.BinaryRenameLoop.outputBody_nilline 58 - theorem
OAI.MaxCutGames.BinaryRenameLoop.outputBody_consline 60 - def
OAI.MaxCutGames.BinaryRenameLoop.stepsline 64 - theorem
OAI.MaxCutGames.BinaryRenameLoop.payload_length_le_streamline 68 - def
OAI.MaxCutGames.BinaryRenameLoop.perLiteralBoundline 83 - theorem
OAI.MaxCutGames.BinaryRenameLoop.literal_steps_leline 86 - theorem
OAI.MaxCutGames.BinaryRenameLoop.steps_leline 98 - theorem
OAI.MaxCutGames.BinaryRenameLoop.steps_le_cubicline 111 - abbrev
OAI.MaxCutGames.BinaryRenameLoop.Alphabetline 129 - abbrev
OAI.MaxCutGames.BinaryRenameLoop.Stateline 130 - abbrev
OAI.MaxCutGames.BinaryRenameLoop.cleanline 131 - inductive
OAI.MaxCutGames.BinaryRenameLoop.Labelline 134 - def
OAI.MaxCutGames.BinaryRenameLoop.literalTapesline 140 - theorem
OAI.MaxCutGames.BinaryRenameLoop.literalTapes_injectiveline 143 - def
OAI.MaxCutGames.BinaryRenameLoop.finishline 149 - def
OAI.MaxCutGames.BinaryRenameLoop.nextline 155 - def
OAI.MaxCutGames.BinaryRenameLoop.instructionline 159 - def
OAI.MaxCutGames.BinaryRenameLoop.loopTapesline 176Source documentation
These are the only four stacks changed by the complete loop.
def loopTapes (tape : Fin 11 → K) (base : K → List Bool) (cursor output variableCounter clauses : List Bool) : K → List Bool := … - theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTapes_cursorline 181 - theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTapes_outputline 187 - theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTapes_variablesline 193 - theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTapes_clausesline 199 - theorem
OAI.MaxCutGames.BinaryRenameLoop.update_cursor_inline_MachineBinaryRenameLoopline 204 - theorem
OAI.MaxCutGames.BinaryRenameLoop.update_output_inline_MachineBinaryRenameLoopline 214 - theorem
OAI.MaxCutGames.BinaryRenameLoop.update_variables_inline_MachineBinaryRenameLoopline 224 - theorem
OAI.MaxCutGames.BinaryRenameLoop.update_clauses_inline_MachineBinaryRenameLoopline 234 - theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTapes_otherline 240 - theorem
OAI.MaxCutGames.BinaryRenameLoop.stepAux_finishline 246 - theorem
OAI.MaxCutGames.BinaryRenameLoop.joinTrace_inline_MachineBinaryRenameLoopline 251 - theorem
OAI.MaxCutGames.BinaryRenameLoop.peekStepline 263 - theorem
OAI.MaxCutGames.BinaryRenameLoop.emptyStepline 275 - theorem
OAI.MaxCutGames.BinaryRenameLoop.tallyStepline 286 - theorem
OAI.MaxCutGames.BinaryRenameLoop.bodyTraceline 302Source documentation
Peek, execute the checked literal program, then update the two counters.
theorem bodyTrace (tokens : List Token) (token : Token) (slot : Fin 3) (suffix output variableCounter clauses : List Bool) (canonical : BinaryNameMachine.canonical token.2 = true) (tokensCanonical : ∀ t ∈ tokens, BinaryNameMachine.canonical t.2 = true) (present : token.2 ∈ BinaryNameSearch.payloads tokens) (permanent : base (tape 1) = BinaryNameSearch.stream tokens) (empty : ∀ i : Fin 11, 2 ≤ i.val → i.val ≤ 7 → base (tape i) = []) : (advance (TM2.step program))^[BinaryLiteralMachine.steps tokens token.2 + 2] (some ⟨some (labels .entry), clean ambient slot, loopTapes tape base (BinaryNameSearch.tokenBits token ++ suffix) output variableCounter clauses⟩) = some ⟨some (labels .entry), clean ambient (nextSlot slot), loopTapes tape base suffix …Mentions: OAI.MaxCutGames.BinaryRenameLoop.Token, OAI.MaxCutGames.BinaryNameMachine.canonical, OAI.MaxCutGames.BinaryNameSearch.payloads, OAI.MaxCutGames.BinaryNameSearch.stream, OAI.MaxCutGames.BinaryLiteralMachine.steps, OAI.MaxCutGames.BinaryRenameLoop.clean, OAI.MaxCutGames.BinaryRenameLoop.loopTapes, OAI.MaxCutGames.BinaryNameSearch.tokenBits, OAI.MaxCutGames.BinaryRenameLoop.nextSlot
- theorem
OAI.MaxCutGames.BinaryRenameLoop.loopTraceline 375Source documentation
Full loop execution, including the final empty-cursor test.
theorem loopTrace (tokens input : List Token) (slot : Fin 3) (output variableCounter clauses : List Bool) (tokensCanonical : ∀ t ∈ tokens, BinaryNameMachine.canonical t.2 = true) (included : ∀ t ∈ input, t ∈ tokens) (permanent : base (tape 1) = BinaryNameSearch.stream tokens) (empty : ∀ i : Fin 11, 2 ≤ i.val → i.val ≤ 7 → base (tape i) = []) : (advance (TM2.step program))^[steps tokens input] (some ⟨some (labels .entry), clean ambient slot, loopTapes tape base (BinaryNameSearch.stream input) output variableCounter clauses⟩) = some ⟨done, clean ambient (finalSlot input.length slot), loopTapes tape base [] ((outputBody tokens input).reverse ++ output) (List.replicate input.length true ++ variableCounter) …Mentions: OAI.MaxCutGames.BinaryRenameLoop.Token, OAI.MaxCutGames.BinaryNameMachine.canonical, OAI.MaxCutGames.BinaryNameSearch.stream, OAI.MaxCutGames.BinaryRenameLoop.steps, OAI.MaxCutGames.BinaryRenameLoop.clean, OAI.MaxCutGames.BinaryRenameLoop.loopTapes, OAI.MaxCutGames.BinaryRenameLoop.finalSlot, OAI.MaxCutGames.BinaryRenameLoop.outputBody
- theorem
OAI.MaxCutGames.BinaryRenameLoop.triplesTraceline 420Source documentation
On complete triples the finite slot is reset and the two counters are exact.
theorem triplesTrace (tokens input : List Token) (count : Nat) (length_eq : input.length = 3 * count) (output variableCounter clauses : List Bool) (tokensCanonical : ∀ t ∈ tokens, BinaryNameMachine.canonical t.2 = true) (included : ∀ t ∈ input, t ∈ tokens) (permanent : base (tape 1) = BinaryNameSearch.stream tokens) (empty : ∀ i : Fin 11, 2 ≤ i.val → i.val ≤ 7 → base (tape i) = []) : (advance (TM2.step program))^[steps tokens input] (some ⟨some (labels .entry), clean ambient 0, loopTapes tape base (BinaryNameSearch.stream input) output variableCounter clauses⟩) = some ⟨done, clean ambient 0, loopTapes tape base [] ((outputBody tokens input).reverse ++ output) (List.replicate (3 * count) true ++ variableCounter) …Mentions: OAI.MaxCutGames.BinaryRenameLoop.Token, OAI.MaxCutGames.BinaryNameMachine.canonical, OAI.MaxCutGames.BinaryNameSearch.stream, OAI.MaxCutGames.BinaryRenameLoop.steps, OAI.MaxCutGames.BinaryRenameLoop.clean, OAI.MaxCutGames.BinaryRenameLoop.loopTapes, OAI.MaxCutGames.BinaryRenameLoop.outputBody
- def
OAI.MaxCutGames.BinaryRenameLoop.triplesInTimeline 438Source documentation
The machine's bit-length bound includes every peek, literal run, and tally.
def triplesInTime (tokens input : List Token) (count : Nat) (length_eq : input.length = 3 * count) (output variableCounter clauses : List Bool) (tokensCanonical : ∀ t ∈ tokens, BinaryNameMachine.canonical t.2 = true) (included : ∀ t ∈ input, t ∈ tokens) (permanent : base (tape 1) = BinaryNameSearch.stream tokens) (empty : ∀ i : Fin 11, 2 ≤ i.val → i.val ≤ 7 → base (tape i) = []) : StateTransition.EvalsToInTime (TM2.step program) ⟨some (labels .entry), clean ambient 0, loopTapes tape base (BinaryNameSearch.stream input) output variableCounter clauses⟩ (some ⟨done, clean ambient 0, loopTapes tape base [] ((outputBody tokens input).reverse ++ output) (List.replicate (3 * count) true ++ variableCounter) …Mentions: OAI.MaxCutGames.BinaryRenameLoop.Token, OAI.MaxCutGames.BinaryNameMachine.canonical, OAI.MaxCutGames.BinaryNameSearch.stream, OAI.MaxCutGames.BinaryRenameLoop.clean, OAI.MaxCutGames.BinaryRenameLoop.loopTapes, OAI.MaxCutGames.BinaryRenameLoop.outputBody
- abbrev
OAI.MaxCutGames.BinaryTokenMachine.Tapeline 480 - abbrev
OAI.MaxCutGames.BinaryTokenMachine.Alphabetline 481 - abbrev
OAI.MaxCutGames.BinaryTokenMachine.Stateline 482 - inductive
OAI.MaxCutGames.BinaryTokenMachine.Labelline 484 - def
OAI.MaxCutGames.BinaryTokenMachine.afterNameline 493 - theorem
OAI.MaxCutGames.BinaryTokenMachine.afterName_zeroline 496 - theorem
OAI.MaxCutGames.BinaryTokenMachine.afterName_oneline 497 - theorem
OAI.MaxCutGames.BinaryTokenMachine.afterName_twoline 498 - def
OAI.MaxCutGames.BinaryTokenMachine.jumpline 500 - def
OAI.MaxCutGames.BinaryTokenMachine.clauseInstructionline 504Source documentation
Discard a clause marker, or finish at the final formula terminator.
def clauseInstruction : TM2.Stmt Alphabet Label State := …
Mentions: OAI.MaxCutGames.BinaryTokenMachine.Alphabet, OAI.MaxCutGames.BinaryTokenMachine.Label, OAI.MaxCutGames.BinaryTokenMachine.State
- def
OAI.MaxCutGames.BinaryTokenMachine.signInstructionline 511 - def
OAI.MaxCutGames.BinaryTokenMachine.nameInstructionline 518Source documentation
Copy both symbols of a payload pair, or copy the name terminator.
def nameInstruction (slot : Fin 3) : TM2.Stmt Alphabet Label State := …
Mentions: OAI.MaxCutGames.BinaryTokenMachine.Alphabet, OAI.MaxCutGames.BinaryTokenMachine.Label, OAI.MaxCutGames.BinaryTokenMachine.State
- def
OAI.MaxCutGames.BinaryTokenMachine.programline 530 - abbrev
OAI.MaxCutGames.BinaryTokenMachine.machineline 538 - def
OAI.MaxCutGames.BinaryTokenMachine.tapesline 549 - def
OAI.MaxCutGames.BinaryTokenMachine.cfgline 552 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tapes_zeroline 556 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tapes_oneline 559 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tapes_twoline 562 - theorem
OAI.MaxCutGames.BinaryTokenMachine.update_zero_inline_MachineBinaryTokenMachineline 565 - theorem
OAI.MaxCutGames.BinaryTokenMachine.update_one_inline_MachineBinaryTokenMachineline 571 - theorem
OAI.MaxCutGames.BinaryTokenMachine.clauseStepline 577 - theorem
OAI.MaxCutGames.BinaryTokenMachine.finalStepline 584 - theorem
OAI.MaxCutGames.BinaryTokenMachine.signStepline 591 - theorem
OAI.MaxCutGames.BinaryTokenMachine.nameEndStepline 599 - theorem
OAI.MaxCutGames.BinaryTokenMachine.nameDigitStepline 607 - theorem
OAI.MaxCutGames.BinaryTokenMachine.nameTraceline 616 - theorem
OAI.MaxCutGames.BinaryTokenMachine.literalTraceline 633 - theorem
OAI.MaxCutGames.BinaryTokenMachine.joinTrace_inline_MachineBinaryTokenMachineline 650 - theorem
OAI.MaxCutGames.BinaryTokenMachine.clauseTraceline 655Source documentation
Three literal subroutines return to the next clause boundary.
theorem clauseTrace (clause : Clause) (suffix reversed output : List Bool) (register : Option Bool) : (advance machine.step)^[clauseNameSize clause + 6] (some (cfg (some (.sign 0)) (clauseBits clause ++ suffix) reversed output register)) = some (cfg (some .clause) suffix ((clauseBits clause).reverse ++ reversed) output) := by …Mentions: OAI.MaxCutGames.BinaryTokenMachine.cfg
- def
OAI.MaxCutGames.BinaryTokenMachine.tokensline 676 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tokens_nilline 678 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tokens_consline 680 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tokens_lengthline 684 - theorem
OAI.MaxCutGames.BinaryTokenMachine.stripTraceline 694Source documentation
Exact first-pass run, retaining the unread suffix and ambient output.
theorem stripTrace (clauses : List Clause) (suffix reversed output : List Bool) (register : Option Bool) : (advance machine.step)^[7 * clauses.length + namesBitSize clauses + 1] (some (cfg (some .clause) (clausesBits clauses ++ suffix) reversed output register)) = some (cfg (some .restore) suffix ((tokens clauses).reverse ++ reversed) output) := by …Mentions: OAI.MaxCutGames.BinaryTokenMachine.cfg, OAI.MaxCutGames.BinaryTokenMachine.tokens
- theorem
OAI.MaxCutGames.BinaryTokenMachine.restoreTraceline 726 - theorem
OAI.MaxCutGames.BinaryTokenMachine.initList_eqline 742 - theorem
OAI.MaxCutGames.BinaryTokenMachine.haltList_eqline 749 - theorem
OAI.MaxCutGames.BinaryTokenMachine.acceptTraceline 756 - theorem
OAI.MaxCutGames.BinaryTokenMachine.haltStepline 774 - theorem
OAI.MaxCutGames.BinaryTokenMachine.tokenTraceline 780Source documentation
Exact transition count for the complete finite-machine computation.
theorem tokenTrace (formula : Formula) : (advance machine.step)^[13 * formula.clauses.length + 3 * namesBitSize formula.clauses + 3] (some (initList machine (formulaBits formula))) = some (haltList machine (tokens formula.clauses)) := by …Mentions: OAI.MaxCutGames.BinaryTokenMachine.machine, OAI.MaxCutGames.BinaryTokenMachine.tokens
- theorem
OAI.MaxCutGames.BinaryTokenMachine.tokenSteps_leline 789 - def
OAI.MaxCutGames.BinaryTokenMachine.outputsInTimeline 795 - def
OAI.MaxCutGames.BinaryTokenMachine.computableInPolyTimeline 804Source documentation
A displayed finite machine and linear polynomial in the ordinary input bit length, proved by the transitions above rather than assumed by a caller.
noncomputable def computableInPolyTime : TM2ComputableInPolyTime BinaryEncoding.formulaBits (id : List Bool → List Bool) (fun formula => tokens formula.clauses) where …Mentions: OAI.MaxCutGames.BinaryEncoding.formulaBits, OAI.MaxCutGames.BinaryTokenMachine.tokens
- theorem
OAI.MaxCutGames.BinaryTokenMachine.machine_finiteAlphabetline 819