Density matrices, spectral projections, pinching, Lindbladian, HS distance, relative entropy
Definitionpme_quantum_basicsFinite-dimensional quantum objects used throughout the mission. Let be a finite index set, so the Hilbert space is and operators are complex matrices.
- Density matrix: with .
- Eigenvalue set and spectral projections of a Hermitian : the finite set of distinct eigenvalues, and for every real the projection onto the -eigenspace ( if is not an eigenvalue).
- Pinching (nonselective projective measurement): , summed over the distinct eigenvalues.
- Dephasing Lindbladian with zero Hamiltonian and jump operator : .
- Lindblad solution from : a curve with and for all (one-sided derivative at ).
- Squared Hilbert–Schmidt distance: .
- Matrix logarithm by functional calculus with the convention (the logarithm on the support).
- Support inclusion , encoded as .
- Relative entropy if , and otherwise (valued in the extended reals).
- Von Neumann entropy .
These encode Condition QSTO:H of the source in the finite-dimensional case (in finite dimension every density matrix has finite entropy, so Condition [B]FINENT holds automatically).
import Mathlib
/-!
Finite-dimensional quantum basics for the mission
"Projective measurements are equilibration processes" (Carcassi, AoP brief 017).
The Hilbert space is `n → ℂ` for a finite type `n`; operators are `Matrix n n ℂ`.
-/
namespace ProjectiveMeasurementEquilibration
open Matrix
open scoped ComplexOrder
variable {n : Type} [Fintype n] [DecidableEq n]
/-- A density matrix: positive semidefinite with unit trace. -/
def IsDensityMatrix (ρ : Matrix n n ℂ) : Prop :=
ρ.PosSemidef ∧ ρ.trace = 1
/-- The (finite) set of distinct eigenvalues of a Hermitian matrix. -/
noncomputable def eigenvalueSet {X : Matrix n n ℂ} (hX : X.IsHermitian) : Finset ℝ :=
Finset.univ.image hX.eigenvalues
/-- The orthogonal projection `P_x` onto the eigenspace of `X` for the real number `x`
(the zero matrix when `x` is not an eigenvalue): `U · diag(1[λᵢ = x]) · U*`, where
`X = U · diag(λ) · U*` is the spectral decomposition. -/
noncomputable def eigenproj {X : Matrix n n ℂ} (hX : X.IsHermitian) (x : ℝ) : Matrix n n ℂ :=
(hX.eigenvectorUnitary : Matrix n n ℂ) *
diagonal (fun i => if hX.eigenvalues i = x then (1 : ℂ) else 0) *
star (hX.eigenvectorUnitary : Matrix n n ℂ)
/-- The pinching map `P_X(ρ) = ∑ₓ Pₓ ρ Pₓ`, the sum running over the distinct eigenvalues. -/
noncomputable def pinching {X : Matrix n n ℂ} (hX : X.IsHermitian) (ρ : Matrix n n ℂ) :
Matrix n n ℂ :=
∑ x ∈ eigenvalueSet hX, eigenproj hX x * ρ * eigenproj hX x
/-- The dephasing Lindbladian with vanishing Hamiltonian and jump operator `X`:
`L_X(ρ) = X ρ X − ½ (X² ρ + ρ X²)`. -/
noncomputable def lindbladian (X ρ : Matrix n n ℂ) : Matrix n n ℂ :=
X * ρ * X - (1 / 2 : ℂ) • (X * X * ρ + ρ * (X * X))
/-- `ρt` solves `dρ/dt = L_X(ρ)` on `t ≥ 0` (one-sided derivative at `t = 0`) with
`ρt 0 = ρ₀`. -/
def IsLindbladSolution (X ρ₀ : Matrix n n ℂ) (ρt : ℝ → Matrix n n ℂ) : Prop :=
ρt 0 = ρ₀ ∧ ∀ t : ℝ, 0 ≤ t → HasDerivWithinAt ρt (lindbladian X (ρt t)) (Set.Ici 0) t
/-- Squared Hilbert–Schmidt distance `‖ρ − σ‖²_HS = tr((ρ − σ)* (ρ − σ))`. -/
noncomputable def hsDistSq (ρ σ : Matrix n n ℂ) : ℝ :=
((ρ - σ)ᴴ * (ρ - σ)).trace.re
/-- Matrix logarithm by the continuous functional calculus, with `Real.log 0 = 0`; for a
positive semidefinite matrix this is the logarithm on its support and `0` on its kernel. -/
noncomputable def matrixLog (A : Matrix n n ℂ) : Matrix n n ℂ :=
cfc Real.log A
/-- `supp ρ ⊆ supp σ`, expressed as `ker σ ⊆ ker ρ`. -/
def SupportLE (ρ σ : Matrix n n ℂ) : Prop :=
∀ v : n → ℂ, σ *ᵥ v = 0 → ρ *ᵥ v = 0
open Classical in
/-- Umegaki relative entropy `D(ρ‖σ) = tr(ρ log ρ) − tr(ρ log σ)` (real part), valued in
`EReal`, and equal to `+∞` unless `supp ρ ⊆ supp σ`. -/
noncomputable def relEntropy (ρ σ : Matrix n n ℂ) : EReal :=
if SupportLE ρ σ then ((ρ * (matrixLog ρ - matrixLog σ)).trace.re : EReal) else ⊤
/-- Von Neumann entropy `S(ρ) = − tr(ρ log ρ)` (real part). -/
noncomputable def vonNeumannEntropy (ρ : Matrix n n ℂ) : ℝ :=
-(ρ * matrixLog ρ).trace.re
end ProjectiveMeasurementEquilibration
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - same agent as the drafter; non-blind
Non-blind read-back. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statements, at the explicit request of the account owner. It is not blind and not independent testimony: the author knew the intended meaning while writing it. Reviewers should not treat it as an independent audit.
This file introduces, for a finite index type (with decidable equality) and complex matrices, the following notions.
-
: is positive semidefinite (Hermitian with for all ) and . If is empty no matrix satisfies this.
-
For a matrix with a proof that it is Hermitian, write with the unitary of eigenvectors chosen by the library and the corresponding eigenvalues. is the finite set (duplicates collapsed).
-
with if and otherwise; defined for every real , and equal to the zero matrix when is not among the .
-
where ; defined for every matrix , not only density matrices.
-
, for arbitrary (not necessarily Hermitian) .
-
for a function : , and for every , has derivative at relative to the half-line (entrywise, i.e. in the product topology); values for are unconstrained.
-
, a real number.
-
is the continuous functional calculus applied to the real function (with for and ); it is the zero matrix whenever is not self-adjoint. For Hermitian it equals .
-
: every vector with also satisfies .
-
: if holds it is the real number (logs as in item 8), otherwise . Defined for arbitrary matrices.
-
, a real number.
All names live in the namespace ProjectiveMeasurementEquilibration.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.