Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.QuantumCodingTraceUnion

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

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

34 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.QuantumCodingUnion7import Mathlib.Analysis.Matrix.Hermitian8import Mathlib.Analysis.Matrix.Order910/-! # Matrix trace form of the projective quantum union bound1112The vector estimate is summed over the columns of an arbitrary amplitude.13Thus it applies to every positive matrix, without normalization or a rank14restriction, and to the literal ordered product of the selected projections.15-/1617noncomputable section18namespace Nonadditivity.QuantumCoding19open scoped BigOperators InnerProductSpace Matrix MatrixOrder ComplexOrder Matrix.Norms.L2Operator2021set_option backward.isDefEq.respectTransparency false2223variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ]2425/-- A Hermitian idempotent matrix gives an actual orthogonal projection. -/26def Projection.ofMatrix (A : Matrix ι ι ℂ) (hA : A.IsHermitian)27    (hAA : A*A=A) : Projection (EuclideanSpace ℂ ι) where28  map := Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) A29  symmetric := Matrix.isHermitian_iff_isSymmetric.mp hA30  idempotent := by31    intro x32    have h := congrArg (fun B : Matrix ι ι ℂ => Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) B x) hAA33    simpa only [map_mul, ContinuousLinearMap.mul_apply] using h3435/-- The ordered product after `n` selected projective outcomes. -/36def actualProduct (A : ℕ → Matrix ι ι ℂ) : ℕ → Matrix ι ι ℂ37  | 0 => 138  | n+1 => A n * actualProduct A n3940/-- Matrix products describe exactly the vector projection trajectory. -/41theorem matrix_trajectory (A : ℕ → Matrix ι ι ℂ)42    (hA : ∀i, (A i).IsHermitian) (hAA : ∀i, A i*A i=A i)43    (x : EuclideanSpace ℂ ι) (n : ℕ) :44    Projection.trajectory (fun i => Projection.ofMatrix (A i) (hA i) (hAA i)) x n =45      Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) (actualProduct A n) x := by46  induction n with47  | zero => simp [Projection.trajectory, actualProduct]48  | succ n ih =>49    simp only [Projection.trajectory, actualProduct, map_mul,50      ContinuousLinearMap.mul_apply]51    change Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) (A n)52      (Projection.trajectory (fun i => Projection.ofMatrix (A i) (hA i) (hAA i)) x n) = _53    rw [ih]5455/-- One column of a rectangular amplitude, as a genuine Euclidean vector. -/56def amplitudeColumn (X : Matrix ι κ ℂ) (j : κ) : EuclideanSpace ℂ ι :=57  WithLp.toLp 2 (fun i => X i j)5859omit [Fintype κ] in60theorem amplitudeColumn_mul (A : Matrix ι ι ℂ) (X : Matrix ι κ ℂ) (j : κ) :61    amplitudeColumn (A*X) j = Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) A (amplitudeColumn X j) := rfl6263omit [Fintype κ] in64theorem amplitudeColumn_sub_mul (A : Matrix ι ι ℂ) (X : Matrix ι κ ℂ) (j : κ) :65    amplitudeColumn (((1 : Matrix ι ι ℂ)-A)*X) j =66      amplitudeColumn X j - Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) A (amplitudeColumn X j) := by67  rw [Matrix.sub_mul, Matrix.one_mul]68  rfl6970omit [DecidableEq ι] in71/-- The squared column norms sum to the literal Gram-matrix trace. -/72theorem trace_gram_eq_sum_column_norm_sq (X : Matrix ι κ ℂ) :73    (X*X.conjTranspose).trace.re = ∑ j, ‖amplitudeColumn X j‖^2 := by74  rw [Matrix.trace_mul_comm]75  simp only [Matrix.trace, Matrix.diag, Matrix.mul_apply, Matrix.conjTranspose_apply,76    Complex.re_sum, Complex.star_def, ←Complex.normSq_eq_conj_mul_self,77    Complex.ofReal_re, Complex.normSq_eq_norm_sq, EuclideanSpace.norm_sq_eq,78    amplitudeColumn]7980/-- For an orthogonal projection, squared rejected amplitude equals its81single failure probability on the original positive matrix. -/82theorem rejected_gram_trace (A : Matrix ι ι ℂ) (hA : A.IsHermitian)83    (hAA : A*A=A) (X : Matrix ι κ ℂ) :84    ((((1 : Matrix ι ι ℂ)-A)*X)*(((1 : Matrix ι ι ℂ)-A)*X).conjTranspose).trace =85      (((1 : Matrix ι ι ℂ)-A)*(X*X.conjTranspose)).trace := by86  have hQ : ((1 : Matrix ι ι ℂ)-A)*((1 : Matrix ι ι ℂ)-A)=1-A := by87    simp only [Matrix.sub_mul, Matrix.mul_sub, Matrix.one_mul, Matrix.mul_one, hAA]88    abel89  have hstar : ((1 : Matrix ι ι ℂ)-A).conjTranspose=1-A := by90    simp only [Matrix.conjTranspose_sub, Matrix.conjTranspose_one, hA.eq]91  rw [Matrix.conjTranspose_mul, hstar]92  calc93    ((((1 : Matrix ι ι ℂ)-A)*X)*(X.conjTranspose*((1 : Matrix ι ι ℂ)-A))).trace =94        ((((1 : Matrix ι ι ℂ)-A)*(X*X.conjTranspose))*((1 : Matrix ι ι ℂ)-A)).trace := by95      simp only [Matrix.mul_assoc]96    _ = ((((1 : Matrix ι ι ℂ)-A)*((1 : Matrix ι ι ℂ)-A))*(X*X.conjTranspose)).trace := by97      rw [Matrix.trace_mul_cycle]98    _ = _ := by rw [hQ]99100/-- Gao's bound for actual ordered matrix projections and any rectangular101amplitude, with no dimension or normalization factor. -/102theorem trace_union_bound_amplitude (A : ℕ → Matrix ι ι ℂ)103    (hA : ∀i, (A i).IsHermitian) (hAA : ∀i, A i*A i=A i)104    (X : Matrix ι κ ℂ) (n : ℕ) :105    (X*X.conjTranspose).trace.re -106        (actualProduct A n * (X*X.conjTranspose) * (actualProduct A n).conjTranspose).trace.re ≤107      4 * ∑ i ∈ Finset.range n, ((1-A i)*(X*X.conjTranspose)).trace.re := by108  have h := Finset.sum_le_sum (s := Finset.univ) (fun j _ =>109    Projection.union_bound110      (fun i => Projection.ofMatrix (A i) (hA i) (hAA i)) (amplitudeColumn X j) n)111  have hre (i : ℕ) (j : κ) :112      amplitudeColumn X j - (Projection.ofMatrix (A i) (hA i) (hAA i)).map113        (amplitudeColumn X j) = amplitudeColumn ((1-A i)*X) j :=114    (amplitudeColumn_sub_mul (A i) X j).symm115  simp_rw [hre, matrix_trajectory, ←amplitudeColumn_mul] at h116  rw [Finset.sum_sub_distrib, ←Finset.mul_sum, Finset.sum_comm] at h117  simp_rw [←trace_gram_eq_sum_column_norm_sq] at h118  simp_rw [rejected_gram_trace _ (hA _) (hAA _)] at h119  simpa only [Matrix.conjTranspose_mul, Matrix.mul_assoc] using h120121/-- The trace union bound applies to every positive semidefinite input matrix.122The square root is constructed by continuous functional calculus. -/123theorem trace_union_bound (A : ℕ → Matrix ι ι ℂ)124    (hA : ∀i, (A i).IsHermitian) (hAA : ∀i, A i*A i=A i)125    (ρ : Matrix ι ι ℂ) (hρ : ρ.PosSemidef) (n : ℕ) :126    ρ.trace.re -127        (actualProduct A n * ρ * (actualProduct A n).conjTranspose).trace.re ≤128      4 * ∑ i ∈ Finset.range n, ((1-A i)*ρ).trace.re := by129  have hroot : CFC.sqrt ρ * (CFC.sqrt ρ).conjTranspose = ρ := by130    rw [(Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg ρ)).isHermitian.eq]131    exact CFC.sqrt_mul_sqrt_self ρ hρ.nonneg132  simpa only [hroot] using trace_union_bound_amplitude A hA hAA (CFC.sqrt ρ) n133134end Nonadditivity.QuantumCoding