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 (**************************************************************************)
16 include "sets/sets.ma".
18 nrecord category : Type[2] ≝
20 arrows: objs → objs → setoid;
21 id: ∀o:objs. arrows o o;
22 comp: ∀o1,o2,o3. unary_morphism (arrows o2 o3) (unary_morph_setoid (arrows o1 o2) (arrows o1 o3));
23 comp_assoc: ∀o1,o2,o3,o4. ∀a34,a23,a12.
24 comp o1 o3 o4 a34 (comp o1 o2 o3 a23 a12) = comp o1 o2 o4 (comp o2 o3 o4 a34 a23) a12;
25 id_neutral_left: ∀o1,o2. ∀a: arrows o1 o2. comp ??? (id o2) a = a;
26 id_neutral_right: ∀o1,o2. ∀a: arrows o1 o2. comp ??? a (id o1) = a
29 notation > "𝐈𝐝 term 90 A" non associative with precedence 90 for @{ 'id $A }.
30 notation < "mpadded width -90% (𝐈) 𝐝 \sub term 90 A" non associative with precedence 90 for @{ 'id $A }.
32 interpretation "id" 'id A = (id ? A).
34 ndefinition SETOID : category.
37 ##| napply unary_morph_setoid;
38 ##| #o; @ (λx.x); #a; #b; #H; napply H;
39 ##| napply comp_binary_morphisms; (*CSC: why not ∘?*)
40 ##| #o1; #o2; #o3; #o4; #f; #g; #h; #x; #x'; #Hx; nnormalize; napply (†(†(†Hx)))
41 ##|##6,7: #o1; #o2; #f; #x; #x'; #Hx; nnormalize; napply (†Hx) ]
44 unification hint 0 ≔ ;
45 R ≟ (mk_category setoid unary_morph_setoid (id SETOID) (comp SETOID)
46 (comp_assoc SETOID) (id_neutral_left SETOID)
47 (id_neutral_right SETOID))
48 (* -------------------------------------------------------------------- *) ⊢
51 unification hint 0 ≔ x,y ;
52 R ≟ (mk_category setoid unary_morph_setoid (id SETOID) (comp SETOID)
53 (comp_assoc SETOID) (id_neutral_left SETOID)
54 (id_neutral_right SETOID))
55 (* -------------------------------------------------------------------- *) ⊢
56 arrows R x y ≡ unary_morph_setoid x y.
58 unification hint 0 ≔ A,B ;
59 T ≟ (unary_morph_setoid A B)
60 (* ----------------------------------- *) ⊢
61 unary_morphism A B ≡ carr T.
64 ndefinition TYPE : setoid1.
67 alias symbol "eq" = "setoid eq".
68 napply (∃f:T1 ⇒_0 T2.∃g:T2 ⇒_0 T1. (∀x.f (g x) = x) ∧ (∀y.g (f y) = y));
69 ##| #A; @ (𝐈𝐝 A); @ (𝐈𝐝 A); @; #x; napply #;
70 ##| #A; #B; *; #f; *; #g; *; #Hfg; #Hgf; @g; @f; @; nassumption;
71 ##| #A; #B; #C; *; #f; *; #f'; *; #Hf; #Hf'; *; #g; *; #g'; *; #Hg; #Hg';
72 @; ##[ @(λx.g (f x)); #a; #b; #H; napply (.= (††H)); napply #;
73 ##| @; ##[ @(λx.f'(g' x)); #a; #b; #H; napply (.= (††H)); napply #; ##]
75 ##[ napply (.= (†(Hf …))); napply Hg;
76 ##| napply (.= (†(Hg' …))); napply Hf'; ##] ##]
79 unification hint 0 ≔ ;
80 R ≟ (mk_setoid1 setoid (eq1 TYPE))
81 (* -------------------------------------------- *) ⊢
84 nrecord unary_morphism01 (A : setoid) (B: setoid1) : Type[1] ≝
86 prop01: ∀a,a'. eq0 ? a a' → eq1 ? (fun01 a) (fun01 a')
89 interpretation "prop01" 'prop1 c = (prop01 ????? c).