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 "basics/pts.ma".
17 inductive False: CProp[0] ≝.
19 inductive Or (A,B:CProp[0]) : CProp[0] ≝
23 interpretation "constructive or" 'or x y = (Or x y).
25 inductive Or3 (A,B,C:CProp[0]) : CProp[0] ≝
26 | Left3 : A → Or3 A B C
27 | Middle3 : B → Or3 A B C
28 | Right3 : C → Or3 A B C.
30 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
32 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
34 inductive Or4 (A,B,C,D:CProp[0]) : CProp[0] ≝
35 | Left3 : A → Or4 A B C D
36 | Middle3 : B → Or4 A B C D
37 | Right3 : C → Or4 A B C D
38 | Extra3: D → Or4 A B C D.
40 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
42 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
44 inductive And (A,B:CProp[0]) : CProp[0] ≝
45 | Conj : A → B → And A B.
47 interpretation "constructive and" 'and x y = (And x y).
49 inductive And3 (A,B,C:CProp[0]) : CProp[0] ≝
50 | Conj3 : A → B → C → And3 A B C.
52 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
54 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
56 inductive And42 (A,B,C,D:CProp[2]) : CProp[2] ≝
57 | Conj42 : A → B → C → D → And42 A B C D.
59 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
61 interpretation "constructive quaternary and2" 'and4 x y z t = (And42 x y z t).
63 record Iff (A,B:CProp[0]) : CProp[0] ≝
68 record Iff1 (A,B:CProp[1]) : CProp[1] ≝
73 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
74 interpretation "logical iff" 'iff x y = (Iff x y).
75 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
77 inductive exT22 (A:Type[2]) (P:A→CProp[2]) : CProp[2] ≝
78 ex_introT22: ∀w:A. P w → exT22 A P.
80 interpretation "CProp[2] exists" 'exists \eta.x = (exT22 ? x).
82 definition pi1exT22 ≝ λA,P.λx:exT22 A P.match x with [ex_introT22 x _ ⇒ x].
84 λA,P.λx:exT22 A P.match x return λx.P (pi1exT22 ?? x) with [ex_introT22 _ p ⇒ p].
86 interpretation "exT22 \fst" 'pi1 = (pi1exT22 ? ?).
87 interpretation "exT22 \snd" 'pi2 = (pi2exT22 ? ?).
88 interpretation "exT22 \fst a" 'pi1a x = (pi1exT22 ? ? x).
89 interpretation "exT22 \snd a" 'pi2a x = (pi2exT22 ? ? x).
90 interpretation "exT22 \fst b" 'pi1b x y = (pi1exT22 ? ? x y).
91 interpretation "exT22 \snd b" 'pi2b x y = (pi2exT22 ? ? x y).
93 inductive exT (A:Type[0]) (P:A→CProp[0]) : CProp[0] ≝
94 ex_introT: ∀w:A. P w → exT A P.
96 interpretation "CProp exists" 'exists \eta.x = (exT ? x).
98 notation "\ll term 19 a, break term 19 b \gg"
99 with precedence 90 for @{'dependent_pair $a $b}.
100 interpretation "dependent pair" 'dependent_pair a b =
104 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
106 λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
108 interpretation "exT \fst" 'pi1 = (pi1exT ? ?).
109 interpretation "exT \fst a" 'pi1a x = (pi1exT ? ? x).
110 interpretation "exT \fst b" 'pi1b x y = (pi1exT ? ? x y).
111 interpretation "exT \snd" 'pi2 = (pi2exT ? ?).
112 interpretation "exT \snd a" 'pi2a x = (pi2exT ? ? x).
113 interpretation "exT \snd b" 'pi2b x y = (pi2exT ? ? x y).
115 inductive exT23 (A:Type[0]) (P:A→CProp[0]) (Q:A→CProp[0]) (R:A→A→CProp[0]) : CProp[0] ≝
116 ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
118 definition pi1exT23 ≝
119 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
120 definition pi2exT23 ≝
121 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
123 interpretation "exT2 \fst" 'pi1 = (pi1exT23 ? ? ? ?).
124 interpretation "exT2 \snd" 'pi2 = (pi2exT23 ? ? ? ?).
125 interpretation "exT2 \fst a" 'pi1a x = (pi1exT23 ? ? ? ? x).
126 interpretation "exT2 \snd a" 'pi2a x = (pi2exT23 ? ? ? ? x).
127 interpretation "exT2 \fst b" 'pi1b x y = (pi1exT23 ? ? ? ? x y).
128 interpretation "exT2 \snd b" 'pi2b x y = (pi2exT23 ? ? ? ? x y).
130 inductive exT2 (A:Type[0]) (P,Q:A→CProp[0]) : CProp[0] ≝
131 ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
134 definition Not : CProp[0] → CProp[0] ≝ λx:CProp[0].x → False.
136 interpretation "constructive not" 'not x = (Not x).
138 definition cotransitive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
139 λC:Type[0].λlt:C→C→CProp[0].∀x,y,z:C. lt x y → lt x z ∨ lt z y.
141 definition coreflexive: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
142 λC:Type[0].λlt:C→C→CProp[0]. ∀x:C. ¬ (lt x x).
144 definition symmetric: ∀C:Type[0]. ∀lt:C→C→CProp[0].CProp[0] ≝
145 λC:Type[0].λlt:C→C→CProp[0]. ∀x,y:C.lt x y → lt y x.
147 definition antisymmetric: ∀A:Type[0]. ∀R:A→A→CProp[0]. ∀eq:A→A→Prop.CProp[0] ≝
148 λ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.
150 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.
152 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.
154 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.
155 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.
156 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.
158 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.
159 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.
160 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.
162 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.
163 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.
164 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.