Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.Entropy

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

Direct imports

  • Mathlib.Analysis.Matrix.PosDef dependency
  • Mathlib.LinearAlgebra.Matrix.Kronecker dependency
  • Mathlib.Analysis.SpecialFunctions.Log.Basic dependency
  • Mathlib.Tactic.FieldSimp dependency
  • Mathlib.Tactic.Linarith dependency
  • Mathlib.Tactic.NormNum dependency
  • Mathlib.Tactic.Ring dependency

Imported by project modules

7 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

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

99 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Mathlib.Analysis.Matrix.PosDef7import Mathlib.LinearAlgebra.Matrix.Kronecker8import Mathlib.Analysis.SpecialFunctions.Log.Basic9import Mathlib.Tactic.FieldSimp10import Mathlib.Tactic.Linarith11import Mathlib.Tactic.NormNum12import Mathlib.Tactic.Ring1314/-!15# Entropy and purity components of `nonadditivity.tex`1617The results in the first sections are unconditional statements about finite18probability distributions and complex positive semidefinite matrices. Entropies19use natural logarithms. Divide by `Real.log 2` to obtain the paper's convention.2021The Bell weight computation proves the Shannon entropy of the actual list of22weights. It does not claim to prove the quantum mixture entropy inequality,23the complementary-output entropy identity, or the Weyl extension theorem.24-/2526namespace Nonadditivity.Entropy2728open scoped BigOperators ComplexOrder ComplexConjugate Kronecker Matrix2930noncomputable section3132def shannon {ι : Type*} [Fintype ι] (p : ι → ℝ) : ℝ :=33  -∑ i, p i * Real.log (p i)3435def distributionPurity {ι : Type*} [Fintype ι] (p : ι → ℝ) : ℝ :=36  ∑ i, p i ^ 23738theorem distributionPurity_pos {ι : Type*} [Fintype ι]39    (p : ι → ℝ) (hsum : ∑ i, p i = 1) : 0 < distributionPurity p := by40  classical41  have hn : 0 ≤ distributionPurity p := Finset.sum_nonneg (fun i _ => sq_nonneg (p i))42  by_contra hp43  have hz : distributionPurity p = 0 := le_antisymm (le_of_not_gt hp) hn44  have hzero : ∀ i, p i = 0 := by45    intro i46    have hi : p i ^ 2 ≤ distributionPurity p := Finset.single_le_sum47      (fun j _ => sq_nonneg (p j)) (Finset.mem_univ i)48    nlinarith49  simp only [hzero, Finset.sum_const_zero] at hsum50  norm_num at hsum5152/-- The order-two Rényi lower bound for a finite distribution, including zero weights. -/53theorem shannon_ge_neg_log_purity {ι : Type*} [Fintype ι]54    (p : ι → ℝ) (hp : ∀ i, 0 ≤ p i) (hsum : ∑ i, p i = 1) :55    -Real.log (distributionPurity p) ≤ shannon p := by56  classical57  let r := distributionPurity p58  have hr : 0 < r := distributionPurity_pos p hsum59  have hterm (i : ι) :60      p i * (Real.log (p i) - Real.log r) ≤ p i * (p i / r - 1) := by61    by_cases hz : p i = 062    · simp [hz]63    · have hi : 0 < p i := lt_of_le_of_ne (hp i) (Ne.symm hz)64      have hh := Real.log_le_sub_one_of_pos (div_pos hi hr)65      rw [Real.log_div hz (ne_of_gt hr)] at hh66      exact mul_le_mul_of_nonneg_left hh (hp i)67  have hsumterm := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hterm i)68  have hleft : (∑ i, p i * (Real.log (p i) - Real.log r)) =69      (∑ i, p i * Real.log (p i)) - Real.log r := by70    simp only [mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul, hsum, one_mul]71  have hright : (∑ i, p i * (p i / r - 1)) = 0 := by72    simp only [mul_sub, mul_one, ← mul_div_assoc, ← pow_two,73      Finset.sum_sub_distrib, ← Finset.sum_div, hsum]74    change r / r - 1 = 075    simp [ne_of_gt hr]76  rw [hleft, hright] at hsumterm77  unfold shannon78  change -Real.log r ≤ _79  linarith8081theorem shannon_nonneg {ι : Type*} [Fintype ι]82    (p : ι → ℝ) (hp : ∀ i, 0 ≤ p i) (hsum : ∑ i, p i = 1) : 0 ≤ shannon p := by83  classical84  have hterm (i : ι) : p i * Real.log (p i) ≤ 0 := by85    by_cases hz : p i = 086    · simp [hz]87    · have hi : 0 < p i := lt_of_le_of_ne (hp i) (Ne.symm hz)88      have hle : p i ≤ 1 := by89        rw [← hsum]90        exact Finset.single_le_sum (fun j _ => hp j) (Finset.mem_univ i)91      exact mul_nonpos_of_nonneg_of_nonpos (hp i) (Real.log_nonpos (le_of_lt hi) hle)92  have hsumterm := Finset.sum_nonpos (fun i (_ : i ∈ Finset.univ) => hterm i)93  unfold shannon94  linarith9596/-- The usual finite-alphabet entropy maximum, proved directly from `log x ≤ x-1`. -/97theorem shannon_le_log_card {ι : Type*} [Fintype ι] [Nonempty ι]98    (p : ι → ℝ) (hp : ∀ i, 0 ≤ p i) (hsum : ∑ i, p i = 1) :99    shannon p ≤ Real.log (Fintype.card ι) := by100  classical101  let d : ℝ := Fintype.card ι102  have hd : 0 < d := by103    change (0 : ℝ) < Fintype.card ι104    exact_mod_cast (Fintype.card_pos : 0 < Fintype.card ι)105  have hterm (i : ι) : p i - 1 / d - p i * Real.log d ≤ p i * Real.log (p i) := by106    by_cases hz : p i = 0107    · simp only [hz, zero_sub, zero_mul, sub_zero]108      exact neg_nonpos.mpr (le_of_lt (div_pos zero_lt_one hd))109    · have hi : 0 < p i := lt_of_le_of_ne (hp i) (Ne.symm hz)110      have hlog := Real.one_sub_inv_le_log_of_pos (mul_pos hd hi)111      rw [Real.log_mul (ne_of_gt hd) hz] at hlog112      have hm := mul_le_mul_of_nonneg_left hlog (hp i)113      have hfrac : p i * (1 - (d * p i)⁻¹) = p i - 1 / d := by114        field_simp115      rw [hfrac] at hm116      nlinarith117  have hsumterm := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hterm i)118  have hleft : (∑ i, (p i - 1 / d - p i * Real.log d)) = -Real.log d := by119    simp only [Finset.sum_sub_distrib, ← Finset.sum_mul, hsum, Finset.sum_const,120      Finset.card_univ, nsmul_eq_mul, one_mul]121    change 1 - d * (1 / d) - Real.log d = -Real.log d122    field_simp123    ring124  rw [hleft] at hsumterm125  unfold shannon126  change _ ≤ Real.log d127  linarith128129/-- The scalar cancellation used in the adjoint-bound-to-purity argument.130The hypothesis is explicit: this theorem does not supply the channel adjoint131duality or the operator-norm expectation estimate. -/132theorem norm_le_of_sq_le_mul {E : Type*} [SeminormedAddCommGroup E]133    (X : E) (t : ℝ) (ht : 0 ≤ t) (h : ‖X‖ ^ 2 ≤ t * ‖X‖) : ‖X‖ ≤ t := by134  by_cases hz : ‖X‖ = 0135  · simpa [hz] using ht136  · have hp : 0 < ‖X‖ := lt_of_le_of_ne (norm_nonneg X) (Ne.symm hz)137    nlinarith138139/-! ## Actual finite quantum density matrices -/140141/-- A finite-dimensional quantum density matrix. -/142structure DensityMatrix (ι : Type*) [Fintype ι] [DecidableEq ι] where143  matrix : Matrix ι ι ℂ144  positive : matrix.PosSemidef145  normalized : matrix.trace = 1146147def DensityMatrix.weights {ι : Type*} [Fintype ι] [DecidableEq ι]148    (ρ : DensityMatrix ι) : ι → ℝ :=149  ρ.positive.isHermitian.eigenvalues150151theorem DensityMatrix.weights_nonneg {ι : Type*} [Fintype ι] [DecidableEq ι]152    (ρ : DensityMatrix ι) (i : ι) : 0 ≤ ρ.weights i :=153  ρ.positive.eigenvalues_nonneg i154155theorem DensityMatrix.weights_sum {ι : Type*} [Fintype ι] [DecidableEq ι]156    (ρ : DensityMatrix ι) : ∑ i, ρ.weights i = 1 := by157  have h := ρ.positive.isHermitian.trace_eq_sum_eigenvalues158  rw [ρ.normalized] at h159  have hre := congrArg Complex.re h160  simpa [DensityMatrix.weights] using hre.symm161162/-- Von Neumann entropy defined spectrally, with the convention `0 log 0 = 0`. -/163def DensityMatrix.vonNeumann {ι : Type*} [Fintype ι] [DecidableEq ι]164    (ρ : DensityMatrix ι) : ℝ := shannon ρ.weights165166/-- Spectral purity. The following theorem identifies it with the matrix trace. -/167def DensityMatrix.purity {ι : Type*} [Fintype ι] [DecidableEq ι]168  (ρ : DensityMatrix ι) : ℝ := distributionPurity ρ.weights169170theorem DensityMatrix.purity_pos {ι : Type*} [Fintype ι] [DecidableEq ι]171    (ρ : DensityMatrix ι) : 0 < ρ.purity :=172  distributionPurity_pos ρ.weights ρ.weights_sum173174theorem DensityMatrix.trace_square_eq_purity {ι : Type*} [Fintype ι] [DecidableEq ι]175    (ρ : DensityMatrix ι) : (ρ.matrix * ρ.matrix).trace = (ρ.purity : ℂ) := by176  let U := ρ.positive.isHermitian.eigenvectorUnitary177  let D := Matrix.diagonal (fun i => (ρ.weights i : ℂ))178  have hs : ρ.matrix = Unitary.conjStarAlgAut ℂ _ U D :=179    ρ.positive.isHermitian.spectral_theorem180  calc181    (ρ.matrix * ρ.matrix).trace =182        (Unitary.conjStarAlgAut ℂ _ U (D * D)).trace := by rw [map_mul, ← hs]183    _ = (D * D).trace := by184      rw [Unitary.conjStarAlgAut_apply, Matrix.trace_mul_cycle, ← Matrix.mul_assoc,185        Unitary.coe_star_mul_self, Matrix.one_mul]186    _ = (ρ.purity : ℂ) := by187      simp [D, DensityMatrix.purity, distributionPurity, Matrix.diagonal_mul_diagonal,188        Matrix.trace_diagonal, pow_two]189190/-- The actual von Neumann entropy versus order-two Rényi entropy inequality. -/191theorem DensityMatrix.vonNeumann_ge_neg_log_purity192    {ι : Type*} [Fintype ι] [DecidableEq ι] (ρ : DensityMatrix ι) :193    -Real.log ρ.purity ≤ ρ.vonNeumann :=194  shannon_ge_neg_log_purity ρ.weights ρ.weights_nonneg ρ.weights_sum195196theorem DensityMatrix.vonNeumann_nonneg197    {ι : Type*} [Fintype ι] [DecidableEq ι] (ρ : DensityMatrix ι) :198    0 ≤ ρ.vonNeumann :=199  shannon_nonneg ρ.weights ρ.weights_nonneg ρ.weights_sum200201theorem DensityMatrix.vonNeumann_le_log_dim202    {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) :203    ρ.vonNeumann ≤ Real.log (Fintype.card ι) :=204  shannon_le_log_card ρ.weights ρ.weights_nonneg ρ.weights_sum205206/-- Deviation from the maximally mixed output. -/207def DensityMatrix.centered {ι : Type*} [Fintype ι] [DecidableEq ι]208    (ρ : DensityMatrix ι) : Matrix ι ι ℂ :=209  ρ.matrix - (1 / (Fintype.card ι : ℂ)) • 1210211theorem DensityMatrix.centered_isHermitian {ι : Type*} [Fintype ι]212    [DecidableEq ι] (ρ : DensityMatrix ι) : ρ.centered.IsHermitian := by213  simp [Matrix.IsHermitian, DensityMatrix.centered,214    ρ.positive.isHermitian.eq]215216theorem DensityMatrix.centered_trace_zero {ι : Type*} [Fintype ι]217    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) : ρ.centered.trace = 0 := by218  have hd : (Fintype.card ι : ℂ) ≠ 0 := by219    exact_mod_cast Fintype.card_ne_zero220  simp [DensityMatrix.centered, Matrix.trace_sub, Matrix.trace_smul,221    Matrix.trace_one, ρ.normalized, hd]222223/-- Trace pairing with the output equals the squared centered Hilbert--Schmidt length. -/224theorem DensityMatrix.centered_trace_pairing {ι : Type*} [Fintype ι]225    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) :226    (ρ.centered * ρ.centered).trace = (ρ.matrix * ρ.centered).trace := by227  change ((ρ.matrix - (1 / (Fintype.card ι : ℂ)) • 1) * ρ.centered).trace = _228  simp [Matrix.sub_mul, Matrix.trace_sub,229    Matrix.trace_smul, ρ.centered_trace_zero]230231/-- The exact centered-purity decomposition used in Lemma `purity`. -/232theorem DensityMatrix.centered_trace_square {ι : Type*} [Fintype ι]233    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) :234    (ρ.centered * ρ.centered).trace =235      (ρ.purity : ℂ) - 1 / (Fintype.card ι : ℂ) := by236  have hd : (Fintype.card ι : ℂ) ≠ 0 := by237    exact_mod_cast Fintype.card_ne_zero238  simp only [DensityMatrix.centered, Matrix.sub_mul, Matrix.mul_sub,239    Matrix.trace_sub, Matrix.smul_mul, Matrix.mul_smul,240    Matrix.one_mul, Matrix.trace_smul, ρ.normalized,241    Matrix.trace_one, ρ.trace_square_eq_purity, smul_eq_mul, mul_one]242  field_simp243  ring244245theorem DensityMatrix.purity_eq_inv_dim_add_centered {ι : Type*} [Fintype ι]246    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) :247    ρ.purity = 1 / (Fintype.card ι : ℝ) +248      (ρ.centered * ρ.centered).trace.re := by249  have h := congrArg Complex.re ρ.centered_trace_square250  simp only [Complex.sub_re, Complex.ofReal_re, ← Complex.ofReal_natCast,251    ← Complex.ofReal_one, ← Complex.ofReal_div, Complex.ofReal_re] at h252  linarith253254/-- A concrete entropy bound for a finite density matrix satisfying a purity certificate.255This is the final entropy step of Lemma `purity`, independent of how the256certificate is produced. -/257theorem DensityMatrix.entropy_bound_of_purity {ι : Type*} [Fintype ι]258    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) (t : ℝ)259    (hpurity : ρ.purity ≤ 1 / (Fintype.card ι : ℝ) + t ^ 2) :260    Real.log (Fintype.card ι) - Real.log (1 + (Fintype.card ι : ℝ) * t ^ 2) ≤261      ρ.vonNeumann := by262  have hd : (0 : ℝ) < Fintype.card ι := by263    exact_mod_cast Fintype.card_pos264  have hb : 0 < 1 / (Fintype.card ι : ℝ) + t ^ 2 :=265    add_pos_of_pos_of_nonneg (div_pos zero_lt_one hd) (sq_nonneg t)266  have hlog := Real.log_le_log ρ.purity_pos hpurity267  have hrearr : 1 / (Fintype.card ι : ℝ) + t ^ 2 =268      (1 + (Fintype.card ι : ℝ) * t ^ 2) / (Fintype.card ι : ℝ) := by269    field_simp270  have htpos : 0 < 1 + (Fintype.card ι : ℝ) * t ^ 2 := by271    nlinarith [mul_nonneg (le_of_lt hd) (sq_nonneg t)]272  rw [hrearr, Real.log_div (ne_of_gt htpos) (ne_of_gt hd)] at hlog273  have hrenyi := ρ.vonNeumann_ge_neg_log_purity274  linarith275276/-- The centered Hilbert--Schmidt certificate implies both claims of Lemma `purity`. -/277theorem DensityMatrix.purity_and_entropy_of_centered_bound {ι : Type*} [Fintype ι]278    [DecidableEq ι] [Nonempty ι] (ρ : DensityMatrix ι) (t : ℝ)279    (hcenter : (ρ.centered * ρ.centered).trace.re ≤ t ^ 2) :280    ρ.purity ≤ 1 / (Fintype.card ι : ℝ) + t ^ 2 ∧281    Real.log (Fintype.card ι) - Real.log (1 + (Fintype.card ι : ℝ) * t ^ 2) ≤282      ρ.vonNeumann := by283  have hp : ρ.purity ≤ 1 / (Fintype.card ι : ℝ) + t ^ 2 := by284    rw [ρ.purity_eq_inv_dim_add_centered]285    linarith286  exact ⟨hp, ρ.entropy_bound_of_purity t hp⟩287288/-- Conjugation of a genuine density matrix by a genuine unitary matrix. -/289def DensityMatrix.unitaryConjugate {ι : Type*} [Fintype ι] [DecidableEq ι]290    (ρ : DensityMatrix ι) (U : unitary (Matrix ι ι ℂ)) : DensityMatrix ι where291  matrix := (U : Matrix ι ι ℂ) * ρ.matrix * (star U : Matrix ι ι ℂ)292  positive := ρ.positive.mul_mul_conjTranspose_same (U : Matrix ι ι ℂ)293  normalized := by294    rw [Matrix.trace_mul_cycle, Unitary.coe_star_mul_self, Matrix.one_mul]295    exact ρ.normalized296297theorem DensityMatrix.unitaryConjugate_weights {ι : Type*} [Fintype ι] [DecidableEq ι]298    (ρ : DensityMatrix ι) (U : unitary (Matrix ι ι ℂ)) :299    (ρ.unitaryConjugate U).weights = ρ.weights := by300  apply ((ρ.unitaryConjugate U).positive.isHermitian.eigenvalues_eq_eigenvalues_iff301    ρ.positive.isHermitian).mpr302  change (U * ρ.matrix * (star U : Matrix ι ι ℂ)).charpoly = ρ.matrix.charpoly303  rw [Matrix.charpoly_mul_comm, ← Matrix.mul_assoc, Unitary.coe_star_mul_self,304    Matrix.one_mul]305306/-- Unitary invariance of actual von Neumann entropy. -/307theorem DensityMatrix.unitaryConjugate_entropy {ι : Type*} [Fintype ι] [DecidableEq ι]308    (ρ : DensityMatrix ι) (U : unitary (Matrix ι ι ℂ)) :309    (ρ.unitaryConjugate U).vonNeumann = ρ.vonNeumann := by310  simp only [DensityMatrix.vonNeumann, ρ.unitaryConjugate_weights U]311312/-- Entrywise conjugation of a Hermitian density matrix equals its transpose. -/313def DensityMatrix.conjugate {ι : Type*} [Fintype ι] [DecidableEq ι]314    (ρ : DensityMatrix ι) : DensityMatrix ι where315  matrix := ρ.matrix.transpose316  positive := ρ.positive.transpose317  normalized := by simpa using ρ.normalized318319theorem DensityMatrix.conjugate_weights {ι : Type*} [Fintype ι] [DecidableEq ι]320    (ρ : DensityMatrix ι) : ρ.conjugate.weights = ρ.weights := by321  apply (ρ.conjugate.positive.isHermitian.eigenvalues_eq_eigenvalues_iff322    ρ.positive.isHermitian).mpr323  exact Matrix.charpoly_transpose ρ.matrix324325/-- Entropy equality of conjugate quantum output states. -/326theorem DensityMatrix.conjugate_entropy {ι : Type*} [Fintype ι] [DecidableEq ι]327    (ρ : DensityMatrix ι) : ρ.conjugate.vonNeumann = ρ.vonNeumann := by328  simp only [DensityMatrix.vonNeumann, ρ.conjugate_weights]329330/-! ## Bell-mixture weights (the classical component of Lemma `bell`) -/331332def bellWeights (K : ℕ) : Option (Fin (K * (K - 1))) → ℝ333  | none => 1 / (K : ℝ)334  | some _ => 1 / (K : ℝ) ^ 2335336theorem bellWeights_nonneg (K : ℕ) (i : Option (Fin (K * (K - 1)))) :337    0 ≤ bellWeights K i := by338  cases i <;> simp [bellWeights]339340theorem bellWeights_sum (K : ℕ) (hK : 1 ≤ K) : ∑ i, bellWeights K i = 1 := by341  have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (by omega : K ≠ 0)342  have hm : ((K - 1 : ℕ) : ℝ) = (K : ℝ) - 1 := by343    rw [Nat.cast_sub hK]344    simp345  simp [Fintype.sum_option, bellWeights, hm]346  field_simp347  ring348349/-- Exact Shannon entropy of one weight `1/K` and `K(K-1)` weights `1/K²`. -/350theorem bellWeights_shannon (K : ℕ) (hK : 1 ≤ K) :351    shannon (bellWeights K) = 2 * Real.log K - Real.log K / K := by352  have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (by omega : K ≠ 0)353  have hm : ((K - 1 : ℕ) : ℝ) = (K : ℝ) - 1 := by354    rw [Nat.cast_sub hK]355    simp356  simp [shannon, Fintype.sum_option, bellWeights, hm,357    Real.log_pow]358  field_simp359  ring360361/-! ## The actual Bell-vector unitary identity -/362363/-- The unnormalized Bell vector in the product basis. -/364def bellVector {ι : Type*} [DecidableEq ι] : ι × ι → ℂ :=365  fun ij => if ij.1 = ij.2 then 1 else 0366367/-- `U ⊗ conjugate(U)` fixes the Bell vector, for any finite-dimensional unitary. -/368theorem unitary_kronecker_conjugate_fixes_bell {ι : Type*} [Fintype ι] [DecidableEq ι]369    (U : unitary (Matrix ι ι ℂ)) :370    ((U : Matrix ι ι ℂ) ⊗ₖ (U : Matrix ι ι ℂ).map (starRingEnd ℂ)) *ᵥ371      (bellVector : ι × ι → ℂ) = bellVector := by372  ext ⟨i, j⟩373  simp only [Matrix.mulVec, dotProduct, Fintype.sum_prod_type, Matrix.kronecker_apply,374    Matrix.map_apply, bellVector, mul_ite, mul_one, mul_zero]375  simp only [Finset.sum_ite_eq, Finset.mem_univ, if_true]376  have h := congrArg (fun M : Matrix ι ι ℂ => M i j) (Unitary.coe_mul_star_self U)377  simpa [Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.one_apply] using h378379/-- The same identity for any scalar normalization, including `1 / sqrt(dim)`. -/380theorem unitary_kronecker_conjugate_fixes_scaled_bell381    {ι : Type*} [Fintype ι] [DecidableEq ι]382    (U : unitary (Matrix ι ι ℂ)) (c : ℂ) :383    ((U : Matrix ι ι ℂ) ⊗ₖ (U : Matrix ι ι ℂ).map (starRingEnd ℂ)) *ᵥ384      (c • (bellVector : ι × ι → ℂ)) = c • bellVector := by385  rw [Matrix.mulVec_smul, unitary_kronecker_conjugate_fixes_bell]386387end388389end Nonadditivity.Entropy