OAI/Computability/UniqueGames/Machines/MachineLookupLemmas.lean
58 declarations, 0 contain sorry, 0 declared as axioms
Actual traces for the fixed unary lookup machine. Successful lookup preserves an arbitrary unread table suffix. Rejection relative to a list's end is stated only for its complete, unframed encoding, so no hidden endpoint is assumed.
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.guard_step_succline 24 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.guard_step_zeroline 37 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.select_step_nonemptyline 50 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.select_step_emptyline 66 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.copyTraceline 77 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.selectTraceline 92 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.skipCycleTraceline 107 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.emptyCycleTraceline 125 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.successPrefixTraceline 143Source documentation
A successful positional lookup scans precisely its prior and selected field. The suffix is arbitrary and is retained byte for byte.
theorem successPrefixTrace (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (prior : List Nat) (value : Nat) (indexSuffix suffix output : List Bool) (ambient : σ) (register : Option Bool) : (advance (TM2.step (program index source destination)))^[ (encodeWords prior).length + prior.length + value + 3] (some ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord prior.length ++ indexSuffix) (encodeWords prior ++ (encodeWord value ++ suffix)) output⟩) = some ⟨some .accepted, (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) suffix (encodeWord value ++ output)⟩ := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.lookupTrace_someline 171Source documentation
Successful array access, with explicit selected value and preserved framing.
theorem lookupTrace_some (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (values : List Nat) (i value : Nat) (selected : values[i]? = some value) (indexSuffix suffix output : List Bool) (ambient : σ) (register : Option Bool) : (advance (TM2.step (program index source destination)))^[MachineLookupSpec.steps values i] (some ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord i ++ indexSuffix) (encodeWords values ++ suffix) output⟩) = some ⟨some .accepted, (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) (encodeWords (values.drop (i + 1)) ++ suffix) (encodeWord value ++ output)⟩ := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookupSpec.steps, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.emptyTraceline 200 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.lookupTrace_invalidline 223Source documentation
Invalid indices reject on a complete encoded table, after consuming that table and all positive index bits. The output and other tapes are unchanged.
theorem lookupTrace_invalid (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (values : List Nat) (i : Nat) (invalid : values.length ≤ i) (indexSuffix output : List Bool) (ambient : σ) (register : Option Bool) : (advance (TM2.step (program index source destination)))^[MachineLookupSpec.steps values i] (some ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord i ++ indexSuffix) (encodeWords values) output⟩) = some ⟨some .rejected, (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) [] output⟩ := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookupSpec.steps, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords
- def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultLabelline 246Source documentation
The two explicit control outcomes on a complete encoded table.
def resultLabel (values : List Nat) (i : Nat) : Label := …
Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.Label
- def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultOutputline 252Source documentation
Successful lookup prefixes a complete unary word; failure writes nothing.
def resultOutput (values : List Nat) (i : Nat) (output : List Bool) : List Bool := …
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.lookupTraceline 259Source documentation
A total execution statement for every natural index and complete table. No bound or validity assumption on the index is needed.
theorem lookupTrace (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (values : List Nat) (i : Nat) (indexSuffix output : List Bool) (ambient : σ) (register : Option Bool) : (advance (TM2.step (program index source destination)))^[MachineLookupSpec.steps values i] (some ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord i ++ indexSuffix) (encodeWords values) output⟩) = some ⟨some (resultLabel values i), (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) (encodeWords (values.drop (i + 1))) (resultOutput values i output)⟩ := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookupSpec.steps, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultLabel, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultOutput
- def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.lookupInTimeline 283Source documentation
A proved linear transition budget in the lengths of the encoded table and index, including invalid indices. The witness is the actual trace above.
def lookupInTime (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (values : List Nat) (i : Nat) (indexSuffix output : List Bool) (ambient : σ) (register : Option Bool) : StateTransition.EvalsToInTime (TM2.step (program index source destination)) ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord i ++ indexSuffix) (encodeWords values) output⟩ (some ⟨some (resultLabel values i), (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) (encodeWords (values.drop (i + 1))) (resultOutput values i output)⟩) ((encodeWords values).length + 2 * (encodeWord i).length) where …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultLabel, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultOutput
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.lookupHaltTraceline 300Source documentation
The final control label executes a genuine halt in one more transition.
theorem lookupHaltTrace (index source destination : K) (his : index ≠ source) (hid : index ≠ destination) (hsd : source ≠ destination) (base : K → List Bool) (values : List Nat) (i : Nat) (indexSuffix output : List Bool) (ambient : σ) (register : Option Bool) : (advance (TM2.step (program index source destination)))^[MachineLookupSpec.steps values i + 1] (some ⟨some .guard, (ambient, register), tapes index source destination base (encodeWord i ++ indexSuffix) (encodeWords values) output⟩) = some ⟨none, (ambient, none), tapes index source destination base (encodeWord 0 ++ indexSuffix) (encodeWords (values.drop (i + 1))) (resultOutput values i output)⟩ := by …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookupSpec.steps, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWord, OAI.UniqueGamesTheorem.Foundations.Complexity.encodeWords, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.resultOutput
- def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.timePolynomialline 315Source documentation
A single polynomial in the combined two input lengths.
noncomputable def timePolynomial : Polynomial Nat := Polynomial.C 2 * Polynomial.X + 1
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.timePolynomial_boundsline 317 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.machineInTimeline 328Source documentation
The same exact computation as a certificate for the concrete finite three-stack machine. Both valid and invalid indices terminate with reset local state, retaining the zero index delimiter and all other stated tape contents.
def machineInTime (base : Fin 3 → List Bool) (values : List Nat) (i : Nat) (indexSuffix output : List Bool) (register : Option Bool) : StateTransition.EvalsToInTime machine.step ⟨some .guard, ((), register), tapes (K := Fin 3) 0 1 2 base …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.tapes
- abbrev
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.Alphabetline 355 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.initialTapesline 358Source documentation
Tape roles: original table, unary query, scan work, output, copy scratch.
def initialTapes (tape : Fin 5 → K) (base : K → List Bool) (index : Nat) (indexSuffix workSuffix output : List Bool) : K → List Bool := … - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.finalTapesline 363 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.lookupFramedHaltTrace_someline 370 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.preservingLookupTraceline 390Source documentation
Code-level interfaces specify the actual two copy loops and six lookup instructions in the caller's program. No execution premise is supplied.
theorem preservingLookupTrace (tape : Fin 5 → K) (distinct : Function.Injective tape) (firstLabel secondLabel : Λ) (lookupLabels : MachineLookup.Label → Λ) (exit : Option Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineLookup.Label, OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.program, OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.Alphabet
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.preservingLookup_steps_leline 440 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.preservingLookupInTimeline 448 - inductive
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.Labelline 470 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.programline 474 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachinePreservingLookup.machineline 481 - abbrev
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.Alphabetline 501 - inductive
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.Labelline 503 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.instructionline 508 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.stepsline 523 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.finalTapesline 528 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.initialTapes_eq_updateline 533 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.affineLookupTraceline 555Source documentation
An exact trace for the actual composite instructions.
atLabelsspecifies the caller's finite program; there is no execution or runtime premise.theorem affineLookupTrace (source : K) (tape : Fin 5 → K) (distinct : Function.Injective tape) (outside : ∀ i, source ≠ tape i) (coefficient offset : Nat) (labels : Label → Λ) (exit : Option Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.Label, OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.Alphabet
- theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.steps_leline 583 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.steps_le_tableline 591 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.finalTapes_otherline 598 - theorem
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.finalTapes_outputline 604 - def
OAI.UniqueGamesTheorem.Foundations.Complexity.MachineAffineLookup.machineline 609 - abbrev
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.Tapeline 640Source documentation
Shared original table, query, scan and copy scratch, then input coordinate fields and the corresponding gathered output fields.
abbrev Tape (width : Nat) := Fin 4 ⊕ (Fin width ⊕ Fin width)
- def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.shiftline 642 - theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.shift_injectiveline 645 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.lookupRoleline 649 - theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.lookupRole_injectiveline 656 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.Labelline 660 - instance
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.labelFintypeline 664 - instance
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.labelDecidableEqline 671 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.entryline 678 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.instructionline 682 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.stepsline 696 - def
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.finalTapesline 703 - theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.finalTapes_otherline 713 - theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.gatherTraceline 728 - theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.finalTapes_fieldline 790Source documentation
Every output is the physically gathered unary field, with its old suffix preserved. This identifies the operands consumed by the Horner phase.
theorem finalTapes_field (values : List Nat) (coefficient width : Nat) (placement : Tape width → K) (distinct : Function.Injective placement) (indices offsets fields : Fin width → Nat) (base : K → List Bool) (i : Fin width) : finalTapes values coefficient width placement indices offsets fields base (placement (.inr (.inr i))) = encodeWord (fields i) ++ base (placement (.inr (.inr i))) := by …Mentions: OAI.UniqueGamesTheorem.Explicit.MachineProductGather.Tape, OAI.UniqueGamesTheorem.Explicit.MachineProductGather.finalTapes
- theorem
OAI.UniqueGamesTheorem.Explicit.MachineProductGather.steps_leline 825Source documentation
For fixed width, gather time is linear in the encoded table size plus coordinate magnitudes. Query and scan debris is never rescanned.
theorem steps_le (values : List Nat) (coefficient width magnitude : Nat) (indices offsets fields : Fin width → Nat) (selected : ∀ i, values[coefficient * indices i + offsets i]? = some (fields i)) (bounded : ∀ i, indices i ≤ magnitude) : steps values coefficient width indices offsets ≤ width * (2 * magnitude + 5 * (encodeWords values).length + 6) + 1 := by …Mentions: OAI.UniqueGamesTheorem.Explicit.MachineProductGather.steps