]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/formal_topology/overlap/o-basic_pairs.ma
foo overlap
[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 "datatypes/categories.ma".
17
18 record basic_pair: Type ≝
19  { concr: OA;
20    form: OA;
21    rel: arrows1 ? concr form
22  }.
23
24 notation > "x ⊩ y" with precedence 45 for @{'Vdash2 $x $y ?}.
25 notation < "x (⊩  \below c) y" with precedence 45 for @{'Vdash2 $x $y $c}.
26 notation < "⊩ \sub c" with precedence 60 for @{'Vdash $c}.
27 notation > "⊩ " with precedence 60 for @{'Vdash ?}.
28
29 interpretation "basic pair relation indexed" 'Vdash2 x y c = (rel c x y).
30 interpretation "basic pair relation (non applied)" 'Vdash c = (rel c).
31
32 alias symbol "eq" = "setoid1 eq".
33 alias symbol "compose" = "category1 composition".
34 record relation_pair (BP1,BP2: basic_pair): Type ≝
35  { concr_rel: arrows1 ? (concr BP1) (concr BP2);
36    form_rel: arrows1 ? (form BP1) (form BP2);
37    commute: ⊩ ∘ concr_rel = form_rel ∘ ⊩
38  }.
39
40 notation "hvbox (r \sub \c)"  with precedence 90 for @{'concr_rel $r}.
41 notation "hvbox (r \sub \f)"  with precedence 90 for @{'form_rel $r}.
42
43 interpretation "concrete relation" 'concr_rel r = (concr_rel __ r). 
44 interpretation "formal relation" 'form_rel r = (form_rel __ r). 
45
46 definition relation_pair_equality:
47  ∀o1,o2. equivalence_relation1 (relation_pair o1 o2).
48  intros;
49  constructor 1;
50   [ apply (λr,r'. ⊩ ∘ r \sub\c = ⊩ ∘ r' \sub\c);
51   | simplify;
52     intros;
53     apply refl1;
54   | simplify;
55     intros 2;
56     apply sym1;
57   | simplify;
58     intros 3;
59     apply trans1;
60   ]      
61 qed.
62
63 definition relation_pair_setoid: basic_pair → basic_pair → setoid1.
64  intros;
65  constructor 1;
66   [ apply (relation_pair b b1)
67   | apply relation_pair_equality
68   ]
69 qed.
70
71 lemma eq_to_eq': ∀o1,o2.∀r,r': relation_pair_setoid o1 o2. r=r' → r \sub\f ∘ ⊩ = r'\sub\f ∘ ⊩.
72  intros 5 (o1 o2 r r' H); change in H with (⊩ ∘ r\sub\c = ⊩ ∘ r'\sub\c);
73  apply (.= (commute ?? r \sup -1));
74  apply (.= H);
75  apply (.= (commute ?? r'));
76  apply refl1;
77 qed.
78
79
80 definition id_relation_pair: ∀o:basic_pair. relation_pair o o.
81  intro;
82  constructor 1;
83   [1,2: apply id1;
84   | lapply (id_neutral_right1 ? (concr o) ? (⊩)) as H;
85     lapply (id_neutral_left1 ?? (form o) (⊩)) as H1;
86     apply (.= H);
87     apply (H1 \sup -1);]
88 qed.
89
90 definition relation_pair_composition:
91  ∀o1,o2,o3. binary_morphism1 (relation_pair_setoid o1 o2) (relation_pair_setoid o2 o3) (relation_pair_setoid o1 o3).
92  intros;
93  constructor 1;
94   [ intros (r r1);
95     constructor 1;
96      [ apply (r1 \sub\c ∘ r \sub\c) 
97      | apply (r1 \sub\f ∘ r \sub\f)
98      | lapply (commute ?? r) as H;
99        lapply (commute ?? r1) as H1;
100        apply (.= ASSOC1);
101        apply (.= #‡H1);
102        apply (.= ASSOC1\sup -1);
103        apply (.= H‡#);
104        apply ASSOC1]
105   | intros;
106     change with (⊩ ∘ (b\sub\c ∘ a\sub\c) = ⊩ ∘ (b'\sub\c ∘ a'\sub\c));  
107     change in H with (⊩ ∘ a \sub\c = ⊩ ∘ a' \sub\c);
108     change in H1 with (⊩ ∘ b \sub\c = ⊩ ∘ b' \sub\c);
109     apply (.= ASSOC1);
110     apply (.= #‡H1);
111     apply (.= #‡(commute ?? b'));
112     apply (.= ASSOC1 \sup -1);
113     apply (.= H‡#);
114     apply (.= ASSOC1);
115     apply (.= #‡(commute ?? b')\sup -1);
116     apply (ASSOC1 \sup -1)]
117 qed.
118     
119 definition BP: category1.
120  constructor 1;
121   [ apply basic_pair
122   | apply relation_pair_setoid
123   | apply id_relation_pair
124   | apply relation_pair_composition
125   | intros;
126     change with (⊩ ∘ (a34\sub\c ∘ (a23\sub\c ∘ a12\sub\c)) =
127                  ⊩ ∘ ((a34\sub\c ∘ a23\sub\c) ∘ a12\sub\c));
128     apply (ASSOC1‡#);
129   | intros;
130     change with (⊩ ∘ (a\sub\c ∘ (id_relation_pair o1)\sub\c) = ⊩ ∘ a\sub\c);
131     apply ((id_neutral_right1 ????)‡#);
132   | intros;
133     change with (⊩ ∘ ((id_relation_pair o2)\sub\c ∘ a\sub\c) = ⊩ ∘ a\sub\c);
134     apply ((id_neutral_left1 ????)‡#);]
135 qed.
136
137
138 (*
139 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o).
140  intros; constructor 1;
141   [ apply (ext ? ? (rel o));
142   | intros;
143     apply (.= #‡H);
144     apply refl1]
145 qed.
146
147 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
148  λo.extS ?? (rel o).
149 *)
150
151 (*
152 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
153  intros (o); constructor 1;
154   [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
155     intros; simplify; apply (.= (†H)‡#); apply refl1
156   | intros; split; simplify; intros;
157      [ apply (. #‡((†H)‡(†H1))); assumption
158      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
159 qed.
160
161 interpretation "fintersects" 'fintersects U V = (fun1 ___ (fintersects _) U V).
162
163 definition fintersectsS:
164  ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
165  intros (o); constructor 1;
166   [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
167     intros; simplify; apply (.= (†H)‡#); apply refl1
168   | intros; split; simplify; intros;
169      [ apply (. #‡((†H)‡(†H1))); assumption
170      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
171 qed.
172
173 interpretation "fintersectsS" 'fintersects U V = (fun1 ___ (fintersectsS _) U V).
174 *)
175
176 (*
177 definition relS: ∀o: BP. binary_morphism1 (concr o) (Ω \sup (form o)) CPROP.
178  intros (o); constructor 1;
179   [ apply (λx:concr o.λS: Ω \sup (form o).∃y: form o.y ∈ S ∧ x ⊩ y);
180   | intros; split; intros; cases H2; exists [1,3: apply w]
181      [ apply (. (#‡H1)‡(H‡#)); assumption
182      | apply (. (#‡H1 \sup -1)‡(H \sup -1‡#)); assumption]]
183 qed.
184
185 interpretation "basic pair relation for subsets" 'Vdash2 x y = (fun1 (concr _) __ (relS _) x y).
186 interpretation "basic pair relation for subsets (non applied)" 'Vdash = (fun1 ___ (relS _)).
187 *)