]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma
freescale porting, work in progress
[helm.git] / helm / software / matita / contribs / ng_assembly / num / oct_lemmas.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                          Progetto FreeScale                            *)
17 (*                                                                        *)
18 (*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
19 (*   Ultima modifica: 05/08/2009                                          *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "num/oct.ma".
24 include "num/bool_lemmas.ma".
25
26 (* ****** *)
27 (* OTTALI *)
28 (* ****** *)
29
30 ndefinition oct_destruct_aux ≝
31 Πn1,n2:oct.ΠP:Prop.n1 = n2 →
32  match eq_oct n1 n2 with [ true ⇒ P → P | false ⇒ P ].
33
34 ndefinition oct_destruct : oct_destruct_aux.
35  #n1; #n2; #P; #H;
36  nrewrite < H;
37  nelim n1;
38  nnormalize;
39  napply (λx.x).
40 nqed.
41
42 nlemma symmetric_eqoct : symmetricT oct bool eq_oct.
43  #n1; #n2;
44  nelim n1;
45  nelim n2;
46  nnormalize;
47  napply refl_eq.
48 nqed.
49
50 nlemma eqoct_to_eq : ∀n1,n2.eq_oct n1 n2 = true → n1 = n2.
51  #n1; #n2;
52  ncases n1;
53  ncases n2;
54  nnormalize;
55  ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq
56  ##| ##*: #H; napply (bool_destruct … H)
57  ##]
58 nqed.
59
60 nlemma eq_to_eqoct : ∀n1,n2.n1 = n2 → eq_oct n1 n2 = true.
61  #n1; #n2;
62  ncases n1;
63  ncases n2;
64  nnormalize;
65  ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq
66  ##| ##*: #H; napply (oct_destruct … H)
67  ##]
68 nqed.
69
70 nlemma decidable_oct : ∀x,y:oct.decidable (x = y).
71  #x; #y;
72  nnormalize;
73  nelim x;
74  nelim y;
75  ##[ ##1,10,19,28,37,46,55,64: napply (or2_intro1 (? = ?) (? ≠ ?) …); napply refl_eq
76  ##| ##*: napply (or2_intro2 (? = ?) (? ≠ ?) …);
77           nnormalize; #H;
78           napply False_ind;
79           napply (oct_destruct … H)
80  ##]
81 nqed.
82
83 nlemma neqoct_to_neq : ∀n1,n2.eq_oct n1 n2 = false → n1 ≠ n2.
84  #n1; #n2;
85  ncases n1;
86  ncases n2;
87  nnormalize;
88  ##[ ##1,10,19,28,37,46,55,64: #H; napply (bool_destruct … H)
89  ##| ##*: #H; #H1; napply (oct_destruct … H1)
90  ##]
91 nqed.
92
93 nlemma neq_to_neqoct : ∀n1,n2.n1 ≠ n2 → eq_oct n1 n2 = false.
94  #n1; #n2;
95  ncases n1;
96  ncases n2;
97  nnormalize;
98  ##[ ##1,10,19,28,37,46,55,64: #H; nelim (H (refl_eq …))
99  ##| ##*: #H; napply refl_eq
100  ##]
101 nqed.