]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/emulator/opcodes/RS08_instr_mode_lemmas.ma
minus in nat.ma
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / opcodes / RS08_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/RS08_instr_mode.ma".
25 include "num/oct_lemmas.ma".
26 include "num/exadecim_lemmas.ma".
27 include "num/bitrigesim_lemmas.ma".
28
29 nlemma eq_to_eqRS08im : ∀n1,n2.n1 = n2 → eq_RS08_im n1 n2 = true.
30  #n1; #n2; #H;
31  nrewrite > H;
32  nelim n2;
33  ##[ ##11,12: #o; nrewrite > (eq_to_eqoct … (refl_eq …))
34  ##| ##13: #e; nrewrite > (eq_to_eqex … (refl_eq …))
35  ##| ##14: #t; nrewrite > (eq_to_eqbit … (refl_eq …)) ##]
36  nnormalize;
37  napply refl_eq.
38 nqed.
39
40 nlemma neqRS08im_to_neq : ∀n1,n2.eq_RS08_im n1 n2 = false → n1 ≠ n2.
41  #n1; #n2; #H;
42  napply (not_to_not (n1 = n2) (eq_RS08_im n1 n2 = true) …);
43  ##[ ##1: napply (eq_to_eqRS08im n1 n2)
44  ##| ##2: napply (eqfalse_to_neqtrue … H)
45  ##]
46 nqed.
47
48 (* !!! per brevita... *)
49 naxiom eqRS08im_to_eq : ∀c1,c2.eq_RS08_im c1 c2 = true → c1 = c2.
50
51 nlemma neq_to_neqRS08im : ∀n1,n2.n1 ≠ n2 → eq_RS08_im n1 n2 = false.
52  #n1; #n2; #H;
53  napply (neqtrue_to_eqfalse (eq_RS08_im n1 n2));
54  napply (not_to_not (eq_RS08_im n1 n2 = true) (n1 = n2) ? H);
55  napply (eqRS08im_to_eq n1 n2).
56 nqed.
57
58 nlemma decidable_RS08im : ∀x,y:RS08_instr_mode.decidable (x = y).
59  #x; #y; nnormalize;
60  napply (or2_elim (eq_RS08_im x y = true) (eq_RS08_im x y = false) ? (decidable_bexpr ?));
61  ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqRS08im_to_eq … H))
62  ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqRS08im_to_neq … H))
63  ##]
64 nqed.
65
66 nlemma symmetric_eqRS08im : symmetricT RS08_instr_mode bool eq_RS08_im.
67  #n1; #n2;
68  napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_RS08im n1 n2));
69  ##[ ##1: #H; nrewrite > H; napply refl_eq
70  ##| ##2: #H; nrewrite > (neq_to_neqRS08im n1 n2 H);
71           napply (symmetric_eq ? (eq_RS08_im n2 n1) false);
72           napply (neq_to_neqRS08im n2 n1 (symmetric_neq ? n1 n2 H))
73  ##]
74 nqed.