]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/formal_topology/overlap/o-basic_pairs.ma
Additional contribs.
[helm.git] / helm / software / matita / contribs / formal_topology / overlap / o-basic_pairs.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 "o-algebra.ma".
16 include "notation.ma".
17
18 record Obasic_pair: Type2 ≝
19  { Oconcr: OA;
20    Oform: OA;
21    Orel: arrows2 ? Oconcr Oform
22  }.
23
24 (* FIX *)
25 interpretation "o-basic pair relation indexed" 'Vdash2 x y c = (Orel c x y).
26 interpretation "o-basic pair relation (non applied)" 'Vdash c = (Orel c).
27
28 alias symbol "eq" = "setoid1 eq".
29 alias symbol "compose" = "category1 composition".
30 (*DIFFER*)
31
32 alias symbol "eq" = "setoid2 eq".
33 alias symbol "compose" = "category2 composition".
34 record Orelation_pair (BP1,BP2: Obasic_pair): Type2 ≝
35  { Oconcr_rel: arrows2 ? (Oconcr BP1) (Oconcr BP2);
36    Oform_rel: arrows2 ? (Oform BP1) (Oform BP2);
37    Ocommute: ⊩ ∘ Oconcr_rel = Oform_rel ∘ ⊩
38  }.
39  
40 (* FIX *)
41 interpretation "o-concrete relation" 'concr_rel r = (Oconcr_rel ?? r). 
42 interpretation "o-formal relation" 'form_rel r = (Oform_rel ?? r). 
43
44 definition Orelation_pair_equality:
45  ∀o1,o2. equivalence_relation2 (Orelation_pair o1 o2).
46  intros;
47  constructor 1;
48   [ apply (λr,r'. ⊩ ∘ r \sub\c = ⊩ ∘ r' \sub\c);
49   | simplify;
50     intros;
51     apply refl2;
52   | simplify;
53     intros 2;
54     apply sym2;
55   | simplify;
56     intros 3;
57     apply trans2;
58   ]      
59 qed.
60
61 (* qui setoid1 e' giusto: ma non lo e'!!! *)
62 definition Orelation_pair_setoid: Obasic_pair → Obasic_pair → setoid2.
63  intros;
64  constructor 1;
65   [ apply (Orelation_pair o o1)
66   | apply Orelation_pair_equality
67   ]
68 qed.
69
70 definition Orelation_pair_of_Orelation_pair_setoid: 
71   ∀P,Q. Orelation_pair_setoid P Q → Orelation_pair P Q ≝ λP,Q,x.x.
72 coercion Orelation_pair_of_Orelation_pair_setoid.
73
74 lemma eq_to_eq': ∀o1,o2.∀r,r': Orelation_pair_setoid o1 o2. r=r' → r \sub\f ∘ ⊩ = r'\sub\f ∘ ⊩.
75  intros 5 (o1 o2 r r' H); change in H with (⊩ ∘ r\sub\c = ⊩ ∘ r'\sub\c);
76  apply (.= ((Ocommute ?? r) ^ -1));
77  apply (.= H);
78  apply (.= (Ocommute ?? r'));
79  apply refl2;
80 qed.
81
82
83 definition Oid_relation_pair: ∀o:Obasic_pair. Orelation_pair o o.
84  intro;
85  constructor 1;
86   [1,2: apply id2;
87   | lapply (id_neutral_right2 ? (Oconcr o) ? (⊩)) as H;
88     lapply (id_neutral_left2 ?? (Oform o) (⊩)) as H1;
89     apply (.= H);
90     apply (H1 \sup -1);]
91 qed.
92
93 lemma Orelation_pair_composition:
94  ∀o1,o2,o3:Obasic_pair.
95  Orelation_pair_setoid o1 o2 → Orelation_pair_setoid o2 o3→Orelation_pair_setoid o1 o3.
96 intros 3 (o1 o2 o3);
97    intros (r r1);
98     constructor 1;
99      [ apply (r1 \sub\c ∘ r \sub\c) 
100      | apply (r1 \sub\f ∘ r \sub\f)
101      | lapply (Ocommute ?? r) as H;
102        lapply (Ocommute ?? r1) as H1;
103        apply rule (.= ASSOC);
104        apply (.= #‡H1);
105        apply rule (.= ASSOC ^ -1);
106        apply (.= H‡#);
107        apply rule ASSOC]
108 qed.
109
110
111 lemma Orelation_pair_composition_is_morphism:
112   ∀o1,o2,o3:Obasic_pair.
113   Πa,a':Orelation_pair_setoid o1 o2.Πb,b':Orelation_pair_setoid o2 o3.
114    a=a' →b=b' →
115       Orelation_pair_composition o1 o2 o3 a b
116       = Orelation_pair_composition o1 o2 o3 a' b'.
117 intros;
118     change with (⊩ ∘ (b\sub\c ∘ a\sub\c) = ⊩ ∘ (b'\sub\c ∘ a'\sub\c));  
119     change in e with (⊩ ∘ a \sub\c = ⊩ ∘ a' \sub\c);
120     change in e1 with (⊩ ∘ b \sub\c = ⊩ ∘ b' \sub\c);
121     apply rule (.= ASSOC);
122     apply (.= #‡e1);
123     apply (.= #‡(Ocommute ?? b'));
124     apply rule (.= ASSOC \sup -1);
125     apply (.= e‡#);
126     apply rule (.= ASSOC);
127     apply (.= #‡(Ocommute ?? b')\sup -1);
128     apply rule (ASSOC \sup -1);
129 qed.
130
131 definition Orelation_pair_composition_morphism:
132  ∀o1,o2,o3. binary_morphism2 (Orelation_pair_setoid o1 o2) (Orelation_pair_setoid o2 o3) (Orelation_pair_setoid o1 o3).
133 intros; constructor 1;
134 [ apply Orelation_pair_composition;
135 | apply Orelation_pair_composition_is_morphism;]
136 qed.
137
138 lemma Orelation_pair_composition_morphism_assoc:
139 ∀o1,o2,o3,o4:Obasic_pair
140    .Πa12:Orelation_pair_setoid o1 o2
141     .Πa23:Orelation_pair_setoid o2 o3
142      .Πa34:Orelation_pair_setoid o3 o4
143       .Orelation_pair_composition_morphism o1 o3 o4
144        (Orelation_pair_composition_morphism o1 o2 o3 a12 a23) a34
145        =Orelation_pair_composition_morphism o1 o2 o4 a12
146         (Orelation_pair_composition_morphism o2 o3 o4 a23 a34).  
147    intros;
148     change with (⊩ ∘ (a34\sub\c ∘ (a23\sub\c ∘ a12\sub\c)) =
149                  ⊩ ∘ ((a34\sub\c ∘ a23\sub\c) ∘ a12\sub\c));
150     apply rule (ASSOC‡#);
151 qed.
152
153 lemma Orelation_pair_composition_morphism_respects_id:
154 Πo1:Obasic_pair
155 .Πo2:Obasic_pair
156  .Πa:Orelation_pair_setoid o1 o2
157   .Orelation_pair_composition_morphism o1 o1 o2 (Oid_relation_pair o1) a=a.
158    intros;
159     change with (⊩ ∘ (a\sub\c ∘ (Oid_relation_pair o1)\sub\c) = ⊩ ∘ a\sub\c);
160     apply ((id_neutral_right2 ????)‡#);
161 qed.
162
163 lemma Orelation_pair_composition_morphism_respects_id_r:
164 Πo1:Obasic_pair
165 .Πo2:Obasic_pair
166  .Πa:Orelation_pair_setoid o1 o2
167   .Orelation_pair_composition_morphism o1 o2 o2 a (Oid_relation_pair o2)=a.
168 intros;
169     change with (⊩ ∘ ((Oid_relation_pair o2)\sub\c ∘ a\sub\c) = ⊩ ∘ a\sub\c);
170     apply ((id_neutral_left2 ????)‡#);
171 qed.
172
173 definition OBP: category2.
174  constructor 1;
175   [ apply Obasic_pair
176   | apply Orelation_pair_setoid
177   | apply Oid_relation_pair
178   | apply Orelation_pair_composition_morphism
179   | apply Orelation_pair_composition_morphism_assoc;
180   | apply Orelation_pair_composition_morphism_respects_id;
181   | apply Orelation_pair_composition_morphism_respects_id_r;]
182 qed.
183
184 definition Obasic_pair_of_objs2_OBP: objs2 OBP → Obasic_pair ≝ λx.x.
185 coercion Obasic_pair_of_objs2_OBP.
186
187 definition Orelation_pair_setoid_of_arrows2_OBP: 
188   ∀P,Q.arrows2 OBP P Q → Orelation_pair_setoid P Q ≝ λP,Q,c.c.
189 coercion Orelation_pair_setoid_of_arrows2_OBP.
190
191 (*
192 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o).
193  intros; constructor 1;
194   [ apply (ext ? ? (rel o));
195   | intros;
196     apply (.= #‡H);
197     apply refl1]
198 qed.
199
200 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
201  λo.extS ?? (rel o).
202 *)
203
204 (*
205 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
206  intros (o); constructor 1;
207   [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
208     intros; simplify; apply (.= (†H)‡#); apply refl1
209   | intros; split; simplify; intros;
210      [ apply (. #‡((†H)‡(†H1))); assumption
211      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
212 qed.
213
214 interpretation "fintersects" 'fintersects U V = (fun1 ??? (fintersects ?) U V).
215
216 definition fintersectsS:
217  ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
218  intros (o); constructor 1;
219   [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
220     intros; simplify; apply (.= (†H)‡#); apply refl1
221   | intros; split; simplify; intros;
222      [ apply (. #‡((†H)‡(†H1))); assumption
223      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
224 qed.
225
226 interpretation "fintersectsS" 'fintersects U V = (fun1 ??? (fintersectsS ?) U V).
227 *)
228
229 (*
230 definition relS: ∀o: BP. binary_morphism1 (concr o) (Ω \sup (form o)) CPROP.
231  intros (o); constructor 1;
232   [ apply (λx:concr o.λS: Ω \sup (form o).∃y: form o.y ∈ S ∧ x ⊩ y);
233   | intros; split; intros; cases H2; exists [1,3: apply w]
234      [ apply (. (#‡H1)‡(H‡#)); assumption
235      | apply (. (#‡H1 \sup -1)‡(H \sup -1‡#)); assumption]]
236 qed.
237
238 interpretation "basic pair relation for subsets" 'Vdash2 x y = (fun1 (concr ?) ?? (relS ?) x y).
239 interpretation "basic pair relation for subsets (non applied)" 'Vdash = (fun1 ??? (relS ?)).
240 *)
241
242 notation "□ \sub b" non associative with precedence 90 for @{'box $b}.
243 notation > "□⎽term 90 b" non associative with precedence 90 for @{'box $b}.
244 interpretation "Universal image ⊩⎻*" 'box x = (fun12 ? ? (or_f_minus_star ? ?) (Orel x)).
245  
246 notation "◊ \sub b" non associative with precedence 90 for @{'diamond $b}.
247 notation > "◊⎽term 90 b" non associative with precedence 90 for @{'diamond $b}.
248 interpretation "Existential image ⊩" 'diamond x = (fun12 ? ? (or_f ? ?) (Orel x)).
249
250 notation "'Rest' \sub b" non associative with precedence 90 for @{'rest $b}.
251 notation > "'Rest'⎽term 90 b" non associative with precedence 90 for @{'rest $b}.
252 interpretation "Universal pre-image ⊩*" 'rest x = (fun12 ? ? (or_f_star ? ?) (Orel x)).
253
254 notation "'Ext' \sub b" non associative with precedence 90 for @{'ext $b}.
255 notation > "'Ext'⎽term 90 b" non associative with precedence 90 for @{'ext $b}.
256 interpretation "Existential pre-image ⊩⎻" 'ext x = (fun12 ? ? (or_f_minus ? ?) (Orel x)).