include "logic/connectives.ma".
include "properties/relations.ma".
-nrecord setoid : Type[1] ≝
- { carr:> Type;
- eq: carr → carr → CProp;
- refl: reflexive … eq;
- sym: symmetric … eq;
- trans: transitive … eq
- }.
+(*
+notation "hvbox(a break = \sub \ID b)" non associative with precedence 45
+for @{ 'eqID $a $b }.
+
+notation > "hvbox(a break =_\ID b)" non associative with precedence 45
+for @{ cic:/matita/logic/equality/eq.ind#xpointer(1/1) ? $a $b }.
-ndefinition proofs: CProp → setoid.
-#P; napply (mk_setoid …);
-##[ napply P;
-##| #x; #y; napply True;
-##|##*: nwhd; nrepeat (#_); napply I;
-##]
-nqed.
+interpretation "ID eq" 'eqID x y = (cic:/matita/logic/equality/eq.ind#xpointer(1/1) ? x y).
+*)
-nrecord function_space (A,B: setoid): Type ≝
- { f:1> A → B;
- f_ok: ∀a,a':A. proofs (eq … a a') → proofs (eq … (f a) (f a'))
+nrecord setoid : Type[1] ≝
+ { carr:> Type[0];
+ eq: equivalence_relation carr
}.
-notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
+interpretation "setoid eq" 'eq t x y = (eq_rel ? (eq t) x y).
+
+notation > "hvbox(a break =_0 b)" non associative with precedence 45
+for @{ eq_rel ? (eq ?) $a $b }.
-ndefinition function_space_setoid: setoid → setoid → setoid.
- #A; #B; napply (mk_setoid …);
-##[ napply (function_space A B);
-##| #f; #f1; napply (∀a:A. proofs (eq … (f a) (f1 a)));
-##| nwhd; #x; #a;
- napply (f_ok … x …); (* QUI!! *)
-(* unfold carr; unfold proofs; simplify;
- apply (refl A)
- | simplify;
- intros;
- unfold carr; unfold proofs; simplify;
- apply (sym B);
- apply (f a)
- | simplify;
- intros;
- unfold carr; unfold proofs; simplify;
- apply (trans B ? (y a));
- [ apply (f a)
- | apply (f1 a)]]
-qed.
+interpretation "setoid symmetry" 'invert r = (sym ???? r).
+notation ".= r" with precedence 50 for @{'trans $r}.
+interpretation "trans" 'trans r = (trans ????? r).
-nrecord isomorphism (A,B: setoid): Type ≝
- { map1:> function_space_setoid A B;
- map2:> function_space_setoid B A;
- inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
- inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
+nrecord unary_morphism (A,B: setoid) : Type[0] ≝
+ { fun1:1> A → B;
+ prop1: ∀a,a'. eq ? a a' → eq ? (fun1 a) (fun1 a')
}.
-interpretation "isomorphism" 'iff x y = (isomorphism x y).
+nrecord binary_morphism (A,B,C:setoid) : Type[0] ≝
+ { fun2:2> A → B → C;
+ prop2: ∀a,a',b,b'. eq ? a a' → eq ? b b' → eq ? (fun2 a b) (fun2 a' b')
+ }.
-(*
-record dependent_product (A:setoid) (B: A ⇒ setoids): Type ≝
- { dp:> ∀a:A.carr (B a);
- dp_ok: ∀a,a':A. ∀p:proofs1 (eq1 ? a a'). proofs1 (eq1 ? (dp a) (map2 ?? (f1_ok ?? B ?? p) (dp a')))
- }.*)
-
- *)
\ No newline at end of file
+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 "prop2" 'prop2 l r = (prop2 ???????? l r).
+interpretation "refl" 'refl = (refl ???).