]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/datatypes/bool.ma
The library grows...
[helm.git] / helm / matita / library / datatypes / bool.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/datatypes/bool/".
16
17 include "logic/equality.ma".
18
19 inductive bool : Set \def 
20   | true : bool
21   | false : bool.
22   
23 theorem not_eq_true_false : \lnot true = false.
24 simplify.intro.
25 change with 
26 match true with
27 [ true \Rightarrow False
28 | flase \Rightarrow True].
29 rewrite > H.simplify.exact I.
30 qed.
31
32 definition notb : bool \to bool \def
33 \lambda b:bool. 
34  match b with 
35  [ true \Rightarrow false
36  | false \Rightarrow true ].
37  
38 theorem notb_elim: \forall b:bool.\forall P:bool \to Prop.
39 match b with
40 [ true \Rightarrow P false
41 | false \Rightarrow P true] \to P (notb b).
42 intros 2.elim b.exact H. exact H.
43 qed.
44
45 (*CSC: the URI must disappear: there is a bug now *)
46 interpretation "boolean not" 'not x = (cic:/matita/datatypes/bool/notb.con x).
47
48 definition andb : bool \to bool \to bool\def
49 \lambda b1,b2:bool. 
50  match b1 with 
51  [ true \Rightarrow b2
52  | false \Rightarrow false ].
53
54 theorem andb_elim: \forall b1,b2:bool. \forall P:bool \to Prop.
55 match b1 with
56 [ true \Rightarrow P b2
57 | false \Rightarrow P false] \to P (andb b1 b2).
58 intros 3.elim b1.exact H. exact H.
59 qed.
60
61 (*CSC: the URI must disappear: there is a bug now *)
62 interpretation "boolean and" 'and x y = (cic:/matita/datatypes/bool/andb.con x y).
63
64 definition orb : bool \to bool \to bool\def
65 \lambda b1,b2:bool. 
66  match b1 with 
67  [ true \Rightarrow true
68  | false \Rightarrow b2].
69
70 theorem orb_elim: \forall b1,b2:bool. \forall P:bool \to Prop.
71 match b1 with
72 [ true \Rightarrow P true
73 | false \Rightarrow P b2] \to P (orb b1 b2).
74 intros 3.elim b1.exact H. exact H.
75 qed.
76
77 (*CSC: the URI must disappear: there is a bug now *)
78 interpretation "boolean or" 'or x y = (cic:/matita/datatypes/bool/orb.con x y).
79
80 definition if_then_else : bool \to Prop \to Prop \to Prop \def 
81 \lambda b:bool.\lambda P,Q:Prop.
82 match b with
83 [ true \Rightarrow P
84 | false  \Rightarrow Q].
85
86 (*CSC: missing notation for if_then_else *)