]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/ng_assembly/freescale/option_lemmas.ma
freescale porting to ng, work in progress
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale / option_lemmas.ma
index 071d884f475accee1a91af1536f9eecc416c185f..4f362a873737f6a56c8fcd5acd97d9b8ee189002 100644 (file)
@@ -31,7 +31,7 @@ include "freescale/option.ma".
 (* OPTION *)
 (* ****** *)
 
-nlemma option_destruct : ∀T.∀x1,x2:T.Some T x1 = Some T x2 → x1 = x2.
+nlemma option_destruct_some_some : ∀T.∀x1,x2:T.Some T x1 = Some T x2 → x1 = x2.
  #T; #x1; #x2; #H;
  nchange with (match Some T x2 with [ None ⇒ False | Some a ⇒ x1 = a ]);
  nrewrite < H;
@@ -55,49 +55,51 @@ nlemma option_destruct_none_some : ∀T.∀x:T.None T = Some T x → False.
  napply I.
 nqed.
 
-nlemma bsymmetric_eqoption :
-∀T:Type.∀o1,o2:option T.∀f:T → T → bool.
- (boolSymmetric T f) →
- (eq_option T o1 o2 f = eq_option T o2 o1 f).
- #T; #o1; #o2; #f; #H;
- ncases o1;
- ncases o2;
+nlemma symmetric_eqoption :
+∀T:Type.∀op1,op2:option T.∀f:T → T → bool.
+ (symmetricT T bool f) →
+ (eq_option T op1 op2 f = eq_option T op2 op1 f).
+ #T; #op1; #op2; #f; #H;
+ napply (option_ind T ??? op1);
+ napply (option_ind T ??? op2);
  nnormalize;
  ##[ ##1: napply (refl_eq ??)
- ##| ##2,3: #x; napply (refl_eq ??)
- ##| ##4: #x1; #x2; nrewrite > (H x1 x2); napply (refl_eq ??)
+ ##| ##2,3: #H; napply (refl_eq ??)
+ ##| ##4: #a; #a0;
+          nrewrite > (H a0 a);
+          napply (refl_eq ??)
  ##]
 nqed.
 
 nlemma eq_to_eqoption :
-∀T.∀o1,o2:option T.∀f:T → T → bool.
+∀T.∀op1,op2:option T.∀f:T → T → bool.
  (∀x1,x2:T.x1 = x2 → f x1 x2 = true) →
- (o1 = o2 → eq_option T o1 o2 f = true).
- #T; #o1; #o2; #f; #H;
- ncases o1;
- ncases o2;
- ##[ ##1: nnormalize; #H1; napply (refl_eq ??)
- ##| ##2: #H1; #H2; nelim (option_destruct_none_some ?? H2)
- ##| ##3: #H1; #H2; nelim (option_destruct_some_none ?? H2)
- ##| ##4: #x1; #x2; #H1;
         nrewrite > (option_destruct ??? H1);
-          nnormalize;
-          nrewrite > (H x1 x1 (refl_eq ??));
+ (op1 = op2 → eq_option T op1 op2 f = true).
+ #T; #op1; #op2; #f; #H;
+ napply (option_ind T ??? op1);
+ napply (option_ind T ??? op2);
+ nnormalize;
+ ##[ ##1: #H1; napply (refl_eq ??)
+ ##| ##2: #a; #H1; nelim (option_destruct_none_some ?? H1)
+ ##| ##3: #a; #H1; nelim (option_destruct_some_none ?? H1)
##| ##4: #a; #a0; #H1;
+          nrewrite > (option_destruct_some_some ??? H1);
+          nrewrite > (H a a (refl_eq ??));
           napply (refl_eq ??)
  ##]
 nqed.
 
 nlemma eqoption_to_eq :
-∀T.∀o1,o2:option T.∀f:T → T → bool.
+∀T.∀op1,op2:option T.∀f:T → T → bool.
  (∀x1,x2:T.f x1 x2 = true → x1 = x2) →
- (eq_option T o1 o2 f = true → o1 = o2).
- #T; #o1; #o2; #f; #H;
- ncases o1;
- ncases o2;
- ##[ ##1: nnormalize; #H1; napply (refl_eq ??)
- ##| ##2,3: #H1; #H2; nnormalize in H2:(%); nelim (bool_destruct_false_true H2)
- ##| ##4: #x1; #x2; #H1;
         nnormalize in H1:(%);
+ (eq_option T op1 op2 f = true → op1 = op2).
+ #T; #op1; #op2; #f; #H;
+ napply (option_ind T ??? op1);
+ napply (option_ind T ??? op2);
+ nnormalize;
+ ##[ ##1: #H1; napply (refl_eq ??)
+ ##| ##2,3: #a; #H1; napply (bool_destruct ??? H1)
##| ##4: #a; #a0; #H1;
           nrewrite > (H ?? H1);
           napply (refl_eq ??)
  ##]