ReificationsIsomorphicToGeneralizedArrows: use EqDep
[coq-hetmet.git] / src / GeneralizedArrowCategory.v
1 (*********************************************************************************************************************************)
2 (* CategoryOfGeneralizedArrows:                                                                                                  *)
3 (*                                                                                                                               *)
4 (*   There is a category whose objects are surjective monic monoidal enrichments (SMME's) and whose morphisms                    *)
5 (*   are generalized  Arrows                                                                                                     *)
6 (*                                                                                                                               *)
7 (*********************************************************************************************************************************)
8
9 Generalizable All Variables.
10 Require Import Preamble.
11 Require Import General.
12 Require Import Categories_ch1_3.
13 Require Import Functors_ch1_4.
14 Require Import Isomorphisms_ch1_5.
15 Require Import ProductCategories_ch1_6_1.
16 Require Import OppositeCategories_ch1_6_2.
17 Require Import Enrichment_ch2_8.
18 Require Import Subcategories_ch7_1.
19 Require Import NaturalTransformations_ch7_4.
20 Require Import NaturalIsomorphisms_ch7_5.
21 Require Import MonoidalCategories_ch7_8.
22 Require Import Coherence_ch7_8.
23 Require Import Enrichment_ch2_8.
24 Require Import RepresentableStructure_ch7_2.
25 Require Import GeneralizedArrow.
26 Require Import WeakFunctorCategory.
27 Require Import SmallSMMEs.
28
29 (*
30  * Technically reifications form merely a *semicategory* (no identity
31  * maps), but one can always freely adjoin identity maps (and nothing
32  * else) to a semicategory to get a category whose non-identity-map
33  * portion is identical to the original semicategory
34  *
35  * Also, technically this category has ALL enrichments (not just the
36  * surjective monic monoidal ones), though there maps OUT OF only the
37  * surjective enrichments and INTO only the monic monoidal
38  * enrichments.  It's a big pain to do this in Coq, but sort of might
39  * matter in real life: a language with really severe substructural
40  * restrictions might fail to be monoidally enriched, meaning we can't
41  * use it as a host language.  But that's for the next paper...
42  *)
43 Inductive GeneralizedArrowOrIdentity : SMMEs -> SMMEs -> Type :=
44   | gaoi_id   : forall smme:SMMEs,                             GeneralizedArrowOrIdentity smme smme
45   | gaoi_ga : forall s1 s2:SMMEs, GeneralizedArrow s1 s2  -> GeneralizedArrowOrIdentity s1   s2.
46
47 Definition generalizedArrowOrIdentityFobj (s1 s2:SMMEs) (f:GeneralizedArrowOrIdentity s1 s2) : s1 -> s2 :=
48   match f in GeneralizedArrowOrIdentity S1 S2 return S1 -> S2 with
49   | gaoi_id  s       => fun x => x
50   | gaoi_ga s1 s2 f  => fun a => ehom(ECategory:=s2) (mon_i (smme_mon s2)) (ga_functor_obj f a)
51   end.
52
53 Definition generalizedArrowOrIdentityFunc s1 s2 (f:GeneralizedArrowOrIdentity s1 s2)
54   : Functor s1 s2 (generalizedArrowOrIdentityFobj _ _ f) :=
55   match f with
56   | gaoi_id  s       => functor_id _
57   | gaoi_ga s1 s2 f  => ga_functor f >>>> RepresentableFunctor s2 (mon_i s2)
58   end.
59
60 Definition compose_generalizedArrows (s0 s1 s2:SMMEs) :
61   GeneralizedArrow s0 s1 -> GeneralizedArrow s1 s2 -> GeneralizedArrow s0 s2.
62   intro g01.
63   intro g12.
64   refine
65     {| ga_functor          := g01 >>>> RepresentableFunctor s1 (mon_i s1) >>>> g12 |}.
66     apply MonoidalFunctorsCompose.
67     apply MonoidalFunctorsCompose.
68     apply (ga_functor_monoidal g01).
69     apply (me_mf s1).
70     apply (ga_functor_monoidal g12).
71     Defined.
72
73 Definition generalizedArrowOrIdentityComp
74   : forall s1 s2 s3, GeneralizedArrowOrIdentity s1 s2 -> GeneralizedArrowOrIdentity s2 s3 -> GeneralizedArrowOrIdentity s1 s3.
75   intros.
76   destruct X.
77     apply X0.
78   destruct X0.
79     apply (gaoi_ga _ _ g).
80     apply (gaoi_ga _ _ (compose_generalizedArrows _ _ _ g g0)).
81     Defined.
82
83 Definition MorphismsOfCategoryOfGeneralizedArrows : @SmallFunctors SMMEs.
84   refine {| small_func      := GeneralizedArrowOrIdentity
85           ; small_func_id   := fun s => gaoi_id s
86           ; small_func_func := fun smme1 smme2 f => generalizedArrowOrIdentityFunc _ _ f
87           ; small_func_comp := generalizedArrowOrIdentityComp
88          |}; intros; simpl.
89   apply if_id.
90   destruct f as [|fobj f]; simpl in *.
91     apply if_inv.
92     apply if_left_identity.
93   destruct g as [|gobj g]; simpl in *.
94     apply if_inv.
95     apply if_right_identity.
96   unfold mf_F.
97   idtac.
98   unfold mf_f.
99   apply if_associativity.
100   Defined.
101
102 Definition CategoryOfGeneralizedArrows :=
103   WeakFunctorCategory MorphismsOfCategoryOfGeneralizedArrows.