1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "logic/cprop_connectives.ma".
17 record equivalence_relation (A:Type) : Type ≝
18 { eq_rel:2> A → A → CProp;
19 refl: reflexive ? eq_rel;
20 sym: symmetric ? eq_rel;
21 trans: transitive ? eq_rel
24 record setoid : Type ≝
26 eq: equivalence_relation carr
29 interpretation "setoid eq" 'eq x y = (eq_rel _ (eq _) x y).
30 notation ".= r" with precedence 50 for @{trans ????? $r}.
31 interpretation "setoid symmetry" 'invert r = (sym ____ r).
33 record binary_morphism (A,B,C: setoid) : Type ≝
35 prop: ∀a,a',b,b'. eq ? a a' → eq ? b b' → eq ? (fun a b) (fun a' b')
38 notation "# r" with precedence 60 for @{prop ???????? (refl ???) $r}.
39 notation "r #" with precedence 60 for @{prop ???????? $r (refl ???)}.
41 definition CPROP: setoid.
46 | intros 1; split; intro; assumption
47 | intros 3; cases H; split; assumption
48 | intros 5; cases H; cases H1; split; intro;
49 [ apply (H4 (H2 H6)) | apply (H3 (H5 H6))]]]
52 definition eq_morphism: ∀S:setoid. binary_morphism S S CPROP.
55 [ apply (eq_rel ? (eq S))
56 | intros; split; intro;
57 [ apply (.= H \sup -1);
65 record category : Type ≝
67 arrows: objs → objs → setoid;
68 id: ∀o:objs. arrows o o;
69 comp: ∀o1,o2,o3. binary_morphism (arrows o1 o2) (arrows o2 o3) (arrows o1 o3);
70 comp_assoc: ∀o1,o2,o3,o4. ∀a12,a23,a34.
71 comp o1 o3 o4 (comp o1 o2 o3 a12 a23) a34 = comp o1 o2 o4 a12 (comp o2 o3 o4 a23 a34);
72 id_neutral_left: ∀o1,o2. ∀a: arrows o1 o2. comp ??? (id o1) a = a;
73 id_neutral_right: ∀o1,o2. ∀a: arrows o1 o2. comp ??? a (id o2) = a
76 interpretation "category composition" 'compose x y = (fun ___ (comp ____) x y).
77 notation "'ASSOC'" with precedence 90 for @{comp_assoc ????????}.