]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma
mod change (-x)
[helm.git] / helm / software / matita / contribs / ng_assembly / num / oct_lemmas.ma
old mode 100755 (executable)
new mode 100644 (file)
index 7cb8209..3a29cc1
@@ -16,7 +16,7 @@
 (*                          Progetto FreeScale                            *)
 (*                                                                        *)
 (*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
-(*   Ultima modifica: 05/08/2009                                          *)
+(*   Sviluppo: 2008-2010                                                  *)
 (*                                                                        *)
 (* ********************************************************************** *)
 
@@ -27,6 +27,7 @@ include "num/bool_lemmas.ma".
 (* OTTALI *)
 (* ****** *)
 
+(*
 ndefinition oct_destruct_aux ≝
 Πn1,n2:oct.ΠP:Prop.n1 = n2 →
  match eq_oct n1 n2 with [ true ⇒ P → P | false ⇒ P ].
@@ -38,64 +39,55 @@ ndefinition oct_destruct : oct_destruct_aux.
  nnormalize;
  napply (λx.x).
 nqed.
+*)
 
-nlemma symmetric_eqoct : symmetricT oct bool eq_oct.
- #n1; #n2;
- nelim n1;
+nlemma eq_to_eqoct : ∀n1,n2.n1 = n2 → eq_oct n1 n2 = true.
+ #n1; #n2; #H;
+ nrewrite > H;
  nelim n2;
  nnormalize;
  napply refl_eq.
 nqed.
 
-nlemma eqoct_to_eq : ∀n1,n2.eq_oct n1 n2 = true → n1 = n2.
- #n1; #n2;
- ncases n1;
- ncases n2;
- nnormalize;
- ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq
- ##| ##*: #H; napply (bool_destruct … H)
+nlemma neqoct_to_neq : ∀n1,n2.eq_oct n1 n2 = false → n1 ≠ n2.
+ #n1; #n2; #H;
+ napply (not_to_not (n1 = n2) (eq_oct n1 n2 = true) …);
+ ##[ ##1: napply (eq_to_eqoct n1 n2)
+ ##| ##2: napply (eqfalse_to_neqtrue … H)
  ##]
 nqed.
 
-nlemma eq_to_eqoct : ∀n1,n2.n1 = n2 → eq_oct n1 n2 = true.
+nlemma eqoct_to_eq : ∀n1,n2.eq_oct n1 n2 = true → n1 = n2.
  #n1; #n2;
  ncases n1;
  ncases n2;
  nnormalize;
  ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq
- ##| ##*: #H; napply (oct_destruct … H)
+ ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*)
  ##]
 nqed.
 
-nlemma decidable_oct : ∀x,y:oct.decidable (x = y).
- #x; #y;
- nnormalize;
- nelim x;
- nelim y;
- ##[ ##1,10,19,28,37,46,55,64: napply (or2_intro1 (? = ?) (? ≠ ?) …); napply refl_eq
- ##| ##*: napply (or2_intro2 (? = ?) (? ≠ ?) …);
-          nnormalize; #H;
-          napply False_ind;
-          napply (oct_destruct … H)
- ##]
+nlemma neq_to_neqoct : ∀n1,n2.n1 ≠ n2 → eq_oct n1 n2 = false.
+ #n1; #n2; #H;
+ napply (neqtrue_to_eqfalse (eq_oct n1 n2));
+ napply (not_to_not (eq_oct n1 n2 = true) (n1 = n2) ? H);
+ napply (eqoct_to_eq n1 n2).
 nqed.
 
-nlemma neqoct_to_neq : ∀n1,n2.eq_oct n1 n2 = false → n1 ≠ n2.
- #n1; #n2;
- ncases n1;
- ncases n2;
- nnormalize;
- ##[ ##1,10,19,28,37,46,55,64: #H; napply (bool_destruct … H)
- ##| ##*: #H; #H1; napply (oct_destruct … H1)
+nlemma decidable_oct : ∀x,y:oct.decidable (x = y).
+ #x; #y; nnormalize;
+ napply (or2_elim (eq_oct x y = true) (eq_oct x y = false) ? (decidable_bexpr ?));
+ ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqoct_to_eq … H))
+ ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqoct_to_neq … H))
  ##]
 nqed.
 
-nlemma neq_to_neqoct : ∀n1,n2.n1 ≠ n2 → eq_oct n1 n2 = false.
+nlemma symmetric_eqoct : symmetricT oct bool eq_oct.
  #n1; #n2;
- ncases n1;
- ncases n2;
nnormalize;
- ##[ ##1,10,19,28,37,46,55,64: #H; nelim (H (refl_eq …))
- ##| ##*: #H; napply refl_eq
+ napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_oct n1 n2));
+ ##[ ##1: #H; nrewrite > H; napply refl_eq
##| ##2: #H; nrewrite > (neq_to_neqoct n1 n2 H);
+          napply (symmetric_eq ? (eq_oct n2 n1) false);
+          napply (neq_to_neqoct n2 n1 (symmetric_neq ? n1 n2 H))
  ##]
 nqed.