Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.QuantumCodingContinuity

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

Direct imports

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

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

44 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.EntropyMixtures78/-! Dimension-controlled continuity of actual spectral quantum entropy. -/9noncomputable section10namespace Nonadditivity.QuantumCodingContinuity11open Entropy EntropyMixtures12open scoped BigOperators ComplexOrder Matrix ComplexConjugate13set_option backward.isDefEq.respectTransparency false14set_option maxHeartbeats 8000001516variable {ι : Type*} [Fintype ι] [DecidableEq ι]1718/-- Spectral calculus written with the actual eigenvector unitary. -/19def spectralMatrix {A : Matrix ι ι ℂ} (hA : A.IsHermitian) (f : ℝ → ℝ) : Matrix ι ι ℂ :=20  (hA.eigenvectorUnitary : Matrix ι ι ℂ) *21    Matrix.diagonal (fun i => (f (hA.eigenvalues i) : ℂ)) *22      (star hA.eigenvectorUnitary : Matrix ι ι ℂ)2324theorem spectralMatrix_positive {A : Matrix ι ι ℂ} (hA : A.IsHermitian)25    (f : ℝ → ℝ) (hf : ∀ i, 0 ≤ f (hA.eigenvalues i)) :26    (spectralMatrix hA f).PosSemidef := by27  apply Matrix.PosSemidef.mul_mul_conjTranspose_same28  exact Matrix.PosSemidef.diagonal (fun i => by29    change (0 : ℂ) ≤ (f (hA.eigenvalues i) : ℂ)30    exact_mod_cast hf i)3132theorem spectralMatrix_trace {A : Matrix ι ι ℂ} (hA : A.IsHermitian) (f : ℝ → ℝ) :33    Matrix.trace (spectralMatrix hA f) = ((∑ i, f (hA.eigenvalues i) : ℝ) : ℂ) := by34  rw [spectralMatrix, Matrix.trace_mul_cycle, Unitary.coe_star_mul_self, Matrix.one_mul]35  simp3637theorem spectralMatrix_sub {A : Matrix ι ι ℂ} (hA : A.IsHermitian) (f g : ℝ → ℝ) :38    spectralMatrix hA f - spectralMatrix hA g = spectralMatrix hA (fun x => f x - g x) := by39  unfold spectralMatrix40  rw [← Matrix.sub_mul, ← Matrix.mul_sub]41  congr 242  ext i j43  by_cases h : i = j44  · subst j; simp45  · simp [h]4647theorem spectralMatrix_id {A : Matrix ι ι ℂ} (hA : A.IsHermitian) :48    spectralMatrix hA id = A := hA.spectral_theorem.symm4950def differenceHermitian (ρ σ : DensityMatrix ι) : (ρ.matrix - σ.matrix).IsHermitian :=51  ρ.positive.isHermitian.sub σ.positive.isHermitian5253/-- Half the spectral trace norm of the actual difference matrix. -/54def traceDistance (ρ σ : DensityMatrix ι) : ℝ :=55  (∑ i, |(differenceHermitian ρ σ).eigenvalues i|) / 25657theorem traceDistance_nonneg (ρ σ : DensityMatrix ι) : 0 ≤ traceDistance ρ σ := by58  unfold traceDistance59  positivity6061theorem difference_eigenvalues_sum (ρ σ : DensityMatrix ι) :62    ∑ i, (differenceHermitian ρ σ).eigenvalues i = 0 := by63  have h := (differenceHermitian ρ σ).trace_eq_sum_eigenvalues64  have ht : Matrix.trace (ρ.matrix - σ.matrix) = 0 := by65    rw [Matrix.trace_sub, ρ.normalized, σ.normalized, sub_self]66  rw [ht] at h67  have h' := congrArg Complex.re h68  simpa using h'.symm6970theorem positive_eigenvalues_sum (ρ σ : DensityMatrix ι) :71    (∑ i, max ((differenceHermitian ρ σ).eigenvalues i) 0) = traceDistance ρ σ := by72  unfold traceDistance73  have hx (x : ℝ) : max x 0 = (|x| + x) / 2 := by74    by_cases h : 0 ≤ x75    · rw [max_eq_left h, abs_of_nonneg h]; ring76    · rw [max_eq_right (le_of_not_ge h), abs_of_neg (lt_of_not_ge h)]; ring77  simp_rw [hx]78  rw [← Finset.sum_div, Finset.sum_add_distrib, difference_eigenvalues_sum, add_zero]7980theorem negative_eigenvalues_sum (ρ σ : DensityMatrix ι) :81    (∑ i, max (-((differenceHermitian ρ σ).eigenvalues i)) 0) = traceDistance ρ σ := by82  unfold traceDistance83  have hx (x : ℝ) : max (-x) 0 = (|x| - x) / 2 := by84    by_cases h : 0 ≤ x85    · rw [max_eq_right (neg_nonpos.mpr h), abs_of_nonneg h]; ring86    · rw [max_eq_left (neg_nonneg.mpr (le_of_not_ge h)), abs_of_neg (lt_of_not_ge h)]; ring87  simp_rw [hx]88  rw [← Finset.sum_div, Finset.sum_sub_distrib, difference_eigenvalues_sum, sub_zero]8990def jordanPositive (ρ σ : DensityMatrix ι) : Matrix ι ι ℂ :=91  spectralMatrix (differenceHermitian ρ σ) (fun x => max x 0)9293def jordanNegative (ρ σ : DensityMatrix ι) : Matrix ι ι ℂ :=94  spectralMatrix (differenceHermitian ρ σ) (fun x => max (-x) 0)9596theorem jordan_difference (ρ σ : DensityMatrix ι) :97    jordanPositive ρ σ - jordanNegative ρ σ = ρ.matrix - σ.matrix := by98  unfold jordanPositive jordanNegative99  rw [spectralMatrix_sub]100  have hf : (fun x : ℝ => max x 0 - max (-x) 0) = id := by101    funext x102    change max x 0 - max (-x) 0 = x103    by_cases h : 0 ≤ x104    · rw [max_eq_left h, max_eq_right (neg_nonpos.mpr h), sub_zero]105    · rw [max_eq_right (le_of_not_ge h), max_eq_left (neg_nonneg.mpr (le_of_not_ge h))]106      ring107  rw [hf, spectralMatrix_id]108109theorem jordanPositive_trace (ρ σ : DensityMatrix ι) :110    Matrix.trace (jordanPositive ρ σ) = (traceDistance ρ σ : ℂ) := by111  rw [jordanPositive, spectralMatrix_trace, positive_eigenvalues_sum]112113theorem jordanNegative_trace (ρ σ : DensityMatrix ι) :114    Matrix.trace (jordanNegative ρ σ) = (traceDistance ρ σ : ℂ) := by115  rw [jordanNegative, spectralMatrix_trace, negative_eigenvalues_sum]116117theorem traceDistance_zero_imp_eq (ρ σ : DensityMatrix ι) (ht : traceDistance ρ σ = 0) : ρ = σ := by118  have hs : (∑ i, |(differenceHermitian ρ σ).eigenvalues i|) = 0 := by119    unfold traceDistance at ht120    linarith121  have he (i : ι) : (differenceHermitian ρ σ).eigenvalues i = 0 := by122    have h := Finset.single_le_sum (fun j (_ : j ∈ Finset.univ) =>123      abs_nonneg ((differenceHermitian ρ σ).eigenvalues j)) (Finset.mem_univ i)124    rw [hs] at h125    exact abs_eq_zero.mp (le_antisymm h (abs_nonneg _))126  have hD := (differenceHermitian ρ σ).spectral_theorem127  have heq : (differenceHermitian ρ σ).eigenvalues = 0 := funext he128  rw [heq] at hD129  have hz : ρ.matrix - σ.matrix = 0 := by130    simpa [Unitary.conjStarAlgAut_apply, Function.comp_def] using hD131  exact DensityMatrix.ext (sub_eq_zero.mp hz)132133/-- The normalized positive and negative Jordan pieces are actual states. -/134def positiveJordanState (ρ σ : DensityMatrix ι) (ht : 0 < traceDistance ρ σ) : DensityMatrix ι where135  matrix := (1 / (traceDistance ρ σ : ℂ)) • jordanPositive ρ σ136  positive := (spectralMatrix_positive (differenceHermitian ρ σ) _ (fun i => le_max_right _ _)).smul137    (by exact_mod_cast (show (0 : ℝ) ≤ 1 / traceDistance ρ σ by positivity))138  normalized := by139    rw [Matrix.trace_smul, jordanPositive_trace]140    have htc : (traceDistance ρ σ : ℂ) ≠ 0 := by exact_mod_cast ht.ne'141    simp [smul_eq_mul, htc]142143def negativeJordanState (ρ σ : DensityMatrix ι) (ht : 0 < traceDistance ρ σ) : DensityMatrix ι where144  matrix := (1 / (traceDistance ρ σ : ℂ)) • jordanNegative ρ σ145  positive := (spectralMatrix_positive (differenceHermitian ρ σ) _ (fun i => le_max_right _ _)).smul146    (by exact_mod_cast (show (0 : ℝ) ≤ 1 / traceDistance ρ σ by positivity))147  normalized := by148    rw [Matrix.trace_smul, jordanNegative_trace]149    have htc : (traceDistance ρ σ : ℂ) ≠ 0 := by exact_mod_cast ht.ne'150    simp [smul_eq_mul, htc]151152theorem jordanState_balance (ρ σ : DensityMatrix ι) (ht : 0 < traceDistance ρ σ) :153    ρ.matrix + (traceDistance ρ σ : ℂ) • (negativeJordanState ρ σ ht).matrix =154      σ.matrix + (traceDistance ρ σ : ℂ) • (positiveJordanState ρ σ ht).matrix := by155  have htc : (traceDistance ρ σ : ℂ) ≠ 0 := by exact_mod_cast ht.ne'156  simp only [negativeJordanState, positiveJordanState, smul_smul, mul_one_div_cancel htc, one_smul]157  exact (sub_eq_sub_iff_add_eq_add.mp (jordan_difference ρ σ)).symm.trans (add_comm _ _)158159160/-- The two weights used in the common-mixture construction. -/161def mixWeight (t : ℝ) (b : Bool) : ℝ := if b then t / (1 + t) else 1 / (1 + t)162163theorem mixWeight_nonneg {t : ℝ} (ht : 0 ≤ t) (b : Bool) : 0 ≤ mixWeight t b := by164  cases b <;> simp only [mixWeight, Bool.false_eq_true, ↓reduceIte] <;> positivity165166theorem mixWeight_sum {t : ℝ} (ht : 0 ≤ t) : (∑ b : Bool, mixWeight t b) = 1 := by167  have hd : 1 + t ≠ 0 := by linarith168  simp only [Fintype.sum_bool, mixWeight, ↓reduceIte, Bool.false_eq_true]169  field_simp170  ring171172def mixingEntropy (t : ℝ) : ℝ := shannon (mixWeight t)173174theorem mixingEntropy_zero : mixingEntropy 0 = 0 := by175  simp [mixingEntropy, shannon, mixWeight]176177theorem mixingEntropy_le_log_two {t : ℝ} (ht : 0 ≤ t) : mixingEntropy t ≤ Real.log 2 := by178  simpa only [mixingEntropy, Fintype.card_bool, Nat.cast_ofNat] using179    shannon_le_log_card (mixWeight t) (mixWeight_nonneg ht) (mixWeight_sum ht)180181/-- Entropy difference from a verified common-mixture matrix identity. -/182theorem entropy_sub_le_of_balance [Nonempty ι]183    (ρ σ P Q : DensityMatrix ι) {t : ℝ} (ht : 0 ≤ t)184    (hbalance : ρ.matrix + (t : ℂ) • Q.matrix = σ.matrix + (t : ℂ) • P.matrix) :185    ρ.vonNeumann - σ.vonNeumann ≤186      t * Real.log (Fintype.card ι) + (1 + t) * mixingEntropy t := by187  let p := mixWeight t188  let α (b : Bool) := if b then Q else ρ189  let β (b : Bool) := if b then P else σ190  let μ := DensityMatrix.mixture p (mixWeight_nonneg ht) (mixWeight_sum ht) α191  let ν := DensityMatrix.mixture p (mixWeight_nonneg ht) (mixWeight_sum ht) β192  have heq : μ = ν := by193    apply DensityMatrix.ext194    change (∑ b : Bool, (p b : ℂ) • (α b).matrix) =195      ∑ b : Bool, (p b : ℂ) • (β b).matrix196    simp only [Fintype.sum_bool, p, α, β, mixWeight, ↓reduceIte, Bool.false_eq_true,197      Complex.ofReal_div, Complex.ofReal_add, Complex.ofReal_one]198    have hb := congrArg (fun A : Matrix ι ι ℂ => (1 / (1 + (t : ℂ))) • A) hbalance199    simpa only [smul_add, smul_smul, one_div_mul_eq_div, add_comm] using hb200  have hlo := densityMatrix_mixture_entropy_concave p (mixWeight_nonneg ht)201    (mixWeight_sum ht) α202  have hup := densityMatrix_mixture_entropy_upper p (mixWeight_nonneg ht)203    (mixWeight_sum ht) β204  change (∑ b : Bool, p b * (α b).vonNeumann) ≤ μ.vonNeumann at hlo205  change ν.vonNeumann ≤ mixingEntropy t + ∑ b : Bool, p b * (β b).vonNeumann at hup206  rw [heq] at hlo207  have hc := hlo.trans hup208  simp only [Fintype.sum_bool, p, α, β, mixWeight, ↓reduceIte, Bool.false_eq_true] at hc209  have hd : 0 < 1 + t := by positivity210  have hc' := mul_le_mul_of_nonneg_left hc hd.le211  field_simp at hc'212  have hp := P.vonNeumann_le_log_dim213  have hq := Q.vonNeumann_nonneg214  have hh := mul_le_mul_of_nonneg_left hp ht215  have hq' := mul_nonneg ht hq216  nlinarith217218/-- Quantitative continuity of actual quantum entropy in half spectral trace norm.219The binary mixing term is kept exact; no dimension-dependent modulus is hidden. -/220theorem vonNeumann_traceDistance_bound [Nonempty ι] (ρ σ : DensityMatrix ι) :221    |ρ.vonNeumann - σ.vonNeumann| ≤222      traceDistance ρ σ * Real.log (Fintype.card ι) +223        (1 + traceDistance ρ σ) * mixingEntropy (traceDistance ρ σ) := by224  have ht := traceDistance_nonneg ρ σ225  by_cases hz : traceDistance ρ σ = 0226  · have heq := traceDistance_zero_imp_eq ρ σ hz227    rw [heq]228    simp only [sub_self, abs_zero]229    have hz' : traceDistance σ σ = 0 := by simpa only [heq] using hz230    rw [hz', mixingEntropy_zero]231    simp232  · have hpos : 0 < traceDistance ρ σ := lt_of_le_of_ne ht (Ne.symm hz)233    have hb := jordanState_balance ρ σ hpos234    apply abs_le.mpr235    constructor236    · have h := entropy_sub_le_of_balance σ ρ (negativeJordanState ρ σ hpos)237        (positiveJordanState ρ σ hpos) ht hb.symm238      linarith239    · exact entropy_sub_le_of_balance ρ σ (positiveJordanState ρ σ hpos)240        (negativeJordanState ρ σ hpos) ht hb241242/-- A convenient blocklength bound: the only dimensional term is distance times log dimension. -/243theorem vonNeumann_traceDistance_bound_log_two [Nonempty ι] (ρ σ : DensityMatrix ι) :244    |ρ.vonNeumann - σ.vonNeumann| ≤245      traceDistance ρ σ * Real.log (Fintype.card ι) +246        (1 + traceDistance ρ σ) * Real.log 2 := by247  apply (vonNeumann_traceDistance_bound ρ σ).trans248  exact add_le_add le_rfl (mul_le_mul_of_nonneg_left249    (mixingEntropy_le_log_two (traceDistance_nonneg ρ σ))250      (show 0 ≤ 1 + traceDistance ρ σ by linarith [traceDistance_nonneg ρ σ]))251252253/-- The half trace norm of a difference of normalized states is at most one. -/254theorem traceDistance_le_one (ρ σ : DensityMatrix ι) : traceDistance ρ σ ≤ 1 := by255  let V := star (differenceHermitian ρ σ).eigenvectorUnitary256  let α := ρ.unitaryConjugate V257  let β := σ.unitaryConjugate V258  have hdiag : α.matrix - β.matrix =259      Matrix.diagonal (fun i => ((differenceHermitian ρ σ).eigenvalues i : ℂ)) := by260    change (V : Matrix ι ι ℂ) * ρ.matrix * (star V : Matrix ι ι ℂ) -261      (V : Matrix ι ι ℂ) * σ.matrix * (star V : Matrix ι ι ℂ) = _262    rw [← Matrix.sub_mul, ← Matrix.mul_sub]263    exact (differenceHermitian ρ σ).conjStarAlgAut_star_eigenvectorUnitary264  have he (i : ι) : (α.matrix i i).re - (β.matrix i i).re =265      (differenceHermitian ρ σ).eigenvalues i := by266    have h := congrArg (fun M : Matrix ι ι ℂ => (M i i).re) hdiag267    simpa using h268  have hn (i : ι) : 0 ≤ (α.matrix i i).re :=269    (Complex.nonneg_iff.mp α.positive.diag_nonneg).1270  have hm (i : ι) : 0 ≤ (β.matrix i i).re :=271    (Complex.nonneg_iff.mp β.positive.diag_nonneg).1272  have hs : (∑ i, (α.matrix i i).re) = 1 := by273    simpa only [Matrix.trace, ← Complex.re_sum, Complex.one_re] using274      congrArg Complex.re α.normalized275  rw [← positive_eigenvalues_sum]276  calc277    _ ≤ ∑ i, (α.matrix i i).re := by278      apply Finset.sum_le_sum279      intro i _280      apply max_le281      · rw [← he]; exact sub_le_self _ (hm i)282      · exact hn i283    _ = 1 := hs284285/-- A uniform additive constant, useful when the output dimension grows exponentially. -/286theorem vonNeumann_traceDistance_bound_uniform [Nonempty ι] (ρ σ : DensityMatrix ι) :287    |ρ.vonNeumann - σ.vonNeumann| ≤288      traceDistance ρ σ * Real.log (Fintype.card ι) + 2 * Real.log 2 := by289  apply (vonNeumann_traceDistance_bound_log_two ρ σ).trans290  apply add_le_add le_rfl291  apply mul_le_mul_of_nonneg_right292  · linarith [traceDistance_le_one ρ σ]293  · exact Real.log_nonneg (by norm_num)294295end Nonadditivity.QuantumCodingContinuity