+definition category2_of_category1: category1 → category2.
+ intro;
+ constructor 1;
+ [ apply (objs1 c);
+ | intros; apply (setoid2_of_setoid1 (arrows1 c o o1));
+ | apply (id1 c);
+ | intros;
+ constructor 1;
+ [ intros; apply (comp1 c o1 o2 o3 c1 c2);
+ | intros; whd in e e1 a a' b b'; change with (eq1 ? (b∘a) (b'∘a')); apply (e‡e1); ]
+ | intros; simplify; whd in a12 a23 a34; whd; apply rule (ASSOC);
+ | intros; simplify; whd in a; whd; apply id_neutral_right1;
+ | intros; simplify; whd in a; whd; apply id_neutral_left1; ]
+qed.
+(*coercion category2_of_category1.*)
+
+record functor2 (C1: category2) (C2: category2) : Type3 ≝
+ { map_objs2:1> C1 → C2;
+ map_arrows2: ∀S,T. unary_morphism2 (arrows2 ? S T) (arrows2 ? (map_objs2 S) (map_objs2 T));
+ respects_id2: ∀o:C1. map_arrows2 ?? (id2 ? o) = id2 ? (map_objs2 o);
+ respects_comp2:
+ ∀o1,o2,o3.∀f1:arrows2 ? o1 o2.∀f2:arrows2 ? o2 o3.
+ map_arrows2 ?? (f2 ∘ f1) = map_arrows2 ?? f2 ∘ map_arrows2 ?? f1}.
+
+definition functor2_setoid: category2 → category2 → setoid3.
+ intros (C1 C2);
+ constructor 1;
+ [ apply (functor2 C1 C2);
+ | constructor 1;
+ [ intros (f g);
+ apply (∀c:C1. cic:/matita/logic/equality/eq.ind#xpointer(1/1) ? (f c) (g c));
+ | simplify; intros; apply cic:/matita/logic/equality/eq.ind#xpointer(1/1/1);
+ | simplify; intros; apply cic:/matita/logic/equality/sym_eq.con; apply H;
+ | simplify; intros; apply cic:/matita/logic/equality/trans_eq.con;
+ [2: apply H; | skip | apply H1;]]]
+qed.
+
+definition functor2_of_functor2_setoid: ∀S,T. functor2_setoid S T → functor2 S T ≝ λS,T,x.x.
+coercion functor2_of_functor2_setoid.
+
+definition CAT2: category3.
+ constructor 1;
+ [ apply category2;
+ | apply functor2_setoid;
+ | intros; constructor 1;
+ [ apply (λx.x);
+ | intros; constructor 1;
+ [ apply (λx.x);
+ | intros; assumption;]
+ | intros; apply rule #;
+ | intros; apply rule #; ]
+ | intros; constructor 1;
+ [ intros; constructor 1;
+ [ intros; apply (c1 (c o));
+ | intros; constructor 1;
+ [ intro; apply (map_arrows2 ?? c1 ?? (map_arrows2 ?? c ?? c2));
+ | intros; apply (††e); ]
+ | intros; simplify;
+ apply (.= †(respects_id2 : ?));
+ apply (respects_id2 : ?);
+ | intros; simplify;
+ apply (.= †(respects_comp2 : ?));
+ apply (respects_comp2 : ?); ]
+ | intros; intro; simplify;
+ apply (cic:/matita/logic/equality/eq_ind.con ????? (e ?));
+ apply (cic:/matita/logic/equality/eq_ind.con ????? (e1 ?));
+ constructor 1; ]
+ | intros; intro; simplify; constructor 1;
+ | intros; intro; simplify; constructor 1;
+ | intros; intro; simplify; constructor 1; ]
+qed.
+
+definition category2_of_objs3_CAT2: objs3 CAT2 → category2 ≝ λx.x.
+coercion category2_of_objs3_CAT2.
+
+definition functor2_setoid_of_arrows3_CAT2: ∀S,T. arrows3 CAT2 S T → functor2_setoid S T ≝ λS,T,x.x.
+coercion functor2_setoid_of_arrows3_CAT2.
+
+definition unary_morphism_setoid: setoid → setoid → setoid.