Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.Channels

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

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

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

87 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.Entropy7import Mathlib.Data.Matrix.Basic8import Mathlib.LinearAlgebra.Matrix.Kronecker910/-!11# Concrete finite-dimensional channels1213Channels are finite rectangular Kraus families satisfying the actual matrix14completeness equation. Positivity, trace preservation, ancilla positivity,15composition, tensor products and conjugate channels are proved from that data.16No abstract channel-property hypotheses are used to establish these facts.17-/1819noncomputable section2021namespace Nonadditivity.Channels2223open scoped BigOperators ComplexOrder ComplexConjugate Kronecker Matrix24open Nonadditivity.Entropy2526variable {ι ο κ μ ν η : Type*}2728/-- A finite Kraus realization of a completely positive trace-preserving map. -/29structure KrausChannel (ι ο κ : Type*) [Fintype ι] [DecidableEq ι]30    [Fintype ο] [Fintype κ] where31  kraus : κ → Matrix ο ι ℂ32  complete : ∑ k, (kraus k).conjTranspose * kraus k = 13334namespace KrausChannel3536variable [Fintype ι] [DecidableEq ι] [Fintype ο] [Fintype κ]3738/-- The Schrödinger map is the finite Kraus sum. -/39def map (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ) : Matrix ο ο ℂ :=40  ∑ k, T.kraus k * X * (T.kraus k).conjTranspose4142@[simp] theorem map_add (T : KrausChannel ι ο κ) (X Y : Matrix ι ι ℂ) :43    T.map (X + Y) = T.map X + T.map Y := by44  simp [map, Matrix.mul_add, Matrix.add_mul, Finset.sum_add_distrib]4546@[simp] theorem map_smul (T : KrausChannel ι ο κ) (c : ℂ) (X : Matrix ι ι ℂ) :47    T.map (c • X) = c • T.map X := by48  simp [map, Matrix.mul_smul, Matrix.smul_mul, Finset.smul_sum]4950@[simp] theorem map_zero (T : KrausChannel ι ο κ) : T.map 0 = 0 := by simp [map]5152/-- The Kraus map as an actual complex linear map. -/53def linearMap (T : KrausChannel ι ο κ) : Matrix ι ι ℂ →ₗ[ℂ] Matrix ο ο ℂ where54  toFun := T.map55  map_add' := T.map_add56  map_smul' := T.map_smul5758/-- Positivity is derived from the Kraus matrices by congruence. -/59theorem map_posSemidef (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ)60    (hX : X.PosSemidef) : (T.map X).PosSemidef := by61  exact Matrix.posSemidef_sum Finset.univ (fun k _ =>62    hX.mul_mul_conjTranspose_same (T.kraus k))6364/-- Trace preservation holds for every input matrix. -/65@[simp] theorem trace_map (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ) :66    (T.map X).trace = X.trace := by67  calc68    (T.map X).trace = ∑ k, (X * ((T.kraus k).conjTranspose * T.kraus k)).trace := by69      simp only [map, Matrix.trace_sum]70      apply Finset.sum_congr rfl71      intro k _72      rw [Matrix.trace_mul_cycle, Matrix.trace_mul_comm]73    _ = (X * (∑ k, (T.kraus k).conjTranspose * T.kraus k)).trace := by74      rw [Matrix.mul_sum, Matrix.trace_sum]75    _ = X.trace := by rw [T.complete, Matrix.mul_one]7677/-- Applying a concrete channel produces a concrete density matrix. -/78def output [DecidableEq ο] (T : KrausChannel ι ο κ) (ρ : DensityMatrix ι) :79    DensityMatrix ο where80  matrix := T.map ρ.matrix81  positive := T.map_posSemidef ρ.matrix ρ.positive82  normalized := (T.trace_map ρ.matrix).trans ρ.normalized8384@[simp] theorem output_matrix [DecidableEq ο] (T : KrausChannel ι ο κ)85    (ρ : DensityMatrix ι) : (T.output ρ).matrix = T.map ρ.matrix := rfl8687/-- A single identity Kraus operator. -/88def identity : KrausChannel ι ι Unit where89  kraus := fun _ => 190  complete := by simp9192@[simp] theorem identity_map (X : Matrix ι ι ℂ) :93    (identity : KrausChannel ι ι Unit).map X = X := by simp [identity, map]9495/-- A single unitary Kraus operator. -/96def unitaryChannel (U : unitary (Matrix ι ι ℂ)) : KrausChannel ι ι Unit where97  kraus := fun _ => U98  complete := by simp [← Matrix.star_eq_conjTranspose]99100@[simp] theorem unitaryChannel_map (U : unitary (Matrix ι ι ℂ)) (X : Matrix ι ι ℂ) :101    (unitaryChannel U).map X = (U : Matrix ι ι ℂ) * X * (U : Matrix ι ι ℂ).conjTranspose := by102  simp [unitaryChannel, map]103104/-- The Hilbert–Schmidt adjoint channel on observables. -/105def adjointMap (T : KrausChannel ι ο κ) (Y : Matrix ο ο ℂ) : Matrix ι ι ℂ :=106  ∑ k, (T.kraus k).conjTranspose * Y * T.kraus k107108@[simp] theorem adjointMap_add (T : KrausChannel ι ο κ) (X Y : Matrix ο ο ℂ) :109    T.adjointMap (X + Y) = T.adjointMap X + T.adjointMap Y := by110  simp [adjointMap, Matrix.mul_add, Matrix.add_mul, Finset.sum_add_distrib]111112@[simp] theorem adjointMap_smul (T : KrausChannel ι ο κ) (c : ℂ) (X : Matrix ο ο ℂ) :113    T.adjointMap (c • X) = c • T.adjointMap X := by114  simp [adjointMap, Matrix.mul_smul, Matrix.smul_mul, Finset.smul_sum]115116/-- The adjoint on observables as an actual complex linear map. -/117def adjointLinearMap (T : KrausChannel ι ο κ) : Matrix ο ο ℂ →ₗ[ℂ] Matrix ι ι ℂ where118  toFun := T.adjointMap119  map_add' := T.adjointMap_add120  map_smul' := T.adjointMap_smul121122/-- The adjoint preserves Hermitian observables, including nonpositive ones. -/123theorem adjointMap_isHermitian (T : KrausChannel ι ο κ) (Y : Matrix ο ο ℂ)124    (hY : Y.IsHermitian) : (T.adjointMap Y).IsHermitian := by125  change Y.conjTranspose = Y at hY126  unfold Matrix.IsHermitian adjointMap127  simp only [Matrix.conjTranspose_sum, Matrix.conjTranspose_mul,128    Matrix.conjTranspose_conjTranspose, hY, Matrix.mul_assoc]129130/-- Positivity of the channel adjoint is also derived from its Kraus operators. -/131theorem adjointMap_posSemidef (T : KrausChannel ι ο κ) (Y : Matrix ο ο ℂ)132    (hY : Y.PosSemidef) : (T.adjointMap Y).PosSemidef := by133  exact Matrix.posSemidef_sum Finset.univ (fun k _ =>134    hY.conjTranspose_mul_mul_same (T.kraus k))135136@[simp] theorem adjointMap_one [DecidableEq ο] (T : KrausChannel ι ο κ) :137    T.adjointMap 1 = 1 := by simp [adjointMap, T.complete]138139/-- The defining trace duality is proved directly, including rectangular Kraus operators. -/140theorem trace_duality (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ) (Y : Matrix ο ο ℂ) :141    (T.map X * Y).trace = (X * T.adjointMap Y).trace := by142  simp only [map, adjointMap, Matrix.sum_mul, Matrix.mul_sum, Matrix.trace_sum]143  apply Finset.sum_congr rfl144  intro k _145  calc146    ((T.kraus k * X * (T.kraus k).conjTranspose) * Y).trace =147        (T.kraus k * (X * (T.kraus k).conjTranspose * Y)).trace := by148      simp only [Matrix.mul_assoc]149    _ = ((X * (T.kraus k).conjTranspose * Y) * T.kraus k).trace :=150      Matrix.trace_mul_comm _ _151    _ = (X * ((T.kraus k).conjTranspose * Y * T.kraus k)).trace := by152      simp only [Matrix.mul_assoc]153154/-- A random unitary channel with any genuine probability distribution. -/155def randomUnitary (p : κ → ℝ) (hp : ∀ k, 0 ≤ p k) (hsum : ∑ k, p k = 1)156    (U : κ → unitary (Matrix ι ι ℂ)) : KrausChannel ι ι κ where157  kraus := fun k => (Real.sqrt (p k) : ℂ) • (U k : Matrix ι ι ℂ)158  complete := by159    have hTerm (k : κ) :160        ((Real.sqrt (p k) : ℂ) • (U k : Matrix ι ι ℂ)).conjTranspose *161          ((Real.sqrt (p k) : ℂ) • (U k : Matrix ι ι ℂ)) = (p k : ℂ) • (1 : Matrix ι ι ℂ) := by162      simp only [Matrix.conjTranspose_smul, Matrix.smul_mul, Matrix.mul_smul, smul_smul]163      rw [← Matrix.star_eq_conjTranspose]164      simp [← Complex.ofReal_mul, Real.mul_self_sqrt (hp k)]165    simp_rw [hTerm]166    rw [← Finset.sum_smul]167    have hSum : ∑ k, (p k : ℂ) = 1 := by exact_mod_cast hsum168    rw [hSum, one_smul]169170/-- The random-unitary channel's map is the advertised convex combination. -/171theorem randomUnitary_map (p : κ → ℝ) (hp : ∀ k, 0 ≤ p k)172    (hsum : ∑ k, p k = 1) (U : κ → unitary (Matrix ι ι ℂ)) (X : Matrix ι ι ℂ) :173    (randomUnitary p hp hsum U).map X =174      ∑ k, (p k : ℂ) • ((U k : Matrix ι ι ℂ) * X * (U k : Matrix ι ι ℂ).conjTranspose) := by175  simp only [map, randomUnitary]176  apply Finset.sum_congr rfl177  intro k _178  simp only [Matrix.conjTranspose_smul, Matrix.smul_mul, Matrix.mul_smul, smul_smul]179  simp [← Complex.ofReal_mul, Real.mul_self_sqrt (hp k)]180181/-- Uniform mixing of an arbitrary nonempty finite unitary family. -/182def uniformUnitary [Nonempty κ] (U : κ → unitary (Matrix ι ι ℂ)) :183    KrausChannel ι ι κ :=184  randomUnitary (fun _ => 1 / (Fintype.card κ : ℝ)) (fun _ => by positivity)185    (by simp [Fintype.card_ne_zero]) U186187/-- The complementary channel swaps the output and environment coordinates188of the Stinespring Kraus tensor. -/189def complementary (T : KrausChannel ι ο κ) : KrausChannel ι κ ο where190  kraus := fun b e a => T.kraus e b a191  complete := by192    ext i j193    have h := congrArg (fun M : Matrix ι ι ℂ => M i j) T.complete194    simp only [Matrix.sum_apply, Matrix.mul_apply, Matrix.conjTranspose_apply] at h ⊢195    rw [Finset.sum_comm]196    exact h197198/-- The environment output entries are the overlaps of the Kraus branches. -/199theorem complementary_map_entry (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ)200    (e f : κ) :201    (T.complementary.map X) e f =202      (T.kraus e * X * (T.kraus f).conjTranspose).trace := by203  simp only [map, complementary, Matrix.trace, Matrix.diag, Matrix.mul_apply,204    Matrix.conjTranspose_apply, Matrix.sum_apply]205206/-- A trace-preserving isometric embedding, with one rectangular Kraus operator. -/207def isometryChannel (V : Matrix ο ι ℂ) (hV : V.conjTranspose * V = 1) :208    KrausChannel ι ο Unit where209  kraus := fun _ => V210  complete := by simpa using hV211212/-- The actual Stinespring isometry, retaining both output and environment indices. -/213def stinespring (T : KrausChannel ι ο κ) : Matrix (ο × κ) ι ℂ :=214  fun z a => T.kraus z.2 z.1 a215216/-- Kraus completeness proves the Stinespring matrix is isometric. -/217theorem stinespring_isometry (T : KrausChannel ι ο κ) :218    T.stinespring.conjTranspose * T.stinespring = 1 := by219  ext i j220  have h := congrArg (fun M : Matrix ι ι ℂ => M i j) T.complete221  simp only [Matrix.sum_apply, Matrix.mul_apply, Matrix.conjTranspose_apply] at h222  simp only [stinespring, Matrix.mul_apply, Matrix.conjTranspose_apply, Fintype.sum_prod_type]223  rw [Finset.sum_comm]224  exact h225226/-- A genuine joint-output channel, before either subsystem is traced out. -/227def stinespringChannel (T : KrausChannel ι ο κ) : KrausChannel ι (ο × κ) Unit :=228  isometryChannel T.stinespring T.stinespring_isometry229230@[simp] theorem stinespringChannel_map (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ) :231    T.stinespringChannel.map X = T.stinespring * X * T.stinespring.conjTranspose := by232  simp [stinespringChannel, isometryChannel, map]233234/-- Tracing out the environment of the joint channel gives the original channel. -/235theorem stinespring_partialTrace_environment (T : KrausChannel ι ο κ)236    (X : Matrix ι ι ℂ) (b c : ο) :237    (∑ e, (T.stinespringChannel.map X) (b,e) (c,e)) = T.map X b c := by238  simp [stinespringChannel, isometryChannel, stinespring, map, Matrix.sum_apply,239    Matrix.mul_apply, Matrix.conjTranspose_apply]240241/-- Tracing out the output of the same joint channel gives the complementary channel. -/242theorem stinespring_partialTrace_output (T : KrausChannel ι ο κ)243    (X : Matrix ι ι ℂ) (e f : κ) :244    (∑ b, (T.stinespringChannel.map X) (b,e) (b,f)) = T.complementary.map X e f := by245  simp [stinespringChannel, isometryChannel, stinespring, map, complementary,246    Matrix.sum_apply, Matrix.mul_apply, Matrix.conjTranspose_apply]247248end KrausChannel249250section Operations251252variable [Fintype ι] [DecidableEq ι] [Fintype ο] [DecidableEq ο]253variable [Fintype κ] [Fintype μ] [DecidableEq μ] [Fintype ν] [Fintype η]254255namespace KrausChannel256257/-- Compose two channels by multiplying their Kraus operators. -/258def comp (S : KrausChannel ο μ η) (T : KrausChannel ι ο κ) :259    KrausChannel ι μ (κ × η) where260  kraus := fun z => S.kraus z.2 * T.kraus z.1261  complete := by262    simp only [Matrix.conjTranspose_mul, Fintype.sum_prod_type]263    calc264      (∑ k, ∑ l, (T.kraus k).conjTranspose * (S.kraus l).conjTranspose *265          (S.kraus l * T.kraus k)) =266          ∑ k, (T.kraus k).conjTranspose *267            (∑ l, (S.kraus l).conjTranspose * S.kraus l) * T.kraus k := by268        simp only [Matrix.mul_sum, Matrix.sum_mul, Matrix.mul_assoc]269      _ = 1 := by simp [S.complete, T.complete]270271omit [DecidableEq μ] in272theorem comp_map (S : KrausChannel ο μ η) (T : KrausChannel ι ο κ)273    (X : Matrix ι ι ℂ) : (S.comp T).map X = S.map (T.map X) := by274  simp only [map, comp, Matrix.conjTranspose_mul, Fintype.sum_prod_type,275    Matrix.mul_sum, Matrix.sum_mul]276  rw [Finset.sum_comm]277  simp only [Matrix.mul_assoc]278279/-- Tensor channels use the Kronecker products of their Kraus operators. -/280def tensor (T : KrausChannel ι ο κ) (S : KrausChannel μ ν η) :281    KrausChannel (ι × μ) (ο × ν) (κ × η) where282  kraus := fun z => T.kraus z.1 ⊗ₖ S.kraus z.2283  complete := by284    simp only [Matrix.conjTranspose_kronecker, ← Matrix.mul_kronecker_mul,285      Fintype.sum_prod_type]286    calc287      (∑ k, ∑ l, ((T.kraus k).conjTranspose * T.kraus k) ⊗ₖ288        ((S.kraus l).conjTranspose * S.kraus l)) =289          (∑ k, (T.kraus k).conjTranspose * T.kraus k) ⊗ₖ290            (∑ l, (S.kraus l).conjTranspose * S.kraus l) := by291        ext ⟨a,b⟩ ⟨c,d⟩292        simp only [Matrix.sum_apply, Matrix.kroneckerMap_apply, Finset.mul_sum, Finset.sum_mul]293        rw [Finset.sum_comm]294      _ = 1 := by rw [T.complete, S.complete, Matrix.one_kronecker_one]295296omit [DecidableEq ο] in297/-- Tensor channels map product inputs to product outputs. -/298theorem tensor_map (T : KrausChannel ι ο κ) (S : KrausChannel μ ν η)299    (X : Matrix ι ι ℂ) (Y : Matrix μ μ ℂ) :300    (T.tensor S).map (X ⊗ₖ Y) = T.map X ⊗ₖ S.map Y := by301  simp only [map, tensor, Matrix.conjTranspose_kronecker, ← Matrix.mul_kronecker_mul,302    Fintype.sum_prod_type]303  ext ⟨a,b⟩ ⟨c,d⟩304  simp only [Matrix.sum_apply, Matrix.kroneckerMap_apply, Finset.mul_sum, Finset.sum_mul]305  rw [Finset.sum_comm]306307/-- An arbitrary finite ancilla is the tensor product with the identity channel. -/308def amplify (T : KrausChannel ι ο κ) (a : Type*) [Fintype a] [DecidableEq a] :309    KrausChannel (a × ι) (a × ο) (Unit × κ) := identity.tensor T310311omit [DecidableEq ο] in312/-- Complete positivity: every finite ancilla amplification preserves positivity. -/313theorem amplify_posSemidef (T : KrausChannel ι ο κ) (a : Type*)314    [Fintype a] [DecidableEq a] (X : Matrix (a × ι) (a × ι) ℂ)315    (hX : X.PosSemidef) : ((T.amplify a).map X).PosSemidef :=316  (T.amplify a).map_posSemidef X hX317318/-- Complex conjugation of every Kraus operator. -/319def conjugate (T : KrausChannel ι ο κ) : KrausChannel ι ο κ where320  kraus := fun k => (T.kraus k).map star321  complete := by322    have h := congrArg (fun M : Matrix ι ι ℂ => M.map star) T.complete323    ext i j324    have hij := congrArg (fun M : Matrix ι ι ℂ => M i j) h325    simpa [Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.map_apply, Matrix.one_apply,326      Matrix.sum_apply, map_sum, mul_comm] using hij327328omit [DecidableEq ο] in329/-- Conjugating both a channel and its input conjugates the output. -/330theorem conjugate_map (T : KrausChannel ι ο κ) (X : Matrix ι ι ℂ) :331    T.conjugate.map (X.map star) = (T.map X).map star := by332  ext i j333  simp [map, conjugate, Matrix.mul_apply, Matrix.conjTranspose_apply,334    Matrix.map_apply, Matrix.sum_apply, map_sum, mul_comm]335336end KrausChannel337end Operations338339end Nonadditivity.Channels