Skip to content

Commit 5dc620c

Browse files
committed
feat(CategoryTheory/Limits/Shapes/End): functoriality of (co)ends (#27079)
We define basic functoriality properties of the construction `F ↦ end_ F`, and bundle it as a functor whenever all ends exist. The same is done for coends.
1 parent 8d72c49 commit 5dc620c

File tree

1 file changed

+63
-2
lines changed
  • Mathlib/CategoryTheory/Limits/Shapes

1 file changed

+63
-2
lines changed

Mathlib/CategoryTheory/Limits/Shapes/End.lean

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,45 @@ noncomputable def end_.lift : X ⟶ end_ F :=
216216
lemma end_.lift_π (j : J) : lift f hf ≫ π F j = f j := by
217217
apply IsLimit.fac
218218

219+
variable {F' : Jᵒᵖ ⥤ J ⥤ C} [HasEnd F'] (f : F ⟶ F')
220+
221+
/-- A natural transformation of functors F ⟶ F' induces a map end_ F ⟶ end_ F'. -/
222+
noncomputable def end_.map : end_ F ⟶ end_ F' :=
223+
end_.lift (fun x ↦ end_.π _ _ ≫ (f.app (op x)).app x) (fun j j' φ ↦ by
224+
have e := (f.app (op j)).naturality φ
225+
simp only [Category.assoc]
226+
rw [← e, reassoc_of% end_.condition F φ]
227+
simp)
228+
229+
@[reassoc (attr := simp)]
230+
lemma end_.map_π (j : J) :
231+
end_.map f ≫ end_.π F' j = end_.π _ _ ≫ (f.app (op j)).app j := by
232+
simp [end_.map]
233+
234+
@[reassoc (attr := simp)]
235+
lemma end_.map_comp {F'' : Jᵒᵖ ⥤ J ⥤ C} [HasEnd F''] (g : F' ⟶ F'') :
236+
end_.map f ≫ end_.map g = end_.map (f ≫ g) := by
237+
aesop_cat
238+
239+
@[simp]
240+
lemma end_.map_id : end_.map (𝟙 F) = 𝟙 _ := by aesop_cat
241+
219242
end
220243

244+
variable (J C) in
245+
/-- If all bifunctors `Jᵒᵖ ⥤ J ⥤ C` have an end, then the construction
246+
`F ↦ end_ F` defines a functor `(Jᵒᵖ ⥤ J ⥤ C) ⥤ C`. -/
247+
@[simps]
248+
noncomputable def endFunctor [∀ (F : Jᵒᵖ ⥤ J ⥤ C), HasEnd F] :
249+
(Jᵒᵖ ⥤ J ⥤ C) ⥤ C where
250+
obj F := end_ F
251+
map f := end_.map f
252+
221253
end End
222254

223255
section Coend
224256

225-
/-- Given `F : Jᵒᵖ ⥤ J ⥤ C`, this property asserts the existence of the end of `F`. -/
257+
/-- Given `F : Jᵒᵖ ⥤ J ⥤ C`, this property asserts the existence of the coend of `F`. -/
226258
abbrev HasCoend := HasMulticoequalizer (multispanIndexCoend F)
227259

228260
variable [HasCoend F]
@@ -252,16 +284,45 @@ section
252284
variable {X : C} (f : ∀ j, (F.obj (op j)).obj j ⟶ X)
253285
(hf : ∀ ⦃i j : J⦄ (g : i ⟶ j), (F.map g.op).app i ≫ f i = (F.obj (op j)).map g ≫ f j)
254286

255-
/-- Constructor for morphisms to the end of a functor. -/
287+
/-- Constructor for morphisms to the coend of a functor. -/
256288
noncomputable def coend.desc : coend F ⟶ X :=
257289
Cowedge.IsColimit.desc (colimit.isColimit _) f hf
258290

259291
@[reassoc (attr := simp)]
260292
lemma coend.ι_desc (j : J) : ι F j ≫ desc f hf = f j := by
261293
apply IsColimit.fac
262294

295+
variable {F' : Jᵒᵖ ⥤ J ⥤ C} [HasCoend F'] (f : F ⟶ F')
296+
297+
/-- A natural transformation of functors F ⟶ F' induces a map coend F ⟶ coend F'. -/
298+
noncomputable def coend.map : coend F ⟶ coend F' :=
299+
coend.desc (fun x ↦ (f.app (op x)).app x ≫ coend.ι _ _ ) (fun j j' φ ↦ by
300+
simp [coend.condition])
301+
302+
@[reassoc (attr := simp)]
303+
lemma coend.ι_map (j : J) :
304+
coend.ι _ _ ≫ coend.map f = (f.app (op j)).app j ≫ coend.ι _ _ := by
305+
simp [coend.map]
306+
307+
@[reassoc (attr := simp)]
308+
lemma coend.map_comp {F'' : Jᵒᵖ ⥤ J ⥤ C} [HasCoend F''] (g : F' ⟶ F'') :
309+
coend.map f ≫ coend.map g = coend.map (f ≫ g) := by
310+
aesop_cat
311+
312+
@[simp]
313+
lemma coend.map_id : coend.map (𝟙 F) = 𝟙 _ := by aesop_cat
314+
263315
end
264316

317+
variable (J C) in
318+
/-- If all bifunctors `Jᵒᵖ ⥤ J ⥤ C` have a coend, then the construction
319+
`F ↦ coend F` defines a functor `(Jᵒᵖ ⥤ J ⥤ C) ⥤ C`. -/
320+
@[simps]
321+
noncomputable def coendFunctor [∀ (F : Jᵒᵖ ⥤ J ⥤ C), HasCoend F] :
322+
(Jᵒᵖ ⥤ J ⥤ C) ⥤ C where
323+
obj F := coend F
324+
map f := coend.map f
325+
265326
end Coend
266327

267328
end Limits

0 commit comments

Comments
 (0)