Skip to content

Commit 7175569

Browse files
committed
chore(CategoryTheory/Limits): generalize properties of P.Over to P.CostructuredArrow (#38820)
We also add one instance about `CostructuredArrow.toOver`.
1 parent 4b7e5c1 commit 7175569

2 files changed

Lines changed: 69 additions & 21 deletions

File tree

Mathlib/CategoryTheory/Limits/Constructions/Over/Connected.lean

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ def isLimitConePost [IsCofilteredOrEmpty J] {F : J ⥤ C} {c : Cone F} (i : J) (
177177

178178
end Over
179179

180+
instance {B : D} [IsConnected J] [HasLimitsOfShape J C] [PreservesLimitsOfShape J K] :
181+
PreservesLimitsOfShape J (CostructuredArrow.toOver K B) where
182+
preservesLimit {D} := by
183+
have : PreservesLimit D (CostructuredArrow.toOver K B ⋙ Over.forget B) :=
184+
inferInstanceAs <| PreservesLimit D (CostructuredArrow.proj K B ⋙ K)
185+
exact Limits.preservesLimit_of_reflects_of_preserves _ (Over.forget B)
186+
180187
namespace Under
181188

182189
/-- The forgetful functor from the under category creates any connected limit. -/
@@ -194,4 +201,13 @@ instance hasColimitsOfShape_of_isConnected {B : C} [IsConnected J] [HasColimitsO
194201
HasColimitsOfShape J (Under B) where
195202
has_colimit F := hasColimit_of_created F (forget B)
196203

197-
end CategoryTheory.Under
204+
end Under
205+
206+
instance {B : D} [IsConnected J] [HasColimitsOfShape J C] [PreservesColimitsOfShape J K] :
207+
PreservesColimitsOfShape J (StructuredArrow.toUnder B K) where
208+
preservesColimit {D} := by
209+
have : PreservesColimit D (StructuredArrow.toUnder B K ⋙ Under.forget B) :=
210+
inferInstanceAs <| PreservesColimit D (StructuredArrow.proj B K ⋙ K)
211+
exact Limits.preservesColimit_of_reflects_of_preserves _ (Under.forget B)
212+
213+
end CategoryTheory

Mathlib/CategoryTheory/Limits/MorphismProperty.lean

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ instance hasColimitsOfShape_of_closedUnderColimitsOfShape [HasColimitsOfShape J
9292

9393
end MorphismProperty.Comma
9494

95-
section
95+
section CostructuredArrow
9696

9797
variable {A : Type*} [Category* A] {L : A ⥤ T}
9898

@@ -126,7 +126,51 @@ lemma CostructuredArrow.isClosedUnderColimitsOfShape {J : Type*} [Category* J]
126126
P.cancel_left_of_respectsIso]
127127
exact H _ _ d.prop_diag_obj
128128

129-
end
129+
lemma CostructuredArrow.closedUnderLimitsOfShape_walkingCospan [HasPullbacks A] [HasPullbacks T]
130+
[PreservesLimitsOfShape WalkingCospan L] (X : T)
131+
[P.IsStableUnderComposition] [P.IsStableUnderBaseChange]
132+
[P.HasOfPostcompProperty P] :
133+
(P.costructuredArrowObj L (X := X)).IsClosedUnderLimitsOfShape WalkingCospan where
134+
limitsOfShape_le := by
135+
rintro Y ⟨pres, hpres⟩
136+
have h : IsPullback (L.map (pres.π.app .left).left) (L.map (pres.π.app .right).left)
137+
(L.map (pres.diag.map WalkingCospan.Hom.inl).left)
138+
(L.map (pres.diag.map WalkingCospan.Hom.inr).left) :=
139+
IsPullback.of_isLimit_cone <| isLimitOfPreserves
140+
(CategoryTheory.CostructuredArrow.toOver L X ⋙ CategoryTheory.Over.forget X) pres.isLimit
141+
rw [MorphismProperty.costructuredArrowObj_iff]
142+
rw [show Y.hom = L.map (pres.π.app .left).left ≫ (pres.diag.obj .left).hom by simp]
143+
apply P.comp_mem _ _ (P.of_isPullback h.flip ?_) (hpres _)
144+
exact P.of_postcomp _ (pres.diag.obj WalkingCospan.one).hom (hpres .one)
145+
(by simpa using hpres .right)
146+
147+
namespace MorphismProperty.CostructuredArrow
148+
149+
variable (X : T) [P.IsStableUnderComposition] [P.IsStableUnderBaseChange]
150+
[P.HasOfPostcompProperty P] [HasPullbacks A] [HasPullbacks T]
151+
[PreservesLimitsOfShape WalkingCospan L]
152+
153+
noncomputable instance createsLimitsOfShape_walkingCospan :
154+
CreatesLimitsOfShape WalkingCospan (CostructuredArrow.forget P ⊤ L X) := by
155+
apply +allowSynthFailures forgetCreatesLimitsOfShapeOfClosed
156+
· exact inferInstanceAs (HasLimitsOfShape WalkingCospan (CostructuredArrow L X))
157+
· exact CostructuredArrow.closedUnderLimitsOfShape_walkingCospan _ _
158+
159+
instance hasPullbacks : HasPullbacks (P.CostructuredArrow ⊤ L X) := by
160+
apply +allowSynthFailures hasLimitsOfShape_of_closedUnderLimitsOfShape
161+
· exact inferInstanceAs (HasLimitsOfShape WalkingCospan (CostructuredArrow L X))
162+
· exact CostructuredArrow.closedUnderLimitsOfShape_walkingCospan _ _
163+
164+
instance : PreservesLimitsOfShape WalkingCospan (CostructuredArrow.toOver P L X) :=
165+
have : PreservesLimitsOfShape WalkingCospan
166+
(CostructuredArrow.toOver P L X ⋙ Over.forget P ⊤ X) :=
167+
inferInstanceAs <| PreservesLimitsOfShape WalkingCospan <|
168+
CostructuredArrow.forget P ⊤ L X ⋙ CategoryTheory.CostructuredArrow.toOver L X
169+
preservesLimitsOfShape_of_reflects_of_preserves _ (Over.forget _ _ X)
170+
171+
end MorphismProperty.CostructuredArrow
172+
173+
end CostructuredArrow
130174

131175
section
132176

@@ -179,16 +223,8 @@ Without the cancellation property, this does not in general. Consider for exampl
179223
`P = Function.Surjective` on `Type`. -/
180224
instance Over.closedUnderLimitsOfShape_pullback [HasPullbacks T]
181225
[P.IsStableUnderComposition] [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] :
182-
(P.overObj (X := X)).IsClosedUnderLimitsOfShape WalkingCospan where
183-
limitsOfShape_le := by
184-
rintro Y ⟨p⟩
185-
have h := IsPullback.of_isLimit_cone <|
186-
Limits.isLimitOfPreserves (CategoryTheory.Over.forget X) p.isLimit
187-
rw [MorphismProperty.overObj_iff,
188-
show Y.hom = (p.π.app .left).left ≫ (p.diag.obj .left).hom by simp]
189-
apply P.comp_mem _ _ (P.of_isPullback h.flip ?_) (p.prop_diag_obj _)
190-
exact P.of_postcomp _ (p.diag.obj WalkingCospan.one).hom (p.prop_diag_obj .one)
191-
(by simpa using p.prop_diag_obj .right)
226+
(P.overObj (X := X)).IsClosedUnderLimitsOfShape WalkingCospan :=
227+
CostructuredArrow.closedUnderLimitsOfShape_walkingCospan _ _
192228

193229
end
194230

@@ -246,18 +282,14 @@ instance [P.ContainsIdentities] : HasTerminal (P.Over ⊤ X) :=
246282
`Over.forget P ⊤ X` creates pullbacks. -/
247283
noncomputable instance createsLimitsOfShape_walkingCospan [HasPullbacks T]
248284
[P.IsStableUnderComposition] [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] :
249-
CreatesLimitsOfShape WalkingCospan (Over.forget P ⊤ X) := by
250-
apply +allowSynthFailures forgetCreatesLimitsOfShapeOfClosed
251-
· exact inferInstanceAs (HasLimitsOfShape WalkingCospan (Over X))
252-
· apply Over.closedUnderLimitsOfShape_pullback
285+
CreatesLimitsOfShape WalkingCospan (Over.forget P ⊤ X) :=
286+
CostructuredArrow.createsLimitsOfShape_walkingCospan _ _
253287

254288
/-- If `P` is stable under composition, base change and satisfies post-cancellation,
255289
`P.Over ⊤ X` has pullbacks -/
256290
instance (priority := 900) hasPullbacks [HasPullbacks T] [P.IsStableUnderComposition]
257-
[P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : HasPullbacks (P.Over ⊤ X) := by
258-
apply +allowSynthFailures hasLimitsOfShape_of_closedUnderLimitsOfShape
259-
· exact inferInstanceAs (HasLimitsOfShape WalkingCospan (Over X))
260-
· apply Over.closedUnderLimitsOfShape_pullback
291+
[P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : HasPullbacks (P.Over ⊤ X) :=
292+
CostructuredArrow.hasPullbacks _ _
261293

262294
variable [HasPullbacks T] [P.IsStableUnderComposition] [P.ContainsIdentities]
263295
[P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P]

0 commit comments

Comments
 (0)