]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/ng_assembly/num/bitrigesim_lemmas.ma
9aa485cc5f1c846d16c8e32547d9d5b90a97a1c8
[helm.git] / matita / matita / contribs / ng_assembly / num / bitrigesim_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 (*   Sviluppo: 2008-2010                                                  *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "num/bitrigesim.ma".
24 include "num/bool_lemmas.ma".
25
26 (* ************* *)
27 (* BITRIGESIMALI *)
28 (* ************* *)
29
30 (*
31 ndefinition bitrigesim_destruct_aux ≝
32 Πt1,t2:bitrigesim.ΠP:Prop.t1 = t2 →
33  match eq_bit t1 t2 with [ true ⇒ P → P | false ⇒ P ].
34
35 ndefinition bitrigesim_destruct : bitrigesim_destruct_aux.
36  #t1; #t2; #P; #H;
37  nrewrite < H;
38  nelim t1;
39  nnormalize;
40  napply (λx.x).
41 nqed.
42 *)
43
44 nlemma eq_to_eqbit : ∀n1,n2.n1 = n2 → eq_bit n1 n2 = true.
45  #n1; #n2; #H;
46  nrewrite > H;
47  nelim n2;
48  nnormalize;
49  napply refl_eq.
50 nqed.
51
52 nlemma neqbit_to_neq : ∀n1,n2.eq_bit n1 n2 = false → n1 ≠ n2.
53  #n1; #n2; #H;
54  napply (not_to_not (n1 = n2) (eq_bit n1 n2 = true) …);
55  ##[ ##1: napply (eq_to_eqbit n1 n2)
56  ##| ##2: napply (eqfalse_to_neqtrue … H)
57  ##]
58 nqed.
59
60 (* !!! per brevita... *)
61 naxiom eqbit_to_eq : ∀t1,t2.eq_bit t1 t2 = true → t1 = t2.
62
63 nlemma neq_to_neqbit : ∀n1,n2.n1 ≠ n2 → eq_bit n1 n2 = false.
64  #n1; #n2; #H;
65  napply (neqtrue_to_eqfalse (eq_bit n1 n2));
66  napply (not_to_not (eq_bit n1 n2 = true) (n1 = n2) ? H);
67  napply (eqbit_to_eq n1 n2).
68 nqed.
69
70 nlemma decidable_bit : ∀x,y:bitrigesim.decidable (x = y).
71  #x; #y; nnormalize;
72  napply (or2_elim (eq_bit x y = true) (eq_bit x y = false) ? (decidable_bexpr ?));
73  ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqbit_to_eq … H))
74  ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqbit_to_neq … H))
75  ##]
76 nqed.
77
78 nlemma symmetric_eqbit : symmetricT bitrigesim bool eq_bit.
79  #n1; #n2;
80  napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_bit n1 n2));
81  ##[ ##1: #H; nrewrite > H; napply refl_eq
82  ##| ##2: #H; nrewrite > (neq_to_neqbit n1 n2 H);
83           napply (symmetric_eq ? (eq_bit n2 n1) false);
84           napply (neq_to_neqbit n2 n1 (symmetric_neq ? n1 n2 H))
85  ##]
86 nqed.