OAI/Computability/UniqueGames/PCP/SourceQueryLoopLemmas.lean
71 declarations, 0 contain sorry, 0 declared as axioms
An actual fixed finite traversal of all query/noise tapes. The finite control contains one branch for each prescribed tape. The input-dependent signature and the three address bases remain in registers throughout.
- abbrev
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Queryline 18 - abbrev
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Stateline 19 - inductive
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Labelline 21 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.finishline 28 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.statementline 34 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.prefixBitsline 46 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.prefixStepsline 52 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.resultTapes_appendline 58 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.prefixTraceline 69 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.prefixSteps_leline 121 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.loopInTimeline 134Source documentation
The complete finite traversal, including its final exit transition.
theorem loopInTime (u D n B : Nat) (queries : Nat → Query u D) (layout : SourceTestAppend.Layout K) (labels : Label u D n → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (fun _ : K => Bool) Λ (State u D)) (atLabels : ∀ l, p (labels l) = statement u D n queries layout labels exit l) (signature : Signature u) (initialQuery : Query u D) (base : K → List Bool) (values : Fin 3 → Nat) (sourceWords : ∀ side, base (layout.sources side) = encodeWord (values side)) (scratchEmpty : base layout.scratch = []) (temporaryEmpty : base layout.temporary = []) (hbound : ∀ i, i < n → SourceTestAppend.steps u D values (signature, queries i) ≤ B) : ∃ lastQuery : Query u D, Nonempty (StateTransition.EvalsToInTime (TM2.step p) ⟨some (labels (.load ⟨0, by omega⟩)), ((signature, initialQuery), none), base⟩ …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Query, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceTestAppend.Layout, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Label, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.State, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.statement, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceTestAppend.steps
- def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding.decodeTupleline 174Source documentation
Interpret a radix tuple using the declared domain and codomain numbering.
def decodeTuple {α β : Type} (a : Encoding α) (b : Encoding β) (digits : Fin a.size → Fin b.size) : α → β := …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding.enumerate_functionline 180Source documentation
Increasing function rank is exactly the controller's tuple order, followed by the explicit coordinate decoder. This includes empty domains and codomains.
theorem enumerate_function {α β : Type} (a : Encoding α) (b : Encoding β) : (a.function b).enumerate = (tupleOrder b.size a.size).map (decodeTuple a b) := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding.enumerate, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding.decodeTuple
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOccurrences.Encoding.enumerate_fin_functionline 186 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.tupleTapeOrderline 198 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.testTapeEncoding_eq_tupleTapeOrderline 206 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.testTapeEncoding_flatMap_tupleTapeOrderline 213 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.rankedQueryline 221Source documentation
Total extension of the declared tape decoder, for the query loop's natural index register. Out-of-range values are never visited by that loop.
def rankedQuery (u D : ℕ) (fallback : SourceQueryLoop.Query u D) (i : ℕ) : SourceQueryLoop.Query u D := …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceQueryLoop.Query
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.rankedQuery_atline 227 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_ofFnline 232 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_enumerateline 247 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_tupleTapeOrderline 261 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.tupleSourceOrderline 272Source documentation
Clause, slot, left-query, noise, right-query loops, from outermost to innermost. Within each tuple loop coordinate zero changes fastest.
def tupleSourceOrder (F : Formula) (u D : ℕ) : List (SourceIndex F u D) := …
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.sourceIndexEncoding_eq_tupleSourceOrderline 278 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.rawSourceList_eq_tupleOrderline 297Source documentation
Equality of ordered equation lists preserves every repeated occurrence.
theorem rawSourceList_eq_tupleOrder (F : Formula) (u D : ℕ) : rawSourceList F u D = (tupleSourceOrder F u D).map (sourceEquation F u D) := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.tupleSourceOrder
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.sourceList_eq_tupleOrderline 302 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.rawSourceList_flatMap_tupleOrderline 306 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.reverseAppendline 314Source documentation
The stack update performed by one record append.
def reverseAppend {α β : Type} (encode : α → List β) (accumulator : List β) (record : α) : List β := … - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppendline 320Source documentation
After any ascending prefix, the accumulator is its reversed encoding followed by the original accumulator.
theorem foldl_reverseAppend {α β : Type} (encode : α → List β) (records : List α) (accumulator : List β) : records.foldl (reverseAppend encode) accumulator = (records.flatMap encode).reverse ++ accumulator := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppend_headerline 330 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppend_prefixline 338Source documentation
The prefix invariant is stated without requiring that the prefix end on the last record. A later suffix continues from exactly this accumulator.
theorem foldl_reverseAppend_prefix {α β : Type} (encode : α → List β) (emitted remaining : List α) (header : List β) : (emitted ++ remaining).foldl (reverseAppend encode) header.reverse = remaining.foldl (reverseAppend encode) (header ++ emitted.flatMap encode).reverse := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.foldl_resultTapesline 347Source documentation
The actual tape update used by
SourceTestAppendhas this same invariant; all other tapes remain the original tapes.theorem foldl_resultTapes {α K : Type} [DecidableEq K] (layout : SourceTestAppend.Layout K) (encode : α → List Bool) (records : List α) (base : K → List Bool) : records.foldl (fun tapes record => SourceTestAppend.resultTapes layout tapes (encode record)) base = Function.update base layout.accumulator ((records.flatMap encode).reverse ++ base layout.accumulator) := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceTestAppend.Layout, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceTestAppend.resultTapes
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.inputBits_eq_header_recordsline 365 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.input_reverse_accumulatorline 377 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.sourceInput_tuple_reverse_accumulatorline 387Source documentation
The nonempty-formula branch can feed the accumulator directly from the tuple controller's occurrence order. The total-input invariant above also covers the separate singleton empty-formula branch.
theorem sourceInput_tuple_reverse_accumulator (F : Formula) (u D : ℕ) (hD : 0 < D) (hne : F.clauses ≠ []) : (tupleSourceOrder F u D).foldl (reverseAppend (fun p => encodeWords (SourceEncoding.equationWords (sourceEquation F u D p)))) (encodeWords [nBits F u, (sourceList F u D).length]).reverse = (SourceEncoding.inputBits (sourceInput F u D hD)).reverse := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.tupleSourceOrder, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.finalReverse_stepsline 404Source documentation
Applying the existing reversal machine to the accumulated records returns the exact serialized input in
inputBits.length + 1transitions. This is only the final reversal stage, not a bound for generating the records.theorem finalReverse_steps (input : SourceEncoding.Input) (register : Option Bool) : MachineReverse.next^[(SourceEncoding.inputBits input).length + 1] (some (MachineReverse.running (input.equations.foldl (reverseAppend (fun e => encodeWords (SourceEncoding.equationWords e))) (encodeWords [input.variables, input.equations.length]).reverse) [] register)) = some (MachineReverse.halted (SourceEncoding.inputBits input)) := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceLoopOrder.reverseAppend
- abbrev
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.Tapeline 425 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.currentAtline 429 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.remainingAtline 432 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigitsline 437Source documentation
Set the active low coordinates; higher digits and every other tape retain their original contents. Unary digit stacks have no unread suffix.
def setDigits (m : ℕ) {q : ℕ} (digits : Fin q → ℕ) (base : Tape u Extra → List Bool) : Tape u Extra → List Bool | .current i => if h : i.val < q then encodeWord (digits ⟨i.val, h⟩) else base (.current i) | .remaining i => if h : i.val < q then encodeWord (m - 1 - digits ⟨i.val, h⟩) else base (.remaining i) | k => base kMentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.Tape
- def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setAccline 445 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.putDigitline 448 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_zeroline 452 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_extraline 458 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setAcc_selfline 462 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setAcc_setAccline 466 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setAcc_applyline 470 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_setAccline 473 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.putDigit_extraline 479 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.putDigit_setAccline 483 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_putDigitline 491Source documentation
The low-coordinate assignment commutes with a separate higher digit.
theorem setDigits_putDigit (m q : ℕ) (hq : q < u) (digits : Fin q → ℕ) (base : Tape u Extra → List Bool) (d r : ℕ) : setDigits m digits (putDigit ⟨q, hq⟩ base d r) = putDigit ⟨q, hq⟩ (setDigits m digits base) d r := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.putDigit
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_snocline 512Source documentation
The last coordinate is the outside loop coordinate.
theorem setDigits_snoc (m q : ℕ) (hq : q < u) (digits : Fin q → ℕ) (d : ℕ) (base : Tape u Extra → List Bool) : setDigits m (Fin.snoc digits d) base = putDigit ⟨q, hq⟩ (setDigits m digits base) d (m - 1 - d) := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.putDigit
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.setDigits_snoc_baseline 548 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.allBitsline 554 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.blockPrefixline 557 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.blockPrefix_eq_ofFnline 561 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.blocksline 570 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.blockPrefix_allline 573 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.configurationline 580 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.BodyTraceline 583 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.val_snocline 594 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.zeros_snocline 600 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.initialConfigurationline 605 - def
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.finalConfigurationline 609 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.exists_scheduleline 615 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.traversalInTimeline 749Source documentation
The time bound is derived from the concrete schedule, not from the number of tuples alone. Dimension zero consists of its single actual body trace.
theorem traversalInTime (program : Λ → TM2.Stmt (fun _ : Tape u Extra => Bool) Λ (σ × Option Bool)) (bodyLabel : Λ) (next resetLabel : ℕ → Λ) (canonical : σ) (accumulator : Extra) (positive : 0 < m) (B : ℕ) (base : Tape u Extra → List Bool) (bits : (Fin u → Fin m) → List Bool) (atCheck : ∀ i, i < u → program (next i) = increment (currentAt accumulator i) (remainingAt accumulator i) bodyLabel (resetLabel i)) (atReset : ∀ i, i < u → program (resetLabel i) = reset (currentAt accumulator i) (remainingAt accumulator i) (resetLabel i) (next (i + 1))) (bodies : BodyTrace program bodyLabel (next 0) canonical accumulator base bits B) : Nonempty (StateTransition.EvalsToInTime (TM2.step program) (initialConfiguration (m := m) u bodyLabel canonical base) …Mentions: OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.currentAt, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.remainingAt, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.BodyTrace, OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.initialConfiguration
- theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.initial_currentline 771 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.initial_remainingline 777 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.final_currentline 782 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.final_remainingline 788 - theorem
OAI.UniqueGamesTheorem.Foundations.Hastad.SourceOdometerSchedule.final_accumulatorline 794