/- Copyright (c) 2026 Marcel Morgenstern. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marcel Morgenstern -/ module public import OperatorEntropy.DataProcessing.Kraus /-! # Joint convexity of the relative entropy on all states Lieb's theorem `Lieb.relEntropyMat_jointly_convex` is stated for positive-definite matrices. This file extends it to the `EReal`-valued Umegaki relative entropy `relEntropy` on all pairs of density matrices: `D((1-c)ρ₁ + cρ₂ ‖ (1-c)σ₁ + cσ₂) ≤ (1-c) D(ρ₁‖σ₁) + c D(ρ₂‖σ₂)` (`relEntropy_mix_le`), for `c ∈ [0, 1]`, with the convention `0 · ⊤ = 0` of `EReal`. ## Proof 1. Arbitrary first arguments, faithful second arguments (`relEntropyMat_mix_le_of_posDef`): apply Lieb's theorem to `ρᵢ,δ = (1-δ)ρᵢ + δ·𝟙/d` and let `δ → 0⁺`, using the continuity of `M ↦ relEntropyMat M σ` on the density matrices (`Lieb.continuousOn_relEntropyMat_left`). 2. Singular second arguments under the support conditions (`relEntropyReal_mix_le`): apply step 1 to `σᵢ,ε = (1-ε)σᵢ + ε·𝟙/d` and let `ε → 0⁺`; the first-argument terms do not depend on `ε`, and `Tr ρ log σ_ε → Tr ρ log σ` under `supp ρ ⊆ supp σ` (`tendsto_trace_mul_cfc_log_regularize`). 3. If a support condition fails with a positive weight the right-hand side is `⊤`; for the weights `0` and `1` the mixtures are the states themselves. -/ @[expose] public section open Matrix Real Filter Topology open scoped ComplexOrder noncomputable section namespace OperatorEntropy variable {n : Type*} [Fintype n] [DecidableEq n] /-- The matrix of a mixture: `((1-c)ρ + cτ).val = (1-c)•ρ.val + c•τ.val`. -/ theorem DensityMatrix.mix_val (ρ τ : DensityMatrix n) (c : ℝ) (h0 : 0 ≤ c) (h1 : c ≤ 1) : (ρ.mix τ c h0 h1).val = (1 - c) • ρ.val + c • τ.val := rfl /-- A mixture with weight `0` is the first state. -/ theorem DensityMatrix.mix_zero (ρ τ : DensityMatrix n) (h0 : (0 : ℝ) ≤ 0) (h1 : (0 : ℝ) ≤ 1) : ρ.mix τ 0 h0 h1 = ρ := by ext1; simp [DensityMatrix.mix_val] /-- A mixture with weight `1` is the second state. -/ theorem DensityMatrix.mix_one (ρ τ : DensityMatrix n) (h0 : (0 : ℝ) ≤ 1) (h1 : (1 : ℝ) ≤ 1) : ρ.mix τ 1 h0 h1 = τ := by ext1; simp [DensityMatrix.mix_val] /-- The support condition is preserved by mixtures: if `supp ρ₁ ⊆ supp σ₁` and `supp ρ₂ ⊆ supp σ₂`, then `supp((1-c)ρ₁ + cρ₂) ⊆ supp((1-c)σ₁ + cσ₂)`. -/ theorem DensityMatrix.SupportLE.mix {ρ₁ ρ₂ σ₁ σ₂ : DensityMatrix n} (h₁ : ρ₁.SupportLE σ₁) (h₂ : ρ₂.SupportLE σ₂) (c : ℝ) (h0 : 0 ≤ c) (h1 : c ≤ 1) : (ρ₁.mix ρ₂ c h0 h1).SupportLE (σ₁.mix σ₂ c h0 h1) := by intro v hv rw [DensityMatrix.mix_val] at hv ⊢ have hA : ((1 - c) • σ₁.val).PosSemidef := σ₁.posSemidef.smul (by linarith) have hB : (c • σ₂.val).PosSemidef := σ₂.posSemidef.smul h0 have hq : star v ⬝ᵥ (((1 - c) • σ₁.val) *ᵥ v) + star v ⬝ᵥ ((c • σ₂.val) *ᵥ v) = 0 := by rw [← dotProduct_add, ← Matrix.add_mulVec, hv, dotProduct_zero] have hA0 := hA.dotProduct_mulVec_nonneg v have hB0 := hB.dotProduct_mulVec_nonneg v have hAv : ((1 - c) • σ₁.val) *ᵥ v = 0 := hA.dotProduct_mulVec_zero_iff.mp ((add_eq_zero_iff_of_nonneg hA0 hB0).mp hq).1 have hBv : (c • σ₂.val) *ᵥ v = 0 := hB.dotProduct_mulVec_zero_iff.mp ((add_eq_zero_iff_of_nonneg hA0 hB0).mp hq).2 rw [Matrix.smul_mulVec] at hAv hBv rw [Matrix.add_mulVec, Matrix.smul_mulVec, Matrix.smul_mulVec] have e1 : (1 - c) • (ρ₁.val *ᵥ v) = 0 := by rcases eq_or_ne (1 - c) 0 with hc | hc · rw [hc, zero_smul] · rw [h₁ v ((smul_eq_zero.mp hAv).resolve_left hc), smul_zero] have e2 : c • (ρ₂.val *ᵥ v) = 0 := by rcases eq_or_ne c 0 with hc | hc · rw [hc, zero_smul] · rw [h₂ v ((smul_eq_zero.mp hBv).resolve_left hc), smul_zero] rw [e1, e2, add_zero] /-- A density matrix lives on a nonempty index type. -/ theorem DensityMatrix.nonempty (ρ : DensityMatrix n) : Nonempty n := by by_contra hcon rw [not_nonempty_iff] at hcon have ht := ρ.trace_one simp only [Matrix.trace, Matrix.diag_apply, Finset.univ_eq_empty, Finset.sum_empty] at ht exact one_ne_zero ht.symm /-- `relEntropyMat ρ σ = Tr(ρ log ρ) − Tr(ρ log σ)` (real parts). -/ theorem Lieb.relEntropyMat_eq_sub (ρ σ : Matrix n n ℂ) : Lieb.relEntropyMat ρ σ = (ρ * cfc Real.log ρ).trace.re - (ρ * cfc Real.log σ).trace.re := by rw [Lieb.relEntropyMat, mul_sub, Matrix.trace_sub, Complex.sub_re] /-- Along the path `δ ↦ (1-δ)ρ + δτ`, `relEntropyMat (·) σ` tends to `relEntropyMat ρ σ` as `δ → 0⁺`. -/ theorem tendsto_relEntropyMat_mix_left (ρ τ σ : DensityMatrix n) : Tendsto (fun δ : ℝ => Lieb.relEntropyMat ((1 - δ) • ρ.val + δ • τ.val) σ.val) (𝓝[>] (0 : ℝ)) (𝓝 (Lieb.relEntropyMat ρ.val σ.val)) := by have hcont : Continuous (fun δ : ℝ => (1 - δ) • ρ.val + δ • τ.val) := ((continuous_const.sub continuous_id).smul continuous_const).add (continuous_id.smul continuous_const) have hmem : ∀ᶠ δ in 𝓝[>] (0 : ℝ), ((1 - δ) • ρ.val + δ • τ.val) ∈ {M : Matrix n n ℂ | M.PosSemidef ∧ M.trace = 1} := by have h1 : ∀ᶠ δ in 𝓝[>] (0 : ℝ), δ < 1 := nhdsWithin_le_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) filter_upwards [self_mem_nhdsWithin, h1] with δ ha hb exact ⟨(ρ.mix τ δ (le_of_lt ha) hb.le).posSemidef, (ρ.mix τ δ (le_of_lt ha) hb.le).trace_one⟩ have hpath : Tendsto (fun δ : ℝ => (1 - δ) • ρ.val + δ • τ.val) (𝓝[>] (0 : ℝ)) (𝓝[{M : Matrix n n ℂ | M.PosSemidef ∧ M.trace = 1}] ρ.val) := by rw [tendsto_nhdsWithin_iff] refine ⟨?_, hmem⟩ have h := hcont.tendsto 0 simp only [sub_zero, one_smul, zero_smul, add_zero] at h exact h.mono_left nhdsWithin_le_nhds exact ((Lieb.continuousOn_relEntropyMat_left σ).continuousWithinAt ⟨ρ.posSemidef, ρ.trace_one⟩).tendsto.comp hpath /-- **Joint convexity, arbitrary first arguments.** For states `ρ₁, ρ₂` and faithful states `σ₁, σ₂`, and `c ∈ [0, 1]`, `relEntropyMat ((1-c)ρ₁ + cρ₂) ((1-c)σ₁ + cσ₂) ≤ (1-c) relEntropyMat ρ₁ σ₁ + c relEntropyMat ρ₂ σ₂`. -/ theorem relEntropyMat_mix_le_of_posDef (ρ₁ ρ₂ σ₁ σ₂ : DensityMatrix n) (c : ℝ) (h0 : 0 ≤ c) (h1 : c ≤ 1) (hσ₁ : σ₁.val.PosDef) (hσ₂ : σ₂.val.PosDef) : Lieb.relEntropyMat (ρ₁.mix ρ₂ c h0 h1).val (σ₁.mix σ₂ c h0 h1).val ≤ (1 - c) * Lieb.relEntropyMat ρ₁.val σ₁.val + c * Lieb.relEntropyMat ρ₂.val σ₂.val := by have := ρ₁.nonempty set τ : DensityMatrix n := DensityMatrix.maximallyMixed have hτ : τ.val.PosDef := DensityMatrix.maximallyMixed_posDef have hc : (1 - c) ∈ Set.Icc (0 : ℝ) 1 := ⟨by linarith, by linarith⟩ have hineq : ∀ᶠ δ in 𝓝[>] (0 : ℝ), Lieb.relEntropyMat ((1 - δ) • (ρ₁.mix ρ₂ c h0 h1).val + δ • τ.val) (σ₁.mix σ₂ c h0 h1).val ≤ (1 - c) * Lieb.relEntropyMat ((1 - δ) • ρ₁.val + δ • τ.val) σ₁.val + c * Lieb.relEntropyMat ((1 - δ) • ρ₂.val + δ • τ.val) σ₂.val := by have h1' : ∀ᶠ δ in 𝓝[>] (0 : ℝ), δ < 1 := nhdsWithin_le_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) filter_upwards [self_mem_nhdsWithin, h1'] with δ ha hb have hp₁ := mix_posDef (ρ := ρ₁) hτ ha hb.le have hp₂ := mix_posDef (ρ := ρ₂) hτ ha hb.le have h := Lieb.relEntropyMat_jointly_convex _ _ _ _ (1 - c) hc hp₁ hp₂ hσ₁ hσ₂ rw [sub_sub_cancel] at h have e1 : (1 - c) • (ρ₁.mix τ δ ha.le hb.le).val + c • (ρ₂.mix τ δ ha.le hb.le).val = (1 - δ) • (ρ₁.mix ρ₂ c h0 h1).val + δ • τ.val := by simp only [DensityMatrix.mix_val]; module rw [e1] at h exact h refine le_of_tendsto_of_tendsto (tendsto_relEntropyMat_mix_left _ τ _) ?_ hineq exact ((tendsto_relEntropyMat_mix_left ρ₁ τ σ₁).const_mul _).add ((tendsto_relEntropyMat_mix_left ρ₂ τ σ₂).const_mul _) /-- **Joint convexity of the real relative entropy under the support conditions.** For states with `supp ρ₁ ⊆ supp σ₁`, `supp ρ₂ ⊆ supp σ₂` and `c ∈ [0, 1]`, `D((1-c)ρ₁ + cρ₂ ‖ (1-c)σ₁ + cσ₂) ≤ (1-c) D(ρ₁‖σ₁) + c D(ρ₂‖σ₂)` for the real spectral formula. -/ theorem relEntropyReal_mix_le {ρ₁ ρ₂ σ₁ σ₂ : DensityMatrix n} (h₁ : ρ₁.SupportLE σ₁) (h₂ : ρ₂.SupportLE σ₂) (c : ℝ) (h0 : 0 ≤ c) (h1 : c ≤ 1) : relEntropyReal (ρ₁.mix ρ₂ c h0 h1) (σ₁.mix σ₂ c h0 h1) ≤ (1 - c) * relEntropyReal ρ₁ σ₁ + c * relEntropyReal ρ₂ σ₂ := by have := ρ₁.nonempty set τ : DensityMatrix n := DensityMatrix.maximallyMixed have hτ : τ.val.PosDef := DensityMatrix.maximallyMixed_posDef set a : ℝ := (Fintype.card n : ℝ)⁻¹ have hτval : τ.val = a • (1 : Matrix n n ℂ) := rfl set ρ := ρ₁.mix ρ₂ c h0 h1 set σ := σ₁.mix σ₂ c h0 h1 have hreg : ∀ (θ : DensityMatrix n) (ε : ℝ) (ha : 0 ≤ ε) (hb : ε ≤ 1), (θ.mix τ ε ha hb).val = (1 - ε) • θ.val + (ε * a) • (1 : Matrix n n ℂ) := by intro θ ε ha hb rw [DensityMatrix.mix_val, hτval, smul_smul] have hineq : ∀ᶠ ε in 𝓝[>] (0 : ℝ), (ρ.val * cfc Real.log ρ.val).trace.re - (ρ.val * cfc Real.log ((1 - ε) • σ.val + (ε * a) • (1 : Matrix n n ℂ))).trace.re ≤ (1 - c) * ((ρ₁.val * cfc Real.log ρ₁.val).trace.re - (ρ₁.val * cfc Real.log ((1 - ε) • σ₁.val + (ε * a) • (1 : Matrix n n ℂ))).trace.re) + c * ((ρ₂.val * cfc Real.log ρ₂.val).trace.re - (ρ₂.val * cfc Real.log ((1 - ε) • σ₂.val + (ε * a) • (1 : Matrix n n ℂ))).trace.re) := by have h1' : ∀ᶠ ε in 𝓝[>] (0 : ℝ), ε < 1 := nhdsWithin_le_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) filter_upwards [self_mem_nhdsWithin, h1'] with ε ha hb have h := relEntropyMat_mix_le_of_posDef ρ₁ ρ₂ (σ₁.mix τ ε ha.le hb.le) (σ₂.mix τ ε ha.le hb.le) c h0 h1 (mix_posDef hτ ha hb.le) (mix_posDef hτ ha hb.le) have e : ((σ₁.mix τ ε ha.le hb.le).mix (σ₂.mix τ ε ha.le hb.le) c h0 h1).val = (1 - ε) • σ.val + (ε * a) • (1 : Matrix n n ℂ) := by simp only [DensityMatrix.mix_val, σ, hτval]; module rw [e, hreg, hreg, Lieb.relEntropyMat_eq_sub, Lieb.relEntropyMat_eq_sub, Lieb.relEntropyMat_eq_sub] at h exact h have hL := (tendsto_trace_mul_cfc_log_regularize ρ σ (h₁.mix h₂ c h0 h1) a).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) have hR₁ := (tendsto_trace_mul_cfc_log_regularize ρ₁ σ₁ h₁ a).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) have hR₂ := (tendsto_trace_mul_cfc_log_regularize ρ₂ σ₂ h₂ a).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) have hlim := le_of_tendsto_of_tendsto (tendsto_const_nhds.sub hL) (((tendsto_const_nhds.sub hR₁).const_mul (1 - c)).add ((tendsto_const_nhds.sub hR₂).const_mul c)) hineq rw [← Lieb.relEntropyMat_eq_sub, ← Lieb.relEntropyMat_eq_sub, ← Lieb.relEntropyMat_eq_sub, Lieb.relEntropyMat_eq_relEntropyReal, Lieb.relEntropyMat_eq_relEntropyReal, Lieb.relEntropyMat_eq_relEntropyReal] at hlim exact hlim /-- **Lieb's joint convexity for all states.** For all density matrices `ρ₁, ρ₂, σ₁, σ₂` and `c ∈ [0, 1]`, the `EReal`-valued Umegaki relative entropy satisfies `D((1-c)ρ₁ + cρ₂ ‖ (1-c)σ₁ + cσ₂) ≤ (1-c) D(ρ₁‖σ₁) + c D(ρ₂‖σ₂)` (with `0 · ⊤ = 0`); no faithfulness or support hypothesis is needed. -/ theorem relEntropy_mix_le (ρ₁ ρ₂ σ₁ σ₂ : DensityMatrix n) (c : ℝ) (h0 : 0 ≤ c) (h1 : c ≤ 1) : relEntropy (ρ₁.mix ρ₂ c h0 h1) (σ₁.mix σ₂ c h0 h1) ≤ ((1 - c : ℝ) : EReal) * relEntropy ρ₁ σ₁ + (c : EReal) * relEntropy ρ₂ σ₂ := by rcases eq_or_lt_of_le h0 with hc0 | hc0 · subst hc0 rw [DensityMatrix.mix_zero, DensityMatrix.mix_zero] simp rcases eq_or_lt_of_le h1 with hc1 | hc1 · subst hc1 rw [DensityMatrix.mix_one, DensityMatrix.mix_one] simp have hD₂ : (c : EReal) * relEntropy ρ₂ σ₂ ≠ ⊥ := ne_bot_of_le_ne_bot EReal.zero_ne_bot (EReal.mul_nonneg (EReal.coe_nonneg.mpr h0) (relEntropy_nonneg ρ₂ σ₂)) by_cases h₁ : ρ₁.SupportLE σ₁ swap · rw [relEntropy_of_not_supportLE h₁, EReal.coe_mul_top_of_pos (by linarith), EReal.top_add_of_ne_bot hD₂] exact le_top by_cases h₂ : ρ₂.SupportLE σ₂ swap · rw [relEntropy_of_not_supportLE h₂, relEntropy_of_supportLE h₁, EReal.coe_mul_top_of_pos hc0, ← EReal.coe_mul, EReal.add_top_of_ne_bot (EReal.coe_ne_bot _)] exact le_top rw [relEntropy_of_supportLE (h₁.mix h₂ c h0 h1), relEntropy_of_supportLE h₁, relEntropy_of_supportLE h₂, ← EReal.coe_mul, ← EReal.coe_mul, ← EReal.coe_add, EReal.coe_le_coe_iff] exact relEntropyReal_mix_le h₁ h₂ c h0 h1 end OperatorEntropy