]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/lib/formal_topology/cprop_connectives.ma
we added the standard notation for True and False (logical constants)
[helm.git] / matita / matita / lib / formal_topology / cprop_connectives.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basics/pts.ma".
16
17 inductive False: CProp[0] ≝.
18
19 interpretation "constructive logical false" 'false = False.
20
21 inductive True: CProp[0] ≝  
22 I : True.
23
24 interpretation "constructive logical true" 'true = True.
25
26 inductive Or (A,B:CProp[0]) : CProp[0] ≝
27  | Left : A → Or A B
28  | Right : B → Or A B.
29
30 interpretation "constructive or" 'or x y = (Or x y).
31
32 inductive Or3 (A,B,C:CProp[0]) : CProp[0] ≝
33  | Left3 : A → Or3 A B C
34  | Middle3 : B → Or3 A B C
35  | Right3 : C → Or3 A B C.
36
37 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
38
39 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
40
41 inductive Or4 (A,B,C,D:CProp[0]) : CProp[0] ≝
42  | Left3 : A → Or4 A B C D
43  | Middle3 : B → Or4 A B C D
44  | Right3 : C → Or4 A B C D
45  | Extra3: D → Or4 A B C D.
46
47 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
48
49 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
50
51 inductive And (A,B:CProp[0]) : CProp[0] ≝
52  | Conj : A → B → And A B.
53  
54 interpretation "constructive and" 'and x y = (And x y).
55
56 inductive And3 (A,B,C:CProp[0]) : CProp[0] ≝
57  | Conj3 : A → B → C → And3 A B C.
58
59 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
60  
61 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
62
63 inductive And42 (A,B,C,D:CProp[2]) : CProp[2] ≝
64  | Conj42 : A → B → C → D → And42 A B C D.
65
66 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
67  
68 interpretation "constructive quaternary and2" 'and4 x y z t = (And42 x y z t).
69
70 record Iff (A,B:CProp[0]) : CProp[0] ≝
71  { if: A → B;
72    fi: B → A
73  }.
74  
75 record Iff1 (A,B:CProp[1]) : CProp[1] ≝
76  { if1: A → B;
77    fi1: B → A
78  }.
79  
80 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
81 interpretation "logical iff" 'iff x y = (Iff x y).
82 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
83
84 inductive exT22 (A:Type[2]) (P:A→CProp[2]) : CProp[2] ≝
85   ex_introT22: ∀w:A. P w → exT22 A P.
86   
87 interpretation "CProp[2] exists" 'exists \eta.x = (exT22 ? x).
88 (*
89 definition pi1exT22 ≝ λA,P.λx:exT22 A P.match x with [ex_introT22 x _ ⇒ x].
90 definition pi2exT22 ≝ 
91   λA,P.λx:exT22 A P.match x return λx.P (pi1exT22 ?? x) with [ex_introT22 _ p ⇒ p].
92   
93 interpretation "exT22 \fst" 'pi1 = (pi1exT22 ? ?).
94 interpretation "exT22 \snd" 'pi2 = (pi2exT22 ? ?).
95 interpretation "exT22 \fst a" 'pi1a x = (pi1exT22 ? ? x).
96 interpretation "exT22 \snd a" 'pi2a x = (pi2exT22 ? ? x).
97 interpretation "exT22 \fst b" 'pi1b x y = (pi1exT22 ? ? x y).
98 interpretation "exT22 \snd b" 'pi2b x y = (pi2exT22 ? ? x y).
99 *)
100 inductive exT (A:Type[0]) (P:A→CProp[0]) : CProp[0] ≝
101   ex_introT: ∀w:A. P w → exT A P.
102
103 interpretation "CProp exists" 'exists \eta.x = (exT ? x).
104
105 notation "\ll term 19 a, break term 19 b \gg" 
106 with precedence 90 for @{'dependent_pair $a $b}.
107 interpretation "dependent pair" 'dependent_pair a b = 
108   (ex_introT ? ? a b).
109
110 (*
111 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
112 definition pi2exT ≝ 
113   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
114
115 interpretation "exT \fst" 'pi1 = (pi1exT ? ?).
116 interpretation "exT \fst a" 'pi1a x = (pi1exT ? ? x).
117 interpretation "exT \fst b" 'pi1b x y = (pi1exT ? ? x y).
118 interpretation "exT \snd" 'pi2 = (pi2exT ? ?).
119 interpretation "exT \snd a" 'pi2a x = (pi2exT ? ? x).
120 interpretation "exT \snd b" 'pi2b x y = (pi2exT ? ? x y).
121 *)
122 inductive exT23 (A:Type[0]) (P:A→CProp[0]) (Q:A→CProp[0]) (R:A→A→CProp[0]) : CProp[0] ≝
123   ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
124 (*
125 definition pi1exT23 ≝
126   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
127 definition pi2exT23 ≝
128   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
129
130 interpretation "exT2 \fst" 'pi1 = (pi1exT23 ? ? ? ?).
131 interpretation "exT2 \snd" 'pi2 = (pi2exT23 ? ? ? ?).   
132 interpretation "exT2 \fst a" 'pi1a x = (pi1exT23 ? ? ? ? x).
133 interpretation "exT2 \snd a" 'pi2a x = (pi2exT23 ? ? ? ? x).
134 interpretation "exT2 \fst b" 'pi1b x y = (pi1exT23 ? ? ? ? x y).
135 interpretation "exT2 \snd b" 'pi2b x y = (pi2exT23 ? ? ? ? x y).
136 *)
137 inductive exT2 (A:Type[0]) (P,Q:A→CProp[0]) : CProp[0] ≝
138   ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
139
140
141 definition Not : CProp[0] → CProp[0] ≝ λx:CProp[0].x → ⊥.
142
143 interpretation "constructive not" 'not x = (Not x).
144   
145 definition cotransitive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
146  λC:Type[0].λlt:C→C→CProp[0].∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
147
148 definition coreflexive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
149  λC:Type[0].λlt:C→C→CProp[0]. ∀x:C. ¬ (lt x x).
150
151 definition symmetric: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
152  λC:Type[0].λlt:C→C→CProp[0]. ∀x,y:C.lt x y → lt y x.
153
154 definition antisymmetric: ∀A:Type[0]. ∀R:A→A→CProp[0]. ∀eq:A→A→Prop.CProp[0] ≝
155  λA:Type[0].λR:A→A→CProp[0].λeq:A→A→Prop.∀x:A.∀y:A.R x y→R y x→eq x y.
156
157 definition reflexive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝ λA:Type[0].λR:A→A→CProp[0].∀x:A.R x x.
158
159 definition transitive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝ λA:Type[0].λR:A→A→CProp[0].∀x,y,z:A.R x y → R y z → R x z.
160
161 definition reflexive1: ∀A:Type[1].∀R:A→A→CProp[1].CProp[1] ≝ λA:Type[1].λR:A→A→CProp[1].∀x:A.R x x.
162 definition symmetric1: ∀A:Type[1].∀R:A→A→CProp[1].CProp[1] ≝ λC:Type[1].λlt:C→C→CProp[1]. ∀x,y:C.lt x y → lt y x.
163 definition transitive1: ∀A:Type[1].∀R:A→A→CProp[1].CProp[1] ≝ λA:Type[1].λR:A→A→CProp[1].∀x,y,z:A.R x y → R y z → R x z.
164
165 definition reflexive2: ∀A:Type[2].∀R:A→A→CProp[2].CProp[2] ≝ λA:Type[2].λR:A→A→CProp[2].∀x:A.R x x.
166 definition symmetric2: ∀A:Type[2].∀R:A→A→CProp[2].CProp[2] ≝ λC:Type[2].λlt:C→C→CProp[2]. ∀x,y:C.lt x y → lt y x.
167 definition transitive2: ∀A:Type[2].∀R:A→A→CProp[2].CProp[2] ≝ λA:Type[2].λR:A→A→CProp[2].∀x,y,z:A.R x y → R y z → R x z.
168
169 definition reflexive3: ∀A:Type[3].∀R:A→A→CProp[3].CProp[3] ≝ λA:Type[3].λR:A→A→CProp[3].∀x:A.R x x.
170 definition symmetric3: ∀A:Type[3].∀R:A→A→CProp[3].CProp[3] ≝ λC:Type[3].λlt:C→C→CProp[3]. ∀x,y:C.lt x y → lt y x.
171 definition transitive3: ∀A:Type[3].∀R:A→A→CProp[3].CProp[3] ≝ λA:Type[3].λR:A→A→CProp[3].∀x,y,z:A.R x y → R y z → R x z.