Skip to content

Commit ce8a6b0

Browse files
Regular.v: categories in which one can do diagram chasing
Co-authored-by: Thomas Wilskow Thorbjørnsen <[email protected]>
1 parent c1166c4 commit ce8a6b0

File tree

3 files changed

+393
-5
lines changed

3 files changed

+393
-5
lines changed

theories/WildCat.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Require Export WildCat.Displayed.
1919
Require Export WildCat.DisplayedEquiv.
2020
Require Export WildCat.Pullbacks.
2121
Require Export WildCat.AbEnriched.
22+
Require Export WildCat.Regular.
2223

2324
Require Export WildCat.SetoidRewrite.
2425

theories/WildCat/Core.v

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,125 @@ Definition cat_comp2 {A} `{Is1Cat A} {a b c : A}
150150

151151
Notation "q $@@ p" := (cat_comp2 q p).
152152

153-
(** Monomorphisms and epimorphisms. *)
153+
(** Epimorphisms and monomorphisms. *)
154154

155-
Definition Monic {A} `{Is1Cat A} {b c: A} (f : b $-> c)
156-
:= forall a (g h : a $-> b), f $o g $== f $o h -> g $== h.
155+
Class Epic {A} `{Is1Cat A} {a b : A} (f : a $-> b)
156+
:= isepic : forall {c} (g h : b $-> c), g $o f $== h $o f -> g $== h.
157157

158-
Definition Epic {A} `{Is1Cat A} {a b : A} (f : a $-> b)
159-
:= forall c (g h : b $-> c), g $o f $== h $o f -> g $== h.
158+
Arguments isepic {A}%_type_scope {IsGraph0 Is2Graph0 Is01Cat0 H a b} f {Epic c} g h _.
159+
160+
Section Epimorphisms.
161+
162+
Context {A : Type} `{Is1Cat A}.
163+
164+
#[export]
165+
Instance epic_id (P : A) : Epic (Id P).
166+
Proof.
167+
intros B b b' h.
168+
exact ((cat_idr _)^$ $@ h $@ cat_idr _).
169+
Defined.
170+
171+
Definition epic_homotopic {P P'} (f g : P $-> P') `{!Epic f} (h : f $== g)
172+
: Epic g.
173+
Proof.
174+
intros Q x x' h'.
175+
apply (isepic f).
176+
exact ((x $@L h) $@ h' $@ (x' $@L h^$)).
177+
Defined.
178+
179+
#[export]
180+
Instance epic_compose {P P' P'' : A} (f : P $-> P') (g : P' $-> P'')
181+
`{!Epic f} `{!Epic g}
182+
: Epic (g $o f).
183+
Proof.
184+
intros Q x x' h.
185+
apply (isepic g).
186+
apply (isepic f).
187+
exact ((cat_assoc f g x) $@ h $@ (cat_assoc_opp f g x')).
188+
Defined.
189+
190+
Definition epic_cancel {P P' P'' : A} (f : P $-> P') (g : P' $-> P'')
191+
`{!Epic (g $o f)}
192+
: Epic g.
193+
Proof.
194+
intros Q x x' h.
195+
rapply isepic.
196+
exact ((cat_assoc_opp f g x) $@ (h $@R f) $@ (cat_assoc f g x')).
197+
Defined.
198+
199+
Definition Epi (P' P : A) := { e : P' $-> P & Epic e }.
200+
201+
Definition hom_epi {P' P} (e : Epi P' P) := pr1 e : P' $-> P.
202+
Coercion hom_epi : Epi >-> Hom.
203+
204+
#[export]
205+
Instance epic_epi {P' P} (e : Epi P' P) : Epic e := pr2 e.
206+
207+
Definition id_epi P : Epi P P := (Id P; epic_id P).
208+
209+
End Epimorphisms.
210+
211+
Notation "P' $->> P" := (Epi P' P) (at level 99).
212+
213+
(** Monomorphisms could be defined as epimorphisms in the opposite category, which would allow us to reuse the proofs below. We'd have to move the material on epis and monos to a separate file. *)
214+
215+
Class Monic {A} `{Is1Cat A} {b c: A} (f : b $-> c)
216+
:= ismonic : forall {a} (g h : a $-> b), f $o g $== f $o h -> g $== h.
217+
218+
Arguments ismonic {A}%_type_scope {IsGraph0 Is2Graph0 Is01Cat0 H b c} f {Monic a} g h _.
219+
220+
Section Monomorphisms.
221+
222+
Context {A : Type} `{Is1Cat A}.
223+
224+
#[export]
225+
Instance monic_id (P : A) : Monic (Id P).
226+
Proof.
227+
intros B b b' h.
228+
exact ((cat_idl _)^$ $@ h $@ cat_idl _).
229+
Defined.
230+
231+
Definition monic_homotopic {P P'} (f g : P $-> P') `{!Monic f} (h : f $== g)
232+
: Monic g.
233+
Proof.
234+
intros Q x x' h'.
235+
apply (ismonic f).
236+
exact ((h $@R x) $@ h' $@ (h^$ $@R x')).
237+
Defined.
238+
239+
#[export]
240+
Instance monic_compose {P P' P'' : A} (f : P $-> P') (g : P' $-> P'')
241+
`{!Monic f} `{!Monic g}
242+
: Monic (g $o f).
243+
Proof.
244+
intros Q x x' h.
245+
apply (ismonic f).
246+
apply (ismonic g).
247+
exact ((cat_assoc_opp x f g) $@ h $@ (cat_assoc x' f g)).
248+
Defined.
249+
250+
Definition monic_cancel {P P' P'' : A} (f : P $-> P') (g : P' $-> P'')
251+
`{!Monic (g $o f)}
252+
: Monic f.
253+
Proof.
254+
intros Q x x' h.
255+
rapply ismonic.
256+
exact ((cat_assoc x f g) $@ (g $@L h) $@ (cat_assoc_opp x' f g)).
257+
Defined.
258+
259+
Definition Mono (P' P : A) := { e : P' $-> P & Monic e }.
260+
261+
Definition hom_mono {P' P} (m : Mono P' P) := pr1 m : P' $-> P.
262+
Coercion hom_mono : Mono >-> Hom.
263+
264+
#[export]
265+
Instance monic_mono {P' P} (e : Mono P' P) : Monic e := pr2 e.
266+
267+
Definition id_mono P : Mono P P := (Id P; monic_id P).
268+
269+
End Monomorphisms.
270+
271+
Notation "P' $>-> P" := (Mono P' P) (at level 99).
160272

161273
(** Section might be a clearer name but it's better to avoid confusion with Coq keywords. *)
162274

0 commit comments

Comments
 (0)