Shared-site coefficient context · WordPlanarTrees
DefinitionMarkovScatteringCharged_WordPlanarTreesmarkov-scattering
Source context from the finite shared-site cubic model and its supporting definitions and checked lemmas.
Definition code
import Definitions.Def_MarkovScatteringCharged_WordGeometry
import Mathlib.Algebra.BigOperators.Group.Finset.Sigma
open scoped BigOperators
namespace MarkovScattering.WordPlanarTrees
open WordGeometry
/-- A rooted plane full binary tree. Tips represent external legs, and each
binary junction carries the gap that separates the two ordered branches. -/
inductive Tree (m : ℕ)
| tip
| node (gap : Fin m) (left right : Tree m)
deriving DecidableEq
variable {m : ℕ}
/-- The set of gaps at the binary junctions of a subtree. -/
def Tree.gaps : Tree m → Finset (Fin m)
| .tip => ∅
| .node a L R => insert a (L.gaps ∪ R.gaps)
/-- A tree is planar and in order on the given gaps when its node splits
the gaps between the left and right child. -/
def OrderedOn : Tree m → Finset (Fin m) → Prop
| .tip, S => S = ∅
| .node a L R, S => a ∈ S ∧ OrderedOn L (left S a) ∧ OrderedOn R (right S a)
theorem OrderedOn.gaps {T : Tree m} {S : Finset (Fin m)} (h : OrderedOn T S) :
T.gaps = S := by
induction T generalizing S with
| tip =>
change S = ∅ at h
simp [Tree.gaps, h]
| node a L R ihL ihR =>
obtain ⟨ha, hL, hR⟩ := h
rw [Tree.gaps, ihL hL, ihR hR, ← erase_eq_split, Finset.insert_erase ha]
/-- The internal vertices before attaching the distinguished external leg. -/
def Tree.junctions : Tree m → ℕ
| .tip => 0
| .node _ L R => L.junctions + R.junctions + 1
/-- External legs other than the distinguished root leg. -/
def Tree.tips : Tree m → ℕ
| .tip => 1
| .node _ L R => L.tips + R.tips
theorem Tree.tips_eq (T : Tree m) : T.tips = T.junctions + 1 := by
induction T with
| tip => rfl
| node _ L R ihL ihR =>
simp only [Tree.tips, Tree.junctions, ihL, ihR]
omega
theorem OrderedOn.junctions {T : Tree m} {S : Finset (Fin m)} (h : OrderedOn T S) :
T.junctions = S.card := by
induction T generalizing S with
| tip =>
change S = ∅ at h
simp [Tree.junctions, h]
| node a L R ihL ihR =>
obtain ⟨ha, hL, hR⟩ := h
have hcard := Finset.card_erase_add_one ha
rw [erase_eq_split, Finset.card_union_of_disjoint (split_separated S a).1] at hcard
rw [Tree.junctions, ihL hL, ihR hR, hcard]
/-- The intervals carried by the internal edges below an attached branch,
including the incoming edge of a non-tip branch. -/
def Tree.branchChannels : Tree m → List (Finset (Fin m))
| .tip => []
| .node a L R => (Tree.node a L R).gaps :: (L.branchChannels ++ R.branchChannels)
/-- The intervals carried by the internal edges of a whole diagram.
There is no internal edge above its root. -/
def Tree.channels (T : Tree m) : List (Finset (Fin m)) :=
T.branchChannels.tail
theorem Tree.branchChannels_length (T : Tree m) : T.branchChannels.length = T.junctions := by
induction T with
| tip => rfl
| node _ L R ihL ihR =>
simp [Tree.branchChannels, Tree.junctions, ihL, ihR]
theorem Tree.channels_length (T : Tree m) : T.channels.length = T.junctions - 1 := by
rw [Tree.channels, List.length_tail, Tree.branchChannels_length]
private theorem OrderedOn.branchChannels_intervals {T : Tree m} {S : Finset (Fin m)}
(h : OrderedOn T S) (hi : Interval S) {I : Finset (Fin m)} (hI : I ∈ T.branchChannels) :
I.Nonempty ∧ Interval I ∧ I ⊆ S := by
induction T generalizing S with
| tip => simp [Tree.branchChannels] at hI
| node a L R ihL ihR =>
have hs := h.gaps
obtain ⟨ha, hL, hR⟩ := h
rcases List.mem_cons.mp hI with h | h
· rw [h, hs]
exact ⟨⟨a, ha⟩, hi, Finset.Subset.refl _⟩
· rcases List.mem_append.mp h with h | h
· obtain ⟨hn, hconv, hsub⟩ := ihL hL (hi.left a) h
exact ⟨hn, hconv, hsub.trans (left_ssubset ha).1⟩
· obtain ⟨hn, hconv, hsub⟩ := ihR hR (hi.right a) h
exact ⟨hn, hconv, hsub.trans (right_ssubset ha).1⟩
/-- Every propagator of an ordered diagram is a proper nonempty interval of its gap set. -/
theorem OrderedOn.channels_intervals {T : Tree m} {S : Finset (Fin m)}
(h : OrderedOn T S) (hi : Interval S) {I : Finset (Fin m)} (hI : I ∈ T.channels) :
I.Nonempty ∧ Interval I ∧ I ⊂ S := by
cases T with
| tip => simp [Tree.channels, Tree.branchChannels] at hI
| node a L R =>
obtain ⟨ha, hL, hR⟩ := h
rcases List.mem_append.mp hI with h | h
· obtain ⟨hn, hconv, hsub⟩ := hL.branchChannels_intervals (hi.left a) h
exact ⟨hn, hconv, Finset.ssubset_of_subset_of_ssubset hsub (left_ssubset ha)⟩
· obtain ⟨hn, hconv, hsub⟩ := hR.branchChannels_intervals (hi.right a) h
exact ⟨hn, hconv, Finset.ssubset_of_subset_of_ssubset hsub (right_ssubset ha)⟩
private def nodeAt (a : Fin m) : Tree m × Tree m ↪ Tree m where
toFun p := .node a p.1 p.2
inj' := by
rintro ⟨L₁, R₁⟩ ⟨L₂, R₂⟩ h
cases h
rfl
/-- Enumerate planar trees by choosing the root gap and independently constructing
both children. The finite set consists of labelled trees, each included once. -/
def trees (S : Finset (Fin m)) : Finset (Tree m) :=
if S.Nonempty then
S.attach.biUnion fun a =>
((trees (left S a.val)) ×ˢ (trees (right S a.val))).map (nodeAt a.val)
else {Tree.tip}
termination_by S.card
decreasing_by
· exact Finset.card_lt_card (left_ssubset a.property)
· exact Finset.card_lt_card (right_ssubset a.property)
/-- The enumeration contains exactly the trees whose recursive splits follow gap order. -/
theorem mem_trees (T : Tree m) (S : Finset (Fin m)) : T ∈ trees S ↔ OrderedOn T S := by
by_cases hS : S.Nonempty
· rw [trees, if_pos hS]
cases T with
| tip =>
constructor
· intro h
obtain ⟨a, _, ha⟩ := Finset.mem_biUnion.mp h
obtain ⟨⟨L, R⟩, _, heq⟩ := Finset.mem_map.mp ha
cases heq
· intro h
exact (hS.ne_empty h).elim
| node a L R =>
constructor
· intro h
obtain ⟨b, _, hb⟩ := Finset.mem_biUnion.mp h
obtain ⟨⟨L', R'⟩, hmem, heq⟩ := Finset.mem_map.mp hb
change Tree.node b.val L' R' = Tree.node a L R at heq
obtain ⟨rfl, rfl, rfl⟩ := Tree.node.inj heq
obtain ⟨hL, hR⟩ := Finset.mem_product.mp hmem
have hb := b.property
exact ⟨hb, (mem_trees L' (left S b.val)).mp hL, (mem_trees R' (right S b.val)).mp hR⟩
· rintro ⟨ha, hL, hR⟩
exact Finset.mem_biUnion.mpr ⟨⟨a, ha⟩, Finset.mem_attach _ _,
Finset.mem_map.mpr ⟨(L, R), Finset.mem_product.mpr
⟨(mem_trees L (left S a)).mpr hL, (mem_trees R (right S a)).mpr hR⟩, rfl⟩⟩
· have hempty := Finset.not_nonempty_iff_eq_empty.mp hS
rw [trees, if_neg hS]
subst S
cases T <;> simp [OrderedOn]
termination_by S.card
decreasing_by
all_goals first
| exact Finset.card_lt_card (left_ssubset ‹_ ∈ S›)
| exact Finset.card_lt_card (right_ssubset ‹_ ∈ S›)
/-- The root count is omitted. A subtree includes its own incoming propagator
and all internal propagators further below it. -/
def branchWeight {K : Type*} [Field K] (D : Finset (Fin m) → K) : Tree m → K
| .tip => 1
| .node a L R =>
(D (Tree.node a L R).gaps)⁻¹ * branchWeight D L * branchWeight D R
/-- The full tree has no propagator above its root. -/
def diagramWeight {K : Type*} [Field K] (D : Finset (Fin m) → K) : Tree m → K
| .tip => 1
| .node _ L R => branchWeight D L * branchWeight D R
theorem branchWeight_eq_prod {K : Type*} [Field K] (D : Finset (Fin m) → K) (T : Tree m) :
branchWeight D T = (T.branchChannels.map fun I => (D I)⁻¹).prod := by
induction T with
| tip => rfl
| node a L R ihL ihR =>
simp [branchWeight, Tree.branchChannels, ihL, ihR, mul_assoc]
theorem diagramWeight_eq_prod {K : Type*} [Field K] (D : Finset (Fin m) → K) (T : Tree m) :
diagramWeight D T = (T.channels.map fun I => (D I)⁻¹).prod := by
cases T with
| tip => rfl
| node a L R =>
simp [diagramWeight, Tree.channels, Tree.branchChannels, branchWeight_eq_prod]
/-- Each planar cubic tree contributes one product of its internal inverse
propagators, expressed through its rooted planar binary tree. -/
def amplitude {K : Type*} [Field K] (D : Finset (Fin m) → K) (S : Finset (Fin m)) : K :=
∑ T ∈ trees S, diagramWeight D T
private theorem sum_trees_split {K : Type*} [Field K] (f : Tree m → K)
(S : Finset (Fin m)) (hS : S.Nonempty) :
(∑ T ∈ trees S, f T) =
∑ a ∈ S, ∑ L ∈ trees (left S a), ∑ R ∈ trees (right S a), f (.node a L R) := by
rw [trees, if_pos hS, Finset.sum_biUnion]
· simp only [Finset.sum_map, Finset.sum_product, nodeAt]
exact Finset.sum_attach S (fun a => ∑ L ∈ trees (left S a),
∑ R ∈ trees (right S a), f (.node a L R))
· intro a _ b _ hab
apply Finset.disjoint_left.mpr
intro T hT hT'
obtain ⟨⟨L, R⟩, _, rfl⟩ := Finset.mem_map.mp hT
obtain ⟨⟨L', R'⟩, _, h⟩ := Finset.mem_map.mp hT'
change Tree.node b.val L' R' = Tree.node a.val L R at h
exact hab (Subtype.ext (Tree.node.inj h).1.symm)
section Sum
variable {K : Type*} [Field K]
/-- The sum for an attached branch includes a propagator at its own root. -/
def branchSum (D : Finset (Fin m) → K) (S : Finset (Fin m)) : K :=
∑ T ∈ trees S, branchWeight D T
@[simp] theorem trees_empty : trees (∅ : Finset (Fin m)) = {Tree.tip} := by
rw [trees]
simp
@[simp] theorem amplitude_empty (D : Finset (Fin m) → K) : amplitude D ∅ = 1 := by
simp [amplitude, diagramWeight]
@[simp] theorem branchSum_empty (D : Finset (Fin m) → K) : branchSum D ∅ = 1 := by
simp [branchSum, branchWeight]
theorem amplitude_split (D : Finset (Fin m) → K) (S : Finset (Fin m)) (hS : S.Nonempty) :
amplitude D S = ∑ a ∈ S, branchSum D (left S a) * branchSum D (right S a) := by
unfold amplitude branchSum
rw [sum_trees_split _ S hS]
apply Finset.sum_congr rfl
intro a _
simp only [diagramWeight]
symm
rw [Finset.sum_mul]
simp only [Finset.mul_sum]
/-- A diagram with at most one binary junction has no internal propagator. -/
theorem amplitude_eq_one_of_card_le_one (D : Finset (Fin m) → K) {S : Finset (Fin m)}
(hS : S.card ≤ 1) : amplitude D S = 1 := by
by_cases he : S = ∅
· simp [he]
· have hPos := Finset.card_pos.mpr (Finset.nonempty_iff_ne_empty.mpr he)
have hCard : S.card = 1 := by omega
obtain ⟨a, rfl⟩ := Finset.card_eq_one.mp hCard
rw [amplitude_split D {a} (Finset.singleton_nonempty _)]
simp [left, right, Finset.filter_singleton]
theorem branchSum_eq (D : Finset (Fin m) → K) (S : Finset (Fin m)) (hS : S.Nonempty) :
branchSum D S = amplitude D S / D S := by
unfold branchSum amplitude
rw [div_eq_inv_mul, Finset.mul_sum]
apply Finset.sum_congr rfl
intro T hT
have h := (mem_trees T S).mp hT
cases T with
| tip => exact (hS.ne_empty h).elim
| node a L R =>
rw [branchWeight, h.gaps, diagramWeight, mul_assoc]
/-- For any interval with nonzero nonempty subset slacks, the full ordering
sum equals the sum of attached planar branches. -/
theorem orderSum_eq_branchSum (D : Finset (Fin m) → K) (S : Finset (Fin m)) (hi : Interval S)
(hadd : AdditiveOn (lineGraph m) D S) (hnz : NonzeroOn D S) :
orderSum D S = branchSum D S := by
by_cases hS : S.Nonempty
· rw [orderSum_delete D S hS, branchSum_eq D S hS, amplitude_split D S hS]
congr 1
apply Finset.sum_congr rfl
intro a ha
have hsub : left S a ∪ right S a ⊆ S := by
rw [← erase_eq_split S a]
exact Finset.erase_subset _ _
rw [erase_eq_split S a, orderSum_union_of_separated _ _ (split_separated S a)
(hadd.mono hsub) (hnz.mono hsub)]
rw [orderSum_eq_branchSum D (left S a) (hi.left a)
(hadd.mono (left_ssubset ha).1) (hnz.mono (left_ssubset ha).1)]
rw [orderSum_eq_branchSum D (right S a) (hi.right a)
(hadd.mono (right_ssubset ha).1) (hnz.mono (right_ssubset ha).1)]
· obtain rfl := Finset.not_nonempty_iff_eq_empty.mp hS
simp
termination_by S.card
decreasing_by
· exact Finset.card_lt_card (left_ssubset ha)
· exact Finset.card_lt_card (right_ssubset ha)
/-- Omitting the full-set prefix gives the planar cubic amplitude with one term
per diagram. The full-set slack can vanish because the root has no propagator. -/
theorem rootOrderSum_eq_amplitude (D : Finset (Fin m) → K) (S : Finset (Fin m))
(hi : Interval S) (hadd : AdditiveOn (lineGraph m) D S)
(hnz : ∀ ⦃T : Finset (Fin m)⦄, T ⊂ S → T.Nonempty → D T ≠ 0) :
rootOrderSum D S = amplitude D S := by
by_cases hS : S.Nonempty
· rw [rootOrderSum_delete D S hS, amplitude_split D S hS]
apply Finset.sum_congr rfl
intro a ha
have hsub : left S a ∪ right S a ⊂ S := by
rw [← erase_eq_split S a]
exact Finset.erase_ssubset ha
have hnzSplit : NonzeroOn D (left S a ∪ right S a) :=
fun _ hT => hnz (Finset.ssubset_of_subset_of_ssubset hT hsub)
rw [erase_eq_split S a, orderSum_union_of_separated _ _ (split_separated S a)
(hadd.mono hsub.1) hnzSplit]
rw [orderSum_eq_branchSum D (left S a) (hi.left a)
(hadd.mono (left_ssubset ha).1) (hnzSplit.mono Finset.subset_union_left)]
rw [orderSum_eq_branchSum D (right S a) (hi.right a)
(hadd.mono (right_ssubset ha).1) (hnzSplit.mono Finset.subset_union_right)]
· obtain rfl := Finset.not_nonempty_iff_eq_empty.mp hS
simp [rootOrderSum, orders, List.permutations_nil, orderWeight]
end Sum
end MarkovScattering.WordPlanarTrees
Source