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