Distinct guard stages exchange an enabled owner-port pair
ProvedMonodromy.ReversibleRouting.run_pairLet q,e be natural with q+e nonzero, let T be a two-integer-counter table, and assign each edge an owner vertex. Assume ownership is injective within each guard class and distinct edges with the same owner have complementary tests of the same register. For any integer register vector v, enabled edge j, and duplicate-free list of guard stages, running the corresponding native routing stages exchanges the prepared owner(j) state and edge-port q+j state exactly when the guard of j occurs in the list; otherwise both states are fixed. Both conclusions retain v, and the list may be empty.
Statement dependencies: Monodromy.Counter.Reversible.Action.enabled, Monodromy.Counter.Reversible.Edge, Monodromy.Counter.Reversible.Table, Monodromy.CoupledContinuation.Memory, Monodromy.CoupledContinuation.Point, Monodromy.ReversibleControl.Guard, Monodromy.ReversiblePorts.Matching, Monodromy.ReversiblePorts.actionGuard, Monodromy.ReversiblePorts.selected, Monodromy.ReversibleRouting.CompatibleOwner, Monodromy.ReversibleRouting.point, Monodromy.ReversibleRouting.run.
Original proof dependencies: Monodromy.Counter.Reversible.Action.enabled, Monodromy.Counter.Reversible.Edge, Monodromy.Counter.Reversible.Table, Monodromy.CoupledContinuation.Memory, Monodromy.CoupledContinuation.Point, Monodromy.CoupledContinuation.Program.advance, Monodromy.ReversibleControl.Guard, Monodromy.ReversiblePorts.Matching, Monodromy.ReversiblePorts.actionGuard, Monodromy.ReversiblePorts.selected, Monodromy.ReversibleRouting.CompatibleOwner, Monodromy.ReversibleRouting.point, Monodromy.ReversibleRouting.route, Monodromy.ReversibleRouting.route_owner, Monodromy.ReversibleRouting.route_port, Monodromy.ReversibleRouting.run, Monodromy.ReversibleRouting.run_cons.
Statement elaboration dependencies: Monodromy.Counter.Reversible.Action.enabled, Monodromy.Counter.Reversible.Edge, Monodromy.Counter.Reversible.Table, Monodromy.CoupledContinuation.Memory, Monodromy.CoupledContinuation.Point, Monodromy.ReversibleControl.Guard, Monodromy.ReversiblePorts.Matching, Monodromy.ReversiblePorts.actionGuard, Monodromy.ReversiblePorts.selected, Monodromy.ReversibleRouting.CompatibleOwner, Monodromy.ReversibleRouting.point, Monodromy.ReversibleRouting.run.
Proof elaboration dependencies: Monodromy.Counter.Reversible.Action.enabled, Monodromy.Counter.Reversible.Edge, Monodromy.Counter.Reversible.Table, Monodromy.CoupledContinuation.Memory, Monodromy.CoupledContinuation.Point, Monodromy.CoupledContinuation.Program.advance, Monodromy.ReversibleControl.Guard, Monodromy.ReversiblePorts.Matching, Monodromy.ReversiblePorts.actionGuard, Monodromy.ReversiblePorts.selected, Monodromy.ReversibleRouting.CompatibleOwner, Monodromy.ReversibleRouting.point, Monodromy.ReversibleRouting.route, Monodromy.ReversibleRouting.route_owner, Monodromy.ReversibleRouting.route_port, Monodromy.ReversibleRouting.run, Monodromy.ReversibleRouting.run_cons.
module
public import Definitions.Def_Monodromy_Counter
public import Lean.Elab.Tactic.Omega
public import Mathlib.Analysis.Analytic.Constructions
public import Mathlib.Analysis.Analytic.IsolatedZeros
public import Mathlib.Analysis.Analytic.Linear
public import Mathlib.Analysis.Calculus.DSlope
public import Mathlib.Analysis.Calculus.Deriv.Add
public import Mathlib.Analysis.Calculus.Deriv.Comp
public import Mathlib.Analysis.Calculus.Deriv.Mul
public import Mathlib.Analysis.Calculus.Deriv.Pow
public import Mathlib.Analysis.Complex.Basic
public import Mathlib.Analysis.Complex.CoveringMap
public import Mathlib.Analysis.Real.Pi.Bounds
public import Mathlib.Analysis.SpecialFunctions.Complex.Analytic
public import Mathlib.Analysis.SpecialFunctions.Complex.Circle
public import Mathlib.Computability.StateTransition
public import Mathlib.Computability.TuringMachine.PostTuringMachine
public import Mathlib.Data.Fin.Basic
public import Mathlib.Data.Fintype.Card
public import Mathlib.Data.Fintype.EquivFin
public import Mathlib.Data.Nat.Digits.Lemmas
public import Mathlib.Data.Nat.Factorization.Basic
public import Mathlib.Logic.Equiv.Fin.Basic
public import Mathlib.Logic.Equiv.Fin.Rotate
public import Mathlib.Logic.Function.Basic
public import Mathlib.Logic.Function.Conjugate
public import Mathlib.RingTheory.RootsOfUnity.Complex
public import Mathlib.Tactic.FieldSimp
public import Mathlib.Tactic.FinCases
public import Mathlib.Tactic.FunProp
public import Mathlib.Tactic.Linarith
public import Mathlib.Tactic.Ring
public import Mathlib.Topology.Homotopy.Lifting
@[expose] public section
open Monodromy
open Monodromy.ReversibleRouting
open CoupledContinuation Counter.Reversible ReversiblePorts
variable {q e : ℕ} [NeZero (q + e)]
variable (table : Table 2 q e) (owner : Fin e → Fin q)
(matching : ∀ guard, Matching owner (selected table guard))
theorem Monodromy.ReversibleRouting.run_pair (compatible : CompatibleOwner table owner) (values : Fin 2 → ℤ)
(edge : Fin e) (enabled : (table edge).action.enabled values)
(stages : List ReversibleControl.Guard) (distinct : stages.Nodup) :
(run table owner matching stages (point values (Fin.castAdd e (owner edge))) =
if actionGuard (table edge).action ∈ stages then point values (Fin.natAdd q edge)
else point values (Fin.castAdd e (owner edge))) ∧
(run table owner matching stages (point values (Fin.natAdd q edge)) =
if actionGuard (table edge).action ∈ stages then point values (Fin.castAdd e (owner edge))
else point values (Fin.natAdd q edge)) := by sorry
Read-back
What the Lean code literally says, in plain math · OpenAI Codex (independent agent)
Write . The memory space consists of triples of complex numbers with , , and ; its integer-labelled point is , using the principal complex logarithm. A degree- native program, for , assigns a finite word and a Boolean stop flag to each . Its letters are left shift, right shift, left zero probe, right zero probe, and control shift, each with a reversal flag. Their geometric drivers respectively use the left or right base loop or , or the control loop , leaving other components constant; a reversal reverses these paths. From a memory, lower exponential path lifts start at , and an upper exponential lift starts at over the product of those lower lifts and the control path; the endpoint is the new memory. A word concatenates these drivers in list order, with the empty word idle. Selection uses : the values at roots are selected by , where is the divided slope of at , divided by its derivative at , with the divided slope equal to the derivative when . The same selector applied to the stop flags is the halt signal; a program step is absent exactly when that signal equals , and otherwise is its routed advance. Its partial evaluation returns the final state whose step is absent, and is undefined if no such state is reached. For all natural with , take an edge table with vertices and edges, each action either an integer shift of one of two integer registers or a zero/nonzero test leaving registers unchanged, and a map assigning every edge to an owner vertex. Write for an edge's guard: unconditional for a shift, or (tested register, zero flag) for a test; a guard is enabled on when it is unconditional or its specified zero/nonzero test holds. Suppose that for each guard, distinct edges with that guard have distinct owners (the matching hypothesis), and that any distinct edges with the same owner have test actions on the same register with opposite flags (compatible ownership). A guard's routing program conditionally swaps every selected edge port with its owner vertex , using the permutation given by those disjoint pairs and leaving all other vertices/ports fixed. For any integer register tuple , any edge whose action is enabled on , and any duplicate-free finite list of guards, let be the left-to-right composition of those guarded native routing advances, and write . Then is if , and otherwise; simultaneously is if , and otherwise. The empty list is permitted; the assertion requires an actual edge argument, so zero-edge cases are vacuous.
Confirmed by the mission captain (proposal self-audit).