OAI/Computability/MaxCut/Machines/MachineTupleOdometer.lean
69 declarations, 0 contain sorry, 0 declared as axioms
- abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabetline 13 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitTapesline 15 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.incrementline 19 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.resetline 28Source documentation
Reset conserves the digit's unary budget, then enters the next coordinate.
def reset (current remaining : K) (resetLabel carryLabel : Λ) : TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool) := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.incrementPushBoundline 33 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.resetPushBoundline 38 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.update_current_inline_MachineTupleOdometerline 42 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.update_remaining_inline_MachineTupleOdometerline 53 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.stepAux_increment_succline 59 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.stepAux_increment_zeroline 69 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.incrementStep_succline 80Source documentation
A non-carrying digit increment is one actual ambient-program transition.
theorem incrementStep_succ (current remaining : K) (distinct : current ≠ remaining) (checkLabel doneLabel resetLabel : Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.incrementStep_zeroline 93 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.resetTraceline 106 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.carryTraceline 121Source documentation
Exhaustion costs one check plus the actual
d + 1-transition reset.theorem carryTrace (current remaining : K) (distinct : current ≠ remaining) (checkLabel doneLabel resetLabel carryLabel : Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitStepsline 143Source documentation
The exact step count for one digit, including its possible reset.
def digitSteps (d r : ℕ) : ℕ := if r = 0 then d + 2 else 1
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitTraceline 147Source documentation
The bounded digit operation follows actual transitions on both branches. It restores an exhausted digit to zero before returning the carry.
theorem digitTrace (current remaining : K) (distinct : current ≠ remaining) (checkLabel doneLabel resetLabel carryLabel : Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitSteps_leline 172 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitBudgetline 178 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitFrameline 184Source documentation
Every unrelated stack is preserved, including any separate stored radix or input bound. Both digit-stack suffixes are preserved by the trace itself.
theorem digitFrame (current remaining other : K) (notCurrent : other ≠ current) (notRemaining : other ≠ remaining) (base : K → List Bool) (d r : ℕ) (currentSuffix remainingSuffix : List Bool) : digitTapes current remaining base (if r = 0 then 0 else d + 1) (if r = 0 then d else r - 1) currentSuffix remainingSuffix other = digitTapes current remaining base d r currentSuffix remainingSuffix other := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitTapes
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.digitInTimeline 194Source documentation
A composable actual-time witness for any well-formed positive-radix digit.
def digitInTime (current remaining : K) (distinct : current ≠ remaining) (checkLabel doneLabel resetLabel carryLabel : Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.bodyConfigurationline 216 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.checkConfigurationline 224 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.cycleExitline 232 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.VisitTracesline 239 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.cycleStepsline 250 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.cycleSteps_zero_inline_MachineTupleOdometerline 253 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.cycleSteps_succ_inline_MachineTupleOdometerline 257 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.cycleTraceline 263 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.ascendingCycleInTimeline 300Source documentation
A full positive-radix cycle performs
nbody visits and exactly2*ncounter transitions. This bound comes from the composed actual execution.def ascendingCycleInTime (current remaining : K) (distinct : current ≠ remaining) (bodyLabel checkLabel resetLabel exitLabel : Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrderline 338 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder_lengthline 341 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder_dimension_zeroline 345Source documentation
Dimension zero visits the unique empty tuple once, even at radix zero.
theorem tupleOrder_dimension_zero (n : ℕ) : tupleOrder n 0 = [fun i => Fin.elim0 i] := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder_radix_zeroline 353Source documentation
A positive-dimensional zero-radix loop has no tuples to visit.
theorem tupleOrder_radix_zero {q : ℕ} (hq : 0 < q) : tupleOrder 0 q = [] := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleRank_consline 359Source documentation
Coordinate zero is the least significant digit. This is the same radix rank used by
SourceOccurrences.Encoding.function.theorem tupleRank_cons {n q : ℕ} (d : Fin n) (tail : Fin q → Fin n) : (finFunctionFinEquiv (Fin.cons d tail)).val = d.val + n * (finFunctionFinEquiv tail).val := by … - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleRank_increment_lowestline 370 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleRank_carryline 379Source documentation
Resetting an exhausted low digit and incrementing the tail advances the same explicit tuple rank by one.
theorem tupleRank_carry {n q : ℕ} (hn : 0 < n) (d : Fin n) (tail tail' : Fin q → Fin n) (hmax : d.val = n - 1) (htail : (finFunctionFinEquiv tail').val = (finFunctionFinEquiv tail).val + 1) : (finFunctionFinEquiv (Fin.cons (⟨0, hn⟩ : Fin n) tail')).val = (finFunctionFinEquiv (Fin.cons d tail)).val + 1 := by … - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleRank_snocline 388 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.tupleOrder_snocline 395 - structure
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.CycleScheduleline 421Source documentation
Explicit caller state and tape endpoints for one level of the nested loop. Compatibility with its child schedules is checked by their types.
structure CycleSchedule (K σ : Type) where …
- abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Configurationline 428 - inductive
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycleline 435Source documentation
A finite nesting schedule. Only leaves supply actual emitter traces. Internal nodes supply concrete instruction placements and compatible endpoint schedules; their complete execution is derived below. Level
qoperates coordinateq, so coordinate zero is always the innermost loop.inductive NestedCycle (n : ℕ) (current remaining : ℕ → K) (bodyLabel : Λ) (checkLabel resetLabel : ℕ → Λ) (program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)) : …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.counterOverheadline 467Source documentation
Exact concrete-counter overhead for a complete positive-radix nesting.
def counterOverhead (n : ℕ) : ℕ → ℕ | 0 => 0 | q + 1 => n * (counterOverhead n q + 2) namespace NestedCycle variable {n : ℕ} {current remaining : ℕ → K} {bodyLabel : Λ} {checkLabel resetLabel : ℕ → Λ} {program : Λ → TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool)}Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.stepsline 477 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.LeafBoundline 488Source documentation
Every supplied emitter leaf obeys its local time allowance. There is no whole-loop runtime premise at any internal node.
def LeafBound (B : ℕ) {depth : ℕ} {exitLabel : Λ} {start finish : Configuration K Λ σ} (tree : NestedCycle n current remaining bodyLabel checkLabel resetLabel program depth exitLabel start finish) : Prop := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Configuration, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.workline 497Source documentation
Sum of the actual supplied emitter costs, with no counter work included.
def work {depth : ℕ} {exitLabel : Λ} {start finish : Configuration K Λ σ} (tree : NestedCycle n current remaining bodyLabel checkLabel resetLabel program depth exitLabel start finish) : ℕ := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Configuration, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.reverseDigitline 505 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.reverseDigit_currentline 507 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.orderline 511 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.order_eq_tupleOrderline 521 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.order_lengthline 530 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.steps_eq_work_add_overheadline 535 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.traceline 561Source documentation
The whole nested-loop trace is derived from its actual leaf traces and the concrete increment/reset code.
theorem trace {depth : ℕ} {exitLabel : Λ} {start finish : Configuration K Λ σ} (tree : NestedCycle n current remaining bodyLabel checkLabel resetLabel program depth exitLabel start finish) : (MachineComposition.advance (TM2.step program))^[tree.steps] (some start) = some finish := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Configuration, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle, OAI.MaxCutGames.Foundations.Complexity.MachineComposition.advance
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.steps_leline 577 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.inTimeline 607Source documentation
An actual-time certificate for the complete fixed-dimensional schedule.
def inTime {depth : ℕ} {exitLabel : Λ} {start finish : Configuration K Λ σ} (tree : NestedCycle n current remaining bodyLabel checkLabel resetLabel program depth exitLabel start finish) (B : ℕ) (bounded : tree.LeafBound B) : StateTransition.EvalsToInTime (TM2.step program) start (some finish) (n ^ depth * B + counterOverhead n depth) where …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Configuration, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.counterOverhead
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.counterOverhead_leline 619 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.NestedCycle.steps_le_powerline 640 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.entryline 654Source documentation
The actual entry guard bypasses an empty positive-dimensional Cartesian product. Dimension zero always enters its one empty-tuple emitter.
def entry (q : ℕ) (radix : K) (bodyLabel exitLabel : Λ) : TM2.Stmt (Alphabet (K := K)) Λ (σ × Option Bool) := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.entryStep_dimension_zeroline 664 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.entryStep_radix_zeroline 674 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.entryStep_radix_positiveline 686 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.Labelline 705Source documentation
Two labels per coordinate, plus start, body, and exit labels.
abbrev Label (q : ℕ) := Fin q ⊕ (Fin q ⊕ Option Bool)
- def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.startline 707 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.bodyline 708 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.exitline 709 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.checkline 710 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.resetLabelline 711 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.carryline 713 - def
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.programline 718Source documentation
A fixed finite controller. Its only unspecified instruction is the emitter body, whose actual leaf traces are supplied to
NestedCycle.def program (q : ℕ) (current remaining : Fin q → K) (radix : K) (emitter : TM2.Stmt (Alphabet (K := K)) (Label q) (σ × Option Bool)) : …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Alphabet, OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.Label
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineTupleOdometer.Control.label_cardline 728