AFTD Auto-Formalizing Theoretical Domains

von_neumann_entropy

def

For an n-by-n complex matrix ρ indexed by a finite type n with decidable equality, von_neumann_entropy ρ is the real number defined as the sum over all i : n of Real.negMulLog (h.eigenvalues i) if ρ is Hermitian with proof h, and 0 otherwise.

Statement

noncomputable def von_neumann_entropy {n : Type*} [Fintype n] [DecidableEq n] (ρ : Matrix n n ℂ) : ℝ
Defined in
von Neumann 1927; Nielsen & Chuang, Section 11.3
Verified
12 Nov 2026
Axioms
none listed
Used by 1
  • two_qubit_min_bell_fidelityFor a real number ε, two_qubit_min_bell_fidelity ε is the real infimum sInf of the set of real numbers F such that there exists a complex…

Read back from the Lean

Given a finite type n with decidable equality and an n × n matrix ρ over the complex numbers ℂ, von_neumann_entropy ρ is defined to be the real number given by: - if ρ is Hermitian (ρ.IsHermitian), the sum over all i : n of Real.negMulLog (h.eigenvalues i) (that is, ∑ i : n, - λᵢ * log λᵢ, where λᵢ are the eigenvalues of ρ); - otherwise, 0.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Von Neumann entropy of a complex matrix in nats, defined via real eigenvalues when Hermitian and 0 otherwise. -/
noncomputable def von_neumann_entropy {n : Type*} [Fintype n] [DecidableEq n] (ρ : Matrix n n ℂ) : ℝ := if h : ρ.IsHermitian then ∑ i : n, Real.negMulLog (h.eigenvalues i) else 0
See it in the graphDiscuss this resultChallenge it