]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/library/formal_topology/basic_topologies.ma
36a0d24c86a1593887c428a494b765b1c9ce2390
[helm.git] / helm / software / matita / library / formal_topology / basic_topologies.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 "formal_topology/relations.ma".
16 include "datatypes/categories.ma".
17 include "formal_topology/saturations_reductions.ma".
18
19 record basic_topology: Type ≝
20  { carrbt:> REL;
21    A: unary_morphism (Ω \sup carrbt) (Ω \sup carrbt);
22    J: unary_morphism (Ω \sup carrbt) (Ω \sup carrbt);
23    A_is_saturation: is_saturation ? A;
24    J_is_reduction: is_reduction ? J;
25    compatibility: ∀U,V. (A U ≬ J V) = (U ≬ J V)
26  }.
27
28 record continuous_relation (S,T: basic_topology) : Type ≝
29  { cont_rel:> arrows1 ? S T;
30    reduced: ∀U. U = J ? U → image ?? cont_rel U = J ? (image ?? cont_rel U);
31    saturated: ∀U. U = A ? U → minus_star_image ?? cont_rel U = A ? (minus_star_image ?? cont_rel U)
32  }. 
33
34 definition continuous_relation_setoid: basic_topology → basic_topology → setoid1.
35  intros (S T); constructor 1;
36   [ apply (continuous_relation S T)
37   | constructor 1;
38      [ apply (λr,s:continuous_relation S T.∀b. A ? (ext ?? r b) = A ? (ext ?? s b));
39      | simplify; intros; apply refl1;
40      | simplify; intros; apply sym1; apply H
41      | simplify; intros; apply trans1; [2: apply H |3: apply H1; |1: skip]]]
42 qed.
43
44 definition cont_rel': ∀S,T: basic_topology. continuous_relation_setoid S T → arrows1 ? S T ≝ cont_rel.
45
46 coercion cont_rel'.
47
48 definition cont_rel'': ∀S,T: basic_topology. continuous_relation_setoid S T → binary_relation S T ≝ cont_rel.
49
50 coercion cont_rel''.
51
52 theorem continuous_relation_eq':
53  ∀o1,o2.∀a,a': continuous_relation_setoid o1 o2.
54   a = a' → ∀X.minus_star_image ?? a (A o1 X) = minus_star_image ?? a' (A o1 X).
55  intros; split; intro; unfold minus_star_image; simplify; intros;
56   [ cut (ext ?? a a1 ⊆ A ? X); [2: intros 2; apply (H1 a2); cases f1; assumption;]
57     lapply (if ?? (A_is_saturation ???) Hcut); clear Hcut;
58     cut (A ? (ext ?? a' a1) ⊆ A ? X); [2: apply (. (H ?)‡#); assumption]
59     lapply (fi ?? (A_is_saturation ???) Hcut);
60     apply (Hletin1 x); change with (x ∈ ext ?? a' a1); split; simplify;
61      [ apply I | assumption ]
62   | cut (ext ?? a' a1 ⊆ A ? X); [2: intros 2; apply (H1 a2); cases f1; assumption;]
63     lapply (if ?? (A_is_saturation ???) Hcut); clear Hcut;
64     cut (A ? (ext ?? a a1) ⊆ A ? X); [2: apply (. (H ?)\sup -1‡#); assumption]
65     lapply (fi ?? (A_is_saturation ???) Hcut);
66     apply (Hletin1 x); change with (x ∈ ext ?? a a1); split; simplify;
67      [ apply I | assumption ]]
68 qed.
69
70 theorem continuous_relation_eq_inv':
71  ∀o1,o2.∀a,a': continuous_relation_setoid o1 o2.
72   (∀X.minus_star_image ?? a (A o1 X) = minus_star_image ?? a' (A o1 X)) → a=a'.
73  intros 6;
74  cut (∀a,a': continuous_relation_setoid o1 o2.
75   (∀X.minus_star_image ?? a (A o1 X) = minus_star_image ?? a' (A o1 X)) → 
76    ∀V:o2. A ? (ext ?? a' V) ⊆ A ? (ext ?? a V));
77   [2: clear b H a' a; intros;
78       lapply depth=0 (λV.saturation_expansive ??? (extS ?? a V)); [2: apply A_is_saturation;|skip]
79        (* fundamental adjunction here! to be taken out *)
80        cut (∀V:Ω \sup o2.V ⊆ minus_star_image ?? a (A ? (extS ?? a V)));
81         [2: intro; intros 2; unfold minus_star_image; simplify; intros;
82             apply (Hletin V1 x); whd; split; [ exact I | exists; [apply a1] split; assumption]]
83        clear Hletin;
84        cut (∀V:Ω \sup o2.V ⊆ minus_star_image ?? a' (A ? (extS ?? a V)));
85         [2: intro; apply (. #‡(H ?)); apply Hcut] clear H Hcut;
86        (* second half of the fundamental adjunction here! to be taken out too *)
87       intro; lapply (Hcut1 (singleton ? V)); clear Hcut1;
88       unfold minus_star_image in Hletin; unfold singleton in Hletin; simplify in Hletin;
89       whd in Hletin; whd in Hletin:(?→?→%); simplify in Hletin;
90       apply (if ?? (A_is_saturation ???));
91       intros 2 (x H); lapply (Hletin V ? x ?);
92        [ apply refl | cases H; assumption; ]
93       change with (x ∈ A ? (ext ?? a V));
94       apply (. #‡(†(extS_singleton ????)));
95       assumption;]
96  split; apply Hcut; [2: assumption | intro; apply sym1; apply H]
97 qed.
98
99 definition continuous_relation_comp:
100  ∀o1,o2,o3.
101   continuous_relation_setoid o1 o2 →
102    continuous_relation_setoid o2 o3 →
103     continuous_relation_setoid o1 o3.
104  intros (o1 o2 o3 r s); constructor 1;
105   [ apply (s ∘ r)
106   | intros;
107     apply sym1;
108     apply (.= †(image_comp ??????));
109     apply (.= (reduced ?????)\sup -1);
110      [ apply (.= (reduced ?????)); [ assumption | apply refl1 ]
111      | apply (.= (image_comp ??????)\sup -1);
112        apply refl1]
113      | intros;
114        apply sym1;
115        apply (.= †(minus_star_image_comp ??????));
116        apply (.= (saturated ?????)\sup -1);
117         [ apply (.= (saturated ?????)); [ assumption | apply refl1 ]
118         | apply (.= (minus_star_image_comp ??????)\sup -1);
119           apply refl1]]
120 qed.
121
122 definition BTop: category1.
123  constructor 1;
124   [ apply basic_topology
125   | apply continuous_relation_setoid
126   | intro; constructor 1;
127      [ apply id1
128      | intros;
129        apply (.= (image_id ??));
130        apply sym1;
131        apply (.= †(image_id ??));
132        apply sym1;
133        assumption
134      | intros;
135        apply (.= (minus_star_image_id ??));
136        apply sym1;
137        apply (.= †(minus_star_image_id ??));
138        apply sym1;
139        assumption]
140   | intros; constructor 1;
141      [ apply continuous_relation_comp;
142      | intros; simplify; intro x; simplify;
143        lapply depth=0 (continuous_relation_eq' ???? H) as H';
144        lapply depth=0 (continuous_relation_eq' ???? H1) as H1';
145        letin K ≝ (λX.H1' (minus_star_image ?? a (A ? X))); clearbody K;
146        cut (∀X:Ω \sup o1.
147               minus_star_image o2 o3 b (A o2 (minus_star_image o1 o2 a (A o1 X)))
148             = minus_star_image o2 o3 b' (A o2 (minus_star_image o1 o2 a' (A o1 X))));
149         [2: intro; apply sym1; apply (.= #‡(†((H' ?)\sup -1))); apply sym1; apply (K X);]
150        clear K H' H1';
151        cut (∀X:Ω \sup o1.
152               minus_star_image o1 o3 (b ∘ a) (A o1 X) = minus_star_image o1 o3 (b'∘a') (A o1 X));
153         [2: intro;
154             apply (.= (minus_star_image_comp ??????));
155             apply (.= #‡(saturated ?????));
156              [ apply ((saturation_idempotent ????) \sup -1); apply A_is_saturation ]
157             apply sym1; 
158             apply (.= (minus_star_image_comp ??????));
159             apply (.= #‡(saturated ?????));
160              [ apply ((saturation_idempotent ????) \sup -1); apply A_is_saturation ]
161            apply ((Hcut X) \sup -1)]
162        clear Hcut; generalize in match x; clear x;
163        apply (continuous_relation_eq_inv');
164        apply Hcut1;]
165   | intros; simplify; intro; do 2 (unfold continuous_relation_comp); simplify;
166     apply (.= †(ASSOC1‡#));
167     apply refl1
168   | intros; simplify; intro; unfold continuous_relation_comp; simplify;
169     apply (.= †((id_neutral_right1 ????)‡#));
170     apply refl1
171   | intros; simplify; intro; simplify;
172     apply (.= †((id_neutral_left1 ????)‡#));
173     apply refl1]
174 qed.
175
176 (*CSC: unused! *)
177 (* this proof is more logic-oriented than set/lattice oriented *)
178 theorem continuous_relation_eqS:
179  ∀o1,o2:basic_topology.∀a,a': continuous_relation_setoid o1 o2.
180   a = a' → ∀X. A ? (extS ?? a X) = A ? (extS ?? a' X).
181  intros;
182  cut (∀a: arrows1 ? o1 ?.∀x. x ∈ extS ?? a X → ∃y:o2.y ∈ X ∧ x ∈ ext ?? a y);
183   [2: intros; cases f; clear f; cases H1; exists [apply w] cases x1; split;
184       try assumption; split; assumption]
185  cut (∀a,a':continuous_relation_setoid o1 o2.eq1 ? a a' → ∀x. x ∈ extS ?? a X → ∃y:o2. y ∈ X ∧ x ∈ A ? (ext ?? a' y));
186   [2: intros; cases (Hcut ?? f); exists; [apply w] cases x1; split; try assumption;
187       apply (. #‡(H1 ?));
188       apply (saturation_expansive ?? (A_is_saturation o1) (ext ?? a1 w) x);
189       assumption;] clear Hcut;
190  split; apply (if ?? (A_is_saturation ???)); intros 2;
191   [lapply (Hcut1 a a' H a1 f) | lapply (Hcut1 a' a (H \sup -1) a1 f)]
192   cases Hletin; clear Hletin; cases x; clear x;
193  cut (∀a: arrows1 ? o1 ?. ext ?? a w ⊆ extS ?? a X);
194   [2,4: intros 3; cases f3; clear f3; simplify in f5; split; try assumption;
195       exists [1,3: apply w] split; assumption;]
196  cut (∀a. A ? (ext o1 o2 a w) ⊆ A ? (extS o1 o2 a X));
197   [2,4: intros; apply saturation_monotone; try (apply A_is_saturation); apply Hcut;]
198  apply Hcut2; assumption.
199 qed.