1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 (* ********************************************************************** *)
16 (* Progetto FreeScale *)
18 (* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Sviluppo: 2008-2010 *)
21 (* ********************************************************************** *)
23 include "compiler/ast_base_type_base.ma".
24 include "common/comp.ma".
25 include "num/bool_lemmas.ma".
27 (* ************************* *)
28 (* dimensioni degli elementi *)
29 (* ************************* *)
31 ndefinition astbasetype_destruct_aux ≝
32 Πb1,b2:ast_base_type.ΠP:Prop.b1 = b2 →
33 match eq_astbasetype b1 b2 with [ true ⇒ P → P | false ⇒ P ].
35 ndefinition astbasetype_destruct : astbasetype_destruct_aux.
43 nlemma eq_to_eqastbasetype : ∀n1,n2.n1 = n2 → eq_astbasetype n1 n2 = true.
51 nlemma neqastbasetype_to_neq : ∀n1,n2.eq_astbasetype n1 n2 = false → n1 ≠ n2.
53 napply (not_to_not (n1 = n2) (eq_astbasetype n1 n2 = true) …);
54 ##[ ##1: napply (eq_to_eqastbasetype n1 n2)
55 ##| ##2: napply (eqfalse_to_neqtrue … H)
59 nlemma eqastbasetype_to_eq : ∀b1,b2.eq_astbasetype b1 b2 = true → b1 = b2.
60 #b1; #b2; ncases b1; ncases b2; nnormalize;
61 ##[ ##1,5,9: #H; napply refl_eq
62 ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*)
66 nlemma neq_to_neqastbasetype : ∀n1,n2.n1 ≠ n2 → eq_astbasetype n1 n2 = false.
68 napply (neqtrue_to_eqfalse (eq_astbasetype n1 n2));
69 napply (not_to_not (eq_astbasetype n1 n2 = true) (n1 = n2) ? H);
70 napply (eqastbasetype_to_eq n1 n2).
73 nlemma decidable_astbasetype : ∀x,y:ast_base_type.decidable (x = y).
75 napply (or2_elim (eq_astbasetype x y = true) (eq_astbasetype x y = false) ? (decidable_bexpr ?));
76 ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqastbasetype_to_eq … H))
77 ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqastbasetype_to_neq … H))
81 nlemma symmetric_eqastbasetype : symmetricT ast_base_type bool eq_astbasetype.
83 napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_astbasetype n1 n2));
84 ##[ ##1: #H; nrewrite > H; napply refl_eq
85 ##| ##2: #H; nrewrite > (neq_to_neqastbasetype n1 n2 H);
86 napply (symmetric_eq ? (eq_astbasetype n2 n1) false);
87 napply (neq_to_neqastbasetype n2 n1 (symmetric_neq ? n1 n2 H))
91 nlemma astbasetype_is_comparable : comparable.
93 ##[ napply AST_BASE_TYPE_BYTE8
94 ##| napply forall_astbasetype
95 ##| napply eq_astbasetype
96 ##| napply eqastbasetype_to_eq
97 ##| napply eq_to_eqastbasetype
98 ##| napply neqastbasetype_to_neq
99 ##| napply neq_to_neqastbasetype
100 ##| napply decidable_astbasetype
101 ##| napply symmetric_eqastbasetype
105 unification hint 0 ≔ ⊢ carr astbasetype_is_comparable ≡ ast_base_type.