Shared-site coefficient context · ShuffleOrders
DefinitionMarkovScatteringCharged_ShuffleOrdersmarkov-scattering
Source context from the finite shared-site cubic model and its supporting definitions and checked lemmas.
Definition code
import Definitions.Def_MarkovScatteringCharged_Interleavings
import Definitions.Def_MarkovScatteringCharged_Shuffle
/-!
# Weighted interleavings of two orders
For reversed lists, removing the head traces a lattice path backwards. The
weight at each point is the reciprocal slack of the union of the two suffix
sets. Additivity identifies this slack with the denominator in Lemma 2.1.
-/
open scoped BigOperators
namespace MarkovScattering
noncomputable section
variable {V K : Type*} [DecidableEq V] [Field K]
private theorem support_subset_of_suffix {s t : List V} (h : s <:+ t) :
s.toFinset ⊆ t.toFinset := fun _ ha =>
List.mem_toFinset.mpr (h.subset (List.mem_toFinset.mp ha))
private theorem prefixProduct_eq_orderWeight (D : Finset V → K) (x : ℕ → K)
(u : List V) (hx : ∀ s : List V, s <:+ u → x s.length = D s.toFinset) :
prefixProduct x u.length = orderWeight D u := by
induction u with
| nil => rfl
| cons a u ih =>
simp only [List.length_cons, prefixProduct, orderWeight]
rw [ih (fun s hs => hx s (hs.trans (List.suffix_cons a u)))]
rw [← List.length_cons, hx _ List.suffix_rfl, mul_comm]
private theorem sum_shuffles_eq_shuffleWeight (D : Finset V → K) (x y : ℕ → K)
(hx0 : x 0 = 0) (hy0 : y 0 = 0) (u v : List V)
(hx : ∀ s : List V, s <:+ u → x s.length = D s.toFinset)
(hy : ∀ t : List V, t <:+ v → y t.length = D t.toFinset)
(hd : Disjoint u.toFinset v.toFinset)
(hadd : ∀ A ⊆ u.toFinset, ∀ B ⊆ v.toFinset, D (A ∪ B) = D A + D B) :
(∑ l ∈ shuffles u v, orderWeight D l) = shuffleWeight x y u.length v.length := by
induction u generalizing v with
| nil =>
simp [shuffles_nil_left, shuffleWeight_zero_left x y v.length hx0,
prefixProduct_eq_orderWeight D y v hy]
| cons a u ihu =>
induction v with
| nil =>
simp only [shuffles_nil_right, Finset.sum_singleton, List.length_nil]
rw [shuffleWeight_zero_right x y _ hy0, prefixProduct_eq_orderWeight D x _ hx]
| cons b v ihv =>
have hsubu := support_subset_of_suffix (List.suffix_cons a u)
have hsubv := support_subset_of_suffix (List.suffix_cons b v)
have hab : a ≠ b := by
intro e
subst b
exact (Finset.disjoint_left.mp hd) (a := a) (by simp) (by simp)
let Z := D ((a :: u).toFinset ∪ (b :: v).toFinset)
have hZ : Z = x (a :: u).length + y (b :: v).length := by
rw [hx _ List.suffix_rfl, hy _ List.suffix_rfl]
exact hadd _ (fun _ h => h) _ (fun _ h => h)
have leftWeight (l : List V) (hl : l ∈ shuffles u (b :: v)) :
orderWeight D (a :: l) = Z⁻¹ * orderWeight D l := by
rw [orderWeight, List.toFinset_cons, toFinset_of_mem_shuffles hl,
← Finset.insert_union]
simp only [Z, List.toFinset_cons]
have rightWeight (l : List V) (hl : l ∈ shuffles (a :: u) v) :
orderWeight D (b :: l) = Z⁻¹ * orderWeight D l := by
rw [orderWeight, List.toFinset_cons, toFinset_of_mem_shuffles hl,
← Finset.union_insert]
simp only [Z, List.toFinset_cons]
have hleft := ihu (b :: v) (fun s hs => hx s (hs.trans (List.suffix_cons a u)))
hy (Finset.disjoint_of_subset_left hsubu hd)
(fun A hA B hB => hadd A (hA.trans hsubu) B hB)
have hright := ihv (fun t ht => hy t (ht.trans (List.suffix_cons b v)))
(Finset.disjoint_of_subset_right hsubv hd)
(fun A hA B hB => hadd A hA B (hB.trans hsubv))
rw [sum_shuffles_cons (orderWeight D) a b u v hab,
Finset.sum_congr rfl leftWeight, Finset.sum_congr rfl rightWeight,
← Finset.mul_sum, ← Finset.mul_sum, ← mul_add, hleft, hright]
rw [hZ]
simp only [List.length_cons, shuffleWeight, div_eq_mul_inv]
apply mul_comm
/-- For two fixed reversed orders with disjoint supports, the weighted shuffle
sum is the product of the two individual weights. The assumptions concern only
subsets of the two supports. -/
theorem sum_shuffles_orderWeight (D : Finset V → K) (u v : List V) (hz : D ∅ = 0)
(hd : Disjoint u.toFinset v.toFinset)
(hadd : ∀ A ⊆ u.toFinset, ∀ B ⊆ v.toFinset, D (A ∪ B) = D A + D B)
(hnz : ∀ A ⊆ u.toFinset, ∀ B ⊆ v.toFinset, (A ∪ B).Nonempty → D (A ∪ B) ≠ 0) :
(∑ l ∈ shuffles u v, orderWeight D l) = orderWeight D u * orderWeight D v := by
let x (i : ℕ) := D (u.drop (u.length - i)).toFinset
let y (i : ℕ) := D (v.drop (v.length - i)).toFinset
have hx0 : x 0 = 0 := by simp [x, hz]
have hy0 : y 0 = 0 := by simp [y, hz]
have hx (s : List V) (hs : s <:+ u) : x s.length = D s.toFinset := by
change D (u.drop (u.length - s.length)).toFinset = _
rw [← List.suffix_iff_eq_drop.mp hs]
have hy (t : List V) (ht : t <:+ v) : y t.length = D t.toFinset := by
change D (v.drop (v.length - t.length)).toFinset = _
rw [← List.suffix_iff_eq_drop.mp ht]
rw [sum_shuffles_eq_shuffleWeight D x y hx0 hy0 u v hx hy hd hadd]
rw [shuffleWeight_eq_prefixProducts x y u.length v.length hx0 hy0,
prefixProduct_eq_orderWeight D x u hx, prefixProduct_eq_orderWeight D y v hy]
intro i hi j hj hne
let s := u.drop (u.length - i)
let t := v.drop (v.length - j)
have hs : s.length = i := by
dsimp [s]
rw [List.length_drop]
omega
have ht : t.length = j := by
dsimp [t]
rw [List.length_drop]
omega
have hsubS := support_subset_of_suffix (List.drop_suffix (u.length - i) u)
have hsubT := support_subset_of_suffix (List.drop_suffix (v.length - j) v)
have hneUnion : (s.toFinset ∪ t.toFinset).Nonempty := by
cases hS : s with
| nil =>
cases hT : t with
| nil =>
have hi0 : i = 0 := by simpa [hS] using hs.symm
have hj0 : j = 0 := by simpa [hT] using ht.symm
exact (hne (by simp [hi0, hj0])).elim
| cons b bs => exact ⟨b, by simp⟩
| cons a as => exact ⟨a, by simp⟩
change D s.toFinset + D t.toFinset ≠ 0
rw [← hadd _ hsubS _ hsubT]
exact hnz _ hsubS _ hsubT hneUnion
end
end MarkovScattering
Source