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