Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit f120076

Browse files
committed
feat(category_theory): (co)equalizers and (co)kernels when composing with monos/epis (#12828)
1 parent 49cd1cc commit f120076

File tree

2 files changed

+58
-13
lines changed

2 files changed

+58
-13
lines changed

src/category_theory/limits/shapes/equalizers.lean

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,23 @@ def split_mono_of_equalizer {X Y : C} {f : X ⟶ Y} {r : Y ⟶ X} (hr : f ≫ r
922922
id' := fork.is_limit.hom_ext h
923923
((category.assoc _ _ _).trans $ hr.trans (category.id_comp _).symm) }
924924

925+
variables {C f g}
926+
927+
/-- The fork obtained by postcomposing an equalizer fork with a monomorphism is an equalizer. -/
928+
def is_equalizer_comp_mono {c : fork f g} (i : is_limit c) {Z : C} (h : Y ⟶ Z) [hm : mono h] :
929+
is_limit (fork.of_ι c.ι (by simp) : fork (f ≫ h) (g ≫ h)) :=
930+
fork.is_limit.mk' _ $ λ s,
931+
let s' : fork f g := fork.of_ι s.ι (by apply hm.right_cancellation; simp [s.condition]) in
932+
let l := fork.is_limit.lift' i s'.ι s'.condition in
933+
⟨l.1, l.2, λ m hm, by apply fork.is_limit.hom_ext i; rw fork.ι_of_ι at hm; rw hm; exact l.2.symm⟩
934+
935+
variables (C f g)
936+
937+
@[instance]
938+
lemma has_equalizer_comp_mono [has_equalizer f g] {Z : C} (h : Y ⟶ Z) [mono h] :
939+
has_equalizer (f ≫ h) (g ≫ h) :=
940+
⟨⟨{ cone := _, is_limit := is_equalizer_comp_mono (limit.is_limit _) h }⟩⟩
941+
925942
/-- An equalizer of an idempotent morphism and the identity is split mono. -/
926943
def split_mono_of_idempotent_of_is_limit_fork {X : C} {f : X ⟶ X} (hf : f ≫ f = f)
927944
{c : fork f (𝟙 X)} (i : is_limit c) : split_mono c.ι :=
@@ -971,6 +988,25 @@ def split_epi_of_coequalizer {X Y : C} {f : X ⟶ Y} {s : Y ⟶ X} (hs : f ≫ s
971988
{ section_ := s,
972989
id' := cofork.is_colimit.hom_ext h (hs.trans (category.comp_id _).symm) }
973990

991+
variables {C f g}
992+
993+
/-- The cofork obtained by precomposing a coequalizer cofork with an epimorphism is
994+
a coequalizer. -/
995+
def is_coequalizer_epi_comp {c : cofork f g} (i : is_colimit c) {W : C} (h : W ⟶ X) [hm : epi h] :
996+
is_colimit (cofork.of_π c.π (by simp) : cofork (h ≫ f) (h ≫ g)) :=
997+
cofork.is_colimit.mk' _ $ λ s,
998+
let s' : cofork f g := cofork.of_π s.π
999+
(by apply hm.left_cancellation; simp_rw [←category.assoc, s.condition]) in
1000+
let l := cofork.is_colimit.desc' i s'.π s'.condition in
1001+
⟨l.1, l.2,
1002+
λ m hm,by apply cofork.is_colimit.hom_ext i; rw cofork.π_of_π at hm; rw hm; exact l.2.symm⟩
1003+
1004+
lemma has_coequalizer_epi_comp [has_coequalizer f g] {W : C} (h : W ⟶ X) [hm : epi h] :
1005+
has_coequalizer (h ≫ f) (h ≫ g) :=
1006+
⟨⟨{ cocone := _, is_colimit := is_coequalizer_epi_comp (colimit.is_colimit _) h }⟩⟩
1007+
1008+
variables (C f g)
1009+
9741010
/-- A coequalizer of an idempotent morphism and the identity is split epi. -/
9751011
def split_epi_of_idempotent_of_is_colimit_cofork {X : C} {f : X ⟶ X} (hf : f ≫ f = f)
9761012
{c : cofork f (𝟙 X)} (i : is_colimit c) : split_epi c.π :=

src/category_theory/limits/shapes/kernels.lean

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ def is_limit.of_ι {W : C} (g : W ⟶ X) (eq : g ≫ f = 0)
135135
is_limit (kernel_fork.of_ι g eq) :=
136136
is_limit_aux _ (λ s, lift s.ι s.condition) (λ s, fac s.ι s.condition) (λ s, uniq s.ι s.condition)
137137

138+
/-- Every kernel of `f` induces a kernel of `f ≫ g` if `g` is mono. -/
139+
def is_kernel_comp_mono {c : kernel_fork f} (i : is_limit c) {Z} (g : Y ⟶ Z) [hg : mono g] :
140+
is_limit (kernel_fork.of_ι c.ι (by simp) : kernel_fork (f ≫ g)) :=
141+
fork.is_limit.mk' _ $ λ s,
142+
let s' : kernel_fork f := fork.of_ι s.ι (by apply hg.right_cancellation; simp [s.condition]) in
143+
let l := kernel_fork.is_limit.lift' i s'.ι s'.condition in
144+
⟨l.1, l.2, λ m hm, by apply fork.is_limit.hom_ext i; rw fork.ι_of_ι at hm; rw hm; exact l.2.symm⟩
145+
138146
end
139147

140148
section
@@ -273,14 +281,9 @@ lemma kernel_not_epi_of_nonzero (w : f ≠ 0) : ¬epi (kernel.ι f) :=
273281
lemma kernel_not_iso_of_nonzero (w : f ≠ 0) : (is_iso (kernel.ι f)) → false :=
274282
λ I, kernel_not_epi_of_nonzero w $ by { resetI, apply_instance }
275283

276-
-- TODO the remainder of this section has obvious generalizations to `has_equalizer f g`.
277-
278284
instance has_kernel_comp_mono {X Y Z : C} (f : X ⟶ Y) [has_kernel f] (g : Y ⟶ Z) [mono g] :
279285
has_kernel (f ≫ g) :=
280-
{ exists_limit :=
281-
⟨{ cone := kernel_fork.of_ι (kernel.ι f) (by simp),
282-
is_limit := is_limit_aux _ (λ s, kernel.lift _ s.ι ((cancel_mono g).mp (by simp)))
283-
(by tidy) (by tidy) }⟩ }
286+
⟨⟨{ cone := _, is_limit := is_kernel_comp_mono (limit.is_limit _) g }⟩⟩
284287

285288
/--
286289
When `g` is a monomorphism, the kernel of `f ≫ g` is isomorphic to the kernel of `f`.
@@ -440,6 +443,16 @@ def is_colimit.of_π {Z : C} (g : Y ⟶ Z) (eq : f ≫ g = 0)
440443
is_colimit (cokernel_cofork.of_π g eq) :=
441444
is_colimit_aux _ (λ s, desc s.π s.condition) (λ s, fac s.π s.condition) (λ s, uniq s.π s.condition)
442445

446+
/-- Every cokernel of `f` induces a cokernel of `g ≫ f` if `g` is epi. -/
447+
def is_cokernel_epi_comp {c : cokernel_cofork f} (i : is_colimit c) {W} (g : W ⟶ X) [hg : epi g] :
448+
is_colimit (cokernel_cofork.of_π c.π (by simp) : cokernel_cofork (g ≫ f)) :=
449+
cofork.is_colimit.mk' _ $ λ s,
450+
let s' : cokernel_cofork f := cofork.of_π s.π
451+
(by apply hg.left_cancellation; simp [←category.assoc, s.condition]) in
452+
let l := cokernel_cofork.is_colimit.desc' i s'.π s'.condition in
453+
⟨l.1, l.2,
454+
λ m hm, by apply cofork.is_colimit.hom_ext i; rw cofork.π_of_π at hm; rw hm; exact l.2.symm⟩
455+
443456
end
444457

445458
section
@@ -602,13 +615,9 @@ def cokernel_comp_is_iso {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [has_cokernel f
602615
{ hom := cokernel.desc _ (inv g ≫ cokernel.π f) (by simp),
603616
inv := cokernel.desc _ (g ≫ cokernel.π (f ≫ g)) (by rw [←category.assoc, cokernel.condition]), }
604617

605-
instance has_cokernel_epi_comp {X Y Z : C} (f : X ⟶ Y) [epi f] (g : Y ⟶ Z) [has_cokernel g] :
606-
has_cokernel (f ≫ g) :=
607-
{ exists_colimit :=
608-
⟨{ cocone := cokernel_cofork.of_π (cokernel.π g) (by simp),
609-
is_colimit := is_colimit_aux _
610-
(λ s, cokernel.desc _ s.π ((cancel_epi f).mp (by { rw ← category.assoc, simp })))
611-
(by tidy) (by tidy) }⟩ }
618+
instance has_cokernel_epi_comp {X Y : C} (f : X ⟶ Y) [has_cokernel f] {W} (g : W ⟶ X) [epi g] :
619+
has_cokernel (g ≫ f) :=
620+
⟨⟨{ cocone := _, is_colimit := is_cokernel_epi_comp (colimit.is_colimit _) g }⟩⟩
612621

613622
/--
614623
When `f` is an epimorphism, the cokernel of `f ≫ g` is isomorphic to the cokernel of `g`.

0 commit comments

Comments
 (0)