Density matrices are exactly the unit-trace positive semidefinite matrices
ProvedQAlgorithms.Nannicini.densityMatrix_iffLet be a complex matrix acting on qubits. An ensemble of pure states is a family of unit vectors with probabilities , . Its density matrix is (Definition 1.55). Then
This is the standard intrinsic description of mixed states. Later chapters use it to recognize a matrix as a quantum state without exhibiting an ensemble.
Formalization Note Positive semidefiniteness is Mathlib's Matrix.PosSemidef, which includes Hermiticity.
import Definitions.Def_QAlgorithms_Defs_Measurement set_option autoImplicit false
namespace QAlgorithms.Nannicini
open QAlgorithms
open scoped ComplexOrder
/-- Nannicini p.36, Theorem 1.60 (characterization of density matrices): a `q`-qubit matrix `ρ`
is the density matrix `∑_j p_j |ψ_j⟩⟨ψ_j|` of some ensemble `{p_j, |ψ_j⟩}_{j=1..m}` of pure
states (unit vectors) with probabilities `p_j ≥ 0`, `∑_j p_j = 1`, for some `m`, if and only if
`ρ` has unit trace and is positive semidefinite. -/
theorem densityMatrix_iff {q : ℕ} (ρ : Matrix (Qubits q) (Qubits q) ℂ) :
(∃ (m : ℕ) (p : Fin m → ℝ) (ψ : Fin m → EuclideanSpace ℂ (Qubits q)),
(∀ j, 0 ≤ p j) ∧ ∑ j, p j = 1 ∧ (∀ j, IsState (ψ j)) ∧ ρ = ensembleDensity p ψ) ↔
ρ.trace = 1 ∧ ρ.PosSemidef := by sorry
end QAlgorithms.Nannicini
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let and let be a complex matrix whose rows and columns are indexed by .
Claim. The following two conditions are equivalent.
- Ensemble form. There exist a natural number , real weights and vectors such that:
- every ,
- (this forces ),
- every has norm ,
- and
meaning the entry of is .
- Matrix conditions. and is positive semidefinite. Positive semidefinite means is Hermitian and for every complex vector .
No bound on is imposed, and the need not be distinct or orthogonal.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.