Skip to content

Commit f916686

Browse files
committed
chore(CategoryTheory): make MorphismProperty.IsStableUnderColimitsOfShape a class (#24773)
1 parent 5698db4 commit f916686

File tree

6 files changed

+161
-154
lines changed

6 files changed

+161
-154
lines changed

Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Colim.lean

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,16 @@ open Limits
138138
open MorphismProperty
139139

140140
variable (J C) in
141-
lemma isStableUnderColimitsOfShape_monomorphisms
141+
instance isStableUnderColimitsOfShape_monomorphisms
142142
[HasColimitsOfShape J C] [(colim : (J ⥤ C) ⥤ C).PreservesMonomorphisms] :
143-
(monomorphisms C).IsStableUnderColimitsOfShape J := by
144-
intro X₁ X₂ c₁ c₂ hc₁ hc₂ f hf
145-
have (j : J) : Mono (f.app j) := hf _
146-
have := NatTrans.mono_of_mono_app f
147-
exact colim.map_mono' f hc₁ hc₂ _ (by simp)
143+
(monomorphisms C).IsStableUnderColimitsOfShape J where
144+
condition X₁ X₂ c₁ c₂ hc₁ hc₂ f hf φ hφ := by
145+
have (j : J) : Mono (f.app j) := hf _
146+
have := NatTrans.mono_of_mono_app f
147+
apply colim.map_mono' f hc₁ hc₂ φ (by simp [hφ])
148148

149149
instance [HasCoproducts.{u'} C] [AB4OfSize.{u'} C] :
150150
IsStableUnderCoproducts.{u'} (monomorphisms C) where
151-
isStableUnderCoproductsOfShape _ :=
152-
isStableUnderColimitsOfShape_monomorphisms _ _
153151

154152
end MorphismProperty
155153

Mathlib/CategoryTheory/Localization/FiniteProducts.lean

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,28 @@ open Limits
2828
namespace Localization
2929

3030
variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] (L : C ⥤ D)
31-
{W : MorphismProperty C} [L.IsLocalization W]
31+
(W : MorphismProperty C) [L.IsLocalization W]
3232

3333
namespace HasProductsOfShapeAux
3434

35-
variable {J : Type} [HasProductsOfShape J C]
36-
(hW : W.IsStableUnderProductsOfShape J)
37-
include hW
35+
variable (J : Type) [HasProductsOfShape J C] [W.IsStableUnderProductsOfShape J]
3836

3937
lemma inverts :
4038
(W.functorCategory (Discrete J)).IsInvertedBy (lim ⋙ L) :=
41-
fun _ _ f hf => Localization.inverts L W _ (hW.limMap f hf)
39+
fun _ _ f hf => Localization.inverts L W _ (MorphismProperty.limMap f hf)
4240

4341
variable [W.ContainsIdentities] [Finite J]
4442

4543
/-- The (candidate) limit functor for the localized category.
4644
It is induced by `lim ⋙ L : (Discrete J ⥤ C) ⥤ D`. -/
4745
noncomputable abbrev limitFunctor :
4846
(Discrete J ⥤ D) ⥤ D :=
49-
Localization.lift _ (inverts L hW)
47+
Localization.lift _ (inverts L W J)
5048
((whiskeringRight (Discrete J) C D).obj L)
5149

52-
/-- The functor `limitFunctor L hW` is induced by `lim ⋙ L`. -/
50+
/-- The functor `limitFunctor L W J` is induced by `lim ⋙ L`. -/
5351
noncomputable def compLimitFunctorIso :
54-
((whiskeringRight (Discrete J) C D).obj L) ⋙ limitFunctor L hW
52+
((whiskeringRight (Discrete J) C D).obj L) ⋙ limitFunctor L W J
5553
lim ⋙ L := by
5654
apply Localization.fac
5755

@@ -61,56 +59,54 @@ instance :
6159
iso' := (Functor.compConstIso _ _).symm
6260

6361
noncomputable instance :
64-
CatCommSq lim ((whiskeringRight (Discrete J) C D).obj L) L (limitFunctor L hW) where
65-
iso' := (compLimitFunctorIso L hW).symm
62+
CatCommSq lim ((whiskeringRight (Discrete J) C D).obj L) L (limitFunctor L W J) where
63+
iso' := (compLimitFunctorIso L W J).symm
6664

6765
/-- The adjunction between the constant functor `D ⥤ (Discrete J ⥤ D)`
68-
and `limitFunctor L hW`. -/
66+
and `limitFunctor L W J`. -/
6967
noncomputable def adj :
70-
Functor.const _ ⊣ limitFunctor L hW :=
68+
Functor.const _ ⊣ limitFunctor L W J :=
7169
constLimAdj.localization L W ((whiskeringRight (Discrete J) C D).obj L)
72-
(W.functorCategory (Discrete J)) (Functor.const _) (limitFunctor L hW)
70+
(W.functorCategory (Discrete J)) (Functor.const _) (limitFunctor L W J)
7371

7472
lemma adj_counit_app (F : Discrete J ⥤ C) :
75-
(adj L hW).counit.app (F ⋙ L) =
76-
(Functor.const (Discrete J)).map ((compLimitFunctorIso L hW).hom.app F) ≫
73+
(adj L W J).counit.app (F ⋙ L) =
74+
(Functor.const (Discrete J)).map ((compLimitFunctorIso L W J).hom.app F) ≫
7775
(Functor.compConstIso (Discrete J) L).hom.app (lim.obj F) ≫
7876
whiskerRight (constLimAdj.counit.app F) L := by
7977
apply constLimAdj.localization_counit_app
8078

8179
/-- Auxiliary definition for `Localization.preservesProductsOfShape`. -/
8280
noncomputable def isLimitMapCone (F : Discrete J ⥤ C) :
8381
IsLimit (L.mapCone (limit.cone F)) :=
84-
IsLimit.ofIsoLimit (isLimitConeOfAdj (adj L hW) (F ⋙ L))
85-
(Cones.ext ((compLimitFunctorIso L hW).app F) (by simp [adj_counit_app, constLimAdj]))
82+
IsLimit.ofIsoLimit (isLimitConeOfAdj (adj L W J) (F ⋙ L))
83+
(Cones.ext ((compLimitFunctorIso L W J).app F) (by simp [adj_counit_app, constLimAdj]))
8684

8785
end HasProductsOfShapeAux
8886

89-
variable (W)
9087
variable [W.ContainsIdentities]
9188

9289
include L
9390
lemma hasProductsOfShape (J : Type) [Finite J] [HasProductsOfShape J C]
94-
(hW : W.IsStableUnderProductsOfShape J) :
91+
[W.IsStableUnderProductsOfShape J] :
9592
HasProductsOfShape J D :=
9693
hasLimitsOfShape_iff_isLeftAdjoint_const.2
97-
(HasProductsOfShapeAux.adj L hW).isLeftAdjoint
94+
(HasProductsOfShapeAux.adj L W J).isLeftAdjoint
9895

9996
/-- When `C` has finite products indexed by `J`, `W : MorphismProperty C` contains
10097
identities and is stable by products indexed by `J`,
10198
then any localization functor for `W` preserves finite products indexed by `J`. -/
10299
lemma preservesProductsOfShape (J : Type) [Finite J]
103-
[HasProductsOfShape J C] (hW : W.IsStableUnderProductsOfShape J) :
100+
[HasProductsOfShape J C] [W.IsStableUnderProductsOfShape J] :
104101
PreservesLimitsOfShape (Discrete J) L where
105102
preservesLimit {F} := preservesLimit_of_preserves_limit_cone (limit.isLimit F)
106-
(HasProductsOfShapeAux.isLimitMapCone L hW F)
103+
(HasProductsOfShapeAux.isLimitMapCone L W J F)
107104

108105
variable [HasFiniteProducts C] [W.IsStableUnderFiniteProducts]
109106

110107
include W in
111108
lemma hasFiniteProducts : HasFiniteProducts D :=
112-
fun _ => hasProductsOfShape L W _
113-
(W.isStableUnderProductsOfShape_of_isStableUnderFiniteProducts _)⟩
109+
fun _ => hasProductsOfShape L W _⟩
114110

115111
include W in
116112
/-- When `C` has finite products and `W : MorphismProperty C` contains
@@ -119,7 +115,6 @@ then any localization functor for `W` preserves finite products. -/
119115
lemma preservesFiniteProducts :
120116
PreservesFiniteProducts L where
121117
preserves _ := preservesProductsOfShape L W _
122-
(W.isStableUnderProductsOfShape_of_isStableUnderFiniteProducts _)
123118

124119
instance : HasFiniteProducts (W.Localization) := hasFiniteProducts W.Q W
125120

Mathlib/CategoryTheory/MorphismProperty/FunctorCategory.lean

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,25 @@ instance [W.IsStableUnderRetracts] (J : Type u'') [Category.{v''} J] :
3737

3838
variable {W}
3939

40-
lemma IsStableUnderLimitsOfShape.functorCategory
41-
{K : Type u'} [Category.{v'} K]
42-
(hW : W.IsStableUnderLimitsOfShape K)
43-
(J : Type u'') [Category.{v''} J]
44-
[HasLimitsOfShape K C] :
45-
(W.functorCategory J).IsStableUnderLimitsOfShape K := by
46-
intro X₁ X₂ c₁ c₂ hc₁ hc₂ f hf j
47-
convert hW (X₁ ⋙ (evaluation _ _ ).obj j) (X₂ ⋙ (evaluation _ _ ).obj j)
48-
_ _ (isLimitOfPreserves _ hc₁) (isLimitOfPreserves _ hc₂) (whiskerRight f _)
49-
(fun k ↦ hf k j)
50-
apply (isLimitOfPreserves ((evaluation J C).obj j) hc₂).hom_ext
51-
intro k
52-
rw [IsLimit.fac]
53-
dsimp
54-
rw [← NatTrans.comp_app, IsLimit.fac]
55-
dsimp
56-
57-
lemma IsStableUnderColimitsOfShape.functorCategory
58-
{K : Type u'} [Category.{v'} K]
59-
(hW : W.IsStableUnderColimitsOfShape K)
60-
(J : Type u'') [Category.{v''} J]
61-
[HasColimitsOfShape K C] :
62-
(W.functorCategory J).IsStableUnderColimitsOfShape K := by
63-
intro X₁ X₂ c₁ c₂ hc₁ hc₂ f hf j
64-
convert hW (X₁ ⋙ (evaluation _ _ ).obj j) (X₂ ⋙ (evaluation _ _ ).obj j)
65-
_ _ (isColimitOfPreserves _ hc₁) (isColimitOfPreserves _ hc₂) (whiskerRight f _)
66-
(fun k ↦ hf k j)
67-
apply (isColimitOfPreserves ((evaluation J C).obj j) hc₁).hom_ext
68-
intro k
69-
rw [IsColimit.fac]
70-
dsimp
71-
rw [← NatTrans.comp_app, IsColimit.fac]
72-
dsimp
40+
instance IsStableUnderLimitsOfShape.functorCategory
41+
{K : Type u'} [Category.{v'} K] [W.IsStableUnderLimitsOfShape K]
42+
(J : Type u'') [Category.{v''} J] [HasLimitsOfShape K C] :
43+
(W.functorCategory J).IsStableUnderLimitsOfShape K where
44+
condition X₁ X₂ _ _ hc₁ hc₂ f hf φ hφ j :=
45+
MorphismProperty.limitsOfShape_le _
46+
(limitsOfShape.mk' (X₁ ⋙ (evaluation _ _ ).obj j) (X₂ ⋙ (evaluation _ _ ).obj j)
47+
_ _ (isLimitOfPreserves _ hc₁) (isLimitOfPreserves _ hc₂) (whiskerRight f _)
48+
(fun k ↦ hf k j) (φ.app j) (fun k ↦ congr_app (hφ k) j))
49+
50+
instance IsStableUnderColimitsOfShape.functorCategory
51+
{K : Type u'} [Category.{v'} K] [W.IsStableUnderColimitsOfShape K]
52+
(J : Type u'') [Category.{v''} J] [HasColimitsOfShape K C] :
53+
(W.functorCategory J).IsStableUnderColimitsOfShape K where
54+
condition X₁ X₂ _ _ hc₁ hc₂ f hf φ hφ j :=
55+
MorphismProperty.colimitsOfShape_le _
56+
(colimitsOfShape.mk' (X₁ ⋙ (evaluation _ _ ).obj j) (X₂ ⋙ (evaluation _ _ ).obj j)
57+
_ _ (isColimitOfPreserves _ hc₁) (isColimitOfPreserves _ hc₂) (whiskerRight f _)
58+
(fun k ↦ hf k j) (φ.app j) (fun k ↦ congr_app (hφ k) j))
7359

