Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Spectral functions and semidefinite order

Definition
TroppMatrixConcentration_spectral

by tc · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

matrix-concentrationrandom-matrices

For finite complex matrices, define the Euclidean operator norm; the largest and smallest real spectral values; the matrix power-series exponential; the spectral logarithm via continuous functional calculus; the real part of the trace exponential; and the order A⪯BA\preceq BA⪯B meaning that B−AB-AB−A is positive semidefinite. Extreme spectral values are used on nonempty Hermitian matrices, and the logarithm on positive-definite matrices. These are concrete Mathlib operations, with no axioms or theorem assumptions. Outside those intended domains the operations retain Mathlib's total-function conventions, as detailed in the read-back.

Definition code
import Mathlib.Analysis.Matrix.Order
import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.ExpLog.Basic
import Mathlib.Analysis.Normed.Algebra.MatrixExponential

open scoped Matrix.Norms.L2Operator ComplexOrder

noncomputable section
namespace TroppMatrixConcentration

def spectralNorm {m n : Type*} [Fintype m] [Fintype n] [DecidableEq n]
    (A : Matrix m n ℂ) : ℝ := ‖A‖

def lambdaMax {d : Type*} [Fintype d] [DecidableEq d]
    (A : Matrix d d ℂ) : ℝ := sSup (spectrum ℝ A)

def lambdaMin {d : Type*} [Fintype d] [DecidableEq d]
    (A : Matrix d d ℂ) : ℝ := sInf (spectrum ℝ A)

def matrixExp {d : Type*} [Fintype d] [DecidableEq d]
    (A : Matrix d d ℂ) : Matrix d d ℂ := NormedSpace.exp A

def matrixLog {d : Type*} [Fintype d] [DecidableEq d]
    (A : Matrix d d ℂ) : Matrix d d ℂ := cfc Real.log A

def traceExp {d : Type*} [Fintype d] [DecidableEq d]
    (A : Matrix d d ℂ) : ℝ := (Matrix.trace (matrixExp A)).re

def loewnerLE {d : Type*} [Fintype d]
    (A B : Matrix d d ℂ) : Prop := (B - A).PosSemidef

end TroppMatrixConcentration
Source
Joel A. Tropp, An Introduction to Matrix Concentration Inequalities, arXiv:1501.01571v1 (7 January 2015); https://arxiv.org/abs/1501.01571v1; Sections 2.1.6–2.1.14, printed pp. 19–24.
Read-back

What the Lean code literally says, in plain math · gpt-6

TroppMatrixConcentration.spectralNorm. For arbitrary finite index types mmm and nnn, each equipped with a finite enumeration, with decidable equality on nnn, and any complex matrix A∈Cm×nA\in\mathbb C^{m\times n}A∈Cm×n, this defines a real number equal to the operator norm of the linear map x↦Axx\mapsto Axx↦Ax from Cn\mathbb C^nCn to Cm\mathbb C^mCm, both with their Euclidean norms: sup⁡∥x∥2≤1∥Ax∥2\sup_{\|x\|_2\leq 1}\|Ax\|_2sup∥x∥2​≤1​∥Ax∥2​. Neither index type is required to be nonempty; if either is empty, the value is 000. There is no hypothesis on the entries or shape of AAA beyond these types.

TroppMatrixConcentration.lambdaMax. For any finite index type ddd equipped with a finite enumeration and decidable equality, and any complex square matrix A∈Cd×dA\in\mathbb C^{d\times d}A∈Cd×d, this defines the real supremum of SA={r∈R:rI−A is not invertible as a complex matrix}S_A=\{r\in\mathbb R:rI-A\text{ is not invertible as a complex matrix}\}SA​={r∈R:rI−A is not invertible as a complex matrix}. Thus it uses the real members of the spectrum, even when AAA has nonreal eigenvalues; no Hermitian hypothesis is imposed. When SAS_ASA​ is nonempty, this finite set has a largest member and the value equals that member. When SAS_ASA​ is empty, the value is 000, by the total real supremum convention; this includes an empty index type ddd and matrices with no real eigenvalues. The underlying real supremum also defaults to 000 for a set unbounded above, although SAS_ASA​ is finite here. No nonemptiness hypothesis is required on ddd or SAS_ASA​.

