Skip to content

Commit 1c3dd70

Browse files
Merge pull request #1900 from gio256/coeq
Zero-groupoid universal property for coequalizers
2 parents 3b94fcc + d034777 commit 1c3dd70

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

theories/Colimits/Coeq.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Proof.
5555
Defined.
5656

5757
(** ** Universal property *)
58+
(** See Colimits/CoeqUnivProp.v for a similar universal property without [Funext]. *)
5859

5960
Definition Coeq_unrec {B A} (f g : B -> A) {P}
6061
(h : Coeq f g -> P)

theories/Colimits/CoeqUnivProp.v

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
Require Import Basics.Overture.
2+
Require Import Basics.Tactics.
3+
Require Import Basics.PathGroupoids.
4+
Require Import Types.Paths.
5+
Require Import Colimits.Coeq.
6+
Require Import Cubical.DPath.
7+
Require Import WildCat.Core.
8+
Require Import WildCat.Displayed.
9+
Require Import WildCat.Equiv.
10+
Require Import WildCat.EquivGpd.
11+
Require Import WildCat.Forall.
12+
Require Import WildCat.Paths.
13+
Require Import WildCat.ZeroGroupoid.
14+
15+
(** Using wild 0-groupoids, the universal property can be proven without funext. A simple equivalence of 0-groupoids between [Coeq f g -> P] and [{ h : A -> P & h o f == h o g }] would not carry all the higher-dimensional information, but if we generalize it to dependent functions, then it does suffice. *)
16+
Section UnivProp.
17+
Context {B A : Type} (f g : B -> A) (P : Coeq f g -> Type).
18+
19+
(** This allows Coq to infer 0-groupoid structures of the form [@isgraph_forall C P (fun c => isgraph_paths (P c))] on any type of the form [forall c, P c]. *)
20+
Local Existing Instances isgraph_forall is01cat_forall is0gpd_forall | 1.
21+
Local Existing Instances isgraph_total is01cat_total is0gpd_total | 1.
22+
Local Existing Instances isgraph_paths is01cat_paths is0gpd_paths | 2.
23+
24+
(** The codomain of the equivalence is a sigma-groupoid of this family. *)
25+
Definition Coeq_ind_data (h : forall a : A, P (coeq a))
26+
:= forall b : B, DPath P (cglue b) (h (f b)) (h (g b)).
27+
28+
(** We consider [Coeq_ind_data] to be a displayed 0-groupoid, where objects over [h : forall a : A, P (coeq a)] are dependent paths as defined above and morphisms over [p : h == k] are witnesses that p commutes with the homotopies over [h] and [k]. *)
29+
Local Instance isdgraph_Coeq_ind_data : IsDGraph Coeq_ind_data.
30+
Proof.
31+
intros h k p r s.
32+
exact (forall b, ap (transport P (cglue b)) (p (f b)) @ s b = r b @ p (g b)).
33+
Defined.
34+
35+
Local Instance isd01cat_Coeq_ind_data : IsD01Cat Coeq_ind_data.
36+
Proof.
37+
nrapply Build_IsD01Cat.
38+
- intros h h' b; exact (concat_1p_p1 _).
39+
- intros h k j p q h' k' j' p' q' b.
40+
lhs nrapply ap_pp_p.
41+
lhs nrapply (whiskerL _ (p' b)).
42+
lhs nrapply concat_p_pp.
43+
lhs nrapply (whiskerR (q' b)).
44+
nrapply concat_pp_p.
45+
Defined.
46+
47+
Local Instance isd0gpd_Coeq_ind_data : IsD0Gpd Coeq_ind_data.
48+
Proof.
49+
intros h k p r s p' b.
50+
lhs nrapply (whiskerR (ap_V _ _)).
51+
nrapply moveL_pV.
52+
lhs nrapply concat_pp_p.
53+
lhs nrapply (whiskerL _ (p' b)^).
54+
lhs nrapply concat_p_pp.
55+
lhs nrapply (whiskerR (concat_Vp _)).
56+
nrapply concat_1p.
57+
Defined.
58+
59+
(** Here is the functor. The domain is the fully-applied type of [Coeq_ind]: sections of [P] over [Coeq f g]. The codomain consists of input data for [Coeq_ind] given a 0-groupoid structure via [is0gpd_total]. *)
60+
Definition Coeq_ind_inv : (forall z : Coeq f g, P z) -> sig Coeq_ind_data.
61+
Proof.
62+
intros h.
63+
exists (h o coeq).
64+
intros b.
65+
exact (apD h (cglue b)).
66+
Defined.
67+
68+
(** Use [Set Printing Implicit] to see the 0-groupoid structures described above. *)
69+
Local Instance is0functor_Coeq_ind_inv : Is0Functor Coeq_ind_inv.
70+
Proof.
71+
nrapply Build_Is0Functor.
72+
intros h k p.
73+
exists (p o coeq).
74+
intros b.
75+
nrapply moveL_pM.
76+
exact ((apD_homotopic p (cglue b))^).
77+
Defined.
78+
79+
Local Instance issurjinj_Coeq_ind_inv : IsSurjInj Coeq_ind_inv.
80+
Proof.
81+
nrapply Build_IsSurjInj.
82+
- intros [h r].
83+
exists (Coeq_ind P h r).
84+
exists (fun a => idpath).
85+
intros b.
86+
nrefine (concat_1p _ @ _ @ (concat_p1 _)^).
87+
symmetry.
88+
nrapply Coeq_ind_beta_cglue.
89+
- intros h k [p p'].
90+
snrapply Coeq_ind.
91+
1: exact p.
92+
intros b; specialize (p' b).
93+
lhs nrapply transport_paths_FlFr_D.
94+
lhs nrapply concat_pp_p.
95+
lhs nrapply (whiskerL _ p').
96+
lhs nrapply concat_p_pp.
97+
lhs nrapply (whiskerR (concat_Vp _)).
98+
nrapply concat_1p.
99+
Defined.
100+
101+
Definition equiv_0gpd_Coeq_ind
102+
: Build_ZeroGpd (forall z : Coeq f g, P z) _ _ _
103+
$<~> Build_ZeroGpd (sig Coeq_ind_data) _ _ _.
104+
Proof.
105+
snrapply Build_CatEquiv.
106+
1: rapply Build_Morphism_0Gpd.
107+
rapply isequiv_0gpd_issurjinj.
108+
Defined.
109+
110+
End UnivProp.

0 commit comments

Comments
 (0)