X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fcontribs%2Fng_assembly%2Fnum%2Fquatern_lemmas.ma;h=c2c8a33998be710b0b0d4379f06a0c9dc4b3bc11;hb=e607b42a9a469b02ef377210dc34ada14cc603c1;hp=00e559ed4b1b44b292fbcf0cb2cf777c51432278;hpb=29cfb9e2961e62c836cb50217905c0594a074e81;p=helm.git diff --git a/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma index 00e559ed4..c2c8a3399 100755 --- a/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma +++ b/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma @@ -29,97 +29,63 @@ include "num/bool_lemmas.ma". ndefinition quatern_destruct_aux ≝ Πn1,n2:quatern.ΠP:Prop.n1 = n2 → - match n1 with - [ q0 ⇒ match n2 with [ q0 ⇒ P → P | _ ⇒ P ] - | q1 ⇒ match n2 with [ q1 ⇒ P → P | _ ⇒ P ] - | q2 ⇒ match n2 with [ q2 ⇒ P → P | _ ⇒ P ] - | q3 ⇒ match n2 with [ q3 ⇒ P → P | _ ⇒ P ] - ]. + match eq_qu n1 n2 with [ true ⇒ P → P | false ⇒ P ]. ndefinition quatern_destruct : quatern_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 q0 with [ q0 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##2: nelim n2; nnormalize; #H; - ##[ ##2: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match q1 with [ q1 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##3: nelim n2; nnormalize; #H; - ##[ ##3: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match q2 with [ q2 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##| ##4: nelim n2; nnormalize; #H; - ##[ ##4: napply (λx:P.x) - ##| ##*: napply False_ind; - nchange with (match q3 with [ q3 ⇒ False | _ ⇒ True ]); - nrewrite > H; nnormalize; napply I - ##] - ##] + nnormalize; + napply (λx.x). nqed. -nlemma symmetric_eqqu : symmetricT quatern bool eq_qu. - #n1; #n2; - nelim n1; +nlemma eq_to_eqqu : ∀n1,n2.n1 = n2 → eq_qu n1 n2 = true. + #n1; #n2; #H; + nrewrite > H; nelim n2; nnormalize; napply refl_eq. nqed. -nlemma eqqu_to_eq : ∀n1,n2.eq_qu n1 n2 = true → n1 = n2. - #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,6,11,16: #H; napply refl_eq - ##| ##*: #H; napply (bool_destruct … H) +nlemma neqqu_to_neq : ∀n1,n2.eq_qu n1 n2 = false → n1 ≠ n2. + #n1; #n2; #H; + napply (not_to_not (n1 = n2) (eq_qu n1 n2 = true) …); + ##[ ##1: napply (eq_to_eqqu n1 n2) + ##| ##2: napply (eqfalse_to_neqtrue … H) ##] nqed. -nlemma eq_to_eqqu : ∀n1,n2.n1 = n2 → eq_qu n1 n2 = true. +nlemma eqqu_to_eq : ∀n1,n2.eq_qu n1 n2 = true → n1 = n2. #n1; #n2; ncases n1; ncases n2; nnormalize; ##[ ##1,6,11,16: #H; napply refl_eq - ##| ##*: #H; napply (quatern_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) ##] nqed. -nlemma decidable_qu : ∀x,y:quatern.decidable (x = y). - #x; #y; - nnormalize; - nelim x; - nelim y; - ##[ ##1,6,11,16: napply (or2_intro1 (? = ?) (? ≠ ?) …); napply refl_eq - ##| ##*: napply (or2_intro2 (? = ?) (? ≠ ?) …); nnormalize; #H; napply False_ind; napply (quatern_destruct … H) - ##] +nlemma neq_to_neqqu : ∀n1,n2.n1 ≠ n2 → eq_qu n1 n2 = false. + #n1; #n2; #H; + napply (neqtrue_to_eqfalse (eq_qu n1 n2)); + napply (not_to_not (eq_qu n1 n2 = true) (n1 = n2) ? H); + napply (eqqu_to_eq n1 n2). nqed. -nlemma neqqu_to_neq : ∀n1,n2.eq_qu n1 n2 = false → n1 ≠ n2. - #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,6,11,16: #H; napply (bool_destruct … H) - ##| ##*: #H; #H1; napply (quatern_destruct … H1) +nlemma decidable_qu : ∀x,y:quatern.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_qu x y = true) (eq_qu x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqqu_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqqu_to_neq … H)) ##] nqed. -nlemma neq_to_neqqu : ∀n1,n2.n1 ≠ n2 → eq_qu n1 n2 = false. +nlemma symmetric_eqqu : symmetricT quatern bool eq_qu. #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,6,11,16: #H; nelim (H (refl_eq …)) - ##| ##*: #H; napply refl_eq + napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_qu n1 n2)); + ##[ ##1: #H; nrewrite > H; napply refl_eq + ##| ##2: #H; nrewrite > (neq_to_neqqu n1 n2 H); + napply (symmetric_eq ? (eq_qu n2 n1) false); + napply (neq_to_neqqu n2 n1 (symmetric_neq ? n1 n2 H)) ##] nqed.