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