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