-nrecord setoid : Type[1] ≝
- { carr:> Type;
- eq: carr → carr → CProp;
- refl: reflexive … eq;
- sym: symmetric … eq;
- trans: transitive … eq
- }.
-
-ndefinition proofs: CProp → setoid.
-#P; napply mk_setoid;
-##[ napply P;
-##| #x; #y; napply True;
-##|##*: nwhd; nrepeat (#_); napply I;
-##]
+nrecord setoid : Type[1] ≝ {
+ carr:> Type[0];
+ eq0: equivalence_relation carr
+}.
+
+interpretation "setoid eq" 'eq t x y = (eq_rel ? (eq0 t) x y).
+
+notation > "hvbox(a break =_0 b)" non associative with precedence 45
+for @{ eq_rel ? (eq0 ?) $a $b }.
+
+interpretation "setoid symmetry" 'invert r = (sym ???? r).
+notation ".= r" with precedence 50 for @{'trans $r}.
+interpretation "trans" 'trans r = (trans ????? r).
+notation > ".=_0 r" with precedence 50 for @{'trans_x0 $r}.
+interpretation "trans_x0" 'trans_x0 r = (trans ????? r).
+
+nrecord unary_morphism (A,B: setoid) : Type[0] ≝ {
+ fun1:1> A → B;
+ prop1: ∀a,a'. a = a' → fun1 a = fun1 a'
+}.
+
+notation > "B ⇒_0 C" right associative with precedence 72 for @{'umorph0 $B $C}.
+notation "hvbox(B break ⇒\sub 0 C)" right associative with precedence 72 for @{'umorph0 $B $C}.
+interpretation "unary morphism 0" 'umorph0 A B = (unary_morphism A B).
+
+notation "† c" with precedence 90 for @{'prop1 $c }.
+notation "l ‡ r" with precedence 90 for @{'prop2 $l $r }.
+notation "#" with precedence 90 for @{'refl}.
+interpretation "prop1" 'prop1 c = (prop1 ????? c).
+interpretation "refl" 'refl = (refl ???).
+notation "┼_0 c" with precedence 89 for @{'prop1_x0 $c }.
+notation "l ╪_0 r" with precedence 89 for @{'prop2_x0 $l $r }.
+interpretation "prop1_x0" 'prop1_x0 c = (prop1 ????? c).
+
+ndefinition unary_morph_setoid : setoid → setoid → setoid.
+#S1; #S2; @ (S1 ⇒_0 S2); @;
+##[ #f; #g; napply (∀x,x'. x=x' → f x = g x');
+##| #f; #x; #x'; #Hx; napply (.= †Hx); napply #;
+##| #f; #g; #H; #x; #x'; #Hx; napply ((H … Hx^-1)^-1);
+##| #f; #g; #h; #H1; #H2; #x; #x'; #Hx; napply (trans … (H1 …) (H2 …)); //; ##]