Skip to content

Commit c0c380e

Browse files
committed
feat(CategoryTheory/Monoidal/Limits): generalise universes and explicit limits for limits of monoid objects (leanprover-community#35996)
This PR makes two major refactors to the file. These are easiest to make simultaneously, as they are heavily linked. - Generalise the smallness assumptions on the shape category - Take explicit limit cones as inputs rather than assuming HasLimitsOfShape and using the choice-cone
1 parent bddbe1b commit c0c380e

1 file changed

Lines changed: 63 additions & 39 deletions

File tree

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/-
22
Copyright (c) 2020 Kim Morrison. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Kim Morrison
4+
Authors: Kim Morrison, Bhavik Mehta
55
-/
66
module
77

88
public import Mathlib.CategoryTheory.Monoidal.Internal.FunctorCategory
99
public import Mathlib.CategoryTheory.Monoidal.Limits.Basic
1010
public import Mathlib.CategoryTheory.Limits.Preserves.Basic
11+
public import Mathlib.CategoryTheory.Limits.Creates
1112

1213
/-!
1314
# Limits of monoid objects.
@@ -31,65 +32,88 @@ noncomputable section
3132
namespace CategoryTheory
3233
namespace Mon
3334

34-
variable {J : Type w} [SmallCategory J]
35-
variable {C : Type u} [Category.{v} C] [HasLimitsOfShape J C] [MonoidalCategory.{v} C]
35+
variable {J : Type w} [Category* J]
36+
variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C]
3637

37-
/-- We construct the (candidate) limit of a functor `F : J ⥤ Mon C`
38-
by interpreting it as a functor `Mon (J ⥤ C)`,
39-
and noting that taking limits is a lax monoidal functor,
40-
and hence sends monoid objects to monoid objects.
38+
open MonObj
39+
40+
set_option backward.isDefEq.respectTransparency false in
41+
/--
42+
We construct the limit object of a functor `F : J ⥤ Mon C` given a limit cone `c` of
43+
`F ⋙ forget C`.
4144
-/
4245
@[simps!]
43-
def limit (F : J ⥤ Mon C) : Mon C :=
44-
lim.mapMon.obj ((monFunctorCategoryEquivalence J C).inverse.obj F)
46+
def limit (F : J ⥤ Mon C) (c : Cone (F ⋙ Mon.forget C)) (hc : IsLimit c) :
47+
Mon C where
48+
X := c.pt
49+
mon.one := hc.lift
50+
{ pt := _
51+
π.app X := η[(F.obj X).X] }
52+
mon.mul := hc.lift
53+
{ pt := _
54+
π.app X := (c.π.app X ⊗ₘ c.π.app X) ≫ μ[(F.obj X).X]
55+
π.naturality i j f := by have := c.π.naturality f; simp_all }
56+
mon.one_mul := hc.hom_ext <| by simp [whiskerRight_comp_tensorHom_assoc]
57+
mon.mul_one := hc.hom_ext <| by simp [whiskerLeft_comp_tensorHom_assoc]
58+
mon.mul_assoc := by
59+
apply hc.hom_ext
60+
simp only [Functor.comp_obj, forget_obj, Functor.const_obj_obj, IsLimit.fac,
61+
mon_tauto, implies_true]
4562

