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
Nonadditivity.QuantumCodingContinuity.entry_norm_product_sum_leNonadditivity.QuantumCodingContinuity.hsNormNonadditivity.QuantumCodingContinuity.hsNorm.eq_1internal/detail/privateNonadditivity.QuantumCodingContinuity.hsNorm_nonnegNonadditivity.QuantumCodingContinuity.hsNorm_sqNonadditivity.QuantumCodingContinuity.hsNorm_sub_sqNonadditivity.QuantumCodingContinuity.hsNorm_unitaryNonadditivity.QuantumCodingContinuity.sum_abs_diagonal_gram_sub_leNonadditivity.QuantumCodingContinuity.traceDistance_gentle_projectionNonadditivity.QuantumCodingContinuity.traceDistance_le_hsNorm_of_gramNonadditivity.QuantumCodingContinuity.traceDistance_le_hsNorm_of_gram._simp_1_1internal/detail/privateNonadditivity.QuantumCodingContinuity.traceDistance_le_hsNorm_of_gram._simp_1_2internal/detail/privateNonadditivity.QuantumCodingContinuity.weighted_mean_gentle_bound_private.Nonadditivity.QuantumCodingGentle.0.Nonadditivity.QuantumCodingContinuity.abs_normSq_sub_leinternal/detail/private
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 := by26rw [hsNorm, Real.sq_sqrt (by positivity)]27simp [Matrix.trace, Matrix.mul_apply, Matrix.conjTranspose_apply, Complex.mul_conj,28Complex.normSq_eq_norm_sq, -Complex.ofReal_pow]2930theorem hsNorm_unitary (U : unitary (Matrix ι ι ℂ)) (X : Matrix ι κ ℂ) :31hsNorm ((U : Matrix ι ι ℂ) * X) = hsNorm X := by32have hsq : hsNorm ((U : Matrix ι ι ℂ) * X) ^ 2 = hsNorm X ^ 2 := by33rw [hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_mul]34change (((U : Matrix ι ι ℂ) * X) * (Xᴴ * (star U : Matrix ι ι ℂ))).trace.re = _35have hm : ((U : Matrix ι ι ℂ) * X) * (Xᴴ * (star U : Matrix ι ι ℂ)) =36(U : Matrix ι ι ℂ) * (X * Xᴴ) * (star U : Matrix ι ι ℂ) := by37simp only [Matrix.mul_assoc]38rw [hm, Matrix.trace_mul_cycle, Unitary.coe_star_mul_self, Matrix.one_mul]39nlinarith [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 := by44simpa only [hsNorm, Fintype.sum_prod_type] using45Real.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‖) := by50rw [Complex.normSq_eq_norm_sq, Complex.normSq_eq_norm_sq]51have hfact : ‖x‖ ^ 2 - ‖y‖ ^ 2 = (‖x‖ - ‖y‖) * (‖x‖ + ‖y‖) := by ring52rw [hfact, abs_mul, abs_of_nonneg (add_nonneg (norm_nonneg _) (norm_nonneg _))]53exact 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|) ≤59hsNorm (X - Y) * (hsNorm X + hsNorm Y) := by60have he (i : ι) : ((X * Xᴴ - Y * Yᴴ) i i).re =61∑ j, (Complex.normSq (X i j) - Complex.normSq (Y i j)) := by62simp [Matrix.mul_apply, Matrix.conjTranspose_apply, Complex.mul_conj,63Finset.sum_sub_distrib]64simp_rw [he]65calc66_ ≤ ∑ i, ∑ j, |Complex.normSq (X i j) - Complex.normSq (Y i j)| :=67Finset.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‖) :=69Finset.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‖) := by72simp only [Matrix.sub_apply, mul_add, Finset.sum_add_distrib]73_ ≤ hsNorm (X - Y) * hsNorm X + hsNorm (X - Y) * hsNorm Y :=74add_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ᴴ) :80traceDistance ρ σ ≤ hsNorm (X - Y) := by81let U := star (differenceHermitian ρ σ).eigenvectorUnitary82have hd : (U : Matrix ι ι ℂ) * (ρ.matrix - σ.matrix) * (star U : Matrix ι ι ℂ) =83Matrix.diagonal (fun i => ((differenceHermitian ρ σ).eigenvalues i : ℂ)) :=84(differenceHermitian ρ σ).conjStarAlgAut_star_eigenvectorUnitary85have hg : ((U : Matrix ι ι ℂ) * X) * ((U : Matrix ι ι ℂ) * X)ᴴ -86((U : Matrix ι ι ℂ) * Y) * ((U : Matrix ι ι ℂ) * Y)ᴴ =87Matrix.diagonal (fun i => ((differenceHermitian ρ σ).eigenvalues i : ℂ)) := by88calc89_ = (U : Matrix ι ι ℂ) * (ρ.matrix - σ.matrix) * (star U : Matrix ι ι ℂ) := by90simp only [hX, hY, Matrix.conjTranspose_mul, Matrix.mul_sub, Matrix.sub_mul,91← Matrix.star_eq_conjTranspose, Matrix.mul_assoc]92_ = _ := hd93have h := sum_abs_diagonal_gram_sub_le ((U : Matrix ι ι ℂ) * X) ((U : Matrix ι ι ℂ) * Y)94rw [hg] at h95simp only [Matrix.diagonal_apply_eq, Complex.ofReal_re, ← Matrix.mul_sub, hsNorm_unitary] at h96have hx : hsNorm X = 1 := by97have hh := hsNorm_sq X98rw [← hX, ρ.normalized, Complex.one_re] at hh99nlinarith [hsNorm_nonneg X]100have hy : hsNorm Y = 1 := by101have hh := hsNorm_sq Y102rw [← hY, σ.normalized, Complex.one_re] at hh103nlinarith [hsNorm_nonneg Y]104rw [hx, hy] at h105unfold traceDistance106linarith107108109omit [DecidableEq ι] in110theorem hsNorm_sub_sq (X Y : Matrix ι κ ℂ) :111hsNorm (X - Y) ^ 2 = hsNorm X ^ 2 + hsNorm Y ^ 2 - 2 * (X * Yᴴ).trace.re := by112have hc : (Y * Xᴴ).trace.re = (X * Yᴴ).trace.re := by113have h := congrArg Complex.re (Matrix.trace_conjTranspose (X * Yᴴ))114simpa only [Matrix.conjTranspose_mul, Matrix.conjTranspose_conjTranspose,115Complex.star_def, Complex.conj_re] using h116rw [hsNorm_sq, hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_sub,117Matrix.mul_sub, Matrix.sub_mul, Matrix.sub_mul]118simp only [Matrix.trace_sub, Complex.sub_re, hc]119ring120121/-- 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)) :129traceDistance ρ τ ≤ Real.sqrt (2 * (1 - s)) := by130let X := CFC.sqrt ρ.matrix131have hXh : X.IsHermitian :=132(Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg ρ.matrix)).isHermitian133have hX : X * Xᴴ = ρ.matrix := by134rw [hXh.eq]135exact CFC.sqrt_mul_sqrt_self ρ.matrix ρ.positive.nonneg136let c : ℂ := ((Real.sqrt s)⁻¹ : ℝ)137let Y := c • (P * X)138have hcstar : star c = c := by simp [c]139have hcsq : c * c = ((s⁻¹ : ℝ) : ℂ) := by140dsimp [c]141rw [← Complex.ofReal_mul]142congr 1143rw [← mul_inv, Real.mul_self_sqrt hs.le]144have hY : Y * Yᴴ = τ.matrix := by145rw [hτ]146change (c • (P * X)) * (c • (P * X))ᴴ = _147rw [Matrix.conjTranspose_smul, hcstar, Matrix.smul_mul, Matrix.mul_smul,148smul_smul, hcsq, Matrix.conjTranspose_mul, hP.eq]149congr 1150calc151(P * X) * (Xᴴ * P) = P * (X * Xᴴ) * P := by simp only [Matrix.mul_assoc]152_ = _ := by rw [hX]153have hx : hsNorm X = 1 := by154have h := hsNorm_sq X155rw [hX, ρ.normalized, Complex.one_re] at h156nlinarith [hsNorm_nonneg X]157have hy : hsNorm Y = 1 := by158have h := hsNorm_sq Y159rw [hY, τ.normalized, Complex.one_re] at h160nlinarith [hsNorm_nonneg Y]161have htr : (ρ.matrix * P).trace.re = s := by162rw [Matrix.trace_mul_cycle, hPP, Matrix.trace_mul_comm] at hprob163exact hprob164have hcross : (X * Yᴴ).trace.re = Real.sqrt s := by165have hm : X * Yᴴ = c • (ρ.matrix * P) := by166change X * (c • (P * X))ᴴ = _167rw [Matrix.conjTranspose_smul, hcstar, Matrix.mul_smul, Matrix.conjTranspose_mul, hP.eq]168congr 1169rw [← Matrix.mul_assoc, hX]170rw [hm, Matrix.trace_smul]171change (c * (ρ.matrix * P).trace).re = _172simp only [c, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, htr]173have hr := Real.sq_sqrt hs.le174have hn := Real.sqrt_pos.mpr hs175apply (inv_mul_eq_iff_eq_mul₀ hn.ne').2176nlinarith177have hnorm : hsNorm (X - Y) ^ 2 = 2 - 2 * Real.sqrt s := by178rw [hsNorm_sub_sq, hx, hy, hcross]179ring180have hroot : s ≤ Real.sqrt s := by181have hsqrt := Real.sq_sqrt hs.le182have hnon := Real.sqrt_nonneg s183nlinarith184have hbound : hsNorm (X - Y) ≤ Real.sqrt (2 * (1 - s)) := by185have hsqrt := Real.sq_sqrt (show 0 ≤ 2 * (1 - s) by linarith)186nlinarith [hsNorm_nonneg (X - Y), Real.sqrt_nonneg (2 * (1 - s))]187exact (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) := by196have 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)198have hprod (j : μ) : Real.sqrt (p j) * (Real.sqrt (p j) * t j) = p j * t j := by199rw [← mul_assoc, Real.mul_self_sqrt (hp j)]200simp only [hprod, mul_pow, Real.sq_sqrt (hp _), hs, one_mul] at hc201have hsq (j : μ) : t j ^ 2 ≤ 2 * e j := by202have hr := Real.sq_sqrt (show 0 ≤ 2 * e j from mul_nonneg (by norm_num) (he j))203nlinarith [hb j, ht j, Real.sqrt_nonneg (2 * e j)]204have hemean : 0 ≤ ∑ j, p j * e j := Finset.sum_nonneg fun j _ => mul_nonneg (hp j) (he j)205have hsum : (∑ j, p j * t j ^ 2) ≤ 2 * ∑ j, p j * e j := by206calc207_ ≤ ∑ 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 _; ring209have hr := Real.sq_sqrt (show 0 ≤ 2 * ∑ j, p j * e j by positivity)210nlinarith [Real.sqrt_nonneg (2 * ∑ j, p j * e j)]211212end Nonadditivity.QuantumCodingContinuity