]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/lib/basics/bool.ma
list.ma moved inside lists.
[helm.git] / matita / matita / lib / basics / bool.ma
index ce857937c6b5e766e9939a3a16008e373ea8d050..7b26064856545b510fabb55073aa2393bdd00d5a 100644 (file)
@@ -52,6 +52,9 @@ theorem andb_true_l: ∀ b1,b2. (b1 ∧ b2) = true → b1 = true.
 theorem andb_true_r: ∀b1,b2. (b1 ∧ b2) = true → b2 = true.
 #b1 #b2 (cases b1) normalize // (cases b2) // qed.
 
+theorem andb_true: ∀b1,b2. (b1 ∧ b2) = true → b1 = true ∧ b2 = true.
+/3/ qed.
+
 definition orb : bool → bool → bool ≝
 λb1,b2:bool.match b1 with [ true ⇒ true | false ⇒ b2].
  
@@ -61,9 +64,24 @@ theorem orb_elim: ∀ b1,b2:bool. ∀ P:bool → Prop.
 match b1 with [ true ⇒ P true | false ⇒ P b2] → P (orb b1 b2).
 #b1 #b2 #P (elim b1) normalize // qed.
 
+lemma orb_true_r1: ∀b1,b2:bool. 
+  b1 = true → (b1 ∨ b2) = true.
+#b1 #b2 #H >H // qed.
+
+lemma orb_true_r2: ∀b1,b2:bool. 
+  b2 = true → (b1 ∨ b2) = true.
+#b1 #b2 #H >H cases b1 // qed.
+
+lemma orb_true_l: ∀b1,b2:bool. 
+  (b1 ∨ b2) = true → (b1 = true) ∨ (b2 = true).
+* normalize /2/ qed.
+
 definition if_then_else: ∀A:Type[0]. bool → A → A → A ≝ 
 λA.λb.λ P,Q:A. match b with [ true ⇒ P | false  ⇒ Q].
 
+notation "'if' term 19 e 'then' term 19 t 'else' term 19 f" non associative with precedence 19 for @{ 'if_then_else $e $t $f }.
+interpretation "if_then_else" 'if_then_else e t f = (if_then_else ? e t f).
+
 theorem bool_to_decidable_eq: 
   ∀b1,b2:bool. decidable (b1=b2).
 #b1 #b2 (cases b1) (cases b2) /2/ %2 /3/ qed.
@@ -73,3 +91,22 @@ theorem true_or_false:
 #b (cases b) /2/ qed.
 
 
+(****** DeqSet: a set with a decidbale equality ******)
+
+record DeqSet : Type[1] ≝ { carr :> Type[0];
+   eqb: carr → carr → bool;
+   eqb_true: ∀x,y. (eqb x y = true) ↔ (x = y)
+}.
+
+notation "a == b" non associative with precedence 45 for @{ 'eqb $a $b }.
+interpretation "eqb" 'eqb a b = (eqb ? a b).
+
+
+(****** EnumSet: a DeqSet with an enumeration function  ******
+
+record EnumSet : Type[1] ≝ { carr :> DeqSet;
+   enum: carr 
+   eqb_true: ∀x,y. (eqb x y = true) ↔ (x = y)
+}.
+
+*)
\ No newline at end of file