4663
set_option backward.isDefEq.respectTransparency false in
4764
/-- Implementation of `Mon.hasLimits`: a limiting cone over a functor `F : J ⥤ Mon C`.
4865
-/
4966
@[simps]
50-
def limitCone (F : J ⥤ Mon C) : Cone F where
51-
pt := limit F
52-
π :=
53-
{ app := fun j => .mk' (limit.π (F ⋙ Mon.forget C) j)
54-
naturality := fun j j' f => by ext; exact (limit.cone (F ⋙ Mon.forget C)).π.naturality f }
67+
def limitCone (F : J ⥤ Mon C) (c : Cone (F ⋙ Mon.forget C)) (hc : IsLimit c) : Cone F where
68+
pt := limit F c hc
69+
π.app j := .mk' (c.π.app j)
70+
π.naturality j j' f := Hom.ext' (c.π.naturality f)
5571

5672
/-- The image of the proposed limit cone for `F : J ⥤ Mon C` under the forgetful functor
5773
`forget C : Mon C ⥤ C` is isomorphic to the limit cone of `F ⋙ forget C`.
5874
-/
59-
def forgetMapConeLimitConeIso (F : J ⥤ Mon C) :
60-
(forget C).mapCone (limitCone F) ≅ limit.cone (F ⋙ forget C) :=
75+
@[simps!]
76+
def forgetMapConeLimitConeIso (F : J ⥤ Mon C) (c : Cone (F ⋙ Mon.forget C)) (hc : IsLimit c) :
77+
(forget C).mapCone (limitCone F c hc) ≅ c :=
6178
Cones.ext (Iso.refl _) (by simp)
6279

6380
set_option backward.isDefEq.respectTransparency false in
6481
/-- Implementation of `Mon.hasLimitsOfShape`:
6582
the proposed cone over a functor `F : J ⥤ Mon C` is a limit cone.
6683
-/
6784
@[simps]
68-
def limitConeIsLimit (F : J ⥤ Mon C) : IsLimit (limitCone F) where
85+
def limitConeIsLimit (F : J ⥤ Mon C) (c : Cone (F ⋙ Mon.forget C)) (hc : IsLimit c) :
86+
IsLimit (limitCone F c hc) where
6987
lift s :=
70-
{ hom := limit.lift (F ⋙ Mon.forget C) ((Mon.forget C).mapCone s)
71-
isMonHom_hom.mul_hom := limit.hom_ext fun j ↦ by
72-
dsimp
73-
simp only [Category.assoc, limit.lift_π, Functor.mapCone_pt, forget_obj,
74-
Functor.mapCone_π_app, forget_map, IsMonHom.mul_hom, limMap_π, tensorObj_obj,
75-
Functor.comp_obj, MonFunctorCategoryEquivalence.inverseObj_mon_mul_app, lim_μ_π_assoc,
76-
lim_obj, tensorHom_comp_tensorHom_assoc] }
88+
{ hom := hc.lift ((Mon.forget C).mapCone s)
89+
isMonHom_hom.mul_hom := hc.hom_ext <| by simp
90+
isMonHom_hom.one_hom := hc.hom_ext <| by simp }
7791
fac s h := by ext; simp
78-
uniq s m w := by
79-
ext1
80-
refine limit.hom_ext (fun j => ?_)
81-
dsimp; simp only [Mon.forget_map, limit.lift_π, Functor.mapCone_π_app]
82-
exact congr_arg Mon.Hom.hom (w j)
83-
84-
instance hasLimitsOfShape [HasLimitsOfShape J C] : HasLimitsOfShape J (Mon C) where
85-
has_limit := fun F => HasLimit.mk
86-
{ cone := limitCone F
87-
isLimit := limitConeIsLimit F }
88-
89-
instance forget_preservesLimitsOfShape : PreservesLimitsOfShape J (Mon.forget C) where
90-
preservesLimit := fun {F} =>
91-
preservesLimit_of_preserves_limit_cone (limitConeIsLimit F)
92-
(IsLimit.ofIsoLimit (limit.isLimit (F ⋙ Mon.forget C)) (forgetMapConeLimitConeIso F).symm)
92+
uniq s m w := Hom.ext' <| hc.hom_ext fun j ↦ by simpa using congr($(w j).hom)
93+
94+
/--
95+
A helper definition to show that the forgetful functor `forget C : Mon C ⥤ C` creates limits:
96+
given a limit cone `c` of `F ⋙ forget C`, we can lift it to a limit cone of `F`.
97+
-/
98+
def limitConeLiftsToLimit (F : J ⥤ Mon C) (c : Cone (F ⋙ Mon.forget C)) (hc : IsLimit c) :
99+
LiftsToLimit F (forget C) c hc where
100+
liftedCone := limitCone F c hc
101+
validLift := forgetMapConeLimitConeIso _ _ _
102+
makesLimit := limitConeIsLimit _ _ _
103+
104+
instance (F : J ⥤ Mon C) : CreatesLimit F (forget C) :=
105+
createsLimitOfReflectsIso (limitConeLiftsToLimit _)
106+
107+
instance : CreatesLimitsOfShape J (forget C) := ⟨inferInstance⟩
108+
instance : CreatesLimitsOfSize.{w} (forget C) := ⟨inferInstance⟩
109+
instance : CreatesLimits (forget C) := ⟨inferInstance⟩
110+
111+
instance [HasLimitsOfShape J C] : HasLimitsOfShape J (Mon C) :=
112+
hasLimitsOfShape_of_hasLimitsOfShape_createsLimitsOfShape (forget C)
113+
114+
instance [HasLimitsOfShape J C] :
115+
PreservesLimitsOfShape J (Mon.forget C) :=
116+
CategoryTheory.preservesLimitOfShape_of_createsLimitsOfShape_and_hasLimitsOfShape _
93117

94118
end Mon
95119
end CategoryTheory

0 commit comments

Comments
 (0)