]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/library/datatypes/bool.ma
update in groud_2 and models
[helm.git] / helm / software / matita / library / datatypes / bool.ma
index 37a2a377d6fd39320fc8dfbdeeb1820de0fd1b25..f78264d687b9b72ba098447002059550cf6df589 100644 (file)
@@ -12,9 +12,8 @@
 (*                                                                        *)
 (**************************************************************************)
 
-set "baseuri" "cic:/matita/datatypes/bool/".
-
 include "logic/equality.ma".
+include "higher_order_defs/functions.ma".
 
 inductive bool : Set \def 
   | true : bool
@@ -36,7 +35,7 @@ unfold Not.intro.
 change with 
 match true with
 [ true \Rightarrow False
-| flase \Rightarrow True].
+| false \Rightarrow True].
 rewrite > H.simplify.exact I.
 qed.
 
@@ -45,7 +44,10 @@ definition notb : bool \to bool \def
  match b with 
  [ true \Rightarrow false
  | false \Rightarrow true ].
+
+(* FG: interpretation right after definition *)
+interpretation "boolean not" 'not x = (notb x).
+
 theorem notb_elim: \forall b:bool.\forall P:bool \to Prop.
 match b with
 [ true \Rightarrow P false
@@ -53,8 +55,19 @@ match b with
 intros 2.elim b.exact H. exact H.
 qed.
 
-(*CSC: the URI must disappear: there is a bug now *)
-interpretation "boolean not" 'not x = (cic:/matita/datatypes/bool/notb.con x).
+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.
 
 definition andb : bool \to bool \to bool\def
 \lambda b1,b2:bool. 
@@ -62,8 +75,7 @@ definition andb : bool \to bool \to bool\def
  [ true \Rightarrow b2
  | false \Rightarrow false ].
 
-(*CSC: the URI must disappear: there is a bug now *)
-interpretation "boolean and" 'and x y = (cic:/matita/datatypes/bool/andb.con x y).
+interpretation "boolean and" 'and x y = (andb x y).
 
 theorem andb_elim: \forall b1,b2:bool. \forall P:bool \to Prop.
 match b1 with
@@ -72,6 +84,18 @@ 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.
@@ -92,6 +116,9 @@ definition orb : bool \to bool \to bool\def
  [ true \Rightarrow true
  | false \Rightarrow b2].
 
+(* FG: interpretation right after definition *)
+interpretation "boolean or" 'or x y = (orb x y).
+
 theorem orb_elim: \forall b1,b2:bool. \forall P:bool \to Prop.
 match b1 with
 [ true \Rightarrow P true
@@ -99,9 +126,6 @@ match b1 with
 intros 3.elim b1.exact H. exact H.
 qed.
 
-(*CSC: the URI must disappear: there is a bug now *)
-interpretation "boolean or" 'or x y = (cic:/matita/datatypes/bool/orb.con x y).
-
 definition if_then_else : bool \to Prop \to Prop \to Prop \def 
 \lambda b:bool.\lambda P,Q:Prop.
 match b with
@@ -169,4 +193,4 @@ intros.
 rewrite > H.
 rewrite > H1.
 reflexivity.
-qed.
\ No newline at end of file
+qed.