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

Commit 32b2e30

Browse files
committed
feat(category_theory/monad): special coequalizers for a monad (#5239)
Two important coequalizer diagrams related to a monad
1 parent 4e8486b commit 32b2e30

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/-
2+
Copyright (c) 2020 Bhavik Mehta. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Bhavik Mehta
5+
-/
6+
7+
import category_theory.limits.shapes.reflexive
8+
import category_theory.limits.preserves.shapes.equalizers
9+
import category_theory.limits.shapes.split_coequalizer
10+
import category_theory.limits.preserves.limits
11+
import category_theory.monad.adjunction
12+
13+
/-!
14+
# Special coequalizers associated to a monad
15+
16+
Associated to a monad `T : C ⥤ C` we have important coequalizer constructions:
17+
Any algebra is a coequalizer (in the category of algebras) of free algebras. Furthermore, this
18+
coequalizer is reflexive.
19+
In `C`, this cofork diagram is a split coequalizer (in particular, it is still a coequalizer).
20+
This split coequalizer is known as the Beck coequalizer (as it features heavily in Beck's
21+
monadicity theorem).
22+
-/
23+
universes v₁ u₁
24+
25+
namespace category_theory
26+
namespace monad
27+
open limits
28+
29+
variables {C : Type u₁}
30+
variables [category.{v₁} C]
31+
variables {T : C ⥤ C} [monad T] (X : monad.algebra T)
32+
33+
/-!
34+
Show that any algebra is a coequalizer of free algebras.
35+
-/
36+
37+
/-- The top map in the coequalizer diagram we will construct. -/
38+
@[simps {rhs_md := semireducible}]
39+
def coequalizer.top_map : (monad.free T).obj (T.obj X.A) ⟶ (monad.free T).obj X.A :=
40+
(monad.free T).map X.a
41+
42+
/-- The bottom map in the coequalizer diagram we will construct. -/
43+
@[simps]
44+
def coequalizer.bottom_map : (monad.free T).obj (T.obj X.A) ⟶ (monad.free T).obj X.A :=
45+
{ f := (μ_ T).app X.A,
46+
h' := monad.assoc X.A }
47+
48+
/-- The cofork map in the coequalizer diagram we will construct. -/
49+
@[simps]
50+
def coequalizer.π : (monad.free T).obj X.A ⟶ X :=
51+
{ f := X.a,
52+
h' := X.assoc.symm }
53+
54+
lemma coequalizer.condition :
55+
coequalizer.top_map X ≫ coequalizer.π X = coequalizer.bottom_map X ≫ coequalizer.π X :=
56+
algebra.hom.ext _ _ X.assoc.symm
57+
58+
instance : is_reflexive_pair (coequalizer.top_map X) (coequalizer.bottom_map X) :=
59+
begin
60+
apply is_reflexive_pair.mk' _ _ _,
61+
apply (free T).map ((η_ T).app X.A),
62+
{ ext,
63+
dsimp,
64+
rw [← T.map_comp, X.unit, T.map_id] },
65+
{ ext,
66+
apply monad.right_unit }
67+
end
68+
69+
/--
70+
Construct the Beck cofork in the category of algebras. This cofork is reflexive as well as a
71+
coequalizer.
72+
-/
73+
@[simps {rhs_md := semireducible}]
74+
def beck_algebra_cofork : cofork (coequalizer.top_map X) (coequalizer.bottom_map X) :=
75+
cofork.of_π _ (coequalizer.condition X)
76+
77+
/--
78+
The cofork constructed is a colimit. This shows that any algebra is a (reflexive) coequalizer of
79+
free algebras.
80+
-/
81+
def beck_algebra_coequalizer : is_colimit (beck_algebra_cofork X) :=
82+
cofork.is_colimit.mk' _ $ λ s,
83+
begin
84+
have h₁ : T.map X.a ≫ s.π.f = (μ_ T).app X.A ≫ s.π.f := congr_arg monad.algebra.hom.f s.condition,
85+
have h₂ : T.map s.π.f ≫ s.X.a = (μ_ T).app X.A ≫ s.π.f := s.π.h,
86+
refine ⟨⟨(η_ T).app _ ≫ s.π.f, _⟩, _, _⟩,
87+
{ dsimp,
88+
rw [T.map_comp, category.assoc, h₂, monad.right_unit_assoc,
89+
(show X.a ≫ _ ≫ _ = _, from (η_ T).naturality_assoc _ _), h₁, monad.left_unit_assoc] },
90+
{ ext,
91+
simpa [← (η_ T).naturality_assoc, monad.left_unit_assoc] using ((η_ T).app (T.obj X.A)) ≫= h₁ },
92+
{ intros m hm,
93+
ext,
94+
dsimp only,
95+
rw ← hm,
96+
apply (X.unit_assoc _).symm }
97+
end
98+
99+
/-- The Beck cofork is a split coequalizer. -/
100+
def beck_split_coequalizer : is_split_coequalizer (T.map X.a) ((μ_ T).app _) X.a :=
101+
⟨(η_ T).app _, (η_ T).app _, X.assoc.symm, X.unit, monad.left_unit _, ((η_ T).naturality _).symm⟩
102+
103+
/-- This is the Beck cofork. It is a split coequalizer, in particular a coequalizer. -/
104+
@[simps {rhs_md := semireducible}]
105+
def beck_cofork : cofork (T.map X.a) ((μ_ T).app _) :=
106+
(beck_split_coequalizer X).as_cofork
107+
108+
/-- The Beck cofork is a coequalizer. -/
109+
def beck_coequalizer : is_colimit (beck_cofork X) :=
110+
(beck_split_coequalizer X).is_coequalizer
111+
112+
end monad
113+
end category_theory

0 commit comments

Comments
 (0)