X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fnlibrary%2Fsets%2Fsetoids1.ma;h=4ab57d568860ad1c4b505323f909eda3cbd39573;hb=27c34e93fc35402111253325b93089a6308dd4bb;hp=49d259d5dd46ddb0d7efff2f0bf532794d8589df;hpb=34311f3f810eb893b865d1893eae1cf62cd490b4;p=helm.git diff --git a/helm/software/matita/nlibrary/sets/setoids1.ma b/helm/software/matita/nlibrary/sets/setoids1.ma index 49d259d5d..4ab57d568 100644 --- a/helm/software/matita/nlibrary/sets/setoids1.ma +++ b/helm/software/matita/nlibrary/sets/setoids1.ma @@ -16,67 +16,78 @@ include "properties/relations1.ma". include "sets/setoids.ma". include "hints_declaration.ma". -nrecord setoid1: Type[2] ≝ - { carr1:> Type[1]; - eq1: equivalence_relation1 carr1 - }. +nrecord setoid1: Type[2] ≝ { + carr1:> Type[1]; + eq1: equivalence_relation1 carr1 +}. + +unification hint 0 ≔ R : setoid1; + MR ≟ (carr1 R), + lock ≟ mk_lock2 Type[1] MR setoid1 R +(* ---------------------------------------- *) ⊢ + setoid1 ≡ force2 ? MR lock. ndefinition setoid1_of_setoid: setoid → setoid1. - #s; napply mk_setoid1 - [ napply (carr s) - | napply (mk_equivalence_relation1 s) - [ napply eq - | napply refl - | napply sym - | napply trans]##] + #s; @ (carr s); @ (eq0…) (refl…) (sym…) (trans…); nqed. -(*ncoercion setoid1_of_setoid : ∀s:setoid. setoid1 ≝ setoid1_of_setoid - on _s: setoid to setoid1.*) -(*prefer coercion Type_OF_setoid.*) - interpretation "setoid1 eq" 'eq t x y = (eq_rel1 ? (eq1 t) x y). -interpretation "setoid eq" 'eq t x y = (eq_rel ? (eq t) x y). +interpretation "setoid eq" 'eq t x y = (eq_rel ? (eq0 t) x y). notation > "hvbox(a break =_12 b)" non associative with precedence 45 for @{ eq_rel2 (carr2 (setoid2_of_setoid1 ?)) (eq2 (setoid2_of_setoid1 ?)) $a $b }. notation > "hvbox(a break =_0 b)" non associative with precedence 45 -for @{ eq_rel ? (eq ?) $a $b }. +for @{ eq_rel ? (eq0 ?) $a $b }. notation > "hvbox(a break =_1 b)" non associative with precedence 45 for @{ eq_rel1 ? (eq1 ?) $a $b }. interpretation "setoid1 symmetry" 'invert r = (sym1 ???? r). interpretation "setoid symmetry" 'invert r = (sym ???? r). -notation ".= r" with precedence 50 for @{'trans $r}. +notation ".=_1 r" with precedence 50 for @{'trans_x1 $r}. interpretation "trans1" 'trans r = (trans1 ????? r). interpretation "trans" 'trans r = (trans ????? r). +interpretation "trans1_x1" 'trans_x1 r = (trans1 ????? r). -nrecord unary_morphism1 (A,B: setoid1) : Type[1] ≝ - { fun11:1> A → B; - prop11: ∀a,a'. eq1 ? a a' → eq1 ? (fun11 a) (fun11 a') - }. - -nrecord binary_morphism1 (A,B,C:setoid1) : Type[1] ≝ - { fun21:2> A → B → C; - prop21: ∀a,a',b,b'. eq1 ? a a' → eq1 ? b b' → eq1 ? (fun21 a b) (fun21 a' b') - }. - +nrecord unary_morphism1 (A,B: setoid1) : Type[1] ≝ { + fun11:1> A → B; + prop11: ∀a,a'. eq1 ? a a' → eq1 ? (fun11 a) (fun11 a') +}. + +notation > "B ⇒_1 C" right associative with precedence 72 for @{'umorph1 $B $C}. +notation "hvbox(B break ⇒\sub 1 C)" right associative with precedence 72 for @{'umorph1 $B $C}. +interpretation "unary morphism 1" 'umorph1 A B = (unary_morphism1 A B). + +notation "┼_1 c" with precedence 89 for @{'prop1_x1 $c }. interpretation "prop11" 'prop1 c = (prop11 ????? c). -interpretation "prop21" 'prop2 l r = (prop21 ???????? l r). +interpretation "prop11_x1" 'prop1_x1 c = (prop11 ????? c). interpretation "refl1" 'refl = (refl1 ???). ndefinition unary_morphism1_setoid1: setoid1 → setoid1 → setoid1. - #s; #s1; @ (unary_morphism1 s s1); @ - [ #f; #g; napply (∀a:s. f a = g a) - | #x; #a; napply refl1 - | #x; #y; #H; #a; napply sym1; // - | #x; #y; #z; #H1; #H2; #a; napply trans1; ##[##2: napply H1 | ##skip | napply H2]##] + #s; #s1; @ (s ⇒_1 s1); @ + [ #f; #g; napply (∀a,a':s. a=a' → f a = g a') + | #x; #a; #a'; #Ha; napply (.= †Ha); napply refl1 + | #x; #y; #H; #a; #a'; #Ha; napply (.= †Ha); napply sym1; /2/ + | #x; #y; #z; #H1; #H2; #a; #a'; #Ha; napply (.= †Ha); napply trans1; ##[##2: napply H1 | ##skip | napply H2]//;##] nqed. unification hint 0 ≔ S, T ; - R ≟ (unary_morphism1_setoid1 S T) + R ≟ (unary_morphism1_setoid1 S T) (* --------------------------------- *) ⊢ - carr1 R ≡ unary_morphism1 S T. + carr1 R ≡ S ⇒_1 T. + +notation "l ╪_1 r" with precedence 89 for @{'prop2_x1 $l $r }. +interpretation "prop21" 'prop2 l r = (prop11 ? (unary_morphism1_setoid1 ??) ? ?? l ?? r). +interpretation "prop21_x1" 'prop2_x1 l r = (prop11 ? (unary_morphism1_setoid1 ??) ? ?? l ?? r). + +nlemma unary_morph1_eq1: ∀A,B.∀f,g: A ⇒_1 B. (∀x. f x = g x) → f = g. +/3/. nqed. + +nlemma mk_binary_morphism1: + ∀A,B,C: setoid1. ∀f: A → B → C. (∀a,a',b,b'. a=a' → b=b' → f a b = f a' b') → + A ⇒_1 (unary_morphism1_setoid1 B C). + #A; #B; #C; #f; #H; @ [ #x; @ (f x) ] #a; #a'; #Ha [##2: napply unary_morph1_eq1; #y] + /2/. +nqed. ndefinition composition1 ≝ λo1,o2,o3:Type[1].λf:o2 → o3.λg: o1 → o2.λx.f (g x). @@ -84,26 +95,21 @@ ndefinition composition1 ≝ interpretation "function composition" 'compose f g = (composition ??? f g). interpretation "function composition1" 'compose f g = (composition1 ??? f g). -ndefinition comp1_unary_morphisms: - ∀o1,o2,o3:setoid1. - unary_morphism1 o2 o3 → unary_morphism1 o1 o2 → - unary_morphism1 o1 o3. +ndefinition comp1_unary_morphisms: + ∀o1,o2,o3:setoid1.o2 ⇒_1 o3 → o1 ⇒_1 o2 → o1 ⇒_1 o3. #o1; #o2; #o3; #f; #g; @ (f ∘ g); #a; #a'; #e; nnormalize; napply (.= †(†e)); napply #. nqed. -unification hint 0 ≔ o1,o2,o3:setoid1,f:unary_morphism1 o2 o3,g:unary_morphism1 o1 o2; +unification hint 0 ≔ o1,o2,o3:setoid1,f:o2 ⇒_1 o3,g:o1 ⇒_1 o2; R ≟ (mk_unary_morphism1 ?? (composition1 … f g) (prop11 ?? (comp1_unary_morphisms o1 o2 o3 f g))) (* -------------------------------------------------------------------- *) ⊢ fun11 ?? R ≡ (composition1 … f g). -ndefinition comp_binary_morphisms: - ∀o1,o2,o3. - binary_morphism1 (unary_morphism1_setoid1 o2 o3) (unary_morphism1_setoid1 o1 o2) - (unary_morphism1_setoid1 o1 o3). -#o1; #o2; #o3; @ - [ #f; #g; napply (comp1_unary_morphisms … f g) (*CSC: why not ∘?*) - | #a; #a'; #b; #b'; #ea; #eb; #x; nnormalize; - napply (.= †(eb x)); napply ea. +ndefinition comp1_binary_morphisms: + ∀o1,o2,o3. (o2 ⇒_1 o3) ⇒_1 ((o1 ⇒_1 o2) ⇒_1 (o1 ⇒_1 o3)). +#o1; #o2; #o3; napply mk_binary_morphism1 + [ #f; #g; napply (comp1_unary_morphisms … f g) + | #a; #a'; #b; #b'; #ea; #eb; #x; #x'; #Hx; nnormalize; /3/ ] nqed.