Skip to content

Commit d76e532

Browse files
committed
feat(CategoryTheory): combine pullback cones in the functor category (#32618)
1 parent e7e9abd commit d76e532

File tree

2 files changed

+71
-5
lines changed

2 files changed

+71
-5
lines changed

Mathlib/CategoryTheory/Limits/FunctorCategory/Shapes/Pullbacks.lean

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,35 @@ variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D]
2525

2626
section Pullback
2727

28+
/-- Given functors `F G H` and natural transformations `f : F ⟶ H` and `g : g : G ⟶ H`, together
29+
with a collection of limiting pullback cones for each cospan `F X ⟶ H X, G X ⟶ H X`, we can stich
30+
them together to give a pullback cone for the cospan formed by `f` and `g`.
31+
`combinePullbackConesIsLimit` shows that this pullback cone is limiting. -/
32+
@[simps!]
33+
def PullbackCone.combine (f : F ⟶ H) (g : G ⟶ H) (c : ∀ X, PullbackCone (f.app X) (g.app X))
34+
(hc : ∀ X, IsLimit (c X)) : PullbackCone f g :=
35+
PullbackCone.mk (W := {
36+
obj X := (c X).pt
37+
map {X Y} h := (hc Y).lift ⟨_, (c X).π ≫ cospanHomMk (H.map h) (F.map h) (G.map h)⟩
38+
map_id _ := (hc _).hom_ext <| by rintro (_ | _ | _); all_goals simp
39+
map_comp _ _ := (hc _).hom_ext <| by rintro (_ | _ | _); all_goals simp })
40+
{ app X := (c X).fst }
41+
{ app X := (c X).snd }
42+
(by ext; simp [(c _).condition])
43+
44+
/--
45+
The pullback cone `combinePullbackCones` is limiting.
46+
-/
47+
def PullbackCone.combineIsLimit (f : F ⟶ H) (g : G ⟶ H)
48+
(c : ∀ X, PullbackCone (f.app X) (g.app X)) (hc : ∀ X, IsLimit (c X)) :
49+
IsLimit (combine f g c hc) :=
50+
evaluationJointlyReflectsLimits _ fun k ↦ by
51+
refine IsLimit.equivOfNatIsoOfIso ?_ _ _ ?_ (hc k)
52+
· exact cospanIsoMk (Iso.refl _) (Iso.refl _) (Iso.refl _)
53+
· refine Cones.ext (Iso.refl _) ?_
54+
rintro (_ | _ | _)
55+
all_goals cat_disch
56+
2857
variable [HasPullbacks C]
2958

3059
/-- Evaluating a pullback amounts to taking the pullback of the evaluations. -/

Mathlib/CategoryTheory/Limits/Shapes/Pullback/Cospan.lean

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,32 @@ variable {X Y Z X' Y' Z' : C} (iX : X ≅ X') (iY : Y ≅ Y') (iZ : Z ≅ Z')
327327

328328
section
329329

330+
/-- Constructor for natural transformations between cospans. -/
331+
@[simps]
332+
def cospanHomMk {F G : WalkingCospan ⥤ C}
333+
(z : F.obj .one ⟶ G.obj .one) (l : F.obj .left ⟶ G.obj .left)
334+
(r : F.obj .right ⟶ G.obj .right)
335+
(hl : F.map inl ≫ z = l ≫ G.map inl := by cat_disch)
336+
(hr : F.map inr ≫ z = r ≫ G.map inr := by cat_disch) : F ⟶ G where
337+
app := by rintro (_ | _ | _); exacts [z, l, r]
338+
naturality := by rintro (_ | _ | _ ) (_ | _ | _) (_ | _); all_goals cat_disch
339+
340+
/-- Constructor for natural isomorphisms between cospans. -/
341+
@[simps!]
342+
def cospanIsoMk {F G : WalkingCospan ⥤ C}
343+
(z : F.obj .one ≅ G.obj .one) (l : F.obj .left ≅ G.obj .left)
344+
(r : F.obj .right ≅ G.obj .right)
345+
(hl : F.map inl ≫ z.hom = l.hom ≫ G.map inl := by cat_disch)
346+
(hr : F.map inr ≫ z.hom = r.hom ≫ G.map inr := by cat_disch) : F ≅ G :=
347+
NatIso.ofComponents (by rintro (_ | _ | _); exacts [z, l, r])
348+
(by rintro (_ | _ | _ ) (_ | _ | _) (_ | _); all_goals cat_disch)
349+
330350
variable {f : X ⟶ Z} {g : Y ⟶ Z} {f' : X' ⟶ Z'} {g' : Y' ⟶ Z'}
331351

