]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas1.ma
1) \ldots here and there
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale / opcode_base_lemmas1.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: Cosimo Oliboni, oliboni@cs.unibo.it                   *)
19 (*     Cosimo Oliboni, oliboni@cs.unibo.it                                *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "freescale/opcode_base_lemmas_opcode2.ma".
24 include "freescale/opcode_base_lemmas_instrmode2.ma".
25 include "freescale/word16_lemmas.ma".
26
27 (* ********************************************** *)
28 (* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
29 (* ********************************************** *)
30
31 nlemma anyop_destruct : ∀m.∀x1,x2:opcode.anyOP m x1 = anyOP m x2 → x1 = x2.
32  #m; #x1; #x2; #H;
33  nchange with (match anyOP m x2 with [ anyOP a ⇒ x1 = a ]);
34  nrewrite < H;
35  nnormalize;
36  napply refl_eq.
37 nqed.
38
39 nlemma symmetric_eqanyop : ∀m.∀op1,op2:any_opcode m.eq_anyop m op1 op2 = eq_anyop m op2 op1.
40  #m;
41  ncases m;
42  #op1; #op2;
43  ncases op1;
44  #x1;
45  ncases op2;
46  #x2;
47  nchange with (eq_op x1 x2 = eq_op x2 x1);
48  nrewrite > (symmetric_eqop x1 x2);
49  napply refl_eq.
50 nqed.
51
52 nlemma eqanyop_to_eq : ∀m.∀op1,op2:any_opcode m.eq_anyop m op1 op2 = true → op1 = op2.
53  #m;
54  ncases m;
55  #op1; #op2;
56  ncases op1;
57  #x1;
58  ncases op2;
59  #x2;
60  nchange with ((eq_op x1 x2 = true) → ?);
61  #H;
62  nrewrite > (eqop_to_eq … H);
63  napply refl_eq.
64 nqed.
65
66 nlemma eq_to_eqanyop : ∀m.∀op1,op2:any_opcode m.op1 = op2 → eq_anyop m op1 op2 = true.
67  #m;
68  ncases m;
69  #op1; #op2;
70  ncases op1;
71  #p1;
72  ncases op2;
73  #p2; #H;
74  nrewrite > (anyop_destruct … H);
75  nchange with (eq_op p2 p2 = true);
76  nrewrite > (eq_to_eqop p2 p2 (refl_eq opcode p2));
77  napply refl_eq.
78 nqed.
79
80 nlemma b8w16_destruct_b8_b8 : ∀x1,x2.Byte x1 = Byte x2 → x1 = x2.
81  #x1; #x2; #H;
82  nchange with (match Byte x2 with [ Byte a ⇒ x1 = a | Word _ ⇒ False ]);
83  nrewrite < H;
84  nnormalize;
85  napply refl_eq.
86 nqed.
87
88 nlemma b8w16_destruct_w16_w16 : ∀x1,x2.Word x1 = Word x2 → x1 = x2.
89  #x1; #x2; #H;
90  nchange with (match Word x2 with [ Word a ⇒ x1 = a | Byte _ ⇒ False ]);
91  nrewrite < H;
92  nnormalize;
93  napply refl_eq.
94 nqed.
95
96 nlemma b8w16_destruct_b8_w16 : ∀x1,x2.Byte x1 = Word x2 → False.
97  #x1; #x2; #H;
98  nchange with (match Byte x1 with [ Word _ ⇒ True | Byte a ⇒ False ]);
99  nrewrite > H;
100  nnormalize;
101  napply I.
102 nqed.
103
104 nlemma b8w16_destruct_w16_b8 : ∀x1,x2.Word x1 = Byte x2 → False.
105  #x1; #x2; #H;
106  nchange with (match Word x1 with [ Word a ⇒ False | Byte _ ⇒ True ]);
107  nrewrite > H;
108  nnormalize;
109  napply I.
110 nqed.
111
112 nlemma symmetric_eqb8w16 : ∀bw1,bw2.eq_b8w16 bw1 bw2 = eq_b8w16 bw2 bw1.
113  #bw1; #bw2;
114  ncases bw1;
115  #x1;
116  ncases bw2;
117  #x2;
118  ##[ ##1: nchange with (eq_b8 x1 x2 = eq_b8 x2 x1);
119           nrewrite > (symmetric_eqb8 x1 x2);
120           napply refl_eq
121  ##| ##2,3: nnormalize; napply refl_eq
122  ##| ##4: nchange with (eq_w16 x1 x2 = eq_w16 x2 x1);
123           nrewrite > (symmetric_eqw16 x1 x2);
124           napply refl_eq
125  ##]
126 nqed.