]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/formal_topology/overlap/o-basic_pairs.ma
SUBSETS_full up to universe inconsistency
[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
17 record basic_pair: Type2 ≝
18  { concr: OA;
19    form: OA;
20    rel: arrows2 ? concr form
21  }.
22
23 interpretation "basic pair relation indexed" 'Vdash2 x y c = (rel c x y).
24 interpretation "basic pair relation (non applied)" 'Vdash c = (rel c).
25
26 alias symbol "eq" = "setoid1 eq".
27 alias symbol "compose" = "category1 composition".
28 (*DIFFER*)
29
30 alias symbol "eq" = "setoid2 eq".
31 alias symbol "compose" = "category2 composition".
32 record relation_pair (BP1,BP2: basic_pair): Type2 ≝
33  { concr_rel: arrows2 ? (concr BP1) (concr BP2);
34    form_rel: arrows2 ? (form BP1) (form BP2);
35    commute: ⊩ ∘ concr_rel = form_rel ∘ ⊩
36  }.
37
38 notation "hvbox (r \sub \c)"  with precedence 90 for @{'concr_rel $r}.
39 notation "hvbox (r \sub \f)"  with precedence 90 for @{'form_rel $r}.
40
41 interpretation "concrete relation" 'concr_rel r = (concr_rel __ r). 
42 interpretation "formal relation" 'form_rel r = (form_rel __ r). 
43
44 definition relation_pair_equality:
45  ∀o1,o2. equivalence_relation2 (relation_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 relation_pair_setoid: basic_pair → basic_pair → setoid2.
63  intros;
64  constructor 1;
65   [ apply (relation_pair b b1)
66   | apply relation_pair_equality
67   ]
68 qed.
69
70 definition relation_pair_of_relation_pair_setoid: 
71   ∀P,Q. relation_pair_setoid P Q → relation_pair P Q ≝ λP,Q,x.x.
72 coercion relation_pair_of_relation_pair_setoid.
73
74 lemma eq_to_eq': ∀o1,o2.∀r,r': relation_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 (.= ((commute ?? r) \sup -1));
77  apply (.= H);
78  apply (.= (commute ?? r'));
79  apply refl2;
80 qed.
81
82
83 definition id_relation_pair: ∀o:basic_pair. relation_pair o o.
84  intro;
85  constructor 1;
86   [1,2: apply id2;
87   | lapply (id_neutral_right2 ? (concr o) ? (⊩)) as H;
88     lapply (id_neutral_left2 ?? (form o) (⊩)) as H1;
89     apply (.= H);
90     apply (H1 \sup -1);]
91 qed.
92
93 definition relation_pair_composition:
94  ∀o1,o2,o3. binary_morphism2 (relation_pair_setoid o1 o2) (relation_pair_setoid o2 o3) (relation_pair_setoid o1 o3).
95  intros;
96  constructor 1;
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 (commute ?? r) as H;
102        lapply (commute ?? r1) as H1;
103        apply rule (.= ASSOC);
104        apply (.= #‡H1);
105        apply rule (.= ASSOC ^ -1);
106        apply (.= H‡#);
107        apply rule ASSOC]
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 (.= #‡(commute ?? b'));
115     apply rule (.= ASSOC \sup -1);
116     apply (.= e‡#);
117     apply rule (.= ASSOC);
118     apply (.= #‡(commute ?? b')\sup -1);
119     apply rule (ASSOC \sup -1)]
120 qed.
121     
122 definition BP: category2.
123  constructor 1;
124   [ apply basic_pair
125   | apply relation_pair_setoid
126   | apply id_relation_pair
127   | apply relation_pair_composition
128   | intros;
129     change with (⊩ ∘ (a34\sub\c ∘ (a23\sub\c ∘ a12\sub\c)) =
130                  ⊩ ∘ ((a34\sub\c ∘ a23\sub\c) ∘ a12\sub\c));
131     apply rule (ASSOC‡#);
132   | intros;
133     change with (⊩ ∘ (a\sub\c ∘ (id_relation_pair o1)\sub\c) = ⊩ ∘ a\sub\c);
134     apply ((id_neutral_right2 ????)‡#);
135   | intros;
136     change with (⊩ ∘ ((id_relation_pair o2)\sub\c ∘ a\sub\c) = ⊩ ∘ a\sub\c);
137     apply ((id_neutral_left2 ????)‡#);]
138 qed.
139
140 definition basic_pair_of_objs2_BP: objs2 BP → basic_pair ≝ λx.x.
141 coercion basic_pair_of_objs2_BP.
142
143 definition relation_pair_setoid_of_arrows2_BP: 
144   ∀P,Q.arrows2 BP P Q → relation_pair_setoid P Q ≝ λP,Q,c.c.
145 coercion relation_pair_setoid_of_arrows2_BP.
146
147 (*
148 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o).
149  intros; constructor 1;
150   [ apply (ext ? ? (rel o));
151   | intros;
152     apply (.= #‡H);
153     apply refl1]
154 qed.
155
156 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
157  λo.extS ?? (rel o).
158 *)
159
160 (*
161 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
162  intros (o); constructor 1;
163   [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
164     intros; simplify; apply (.= (†H)‡#); apply refl1
165   | intros; split; simplify; intros;
166      [ apply (. #‡((†H)‡(†H1))); assumption
167      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
168 qed.
169
170 interpretation "fintersects" 'fintersects U V = (fun1 ___ (fintersects _) U V).
171
172 definition fintersectsS:
173  ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
174  intros (o); constructor 1;
175   [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
176     intros; simplify; apply (.= (†H)‡#); apply refl1
177   | intros; split; simplify; intros;
178      [ apply (. #‡((†H)‡(†H1))); assumption
179      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
180 qed.
181
182 interpretation "fintersectsS" 'fintersects U V = (fun1 ___ (fintersectsS _) U V).
183 *)
184
185 (*
186 definition relS: ∀o: BP. binary_morphism1 (concr o) (Ω \sup (form o)) CPROP.
187  intros (o); constructor 1;
188   [ apply (λx:concr o.λS: Ω \sup (form o).∃y: form o.y ∈ S ∧ x ⊩ y);
189   | intros; split; intros; cases H2; exists [1,3: apply w]
190      [ apply (. (#‡H1)‡(H‡#)); assumption
191      | apply (. (#‡H1 \sup -1)‡(H \sup -1‡#)); assumption]]
192 qed.
193
194 interpretation "basic pair relation for subsets" 'Vdash2 x y = (fun1 (concr _) __ (relS _) x y).
195 interpretation "basic pair relation for subsets (non applied)" 'Vdash = (fun1 ___ (relS _)).
196 *)
197
198 notation "□ \sub b" non associative with precedence 90 for @{'box $b}.
199 notation > "□_term 90 b" non associative with precedence 90 for @{'box $b}.
200 interpretation "Universal image ⊩⎻*" 'box x = (fun12 _ _ (or_f_minus_star _ _) (rel x)).
201  
202 notation "◊ \sub b" non associative with precedence 90 for @{'diamond $b}.
203 notation > "◊_term 90 b" non associative with precedence 90 for @{'diamond $b}.
204 interpretation "Existential image ⊩" 'diamond x = (fun12 _ _ (or_f _ _) (rel x)).
205
206 notation "'Rest' \sub b" non associative with precedence 90 for @{'rest $b}.
207 notation > "'Rest'⎽term 90 b" non associative with precedence 90 for @{'rest $b}.
208 interpretation "Universal pre-image ⊩*" 'rest x = (fun12 _ _ (or_f_star _ _) (rel x)).
209
210 notation "'Ext' \sub b" non associative with precedence 90 for @{'ext $b}.
211 notation > "'Ext'⎽term 90 b" non associative with precedence 90 for @{'ext $b}.
212 interpretation "Existential pre-image ⊩⎻" 'ext x = (fun12 _ _ (or_f_minus _ _) (rel x)).