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: Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Cosimo Oliboni, oliboni@cs.unibo.it *)
21 (* ********************************************************************** *)
23 include "num/bool.ma".
29 ndefinition bool_destruct_aux ≝
30 Πb1,b2:bool.ΠP:Prop.b1 = b2 →
32 [ true ⇒ match b2 with [ true ⇒ P → P | false ⇒ P ]
33 | false ⇒ match b2 with [ true ⇒ P | false ⇒ P → P ]
36 ndefinition bool_destruct : bool_destruct_aux.
42 ##[ ##2: napply False_ind;
43 nchange with (match true with [ true ⇒ False | false ⇒ True]);
47 ##| ##3: napply False_ind;
48 nchange with (match true with [ true ⇒ False | false ⇒ True]);
52 ##| ##1,4: napply (λx:P.x)
56 nlemma symmetric_eqbool : symmetricT bool bool eq_bool.
64 nlemma symmetric_andbool : symmetricT bool bool and_bool.
72 nlemma associative_andbool : ∀b1,b2,b3.((b1 ⊗ b2) ⊗ b3) = (b1 ⊗ (b2 ⊗ b3)).
81 nlemma symmetric_orbool : symmetricT bool bool or_bool.
89 nlemma associative_orbool : ∀b1,b2,b3.((b1 ⊕ b2) ⊕ b3) = (b1 ⊕ (b2 ⊕ b3)).
98 nlemma symmetric_xorbool : symmetricT bool bool xor_bool.
106 nlemma associative_xorbool : ∀b1,b2,b3.((b1 ⊙ b2) ⊙ b3) = (b1 ⊙ (b2 ⊙ b3)).
115 nlemma eqbool_to_eq : ∀b1,b2:bool.(eq_bool b1 b2 = true) → (b1 = b2).
120 ##[ ##1,4: #H; napply refl_eq
121 ##| ##*: #H; napply (bool_destruct … H)
125 nlemma eq_to_eqbool : ∀b1,b2.b1 = b2 → eq_bool b1 b2 = true.
130 ##[ ##1,4: #H; napply refl_eq
131 ##| ##*: #H; napply (bool_destruct … H)
135 nlemma andb_true_true_l: ∀b1,b2.(b1 ⊗ b2) = true → b1 = true.
140 ##[ ##1,2: #H; napply refl_eq
141 ##| ##*: #H; napply (bool_destruct … H)
145 nlemma andb_true_true_r: ∀b1,b2.(b1 ⊗ b2) = true → b2 = true.
150 ##[ ##1,3: #H; napply refl_eq
151 ##| ##*: #H; napply (bool_destruct … H)
155 nlemma andb_false : ∀b1,b2.(b1 ⊗ b2) = false → (b1 = false) ∨ (b2 = false).
160 ##[ ##1: #H; napply (bool_destruct … H)
161 ##| ##2,4: #H; napply (or_intror … H)
162 ##| ##3: #H; napply (or_introl … H)
166 nlemma orb_false_false_l : ∀b1,b2:bool.(b1 ⊕ b2) = false → b1 = false.
171 ##[ ##4: #H; napply refl_eq
172 ##| ##*: #H; napply (bool_destruct … H)
176 nlemma orb_false_false_r : ∀b1,b2:bool.(b1 ⊕ b2) = false → b2 = false.
181 ##[ ##4: #H; napply refl_eq
182 ##| ##*: #H; napply (bool_destruct … H)