Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.GaussianQuadratic

Download original .lean · View on GitHub · Jump to source

Direct imports

  • Mathlib.Probability.Distributions.Gaussian.Multivariate dependency
  • Mathlib.Probability.Moments.MGFAnalytic dependency
  • Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral dependency
  • Mathlib.Analysis.InnerProductSpace.Spectrum dependency
  • Mathlib.Analysis.InnerProductSpace.Trace dependency

Imported by project modules

3 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

20 project constants, including generated, internal and private declarations.

20 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56/-7Copyright (c) 2026 Yuanhe Zhang. All rights reserved.8The adapted portions are released under the Apache License 2.0.910The eigenbasis coordinate calculations in this file adapt proof patterns from11SLT/HansonWright.lean by Yuanhe Zhang, Jason D. Lee, and Fanghui Liu,12released under Apache 2.0 (2026), commit d0f506f0a695018265dccb33bcb05e2f5ca1c876.13The Gaussian density calculation and the quadratic concentration proof below14are established directly against this project's pinned mathlib.15-/16import Mathlib.Probability.Distributions.Gaussian.Multivariate17import Mathlib.Probability.Moments.MGFAnalytic18import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral19import Mathlib.Analysis.InnerProductSpace.Spectrum20import Mathlib.Analysis.InnerProductSpace.Trace2122/-! # Exact Gaussian quadratic integrals and concentration2324This file derives the Gaussian quadratic MGF directly from the Gaussian density,25then diagonalizes a symmetric quadratic form. No concentration inequality is26assumed as a hypothesis.27-/2829noncomputable section3031open MeasureTheory ProbabilityTheory Real32open scoped BigOperators NNReal3334namespace Nonadditivity.GaussianQuadratic3536/-- Exact one-dimensional Gaussian square-exponential integral. -/37theorem integral_exp_sq (a : ℝ) (ha : a < 1 / 2) :38    (∫ x : ℝ, exp (a * x ^ 2) ∂gaussianReal 0 1) =39      (sqrt (1 - 2 * a))⁻¹ := by40  rw [integral_gaussianReal_eq_integral_smul (by norm_num : (1 : ℝ≥0) ≠ 0)]41  simp only [smul_eq_mul, gaussianPDFReal, NNReal.coe_one, mul_one, sub_zero]42  have hpoint (x : ℝ) :43      (sqrt (2 * π))⁻¹ * exp (-x ^ 2 / 2) * exp (a * x ^ 2) =44        (sqrt (2 * π))⁻¹ * exp (-(1 / 2 - a) * x ^ 2) := by45    rw [mul_assoc, ← exp_add]46    congr 247    ring48  simp_rw [hpoint]49  rw [integral_const_mul, integral_gaussian]50  have hb : 0 < 1 - 2 * a := by linarith51  have heq : π / (1 / 2 - a) = (2 * π) / (1 - 2 * a) := by field_simp52  rw [heq, sqrt_div (by positivity), ← mul_div_assoc,53    inv_mul_cancel₀ (ne_of_gt (sqrt_pos.2 (by positivity : 0 < 2 * π))), one_div]5455/-- The quadratic Gaussian integral is integrable precisely in the subcritical range. -/56theorem integrable_exp_sq (a : ℝ) (ha : a < 1 / 2) :57    Integrable (fun x : ℝ => exp (a * x ^ 2)) (gaussianReal 0 1) := by58  apply Integrable.of_integral_ne_zero59  rw [integral_exp_sq a ha]60  exact inv_ne_zero (ne_of_gt (sqrt_pos.2 (by linarith)))6162/-- A convenient elementary logarithm remainder estimate. -/63theorem neg_log_one_sub_le {u : ℝ} (hu : u ≤ 1 / 2) :64    -log (1 - u) ≤ u + 2 * u ^ 2 := by65  have hp : 0 < 1 - u := by linarith66  have h := log_le_sub_one_of_pos (inv_pos.2 hp)67  rw [log_inv] at h68  have hrem : (1 - u)⁻¹ - 1 ≤ u + 2 * u ^ 2 := by69    apply (mul_le_mul_iff_left₀ hp).mp70    field_simp71    nlinarith [sq_nonneg u, mul_nonneg (sq_nonneg u) (by linarith : 0 ≤ 1 - 2 * u)]72  exact h.trans hrem7374/-- Centered scalar square-exponential bound, uniform over both signs. -/75theorem integral_exp_centered_sq_le {a : ℝ} (ha : |a| ≤ 1 / 4) :76    (∫ x : ℝ, exp (a * (x ^ 2 - 1)) ∂gaussianReal 0 1) ≤ exp (4 * a ^ 2) := by77  have ha' : a < 1 / 2 := by have := le_abs_self a; linarith78  have hp : 0 < 1 - 2 * a := by linarith79  have hpoint (x : ℝ) : exp (a * (x ^ 2 - 1)) = exp (-a) * exp (a * x ^ 2) := by80    rw [← exp_add]81    congr 182    ring83  simp_rw [hpoint]84  rw [integral_const_mul, integral_exp_sq a ha']85  have hsqrt : (sqrt (1 - 2 * a))⁻¹ = exp (- log (1 - 2 * a) / 2) := by86    rw [neg_div, exp_neg, ← log_sqrt hp.le, exp_log (sqrt_pos.2 hp)]87  rw [hsqrt, ← exp_add]88  apply exp_le_exp.mpr89  have hlog := neg_log_one_sub_le (u := 2 * a) (by have := le_abs_self a; linarith)90  nlinarith91929394section FiniteDimensional9596variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]97  [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]9899omit [MeasurableSpace E] [BorelSpace E] in100/-- A real symmetric quadratic form in its orthonormal eigenbasis. -/101theorem quadratic_eq_eigen_sum (T : E →ₗ[ℝ] E) (hT : T.IsSymmetric) (x : E) :102    inner ℝ (T x) x = ∑ i : Fin (Module.finrank ℝ E),103      hT.eigenvalues rfl i * ((hT.eigenvectorBasis rfl).repr x i) ^ 2 := by104  let b := hT.eigenvectorBasis (by rfl : Module.finrank ℝ E = Module.finrank ℝ E)105  calc106    inner ℝ (T x) x = inner ℝ (b.repr (T x)) (b.repr x) := by107      rw [b.repr.inner_map_map]108    _ = _ := by109      rw [PiLp.inner_apply]110      apply Finset.sum_congr rfl111      intro i _112      have hcoord : b.repr (T x) i = hT.eigenvalues rfl i * b.repr x i := by113        simpa [b] using hT.eigenvectorBasis_apply_self_apply114          (by rfl : Module.finrank ℝ E = Module.finrank ℝ E) x i115      rw [hcoord]116      change (b.repr x i) * (hT.eigenvalues rfl i * b.repr x i) = _117      change _ = hT.eigenvalues rfl i * (b.repr x i) ^ 2118      ring119120omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in121/-- Coordinates of eigenvector synthesis are the coefficients used. -/122theorem basis_repr_sum (b : OrthonormalBasis (Fin (Module.finrank ℝ E)) ℝ E)123    (z : Fin (Module.finrank ℝ E) → ℝ) (i : Fin (Module.finrank ℝ E)) :124    b.repr (∑ j, z j • b j) i = z i := by125  simp only [OrthonormalBasis.repr_apply_apply, inner_sum, inner_smul_right]126  rw [Finset.sum_eq_single i]127  · simp128  · intro j _ hji129    rw [b.inner_eq_zero hji.symm]130    simp131  · intro hi132    exact (hi (Finset.mem_univ i)).elim133134/-- Exact centered quadratic Gaussian MGF as a finite product. -/135theorem integral_exp_centered_quadratic_eq136    (T : E →L[ℝ] E) (hT : T.toLinearMap.IsSymmetric) (s : ℝ) :137    (∫ x : E, exp (s * (inner ℝ (T x) x - ∑ i, hT.eigenvalues rfl i))138      ∂stdGaussian E) =139    ∏ i : Fin (Module.finrank ℝ E),140      ∫ z : ℝ, exp ((s * hT.eigenvalues rfl i) * (z ^ 2 - 1))141        ∂gaussianReal 0 1 := by142  let b := hT.eigenvectorBasis (by rfl : Module.finrank ℝ E = Module.finrank ℝ E)143  rw [stdGaussian_eq_map_pi_orthonormalBasis b,144    integral_map ((continuous_finset_sum _ fun i _ =>145      (continuous_apply i).smul continuous_const).aemeasurable) (by fun_prop)]146  have hpoint (z : Fin (Module.finrank ℝ E) → ℝ) :147      exp (s * (inner ℝ (T (∑ i, z i • b i)) (∑ i, z i • b i) -148        ∑ i, hT.eigenvalues rfl i)) =149      ∏ i, exp ((s * hT.eigenvalues rfl i) * (z i ^ 2 - 1)) := by150    rw [← Real.exp_sum]151    congr 1152    change s * (inner ℝ (T.toLinearMap (∑ i, z i • b i)) (∑ i, z i • b i) - _) = _153    rw [quadratic_eq_eigen_sum T.toLinearMap hT]154    simp only [show hT.eigenvectorBasis rfl = b from rfl, basis_repr_sum]155    rw [← Finset.sum_sub_distrib, Finset.mul_sum]156    apply Finset.sum_congr rfl157    intro i _158    ring159  simp_rw [hpoint]160  exact integral_fintype_prod_eq_prod (fun i z => exp ((s * hT.eigenvalues rfl i) * (z ^ 2 - 1)))161162/-- The Gaussian quadratic MGF bound from spectral diagonalization and scalar integration. -/163theorem integral_exp_centered_quadratic_le164    (T : E →L[ℝ] E) (hT : T.toLinearMap.IsSymmetric) (s : ℝ)165    (hs : ∀ i : Fin (Module.finrank ℝ E), |s * hT.eigenvalues rfl i| ≤ 1 / 4) :166    (∫ x : E, exp (s * (inner ℝ (T x) x - ∑ i, hT.eigenvalues rfl i))167      ∂stdGaussian E) ≤168      exp (4 * s ^ 2 * ∑ i, (hT.eigenvalues rfl i) ^ 2) := by169  rw [integral_exp_centered_quadratic_eq T hT s]170  calc171    _ ≤ ∏ i : Fin (Module.finrank ℝ E), exp (4 * (s * hT.eigenvalues rfl i) ^ 2) := by172      apply Finset.prod_le_prod173      · intro i _174        exact integral_nonneg (fun _ => exp_nonneg _)175      · intro i _176        exact integral_exp_centered_sq_le (hs i)177    _ = _ := by178      rw [← Real.exp_sum]179      congr 1180      rw [Finset.mul_sum]181      apply Finset.sum_congr rfl182      intro i _183      ring184185/-- Integrability accompanies the Gaussian MGF bound, rather than being assumed. -/186theorem integrable_exp_centered_quadratic187    (T : E →L[ℝ] E) (hT : T.toLinearMap.IsSymmetric) (s : ℝ)188    (hs : ∀ i : Fin (Module.finrank ℝ E), |s * hT.eigenvalues rfl i| ≤ 1 / 4) :189    Integrable (fun x : E => exp (s * (inner ℝ (T x) x - ∑ i, hT.eigenvalues rfl i)))190      (stdGaussian E) := by191  apply Integrable.of_integral_ne_zero192  rw [integral_exp_centered_quadratic_eq T hT s]193  apply ne_of_gt194  apply Finset.prod_pos195  intro i _196  have hint : Integrable (fun z : ℝ =>197      exp ((s * hT.eigenvalues rfl i) * (z ^ 2 - 1))) (gaussianReal 0 1) := by198    have hsmall : s * hT.eigenvalues rfl i < 1 / 2 :=199      lt_of_le_of_lt ((le_abs_self _).trans (hs i)) (by norm_num)200    have hpt (z : ℝ) : exp ((s * hT.eigenvalues rfl i) * (z ^ 2 - 1)) =201        exp (-(s * hT.eigenvalues rfl i)) * exp ((s * hT.eigenvalues rfl i) * z ^ 2) := by202      rw [← exp_add]203      congr 1204      ring205    simp_rw [hpt]206    exact (integrable_exp_sq _ hsmall).const_mul _207  exact mgf_pos hint208209omit [MeasurableSpace E] [BorelSpace E] in210/-- The squared spectral coefficients are the trace of the square. -/211theorem trace_sq_eq_sum_eigenvalues_sq (T : E →L[ℝ] E)212    (hT : T.toLinearMap.IsSymmetric) :213    (T.toLinearMap * T.toLinearMap).trace ℝ E =214      ∑ i : Fin (Module.finrank ℝ E), (hT.eigenvalues rfl i) ^ 2 := by215  let b := hT.eigenvectorBasis (by rfl : Module.finrank ℝ E = Module.finrank ℝ E)216  rw [LinearMap.trace_eq_sum_inner _ b]217  apply Finset.sum_congr rfl218  intro i _219  change inner ℝ (b i) (T.toLinearMap (T.toLinearMap (b i))) = _220  have heig : T.toLinearMap (b i) = (hT.eigenvalues rfl i) • b i :=221    hT.apply_eigenvectorBasis rfl i222  rw [heig, map_smul, heig, inner_smul_right, inner_smul_right]223  simp [b.norm_eq_one, pow_two]224225omit [MeasurableSpace E] [BorelSpace E] in226/-- Every spectral coefficient is bounded by the actual operator norm. -/227theorem abs_eigenvalue_le_norm (T : E →L[ℝ] E)228    (hT : T.toLinearMap.IsSymmetric) (i : Fin (Module.finrank ℝ E)) :229    |hT.eigenvalues rfl i| ≤ ‖T‖ := by230  let b := hT.eigenvectorBasis (by rfl : Module.finrank ℝ E = Module.finrank ℝ E)231  have h := T.le_opNorm (b i)232  have heig : T (b i) = (hT.eigenvalues rfl i) • b i :=233    hT.apply_eigenvectorBasis rfl i234  simpa only [heig, norm_smul, Real.norm_eq_abs, b.norm_eq_one, mul_one] using h235236/-- A basis-free, centered Gaussian quadratic MGF estimate. -/237theorem integral_exp_trace_centered_le (T : E →L[ℝ] E)238    (hT : T.toLinearMap.IsSymmetric) (s : ℝ) (hs : |s| * ‖T‖ ≤ 1 / 4) :239    (∫ x : E, exp (s * (inner ℝ (T x) x - T.toLinearMap.trace ℝ E))240      ∂stdGaussian E) ≤ exp (4 * s ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) := by241  rw [hT.trace_eq_sum_eigenvalues rfl, trace_sq_eq_sum_eigenvalues_sq T hT]242  apply integral_exp_centered_quadratic_le T hT s243  intro i244  rw [abs_mul]245  exact (mul_le_mul_of_nonneg_left (abs_eigenvalue_le_norm T hT i) (abs_nonneg s)).trans hs246247/-- Integrability of the centered MGF under the same explicit norm condition. -/248theorem integrable_exp_trace_centered (T : E →L[ℝ] E)249    (hT : T.toLinearMap.IsSymmetric) (s : ℝ) (hs : |s| * ‖T‖ ≤ 1 / 4) :250    Integrable (fun x : E => exp (s * (inner ℝ (T x) x - T.toLinearMap.trace ℝ E)))251      (stdGaussian E) := by252  rw [hT.trace_eq_sum_eigenvalues rfl]253  apply integrable_exp_centered_quadratic T hT s254  intro i255  rw [abs_mul]256  exact (mul_le_mul_of_nonneg_left (abs_eigenvalue_le_norm T hT i) (abs_nonneg s)).trans hs257258/-- Explicit Gaussian upper-tail bound. The exponent parameter is free for optimization. -/259theorem measure_quadratic_ge_le (T : E →L[ℝ] E)260    (hT : T.toLinearMap.IsSymmetric) (s t : ℝ)261    (hs : 0 ≤ s) (hsmall : s * ‖T‖ ≤ 1 / 4) :262    (stdGaussian E).real {x | t ≤ inner ℝ (T x) x - T.toLinearMap.trace ℝ E} ≤263      exp (-s * t + 4 * s ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) := by264  have hsmall' : |s| * ‖T‖ ≤ 1 / 4 := by simpa [abs_of_nonneg hs] using hsmall265  calc266    _ ≤ exp (-s * t) * (∫ x : E,267        exp (s * (inner ℝ (T x) x - T.toLinearMap.trace ℝ E)) ∂stdGaussian E) :=268      measure_ge_le_exp_mul_mgf t hs (integrable_exp_trace_centered T hT s hsmall')269    _ ≤ exp (-s * t) * exp (4 * s ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) :=270      mul_le_mul_of_nonneg_left (integral_exp_trace_centered_le T hT s hsmall') (exp_nonneg _)271    _ = _ := (exp_add _ _).symm272273/-- Explicit Gaussian lower-tail bound. -/274theorem measure_quadratic_le_le (T : E →L[ℝ] E)275    (hT : T.toLinearMap.IsSymmetric) (s t : ℝ)276    (hs : 0 ≤ s) (hsmall : s * ‖T‖ ≤ 1 / 4) :277    (stdGaussian E).real {x | inner ℝ (T x) x - T.toLinearMap.trace ℝ E ≤ -t} ≤278      exp (-s * t + 4 * s ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) := by279  have hsmall' : |-s| * ‖T‖ ≤ 1 / 4 := by simpa [abs_neg, abs_of_nonneg hs] using hsmall280  calc281    _ ≤ exp (-(-s) * (-t)) * (∫ x : E,282        exp ((-s) * (inner ℝ (T x) x - T.toLinearMap.trace ℝ E)) ∂stdGaussian E) :=283      measure_le_le_exp_mul_mgf (-t) (neg_nonpos.mpr hs)284        (integrable_exp_trace_centered T hT (-s) hsmall')285    _ ≤ exp (-(-s) * (-t)) * exp (4 * (-s) ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) :=286      mul_le_mul_of_nonneg_left (integral_exp_trace_centered_le T hT (-s) hsmall') (exp_nonneg _)287    _ = _ := by rw [← exp_add]; congr 1; ring288289/-- Two-sided concentration for a concrete Gaussian quadratic form. -/290theorem measure_abs_quadratic_ge_le (T : E →L[ℝ] E)291    (hT : T.toLinearMap.IsSymmetric) (s t : ℝ)292    (hs : 0 ≤ s) (hsmall : s * ‖T‖ ≤ 1 / 4) :293    (stdGaussian E).real {x | t ≤ |inner ℝ (T x) x - T.toLinearMap.trace ℝ E|} ≤294      2 * exp (-s * t + 4 * s ^ 2 * (T.toLinearMap * T.toLinearMap).trace ℝ E) := by295  have heq : {x : E | t ≤ |inner ℝ (T x) x - T.toLinearMap.trace ℝ E|} =296      {x | t ≤ inner ℝ (T x) x - T.toLinearMap.trace ℝ E} ∪297      {x | inner ℝ (T x) x - T.toLinearMap.trace ℝ E ≤ -t} := by298    ext x299    simp only [Set.mem_setOf_eq, Set.mem_union, le_abs, le_neg]300  rw [heq]301  have hu := measure_quadratic_ge_le T hT s t hs hsmall302  have hl := measure_quadratic_le_le T hT s t hs hsmall303  exact (measureReal_union_le _ _).trans (by linarith)304305/-- A finite collection of quadratic tests is simultaneously passed by an306actual Gaussian sample whenever their explicit Gaussian tail bounds sum to less than one. -/307theorem exists_simultaneous_quadratic_bounds {J : Type*} [Fintype J]308    (T : J → E →L[ℝ] E) (hT : ∀ j, (T j).toLinearMap.IsSymmetric)309    (s t : J → ℝ) (hs : ∀ j, 0 ≤ s j)310    (hsmall : ∀ j, s j * ‖T j‖ ≤ 1 / 4)311    (hbudget : (∑ j, 2 * exp (-s j * t j +312      4 * s j ^ 2 * ((T j).toLinearMap * (T j).toLinearMap).trace ℝ E)) < 1) :313    ∃ x : E, ∀ j, |inner ℝ (T j x) x - (T j).toLinearMap.trace ℝ E| < t j := by314  classical315  by_contra hnone316  push_neg at hnone317  have hcover : (⋃ j, {x : E | t j ≤318      |inner ℝ (T j x) x - (T j).toLinearMap.trace ℝ E|}) = Set.univ := by319    apply Set.eq_univ_of_forall320    intro x321    obtain ⟨j, hj⟩ := hnone x322    exact Set.mem_iUnion.mpr ⟨j, hj⟩323  have hsum := measureReal_iUnion_fintype_le (μ := stdGaussian E)324    (fun j => {x : E | t j ≤ |inner ℝ (T j x) x - (T j).toLinearMap.trace ℝ E|})325  rw [hcover, probReal_univ] at hsum326  have hbound : (∑ j, (stdGaussian E).real327      {x : E | t j ≤ |inner ℝ (T j x) x - (T j).toLinearMap.trace ℝ E|}) ≤328      ∑ j, 2 * exp (-s j * t j +329        4 * s j ^ 2 * ((T j).toLinearMap * (T j).toLinearMap).trace ℝ E) := by330    apply Finset.sum_le_sum331    intro j _332    exact measure_abs_quadratic_ge_le (T j) (hT j) (s j) (t j) (hs j) (hsmall j)333  exact (not_lt_of_ge (hsum.trans hbound)) hbudget334335end FiniteDimensional336337end Nonadditivity.GaussianQuadratic