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 *)
19 (* Cosimo Oliboni, oliboni@cs.unibo.it *)
21 (* Questo materiale fa parte della tesi: *)
22 (* "Formalizzazione Interattiva dei Microcontroller a 8bit FreeScale" *)
24 (* data ultima modifica 15/11/2007 *)
25 (* ********************************************************************** *)
27 include "freescale/theory.ma".
28 include "freescale/bool.ma".
34 ndefinition bool_destruct :
35 Πb1,b2:bool.ΠP:Prop.b1 = b2 →
37 [ true ⇒ match b2 with [ true ⇒ P → P | false ⇒ P ]
38 | false ⇒ match b2 with [ true ⇒ P | false ⇒ P → P ]
45 ##[ ##2: napply (False_ind ??);
46 nchange with (match true with [ true ⇒ False | false ⇒ True]);
50 ##| ##3: napply (False_ind ??);
51 nchange with (match true with [ true ⇒ False | false ⇒ True]);
55 ##| ##1,4: napply (λx:P.x)
59 nlemma symmetric_eqbool : symmetricT bool bool eq_bool.
67 nlemma symmetric_andbool : symmetricT bool bool and_bool.
75 nlemma associative_andbool : ∀b1,b2,b3.((b1 ⊗ b2) ⊗ b3) = (b1 ⊗ (b2 ⊗ b3)).
84 nlemma symmetric_orbool : symmetricT bool bool or_bool.
92 nlemma associative_orbool : ∀b1,b2,b3.((b1 ⊕ b2) ⊕ b3) = (b1 ⊕ (b2 ⊕ b3)).
101 nlemma symmetric_xorbool : symmetricT bool bool xor_bool.
109 nlemma associative_orbool : ∀b1,b2,b3.((b1 ⊙ b2) ⊙ b3) = (b1 ⊙ (b2 ⊙ b3)).
118 nlemma eqbool_to_eq : ∀b1,b2:bool.(eq_bool b1 b2 = true) → (b1 = b2).
120 nletin K ≝ (bool_destruct ?? (b1 = b2) H);
121 nelim b1 in K:(%) ⊢ %;
124 ##[ ##2,3: #H; napply H
125 ##| ##1,4: #H; napply (refl_eq ??)
129 nlemma eq_to_eqbool : ∀b1,b2.b1 = b2 → eq_bool b1 b2 = true.
131 nletin K ≝ (bool_destruct ?? (eq_bool b1 b2 = true) H);
132 nelim b1 in K:(%) ⊢ %;
135 ##[ ##2,3: #H; napply H
136 ##| ##1,4: #H; napply (refl_eq ??)
140 nlemma andb_true_true_l: ∀b1,b2.(b1 ⊗ b2) = true → b1 = true.
142 nletin K ≝ (bool_destruct ?? (b1 = true) H);
143 nelim b1 in K:(%) ⊢ %;
146 ##[ ##3,4: #H; napply H
147 ##| ##1,2: #H; napply (refl_eq ??)
151 nlemma andb_true_true_r: ∀b1,b2.(b1 ⊗ b2) = true → b2 = true.
153 nletin K ≝ (bool_destruct ?? (b2 = true) H);
154 nelim b1 in K:(%) ⊢ %;
157 ##[ ##2,4: #H; napply H
158 ##| ##1,3: #H; napply (refl_eq ??)
162 nlemma orb_false_false_l : ∀b1,b2:bool.(b1 ⊕ b2) = false → b1 = false.
164 nletin K ≝ (bool_destruct ?? (b1 = false) H);
165 nelim b1 in K:(%) ⊢ %;
168 ##[ ##1,2,3: #H; napply H
169 ##| ##4: #H; napply (refl_eq ??)
173 nlemma orb_false_false_r : ∀b1,b2:bool.(b1 ⊕ b2) = false → b2 = false.
175 nletin K ≝ (bool_destruct ?? (b2 = false) H);
176 nelim b1 in K:(%) ⊢ %;
179 ##[ ##1,2,3: #H; napply H
180 ##| ##4: #H; napply (refl_eq ??)