Skip to content

Commit ac7c96f

Browse files
committed
chore(Algebra/Category/ModuleCat): rename ModuleCat.asHom to ModuleCat.ofHom (#19705)
As discussed in the comments for #19511. It seems the choice between `ofHom` and `asHom` is somewhat inconsistent in concrete categories, but `ofHom` wins. In particular, we want to be consistent with the newly refactored `AlgebraCat.ofHom` and the constructor for objects `ModuleCat.of`. The choice between `asHom` and `ofHom` was only made a few months ago: #17476. It's a bit unfortunate to go back on something that was deprecated so recently, but I think the result is worth the pain. I have not touched `asHomLeft` and `asHomRight` since #19511 will replace these with `ofHom` everywhere anyway.
1 parent b10b730 commit ac7c96f

File tree

17 files changed

+70
-70
lines changed

17 files changed

+70
-70
lines changed

Mathlib/Algebra/Category/AlgebraCat/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ instance hasForgetToRing : HasForget₂ (AlgebraCat.{v} R) RingCat.{v} where
153153
instance hasForgetToModule : HasForget₂ (AlgebraCat.{v} R) (ModuleCat.{v} R) where
154154
forget₂ :=
155155
{ obj := fun M => ModuleCat.of R M
156-
map := fun f => ModuleCat.asHom f.hom.toLinearMap }
156+
map := fun f => ModuleCat.ofHom f.hom.toLinearMap }
157157

158158
@[simp]
159159
lemma forget₂_module_obj (X : AlgebraCat.{v} R) :
@@ -162,7 +162,7 @@ lemma forget₂_module_obj (X : AlgebraCat.{v} R) :
162162

