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