Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.SpectralDamping

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

Direct imports

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

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

43 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.GaussianNormalization7import Mathlib.Analysis.Matrix.Order8import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Order910/-! Finite moment damping: an actual positive contraction simultaneously suppresses11all operators in a finite family, at a trace cost controlled by their even moments. -/12noncomputable section13set_option backward.isDefEq.respectTransparency false14set_option linter.unusedSectionVars false15set_option maxHeartbeats 120000016namespace Nonadditivity.SpectralDamping17open scoped BigOperators Matrix Matrix.Norms.L2Operator MatrixOrder ComplexOrder18variable {D Q : Type*} [Fintype D] [DecidableEq D] [Nonempty D] [Fintype Q]1920/-- Functional calculus in a fixed Hermitian eigenbasis. -/21def spectral (A : Matrix D D ℂ) (hA : A.IsHermitian) (f : ℝ → ℝ) : Matrix D D ℂ :=22  Unitary.conjStarAlgAut ℂ _ hA.eigenvectorUnitary23    (Matrix.diagonal fun i => (f (hA.eigenvalues i) : ℂ))2425theorem spectral_id (A : Matrix D D ℂ) (hA : A.IsHermitian) :26    spectral A hA id = A := hA.spectral_theorem.symm2728theorem spectral_one (A : Matrix D D ℂ) (hA : A.IsHermitian) :29    spectral A hA (fun _ => 1) = 1 := by simp [spectral]3031theorem spectral_add (A : Matrix D D ℂ) (hA : A.IsHermitian) (f g : ℝ → ℝ) :32    spectral A hA (fun x => f x + g x) = spectral A hA f + spectral A hA g := by33  unfold spectral34  rw [←map_add]35  congr 136  ext i j37  by_cases h:i=j <;> simp [h]3839theorem spectral_sub (A : Matrix D D ℂ) (hA : A.IsHermitian) (f g : ℝ → ℝ) :40    spectral A hA (fun x => f x - g x) = spectral A hA f - spectral A hA g := by41  unfold spectral42  rw [←map_sub]43  congr 144  ext i j45  by_cases h:i=j <;> simp [h]4647theorem spectral_mul (A : Matrix D D ℂ) (hA : A.IsHermitian) (f g : ℝ → ℝ) :48    spectral A hA (fun x => f x * g x) = spectral A hA f * spectral A hA g := by49  simp only [spectral,Complex.ofReal_mul,←Matrix.diagonal_mul_diagonal,map_mul]5051theorem spectral_pow (A : Matrix D D ℂ) (hA : A.IsHermitian) (f : ℝ → ℝ) (p : ℕ) :52    spectral A hA (fun x => f x ^ p) = spectral A hA f ^ p := by53  unfold spectral54  rw [←map_pow,Matrix.diagonal_pow]55  congr 156  ext i j57  by_cases h:i=j <;> simp [h,Pi.pow_apply]5859theorem spectral_smul (A : Matrix D D ℂ) (hA : A.IsHermitian) (c : ℝ) (f : ℝ → ℝ) :60    spectral A hA (fun x => c * f x) = c • spectral A hA f := by61  simp only [spectral,Complex.ofReal_mul]62  rw [show (Matrix.diagonal fun i => (c:ℂ)*(f (hA.eigenvalues i):ℂ)) =63    (c:ℂ) • Matrix.diagonal (fun i => (f (hA.eigenvalues i):ℂ)) by64      ext i j; by_cases h:i=j <;> simp [h]]65  rw [map_smul]66  rfl6768theorem spectral_posSemidef (A : Matrix D D ℂ) (hA : A.IsHermitian) (f : ℝ → ℝ)69    (hf : ∀ i, 0 ≤ f (hA.eigenvalues i)) : (spectral A hA f).PosSemidef := by70  apply Matrix.LE.le.posSemidef71  unfold spectral72  exact map_nonneg (Unitary.conjStarAlgAut ℂ _ hA.eigenvectorUnitary)73    (Matrix.PosSemidef.nonneg (Matrix.posSemidef_diagonal_iff.mpr (fun i => by74      exact_mod_cast hf i)))7576theorem spectral_hermitian (A : Matrix D D ℂ) (hA : A.IsHermitian) (f : ℝ → ℝ) :77    (spectral A hA f).IsHermitian := by78  change star (spectral A hA f) = spectral A hA f79  unfold spectral80  rw [←map_star]81  congr 182  ext i j83  by_cases h:i=j84  · subst j; simp [Matrix.star_apply]85  · simp [Matrix.star_apply,h,Ne.symm h]8687theorem spectral_mono (A : Matrix D D ℂ) (hA : A.IsHermitian) (f g : ℝ → ℝ)88    (hfg : ∀ i, f (hA.eigenvalues i) ≤ g (hA.eigenvalues i)) :89    spectral A hA f ≤ spectral A hA g := by90  rw [Matrix.le_iff,←spectral_sub]91  exact spectral_posSemidef A hA _ (fun i => sub_nonneg.mpr (hfg i))9293theorem spectral_trace (A : Matrix D D ℂ) (hA : A.IsHermitian) (f : ℝ → ℝ) :94    (spectral A hA f).trace.re = ∑ i, f (hA.eigenvalues i) := by95  simp only [spectral,Unitary.conjStarAlgAut_apply,Matrix.trace_mul_cycle,96    Unitary.coe_star_mul_self,Matrix.one_mul,Matrix.trace_diagonal]97  simp9899/-- The damping matrix is precisely `(I+R)⁻¹` in a Hermitian eigenbasis. -/100def damping (R : Matrix D D ℂ) (hR : R.IsHermitian) : Matrix D D ℂ :=101  spectral R hR (fun r => (1+r)⁻¹)102103theorem damping_hermitian (R : Matrix D D ℂ) (hR : R.IsHermitian) :104    (damping R hR).IsHermitian := spectral_hermitian _ _ _105106theorem damping_posSemidef (R : Matrix D D ℂ) (hR : R.PosSemidef) :107    (damping R hR.isHermitian).PosSemidef :=108  spectral_posSemidef _ _ _ (fun i => by have := hR.eigenvalues_nonneg i; positivity)109110theorem damping_le_one (R : Matrix D D ℂ) (hR : R.PosSemidef) :111    damping R hR.isHermitian ≤ 1 := by112  rw [←spectral_one R hR.isHermitian]113  exact spectral_mono _ _ _ _ (fun i => inv_le_one_of_one_le₀ (by114    have := hR.eigenvalues_nonneg i; linarith))115116theorem damping_norm_le_one (R : Matrix D D ℂ) (hR : R.PosSemidef) :117    ‖damping R hR.isHermitian‖ ≤ 1 := by118  letI : CStarAlgebra (Matrix D D ℂ) := {}119  exact (CStarAlgebra.norm_le_one_iff_of_nonneg _ (damping_posSemidef R hR).nonneg).mpr120    (damping_le_one R hR)121122theorem damping_residual_posSemidef (R : Matrix D D ℂ) (hR : R.PosSemidef) :123    (1-damping R hR.isHermitian*damping R hR.isHermitian).PosSemidef := by124  rw [damping,←spectral_mul,←spectral_one R hR.isHermitian,←spectral_sub]125  apply spectral_posSemidef126  intro i127  have h0 : 0 ≤ (1+hR.isHermitian.eigenvalues i)⁻¹ := by128    have := hR.eigenvalues_nonneg i; positivity129  have h1 : (1+hR.isHermitian.eigenvalues i)⁻¹ ≤ 1 :=130    inv_le_one_of_one_le₀ (by have := hR.eigenvalues_nonneg i; linarith)131  nlinarith132133theorem damping_identity (R : Matrix D D ℂ) (hR : R.PosSemidef) :134    damping R hR.isHermitian * (1+R) * damping R hR.isHermitian =135      damping R hR.isHermitian := by136  have he : 1+R = spectral R hR.isHermitian (fun r => 1+r) := by137    rw [spectral_add,spectral_one]; exact congrArg (1+·) (spectral_id R hR.isHermitian).symm138  rw [he,damping,←spectral_mul,←spectral_mul]139  unfold spectral140  congr 2141  funext i142  have hn : 1+hR.isHermitian.eigenvalues i ≠ 0 := by143    have := hR.eigenvalues_nonneg i; linarith144  simp [hn]145146/-- The actual normalized loss of trace tends to zero when the normalized penalty does. -/147theorem damping_trace_loss (R : Matrix D D ℂ) (hR : R.PosSemidef) :148    (1-damping R hR.isHermitian*damping R hR.isHermitian).trace.re ≤ 2*R.trace.re := by149  rw [damping,←spectral_mul,←spectral_one R hR.isHermitian,←spectral_sub,spectral_trace,150    show R.trace.re = ∑ i, hR.isHermitian.eigenvalues i from by151      simpa using HaarMomentTail.trace_pow_re_eq_sum R hR.isHermitian 1,Finset.mul_sum]152  apply Finset.sum_le_sum153  intro i _154  have hr := hR.eigenvalues_nonneg i155  have hp : 0 < 1+hR.isHermitian.eigenvalues i := by linarith156  have hid : (1+hR.isHermitian.eigenvalues i) * (1+hR.isHermitian.eigenvalues i)⁻¹ = 1 :=157    mul_inv_cancel₀ hp.ne'158  have hinv : 0 ≤ (1+hR.isHermitian.eigenvalues i)⁻¹ := inv_nonneg.mpr hp.le159  have hs : 0 ≤ hR.isHermitian.eigenvalues i * (1+hR.isHermitian.eigenvalues i)⁻¹ :=160    mul_nonneg hr hinv161  nlinarith [sq_nonneg (hR.isHermitian.eigenvalues i * (1+hR.isHermitian.eigenvalues i)⁻¹)]162163/-- Hermitian order bounds give the actual Euclidean operator-norm bound. -/164theorem norm_le_of_bounds (A : Matrix D D ℂ) (hA : A.IsHermitian)165    {L : ℝ} (hL : 0 ≤ L) (hl : (-L) • (1 : Matrix D D ℂ) ≤ A)166    (hu : A ≤ L • (1 : Matrix D D ℂ)) : ‖A‖ ≤ L := by167  letI : CStarAlgebra (Matrix D D ℂ) := {}168  have hupper : ∀ x ∈ spectrum ℝ A, x ≤ L :=169    (le_algebraMap_iff_spectrum_le hA).mp (by170      simpa only [Algebra.algebraMap_eq_smul_one] using hu)171  have hlower : ∀ x ∈ spectrum ℝ A, -L ≤ x :=172    (algebraMap_le_iff_le_spectrum hA).mp (by173      simpa only [Algebra.algebraMap_eq_smul_one] using hl)174  have he (i : D) : hA.eigenvalues i ∈ spectrum ℝ A := by175    rw [hA.spectrum_real_eq_range_eigenvalues]176    exact ⟨i,rfl⟩177  conv_lhs => rw [hA.spectral_theorem]178  rw [StarAlgEquiv.norm_map,Matrix.l2_opNorm_diagonal]179  apply (pi_norm_le_iff_of_nonneg hL).mpr180  intro i181  change ‖(hA.eigenvalues i : ℂ)‖ ≤ L182  simpa only [Complex.norm_real,Real.norm_eq_abs] using183    (abs_le.mpr ⟨hlower _ (he i),hupper _ (he i)⟩)184185theorem congruence_mono (F : Matrix D D ℂ) (hF : F.IsHermitian)186    {A B : Matrix D D ℂ} (hAB : A ≤ B) : F*A*F ≤ F*B*F := by187  rw [Matrix.le_iff] at hAB ⊢188  simpa only [hF.eq,Matrix.mul_sub,Matrix.sub_mul] using189    hAB.conjTranspose_mul_mul_same F190191theorem damping_sandwich_norm_le (R : Matrix D D ℂ) (hR : R.PosSemidef)192    (X : Matrix D D ℂ) (hX : X.IsHermitian)193    (hl : -(1+R) ≤ X) (hu : X ≤ 1+R) :194    ‖damping R hR.isHermitian * X * damping R hR.isHermitian‖ ≤ 1 := by195  let F := damping R hR.isHermitian196  have hF : F.IsHermitian := damping_hermitian _ _197  have hu' : F*X*F ≤ F := by198    have h := congruence_mono F hF hu199    simpa only [F,damping_identity R hR] using h200  have hl' : -F ≤ F*X*F := by201    have h := congruence_mono F hF hl202    simpa only [F,Matrix.mul_neg,Matrix.neg_mul,damping_identity R hR] using h203  have hf1 : F ≤ 1 := damping_le_one R hR204  apply norm_le_of_bounds _ (by205    simpa only [hF.eq] using Matrix.isHermitian_conjTranspose_mul_mul F hX) zero_le_one206  · simpa only [neg_smul,one_smul] using (neg_le_neg hf1).trans hl'207  · simpa only [one_smul] using hu'.trans hf1208209theorem abs_le_one_add_even_pow (x : ℝ) (p : ℕ) (hp : 1 ≤ p) :210    |x| ≤ 1+x^(2*p) := by211  have hn : 0 ≤ x^(2*p) := by rw [pow_mul]; positivity212  by_cases hx : |x| ≤ 1213  · linarith214  · have hpow := le_self_pow₀ (le_of_not_ge hx) (show 2*p≠0 by omega)215    have habs : |x|^(2*p) = x^(2*p) := by simp only [pow_mul,sq_abs]216    rw [habs] at hpow217    linarith218219theorem even_power_posSemidef (X : Matrix D D ℂ) (hX : X.IsHermitian) (p : ℕ) :220    (X^(2*p)).PosSemidef := by221  have h := spectral_posSemidef X hX (fun x => x^(2*p)) (fun i => by dsimp; rw [pow_mul]; positivity)222  rw [spectral_pow] at h223  change (spectral X hX id ^ (2*p)).PosSemidef at h224  rwa [spectral_id] at h225226theorem even_power_bounds (X : Matrix D D ℂ) (hX : X.IsHermitian)227    (p : ℕ) (hp : 1 ≤ p) : -(1+X^(2*p)) ≤ X ∧ X ≤ 1+X^(2*p) := by228  have hu := spectral_mono X hX id (fun x => 1+x^(2*p)) (fun i =>229    (le_abs_self _).trans (abs_le_one_add_even_pow _ p hp))230  have hl := spectral_mono X hX (fun x => -(1+x^(2*p))) id (fun i => by231    have h := abs_le_one_add_even_pow (hX.eigenvalues i) p hp232    have h' := neg_abs_le (hX.eigenvalues i)233    dsimp only [id_eq]234    linarith)235  have hn : spectral X hX (fun x => -(1+x^(2*p))) =236      -(spectral X hX (fun x => 1+x^(2*p))) := by237    simpa using spectral_smul X hX (-1) (fun x => 1+x^(2*p))238  have he : spectral X hX (fun x => 1+x^(2*p)) = 1+X^(2*p) := by239    rw [spectral_add,spectral_one,spectral_pow]240    change 1+spectral X hX id^(2*p) = _241    rw [spectral_id]242  rw [hn,he,spectral_id] at hl243  rw [he,spectral_id] at hu244  exact ⟨hl,hu⟩245246/-- The finite penalty uses only the requested fixed even moment. -/247def penalty (X : Q → Matrix D D ℂ) (p : ℕ) : Matrix D D ℂ := ∑ q, X q^(2*p)248249theorem penalty_posSemidef (X : Q → Matrix D D ℂ) (hX : ∀ q, (X q).IsHermitian)250    (p : ℕ) : (penalty X p).PosSemidef :=251  Matrix.posSemidef_sum Finset.univ (fun q _ => even_power_posSemidef (X q) (hX q) p)252253theorem penalty_bounds (X : Q → Matrix D D ℂ) (hX : ∀ q, (X q).IsHermitian)254    (p : ℕ) (hp : 1 ≤ p) (q : Q) :255    -(1+penalty X p) ≤ X q ∧ X q ≤ 1+penalty X p := by256  have hsum : X q^(2*p) ≤ penalty X p := Finset.single_le_sum257    (fun i _ => (even_power_posSemidef (X i) (hX i) p).nonneg) (Finset.mem_univ q)258  have hb := even_power_bounds (X q) (hX q) p hp259  exact ⟨(neg_le_neg (add_le_add (le_refl (1 : Matrix D D ℂ)) hsum)).trans hb.1,260    hb.2.trans (add_le_add (le_refl (1 : Matrix D D ℂ)) hsum)⟩261262/-- A single explicitly constructed contraction suppresses every member of the family. -/263theorem family_damping_norm_le (X : Q → Matrix D D ℂ)264    (hX : ∀ q, (X q).IsHermitian) (p : ℕ) (hp : 1 ≤ p) (q : Q) :265    ‖damping (penalty X p) (penalty_posSemidef X hX p).isHermitian * X q *266      damping (penalty X p) (penalty_posSemidef X hX p).isHermitian‖ ≤ 1 :=267  damping_sandwich_norm_le _ (penalty_posSemidef X hX p) _ (hX q)268    (penalty_bounds X hX p hp q).1 (penalty_bounds X hX p hp q).2269270theorem penalty_trace (X : Q → Matrix D D ℂ) (p : ℕ) :271    (penalty X p).trace.re = ∑ q, (X q^(2*p)).trace.re := by272  simp [penalty,Matrix.trace_sum]273274theorem damping_left_inverse (R : Matrix D D ℂ) (hR : R.PosSemidef) :275    (1+R)*damping R hR.isHermitian = 1 := by276  have he : 1+R = spectral R hR.isHermitian (fun r => 1+r) := by277    rw [spectral_add,spectral_one]278    exact congrArg (1+·) (spectral_id R hR.isHermitian).symm279  rw [he,damping,←spectral_mul,←spectral_one R hR.isHermitian]280  unfold spectral281  congr 2282  funext i283  have hn : 1+hR.isHermitian.eigenvalues i ≠ 0 := by284    have := hR.eigenvalues_nonneg i; linarith285  simp [hn]286287/-- Fixed moments yield an actual simultaneously damped family, with its exact trace cost288and an explicit left inverse. No convergence or random-matrix estimate is assumed. -/289theorem exists_damping (X : Q → Matrix D D ℂ) (hX : ∀ q, (X q).IsHermitian)290    (L : ℝ) (hL : 0 < L) (p : ℕ) (hp : 1 ≤ p) :291    ∃ F G : Matrix D D ℂ, F.IsHermitian ∧ (1-F*F).PosSemidef ∧ G*F=1 ∧292      (∀ q, ‖F*X q*F‖ ≤ L) ∧293      (1-F*F).trace.re ≤ 2 * ∑ q, (L⁻¹)^(2*p) * (X q^(2*p)).trace.re := by294  let Y : Q → Matrix D D ℂ := fun q => (L⁻¹ : ℝ) • X q295  have hY (q : Q) : (Y q).IsHermitian := by296    change star ((L⁻¹ : ℝ) • X q) = (L⁻¹ : ℝ) • X q297    simp only [star_smul,star_trivial]298    change (L⁻¹ : ℝ) • (X q).conjTranspose = (L⁻¹ : ℝ) • X q299    rw [(hX q).eq]300  let R := penalty Y p301  have hR : R.PosSemidef := penalty_posSemidef Y hY p302  let F := damping R hR.isHermitian303  refine ⟨F,1+R,damping_hermitian _ _,damping_residual_posSemidef _ hR,304    damping_left_inverse _ hR,?_,?_⟩305  · intro q306    have hb : ‖F*Y q*F‖ ≤ 1 := family_damping_norm_le Y hY p hp q307    have he : F*X q*F = L • (F*Y q*F) := by308      simp only [Y,Matrix.mul_smul,Matrix.smul_mul,smul_smul,mul_inv_cancel₀ hL.ne',one_smul]309    rw [he,norm_smul,Real.norm_eq_abs,abs_of_pos hL]310    simpa only [mul_one] using mul_le_mul_of_nonneg_left hb hL.le311  · have hb := damping_trace_loss R hR312    simpa only [R,penalty_trace,Y,smul_pow,Matrix.trace_smul,Complex.smul_re,smul_eq_mul] using hb313314end Nonadditivity.SpectralDamping