OAI/Computability/MaxCut/Machines/MachineHorner.lean
67 declarations, 0 contain sorry, 0 declared as axioms
Fixed-width Horner traversal by actual radix steps. Two accumulators alternate: a radix step writes into the empty alternate, then the previous accumulator is consumed. The base, digit fields, and arbitrary external tapes are preserved.
- abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layoutline 18 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabetline 19 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Stateline 20 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.parityline 22 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.accumulatorline 26 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.accumulator_neline 28 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixLayoutline 31 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlotsline 43 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_baseline 46 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_accline 48 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_digitline 50 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_outline 52 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_counterline 54 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radixSlots_scratchline 56 - inductive
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Labelline 59 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.entryLabelline 66 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.drainLoopline 70Source documentation
Consume an isolated unary field, including its delimiter.
def drainLoop (tape : K) (loopLabel : Λ) (exit : Option Λ) : TM2.Stmt (Alphabet (K := K)) Λ (State σ) := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.statementline 79 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.programline 93 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.machineline 96 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.valueline 107 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.stepCostline 111 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.prefixStepsline 114 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.stageTapesline 118 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.resultTapesline 121 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.drainTraceline 124 - structure
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Cleanline 148 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Clean.accline 155 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.digitTraceline 163Source documentation
One genuine radix execution followed by a unary drain of its old input accumulator. The new accumulator is left in the alternate physical tape.
theorem digitTrace (slots : Layout width ↪ K) (labels : Label width → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (Alphabet (K := K)) Λ (State σ)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layout, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Label, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.prefixTraceline 235Source documentation
Prefix induction follows the fixed finite sequence of digit labels.
theorem prefixTrace (slots : Layout width ↪ K) (labels : Label width → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (Alphabet (K := K)) Λ (State σ)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layout, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Label, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.finishTraceline 258Source documentation
Move the final accumulator to the external output, restoring its order and emptying accumulator/scratch. The old destination is retained as a suffix.
theorem finishTrace (slots : Layout width ↪ K) (labels : Label width → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (Alphabet (K := K)) Λ (State σ)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layout, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Label, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.stepsline 329 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.hornerTraceline 334Source documentation
Complete actual Horner execution on preserved digit/base fields. Initial work tapes are empty; only the destination changes at the optional continuation.
theorem hornerTrace (slots : Layout width ↪ K) (labels : Label width → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (Alphabet (K := K)) Λ (State σ)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layout, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Label, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.value_eq_foldlline 365 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.value_add_one_leline 378Source documentation
A magnitude bound accommodates arbitrary digits, including fixed polynomial coefficients larger than the radix. No bounded-digit assumption is needed for execution correctness.
theorem value_add_one_le (radix : Nat) (digits : Nat → Nat) (width magnitude : Nat) (radixBound : radix ≤ magnitude) (digitBound : ∀ i, i < width → digits i ≤ magnitude) (n : Nat) (hn : n ≤ width) : value radix digits n + 1 ≤ (magnitude + 1) ^ n := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.value
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.value_leline 397 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.perDigitBoundline 405 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.stepCost_leline 409 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.prefixSteps_leline 418 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.timePolynomialline 437 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.timePolynomial_evalline 444 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.steps_le_timePolynomialline 450 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.hornerInTimeline 460 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.hornerInPolynomialTimeline 476 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.operandLengthline 497Source documentation
The actual total bit length of the isolated radix and digit fields.
def operandLength (radix : Nat) (digits : Nat → Nat) (width : Nat) : Nat := …
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.radix_le_operandLengthline 501 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.digit_le_operandLengthline 508 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.resultTapes_outputline 519 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.resultTapes_otherline 523 - def
OAI.MaxCutGames.Foundations.Complexity.MachineHorner.hornerInEncodedPolynomialTimeline 529Source documentation
Actual subroutine time bounded in the concrete lengths of its operand fields. The destination suffix and unrelated tapes are preserved without scans.
def hornerInEncodedPolynomialTime (slots : Layout width ↪ K) (labels : Label width → Λ) (exit : Option Λ) (p : Λ → TM2.Stmt (Alphabet (K := K)) Λ (State σ)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Layout, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Label, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineHorner.State
- abbrev
OAI.MaxCutGames.Explicit.MachineProductField.Layoutline 563Source documentation
Gather's table/query/scan/scratch and coordinate tapes; then radix, two Horner accumulators, counter, scratch, isolated field output, global output.
abbrev Layout (width : Nat) := MachineProductGather.Tape width ⊕ Fin 7
Mentions: OAI.MaxCutGames.Explicit.MachineProductGather.Tape
- def
OAI.MaxCutGames.Explicit.MachineProductField.gatherSlotsline 565 - def
OAI.MaxCutGames.Explicit.MachineProductField.hornerRoleline 568 - theorem
OAI.MaxCutGames.Explicit.MachineProductField.hornerRole_injectiveline 577 - def
OAI.MaxCutGames.Explicit.MachineProductField.hornerSlotsline 589 - def
OAI.MaxCutGames.Explicit.MachineProductField.clearTapesline 592 - abbrev
OAI.MaxCutGames.Explicit.MachineProductField.Labelline 596 - def
OAI.MaxCutGames.Explicit.MachineProductField.entryline 600 - def
OAI.MaxCutGames.Explicit.MachineProductField.instructionline 603 - structure
OAI.MaxCutGames.Explicit.MachineProductField.Readyline 618Source documentation
Conditions on real input/work stacks; arbitrary output suffixes remain permitted. The two query/scan tapes are empty at a row boundary.
structure Ready (slots : Layout width ↪ K) (base : K → List Bool) : Prop where …
Mentions: OAI.MaxCutGames.Explicit.MachineProductField.Layout
- def
OAI.MaxCutGames.Explicit.MachineProductField.gatheredline 629 - def
OAI.MaxCutGames.Explicit.MachineProductField.evaluatedline 634 - def
OAI.MaxCutGames.Explicit.MachineProductField.emittedline 639 - def
OAI.MaxCutGames.Explicit.MachineProductField.finalTapesline 645 - def
OAI.MaxCutGames.Explicit.MachineProductField.stepsline 650 - theorem
OAI.MaxCutGames.Explicit.MachineProductField.gathered_extraline 659 - theorem
OAI.MaxCutGames.Explicit.MachineProductField.fieldTraceline 671Source documentation
Actual execution of the complete gather/Horner/emit/cleanup phase. The field equality connects only mathematical tape contents; all transition work is proved from the concrete instructions.
theorem fieldTrace (slots : Layout width ↪ K) (values : List Nat) (coefficient : Nat) (indices offsets fields : Fin width → Nat) (selected : ∀ i, values[coefficient * indices i + offsets i]? = some (fields i)) (labels : Label slots → Λ) (exit : Option Λ) (program : Λ → TM2.Stmt (fun _ : K => Bool) Λ (MachineHorner.State σ)) (atLabels : ∀ l, program (labels l) = instruction slots coefficient offsets labels exit l) (base : K → List Bool) (suffixes : Fin width → List Bool) (ready : Ready slots base) (tableWord : base (slots (.inl (.inl 0))) = encodeWords values) (sourceWords : ∀ i, base (slots (.inl (.inr (.inl i)))) = encodeWord (indices i) ++ suffixes i) (radix : Nat) (digits : Nat → Nat) (radixWord : base (slots (.inr 0)) = encodeWord radix) …Mentions: OAI.MaxCutGames.Explicit.MachineProductField.Layout, OAI.MaxCutGames.Explicit.MachineProductField.Label, OAI.MaxCutGames.Explicit.MachineProductField.instruction, OAI.MaxCutGames.Explicit.MachineProductField.Ready