X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fcontribs%2Fng_assembly%2Fnum%2Foct_lemmas.ma;h=3a29cc1b75360949c51fced2ea550e09cf6d2472;hb=a6501e81dc2cae2025841cefd502c220e01cd5d8;hp=2aca1babcf6ef6f352bdb4ab943e141d37e4b8f9;hpb=b1c174cffd3c1d10383a52d63a6e662156fb0bb7;p=helm.git diff --git a/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma index 2aca1babc..3a29cc1b7 100755 --- a/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma +++ b/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma @@ -15,8 +15,8 @@ (* ********************************************************************** *) (* Progetto FreeScale *) (* *) -(* Sviluppato da: Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) (* *) (* ********************************************************************** *) @@ -27,97 +27,67 @@ include "num/bool_lemmas.ma". (* OTTALI *) (* ****** *) +(* ndefinition oct_destruct_aux ≝ Πn1,n2:oct.ΠP:Prop.n1 = n2 → - match n1 with - [ o0 ⇒ match n2 with [ o0 ⇒ P → P | _ ⇒ P ] - | o1 ⇒ match n2 with [ o1 ⇒ P → P | _ ⇒ P ] - | o2 ⇒ match n2 with [ o2 ⇒ P → P | _ ⇒ P ] - | o3 ⇒ match n2 with [ o3 ⇒ P → P | _ ⇒ P ] - | o4 ⇒ match n2 with [ o4 ⇒ P → P | _ ⇒ P ] - | o5 ⇒ match n2 with [ o5 ⇒ P → P | _ ⇒ P ] - | o6 ⇒ match n2 with [ o6 ⇒ P → P | _ ⇒ P ] - | o7 ⇒ match n2 with [ o7 ⇒ P → P | _ ⇒ P ] - ]. + match eq_oct n1 n2 with [ true ⇒ P → P | false ⇒ P ]. ndefinition oct_destruct : oct_destruct_aux. - #n1; #n2; #P; + #n1; #n2; #P; #H; + nrewrite < H; nelim n1; - ##[ ##1: nelim n2; nnormalize; #H; - ##[ ##1: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o0 with [ o0 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##2: nelim n2; nnormalize; #H; - ##[ ##2: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o1 with [ o1 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##3: nelim n2; nnormalize; #H; - ##[ ##3: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o2 with [ o2 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##4: nelim n2; nnormalize; #H; - ##[ ##4: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o3 with [ o3 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##5: nelim n2; nnormalize; #H; - ##[ ##5: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o4 with [ o4 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##6: nelim n2; nnormalize; #H; - ##[ ##6: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o5 with [ o5 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##7: nelim n2; nnormalize; #H; - ##[ ##7: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o6 with [ o6 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##8: nelim n2; nnormalize; #H; - ##[ ##8: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match o7 with [ o7 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##] + 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 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 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) + ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eq_to_eqoct : ∀n1,n2.n1 = n2 → eq_oct n1 n2 = true. +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 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 symmetric_eqoct : symmetricT oct bool eq_oct. #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq - ##| ##*: #H; napply (oct_destruct … H) + 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.