Documentation

CsdLean4.Mathlib.QuantumInfo.TraceDistance

Trace norm and trace distance (K3 foundation) #

Category: 1-Mathlib (CSD-free; staged as a Mathlib-upstream candidate).

The trace norm of a Hermitian matrix and the trace distance of two states, the metric of statistical distinguishability:

traceNorm A = ∑ᵢ |λᵢ(A)| (sum of absolute eigenvalues = Tr|A| for Hermitian A), traceDist ρ σ = ½ · traceNorm (ρ − σ).

This is the K3 metric-core tranche (K3 of specs/qi-qec-roadmap.md). It delivers the definitions and the complete metric:

The posPart/negPart/posProj Jordan primitives and the IsHermitian.cfc algebra layer are exposed as named QuantumInfo declarations: they recur in the next K3 tranche.

The CPTP data-processing inequality traceDist (Φρ) (Φσ) ≤ traceDist ρ σ (channels cannot increase distinguishability) builds on this file's posPart/posProj machinery and the key bound re_trace_mul_le_re_trace_posPart (the variational half Re Tr((ρ−σ)·P) ≤ Re Tr((ρ−σ)₊), achieved at P = posProj (ρ−σ)); it is proved in DataProcessing.lean (channel_traceDist_le, done 2026-06-09) via the channel adjoint. So K3 (metric + data-processing) is complete.

