inductive bool : Set \def
| true : bool
| false : bool.
-
+
+theorem bool_elim: \forall P:bool \to Prop. \forall b:bool.
+ (b = true \to P true)
+ \to (b = false \to P false)
+ \to P b.
+ intros 2 (P b).
+ elim b;
+ [ apply H; reflexivity
+ | apply H1; reflexivity
+ ]
+qed.
+
theorem not_eq_true_false : true \neq false.
-simplify.intro.
+unfold Not.intro.
change with
match true with
[ true \Rightarrow False
[ 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).
+
theorem andb_elim: \forall b1,b2:bool. \forall P:bool \to Prop.
match b1 with
[ true \Rightarrow P b2
-| false \Rightarrow P false] \to P (andb b1 b2).
+| false \Rightarrow P false] \to P (b1 \land b2).
intros 3.elim b1.exact H. exact H.
qed.
-(*CSC: the URI must disappear: there is a bug now *)
-interpretation "boolean and" 'and x y = (cic:/matita/datatypes/bool/andb.con x y).
+theorem andb_true_true: \forall b1,b2. (b1 \land b2) = true \to b1 = true.
+intro. elim b1.
+reflexivity.
+assumption.
+qed.
definition orb : bool \to bool \to bool\def
\lambda b1,b2:bool.
| false \Rightarrow Q].
(*CSC: missing notation for if_then_else *)
+
+theorem bool_to_decidable_eq:
+ \forall b1,b2:bool. decidable (b1=b2).
+ intros.
+ unfold decidable.
+ elim b1.
+ elim b2.
+ left. reflexivity.
+ right. exact not_eq_true_false.
+ elim b2.
+ right. unfold Not. intro.
+ apply not_eq_true_false.
+ symmetry. exact H.
+ left. reflexivity.
+qed.
+
+theorem P_x_to_P_x_to_eq:
+ \forall A:Set. \forall P: A \to bool.
+ \forall x:A. \forall p1,p2:P x = true. p1 = p2.
+ intros.
+ apply eq_to_eq_to_eq_p_q.
+ exact bool_to_decidable_eq.
+qed.