TroppMatrixConcentration.lambdaMin. For any finite index type ddd equipped with a finite enumeration and decidable equality, and any complex square matrix A∈Cd×dA\in\mathbb C^{d\times d}A∈Cd×d, this defines the real infimum of SA={r∈R:rI−A is not invertible as a complex matrix}S_A=\{r\in\mathbb R:rI-A\text{ is not invertible as a complex matrix}\}SA​={r∈R:rI−A is not invertible as a complex matrix}. Thus it uses the real members of the spectrum, even when AAA has nonreal eigenvalues; no Hermitian hypothesis is imposed. When SAS_ASA​ is nonempty, this finite set has a smallest member and the value equals that member. When SAS_ASA​ is empty, the value is 000, by the total real infimum convention; this includes an empty index type ddd and matrices with no real eigenvalues. The underlying real infimum also defaults to 000 for a set unbounded below, although SAS_ASA​ is finite here. No nonemptiness hypothesis is required on ddd or SAS_ASA​.

TroppMatrixConcentration.matrixExp. For any finite index type ddd equipped with a finite enumeration and decidable equality, and any complex square matrix A∈Cd×dA\in\mathbb C^{d\times d}A∈Cd×d, this defines a complex square matrix by the normed-algebra exponential exp⁡(A)=∑k=0∞Ak/k!\exp(A)=\sum_{k=0}^{\infty}A^k/k!exp(A)=∑k=0∞​Ak/k!, with matrix multiplication and A0=IA^0=IA0=I. This series converges for every such finite matrix; no Hermitian, positivity, or invertibility hypothesis is required. The type ddd may be empty, in which case the result is the unique empty square matrix, which is both its zero and its identity matrix.

TroppMatrixConcentration.matrixLog. For any finite index type ddd equipped with a finite enumeration and decidable equality, and any complex square matrix A∈Cd×dA\in\mathbb C^{d\times d}A∈Cd×d, this defines the real continuous functional calculus applied to AAA and the total real function ℓ\ellℓ given by ℓ(0)=0\ell(0)=0ℓ(0)=0 and ℓ(t)=log⁡∣t∣\ell(t)=\log|t|ℓ(t)=log∣t∣ for t≠0t\ne0t=0. The functional calculus returns the zero matrix when AAA is not self-adjoint, equivalently not Hermitian; its general definition also returns zero when the scalar function is not continuous on {r∈R:rI−A is not invertible}\{r\in\mathbb R:rI-A\text{ is not invertible}\}{r∈R:rI−A is not invertible}, but continuity on this finite set holds here. For Hermitian A=Udiag⁡(λi)U∗A=U\operatorname{diag}(\lambda_i)U^*A=Udiag(λi​)U∗ with UUU unitary and all λi\lambda_iλi​ real, the value is Udiag⁡(ℓ(λi))U∗U\operatorname{diag}(\ell(\lambda_i))U^*Udiag(ℓ(λi​))U∗: negative eigenvalues are sent to the logarithm of their absolute value, and zero eigenvalues are sent to zero. The declaration imposes no Hermitian, positivity, invertibility, or nonemptiness hypothesis. When ddd is empty, the result is the unique empty square matrix.

TroppMatrixConcentration.traceExp. For any finite index type ddd equipped with a finite enumeration and decidable equality, and any complex square matrix A∈Cd×dA\in\mathbb C^{d\times d}A∈Cd×d, this defines the real number Re⁡(∑i∈d(∑k=0∞Ak/k!)ii)\operatorname{Re}\bigl(\sum_{i\in d}(\sum_{k=0}^{\infty}A^k/k!)_{ii}\bigr)Re(∑i∈d​(∑k=0∞​Ak/k!)ii​), namely the real part of the trace of the normed-algebra matrix exponential, whose series converges for every such AAA. No Hermitian or positivity hypothesis is imposed, so the definition explicitly takes a real part even when the trace is complex. The index type ddd may be empty, in which case the trace is an empty sum and the value is 000.

TroppMatrixConcentration.loewnerLE. For any finite index type ddd equipped with a finite enumeration, and any two complex square matrices A,B∈Cd×dA,B\in\mathbb C^{d\times d}A,B∈Cd×d, this defines a proposition saying that B−AB-AB−A is positive semidefinite: (B−A)∗=B−A(B-A)^*=B-A(B−A)∗=B−A, and for every vector x∈Cdx\in\mathbb C^dx∈Cd, the scalar ∑i,j∈dxi‾(Bij−Aij)xj\sum_{i,j\in d}\overline{x_i}(B_{ij}-A_{ij})x_j∑i,j∈d​xi​​(Bij​−Aij​)xj​ is real and nonnegative. The underlying definition quantifies over finitely supported vectors, which includes every vector on the finite type ddd. There is no decidable-equality assumption on ddd, no nonemptiness assumption, and no separate assumption that either AAA or BBB is Hermitian. When ddd is empty, the Hermitian equality holds for the unique matrices, the quadratic form is zero, and the proposition holds.

Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by tc · Oct 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me