import Architect import Mathlib.Analysis.Complex.Basic import Mathlib.Combinatorics.SimpleGraph.Basic import Mathlib.Data.Matrix.Basic import Mathlib.Dynamics.PeriodicPts.Lemmas import Mathlib.GroupTheory.Perm.Basic import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Tactic namespace Signals.Plabic open scoped NNReal /-! Finite bicolored strand routing with explicit rotation and exit data. A rotation system is not by itself a planar disk embedding. Same-color edges are allowed. Termination, the bijective boundary map, fixed-point decorations, and any later identification with positroid cells must not be inferred merely from the existence of a finite graph. -/ /-- Internal vertex colors for the prescribed strand-turning convention. -/ inductive NodeColor where | black | white deriving DecidableEq, Repr /-- A permutation with a color supplied exactly where a fixed point needs decoration. -/ @[blueprint "def:signals-decorated-permutation" (title := "Explicit fixed-point decorations") (statement := /-- A decorated boundary permutation is a finite permutation with an explicitly supplied black or white color for each fixed point. The colors are not inferred from routing. -/)] structure DecoratedPermutation (boundaryCount : ℕ) where perm : Equiv.Perm (Fin boundaryCount) fixedColor : ∀ index, perm index = index → NodeColor /-- Identity boundary routing with every fixed point decorated white. -/ def DecoratedPermutation.identityWhite (boundaryCount : ℕ) : DecoratedPermutation boundaryCount := { perm := Equiv.refl _ fixedColor := fun _ _ => .white } /-- Distinct boundary and internal vertex identifiers; each internal identifier has one color. -/ abbrev Vertex (boundaryCount internalCount : ℕ) := Fin boundaryCount ⊕ Fin internalCount /-- A finite graph with one incident edge per boundary vertex and cyclic internal rotations. `rotation` is interpreted as counterclockwise; black uses it and white uses its inverse. `singleOrbit` rules out a purported cyclic order consisting of several cycles. A genus-zero disk embedding and reducedness are not supplied here. -/ @[blueprint "def:signals-rotation-system" (title := "Finite colored rotation systems") (statement := /-- A finite graph carries degree-one boundary vertices, internal colors and single-orbit cyclic neighbor rotations. Black turns use the rotation, white turns its inverse. A planar disk embedding and reducedness are not included. -/)] structure RotationSystem (boundaryCount internalCount : ℕ) where graph : SimpleGraph (Vertex boundaryCount internalCount) color : Fin internalCount → NodeColor rotation : ∀ vertex, Equiv.Perm (graph.neighborSet vertex) singleOrbit : ∀ internal (first second : graph.neighborSet (Sum.inr internal)), ∃ steps : ℕ, (rotation (Sum.inr internal))^[steps] first = second boundaryNeighbor : Fin boundaryCount → Vertex boundaryCount internalCount boundaryAdjacent : ∀ index, graph.Adj (Sum.inl index) (boundaryNeighbor index) boundaryUnique : ∀ index vertex, graph.Adj (Sum.inl index) vertex → vertex = boundaryNeighbor index /-- A directed edge carries its adjacency proof throughout routing. -/ structure DirectedEdge {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) where src : Vertex boundaryCount internalCount dst : Vertex boundaryCount internalCount adjacent : system.graph.Adj src dst /-- Directed edges are equivalent to a vertex paired with one of its outgoing neighbors. -/ def DirectedEdge.outgoingEquiv {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : DirectedEdge system ≃ Σ vertex, system.graph.neighborSet vertex where toFun edge := ⟨edge.src, ⟨edge.dst, edge.adjacent⟩⟩ invFun outgoing := ⟨outgoing.1, outgoing.2.val, outgoing.2.property⟩ left_inv edge := by cases edge; rfl right_inv outgoing := by rcases outgoing with ⟨vertex, neighbor, adjacent⟩; rfl /-- Finite vertex and neighbor sets give a finite directed-edge carrier without extra graph data. -/ instance {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : Finite (DirectedEdge system) := Finite.of_equiv (Σ vertex, system.graph.neighborSet vertex) (DirectedEdge.outgoingEquiv system).symm /-- Directed edges agree once their source and destination agree; adjacency proofs are irrelevant. -/ @[ext] lemma DirectedEdge.ext {boundaryCount internalCount : ℕ} {system : RotationSystem boundaryCount internalCount} (first second : DirectedEdge system) (sources : first.src = second.src) (destinations : first.dst = second.dst) : first = second := by cases first cases second cases sources cases destinations rfl /-- Reverse each directed edge; graph symmetry makes this an involutive permutation. -/ def DirectedEdge.reverse {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : Equiv.Perm (DirectedEdge system) where toFun edge := ⟨edge.dst, edge.src, edge.adjacent.symm⟩ invFun edge := ⟨edge.dst, edge.src, edge.adjacent.symm⟩ left_inv _ := rfl right_inv _ := rfl /-- Neighbor turns use the chosen color internally and the unique boundary edge externally. -/ def RotationSystem.turnRotation {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (vertex : Vertex boundaryCount internalCount) : Equiv.Perm (system.graph.neighborSet vertex) := match vertex with | Sum.inl _ => Equiv.refl _ | Sum.inr internal => match system.color internal with | .black => system.rotation (Sum.inr internal) | .white => (system.rotation (Sum.inr internal)).symm /-- Continue strands through boundaries to obtain a derived permutation on all directed edges. -/ @[blueprint "def:signals-dart-permutation" (title := "Continuing dart permutation") (statement := /-- Reverse each directed edge and apply its destination's invertible neighbor turn. The resulting continuing dynamics form a permutation of the finite dart carrier. -/)] def RotationSystem.dartTurn {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : Equiv.Perm (DirectedEdge system) := (DirectedEdge.reverse system).trans (((DirectedEdge.outgoingEquiv system).trans (Equiv.sigmaCongrRight system.turnRotation)).trans (DirectedEdge.outgoingEquiv system).symm) /-- Each continuing turn leaves from the previous directed edge's destination. -/ lemma RotationSystem.dartTurn_source {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) : (system.dartTurn edge).src = edge.dst := rfl /-- Every dart returns in a positive number of turns bounded by the finite dart count. -/ @[blueprint "lem:signals-dart-period" (title := "Dart-count period bound") (statement := /-- Each dart returns after a positive number of continuing turns at most the cardinality of the directed-edge carrier. -/) (proof := /-- A finite permutation has periodic points; bound the minimal period by the carrier size. -/) (latexEnv := "lemma")] lemma RotationSystem.dartTurn_period {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) : ∃ period > 0, period ≤ Nat.card (DirectedEdge system) ∧ (system.dartTurn : DirectedEdge system → DirectedEdge system)^[period] edge = edge := by classical let _ : Fintype (DirectedEdge system) := Fintype.ofFinite _ let turn : DirectedEdge system → DirectedEdge system := system.dartTurn have periodic := system.dartTurn.injective.mem_periodicPts edge refine ⟨Function.minimalPeriod turn edge, Function.minimalPeriod_pos_of_mem_periodicPts periodic, ?_, (Function.isPeriodicPt_minimalPeriod turn edge).eq⟩ simpa only [Nat.card_eq_fintype_card] using (Function.minimalPeriod_le_card (f := turn) (x := edge)) /-- The unique outgoing edge at a boundary vertex initializes its strand. -/ def RotationSystem.start {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : DirectedEdge system := { src := Sum.inl index dst := system.boundaryNeighbor index adjacent := system.boundaryAdjacent index } /-- One routing step: black takes the next neighbor, white the previous, and boundary stops. -/ def RotationSystem.step {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) : DirectedEdge system := match edge.dst with | Sum.inl _ => edge | Sum.inr internal => let incoming : system.graph.neighborSet edge.dst := ⟨edge.src, edge.adjacent.symm⟩ let outgoing := match system.color internal with | .black => system.rotation edge.dst incoming | .white => (system.rotation edge.dst).symm incoming { src := edge.dst dst := outgoing.val adjacent := outgoing.property } /-- Routing at an exit boundary leaves the directed edge unchanged. -/ lemma RotationSystem.step_boundary {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) (index : Fin boundaryCount) (terminal : edge.dst = Sum.inl index) : system.step edge = edge := by simp [RotationSystem.step, terminal] /-- At an internal destination the continuing dart turn agrees with the original strand step. -/ lemma RotationSystem.dartTurn_internal {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) (internal : Fin internalCount) (destination : edge.dst = Sum.inr internal) : system.dartTurn edge = system.step edge := by cases edge with | mk source target adjacent => dsimp at destination subst target cases color : system.color internal <;> simp [dartTurn, DirectedEdge.reverse, DirectedEdge.outgoingEquiv, Equiv.sigmaCongrRight, turnRotation, step, color] /-- A boundary arrival continues through its unique incident edge to the corresponding start. -/ lemma RotationSystem.dartTurn_boundary {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) (index : Fin boundaryCount) (destination : edge.dst = Sum.inl index) : system.dartTurn edge = system.start index := by cases edge with | mk source target adjacent => dsimp at destination subst target apply DirectedEdge.ext · rfl · exact system.boundaryUnique index source adjacent.symm /-- Evaluate a strand for a bounded number of steps, retaining a valid directed edge. -/ def RotationSystem.route {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : ℕ → DirectedEdge system → DirectedEdge system | 0, edge => edge | steps + 1, edge => system.step (system.route steps edge) /-- Once a strand reaches a boundary, every further bounded evaluation preserves the exit. -/ lemma RotationSystem.route_boundary {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (edge : DirectedEdge system) (index : Fin boundaryCount) (terminal : edge.dst = Sum.inl index) (steps : ℕ) : system.route steps edge = edge := by induction steps with | zero => rfl | succ steps induction_hypothesis => rw [RotationSystem.route, induction_hypothesis] exact system.step_boundary edge index terminal /-- Moving the first step outside a bounded route leaves the same strand endpoint. -/ lemma RotationSystem.route_succ_start {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (steps : ℕ) (edge : DirectedEdge system) : system.route (steps + 1) edge = system.route steps (system.step edge) := by induction steps with | zero => rfl | succ steps induction_hypothesis => exact congrArg system.step induction_hypothesis /-- Splitting a route into two consecutive bounded evaluations preserves its endpoint. -/ lemma RotationSystem.route_add {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (steps extra : ℕ) (edge : DirectedEdge system) : system.route (steps + extra) edge = system.route extra (system.route steps edge) := by induction extra with | zero => rfl | succ extra induction_hypothesis => exact congrArg system.step induction_hypothesis /-- Search for the first boundary exit, returning its step count or an explicit fuel failure. -/ @[blueprint "def:signals-first-exit" (title := "Executable bounded exit search") (statement := /-- A fuel-bounded strand evaluator returns the earliest exit's step count and boundary label, or an explicit failure if the budget is exhausted internally. -/)] def RotationSystem.firstExit {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : ℕ → DirectedEdge system → Option (ℕ × Fin boundaryCount) | 0, edge => match edge.dst with | Sum.inl index => some (0, index) | Sum.inr _ => none | fuel + 1, edge => match edge.dst with | Sum.inl index => some (0, index) | Sum.inr _ => (system.firstExit fuel (system.step edge)).map (fun exit => (exit.1 + 1, exit.2)) /-- A successful search reaches the reported boundary within fuel, with no earlier boundary exit. -/ lemma RotationSystem.firstExit_spec {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fuel : ℕ) (edge : DirectedEdge system) (steps : ℕ) (index : Fin boundaryCount) (result : system.firstExit fuel edge = some (steps, index)) : steps ≤ fuel ∧ (system.route steps edge).dst = Sum.inl index ∧ ∀ earlier < steps, ∀ other, (system.route earlier edge).dst ≠ Sum.inl other := by induction fuel generalizing edge steps index with | zero => cases terminal : edge.dst with | inl found => simp only [firstExit, terminal, Option.some.injEq, Prod.mk.injEq] at result rcases result with ⟨rfl, rfl⟩ exact ⟨Nat.le_refl _, terminal, by intro earlier before; omega⟩ | inr _ => simp [firstExit, terminal] at result | succ fuel induction_hypothesis => cases terminal : edge.dst with | inl found => simp only [firstExit, terminal, Option.some.injEq, Prod.mk.injEq] at result rcases result with ⟨rfl, rfl⟩ exact ⟨Nat.zero_le _, terminal, by intro earlier before; omega⟩ | inr _ => cases previous : system.firstExit fuel (system.step edge) with | none => simp [firstExit, terminal, previous] at result | some exit => rcases exit with ⟨previousSteps, previousIndex⟩ simp only [firstExit, terminal, previous, Option.map_some, Option.some.injEq, Prod.mk.injEq] at result rcases result with ⟨rfl, rfl⟩ obtain ⟨bound, destination, minimal⟩ := induction_hypothesis (system.step edge) previousSteps previousIndex previous refine ⟨Nat.succ_le_succ bound, ?_, ?_⟩ · simpa only [route_succ_start] using destination · intro earlier before other cases earlier with | zero => simp [route, terminal] | succ earlier => have earlierBound : earlier < previousSteps := by omega simpa only [route_succ_start] using minimal earlier earlierBound other /-- Any boundary reached by the fuel-limited route is found by the first-exit search. -/ lemma RotationSystem.firstExit_exists {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fuel : ℕ) (edge : DirectedEdge system) (index : Fin boundaryCount) (terminal : (system.route fuel edge).dst = Sum.inl index) : ∃ steps ≤ fuel, system.firstExit fuel edge = some (steps, index) := by induction fuel generalizing edge with | zero => exact ⟨0, Nat.le_refl _, by simp [firstExit, show edge.dst = Sum.inl index from terminal]⟩ | succ fuel induction_hypothesis => cases destination : edge.dst with | inl found => have sameIndex : found = index := Sum.inl.inj (by simpa only [system.route_boundary edge found destination (fuel + 1), destination] using terminal) exact ⟨0, Nat.zero_le _, by simp [firstExit, destination, sameIndex]⟩ | inr _ => rw [route_succ_start] at terminal obtain ⟨steps, bound, result⟩ := induction_hypothesis (system.step edge) terminal exact ⟨steps + 1, Nat.succ_le_succ bound, by simp [firstExit, destination, result]⟩ /-- Fuel exhaustion is equivalent to reaching no boundary by the bounded route endpoint. -/ lemma RotationSystem.firstExit_none_iff {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fuel : ℕ) (edge : DirectedEdge system) : system.firstExit fuel edge = none ↔ ∀ index, (system.route fuel edge).dst ≠ Sum.inl index := by constructor · intro result index terminal obtain ⟨steps, _, found⟩ := system.firstExit_exists fuel edge index terminal rw [result] at found contradiction · intro absent cases result : system.firstExit fuel edge with | none => rfl | some exit => rcases exit with ⟨steps, index⟩ obtain ⟨bound, destination, _⟩ := system.firstExit_spec fuel edge steps index result have extended : (system.route fuel edge).dst = Sum.inl index := by rw [← Nat.add_sub_of_le bound, route_add, system.route_boundary (system.route steps edge) index destination (fuel - steps)] exact destination exact False.elim (absent index extended) /-- Before any boundary arrival, the absorbing route agrees with continuing dart iteration. -/ lemma RotationSystem.route_eq_dartIterate {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (steps : ℕ) (edge : DirectedEdge system) (noBoundary : ∀ earlier < steps, ∀ index, (system.route earlier edge).dst ≠ Sum.inl index) : system.route steps edge = (system.dartTurn : DirectedEdge system → DirectedEdge system)^[steps] edge := by revert noBoundary induction steps with | zero => intro _; rfl | succ steps induction_hypothesis => intro noBoundary have previous := induction_hypothesis (fun earlier before index => noBoundary earlier (by omega) index) cases destination : (system.route steps edge).dst with | inl index => exact False.elim (noBoundary steps (by omega) index destination) | inr internal => rw [route, ← system.dartTurn_internal (system.route steps edge) internal destination, previous, Function.iterate_succ_apply'] /-- An exhausted search budget also excludes all boundary arrivals at earlier steps. -/ lemma RotationSystem.firstExit_none_earlier {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fuel : ℕ) (edge : DirectedEdge system) (result : system.firstExit fuel edge = none) (earlier : ℕ) (bound : earlier ≤ fuel) (index : Fin boundaryCount) : (system.route earlier edge).dst ≠ Sum.inl index := by intro destination have terminal : (system.route fuel edge).dst = Sum.inl index := by rw [← Nat.add_sub_of_le bound, route_add, system.route_boundary (system.route earlier edge) index destination (fuel - earlier)] exact destination exact ((system.firstExit_none_iff fuel edge).mp result index) terminal /-- Every boundary start has an exit found using at most the finite dart count as search fuel. -/ @[blueprint "lem:signals-boundary-exit-exists" (title := "Derived finite boundary termination") (statement := /-- Starting at a boundary, first-exit search succeeds with the finite dart count as fuel. Termination is derived, not supplied as a certificate field. -/) (proof := /-- Until an exit, stopped routing agrees with continuing dart dynamics. A bounded positive dart period forces a boundary arrival. -/) (latexEnv := "lemma")] lemma RotationSystem.boundary_firstExit_exists {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : ∃ steps destination, system.firstExit (Nat.card (DirectedEdge system)) (system.start index) = some (steps, destination) := by cases result : system.firstExit (Nat.card (DirectedEdge system)) (system.start index) with | some exit => rcases exit with ⟨steps, destination⟩ exact ⟨steps, destination, rfl⟩ | none => obtain ⟨period, positive, bound, returns⟩ := system.dartTurn_period (system.start index) cases period with | zero => omega | succ previous => have noBoundary : ∀ earlier < previous, ∀ other, (system.route earlier (system.start index)).dst ≠ Sum.inl other := by intro earlier before other exact system.firstExit_none_earlier _ _ result earlier (by omega) other have agreement := system.route_eq_dartIterate previous (system.start index) noBoundary have sources := congrArg DirectedEdge.src returns rw [Function.iterate_succ_apply', system.dartTurn_source, ← agreement] at sources exact False.elim (system.firstExit_none_earlier _ _ result previous (by omega) index sources) /-- Extract the guaranteed first exit from the computed dart-count search, not a supplied match. -/ noncomputable def RotationSystem.boundaryExitData {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : ℕ × Fin boundaryCount := (system.firstExit (Nat.card (DirectedEdge system)) (system.start index)).get (by obtain ⟨steps, destination, result⟩ := system.boundary_firstExit_exists index rw [result] rfl) /-- The derived boundary data are exactly the successful finite search result. -/ lemma RotationSystem.boundaryExitData_found {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : system.firstExit (Nat.card (DirectedEdge system)) (system.start index) = some (system.boundaryExitData index) := by unfold boundaryExitData exact (Option.some_get _).symm /-- Derived boundary data retain the dart-count bound, route endpoint and earliest-exit condition. -/ lemma RotationSystem.boundaryExitData_spec {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : (system.boundaryExitData index).1 ≤ Nat.card (DirectedEdge system) ∧ (system.route (system.boundaryExitData index).1 (system.start index)).dst = Sum.inl (system.boundaryExitData index).2 ∧ ∀ earlier < (system.boundaryExitData index).1, ∀ other, (system.route earlier (system.start index)).dst ≠ Sum.inl other := system.firstExit_spec _ _ _ _ (system.boundaryExitData_found index) /-- One turn after the earliest boundary arrival reaches the derived destination's start edge. -/ lemma RotationSystem.boundary_return_eq {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : (system.dartTurn : DirectedEdge system → DirectedEdge system)^[ (system.boundaryExitData index).1 + 1] (system.start index) = system.start (system.boundaryExitData index).2 := by rw [Function.iterate_succ_apply', ← system.route_eq_dartIterate (system.boundaryExitData index).1 (system.start index) (system.boundaryExitData_spec index).2.2] exact system.dartTurn_boundary _ _ (system.boundaryExitData_spec index).2.1 /-- No positive iterate reaches any boundary start before the derived first-return time. -/ lemma RotationSystem.boundary_no_early_start {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (first other : Fin boundaryCount) (turns : ℕ) (bound : turns ≤ (system.boundaryExitData first).1) (returns : (system.dartTurn : DirectedEdge system → DirectedEdge system)^[turns] (system.start first) = system.start other) : turns = 0 ∧ first = other := by cases turns with | zero => exact ⟨rfl, Sum.inl.inj (congrArg DirectedEdge.src returns)⟩ | succ previous => have minimal := (system.boundaryExitData_spec first).2.2 have agreement := system.route_eq_dartIterate previous (system.start first) (fun earlier before index => minimal earlier (by omega) index) have sources := congrArg DirectedEdge.src returns rw [Function.iterate_succ_apply', system.dartTurn_source, ← agreement] at sources exact False.elim (minimal previous (by omega) other sources) /-- The positive boundary first-return time is bounded by the finite dart count. -/ @[blueprint "lem:signals-boundary-return-bound" (title := "Positive first-return bound") (statement := /-- The earliest boundary arrival plus one continuing turn reaches the destination's start edge, with positive return time at most the dart count. -/) (proof := /-- First-return minimality places the earliest exit before the bounded dart period. -/) (latexEnv := "lemma")] lemma RotationSystem.boundary_return_bound {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : (system.boundaryExitData index).1 + 1 ≤ Nat.card (DirectedEdge system) := by obtain ⟨period, positive, bound, returns⟩ := system.dartTurn_period (system.start index) have sooner : (system.boundaryExitData index).1 < period := by by_contra! earlier have impossible := (system.boundary_no_early_start index index period earlier returns).1 omega omega /-- Invertible dart dynamics and first-return minimality prevent two starts sharing an exit. -/ @[blueprint "lem:signals-boundary-exit-injective" (title := "First-exit injectivity") (statement := /-- Distinct boundary starts have distinct derived first-exit labels. -/) (proof := /-- Cancel common invertible dart iterates. A shared exit would force an earlier boundary return, contradicting first-return minimality. -/) (latexEnv := "lemma")] lemma RotationSystem.boundaryExit_injective {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : Function.Injective (fun index => (system.boundaryExitData index).2) := by have ordered_case : ∀ first second : Fin boundaryCount, (system.boundaryExitData first).1 ≤ (system.boundaryExitData second).1 → (system.boundaryExitData first).2 = (system.boundaryExitData second).2 → first = second := by intro first second ordered matched let gap := (system.boundaryExitData second).1 - (system.boundaryExitData first).1 let turn : DirectedEdge system → DirectedEdge system := system.dartTurn have total : (system.boundaryExitData first).1 + 1 + gap = (system.boundaryExitData second).1 + 1 := by dsimp [gap]; omega have sameReturn : turn^[(system.boundaryExitData first).1 + 1] (system.start first) = turn^[(system.boundaryExitData first).1 + 1] (turn^[gap] (system.start second)) := by rw [← Function.iterate_add_apply, total] dsimp only [turn] rw [system.boundary_return_eq first, system.boundary_return_eq second, matched] have meet := (system.dartTurn.injective.iterate _) sameReturn have earliest := system.boundary_no_early_start second first gap (Nat.sub_le _ _) meet.symm exact earliest.2.symm intro first second matched rcases le_total (system.boundaryExitData first).1 (system.boundaryExitData second).1 with ordered | ordered · exact ordered_case first second ordered matched · exact (ordered_case second first ordered matched.symm).symm /-- Construct the boundary permutation from guaranteed earliest exits, without a supplied permutation. -/ @[blueprint "def:signals-derived-boundary-permutation" (title := "Derived boundary permutation") (statement := /-- Derived earliest-exit labels construct a boundary permutation: injectivity implies surjectivity on the finite boundary set. Fixed-point colors remain separate input data. -/)] noncomputable def RotationSystem.boundaryPerm {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) : Equiv.Perm (Fin boundaryCount) := Equiv.ofBijective (fun index => (system.boundaryExitData index).2) ⟨system.boundaryExit_injective, Finite.injective_iff_surjective.mp system.boundaryExit_injective⟩ /-- The constructed boundary permutation is exactly the label returned by the first-exit search. -/ lemma RotationSystem.boundaryPerm_apply {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (index : Fin boundaryCount) : system.boundaryPerm index = (system.boundaryExitData index).2 := rfl /-- Any two successful fuel budgets return the same earliest step count and boundary label. -/ lemma RotationSystem.firstExit_unique {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fuel otherFuel : ℕ) (edge : DirectedEdge system) (steps otherSteps : ℕ) (index otherIndex : Fin boundaryCount) (result : system.firstExit fuel edge = some (steps, index)) (otherResult : system.firstExit otherFuel edge = some (otherSteps, otherIndex)) : steps = otherSteps ∧ index = otherIndex := by obtain ⟨_, destination, minimal⟩ := system.firstExit_spec fuel edge steps index result obtain ⟨_, otherDestination, otherMinimal⟩ := system.firstExit_spec otherFuel edge otherSteps otherIndex otherResult have sameSteps : steps = otherSteps := by apply le_antisymm · by_contra! more exact minimal otherSteps more otherIndex otherDestination · by_contra! more exact otherMinimal steps more index destination refine ⟨sameSteps, Sum.inl.inj (destination.symm.trans ?_)⟩ simpa only [sameSteps] using otherDestination /-- A checked finite exit certificate and bijective boundary labeling. The permutation and finite step counts are supplied and checked against the route evaluator, not derived from unproved termination or planarity premises. -/ structure BoundaryRouting {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) where perm : Equiv.Perm (Fin boundaryCount) steps : Fin boundaryCount → ℕ exits : ∀ index, (system.route (steps index) (system.start index)).dst = Sum.inl (perm index) fixedColor : ∀ index, perm index = index → NodeColor /-- Extract a decorated permutation only from checked boundary routing data. -/ def BoundaryRouting.decorated {boundaryCount internalCount : ℕ} {system : RotationSystem boundaryCount internalCount} (routing : BoundaryRouting system) : DecoratedPermutation boundaryCount := { perm := routing.perm fixedColor := routing.fixedColor } /-- The extracted permutation agrees with each finite routed endpoint. -/ lemma BoundaryRouting.route_destination {boundaryCount internalCount : ℕ} {system : RotationSystem boundaryCount internalCount} (routing : BoundaryRouting system) (index : Fin boundaryCount) : (system.route (routing.steps index) (system.start index)).dst = Sum.inl (routing.decorated.perm index) := routing.exits index /-- Bijectivity is available only through the checked routing certificate's permutation. -/ lemma BoundaryRouting.perm_bijective {boundaryCount internalCount : ℕ} {system : RotationSystem boundaryCount internalCount} (routing : BoundaryRouting system) : Function.Bijective routing.decorated.perm := routing.perm.bijective /-- Populate the compatibility certificate from derived exits; fixed-point decorations remain explicit. -/ noncomputable def RotationSystem.derivedRouting {boundaryCount internalCount : ℕ} (system : RotationSystem boundaryCount internalCount) (fixedColor : ∀ index, system.boundaryPerm index = index → NodeColor) : BoundaryRouting system := { perm := system.boundaryPerm steps := fun index => (system.boundaryExitData index).1 exits := fun index => (system.boundaryExitData_spec index).2.1 fixedColor := fixedColor } /-- Nonnegative edge weights with a checked strict level increase on every nonzero edge. -/ @[blueprint "def:signals-weighted-acyclic-network" (title := "Level-certified weighted networks") (statement := /-- A finite nonnegative weight matrix $W$ has vertex levels in $\{0,\ldots,h\}$, strictly increasing along each nonzero edge. No planar embedding is supplied. -/)] structure WeightedAcyclicNetwork (vertexCount height : ℕ) where level : Fin vertexCount → Fin (height + 1) weight : Matrix (Fin vertexCount) (Fin vertexCount) ℝ≥0 ascending : ∀ first second, weight first second ≠ 0 → (level first).val < (level second).val /-- Matrix-power path weights vanish when their length exceeds the available level difference. -/ lemma WeightedAcyclicNetwork.pathWeight_zero {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) (length : ℕ) (first second : Fin vertexCount) (tooLong : (network.level second).val < (network.level first).val + length) : (network.weight ^ length) first second = 0 := by induction length generalizing first second with | zero => by_cases same : first = second · subst second omega · simp [same] | succ length induction_hypothesis => rw [pow_succ, Matrix.mul_apply] apply Finset.sum_eq_zero intro middle _ by_cases left : (network.level middle).val < (network.level first).val + length · rw [induction_hypothesis first middle left, zero_mul] · have right : network.weight middle second = 0 := by by_contra nonzero have increasing := network.ascending middle second nonzero omega rw [right, mul_zero] /-- The checked level bound derives nilpotency; no cyclic-series convergence is assumed. -/ @[blueprint "lem:signals-weight-nilpotency" (title := "Derived weight nilpotency") (statement := /-- For a level-certified network of height $h$, $W^{h+1}=0$. -/) (proof := /-- Induct on path length to show entries vanish beyond the available level difference. -/) (latexEnv := "lemma")] lemma WeightedAcyclicNetwork.nilpotent {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) : network.weight ^ (height + 1) = 0 := by apply Matrix.ext intro first second change (network.weight ^ (height + 1)) first second = 0 apply network.pathWeight_zero have bounded := (network.level second).isLt omega /-- Sum all weighted path lengths allowed by the certified acyclic height, including length zero. -/ @[blueprint "def:signals-finite-transfer" (title := "Finite weighted-path transfer") (statement := /-- Define the actual transfer matrix $T=\sum_{\ell=0}^{h}W^\ell$, including the identity term. Nilpotency makes larger cutoffs add only zero terms. -/)] noncomputable def WeightedAcyclicNetwork.transfer {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) : Matrix (Fin vertexCount) (Fin vertexCount) ℝ≥0 := ∑ length ∈ Finset.range (height + 1), network.weight ^ length /-- Increasing the finite path cutoff adds only zero terms, rather than a convergence assumption. -/ lemma WeightedAcyclicNetwork.transfer_stable {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) (extra : ℕ) : (∑ length ∈ Finset.range (height + 1 + extra), network.weight ^ length) = network.transfer := by rw [Finset.sum_range_add] have tailZero : (∑ length ∈ Finset.range extra, network.weight ^ (height + 1 + length)) = 0 := by apply Finset.sum_eq_zero intro length _ rw [pow_add, network.nilpotent, zero_mul] rw [tailZero, add_zero] rfl /-- The finite path sum satisfies the exact identity-plus-one-edge continuation equation. -/ @[blueprint "lem:signals-transfer-equation" (title := "Finite continuation identity") (statement := /-- The derived finite transfer satisfies $T=I+WT$ exactly. -/) (proof := /-- Shift the finite power sum; the final power vanishes by the level-derived nilpotency. -/) (latexEnv := "lemma")] lemma WeightedAcyclicNetwork.transfer_equation {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) : network.transfer = 1 + network.weight * network.transfer := by calc network.transfer = ∑ length ∈ Finset.range (height + 1 + 1), network.weight ^ length := by rw [Finset.sum_range_succ, network.nilpotent, add_zero] rfl _ = 1 + ∑ length ∈ Finset.range (height + 1), network.weight ^ (length + 1) := by rw [Finset.sum_range_succ'] simp only [pow_zero] exact add_comm _ _ _ = 1 + network.weight * network.transfer := by rw [transfer, Finset.mul_sum] congr 1 apply Finset.sum_congr rfl intro length _ exact pow_succ' network.weight length /-- Boundary measurements select source/sink entries of the derived finite weighted path sum. -/ @[blueprint "def:signals-boundary-measurement" (title := "Actual source-sink measurements") (statement := /-- Chosen source and sink maps select entries of the derived transfer matrix. These nonnegative measurements do not by themselves establish signed-minor positivity. -/)] noncomputable def WeightedAcyclicNetwork.boundaryMeasurement {vertexCount height : ℕ} (network : WeightedAcyclicNetwork vertexCount height) {sourceCount sinkCount : ℕ} (sources : Fin sourceCount → Fin vertexCount) (sinks : Fin sinkCount → Fin vertexCount) : Matrix (Fin sourceCount) (Fin sinkCount) ℝ≥0 := fun source sink => network.transfer (sources source) (sinks sink) /-- A single weighted directed edge with source zero and sink one. -/ def WeightedAcyclicNetwork.oneEdgePath (weight : ℝ≥0) : WeightedAcyclicNetwork 2 1 := { level := fun vertex => vertex weight := ![![0, weight], ![0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- A subdivided directed edge with an intermediate vertex and two independently supplied weights. -/ def WeightedAcyclicNetwork.twoEdgePath (firstWeight secondWeight : ℝ≥0) : WeightedAcyclicNetwork 3 2 := { level := fun vertex => vertex weight := ![![0, firstWeight, 0], ![0, 0, secondWeight], ![0, 0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- A single edge's actual finite path sum recovers its supplied edge weight. -/ lemma WeightedAcyclicNetwork.oneEdgePath_transfer (weight : ℝ≥0) : (oneEdgePath weight).transfer 0 1 = weight := by simp only [transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, Matrix.one_apply] simp [oneEdgePath] /-- A two-edge path's actual finite sum multiplies its two edge weights. -/ lemma WeightedAcyclicNetwork.twoEdgePath_transfer (firstWeight secondWeight : ℝ≥0) : (twoEdgePath firstWeight secondWeight).transfer 0 2 = firstWeight * secondWeight := by simp only [transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, pow_two, Matrix.one_apply, Matrix.mul_apply] simp [twoEdgePath, Fin.sum_univ_succ] /-- Subdivision by a nonzero factor preserves the complete one-source/one-sink boundary matrix. -/ @[blueprint "lem:signals-guarded-subdivision" (title := "Guarded edge subdivision") (statement := /-- For a nonzero split factor $s$, subdividing a single weight $w$ into $s$ and $w/s$ preserves the actual source-sink boundary measurement. -/) (proof := /-- Compute the one-edge and two-edge transfers and cancel the nonzero split factor. -/) (latexEnv := "lemma")] lemma WeightedAcyclicNetwork.subdivision_boundary (weight factor : ℝ≥0) (nonzero : factor ≠ 0) : (twoEdgePath factor (weight / factor)).boundaryMeasurement (fun _ : Fin 1 => 0) (fun _ : Fin 1 => 2) = (oneEdgePath weight).boundaryMeasurement (fun _ : Fin 1 => 0) (fun _ : Fin 1 => 1) := by apply Matrix.ext intro source sink change (twoEdgePath factor (weight / factor)).transfer 0 2 = (oneEdgePath weight).transfer 0 1 rw [twoEdgePath_transfer, oneEdgePath_transfer, div_eq_mul_inv] calc factor * (weight * factor⁻¹) = weight * (factor * factor⁻¹) := by ac_rfl _ = weight := by rw [mul_inv_cancel₀ nonzero, mul_one] /-- One source feeding two sinks with independent nonnegative edge weights. -/ def WeightedAcyclicNetwork.fork (firstWeight secondWeight : ℝ≥0) : WeightedAcyclicNetwork 3 1 := { level := fun vertex => if vertex = 0 then 0 else 1 weight := ![![0, firstWeight, secondWeight], ![0, 0, 0], ![0, 0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- The fork's two boundary entries are derived from its finite weighted-path sum. -/ lemma WeightedAcyclicNetwork.fork_boundary (firstWeight secondWeight : ℝ≥0) : (fork firstWeight secondWeight).boundaryMeasurement (fun _ : Fin 1 => 0) Fin.succ = (![![firstWeight, secondWeight]] : Matrix (Fin 1) (Fin 2) ℝ≥0) := by apply Matrix.ext intro source sink fin_cases source fin_cases sink all_goals simp only [boundaryMeasurement, transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, Matrix.one_apply] simp [fork] /-- Two sources at level zero feed two sinks at level one with independent edge weights. -/ def WeightedAcyclicNetwork.twoChannel (firstFirst firstSecond secondFirst secondSecond : ℝ≥0) : WeightedAcyclicNetwork 4 1 := { level := fun vertex => if vertex.val < 2 then 0 else 1 weight := ![![0, 0, firstFirst, firstSecond], ![0, 0, secondFirst, secondSecond], ![0, 0, 0, 0], ![0, 0, 0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- The complete two-channel boundary matrix is derived from the finite weighted path sum. -/ lemma WeightedAcyclicNetwork.twoChannel_boundary (firstFirst firstSecond secondFirst secondSecond : ℝ≥0) : (twoChannel firstFirst firstSecond secondFirst secondSecond).boundaryMeasurement (Fin.castAdd 2) (Fin.natAdd 2) = (!![firstFirst, firstSecond; secondFirst, secondSecond] : Matrix (Fin 2) (Fin 2) ℝ≥0) := by apply Matrix.ext intro source sink fin_cases source <;> fin_cases sink all_goals simp only [boundaryMeasurement, transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, Matrix.one_apply] simp [twoChannel] /-- Two sources feed two sinks through one shared intermediate vertex. -/ def WeightedAcyclicNetwork.singleHub (firstIn secondIn firstOut secondOut : ℝ≥0) : WeightedAcyclicNetwork 5 2 := { level := fun vertex => if vertex.val < 2 then 0 else if vertex.val = 2 then 1 else 2 weight := ![![0, 0, firstIn, 0, 0], ![0, 0, secondIn, 0, 0], ![0, 0, 0, firstOut, secondOut], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- Each measured hub entry is the product of its independently supplied incoming and outgoing edge. -/ lemma WeightedAcyclicNetwork.singleHub_boundary (firstIn secondIn firstOut secondOut : ℝ≥0) : (singleHub firstIn secondIn firstOut secondOut).boundaryMeasurement (Fin.castAdd 3) (Fin.natAdd 3) = (!![firstIn * firstOut, firstIn * secondOut; secondIn * firstOut, secondIn * secondOut] : Matrix (Fin 2) (Fin 2) ℝ≥0) := by apply Matrix.ext intro source sink fin_cases source <;> fin_cases sink all_goals simp only [boundaryMeasurement, transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, pow_two, Matrix.one_apply, Matrix.mul_apply] simp [singleHub, Fin.sum_univ_succ] /-- One source at level zero feeds two parallel intermediate vertices at level one, which both feed one sink at level two. -/ def WeightedAcyclicNetwork.diamond (firstIn secondIn firstOut secondOut : ℝ≥0) : WeightedAcyclicNetwork 4 2 := { level := fun vertex => if vertex = 0 then 0 else if vertex.val < 3 then 1 else 2 weight := ![![0, firstIn, secondIn, 0], ![0, 0, 0, firstOut], ![0, 0, 0, secondOut], ![0, 0, 0, 0]] ascending := by intro first second nonzero fin_cases first <;> fin_cases second <;> norm_num at * } /-- The diamond network's source-to-sink transfer sums the two parallel two-edge path products. -/ lemma WeightedAcyclicNetwork.diamond_transfer (firstIn secondIn firstOut secondOut : ℝ≥0) : (diamond firstIn secondIn firstOut secondOut).transfer 0 3 = firstIn * firstOut + secondIn * secondOut := by simp only [transfer, Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, zero_add, Matrix.add_apply, pow_zero, pow_one, pow_two, Matrix.one_apply, Matrix.mul_apply] simp [diamond, Fin.sum_univ_succ] /-- Reducing two parallel two-edge paths into a single edge with summed path-product weight preserves the complete one-source/one-sink boundary measurement matrix. -/ @[blueprint "lem:signals-parallel-path-reduction" (title := "Parallel two-edge path reduction") (statement := /-- Replacing two parallel two-edge paths of weights $(a_1,b_1)$ and $(a_2,b_2)$ between one source and one sink by a single edge of weight $a_1 b_1+a_2 b_2$ preserves the actual source-sink boundary measurement matrix. -/) (proof := /-- Compute the diamond transfer sum and compare with \texttt{oneEdgePath\_transfer}. -/) (latexEnv := "lemma")] lemma WeightedAcyclicNetwork.parallel_reduction_boundary (firstIn secondIn firstOut secondOut : ℝ≥0) : (diamond firstIn secondIn firstOut secondOut).boundaryMeasurement (fun _ : Fin 1 => 0) (fun _ : Fin 1 => 3) = (oneEdgePath (firstIn * firstOut + secondIn * secondOut)).boundaryMeasurement (fun _ : Fin 1 => 0) (fun _ : Fin 1 => 1) := by apply Matrix.ext intro source sink change (diamond firstIn secondIn firstOut secondOut).transfer 0 3 = (oneEdgePath (firstIn * firstOut + secondIn * secondOut)).transfer 0 1 rw [diamond_transfer, oneEdgePath_transfer] /-! ## Multi-Layer Lindström–Gessel–Viennot (LGV) Disjoint-Path Composition & Three-Channel ($k = 3$) LGV Positivity -/ /-- The determinant of a finite list of composable $k \times k$ layer transfer matrices $L = [M_1, M_2, \dots, M_m]$ equals the product of the individual layer determinants: $\det\bigl(\prod_{r=1}^m M_r\bigr) = \prod_{r=1}^m \det(M_r)$. -/ @[blueprint "thm:signals-lgv-multilayer-det-prod" (title := "Multi-layer Lindström–Gessel–Viennot transfer matrix determinant multiplicativity") (statement := /-- For any rank $k\in\mathbb N$ and any finite list $L$ of $k\times k$ layer transfer matrices, $\det(L.\mathrm{prod}) = (L.\mathrm{map}\,\det).\mathrm{prod}$. -/) (proof := /-- Induct on the layer list $L$ using $\det(I_k)=1$ and $\det(AB)=\det(A)\det(B)$. -/)] theorem lgv_multiLayer_det_prod {k : ℕ} (layers : List (Matrix (Fin k) (Fin k) ℝ)) : layers.prod.det = (layers.map Matrix.det).prod := by induction layers with | nil => simp [Matrix.det_one] | cons head tail ih => simp [List.prod_cons, Matrix.det_mul, ih] /-- **Multi-Layer Lindström–Gessel–Viennot (LGV) Total Nonnegativity Preservation**: If every layer transfer matrix $M_r \in L$ in an arbitrary-length planar acyclic cascade has nonnegative $k$-channel determinant $\det(M_r) \ge 0$, then the composite multi-step transfer matrix $T = \prod_{r=1}^m M_r$ has $\det(T) \ge 0$. -/ @[blueprint "thm:signals-lgv-multilayer-det-nonneg" (title := "Multi-layer LGV nonnegativity preservation across arbitrary path length") (statement := /-- For any list $L$ of $k\times k$ layer transfer matrices, if $\forall M\in L,\,0\le\det M$, then $0\le\det(L.\mathrm{prod})$. -/) (proof := /-- Induct on $L$ using \texttt{Matrix.det\_mul} and \texttt{mul\_nonneg}. -/)] theorem lgv_multiLayer_det_nonnegative {k : ℕ} (layers : List (Matrix (Fin k) (Fin k) ℝ)) (h_nonneg : ∀ M ∈ layers, 0 ≤ M.det) : 0 ≤ layers.prod.det := by induction layers with | nil => simp [Matrix.det_one] | cons head tail ih => rw [List.prod_cons, Matrix.det_mul] exact mul_nonneg (h_nonneg head (by simp)) (ih (fun M hM => h_nonneg M (by simp [hM]))) /-- **Multi-Layer Lindström–Gessel–Viennot (LGV) Strict Disjoint-Path Positivity**: If every layer transfer matrix $M_r \in L$ in an arbitrary-length planar acyclic cascade admits a strictly positive $k$-tuple of vertex-disjoint paths ($\det(M_r) > 0$), then the composite multi-step transfer matrix $T = \prod_{r=1}^m M_r$ has strictly positive determinant $\det(T) > 0$. -/ @[blueprint "thm:signals-lgv-multilayer-det-pos" (title := "Multi-layer LGV strict disjoint-path positivity across arbitrary path length") (statement := /-- For any list $L$ of $k\times k$ layer transfer matrices, if $\forall M\in L,\,0 < \det M$, then $0 < \det(L.\mathrm{prod})$. -/) (proof := /-- Induct on $L$ using \texttt{Matrix.det\_mul} and \texttt{mul\_pos}. -/)] theorem lgv_multiLayer_det_positive {k : ℕ} (layers : List (Matrix (Fin k) (Fin k) ℝ)) (h_pos : ∀ M ∈ layers, 0 < M.det) : 0 < layers.prod.det := by induction layers with | nil => simp [Matrix.det_one] | cons head tail ih => rw [List.prod_cons, Matrix.det_mul] exact mul_pos (h_pos head (by simp)) (ih (fun M hM => h_pos M (by simp [hM]))) /-- Planar upper-bidiagonal elementary $3 \times 3$ step matrix $E_{\mathrm{upper}}^{(3)}(d_0, d_1, d_2, u_{01}, u_{12})$ with horizontal channel weights $d_0, d_1, d_2$ and non-crossing upward steps $0 \to 1$ ($u_{01}$) and $1 \to 2$ ($u_{12}$). -/ @[blueprint "def:signals-planar-three-channel-upper-step" (title := "Planar 3-channel upper-bidiagonal step matrix") (statement := /-- Define the planar 3-channel upper-bidiagonal transfer step $E_{\mathrm{upper}}^{(3)}(d_0,d_1,d_2,u_{01},u_{12}) = \begin{pmatrix} d_0 & u_{01} & 0 \\ 0 & d_1 & u_{12} \\ 0 & 0 & d_2 \end{pmatrix}$. -/)] def planarThreeChannelUpperStep (d0 d1 d2 u01 u12 : ℝ) : Matrix (Fin 3) (Fin 3) ℝ := !![d0, u01, 0; 0, d1, u12; 0, 0, d2] /-- Planar lower-bidiagonal elementary $3 \times 3$ step matrix $E_{\mathrm{lower}}^{(3)}(d_0, d_1, d_2, l_{10}, l_{21})$ with horizontal channel weights $d_0, d_1, d_2$ and non-crossing downward steps $1 \to 0$ ($l_{10}$) and $2 \to 1$ ($l_{21}$). -/ @[blueprint "def:signals-planar-three-channel-lower-step" (title := "Planar 3-channel lower-bidiagonal step matrix") (statement := /-- Define the planar 3-channel lower-bidiagonal transfer step $E_{\mathrm{lower}}^{(3)}(d_0,d_1,d_2,l_{10},l_{21}) = \begin{pmatrix} d_0 & 0 & 0 \\ l_{10} & d_1 & 0 \\ 0 & l_{21} & d_2 \end{pmatrix}$. -/)] def planarThreeChannelLowerStep (d0 d1 d2 l10 l21 : ℝ) : Matrix (Fin 3) (Fin 3) ℝ := !![d0, 0, 0; l10, d1, 0; 0, l21, d2] /-- **Three-Channel ($k = 3$) Lindström–Gessel–Viennot Disjoint-Path Determinant & Shared-Vertex Obstruction Theorem**: 1. For any planar upper-bidiagonal or lower-bidiagonal 3-channel step, every intersecting path triple cancels or vanishes by planarity, leaving the unique vertex-disjoint horizontal path-triple product: $$\det E_{\mathrm{upper}}^{(3)}(d_0, d_1, d_2, u_{01}, u_{12}) = d_0 d_1 d_2, \qquad \det E_{\mathrm{lower}}^{(3)}(d_0, d_1, d_2, l_{10}, l_{21}) = d_0 d_1 d_2,$$ 2. For their two-step planar composite $T^{(3)} = E_{\mathrm{lower}}^{(3)}(1, 1, 1, l_{10}, l_{21}) \, E_{\mathrm{upper}}^{(3)}(d_0, d_1, d_2, u_{01}, u_{12})$, the 3-channel LGV determinant equals $\det T^{(3)} = d_0 d_1 d_2 > 0$ whenever $d_0, d_1, d_2 > 0$, 3. Conversely, if three sources route through a two-vertex bottleneck (`A : Matrix (Fin 3) (Fin 2) ℝ` composed with `B : Matrix (Fin 2) (Fin 3) ℝ`), the pigeonhole principle forces every path triple to share an intermediate vertex and the $3 \times 3$ determinant vanishes identically: $\det(A B) = 0$. -/ @[blueprint "thm:signals-planar-three-channel-lgv-identities" (title := "Three-channel (k = 3) LGV vertex-disjoint path positivity and 2-vertex bottleneck cancellation") (statement := /-- For any $d_0,d_1,d_2,u_{01},u_{12},l_{10},l_{21}\in\mathbb R$, $A\in\mathbb R^{3\times 2}$, and $B\in\mathbb R^{2\times 3}$: (1) $\det E_{\mathrm{upper}}^{(3)}(d_0,d_1,d_2,u_{01},u_{12}) = d_0 d_1 d_2$, (2) $\det E_{\mathrm{lower}}^{(3)}(d_0,d_1,d_2,l_{10},l_{21}) = d_0 d_1 d_2$, (3) $\det\bigl(E_{\mathrm{lower}}^{(3)}(1,1,1,l_{10},l_{21})\,E_{\mathrm{upper}}^{(3)}(d_0,d_1,d_2,u_{01},u_{12})\bigr) = d_0 d_1 d_2$, (4) if $0 < d_0, d_1, d_2$, then $0 < \det\bigl(E_{\mathrm{lower}}^{(3)}(1,1,1,l_{10},l_{21})\,E_{\mathrm{upper}}^{(3)}(d_0,d_1,d_2,u_{01},u_{12})\bigr)$, and (5) $\det(AB) = 0$. -/) (proof := /-- Expand $3\times 3$ determinants via \texttt{Matrix.det\_fin\_three} and close by ring algebra and \texttt{mul\_pos}. -/)] theorem planar_threeChannel_lgv_and_bottleneck_identities (d0 d1 d2 u01 u12 l10 l21 : ℝ) (hd0 : 0 < d0) (hd1 : 0 < d1) (hd2 : 0 < d2) (A : Matrix (Fin 3) (Fin 2) ℝ) (B : Matrix (Fin 2) (Fin 3) ℝ) : (planarThreeChannelUpperStep d0 d1 d2 u01 u12).det = d0 * d1 * d2 ∧ (planarThreeChannelLowerStep d0 d1 d2 l10 l21).det = d0 * d1 * d2 ∧ (planarThreeChannelLowerStep 1 1 1 l10 l21 * planarThreeChannelUpperStep d0 d1 d2 u01 u12).det = d0 * d1 * d2 ∧ 0 < (planarThreeChannelLowerStep 1 1 1 l10 l21 * planarThreeChannelUpperStep d0 d1 d2 u01 u12).det ∧ (A * B).det = 0 := by have h_up : (planarThreeChannelUpperStep d0 d1 d2 u01 u12).det = d0 * d1 * d2 := by unfold planarThreeChannelUpperStep rw [Matrix.det_fin_three] dsimp [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail] ring have h_low : (planarThreeChannelLowerStep d0 d1 d2 l10 l21).det = d0 * d1 * d2 := by unfold planarThreeChannelLowerStep rw [Matrix.det_fin_three] dsimp [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail] ring have h_comp : (planarThreeChannelLowerStep 1 1 1 l10 l21 * planarThreeChannelUpperStep d0 d1 d2 u01 u12).det = d0 * d1 * d2 := by rw [Matrix.det_mul, h_up] have h_low1 : (planarThreeChannelLowerStep 1 1 1 l10 l21).det = 1 := by unfold planarThreeChannelLowerStep rw [Matrix.det_fin_three] dsimp [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail] ring rw [h_low1, one_mul] have h_pos : 0 < (planarThreeChannelLowerStep 1 1 1 l10 l21 * planarThreeChannelUpperStep d0 d1 d2 u01 u12).det := by rw [h_comp] exact mul_pos (mul_pos hd0 hd1) hd2 have h_bottle : (A * B).det = 0 := by rw [Matrix.det_fin_three] simp only [Matrix.mul_apply, Fin.sum_univ_two, Fin.isValue] ring exact ⟨h_up, h_low, h_comp, h_pos, h_bottle⟩ /-! ## Vector-Relation Configurations (VRC) for Complex Grassmannian $\mathrm{Gr}_{\mathbb{C}}(k, n)$ Plabic Networks Standard Postnikov plabic graphs (`WeightedAcyclicNetwork` above) assign strictly positive real weights $x_e \in \mathbb{R}_{>0}$ (or nonnegative `ℝ≥0` weights) to parameterize positroid cells of the **Totally Nonnegative Grassmannian $\mathrm{Gr}_{\ge 0}(k, n)$**, where boundary-measurement denominators and cluster-mutation denominators $x_X + 1 > 1 > 0$ never vanish. When moving to the **Complex Grassmannian $\mathrm{Gr}_{\mathbb{C}}(k, n)$**—as required for off-shell virtual states, complex Kohn-Sham / QED-DFT electronic orbitals, hybrid polariton and plasmon superpositions, and quantum causal channels—rational face weights $x_e \in \mathbb{C}^*$ parameterize only an open algebraic torus chart $(\mathbb{C}^*)^{k(n-k)}$ and suffer from two fundamental obstructions: 1. **On-Shell Resonance / Destructive-Interference Poles ($x_X = -1$)**: Under the complex square move (urban renewal) $x_X' = 1 / x_X$, $x_1' = (x_1 x_X + x_2) / (x_X + 1)$, the denominator $x_X + 1$ vanishes at $x_X = -1$ (on-shell polaritonic resonance or destructive loop interference). 2. **Chart-Boundary Degeneration ($x_X = 0$)**: Rational entries such as $x_X^{-1}$ blow up on lower-rank positroid / Schubert boundary strata. Following Lam (2015) and Affolter, Glick, Pylyavskyy, & Ramassamy (2019, `arXiv:1908.06959`), a **Vector-Relation Configuration (`VectorRelationConfiguration`)** resolves both obstructions by placing vectors $v_w \in R^k$ on the white vertices $w \in W$ (`vectors : Matrix (Fin rankK) (Fin whiteCount) R`) and homogeneous linear relations $\sum_{w} K_{b,w} v_w = 0$ on the black vertices $b \in B$ (`relations : Matrix (Fin blackCount) (Fin whiteCount) R`), governed by the polynomial matrix identity $V K^\top = 0$ (`vectors * relations.transpose = 0`). -/ /-- A **Vector-Relation Configuration (VRC)** on a bicolored network over a commutative ring $R$: - `vectors : Matrix (Fin rankK) (Fin whiteCount) R` assigns a column vector $v_w \in R^{\mathrm{rankK}}$ to each white vertex $w \in \mathrm{Fin}\,\mathrm{whiteCount}$, - `relations : Matrix (Fin blackCount) (Fin whiteCount) R` assigns linear relation coefficients $K_{b, w} \in R$ to each black vertex $b \in \mathrm{Fin}\,\mathrm{blackCount}$, - `boundaryWhite : Fin boundaryCount → Fin whiteCount` identifies the $n$ boundary white vertices, - `relation_satisfied : vectors * relations.transpose = 0` enforces $\sum_w K_{b, w} v_w = 0$ at every black vertex $b$ without any division or non-vanishing denominator assumption. -/ @[blueprint "def:signals-vector-relation-configuration" (title := "Vector-Relation Configuration (VRC) for Complex and Ring-Valued Grassmannians") (statement := /-- A Vector-Relation Configuration over a commutative ring $R$ consists of white-vertex vectors $V \in R^{k \times |W|}$, black-vertex relation coefficients $K \in R^{|B| \times |W|}$, and boundary vertex indices $\partial : \mathrm{Fin}\,n \to \mathrm{Fin}\,|W|$ satisfying the homogeneous linear constraint $V K^\top = 0$. -/)] structure VectorRelationConfiguration (rankK whiteCount blackCount boundaryCount : ℕ) (R : Type*) [CommRing R] where vectors : Matrix (Fin rankK) (Fin whiteCount) R relations : Matrix (Fin blackCount) (Fin whiteCount) R boundaryWhite : Fin boundaryCount → Fin whiteCount relation_satisfied : vectors * relations.transpose = 0 /-- Extract the $k \times n$ boundary generator matrix $C_{\mathrm{bdry}} \in R^{k \times n}$ whose $j$-th column is the vector at boundary white vertex `boundaryWhite j`. -/ @[blueprint "def:signals-vrc-boundary-matrix" (title := "Boundary subspace generator matrix of a Vector-Relation Configuration") (statement := /-- Extract the $k \times n$ boundary matrix $C_{i, j} = V_{i, \partial(j)}$ generating the point in $\mathrm{Gr}_R(k, n)$. -/)] def VectorRelationConfiguration.boundaryMatrix {rankK whiteCount blackCount boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) : Matrix (Fin rankK) (Fin boundaryCount) R := vrc.vectors.submatrix id vrc.boundaryWhite /-- At every black vertex $b$ and vector component $i$, the weighted sum of white-vertex vectors vanishes identically: $\sum_w V_{i, w} K_{b, w} = 0$. -/ @[blueprint "lem:signals-vrc-black-linear-combination-zero" (title := "Componentwise black-vertex linear relation identity") (statement := /-- For any `vrc`, $i \in \mathrm{Fin}\,k$, and $b \in \mathrm{Fin}\,|B|$, $\sum_{w} V_{i, w} K_{b, w} = 0$. -/) (proof := /-- Extract the $(i, b)$ entry of `vrc.relation_satisfied : V * Kᵀ = 0`. -/) (latexEnv := "lemma")] lemma VectorRelationConfiguration.blackLinearCombination_eq_zero {rankK whiteCount blackCount boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) (i : Fin rankK) (b : Fin blackCount) : ∑ w : Fin whiteCount, vrc.vectors i w * vrc.relations b w = 0 := by have h := congrFun (congrFun vrc.relation_satisfied i) b simpa [Matrix.mul_apply, Matrix.transpose_apply] using h /-- **Global $\mathrm{GL}_k(R)$ / Unitary Orbital Rotation Gauge Invariance of a VRC**: Left-multiplying all white-vertex vectors by $g \in R^{k \times k}$ (such as a unitary orbital transformation $U \in U(N_{\mathrm{occ}})$ in Kohn-Sham DFT) preserves all black-vertex relations $V K^\top = 0$. -/ @[blueprint "def:signals-vrc-transform-gl" (title := "Global GL_k / unitary orbital gauge action on a Vector-Relation Configuration") (statement := /-- Left-multiplying white-vertex vectors by $g \in R^{k \times k}$ maps $V \mapsto gV$ and preserves $(gV)K^\top = g(VK^\top) = 0$. -/)] def VectorRelationConfiguration.transformGL {rankK whiteCount blackCount boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) (g : Matrix (Fin rankK) (Fin rankK) R) : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R where vectors := g * vrc.vectors relations := vrc.relations boundaryWhite := vrc.boundaryWhite relation_satisfied := by rw [Matrix.mul_assoc, vrc.relation_satisfied, Matrix.mul_zero] /-- Global $\mathrm{GL}_k(R)$ action on a VRC acts by left multiplication on the boundary matrix: $(g \cdot \mathrm{vrc}).\mathrm{boundaryMatrix} = g \cdot \mathrm{vrc}.\mathrm{boundaryMatrix}$. -/ lemma VectorRelationConfiguration.transformGL_boundaryMatrix {rankK whiteCount blackCount boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) (g : Matrix (Fin rankK) (Fin rankK) R) : (vrc.transformGL g).boundaryMatrix = g * vrc.boundaryMatrix := by apply Matrix.ext intro i j simp [boundaryMatrix, transformGL, Matrix.mul_apply] /-- **Black-Vertex Row-Operation / Urban-Renewal Elimination Invariance of a VRC**: Left-multiplying the black-vertex relation matrix $K$ by any row-mixing matrix $M \in R^{|B'| \times |B|}$ preserves $V (M K)^\top = (V K^\top) M^\top = 0$ and leaves the boundary Grassmannian generator matrix unchanged. -/ @[blueprint "def:signals-vrc-transform-black-relations" (title := "Black-vertex row-mixing and linear-elimination gauge action on a VRC") (statement := /-- Left-multiplying the relation matrix $K$ by $M \in R^{|B'| \times |B|}$ preserves $V(MK)^\top = (VK^\top)M^\top = 0$ and leaves the boundary matrix invariant. -/)] def VectorRelationConfiguration.transformBlackRelations {rankK whiteCount blackCount blackCount' boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) (m : Matrix (Fin blackCount') (Fin blackCount) R) : VectorRelationConfiguration rankK whiteCount blackCount' boundaryCount R where vectors := vrc.vectors relations := m * vrc.relations boundaryWhite := vrc.boundaryWhite relation_satisfied := by rw [Matrix.transpose_mul, ← Matrix.mul_assoc, vrc.relation_satisfied, Matrix.zero_mul] /-- Black-vertex relation row operations leave the boundary subspace matrix identically unchanged. -/ lemma VectorRelationConfiguration.transformBlackRelations_boundaryMatrix {rankK whiteCount blackCount blackCount' boundaryCount : ℕ} {R : Type*} [CommRing R] (vrc : VectorRelationConfiguration rankK whiteCount blackCount boundaryCount R) (m : Matrix (Fin blackCount') (Fin blackCount) R) : (vrc.transformBlackRelations m).boundaryMatrix = vrc.boundaryMatrix := rfl /-- The $2 \times 2$ Plücker minor $p_{j_1, j_2}(C) = C_{0, j_1} C_{1, j_2} - C_{0, j_2} C_{1, j_1}$ of a $2 \times 4$ generator matrix $C \in R^{2 \times 4}$. -/ @[blueprint "def:signals-plucker-2x4-minor" (title := "2x2 Plücker minor of a 2x4 Grassmannian generator matrix") (statement := /-- Define $p_{j_1, j_2}(C) = C_{0, j_1} C_{1, j_2} - C_{0, j_2} C_{1, j_1}$ for $C \in R^{2 \times 4}$. -/)] def plucker2x4Minor {R : Type*} [CommRing R] (C : Matrix (Fin 2) (Fin 4) R) (j1 j2 : Fin 4) : R := C 0 j1 * C 1 j2 - C 0 j2 * C 1 j1 /-- The quadratic Plücker relation residual $\mathcal{R}_{\mathrm{Pl\ddot{u}cker}}(C) = p_{01} p_{23} - p_{02} p_{13} + p_{03} p_{12}$ (in 1-based indexing: $p_{12} p_{34} - p_{13} p_{24} + p_{14} p_{23}$) for $C \in R^{2 \times 4}$. -/ @[blueprint "def:signals-plucker-quadratic-relation-2x4" (title := "Quadratic Plücker relation residual on Gr(2, 4)") (statement := /-- Define $\mathcal{R}_{\mathrm{Pl\ddot{u}cker}}(C) = p_{01}(C) p_{23}(C) - p_{02}(C) p_{13}(C) + p_{03}(C) p_{12}(C)$. -/)] def pluckerQuadraticRelation2x4 {R : Type*} [CommRing R] (C : Matrix (Fin 2) (Fin 4) R) : R := plucker2x4Minor C 0 1 * plucker2x4Minor C 2 3 - plucker2x4Minor C 0 2 * plucker2x4Minor C 1 3 + plucker2x4Minor C 0 3 * plucker2x4Minor C 1 2 /-- **Universal Quadratic Plücker Identity on $\mathrm{Gr}_R(2, 4)$**: Every $2 \times 4$ matrix $C \in R^{2 \times 4}$ over any commutative ring $R$ (including every VRC boundary matrix over $\mathbb{C}$) identically satisfies the quadratic Plücker relation $p_{01} p_{23} - p_{02} p_{13} + p_{03} p_{12} = 0$. -/ @[blueprint "thm:signals-plucker-quadratic-relation-2x4-eq-zero" (title := "Universal quadratic Plücker relation identity for 2x4 generator matrices") (statement := /-- For any commutative ring $R$ and any $C \in R^{2 \times 4}$, $\operatorname{pluckerQuadraticRelation2x4}(C) = 0$. -/) (proof := /-- Unfold \texttt{pluckerQuadraticRelation2x4} and \texttt{plucker2x4Minor} and close by \texttt{ring}. -/)] theorem pluckerQuadraticRelation2x4_eq_zero {R : Type*} [CommRing R] (C : Matrix (Fin 2) (Fin 4) R) : pluckerQuadraticRelation2x4 C = 0 := by unfold pluckerQuadraticRelation2x4 plucker2x4Minor ring /-- The rational face-weight generator matrix $C_{\mathrm{rat}}(x_1, x_2, x_X)$ on $\mathrm{Gr}_F(2, 4)$ from the QCI-GXC / polariton plabic network (`Google-Search_Density-Functional-Theory_20261105-1512.md`, lines 576–580, 735–739, 1118–1122): $$C_{\mathrm{rat}}(x_1, x_2, x_X) = \begin{pmatrix} 1 & 0 & -x_1 & -x_X \\ 0 & 1 & x_X^{-1} & -x_2 \end{pmatrix}.$$ -/ @[blueprint "def:signals-gr24-rational-chart-matrix" (title := "Rational face-weight Gr(2, 4) plabic chart matrix") (statement := /-- Define $C_{\mathrm{rat}}(x_1, x_2, x_X) = \begin{pmatrix} 1 & 0 & -x_1 & -x_X \\ 0 & 1 & x_X^{-1} & -x_2 \end{pmatrix}$. -/)] def gr24RationalChartMatrix {F : Type*} [Field F] (x1 x2 xX : F) : Matrix (Fin 2) (Fin 4) F := !![1, 0, -x1, -xX; 0, 1, xX⁻¹, -x2] /-- The rational complex cluster mutation (square move) around the central face $x_X$ (`Google-Search_Density-Functional-Theory_20261105-1512.md`, lines 373–378, 761–763, 1129–1135): $$(x_1', x_2', x_X') = \left(\frac{x_1 x_X + x_2}{x_X + 1},\; x_2,\; \frac{1}{x_X}\right).$$ -/ @[blueprint "def:signals-gr24-cluster-mutation" (title := "Complex square-move cluster mutation on Gr(2, 4) face weights") (statement := /-- Define $\operatorname{gr24ClusterMutation}(x_1, x_2, x_X) = \bigl((x_1 x_X + x_2)/(x_X + 1),\; x_2,\; x_X^{-1}\bigr)$. -/)] def gr24ClusterMutation {F : Type*} [Field F] (x1 x2 xX : F) : F × F × F := ((x1 * xX + x2) / (xX + 1), x2, xX⁻¹) /-- **Pole-Free Homogeneous Vector-Relation Configuration (`gr24HomogeneousVRC`) for the $\mathrm{Gr}_R(2, 4)$ Plabic Network**: Clears the rational chart singularity $x_X^{-1}$ by scaling white vertex $w_2$ by $x_X$, yielding white-vertex vectors $$V_{\mathrm{hom}}(x_1, x_2, x_X) = \begin{pmatrix} 1 & 0 & -x_1 x_X & -x_X \\ 0 & 1 & 1 & -x_2 \end{pmatrix}$$ and black-vertex linear relations $$K_{\mathrm{hom}}(x_1, x_2, x_X) = \begin{pmatrix} x_1 x_X & -1 & 1 & 0 \\ x_X & x_2 & 0 & 1 \end{pmatrix},$$ which satisfy $V_{\mathrm{hom}} K_{\mathrm{hom}}^\top = 0$ over **any** commutative ring $R$ (including at $x_X = 0$ and $x_X = -1$)! -/ @[blueprint "def:signals-gr24-homogeneous-vrc" (title := "Pole-free homogeneous Vector-Relation Configuration for Gr(2, 4)") (statement := /-- Construct the 4-white, 2-black Vector-Relation Configuration on $\mathrm{Gr}_R(2, 4)$ with $V_{\mathrm{hom}} = \begin{pmatrix} 1 & 0 & -x_1 x_X & -x_X \\ 0 & 1 & 1 & -x_2 \end{pmatrix}$ and $K_{\mathrm{hom}} = \begin{pmatrix} x_1 x_X & -1 & 1 & 0 \\ x_X & x_2 & 0 & 1 \end{pmatrix}$, regular for all $x_1, x_2, x_X \in R$. -/)] def gr24HomogeneousVRC {R : Type*} [CommRing R] (x1 x2 xX : R) : VectorRelationConfiguration 2 4 2 4 R where vectors := !![1, 0, -(x1 * xX), -xX; 0, 1, 1, -x2] relations := !![x1 * xX, -1, 1, 0; xX, x2, 0, 1] boundaryWhite := id relation_satisfied := by apply Matrix.ext intro i b fin_cases i <;> fin_cases b <;> simp [Matrix.mul_apply, Fin.sum_univ_four] /-- **Pole-Free Mutated Vector-Relation Configuration (`gr24MutatedHomogeneousVRC`) Across the $x_X = -1$ On-Shell Polaritonic Resonance**: In the rational cluster mutation (`gr24ClusterMutation`), $x_1' = (x_1 x_X + x_2)/(x_X + 1)$ and $x_X' = 1 / x_X$ exhibit rational poles at the on-shell polariton resonance $x_X = -1$ ($x_X + 1 = 0$) and at $x_X = 0$. In the Vector-Relation Configuration framework, scaling white vertex $w_2$ by $x_X + 1$ and white vertex $w_3$ by $x_X$ produces the polynomial VRC: $$V_{\mathrm{mut}}^{\mathrm{VRC}}(x_1, x_2, x_X) = \begin{pmatrix} 1 & 0 & -(x_1 x_X + x_2) & -1 \\ 0 & 1 & x_X(x_X + 1) & -x_2 x_X \end{pmatrix},$$ $$K_{\mathrm{mut}}^{\mathrm{VRC}}(x_1, x_2, x_X) = \begin{pmatrix} x_1 x_X + x_2 & -x_X(x_X + 1) & 1 & 0 \\ 1 & x_2 x_X & 0 & 1 \end{pmatrix},$$ which satisfies $V_{\mathrm{mut}}^{\mathrm{VRC}} (K_{\mathrm{mut}}^{\mathrm{VRC}})^\top = 0$ and the quadratic Plücker relation identically for **all** $x_1, x_2, x_X \in R$, remaining completely smooth through the on-shell polariton resonance $x_X = -1$! -/ @[blueprint "def:signals-gr24-mutated-homogeneous-vrc" (title := "Pole-free mutated Vector-Relation Configuration across the x_X = -1 polariton resonance") (statement := /-- Construct the post-square-move Vector-Relation Configuration on $\mathrm{Gr}_R(2, 4)$ by clearing the $(x_X + 1)$ and $x_X$ denominators into homogeneous white-vertex vectors and black-vertex linear relations, regular at $x_X = -1$ and $x_X = 0$. -/)] def gr24MutatedHomogeneousVRC {R : Type*} [CommRing R] (x1 x2 xX : R) : VectorRelationConfiguration 2 4 2 4 R where vectors := !![1, 0, -(x1 * xX + x2), -1; 0, 1, xX * (xX + 1), -(x2 * xX)] relations := !![x1 * xX + x2, -(xX * (xX + 1)), 1, 0; 1, x2 * xX, 0, 1] boundaryWhite := id relation_satisfied := by apply Matrix.ext intro i b fin_cases i <;> fin_cases b <;> simp [Matrix.mul_apply, Fin.sum_univ_four] /-- **Master Theorem: Complex Grassmannian Vector-Relation Configurations, Pole-Free Square-Move Resonance at $x_X = -1$, and Exact SymPy Benchmark Check Figures**: 1. Every $2 \times 4$ rational chart matrix $C_{\mathrm{rat}}(x_1, x_2, x_X)$ ($x_X \neq 0$) has exact Plücker minors $p_{01} = 1$, $p_{02} = x_X^{-1}$, $p_{03} = -x_2$, $p_{12} = x_1$, $p_{13} = x_X$, $p_{23} = x_1 x_2 + 1$, and satisfies `pluckerQuadraticRelation2x4 = 0`, 2. Both the pre-mutation `gr24HomogeneousVRC` and post-mutation `gr24MutatedHomogeneousVRC` satisfy $V K^\top = 0$ and `pluckerQuadraticRelation2x4 = 0` for **all** $x_1, x_2, x_X \in \mathbb{C}$, 3. At the **on-shell polariton resonance pole $x_X = -1$** ($x_X + 1 = 0$), where the rational cluster mutation divides by zero, `gr24MutatedHomogeneousVRC x1 x2 (-1)` remains regular with finite Plücker minors $P_{01} = 1$, $P_{02} = 0$, $P_{03} = x_2$, $P_{12} = x_2 - x_1$, $P_{13} = 1$, and $P_{23} = x_2(x_1 - x_2)$, 4. On the concrete off-shell complex test point from `qci_gxc_sympy.py` (`lines 1190–1212`), $x_1 = \frac{1}{2} + \frac{1}{5}i$, $x_2 = -\frac{3}{10} + \frac{7}{10}i$, $x_X = \frac{6}{5} - \frac{2}{5}i$: - $p_{03}(C_{\mathrm{rat}}(x_1, x_2, x_X)) = -x_2 = \frac{3}{10} - \frac{7}{10}i$, and - $(\operatorname{gr24ClusterMutation}(x_1, x_2, x_X)).2.2 = x_X^{-1} = \frac{3}{4} + \frac{1}{4}i$. -/ @[blueprint "thm:signals-complex-plabic-vrc-and-sympy-check-figures" (title := "Complex Grassmannian VRC regularity at x_X = -1 and exact SymPy Plücker check figures") (statement := /-- Simultaneous verification of the $\mathrm{Gr}_{\mathbb{C}}(2,4)$ Plücker minors, quadratic Plücker relation, pole-free Vector-Relation Configuration regularity at the on-shell polariton resonance $x_X = -1$, and exact numerical check figures $p_{14} = 0.3 - 0.7i$ and $x_X' = 0.75 + 0.25i$ from \texttt{qci\_gxc\_sympy.py}. -/) (proof := /-- Expand matrix entries and determinants on $\mathrm{Fin}\,2 \times \mathrm{Fin}\,4$ and close by \texttt{ring}, \texttt{field\_simp}, and complex arithmetic. -/)] theorem complex_plabic_vrc_and_sympy_check_figures (x1 x2 xX : ℂ) (hxX : xX ≠ 0) : let C_rat := gr24RationalChartMatrix x1 x2 xX let vrc_pre := gr24HomogeneousVRC x1 x2 xX let vrc_res := gr24MutatedHomogeneousVRC x1 x2 (-1) let test_x1 : ℂ := 1 / 2 + (1 / 5 : ℂ) * Complex.I let test_x2 : ℂ := -(3 / 10 : ℂ) + (7 / 10 : ℂ) * Complex.I let test_xX : ℂ := 6 / 5 - (2 / 5 : ℂ) * Complex.I plucker2x4Minor C_rat 0 1 = 1 ∧ plucker2x4Minor C_rat 0 2 = xX⁻¹ ∧ plucker2x4Minor C_rat 0 3 = -x2 ∧ plucker2x4Minor C_rat 1 2 = x1 ∧ plucker2x4Minor C_rat 1 3 = xX ∧ plucker2x4Minor C_rat 2 3 = x1 * x2 + 1 ∧ pluckerQuadraticRelation2x4 C_rat = 0 ∧ vrc_pre.vectors * vrc_pre.relations.transpose = 0 ∧ pluckerQuadraticRelation2x4 vrc_pre.boundaryMatrix = 0 ∧ vrc_res.vectors * vrc_res.relations.transpose = 0 ∧ pluckerQuadraticRelation2x4 vrc_res.boundaryMatrix = 0 ∧ plucker2x4Minor vrc_res.boundaryMatrix 0 2 = 0 ∧ plucker2x4Minor vrc_res.boundaryMatrix 1 2 = x2 - x1 ∧ plucker2x4Minor vrc_res.boundaryMatrix 2 3 = x2 * (x1 - x2) ∧ plucker2x4Minor (gr24RationalChartMatrix test_x1 test_x2 test_xX) 0 3 = (3 / 10 : ℂ) - (7 / 10 : ℂ) * Complex.I ∧ (gr24ClusterMutation test_x1 test_x2 test_xX).2.2 = (3 / 4 : ℂ) + (1 / 4 : ℂ) * Complex.I := by intro C_rat vrc_pre vrc_res test_x1 test_x2 test_xX have hp23 : plucker2x4Minor C_rat 2 3 = x1 * x2 + 1 := by unfold C_rat gr24RationalChartMatrix plucker2x4Minor dsimp [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.vecHead, Matrix.vecTail] calc -x1 * -x2 - -xX * xX⁻¹ = x1 * x2 + xX * xX⁻¹ := by ring _ = x1 * x2 + 1 := by rw [mul_inv_cancel₀ hxX] have h_test_inv : (gr24ClusterMutation test_x1 test_x2 test_xX).2.2 = (3 / 4 : ℂ) + (1 / 4 : ℂ) * Complex.I := by unfold gr24ClusterMutation test_xX dsimp apply inv_eq_of_mul_eq_one_right calc ((6 / 5 : ℂ) - (2 / 5 : ℂ) * Complex.I) * ((3 / 4 : ℂ) + (1 / 4 : ℂ) * Complex.I) = (9 / 10 : ℂ) - (1 / 10 : ℂ) * (Complex.I ^ 2) := by ring _ = 1 := by rw [Complex.I_sq]; ring refine ⟨by unfold C_rat gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, by unfold C_rat gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, by unfold C_rat gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, by unfold C_rat gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, by unfold C_rat gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, hp23, pluckerQuadraticRelation2x4_eq_zero C_rat, vrc_pre.relation_satisfied, pluckerQuadraticRelation2x4_eq_zero vrc_pre.boundaryMatrix, vrc_res.relation_satisfied, pluckerQuadraticRelation2x4_eq_zero vrc_res.boundaryMatrix, by unfold vrc_res gr24MutatedHomogeneousVRC VectorRelationConfiguration.boundaryMatrix plucker2x4Minor; dsimp; ring, by unfold vrc_res gr24MutatedHomogeneousVRC VectorRelationConfiguration.boundaryMatrix plucker2x4Minor; dsimp; ring, by unfold vrc_res gr24MutatedHomogeneousVRC VectorRelationConfiguration.boundaryMatrix plucker2x4Minor; dsimp; ring, by unfold test_x1 test_x2 test_xX gr24RationalChartMatrix plucker2x4Minor; dsimp; ring, h_test_inv⟩ end Signals.Plabic