]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/emulator/opcodes/HC08_instr_mode_lemmas.ma
freescale porting
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / opcodes / HC08_instr_mode_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/bool_lemmas.ma".
24 include "emulator/opcodes/HC08_instr_mode.ma".
25 include "num/oct_lemmas.ma".
26
27 nlemma eq_to_eqHC08im : ∀n1,n2.n1 = n2 → eq_HC08_im n1 n2 = true.
28  #n1; #n2; #H;
29  nrewrite > H;
30  nelim n2;
31  ##[ ##31,32: #o; nrewrite > (eq_to_eqoct … (refl_eq …)) ##]
32  nnormalize;
33  napply refl_eq.
34 nqed.
35
36 nlemma neqHC08im_to_neq : ∀n1,n2.eq_HC08_im n1 n2 = false → n1 ≠ n2.
37  #n1; #n2; #H;
38  napply (not_to_not (n1 = n2) (eq_HC08_im n1 n2 = true) …);
39  ##[ ##1: napply (eq_to_eqHC08im n1 n2)
40  ##| ##2: napply (eqfalse_to_neqtrue … H)
41  ##]
42 nqed.
43
44 (* !!! per brevita... *)
45 naxiom eqHC08im_to_eq : ∀c1,c2.eq_HC08_im c1 c2 = true → c1 = c2.
46
47 nlemma neq_to_neqHC08im : ∀n1,n2.n1 ≠ n2 → eq_HC08_im n1 n2 = false.
48  #n1; #n2; #H;
49  napply (neqtrue_to_eqfalse (eq_HC08_im n1 n2));
50  napply (not_to_not (eq_HC08_im n1 n2 = true) (n1 = n2) ? H);
51  napply (eqHC08im_to_eq n1 n2).
52 nqed.
53
54 nlemma decidable_HC08im : ∀x,y:HC08_instr_mode.decidable (x = y).
55  #x; #y; nnormalize;
56  napply (or2_elim (eq_HC08_im x y = true) (eq_HC08_im x y = false) ? (decidable_bexpr ?));
57  ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqHC08im_to_eq … H))
58  ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqHC08im_to_neq … H))
59  ##]
60 nqed.
61
62 nlemma symmetric_eqHC08im : symmetricT HC08_instr_mode bool eq_HC08_im.
63  #n1; #n2;
64  napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_HC08im n1 n2));
65  ##[ ##1: #H; nrewrite > H; napply refl_eq
66  ##| ##2: #H; nrewrite > (neq_to_neqHC08im n1 n2 H);
67           napply (symmetric_eq ? (eq_HC08_im n2 n1) false);
68           napply (neq_to_neqHC08im n2 n1 (symmetric_neq ? n1 n2 H))
69  ##]
70 nqed.