163163
@[simp]
164164
lemma forget₂_module_map {X Y : AlgebraCat.{v} R} (f : X ⟶ Y) :
165-
(forget₂ (AlgebraCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.asHom f.hom.toLinearMap :=
165+
(forget₂ (AlgebraCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=
166166
rfl
167167

168168
variable {R} in

Mathlib/Algebra/Category/CoalgebraCat/ComonEquivalence.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ variable {R : Type u} [CommRing R]
3838
/-- An `R`-coalgebra is a comonoid object in the category of `R`-modules. -/
3939
@[simps] def toComonObj (X : CoalgebraCat R) : Comon_ (ModuleCat R) where
4040
X := ModuleCat.of R X
41-
counit := ModuleCat.asHom Coalgebra.counit
42-
comul := ModuleCat.asHom Coalgebra.comul
41+
counit := ModuleCat.ofHom Coalgebra.counit
42+
comul := ModuleCat.ofHom Coalgebra.comul
4343
counit_comul := by simpa only [ModuleCat.of_coe] using Coalgebra.rTensor_counit_comp_comul
4444
comul_counit := by simpa only [ModuleCat.of_coe] using Coalgebra.lTensor_counit_comp_comul
4545
comul_assoc := by simp_rw [ModuleCat.of_coe]; exact Coalgebra.coassoc.symm
@@ -50,7 +50,7 @@ variable (R) in
5050
def toComon : CoalgebraCat R ⥤ Comon_ (ModuleCat R) where
5151
obj X := toComonObj X
5252
map f :=
53-
{ hom := ModuleCat.asHom f.1
53+
{ hom := ModuleCat.ofHom f.1
5454
hom_counit := f.1.counit_comp
5555
hom_comul := f.1.map_comp_comul.symm }
5656

Mathlib/Algebra/Category/FGModuleCat/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ end FGModuleCat
267267
@[simp] theorem LinearMap.comp_id_fgModuleCat
268268
{R} [Ring R] {G : FGModuleCat.{u} R} {H : Type u} [AddCommGroup H] [Module R H]
269269
(f : G →ₗ[R] H) : f.comp (𝟙 G) = f :=
270-
Category.id_comp (ModuleCat.asHom f)
270+
Category.id_comp (ModuleCat.ofHom f)
271271
@[simp] theorem LinearMap.id_fgModuleCat_comp
272272
{R} [Ring R] {G : Type u} [AddCommGroup G] [Module R G] {H : FGModuleCat.{u} R}
273273
(f : G →ₗ[R] H) : LinearMap.comp (𝟙 H) f = f :=
274-
Category.comp_id (ModuleCat.asHom f)
274+
Category.comp_id (ModuleCat.ofHom f)

Mathlib/Algebra/Category/ModuleCat/Basic.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,21 @@ variable {X₁ X₂ : Type v}
209209
open ModuleCat
210210

211211
/-- Reinterpreting a linear map in the category of `R`-modules. -/
212-
def ModuleCat.asHom [AddCommGroup X₁] [Module R X₁] [AddCommGroup X₂] [Module R X₂] :
212+
def ModuleCat.ofHom [AddCommGroup X₁] [Module R X₁] [AddCommGroup X₂] [Module R X₂] :
213213
(X₁ →ₗ[R] X₂) → (ModuleCat.of R X₁ ⟶ ModuleCat.of R X₂) :=
214214
id
215215

216-
@[deprecated (since := "2024-10-06")] alias ModuleCat.ofHom := ModuleCat.asHom
216+
@[deprecated (since := "2024-12-03")] alias ModuleCat.asHom := ModuleCat.ofHom
217217

218218
/-- Reinterpreting a linear map in the category of `R`-modules -/
219-
scoped[ModuleCat] notation "↟" f:1024 => ModuleCat.asHom f
219+
scoped[ModuleCat] notation "↟" f:1024 => ModuleCat.ofHom f
220220

221221
@[simp 1100]
222-
theorem ModuleCat.asHom_apply {R : Type u} [Ring R] {X Y : Type v} [AddCommGroup X] [Module R X]
222+
theorem ModuleCat.ofHom_apply {R : Type u} [Ring R] {X Y : Type v} [AddCommGroup X] [Module R X]
223223
[AddCommGroup Y] [Module R Y] (f : X →ₗ[R] Y) (x : X) : (↟ f) x = f x :=
224224
rfl
225225

226-
@[deprecated (since := "2024-10-06")] alias ModuleCat.ofHom_apply := ModuleCat.asHom_apply
226+
@[deprecated (since := "2024-10-06")] alias ModuleCat.asHom_apply := ModuleCat.ofHom_apply
227227

228228
/-- Reinterpreting a linear map in the category of `R`-modules. -/
229229
def ModuleCat.asHomRight [AddCommGroup X₁] [Module R X₁] {X₂ : ModuleCat.{v} R} :
@@ -440,8 +440,8 @@ end ModuleCat
440440
@[simp] theorem LinearMap.comp_id_moduleCat
441441
{R} [Ring R] {G : ModuleCat.{u} R} {H : Type u} [AddCommGroup H] [Module R H] (f : G →ₗ[R] H) :
442442
f.comp (𝟙 G) = f :=
443-
Category.id_comp (ModuleCat.asHom f)
443+
Category.id_comp (ModuleCat.ofHom f)
444444
@[simp] theorem LinearMap.id_moduleCat_comp
445445
{R} [Ring R] {G : Type u} [AddCommGroup G] [Module R G] {H : ModuleCat.{u} R} (f : G →ₗ[R] H) :
446446
LinearMap.comp (𝟙 H) f = f :=
447-
Category.comp_id (ModuleCat.asHom f)
447+
Category.comp_id (ModuleCat.ofHom f)

Mathlib/Algebra/Category/ModuleCat/Biproducts.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ of modules. -/
144144
noncomputable def lequivProdOfRightSplitExact {f : B →ₗ[R] M} (hj : Function.Injective j)
145145
(exac : LinearMap.range j = LinearMap.ker g) (h : g.comp f = LinearMap.id) : (A × B) ≃ₗ[R] M :=
146146
((ShortComplex.Splitting.ofExactOfSection _
147-
(ShortComplex.Exact.moduleCat_of_range_eq_ker (ModuleCat.asHom j)
148-
(ModuleCat.asHom g) exac) (asHom f) h
147+
(ShortComplex.Exact.moduleCat_of_range_eq_ker (ModuleCat.ofHom j)
148+
(ModuleCat.ofHom g) exac) (ofHom f) h
149149
(by simpa only [ModuleCat.mono_iff_injective])).isoBinaryBiproduct ≪≫
150150
biprodIsoProd _ _ ).symm.toLinearEquiv
151151

@@ -154,8 +154,8 @@ of modules. -/
154154
noncomputable def lequivProdOfLeftSplitExact {f : M →ₗ[R] A} (hg : Function.Surjective g)
155155
(exac : LinearMap.range j = LinearMap.ker g) (h : f.comp j = LinearMap.id) : (A × B) ≃ₗ[R] M :=
156156
((ShortComplex.Splitting.ofExactOfRetraction _
157-
(ShortComplex.Exact.moduleCat_of_range_eq_ker (ModuleCat.asHom j)
158-
(ModuleCat.asHom g) exac) (ModuleCat.asHom f) h
157+
(ShortComplex.Exact.moduleCat_of_range_eq_ker (ModuleCat.ofHom j)
158+
(ModuleCat.ofHom g) exac) (ModuleCat.ofHom f) h
159159
(by simpa only [ModuleCat.epi_iff_surjective] using hg)).isoBinaryBiproduct ≪≫
160160
biprodIsoProd _ _).symm.toLinearEquiv
161161

Mathlib/Algebra/Category/ModuleCat/Images.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ noncomputable def imageIsoRange {G H : ModuleCat.{v} R} (f : G ⟶ H) :
9797

9898
@[simp, reassoc, elementwise]
9999
theorem imageIsoRange_inv_image_ι {G H : ModuleCat.{v} R} (f : G ⟶ H) :
100-
(imageIsoRange f).inv ≫ Limits.image.ι f = ModuleCat.asHom f.range.subtype :=
100+
(imageIsoRange f).inv ≫ Limits.image.ι f = ModuleCat.ofHom f.range.subtype :=
101101
IsImage.isoExt_inv_m _ _
102102

103103
@[simp, reassoc, elementwise]
104104
theorem imageIsoRange_hom_subtype {G H : ModuleCat.{v} R} (f : G ⟶ H) :
105-
(imageIsoRange f).hom ≫ ModuleCat.asHom f.range.subtype = Limits.image.ι f := by
105+
(imageIsoRange f).hom ≫ ModuleCat.ofHom f.range.subtype = Limits.image.ι f := by
106106
rw [← imageIsoRange_inv_image_ι f, Iso.hom_inv_id_assoc]
107107

108108
end ModuleCat

Mathlib/Algebra/Category/ModuleCat/Injective.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ theorem injective_module_of_injective_object
2727
[inj : CategoryTheory.Injective <| ModuleCat.of R M] :
2828
Module.Injective R M where
2929
out X Y _ _ _ _ f hf g := by
30-
have : CategoryTheory.Mono (ModuleCat.asHom f) := (ModuleCat.mono_iff_injective _).mpr hf
31-
obtain ⟨l, rfl⟩ := inj.factors (ModuleCat.asHom g) (ModuleCat.asHom f)
30+
have : CategoryTheory.Mono (ModuleCat.ofHom f) := (ModuleCat.mono_iff_injective _).mpr hf
31+
obtain ⟨l, rfl⟩ := inj.factors (ModuleCat.ofHom g) (ModuleCat.ofHom f)
3232
exact ⟨l, fun _ ↦ rfl⟩
3333

3434
theorem injective_iff_injective_object :

Mathlib/Algebra/Category/ModuleCat/Kernels.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ variable {M N : ModuleCat.{v} R} (f : M ⟶ N)
2626
/-- The kernel cone induced by the concrete kernel. -/
2727
def kernelCone : KernelFork f :=
2828
-- Porting note: previously proven by tidy
29-
KernelFork.ofι (asHom f.ker.subtype) <| by ext x; cases x; assumption
29+
KernelFork.ofι (ofHom f.ker.subtype) <| by ext x; cases x; assumption
3030

3131
/-- The kernel of a linear map is a kernel in the categorical sense. -/
3232
def kernelIsLimit : IsLimit (kernelCone f) :=
@@ -44,7 +44,7 @@ def kernelIsLimit : IsLimit (kernelCone f) :=
4444

4545
/-- The cokernel cocone induced by the projection onto the quotient. -/
4646
def cokernelCocone : CokernelCofork f :=
47-
CokernelCofork.ofπ (asHom f.range.mkQ) <| LinearMap.range_mkQ_comp _
47+
CokernelCofork.ofπ (ofHom f.range.mkQ) <| LinearMap.range_mkQ_comp _
4848

4949
/-- The projection onto the quotient is a cokernel in the categorical sense. -/
5050
def cokernelIsColimit : IsColimit (cokernelCocone f) :=
@@ -53,10 +53,10 @@ def cokernelIsColimit : IsColimit (cokernelCocone f) :=
5353
f.range.liftQ (Cofork.π s) <| LinearMap.range_le_ker_iff.2 <| CokernelCofork.condition s)
5454
(fun s => f.range.liftQ_mkQ (Cofork.π s) _) fun s m h => by
5555
-- Porting note (https://github.com/leanprover-community/mathlib4/pull/11036): broken dot notation
56-
haveI : Epi (asHom (LinearMap.range f).mkQ) :=
56+
haveI : Epi (ofHom (LinearMap.range f).mkQ) :=
5757
(epi_iff_range_eq_top _).mpr (Submodule.range_mkQ _)
5858
-- Porting note (https://github.com/leanprover-community/mathlib4/pull/11036): broken dot notation
59-
apply (cancel_epi (asHom (LinearMap.range f).mkQ)).1
59+
apply (cancel_epi (ofHom (LinearMap.range f).mkQ)).1
6060
convert h
6161
-- Porting note: no longer necessary
6262
-- exact Submodule.liftQ_mkQ _ _ _

Mathlib/Algebra/Homology/ShortComplex/ModuleCat.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ linear maps `f` and `g` and the vanishing of their composition. -/
3333
def moduleCatMk {X₁ X₂ X₃ : Type v} [AddCommGroup X₁] [AddCommGroup X₂] [AddCommGroup X₃]
3434
[Module R X₁] [Module R X₂] [Module R X₃] (f : X₁ →ₗ[R] X₂) (g : X₂ →ₗ[R] X₃)
3535
(hfg : g.comp f = 0) : ShortComplex (ModuleCat.{v} R) :=
36-
ShortComplex.mk (ModuleCat.asHom f) (ModuleCat.asHom g) hfg
36+
ShortComplex.mk (ModuleCat.ofHom f) (ModuleCat.ofHom g) hfg
3737

3838
variable (S : ShortComplex (ModuleCat.{v} R))
3939

@@ -138,7 +138,7 @@ def moduleCatLeftHomologyData : S.LeftHomologyData where
138138
erw [Submodule.Quotient.mk_eq_zero]
139139
rw [LinearMap.mem_range]
140140
apply exists_apply_eq_apply
141-
hπ := ModuleCat.cokernelIsColimit (ModuleCat.asHom S.moduleCatToCycles)
141+
hπ := ModuleCat.cokernelIsColimit (ModuleCat.ofHom S.moduleCatToCycles)
142142

143143
@[simp]
144144
lemma moduleCatLeftHomologyData_f' :

Mathlib/CategoryTheory/Linear/Yoneda.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace CategoryTheory
2828
variable (R : Type w) [Ring R] {C : Type u} [Category.{v} C] [Preadditive C] [Linear R C]
2929
variable (C)
3030

31-
-- Porting note: inserted specific `ModuleCat.asHom` in the definition of `linearYoneda`
31+
-- Porting note: inserted specific `ModuleCat.ofHom` in the definition of `linearYoneda`
3232
-- and similarly in `linearCoyoneda`, otherwise many simp lemmas are not triggered automatically.
3333
-- Eventually, doing so allows more proofs to be automatic!
3434
/-- The Yoneda embedding for `R`-linear categories `C`,
@@ -38,9 +38,9 @@ with value on `Y : Cᵒᵖ` given by `ModuleCat.of R (unop Y ⟶ X)`. -/
3838
def linearYoneda : C ⥤ Cᵒᵖ ⥤ ModuleCat R where
3939
obj X :=
4040
{ obj := fun Y => ModuleCat.of R (unop Y ⟶ X)
41-
map := fun f => ModuleCat.asHom (Linear.leftComp R _ f.unop) }
41+
map := fun f => ModuleCat.ofHom (Linear.leftComp R _ f.unop) }
4242
map {X₁ X₂} f :=
43-
{ app := fun Y => @ModuleCat.asHom R _ (Y.unop ⟶ X₁) (Y.unop ⟶ X₂) _ _ _ _
43+
{ app := fun Y => @ModuleCat.ofHom R _ (Y.unop ⟶ X₁) (Y.unop ⟶ X₂) _ _ _ _
4444
(Linear.rightComp R _ f) }
4545

4646
/-- The Yoneda embedding for `R`-linear categories `C`,
@@ -50,9 +50,9 @@ with value on `X : C` given by `ModuleCat.of R (unop Y ⟶ X)`. -/
5050
def linearCoyoneda : Cᵒᵖ ⥤ C ⥤ ModuleCat R where
5151
obj Y :=
5252
{ obj := fun X => ModuleCat.of R (unop Y ⟶ X)
53-
map := fun f => ModuleCat.asHom (Linear.rightComp R _ f) }
53+
map := fun f => ModuleCat.ofHom (Linear.rightComp R _ f) }
5454
map {Y₁ Y₂} f :=
55-
{ app := fun X => @ModuleCat.asHom R _ (unop Y₁ ⟶ X) (unop Y₂ ⟶ X) _ _ _ _
55+
{ app := fun X => @ModuleCat.ofHom R _ (unop Y₁ ⟶ X) (unop Y₂ ⟶ X) _ _ _ _
5656
(Linear.leftComp _ _ f.unop) }
5757

5858
instance linearYoneda_obj_additive (X : C) : ((linearYoneda R C).obj X).Additive where

0 commit comments

Comments
 (0)