332352
/-- Construct an isomorphism of cospans from components. -/
333353
def cospanExt (wf : iX.hom ≫ f' = f ≫ iZ.hom) (wg : iY.hom ≫ g' = g ≫ iZ.hom) :
334354
cospan f g ≅ cospan f' g' :=
335-
NatIso.ofComponents
336-
(by rintro (⟨⟩ | ⟨⟨⟩⟩); exacts [iZ, iX, iY])
337-
(by rintro (⟨⟩ | ⟨⟨⟩⟩) (⟨⟩ | ⟨⟨⟩⟩) f <;> cases f <;> simp [wf, wg])
355+
cospanIsoMk iZ iX iY
338356

339357
variable (wf : iX.hom ≫ f' = f ≫ iZ.hom) (wg : iY.hom ≫ g' = g ≫ iZ.hom)
340358

@@ -375,13 +393,32 @@ end
375393

376394
section
377395

396+
/-- Constructor for natural transformations between spans. -/
397+
@[simps]
398+
def spanHomMk {F G : WalkingSpan ⥤ C}
399+
(z : F.obj .zero ⟶ G.obj .zero) (l : F.obj .left ⟶ G.obj .left)
400+
(r : F.obj .right ⟶ G.obj .right)
401+
(hl : F.map fst ≫ l = z ≫ G.map fst := by cat_disch)
402+
(hr : F.map snd ≫ r = z ≫ G.map snd := by cat_disch) : F ⟶ G where
403+
app := by rintro (_ | _ | _); exacts [z, l, r]
404+
naturality := by rintro (_ | _ | _ ) (_ | _ | _) (_ | _); all_goals cat_disch
405+
406+
/-- Constructor for natural isomorphisms between spans. -/
407+
@[simps!]
408+
def spanIsoMk {F G : WalkingSpan ⥤ C}
409+
(z : F.obj .zero ≅ G.obj .zero) (l : F.obj .left ≅ G.obj .left)
410+
(r : F.obj .right ≅ G.obj .right)
411+
(hl : F.map fst ≫ l.hom = z.hom ≫ G.map fst := by cat_disch)
412+
(hr : F.map snd ≫ r.hom = z.hom ≫ G.map snd := by cat_disch) : F ≅ G :=
413+
NatIso.ofComponents (by rintro (_ | _ | _); exacts [z, l, r])
414+
(by rintro (_ | _ | _ ) (_ | _ | _) (_ | _); all_goals cat_disch)
415+
378416
variable {f : X ⟶ Y} {g : X ⟶ Z} {f' : X' ⟶ Y'} {g' : X' ⟶ Z'}
379417

380418
/-- Construct an isomorphism of spans from components. -/
381419
def spanExt (wf : iX.hom ≫ f' = f ≫ iY.hom) (wg : iX.hom ≫ g' = g ≫ iZ.hom) :
382420
span f g ≅ span f' g' :=
383-
NatIso.ofComponents (by rintro (⟨⟩ | ⟨⟨⟩⟩); exacts [iX, iY, iZ])
384-
(by rintro (⟨⟩ | ⟨⟨⟩⟩) (⟨⟩ | ⟨⟨⟩⟩) f <;> cases f <;> simp [wf, wg])
421+
spanIsoMk iX iY iZ
385422

386423
variable (wf : iX.hom ≫ f' = f ≫ iY.hom) (wg : iX.hom ≫ g' = g ≫ iZ.hom)
387424

0 commit comments

Comments
 (0)