Skip to content

Commit c85f12d

Browse files
urkudthemathqueen
andcommitted
chore(*): restrict operations to LinearMaps (leanprover-community#33241)
Make `LinearMap.ker`, `LinearMap.range`, `Submodule.map`, and `Submodule.comap` work for `LinearMap`s only. Co-authored-by: Monica Omar <23701951+themathqueen@users.noreply.github.com>
1 parent 31b5cb4 commit c85f12d

86 files changed

Lines changed: 538 additions & 545 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Mathlib/Algebra/Algebra/Subalgebra/Tower.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ section CommSemiring
123123
@[simp]
124124
lemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]
125125
[Algebra R A] (S : Subalgebra R A) :
126-
LinearMap.range (IsScalarTower.toAlgHom R S A) = Subalgebra.toSubmodule S := by
126+
LinearMap.range (IsScalarTower.toAlgHom R S A : S →ₗ[R] A) = Subalgebra.toSubmodule S := by
127127
ext
128128
simp [algebraMap_eq]
129129

Mathlib/Algebra/Category/ContinuousCohomology/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _root_.continuousCohomology (n : ℕ) : Action (TopModuleCat R) G ⥤ TopMod
163163
/-- The `0`-homogeneous cochains are isomorphic to `Xᴳ`. -/
164164
def kerHomogeneousCochainsZeroEquiv
165165
(X : Action (TopModuleCat R) G) (n : ℕ) (hn : n = 1) :
166-
LinearMap.ker (((homogeneousCochains R G).obj X).d 0 n).hom ≃L[R] (invariants R G).obj X where
166+
(((homogeneousCochains R G).obj X).d 0 n).hom.ker ≃L[R] (invariants R G).obj X where
167167
toFun x :=
168168
{ val := DFunLike.coe (F := C(G, _)) x.1.1 1
169169
property g := by

Mathlib/Algebra/Category/ModuleCat/Topology/Homology.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variable {M N : TopModuleCat.{v} R} (φ : M ⟶ N)
3535
section kernel
3636

3737
/-- Kernel in `TopModuleCat R` is the kernel of the linear map with the subspace topology. -/
38-
abbrev ker : TopModuleCat R := .of R (LinearMap.ker φ.hom)
38+
abbrev ker : TopModuleCat R := .of R φ.hom.ker
3939

4040
/-- The inclusion map from the kernel in `TopModuleCat R`. -/
4141
def kerι : ker φ ⟶ M := ofHom ⟨Submodule.subtype _, continuous_subtype_val⟩
@@ -49,9 +49,9 @@ instance : Mono (kerι φ) := ConcreteCategory.mono_of_injective (kerι φ) <| S
4949
/-- `TopModuleCat.ker` is indeed the kernel in `TopModuleCat R`. -/
5050
def isLimitKer : IsLimit (KernelFork.ofι (kerι φ) (kerι_comp φ)) :=
5151
isLimitAux (KernelFork.ofι (kerι φ) (kerι_comp φ))
52-
(fun s ↦ ofHom <| (Fork.ι s).hom.codRestrict (LinearMap.ker φ.hom) fun m ↦ by
53-
rw [LinearMap.mem_ker, ← ConcreteCategory.comp_apply (Fork.ι s) φ,
54-
KernelFork.condition, hom_zero_apply])
52+
(fun s ↦ ofHom <| (Fork.ι s).hom.codRestrict φ.hom.ker fun m ↦ by
53+
rw [LinearMap.mem_ker, ContinuousLinearMap.coe_coe,
54+
← ConcreteCategory.comp_apply (Fork.ι s) φ, KernelFork.condition, hom_zero_apply])
5555
(fun s ↦ rfl)
5656
(fun s m h ↦ by dsimp at h ⊢; rw [← cancel_mono (kerι φ), h]; rfl)
5757

@@ -60,7 +60,7 @@ end kernel
6060
section cokernel
6161

6262
/-- Cokernel in `TopModuleCat R` is the cokernel of the linear map with the quotient topology. -/
63-
abbrev coker : TopModuleCat R := .of R (N ⧸ LinearMap.range φ.hom)
63+
abbrev coker : TopModuleCat R := .of R (N ⧸ φ.hom.range)
6464

6565
/-- The projection map to the cokernel in `TopModuleCat R`. -/
6666
def cokerπ : N ⟶ coker φ := ofHom <| ⟨Submodule.mkQ _, by tauto⟩
@@ -81,7 +81,7 @@ instance : Epi (cokerπ φ) := ConcreteCategory.epi_of_surjective (cokerπ φ) (
8181
def isColimitCoker : IsColimit (CokernelCofork.ofπ (cokerπ φ) (comp_cokerπ φ)) :=
8282
isColimitAux (.ofπ (cokerπ φ) (comp_cokerπ φ))
8383
(fun s ↦ ofHom <|
84-
{ toLinearMap := (LinearMap.range φ.hom).liftQ s.π.hom.toLinearMap
84+
{ toLinearMap := φ.hom.range.liftQ s.π.hom.toLinearMap
8585
(LinearMap.range_le_ker_iff.mpr <| show (φ ≫ s.π).hom.toLinearMap = 0 by
8686
rw [s.condition, hom_zero, ContinuousLinearMap.coe_zero])
8787
cont := Continuous.quotient_lift s.π.hom.2 _ })

Mathlib/Algebra/Lie/Weights/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ theorem zero_genWeightSpace_eq_top_of_nilpotent [IsNilpotent L M] :
315315

316316
theorem exists_genWeightSpace_le_ker_of_isNoetherian [IsNoetherian R M] (χ : L → R) (x : L) :
317317
∃ k : ℕ,
318-
genWeightSpace M χ ≤ LinearMap.ker ((toEnd R L M x - algebraMap R _ (χ x)) ^ k) := by
318+
genWeightSpace M χ ≤ ((toEnd R L M x - algebraMap R _ (χ x)) ^ k).ker := by
319319
use (toEnd R L M x).maxGenEigenspaceIndex (χ x)
320320
intro m hm
321321
replace hm : m ∈ (toEnd R L M x).maxGenEigenspace (χ x) :=

Mathlib/Algebra/Module/Submodule/Equiv.lean

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ def ofSubmodules (p : Submodule R M) (q : Submodule R₂ M₂) (h : p.map (e : M
6161
(e.submoduleMap p).trans (LinearEquiv.ofEq _ _ h)
6262

6363
@[simp]
64-
theorem ofSubmodules_apply {p : Submodule R M} {q : Submodule R₂ M₂} (h : p.map ↑e = q) (x : p) :
64+
theorem ofSubmodules_apply {p : Submodule R M} {q : Submodule R₂ M₂}
65+
(h : p.map (e : M →ₛₗ[σ₁₂] M₂) = q) (x : p) :
6566
↑(e.ofSubmodules p q h x) = e x :=
6667
rfl
6768

6869
@[simp]
69-
theorem ofSubmodules_symm_apply {p : Submodule R M} {q : Submodule R₂ M₂} (h : p.map ↑e = q)
70+
theorem ofSubmodules_symm_apply {p : Submodule R M} {q : Submodule R₂ M₂}
71+
(h : p.map (e : M →ₛₗ[σ₁₂] M₂) = q)
7072
(x : q) : ↑((e.ofSubmodules p q h).symm x) = e.symm x :=
7173
rfl
7274

@@ -116,11 +118,6 @@ theorem ofTop_symm_apply {h} (x : M) : (ofTop p h).symm x = ⟨x, h.symm ▸ tri
116118
protected theorem range : LinearMap.range (e : M →ₛₗ[σ₁₂] M₂) = ⊤ :=
117119
LinearMap.range_eq_top.2 e.toEquiv.surjective
118120

119-
@[simp]
120-
protected theorem _root_.LinearEquivClass.range [Module R M] [Module R₂ M₂] {F : Type*}
121-
[EquivLike F M M₂] [SemilinearEquivClass F σ₁₂ M M₂] (e : F) : LinearMap.range e = ⊤ :=
122-
LinearMap.range_eq_top.2 (EquivLike.surjective e)
123-
124121
theorem eq_bot_of_equiv [Module R₂ M₂] (e : p ≃ₛₗ[σ₁₂] (⊥ : Submodule R₂ M₂)) : p = ⊥ := by
125122
refine bot_unique (SetLike.le_def.2 fun b hb => (Submodule.mem_bot R).2 ?_)
126123
rw [← p.mk_eq_zero hb, ← e.map_eq_zero_iff]

Mathlib/Algebra/Module/Submodule/Invariant.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ theorem mem_invtSubmodule_iff_forall_mem_of_mem {p : Submodule R M} :
6060

6161
/-- `p` is `f.symm` invariant if and only if `p ≤ p.map f`. -/
6262
lemma mem_invtSubmodule_symm_iff_le_map {f : M ≃ₗ[R] M} {p : Submodule R M} :
63-
p ∈ invtSubmodule f.symm ↔ p ≤ p.map f :=
63+
p ∈ invtSubmodule f.symm ↔ p ≤ p.map (f : M →ₗ[R] M) :=
6464
(mem_invtSubmodule_iff_map_le _).trans (f.toEquiv.symm.subset_symm_image _ _).symm
6565

6666
namespace invtSubmodule
@@ -166,16 +166,15 @@ protected lemma comp {p : Submodule R M} {g : End R M}
166166
@[simp] lemma _root_.LinearEquiv.map_mem_invtSubmodule_conj_iff {R M N : Type*} [CommSemiring R]
167167
[AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] {f : End R M}
168168
{e : M ≃ₗ[R] N} {p : Submodule R M} :
169-
p.map e ∈ (e.conj f).invtSubmodule ↔ p ∈ f.invtSubmodule := by
170-
change p.map e.toLinearMap ∈ _ ↔ _
169+
p.map (e : M →ₗ[R] N) ∈ (e.conj f).invtSubmodule ↔ p ∈ f.invtSubmodule := by
171170
have : e.symm.toLinearMap ∘ₗ ((e ∘ₗ f) ∘ₗ e.symm.toLinearMap) ∘ₗ e = f := by ext; simp
172171
rw [LinearEquiv.conj_apply, mem_invtSubmodule, mem_invtSubmodule, Submodule.map_le_iff_le_comap,
173172
Submodule.map_equiv_eq_comap_symm, ← Submodule.comap_comp, ← Submodule.comap_comp, this]
174173

175174
lemma _root_.LinearEquiv.map_mem_invtSubmodule_iff {R M N : Type*} [CommSemiring R]
176175
[AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] {f : End R N}
177176
{e : M ≃ₗ[R] N} {p : Submodule R M} :
178-
p.map e ∈ f.invtSubmodule ↔ p ∈ (e.symm.conj f).invtSubmodule := by
177+
p.map (e : M →ₗ[R] N) ∈ f.invtSubmodule ↔ p ∈ (e.symm.conj f).invtSubmodule := by
179178
simp [← e.map_mem_invtSubmodule_conj_iff]
180179

181180
end invtSubmodule

Mathlib/Algebra/Module/Submodule/Ker.lean

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,22 @@ open Submodule
5454

5555
variable {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
5656
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
57-
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
5857

5958
/-- The kernel of a linear map `f : M → M₂` is defined to be `comap f ⊥`. This is equivalent to the
6059
set of `x : M` such that `f x = 0`. The kernel is a submodule of `M`. -/
61-
def ker (f : F) : Submodule R M :=
60+
def ker (f : M →ₛₗ[τ₁₂] M₂) : Submodule R M :=
6261
comap f ⊥
6362

6463
@[simp]
65-
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
64+
theorem mem_ker {f : M →ₛₗ[τ₁₂] M₂} {y} : y ∈ ker f ↔ f y = 0 :=
6665
mem_bot R₂
6766

6867
@[simp]
6968
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
7069
rfl
7170

7271
@[simp]
73-
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
72+
theorem map_coe_ker (f : M →ₛₗ[τ₁₂] M₂) (x : ker f) : f x = 0 :=
7473
mem_ker.1 x.2
7574

7675
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : (ker f).toAddSubmonoid = (AddMonoidHom.mker f) :=
@@ -101,18 +100,18 @@ theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂)
101100
ker f ≤ p.comap f :=
102101
fun x hx ↦ by simp [mem_ker.mp hx]
103102

104-
theorem disjoint_ker {f : F} {p : Submodule R M} :
103+
theorem disjoint_ker {f : M →ₛₗ[τ₁₂] M₂} {p : Submodule R M} :
105104
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
106105
simp [disjoint_def]
107106

108-
theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by
107+
theorem ker_eq_bot' {f : M →ₛₗ[τ₁₂] M₂} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by
109108
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
110109

111110
theorem ker_eq_bot_of_inverse {τ₂₁ : R₂ →+* R} [RingHomInvPair τ₁₂ τ₂₁] {f : M →ₛₗ[τ₁₂] M₂}
112111
{g : M₂ →ₛₗ[τ₂₁] M} (h : (g.comp f : M →ₗ[R] M) = id) : ker f = ⊥ :=
113112
ker_eq_bot'.2 fun m hm => by rw [← id_apply (R := R) m, ← h, comp_apply, hm, g.map_zero]
114113

115-
theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} :
114+
theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : M →ₛₗ[τ₁₂] M₂} {p : Submodule R M} :
116115
p ≤ ker f ↔ map f p = ⊥ := by rw [ker, eq_bot_iff, map_le_iff_le_comap]
117116

118117
theorem ker_codRestrict {τ₂₁ : R₂ →+* R} (p : Submodule R M) (f : M₂ →ₛₗ[τ₂₁] M) (hf) :
@@ -144,7 +143,7 @@ theorem exists_ne_zero_of_sSup_eq_top {f : M →ₛₗ[τ₁₂] M₂} (h : f
144143
theorem _root_.AddMonoidHom.coe_toIntLinearMap_ker {M M₂ : Type*} [AddCommGroup M] [AddCommGroup M₂]
145144
(f : M →+ M₂) : LinearMap.ker f.toIntLinearMap = AddSubgroup.toIntSubmodule f.ker := rfl
146145

147-
theorem ker_eq_bot_of_injective {f : F} (hf : Injective f) : ker f = ⊥ := by
146+
theorem ker_eq_bot_of_injective {f : M →ₛₗ[τ₁₂] M₂} (hf : Injective f) : ker f = ⊥ := by
148147
rw [eq_bot_iff]
149148
intro x hx
150149
simpa only [mem_ker, mem_bot, ← map_zero f, hf.eq_iff] using hx
@@ -167,8 +166,7 @@ variable [Ring R] [Ring R₂]
167166
variable [AddCommGroup M] [AddCommGroup M₂]
168167
variable [Module R M] [Module R₂ M₂]
169168
variable {τ₁₂ : R →+* R₂}
170-
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
171-
variable {f : F}
169+
variable {f : M →ₛₗ[τ₁₂] M₂}
172170

173171
open Submodule
174172

@@ -190,12 +188,11 @@ theorem injOn_of_disjoint_ker {p : Submodule R M} {s : Set M} (h : s ⊆ p)
190188
(hd : Disjoint p (ker f)) : Set.InjOn f s :=
191189
disjoint_ker_iff_injOn.mp hd |>.mono h
192190

193-
variable (F) in
194-
theorem _root_.LinearMapClass.ker_eq_bot : ker f = ⊥ ↔ Injective f := by
191+
theorem ker_eq_bot {f : M →ₛₗ[τ₁₂] M₂} : ker f = ⊥ ↔ Injective f := by
195192
simpa [disjoint_iff_inf_le] using disjoint_ker_iff_injOn (f := f) (p := ⊤)
196193

197-
theorem ker_eq_bot {f : M →ₛₗ[τ₁₂] M₂} : ker f = ⊥ ↔ Injective f :=
198-
LinearMapClass.ker_eq_bot _
194+
@[deprecated (since := "2025-12-23")]
195+
alias _root_.LinearMapClass.ker_eq_bot := ker_eq_bot
199196

200197
@[simp] lemma injective_domRestrict_iff {f : M →ₛₗ[τ₁₂] M₂} {S : Submodule R M} :
201198
Injective (f.domRestrict S) ↔ S ⊓ LinearMap.ker f = ⊥ := by
@@ -242,12 +239,11 @@ variable [Semiring R] [Semiring R₂] [AddCommMonoid M] [AddCommMonoid M₂]
242239
variable [Module R M] [Module R₂ M₂]
243240
variable (p : Submodule R M)
244241
variable {τ₁₂ : R →+* R₂}
245-
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
246242

247243
open LinearMap
248244

249245
@[simp]
250-
theorem comap_bot (f : F) : comap f ⊥ = ker f :=
246+
theorem comap_bot (f : M →ₛₗ[τ₁₂] M₂) : comap f ⊥ = ker f :=
251247
rfl
252248

253249
@[simp]

0 commit comments

Comments
 (0)