]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_instr_mode.ma
mod change (-x)
[helm.git] / helm / software / matita / contribs / ng_assembly2 / emulator / opcodes / IP2022_instr_mode.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 "emulator/opcodes/IP2022_instr_mode_base.ma".
24
25 nlemma eq_to_eqIP2022im : ∀n1,n2.n1 = n2 → eq_IP2022_im n1 n2 = true.
26  #n1; #n2; #H;
27  nrewrite > H;
28  nelim n2;
29  ##[ ##4,11,12: #o; nrewrite > (eq_to_eqoct … (refl_eq …))
30  ##| ##6: #t; nrewrite > (eq_to_eqbit … (refl_eq …)) ##]
31  nnormalize;
32  napply refl_eq.
33 nqed.
34
35 nlemma neqIP2022im_to_neq : ∀n1,n2.eq_IP2022_im n1 n2 = false → n1 ≠ n2.
36  #n1; #n2; #H;
37  napply (not_to_not (n1 = n2) (eq_IP2022_im n1 n2 = true) …);
38  ##[ ##1: napply (eq_to_eqIP2022im n1 n2)
39  ##| ##2: napply (eqfalse_to_neqtrue … H)
40  ##]
41 nqed.
42
43 (* !!! per brevita... *)
44 naxiom eqIP2022im_to_eq : ∀c1,c2.eq_IP2022_im c1 c2 = true → c1 = c2.
45
46 nlemma neq_to_neqIP2022im : ∀n1,n2.n1 ≠ n2 → eq_IP2022_im n1 n2 = false.
47  #n1; #n2; #H;
48  napply (neqtrue_to_eqfalse (eq_IP2022_im n1 n2));
49  napply (not_to_not (eq_IP2022_im n1 n2 = true) (n1 = n2) ? H);
50  napply (eqIP2022im_to_eq n1 n2).
51 nqed.
52
53 nlemma decidable_IP2022im : ∀x,y:IP2022_instr_mode.decidable (x = y).
54  #x; #y; nnormalize;
55  napply (or2_elim (eq_IP2022_im x y = true) (eq_IP2022_im x y = false) ? (decidable_bexpr ?));
56  ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqIP2022im_to_eq … H))
57  ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqIP2022im_to_neq … H))
58  ##]
59 nqed.
60
61 nlemma symmetric_eqIP2022im : symmetricT IP2022_instr_mode bool eq_IP2022_im.
62  #n1; #n2;
63  napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_IP2022im n1 n2));
64  ##[ ##1: #H; nrewrite > H; napply refl_eq
65  ##| ##2: #H; nrewrite > (neq_to_neqIP2022im n1 n2 H);
66           napply (symmetric_eq ? (eq_IP2022_im n2 n1) false);
67           napply (neq_to_neqIP2022im n2 n1 (symmetric_neq ? n1 n2 H))
68  ##]
69 nqed.
70
71 nlemma IP2022im_is_comparable : comparable.
72  @ IP2022_instr_mode
73   ##[ napply MODE_INH
74   ##| napply forall_IP2022_im
75   ##| napply eq_IP2022_im
76   ##| napply eqIP2022im_to_eq
77   ##| napply eq_to_eqIP2022im
78   ##| napply neqIP2022im_to_neq
79   ##| napply neq_to_neqIP2022im
80   ##| napply decidable_IP2022im
81   ##| napply symmetric_eqIP2022im
82   ##]
83 nqed.
84
85 unification hint 0 ≔ ⊢ carr IP2022im_is_comparable ≡ IP2022_instr_mode.