Exact Lean source
Nonadditivity.HaarColumnMoments
Download original .lean · View on GitHub · Jump to source
Direct imports
Nonadditivity.HaarFourthMomentsMathlib.Algebra.Polynomial.RootsdependencyMathlib.Algebra.Polynomial.Eval.Degreedependency
Imported by project modules
2 direct reverse imports
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
59 project constants, including generated, internal and private declarations.
59 declarations
Nonadditivity.HaarColumnMoments.averagePolynomialNonadditivity.HaarColumnMoments.averagePolynomial.eq_1internal/detail/privateNonadditivity.HaarColumnMoments.averagePolynomial_coeffNonadditivity.HaarColumnMoments.averagePolynomial_evalNonadditivity.HaarColumnMoments.averagePolynomial_eval._simp_1_2internal/detail/privateNonadditivity.HaarColumnMoments.average_entryPolynomialNonadditivity.HaarColumnMoments.coeff_linear_pow_oneNonadditivity.HaarColumnMoments.coeff_linear_pow_twoNonadditivity.HaarColumnMoments.coeff_linear_pow_two._proof_1_1internal/detail/privateNonadditivity.HaarColumnMoments.coeff_linear_pow_two._proof_1_2internal/detail/privateNonadditivity.HaarColumnMoments.coeff_linear_pow_two._simp_1_3internal/detail/privateNonadditivity.HaarColumnMoments.coeff_linear_pow_zeroNonadditivity.HaarColumnMoments.coeff_mul_twoNonadditivity.HaarColumnMoments.coeff_one_add_X_sq_pow_oneNonadditivity.HaarColumnMoments.coeff_one_add_X_sq_pow_twoNonadditivity.HaarColumnMoments.coeff_one_add_X_sq_pow_zeroNonadditivity.HaarColumnMoments.continuous_coeff_powNonadditivity.HaarColumnMoments.continuous_entryPolynomial_coeffNonadditivity.HaarColumnMoments.entryPolynomialNonadditivity.HaarColumnMoments.entryPolynomial.eq_1internal/detail/privateNonadditivity.HaarColumnMoments.entryPolynomial_coeff_twoNonadditivity.HaarColumnMoments.entryPolynomial_coeff_two._proof_1_2internal/detail/privateNonadditivity.HaarColumnMoments.entryPolynomial_degreeNonadditivity.HaarColumnMoments.entryPolynomial_degree._proof_1_1internal/detail/privateNonadditivity.HaarColumnMoments.entryPolynomial_eval_realNonadditivity.HaarColumnMoments.integral_entryPolynomial_coeff_twoNonadditivity.HaarColumnMoments.integral_entry_norm_evenNonadditivity.HaarColumnMoments.integral_entry_norm_even_leNonadditivity.HaarColumnMoments.integral_phase_square_left_zeroNonadditivity.HaarColumnMoments.integral_phase_square_right_zeroNonadditivity.HaarColumnMoments.integral_sample_entry_norm_evenNonadditivity.HaarColumnMoments.mixedNonadditivity.HaarColumnMoments.mixed.eq_1internal/detail/privateNonadditivity.HaarColumnMoments.mixed_of_neNonadditivity.HaarColumnMoments.mixed_selfNonadditivity.HaarColumnMoments.momentNonadditivity.HaarColumnMoments.moment.eq_1internal/detail/privateNonadditivity.HaarColumnMoments.moment_addNonadditivity.HaarColumnMoments.moment_eq_succ_mul_mixedNonadditivity.HaarColumnMoments.moment_eq_succ_mul_mixed._proof_1_1internal/detail/privateNonadditivity.HaarColumnMoments.moment_oneNonadditivity.HaarColumnMoments.moment_recurrenceNonadditivity.HaarColumnMoments.moment_recurrence._simp_1_1internal/detail/privateNonadditivity.HaarColumnMoments.moment_rotationNonadditivity.HaarColumnMoments.moment_zeroNonadditivity.HaarColumnMoments.norm_even_complexNonadditivity.HaarColumnMoments.rotationNonadditivity.HaarColumnMoments.rotation._proof_1internal/detail/privateNonadditivity.HaarColumnMoments.rotation.congr_simpNonadditivity.HaarColumnMoments.rotation_mul_entryNonadditivity.HaarColumnMoments.rowRotationMatrixNonadditivity.HaarColumnMoments.rowRotationMatrix.eq_1internal/detail/privateNonadditivity.HaarColumnMoments.rowRotationMatrix_mulNonadditivity.HaarColumnMoments.rowRotationMatrix_sqNonadditivity.HaarColumnMoments.rowRotationMatrix_sq._simp_1_2internal/detail/privateNonadditivity.HaarColumnMoments.rowRotationMatrix_starNonadditivity.HaarColumnMoments.rowRotationMatrix_star._simp_1_2internal/detail/privateNonadditivity.HaarColumnMoments.sum_mixedNonadditivity.HaarColumnMoments.sum_mixed._simp_1_1internal/detail/private
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarFourthMoments7import Mathlib.Algebra.Polynomial.Roots8import Mathlib.Algebra.Polynomial.Eval.Degree910/-! # Arbitrary moments of a Haar column1112The argument uses exact two-row rotations and coefficient comparison in a13finite polynomial. It never assumes a Gaussian description of Haar measure.14-/15noncomputable section16set_option backward.isDefEq.respectTransparency false17set_option maxHeartbeats 10000001819namespace Nonadditivity.HaarColumnMoments20open MeasureTheory HaarModel HaarMoments HaarFourthMoments Polynomial21open scoped Matrix Matrix.Norms.L2Operator22variable {N : ℕ}2324def rowRotationMatrix (i k : Fin (N+1)) (a b : ℝ) : Mat N := fun r s =>25if r = i then (a:ℂ) * (if s = i then 1 else 0) +26(b:ℂ) * (if s = k then 1 else 0)27else if r = k then (b:ℂ) * (if s = i then 1 else 0) -28(a:ℂ) * (if s = k then 1 else 0)29else if r = s then 1 else 03031lemma rowRotationMatrix_mul (i k : Fin (N+1)) (a b : ℝ) (M : Mat N) (r s) :32(rowRotationMatrix i k a b * M) r s =33if r = i then (a:ℂ) * M i s + (b:ℂ) * M k s34else if r = k then (b:ℂ) * M i s - (a:ℂ) * M k s35else M r s := by36by_cases hri : r = i37· subst r38simp [Matrix.mul_apply, rowRotationMatrix, add_mul, mul_ite,39Finset.sum_add_distrib]40· by_cases hrk : r = k41· subst r42simp [Matrix.mul_apply, rowRotationMatrix, hri, sub_mul, mul_ite,43Finset.sum_sub_distrib]44· simp [Matrix.mul_apply, rowRotationMatrix, hri, hrk]4546lemma rowRotationMatrix_star (i k : Fin (N+1)) (hik : i ≠ k) (a b : ℝ) :47star (rowRotationMatrix i k a b) = rowRotationMatrix i k a b := by48ext r s49simp only [Matrix.star_eq_conjTranspose, Matrix.conjTranspose_apply]50by_cases hri : r = i <;> by_cases hrk : r = k <;>51by_cases hsi : s = i <;> by_cases hsk : s = k <;>52simp_all [rowRotationMatrix, eq_comm]5354lemma rowRotationMatrix_sq (i k : Fin (N+1)) (hik : i ≠ k)55(a b : ℝ) (hab : a^2 + b^2 = 1) :56rowRotationMatrix i k a b * rowRotationMatrix i k a b = 1 := by57have hab' : (a:ℂ)^2 + (b:ℂ)^2 = 1 := by exact_mod_cast hab58clear hab'59ext r s60rw [rowRotationMatrix_mul]61by_cases hri : r = i <;> by_cases hrk : r = k <;>62by_cases hsi : s = i <;> by_cases hsk : s = k <;>63simp_all [rowRotationMatrix, Matrix.one_apply, eq_comm] <;>64first | ring1 |65(have hc : (a:ℂ)^2 + (b:ℂ)^2 = 1 := by exact_mod_cast hab66linear_combination hc)6768def rotation (i k : Fin (N+1)) (hik : i ≠ k)69(a b : ℝ) (hab : a^2 + b^2 = 1) : LocalUnitary N :=70⟨rowRotationMatrix i k a b, by71rw [Unitary.mem_iff, rowRotationMatrix_star i k hik]72exact ⟨rowRotationMatrix_sq i k hik a b hab,73rowRotationMatrix_sq i k hik a b hab⟩⟩7475@[simp] lemma rotation_mul_entry (i k j : Fin (N+1)) (hik : i ≠ k)76(a b : ℝ) (hab : a^2 + b^2 = 1) (U : LocalUnitary N) :77((rotation i k hik a b hab * U : LocalUnitary N) : Mat N) i j =78(a:ℂ) * (U : Mat N) i j + (b:ℂ) * (U : Mat N) k j := by79change (rowRotationMatrix i k a b * (U : Mat N)) i j = _80simp [rowRotationMatrix_mul]8182def moment (i j : Fin (N+1)) (p : ℕ) : ℝ :=83∫ U : LocalUnitary N, ‖(U : Mat N) i j‖^(2*p) ∂haar N8485lemma moment_zero (i j : Fin (N+1)) : moment i j 0 = 1 := by86simp [moment]8788lemma moment_one (i j : Fin (N+1)) : moment i j 1 = 1 / (N+1:ℝ) := by89simpa [moment] using integral_entry_norm_sq i j9091lemma moment_rotation (i k j : Fin (N+1)) (hik : i ≠ k)92(a b : ℝ) (hab : a^2 + b^2 = 1) (p : ℕ) :93(∫ U : LocalUnitary N,94‖(a:ℂ) * (U : Mat N) i j + (b:ℂ) * (U : Mat N) k j‖^(2*p) ∂haar N) =95moment i j p := by96simpa [moment] using integral_mul_left_eq_self (μ := haar N)97(fun U : LocalUnitary N => ‖(U : Mat N) i j‖^(2*p)) (rotation i k hik a b hab)9899lemma moment_add (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) (t : ℝ) :100(∫ U : LocalUnitary N,101‖(U : Mat N) i j + (t:ℂ) * (U : Mat N) k j‖^(2*p) ∂haar N) =102(1+t^2)^p * moment i j p := by103let a : ℝ := (Real.sqrt (1+t^2))⁻¹104have ht : 0 < 1+t^2 := by positivity105have ha : a^2 * (1+t^2) = 1 := by106dsimp [a]107rw [inv_pow, Real.sq_sqrt ht.le, inv_mul_cancel₀ ht.ne']108have hab : a^2 + (a*t)^2 = 1 := by nlinarith109have hr := moment_rotation i k j hik a (a*t) hab p110have he (x y : ℂ) : (a:ℂ)*x + ((a*t:ℝ):ℂ)*y = (a:ℂ)*(x+(t:ℂ)*y) := by111push_cast112ring113simp_rw [he, norm_mul, mul_pow, integral_const_mul] at hr114have hp : ‖(a:ℂ)‖^(2*p) * (1+t^2)^p = 1 := by115rw [Complex.norm_real, Real.norm_eq_abs, pow_mul, sq_abs, ← mul_pow, ha, one_pow]116let Ival : ℝ := ∫ U : LocalUnitary N,117‖(U : Mat N) i j + (t:ℂ) * (U : Mat N) k j‖^(2*p) ∂haar N118change Ival = _119change ‖(a:ℂ)‖^(2*p) * Ival = _ at hr120calc121Ival = (‖(a:ℂ)‖^(2*p) * (1+t^2)^p) * Ival := by rw [hp, one_mul]122_ = (1+t^2)^p * (‖(a:ℂ)‖^(2*p) * Ival) := by ring123_ = _ := by rw [hr]124125/-- Integrate a uniformly bounded-degree polynomial coefficient by coefficient. -/126def averagePolynomial (P : LocalUnitary N → ℂ[X]) (d : ℕ) : ℂ[X] :=127∑ k ∈ Finset.range d, monomial k (∫ U, (P U).coeff k ∂haar N)128129lemma averagePolynomial_coeff (P : LocalUnitary N → ℂ[X]) (d k : ℕ)130(hk : k < d) : (averagePolynomial P d).coeff k = ∫ U, (P U).coeff k ∂haar N := by131simp [averagePolynomial, coeff_monomial, hk]132133lemma averagePolynomial_eval (P : LocalUnitary N → ℂ[X]) (d : ℕ)134(hdeg : ∀ U, (P U).natDegree < d)135(hint : ∀ k, Integrable (fun U => (P U).coeff k) (haar N)) (z : ℂ) :136(averagePolynomial P d).eval z = ∫ U, (P U).eval z ∂haar N := by137simp only [averagePolynomial, eval_finset_sum, eval_monomial]138simp_rw [← integral_mul_const]139rw [← integral_finset_sum _ (fun k _ => (hint k).mul_const _)]140apply integral_congr_ae141filter_upwards [] with U142exact (eval_eq_sum_range' (hdeg U) z).symm143144lemma coeff_mul_two (P Q : ℂ[X]) :145(P*Q).coeff 2 = P.coeff 0 * Q.coeff 2 + P.coeff 1 * Q.coeff 1 +146P.coeff 2 * Q.coeff 0 := by147simp [coeff_mul, Finset.Nat.antidiagonal_succ, Finset.antidiagonal_zero]148ring149150lemma coeff_linear_pow_zero (x y : ℂ) (p : ℕ) :151((C x + X * C y)^p).coeff 0 = x^p := by rw [coeff_zero_eq_eval_zero]; simp152153lemma coeff_linear_pow_one (x y : ℂ) (p : ℕ) :154((C x + X * C y)^(p+1)).coeff 1 = (p+1:ℂ)*x^p*y := by155induction p with156| zero => simp157| succ p ih =>158rw [pow_succ, mul_coeff_one, ih]159simp [coeff_zero_eq_eval_zero]160ring161162lemma coeff_linear_pow_two (x y : ℂ) (p : ℕ) :163((C x + X * C y)^(p+2)).coeff 2 =164((p+2:ℂ)*(p+1:ℂ)/2)*x^p*y^2 := by165induction p with166| zero =>167rw [pow_two, coeff_mul_two]168simp169ring170| succ p ih =>171rw [show p+1+2 = (p+2)+1 by omega, pow_succ, coeff_mul_two, ih]172rw [show p+2 = (p+1)+1 by omega, coeff_linear_pow_one]173simp only [coeff_add, coeff_C, coeff_X_mul, if_true, if_false, zero_add,174add_zero, one_ne_zero, Nat.cast_add, Nat.cast_one]175simp176ring177178179lemma continuous_coeff_pow {P : LocalUnitary N → ℂ[X]}180(hP : ∀ k, Continuous (fun U => (P U).coeff k)) (p k : ℕ) :181Continuous (fun U => ((P U)^p).coeff k) := by182induction p generalizing k with183| zero => simpa using (continuous_const : Continuous (fun _ : LocalUnitary N => (1:ℂ[X]).coeff k))184| succ p ih =>185simp only [pow_succ, coeff_mul]186exact continuous_finset_sum _ (fun x _ => (ih x.1).mul (hP x.2))187188def entryPolynomial (i k j : Fin (N+1)) (p : ℕ) (U : LocalUnitary N) : ℂ[X] :=189(C ((U:Mat N) i j) + X*C ((U:Mat N) k j))^p *190(C (star ((U:Mat N) i j)) + X*C (star ((U:Mat N) k j)))^p191192lemma continuous_entryPolynomial_coeff (i k j : Fin (N+1)) (p r : ℕ) :193Continuous (fun U : LocalUnitary N => (entryPolynomial i k j p U).coeff r) := by194have hf (a b : LocalUnitary N → ℂ) (ha : Continuous a) (hb : Continuous b) (q : ℕ) :195Continuous (fun U => ((C (a U) + X*C (b U))^p).coeff q) := by196apply continuous_coeff_pow197intro l198cases l with199| zero => simpa [coeff_zero_eq_eval_zero] using ha200| succ l =>201cases l with202| zero => simpa using hb203| succ l => simpa using (continuous_const : Continuous (fun _ : LocalUnitary N => (0:ℂ)))204simp only [entryPolynomial, coeff_mul]205exact continuous_finset_sum _ (fun x _ =>206(hf _ _ (continuous_entry i j) (continuous_entry k j) x.1).mul207(hf _ _ (continuous_entry i j).star (continuous_entry k j).star x.2))208209lemma entryPolynomial_degree (i k j : Fin (N+1)) (p : ℕ) (U : LocalUnitary N) :210(entryPolynomial i k j p U).natDegree < 2*p+1 := by211have hlin (x y : ℂ) : (C x + X*C y).natDegree ≤ 1 := by212compute_degree213have hp (x y : ℂ) : ((C x + X*C y)^p).natDegree ≤ p := by214exact natDegree_pow_le.trans (by simpa using Nat.mul_le_mul_left p (hlin x y))215exact (natDegree_mul_le.trans (Nat.add_le_add (hp _ _) (hp _ _))).trans_lt (by omega)216217lemma norm_even_complex (z : ℂ) (p : ℕ) :218((‖z‖^(2*p):ℝ):ℂ) = z^p * (star z)^p := by219rw [pow_mul, ← Complex.normSq_eq_norm_sq, Complex.ofReal_pow,220Complex.normSq_eq_conj_mul_self, mul_pow, mul_comm]221rfl222223lemma entryPolynomial_eval_real (i k j : Fin (N+1)) (p : ℕ)224(U : LocalUnitary N) (t : ℝ) :225(entryPolynomial i k j p U).eval (t:ℂ) =226((‖(U:Mat N) i j + (t:ℂ)*(U:Mat N) k j‖^(2*p):ℝ):ℂ) := by227rw [norm_even_complex]228simp only [entryPolynomial, eval_mul, eval_pow, eval_add, eval_C, eval_X,229star_add, star_mul, Complex.star_def, Complex.conj_ofReal]230congr 1; ring231232lemma average_entryPolynomial (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :233averagePolynomial (entryPolynomial i k j p) (2*p+1) =234C (moment i j p : ℂ) * (1+X^2)^p := by235apply Polynomial.eq_of_infinite_eval_eq236have hinf : Set.Infinite (Set.range (Complex.ofReal : ℝ → ℂ)) :=237Set.infinite_range_of_injective Complex.ofReal_injective238apply hinf.mono239rintro _ ⟨t, rfl⟩240change _ = _241rw [averagePolynomial_eval _ _ (entryPolynomial_degree i k j p)242(fun r => (continuous_entryPolynomial_coeff i k j p r).integrable_of_hasCompactSupport243(HasCompactSupport.of_compactSpace _))]244simp_rw [entryPolynomial_eval_real]245rw [integral_complex_ofReal, moment_add i k j hik]246simp247ring248249lemma integral_phase_square_left_zero (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :250(∫ U : LocalUnitary N, ((U:Mat N) i j)^p * ((U:Mat N) k j)^2 *251(star ((U:Mat N) i j))^(p+2) ∂haar N) = 0 := by252apply integral_eq_zero_of_mul_left_eq_neg (g := rowPhase k Complex.I (by simp))253intro U254simp [hik, mul_pow]255256lemma integral_phase_square_right_zero (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :257(∫ U : LocalUnitary N, ((U:Mat N) i j)^(p+2) *258(star ((U:Mat N) i j))^p * (star ((U:Mat N) k j))^2 ∂haar N) = 0 := by259apply integral_eq_zero_of_mul_left_eq_neg (g := rowPhase k Complex.I (by simp))260intro U261simp [hik, mul_pow]262263lemma coeff_one_add_X_sq_pow_zero (p : ℕ) :264((1+X^2:ℂ[X])^p).coeff 0 = 1 := by simp [coeff_zero_eq_eval_zero]265266lemma coeff_one_add_X_sq_pow_one (p : ℕ) :267((1+X^2:ℂ[X])^p).coeff 1 = 0 := by268induction p with269| zero => simp [coeff_one]270| succ p ih =>271rw [pow_succ, mul_coeff_one, ih]272simp [coeff_one, coeff_zero_eq_eval_zero]273274lemma coeff_one_add_X_sq_pow_two (p : ℕ) :275((1+X^2:ℂ[X])^p).coeff 2 = (p:ℂ) := by276induction p with277| zero => simp [coeff_one]278| succ p ih =>279rw [pow_succ, coeff_mul_two, ih, coeff_one_add_X_sq_pow_zero,280coeff_one_add_X_sq_pow_one]281simp [coeff_one]282ring283284def mixed (i k j : Fin (N+1)) (p : ℕ) : ℝ :=285∫ U : LocalUnitary N, ‖(U:Mat N) i j‖^(2*p) * ‖(U:Mat N) k j‖^2 ∂haar N286287lemma entryPolynomial_coeff_two (i k j : Fin (N+1)) (p : ℕ) (U : LocalUnitary N) :288(entryPolynomial i k j (p+2) U).coeff 2 =289((p+2:ℂ)*(p+1:ℂ)/2) *290(((U:Mat N) i j)^p * ((U:Mat N) k j)^2 * (star ((U:Mat N) i j))^(p+2)) +291((p+2:ℂ)*(p+1:ℂ)/2) *292(((U:Mat N) i j)^(p+2) * (star ((U:Mat N) i j))^p * (star ((U:Mat N) k j))^2) +293(p+2:ℂ)^2 *294((‖(U:Mat N) i j‖^(2*(p+1)) * ‖(U:Mat N) k j‖^2 : ℝ):ℂ) := by295rw [entryPolynomial, coeff_mul_two, coeff_linear_pow_zero,296coeff_linear_pow_zero, coeff_linear_pow_two, coeff_linear_pow_two]297rw [show p+2 = (p+1)+1 by omega, coeff_linear_pow_one, coeff_linear_pow_one]298rw [Complex.ofReal_mul, norm_even_complex]299have hy := norm_even_complex ((U:Mat N) k j) 1300norm_num only [Nat.mul_one, pow_one] at hy301rw [hy]302push_cast303ring304305lemma integral_entryPolynomial_coeff_two (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :306(∫ U : LocalUnitary N, (entryPolynomial i k j (p+2) U).coeff 2 ∂haar N) =307(p+2:ℂ)^2 * (mixed i k j (p+1) : ℂ) := by308let c : ℂ := (p+2:ℂ)*(p+1:ℂ)/2309let f : LocalUnitary N → ℂ := fun U =>310((U:Mat N) i j)^p * ((U:Mat N) k j)^2 * (star ((U:Mat N) i j))^(p+2)311let g : LocalUnitary N → ℂ := fun U =>312((U:Mat N) i j)^(p+2) * (star ((U:Mat N) i j))^p * (star ((U:Mat N) k j))^2313let h : LocalUnitary N → ℝ := fun U =>314‖(U:Mat N) i j‖^(2*(p+1)) * ‖(U:Mat N) k j‖^2315have hf : Continuous f := ((continuous_entry i j).pow p |>.mul316((continuous_entry k j).pow 2)).mul ((continuous_entry i j).star.pow (p+2))317have hg : Continuous g := ((continuous_entry i j).pow (p+2) |>.mul318((continuous_entry i j).star.pow p)).mul ((continuous_entry k j).star.pow 2)319have hh : Continuous (fun U => (h U : ℂ)) := Complex.continuous_ofReal.comp320(((continuous_entry i j).norm.pow (2*(p+1))).mul ((continuous_entry k j).norm.pow 2))321have hif : Integrable (fun U => c * f U) (haar N) := (hf.const_mul c).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)322have hig : Integrable (fun U => c * g U) (haar N) := (hg.const_mul c).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)323have hih : Integrable (fun U => (p+2:ℂ)^2 * (h U : ℂ)) (haar N) := (hh.const_mul ((p+2:ℂ)^2)).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)324simp_rw [entryPolynomial_coeff_two]325have hi1 := integral_add (hif.add hig) hih326have hi2 := integral_add hif hig327simp only [Pi.add_apply] at hi1 hi2328dsimp only [c, f, g, h] at hi1 hi2329rw [hi1, hi2]330simp only [integral_const_mul, integral_phase_square_left_zero i k j hik,331integral_phase_square_right_zero i k j hik, mul_zero, zero_add]332rw [integral_complex_ofReal]333rfl334335/-- The degree-two coefficient of rotation invariance determines the mixed moment. -/336theorem moment_eq_succ_mul_mixed (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :337moment i j (p+2) = (p+2:ℝ) * mixed i k j (p+1) := by338have he := congrArg (fun P : ℂ[X] => P.coeff 2)339(average_entryPolynomial i k j hik (p+2))340dsimp only at he341rw [averagePolynomial_coeff _ _ _ (by omega), integral_entryPolynomial_coeff_two i k j hik,342coeff_C_mul, coeff_one_add_X_sq_pow_two] at he343have hreal : (p+2:ℝ)^2 * mixed i k j (p+1) = moment i j (p+2) * (p+2:ℝ) := by344exact_mod_cast he345have hp : (0:ℝ) < p+2 := by positivity346nlinarith347348lemma mixed_self (i j : Fin (N+1)) (p : ℕ) : mixed i i j p = moment i j (p+1) := by349unfold mixed moment350apply integral_congr_ae351filter_upwards [] with U352rw [← pow_add]353congr 1354355lemma mixed_of_ne (i k j : Fin (N+1)) (hik : i ≠ k) (p : ℕ) :356mixed i k j p = moment i j (p+1) / (p+1:ℝ) := by357cases p with358| zero => simp [mixed, moment_one, integral_entry_norm_sq]359| succ p =>360have hm := moment_eq_succ_mul_mixed i k j hik p361push_cast362apply (eq_div_iff (by positivity : (p+1+1:ℝ) ≠ 0)).mpr363convert hm.symm using 1; ring364365lemma sum_mixed (i j : Fin (N+1)) (p : ℕ) : ∑ k, mixed i k j p = moment i j p := by366unfold mixed moment367have hi := integral_finset_sum Finset.univ (fun k _ => integrable_continuous368(((continuous_entry i j).norm.pow (2*p)).mul ((continuous_entry k j).norm.pow 2)))369simp only [Pi.mul_apply] at hi370rw [← hi]371simp_rw [← Finset.mul_sum, column_sum_norm_sq, mul_one]372373/-- The all-order Haar moment recurrence, with no asymptotic hypothesis. -/374theorem moment_recurrence (i j : Fin (N+1)) (p : ℕ) :375(N+p+1:ℝ) * moment i j (p+1) = (p+1:ℝ) * moment i j p := by376have hm (k : Fin (N+1)) : mixed i k j p =377(if k=i then moment i j (p+1) - moment i j (p+1)/(p+1:ℝ) else 0) +378moment i j (p+1)/(p+1:ℝ) := by379by_cases hki : k=i380· subst k381simp [mixed_self]382· simp [hki, mixed_of_ne i k j (Ne.symm hki)]383have hs := sum_mixed i j p384simp_rw [hm] at hs385simp only [Finset.sum_add_distrib, Finset.sum_ite_eq', Finset.mem_univ, if_true,386Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul,387Nat.cast_add, Nat.cast_one] at hs388have hp : (p+1:ℝ) ≠ 0 := by positivity389field_simp at hs390nlinarith391392/-- Every even absolute Haar entry moment is the exact factorial ratio. -/393theorem integral_entry_norm_even (i j : Fin (N+1)) (p : ℕ) :394(∫ U : LocalUnitary N, ‖(U:Mat N) i j‖^(2*p) ∂haar N) =395(p.factorial:ℝ) / ((N+1).ascFactorial p : ℝ) := by396change moment i j p = _397induction p with398| zero => simp [moment_zero]399| succ p ih =>400have hm := moment_recurrence i j p401rw [ih] at hm402rw [Nat.factorial_succ, Nat.ascFactorial_succ]403push_cast404have hd : (0:ℝ) < (N+1).ascFactorial p := by exact_mod_cast Nat.ascFactorial_pos N p405have hp : (0:ℝ) < N+1+p := by positivity406apply (eq_div_iff (mul_ne_zero hp.ne' hd.ne')).mpr407field_simp at hm408nlinarith409410/-- The exact moments obey the Gaussian-size upper bound at every order. -/411theorem integral_entry_norm_even_le (i j : Fin (N+1)) (p : ℕ) :412(∫ U : LocalUnitary N, ‖(U:Mat N) i j‖^(2*p) ∂haar N) ≤413(p.factorial:ℝ) / (N+1:ℝ)^p := by414rw [integral_entry_norm_even]415apply div_le_div_of_nonneg_left (by positivity) (by positivity)416exact_mod_cast Nat.pow_succ_le_ascFactorial (N+1) p417418/-- The exact formula persists for each independent sampled block coordinate. -/419theorem integral_sample_entry_norm_even (K n : ℕ) (a : Fin n × Fin K)420(i j : Fin (N+1)) (p : ℕ) :421(∫ ω : Sample K n N, ‖(ω a : Mat N) i j‖^(2*p) ∂sampleMeasure K n N) =422(p.factorial:ℝ) / ((N+1).ascFactorial p : ℝ) := by423exact (integral_comp_eval (μ := fun _ : Fin n × Fin K => haar N) (i := a)424((continuous_entry i j).norm.pow (2*p)).aestronglyMeasurable).trans425(integral_entry_norm_even i j p)426427end Nonadditivity.HaarColumnMoments428429