Skip to content

Commit 9977226

Browse files
committed
feat(Analysis/Hermitian): more lemma to convert between IsHermitian and IsSymmetric
1 parent 8807830 commit 9977226

3 files changed

Lines changed: 34 additions & 16 deletions

File tree

Mathlib/Analysis/InnerProductSpace/Positive.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ theorem isPositive_linearIsometryEquiv_conj_iff {T : E →ₗ[𝕜] E} (f : E
202202
/-- `A.toEuclideanLin` is positive if and only if `A` is positive semi-definite. -/
203203
@[simp] theorem _root_.Matrix.isPositive_toEuclideanLin_iff {n : Type*} [Fintype n] [DecidableEq n]
204204
{A : Matrix n n 𝕜} : A.toEuclideanLin.IsPositive ↔ A.PosSemidef := by
205-
simp_rw [LinearMap.IsPositive, Matrix.isHermitian_iff_isSymmetric, inner_re_symm,
205+
simp_rw [LinearMap.IsPositive, Matrix.isSymmetric_toEuclideanLin_iff, inner_re_symm,
206206
EuclideanSpace.inner_eq_star_dotProduct, Matrix.ofLp_toLpLin, Matrix.toLin'_apply,
207207
dotProduct_comm (A.mulVec _), Matrix.posSemidef_iff_dotProduct_mulVec, and_congr_right_iff,
208208
RCLike.nonneg_iff (K := 𝕜)]

Mathlib/Analysis/Matrix/Hermitian.lean

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module
77

88
public import Mathlib.Analysis.InnerProductSpace.PiL2
99
public import Mathlib.LinearAlgebra.Matrix.Hermitian
10+
import Mathlib.Analysis.InnerProductSpace.Adjoint
1011

1112
/-!
1213
# Hermitian matrices over ℝ and ℂ
@@ -38,22 +39,39 @@ lemma IsHermitian.coe_re_apply_self (h : A.IsHermitian) (i : n) : (re (A i i) :
3839
lemma IsHermitian.coe_re_diag (h : A.IsHermitian) : (fun i => (re (A.diag i) : 𝕜)) = A.diag :=
3940
funext h.coe_re_apply_self
4041

41-
/-- A matrix is Hermitian iff the corresponding linear map is self adjoint. -/
42+
/-- A matrix is Hermitian iff the corresponding linear map with an orthonormal basis is self
43+
adjoint. -/
44+
@[simp]
45+
lemma isSymmetric_toLin_iff [Fintype n] [DecidableEq n] {E : Type*}
46+
[NormedAddCommGroup E] [InnerProductSpace 𝕜 E] (b : OrthonormalBasis n 𝕜 E) :
47+
(A.toLin b.toBasis b.toBasis).IsSymmetric ↔ A.IsHermitian := by
48+
have : FiniteDimensional 𝕜 E := b.toBasis.finiteDimensional_of_finite
49+
simp_rw [LinearMap.IsSymmetric, ← LinearMap.adjoint_inner_left, ← toLin_conjTranspose]
50+
refine ⟨fun h ↦ ?_, fun h _ _ ↦ by rw [h.eq]⟩
51+
simpa using (LinearMap.ext fun x ↦ ext_inner_right _ (h x)).symm
52+
53+
/-- A matrix is Hermitian iff the corresponding linear map on the Euclidean space is self adjoint.
54+
-/
55+
@[simp]
56+
lemma isSymmetric_toEuclideanLin_iff [Fintype n] [DecidableEq n] :
57+
A.toEuclideanLin.IsSymmetric ↔ A.IsHermitian :=
58+
isSymmetric_toLin_iff (EuclideanSpace.basisFun n 𝕜)
59+
60+
@[deprecated isSymmetric_toEuclideanLin_iff (since := "2026-03-30")]
4261
lemma isHermitian_iff_isSymmetric [Fintype n] [DecidableEq n] :
43-
IsHermitian A ↔ A.toEuclideanLin.IsSymmetric := by
44-
rw [LinearMap.IsSymmetric, (WithLp.toLp_surjective _).forall₂]
45-
simp only [toLpLin_toLp, Matrix.toLin'_apply, EuclideanSpace.inner_eq_star_dotProduct,
46-
star_mulVec]
47-
constructor
48-
· rintro (h : Aᴴ = A) x y
49-
rw [dotProduct_comm, ← dotProduct_mulVec, h, dotProduct_comm]
50-
· intro h
51-
ext i j
52-
simpa [(Pi.single_star i 1).symm] using h (Pi.single i 1) (Pi.single j 1)
62+
IsHermitian A ↔ A.toEuclideanLin.IsSymmetric := isSymmetric_toEuclideanLin_iff.symm
5363

5464
lemma IsHermitian.im_star_dotProduct_mulVec_self [Fintype n] (hA : A.IsHermitian) (x : n → 𝕜) :
5565
RCLike.im (star x ⬝ᵥ A *ᵥ x) = 0 := by
5666
classical
57-
simpa [dotProduct_comm] using (isHermitian_iff_isSymmetric.mp hA).im_inner_self_apply _
67+
simpa [dotProduct_comm] using (isSymmetric_toEuclideanLin_iff.mpr hA).im_inner_self_apply _
5868

5969
end Matrix
70+
71+
/-- A linear map is self adjoint if the corresponding matrix with an orthonormal basis is Hermitian.
72+
-/
73+
@[simp]
74+
lemma LinearMap.isHermitian_toMatrix_iff {n 𝕜 E : Type*} [Fintype n] [DecidableEq n] [RCLike 𝕜]
75+
[NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {f : E →ₗ[𝕜] E} (b : OrthonormalBasis n 𝕜 E) :
76+
(f.toMatrix b.toBasis b.toBasis).IsHermitian ↔ f.IsSymmetric := by
77+
rw [← Matrix.isSymmetric_toLin_iff b, Matrix.toLin_toMatrix]

Mathlib/Analysis/Matrix/Spectrum.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ variable (hA : A.IsHermitian) (hB : B.IsHermitian)
5656
/-- The eigenvalues of a Hermitian matrix, indexed by `Fin (Fintype.card n)` where `n` is the index
5757
type of the matrix. -/
5858
noncomputable def eigenvalues₀ : Fin (Fintype.card n) → ℝ :=
59-
(isHermitian_iff_isSymmetric.1 hA).eigenvalues finrank_euclideanSpace
59+
(isSymmetric_toEuclideanLin_iff.mpr hA).eigenvalues finrank_euclideanSpace
6060

6161
lemma eigenvalues₀_antitone : Antitone hA.eigenvalues₀ :=
6262
LinearMap.IsSymmetric.eigenvalues_antitone ..
@@ -67,14 +67,14 @@ noncomputable def eigenvalues : n → ℝ := fun i =>
6767

6868
/-- A choice of an orthonormal basis of eigenvectors of a Hermitian matrix. -/
6969
noncomputable def eigenvectorBasis : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n) :=
70-
((isHermitian_iff_isSymmetric.1 hA).eigenvectorBasis finrank_euclideanSpace).reindex
70+
((isSymmetric_toEuclideanLin_iff.mpr hA).eigenvectorBasis finrank_euclideanSpace).reindex
7171
(Fintype.equivOfCardEq (Fintype.card_fin _))
7272

7373
lemma mulVec_eigenvectorBasis (j : n) :
7474
A *ᵥ ⇑(hA.eigenvectorBasis j) = (hA.eigenvalues j) • ⇑(hA.eigenvectorBasis j) := by
7575
simpa only [eigenvectorBasis, OrthonormalBasis.reindex_apply, toLpLin_apply,
7676
RCLike.real_smul_eq_coe_smul (K := 𝕜)] using
77-
congr(⇑$((isHermitian_iff_isSymmetric.1 hA).apply_eigenvectorBasis
77+
congr(⇑$((isSymmetric_toEuclideanLin_iff.mpr hA).apply_eigenvectorBasis
7878
finrank_euclideanSpace ((Fintype.equivOfCardEq (Fintype.card_fin _)).symm j)))
7979

8080
/-- Eigenvalues of a Hermitian matrix A are in the ℝ spectrum of A. -/

0 commit comments

Comments
 (0)