Skip to content

Commit 2f662a4

Browse files
committed
chore(LinearAlgebra): prepare library for API refactor (#16738)
This PR adds equation lemmas for several concepts around eigenspaces, eigenvectors, and eigenvalues, and uses these lemmas in the rest of the library. The result is an improved API boundary which allows for a refactor (and generalization) of the definitions in follow up work.
1 parent 718a757 commit 2f662a4

File tree

9 files changed

+50
-15
lines changed

9 files changed

+50
-15
lines changed

Mathlib/Algebra/Lie/Sl2.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ lemma exists_nat [IsNoetherian R M] [NoZeroSMulDivisors R M] [IsDomain R] [CharZ
148148
{μ - 2 * n | n : ℕ}
149149
(fun ⟨s, hs⟩ ↦ ψ Classical.choose hs)
150150
(fun ⟨r, hr⟩ ↦ by simp [lie_h_pow_toEnd_f P, Classical.choose_spec hr, contra,
151-
Module.End.HasEigenvector, Module.End.mem_eigenspace_iff])).finite
151+
Module.End.hasEigenvector_iff, Module.End.mem_eigenspace_iff])).finite
152152

153153
lemma pow_toEnd_f_ne_zero_of_eq_nat
154154
[CharZero R] [NoZeroSMulDivisors R M]

Mathlib/Algebra/Lie/Weights/Basic.lean

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ theorem mem_genWeightSpaceOf (χ : R) (x : L) (m : M) :
165165

166166
theorem coe_genWeightSpaceOf_zero (x : L) :
167167
↑(genWeightSpaceOf M (0 : R) x) = ⨆ k, LinearMap.ker (toEnd R L M x ^ k) := by
168-
simp [genWeightSpaceOf, Module.End.maxGenEigenspace]
168+
simp [genWeightSpaceOf, Module.End.maxGenEigenspace_def]
169169

170170
/-- If `M` is a representation of a nilpotent Lie algebra `L`
171171
and `χ : L → R` is a family of scalars,
@@ -272,7 +272,7 @@ lemma genWeightSpaceOf_ne_bot (χ : Weight R L M) (x : L) :
272272
lemma hasEigenvalueAt (χ : Weight R L M) (x : L) :
273273
(toEnd R L M x).HasEigenvalue (χ x) := by
274274
obtain ⟨k : ℕ, hk : (toEnd R L M x).genEigenspace (χ x) k ≠ ⊥⟩ := by
275-
simpa [Module.End.maxGenEigenspace, genWeightSpaceOf] using χ.genWeightSpaceOf_ne_bot x
275+
simpa [genWeightSpaceOf, Module.End.maxGenEigenspace_def] using χ.genWeightSpaceOf_ne_bot x
276276
exact Module.End.hasEigenvalue_of_hasGenEigenvalue hk
277277

