Shared-site coefficient context · GraphMomentumVertices
DefinitionMarkovScatteringCharged_GraphMomentumVerticesmarkov-scattering
Source context from the finite shared-site cubic model and its supporting definitions and checked lemmas.
Definition code
import Definitions.Def_MarkovScatteringCharged_GraphMomentumVerticesRegister
open scoped BigOperators
/-!
# Registered local vertex factors
An edge step supplies its propagator and adds the sampled edge momentum to both
the balance register and its labelled assignment slot. After all edge steps,
each vertex contributes one diagonal transfer reading just its signed end
momenta and its own balance. The sector detector reads only the final balance
and the four-phase character.
-/
namespace MarkovScattering.GraphMomentum
noncomputable section
section TransferWords
variable {B : Type*} [Fintype B]
/-- A local complex factor that leaves the register unchanged. -/
def diagonalFactor [DecidableEq B] (g : B → ℂ) (a b : B) : ℂ :=
if a = b then g a else 0
theorem act_diagonalFactor [DecidableEq B] (g f : B → ℂ) (a : B) :
FourPhase.act (diagonalFactor g) f a = g a * f a := by
simp [FourPhase.act,diagonalFactor,ite_mul]
theorem applyWord_append (f : B → ℂ) (L R : List (B → B → ℂ)) :
FourPhase.applyWord f (L ++ R) =
FourPhase.applyWord (FourPhase.applyWord f R) L := by
induction L with
| nil => rfl
| cons A L ih => simp only [List.cons_append,FourPhase.applyWord,ih]
theorem apply_diagonalFactors [DecidableEq B] (g : List (B → ℂ)) (f : B → ℂ) (a : B) :
FourPhase.applyWord f (g.map diagonalFactor) a = (g.map (fun h => h a)).prod * f a := by
induction g with
| nil => simp [FourPhase.applyWord]
| cons h g ih =>
simp only [List.map_cons,FourPhase.applyWord,act_diagonalFactor,ih,List.prod_cons,mul_assoc]
/-- Enumerate each local diagonal transfer once, keeping the index of the
vertex independent of its value on the register. -/
def indexedDiagonalSteps {I : Type*} [Fintype I] [DecidableEq B] (g : I → B → ℂ) :
List (B → B → ℂ) :=
(List.ofFn fun i => g ((Fintype.equivFin I).symm i)).map diagonalFactor
theorem apply_indexedDiagonalSteps {I : Type*} [Fintype I] [DecidableEq B]
(g : I → B → ℂ) (f : B → ℂ) (u : B) :
FourPhase.applyWord f (indexedDiagonalSteps g) u = (∏ i, g i u) * f u := by
rw [indexedDiagonalSteps,apply_diagonalFactors,List.map_ofFn,List.prod_ofFn]
simp only [Function.comp_apply]
exact congrArg (fun z : ℂ => z * f u) ((Fintype.equivFin I).symm.prod_comp (fun i => g i u))
end TransferWords
variable {E V K : Type*} [Fintype E] [DecidableEq E] [Fintype V] [DecidableEq V]
[Fintype K] [DecidableEq K] [AddCommGroup K]
/-- An edge contributes two distinct end flags, including when both ends are
at the same vertex. A true flag marks the target. -/
def endVertex (s t : E → V) (h : E × Bool) : V :=
if h.2 then t h.1 else s h.1
def IncidentEnds (s t : E → V) (v : V) := {h : E × Bool // endVertex s t h = v}
/-- Local tensors use only this vertex's balance and its own signed edge ends.
The queried external sector is not an input to the transfer word. -/
abbrev VertexFactors (s t : E → V) (K : Type*) :=
∀ v, K → (IncidentEnds s t v → K) → ℂ
/-- The target end reads q and the source end reads -q. Distinct flags preserve
both slots of a self-loop. -/
def signedEnds (s t : E → V) (q : E → K) (v : V) : IncidentEnds s t v → K :=
fun h => if h.val.2 then q h.val.1 else -q h.val.1
abbrev FlowRegister (V E K : Type*) := Register (V → K) E K
/-- One edge adds its incidence to the balance and its momentum to exactly
its own assignment slot. -/
def registeredIncrement (s t : E → V) (i : E) (q : K) : FlowRegister V E K :=
codedIncrement (fun e => incidence (s e) (t e)) id i q
omit [Fintype V] [Fintype K] [DecidableEq K] in
theorem registeredIncrement_sum (s t : E → V) (q : E → K) :
(∑ i, registeredIncrement s t i (q i)) =
((∑ i, incidence (s i) (t i) (q i)),q) :=
codedIncrement_sum (fun e => incidence (s e) (t e)) id q
/-- The transfer sequence recording the ordinary independently sampled
edge momenta. -/
def registeredEdgeSteps (s t : E → V) (w : E → K → ℂ) :
List (FlowRegister V E K → FlowRegister V E K → ℂ) :=
codedEdgeSteps (fun e => incidence (s e) (t e)) id w
theorem apply_registeredEdgeSteps (s t : E → V) (w : E → K → ℂ)
(f : FlowRegister V E K → ℂ) (u : FlowRegister V E K) :
FourPhase.applyWord f (registeredEdgeSteps s t w) u =
∑ q : E → K, (∏ i, w i (q i)) * f (u + ((∑ i, incidence (s i) (t i) (q i)),q)) :=
apply_codedEdgeSteps (fun e => incidence (s e) (t e)) id w f u
/-- A vertex reads only the local projection of the register. -/
def vertexWeight (s t : E → V) (g : VertexFactors s t K) (v : V)
(u : FlowRegister V E K) : ℂ :=
g v (u.1 v) (signedEnds s t u.2 v)
/-- One separate diagonal step per vertex. -/
def registeredVertexSteps (s t : E → V) (g : VertexFactors s t K) :
List (FlowRegister V E K → FlowRegister V E K → ℂ) :=
indexedDiagonalSteps (vertexWeight s t g)
theorem apply_registeredVertexSteps (s t : E → V) (g : VertexFactors s t K)
(f : FlowRegister V E K → ℂ) (u : FlowRegister V E K) :
FourPhase.applyWord f (registeredVertexSteps s t g) u =
(∏ v, vertexWeight s t g v u) * f u :=
apply_indexedDiagonalSteps (vertexWeight s t g) f u
/-- The complete sequence uses graph data and local factors, independently of
the sector queried at the endpoint. -/
def registeredGraphSteps (s t : E → V) (w : E → K → ℂ) (g : VertexFactors s t K) :
List (FlowRegister V E K → FlowRegister V E K → ℂ) :=
registeredEdgeSteps s t w ++ registeredVertexSteps s t g
/-- The corresponding stochastic steps have nonnegative entries and unit row sums. -/
theorem registeredGraphSteps_stochastic (s t : E → V) (w : E → K → ℂ) (g : VertexFactors s t K)
(P : (FlowRegister V E K × Fin 4) → (FlowRegister V E K × Fin 4) → ℝ)
(hP : P ∈ (registeredGraphSteps s t w g).map FourPhase.kernel) :
(∀ a b, 0 ≤ P a b) ∧ ∀ a, ∑ b, P a b = 1 := by
obtain ⟨A,_,rfl⟩ := List.mem_map.mp hP
exact ⟨FourPhase.kernel_nonneg A,FourPhase.kernel_row A⟩
/-- The phase-only observable marks the final balance sector and ignores the
stored assignment. All edge and vertex factors were applied by transitions. -/
def registeredReadout (s t : E → V) (w : E → K → ℂ) (g : VertexFactors s t K)
(x : V → K) : ℂ :=
let mats := registeredGraphSteps s t w g
calibration mats * FourPhase.observeWord
(FourPhase.lift (fun u : FlowRegister V E K => if u.1 = x then 1 else 0)) mats (0,0)
/-- The independently enumerated constrained graph sum with one local complex
factor at each edge and vertex. -/
def constrainedVertexSum (s t : E → V) (w : E → K → ℂ) (g : VertexFactors s t K)
(x : V → K) : ℂ :=
∑ q : E → K, if (∑ i, incidence (s i) (t i) (q i)) = x then
(∏ i, w i (q i)) * ∏ v, g v (x v) (signedEnds s t q v)
else 0
/-- The registered stochastic transfers recover the full constrained sum,
including the independent local vertex tensors. -/
theorem registeredReadout_eq_constrainedVertexSum (s t : E → V) (w : E → K → ℂ)
(g : VertexFactors s t K) (x : V → K) :
registeredReadout s t w g x = constrainedVertexSum s t w g x := by
dsimp only [registeredReadout]
rw [FourPhase.observe_word]
change calibration (registeredGraphSteps s t w g) *
(FourPhase.phase 0 * _ / calibration (registeredGraphSteps s t w g)) = _
simp only [FourPhase.phase,Matrix.cons_val_zero,one_mul,mul_div_cancel₀ _ (calibration_ne_zero _)]
rw [registeredGraphSteps,applyWord_append,apply_registeredEdgeSteps]
unfold constrainedVertexSum
apply Finset.sum_congr rfl
intro q _
simp only [zero_add,apply_registeredVertexSteps,vertexWeight]
by_cases h : (∑ i, incidence (s i) (t i) (q i)) = x
· simp only [h,if_pos, mul_one]
· simp only [h,ite_false,mul_zero]
/-- Local factors cannot create support in a sector with nonzero total balance. -/
theorem registeredReadout_zero_of_nonconservation (s t : E → V) (w : E → K → ℂ)
(g : VertexFactors s t K) (x : V → K) (hx : ∑ v, x v ≠ 0) :
registeredReadout s t w g x = 0 := by
rw [registeredReadout_eq_constrainedVertexSum,constrainedVertexSum]
apply Finset.sum_eq_zero
intro q _
have h : (∑ i, incidence (s i) (t i) (q i)) ≠ x := by
intro he
apply hx
rw [← he]
simp only [Finset.sum_apply]
rw [Finset.sum_comm]
simp only [incidence_conserves,Finset.sum_const_zero]
rw [if_neg h]
end
end MarkovScattering.GraphMomentum
Source