]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/formal_topology/overlap/cprop_connectives.ma
1. new coercion(s) from CPropi to CProp
[helm.git] / helm / software / matita / contribs / formal_topology / overlap / 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 "logic/connectives.ma".
16
17 definition Type3 : Type := Type.
18 definition Type2 : Type3 := Type.
19 definition Type1 : Type2 := Type.
20 definition Type0 : Type1 := Type.
21
22 definition Type_of_Type0: Type0 → Type := λx.x.
23 definition Type_of_Type1: Type1 → Type := λx.x.
24 definition Type_of_Type2: Type2 → Type := λx.x.
25 definition Type_of_Type3: Type3 → Type := λx.x.
26 coercion Type_of_Type0.
27 coercion Type_of_Type1.
28 coercion Type_of_Type2.
29 coercion Type_of_Type3.
30
31 definition CProp0 : Type1 := Type0.
32 definition CProp1 : Type2 := Type1.
33 definition CProp2 : Type3 := Type2.
34 definition CProp_of_CProp0: CProp0 → CProp ≝ λx.x.
35 definition CProp_of_CProp1: CProp1 → CProp ≝ λx.x.
36 definition CProp_of_CProp2: CProp2 → CProp ≝ λx.x.
37 coercion CProp_of_CProp0.
38 coercion CProp_of_CProp1.
39 coercion CProp_of_CProp2.
40
41 inductive Or (A,B:CProp0) : CProp0 ≝
42  | Left : A → Or A B
43  | Right : B → Or A B.
44
45 interpretation "constructive or" 'or x y = (Or x y).
46
47 inductive Or3 (A,B,C:CProp0) : CProp0 ≝
48  | Left3 : A → Or3 A B C
49  | Middle3 : B → Or3 A B C
50  | Right3 : C → Or3 A B C.
51
52 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
53
54 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
55
56 inductive Or4 (A,B,C,D:CProp0) : CProp0 ≝
57  | Left3 : A → Or4 A B C D
58  | Middle3 : B → Or4 A B C D
59  | Right3 : C → Or4 A B C D
60  | Extra3: D → Or4 A B C D.
61
62 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
63
64 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
65
66 inductive And (A,B:CProp0) : CProp0 ≝
67  | Conj : A → B → And A B.
68  
69 interpretation "constructive and" 'and x y = (And x y).
70
71 inductive And3 (A,B,C:CProp0) : CProp0 ≝
72  | Conj3 : A → B → C → And3 A B C.
73
74 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
75  
76 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
77
78 inductive And42 (A,B,C,D:CProp2) : CProp2 ≝
79  | Conj42 : A → B → C → D → And42 A B C D.
80
81 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
82  
83 interpretation "constructive quaternary and2" 'and4 x y z t = (And42 x y z t).
84
85 record Iff (A,B:CProp0) : CProp0 ≝
86  { if: A → B;
87    fi: B → A
88  }.
89  
90 record Iff1 (A,B:CProp1) : CProp1 ≝
91  { if1: A → B;
92    fi1: B → A
93  }.
94  
95 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
96 interpretation "logical iff" 'iff x y = (Iff x y).
97 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
98
99 inductive exT (A:Type0) (P:A→CProp0) : CProp0 ≝
100   ex_introT: ∀w:A. P w → exT A P.
101
102 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
103
104 notation "\ll term 19 a, break term 19 b \gg" 
105 with precedence 90 for @{'dependent_pair $a $b}.
106 interpretation "dependent pair" 'dependent_pair a b = 
107   (ex_introT _ _ a b).
108
109
110 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
111 definition pi2exT ≝ 
112   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
113
114 interpretation "exT \fst" 'pi1 = (pi1exT _ _).
115 interpretation "exT \fst" 'pi1a x = (pi1exT _ _ x).
116 interpretation "exT \fst" 'pi1b x y = (pi1exT _ _ x y).
117 interpretation "exT \snd" 'pi2 = (pi2exT _ _).
118 interpretation "exT \snd" 'pi2a x = (pi2exT _ _ x).
119 interpretation "exT \snd" 'pi2b x y = (pi2exT _ _ x y).
120
121 inductive exT23 (A:Type0) (P:A→CProp0) (Q:A→CProp0) (R:A→A→CProp0) : CProp0 ≝
122   ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
123
124 definition pi1exT23 ≝
125   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
126 definition pi2exT23 ≝
127   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
128
129 interpretation "exT2 \fst" 'pi1 = (pi1exT23 _ _ _ _).
130 interpretation "exT2 \snd" 'pi2 = (pi2exT23 _ _ _ _).   
131 interpretation "exT2 \fst" 'pi1a x = (pi1exT23 _ _ _ _ x).
132 interpretation "exT2 \snd" 'pi2a x = (pi2exT23 _ _ _ _ x).
133 interpretation "exT2 \fst" 'pi1b x y = (pi1exT23 _ _ _ _ x y).
134 interpretation "exT2 \snd" 'pi2b x y = (pi2exT23 _ _ _ _ x y).
135
136 inductive exT2 (A:Type0) (P,Q:A→CProp0) : CProp0 ≝
137   ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
138
139 definition Not : CProp0 → Prop ≝ λx:CProp.x → False.
140
141 interpretation "constructive not" 'not x = (Not x).
142   
143 definition cotransitive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
144  λC:Type0.λlt:C→C→CProp0.∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
145
146 definition coreflexive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
147  λC:Type0.λlt:C→C→CProp0. ∀x:C. ¬ (lt x x).
148
149 definition symmetric: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝
150  λC:Type0.λlt:C→C→CProp0. ∀x,y:C.lt x y → lt y x.
151
152 definition antisymmetric: ∀A:Type0. ∀R:A→A→CProp0. ∀eq:A→A→Prop.CProp0 ≝
153  λA:Type0.λR:A→A→CProp0.λeq:A→A→Prop.∀x:A.∀y:A.R x y→R y x→eq x y.
154
155 definition reflexive: ∀C:Type0. ∀lt:C→C→CProp0.CProp0 ≝ λA:Type0.λR:A→A→CProp0.∀x:A.R x x.
156
157 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.