]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/nlibrary/sets/setoids1.ma
minus
[helm.git] / helm / software / matita / nlibrary / sets / setoids1.ma
index bae7f549ecc5ca3fdf800b59788aa5b3eaf48399..49d259d5dd46ddb0d7efff2f0bf532794d8589df 100644 (file)
@@ -14,6 +14,7 @@
 
 include "properties/relations1.ma".
 include "sets/setoids.ma".
+include "hints_declaration.ma".
 
 nrecord setoid1: Type[2] ≝
  { carr1:> Type[1];
@@ -30,8 +31,8 @@ ndefinition setoid1_of_setoid: setoid → setoid1.
     | napply trans]##]
 nqed.
 
-ncoercion setoid1_of_setoid : ∀s:setoid. setoid1 ≝ setoid1_of_setoid
- on _s: setoid to setoid1.
+(*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).
@@ -63,3 +64,46 @@ nrecord binary_morphism1 (A,B,C:setoid1) : Type[1] ≝
 interpretation "prop11" 'prop1 c = (prop11 ????? c).
 interpretation "prop21" 'prop2 l r = (prop21 ???????? l r).
 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]##]
+nqed.
+
+unification hint 0 ≔ S, T ;
+ R ≟ (unary_morphism1_setoid1 S T)
+(* --------------------------------- *) ⊢
+   carr1 R ≡ unary_morphism1 S T.
+
+ndefinition composition1 ≝
+ λo1,o2,o3:Type[1].λf:o2 → o3.λg: o1 → o2.λx.f (g x).
+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.
+#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;
+   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.
+nqed.