noncomputable def QuantumInfo.traceNorm {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

The trace norm of a Hermitian matrix, ‖A‖₁ = ∑ᵢ |λᵢ(A)| = Tr|A|: the sum of the absolute values of its (real) eigenvalues.

Equations
Instances For
    noncomputable def QuantumInfo.traceDist {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ : Matrix n n } (h : (ρ - σ).IsHermitian) :

    The trace distance D(ρ,σ) = ½‖ρ − σ‖₁: the metric of statistical distinguishability.

    Equations
    Instances For
      theorem QuantumInfo.traceNorm_nonneg {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

      The trace norm is non-negative.

      theorem QuantumInfo.traceDist_nonneg {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ : Matrix n n } (h : (ρ - σ).IsHermitian) :

      The trace distance is non-negative.

      theorem QuantumInfo.traceNorm_eq_zero_iff {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
      traceNorm hA = 0 A = 0

      The trace norm vanishes iff the matrix is zero. From ∑ᵢ |λᵢ| = 0 ↔ all λᵢ = 0 and IsHermitian.eigenvalues_eq_zero_iff.

      theorem QuantumInfo.traceDist_eq_zero_iff {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ : Matrix n n } (h : (ρ - σ).IsHermitian) :
      traceDist h = 0 ρ = σ

      Distinguishability headline: zero trace distance iff the states coincide. traceDist ρ σ = 0 ↔ ρ = σ.

      @[simp]
      theorem QuantumInfo.traceDist_self {n : Type u_1} [Fintype n] [DecidableEq n] {ρ : Matrix n n } (h : (ρ - ρ).IsHermitian) :

      The trace distance of a state to itself is zero.

      theorem QuantumInfo.re_trace_cfc {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f : ) :
      RCLike.re (cfc f A).trace = i : n, f (hA.eigenvalues i)

      Bridge to the functional calculus: traceNorm A = Re Tr(cfc |·| A) = Re Tr|A|. The Hermitian functional calculus cfc |·| A = U · diag(|λᵢ|) · Uᴴ, whose trace is ∑ᵢ |λᵢ| by cyclicity of the trace and unitarity. This identifies the eigenvalue-sum definition with the operator absolute value, the form on which cfc_comp_neg acts.

      theorem QuantumInfo.traceNorm_congr {n : Type u_1} [Fintype n] [DecidableEq n] {A B : Matrix n n } (hA : A.IsHermitian) (hB : B.IsHermitian) (hAB : A = B) :

      Helper: traceNorm depends only on the underlying matrix (transport along A = B).

      theorem QuantumInfo.traceDist_congr {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ ρ' σ' : Matrix n n } (h : (ρ - σ).IsHermitian) (h' : (ρ' - σ').IsHermitian) (heq : ρ - σ = ρ' - σ') :

      Helper: traceDist depends only on the underlying difference matrix (transport along the equality ρ − σ = ρ' − σ').

      theorem QuantumInfo.traceNorm_neg {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

      The trace norm is invariant under negation: traceNorm (−A) = traceNorm A. Via the functional-calculus bridge and cfc_comp_neg (|−x| = |x|).

      theorem QuantumInfo.traceDist_comm {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ : Matrix n n } (h : (ρ - σ).IsHermitian) (h' : (σ - ρ).IsHermitian) :

      Symmetry of the trace distance: traceDist ρ σ = traceDist σ ρ.

      The trace norm of a positive-semidefinite operator is its trace. Since a PSD operator has non-negative eigenvalues, ∑ᵢ |λᵢ| = ∑ᵢ λᵢ = Tr A. In particular a density operator (PSD, unit trace) has trace norm 1.

      Trace-norm subadditivity (the triangle inequality) #

      The route follows specs/trace-distance-triangle-plan.md: a Jordan decomposition of a Hermitian matrix into positive/negative parts via the Hermitian functional calculus Matrix.IsHermitian.cfc f = U · diag(↑∘f∘λ) · Uᴴ (defined for any f : ℝ → ℝ, so the discontinuous positive-eigenspace projector is admissible), plus the linchpin tr_psd_mul_nonneg : 0 ≤ Re Tr(S·P) for S, P positive-semidefinite.

      theorem QuantumInfo.cfc_isHermitian {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f : ) :

      IsHermitian.cfc f is Hermitian. U · diag(↑∘f∘λ) · Uᴴ is self-adjoint because the diagonal of real values is.

      theorem QuantumInfo.cfc_mul {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f g : ) :
      hA.cfc f * hA.cfc g = hA.cfc fun (x : ) => f x * g x

      Multiplicativity of IsHermitian.cfc: (hM.cfc f)·(hM.cfc g) = hM.cfc (f·g). The two conjugating unitaries collapse via Uᴴ U = 1 and diagonal_mul_diagonal.

      theorem QuantumInfo.cfc_add {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f g : ) :
      hA.cfc f + hA.cfc g = hA.cfc fun (x : ) => f x + g x

      Additivity of IsHermitian.cfc: (hM.cfc f) + (hM.cfc g) = hM.cfc (f + g) (pointwise sum). Same conjugated-diagonal collapse as cfc_mul, with diagonal_add.

      theorem QuantumInfo.cfc_sub {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f g : ) :
      hA.cfc f - hA.cfc g = hA.cfc fun (x : ) => f x - g x

      Subtractivity of IsHermitian.cfc: (hM.cfc f) − (hM.cfc g) = hM.cfc (f − g).

      theorem QuantumInfo.cfc_zero {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
      (hA.cfc fun (x : ) => 0) = 0

      IsHermitian.cfc (fun _ => 0) = 0.

      theorem QuantumInfo.cfc_neg {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) (f : ) :
      -hA.cfc f = hA.cfc fun (x : ) => -f x

      Negation through IsHermitian.cfc: −(hM.cfc f) = hM.cfc (−f).

      theorem QuantumInfo.cfc_id {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
      hA.cfc id = A

      IsHermitian.cfc id = A: the functional calculus of the identity recovers the operator (the spectral theorem).

      theorem QuantumInfo.cfc_posSemidef {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) {g : } (hg : ∀ (x : ), 0 g x) :

      IsHermitian.cfc of a pointwise non-negative function is positive-semidefinite: U · diag(↑∘g∘λ) · Uᴴ with g ∘ λ ≥ 0.

      theorem QuantumInfo.tr_psd_mul_nonneg {n : Type u_1} [Fintype n] [DecidableEq n] {S P : Matrix n n } (hS : S.PosSemidef) (hP : P.PosSemidef) :

      The linchpin (TR-PSD): for positive-semidefinite S, P, 0 ≤ Re Tr(S·P). Route: √S := S.cfc Real.sqrt is Hermitian with √S·√S = S (PSD eigenvalues), so Tr(S·P) = Tr(√S·P·(√S)ᴴ) by trace cyclicity, and √S·P·(√S)ᴴ is PSD with non-negative trace.

      noncomputable def QuantumInfo.posPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

      The positive part of a Hermitian matrix, A₊ = U · diag(λᵢ⁺) · Uᴴ with λ⁺ = max λ 0. Reusable Jordan-decomposition primitive.

      Equations
      Instances For
        noncomputable def QuantumInfo.negPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

        The negative part of a Hermitian matrix, A₋ = U · diag(λᵢ⁻) · Uᴴ with λ⁻ = max (−λ) 0, so that A = A₊ − A₋ and |A| = A₊ + A₋.

        Equations
        Instances For
          noncomputable def QuantumInfo.posProj {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :

          The positive-eigenspace projector P₊ = U · diag(1_{λᵢ>0}) · Uᴴ. Discontinuous, hence built through IsHermitian.cfc (admissible for any f), never generic cfc.

          Equations
          Instances For
            theorem QuantumInfo.cfc_one {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            (hA.cfc fun (x : ) => 1) = 1

            IsHermitian.cfc (fun _ => 1) = 1.

            1 − P₊ is positive-semidefinite: it equals hA.cfc (1_{x ≤ 0}), a non-negative cfc.

            theorem QuantumInfo.mul_posProj_eq_posPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            A * posProj hA = posPart hA

            H · P₊ = H₊ (the positive part as H times its positive-eigenspace projector): pointwise x · 1_{x>0} = max x 0.

            theorem QuantumInfo.posPart_add_negPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            posPart hA + negPart hA = hA.cfc fun (x : ) => |x|

            H₊ + H₋ = |H| (the absolute value via the functional calculus): pointwise max x 0 + max (−x) 0 = |x|.

            theorem QuantumInfo.posPart_sub_negPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            posPart hA - negPart hA = A

            H₊ − H₋ = H (Jordan decomposition): pointwise max x 0 − max (−x) 0 = x.

            theorem QuantumInfo.re_trace_posPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            RCLike.re (posPart hA).trace = i : n, max (hA.eigenvalues i) 0

            The trace of H₊ is real and equals ∑ᵢ λᵢ⁺; combined with the matching H₋ fact, traceNorm = Re Tr(H₊) + Re Tr(H₋).

            theorem QuantumInfo.re_trace_negPart {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n } (hA : A.IsHermitian) :
            RCLike.re (negPart hA).trace = i : n, max (-hA.eigenvalues i) 0

            L5: traceNorm H = Re Tr(H₊) + Re Tr(H₋) — the trace norm as the sum of the traces of the two Jordan parts (∑ |λᵢ| = ∑ λᵢ⁺ + ∑ λᵢ⁻).

            theorem QuantumInfo.re_trace_mul_le_re_trace_posPart {n : Type u_1} [Fintype n] [DecidableEq n] {A P : Matrix n n } (hA : A.IsHermitian) (hP : P.PosSemidef) (hP' : (1 - P).PosSemidef) :

            L6 (key bound): for Hermitian A and P with both P and 1 − P positive- semidefinite, Re Tr(A·P) ≤ Re Tr(A₊). Write A = A₊ − A₋; then Tr(A·P) = Tr(A₊·P) − Tr(A₋·P) ≤ Tr(A₊·P) ≤ Tr(A₊) by tr_psd_mul_nonneg twice (Tr(A₋·P) ≥ 0, Tr(A₊·(1−P)) ≥ 0).

            L7: for Hermitian A, B and H = A + B, Re Tr(H₊) ≤ Re Tr(A₊) + Re Tr(B₊). Use Tr(H₊) = Tr(H·P₊) = Tr(A·P₊) + Tr(B·P₊) and the key bound L6 on each summand with P = P₊(H) (which has P₊, 1 − P₊ both PSD).

            L6 (negative-part key bound): for Hermitian A and P with P, 1 − P PSD, −Re Tr(A₋) ≤ Re Tr(A·P). From Tr(A·P) = Tr(A₊·P) − Tr(A₋·P) ≥ 0 − Tr(A₋) = −Tr(A₋) (Tr(A₊·P) ≥ 0, Tr(A₋·(1−P)) ≥ 0).

            H · P₋ = −H₋ where P₋ = 1 − P₊ is the non-positive-eigenspace projector: pointwise x · (1 − 1_{x>0}) = x · 1_{x≤0} = −max(−x) 0.

            L7 (negative part): Re Tr(H₋) ≤ Re Tr(A₋) + Re Tr(B₋) for H = A + B.

            theorem QuantumInfo.traceNorm_add_le {n : Type u_1} [Fintype n] [DecidableEq n] {A B : Matrix n n } (hA : A.IsHermitian) (hB : B.IsHermitian) :

            L8: trace-norm subadditivity ‖A + B‖₁ ≤ ‖A‖₁ + ‖B‖₁ for Hermitian A, B. Splits traceNorm = Re Tr(·₊) + Re Tr(·₋) and bounds each part by L7 (posPart) and its negative-part counterpart.

            theorem QuantumInfo.traceDist_triangle {n : Type u_1} [Fintype n] [DecidableEq n] {ρ σ τ : Matrix n n } (hρτ : (ρ - τ).IsHermitian) (hρσ : (ρ - σ).IsHermitian) (hστ : (σ - τ).IsHermitian) :
            traceDist hρτ traceDist hρσ + traceDist hστ

            L9: the trace-distance triangle inequality D(ρ,τ) ≤ D(ρ,σ) + D(σ,τ) — completing the metric. From traceNorm subadditivity on ρ − τ = (ρ − σ) + (σ − τ) and D = ½‖·‖₁.