278278
lemma apply_eq_zero_of_isNilpotent [NoZeroSMulDivisors R M] [IsReduced R]
@@ -313,7 +313,7 @@ theorem exists_genWeightSpace_le_ker_of_isNoetherian [IsNoetherian R M] (χ : L
313313
intro m hm
314314
replace hm : m ∈ (toEnd R L M x).maxGenEigenspace (χ x) :=
315315
genWeightSpace_le_genWeightSpaceOf M x χ hm
316-
rwa [Module.End.maxGenEigenspace_eq] at hm
316+
rwa [Module.End.maxGenEigenspace_eq, Module.End.genEigenspace_def] at hm
317317

318318
variable (R) in
319319
theorem exists_genWeightSpace_zero_le_ker_of_isNoetherian
@@ -638,6 +638,8 @@ end fitting_decomposition
638638
lemma disjoint_genWeightSpaceOf [NoZeroSMulDivisors R M] {x : L} {φ₁ φ₂ : R} (h : φ₁ ≠ φ₂) :
639639
Disjoint (genWeightSpaceOf M φ₁ x) (genWeightSpaceOf M φ₂ x) := by
640640
rw [LieSubmodule.disjoint_iff_coe_toSubmodule]
641+
dsimp [genWeightSpaceOf]
642+
simp_rw [Module.End.maxGenEigenspace_def]
641643
exact Module.End.disjoint_iSup_genEigenspace _ h
642644

643645
lemma disjoint_genWeightSpace [NoZeroSMulDivisors R M] {χ₁ χ₂ : L → R} (h : χ₁ ≠ χ₂) :
@@ -707,6 +709,8 @@ lemma independent_genWeightSpace' [NoZeroSMulDivisors R M] :
707709
lemma independent_genWeightSpaceOf [NoZeroSMulDivisors R M] (x : L) :
708710
CompleteLattice.Independent fun (χ : R) ↦ genWeightSpaceOf M χ x := by
709711
rw [LieSubmodule.independent_iff_coe_toSubmodule]
712+
dsimp [genWeightSpaceOf]
713+
simp_rw [Module.End.maxGenEigenspace_def]
710714
exact (toEnd R L M x).independent_genEigenspace
711715

712716
lemma finite_genWeightSpaceOf_ne_bot [NoZeroSMulDivisors R M] [IsNoetherian R M] (x : L) :
@@ -747,6 +751,8 @@ lemma iSup_genWeightSpaceOf_eq_top [IsTriangularizable R L M] (x : L) :
747751
⨆ (φ : R), genWeightSpaceOf M φ x = ⊤ := by
748752
rw [← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.iSup_coe_toSubmodule,
749753
LieSubmodule.top_coeSubmodule]
754+
dsimp [genWeightSpaceOf]
755+
simp_rw [Module.End.maxGenEigenspace_def]
750756
exact IsTriangularizable.iSup_eq_top x
751757

752758
open LinearMap FiniteDimensional in

Mathlib/Algebra/Lie/Weights/Linear.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ instance instLinearWeightsOfIsLieAbelian [IsLieAbelian L] [NoZeroSMulDivisors R
9898
rw [commute_iff_lie_eq, ← LieHom.map_lie, trivial_lie_zero, LieHom.map_zero]
9999
intro χ hχ x y
100100
simp_rw [Ne, ← LieSubmodule.coe_toSubmodule_eq_iff, genWeightSpace, genWeightSpaceOf,
101-
LieSubmodule.iInf_coe_toSubmodule, LieSubmodule.bot_coeSubmodule] at hχ
101+
LieSubmodule.iInf_coe_toSubmodule, LieSubmodule.bot_coeSubmodule,
102+
Module.End.maxGenEigenspace_def] at hχ
102103
exact Module.End.map_add_of_iInf_genEigenspace_ne_bot_of_commute
103104
(toEnd R L M).toLinearMap χ hχ h x y
104105
{ map_add := aux
105106
map_smul := fun χ hχ t x ↦ by
106107
simp_rw [Ne, ← LieSubmodule.coe_toSubmodule_eq_iff, genWeightSpace, genWeightSpaceOf,
107-
LieSubmodule.iInf_coe_toSubmodule, LieSubmodule.bot_coeSubmodule] at hχ
108+
LieSubmodule.iInf_coe_toSubmodule, LieSubmodule.bot_coeSubmodule,
109+
Module.End.maxGenEigenspace_def] at hχ
108110
exact Module.End.map_smul_of_iInf_genEigenspace_ne_bot
109111
(toEnd R L M).toLinearMap χ hχ t x
110112
map_lie := fun χ hχ t x ↦ by

Mathlib/LinearAlgebra/Eigenspace/Basic.lean

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,26 @@ variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M
6363
def eigenspace (f : End R M) (μ : R) : Submodule R M :=
6464
LinearMap.ker (f - algebraMap R (End R M) μ)
6565

66+
lemma eigenspace_def (f : End R M) (μ : R) :
67+
f.eigenspace μ = LinearMap.ker (f - algebraMap R (End R M) μ) := rfl
68+
6669
@[simp]
6770
theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by simp [eigenspace]
6871

6972
/-- A nonzero element of an eigenspace is an eigenvector. (Def 5.7 of [axler2015]) -/
7073
def HasEigenvector (f : End R M) (μ : R) (x : M) : Prop :=
7174
x ∈ eigenspace f μ ∧ x ≠ 0
7275

76+
lemma hasEigenvector_iff {f : End R M} {μ : R} {x : M} :
77+
f.HasEigenvector μ x ↔ x ∈ eigenspace f μ ∧ x ≠ 0 := Iff.rfl
78+
7379
/-- A scalar `μ` is an eigenvalue for a linear map `f` if there are nonzero vectors `x`
7480
such that `f x = μ • x`. (Def 5.5 of [axler2015]) -/
7581
def HasEigenvalue (f : End R M) (a : R) : Prop :=
7682
eigenspace f a ≠ ⊥
7783

84+
lemma hasEigenvalue_iff (f : End R M) (μ : R) : f.HasEigenvalue μ ↔ eigenspace f μ ≠ ⊥ := Iff.rfl
85+
7886
/-- The eigenvalues of the endomorphism `f`, as a subtype of `R`. -/
7987
def Eigenvalues (f : End R M) : Type _ :=
8088
{ μ : R // f.HasEigenvalue μ }
@@ -161,6 +169,9 @@ def genEigenspace (f : End R M) (μ : R) : ℕ →o Submodule R M where
161169
LinearMap.ker_le_ker_comp ((f - algebraMap R (End R M) μ) ^ k)
162170
((f - algebraMap R (End R M) μ) ^ (m - k))
163171

172+
lemma genEigenspace_def (f : End R M) (μ : R) (k : ℕ) :
173+
f.genEigenspace μ k = LinearMap.ker ((f - algebraMap R (End R M) μ) ^ k) := rfl
174+
164175
@[simp]
165176
theorem mem_genEigenspace (f : End R M) (μ : R) (k : ℕ) (m : M) :
166177
m ∈ f.genEigenspace μ k ↔ ((f - μ • (1 : End R M)) ^ k) m = 0 := Iff.rfl
@@ -175,16 +186,25 @@ theorem genEigenspace_zero (f : End R M) (k : ℕ) :
175186
def HasGenEigenvector (f : End R M) (μ : R) (k : ℕ) (x : M) : Prop :=
176187
x ≠ 0 ∧ x ∈ genEigenspace f μ k
177188

189+
lemma hasGenEigenvector_iff {f : End R M} {μ : R} {k : ℕ} {x : M} :
190+
f.HasGenEigenvector μ k x ↔ x ≠ 0 ∧ x ∈ f.genEigenspace μ k := Iff.rfl
191+
178192
/-- A scalar `μ` is a generalized eigenvalue for a linear map `f` and an exponent `k ∈ ℕ` if there
179193
are generalized eigenvectors for `f`, `k`, and `μ`. -/
180194
def HasGenEigenvalue (f : End R M) (μ : R) (k : ℕ) : Prop :=
181195
genEigenspace f μ k ≠ ⊥
182196

197+
lemma hasGenEigenvalue_iff (f : End R M) (μ : R) (k : ℕ) :
198+
f.HasGenEigenvalue μ k ↔ genEigenspace f μ k ≠ ⊥ := Iff.rfl
199+
183200
/-- The generalized eigenrange for a linear map `f`, a scalar `μ`, and an exponent `k ∈ ℕ` is the
184201
range of `(f - μ • id) ^ k`. -/
185202
def genEigenrange (f : End R M) (μ : R) (k : ℕ) : Submodule R M :=
186203
LinearMap.range ((f - algebraMap R (End R M) μ) ^ k)
187204

205+
lemma genEigenrange_def (f : End R M) (μ : R) (k : ℕ) :
206+
f.genEigenrange μ k = LinearMap.range ((f - algebraMap R (End R M) μ) ^ k) := rfl
207+
188208
/-- The exponent of a generalized eigenvalue is never 0. -/
189209
theorem exp_ne_zero_of_hasGenEigenvalue {f : End R M} {μ : R} {k : ℕ}
190210
(h : f.HasGenEigenvalue μ k) : k ≠ 0 := by
@@ -195,6 +215,9 @@ theorem exp_ne_zero_of_hasGenEigenvalue {f : End R M} {μ : R} {k : ℕ}
195215
def maxGenEigenspace (f : End R M) (μ : R) : Submodule R M :=
196216
⨆ k, f.genEigenspace μ k
197217

218+
lemma maxGenEigenspace_def (f : End R M) (μ : R) :
219+
f.maxGenEigenspace μ = ⨆ k, f.genEigenspace μ k := rfl
220+
198221
theorem genEigenspace_le_maximal (f : End R M) (μ : R) (k : ℕ) :
199222
f.genEigenspace μ k ≤ f.maxGenEigenspace μ :=
200223
le_iSup _ _

Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ variable {f} {μ : K}
6868

6969
theorem hasEigenvalue_of_isRoot (h : (minpoly K f).IsRoot μ) : f.HasEigenvalue μ := by
7070
cases' dvd_iff_isRoot.2 h with p hp
71-
rw [HasEigenvalue, eigenspace]
71+
rw [hasEigenvalue_iff, eigenspace_def]
7272
intro con
7373
cases' (LinearMap.isUnit_iff_ker_eq_bot _).2 con with u hu
7474
have p_ne_0 : p ≠ 0 := by

Mathlib/LinearAlgebra/Eigenspace/Semisimple.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ lemma IsSemisimple.genEigenspace_eq_eigenspace
5555
lemma IsSemisimple.maxGenEigenspace_eq_eigenspace
5656
(hf : f.IsSemisimple) (μ : R) :
5757
f.maxGenEigenspace μ = f.eigenspace μ := by
58-
simp_rw [maxGenEigenspace, ← (f.genEigenspace μ).monotone.iSup_nat_add 1,
58+
simp_rw [maxGenEigenspace_def, ← (f.genEigenspace μ).monotone.iSup_nat_add 1,
5959
hf.genEigenspace_eq_eigenspace μ (Nat.zero_lt_succ _), ciSup_const]
6060

6161
end Module.End

Mathlib/LinearAlgebra/Eigenspace/Triangularizable.lean

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ theorem exists_hasEigenvalue_of_iSup_genEigenspace_eq_top [Nontrivial M] {f : En
5353
intro μ
5454
replace contra : ∀ k, f.genEigenspace μ k = ⊥ := fun k ↦ by
5555
have hk : ¬ f.HasGenEigenvalue μ k := fun hk ↦ contra μ (f.hasEigenvalue_of_hasGenEigenvalue hk)
56-
rwa [HasGenEigenvalue, not_not] at hk
56+
rwa [hasGenEigenvalue_iff, not_not] at hk
5757
simp [contra]
5858

5959
-- This is Lemma 5.21 of [axler2015], although we are no longer following that proof.
@@ -99,6 +99,8 @@ theorem iSup_genEigenspace_eq_top [IsAlgClosed K] [FiniteDimensional K V] (f : E
9999
apply pos_finrank_genEigenspace_of_hasEigenvalue hμ₀ (Nat.zero_lt_succ n)
100100
-- and the dimensions of `ES` and `ER` add up to `finrank K V`.
101101
have h_dim_add : finrank K ER + finrank K ES = finrank K V := by
102+
dsimp only [ER, ES]
103+
rw [Module.End.genEigenspace_def, Module.End.genEigenrange_def]
102104
apply LinearMap.finrank_range_add_finrank_ker
103105
-- Therefore the dimension `ER` mus be smaller than `finrank K V`.
104106
have h_dim_ER : finrank K ER < n.succ := by linarith
@@ -168,7 +170,8 @@ theorem inf_iSup_genEigenspace [FiniteDimensional K V] (h : ∀ x ∈ p, f x ∈
168170
· rw [hμμ']
169171
replace hm₂ : ((f - algebraMap K (End K V) μ') ^ finrank K V) (m μ') = 0 := by
170172
obtain ⟨k, hk⟩ := (mem_iSup_of_chain _ _).mp (hm₂ μ')
171-
exact Module.End.genEigenspace_le_genEigenspace_finrank _ _ k hk
173+
simpa only [End.mem_genEigenspace] using
174+
Module.End.genEigenspace_le_genEigenspace_finrank _ _ k hk
172175
have : _ = g := (m.support.erase μ).noncommProd_erase_mul (Finset.mem_erase.mpr ⟨hμμ', hμ'⟩)
173176
(fun μ ↦ (f - algebraMap K (End K V) μ) ^ finrank K V) (fun μ₁ _ μ₂ _ _ ↦ h_comm μ₁ μ₂)
174177
rw [← this, LinearMap.mul_apply, hm₂, _root_.map_zero]
@@ -185,9 +188,10 @@ theorem inf_iSup_genEigenspace [FiniteDimensional K V] (h : ∀ x ∈ p, f x ∈
185188
apply LinearMap.injOn_of_disjoint_ker (subset_refl _)
186189
have this := f.independent_genEigenspace
187190
simp_rw [f.iSup_genEigenspace_eq_genEigenspace_finrank] at this ⊢
188-
rw [LinearMap.ker_noncommProd_eq_of_supIndep_ker _ _ <| this.supIndep' (m.support.erase μ),
189-
← Finset.sup_eq_iSup]
190-
exact Finset.supIndep_iff_disjoint_erase.mp (this.supIndep' m.support) μ hμ
191+
rw [LinearMap.ker_noncommProd_eq_of_supIndep_ker, ← Finset.sup_eq_iSup]
192+
· simpa only [End.genEigenspace_def] using
193+
Finset.supIndep_iff_disjoint_erase.mp (this.supIndep' m.support) μ hμ
194+
· simpa only [End.genEigenspace_def] using this.supIndep' (m.support.erase μ)
191195
have hg₄ : SurjOn g
192196
↑(p ⊓ ⨆ k, f.genEigenspace μ k) ↑(p ⊓ ⨆ k, f.genEigenspace μ k) := by
193197
have : MapsTo g

Mathlib/LinearAlgebra/Eigenspace/Zero.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ lemma finrank_maxGenEigenspace (φ : Module.End K M) :
135135
finrank K (φ.maxGenEigenspace 0) = natTrailingDegree (φ.charpoly) := by
136136
set V := φ.maxGenEigenspace 0
137137
have hV : V = ⨆ (n : ℕ), ker (φ ^ n) := by
138-
simp [V, Module.End.maxGenEigenspace, Module.End.genEigenspace]
138+
simp [V, Module.End.maxGenEigenspace_def, Module.End.genEigenspace_def]
139139
let W := ⨅ (n : ℕ), LinearMap.range (φ ^ n)
140140
have hVW : IsCompl V W := by
141141
rw [hV]

Mathlib/LinearAlgebra/Matrix/Gershgorin.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ theorem det_ne_zero_of_sum_row_lt_diag (h : ∀ k, ∑ j ∈ Finset.univ.erase k
6262
suffices ∃ k, 0 ∈ Metric.closedBall (A k k) (∑ j ∈ Finset.univ.erase k, ‖A k j‖) by
6363
exact this.imp (fun a h ↦ by rwa [mem_closedBall_iff_norm', sub_zero] at h)
6464
refine eigenvalue_mem_ball ?_
65-
rw [Module.End.HasEigenvalue, Module.End.eigenspace_zero, ne_comm]
65+
rw [Module.End.hasEigenvalue_iff, Module.End.eigenspace_zero, ne_comm]
6666
exact ne_of_lt (LinearMap.bot_lt_ker_of_det_eq_zero (by rwa [LinearMap.det_toLin']))
6767

6868
/-- If `A` is a column strictly dominant diagonal matrix, then it's determinant is nonzero. -/

0 commit comments

Comments
 (0)