OAI/Computability/MaxCut/PCP/LoopOrder.lean
60 declarations, 0 contain sorry, 0 declared as axioms
- def
OAI.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding.decodeTupleline 14Source 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.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding.enumerate_functionline 20Source 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.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding, OAI.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding.enumerate, OAI.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding.decodeTuple
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOccurrences.Encoding.enumerate_fin_functionline 26 - def
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.tupleTapeOrderline 38 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.testTapeEncoding_eq_tupleTapeOrderline 46 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.testTapeEncoding_flatMap_tupleTapeOrderline 53 - def
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.rankedQueryline 61Source 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.MaxCutGames.Foundations.Hastad.SourceQueryLoop.Query
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.rankedQuery_atline 67 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_ofFnline 72 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_enumerateline 87 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.query_prefixBits_eq_tupleTapeOrderline 101 - def
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.tupleSourceOrderline 112Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.sourceIndexEncoding_eq_tupleSourceOrderline 118 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.rawSourceList_eq_tupleOrderline 137Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.tupleSourceOrder
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.sourceList_eq_tupleOrderline 142 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.rawSourceList_flatMap_tupleOrderline 146 - def
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.reverseAppendline 154Source documentation
The stack update performed by one record append.
def reverseAppend {α β : Type} (encode : α → List β) (accumulator : List β) (record : α) : List β := … - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppendline 160Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppend_headerline 170 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.foldl_reverseAppend_prefixline 178Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.foldl_resultTapesline 187Source 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.MaxCutGames.Foundations.Hastad.SourceTestAppend.Layout, OAI.MaxCutGames.Foundations.Hastad.SourceTestAppend.resultTapes
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.inputBits_eq_header_recordsline 205 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.input_reverse_accumulatorline 217 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.sourceInput_tuple_reverse_accumulatorline 227Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.tupleSourceOrder, OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.reverseAppend
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceLoopOrder.finalReverse_stepsline 244Source 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.MaxCutGames.Foundations.Hastad.SourceLoopOrder.reverseAppend
- abbrev
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.Tapeline 265 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.currentAtline 269 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.remainingAtline 272 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigitsline 277Source 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.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.Tape
- def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setAccline 285 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.putDigitline 288 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_zeroline 292 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_extraline 298 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setAcc_selfline 302 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setAcc_setAccline 306 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setAcc_applyline 310 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_setAccline 313 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.putDigit_extraline 319 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.putDigit_setAccline 323 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_putDigitline 331Source 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.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.putDigit
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_snocline 352Source 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.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.putDigit
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.setDigits_snoc_baseline 388 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.allBitsline 394 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.blockPrefixline 397 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.blockPrefix_eq_ofFnline 401 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.blocksline 410 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.blockPrefix_allline 413 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.configurationline 420 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.BodyTraceline 423 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.val_snocline 434 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.zeros_snocline 440 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.initialConfigurationline 445 - def
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.finalConfigurationline 449 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.exists_scheduleline 455 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.traversalInTimeline 589Source 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.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.Tape, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.currentAt, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.remainingAt, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.BodyTrace, OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.initialConfiguration
- theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.initial_currentline 611 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.initial_remainingline 617 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.final_currentline 622 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.final_remainingline 628 - theorem
OAI.MaxCutGames.Foundations.Hastad.SourceOdometerSchedule.final_accumulatorline 634