Exact Lean source
Nonadditivity.HaarPathWeights
Download original .lean · View on GitHub · Jump to source
Direct imports
Imported by project modules
Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.
Declarations in this module
50 project constants, including generated, internal and private declarations.
50 declarations
Nonadditivity.HaarPathWeights.EntryNonadditivity.HaarPathWeights.SignedEntryNonadditivity.HaarPathWeights.count_edgeListNonadditivity.HaarPathWeights.count_edgeList._proof_1_4internal/detail/privateNonadditivity.HaarPathWeights.count_edgeList._proof_1_5internal/detail/privateNonadditivity.HaarPathWeights.edgeListNonadditivity.HaarPathWeights.edgeList.eq_1internal/detail/privateNonadditivity.HaarPathWeights.edgeList_pathEntriesNonadditivity.HaarPathWeights.entryProductNonadditivity.HaarPathWeights.entryProduct.eq_1internal/detail/privateNonadditivity.HaarPathWeights.familyListNonadditivity.HaarPathWeights.familyList.eq_1internal/detail/privateNonadditivity.HaarPathWeights.highMultiplicity_edgeListNonadditivity.HaarPathWeights.highMultiplicity_edgeList._simp_1_1internal/detail/privateNonadditivity.HaarPathWeights.integral_entryMonomial_eq_zero_of_degree_neNonadditivity.HaarPathWeights.integral_listMonomial_eq_zero_of_length_neNonadditivity.HaarPathWeights.integral_signedProduct_eq_zero_of_unbalancedNonadditivity.HaarPathWeights.listMonomialNonadditivity.HaarPathWeights.listMonomial.eq_1internal/detail/privateNonadditivity.HaarPathWeights.listMonomial_eq_entryMonomialNonadditivity.HaarPathWeights.norm_listMonomial_integral_leNonadditivity.HaarPathWeights.norm_pathProduct_integral_leNonadditivity.HaarPathWeights.norm_pathProduct_integral_le._proof_1_1internal/detail/privateNonadditivity.HaarPathWeights.norm_pathProduct_integral_le._proof_1_2internal/detail/privateNonadditivity.HaarPathWeights.norm_pathProduct_integral_le._proof_1_4internal/detail/privateNonadditivity.HaarPathWeights.norm_pathProduct_integral_le._proof_1_5internal/detail/privateNonadditivity.HaarPathWeights.norm_signedProduct_integral_leNonadditivity.HaarPathWeights.norm_signedProduct_integral_le._proof_1_1internal/detail/privateNonadditivity.HaarPathWeights.norm_signedProduct_integral_le._proof_1_2internal/detail/privateNonadditivity.HaarPathWeights.norm_signedProduct_integral_le._proof_1_3internal/detail/privateNonadditivity.HaarPathWeights.norm_signedProduct_integral_le._proof_1_5internal/detail/privateNonadditivity.HaarPathWeights.pathEntriesNonadditivity.HaarPathWeights.pathEntries.eq_1internal/detail/privateNonadditivity.HaarPathWeights.pathEntries_lengthNonadditivity.HaarPathWeights.pathProductNonadditivity.HaarPathWeights.pathProduct.eq_1internal/detail/privateNonadditivity.HaarPathWeights.pathProduct_eqNonadditivity.HaarPathWeights.selectedNonadditivity.HaarPathWeights.selected.eq_1internal/detail/privateNonadditivity.HaarPathWeights.selected_lengthsNonadditivity.HaarPathWeights.selected_lengths._proof_1_2internal/detail/privateNonadditivity.HaarPathWeights.selected_lengths._proof_1_3internal/detail/privateNonadditivity.HaarPathWeights.selected_lengths._proof_1_4internal/detail/privateNonadditivity.HaarPathWeights.selected_lengths._proof_1_5internal/detail/privateNonadditivity.HaarPathWeights.signedProductNonadditivity.HaarPathWeights.signedProduct._proof_1internal/detail/privateNonadditivity.HaarPathWeights.signedProduct.eq_1internal/detail/privateNonadditivity.HaarPathWeights.signedProduct_eqNonadditivity.HaarPathWeights.singleton_card_edgeListNonadditivity.HaarPathWeights.singleton_card_eq_sum
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPairEntryBound7import Nonadditivity.HaarPathGraph8import Nonadditivity.HaarWordPhase910/-! # Actual two-generator path weights1112A literal path contributes a product of ordinary and conjugated Haar entries.13This file connects those products to the proved Weingarten entry estimate.14-/15noncomputable section16attribute [local instance 2000] instBEqOfDecidableEq17set_option backward.isDefEq.respectTransparency false18set_option maxHeartbeats 120000019namespace Nonadditivity.HaarPathWeights20open MeasureTheory HaarModel HaarInvariantTensor HaarPathMultiplicity HaarFourthMoments21open scoped BigOperators Matrix Matrix.Norms.L2Operator2223abbrev Entry (N : ℕ) := Fin (N+1) × Fin (N+1)24abbrev SignedEntry (N : ℕ) := (Fin 2 × Bool) × Entry N2526def selected {N : ℕ} (c : Fin 2 × Bool) (L : List (SignedEntry N)) : List (Entry N) :=27(L.filter (fun e => e.1=c)).map Prod.snd2829def entryProduct {N : ℕ} (L : List (Entry N)) (U : LocalUnitary N) : ℂ :=30(L.map (fun e => (U : Mat N) e.1 e.2)).prod3132def listMonomial {N : ℕ} (L R : List (Entry N)) (U : LocalUnitary N) : ℂ :=33entryProduct L U * star (entryProduct R U)3435def signedProduct {N : ℕ} (L : List (SignedEntry N)) (U : LocalUnitary N × LocalUnitary N) : ℂ :=36(L.map (fun e => if e.1.2 then37((if e.1.1=0 then U.1 else U.2) : Mat N) e.2.1 e.2.2 else38star (((if e.1.1=0 then U.1 else U.2) : Mat N) e.2.1 e.2.2))).prod3940/-- Sorting entries by their generator and sign does not change the scalar41product associated with the original ordered path. -/42theorem signedProduct_eq {N : ℕ} (L : List (SignedEntry N))43(U : LocalUnitary N × LocalUnitary N) :44signedProduct L U =45listMonomial (selected (0,true) L) (selected (0,false) L) U.1 *46listMonomial (selected (1,true) L) (selected (1,false) L) U.2 := by47induction L with48| nil => simp [signedProduct, listMonomial, selected, entryProduct]49| cons e L ih =>50obtain ⟨⟨a,b⟩,x⟩ := e51fin_cases a <;> cases b <;>52simp [signedProduct, listMonomial, selected, entryProduct,53star_mul] at ih ⊢ <;> rw [ih] <;> ring5455/-- List and tuple presentations are definitionally the same Haar monomial56up to the standard finite-product enumeration. -/57theorem listMonomial_eq_entryMonomial {N : ℕ} (L R : List (Entry N))58(U : LocalUnitary N) :59listMonomial L R U = HaarMixedMoments.entryMonomial60(fun a => (L.get a).1) (fun a => (L.get a).2)61(fun a => (R.get a).1) (fun a => (R.get a).2) U := by62simp only [listMonomial, entryProduct, HaarMixedMoments.entryMonomial]63have hp (S : List (Entry N)) (f : Entry N → ℂ) :64(S.map f).prod = ∏ a : Fin S.length, f (S.get a) := by65rw [← List.prod_ofFn, List.ofFn_comp', List.ofFn_get]66rw [hp L, hp R]67simp only [star_prod]6869/-- A Haar monomial with unequal total positive and negative degrees vanishes. -/70theorem integral_entryMonomial_eq_zero_of_degree_ne {N p q : ℕ}71(i j : Tuple N p) (k l : Tuple N q) (hpq : p ≠ q) :72(∫ U : LocalUnitary N, HaarMixedMoments.entryMonomial i j k l U ∂haar N)=0 := by73have hsum (x : Fin p → Fin (N+1)) :74(∑ r, HaarMixedMoments.multiplicity x r)=p := by75have h := Finset.card_eq_sum_card_fiberwise (s := Finset.univ)76(t := Finset.univ) (f := x) (fun _ _ => Finset.mem_univ _)77simpa [HaarMixedMoments.multiplicity] using h.symm78have hsumq (x : Fin q → Fin (N+1)) :79(∑ r, HaarMixedMoments.multiplicity x r)=q := by80have h := Finset.card_eq_sum_card_fiberwise (s := Finset.univ)81(t := Finset.univ) (f := x) (fun _ _ => Finset.mem_univ _)82simpa [HaarMixedMoments.multiplicity] using h.symm83have hex : ∃ r, HaarMixedMoments.multiplicity i r ≠ HaarMixedMoments.multiplicity k r := by84by_contra! h85exact hpq ((hsum i).symm.trans ((Finset.sum_congr rfl (fun r _ => h r)).trans (hsumq k)))86obtain ⟨r,hr⟩ := hex87exact HaarMixedMoments.integral_entryMonomial_eq_zero_of_row_mismatch i j k l r hr8889/-- Exact zero for an unbalanced literal entry list. -/90theorem integral_listMonomial_eq_zero_of_length_ne {N : ℕ} (L R : List (Entry N))91(h : L.length ≠ R.length) :92(∫ U : LocalUnitary N, listMonomial L R U ∂haar N)=0 := by93simp_rw [listMonomial_eq_entryMonomial]94exact integral_entryMonomial_eq_zero_of_degree_ne _ _ _ _ h9596/-- The established entry bound in a literal-list presentation. -/97theorem norm_listMonomial_integral_le {N P : ℕ} (L R : List (Entry N))98(hbal : L.length=R.length) (hP : L.length ≤ P)99(hN : 16*(P:ℝ)^4 ≤ N+1) :100‖∫ U : LocalUnitary N, listMonomial L R U ∂haar N‖ ≤101(2/(N+1:ℝ)^L.length) * (P:ℝ)^(highMultiplicityOccurrences (L++R)/2) *102(2*(P:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges (L++R)).card := by103induction L using List.ofFnRec with104| h p f =>105induction R using List.ofFnRec with106| h q g =>107simp only [List.length_ofFn] at hbal hP ⊢108subst q109have h := norm_entry_moment_le_uniform hP hN110(fun a => (f a).1) (fun a => (f a).2)111(fun a => (g a).1) (fun a => (g a).2)112simpa only [listMonomial, entryProduct, List.map_ofFn, List.prod_ofFn,113star_prod, HaarMixedMoments.entryMonomial, entryList, Function.comp_apply,114Prod.mk.eta] using h115116/-- The actual path integral vanishes if either generator has unequal numbers117of ordinary and conjugated entries. -/118theorem integral_signedProduct_eq_zero_of_unbalanced {N : ℕ}119(L : List (SignedEntry N)) (a : Fin 2)120(h : (selected (a,true) L).length ≠ (selected (a,false) L).length) :121(∫ U : LocalUnitary N × LocalUnitary N, signedProduct L U ∂(haar N).prod (haar N))=0 := by122simp_rw [signedProduct_eq]123rw [integral_prod_mul]124fin_cases a125· change (selected (0,true) L).length ≠ (selected (0,false) L).length at h126rw [integral_listMonomial_eq_zero_of_length_ne _ _ h, zero_mul]127· change (selected (1,true) L).length ≠ (selected (1,false) L).length at h128rw [integral_listMonomial_eq_zero_of_length_ne _ _ h, mul_zero]129130def familyList {N : ℕ} (a : Fin 2) (L : List (SignedEntry N)) : List (Entry N) :=131selected (a,true) L ++ selected (a,false) L132133def edgeList {N : ℕ} (L : List (SignedEntry N)) : List (HaarPathGraph.Edge (Fin (N+1)) 2) :=134L.map (fun e => (e.2.1,e.1.1,e.2.2))135136/-- The unsigned colored edge multiplicity is exactly its positive plus137negative entry multiplicity in the corresponding Haar family. -/138theorem count_edgeList {N : ℕ} (L : List (SignedEntry N))139(x y : Fin (N+1)) (a : Fin 2) :140(edgeList L).count (x,a,y) = (familyList a L).count (x,y) := by141simp only [familyList, List.count_append]142induction L with143| nil => simp [edgeList, selected]144| cons e L ih =>145obtain ⟨⟨b,c⟩,u,v⟩ := e146cases c <;> by_cases hba : b=a <;> by_cases hx : u=x <;> by_cases hy : v=y <;>147simp_all [edgeList, selected] <;> omega148149/-- Singleton counting can equivalently be performed over the full finite150edge alphabet; absent edges make zero contribution. -/151theorem singleton_card_eq_sum {E : Type*} [Fintype E] [DecidableEq E] (L : List E) :152(singletonEdges L).card = ∑ e : E, if L.count e=1 then 1 else 0 := by153rw [singletonEdges, Finset.card_filter]154apply Finset.sum_subset (Finset.subset_univ _)155intro e _ he156have hz : L.count e=0 := List.count_eq_zero.mpr157(fun h => he (List.mem_toFinset.mpr h))158simp [hz]159160/-- Different Haar families have disjoint colored edges. -/161theorem singleton_card_edgeList {N : ℕ} (L : List (SignedEntry N)) :162(singletonEdges (edgeList L)).card =163(singletonEdges (familyList 0 L)).card + (singletonEdges (familyList 1 L)).card := by164simp only [singleton_card_eq_sum, Fintype.sum_prod_type,165Fin.sum_univ_two, Finset.sum_add_distrib]166simp_rw [count_edgeList (N := N) L]167168/-- Fourth-and-higher multiplicities split exactly across independent colors. -/169theorem highMultiplicity_edgeList {N : ℕ} (L : List (SignedEntry N)) :170highMultiplicityOccurrences (edgeList L) =171highMultiplicityOccurrences (familyList 0 L) +172highMultiplicityOccurrences (familyList 1 L) := by173simp only [← HaarMatchingSharp.sum_high_multiplicity, Fintype.sum_prod_type,174Fin.sum_univ_two, Finset.sum_add_distrib]175simp_rw [count_edgeList (N := N) L]176177/-- Splitting a literal word into the four signed colors preserves its length. -/178theorem selected_lengths {N : ℕ} (L : List (SignedEntry N)) :179(selected (0,true) L).length + (selected (0,false) L).length +180(selected (1,true) L).length + (selected (1,false) L).length = L.length := by181induction L with182| nil => simp [selected]183| cons e L ih =>184obtain ⟨⟨a,b⟩,x⟩ := e185fin_cases a <;> cases b <;>186simp [selected] at ih ⊢ <;> omega187188/-- A singleton-sensitive estimate for the actual product of entries in an189arbitrarily ordered balanced word; no matching enumeration is assumed. -/190theorem norm_signedProduct_integral_le {N P : ℕ} (L : List (SignedEntry N))191(hP : 1 ≤ P) (hbal : ∀ a : Fin 2,192(selected (a,true) L).length=(selected (a,false) L).length)193(hlen : L.length ≤ 2*P) (hN : 16*(P:ℝ)^4 ≤ N+1) :194‖∫ U : LocalUnitary N × LocalUnitary N, signedProduct L U ∂(haar N).prod (haar N)‖ ≤195(4/(N+1:ℝ)^(L.length/2)) * (P:ℝ)^(highMultiplicityOccurrences (edgeList L)/2) *196(2*(P:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges (edgeList L)).card := by197have hs := selected_lengths L198have hb0 := hbal 0199have hb1 := hbal 1200have h0P : (selected (0,true) L).length ≤ P := by omega201have h1P : (selected (1,true) L).length ≤ P := by omega202have hdeg : (selected (0,true) L).length + (selected (1,true) L).length=L.length/2 := by omega203have h0 := norm_listMonomial_integral_le _ _ hb0 h0P hN204have h1 := norm_listMonomial_integral_le _ _ hb1 h1P hN205simp_rw [signedProduct_eq]206rw [integral_prod_mul, norm_mul]207apply (mul_le_mul h0 h1 (norm_nonneg _) (by positivity)).trans208have heq :209(2/(N+1:ℝ)^(selected (0,true) L).length *210(P:ℝ)^(highMultiplicityOccurrences (familyList 0 L)/2) *211(2*(P:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges (familyList 0 L)).card) *212(2/(N+1:ℝ)^(selected (1,true) L).length *213(P:ℝ)^(highMultiplicityOccurrences (familyList 1 L)/2) *214(2*(P:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges (familyList 1 L)).card) =215(4/(N+1:ℝ)^(L.length/2)) *216(P:ℝ)^(highMultiplicityOccurrences (familyList 0 L)/2+217highMultiplicityOccurrences (familyList 1 L)/2) *218(2*(P:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges (edgeList L)).card := by219rw [singleton_card_edgeList, ←hdeg]220simp only [pow_add, div_eq_mul_inv, mul_inv_rev]221ring222simp only [familyList] at heq223rw [heq]224apply mul_le_mul_of_nonneg_right _ (by positivity)225apply mul_le_mul_of_nonneg_left _ (by positivity)226apply pow_le_pow_right₀ (by exact_mod_cast hP)227rw [highMultiplicity_edgeList]228simp only [familyList]229omega230231/-- The oriented entries of a literal path, with negative letters represented232by conjugated entries in the reverse direction. -/233def pathEntries {N m : ℕ} (P : HaarPathGraph.Path (Fin (N+1)) 2 m) : List (SignedEntry N) :=234List.ofFn fun i => (P.colors i, if (P.colors i).2 then235(P.vertex i.castSucc,P.vertex i.succ) else (P.vertex i.succ,P.vertex i.castSucc))236237def pathProduct {N m : ℕ} (P : HaarPathGraph.Path (Fin (N+1)) 2 m)238(U : LocalUnitary N × LocalUnitary N) : ℂ :=239∏ i : Fin m, (if (P.colors i).2 then240((if (P.colors i).1=0 then U.1 else U.2) : Mat N) else241((if (P.colors i).1=0 then U.1 else U.2) : Mat N)ᴴ)242(P.vertex i.castSucc) (P.vertex i.succ)243244@[simp] theorem pathEntries_length {N m : ℕ} (P : HaarPathGraph.Path (Fin (N+1)) 2 m) :245(pathEntries P).length=m := by simp [pathEntries]246247/-- The edge list used by the graph defect is the literal entry list used by248Weingarten integration; loops and parallel colors retain their multiplicities. -/249@[simp] theorem edgeList_pathEntries {N m : ℕ} (P : HaarPathGraph.Path (Fin (N+1)) 2 m) :250edgeList (pathEntries P)=P.edgeList := by251simp only [edgeList, pathEntries, List.map_ofFn, HaarPathGraph.Path.edgeList]252congr 1253funext i254cases hb : (P.colors i).2 <;> simp [HaarPathGraph.edge, hb]255256/-- The matrix-entry product of the path is exactly the signed scalar product. -/257theorem pathProduct_eq {N m : ℕ} (P : HaarPathGraph.Path (Fin (N+1)) 2 m)258(U : LocalUnitary N × LocalUnitary N) :259pathProduct P U=signedProduct (pathEntries P) U := by260simp only [pathProduct, signedProduct, pathEntries, List.map_ofFn, List.prod_ofFn]261apply Finset.prod_congr rfl262intro i _263cases hb : (P.colors i).2 <;> simp [hb, Matrix.conjTranspose_apply]264265/-- The probabilistic BC path weight estimate for the actual pair of independent266Haar matrices. The graph defect and singleton count are computed from `P`.267The prefactor `4` improves the published `25/4`; no probabilistic input remains. -/268theorem norm_pathProduct_integral_le {N m : ℕ}269(P : HaarPathGraph.Path (Fin (N+1)) 2 m) (hm : 0 < m)270(hN : 16*((m/2:ℕ):ℝ)^4 ≤ N+1) :271‖∫ U : LocalUnitary N × LocalUnitary N, pathProduct P U ∂(haar N).prod (haar N)‖ ≤272(4/(N+1:ℝ)^(m/2)) * (m:ℝ)^P.defectTwice *273((m:ℝ)/Real.sqrt (Real.sqrt (N+1)))^(singletonEdges P.edgeList).card := by274by_cases hbal : ∀ a : Fin 2,275(selected (a,true) (pathEntries P)).length=(selected (a,false) (pathEntries P)).length276· have hs := selected_lengths (pathEntries P)277have hb0 := hbal 0278have hb1 := hbal 1279rw [pathEntries_length] at hs280have hhalf : 1 ≤ m/2 := by omega281have hlen : (pathEntries P).length ≤ 2*(m/2) := by rw [pathEntries_length]; omega282have h := norm_signedProduct_integral_le (pathEntries P) hhalf hbal hlen hN283simp only [pathEntries_length, edgeList_pathEntries] at h284simp_rw [pathProduct_eq]285apply h.trans286apply mul_le_mul287· apply mul_le_mul_of_nonneg_left _ (by positivity)288have hhigh := P.highMultiplicityOccurrences_le_twice_defect289calc290((m/2:ℕ):ℝ)^(highMultiplicityOccurrences P.edgeList/2) ≤291(m:ℝ)^(highMultiplicityOccurrences P.edgeList/2) := by292gcongr293exact_mod_cast (Nat.div_le_self m 2)294_ ≤ (m:ℝ)^P.defectTwice := by295apply pow_le_pow_right₀ (by exact_mod_cast hm)296omega297· apply pow_le_pow_left₀ (by positivity)298apply div_le_div_of_nonneg_right _ (by positivity)299exact_mod_cast (by omega : 2*(m/2) ≤ m)300· positivity301· positivity302· push_neg at hbal303obtain ⟨a,ha⟩ := hbal304simp_rw [pathProduct_eq]305rw [integral_signedProduct_eq_zero_of_unbalanced _ a ha, norm_zero]306positivity307308end Nonadditivity.HaarPathWeights