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 (* Ultima modifica: 05/08/2009 *)
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 decidable_bool : ∀x,y:bool.decidable (x = y).
140 ##[ ##1,4: napply (or_introl (? = ?) (? ≠ ?) …); napply refl_eq
141 ##| ##*: napply (or_intror (? = ?) (? ≠ ?) …); nnormalize; #H; napply False_ind; napply (bool_destruct … H)
145 nlemma neqbool_to_neq : ∀b1,b2:bool.(eq_bool b1 b2 = false) → (b1 ≠ b2).
150 ##[ ##1,4: #H; napply (bool_destruct … H)
151 ##| ##*: #H; #H1; napply (bool_destruct … H1)
155 nlemma neq_to_neqbool : ∀b1,b2.b1 ≠ b2 → eq_bool b1 b2 = false.
160 ##[ ##1,4: #H; nelim (H (refl_eq …))
161 ##| ##*: #H; napply refl_eq
165 nlemma andb_true_true_l: ∀b1,b2.(b1 ⊗ b2) = true → b1 = true.
170 ##[ ##1,2: #H; napply refl_eq
171 ##| ##*: #H; napply (bool_destruct … H)
175 nlemma andb_true_true_r: ∀b1,b2.(b1 ⊗ b2) = true → b2 = true.
180 ##[ ##1,3: #H; napply refl_eq
181 ##| ##*: #H; napply (bool_destruct … H)
185 nlemma andb_false : ∀b1,b2.(b1 ⊗ b2) = false → (b1 = false) ∨ (b2 = false).
190 ##[ ##1: #H; napply (bool_destruct … H)
191 ##| ##2,4: #H; napply (or_intror … H)
192 ##| ##3: #H; napply (or_introl … H)
196 nlemma orb_false_false_l : ∀b1,b2:bool.(b1 ⊕ b2) = false → b1 = false.
201 ##[ ##4: #H; napply refl_eq
202 ##| ##*: #H; napply (bool_destruct … H)
206 nlemma orb_false_false_r : ∀b1,b2:bool.(b1 ⊕ b2) = false → b2 = false.
211 ##[ ##4: #H; napply refl_eq
212 ##| ##*: #H; napply (bool_destruct … H)