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 inductive Or (A,B:CProp) : CProp ≝
21 interpretation "constructive or" 'or x y = (Or x y).
23 inductive Or3 (A,B,C:CProp) : CProp ≝
24 | Left3 : A → Or3 A B C
25 | Middle3 : B → Or3 A B C
26 | Right3 : C → Or3 A B C.
28 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
30 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
32 inductive Or4 (A,B,C,D:CProp) : CProp ≝
33 | Left3 : A → Or4 A B C D
34 | Middle3 : B → Or4 A B C D
35 | Right3 : C → Or4 A B C D
36 | Extra3: D → Or4 A B C D.
38 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
40 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
42 inductive And (A,B:CProp) : CProp ≝
43 | Conj : A → B → And A B.
45 interpretation "constructive and" 'and x y = (And x y).
47 inductive And3 (A,B,C:CProp) : CProp ≝
48 | Conj3 : A → B → C → And3 A B C.
50 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
52 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
54 inductive And4 (A,B,C,D:CProp) : CProp ≝
55 | Conj4 : A → B → C → D → And4 A B C D.
57 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
59 interpretation "constructive quaternary and" 'and4 x y z t = (And4 x y z t).
61 record Iff (A,B:CProp) : CProp ≝
66 record Iff1 (A,B:CProp) : CProp ≝
71 interpretation "logical iff" 'iff x y = (Iff x y).
73 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
74 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
76 inductive exT (A:Type) (P:A→CProp) : CProp ≝
77 ex_introT: ∀w:A. P w → exT A P.
79 interpretation "CProp exists" 'exists x = (exT ? x).
81 notation "\ll term 19 a, break term 19 b \gg"
82 with precedence 90 for @{'dependent_pair $a $b}.
83 interpretation "dependent pair" 'dependent_pair a b = (ex_introT ?? a b).
85 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
87 interpretation "exT \fst" 'pi1 = (pi1exT ? ?).
88 interpretation "exT \fst" 'pi1a x = (pi1exT ? ? x).
89 interpretation "exT \fst" 'pi1b x y = (pi1exT ? ? x y).
92 λA,P.λx:exT A P.match x return λx.P (pi1exT ? ? x) with [ex_introT _ p ⇒ p].
94 interpretation "exT \snd" 'pi2 = (pi2exT ? ?).
95 interpretation "exT \snd" 'pi2a x = (pi2exT ? ? x).
96 interpretation "exT \snd" 'pi2b x y = (pi2exT ? ? x y).
98 inductive exP (A:Type) (P:A→Prop) : CProp ≝
99 ex_introP: ∀w:A. P w → exP A P.
101 interpretation "dependent pair for Prop" 'dependent_pair a b =
104 interpretation "CProp exists for Prop" 'exists x = (exP ? x).
106 definition pi1exP ≝ λA,P.λx:exP A P.match x with [ex_introP x _ ⇒ x].
108 interpretation "exP \fst" 'pi1 = (pi1exP ? ?).
109 interpretation "exP \fst" 'pi1a x = (pi1exP ? ? x).
110 interpretation "exP \fst" 'pi1b x y = (pi1exP ? ? x y).
113 λA,P.λx:exP A P.match x return λx.P (pi1exP ?? x) with [ex_introP _ p ⇒ p].
115 interpretation "exP \snd" 'pi2 = (pi2exP ? ?).
116 interpretation "exP \snd" 'pi2a x = (pi2exP ? ? x).
117 interpretation "exP \snd" 'pi2b x y = (pi2exP ? ? x y).
119 inductive exT23 (A:Type) (P:A→CProp) (Q:A→CProp) (R:A→A→CProp) : CProp ≝
120 ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
122 definition pi1exT23 ≝
123 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
125 interpretation "exT2 \fst" 'pi1 = (pi1exT23 ? ? ? ?).
126 interpretation "exT2 \fst" 'pi1a x = (pi1exT23 ? ? ? ? x).
127 interpretation "exT2 \fst" 'pi1b x y = (pi1exT23 ? ? ? ? x y).
129 definition pi2exT23 ≝
130 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
132 interpretation "exT2 \snd" 'pi2 = (pi2exT23 ? ? ? ?).
133 interpretation "exT2 \snd" 'pi2a x = (pi2exT23 ? ? ? ? x).
134 interpretation "exT2 \snd" 'pi2b x y = (pi2exT23 ? ? ? ? x y).
136 inductive exT2 (A:Type) (P,Q:A→CProp) : CProp ≝
137 ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
139 definition Not : CProp → Prop ≝ λx:CProp.x → False.
141 interpretation "constructive not" 'not x = (Not x).
143 definition cotransitive ≝
144 λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y.
146 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
148 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
150 definition antisymmetric ≝ λA:Type.λR:A→A→CProp.λeq:A→A→Prop.∀x:A.∀y:A.R x y→R y x→eq x y.
152 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
154 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.