]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/library/datatypes/bool.ma
Reorganization of the library.
[helm.git] / matita / library / datatypes / bool.ma
index 3292e6789610f6114c590be58d18c729a3bf92fe..953471191b1ddb8b215c34998df0ed9822890c16 100644 (file)
@@ -15,6 +15,7 @@
 set "baseuri" "cic:/matita/datatypes/bool/".
 
 include "logic/equality.ma".
+include "higher_order_defs/functions.ma".
 
 inductive bool : Set \def 
   | true : bool
@@ -53,6 +54,20 @@ match b with
 intros 2.elim b.exact H. exact H.
 qed.
 
+theorem notb_notb: \forall b:bool. notb (notb b) = b.
+intros.
+elim b;reflexivity.
+qed.
+
+theorem injective_notb: injective bool bool notb.
+unfold injective.
+intros.
+rewrite < notb_notb.
+rewrite < (notb_notb y).
+apply eq_f.
+assumption.
+qed.
+
 (*CSC: the URI must disappear: there is a bug now *)
 interpretation "boolean not" 'not x = (cic:/matita/datatypes/bool/notb.con x).
 
@@ -72,12 +87,32 @@ match b1 with
 intros 3.elim b1.exact H. exact H.
 qed.
 
+theorem and_true: \forall a,b:bool. 
+andb a b =true \to a =true \land b= true.
+intro.elim a
+  [split
+    [reflexivity|assumption]
+  |apply False_ind.
+   apply not_eq_true_false.
+   apply sym_eq.
+   assumption
+  ]
+qed.
+
 theorem andb_true_true: \forall b1,b2. (b1 \land b2) = true \to b1 = true.
 intro. elim b1.
 reflexivity.
 assumption.
 qed.
 
+theorem andb_true_true_r: \forall b1,b2. (b1 \land b2) = true \to b2 = true.
+intro. elim b1
+  [assumption
+  |apply False_ind.apply not_eq_true_false.
+   apply sym_eq.assumption
+  ]
+qed.
+
 definition orb : bool \to bool \to bool\def
 \lambda b1,b2:bool. 
  match b1 with 
@@ -123,4 +158,42 @@ theorem P_x_to_P_x_to_eq:
  intros.
  apply eq_to_eq_to_eq_p_q.
  exact bool_to_decidable_eq.
-qed. 
+qed.
+
+
+(* some basic properties of and - or*)
+theorem andb_sym: \forall A,B:bool.
+(A \land B) = (B \land A).
+intros.
+elim A;
+  elim B;
+    simplify;
+    reflexivity.
+qed.
+
+theorem andb_assoc: \forall A,B,C:bool.
+(A \land (B \land C)) = ((A \land B) \land C).
+intros.
+elim A;
+  elim B;
+    elim C;
+      simplify;
+      reflexivity.
+qed.
+
+theorem orb_sym: \forall A,B:bool.
+(A \lor B) = (B \lor A).
+intros.
+elim A;
+  elim B;
+    simplify;
+    reflexivity.
+qed.
+
+theorem true_to_true_to_andb_true: \forall A,B:bool.
+A = true \to B = true \to (A \land B) = true.
+intros.
+rewrite > H.
+rewrite > H1.
+reflexivity.
+qed.
\ No newline at end of file