]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/formal_topology/overlap/basic_pairs.ma
Cool: only 8 universes in use.
[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 definition relation_pair_equality:
44  ∀o1,o2. equivalence_relation1 (relation_pair o1 o2).
45  intros;
46  constructor 1;
47   [ apply (λr,r'. ⊩ ∘ r \sub\c = ⊩ ∘ r' \sub\c);
48   | simplify;
49     intros;
50     apply refl1;
51   | simplify;
52     intros 2;
53     apply sym1;
54   | simplify;
55     intros 3;
56     apply trans1;
57   ]      
58 qed.
59
60 definition relation_pair_setoid: basic_pair → basic_pair → setoid1.
61  intros;
62  constructor 1;
63   [ apply (relation_pair b b1)
64   | apply relation_pair_equality
65   ]
66 qed.
67
68 lemma eq_to_eq': ∀o1,o2.∀r,r': relation_pair_setoid o1 o2. r=r' → r \sub\f ∘ ⊩ = r'\sub\f ∘ ⊩.
69  intros 7 (o1 o2 r r' H c1 f2);
70  split; intro H1;
71   [ lapply (fi ?? (commute ?? r c1 f2) H1) as H2;
72     lapply (if ?? (H c1 f2) H2) as H3;
73     apply (if ?? (commute ?? r' c1 f2) H3);
74   | lapply (fi ?? (commute ?? r' c1 f2) H1) as H2;
75     lapply (fi ?? (H c1 f2) H2) as H3;
76     apply (if ?? (commute ?? r c1 f2) H3);
77   ]
78 qed.
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        alias symbol "trans" = "trans1".
101        alias symbol "assoc" = "category1 assoc".
102        apply (.= ASSOC);
103        apply (.= #‡H1);
104        alias symbol "invert" = "setoid1 symmetry".
105        apply (.= ASSOC ^ -1);
106        apply (.= H‡#);
107        apply 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 (.= ASSOC);
113     apply (.= #‡e1);
114     apply (.= #‡(commute ?? b'));
115     apply (.= ASSOC ^ -1);
116     apply (.= e‡#);
117     apply (.= ASSOC);
118     apply (.= #‡(commute ?? b')\sup -1);
119     apply (ASSOC ^ -1)]
120 qed.
121     
122 definition BP: category1.
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     alias symbol "refl" = "refl1".
132     alias symbol "prop2" = "prop21".
133     apply (ASSOC‡#);
134   | intros;
135     change with (⊩ ∘ (a\sub\c ∘ (id_relation_pair o1)\sub\c) = ⊩ ∘ a\sub\c);
136     apply ((id_neutral_right1 ????)‡#);
137   | intros;
138     change with (⊩ ∘ ((id_relation_pair o2)\sub\c ∘ a\sub\c) = ⊩ ∘ a\sub\c);
139     apply ((id_neutral_left1 ????)‡#);]
140 qed.
141
142 (*
143 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o).
144  intros; constructor 1;
145   [ apply (ext ? ? (rel o));
146   | intros;
147     apply (.= #‡H);
148     apply refl1]
149 qed.
150
151 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
152  λo.extS ?? (rel o).
153
154 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
155  intros (o); constructor 1;
156   [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
157     intros; simplify; apply (.= (†H)‡#); apply refl1
158   | intros; split; simplify; intros;
159      [ apply (. #‡((†H)‡(†H1))); assumption
160      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
161 qed.
162
163 interpretation "fintersects" 'fintersects U V = (fun1 ___ (fintersects _) U V).
164
165 definition fintersectsS:
166  ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
167  intros (o); constructor 1;
168   [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
169     intros; simplify; apply (.= (†H)‡#); apply refl1
170   | intros; split; simplify; intros;
171      [ apply (. #‡((†H)‡(†H1))); assumption
172      | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
173 qed.
174
175 interpretation "fintersectsS" 'fintersects U V = (fun1 ___ (fintersectsS _) U V).
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 *)