Exact Lean source
Nonadditivity.EntropyProducts
Download original .lean · View on GitHub · Jump to source
Direct imports
Nonadditivity.EntropyMathlib.Analysis.Matrix.Orderdependency
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
25 project constants, including generated, internal and private declarations.
25 declarations
Nonadditivity.Entropy.DensityMatrix.entropy_eq_neg_root_sumNonadditivity.Entropy.DensityMatrix.entropy_eq_of_padded_charpolyNonadditivity.Entropy.DensityMatrix.entropy_eq_shannon_of_diagonalizationNonadditivity.Entropy.DensityMatrix.entropy_eq_shannon_of_diagonalization._simp_1_1internal/detail/privateNonadditivity.Entropy.DensityMatrix.entropy_eq_shannon_of_diagonalization._simp_1_2internal/detail/privateNonadditivity.Entropy.DensityMatrix.tensorNonadditivity.Entropy.DensityMatrix.tensor._proof_1internal/detail/privateNonadditivity.Entropy.DensityMatrix.tensor._proof_2internal/detail/privateNonadditivity.Entropy.DensityMatrix.tensor_entropyNonadditivity.Entropy.DensityMatrix.tensor_matrixNonadditivity.Entropy.bipartiteLeftNonadditivity.Entropy.bipartiteLeft._proof_1internal/detail/privateNonadditivity.Entropy.bipartiteRightNonadditivity.Entropy.bipartiteRight._proof_1internal/detail/privateNonadditivity.Entropy.bipartiteRight._proof_2internal/detail/privateNonadditivity.Entropy.bipartite_entropy_eqNonadditivity.Entropy.bipartite_physical_reductions_entropy_eqNonadditivity.Entropy.mul_log_mulNonadditivity.Entropy.shannon_productNonadditivity.Entropy.shannon_product._simp_1_1internal/detail/privateNonadditivity.Entropy.shannon_product._simp_1_2internal/detail/privateNonadditivity.Entropy.tensorUnitaryNonadditivity.Entropy.tensorUnitary._proof_1internal/detail/privateNonadditivity.Entropy.tensorUnitary._simp_1internal/detail/privateNonadditivity.Entropy.tensorUnitary.eq_1internal/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.Entropy7import Mathlib.Analysis.Matrix.Order89/-!10# Tensor products of actual quantum density matrices1112This file constructs the Kronecker product of two PSD trace-one complex13matrices and proves von Neumann entropy additivity. No entropy law or14eigenvalue formula is postulated: the proof uses unitary diagonalization,15characteristic-polynomial root multisets, and the logarithm product identity.16-/1718namespace Nonadditivity.Entropy1920open scoped BigOperators ComplexOrder ComplexConjugate Kronecker Matrix2122noncomputable section2324theorem mul_log_mul (x y : ℝ) :25(x * y) * Real.log (x * y) = (x * Real.log x) * y + x * (y * Real.log y) := by26by_cases hx : x = 027· simp [hx]28by_cases hy : y = 029· simp [hy]30rw [Real.log_mul hx hy]31ring3233/-- Shannon entropy is additive for product distributions, including zero weights. -/34theorem shannon_product {ι κ : Type*} [Fintype ι] [Fintype κ]35(p : ι → ℝ) (q : κ → ℝ) (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) :36shannon (fun ij : ι × κ => p ij.1 * q ij.2) = shannon p + shannon q := by37simp only [shannon, Fintype.sum_prod_type, mul_log_mul, Finset.sum_add_distrib,38← Finset.sum_mul, ← Finset.mul_sum, hp, hq, mul_one, one_mul]39ring4041/-- The genuine tensor-product density matrix. -/42def DensityMatrix.tensor {ι κ : Type*} [Fintype ι] [Fintype κ]43[DecidableEq ι] [DecidableEq κ] (ρ : DensityMatrix ι) (σ : DensityMatrix κ) :44DensityMatrix (ι × κ) where45matrix := ρ.matrix ⊗ₖ σ.matrix46positive := ρ.positive.kronecker σ.positive47normalized := by rw [Matrix.trace_kronecker, ρ.normalized, σ.normalized, one_mul]4849theorem DensityMatrix.tensor_matrix {ι κ : Type*} [Fintype ι] [Fintype κ]50[DecidableEq ι] [DecidableEq κ] (ρ : DensityMatrix ι) (σ : DensityMatrix κ) :51(ρ.tensor σ).matrix = ρ.matrix ⊗ₖ σ.matrix := rfl5253/-- Tensoring actual unitaries gives an actual unitary. -/54def tensorUnitary {ι κ : Type*} [Fintype ι] [Fintype κ]55[DecidableEq ι] [DecidableEq κ]56(U : unitary (Matrix ι ι ℂ)) (V : unitary (Matrix κ κ ℂ)) :57unitary (Matrix (ι × κ) (ι × κ) ℂ) :=58⟨(U : Matrix ι ι ℂ) ⊗ₖ (V : Matrix κ κ ℂ), by59rw [Unitary.mem_iff]60constructor61· change ((U : Matrix ι ι ℂ) ⊗ₖ (V : Matrix κ κ ℂ))ᴴ *62((U : Matrix ι ι ℂ) ⊗ₖ (V : Matrix κ κ ℂ)) = 163rw [Matrix.conjTranspose_kronecker, ← Matrix.mul_kronecker_mul]64simp only [← Matrix.star_eq_conjTranspose, Unitary.coe_star_mul_self]65exact Matrix.one_kronecker_one (m := ι) (n := κ)66· change ((U : Matrix ι ι ℂ) ⊗ₖ (V : Matrix κ κ ℂ)) *67((U : Matrix ι ι ℂ) ⊗ₖ (V : Matrix κ κ ℂ))ᴴ = 168rw [Matrix.conjTranspose_kronecker, ← Matrix.mul_kronecker_mul]69simp only [← Matrix.star_eq_conjTranspose]70have hU : (U : Matrix ι ι ℂ) * star (U : Matrix ι ι ℂ) = 1 := by71simpa only [Unitary.coe_star] using Unitary.coe_mul_star_self U72have hV : (V : Matrix κ κ ℂ) * star (V : Matrix κ κ ℂ) = 1 := by73simpa only [Unitary.coe_star] using Unitary.coe_mul_star_self V74rw [hU, hV]75exact Matrix.one_kronecker_one (m := ι) (n := κ)⟩7677/-- Entropy can be evaluated using any unitary diagonalization, without sorting the eigenvalues. -/78theorem DensityMatrix.entropy_eq_shannon_of_diagonalization79{ι : Type*} [Fintype ι] [DecidableEq ι] (ρ : DensityMatrix ι)80(p : ι → ℝ) (U : unitary (Matrix ι ι ℂ))81(h : ρ.matrix = (U : Matrix ι ι ℂ) * Matrix.diagonal (fun i => (p i : ℂ)) *82(star U : Matrix ι ι ℂ)) : ρ.vonNeumann = shannon p := by83have hc : ρ.matrix.charpoly = (Matrix.diagonal (fun i => (p i : ℂ))).charpoly := by84rw [h, Matrix.charpoly_mul_comm, ← Matrix.mul_assoc,85Unitary.coe_star_mul_self, Matrix.one_mul]86have hr : ρ.matrix.charpoly.roots =87Multiset.map (fun i => (p i : ℂ)) Finset.univ.val := by88rw [hc, Matrix.charpoly_diagonal, Polynomial.roots_prod]89· simp90· simp [Finset.prod_ne_zero_iff, Polynomial.X_sub_C_ne_zero]91have he := ρ.positive.isHermitian.roots_charpoly_eq_eigenvalues92rw [hr] at he93have hs := congrArg (fun s : Multiset ℂ =>94(s.map (fun z => z.re * Real.log z.re)).sum) he95simp only [Multiset.map_map, Function.comp_def, Complex.ofReal_re] at hs96change (∑ i, p i * Real.log (p i)) =97∑ i, ρ.weights i * Real.log (ρ.weights i) at hs98exact congrArg Neg.neg hs.symm99100set_option maxHeartbeats 1000000 in101/-- The quantum entropy additivity law used for Bell output tensor blocks. -/102theorem DensityMatrix.tensor_entropy {ι κ : Type*} [Fintype ι] [Fintype κ]103[DecidableEq ι] [DecidableEq κ] (ρ : DensityMatrix ι) (σ : DensityMatrix κ) :104(ρ.tensor σ).vonNeumann = ρ.vonNeumann + σ.vonNeumann := by105let U := ρ.positive.isHermitian.eigenvectorUnitary106let V := σ.positive.isHermitian.eigenvectorUnitary107have hρ : ρ.matrix = (U : Matrix ι ι ℂ) *108Matrix.diagonal (fun i => (ρ.weights i : ℂ)) * (star U : Matrix ι ι ℂ) :=109ρ.positive.isHermitian.spectral_theorem110have hσ : σ.matrix = (V : Matrix κ κ ℂ) *111Matrix.diagonal (fun j => (σ.weights j : ℂ)) * (star V : Matrix κ κ ℂ) :=112σ.positive.isHermitian.spectral_theorem113have ht : (ρ.tensor σ).matrix = (tensorUnitary U V : Matrix _ _ ℂ) *114Matrix.diagonal (fun ij : ι × κ => ((ρ.weights ij.1 * σ.weights ij.2 : ℝ) : ℂ)) *115(star (tensorUnitary U V) : Matrix _ _ ℂ) := by116rw [DensityMatrix.tensor_matrix, hρ, hσ,117Matrix.mul_kronecker_mul, Matrix.mul_kronecker_mul,118Matrix.diagonal_kronecker_diagonal]119simp only [tensorUnitary, Matrix.star_eq_conjTranspose,120Matrix.conjTranspose_kronecker, Complex.ofReal_mul]121have he := (ρ.tensor σ).entropy_eq_shannon_of_diagonalization122(fun ij : ι × κ => ρ.weights ij.1 * σ.weights ij.2) (tensorUnitary U V) ht123exact he.trans (shannon_product ρ.weights σ.weights ρ.weights_sum σ.weights_sum)124125/-! ## Rectangular Gram matrices and pure-state reductions -/126127/-- The spectral entropy can equally be evaluated from characteristic-polynomial roots. -/128theorem DensityMatrix.entropy_eq_neg_root_sum129{ι : Type*} [Fintype ι] [DecidableEq ι] (ρ : DensityMatrix ι) :130ρ.vonNeumann =131-(ρ.matrix.charpoly.roots.map (fun z : ℂ => z.re * Real.log z.re)).sum := by132rw [ρ.positive.isHermitian.roots_charpoly_eq_eigenvalues]133simp only [Multiset.map_map, Function.comp_def]134rfl135136/-- Adding arbitrary zero eigenvalues leaves entropy unchanged.137The polynomial identity is an algebraic relation, not an entropy hypothesis. -/138theorem DensityMatrix.entropy_eq_of_padded_charpoly139{ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]140(ρ : DensityMatrix ι) (σ : DensityMatrix κ) (m n : ℕ)141(h : (Polynomial.X : Polynomial ℂ) ^ m * ρ.matrix.charpoly =142(Polynomial.X : Polynomial ℂ) ^ n * σ.matrix.charpoly) :143ρ.vonNeumann = σ.vonNeumann := by144have hr := congrArg Polynomial.roots h145rw [Polynomial.roots_mul (mul_ne_zero146(pow_ne_zero m Polynomial.X_ne_zero) ρ.matrix.charpoly_monic.ne_zero),147Polynomial.roots_mul (mul_ne_zero148(pow_ne_zero n Polynomial.X_ne_zero) σ.matrix.charpoly_monic.ne_zero),149Polynomial.roots_X_pow, Polynomial.roots_X_pow] at hr150have hs := congrArg (fun s : Multiset ℂ =>151(s.map (fun z => z.re * Real.log z.re)).sum) hr152simp [Multiset.nsmul_singleton, Multiset.map_replicate] at hs153rw [ρ.entropy_eq_neg_root_sum, σ.entropy_eq_neg_root_sum]154exact congrArg Neg.neg hs155156/-- Left reduced state of a normalized bipartite pure vector represented as a coefficient matrix. -/157def bipartiteLeft {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]158(A : Matrix ι κ ℂ) (hnorm : (A * Aᴴ).trace = 1) : DensityMatrix ι where159matrix := A * Aᴴ160positive := Matrix.posSemidef_self_mul_conjTranspose A161normalized := hnorm162163/-- Right Gram state. Its transpose is the right physical reduction under164the coefficient convention; entropy is invariant under that conjugation. -/165def bipartiteRight {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]166(A : Matrix ι κ ℂ) (hnorm : (A * Aᴴ).trace = 1) : DensityMatrix κ where167matrix := Aᴴ * A168positive := Matrix.posSemidef_conjTranspose_mul_self A169normalized := by rw [Matrix.trace_mul_comm]; exact hnorm170171/-- Schmidt entropy equality, including unequal dimensions and zero Schmidt coefficients. -/172theorem bipartite_entropy_eq {ι κ : Type*} [Fintype ι] [Fintype κ]173[DecidableEq ι] [DecidableEq κ] (A : Matrix ι κ ℂ)174(hnorm : (A * Aᴴ).trace = 1) :175(bipartiteLeft A hnorm).vonNeumann = (bipartiteRight A hnorm).vonNeumann := by176apply DensityMatrix.entropy_eq_of_padded_charpoly _ _ (Fintype.card κ) (Fintype.card ι)177exact Matrix.charpoly_mul_comm' A Aᴴ178179/-- Entropy equality for the actual coefficient-basis left and right reduced matrices. -/180theorem bipartite_physical_reductions_entropy_eq {ι κ : Type*} [Fintype ι] [Fintype κ]181[DecidableEq ι] [DecidableEq κ] (A : Matrix ι κ ℂ)182(hnorm : (A * Aᴴ).trace = 1) :183(bipartiteLeft A hnorm).vonNeumann = (bipartiteRight A hnorm).conjugate.vonNeumann := by184rw [DensityMatrix.conjugate_entropy]185exact bipartite_entropy_eq A hnorm186187end188189end Nonadditivity.Entropy