Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.QuantumCodingGentle

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

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

14 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.QuantumCodingTraceDistance78/-! Actual purification and gentle-projection bounds for spectral trace distance. -/9noncomputable section10namespace Nonadditivity.QuantumCodingContinuity11open Entropy EntropyMixtures12open scoped BigOperators ComplexOrder Matrix ComplexConjugate MatrixOrder Matrix.Norms.L2Operator13set_option backward.isDefEq.respectTransparency false14set_option maxHeartbeats 10000001516variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ]1718/-- Rectangular Hilbert--Schmidt norm, independent of matrix operator-norm instances. -/19def hsNorm (X : Matrix ι κ ℂ) : ℝ := Real.sqrt (∑ i, ∑ j, ‖X i j‖ ^ 2)2021omit [DecidableEq ι] in22theorem hsNorm_nonneg (X : Matrix ι κ ℂ) : 0 ≤ hsNorm X := Real.sqrt_nonneg _2324omit [DecidableEq ι] in25theorem hsNorm_sq (X : Matrix ι κ ℂ) : hsNorm X ^ 2 = (X * Xᴴ).trace.re := by26  rw [hsNorm, Real.sq_sqrt (by positivity)]27  simp [Matrix.trace, Matrix.mul_apply, Matrix.conjTranspose_apply, Complex.mul_conj,28    Complex.normSq_eq_norm_sq, -Complex.ofReal_pow]2930theorem hsNorm_unitary (U : unitary (Matrix ι ι ℂ)) (X : Matrix ι κ ℂ) :31    hsNorm ((U : Matrix ι ι ℂ) * X) = hsNorm X := by32  have hsq : hsNorm ((U : Matrix ι ι ℂ) * X) ^ 2 = hsNorm X ^ 2 := by33    rw [hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_mul]34    change (((U : Matrix ι ι ℂ) * X) * (Xᴴ * (star U : Matrix ι ι ℂ))).trace.re = _35    have hm : ((U : Matrix ι ι ℂ) * X) * (Xᴴ * (star U : Matrix ι ι ℂ)) =36        (U : Matrix ι ι ℂ) * (X * Xᴴ) * (star U : Matrix ι ι ℂ) := by37      simp only [Matrix.mul_assoc]38    rw [hm, Matrix.trace_mul_cycle, Unitary.coe_star_mul_self, Matrix.one_mul]39  nlinarith [hsNorm_nonneg ((U : Matrix ι ι ℂ) * X), hsNorm_nonneg X]4041omit [DecidableEq ι] in42theorem entry_norm_product_sum_le (X Y : Matrix ι κ ℂ) :43    (∑ i, ∑ j, ‖X i j‖ * ‖Y i j‖) ≤ hsNorm X * hsNorm Y := by44  simpa only [hsNorm, Fintype.sum_prod_type] using45    Real.sum_mul_le_sqrt_mul_sqrt Finset.univ46      (fun ij : ι × κ => ‖X ij.1 ij.2‖) (fun ij : ι × κ => ‖Y ij.1 ij.2‖)4748private theorem abs_normSq_sub_le (x y : ℂ) :49    |Complex.normSq x - Complex.normSq y| ≤ ‖x - y‖ * (‖x‖ + ‖y‖) := by50  rw [Complex.normSq_eq_norm_sq, Complex.normSq_eq_norm_sq]51  have hfact : ‖x‖ ^ 2 - ‖y‖ ^ 2 = (‖x‖ - ‖y‖) * (‖x‖ + ‖y‖) := by ring52  rw [hfact, abs_mul, abs_of_nonneg (add_nonneg (norm_nonneg _) (norm_nonneg _))]53  exact mul_le_mul_of_nonneg_right (abs_norm_sub_norm_le x y) (by positivity)5455omit [DecidableEq ι] in56/-- A dimension-free bound for the diagonal of a difference of Gram matrices. -/57theorem sum_abs_diagonal_gram_sub_le (X Y : Matrix ι κ ℂ) :58    (∑ i, |((X * Xᴴ - Y * Yᴴ) i i).re|) ≤59      hsNorm (X - Y) * (hsNorm X + hsNorm Y) := by60  have he (i : ι) : ((X * Xᴴ - Y * Yᴴ) i i).re =61      ∑ j, (Complex.normSq (X i j) - Complex.normSq (Y i j)) := by62    simp [Matrix.mul_apply, Matrix.conjTranspose_apply, Complex.mul_conj,63      Finset.sum_sub_distrib]64  simp_rw [he]65  calc66    _ ≤ ∑ i, ∑ j, |Complex.normSq (X i j) - Complex.normSq (Y i j)| :=67      Finset.sum_le_sum fun i _ => Finset.abs_sum_le_sum_abs _ _68    _ ≤ ∑ i, ∑ j, ‖X i j - Y i j‖ * (‖X i j‖ + ‖Y i j‖) :=69      Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => abs_normSq_sub_le _ _70    _ = (∑ i, ∑ j, ‖(X - Y) i j‖ * ‖X i j‖) +71        (∑ i, ∑ j, ‖(X - Y) i j‖ * ‖Y i j‖) := by72      simp only [Matrix.sub_apply, mul_add, Finset.sum_add_distrib]73    _ ≤ hsNorm (X - Y) * hsNorm X + hsNorm (X - Y) * hsNorm Y :=74      add_le_add (entry_norm_product_sum_le (X - Y) X) (entry_norm_product_sum_le (X - Y) Y)75    _ = _ := by ring7677/-- Purification bound for arbitrary rectangular amplitudes of normalized states. -/78theorem traceDistance_le_hsNorm_of_gram (ρ σ : DensityMatrix ι)79    (X Y : Matrix ι κ ℂ) (hX : ρ.matrix = X * Xᴴ) (hY : σ.matrix = Y * Yᴴ) :80    traceDistance ρ σ ≤ hsNorm (X - Y) := by81  let U := star (differenceHermitian ρ σ).eigenvectorUnitary82  have hd : (U : Matrix ι ι ℂ) * (ρ.matrix - σ.matrix) * (star U : Matrix ι ι ℂ) =83      Matrix.diagonal (fun i => ((differenceHermitian ρ σ).eigenvalues i : ℂ)) :=84    (differenceHermitian ρ σ).conjStarAlgAut_star_eigenvectorUnitary85  have hg : ((U : Matrix ι ι ℂ) * X) * ((U : Matrix ι ι ℂ) * X)ᴴ -86      ((U : Matrix ι ι ℂ) * Y) * ((U : Matrix ι ι ℂ) * Y)ᴴ =87      Matrix.diagonal (fun i => ((differenceHermitian ρ σ).eigenvalues i : ℂ)) := by88    calc89      _ = (U : Matrix ι ι ℂ) * (ρ.matrix - σ.matrix) * (star U : Matrix ι ι ℂ) := by90        simp only [hX, hY, Matrix.conjTranspose_mul, Matrix.mul_sub, Matrix.sub_mul,91          ← Matrix.star_eq_conjTranspose, Matrix.mul_assoc]92      _ = _ := hd93  have h := sum_abs_diagonal_gram_sub_le ((U : Matrix ι ι ℂ) * X) ((U : Matrix ι ι ℂ) * Y)94  rw [hg] at h95  simp only [Matrix.diagonal_apply_eq, Complex.ofReal_re, ← Matrix.mul_sub, hsNorm_unitary] at h96  have hx : hsNorm X = 1 := by97    have hh := hsNorm_sq X98    rw [← hX, ρ.normalized, Complex.one_re] at hh99    nlinarith [hsNorm_nonneg X]100  have hy : hsNorm Y = 1 := by101    have hh := hsNorm_sq Y102    rw [← hY, σ.normalized, Complex.one_re] at hh103    nlinarith [hsNorm_nonneg Y]104  rw [hx, hy] at h105  unfold traceDistance106  linarith107108109omit [DecidableEq ι] in110theorem hsNorm_sub_sq (X Y : Matrix ι κ ℂ) :111    hsNorm (X - Y) ^ 2 = hsNorm X ^ 2 + hsNorm Y ^ 2 - 2 * (X * Yᴴ).trace.re := by112  have hc : (Y * Xᴴ).trace.re = (X * Yᴴ).trace.re := by113    have h := congrArg Complex.re (Matrix.trace_conjTranspose (X * Yᴴ))114    simpa only [Matrix.conjTranspose_mul, Matrix.conjTranspose_conjTranspose,115      Complex.star_def, Complex.conj_re] using h116  rw [hsNorm_sq, hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_sub,117    Matrix.mul_sub, Matrix.sub_mul, Matrix.sub_mul]118  simp only [Matrix.trace_sub, Complex.sub_re, hc]119  ring120121/-- Gentle projection with a dimension-free square-root disturbance estimate.122The success probability is the literal matrix trace; the comparison state123is the normalized projected density matrix. -/124theorem traceDistance_gentle_projection (ρ τ : DensityMatrix ι)125    (P : Matrix ι ι ℂ) (hP : P.IsHermitian) (hPP : P * P = P)126    (s : ℝ) (hs : 0 < s) (hs₁ : s ≤ 1)127    (hprob : (P * ρ.matrix * P).trace.re = s)128    (hτ : τ.matrix = ((s⁻¹ : ℝ) : ℂ) • (P * ρ.matrix * P)) :129    traceDistance ρ τ ≤ Real.sqrt (2 * (1 - s)) := by130  let X := CFC.sqrt ρ.matrix131  have hXh : X.IsHermitian :=132    (Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg ρ.matrix)).isHermitian133  have hX : X * Xᴴ = ρ.matrix := by134    rw [hXh.eq]135    exact CFC.sqrt_mul_sqrt_self ρ.matrix ρ.positive.nonneg136  let c : ℂ := ((Real.sqrt s)⁻¹ : ℝ)137  let Y := c • (P * X)138  have hcstar : star c = c := by simp [c]139  have hcsq : c * c = ((s⁻¹ : ℝ) : ℂ) := by140    dsimp [c]141    rw [← Complex.ofReal_mul]142    congr 1143    rw [← mul_inv, Real.mul_self_sqrt hs.le]144  have hY : Y * Yᴴ = τ.matrix := by145    rw [hτ]146    change (c • (P * X)) * (c • (P * X))ᴴ = _147    rw [Matrix.conjTranspose_smul, hcstar, Matrix.smul_mul, Matrix.mul_smul,148      smul_smul, hcsq, Matrix.conjTranspose_mul, hP.eq]149    congr 1150    calc151      (P * X) * (Xᴴ * P) = P * (X * Xᴴ) * P := by simp only [Matrix.mul_assoc]152      _ = _ := by rw [hX]153  have hx : hsNorm X = 1 := by154    have h := hsNorm_sq X155    rw [hX, ρ.normalized, Complex.one_re] at h156    nlinarith [hsNorm_nonneg X]157  have hy : hsNorm Y = 1 := by158    have h := hsNorm_sq Y159    rw [hY, τ.normalized, Complex.one_re] at h160    nlinarith [hsNorm_nonneg Y]161  have htr : (ρ.matrix * P).trace.re = s := by162    rw [Matrix.trace_mul_cycle, hPP, Matrix.trace_mul_comm] at hprob163    exact hprob164  have hcross : (X * Yᴴ).trace.re = Real.sqrt s := by165    have hm : X * Yᴴ = c • (ρ.matrix * P) := by166      change X * (c • (P * X))ᴴ = _167      rw [Matrix.conjTranspose_smul, hcstar, Matrix.mul_smul, Matrix.conjTranspose_mul, hP.eq]168      congr 1169      rw [← Matrix.mul_assoc, hX]170    rw [hm, Matrix.trace_smul]171    change (c * (ρ.matrix * P).trace).re = _172    simp only [c, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, htr]173    have hr := Real.sq_sqrt hs.le174    have hn := Real.sqrt_pos.mpr hs175    apply (inv_mul_eq_iff_eq_mul₀ hn.ne').2176    nlinarith177  have hnorm : hsNorm (X - Y) ^ 2 = 2 - 2 * Real.sqrt s := by178    rw [hsNorm_sub_sq, hx, hy, hcross]179    ring180  have hroot : s ≤ Real.sqrt s := by181    have hsqrt := Real.sq_sqrt hs.le182    have hnon := Real.sqrt_nonneg s183    nlinarith184  have hbound : hsNorm (X - Y) ≤ Real.sqrt (2 * (1 - s)) := by185    have hsqrt := Real.sq_sqrt (show 0 ≤ 2 * (1 - s) by linarith)186    nlinarith [hsNorm_nonneg (X - Y), Real.sqrt_nonneg (2 * (1 - s))]187  exact (traceDistance_le_hsNorm_of_gram ρ τ X Y hX.symm hY.symm).trans hbound188189190/-- Mean square-root disturbance is controlled by the mean failure probability. -/191theorem weighted_mean_gentle_bound {μ : Type*} [Fintype μ]192    (p t e : μ → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : ∑ j, p j = 1)193    (ht : ∀ j, 0 ≤ t j) (he : ∀ j, 0 ≤ e j)194    (hb : ∀ j, t j ≤ Real.sqrt (2 * e j)) :195    (∑ j, p j * t j) ≤ Real.sqrt (2 * ∑ j, p j * e j) := by196  have hc := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ197    (fun j => Real.sqrt (p j)) (fun j => Real.sqrt (p j) * t j)198  have hprod (j : μ) : Real.sqrt (p j) * (Real.sqrt (p j) * t j) = p j * t j := by199    rw [← mul_assoc, Real.mul_self_sqrt (hp j)]200  simp only [hprod, mul_pow, Real.sq_sqrt (hp _), hs, one_mul] at hc201  have hsq (j : μ) : t j ^ 2 ≤ 2 * e j := by202    have hr := Real.sq_sqrt (show 0 ≤ 2 * e j from mul_nonneg (by norm_num) (he j))203    nlinarith [hb j, ht j, Real.sqrt_nonneg (2 * e j)]204  have hemean : 0 ≤ ∑ j, p j * e j := Finset.sum_nonneg fun j _ => mul_nonneg (hp j) (he j)205  have hsum : (∑ j, p j * t j ^ 2) ≤ 2 * ∑ j, p j * e j := by206    calc207      _ ≤ ∑ j, p j * (2 * e j) := Finset.sum_le_sum fun j _ => mul_le_mul_of_nonneg_left (hsq j) (hp j)208      _ = _ := by simp only [Finset.mul_sum]; apply Finset.sum_congr rfl; intro j _; ring209  have hr := Real.sq_sqrt (show 0 ≤ 2 * ∑ j, p j * e j by positivity)210  nlinarith [Real.sqrt_nonneg (2 * ∑ j, p j * e j)]211212end Nonadditivity.QuantumCodingContinuity