Shared-site coefficient context · SpeciesTreeWick
DefinitionMarkovScatteringCharged_SpeciesTreeWickmarkov-scattering
Source context from the finite shared-site cubic model and its supporting definitions and checked lemmas.
Definition code
import Definitions.Def_MarkovScatteringCharged_SpeciesTreeMarkov
import Definitions.Def_MarkovScatteringCharged_WickTransfer
/-! At finite regulator, prepare independent species at the field slots,
apply each local vertex tensor, then generate Wick pairings one at a time.
The local tensors may have different valences. -/
namespace MarkovScattering.SpeciesTree.Wick
open GraphMomentum WickTransfer
noncomputable section
variable {n : ℕ} {A V : Type*} [Fintype A] [DecidableEq A] [Fintype V]
/-- A supplied collection of local polynomial insertions. The local use of
each slot is explicit; a fixed perturbative monomial is represented by the
product over its labelled vertex occurrences. -/
structure Data (n : ℕ) (A V : Type*) where
valence : V → ℕ
slots : ∀ v, Fin (valence v) → Fin n
vertex : ∀ v, (Fin (valence v) → A) → ℂ
odd : Fin n → A → Bool
covariance : Fin n → Fin n → A → A → ℂ
abbrev Register (n : ℕ) (A : Type*) := Option ((Fin n → A) × Slots n)
def allocate (S : Slots n) : Register n A → Register n A → ℂ
| none, some (_,T) => if T = S then 1 else 0
| _, _ => 0
def gate (d : Data n A V) (v : V) : Register n A → ℂ
| none => 1
| some (q,_) => d.vertex v (fun i => q (d.slots v i))
def pair (d : Data n A V) : Register n A → Register n A → ℂ
| some (q,S), some (r,T) =>
if r = q then WickTransfer.transfer (fun i => d.odd i (q i))
(fun i j => d.covariance i j (q i) (q j)) S T else 0
| _, _ => 0
def endpoint : Register n A → ℂ
| none => 0
| some (_,S) => WickTransfer.terminal S
def experiments (d : Data n A V) (k : ℕ) (S : Slots n) :
List (Register n A → Register n A → ℂ) :=
allocate S :: (indexedDiagonalSteps (gate d) ++ List.replicate k (pair d))
theorem experiments_stochastic (d : Data n A V) (k : ℕ) (S : Slots n)
(P : (Register n A × Fin 4) → (Register n A × Fin 4) → ℝ)
(hP : P ∈ (experiments d k S).map FourPhase.kernel) :
(∀ a b, 0 ≤ P a b) ∧ ∀ a, ∑ b, P a b = 1 := by
obtain ⟨M,_,rfl⟩ := List.mem_map.mp hP
exact ⟨FourPhase.kernel_nonneg M,FourPhase.kernel_row M⟩
omit [Fintype V] in
private theorem pair_act (d : Data n A V) (f : Register n A → ℂ)
(q : Fin n → A) (S : Slots n) :
FourPhase.act (pair d) f (some (q,S)) =
FourPhase.act
(WickTransfer.transfer (fun i => d.odd i (q i)) (fun i j => d.covariance i j (q i) (q j)))
(fun T => f (some (q,T))) S := by
simp only [FourPhase.act,Fintype.sum_option,Fintype.sum_prod_type,pair,zero_mul,zero_add,ite_mul]
simp_rw [Finset.sum_ite_irrel,Finset.sum_const_zero]
rw [Finset.sum_ite_eq',if_pos (Finset.mem_univ q)]
omit [Fintype V] in
private theorem pair_applyWord (d : Data n A V) (k : ℕ) (q : Fin n → A) (S : Slots n) :
FourPhase.applyWord endpoint (List.replicate k (pair d)) (some (q,S)) =
FourPhase.applyWord WickTransfer.terminal
(List.replicate k (WickTransfer.transfer (fun i => d.odd i (q i))
(fun i j => d.covariance i j (q i) (q j)))) S := by
induction k generalizing S with
| zero => rfl
| succ k ih =>
simp only [List.replicate_succ,FourPhase.applyWord,pair_act]
congr 1
funext T
exact ih T
/-- The usual finite Wick contraction sums independent species at all slots.
The vertex data are supplied before any pairing or loop is generated. -/
def regulatedContraction (d : Data n A V) (S : Slots n) : ℂ :=
∑ q : Fin n → A, (∏ v, d.vertex v (fun i => q (d.slots v i))) *
WickTransfer.wick (fun i => d.odd i (q i)) (fun i j => d.covariance i j (q i) (q j)) S
def observe (d : Data n A V) (k : ℕ) (S : Slots n) : ℂ :=
let mats := experiments d k S
calibration mats * FourPhase.observeWord (FourPhase.lift endpoint) mats (none,0)
/-- Read an entire finite Wick coefficient by a single stochastic word:
preparation, one gate per supplied local tensor, and least-slot pairings.
The terminal detector observes only phase and whether all slots were removed. -/
theorem observe_eq_regulatedContraction (d : Data n A V) (k : ℕ) (S : Slots n)
(hk : S.card = 2*k) :
observe d k S = regulatedContraction d S := by
dsimp only [observe]
rw [FourPhase.observe_word]
change calibration (experiments d k S) *
(FourPhase.phase 0 * _ / calibration (experiments d k S)) = _
simp only [FourPhase.phase,Matrix.cons_val_zero,one_mul,mul_div_cancel₀ _ (calibration_ne_zero _)]
rw [experiments,FourPhase.applyWord,applyWord_append]
simp only [FourPhase.act,Fintype.sum_option,Fintype.sum_prod_type,allocate,zero_mul,zero_add,
ite_mul,one_mul,apply_indexedDiagonalSteps,gate,pair_applyWord]
unfold regulatedContraction
apply Finset.sum_congr rfl
intro q _
rw [Finset.sum_ite_eq',if_pos (Finset.mem_univ S),apply_pairs _ _ k S hk]
end
end MarkovScattering.SpeciesTree.Wick
Source