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 "num/exadecim.ma".
24 include "num/bool_lemmas.ma".
31 ndefinition exadecim_destruct_aux ≝
32 Πe1,e2.ΠP:Prop.ΠH:e1 = e2.
33 match eq_ex e1 e2 with [ true ⇒ P → P | false ⇒ P ].
35 ndefinition exadecim_destruct : exadecim_destruct_aux.
44 nlemma eq_to_eqex : ∀n1,n2.n1 = n2 → eq_ex n1 n2 = true.
52 nlemma neqex_to_neq : ∀n1,n2.eq_ex n1 n2 = false → n1 ≠ n2.
54 napply (not_to_not (n1 = n2) (eq_ex n1 n2 = true) …);
55 ##[ ##1: napply (eq_to_eqex n1 n2)
56 ##| ##2: napply (eqfalse_to_neqtrue … H)
60 nlemma eqex_to_eq : ∀n1,n2.eq_ex n1 n2 = true → n1 = n2.
65 ##[ ##1,18,35,52,69,86,103,120,137,154,171,188,205,222,239,256: #H; napply refl_eq
66 ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*)
70 nlemma neq_to_neqex : ∀n1,n2.n1 ≠ n2 → eq_ex n1 n2 = false.
72 napply (neqtrue_to_eqfalse (eq_ex n1 n2));
73 napply (not_to_not (eq_ex n1 n2 = true) (n1 = n2) ? H);
74 napply (eqex_to_eq n1 n2).
77 nlemma decidable_ex : ∀x,y:exadecim.decidable (x = y).
79 napply (or2_elim (eq_ex x y = true) (eq_ex x y = false) ? (decidable_bexpr ?));
80 ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqex_to_eq … H))
81 ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqex_to_neq … H))
85 nlemma symmetric_eqex : symmetricT exadecim bool eq_ex.
87 napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_ex n1 n2));
88 ##[ ##1: #H; nrewrite > H; napply refl_eq
89 ##| ##2: #H; nrewrite > (neq_to_neqex n1 n2 H);
90 napply (symmetric_eq ? (eq_ex n2 n1) false);
91 napply (neq_to_neqex n2 n1 (symmetric_neq ? n1 n2 H))