1 (*********************************************************************************************************************************)
2 (* ReificationsIsomorphicToGeneralizedArrows: *)
4 (* The category of generalized arrows and the category of reifications are isomorphic categories. *)
6 (*********************************************************************************************************************************)
8 Generalizable All Variables.
9 Require Import Preamble.
10 Require Import General.
11 Require Import Categories_ch1_3.
12 Require Import Functors_ch1_4.
13 Require Import Isomorphisms_ch1_5.
14 Require Import ProductCategories_ch1_6_1.
15 Require Import OppositeCategories_ch1_6_2.
16 Require Import Enrichment_ch2_8.
17 Require Import Subcategories_ch7_1.
18 Require Import NaturalTransformations_ch7_4.
19 Require Import NaturalIsomorphisms_ch7_5.
20 Require Import MonoidalCategories_ch7_8.
21 Require Import Coherence_ch7_8.
22 Require Import Enrichment_ch2_8.
23 Require Import RepresentableStructure_ch7_2.
24 Require Import Reification.
25 Require Import GeneralizedArrow.
26 Require Import GeneralizedArrowFromReification.
27 Require Import ReificationFromGeneralizedArrow.
28 Require Import ReificationCategory.
29 Require Import GeneralizedArrowCategory.
30 Require Import ReificationCategory.
31 Require Import ReificationsAndGeneralizedArrows.
32 Require Import WeakFunctorCategory.
34 Section ReificationsIsomorphicToGeneralizedArrows.
36 Lemma step1_lemma (s0 s1 s2:SmallSMMEs.SMMEs)(r01:Reification s0 s1 (me_i s1))(r12:Reification s1 s2 (me_i s2)) :
37 (step1_functor s0 s1 r01 >>>>
38 InclusionFunctor (enr_v s1) (FullImage (HomFunctor s1 (me_i s1)))) >>>> step1_functor s1 s2 r12
39 ≃ step1_functor s0 s2 (compose_reifications s0 s1 s2 r01 r12).
43 Definition M1 {c1 c2 : SmallSMMEs.SMMEs} :
44 (c1 ~~{ MorphismsOfCategoryOfGeneralizedArrows }~~> c2) ->
45 (c1 ~~{ MorphismsOfCategoryOfReifications }~~> c2).
47 destruct GA; [ apply roi_id | idtac ].
49 apply reification_from_garrow.
53 (* I tried really hard to avoid this *)
54 Require Import Coq.Logic.Eqdep.
56 Inductive Heq : forall {A}{B}, A -> B -> Prop :=
57 heq : forall {A} (a:A), Heq a a.
59 Lemma invert_ga' : forall (a b: SMME)
60 (f:a~~{MorphismsOfCategoryOfGeneralizedArrows}~~>b), a=b ->
61 (Heq f (gaoi_id a)) \/ (exists f', Heq f (gaoi_ga a b f')).
70 Lemma invert_ga : forall (a: SMME)
71 (f:a~~{MorphismsOfCategoryOfGeneralizedArrows}~~>a),
72 (f = gaoi_id _) \/ (exists f', f = gaoi_ga _ _ f').
74 set (invert_ga' a a f (refl_equal a)) as q.
78 apply inj_pairT2 in H2.
79 apply inj_pairT2 in H1.
85 apply inj_pairT2 in H2.
86 apply inj_pairT2 in H1.
90 Lemma invert_reif' : forall (a b: SMME)
91 (f:a~~{MorphismsOfCategoryOfReifications}~~>b), a=b ->
92 (Heq f (roi_id a)) \/ (exists f', Heq f (roi_reif a b f')).
101 Lemma invert_reif : forall (a: SMME)
102 (f:a~~{MorphismsOfCategoryOfReifications}~~>a),
103 (f = roi_id _) \/ (exists f', f = roi_reif _ _ f').
105 set (invert_reif' a a f (refl_equal a)) as q.
109 apply inj_pairT2 in H2.
110 apply inj_pairT2 in H1.
116 apply inj_pairT2 in H2.
117 apply inj_pairT2 in H1.
121 Definition M1_Functor : Functor MorphismsOfCategoryOfGeneralizedArrows MorphismsOfCategoryOfReifications (fun x => x).
122 refine {| fmor := fun a b f => M1 f |}.
128 set (invert_ga _ f') as q.
135 destruct f'; simpl in *.
147 apply (if_associativity
148 ((ga_functor g0 >>>> HomFunctor s0 (mon_i s0))) (ga_functor g) (HomFunctor s2 (me_i s2))).
151 Definition M2 (c1 c2 : SmallSMMEs.SMMEs) :
152 (c1 ~~{ MorphismsOfCategoryOfReifications }~~> c2) ->
153 (c1 ~~{ MorphismsOfCategoryOfGeneralizedArrows }~~> c2).
155 destruct RE; [ apply gaoi_id | idtac ].
157 apply (garrow_from_reification s1 s2 r).
161 forall a b (f f':a~~{MorphismsOfCategoryOfReifications}~~>b),
163 M2 a b f ~~ M2 a b f'.
169 set (invert_reif _ f') as q.
175 unfold garrow_functor.
176 unfold step2_functor.
179 apply (if_comp (@step1_niso _ smme _ _ smme x)).
181 apply (@roundtrip_lemma _ smme _ _ smme x).
183 destruct f'; simpl in *.
188 unfold garrow_functor.
189 unfold step2_functor.
190 apply (if_comp (@step1_niso _ smme _ _ smme r)).
192 apply (@roundtrip_lemma _ smme _ _ smme r).
194 unfold garrow_functor.
195 unfold step2_functor.
197 set (if_comp H (@step1_niso _ s1 _ _ s2 r)) as yy.
198 set (if_comp (if_inv (@step1_niso _ s1 _ _ s2 r0)) yy) as yy'.
199 apply (if_comp (@roundtrip_lemma _ s1 _ _ s2 r)).
201 apply (if_comp (@roundtrip_lemma _ s1 _ _ s2 r0)).
205 Definition M2_Functor : Functor MorphismsOfCategoryOfReifications MorphismsOfCategoryOfGeneralizedArrows (fun x => x).
206 refine {| fmor := fun a b f => M2 _ _ f |}.
208 intros; simpl; apply if_id.
217 (F0:=((garrow_functor s1 s0 r >>>> HomFunctor s0 (mon_i s0)) >>>> garrow_functor s0 s2 r0))
218 (F1:=(garrow_functor s1 s2 (compose_reifications s1 s0 s2 r r0)))
219 (G0:=(HomFunctor s2 (mon_i s2)))
220 (G1:=(HomFunctor s2 (mon_i s2))));
221 [ idtac | apply if_id ].
224 apply (if_associativity (garrow_functor s1 s0 r) (HomFunctor s0 (mon_i s0)) (garrow_functor s0 s2 r0)).
226 unfold garrow_functor at 1.
227 unfold step2_functor at 1.
228 set (roundtrip_lemma'
229 (HomFunctor (enr_c (smme_e s0)) (me_i (smme_mon s0)))
230 (ffme_mf_full (smme_mee s0)) (ffme_mf_faithful (smme_mee s0))
231 (step1_functor (smme_see s1) (smme_mee s0) r)
234 (G0:=garrow_functor (smme_see s0) (smme_mee s2) r0)
235 (G1:=garrow_functor (smme_see s0) (smme_mee s2) r0)
239 unfold garrow_functor at 2.
240 unfold garrow_functor at 1.
243 apply (if_associativity _ (step1_functor s0 s2 r0) (step2_functor s2)).
245 (G0:=step2_functor s2)
246 (G1:=step2_functor s2)); [ idtac | apply if_id ].
250 Theorem ReificationsAreGArrows : IsomorphicCategories CategoryOfGeneralizedArrows CategoryOfReifications.
251 refine {| ic_f := M1_Functor ; ic_g := M2_Functor |}.
252 unfold EqualFunctors; intros; apply heq_morphisms_intro; unfold eqv in *; simpl in *.
254 set (@roundtrip_garrow_to_garrow _ a _ _ b) as q.
255 destruct f; simpl in *.
258 apply (if_comp (if_inv H)).
261 apply (if_respects(F0:=ga_functor g)(F1:=garrow_functor s1 s2 (reification_from_garrow s1 s2 g))
262 (G0:=HomFunctor s2 (mon_i s2))(G1:=HomFunctor s2 (mon_i s2))).
266 unfold EqualFunctors; intros; apply heq_morphisms_intro; unfold eqv in *; simpl in *.
268 set (@roundtrip_reification_to_reification _ a _ _ b) as q.
272 apply (if_comp (if_inv H)).
282 End ReificationsIsomorphicToGeneralizedArrows.