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 interpretation "constructive logical false" 'false = False.
21 inductive True: CProp[0] ≝
24 interpretation "constructive logical true" 'true = True.
26 inductive Or (A,B:CProp[0]) : CProp[0] ≝
30 interpretation "constructive or" 'or x y = (Or x y).
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.
37 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
39 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
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.
47 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
49 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
51 inductive And (A,B:CProp[0]) : CProp[0] ≝
52 | Conj : A → B → And A B.
54 interpretation "constructive and" 'and x y = (And x y).
56 inductive And3 (A,B,C:CProp[0]) : CProp[0] ≝
57 | Conj3 : A → B → C → And3 A B C.
59 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
61 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
63 inductive And42 (A,B,C,D:CProp[2]) : CProp[2] ≝
64 | Conj42 : A → B → C → D → And42 A B C D.
66 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
68 interpretation "constructive quaternary and2" 'and4 x y z t = (And42 x y z t).
70 record Iff (A,B:CProp[0]) : CProp[0] ≝
75 record Iff1 (A,B:CProp[1]) : CProp[1] ≝
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).
84 inductive exT22 (A:Type[2]) (P:A→CProp[2]) : CProp[2] ≝
85 ex_introT22: ∀w:A. P w → exT22 A P.
87 interpretation "CProp[2] exists" 'exists \eta.x = (exT22 ? x).
89 definition pi1exT22 ≝ λA,P.λx:exT22 A P.match x with [ex_introT22 x _ ⇒ x].
91 λA,P.λx:exT22 A P.match x return λx.P (pi1exT22 ?? x) with [ex_introT22 _ p ⇒ p].
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).
100 inductive exT (A:Type[0]) (P:A→CProp[0]) : CProp[0] ≝
101 ex_introT: ∀w:A. P w → exT A P.
103 interpretation "CProp exists" 'exists \eta.x = (exT ? x).
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 =
111 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
113 λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
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).
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.
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].
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).
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.
141 definition Not : CProp[0] → CProp[0] ≝ λx:CProp[0].x → ⊥.
143 interpretation "constructive not" 'not x = (Not x).
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.
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).
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.
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.
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.
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.
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.
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.
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.