7460
instance [W.IsStableUnderBaseChange] (J : Type u'') [Category.{v''} J] [HasPullbacks C] :
7561
(W.functorCategory J).IsStableUnderBaseChange where

Mathlib/CategoryTheory/MorphismProperty/LiftingProperty.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ instance rlp_isMultiplicative : T.rlp.IsMultiplicative where
7979
have := hj _ hp
8080
infer_instance
8181

82-
lemma llp_isStableUnderCoproductsOfShape (J : Type*) :
82+
instance llp_isStableUnderCoproductsOfShape (J : Type*) :
8383
T.llp.IsStableUnderCoproductsOfShape J := by
8484
apply IsStableUnderCoproductsOfShape.mk
8585
intro A B _ _ f hf X Y p hp
8686
have := fun j ↦ hf j _ hp
8787
infer_instance
8888

89-
lemma rlp_isStableUnderProductsOfShape (J : Type*) :
89+
instance rlp_isStableUnderProductsOfShape (J : Type*) :
9090
T.rlp.IsStableUnderProductsOfShape J := by
9191
apply IsStableUnderProductsOfShape.mk
9292
intro A B _ _ f hf X Y p hp
@@ -135,9 +135,7 @@ lemma rlp_pushouts : T.pushouts.rlp = T.rlp := by
135135
lemma colimitsOfShape_discrete_le_llp_rlp (J : Type w) :
136136
T.colimitsOfShape (Discrete J) ≤ T.rlp.llp := by
137137
intro A B i hi
138-
exact (T.rlp.llp.isStableUnderColimitsOfShape_iff_colimitsOfShape_le (Discrete J)).1
139-
(llp_isStableUnderCoproductsOfShape _ _) _
140-
(colimitsOfShape_monotone T.le_llp_rlp _ _ hi)
138+
exact MorphismProperty.colimitsOfShape_le _ (colimitsOfShape_monotone T.le_llp_rlp _ _ hi)
141139

142140
lemma coproducts_le_llp_rlp : (coproducts.{w} T) ≤ T.rlp.llp := by
143141
intro A B i hi

0 commit comments

Comments
 (0)