1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "logic/connectives.ma".
17 definition Type4 : Type := Type.
18 definition Type3 : Type4 := Type.
19 definition Type2 : Type3 := Type.
20 definition Type1 : Type2 := Type.
21 definition Type0 : Type1 := Type.
23 definition Type_of_Type0: Type0 → Type := λx.x.
24 definition Type_of_Type1: Type1 → Type := λx.x.
25 definition Type_of_Type2: Type2 → Type := λx.x.
26 definition Type_of_Type3: Type3 → Type := λx.x.
27 definition Type_of_Type4: Type4 → Type := λx.x.
28 coercion Type_of_Type0.
29 coercion Type_of_Type1.
30 coercion Type_of_Type2.
31 coercion Type_of_Type3.
32 coercion Type_of_Type4.
34 definition CProp0 : Type1 := Type0.
35 definition CProp1 : Type2 := Type1.
36 definition CProp2 : Type3 := Type2.
37 definition CProp3 : Type4 := Type3.
38 definition CProp_of_CProp0: CProp0 → CProp ≝ λx.x.
39 definition CProp_of_CProp1: CProp1 → CProp ≝ λx.x.
40 definition CProp_of_CProp2: CProp2 → CProp ≝ λx.x.
41 definition CProp_of_CProp3: CProp3 → CProp ≝ λx.x.
42 coercion CProp_of_CProp0.
43 coercion CProp_of_CProp1.
44 coercion CProp_of_CProp2.
45 coercion CProp_of_CProp3.
47 inductive Or (A,B:CProp0) : CProp0 ≝
51 interpretation "constructive or" 'or x y = (Or x y).
53 inductive Or3 (A,B,C:CProp0) : CProp0 ≝
54 | Left3 : A → Or3 A B C
55 | Middle3 : B → Or3 A B C
56 | Right3 : C → Or3 A B C.
58 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
60 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
62 inductive Or4 (A,B,C,D:CProp0) : CProp0 ≝
63 | Left3 : A → Or4 A B C D
64 | Middle3 : B → Or4 A B C D
65 | Right3 : C → Or4 A B C D
66 | Extra3: D → Or4 A B C D.
68 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
70 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
72 inductive And (A,B:CProp0) : CProp0 ≝
73 | Conj : A → B → And A B.
75 interpretation "constructive and" 'and x y = (And x y).
77 inductive And3 (A,B,C:CProp0) : CProp0 ≝
78 | Conj3 : A → B → C → And3 A B C.
80 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
82 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
84 inductive And42 (A,B,C,D:CProp2) : CProp2 ≝
85 | Conj42 : A → B → C → D → And42 A B C D.
87 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
89 interpretation "constructive quaternary and2" 'and4 x y z t = (And42 x y z t).
91 record Iff (A,B:CProp0) : CProp0 ≝
96 record Iff1 (A,B:CProp1) : CProp1 ≝
101 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
102 interpretation "logical iff" 'iff x y = (Iff x y).
103 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
105 inductive exT22 (A:Type2) (P:A→CProp2) : CProp2 ≝
106 ex_introT22: ∀w:A. P w → exT22 A P.
108 interpretation "CProp2 exists" 'exists \eta.x = (exT22 ? x).
110 definition pi1exT22 ≝ λA,P.λx:exT22 A P.match x with [ex_introT22 x _ ⇒ x].
111 definition pi2exT22 ≝
112 λA,P.λx:exT22 A P.match x return λx.P (pi1exT22 ?? x) with [ex_introT22 _ p ⇒ p].
114 interpretation "exT22 \fst" 'pi1 = (pi1exT22 ? ?).
115 interpretation "exT22 \snd" 'pi2 = (pi2exT22 ? ?).
116 interpretation "exT22 \fst a" 'pi1a x = (pi1exT22 ? ? x).
117 interpretation "exT22 \snd a" 'pi2a x = (pi2exT22 ? ? x).
118 interpretation "exT22 \fst b" 'pi1b x y = (pi1exT22 ? ? x y).
119 interpretation "exT22 \snd b" 'pi2b x y = (pi2exT22 ? ? x y).
121 inductive exT (A:Type0) (P:A→CProp0) : CProp0 ≝
122 ex_introT: ∀w:A. P w → exT A P.
124 interpretation "CProp exists" 'exists \eta.x = (exT ? x).
126 notation "\ll term 19 a, break term 19 b \gg"
127 with precedence 90 for @{'dependent_pair $a $b}.
128 interpretation "dependent pair" 'dependent_pair a b =
132 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
134 λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
136 interpretation "exT \fst" 'pi1 = (pi1exT ? ?).
137 interpretation "exT \fst a" 'pi1a x = (pi1exT ? ? x).
138 interpretation "exT \fst b" 'pi1b x y = (pi1exT ? ? x y).
139 interpretation "exT \snd" 'pi2 = (pi2exT ? ?).
140 interpretation "exT \snd a" 'pi2a x = (pi2exT ? ? x).
141 interpretation "exT \snd b" 'pi2b x y = (pi2exT ? ? x y).
143 inductive exT23 (A:Type0) (P:A→CProp0) (Q:A→CProp0) (R:A→A→CProp0) : CProp0 ≝
144 ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
146 definition pi1exT23 ≝
147 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
148 definition pi2exT23 ≝
149 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
151 interpretation "exT2 \fst" 'pi1 = (pi1exT23 ? ? ? ?).
152 interpretation "exT2 \snd" 'pi2 = (pi2exT23 ? ? ? ?).
153 interpretation "exT2 \fst a" 'pi1a x = (pi1exT23 ? ? ? ? x).
154 interpretation "exT2 \snd a" 'pi2a x = (pi2exT23 ? ? ? ? x).
155 interpretation "exT2 \fst b" 'pi1b x y = (pi1exT23 ? ? ? ? x y).
156 interpretation "exT2 \snd b" 'pi2b x y = (pi2exT23 ? ? ? ? x y).
158 inductive exT2 (A:Type0) (P,Q:A→CProp0) : CProp0 ≝
159 ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
162 definition Not : CProp0 → Prop ≝ λx:CProp.x → False.
164 interpretation "constructive not" 'not x = (Not x).
166 definition cotransitive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
167 λC:Type0.λlt:C→C→CProp0.∀x,y,z:C. lt x y → lt x z ∨ lt z y.
169 definition coreflexive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
170 λC:Type0.λlt:C→C→CProp0. ∀x:C. ¬ (lt x x).
172 definition symmetric: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
173 λC:Type0.λlt:C→C→CProp0. ∀x,y:C.lt x y → lt y x.
175 definition antisymmetric: ∀A:Type0. ∀R:A→A→CProp0. ∀eq:A→A→Prop.CProp0 ≝
176 λA:Type0.λR:A→A→CProp0.λeq:A→A→Prop.∀x:A.∀y:A.R x y→R y x→eq x y.
178 definition reflexive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝ λA:Type0.λR:A→A→CProp0.∀x:A.R x x.
180 definition transitive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝ λA:Type0.λR:A→A→CProp0.∀x,y,z:A.R x y → R y z → R x z.
182 definition reflexive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x:A.R x x.
183 definition symmetric1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λC:Type1.λlt:C→C→CProp1. ∀x,y:C.lt x y → lt y x.
184 definition transitive1: ∀A:Type1.∀R:A→A→CProp1.CProp1 ≝ λA:Type1.λR:A→A→CProp1.∀x,y,z:A.R x y → R y z → R x z.
186 definition reflexive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x:A.R x x.
187 definition symmetric2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λC:Type2.λlt:C→C→CProp2. ∀x,y:C.lt x y → lt y x.
188 definition transitive2: ∀A:Type2.∀R:A→A→CProp2.CProp2 ≝ λA:Type2.λR:A→A→CProp2.∀x,y,z:A.R x y → R y z → R x z.
190 definition reflexive3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λA:Type3.λR:A→A→CProp3.∀x:A.R x x.
191 definition symmetric3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λC:Type3.λlt:C→C→CProp3. ∀x,y:C.lt x y → lt y x.
192 definition transitive3: ∀A:Type3.∀R:A→A→CProp3.CProp3 ≝ λA:Type3.λR:A→A→CProp3.∀x,y,z:A.R x y → R y z → R x z.