| author | wenzelm | 
| Sat, 03 Sep 2011 21:15:35 +0200 | |
| changeset 44676 | 7de87f1ae965 | 
| parent 44668 | 31d41a0f6b5d | 
| child 44890 | 22f665a2e91c | 
| permissions | -rw-r--r-- | 
| 
33714
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
1  | 
(* title: HOL/Library/Topology_Euclidian_Space.thy  | 
| 33175 | 2  | 
Author: Amine Chaieb, University of Cambridge  | 
3  | 
Author: Robert Himmelmann, TU Muenchen  | 
|
| 44075 | 4  | 
Author: Brian Huffman, Portland State University  | 
| 33175 | 5  | 
*)  | 
6  | 
||
7  | 
header {* Elementary topology in Euclidean space. *}
 | 
|
8  | 
||
9  | 
theory Topology_Euclidean_Space  | 
|
| 
44628
 
bd17b7543af1
move lemmas from Topology_Euclidean_Space to Euclidean_Space
 
huffman 
parents: 
44584 
diff
changeset
 | 
10  | 
imports SEQ Linear_Algebra "~~/src/HOL/Library/Glbs" Norm_Arith  | 
| 33175 | 11  | 
begin  | 
12  | 
||
| 44517 | 13  | 
subsection {* General notion of a topology as a value *}
 | 
| 33175 | 14  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
15  | 
definition "istopology L \<longleftrightarrow> L {} \<and> (\<forall>S T. L S \<longrightarrow> L T \<longrightarrow> L (S \<inter> T)) \<and> (\<forall>K. Ball K L \<longrightarrow> L (\<Union> K))"
 | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
16  | 
typedef (open) 'a topology = "{L::('a set) \<Rightarrow> bool. istopology L}"
 | 
| 33175 | 17  | 
morphisms "openin" "topology"  | 
18  | 
unfolding istopology_def by blast  | 
|
19  | 
||
20  | 
lemma istopology_open_in[intro]: "istopology(openin U)"  | 
|
21  | 
using openin[of U] by blast  | 
|
22  | 
||
23  | 
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
24  | 
using topology_inverse[unfolded mem_Collect_eq] .  | 
| 33175 | 25  | 
|
26  | 
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"  | 
|
27  | 
using topology_inverse[of U] istopology_open_in[of "topology U"] by auto  | 
|
28  | 
||
29  | 
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"  | 
|
30  | 
proof-  | 
|
31  | 
  {assume "T1=T2" hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp}
 | 
|
32  | 
moreover  | 
|
33  | 
  {assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
 | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
34  | 
hence "openin T1 = openin T2" by (simp add: fun_eq_iff)  | 
| 33175 | 35  | 
hence "topology (openin T1) = topology (openin T2)" by simp  | 
36  | 
hence "T1 = T2" unfolding openin_inverse .}  | 
|
37  | 
ultimately show ?thesis by blast  | 
|
38  | 
qed  | 
|
39  | 
||
40  | 
text{* Infer the "universe" from union of all sets in the topology. *}
 | 
|
41  | 
||
42  | 
definition "topspace T =  \<Union>{S. openin T S}"
 | 
|
43  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
44  | 
subsubsection {* Main properties of open sets *}
 | 
| 33175 | 45  | 
|
46  | 
lemma openin_clauses:  | 
|
47  | 
fixes U :: "'a topology"  | 
|
48  | 
  shows "openin U {}"
 | 
|
49  | 
"\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)"  | 
|
50  | 
"\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
51  | 
using openin[of U] unfolding istopology_def mem_Collect_eq  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
52  | 
by fast+  | 
| 33175 | 53  | 
|
54  | 
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"  | 
|
55  | 
unfolding topspace_def by blast  | 
|
56  | 
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
 | 
|
57  | 
||
58  | 
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)"  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
59  | 
using openin_clauses by simp  | 
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
60  | 
|
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
61  | 
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)"  | 
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
62  | 
using openin_clauses by simp  | 
| 33175 | 63  | 
|
64  | 
lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)"  | 
|
65  | 
  using openin_Union[of "{S,T}" U] by auto
 | 
|
66  | 
||
67  | 
lemma openin_topspace[intro, simp]: "openin U (topspace U)" by (simp add: openin_Union topspace_def)  | 
|
68  | 
||
69  | 
lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)" (is "?lhs \<longleftrightarrow> ?rhs")  | 
|
| 36584 | 70  | 
proof  | 
71  | 
assume ?lhs then show ?rhs by auto  | 
|
72  | 
next  | 
|
73  | 
assume H: ?rhs  | 
|
74  | 
  let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
 | 
|
75  | 
have "openin U ?t" by (simp add: openin_Union)  | 
|
76  | 
also have "?t = S" using H by auto  | 
|
77  | 
finally show "openin U S" .  | 
|
| 33175 | 78  | 
qed  | 
79  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
80  | 
subsubsection {* Closed sets *}
 | 
| 33175 | 81  | 
|
82  | 
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)"  | 
|
83  | 
||
84  | 
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def)  | 
|
85  | 
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
 | 
|
86  | 
lemma closedin_topspace[intro,simp]:  | 
|
87  | 
"closedin U (topspace U)" by (simp add: closedin_def)  | 
|
88  | 
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)"  | 
|
89  | 
by (auto simp add: Diff_Un closedin_def)  | 
|
90  | 
||
91  | 
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto
 | 
|
92  | 
lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S"
 | 
|
93  | 
shows "closedin U (\<Inter> K)" using Ke Kc unfolding closedin_def Diff_Inter by auto  | 
|
94  | 
||
95  | 
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"  | 
|
96  | 
  using closedin_Inter[of "{S,T}" U] by auto
 | 
|
97  | 
||
98  | 
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast  | 
|
99  | 
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"  | 
|
100  | 
apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2)  | 
|
101  | 
apply (metis openin_subset subset_eq)  | 
|
102  | 
done  | 
|
103  | 
||
104  | 
lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"  | 
|
105  | 
by (simp add: openin_closedin_eq)  | 
|
106  | 
||
107  | 
lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)"  | 
|
108  | 
proof-  | 
|
109  | 
have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S] oS cT  | 
|
110  | 
by (auto simp add: topspace_def openin_subset)  | 
|
111  | 
then show ?thesis using oS cT by (auto simp add: closedin_def)  | 
|
112  | 
qed  | 
|
113  | 
||
114  | 
lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)"  | 
|
115  | 
proof-  | 
|
116  | 
have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S] oS cT  | 
|
117  | 
by (auto simp add: topspace_def )  | 
|
118  | 
then show ?thesis using oS cT by (auto simp add: openin_closedin_eq)  | 
|
119  | 
qed  | 
|
120  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
121  | 
subsubsection {* Subspace topology *}
 | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
122  | 
|
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
123  | 
definition "subtopology U V = topology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
124  | 
|
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
125  | 
lemma istopology_subtopology: "istopology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
126  | 
(is "istopology ?L")  | 
| 33175 | 127  | 
proof-  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
128  | 
  have "?L {}" by blast
 | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
129  | 
  {fix A B assume A: "?L A" and B: "?L B"
 | 
| 33175 | 130  | 
from A B obtain Sa and Sb where Sa: "openin U Sa" "A = Sa \<inter> V" and Sb: "openin U Sb" "B = Sb \<inter> V" by blast  | 
131  | 
have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)" using Sa Sb by blast+  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
132  | 
then have "?L (A \<inter> B)" by blast}  | 
| 33175 | 133  | 
moreover  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
134  | 
  {fix K assume K: "K \<subseteq> Collect ?L"
 | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
135  | 
have th0: "Collect ?L = (\<lambda>S. S \<inter> V) ` Collect (openin U)"  | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
136  | 
apply (rule set_eqI)  | 
| 33175 | 137  | 
apply (simp add: Ball_def image_iff)  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
138  | 
by metis  | 
| 33175 | 139  | 
from K[unfolded th0 subset_image_iff]  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
140  | 
obtain Sk where Sk: "Sk \<subseteq> Collect (openin U)" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast  | 
| 33175 | 141  | 
have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
142  | 
moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq)  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
143  | 
ultimately have "?L (\<Union>K)" by blast}  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
144  | 
ultimately show ?thesis  | 
| 
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
145  | 
unfolding subset_eq mem_Collect_eq istopology_def by blast  | 
| 33175 | 146  | 
qed  | 
147  | 
||
148  | 
lemma openin_subtopology:  | 
|
149  | 
"openin (subtopology U V) S \<longleftrightarrow> (\<exists> T. (openin U T) \<and> (S = T \<inter> V))"  | 
|
150  | 
unfolding subtopology_def topology_inverse'[OF istopology_subtopology]  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
151  | 
by auto  | 
| 33175 | 152  | 
|
153  | 
lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V"  | 
|
154  | 
by (auto simp add: topspace_def openin_subtopology)  | 
|
155  | 
||
156  | 
lemma closedin_subtopology:  | 
|
157  | 
"closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)"  | 
|
158  | 
unfolding closedin_def topspace_subtopology  | 
|
159  | 
apply (simp add: openin_subtopology)  | 
|
160  | 
apply (rule iffI)  | 
|
161  | 
apply clarify  | 
|
162  | 
apply (rule_tac x="topspace U - T" in exI)  | 
|
163  | 
by auto  | 
|
164  | 
||
165  | 
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"  | 
|
166  | 
unfolding openin_subtopology  | 
|
167  | 
apply (rule iffI, clarify)  | 
|
168  | 
apply (frule openin_subset[of U]) apply blast  | 
|
169  | 
apply (rule exI[where x="topspace U"])  | 
|
170  | 
by auto  | 
|
171  | 
||
172  | 
lemma subtopology_superset: assumes UV: "topspace U \<subseteq> V"  | 
|
173  | 
shows "subtopology U V = U"  | 
|
174  | 
proof-  | 
|
175  | 
  {fix S
 | 
|
176  | 
    {fix T assume T: "openin U T" "S = T \<inter> V"
 | 
|
177  | 
from T openin_subset[OF T(1)] UV have eq: "S = T" by blast  | 
|
178  | 
have "openin U S" unfolding eq using T by blast}  | 
|
179  | 
moreover  | 
|
180  | 
    {assume S: "openin U S"
 | 
|
181  | 
hence "\<exists>T. openin U T \<and> S = T \<inter> V"  | 
|
182  | 
using openin_subset[OF S] UV by auto}  | 
|
183  | 
ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" by blast}  | 
|
184  | 
then show ?thesis unfolding topology_eq openin_subtopology by blast  | 
|
185  | 
qed  | 
|
186  | 
||
187  | 
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"  | 
|
188  | 
by (simp add: subtopology_superset)  | 
|
189  | 
||
190  | 
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"  | 
|
191  | 
by (simp add: subtopology_superset)  | 
|
192  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
193  | 
subsubsection {* The standard Euclidean topology *}
 | 
| 33175 | 194  | 
|
195  | 
definition  | 
|
196  | 
euclidean :: "'a::topological_space topology" where  | 
|
197  | 
"euclidean = topology open"  | 
|
198  | 
||
199  | 
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"  | 
|
200  | 
unfolding euclidean_def  | 
|
201  | 
apply (rule cong[where x=S and y=S])  | 
|
202  | 
apply (rule topology_inverse[symmetric])  | 
|
203  | 
apply (auto simp add: istopology_def)  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
204  | 
done  | 
| 33175 | 205  | 
|
206  | 
lemma topspace_euclidean: "topspace euclidean = UNIV"  | 
|
207  | 
apply (simp add: topspace_def)  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
208  | 
apply (rule set_eqI)  | 
| 33175 | 209  | 
by (auto simp add: open_openin[symmetric])  | 
210  | 
||
211  | 
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"  | 
|
212  | 
by (simp add: topspace_euclidean topspace_subtopology)  | 
|
213  | 
||
214  | 
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"  | 
|
215  | 
by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV)  | 
|
216  | 
||
217  | 
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"  | 
|
218  | 
by (simp add: open_openin openin_subopen[symmetric])  | 
|
219  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
220  | 
text {* Basic "localization" results are handy for connectedness. *}
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
221  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
222  | 
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
223  | 
by (auto simp add: openin_subtopology open_openin[symmetric])  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
224  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
225  | 
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
226  | 
by (auto simp add: openin_open)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
227  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
228  | 
lemma open_openin_trans[trans]:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
229  | 
"open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
230  | 
by (metis Int_absorb1 openin_open_Int)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
231  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
232  | 
lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
233  | 
by (auto simp add: openin_open)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
234  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
235  | 
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
236  | 
by (simp add: closedin_subtopology closed_closedin Int_ac)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
237  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
238  | 
lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
239  | 
by (metis closedin_closed)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
240  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
241  | 
lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
242  | 
apply (subgoal_tac "S \<inter> T = T" )  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
243  | 
apply auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
244  | 
apply (frule closedin_closed_Int[of T S])  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
245  | 
by simp  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
246  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
247  | 
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
248  | 
by (auto simp add: closedin_closed)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
249  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
250  | 
lemma openin_euclidean_subtopology_iff:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
251  | 
fixes S U :: "'a::metric_space set"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
252  | 
shows "openin (subtopology euclidean U) S  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
253  | 
\<longleftrightarrow> S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)" (is "?lhs \<longleftrightarrow> ?rhs")  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
254  | 
proof  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
255  | 
assume ?lhs thus ?rhs unfolding openin_open open_dist by blast  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
256  | 
next  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
257  | 
  def T \<equiv> "{x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
258  | 
have 1: "\<forall>x\<in>T. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> T"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
259  | 
unfolding T_def  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
260  | 
apply clarsimp  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
261  | 
apply (rule_tac x="d - dist x a" in exI)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
262  | 
apply (clarsimp simp add: less_diff_eq)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
263  | 
apply (erule rev_bexI)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
264  | 
apply (rule_tac x=d in exI, clarify)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
265  | 
apply (erule le_less_trans [OF dist_triangle])  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
266  | 
done  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
267  | 
assume ?rhs hence 2: "S = U \<inter> T"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
268  | 
unfolding T_def  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
269  | 
apply auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
270  | 
apply (drule (1) bspec, erule rev_bexI)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
271  | 
apply auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
272  | 
done  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
273  | 
from 1 2 show ?lhs  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
274  | 
unfolding openin_open open_dist by fast  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
275  | 
qed  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
276  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
277  | 
text {* These "transitivity" results are handy too *}
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
278  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
279  | 
lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
280  | 
\<Longrightarrow> openin (subtopology euclidean U) S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
281  | 
unfolding open_openin openin_open by blast  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
282  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
283  | 
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
284  | 
by (auto simp add: openin_open intro: openin_trans)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
285  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
286  | 
lemma closedin_trans[trans]:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
287  | 
"closedin (subtopology euclidean T) S \<Longrightarrow>  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
288  | 
closedin (subtopology euclidean U) T  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
289  | 
==> closedin (subtopology euclidean U) S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
290  | 
by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
291  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
292  | 
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
293  | 
by (auto simp add: closedin_closed intro: closedin_trans)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
294  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
295  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
296  | 
subsection {* Open and closed balls *}
 | 
| 33175 | 297  | 
|
298  | 
definition  | 
|
299  | 
ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where  | 
|
300  | 
  "ball x e = {y. dist x y < e}"
 | 
|
301  | 
||
302  | 
definition  | 
|
303  | 
cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where  | 
|
304  | 
  "cball x e = {y. dist x y \<le> e}"
 | 
|
305  | 
||
306  | 
lemma mem_ball[simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" by (simp add: ball_def)  | 
|
307  | 
lemma mem_cball[simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" by (simp add: cball_def)  | 
|
308  | 
||
309  | 
lemma mem_ball_0 [simp]:  | 
|
310  | 
fixes x :: "'a::real_normed_vector"  | 
|
311  | 
shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"  | 
|
312  | 
by (simp add: dist_norm)  | 
|
313  | 
||
314  | 
lemma mem_cball_0 [simp]:  | 
|
315  | 
fixes x :: "'a::real_normed_vector"  | 
|
316  | 
shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"  | 
|
317  | 
by (simp add: dist_norm)  | 
|
318  | 
||
319  | 
lemma centre_in_cball[simp]: "x \<in> cball x e \<longleftrightarrow> 0\<le> e" by simp  | 
|
320  | 
lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq)  | 
|
321  | 
lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq)  | 
|
322  | 
lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq)  | 
|
323  | 
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
324  | 
by (simp add: set_eq_iff) arith  | 
| 33175 | 325  | 
|
326  | 
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
327  | 
by (simp add: set_eq_iff)  | 
| 33175 | 328  | 
|
329  | 
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b"  | 
|
330  | 
"(a::real) - b < 0 \<longleftrightarrow> a < b"  | 
|
331  | 
"a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+  | 
|
332  | 
lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b"  | 
|
333  | 
"a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b" by arith+  | 
|
334  | 
||
335  | 
lemma open_ball[intro, simp]: "open (ball x e)"  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
336  | 
unfolding open_dist ball_def mem_Collect_eq Ball_def  | 
| 33175 | 337  | 
unfolding dist_commute  | 
338  | 
apply clarify  | 
|
339  | 
apply (rule_tac x="e - dist xa x" in exI)  | 
|
340  | 
using dist_triangle_alt[where z=x]  | 
|
341  | 
apply (clarsimp simp add: diff_less_iff)  | 
|
342  | 
apply atomize  | 
|
343  | 
apply (erule_tac x="y" in allE)  | 
|
344  | 
apply (erule_tac x="xa" in allE)  | 
|
345  | 
by arith  | 
|
346  | 
||
347  | 
lemma centre_in_ball[simp]: "x \<in> ball x e \<longleftrightarrow> e > 0" by (metis mem_ball dist_self)  | 
|
348  | 
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)"  | 
|
349  | 
unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..  | 
|
350  | 
||
| 
33714
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
351  | 
lemma openE[elim?]:  | 
| 
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
352  | 
assumes "open S" "x\<in>S"  | 
| 
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
353  | 
obtains e where "e>0" "ball x e \<subseteq> S"  | 
| 
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
354  | 
using assms unfolding open_contains_ball by auto  | 
| 
 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 
hoelzl 
parents: 
33324 
diff
changeset
 | 
355  | 
|
| 33175 | 356  | 
lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"  | 
357  | 
by (metis open_contains_ball subset_eq centre_in_ball)  | 
|
358  | 
||
359  | 
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
 | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
360  | 
unfolding mem_ball set_eq_iff  | 
| 33175 | 361  | 
apply (simp add: not_less)  | 
362  | 
by (metis zero_le_dist order_trans dist_self)  | 
|
363  | 
||
364  | 
lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
 | 
|
365  | 
||
366  | 
||
367  | 
subsection{* Connectedness *}
 | 
|
368  | 
||
369  | 
definition "connected S \<longleftrightarrow>  | 
|
370  | 
  ~(\<exists>e1 e2. open e1 \<and> open e2 \<and> S \<subseteq> (e1 \<union> e2) \<and> (e1 \<inter> e2 \<inter> S = {})
 | 
|
371  | 
  \<and> ~(e1 \<inter> S = {}) \<and> ~(e2 \<inter> S = {}))"
 | 
|
372  | 
||
373  | 
lemma connected_local:  | 
|
374  | 
"connected S \<longleftrightarrow> ~(\<exists>e1 e2.  | 
|
375  | 
openin (subtopology euclidean S) e1 \<and>  | 
|
376  | 
openin (subtopology euclidean S) e2 \<and>  | 
|
377  | 
S \<subseteq> e1 \<union> e2 \<and>  | 
|
378  | 
                 e1 \<inter> e2 = {} \<and>
 | 
|
379  | 
                 ~(e1 = {}) \<and>
 | 
|
380  | 
                 ~(e2 = {}))"
 | 
|
381  | 
unfolding connected_def openin_open by (safe, blast+)  | 
|
382  | 
||
| 34105 | 383  | 
lemma exists_diff:  | 
384  | 
fixes P :: "'a set \<Rightarrow> bool"  | 
|
385  | 
shows "(\<exists>S. P(- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs")  | 
|
| 33175 | 386  | 
proof-  | 
387  | 
  {assume "?lhs" hence ?rhs by blast }
 | 
|
388  | 
moreover  | 
|
389  | 
  {fix S assume H: "P S"
 | 
|
| 34105 | 390  | 
have "S = - (- S)" by auto  | 
391  | 
with H have "P (- (- S))" by metis }  | 
|
| 33175 | 392  | 
ultimately show ?thesis by metis  | 
393  | 
qed  | 
|
394  | 
||
395  | 
lemma connected_clopen: "connected S \<longleftrightarrow>  | 
|
396  | 
(\<forall>T. openin (subtopology euclidean S) T \<and>  | 
|
397  | 
            closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
 | 
|
398  | 
proof-  | 
|
| 34105 | 399  | 
  have " \<not> connected S \<longleftrightarrow> (\<exists>e1 e2. open e1 \<and> open (- e2) \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
 | 
| 33175 | 400  | 
unfolding connected_def openin_open closedin_closed  | 
401  | 
apply (subst exists_diff) by blast  | 
|
| 34105 | 402  | 
  hence th0: "connected S \<longleftrightarrow> \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
 | 
403  | 
(is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis  | 
|
| 33175 | 404  | 
|
405  | 
  have th1: "?rhs \<longleftrightarrow> \<not> (\<exists>t' t. closed t'\<and>t = S\<inter>t' \<and> t\<noteq>{} \<and> t\<noteq>S \<and> (\<exists>t'. open t' \<and> t = S \<inter> t'))"
 | 
|
406  | 
(is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")  | 
|
407  | 
unfolding connected_def openin_open closedin_closed by auto  | 
|
408  | 
  {fix e2
 | 
|
409  | 
    {fix e1 have "?P e2 e1 \<longleftrightarrow> (\<exists>t.  closed e2 \<and> t = S\<inter>e2 \<and> open e1 \<and> t = S\<inter>e1 \<and> t\<noteq>{} \<and> t\<noteq>S)"
 | 
|
410  | 
by auto}  | 
|
411  | 
then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis}  | 
|
412  | 
then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast  | 
|
413  | 
then show ?thesis unfolding th0 th1 by simp  | 
|
414  | 
qed  | 
|
415  | 
||
416  | 
lemma connected_empty[simp, intro]: "connected {}"
 | 
|
417  | 
by (simp add: connected_def)  | 
|
418  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
419  | 
|
| 33175 | 420  | 
subsection{* Limit points *}
 | 
421  | 
||
| 
44207
 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 
huffman 
parents: 
44170 
diff
changeset
 | 
422  | 
definition (in topological_space)  | 
| 
 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 
huffman 
parents: 
44170 
diff
changeset
 | 
423  | 
islimpt:: "'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "islimpt" 60) where  | 
| 33175 | 424  | 
"x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))"  | 
425  | 
||
426  | 
lemma islimptI:  | 
|
427  | 
assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"  | 
|
428  | 
shows "x islimpt S"  | 
|
429  | 
using assms unfolding islimpt_def by auto  | 
|
430  | 
||
431  | 
lemma islimptE:  | 
|
432  | 
assumes "x islimpt S" and "x \<in> T" and "open T"  | 
|
433  | 
obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"  | 
|
434  | 
using assms unfolding islimpt_def by auto  | 
|
435  | 
||
| 44584 | 436  | 
lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)"  | 
437  | 
unfolding islimpt_def eventually_at_topological by auto  | 
|
438  | 
||
439  | 
lemma islimpt_subset: "\<lbrakk>x islimpt S; S \<subseteq> T\<rbrakk> \<Longrightarrow> x islimpt T"  | 
|
440  | 
unfolding islimpt_def by fast  | 
|
| 33175 | 441  | 
|
442  | 
lemma islimpt_approachable:  | 
|
443  | 
fixes x :: "'a::metric_space"  | 
|
444  | 
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)"  | 
|
| 44584 | 445  | 
unfolding islimpt_iff_eventually eventually_at by fast  | 
| 33175 | 446  | 
|
447  | 
lemma islimpt_approachable_le:  | 
|
448  | 
fixes x :: "'a::metric_space"  | 
|
449  | 
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)"  | 
|
450  | 
unfolding islimpt_approachable  | 
|
| 44584 | 451  | 
using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x",  | 
452  | 
THEN arg_cong [where f=Not]]  | 
|
453  | 
by (simp add: Bex_def conj_commute conj_left_commute)  | 
|
| 33175 | 454  | 
|
| 44571 | 455  | 
lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
 | 
456  | 
  unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
 | 
|
457  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
458  | 
text {* A perfect space has no isolated points. *}
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
459  | 
|
| 44571 | 460  | 
lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV"  | 
461  | 
unfolding islimpt_UNIV_iff by (rule not_open_singleton)  | 
|
| 33175 | 462  | 
|
463  | 
lemma perfect_choose_dist:  | 
|
| 
44072
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
464  | 
  fixes x :: "'a::{perfect_space, metric_space}"
 | 
| 33175 | 465  | 
shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"  | 
466  | 
using islimpt_UNIV [of x]  | 
|
467  | 
by (simp add: islimpt_approachable)  | 
|
468  | 
||
469  | 
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)"  | 
|
470  | 
unfolding closed_def  | 
|
471  | 
apply (subst open_subopen)  | 
|
| 34105 | 472  | 
apply (simp add: islimpt_def subset_eq)  | 
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
473  | 
by (metis ComplE ComplI)  | 
| 33175 | 474  | 
|
475  | 
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
 | 
|
476  | 
unfolding islimpt_def by auto  | 
|
477  | 
||
478  | 
lemma finite_set_avoid:  | 
|
479  | 
fixes a :: "'a::metric_space"  | 
|
480  | 
assumes fS: "finite S" shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x"  | 
|
481  | 
proof(induct rule: finite_induct[OF fS])  | 
|
| 41863 | 482  | 
case 1 thus ?case by (auto intro: zero_less_one)  | 
| 33175 | 483  | 
next  | 
484  | 
case (2 x F)  | 
|
485  | 
from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast  | 
|
486  | 
  {assume "x = a" hence ?case using d by auto  }
 | 
|
487  | 
moreover  | 
|
488  | 
  {assume xa: "x\<noteq>a"
 | 
|
489  | 
let ?d = "min d (dist a x)"  | 
|
490  | 
have dp: "?d > 0" using xa d(1) using dist_nz by auto  | 
|
491  | 
from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto  | 
|
492  | 
with dp xa have ?case by(auto intro!: exI[where x="?d"]) }  | 
|
493  | 
ultimately show ?case by blast  | 
|
494  | 
qed  | 
|
495  | 
||
496  | 
lemma islimpt_finite:  | 
|
497  | 
fixes S :: "'a::metric_space set"  | 
|
498  | 
assumes fS: "finite S" shows "\<not> a islimpt S"  | 
|
499  | 
unfolding islimpt_approachable  | 
|
500  | 
using finite_set_avoid[OF fS, of a] by (metis dist_commute not_le)  | 
|
501  | 
||
502  | 
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"  | 
|
503  | 
apply (rule iffI)  | 
|
504  | 
defer  | 
|
505  | 
apply (metis Un_upper1 Un_upper2 islimpt_subset)  | 
|
506  | 
unfolding islimpt_def  | 
|
507  | 
apply (rule ccontr, clarsimp, rename_tac A B)  | 
|
508  | 
apply (drule_tac x="A \<inter> B" in spec)  | 
|
509  | 
apply (auto simp add: open_Int)  | 
|
510  | 
done  | 
|
511  | 
||
512  | 
lemma discrete_imp_closed:  | 
|
513  | 
fixes S :: "'a::metric_space set"  | 
|
514  | 
assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x"  | 
|
515  | 
shows "closed S"  | 
|
516  | 
proof-  | 
|
517  | 
  {fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
 | 
|
518  | 
from e have e2: "e/2 > 0" by arith  | 
|
519  | 
from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast  | 
|
520  | 
let ?m = "min (e/2) (dist x y) "  | 
|
521  | 
from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym])  | 
|
522  | 
from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast  | 
|
523  | 
have th: "dist z y < e" using z y  | 
|
524  | 
by (intro dist_triangle_lt [where z=x], simp)  | 
|
525  | 
from d[rule_format, OF y(1) z(1) th] y z  | 
|
526  | 
have False by (auto simp add: dist_commute)}  | 
|
527  | 
then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a])  | 
|
528  | 
qed  | 
|
529  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
530  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
531  | 
subsection {* Interior of a Set *}
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
532  | 
|
| 44519 | 533  | 
definition "interior S = \<Union>{T. open T \<and> T \<subseteq> S}"
 | 
534  | 
||
535  | 
lemma interiorI [intro?]:  | 
|
536  | 
assumes "open T" and "x \<in> T" and "T \<subseteq> S"  | 
|
537  | 
shows "x \<in> interior S"  | 
|
538  | 
using assms unfolding interior_def by fast  | 
|
539  | 
||
540  | 
lemma interiorE [elim?]:  | 
|
541  | 
assumes "x \<in> interior S"  | 
|
542  | 
obtains T where "open T" and "x \<in> T" and "T \<subseteq> S"  | 
|
543  | 
using assms unfolding interior_def by fast  | 
|
544  | 
||
545  | 
lemma open_interior [simp, intro]: "open (interior S)"  | 
|
546  | 
by (simp add: interior_def open_Union)  | 
|
547  | 
||
548  | 
lemma interior_subset: "interior S \<subseteq> S"  | 
|
549  | 
by (auto simp add: interior_def)  | 
|
550  | 
||
551  | 
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> interior S"  | 
|
552  | 
by (auto simp add: interior_def)  | 
|
553  | 
||
554  | 
lemma interior_open: "open S \<Longrightarrow> interior S = S"  | 
|
555  | 
by (intro equalityI interior_subset interior_maximal subset_refl)  | 
|
| 33175 | 556  | 
|
557  | 
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"  | 
|
| 44519 | 558  | 
by (metis open_interior interior_open)  | 
559  | 
||
560  | 
lemma open_subset_interior: "open S \<Longrightarrow> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"  | 
|
| 33175 | 561  | 
by (metis interior_maximal interior_subset subset_trans)  | 
562  | 
||
| 44519 | 563  | 
lemma interior_empty [simp]: "interior {} = {}"
 | 
564  | 
using open_empty by (rule interior_open)  | 
|
565  | 
||
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
566  | 
lemma interior_UNIV [simp]: "interior UNIV = UNIV"  | 
| 
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
567  | 
using open_UNIV by (rule interior_open)  | 
| 
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
568  | 
|
| 44519 | 569  | 
lemma interior_interior [simp]: "interior (interior S) = interior S"  | 
570  | 
using open_interior by (rule interior_open)  | 
|
571  | 
||
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
572  | 
lemma interior_mono: "S \<subseteq> T \<Longrightarrow> interior S \<subseteq> interior T"  | 
| 
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
573  | 
by (auto simp add: interior_def)  | 
| 44519 | 574  | 
|
575  | 
lemma interior_unique:  | 
|
576  | 
assumes "T \<subseteq> S" and "open T"  | 
|
577  | 
assumes "\<And>T'. T' \<subseteq> S \<Longrightarrow> open T' \<Longrightarrow> T' \<subseteq> T"  | 
|
578  | 
shows "interior S = T"  | 
|
579  | 
by (intro equalityI assms interior_subset open_interior interior_maximal)  | 
|
580  | 
||
581  | 
lemma interior_inter [simp]: "interior (S \<inter> T) = interior S \<inter> interior T"  | 
|
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
582  | 
by (intro equalityI Int_mono Int_greatest interior_mono Int_lower1  | 
| 44519 | 583  | 
Int_lower2 interior_maximal interior_subset open_Int open_interior)  | 
584  | 
||
585  | 
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"  | 
|
586  | 
using open_contains_ball_eq [where S="interior S"]  | 
|
587  | 
by (simp add: open_subset_interior)  | 
|
| 33175 | 588  | 
|
589  | 
lemma interior_limit_point [intro]:  | 
|
590  | 
fixes x :: "'a::perfect_space"  | 
|
591  | 
assumes x: "x \<in> interior S" shows "x islimpt S"  | 
|
| 
44072
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
592  | 
using x islimpt_UNIV [of x]  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
593  | 
unfolding interior_def islimpt_def  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
594  | 
apply (clarsimp, rename_tac T T')  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
595  | 
apply (drule_tac x="T \<inter> T'" in spec)  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
596  | 
apply (auto simp add: open_Int)  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
597  | 
done  | 
| 33175 | 598  | 
|
599  | 
lemma interior_closed_Un_empty_interior:  | 
|
600  | 
  assumes cS: "closed S" and iT: "interior T = {}"
 | 
|
| 44519 | 601  | 
shows "interior (S \<union> T) = interior S"  | 
| 33175 | 602  | 
proof  | 
| 44519 | 603  | 
show "interior S \<subseteq> interior (S \<union> T)"  | 
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
604  | 
by (rule interior_mono, rule Un_upper1)  | 
| 33175 | 605  | 
next  | 
606  | 
show "interior (S \<union> T) \<subseteq> interior S"  | 
|
607  | 
proof  | 
|
608  | 
fix x assume "x \<in> interior (S \<union> T)"  | 
|
| 44519 | 609  | 
then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" ..  | 
| 33175 | 610  | 
show "x \<in> interior S"  | 
611  | 
proof (rule ccontr)  | 
|
612  | 
assume "x \<notin> interior S"  | 
|
613  | 
with `x \<in> R` `open R` obtain y where "y \<in> R - S"  | 
|
| 44519 | 614  | 
unfolding interior_def by fast  | 
| 33175 | 615  | 
from `open R` `closed S` have "open (R - S)" by (rule open_Diff)  | 
616  | 
from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast  | 
|
617  | 
      from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
 | 
|
618  | 
show "False" unfolding interior_def by fast  | 
|
619  | 
qed  | 
|
620  | 
qed  | 
|
621  | 
qed  | 
|
622  | 
||
| 44365 | 623  | 
lemma interior_Times: "interior (A \<times> B) = interior A \<times> interior B"  | 
624  | 
proof (rule interior_unique)  | 
|
625  | 
show "interior A \<times> interior B \<subseteq> A \<times> B"  | 
|
626  | 
by (intro Sigma_mono interior_subset)  | 
|
627  | 
show "open (interior A \<times> interior B)"  | 
|
628  | 
by (intro open_Times open_interior)  | 
|
| 44519 | 629  | 
fix T assume "T \<subseteq> A \<times> B" and "open T" thus "T \<subseteq> interior A \<times> interior B"  | 
630  | 
proof (safe)  | 
|
631  | 
fix x y assume "(x, y) \<in> T"  | 
|
632  | 
then obtain C D where "open C" "open D" "C \<times> D \<subseteq> T" "x \<in> C" "y \<in> D"  | 
|
633  | 
using `open T` unfolding open_prod_def by fast  | 
|
634  | 
hence "open C" "open D" "C \<subseteq> A" "D \<subseteq> B" "x \<in> C" "y \<in> D"  | 
|
635  | 
using `T \<subseteq> A \<times> B` by auto  | 
|
636  | 
thus "x \<in> interior A" and "y \<in> interior B"  | 
|
637  | 
by (auto intro: interiorI)  | 
|
638  | 
qed  | 
|
| 44365 | 639  | 
qed  | 
640  | 
||
| 33175 | 641  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
642  | 
subsection {* Closure of a Set *}
 | 
| 33175 | 643  | 
|
644  | 
definition "closure S = S \<union> {x | x. x islimpt S}"
 | 
|
645  | 
||
| 44518 | 646  | 
lemma interior_closure: "interior S = - (closure (- S))"  | 
647  | 
unfolding interior_def closure_def islimpt_def by auto  | 
|
648  | 
||
| 34105 | 649  | 
lemma closure_interior: "closure S = - interior (- S)"  | 
| 44518 | 650  | 
unfolding interior_closure by simp  | 
| 33175 | 651  | 
|
652  | 
lemma closed_closure[simp, intro]: "closed (closure S)"  | 
|
| 44518 | 653  | 
unfolding closure_interior by (simp add: closed_Compl)  | 
654  | 
||
655  | 
lemma closure_subset: "S \<subseteq> closure S"  | 
|
656  | 
unfolding closure_def by simp  | 
|
| 33175 | 657  | 
|
658  | 
lemma closure_hull: "closure S = closed hull S"  | 
|
| 44519 | 659  | 
unfolding hull_def closure_interior interior_def by auto  | 
| 33175 | 660  | 
|
661  | 
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"  | 
|
| 44519 | 662  | 
unfolding closure_hull using closed_Inter by (rule hull_eq)  | 
663  | 
||
664  | 
lemma closure_closed [simp]: "closed S \<Longrightarrow> closure S = S"  | 
|
665  | 
unfolding closure_eq .  | 
|
666  | 
||
667  | 
lemma closure_closure [simp]: "closure (closure S) = closure S"  | 
|
| 44518 | 668  | 
unfolding closure_hull by (rule hull_hull)  | 
| 33175 | 669  | 
|
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
670  | 
lemma closure_mono: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"  | 
| 44518 | 671  | 
unfolding closure_hull by (rule hull_mono)  | 
| 33175 | 672  | 
|
| 44519 | 673  | 
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T"  | 
| 44518 | 674  | 
unfolding closure_hull by (rule hull_minimal)  | 
| 33175 | 675  | 
|
| 44519 | 676  | 
lemma closure_unique:  | 
677  | 
assumes "S \<subseteq> T" and "closed T"  | 
|
678  | 
assumes "\<And>T'. S \<subseteq> T' \<Longrightarrow> closed T' \<Longrightarrow> T \<subseteq> T'"  | 
|
679  | 
shows "closure S = T"  | 
|
680  | 
using assms unfolding closure_hull by (rule hull_unique)  | 
|
681  | 
||
682  | 
lemma closure_empty [simp]: "closure {} = {}"
 | 
|
| 44518 | 683  | 
using closed_empty by (rule closure_closed)  | 
| 33175 | 684  | 
|
| 
44522
 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 
huffman 
parents: 
44519 
diff
changeset
 | 
685  | 
lemma closure_UNIV [simp]: "closure UNIV = UNIV"  | 
| 44518 | 686  | 
using closed_UNIV by (rule closure_closed)  | 
687  | 
||
688  | 
lemma closure_union [simp]: "closure (S \<union> T) = closure S \<union> closure T"  | 
|
689  | 
unfolding closure_interior by simp  | 
|
| 33175 | 690  | 
|
691  | 
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
 | 
|
692  | 
using closure_empty closure_subset[of S]  | 
|
693  | 
by blast  | 
|
694  | 
||
695  | 
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"  | 
|
696  | 
using closure_eq[of S] closure_subset[of S]  | 
|
697  | 
by simp  | 
|
698  | 
||
699  | 
lemma open_inter_closure_eq_empty:  | 
|
700  | 
  "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
 | 
|
| 34105 | 701  | 
using open_subset_interior[of S "- T"]  | 
702  | 
using interior_subset[of "- T"]  | 
|
| 33175 | 703  | 
unfolding closure_interior  | 
704  | 
by auto  | 
|
705  | 
||
706  | 
lemma open_inter_closure_subset:  | 
|
707  | 
"open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"  | 
|
708  | 
proof  | 
|
709  | 
fix x  | 
|
710  | 
assume as: "open S" "x \<in> S \<inter> closure T"  | 
|
711  | 
  { assume *:"x islimpt T"
 | 
|
712  | 
have "x islimpt (S \<inter> T)"  | 
|
713  | 
proof (rule islimptI)  | 
|
714  | 
fix A  | 
|
715  | 
assume "x \<in> A" "open A"  | 
|
716  | 
with as have "x \<in> A \<inter> S" "open (A \<inter> S)"  | 
|
717  | 
by (simp_all add: open_Int)  | 
|
718  | 
with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x"  | 
|
719  | 
by (rule islimptE)  | 
|
720  | 
hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"  | 
|
721  | 
by simp_all  | 
|
722  | 
thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..  | 
|
723  | 
qed  | 
|
724  | 
}  | 
|
725  | 
then show "x \<in> closure (S \<inter> T)" using as  | 
|
726  | 
unfolding closure_def  | 
|
727  | 
by blast  | 
|
728  | 
qed  | 
|
729  | 
||
| 44519 | 730  | 
lemma closure_complement: "closure (- S) = - interior S"  | 
| 44518 | 731  | 
unfolding closure_interior by simp  | 
| 33175 | 732  | 
|
| 44519 | 733  | 
lemma interior_complement: "interior (- S) = - closure S"  | 
| 44518 | 734  | 
unfolding closure_interior by simp  | 
| 33175 | 735  | 
|
| 44365 | 736  | 
lemma closure_Times: "closure (A \<times> B) = closure A \<times> closure B"  | 
| 44519 | 737  | 
proof (rule closure_unique)  | 
| 44365 | 738  | 
show "A \<times> B \<subseteq> closure A \<times> closure B"  | 
739  | 
by (intro Sigma_mono closure_subset)  | 
|
740  | 
show "closed (closure A \<times> closure B)"  | 
|
741  | 
by (intro closed_Times closed_closure)  | 
|
| 44519 | 742  | 
fix T assume "A \<times> B \<subseteq> T" and "closed T" thus "closure A \<times> closure B \<subseteq> T"  | 
| 44365 | 743  | 
apply (simp add: closed_def open_prod_def, clarify)  | 
744  | 
apply (rule ccontr)  | 
|
745  | 
apply (drule_tac x="(a, b)" in bspec, simp, clarify, rename_tac C D)  | 
|
746  | 
apply (simp add: closure_interior interior_def)  | 
|
747  | 
apply (drule_tac x=C in spec)  | 
|
748  | 
apply (drule_tac x=D in spec)  | 
|
749  | 
apply auto  | 
|
750  | 
done  | 
|
751  | 
qed  | 
|
752  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
753  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
754  | 
subsection {* Frontier (aka boundary) *}
 | 
| 33175 | 755  | 
|
756  | 
definition "frontier S = closure S - interior S"  | 
|
757  | 
||
758  | 
lemma frontier_closed: "closed(frontier S)"  | 
|
759  | 
by (simp add: frontier_def closed_Diff)  | 
|
760  | 
||
| 34105 | 761  | 
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))"  | 
| 33175 | 762  | 
by (auto simp add: frontier_def interior_closure)  | 
763  | 
||
764  | 
lemma frontier_straddle:  | 
|
765  | 
fixes a :: "'a::metric_space"  | 
|
766  | 
shows "a \<in> frontier S \<longleftrightarrow> (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))" (is "?lhs \<longleftrightarrow> ?rhs")  | 
|
767  | 
proof  | 
|
768  | 
assume "?lhs"  | 
|
769  | 
  { fix e::real
 | 
|
770  | 
assume "e > 0"  | 
|
771  | 
let ?rhse = "(\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)"  | 
|
772  | 
    { assume "a\<in>S"
 | 
|
773  | 
have "\<exists>x\<in>S. dist a x < e" using `e>0` `a\<in>S` by(rule_tac x=a in bexI) auto  | 
|
774  | 
moreover have "\<exists>x. x \<notin> S \<and> dist a x < e" using `?lhs` `a\<in>S`  | 
|
775  | 
unfolding frontier_closures closure_def islimpt_def using `e>0`  | 
|
776  | 
by (auto, erule_tac x="ball a e" in allE, auto)  | 
|
777  | 
ultimately have ?rhse by auto  | 
|
778  | 
}  | 
|
779  | 
moreover  | 
|
780  | 
    { assume "a\<notin>S"
 | 
|
781  | 
hence ?rhse using `?lhs`  | 
|
782  | 
unfolding frontier_closures closure_def islimpt_def  | 
|
783  | 
using open_ball[of a e] `e > 0`  | 
|
| 33324 | 784  | 
by simp (metis centre_in_ball mem_ball open_ball)  | 
| 33175 | 785  | 
}  | 
786  | 
ultimately have ?rhse by auto  | 
|
787  | 
}  | 
|
788  | 
thus ?rhs by auto  | 
|
789  | 
next  | 
|
790  | 
assume ?rhs  | 
|
791  | 
moreover  | 
|
792  | 
  { fix T assume "a\<notin>S" and
 | 
|
793  | 
as:"\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)" "a \<notin> S" "a \<in> T" "open T"  | 
|
794  | 
from `open T` `a \<in> T` have "\<exists>e>0. ball a e \<subseteq> T" unfolding open_contains_ball[of T] by auto  | 
|
795  | 
then obtain e where "e>0" "ball a e \<subseteq> T" by auto  | 
|
796  | 
then obtain y where y:"y\<in>S" "dist a y < e" using as(1) by auto  | 
|
797  | 
have "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> a"  | 
|
798  | 
using `dist a y < e` `ball a e \<subseteq> T` unfolding ball_def using `y\<in>S` `a\<notin>S` by auto  | 
|
799  | 
}  | 
|
800  | 
hence "a \<in> closure S" unfolding closure_def islimpt_def using `?rhs` by auto  | 
|
801  | 
moreover  | 
|
802  | 
  { fix T assume "a \<in> T"  "open T" "a\<in>S"
 | 
|
803  | 
then obtain e where "e>0" and balle: "ball a e \<subseteq> T" unfolding open_contains_ball using `?rhs` by auto  | 
|
804  | 
obtain x where "x \<notin> S" "dist a x < e" using `?rhs` using `e>0` by auto  | 
|
| 34105 | 805  | 
hence "\<exists>y\<in>- S. y \<in> T \<and> y \<noteq> a" using balle `a\<in>S` unfolding ball_def by (rule_tac x=x in bexI)auto  | 
| 33175 | 806  | 
}  | 
| 34105 | 807  | 
hence "a islimpt (- S) \<or> a\<notin>S" unfolding islimpt_def by auto  | 
808  | 
ultimately show ?lhs unfolding frontier_closures using closure_def[of "- S"] by auto  | 
|
| 33175 | 809  | 
qed  | 
810  | 
||
811  | 
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"  | 
|
812  | 
by (metis frontier_def closure_closed Diff_subset)  | 
|
813  | 
||
| 34964 | 814  | 
lemma frontier_empty[simp]: "frontier {} = {}"
 | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
815  | 
by (simp add: frontier_def)  | 
| 33175 | 816  | 
|
817  | 
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"  | 
|
818  | 
proof-  | 
|
819  | 
  { assume "frontier S \<subseteq> S"
 | 
|
820  | 
hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto  | 
|
821  | 
hence "closed S" using closure_subset_eq by auto  | 
|
822  | 
}  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
823  | 
thus ?thesis using frontier_subset_closed[of S] ..  | 
| 33175 | 824  | 
qed  | 
825  | 
||
| 34105 | 826  | 
lemma frontier_complement: "frontier(- S) = frontier S"  | 
| 33175 | 827  | 
by (auto simp add: frontier_def closure_complement interior_complement)  | 
828  | 
||
829  | 
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
 | 
|
| 34105 | 830  | 
using frontier_complement frontier_subset_eq[of "- S"]  | 
831  | 
unfolding open_closed by auto  | 
|
| 33175 | 832  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
833  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
834  | 
subsection {* Filters and the ``eventually true'' quantifier *}
 | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
835  | 
|
| 33175 | 836  | 
definition  | 
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
837  | 
at_infinity :: "'a::real_normed_vector filter" where  | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
838  | 
"at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)"  | 
| 33175 | 839  | 
|
840  | 
definition  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
841  | 
indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter"  | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
842  | 
(infixr "indirection" 70) where  | 
| 33175 | 843  | 
  "a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
 | 
844  | 
||
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
845  | 
text{* Prove That They are all filters. *}
 | 
| 33175 | 846  | 
|
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
847  | 
lemma eventually_at_infinity:  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
848  | 
"eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)"  | 
| 33175 | 849  | 
unfolding at_infinity_def  | 
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
850  | 
proof (rule eventually_Abs_filter, rule is_filter.intro)  | 
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
851  | 
fix P Q :: "'a \<Rightarrow> bool"  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
852  | 
assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x"  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
853  | 
then obtain r s where  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
854  | 
"\<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<forall>x. s \<le> norm x \<longrightarrow> Q x" by auto  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
855  | 
then have "\<forall>x. max r s \<le> norm x \<longrightarrow> P x \<and> Q x" by simp  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
856  | 
then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x \<and> Q x" ..  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
857  | 
qed auto  | 
| 33175 | 858  | 
|
| 36437 | 859  | 
text {* Identify Trivial limits, where we can't approach arbitrarily closely. *}
 | 
| 33175 | 860  | 
|
861  | 
lemma trivial_limit_within:  | 
|
862  | 
shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"  | 
|
863  | 
proof  | 
|
864  | 
assume "trivial_limit (at a within S)"  | 
|
865  | 
thus "\<not> a islimpt S"  | 
|
866  | 
unfolding trivial_limit_def  | 
|
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
867  | 
unfolding eventually_within eventually_at_topological  | 
| 33175 | 868  | 
unfolding islimpt_def  | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
869  | 
apply (clarsimp simp add: set_eq_iff)  | 
| 33175 | 870  | 
apply (rename_tac T, rule_tac x=T in exI)  | 
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
871  | 
apply (clarsimp, drule_tac x=y in bspec, simp_all)  | 
| 33175 | 872  | 
done  | 
873  | 
next  | 
|
874  | 
assume "\<not> a islimpt S"  | 
|
875  | 
thus "trivial_limit (at a within S)"  | 
|
876  | 
unfolding trivial_limit_def  | 
|
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
877  | 
unfolding eventually_within eventually_at_topological  | 
| 33175 | 878  | 
unfolding islimpt_def  | 
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
879  | 
apply clarsimp  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
880  | 
apply (rule_tac x=T in exI)  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
881  | 
apply auto  | 
| 33175 | 882  | 
done  | 
883  | 
qed  | 
|
884  | 
||
885  | 
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"  | 
|
886  | 
using trivial_limit_within [of a UNIV]  | 
|
887  | 
by (simp add: within_UNIV)  | 
|
888  | 
||
889  | 
lemma trivial_limit_at:  | 
|
890  | 
fixes a :: "'a::perfect_space"  | 
|
891  | 
shows "\<not> trivial_limit (at a)"  | 
|
| 44571 | 892  | 
by (rule at_neq_bot)  | 
| 33175 | 893  | 
|
894  | 
lemma trivial_limit_at_infinity:  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
895  | 
  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)"
 | 
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
896  | 
unfolding trivial_limit_def eventually_at_infinity  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
897  | 
apply clarsimp  | 
| 
44072
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
898  | 
apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
899  | 
apply (rule_tac x="scaleR (b / norm x) x" in exI, simp)  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
900  | 
apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def])  | 
| 
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
901  | 
apply (drule_tac x=UNIV in spec, simp)  | 
| 33175 | 902  | 
done  | 
903  | 
||
| 36437 | 904  | 
text {* Some property holds "sufficiently close" to the limit point. *}
 | 
| 33175 | 905  | 
|
906  | 
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)  | 
|
907  | 
"eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"  | 
|
908  | 
unfolding eventually_at dist_nz by auto  | 
|
909  | 
||
910  | 
lemma eventually_within: "eventually P (at a within S) \<longleftrightarrow>  | 
|
911  | 
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"  | 
|
912  | 
unfolding eventually_within eventually_at dist_nz by auto  | 
|
913  | 
||
914  | 
lemma eventually_within_le: "eventually P (at a within S) \<longleftrightarrow>  | 
|
915  | 
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" (is "?lhs = ?rhs")  | 
|
916  | 
unfolding eventually_within  | 
|
| 44668 | 917  | 
by auto (metis dense order_le_less_trans)  | 
| 33175 | 918  | 
|
919  | 
lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)"  | 
|
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
920  | 
unfolding trivial_limit_def  | 
| 
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
921  | 
by (auto elim: eventually_rev_mp)  | 
| 33175 | 922  | 
|
923  | 
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"  | 
|
| 
36358
 
246493d61204
define nets directly as filters, instead of as filter bases
 
huffman 
parents: 
36336 
diff
changeset
 | 
924  | 
unfolding trivial_limit_def by (auto elim: eventually_rev_mp)  | 
| 33175 | 925  | 
|
926  | 
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"  | 
|
| 
44342
 
8321948340ea
redefine constant 'trivial_limit' as an abbreviation
 
huffman 
parents: 
44286 
diff
changeset
 | 
927  | 
by (simp add: filter_eq_iff)  | 
| 33175 | 928  | 
|
929  | 
text{* Combining theorems for "eventually" *}
 | 
|
930  | 
||
931  | 
lemma eventually_rev_mono:  | 
|
932  | 
"eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net"  | 
|
933  | 
using eventually_mono [of P Q] by fast  | 
|
934  | 
||
935  | 
lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)"  | 
|
936  | 
by (simp add: eventually_False)  | 
|
937  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
938  | 
|
| 36437 | 939  | 
subsection {* Limits *}
 | 
| 33175 | 940  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
941  | 
text{* Notation Lim to avoid collition with lim defined in analysis *}
 | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
942  | 
|
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
943  | 
definition Lim :: "'a filter \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b"
 | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
944  | 
where "Lim A f = (THE l. (f ---> l) A)"  | 
| 33175 | 945  | 
|
946  | 
lemma Lim:  | 
|
947  | 
"(f ---> l) net \<longleftrightarrow>  | 
|
948  | 
trivial_limit net \<or>  | 
|
949  | 
(\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"  | 
|
950  | 
unfolding tendsto_iff trivial_limit_eq by auto  | 
|
951  | 
||
952  | 
text{* Show that they yield usual definitions in the various cases. *}
 | 
|
953  | 
||
954  | 
lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow>  | 
|
955  | 
(\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> dist (f x) l < e)"  | 
|
956  | 
by (auto simp add: tendsto_iff eventually_within_le)  | 
|
957  | 
||
958  | 
lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow>  | 
|
959  | 
(\<forall>e >0. \<exists>d>0. \<forall>x \<in> S. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)"  | 
|
960  | 
by (auto simp add: tendsto_iff eventually_within)  | 
|
961  | 
||
962  | 
lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow>  | 
|
963  | 
(\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)"  | 
|
964  | 
by (auto simp add: tendsto_iff eventually_at)  | 
|
965  | 
||
966  | 
lemma Lim_at_iff_LIM: "(f ---> l) (at a) \<longleftrightarrow> f -- a --> l"  | 
|
967  | 
unfolding Lim_at LIM_def by (simp only: zero_less_dist_iff)  | 
|
968  | 
||
969  | 
lemma Lim_at_infinity:  | 
|
970  | 
"(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)"  | 
|
971  | 
by (auto simp add: tendsto_iff eventually_at_infinity)  | 
|
972  | 
||
973  | 
lemma Lim_sequentially:  | 
|
974  | 
"(S ---> l) sequentially \<longleftrightarrow>  | 
|
975  | 
(\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (S n) l < e)"  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
976  | 
by (rule LIMSEQ_def) (* FIXME: redundant *)  | 
| 33175 | 977  | 
|
978  | 
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net"  | 
|
979  | 
by (rule topological_tendstoI, auto elim: eventually_rev_mono)  | 
|
980  | 
||
981  | 
text{* The expected monotonicity property. *}
 | 
|
982  | 
||
983  | 
lemma Lim_within_empty: "(f ---> l) (net within {})"
 | 
|
984  | 
unfolding tendsto_def Limits.eventually_within by simp  | 
|
985  | 
||
986  | 
lemma Lim_within_subset: "(f ---> l) (net within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f ---> l) (net within T)"  | 
|
987  | 
unfolding tendsto_def Limits.eventually_within  | 
|
988  | 
by (auto elim!: eventually_elim1)  | 
|
989  | 
||
990  | 
lemma Lim_Un: assumes "(f ---> l) (net within S)" "(f ---> l) (net within T)"  | 
|
991  | 
shows "(f ---> l) (net within (S \<union> T))"  | 
|
992  | 
using assms unfolding tendsto_def Limits.eventually_within  | 
|
993  | 
apply clarify  | 
|
994  | 
apply (drule spec, drule (1) mp, drule (1) mp)  | 
|
995  | 
apply (drule spec, drule (1) mp, drule (1) mp)  | 
|
996  | 
apply (auto elim: eventually_elim2)  | 
|
997  | 
done  | 
|
998  | 
||
999  | 
lemma Lim_Un_univ:  | 
|
1000  | 
"(f ---> l) (net within S) \<Longrightarrow> (f ---> l) (net within T) \<Longrightarrow> S \<union> T = UNIV  | 
|
1001  | 
==> (f ---> l) net"  | 
|
1002  | 
by (metis Lim_Un within_UNIV)  | 
|
1003  | 
||
1004  | 
text{* Interrelations between restricted and unrestricted limits. *}
 | 
|
1005  | 
||
1006  | 
lemma Lim_at_within: "(f ---> l) net ==> (f ---> l)(net within S)"  | 
|
1007  | 
(* FIXME: rename *)  | 
|
1008  | 
unfolding tendsto_def Limits.eventually_within  | 
|
1009  | 
apply (clarify, drule spec, drule (1) mp, drule (1) mp)  | 
|
1010  | 
by (auto elim!: eventually_elim1)  | 
|
1011  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1012  | 
lemma eventually_within_interior:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1013  | 
assumes "x \<in> interior S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1014  | 
shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" (is "?lhs = ?rhs")  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1015  | 
proof-  | 
| 44519 | 1016  | 
from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" ..  | 
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1017  | 
  { assume "?lhs"
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1018  | 
then obtain A where "open A" "x \<in> A" "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1019  | 
unfolding Limits.eventually_within Limits.eventually_at_topological  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1020  | 
by auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1021  | 
with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1022  | 
by auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1023  | 
then have "?rhs"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1024  | 
unfolding Limits.eventually_at_topological by auto  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1025  | 
} moreover  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1026  | 
  { assume "?rhs" hence "?lhs"
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1027  | 
unfolding Limits.eventually_within  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1028  | 
by (auto elim: eventually_elim1)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1029  | 
} ultimately  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1030  | 
show "?thesis" ..  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1031  | 
qed  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1032  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1033  | 
lemma at_within_interior:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1034  | 
"x \<in> interior S \<Longrightarrow> at x within S = at x"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1035  | 
by (simp add: filter_eq_iff eventually_within_interior)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1036  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1037  | 
lemma at_within_open:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1038  | 
"\<lbrakk>x \<in> S; open S\<rbrakk> \<Longrightarrow> at x within S = at x"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1039  | 
by (simp only: at_within_interior interior_open)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1040  | 
|
| 33175 | 1041  | 
lemma Lim_within_open:  | 
1042  | 
fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"  | 
|
1043  | 
assumes"a \<in> S" "open S"  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1044  | 
shows "(f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1045  | 
using assms by (simp only: at_within_open)  | 
| 33175 | 1046  | 
|
| 43338 | 1047  | 
lemma Lim_within_LIMSEQ:  | 
| 44584 | 1048  | 
fixes a :: "'a::metric_space"  | 
| 43338 | 1049  | 
assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"  | 
1050  | 
shows "(X ---> L) (at a within T)"  | 
|
| 44584 | 1051  | 
using assms unfolding tendsto_def [where l=L]  | 
1052  | 
by (simp add: sequentially_imp_eventually_within)  | 
|
| 43338 | 1053  | 
|
1054  | 
lemma Lim_right_bound:  | 
|
1055  | 
fixes f :: "real \<Rightarrow> real"  | 
|
1056  | 
assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b"  | 
|
1057  | 
assumes bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a"  | 
|
1058  | 
  shows "(f ---> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
 | 
|
1059  | 
proof cases  | 
|
1060  | 
  assume "{x<..} \<inter> I = {}" then show ?thesis by (simp add: Lim_within_empty)
 | 
|
1061  | 
next  | 
|
1062  | 
  assume [simp]: "{x<..} \<inter> I \<noteq> {}"
 | 
|
1063  | 
show ?thesis  | 
|
1064  | 
proof (rule Lim_within_LIMSEQ, safe)  | 
|
1065  | 
    fix S assume S: "\<forall>n. S n \<noteq> x \<and> S n \<in> {x <..} \<inter> I" "S ----> x"
 | 
|
1066  | 
||
1067  | 
    show "(\<lambda>n. f (S n)) ----> Inf (f ` ({x<..} \<inter> I))"
 | 
|
1068  | 
proof (rule LIMSEQ_I, rule ccontr)  | 
|
1069  | 
fix r :: real assume "0 < r"  | 
|
1070  | 
      with Inf_close[of "f ` ({x<..} \<inter> I)" r]
 | 
|
1071  | 
      obtain y where y: "x < y" "y \<in> I" "f y < Inf (f ` ({x <..} \<inter> I)) + r" by auto
 | 
|
1072  | 
from `x < y` have "0 < y - x" by auto  | 
|
1073  | 
from S(2)[THEN LIMSEQ_D, OF this]  | 
|
1074  | 
obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> \<bar>S n - x\<bar> < y - x" by auto  | 
|
1075  | 
||
1076  | 
      assume "\<not> (\<exists>N. \<forall>n\<ge>N. norm (f (S n) - Inf (f ` ({x<..} \<inter> I))) < r)"
 | 
|
1077  | 
      moreover have "\<And>n. Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
 | 
|
1078  | 
using S bnd by (intro Inf_lower[where z=K]) auto  | 
|
1079  | 
      ultimately obtain n where n: "N \<le> n" "r + Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
 | 
|
1080  | 
by (auto simp: not_less field_simps)  | 
|
1081  | 
with N[OF n(1)] mono[OF _ `y \<in> I`, of "S n"] S(1)[THEN spec, of n] y  | 
|
1082  | 
show False by auto  | 
|
1083  | 
qed  | 
|
1084  | 
qed  | 
|
1085  | 
qed  | 
|
1086  | 
||
| 33175 | 1087  | 
text{* Another limit point characterization. *}
 | 
1088  | 
||
1089  | 
lemma islimpt_sequential:  | 
|
| 36667 | 1090  | 
fixes x :: "'a::metric_space"  | 
| 33175 | 1091  | 
  shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)"
 | 
1092  | 
(is "?lhs = ?rhs")  | 
|
1093  | 
proof  | 
|
1094  | 
assume ?lhs  | 
|
1095  | 
then obtain f where f:"\<forall>y. y>0 \<longrightarrow> f y \<in> S \<and> f y \<noteq> x \<and> dist (f y) x < y"  | 
|
| 44584 | 1096  | 
unfolding islimpt_approachable  | 
1097  | 
using choice[of "\<lambda>e y. e>0 \<longrightarrow> y\<in>S \<and> y\<noteq>x \<and> dist y x < e"] by auto  | 
|
1098  | 
let ?I = "\<lambda>n. inverse (real (Suc n))"  | 
|
1099  | 
  have "\<forall>n. f (?I n) \<in> S - {x}" using f by simp
 | 
|
1100  | 
moreover have "(\<lambda>n. f (?I n)) ----> x"  | 
|
1101  | 
proof (rule metric_tendsto_imp_tendsto)  | 
|
1102  | 
show "?I ----> 0"  | 
|
1103  | 
by (rule LIMSEQ_inverse_real_of_nat)  | 
|
1104  | 
show "eventually (\<lambda>n. dist (f (?I n)) x \<le> dist (?I n) 0) sequentially"  | 
|
1105  | 
by (simp add: norm_conv_dist [symmetric] less_imp_le f)  | 
|
1106  | 
qed  | 
|
1107  | 
ultimately show ?rhs by fast  | 
|
| 33175 | 1108  | 
next  | 
1109  | 
assume ?rhs  | 
|
1110  | 
  then obtain f::"nat\<Rightarrow>'a"  where f:"(\<forall>n. f n \<in> S - {x})" "(\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f n) x < e)" unfolding Lim_sequentially by auto
 | 
|
1111  | 
  { fix e::real assume "e>0"
 | 
|
1112  | 
then obtain N where "dist (f N) x < e" using f(2) by auto  | 
|
1113  | 
moreover have "f N\<in>S" "f N \<noteq> x" using f(1) by auto  | 
|
1114  | 
ultimately have "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" by auto  | 
|
1115  | 
}  | 
|
1116  | 
thus ?lhs unfolding islimpt_approachable by auto  | 
|
1117  | 
qed  | 
|
1118  | 
||
| 44125 | 1119  | 
lemma Lim_inv: (* TODO: delete *)  | 
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
1120  | 
fixes f :: "'a \<Rightarrow> real" and A :: "'a filter"  | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
1121  | 
assumes "(f ---> l) A" and "l \<noteq> 0"  | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
1122  | 
shows "((inverse o f) ---> inverse l) A"  | 
| 36437 | 1123  | 
unfolding o_def using assms by (rule tendsto_inverse)  | 
1124  | 
||
| 33175 | 1125  | 
lemma Lim_null:  | 
1126  | 
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"  | 
|
| 44125 | 1127  | 
shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net"  | 
| 33175 | 1128  | 
by (simp add: Lim dist_norm)  | 
1129  | 
||
1130  | 
lemma Lim_null_comparison:  | 
|
1131  | 
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"  | 
|
1132  | 
assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net"  | 
|
1133  | 
shows "(f ---> 0) net"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1134  | 
proof (rule metric_tendsto_imp_tendsto)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1135  | 
show "(g ---> 0) net" by fact  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1136  | 
show "eventually (\<lambda>x. dist (f x) 0 \<le> dist (g x) 0) net"  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1137  | 
using assms(1) by (rule eventually_elim1, simp add: dist_norm)  | 
| 33175 | 1138  | 
qed  | 
1139  | 
||
1140  | 
lemma Lim_transform_bound:  | 
|
1141  | 
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"  | 
|
1142  | 
fixes g :: "'a \<Rightarrow> 'c::real_normed_vector"  | 
|
1143  | 
assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net" "(g ---> 0) net"  | 
|
1144  | 
shows "(f ---> 0) net"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1145  | 
using assms(1) tendsto_norm_zero [OF assms(2)]  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1146  | 
by (rule Lim_null_comparison)  | 
| 33175 | 1147  | 
|
1148  | 
text{* Deducing things about the limit from the elements. *}
 | 
|
1149  | 
||
1150  | 
lemma Lim_in_closed_set:  | 
|
1151  | 
assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) net" "\<not>(trivial_limit net)" "(f ---> l) net"  | 
|
1152  | 
shows "l \<in> S"  | 
|
1153  | 
proof (rule ccontr)  | 
|
1154  | 
assume "l \<notin> S"  | 
|
1155  | 
with `closed S` have "open (- S)" "l \<in> - S"  | 
|
1156  | 
by (simp_all add: open_Compl)  | 
|
1157  | 
with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net"  | 
|
1158  | 
by (rule topological_tendstoD)  | 
|
1159  | 
with assms(2) have "eventually (\<lambda>x. False) net"  | 
|
1160  | 
by (rule eventually_elim2) simp  | 
|
1161  | 
with assms(3) show "False"  | 
|
1162  | 
by (simp add: eventually_False)  | 
|
1163  | 
qed  | 
|
1164  | 
||
1165  | 
text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *}
 | 
|
1166  | 
||
1167  | 
lemma Lim_dist_ubound:  | 
|
1168  | 
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. dist a (f x) <= e) net"  | 
|
1169  | 
shows "dist a l <= e"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1170  | 
proof-  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1171  | 
  have "dist a l \<in> {..e}"
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1172  | 
proof (rule Lim_in_closed_set)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1173  | 
    show "closed {..e}" by simp
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1174  | 
    show "eventually (\<lambda>x. dist a (f x) \<in> {..e}) net" by (simp add: assms)
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1175  | 
show "\<not> trivial_limit net" by fact  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1176  | 
show "((\<lambda>x. dist a (f x)) ---> dist a l) net" by (intro tendsto_intros assms)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1177  | 
qed  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1178  | 
thus ?thesis by simp  | 
| 33175 | 1179  | 
qed  | 
1180  | 
||
1181  | 
lemma Lim_norm_ubound:  | 
|
1182  | 
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"  | 
|
1183  | 
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) <= e) net"  | 
|
1184  | 
shows "norm(l) <= e"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1185  | 
proof-  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1186  | 
  have "norm l \<in> {..e}"
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1187  | 
proof (rule Lim_in_closed_set)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1188  | 
    show "closed {..e}" by simp
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1189  | 
    show "eventually (\<lambda>x. norm (f x) \<in> {..e}) net" by (simp add: assms)
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1190  | 
show "\<not> trivial_limit net" by fact  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1191  | 
show "((\<lambda>x. norm (f x)) ---> norm l) net" by (intro tendsto_intros assms)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1192  | 
qed  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1193  | 
thus ?thesis by simp  | 
| 33175 | 1194  | 
qed  | 
1195  | 
||
1196  | 
lemma Lim_norm_lbound:  | 
|
1197  | 
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"  | 
|
1198  | 
assumes "\<not> (trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. e <= norm(f x)) net"  | 
|
1199  | 
shows "e \<le> norm l"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1200  | 
proof-  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1201  | 
  have "norm l \<in> {e..}"
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1202  | 
proof (rule Lim_in_closed_set)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1203  | 
    show "closed {e..}" by simp
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1204  | 
    show "eventually (\<lambda>x. norm (f x) \<in> {e..}) net" by (simp add: assms)
 | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1205  | 
show "\<not> trivial_limit net" by fact  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1206  | 
show "((\<lambda>x. norm (f x)) ---> norm l) net" by (intro tendsto_intros assms)  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1207  | 
qed  | 
| 
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1208  | 
thus ?thesis by simp  | 
| 33175 | 1209  | 
qed  | 
1210  | 
||
1211  | 
text{* Uniqueness of the limit, when nontrivial. *}
 | 
|
1212  | 
||
1213  | 
lemma tendsto_Lim:  | 
|
1214  | 
fixes f :: "'a \<Rightarrow> 'b::t2_space"  | 
|
1215  | 
shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l"  | 
|
| 41970 | 1216  | 
unfolding Lim_def using tendsto_unique[of net f] by auto  | 
| 33175 | 1217  | 
|
1218  | 
text{* Limit under bilinear function *}
 | 
|
1219  | 
||
1220  | 
lemma Lim_bilinear:  | 
|
1221  | 
assumes "(f ---> l) net" and "(g ---> m) net" and "bounded_bilinear h"  | 
|
1222  | 
shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net"  | 
|
1223  | 
using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net`  | 
|
1224  | 
by (rule bounded_bilinear.tendsto)  | 
|
1225  | 
||
1226  | 
text{* These are special for limits out of the same vector space. *}
 | 
|
1227  | 
||
1228  | 
lemma Lim_within_id: "(id ---> a) (at a within s)"  | 
|
1229  | 
unfolding tendsto_def Limits.eventually_within eventually_at_topological  | 
|
1230  | 
by auto  | 
|
1231  | 
||
1232  | 
lemma Lim_at_id: "(id ---> a) (at a)"  | 
|
1233  | 
apply (subst within_UNIV[symmetric]) by (simp add: Lim_within_id)  | 
|
1234  | 
||
1235  | 
lemma Lim_at_zero:  | 
|
1236  | 
fixes a :: "'a::real_normed_vector"  | 
|
1237  | 
fixes l :: "'b::topological_space"  | 
|
1238  | 
shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" (is "?lhs = ?rhs")  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1239  | 
using LIM_offset_zero LIM_offset_zero_cancel ..  | 
| 33175 | 1240  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
1241  | 
text{* It's also sometimes useful to extract the limit point from the filter. *}
 | 
| 33175 | 1242  | 
|
1243  | 
definition  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
1244  | 
netlimit :: "'a::t2_space filter \<Rightarrow> 'a" where  | 
| 33175 | 1245  | 
"netlimit net = (SOME a. ((\<lambda>x. x) ---> a) net)"  | 
1246  | 
||
1247  | 
lemma netlimit_within:  | 
|
1248  | 
assumes "\<not> trivial_limit (at a within S)"  | 
|
1249  | 
shows "netlimit (at a within S) = a"  | 
|
1250  | 
unfolding netlimit_def  | 
|
1251  | 
apply (rule some_equality)  | 
|
1252  | 
apply (rule Lim_at_within)  | 
|
| 
44568
 
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
 
huffman 
parents: 
44533 
diff
changeset
 | 
1253  | 
apply (rule tendsto_ident_at)  | 
| 41970 | 1254  | 
apply (erule tendsto_unique [OF assms])  | 
| 33175 | 1255  | 
apply (rule Lim_at_within)  | 
| 
44568
 
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
 
huffman 
parents: 
44533 
diff
changeset
 | 
1256  | 
apply (rule tendsto_ident_at)  | 
| 33175 | 1257  | 
done  | 
1258  | 
||
1259  | 
lemma netlimit_at:  | 
|
| 
44072
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
1260  | 
  fixes a :: "'a::{perfect_space,t2_space}"
 | 
| 33175 | 1261  | 
shows "netlimit (at a) = a"  | 
1262  | 
apply (subst within_UNIV[symmetric])  | 
|
1263  | 
using netlimit_within[of a UNIV]  | 
|
| 44584 | 1264  | 
by (simp add: within_UNIV)  | 
| 33175 | 1265  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1266  | 
lemma lim_within_interior:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1267  | 
"x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1268  | 
by (simp add: at_within_interior)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1269  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1270  | 
lemma netlimit_within_interior:  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1271  | 
  fixes x :: "'a::{t2_space,perfect_space}"
 | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1272  | 
assumes "x \<in> interior S"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1273  | 
shows "netlimit (at x within S) = x"  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1274  | 
using assms by (simp add: at_within_interior netlimit_at)  | 
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1275  | 
|
| 33175 | 1276  | 
text{* Transformation of limit. *}
 | 
1277  | 
||
1278  | 
lemma Lim_transform:  | 
|
1279  | 
fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector"  | 
|
1280  | 
assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net"  | 
|
1281  | 
shows "(g ---> l) net"  | 
|
| 
44252
 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 
huffman 
parents: 
44250 
diff
changeset
 | 
1282  | 
using tendsto_diff [OF assms(2) assms(1)] by simp  | 
| 33175 | 1283  | 
|
1284  | 
lemma Lim_transform_eventually:  | 
|
| 36667 | 1285  | 
"eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net \<Longrightarrow> (g ---> l) net"  | 
| 33175 | 1286  | 
apply (rule topological_tendstoI)  | 
1287  | 
apply (drule (2) topological_tendstoD)  | 
|
1288  | 
apply (erule (1) eventually_elim2, simp)  | 
|
1289  | 
done  | 
|
1290  | 
||
1291  | 
lemma Lim_transform_within:  | 
|
| 36667 | 1292  | 
assumes "0 < d" and "\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"  | 
1293  | 
and "(f ---> l) (at x within S)"  | 
|
1294  | 
shows "(g ---> l) (at x within S)"  | 
|
1295  | 
proof (rule Lim_transform_eventually)  | 
|
1296  | 
show "eventually (\<lambda>x. f x = g x) (at x within S)"  | 
|
1297  | 
unfolding eventually_within  | 
|
1298  | 
using assms(1,2) by auto  | 
|
1299  | 
show "(f ---> l) (at x within S)" by fact  | 
|
1300  | 
qed  | 
|
| 33175 | 1301  | 
|
1302  | 
lemma Lim_transform_at:  | 
|
| 36667 | 1303  | 
assumes "0 < d" and "\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"  | 
1304  | 
and "(f ---> l) (at x)"  | 
|
1305  | 
shows "(g ---> l) (at x)"  | 
|
1306  | 
proof (rule Lim_transform_eventually)  | 
|
1307  | 
show "eventually (\<lambda>x. f x = g x) (at x)"  | 
|
1308  | 
unfolding eventually_at  | 
|
1309  | 
using assms(1,2) by auto  | 
|
1310  | 
show "(f ---> l) (at x)" by fact  | 
|
1311  | 
qed  | 
|
| 33175 | 1312  | 
|
1313  | 
text{* Common case assuming being away from some crucial point like 0. *}
 | 
|
1314  | 
||
1315  | 
lemma Lim_transform_away_within:  | 
|
| 36669 | 1316  | 
fixes a b :: "'a::t1_space"  | 
| 36667 | 1317  | 
assumes "a \<noteq> b" and "\<forall>x\<in>S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"  | 
| 33175 | 1318  | 
and "(f ---> l) (at a within S)"  | 
1319  | 
shows "(g ---> l) (at a within S)"  | 
|
| 36669 | 1320  | 
proof (rule Lim_transform_eventually)  | 
1321  | 
show "(f ---> l) (at a within S)" by fact  | 
|
1322  | 
show "eventually (\<lambda>x. f x = g x) (at a within S)"  | 
|
1323  | 
unfolding Limits.eventually_within eventually_at_topological  | 
|
1324  | 
    by (rule exI [where x="- {b}"], simp add: open_Compl assms)
 | 
|
| 33175 | 1325  | 
qed  | 
1326  | 
||
1327  | 
lemma Lim_transform_away_at:  | 
|
| 36669 | 1328  | 
fixes a b :: "'a::t1_space"  | 
| 33175 | 1329  | 
assumes ab: "a\<noteq>b" and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"  | 
1330  | 
and fl: "(f ---> l) (at a)"  | 
|
1331  | 
shows "(g ---> l) (at a)"  | 
|
1332  | 
using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl  | 
|
1333  | 
by (auto simp add: within_UNIV)  | 
|
1334  | 
||
1335  | 
text{* Alternatively, within an open set. *}
 | 
|
1336  | 
||
1337  | 
lemma Lim_transform_within_open:  | 
|
| 36667 | 1338  | 
assumes "open S" and "a \<in> S" and "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x"  | 
1339  | 
and "(f ---> l) (at a)"  | 
|
| 33175 | 1340  | 
shows "(g ---> l) (at a)"  | 
| 36667 | 1341  | 
proof (rule Lim_transform_eventually)  | 
1342  | 
show "eventually (\<lambda>x. f x = g x) (at a)"  | 
|
1343  | 
unfolding eventually_at_topological  | 
|
1344  | 
using assms(1,2,3) by auto  | 
|
1345  | 
show "(f ---> l) (at a)" by fact  | 
|
| 33175 | 1346  | 
qed  | 
1347  | 
||
1348  | 
text{* A congruence rule allowing us to transform limits assuming not at point. *}
 | 
|
1349  | 
||
1350  | 
(* FIXME: Only one congruence rule for tendsto can be used at a time! *)  | 
|
1351  | 
||
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1352  | 
lemma Lim_cong_within(*[cong add]*):  | 
| 43338 | 1353  | 
assumes "a = b" "x = y" "S = T"  | 
1354  | 
assumes "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x"  | 
|
1355  | 
shows "(f ---> x) (at a within S) \<longleftrightarrow> (g ---> y) (at b within T)"  | 
|
| 36667 | 1356  | 
unfolding tendsto_def Limits.eventually_within eventually_at_topological  | 
1357  | 
using assms by simp  | 
|
1358  | 
||
1359  | 
lemma Lim_cong_at(*[cong add]*):  | 
|
| 43338 | 1360  | 
assumes "a = b" "x = y"  | 
| 36667 | 1361  | 
assumes "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x"  | 
| 43338 | 1362  | 
shows "((\<lambda>x. f x) ---> x) (at a) \<longleftrightarrow> ((g ---> y) (at a))"  | 
| 36667 | 1363  | 
unfolding tendsto_def eventually_at_topological  | 
1364  | 
using assms by simp  | 
|
| 33175 | 1365  | 
|
1366  | 
text{* Useful lemmas on closure and set of possible sequential limits.*}
 | 
|
1367  | 
||
1368  | 
lemma closure_sequential:  | 
|
| 36667 | 1369  | 
fixes l :: "'a::metric_space"  | 
| 33175 | 1370  | 
shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" (is "?lhs = ?rhs")  | 
1371  | 
proof  | 
|
1372  | 
assume "?lhs" moreover  | 
|
1373  | 
  { assume "l \<in> S"
 | 
|
| 44125 | 1374  | 
hence "?rhs" using tendsto_const[of l sequentially] by auto  | 
| 33175 | 1375  | 
} moreover  | 
1376  | 
  { assume "l islimpt S"
 | 
|
1377  | 
hence "?rhs" unfolding islimpt_sequential by auto  | 
|
1378  | 
} ultimately  | 
|
1379  | 
show "?rhs" unfolding closure_def by auto  | 
|
1380  | 
next  | 
|
1381  | 
assume "?rhs"  | 
|
1382  | 
thus "?lhs" unfolding closure_def unfolding islimpt_sequential by auto  | 
|
1383  | 
qed  | 
|
1384  | 
||
1385  | 
lemma closed_sequential_limits:  | 
|
1386  | 
fixes S :: "'a::metric_space set"  | 
|
1387  | 
shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)"  | 
|
1388  | 
unfolding closed_limpt  | 
|
1389  | 
using closure_sequential [where 'a='a] closure_closed [where 'a='a] closed_limpt [where 'a='a] islimpt_sequential [where 'a='a] mem_delete [where 'a='a]  | 
|
1390  | 
by metis  | 
|
1391  | 
||
1392  | 
lemma closure_approachable:  | 
|
1393  | 
fixes S :: "'a::metric_space set"  | 
|
1394  | 
shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)"  | 
|
1395  | 
apply (auto simp add: closure_def islimpt_approachable)  | 
|
1396  | 
by (metis dist_self)  | 
|
1397  | 
||
1398  | 
lemma closed_approachable:  | 
|
1399  | 
fixes S :: "'a::metric_space set"  | 
|
1400  | 
shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"  | 
|
1401  | 
by (metis closure_closed closure_approachable)  | 
|
1402  | 
||
1403  | 
text{* Some other lemmas about sequences. *}
 | 
|
1404  | 
||
| 36441 | 1405  | 
lemma sequentially_offset:  | 
1406  | 
assumes "eventually (\<lambda>i. P i) sequentially"  | 
|
1407  | 
shows "eventually (\<lambda>i. P (i + k)) sequentially"  | 
|
1408  | 
using assms unfolding eventually_sequentially by (metis trans_le_add1)  | 
|
1409  | 
||
| 33175 | 1410  | 
lemma seq_offset:  | 
| 36441 | 1411  | 
assumes "(f ---> l) sequentially"  | 
1412  | 
shows "((\<lambda>i. f (i + k)) ---> l) sequentially"  | 
|
| 44584 | 1413  | 
using assms by (rule LIMSEQ_ignore_initial_segment) (* FIXME: redundant *)  | 
| 33175 | 1414  | 
|
1415  | 
lemma seq_offset_neg:  | 
|
1416  | 
"(f ---> l) sequentially ==> ((\<lambda>i. f(i - k)) ---> l) sequentially"  | 
|
1417  | 
apply (rule topological_tendstoI)  | 
|
1418  | 
apply (drule (2) topological_tendstoD)  | 
|
1419  | 
apply (simp only: eventually_sequentially)  | 
|
1420  | 
apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k")  | 
|
1421  | 
apply metis  | 
|
1422  | 
by arith  | 
|
1423  | 
||
1424  | 
lemma seq_offset_rev:  | 
|
1425  | 
"((\<lambda>i. f(i + k)) ---> l) sequentially ==> (f ---> l) sequentially"  | 
|
| 44584 | 1426  | 
by (rule LIMSEQ_offset) (* FIXME: redundant *)  | 
| 33175 | 1427  | 
|
1428  | 
lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially"  | 
|
| 44584 | 1429  | 
using LIMSEQ_inverse_real_of_nat by (rule LIMSEQ_imp_Suc)  | 
| 33175 | 1430  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1431  | 
subsection {* More properties of closed balls *}
 | 
| 33175 | 1432  | 
|
1433  | 
lemma closed_cball: "closed (cball x e)"  | 
|
1434  | 
unfolding cball_def closed_def  | 
|
1435  | 
unfolding Collect_neg_eq [symmetric] not_le  | 
|
1436  | 
apply (clarsimp simp add: open_dist, rename_tac y)  | 
|
1437  | 
apply (rule_tac x="dist x y - e" in exI, clarsimp)  | 
|
1438  | 
apply (rename_tac x')  | 
|
1439  | 
apply (cut_tac x=x and y=x' and z=y in dist_triangle)  | 
|
1440  | 
apply simp  | 
|
1441  | 
done  | 
|
1442  | 
||
1443  | 
lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)"  | 
|
1444  | 
proof-  | 
|
1445  | 
  { fix x and e::real assume "x\<in>S" "e>0" "ball x e \<subseteq> S"
 | 
|
1446  | 
hence "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto)  | 
|
1447  | 
} moreover  | 
|
1448  | 
  { fix x and e::real assume "x\<in>S" "e>0" "cball x e \<subseteq> S"
 | 
|
1449  | 
hence "\<exists>d>0. ball x d \<subseteq> S" unfolding subset_eq apply(rule_tac x="e/2" in exI) by auto  | 
|
1450  | 
} ultimately  | 
|
1451  | 
show ?thesis unfolding open_contains_ball by auto  | 
|
1452  | 
qed  | 
|
1453  | 
||
1454  | 
lemma open_contains_cball_eq: "open S ==> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"  | 
|
| 
44170
 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 
huffman 
parents: 
44167 
diff
changeset
 | 
1455  | 
by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball)  | 
| 33175 | 1456  | 
|
1457  | 
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)"  | 
|
1458  | 
apply (simp add: interior_def, safe)  | 
|
1459  | 
apply (force simp add: open_contains_cball)  | 
|
1460  | 
apply (rule_tac x="ball x e" in exI)  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1461  | 
apply (simp add: subset_trans [OF ball_subset_cball])  | 
| 33175 | 1462  | 
done  | 
1463  | 
||
1464  | 
lemma islimpt_ball:  | 
|
1465  | 
  fixes x y :: "'a::{real_normed_vector,perfect_space}"
 | 
|
1466  | 
shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" (is "?lhs = ?rhs")  | 
|
1467  | 
proof  | 
|
1468  | 
assume "?lhs"  | 
|
1469  | 
  { assume "e \<le> 0"
 | 
|
1470  | 
    hence *:"ball x e = {}" using ball_eq_empty[of x e] by auto
 | 
|
1471  | 
have False using `?lhs` unfolding * using islimpt_EMPTY[of y] by auto  | 
|
1472  | 
}  | 
|
1473  | 
hence "e > 0" by (metis not_less)  | 
|
1474  | 
moreover  | 
|
1475  | 
have "y \<in> cball x e" using closed_cball[of x e] islimpt_subset[of y "ball x e" "cball x e"] ball_subset_cball[of x e] `?lhs` unfolding closed_limpt by auto  | 
|
1476  | 
ultimately show "?rhs" by auto  | 
|
1477  | 
next  | 
|
1478  | 
assume "?rhs" hence "e>0" by auto  | 
|
1479  | 
  { fix d::real assume "d>0"
 | 
|
1480  | 
have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"  | 
|
1481  | 
proof(cases "d \<le> dist x y")  | 
|
1482  | 
case True thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"  | 
|
1483  | 
proof(cases "x=y")  | 
|
1484  | 
case True hence False using `d \<le> dist x y` `d>0` by auto  | 
|
1485  | 
thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by auto  | 
|
1486  | 
next  | 
|
1487  | 
case False  | 
|
1488  | 
||
1489  | 
have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x))  | 
|
1490  | 
= norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))"  | 
|
1491  | 
unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[THEN sym] by auto  | 
|
1492  | 
also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)"  | 
|
1493  | 
using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", THEN sym, of "y - x"]  | 
|
1494  | 
unfolding scaleR_minus_left scaleR_one  | 
|
1495  | 
by (auto simp add: norm_minus_commute)  | 
|
1496  | 
also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>"  | 
|
1497  | 
unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]]  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
1498  | 
unfolding left_distrib using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] by auto  | 
| 33175 | 1499  | 
also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` by(auto simp add: dist_norm)  | 
1500  | 
finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` by auto  | 
|
1501  | 
||
1502  | 
moreover  | 
|
1503  | 
||
1504  | 
have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0"  | 
|
1505  | 
using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff by (auto simp add: dist_commute)  | 
|
1506  | 
moreover  | 
|
1507  | 
have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" unfolding dist_norm apply simp unfolding norm_minus_cancel  | 
|
1508  | 
using `d>0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y]  | 
|
1509  | 
unfolding dist_norm by auto  | 
|
1510  | 
ultimately show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by (rule_tac x="y - (d / (2*dist y x)) *\<^sub>R (y - x)" in bexI) auto  | 
|
1511  | 
qed  | 
|
1512  | 
next  | 
|
1513  | 
case False hence "d > dist x y" by auto  | 
|
1514  | 
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"  | 
|
1515  | 
proof(cases "x=y")  | 
|
1516  | 
case True  | 
|
1517  | 
obtain z where **: "z \<noteq> y" "dist z y < min e d"  | 
|
1518  | 
using perfect_choose_dist[of "min e d" y]  | 
|
1519  | 
using `d > 0` `e>0` by auto  | 
|
1520  | 
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"  | 
|
1521  | 
unfolding `x = y`  | 
|
1522  | 
using `z \<noteq> y` **  | 
|
1523  | 
by (rule_tac x=z in bexI, auto simp add: dist_commute)  | 
|
1524  | 
next  | 
|
1525  | 
case False thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"  | 
|
1526  | 
using `d>0` `d > dist x y` `?rhs` by(rule_tac x=x in bexI, auto)  | 
|
1527  | 
qed  | 
|
1528  | 
qed }  | 
|
1529  | 
thus "?lhs" unfolding mem_cball islimpt_approachable mem_ball by auto  | 
|
1530  | 
qed  | 
|
1531  | 
||
1532  | 
lemma closure_ball_lemma:  | 
|
1533  | 
fixes x y :: "'a::real_normed_vector"  | 
|
1534  | 
assumes "x \<noteq> y" shows "y islimpt ball x (dist x y)"  | 
|
1535  | 
proof (rule islimptI)  | 
|
1536  | 
fix T assume "y \<in> T" "open T"  | 
|
1537  | 
then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T"  | 
|
1538  | 
unfolding open_dist by fast  | 
|
1539  | 
(* choose point between x and y, within distance r of y. *)  | 
|
1540  | 
def k \<equiv> "min 1 (r / (2 * dist x y))"  | 
|
1541  | 
def z \<equiv> "y + scaleR k (x - y)"  | 
|
1542  | 
have z_def2: "z = x + scaleR (1 - k) (y - x)"  | 
|
1543  | 
unfolding z_def by (simp add: algebra_simps)  | 
|
1544  | 
have "dist z y < r"  | 
|
1545  | 
unfolding z_def k_def using `0 < r`  | 
|
1546  | 
by (simp add: dist_norm min_def)  | 
|
1547  | 
hence "z \<in> T" using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp  | 
|
1548  | 
have "dist x z < dist x y"  | 
|
1549  | 
unfolding z_def2 dist_norm  | 
|
1550  | 
apply (simp add: norm_minus_commute)  | 
|
1551  | 
apply (simp only: dist_norm [symmetric])  | 
|
1552  | 
apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp)  | 
|
1553  | 
apply (rule mult_strict_right_mono)  | 
|
1554  | 
apply (simp add: k_def divide_pos_pos zero_less_dist_iff `0 < r` `x \<noteq> y`)  | 
|
1555  | 
apply (simp add: zero_less_dist_iff `x \<noteq> y`)  | 
|
1556  | 
done  | 
|
1557  | 
hence "z \<in> ball x (dist x y)" by simp  | 
|
1558  | 
have "z \<noteq> y"  | 
|
1559  | 
unfolding z_def k_def using `x \<noteq> y` `0 < r`  | 
|
1560  | 
by (simp add: min_def)  | 
|
1561  | 
show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y"  | 
|
1562  | 
using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y`  | 
|
1563  | 
by fast  | 
|
1564  | 
qed  | 
|
1565  | 
||
1566  | 
lemma closure_ball:  | 
|
1567  | 
fixes x :: "'a::real_normed_vector"  | 
|
1568  | 
shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e"  | 
|
1569  | 
apply (rule equalityI)  | 
|
1570  | 
apply (rule closure_minimal)  | 
|
1571  | 
apply (rule ball_subset_cball)  | 
|
1572  | 
apply (rule closed_cball)  | 
|
1573  | 
apply (rule subsetI, rename_tac y)  | 
|
1574  | 
apply (simp add: le_less [where 'a=real])  | 
|
1575  | 
apply (erule disjE)  | 
|
1576  | 
apply (rule subsetD [OF closure_subset], simp)  | 
|
1577  | 
apply (simp add: closure_def)  | 
|
1578  | 
apply clarify  | 
|
1579  | 
apply (rule closure_ball_lemma)  | 
|
1580  | 
apply (simp add: zero_less_dist_iff)  | 
|
1581  | 
done  | 
|
1582  | 
||
1583  | 
(* In a trivial vector space, this fails for e = 0. *)  | 
|
1584  | 
lemma interior_cball:  | 
|
1585  | 
  fixes x :: "'a::{real_normed_vector, perfect_space}"
 | 
|
1586  | 
shows "interior (cball x e) = ball x e"  | 
|
1587  | 
proof(cases "e\<ge>0")  | 
|
1588  | 
case False note cs = this  | 
|
1589  | 
  from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover
 | 
|
1590  | 
  { fix y assume "y \<in> cball x e"
 | 
|
1591  | 
hence False unfolding mem_cball using dist_nz[of x y] cs by auto }  | 
|
1592  | 
  hence "cball x e = {}" by auto
 | 
|
1593  | 
  hence "interior (cball x e) = {}" using interior_empty by auto
 | 
|
1594  | 
ultimately show ?thesis by blast  | 
|
1595  | 
next  | 
|
1596  | 
case True note cs = this  | 
|
1597  | 
have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover  | 
|
1598  | 
  { fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S"
 | 
|
1599  | 
then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast  | 
|
1600  | 
||
1601  | 
then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d"  | 
|
1602  | 
using perfect_choose_dist [of d] by auto  | 
|
1603  | 
have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute)  | 
|
1604  | 
hence xa_cball:"xa \<in> cball x e" using as(1) by auto  | 
|
1605  | 
||
1606  | 
hence "y \<in> ball x e" proof(cases "x = y")  | 
|
1607  | 
case True  | 
|
1608  | 
hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute)  | 
|
1609  | 
thus "y \<in> ball x e" using `x = y ` by simp  | 
|
1610  | 
next  | 
|
1611  | 
case False  | 
|
1612  | 
have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm  | 
|
1613  | 
using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto  | 
|
1614  | 
hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast  | 
|
1615  | 
have "y - x \<noteq> 0" using `x \<noteq> y` by auto  | 
|
1616  | 
hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym]  | 
|
1617  | 
using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto  | 
|
1618  | 
||
1619  | 
have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x = norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)"  | 
|
1620  | 
by (auto simp add: dist_norm algebra_simps)  | 
|
1621  | 
also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))"  | 
|
1622  | 
by (auto simp add: algebra_simps)  | 
|
1623  | 
also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)"  | 
|
1624  | 
using ** by auto  | 
|
1625  | 
also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm)  | 
|
1626  | 
finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute)  | 
|
1627  | 
thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto  | 
|
1628  | 
qed }  | 
|
1629  | 
hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto  | 
|
1630  | 
ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto  | 
|
1631  | 
qed  | 
|
1632  | 
||
1633  | 
lemma frontier_ball:  | 
|
1634  | 
fixes a :: "'a::real_normed_vector"  | 
|
1635  | 
  shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}"
 | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1636  | 
apply (simp add: frontier_def closure_ball interior_open order_less_imp_le)  | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
1637  | 
apply (simp add: set_eq_iff)  | 
| 33175 | 1638  | 
by arith  | 
1639  | 
||
1640  | 
lemma frontier_cball:  | 
|
1641  | 
  fixes a :: "'a::{real_normed_vector, perfect_space}"
 | 
|
1642  | 
  shows "frontier(cball a e) = {x. dist a x = e}"
 | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1643  | 
apply (simp add: frontier_def interior_cball closed_cball order_less_imp_le)  | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
1644  | 
apply (simp add: set_eq_iff)  | 
| 33175 | 1645  | 
by arith  | 
1646  | 
||
1647  | 
lemma cball_eq_empty: "(cball x e = {}) \<longleftrightarrow> e < 0"
 | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
1648  | 
apply (simp add: set_eq_iff not_le)  | 
| 33175 | 1649  | 
by (metis zero_le_dist dist_self order_less_le_trans)  | 
1650  | 
lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty)
 | 
|
1651  | 
||
1652  | 
lemma cball_eq_sing:  | 
|
| 
44072
 
5b970711fb39
class perfect_space inherits from topological_space;
 
huffman 
parents: 
43338 
diff
changeset
 | 
1653  | 
  fixes x :: "'a::{metric_space,perfect_space}"
 | 
| 33175 | 1654  | 
  shows "(cball x e = {x}) \<longleftrightarrow> e = 0"
 | 
1655  | 
proof (rule linorder_cases)  | 
|
1656  | 
assume e: "0 < e"  | 
|
1657  | 
obtain a where "a \<noteq> x" "dist a x < e"  | 
|
1658  | 
using perfect_choose_dist [OF e] by auto  | 
|
1659  | 
hence "a \<noteq> x" "dist x a \<le> e" by (auto simp add: dist_commute)  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
1660  | 
with e show ?thesis by (auto simp add: set_eq_iff)  | 
| 33175 | 1661  | 
qed auto  | 
1662  | 
||
1663  | 
lemma cball_sing:  | 
|
1664  | 
fixes x :: "'a::metric_space"  | 
|
1665  | 
  shows "e = 0 ==> cball x e = {x}"
 | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
1666  | 
by (auto simp add: set_eq_iff)  | 
| 33175 | 1667  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1668  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1669  | 
subsection {* Boundedness *}
 | 
| 33175 | 1670  | 
|
1671  | 
(* FIXME: This has to be unified with BSEQ!! *)  | 
|
| 
44207
 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 
huffman 
parents: 
44170 
diff
changeset
 | 
1672  | 
definition (in metric_space)  | 
| 
 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 
huffman 
parents: 
44170 
diff
changeset
 | 
1673  | 
bounded :: "'a set \<Rightarrow> bool" where  | 
| 33175 | 1674  | 
"bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)"  | 
1675  | 
||
1676  | 
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"  | 
|
1677  | 
unfolding bounded_def  | 
|
1678  | 
apply safe  | 
|
1679  | 
apply (rule_tac x="dist a x + e" in exI, clarify)  | 
|
1680  | 
apply (drule (1) bspec)  | 
|
1681  | 
apply (erule order_trans [OF dist_triangle add_left_mono])  | 
|
1682  | 
apply auto  | 
|
1683  | 
done  | 
|
1684  | 
||
1685  | 
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)"  | 
|
1686  | 
unfolding bounded_any_center [where a=0]  | 
|
1687  | 
by (simp add: dist_norm)  | 
|
1688  | 
||
1689  | 
lemma bounded_empty[simp]: "bounded {}" by (simp add: bounded_def)
 | 
|
1690  | 
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S"  | 
|
1691  | 
by (metis bounded_def subset_eq)  | 
|
1692  | 
||
1693  | 
lemma bounded_interior[intro]: "bounded S ==> bounded(interior S)"  | 
|
1694  | 
by (metis bounded_subset interior_subset)  | 
|
1695  | 
||
1696  | 
lemma bounded_closure[intro]: assumes "bounded S" shows "bounded(closure S)"  | 
|
1697  | 
proof-  | 
|
1698  | 
from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" unfolding bounded_def by auto  | 
|
1699  | 
  { fix y assume "y \<in> closure S"
 | 
|
1700  | 
then obtain f where f: "\<forall>n. f n \<in> S" "(f ---> y) sequentially"  | 
|
1701  | 
unfolding closure_sequential by auto  | 
|
1702  | 
have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp  | 
|
1703  | 
hence "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially"  | 
|
1704  | 
by (rule eventually_mono, simp add: f(1))  | 
|
1705  | 
have "dist x y \<le> a"  | 
|
1706  | 
apply (rule Lim_dist_ubound [of sequentially f])  | 
|
1707  | 
apply (rule trivial_limit_sequentially)  | 
|
1708  | 
apply (rule f(2))  | 
|
1709  | 
apply fact  | 
|
1710  | 
done  | 
|
1711  | 
}  | 
|
1712  | 
thus ?thesis unfolding bounded_def by auto  | 
|
1713  | 
qed  | 
|
1714  | 
||
1715  | 
lemma bounded_cball[simp,intro]: "bounded (cball x e)"  | 
|
1716  | 
apply (simp add: bounded_def)  | 
|
1717  | 
apply (rule_tac x=x in exI)  | 
|
1718  | 
apply (rule_tac x=e in exI)  | 
|
1719  | 
apply auto  | 
|
1720  | 
done  | 
|
1721  | 
||
1722  | 
lemma bounded_ball[simp,intro]: "bounded(ball x e)"  | 
|
1723  | 
by (metis ball_subset_cball bounded_cball bounded_subset)  | 
|
1724  | 
||
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1725  | 
lemma finite_imp_bounded[intro]:  | 
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1726  | 
fixes S :: "'a::metric_space set" assumes "finite S" shows "bounded S"  | 
| 33175 | 1727  | 
proof-  | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1728  | 
  { fix a and F :: "'a set" assume as:"bounded F"
 | 
| 33175 | 1729  | 
then obtain x e where "\<forall>y\<in>F. dist x y \<le> e" unfolding bounded_def by auto  | 
1730  | 
hence "\<forall>y\<in>(insert a F). dist x y \<le> max e (dist x a)" by auto  | 
|
1731  | 
hence "bounded (insert a F)" unfolding bounded_def by (intro exI)  | 
|
1732  | 
}  | 
|
1733  | 
thus ?thesis using finite_induct[of S bounded] using bounded_empty assms by auto  | 
|
1734  | 
qed  | 
|
1735  | 
||
1736  | 
lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T"  | 
|
1737  | 
apply (auto simp add: bounded_def)  | 
|
1738  | 
apply (rename_tac x y r s)  | 
|
1739  | 
apply (rule_tac x=x in exI)  | 
|
1740  | 
apply (rule_tac x="max r (dist x y + s)" in exI)  | 
|
1741  | 
apply (rule ballI, rename_tac z, safe)  | 
|
1742  | 
apply (drule (1) bspec, simp)  | 
|
1743  | 
apply (drule (1) bspec)  | 
|
1744  | 
apply (rule min_max.le_supI2)  | 
|
1745  | 
apply (erule order_trans [OF dist_triangle add_left_mono])  | 
|
1746  | 
done  | 
|
1747  | 
||
1748  | 
lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)"  | 
|
1749  | 
by (induct rule: finite_induct[of F], auto)  | 
|
1750  | 
||
1751  | 
lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)"  | 
|
1752  | 
apply (simp add: bounded_iff)  | 
|
1753  | 
apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)")  | 
|
1754  | 
by metis arith  | 
|
1755  | 
||
1756  | 
lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)"  | 
|
1757  | 
by (metis Int_lower1 Int_lower2 bounded_subset)  | 
|
1758  | 
||
1759  | 
lemma bounded_diff[intro]: "bounded S ==> bounded (S - T)"  | 
|
1760  | 
apply (metis Diff_subset bounded_subset)  | 
|
1761  | 
done  | 
|
1762  | 
||
1763  | 
lemma bounded_insert[intro]:"bounded(insert x S) \<longleftrightarrow> bounded S"  | 
|
1764  | 
by (metis Diff_cancel Un_empty_right Un_insert_right bounded_Un bounded_subset finite.emptyI finite_imp_bounded infinite_remove subset_insertI)  | 
|
1765  | 
||
1766  | 
lemma not_bounded_UNIV[simp, intro]:  | 
|
1767  | 
  "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
 | 
|
1768  | 
proof(auto simp add: bounded_pos not_le)  | 
|
1769  | 
obtain x :: 'a where "x \<noteq> 0"  | 
|
1770  | 
using perfect_choose_dist [OF zero_less_one] by fast  | 
|
1771  | 
fix b::real assume b: "b >0"  | 
|
1772  | 
have b1: "b +1 \<ge> 0" using b by simp  | 
|
1773  | 
with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))"  | 
|
1774  | 
by (simp add: norm_sgn)  | 
|
1775  | 
then show "\<exists>x::'a. b < norm x" ..  | 
|
1776  | 
qed  | 
|
1777  | 
||
1778  | 
lemma bounded_linear_image:  | 
|
1779  | 
assumes "bounded S" "bounded_linear f"  | 
|
1780  | 
shows "bounded(f ` S)"  | 
|
1781  | 
proof-  | 
|
1782  | 
from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto  | 
|
1783  | 
from assms(2) obtain B where B:"B>0" "\<forall>x. norm (f x) \<le> B * norm x" using bounded_linear.pos_bounded by (auto simp add: mult_ac)  | 
|
1784  | 
  { fix x assume "x\<in>S"
 | 
|
1785  | 
hence "norm x \<le> b" using b by auto  | 
|
1786  | 
hence "norm (f x) \<le> B * b" using B(2) apply(erule_tac x=x in allE)  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
1787  | 
by (metis B(1) B(2) order_trans mult_le_cancel_left_pos)  | 
| 33175 | 1788  | 
}  | 
1789  | 
thus ?thesis unfolding bounded_pos apply(rule_tac x="b*B" in exI)  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
1790  | 
using b B mult_pos_pos [of b B] by (auto simp add: mult_commute)  | 
| 33175 | 1791  | 
qed  | 
1792  | 
||
1793  | 
lemma bounded_scaling:  | 
|
1794  | 
fixes S :: "'a::real_normed_vector set"  | 
|
1795  | 
shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)"  | 
|
1796  | 
apply (rule bounded_linear_image, assumption)  | 
|
| 
44282
 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 
huffman 
parents: 
44252 
diff
changeset
 | 
1797  | 
apply (rule bounded_linear_scaleR_right)  | 
| 33175 | 1798  | 
done  | 
1799  | 
||
1800  | 
lemma bounded_translation:  | 
|
1801  | 
fixes S :: "'a::real_normed_vector set"  | 
|
1802  | 
assumes "bounded S" shows "bounded ((\<lambda>x. a + x) ` S)"  | 
|
1803  | 
proof-  | 
|
1804  | 
from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto  | 
|
1805  | 
  { fix x assume "x\<in>S"
 | 
|
1806  | 
hence "norm (a + x) \<le> b + norm a" using norm_triangle_ineq[of a x] b by auto  | 
|
1807  | 
}  | 
|
1808  | 
thus ?thesis unfolding bounded_pos using norm_ge_zero[of a] b(1) using add_strict_increasing[of b 0 "norm a"]  | 
|
1809  | 
by (auto intro!: add exI[of _ "b + norm a"])  | 
|
1810  | 
qed  | 
|
1811  | 
||
1812  | 
||
1813  | 
text{* Some theorems on sups and infs using the notion "bounded". *}
 | 
|
1814  | 
||
1815  | 
lemma bounded_real:  | 
|
1816  | 
fixes S :: "real set"  | 
|
1817  | 
shows "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. abs x <= a)"  | 
|
1818  | 
by (simp add: bounded_iff)  | 
|
1819  | 
||
| 33270 | 1820  | 
lemma bounded_has_Sup:  | 
1821  | 
fixes S :: "real set"  | 
|
1822  | 
  assumes "bounded S" "S \<noteq> {}"
 | 
|
1823  | 
shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b"  | 
|
1824  | 
proof  | 
|
1825  | 
fix x assume "x\<in>S"  | 
|
1826  | 
thus "x \<le> Sup S"  | 
|
1827  | 
by (metis SupInf.Sup_upper abs_le_D1 assms(1) bounded_real)  | 
|
1828  | 
next  | 
|
1829  | 
show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms  | 
|
1830  | 
by (metis SupInf.Sup_least)  | 
|
1831  | 
qed  | 
|
1832  | 
||
1833  | 
lemma Sup_insert:  | 
|
1834  | 
fixes S :: "real set"  | 
|
1835  | 
  shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))" 
 | 
|
1836  | 
by auto (metis Int_absorb Sup_insert_nonempty assms bounded_has_Sup(1) disjoint_iff_not_equal)  | 
|
1837  | 
||
1838  | 
lemma Sup_insert_finite:  | 
|
1839  | 
fixes S :: "real set"  | 
|
1840  | 
  shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
 | 
|
1841  | 
apply (rule Sup_insert)  | 
|
1842  | 
apply (rule finite_imp_bounded)  | 
|
1843  | 
by simp  | 
|
1844  | 
||
1845  | 
lemma bounded_has_Inf:  | 
|
1846  | 
fixes S :: "real set"  | 
|
1847  | 
  assumes "bounded S"  "S \<noteq> {}"
 | 
|
1848  | 
shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b"  | 
|
| 33175 | 1849  | 
proof  | 
1850  | 
fix x assume "x\<in>S"  | 
|
1851  | 
from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto  | 
|
| 33270 | 1852  | 
thus "x \<ge> Inf S" using `x\<in>S`  | 
1853  | 
by (metis Inf_lower_EX abs_le_D2 minus_le_iff)  | 
|
| 33175 | 1854  | 
next  | 
| 33270 | 1855  | 
show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms  | 
1856  | 
by (metis SupInf.Inf_greatest)  | 
|
1857  | 
qed  | 
|
1858  | 
||
1859  | 
lemma Inf_insert:  | 
|
1860  | 
fixes S :: "real set"  | 
|
1861  | 
  shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" 
 | 
|
1862  | 
by auto (metis Int_absorb Inf_insert_nonempty bounded_has_Inf(1) disjoint_iff_not_equal)  | 
|
1863  | 
lemma Inf_insert_finite:  | 
|
1864  | 
fixes S :: "real set"  | 
|
1865  | 
  shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
 | 
|
1866  | 
by (rule Inf_insert, rule finite_imp_bounded, simp)  | 
|
1867  | 
||
| 33175 | 1868  | 
(* TODO: Move this to RComplete.thy -- would need to include Glb into RComplete *)  | 
1869  | 
lemma real_isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::real)"  | 
|
1870  | 
apply (frule isGlb_isLb)  | 
|
1871  | 
apply (frule_tac x = y in isGlb_isLb)  | 
|
1872  | 
apply (blast intro!: order_antisym dest!: isGlb_le_isLb)  | 
|
1873  | 
done  | 
|
1874  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
1875  | 
|
| 36437 | 1876  | 
subsection {* Equivalent versions of compactness *}
 | 
1877  | 
||
1878  | 
subsubsection{* Sequential compactness *}
 | 
|
| 33175 | 1879  | 
|
1880  | 
definition  | 
|
1881  | 
compact :: "'a::metric_space set \<Rightarrow> bool" where (* TODO: generalize *)  | 
|
1882  | 
"compact S \<longleftrightarrow>  | 
|
1883  | 
(\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow>  | 
|
1884  | 
(\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))"  | 
|
1885  | 
||
| 44075 | 1886  | 
lemma compactI:  | 
1887  | 
assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially"  | 
|
1888  | 
shows "compact S"  | 
|
1889  | 
unfolding compact_def using assms by fast  | 
|
1890  | 
||
1891  | 
lemma compactE:  | 
|
1892  | 
assumes "compact S" "\<forall>n. f n \<in> S"  | 
|
1893  | 
obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) ---> l) sequentially"  | 
|
1894  | 
using assms unfolding compact_def by fast  | 
|
1895  | 
||
| 33175 | 1896  | 
text {*
 | 
1897  | 
A metric space (or topological vector space) is said to have the  | 
|
1898  | 
Heine-Borel property if every closed and bounded subset is compact.  | 
|
1899  | 
*}  | 
|
1900  | 
||
| 
44207
 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 
huffman 
parents: 
44170 
diff
changeset
 | 
1901  | 
class heine_borel = metric_space +  | 
| 33175 | 1902  | 
assumes bounded_imp_convergent_subsequence:  | 
1903  | 
"bounded s \<Longrightarrow> \<forall>n. f n \<in> s  | 
|
1904  | 
\<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
1905  | 
||
1906  | 
lemma bounded_closed_imp_compact:  | 
|
1907  | 
fixes s::"'a::heine_borel set"  | 
|
1908  | 
assumes "bounded s" and "closed s" shows "compact s"  | 
|
1909  | 
proof (unfold compact_def, clarify)  | 
|
1910  | 
fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s"  | 
|
1911  | 
obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"  | 
|
1912  | 
using bounded_imp_convergent_subsequence [OF `bounded s` `\<forall>n. f n \<in> s`] by auto  | 
|
1913  | 
from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" by simp  | 
|
1914  | 
have "l \<in> s" using `closed s` fr l  | 
|
1915  | 
unfolding closed_sequential_limits by blast  | 
|
1916  | 
show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
1917  | 
using `l \<in> s` r l by blast  | 
|
1918  | 
qed  | 
|
1919  | 
||
1920  | 
lemma subseq_bigger: assumes "subseq r" shows "n \<le> r n"  | 
|
1921  | 
proof(induct n)  | 
|
1922  | 
show "0 \<le> r 0" by auto  | 
|
1923  | 
next  | 
|
1924  | 
fix n assume "n \<le> r n"  | 
|
1925  | 
moreover have "r n < r (Suc n)"  | 
|
1926  | 
using assms [unfolded subseq_def] by auto  | 
|
1927  | 
ultimately show "Suc n \<le> r (Suc n)" by auto  | 
|
1928  | 
qed  | 
|
1929  | 
||
1930  | 
lemma eventually_subseq:  | 
|
1931  | 
assumes r: "subseq r"  | 
|
1932  | 
shows "eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"  | 
|
1933  | 
unfolding eventually_sequentially  | 
|
1934  | 
by (metis subseq_bigger [OF r] le_trans)  | 
|
1935  | 
||
1936  | 
lemma lim_subseq:  | 
|
1937  | 
"subseq r \<Longrightarrow> (s ---> l) sequentially \<Longrightarrow> ((s o r) ---> l) sequentially"  | 
|
1938  | 
unfolding tendsto_def eventually_sequentially o_def  | 
|
1939  | 
by (metis subseq_bigger le_trans)  | 
|
1940  | 
||
1941  | 
lemma num_Axiom: "EX! g. g 0 = e \<and> (\<forall>n. g (Suc n) = f n (g n))"  | 
|
1942  | 
unfolding Ex1_def  | 
|
1943  | 
apply (rule_tac x="nat_rec e f" in exI)  | 
|
1944  | 
apply (rule conjI)+  | 
|
1945  | 
apply (rule def_nat_rec_0, simp)  | 
|
1946  | 
apply (rule allI, rule def_nat_rec_Suc, simp)  | 
|
1947  | 
apply (rule allI, rule impI, rule ext)  | 
|
1948  | 
apply (erule conjE)  | 
|
1949  | 
apply (induct_tac x)  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
1950  | 
apply simp  | 
| 33175 | 1951  | 
apply (erule_tac x="n" in allE)  | 
1952  | 
apply (simp)  | 
|
1953  | 
done  | 
|
1954  | 
||
1955  | 
lemma convergent_bounded_increasing: fixes s ::"nat\<Rightarrow>real"  | 
|
1956  | 
assumes "incseq s" and "\<forall>n. abs(s n) \<le> b"  | 
|
1957  | 
shows "\<exists> l. \<forall>e::real>0. \<exists> N. \<forall>n \<ge> N. abs(s n - l) < e"  | 
|
1958  | 
proof-  | 
|
1959  | 
have "isUb UNIV (range s) b" using assms(2) and abs_le_D1 unfolding isUb_def and setle_def by auto  | 
|
1960  | 
then obtain t where t:"isLub UNIV (range s) t" using reals_complete[of "range s" ] by auto  | 
|
1961  | 
  { fix e::real assume "e>0" and as:"\<forall>N. \<exists>n\<ge>N. \<not> \<bar>s n - t\<bar> < e"
 | 
|
1962  | 
    { fix n::nat
 | 
|
1963  | 
obtain N where "N\<ge>n" and n:"\<bar>s N - t\<bar> \<ge> e" using as[THEN spec[where x=n]] by auto  | 
|
1964  | 
have "t \<ge> s N" using isLub_isUb[OF t, unfolded isUb_def setle_def] by auto  | 
|
1965  | 
with n have "s N \<le> t - e" using `e>0` by auto  | 
|
1966  | 
hence "s n \<le> t - e" using assms(1)[unfolded incseq_def, THEN spec[where x=n], THEN spec[where x=N]] using `n\<le>N` by auto }  | 
|
1967  | 
hence "isUb UNIV (range s) (t - e)" unfolding isUb_def and setle_def by auto  | 
|
1968  | 
hence False using isLub_le_isUb[OF t, of "t - e"] and `e>0` by auto }  | 
|
1969  | 
thus ?thesis by blast  | 
|
1970  | 
qed  | 
|
1971  | 
||
1972  | 
lemma convergent_bounded_monotone: fixes s::"nat \<Rightarrow> real"  | 
|
1973  | 
assumes "\<forall>n. abs(s n) \<le> b" and "monoseq s"  | 
|
1974  | 
shows "\<exists>l. \<forall>e::real>0. \<exists>N. \<forall>n\<ge>N. abs(s n - l) < e"  | 
|
1975  | 
using convergent_bounded_increasing[of s b] assms using convergent_bounded_increasing[of "\<lambda>n. - s n" b]  | 
|
1976  | 
unfolding monoseq_def incseq_def  | 
|
1977  | 
apply auto unfolding minus_add_distrib[THEN sym, unfolded diff_minus[THEN sym]]  | 
|
1978  | 
unfolding abs_minus_cancel by(rule_tac x="-l" in exI)auto  | 
|
1979  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1980  | 
(* TODO: merge this lemma with the ones above *)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1981  | 
lemma bounded_increasing_convergent: fixes s::"nat \<Rightarrow> real"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1982  | 
  assumes "bounded {s n| n::nat. True}"  "\<forall>n. (s n) \<le>(s(Suc n))"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1983  | 
shows "\<exists>l. (s ---> l) sequentially"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1984  | 
proof-  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1985  | 
obtain a where a:"\<forall>n. \<bar> (s n)\<bar> \<le> a" using assms(1)[unfolded bounded_iff] by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1986  | 
  { fix m::nat
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1987  | 
have "\<And> n. n\<ge>m \<longrightarrow> (s m) \<le> (s n)"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1988  | 
apply(induct_tac n) apply simp using assms(2) apply(erule_tac x="na" in allE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1989  | 
apply(case_tac "m \<le> na") unfolding not_less_eq_eq by(auto simp add: not_less_eq_eq) }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1990  | 
hence "\<forall>m n. m \<le> n \<longrightarrow> (s m) \<le> (s n)" by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1991  | 
then obtain l where "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<bar> (s n) - l\<bar> < e" using convergent_bounded_monotone[OF a]  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1992  | 
unfolding monoseq_def by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1993  | 
thus ?thesis unfolding Lim_sequentially apply(rule_tac x="l" in exI)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1994  | 
unfolding dist_norm by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1995  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
1996  | 
|
| 33175 | 1997  | 
lemma compact_real_lemma:  | 
1998  | 
assumes "\<forall>n::nat. abs(s n) \<le> b"  | 
|
1999  | 
shows "\<exists>(l::real) r. subseq r \<and> ((s \<circ> r) ---> l) sequentially"  | 
|
2000  | 
proof-  | 
|
2001  | 
obtain r where r:"subseq r" "monoseq (\<lambda>n. s (r n))"  | 
|
2002  | 
using seq_monosub[of s] by auto  | 
|
2003  | 
thus ?thesis using convergent_bounded_monotone[of "\<lambda>n. s (r n)" b] and assms  | 
|
2004  | 
unfolding tendsto_iff dist_norm eventually_sequentially by auto  | 
|
2005  | 
qed  | 
|
2006  | 
||
2007  | 
instance real :: heine_borel  | 
|
2008  | 
proof  | 
|
2009  | 
fix s :: "real set" and f :: "nat \<Rightarrow> real"  | 
|
2010  | 
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"  | 
|
2011  | 
then obtain b where b: "\<forall>n. abs (f n) \<le> b"  | 
|
2012  | 
unfolding bounded_iff by auto  | 
|
2013  | 
obtain l :: real and r :: "nat \<Rightarrow> nat" where  | 
|
2014  | 
r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"  | 
|
2015  | 
using compact_real_lemma [OF b] by auto  | 
|
2016  | 
thus "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2017  | 
by auto  | 
|
2018  | 
qed  | 
|
2019  | 
||
| 44138 | 2020  | 
lemma bounded_component: "bounded s \<Longrightarrow> bounded ((\<lambda>x. x $$ i) ` s)"  | 
2021  | 
apply (erule bounded_linear_image)  | 
|
2022  | 
apply (rule bounded_linear_euclidean_component)  | 
|
2023  | 
done  | 
|
| 33175 | 2024  | 
|
2025  | 
lemma compact_lemma:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2026  | 
fixes f :: "nat \<Rightarrow> 'a::euclidean_space"  | 
| 33175 | 2027  | 
assumes "bounded s" and "\<forall>n. f n \<in> s"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2028  | 
shows "\<forall>d. \<exists>l::'a. \<exists> r. subseq r \<and>  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2029  | 
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $$ i) (l $$ i) < e) sequentially)"  | 
| 33175 | 2030  | 
proof  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2031  | 
  fix d'::"nat set" def d \<equiv> "d' \<inter> {..<DIM('a)}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2032  | 
  have "finite d" "d\<subseteq>{..<DIM('a)}" unfolding d_def by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2033  | 
hence "\<exists>l::'a. \<exists>r. subseq r \<and>  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2034  | 
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $$ i) (l $$ i) < e) sequentially)"  | 
| 33175 | 2035  | 
proof(induct d) case empty thus ?case unfolding subseq_def by auto  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2036  | 
  next case (insert k d) have k[intro]:"k<DIM('a)" using insert by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2037  | 
have s': "bounded ((\<lambda>x. x $$ k) ` s)" using `bounded s` by (rule bounded_component)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2038  | 
obtain l1::"'a" and r1 where r1:"subseq r1" and  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2039  | 
lr1:"\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $$ i) (l1 $$ i) < e) sequentially"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2040  | 
using insert(3) using insert(4) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2041  | 
have f': "\<forall>n. f (r1 n) $$ k \<in> (\<lambda>x. x $$ k) ` s" using `\<forall>n. f n \<in> s` by simp  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2042  | 
obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) $$ k) ---> l2) sequentially"  | 
| 33175 | 2043  | 
using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto  | 
2044  | 
def r \<equiv> "r1 \<circ> r2" have r:"subseq r"  | 
|
2045  | 
using r1 and r2 unfolding r_def o_def subseq_def by auto  | 
|
2046  | 
moreover  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2047  | 
def l \<equiv> "(\<chi>\<chi> i. if i = k then l2 else l1$$i)::'a"  | 
| 33175 | 2048  | 
    { fix e::real assume "e>0"
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2049  | 
from lr1 `e>0` have N1:"eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $$ i) (l1 $$ i) < e) sequentially" by blast  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2050  | 
from lr2 `e>0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) $$ k) l2 < e) sequentially" by (rule tendstoD)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2051  | 
from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) $$ i) (l1 $$ i) < e) sequentially"  | 
| 33175 | 2052  | 
by (rule eventually_subseq)  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2053  | 
have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) $$ i) (l $$ i) < e) sequentially"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2054  | 
using N1' N2 apply(rule eventually_elim2) unfolding l_def r_def o_def  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2055  | 
using insert.prems by auto  | 
| 33175 | 2056  | 
}  | 
2057  | 
ultimately show ?case by auto  | 
|
2058  | 
qed  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2059  | 
thus "\<exists>l::'a. \<exists>r. subseq r \<and>  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2060  | 
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d'. dist (f (r n) $$ i) (l $$ i) < e) sequentially)"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2061  | 
apply safe apply(rule_tac x=l in exI,rule_tac x=r in exI) apply safe  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2062  | 
apply(erule_tac x=e in allE) unfolding d_def eventually_sequentially apply safe  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2063  | 
apply(rule_tac x=N in exI) apply safe apply(erule_tac x=n in allE,safe)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2064  | 
apply(erule_tac x=i in ballE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2065  | 
proof- fix i and r::"nat=>nat" and n::nat and e::real and l::'a  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2066  | 
    assume "i\<in>d'" "i \<notin> d' \<inter> {..<DIM('a)}" and e:"e>0"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2067  | 
    hence *:"i\<ge>DIM('a)" by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2068  | 
thus "dist (f (r n) $$ i) (l $$ i) < e" using e by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2069  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2070  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2071  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2072  | 
instance euclidean_space \<subseteq> heine_borel  | 
| 33175 | 2073  | 
proof  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2074  | 
fix s :: "'a set" and f :: "nat \<Rightarrow> 'a"  | 
| 33175 | 2075  | 
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2076  | 
then obtain l::'a and r where r: "subseq r"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2077  | 
and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>UNIV. dist (f (r n) $$ i) (l $$ i) < e) sequentially"  | 
| 33175 | 2078  | 
using compact_lemma [OF s f] by blast  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2079  | 
  let ?d = "{..<DIM('a)}"
 | 
| 33175 | 2080  | 
  { fix e::real assume "e>0"
 | 
2081  | 
hence "0 < e / (real_of_nat (card ?d))"  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2082  | 
using DIM_positive using divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2083  | 
with l have "eventually (\<lambda>n. \<forall>i. dist (f (r n) $$ i) (l $$ i) < e / (real_of_nat (card ?d))) sequentially"  | 
| 33175 | 2084  | 
by simp  | 
2085  | 
moreover  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2086  | 
    { fix n assume n: "\<forall>i. dist (f (r n) $$ i) (l $$ i) < e / (real_of_nat (card ?d))"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2087  | 
have "dist (f (r n)) l \<le> (\<Sum>i\<in>?d. dist (f (r n) $$ i) (l $$ i))"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2088  | 
apply(subst euclidean_dist_l2) using zero_le_dist by (rule setL2_le_setsum)  | 
| 33175 | 2089  | 
also have "\<dots> < (\<Sum>i\<in>?d. e / (real_of_nat (card ?d)))"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2090  | 
apply(rule setsum_strict_mono) using n by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2091  | 
finally have "dist (f (r n)) l < e" unfolding setsum_constant  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
2092  | 
using DIM_positive[where 'a='a] by auto  | 
| 33175 | 2093  | 
}  | 
2094  | 
ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"  | 
|
2095  | 
by (rule eventually_elim1)  | 
|
2096  | 
}  | 
|
2097  | 
hence *:"((f \<circ> r) ---> l) sequentially" unfolding o_def tendsto_iff by simp  | 
|
2098  | 
with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" by auto  | 
|
2099  | 
qed  | 
|
2100  | 
||
2101  | 
lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)"  | 
|
2102  | 
unfolding bounded_def  | 
|
2103  | 
apply clarify  | 
|
2104  | 
apply (rule_tac x="a" in exI)  | 
|
2105  | 
apply (rule_tac x="e" in exI)  | 
|
2106  | 
apply clarsimp  | 
|
2107  | 
apply (drule (1) bspec)  | 
|
2108  | 
apply (simp add: dist_Pair_Pair)  | 
|
2109  | 
apply (erule order_trans [OF real_sqrt_sum_squares_ge1])  | 
|
2110  | 
done  | 
|
2111  | 
||
2112  | 
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)"  | 
|
2113  | 
unfolding bounded_def  | 
|
2114  | 
apply clarify  | 
|
2115  | 
apply (rule_tac x="b" in exI)  | 
|
2116  | 
apply (rule_tac x="e" in exI)  | 
|
2117  | 
apply clarsimp  | 
|
2118  | 
apply (drule (1) bspec)  | 
|
2119  | 
apply (simp add: dist_Pair_Pair)  | 
|
2120  | 
apply (erule order_trans [OF real_sqrt_sum_squares_ge2])  | 
|
2121  | 
done  | 
|
2122  | 
||
| 
37678
 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 
haftmann 
parents: 
37649 
diff
changeset
 | 
2123  | 
instance prod :: (heine_borel, heine_borel) heine_borel  | 
| 33175 | 2124  | 
proof  | 
2125  | 
  fix s :: "('a * 'b) set" and f :: "nat \<Rightarrow> 'a * 'b"
 | 
|
2126  | 
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"  | 
|
2127  | 
from s have s1: "bounded (fst ` s)" by (rule bounded_fst)  | 
|
2128  | 
from f have f1: "\<forall>n. fst (f n) \<in> fst ` s" by simp  | 
|
2129  | 
obtain l1 r1 where r1: "subseq r1"  | 
|
2130  | 
and l1: "((\<lambda>n. fst (f (r1 n))) ---> l1) sequentially"  | 
|
2131  | 
using bounded_imp_convergent_subsequence [OF s1 f1]  | 
|
2132  | 
unfolding o_def by fast  | 
|
2133  | 
from s have s2: "bounded (snd ` s)" by (rule bounded_snd)  | 
|
2134  | 
from f have f2: "\<forall>n. snd (f (r1 n)) \<in> snd ` s" by simp  | 
|
2135  | 
obtain l2 r2 where r2: "subseq r2"  | 
|
2136  | 
and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially"  | 
|
2137  | 
using bounded_imp_convergent_subsequence [OF s2 f2]  | 
|
2138  | 
unfolding o_def by fast  | 
|
2139  | 
have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially"  | 
|
2140  | 
using lim_subseq [OF r2 l1] unfolding o_def .  | 
|
2141  | 
have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially"  | 
|
2142  | 
using tendsto_Pair [OF l1' l2] unfolding o_def by simp  | 
|
2143  | 
have r: "subseq (r1 \<circ> r2)"  | 
|
2144  | 
using r1 r2 unfolding subseq_def by simp  | 
|
2145  | 
show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2146  | 
using l r by fast  | 
|
2147  | 
qed  | 
|
2148  | 
||
| 36437 | 2149  | 
subsubsection{* Completeness *}
 | 
| 33175 | 2150  | 
|
2151  | 
lemma cauchy_def:  | 
|
2152  | 
"Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"  | 
|
2153  | 
unfolding Cauchy_def by blast  | 
|
2154  | 
||
2155  | 
definition  | 
|
2156  | 
complete :: "'a::metric_space set \<Rightarrow> bool" where  | 
|
2157  | 
"complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f  | 
|
2158  | 
--> (\<exists>l \<in> s. (f ---> l) sequentially))"  | 
|
2159  | 
||
2160  | 
lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs")  | 
|
2161  | 
proof-  | 
|
2162  | 
  { assume ?rhs
 | 
|
2163  | 
    { fix e::real
 | 
|
2164  | 
assume "e>0"  | 
|
2165  | 
with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2"  | 
|
2166  | 
by (erule_tac x="e/2" in allE) auto  | 
|
2167  | 
      { fix n m
 | 
|
2168  | 
assume nm:"N \<le> m \<and> N \<le> n"  | 
|
2169  | 
hence "dist (s m) (s n) < e" using N  | 
|
2170  | 
using dist_triangle_half_l[of "s m" "s N" "e" "s n"]  | 
|
2171  | 
by blast  | 
|
2172  | 
}  | 
|
2173  | 
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e"  | 
|
2174  | 
by blast  | 
|
2175  | 
}  | 
|
2176  | 
hence ?lhs  | 
|
2177  | 
unfolding cauchy_def  | 
|
2178  | 
by blast  | 
|
2179  | 
}  | 
|
2180  | 
thus ?thesis  | 
|
2181  | 
unfolding cauchy_def  | 
|
2182  | 
using dist_triangle_half_l  | 
|
2183  | 
by blast  | 
|
2184  | 
qed  | 
|
2185  | 
||
2186  | 
lemma convergent_imp_cauchy:  | 
|
2187  | 
"(s ---> l) sequentially ==> Cauchy s"  | 
|
2188  | 
proof(simp only: cauchy_def, rule, rule)  | 
|
2189  | 
fix e::real assume "e>0" "(s ---> l) sequentially"  | 
|
2190  | 
then obtain N::nat where N:"\<forall>n\<ge>N. dist (s n) l < e/2" unfolding Lim_sequentially by(erule_tac x="e/2" in allE) auto  | 
|
2191  | 
thus "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e" using dist_triangle_half_l[of _ l e _] by (rule_tac x=N in exI) auto  | 
|
2192  | 
qed  | 
|
2193  | 
||
| 34104 | 2194  | 
lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded (range s)"  | 
| 33175 | 2195  | 
proof-  | 
2196  | 
from assms obtain N::nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" unfolding cauchy_def apply(erule_tac x= 1 in allE) by auto  | 
|
2197  | 
hence N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto  | 
|
2198  | 
moreover  | 
|
2199  | 
  have "bounded (s ` {0..N})" using finite_imp_bounded[of "s ` {1..N}"] by auto
 | 
|
2200  | 
  then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
 | 
|
2201  | 
unfolding bounded_any_center [where a="s N"] by auto  | 
|
2202  | 
ultimately show "?thesis"  | 
|
2203  | 
unfolding bounded_any_center [where a="s N"]  | 
|
2204  | 
apply(rule_tac x="max a 1" in exI) apply auto  | 
|
| 34104 | 2205  | 
apply(erule_tac x=y in allE) apply(erule_tac x=y in ballE) by auto  | 
| 33175 | 2206  | 
qed  | 
2207  | 
||
2208  | 
lemma compact_imp_complete: assumes "compact s" shows "complete s"  | 
|
2209  | 
proof-  | 
|
2210  | 
  { fix f assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f"
 | 
|
2211  | 
from as(1) obtain l r where lr: "l\<in>s" "subseq r" "((f \<circ> r) ---> l) sequentially" using assms unfolding compact_def by blast  | 
|
2212  | 
||
2213  | 
note lr' = subseq_bigger [OF lr(2)]  | 
|
2214  | 
||
2215  | 
    { fix e::real assume "e>0"
 | 
|
2216  | 
from as(2) obtain N where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (f m) (f n) < e/2" unfolding cauchy_def using `e>0` apply (erule_tac x="e/2" in allE) by auto  | 
|
2217  | 
from lr(3)[unfolded Lim_sequentially, THEN spec[where x="e/2"]] obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" using `e>0` by auto  | 
|
2218  | 
      { fix n::nat assume n:"n \<ge> max N M"
 | 
|
2219  | 
have "dist ((f \<circ> r) n) l < e/2" using n M by auto  | 
|
2220  | 
moreover have "r n \<ge> N" using lr'[of n] n by auto  | 
|
2221  | 
hence "dist (f n) ((f \<circ> r) n) < e / 2" using N using n by auto  | 
|
2222  | 
ultimately have "dist (f n) l < e" using dist_triangle_half_r[of "f (r n)" "f n" e l] by (auto simp add: dist_commute) }  | 
|
2223  | 
hence "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast }  | 
|
2224  | 
hence "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` unfolding Lim_sequentially by auto }  | 
|
2225  | 
thus ?thesis unfolding complete_def by auto  | 
|
2226  | 
qed  | 
|
2227  | 
||
2228  | 
instance heine_borel < complete_space  | 
|
2229  | 
proof  | 
|
2230  | 
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"  | 
|
| 34104 | 2231  | 
hence "bounded (range f)"  | 
2232  | 
by (rule cauchy_imp_bounded)  | 
|
| 33175 | 2233  | 
hence "compact (closure (range f))"  | 
2234  | 
using bounded_closed_imp_compact [of "closure (range f)"] by auto  | 
|
2235  | 
hence "complete (closure (range f))"  | 
|
| 34104 | 2236  | 
by (rule compact_imp_complete)  | 
| 33175 | 2237  | 
moreover have "\<forall>n. f n \<in> closure (range f)"  | 
2238  | 
using closure_subset [of "range f"] by auto  | 
|
2239  | 
ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially"  | 
|
2240  | 
using `Cauchy f` unfolding complete_def by auto  | 
|
2241  | 
then show "convergent f"  | 
|
| 
36660
 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 
huffman 
parents: 
36659 
diff
changeset
 | 
2242  | 
unfolding convergent_def by auto  | 
| 33175 | 2243  | 
qed  | 
2244  | 
||
| 44632 | 2245  | 
instance euclidean_space \<subseteq> banach ..  | 
2246  | 
||
| 33175 | 2247  | 
lemma complete_univ: "complete (UNIV :: 'a::complete_space set)"  | 
2248  | 
proof(simp add: complete_def, rule, rule)  | 
|
2249  | 
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"  | 
|
2250  | 
hence "convergent f" by (rule Cauchy_convergent)  | 
|
| 
36660
 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 
huffman 
parents: 
36659 
diff
changeset
 | 
2251  | 
thus "\<exists>l. f ----> l" unfolding convergent_def .  | 
| 33175 | 2252  | 
qed  | 
2253  | 
||
2254  | 
lemma complete_imp_closed: assumes "complete s" shows "closed s"  | 
|
2255  | 
proof -  | 
|
2256  | 
  { fix x assume "x islimpt s"
 | 
|
2257  | 
    then obtain f where f: "\<forall>n. f n \<in> s - {x}" "(f ---> x) sequentially"
 | 
|
2258  | 
unfolding islimpt_sequential by auto  | 
|
2259  | 
then obtain l where l: "l\<in>s" "(f ---> l) sequentially"  | 
|
2260  | 
using `complete s`[unfolded complete_def] using convergent_imp_cauchy[of f x] by auto  | 
|
| 41970 | 2261  | 
hence "x \<in> s" using tendsto_unique[of sequentially f l x] trivial_limit_sequentially f(2) by auto  | 
| 33175 | 2262  | 
}  | 
2263  | 
thus "closed s" unfolding closed_limpt by auto  | 
|
2264  | 
qed  | 
|
2265  | 
||
2266  | 
lemma complete_eq_closed:  | 
|
2267  | 
fixes s :: "'a::complete_space set"  | 
|
2268  | 
shows "complete s \<longleftrightarrow> closed s" (is "?lhs = ?rhs")  | 
|
2269  | 
proof  | 
|
2270  | 
assume ?lhs thus ?rhs by (rule complete_imp_closed)  | 
|
2271  | 
next  | 
|
2272  | 
assume ?rhs  | 
|
2273  | 
  { fix f assume as:"\<forall>n::nat. f n \<in> s" "Cauchy f"
 | 
|
2274  | 
then obtain l where "(f ---> l) sequentially" using complete_univ[unfolded complete_def, THEN spec[where x=f]] by auto  | 
|
2275  | 
hence "\<exists>l\<in>s. (f ---> l) sequentially" using `?rhs`[unfolded closed_sequential_limits, THEN spec[where x=f], THEN spec[where x=l]] using as(1) by auto }  | 
|
2276  | 
thus ?lhs unfolding complete_def by auto  | 
|
2277  | 
qed  | 
|
2278  | 
||
2279  | 
lemma convergent_eq_cauchy:  | 
|
2280  | 
fixes s :: "nat \<Rightarrow> 'a::complete_space"  | 
|
| 44632 | 2281  | 
shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s"  | 
2282  | 
unfolding Cauchy_convergent_iff convergent_def ..  | 
|
| 33175 | 2283  | 
|
2284  | 
lemma convergent_imp_bounded:  | 
|
2285  | 
fixes s :: "nat \<Rightarrow> 'a::metric_space"  | 
|
| 44632 | 2286  | 
shows "(s ---> l) sequentially \<Longrightarrow> bounded (range s)"  | 
2287  | 
by (intro cauchy_imp_bounded convergent_imp_cauchy)  | 
|
| 33175 | 2288  | 
|
| 36437 | 2289  | 
subsubsection{* Total boundedness *}
 | 
| 33175 | 2290  | 
|
2291  | 
fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
 | 
|
2292  | 
"helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))"  | 
|
2293  | 
declare helper_1.simps[simp del]  | 
|
2294  | 
||
2295  | 
lemma compact_imp_totally_bounded:  | 
|
2296  | 
assumes "compact s"  | 
|
2297  | 
shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k))"  | 
|
2298  | 
proof(rule, rule, rule ccontr)  | 
|
2299  | 
fix e::real assume "e>0" and assm:"\<not> (\<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k)"  | 
|
2300  | 
def x \<equiv> "helper_1 s e"  | 
|
2301  | 
  { fix n
 | 
|
2302  | 
have "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)"  | 
|
2303  | 
proof(induct_tac rule:nat_less_induct)  | 
|
2304  | 
fix n def Q \<equiv> "(\<lambda>y. y \<in> s \<and> (\<forall>m<n. \<not> dist (x m) y < e))"  | 
|
2305  | 
assume as:"\<forall>m<n. x m \<in> s \<and> (\<forall>ma<m. \<not> dist (x ma) (x m) < e)"  | 
|
2306  | 
      have "\<not> s \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)" using assm apply simp apply(erule_tac x="x ` {0 ..< n}" in allE) using as by auto
 | 
|
2307  | 
      then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)" unfolding subset_eq by auto
 | 
|
2308  | 
have "Q (x n)" unfolding x_def and helper_1.simps[of s e n]  | 
|
2309  | 
apply(rule someI2[where a=z]) unfolding x_def[symmetric] and Q_def using z by auto  | 
|
2310  | 
thus "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" unfolding Q_def by auto  | 
|
2311  | 
qed }  | 
|
2312  | 
hence "\<forall>n::nat. x n \<in> s" and x:"\<forall>n. \<forall>m < n. \<not> (dist (x m) (x n) < e)" by blast+  | 
|
2313  | 
then obtain l r where "l\<in>s" and r:"subseq r" and "((x \<circ> r) ---> l) sequentially" using assms(1)[unfolded compact_def, THEN spec[where x=x]] by auto  | 
|
2314  | 
from this(3) have "Cauchy (x \<circ> r)" using convergent_imp_cauchy by auto  | 
|
2315  | 
then obtain N::nat where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist ((x \<circ> r) m) ((x \<circ> r) n) < e" unfolding cauchy_def using `e>0` by auto  | 
|
2316  | 
show False  | 
|
2317  | 
using N[THEN spec[where x=N], THEN spec[where x="N+1"]]  | 
|
2318  | 
using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]]  | 
|
2319  | 
using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto  | 
|
2320  | 
qed  | 
|
2321  | 
||
| 36437 | 2322  | 
subsubsection{* Heine-Borel theorem *}
 | 
2323  | 
||
2324  | 
text {* Following Burkill \& Burkill vol. 2. *}
 | 
|
| 33175 | 2325  | 
|
2326  | 
lemma heine_borel_lemma: fixes s::"'a::metric_space set"  | 
|
2327  | 
assumes "compact s" "s \<subseteq> (\<Union> t)" "\<forall>b \<in> t. open b"  | 
|
2328  | 
shows "\<exists>e>0. \<forall>x \<in> s. \<exists>b \<in> t. ball x e \<subseteq> b"  | 
|
2329  | 
proof(rule ccontr)  | 
|
2330  | 
assume "\<not> (\<exists>e>0. \<forall>x\<in>s. \<exists>b\<in>t. ball x e \<subseteq> b)"  | 
|
2331  | 
hence cont:"\<forall>e>0. \<exists>x\<in>s. \<forall>xa\<in>t. \<not> (ball x e \<subseteq> xa)" by auto  | 
|
2332  | 
  { fix n::nat
 | 
|
2333  | 
have "1 / real (n + 1) > 0" by auto  | 
|
2334  | 
hence "\<exists>x. x\<in>s \<and> (\<forall>xa\<in>t. \<not> (ball x (inverse (real (n+1))) \<subseteq> xa))" using cont unfolding Bex_def by auto }  | 
|
2335  | 
hence "\<forall>n::nat. \<exists>x. x \<in> s \<and> (\<forall>xa\<in>t. \<not> ball x (inverse (real (n + 1))) \<subseteq> xa)" by auto  | 
|
2336  | 
then obtain f where f:"\<forall>n::nat. f n \<in> s \<and> (\<forall>xa\<in>t. \<not> ball (f n) (inverse (real (n + 1))) \<subseteq> xa)"  | 
|
2337  | 
using choice[of "\<lambda>n::nat. \<lambda>x. x\<in>s \<and> (\<forall>xa\<in>t. \<not> ball x (inverse (real (n + 1))) \<subseteq> xa)"] by auto  | 
|
2338  | 
||
2339  | 
then obtain l r where l:"l\<in>s" and r:"subseq r" and lr:"((f \<circ> r) ---> l) sequentially"  | 
|
2340  | 
using assms(1)[unfolded compact_def, THEN spec[where x=f]] by auto  | 
|
2341  | 
||
2342  | 
obtain b where "l\<in>b" "b\<in>t" using assms(2) and l by auto  | 
|
2343  | 
then obtain e where "e>0" and e:"\<forall>z. dist z l < e \<longrightarrow> z\<in>b"  | 
|
2344  | 
using assms(3)[THEN bspec[where x=b]] unfolding open_dist by auto  | 
|
2345  | 
||
2346  | 
then obtain N1 where N1:"\<forall>n\<ge>N1. dist ((f \<circ> r) n) l < e / 2"  | 
|
2347  | 
using lr[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto  | 
|
2348  | 
||
2349  | 
obtain N2::nat where N2:"N2>0" "inverse (real N2) < e /2" using real_arch_inv[of "e/2"] and `e>0` by auto  | 
|
2350  | 
have N2':"inverse (real (r (N1 + N2) +1 )) < e/2"  | 
|
2351  | 
apply(rule order_less_trans) apply(rule less_imp_inverse_less) using N2  | 
|
2352  | 
using subseq_bigger[OF r, of "N1 + N2"] by auto  | 
|
2353  | 
||
2354  | 
def x \<equiv> "(f (r (N1 + N2)))"  | 
|
2355  | 
have x:"\<not> ball x (inverse (real (r (N1 + N2) + 1))) \<subseteq> b" unfolding x_def  | 
|
2356  | 
using f[THEN spec[where x="r (N1 + N2)"]] using `b\<in>t` by auto  | 
|
2357  | 
have "\<exists>y\<in>ball x (inverse (real (r (N1 + N2) + 1))). y\<notin>b" apply(rule ccontr) using x by auto  | 
|
2358  | 
then obtain y where y:"y \<in> ball x (inverse (real (r (N1 + N2) + 1)))" "y \<notin> b" by auto  | 
|
2359  | 
||
2360  | 
have "dist x l < e/2" using N1 unfolding x_def o_def by auto  | 
|
2361  | 
hence "dist y l < e" using y N2' using dist_triangle[of y l x]by (auto simp add:dist_commute)  | 
|
2362  | 
||
2363  | 
thus False using e and `y\<notin>b` by auto  | 
|
2364  | 
qed  | 
|
2365  | 
||
2366  | 
lemma compact_imp_heine_borel: "compact s ==> (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)  | 
|
2367  | 
\<longrightarrow> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))"  | 
|
2368  | 
proof clarify  | 
|
2369  | 
fix f assume "compact s" " \<forall>t\<in>f. open t" "s \<subseteq> \<Union>f"  | 
|
2370  | 
then obtain e::real where "e>0" and "\<forall>x\<in>s. \<exists>b\<in>f. ball x e \<subseteq> b" using heine_borel_lemma[of s f] by auto  | 
|
2371  | 
hence "\<forall>x\<in>s. \<exists>b. b\<in>f \<and> ball x e \<subseteq> b" by auto  | 
|
2372  | 
hence "\<exists>bb. \<forall>x\<in>s. bb x \<in>f \<and> ball x e \<subseteq> bb x" using bchoice[of s "\<lambda>x b. b\<in>f \<and> ball x e \<subseteq> b"] by auto  | 
|
2373  | 
then obtain bb where bb:"\<forall>x\<in>s. (bb x) \<in> f \<and> ball x e \<subseteq> (bb x)" by blast  | 
|
2374  | 
||
2375  | 
from `compact s` have "\<exists> k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" using compact_imp_totally_bounded[of s] `e>0` by auto  | 
|
2376  | 
then obtain k where k:"finite k" "k \<subseteq> s" "s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" by auto  | 
|
2377  | 
||
2378  | 
have "finite (bb ` k)" using k(1) by auto  | 
|
2379  | 
moreover  | 
|
2380  | 
  { fix x assume "x\<in>s"
 | 
|
2381  | 
hence "x\<in>\<Union>(\<lambda>x. ball x e) ` k" using k(3) unfolding subset_eq by auto  | 
|
2382  | 
hence "\<exists>X\<in>bb ` k. x \<in> X" using bb k(2) by blast  | 
|
2383  | 
hence "x \<in> \<Union>(bb ` k)" using Union_iff[of x "bb ` k"] by auto  | 
|
2384  | 
}  | 
|
2385  | 
ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f'" using bb k(2) by (rule_tac x="bb ` k" in exI) auto  | 
|
2386  | 
qed  | 
|
2387  | 
||
| 36437 | 2388  | 
subsubsection {* Bolzano-Weierstrass property *}
 | 
| 33175 | 2389  | 
|
2390  | 
lemma heine_borel_imp_bolzano_weierstrass:  | 
|
2391  | 
assumes "\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) --> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f'))"  | 
|
2392  | 
"infinite t" "t \<subseteq> s"  | 
|
2393  | 
shows "\<exists>x \<in> s. x islimpt t"  | 
|
2394  | 
proof(rule ccontr)  | 
|
2395  | 
assume "\<not> (\<exists>x \<in> s. x islimpt t)"  | 
|
2396  | 
then obtain f where f:"\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)" unfolding islimpt_def  | 
|
2397  | 
using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] by auto  | 
|
2398  | 
  obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
 | 
|
2399  | 
    using assms(1)[THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto
 | 
|
2400  | 
from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto  | 
|
2401  | 
  { fix x y assume "x\<in>t" "y\<in>t" "f x = f y"
 | 
|
2402  | 
hence "x \<in> f x" "y \<in> f x \<longrightarrow> y = x" using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto  | 
|
2403  | 
hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto }  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
2404  | 
hence "inj_on f t" unfolding inj_on_def by simp  | 
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
2405  | 
hence "infinite (f ` t)" using assms(2) using finite_imageD by auto  | 
| 33175 | 2406  | 
moreover  | 
2407  | 
  { fix x assume "x\<in>t" "f x \<notin> g"
 | 
|
2408  | 
from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto  | 
|
2409  | 
then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto  | 
|
2410  | 
hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto  | 
|
2411  | 
hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto }  | 
|
2412  | 
hence "f ` t \<subseteq> g" by auto  | 
|
2413  | 
ultimately show False using g(2) using finite_subset by auto  | 
|
2414  | 
qed  | 
|
2415  | 
||
| 36437 | 2416  | 
subsubsection {* Complete the chain of compactness variants *}
 | 
| 33175 | 2417  | 
|
| 44073 | 2418  | 
lemma islimpt_range_imp_convergent_subsequence:  | 
2419  | 
fixes f :: "nat \<Rightarrow> 'a::metric_space"  | 
|
2420  | 
assumes "l islimpt (range f)"  | 
|
2421  | 
shows "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2422  | 
proof (intro exI conjI)  | 
|
2423  | 
have *: "\<And>e. 0 < e \<Longrightarrow> \<exists>n. 0 < dist (f n) l \<and> dist (f n) l < e"  | 
|
2424  | 
using assms unfolding islimpt_def  | 
|
2425  | 
by (drule_tac x="ball l e" in spec)  | 
|
2426  | 
(auto simp add: zero_less_dist_iff dist_commute)  | 
|
2427  | 
||
2428  | 
def t \<equiv> "\<lambda>e. LEAST n. 0 < dist (f n) l \<and> dist (f n) l < e"  | 
|
2429  | 
have f_t_neq: "\<And>e. 0 < e \<Longrightarrow> 0 < dist (f (t e)) l"  | 
|
2430  | 
unfolding t_def by (rule LeastI2_ex [OF * conjunct1])  | 
|
2431  | 
have f_t_closer: "\<And>e. 0 < e \<Longrightarrow> dist (f (t e)) l < e"  | 
|
2432  | 
unfolding t_def by (rule LeastI2_ex [OF * conjunct2])  | 
|
2433  | 
have t_le: "\<And>n e. 0 < dist (f n) l \<Longrightarrow> dist (f n) l < e \<Longrightarrow> t e \<le> n"  | 
|
2434  | 
unfolding t_def by (simp add: Least_le)  | 
|
2435  | 
have less_tD: "\<And>n e. n < t e \<Longrightarrow> 0 < dist (f n) l \<Longrightarrow> e \<le> dist (f n) l"  | 
|
2436  | 
unfolding t_def by (drule not_less_Least) simp  | 
|
2437  | 
have t_antimono: "\<And>e e'. 0 < e \<Longrightarrow> e \<le> e' \<Longrightarrow> t e' \<le> t e"  | 
|
2438  | 
apply (rule t_le)  | 
|
2439  | 
apply (erule f_t_neq)  | 
|
2440  | 
apply (erule (1) less_le_trans [OF f_t_closer])  | 
|
2441  | 
done  | 
|
2442  | 
have t_dist_f_neq: "\<And>n. 0 < dist (f n) l \<Longrightarrow> t (dist (f n) l) \<noteq> n"  | 
|
2443  | 
by (drule f_t_closer) auto  | 
|
2444  | 
have t_less: "\<And>e. 0 < e \<Longrightarrow> t e < t (dist (f (t e)) l)"  | 
|
2445  | 
apply (subst less_le)  | 
|
2446  | 
apply (rule conjI)  | 
|
2447  | 
apply (rule t_antimono)  | 
|
2448  | 
apply (erule f_t_neq)  | 
|
2449  | 
apply (erule f_t_closer [THEN less_imp_le])  | 
|
2450  | 
apply (rule t_dist_f_neq [symmetric])  | 
|
2451  | 
apply (erule f_t_neq)  | 
|
2452  | 
done  | 
|
2453  | 
have dist_f_t_less':  | 
|
2454  | 
"\<And>e e'. 0 < e \<Longrightarrow> 0 < e' \<Longrightarrow> t e \<le> t e' \<Longrightarrow> dist (f (t e')) l < e"  | 
|
2455  | 
apply (simp add: le_less)  | 
|
2456  | 
apply (erule disjE)  | 
|
2457  | 
apply (rule less_trans)  | 
|
2458  | 
apply (erule f_t_closer)  | 
|
2459  | 
apply (rule le_less_trans)  | 
|
2460  | 
apply (erule less_tD)  | 
|
2461  | 
apply (erule f_t_neq)  | 
|
2462  | 
apply (erule f_t_closer)  | 
|
2463  | 
apply (erule subst)  | 
|
2464  | 
apply (erule f_t_closer)  | 
|
2465  | 
done  | 
|
2466  | 
||
2467  | 
def r \<equiv> "nat_rec (t 1) (\<lambda>_ x. t (dist (f x) l))"  | 
|
2468  | 
have r_simps: "r 0 = t 1" "\<And>n. r (Suc n) = t (dist (f (r n)) l)"  | 
|
2469  | 
unfolding r_def by simp_all  | 
|
2470  | 
have f_r_neq: "\<And>n. 0 < dist (f (r n)) l"  | 
|
2471  | 
by (induct_tac n) (simp_all add: r_simps f_t_neq)  | 
|
2472  | 
||
2473  | 
show "subseq r"  | 
|
2474  | 
unfolding subseq_Suc_iff  | 
|
2475  | 
apply (rule allI)  | 
|
2476  | 
apply (case_tac n)  | 
|
2477  | 
apply (simp_all add: r_simps)  | 
|
2478  | 
apply (rule t_less, rule zero_less_one)  | 
|
2479  | 
apply (rule t_less, rule f_r_neq)  | 
|
2480  | 
done  | 
|
2481  | 
show "((f \<circ> r) ---> l) sequentially"  | 
|
2482  | 
unfolding Lim_sequentially o_def  | 
|
2483  | 
apply (clarify, rule_tac x="t e" in exI, clarify)  | 
|
2484  | 
apply (drule le_trans, rule seq_suble [OF `subseq r`])  | 
|
2485  | 
apply (case_tac n, simp_all add: r_simps dist_f_t_less' f_r_neq)  | 
|
2486  | 
done  | 
|
2487  | 
qed  | 
|
2488  | 
||
2489  | 
lemma finite_range_imp_infinite_repeats:  | 
|
2490  | 
fixes f :: "nat \<Rightarrow> 'a"  | 
|
2491  | 
assumes "finite (range f)"  | 
|
2492  | 
  shows "\<exists>k. infinite {n. f n = k}"
 | 
|
2493  | 
proof -  | 
|
2494  | 
  { fix A :: "'a set" assume "finite A"
 | 
|
2495  | 
    hence "\<And>f. infinite {n. f n \<in> A} \<Longrightarrow> \<exists>k. infinite {n. f n = k}"
 | 
|
2496  | 
proof (induct)  | 
|
2497  | 
case empty thus ?case by simp  | 
|
2498  | 
next  | 
|
2499  | 
case (insert x A)  | 
|
2500  | 
show ?case  | 
|
2501  | 
      proof (cases "finite {n. f n = x}")
 | 
|
2502  | 
case True  | 
|
2503  | 
        with `infinite {n. f n \<in> insert x A}`
 | 
|
2504  | 
        have "infinite {n. f n \<in> A}" by simp
 | 
|
2505  | 
        thus "\<exists>k. infinite {n. f n = k}" by (rule insert)
 | 
|
2506  | 
next  | 
|
2507  | 
        case False thus "\<exists>k. infinite {n. f n = k}" ..
 | 
|
2508  | 
qed  | 
|
2509  | 
qed  | 
|
2510  | 
} note H = this  | 
|
2511  | 
  from assms show "\<exists>k. infinite {n. f n = k}"
 | 
|
2512  | 
by (rule H) simp  | 
|
2513  | 
qed  | 
|
2514  | 
||
2515  | 
lemma bolzano_weierstrass_imp_compact:  | 
|
2516  | 
fixes s :: "'a::metric_space set"  | 
|
2517  | 
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"  | 
|
2518  | 
shows "compact s"  | 
|
2519  | 
proof -  | 
|
2520  | 
  { fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s"
 | 
|
2521  | 
have "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2522  | 
proof (cases "finite (range f)")  | 
|
2523  | 
case True  | 
|
2524  | 
      hence "\<exists>l. infinite {n. f n = l}"
 | 
|
2525  | 
by (rule finite_range_imp_infinite_repeats)  | 
|
2526  | 
      then obtain l where "infinite {n. f n = l}" ..
 | 
|
2527  | 
      hence "\<exists>r. subseq r \<and> (\<forall>n. r n \<in> {n. f n = l})"
 | 
|
2528  | 
by (rule infinite_enumerate)  | 
|
2529  | 
then obtain r where "subseq r" and fr: "\<forall>n. f (r n) = l" by auto  | 
|
2530  | 
hence "subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
| 44125 | 2531  | 
unfolding o_def by (simp add: fr tendsto_const)  | 
| 44073 | 2532  | 
hence "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
2533  | 
by - (rule exI)  | 
|
2534  | 
from f have "\<forall>n. f (r n) \<in> s" by simp  | 
|
2535  | 
hence "l \<in> s" by (simp add: fr)  | 
|
2536  | 
thus "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2537  | 
by (rule rev_bexI) fact  | 
|
2538  | 
next  | 
|
2539  | 
case False  | 
|
2540  | 
with f assms have "\<exists>x\<in>s. x islimpt (range f)" by auto  | 
|
2541  | 
then obtain l where "l \<in> s" "l islimpt (range f)" ..  | 
|
2542  | 
have "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2543  | 
using `l islimpt (range f)`  | 
|
2544  | 
by (rule islimpt_range_imp_convergent_subsequence)  | 
|
2545  | 
with `l \<in> s` show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" ..  | 
|
2546  | 
qed  | 
|
2547  | 
}  | 
|
2548  | 
thus ?thesis unfolding compact_def by auto  | 
|
2549  | 
qed  | 
|
2550  | 
||
| 33175 | 2551  | 
primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where  | 
2552  | 
"helper_2 beyond 0 = beyond 0" |  | 
|
2553  | 
"helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )"  | 
|
2554  | 
||
2555  | 
lemma bolzano_weierstrass_imp_bounded: fixes s::"'a::metric_space set"  | 
|
2556  | 
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"  | 
|
2557  | 
shows "bounded s"  | 
|
2558  | 
proof(rule ccontr)  | 
|
2559  | 
assume "\<not> bounded s"  | 
|
2560  | 
then obtain beyond where "\<forall>a. beyond a \<in>s \<and> \<not> dist undefined (beyond a) \<le> a"  | 
|
2561  | 
unfolding bounded_any_center [where a=undefined]  | 
|
2562  | 
apply simp using choice[of "\<lambda>a x. x\<in>s \<and> \<not> dist undefined x \<le> a"] by auto  | 
|
2563  | 
hence beyond:"\<And>a. beyond a \<in>s" "\<And>a. dist undefined (beyond a) > a"  | 
|
2564  | 
unfolding linorder_not_le by auto  | 
|
2565  | 
def x \<equiv> "helper_2 beyond"  | 
|
2566  | 
||
2567  | 
  { fix m n ::nat assume "m<n"
 | 
|
2568  | 
hence "dist undefined (x m) + 1 < dist undefined (x n)"  | 
|
2569  | 
proof(induct n)  | 
|
2570  | 
case 0 thus ?case by auto  | 
|
2571  | 
next  | 
|
2572  | 
case (Suc n)  | 
|
2573  | 
have *:"dist undefined (x n) + 1 < dist undefined (x (Suc n))"  | 
|
2574  | 
unfolding x_def and helper_2.simps  | 
|
2575  | 
using beyond(2)[of "dist undefined (helper_2 beyond n) + 1"] by auto  | 
|
2576  | 
thus ?case proof(cases "m < n")  | 
|
2577  | 
case True thus ?thesis using Suc and * by auto  | 
|
2578  | 
next  | 
|
2579  | 
case False hence "m = n" using Suc(2) by auto  | 
|
2580  | 
thus ?thesis using * by auto  | 
|
2581  | 
qed  | 
|
2582  | 
qed } note * = this  | 
|
2583  | 
  { fix m n ::nat assume "m\<noteq>n"
 | 
|
2584  | 
have "1 < dist (x m) (x n)"  | 
|
2585  | 
proof(cases "m<n")  | 
|
2586  | 
case True  | 
|
2587  | 
hence "1 < dist undefined (x n) - dist undefined (x m)" using *[of m n] by auto  | 
|
2588  | 
thus ?thesis using dist_triangle [of undefined "x n" "x m"] by arith  | 
|
2589  | 
next  | 
|
2590  | 
case False hence "n<m" using `m\<noteq>n` by auto  | 
|
2591  | 
hence "1 < dist undefined (x m) - dist undefined (x n)" using *[of n m] by auto  | 
|
2592  | 
thus ?thesis using dist_triangle2 [of undefined "x m" "x n"] by arith  | 
|
2593  | 
qed } note ** = this  | 
|
2594  | 
  { fix a b assume "x a = x b" "a \<noteq> b"
 | 
|
2595  | 
hence False using **[of a b] by auto }  | 
|
2596  | 
hence "inj x" unfolding inj_on_def by auto  | 
|
2597  | 
moreover  | 
|
2598  | 
  { fix n::nat
 | 
|
2599  | 
have "x n \<in> s"  | 
|
2600  | 
proof(cases "n = 0")  | 
|
2601  | 
case True thus ?thesis unfolding x_def using beyond by auto  | 
|
2602  | 
next  | 
|
2603  | 
case False then obtain z where "n = Suc z" using not0_implies_Suc by auto  | 
|
2604  | 
thus ?thesis unfolding x_def using beyond by auto  | 
|
2605  | 
qed }  | 
|
2606  | 
ultimately have "infinite (range x) \<and> range x \<subseteq> s" unfolding x_def using range_inj_infinite[of "helper_2 beyond"] using beyond(1) by auto  | 
|
2607  | 
||
2608  | 
then obtain l where "l\<in>s" and l:"l islimpt range x" using assms[THEN spec[where x="range x"]] by auto  | 
|
2609  | 
then obtain y where "x y \<noteq> l" and y:"dist (x y) l < 1/2" unfolding islimpt_approachable apply(erule_tac x="1/2" in allE) by auto  | 
|
2610  | 
then obtain z where "x z \<noteq> l" and z:"dist (x z) l < dist (x y) l" using l[unfolded islimpt_approachable, THEN spec[where x="dist (x y) l"]]  | 
|
2611  | 
unfolding dist_nz by auto  | 
|
2612  | 
show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto  | 
|
2613  | 
qed  | 
|
2614  | 
||
2615  | 
lemma sequence_infinite_lemma:  | 
|
| 44076 | 2616  | 
fixes f :: "nat \<Rightarrow> 'a::t1_space"  | 
2617  | 
assumes "\<forall>n. f n \<noteq> l" and "(f ---> l) sequentially"  | 
|
| 34104 | 2618  | 
shows "infinite (range f)"  | 
2619  | 
proof  | 
|
2620  | 
assume "finite (range f)"  | 
|
| 44076 | 2621  | 
hence "closed (range f)" by (rule finite_imp_closed)  | 
2622  | 
hence "open (- range f)" by (rule open_Compl)  | 
|
2623  | 
from assms(1) have "l \<in> - range f" by auto  | 
|
2624  | 
from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially"  | 
|
2625  | 
using `open (- range f)` `l \<in> - range f` by (rule topological_tendstoD)  | 
|
2626  | 
thus False unfolding eventually_sequentially by auto  | 
|
2627  | 
qed  | 
|
2628  | 
||
2629  | 
lemma closure_insert:  | 
|
2630  | 
fixes x :: "'a::t1_space"  | 
|
2631  | 
shows "closure (insert x s) = insert x (closure s)"  | 
|
2632  | 
apply (rule closure_unique)  | 
|
| 44519 | 2633  | 
apply (rule insert_mono [OF closure_subset])  | 
2634  | 
apply (rule closed_insert [OF closed_closure])  | 
|
| 44076 | 2635  | 
apply (simp add: closure_minimal)  | 
2636  | 
done  | 
|
2637  | 
||
2638  | 
lemma islimpt_insert:  | 
|
2639  | 
fixes x :: "'a::t1_space"  | 
|
2640  | 
shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s"  | 
|
2641  | 
proof  | 
|
2642  | 
assume *: "x islimpt (insert a s)"  | 
|
2643  | 
show "x islimpt s"  | 
|
2644  | 
proof (rule islimptI)  | 
|
2645  | 
fix t assume t: "x \<in> t" "open t"  | 
|
2646  | 
show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x"  | 
|
2647  | 
proof (cases "x = a")  | 
|
2648  | 
case True  | 
|
2649  | 
obtain y where "y \<in> insert a s" "y \<in> t" "y \<noteq> x"  | 
|
2650  | 
using * t by (rule islimptE)  | 
|
2651  | 
with `x = a` show ?thesis by auto  | 
|
2652  | 
next  | 
|
2653  | 
case False  | 
|
2654  | 
      with t have t': "x \<in> t - {a}" "open (t - {a})"
 | 
|
2655  | 
by (simp_all add: open_Diff)  | 
|
2656  | 
      obtain y where "y \<in> insert a s" "y \<in> t - {a}" "y \<noteq> x"
 | 
|
2657  | 
using * t' by (rule islimptE)  | 
|
2658  | 
thus ?thesis by auto  | 
|
2659  | 
qed  | 
|
2660  | 
qed  | 
|
2661  | 
next  | 
|
2662  | 
assume "x islimpt s" thus "x islimpt (insert a s)"  | 
|
2663  | 
by (rule islimpt_subset) auto  | 
|
2664  | 
qed  | 
|
2665  | 
||
2666  | 
lemma islimpt_union_finite:  | 
|
2667  | 
fixes x :: "'a::t1_space"  | 
|
2668  | 
shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t"  | 
|
2669  | 
by (induct set: finite, simp_all add: islimpt_insert)  | 
|
2670  | 
||
| 33175 | 2671  | 
lemma sequence_unique_limpt:  | 
| 44076 | 2672  | 
fixes f :: "nat \<Rightarrow> 'a::t2_space"  | 
2673  | 
assumes "(f ---> l) sequentially" and "l' islimpt (range f)"  | 
|
| 33175 | 2674  | 
shows "l' = l"  | 
| 44076 | 2675  | 
proof (rule ccontr)  | 
2676  | 
assume "l' \<noteq> l"  | 
|
2677  | 
  obtain s t where "open s" "open t" "l' \<in> s" "l \<in> t" "s \<inter> t = {}"
 | 
|
2678  | 
using hausdorff [OF `l' \<noteq> l`] by auto  | 
|
2679  | 
have "eventually (\<lambda>n. f n \<in> t) sequentially"  | 
|
2680  | 
using assms(1) `open t` `l \<in> t` by (rule topological_tendstoD)  | 
|
2681  | 
then obtain N where "\<forall>n\<ge>N. f n \<in> t"  | 
|
2682  | 
unfolding eventually_sequentially by auto  | 
|
2683  | 
||
2684  | 
  have "UNIV = {..<N} \<union> {N..}" by auto
 | 
|
2685  | 
  hence "l' islimpt (f ` ({..<N} \<union> {N..}))" using assms(2) by simp
 | 
|
2686  | 
  hence "l' islimpt (f ` {..<N} \<union> f ` {N..})" by (simp add: image_Un)
 | 
|
2687  | 
  hence "l' islimpt (f ` {N..})" by (simp add: islimpt_union_finite)
 | 
|
2688  | 
  then obtain y where "y \<in> f ` {N..}" "y \<in> s" "y \<noteq> l'"
 | 
|
2689  | 
using `l' \<in> s` `open s` by (rule islimptE)  | 
|
2690  | 
then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'" by auto  | 
|
2691  | 
with `\<forall>n\<ge>N. f n \<in> t` have "f n \<in> s \<inter> t" by simp  | 
|
2692  | 
  with `s \<inter> t = {}` show False by simp
 | 
|
| 33175 | 2693  | 
qed  | 
2694  | 
||
2695  | 
lemma bolzano_weierstrass_imp_closed:  | 
|
2696  | 
fixes s :: "'a::metric_space set" (* TODO: can this be generalized? *)  | 
|
2697  | 
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"  | 
|
2698  | 
shows "closed s"  | 
|
2699  | 
proof-  | 
|
2700  | 
  { fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially"
 | 
|
2701  | 
hence "l \<in> s"  | 
|
2702  | 
proof(cases "\<forall>n. x n \<noteq> l")  | 
|
2703  | 
case False thus "l\<in>s" using as(1) by auto  | 
|
2704  | 
next  | 
|
2705  | 
case True note cas = this  | 
|
| 34104 | 2706  | 
with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto  | 
2707  | 
then obtain l' where "l'\<in>s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto  | 
|
| 33175 | 2708  | 
thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto  | 
2709  | 
qed }  | 
|
2710  | 
thus ?thesis unfolding closed_sequential_limits by fast  | 
|
2711  | 
qed  | 
|
2712  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
2713  | 
text {* Hence express everything as an equivalence. *}
 | 
| 33175 | 2714  | 
|
2715  | 
lemma compact_eq_heine_borel:  | 
|
| 44074 | 2716  | 
fixes s :: "'a::metric_space set"  | 
| 33175 | 2717  | 
shows "compact s \<longleftrightarrow>  | 
2718  | 
(\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)  | 
|
2719  | 
--> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" (is "?lhs = ?rhs")  | 
|
2720  | 
proof  | 
|
| 44074 | 2721  | 
assume ?lhs thus ?rhs by (rule compact_imp_heine_borel)  | 
| 33175 | 2722  | 
next  | 
2723  | 
assume ?rhs  | 
|
2724  | 
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. x islimpt t)"  | 
|
2725  | 
by (blast intro: heine_borel_imp_bolzano_weierstrass[of s])  | 
|
| 44074 | 2726  | 
thus ?lhs by (rule bolzano_weierstrass_imp_compact)  | 
| 33175 | 2727  | 
qed  | 
2728  | 
||
2729  | 
lemma compact_eq_bolzano_weierstrass:  | 
|
| 44074 | 2730  | 
fixes s :: "'a::metric_space set"  | 
| 33175 | 2731  | 
shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs")  | 
2732  | 
proof  | 
|
2733  | 
assume ?lhs thus ?rhs unfolding compact_eq_heine_borel using heine_borel_imp_bolzano_weierstrass[of s] by auto  | 
|
2734  | 
next  | 
|
| 44074 | 2735  | 
assume ?rhs thus ?lhs by (rule bolzano_weierstrass_imp_compact)  | 
| 33175 | 2736  | 
qed  | 
2737  | 
||
2738  | 
lemma compact_eq_bounded_closed:  | 
|
2739  | 
fixes s :: "'a::heine_borel set"  | 
|
2740  | 
shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs")  | 
|
2741  | 
proof  | 
|
2742  | 
assume ?lhs thus ?rhs unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto  | 
|
2743  | 
next  | 
|
2744  | 
assume ?rhs thus ?lhs using bounded_closed_imp_compact by auto  | 
|
2745  | 
qed  | 
|
2746  | 
||
2747  | 
lemma compact_imp_bounded:  | 
|
2748  | 
fixes s :: "'a::metric_space set"  | 
|
2749  | 
shows "compact s ==> bounded s"  | 
|
2750  | 
proof -  | 
|
2751  | 
assume "compact s"  | 
|
2752  | 
hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')"  | 
|
2753  | 
by (rule compact_imp_heine_borel)  | 
|
2754  | 
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"  | 
|
2755  | 
using heine_borel_imp_bolzano_weierstrass[of s] by auto  | 
|
2756  | 
thus "bounded s"  | 
|
2757  | 
by (rule bolzano_weierstrass_imp_bounded)  | 
|
2758  | 
qed  | 
|
2759  | 
||
2760  | 
lemma compact_imp_closed:  | 
|
2761  | 
fixes s :: "'a::metric_space set"  | 
|
2762  | 
shows "compact s ==> closed s"  | 
|
2763  | 
proof -  | 
|
2764  | 
assume "compact s"  | 
|
2765  | 
hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')"  | 
|
2766  | 
by (rule compact_imp_heine_borel)  | 
|
2767  | 
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"  | 
|
2768  | 
using heine_borel_imp_bolzano_weierstrass[of s] by auto  | 
|
2769  | 
thus "closed s"  | 
|
2770  | 
by (rule bolzano_weierstrass_imp_closed)  | 
|
2771  | 
qed  | 
|
2772  | 
||
2773  | 
text{* In particular, some common special cases. *}
 | 
|
2774  | 
||
2775  | 
lemma compact_empty[simp]:  | 
|
2776  | 
 "compact {}"
 | 
|
2777  | 
unfolding compact_def  | 
|
2778  | 
by simp  | 
|
2779  | 
||
| 44075 | 2780  | 
lemma subseq_o: "subseq r \<Longrightarrow> subseq s \<Longrightarrow> subseq (r \<circ> s)"  | 
2781  | 
unfolding subseq_def by simp (* TODO: move somewhere else *)  | 
|
2782  | 
||
2783  | 
lemma compact_union [intro]:  | 
|
2784  | 
assumes "compact s" and "compact t"  | 
|
2785  | 
shows "compact (s \<union> t)"  | 
|
2786  | 
proof (rule compactI)  | 
|
2787  | 
fix f :: "nat \<Rightarrow> 'a"  | 
|
2788  | 
assume "\<forall>n. f n \<in> s \<union> t"  | 
|
2789  | 
  hence "infinite {n. f n \<in> s \<union> t}" by simp
 | 
|
2790  | 
  hence "infinite {n. f n \<in> s} \<or> infinite {n. f n \<in> t}" by simp
 | 
|
2791  | 
thus "\<exists>l\<in>s \<union> t. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
2792  | 
proof  | 
|
2793  | 
    assume "infinite {n. f n \<in> s}"
 | 
|
2794  | 
from infinite_enumerate [OF this]  | 
|
2795  | 
obtain q where "subseq q" "\<forall>n. (f \<circ> q) n \<in> s" by auto  | 
|
2796  | 
obtain r l where "l \<in> s" "subseq r" "((f \<circ> q \<circ> r) ---> l) sequentially"  | 
|
2797  | 
using `compact s` `\<forall>n. (f \<circ> q) n \<in> s` by (rule compactE)  | 
|
2798  | 
hence "l \<in> s \<union> t" "subseq (q \<circ> r)" "((f \<circ> (q \<circ> r)) ---> l) sequentially"  | 
|
2799  | 
using `subseq q` by (simp_all add: subseq_o o_assoc)  | 
|
2800  | 
thus ?thesis by auto  | 
|
2801  | 
next  | 
|
2802  | 
    assume "infinite {n. f n \<in> t}"
 | 
|
2803  | 
from infinite_enumerate [OF this]  | 
|
2804  | 
obtain q where "subseq q" "\<forall>n. (f \<circ> q) n \<in> t" by auto  | 
|
2805  | 
obtain r l where "l \<in> t" "subseq r" "((f \<circ> q \<circ> r) ---> l) sequentially"  | 
|
2806  | 
using `compact t` `\<forall>n. (f \<circ> q) n \<in> t` by (rule compactE)  | 
|
2807  | 
hence "l \<in> s \<union> t" "subseq (q \<circ> r)" "((f \<circ> (q \<circ> r)) ---> l) sequentially"  | 
|
2808  | 
using `subseq q` by (simp_all add: subseq_o o_assoc)  | 
|
2809  | 
thus ?thesis by auto  | 
|
2810  | 
qed  | 
|
2811  | 
qed  | 
|
2812  | 
||
2813  | 
lemma compact_inter_closed [intro]:  | 
|
2814  | 
assumes "compact s" and "closed t"  | 
|
2815  | 
shows "compact (s \<inter> t)"  | 
|
2816  | 
proof (rule compactI)  | 
|
2817  | 
fix f :: "nat \<Rightarrow> 'a"  | 
|
2818  | 
assume "\<forall>n. f n \<in> s \<inter> t"  | 
|
2819  | 
hence "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t" by simp_all  | 
|
2820  | 
obtain l r where "l \<in> s" "subseq r" "((f \<circ> r) ---> l) sequentially"  | 
|
2821  | 
using `compact s` `\<forall>n. f n \<in> s` by (rule compactE)  | 
|
| 33175 | 2822  | 
moreover  | 
| 44075 | 2823  | 
from `closed t` `\<forall>n. f n \<in> t` `((f \<circ> r) ---> l) sequentially` have "l \<in> t"  | 
2824  | 
unfolding closed_sequential_limits o_def by fast  | 
|
2825  | 
ultimately show "\<exists>l\<in>s \<inter> t. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"  | 
|
| 33175 | 2826  | 
by auto  | 
2827  | 
qed  | 
|
2828  | 
||
| 44075 | 2829  | 
lemma closed_inter_compact [intro]:  | 
2830  | 
assumes "closed s" and "compact t"  | 
|
2831  | 
shows "compact (s \<inter> t)"  | 
|
2832  | 
using compact_inter_closed [of t s] assms  | 
|
2833  | 
by (simp add: Int_commute)  | 
|
2834  | 
||
2835  | 
lemma compact_inter [intro]:  | 
|
2836  | 
assumes "compact s" and "compact t"  | 
|
2837  | 
shows "compact (s \<inter> t)"  | 
|
2838  | 
using assms by (intro compact_inter_closed compact_imp_closed)  | 
|
| 33175 | 2839  | 
|
2840  | 
lemma compact_sing [simp]: "compact {a}"
 | 
|
2841  | 
unfolding compact_def o_def subseq_def  | 
|
2842  | 
by (auto simp add: tendsto_const)  | 
|
2843  | 
||
| 44075 | 2844  | 
lemma compact_insert [simp]:  | 
2845  | 
assumes "compact s" shows "compact (insert x s)"  | 
|
2846  | 
proof -  | 
|
2847  | 
  have "compact ({x} \<union> s)"
 | 
|
2848  | 
using compact_sing assms by (rule compact_union)  | 
|
2849  | 
thus ?thesis by simp  | 
|
2850  | 
qed  | 
|
2851  | 
||
2852  | 
lemma finite_imp_compact:  | 
|
2853  | 
shows "finite s \<Longrightarrow> compact s"  | 
|
2854  | 
by (induct set: finite) simp_all  | 
|
2855  | 
||
| 33175 | 2856  | 
lemma compact_cball[simp]:  | 
2857  | 
fixes x :: "'a::heine_borel"  | 
|
2858  | 
shows "compact(cball x e)"  | 
|
2859  | 
using compact_eq_bounded_closed bounded_cball closed_cball  | 
|
2860  | 
by blast  | 
|
2861  | 
||
2862  | 
lemma compact_frontier_bounded[intro]:  | 
|
2863  | 
fixes s :: "'a::heine_borel set"  | 
|
2864  | 
shows "bounded s ==> compact(frontier s)"  | 
|
2865  | 
unfolding frontier_def  | 
|
2866  | 
using compact_eq_bounded_closed  | 
|
2867  | 
by blast  | 
|
2868  | 
||
2869  | 
lemma compact_frontier[intro]:  | 
|
2870  | 
fixes s :: "'a::heine_borel set"  | 
|
2871  | 
shows "compact s ==> compact (frontier s)"  | 
|
2872  | 
using compact_eq_bounded_closed compact_frontier_bounded  | 
|
2873  | 
by blast  | 
|
2874  | 
||
2875  | 
lemma frontier_subset_compact:  | 
|
2876  | 
fixes s :: "'a::heine_borel set"  | 
|
2877  | 
shows "compact s ==> frontier s \<subseteq> s"  | 
|
2878  | 
using frontier_subset_closed compact_eq_bounded_closed  | 
|
2879  | 
by blast  | 
|
2880  | 
||
2881  | 
lemma open_delete:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
2882  | 
fixes s :: "'a::t1_space set"  | 
| 
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
2883  | 
  shows "open s \<Longrightarrow> open (s - {x})"
 | 
| 
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
2884  | 
by (simp add: open_Diff)  | 
| 33175 | 2885  | 
|
2886  | 
text{* Finite intersection property. I could make it an equivalence in fact. *}
 | 
|
2887  | 
||
2888  | 
lemma compact_imp_fip:  | 
|
2889  | 
assumes "compact s" "\<forall>t \<in> f. closed t"  | 
|
2890  | 
        "\<forall>f'. finite f' \<and> f' \<subseteq> f --> (s \<inter> (\<Inter> f') \<noteq> {})"
 | 
|
2891  | 
  shows "s \<inter> (\<Inter> f) \<noteq> {}"
 | 
|
2892  | 
proof  | 
|
2893  | 
  assume as:"s \<inter> (\<Inter> f) = {}"
 | 
|
| 34105 | 2894  | 
hence "s \<subseteq> \<Union> uminus ` f" by auto  | 
2895  | 
moreover have "Ball (uminus ` f) open" using open_Diff closed_Diff using assms(2) by auto  | 
|
2896  | 
ultimately obtain f' where f':"f' \<subseteq> uminus ` f" "finite f'" "s \<subseteq> \<Union>f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\<lambda>t. - t) ` f"]] by auto  | 
|
2897  | 
hence "finite (uminus ` f') \<and> uminus ` f' \<subseteq> f" by(auto simp add: Diff_Diff_Int)  | 
|
2898  | 
  hence "s \<inter> \<Inter>uminus ` f' \<noteq> {}" using assms(3)[THEN spec[where x="uminus ` f'"]] by auto
 | 
|
| 33175 | 2899  | 
thus False using f'(3) unfolding subset_eq and Union_iff by blast  | 
2900  | 
qed  | 
|
2901  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
2902  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
2903  | 
subsection {* Bounded closed nest property (proof does not use Heine-Borel) *}
 | 
| 33175 | 2904  | 
|
2905  | 
lemma bounded_closed_nest:  | 
|
2906  | 
  assumes "\<forall>n. closed(s n)" "\<forall>n. (s n \<noteq> {})"
 | 
|
2907  | 
"(\<forall>m n. m \<le> n --> s n \<subseteq> s m)" "bounded(s 0)"  | 
|
2908  | 
shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s(n)"  | 
|
2909  | 
proof-  | 
|
2910  | 
from assms(2) obtain x where x:"\<forall>n::nat. x n \<in> s n" using choice[of "\<lambda>n x. x\<in> s n"] by auto  | 
|
2911  | 
from assms(4,1) have *:"compact (s 0)" using bounded_closed_imp_compact[of "s 0"] by auto  | 
|
2912  | 
||
2913  | 
then obtain l r where lr:"l\<in>s 0" "subseq r" "((x \<circ> r) ---> l) sequentially"  | 
|
2914  | 
unfolding compact_def apply(erule_tac x=x in allE) using x using assms(3) by blast  | 
|
2915  | 
||
2916  | 
  { fix n::nat
 | 
|
2917  | 
    { fix e::real assume "e>0"
 | 
|
2918  | 
with lr(3) obtain N where N:"\<forall>m\<ge>N. dist ((x \<circ> r) m) l < e" unfolding Lim_sequentially by auto  | 
|
2919  | 
hence "dist ((x \<circ> r) (max N n)) l < e" by auto  | 
|
2920  | 
moreover  | 
|
2921  | 
have "r (max N n) \<ge> n" using lr(2) using subseq_bigger[of r "max N n"] by auto  | 
|
2922  | 
hence "(x \<circ> r) (max N n) \<in> s n"  | 
|
2923  | 
using x apply(erule_tac x=n in allE)  | 
|
2924  | 
using x apply(erule_tac x="r (max N n)" in allE)  | 
|
2925  | 
using assms(3) apply(erule_tac x=n in allE)apply( erule_tac x="r (max N n)" in allE) by auto  | 
|
2926  | 
ultimately have "\<exists>y\<in>s n. dist y l < e" by auto  | 
|
2927  | 
}  | 
|
2928  | 
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by blast  | 
|
2929  | 
}  | 
|
2930  | 
thus ?thesis by auto  | 
|
2931  | 
qed  | 
|
2932  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
2933  | 
text {* Decreasing case does not even need compactness, just completeness. *}
 | 
| 33175 | 2934  | 
|
2935  | 
lemma decreasing_closed_nest:  | 
|
2936  | 
assumes "\<forall>n. closed(s n)"  | 
|
2937  | 
          "\<forall>n. (s n \<noteq> {})"
 | 
|
2938  | 
"\<forall>m n. m \<le> n --> s n \<subseteq> s m"  | 
|
2939  | 
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y \<in> (s n). dist x y < e"  | 
|
| 44632 | 2940  | 
shows "\<exists>a::'a::complete_space. \<forall>n::nat. a \<in> s n"  | 
| 33175 | 2941  | 
proof-  | 
2942  | 
have "\<forall>n. \<exists> x. x\<in>s n" using assms(2) by auto  | 
|
2943  | 
hence "\<exists>t. \<forall>n. t n \<in> s n" using choice[of "\<lambda> n x. x \<in> s n"] by auto  | 
|
2944  | 
then obtain t where t: "\<forall>n. t n \<in> s n" by auto  | 
|
2945  | 
  { fix e::real assume "e>0"
 | 
|
2946  | 
then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" using assms(4) by auto  | 
|
2947  | 
    { fix m n ::nat assume "N \<le> m \<and> N \<le> n"
 | 
|
2948  | 
hence "t m \<in> s N" "t n \<in> s N" using assms(3) t unfolding subset_eq t by blast+  | 
|
2949  | 
hence "dist (t m) (t n) < e" using N by auto  | 
|
2950  | 
}  | 
|
2951  | 
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" by auto  | 
|
2952  | 
}  | 
|
2953  | 
hence "Cauchy t" unfolding cauchy_def by auto  | 
|
2954  | 
then obtain l where l:"(t ---> l) sequentially" using complete_univ unfolding complete_def by auto  | 
|
2955  | 
  { fix n::nat
 | 
|
2956  | 
    { fix e::real assume "e>0"
 | 
|
2957  | 
then obtain N::nat where N:"\<forall>n\<ge>N. dist (t n) l < e" using l[unfolded Lim_sequentially] by auto  | 
|
2958  | 
have "t (max n N) \<in> s n" using assms(3) unfolding subset_eq apply(erule_tac x=n in allE) apply (erule_tac x="max n N" in allE) using t by auto  | 
|
2959  | 
hence "\<exists>y\<in>s n. dist y l < e" apply(rule_tac x="t (max n N)" in bexI) using N by auto  | 
|
2960  | 
}  | 
|
2961  | 
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by auto  | 
|
2962  | 
}  | 
|
2963  | 
then show ?thesis by auto  | 
|
2964  | 
qed  | 
|
2965  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
2966  | 
text {* Strengthen it to the intersection actually being a singleton. *}
 | 
| 33175 | 2967  | 
|
2968  | 
lemma decreasing_closed_nest_sing:  | 
|
| 44632 | 2969  | 
fixes s :: "nat \<Rightarrow> 'a::complete_space set"  | 
| 33175 | 2970  | 
assumes "\<forall>n. closed(s n)"  | 
2971  | 
          "\<forall>n. s n \<noteq> {}"
 | 
|
2972  | 
"\<forall>m n. m \<le> n --> s n \<subseteq> s m"  | 
|
2973  | 
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e"  | 
|
| 34104 | 2974  | 
  shows "\<exists>a. \<Inter>(range s) = {a}"
 | 
| 33175 | 2975  | 
proof-  | 
2976  | 
obtain a where a:"\<forall>n. a \<in> s n" using decreasing_closed_nest[of s] using assms by auto  | 
|
| 34104 | 2977  | 
  { fix b assume b:"b \<in> \<Inter>(range s)"
 | 
| 33175 | 2978  | 
    { fix e::real assume "e>0"
 | 
2979  | 
hence "dist a b < e" using assms(4 )using b using a by blast  | 
|
2980  | 
}  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
2981  | 
hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz less_le)  | 
| 33175 | 2982  | 
}  | 
| 34104 | 2983  | 
  with a have "\<Inter>(range s) = {a}" unfolding image_def by auto
 | 
2984  | 
thus ?thesis ..  | 
|
| 33175 | 2985  | 
qed  | 
2986  | 
||
2987  | 
text{* Cauchy-type criteria for uniform convergence. *}
 | 
|
2988  | 
||
2989  | 
lemma uniformly_convergent_eq_cauchy: fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::heine_borel" shows  | 
|
2990  | 
"(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e) \<longleftrightarrow>  | 
|
2991  | 
(\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x --> dist (s m x) (s n x) < e)" (is "?lhs = ?rhs")  | 
|
2992  | 
proof(rule)  | 
|
2993  | 
assume ?lhs  | 
|
2994  | 
then obtain l where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e" by auto  | 
|
2995  | 
  { fix e::real assume "e>0"
 | 
|
2996  | 
then obtain N::nat where N:"\<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e / 2" using l[THEN spec[where x="e/2"]] by auto  | 
|
2997  | 
    { fix n m::nat and x::"'b" assume "N \<le> m \<and> N \<le> n \<and> P x"
 | 
|
2998  | 
hence "dist (s m x) (s n x) < e"  | 
|
2999  | 
using N[THEN spec[where x=m], THEN spec[where x=x]]  | 
|
3000  | 
using N[THEN spec[where x=n], THEN spec[where x=x]]  | 
|
3001  | 
using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto }  | 
|
3002  | 
hence "\<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x --> dist (s m x) (s n x) < e" by auto }  | 
|
3003  | 
thus ?rhs by auto  | 
|
3004  | 
next  | 
|
3005  | 
assume ?rhs  | 
|
3006  | 
hence "\<forall>x. P x \<longrightarrow> Cauchy (\<lambda>n. s n x)" unfolding cauchy_def apply auto by (erule_tac x=e in allE)auto  | 
|
3007  | 
then obtain l where l:"\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" unfolding convergent_eq_cauchy[THEN sym]  | 
|
3008  | 
using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] by auto  | 
|
3009  | 
  { fix e::real assume "e>0"
 | 
|
3010  | 
then obtain N where N:"\<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x \<longrightarrow> dist (s m x) (s n x) < e/2"  | 
|
3011  | 
using `?rhs`[THEN spec[where x="e/2"]] by auto  | 
|
3012  | 
    { fix x assume "P x"
 | 
|
3013  | 
then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2"  | 
|
3014  | 
using l[THEN spec[where x=x], unfolded Lim_sequentially] using `e>0` by(auto elim!: allE[where x="e/2"])  | 
|
3015  | 
fix n::nat assume "n\<ge>N"  | 
|
3016  | 
hence "dist(s n x)(l x) < e" using `P x`and N[THEN spec[where x=n], THEN spec[where x="N+M"], THEN spec[where x=x]]  | 
|
3017  | 
using M[THEN spec[where x="N+M"]] and dist_triangle_half_l[of "s n x" "s (N+M) x" e "l x"] by (auto simp add: dist_commute) }  | 
|
3018  | 
hence "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" by auto }  | 
|
3019  | 
thus ?lhs by auto  | 
|
3020  | 
qed  | 
|
3021  | 
||
3022  | 
lemma uniformly_cauchy_imp_uniformly_convergent:  | 
|
3023  | 
fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::heine_borel"  | 
|
3024  | 
assumes "\<forall>e>0.\<exists>N. \<forall>m (n::nat) x. N \<le> m \<and> N \<le> n \<and> P x --> dist(s m x)(s n x) < e"  | 
|
3025  | 
"\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n --> dist(s n x)(l x) < e)"  | 
|
3026  | 
shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e"  | 
|
3027  | 
proof-  | 
|
3028  | 
obtain l' where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l' x) < e"  | 
|
3029  | 
using assms(1) unfolding uniformly_convergent_eq_cauchy[THEN sym] by auto  | 
|
3030  | 
moreover  | 
|
3031  | 
  { fix x assume "P x"
 | 
|
| 41970 | 3032  | 
hence "l x = l' x" using tendsto_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"]  | 
| 33175 | 3033  | 
using l and assms(2) unfolding Lim_sequentially by blast }  | 
3034  | 
ultimately show ?thesis by auto  | 
|
3035  | 
qed  | 
|
3036  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3037  | 
|
| 36437 | 3038  | 
subsection {* Continuity *}
 | 
3039  | 
||
3040  | 
text {* Define continuity over a net to take in restrictions of the set. *}
 | 
|
| 33175 | 3041  | 
|
3042  | 
definition  | 
|
| 
44081
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
3043  | 
  continuous :: "'a::t2_space filter \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
| 
 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 
huffman 
parents: 
44076 
diff
changeset
 | 
3044  | 
where "continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net"  | 
| 33175 | 3045  | 
|
3046  | 
lemma continuous_trivial_limit:  | 
|
3047  | 
"trivial_limit net ==> continuous net f"  | 
|
3048  | 
unfolding continuous_def tendsto_def trivial_limit_eq by auto  | 
|
3049  | 
||
3050  | 
lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f ---> f(x)) (at x within s)"  | 
|
3051  | 
unfolding continuous_def  | 
|
3052  | 
unfolding tendsto_def  | 
|
3053  | 
using netlimit_within[of x s]  | 
|
3054  | 
by (cases "trivial_limit (at x within s)") (auto simp add: trivial_limit_eventually)  | 
|
3055  | 
||
3056  | 
lemma continuous_at: "continuous (at x) f \<longleftrightarrow> (f ---> f(x)) (at x)"  | 
|
3057  | 
using continuous_within [of x UNIV f] by (simp add: within_UNIV)  | 
|
3058  | 
||
3059  | 
lemma continuous_at_within:  | 
|
3060  | 
assumes "continuous (at x) f" shows "continuous (at x within s) f"  | 
|
3061  | 
using assms unfolding continuous_at continuous_within  | 
|
3062  | 
by (rule Lim_at_within)  | 
|
3063  | 
||
3064  | 
text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
 | 
|
3065  | 
||
3066  | 
lemma continuous_within_eps_delta:  | 
|
3067  | 
"continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'\<in> s. dist x' x < d --> dist (f x') (f x) < e)"  | 
|
3068  | 
unfolding continuous_within and Lim_within  | 
|
| 44584 | 3069  | 
apply auto unfolding dist_nz[THEN sym] apply(auto del: allE elim!:allE) apply(rule_tac x=d in exI) by auto  | 
| 33175 | 3070  | 
|
3071  | 
lemma continuous_at_eps_delta: "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.  | 
|
3072  | 
\<forall>x'. dist x' x < d --> dist(f x')(f x) < e)"  | 
|
3073  | 
using continuous_within_eps_delta[of x UNIV f]  | 
|
3074  | 
unfolding within_UNIV by blast  | 
|
3075  | 
||
3076  | 
text{* Versions in terms of open balls. *}
 | 
|
3077  | 
||
3078  | 
lemma continuous_within_ball:  | 
|
3079  | 
"continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.  | 
|
3080  | 
f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")  | 
|
3081  | 
proof  | 
|
3082  | 
assume ?lhs  | 
|
3083  | 
  { fix e::real assume "e>0"
 | 
|
3084  | 
then obtain d where d: "d>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e"  | 
|
3085  | 
using `?lhs`[unfolded continuous_within Lim_within] by auto  | 
|
3086  | 
    { fix y assume "y\<in>f ` (ball x d \<inter> s)"
 | 
|
3087  | 
hence "y \<in> ball (f x) e" using d(2) unfolding dist_nz[THEN sym]  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
3088  | 
apply (auto simp add: dist_commute) apply(erule_tac x=xa in ballE) apply auto using `e>0` by auto  | 
| 33175 | 3089  | 
}  | 
3090  | 
hence "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e" using `d>0` unfolding subset_eq ball_def by (auto simp add: dist_commute) }  | 
|
3091  | 
thus ?rhs by auto  | 
|
3092  | 
next  | 
|
3093  | 
assume ?rhs thus ?lhs unfolding continuous_within Lim_within ball_def subset_eq  | 
|
3094  | 
apply (auto simp add: dist_commute) apply(erule_tac x=e in allE) by auto  | 
|
3095  | 
qed  | 
|
3096  | 
||
3097  | 
lemma continuous_at_ball:  | 
|
3098  | 
"continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")  | 
|
3099  | 
proof  | 
|
3100  | 
assume ?lhs thus ?rhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball  | 
|
3101  | 
apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x=xa in allE) apply (auto simp add: dist_commute dist_nz)  | 
|
3102  | 
unfolding dist_nz[THEN sym] by auto  | 
|
3103  | 
next  | 
|
3104  | 
assume ?rhs thus ?lhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball  | 
|
3105  | 
apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x="f xa" in allE) by (auto simp add: dist_commute dist_nz)  | 
|
3106  | 
qed  | 
|
3107  | 
||
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3108  | 
text{* Define setwise continuity in terms of limits within the set. *}
 | 
| 33175 | 3109  | 
|
3110  | 
definition  | 
|
| 36359 | 3111  | 
continuous_on ::  | 
3112  | 
    "'a set \<Rightarrow> ('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
|
3113  | 
where  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3114  | 
"continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. (f ---> f x) (at x within s))"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3115  | 
|
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3116  | 
lemma continuous_on_topological:  | 
| 36359 | 3117  | 
"continuous_on s f \<longleftrightarrow>  | 
3118  | 
(\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow>  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3119  | 
(\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3120  | 
unfolding continuous_on_def tendsto_def  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3121  | 
unfolding Limits.eventually_within eventually_at_topological  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3122  | 
by (intro ball_cong [OF refl] all_cong imp_cong ex_cong conj_cong refl) auto  | 
| 36359 | 3123  | 
|
3124  | 
lemma continuous_on_iff:  | 
|
3125  | 
"continuous_on s f \<longleftrightarrow>  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3126  | 
(\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3127  | 
unfolding continuous_on_def Lim_within  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3128  | 
apply (intro ball_cong [OF refl] all_cong ex_cong)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3129  | 
apply (rename_tac y, case_tac "y = x", simp)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3130  | 
apply (simp add: dist_nz)  | 
| 36359 | 3131  | 
done  | 
| 33175 | 3132  | 
|
3133  | 
definition  | 
|
3134  | 
uniformly_continuous_on ::  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3135  | 
    "'a set \<Rightarrow> ('a::metric_space \<Rightarrow> 'b::metric_space) \<Rightarrow> bool"
 | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3136  | 
where  | 
| 33175 | 3137  | 
"uniformly_continuous_on s f \<longleftrightarrow>  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3138  | 
(\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"  | 
| 
35172
 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 
himmelma 
parents: 
35028 
diff
changeset
 | 
3139  | 
|
| 33175 | 3140  | 
text{* Some simple consequential lemmas. *}
 | 
3141  | 
||
3142  | 
lemma uniformly_continuous_imp_continuous:  | 
|
3143  | 
" uniformly_continuous_on s f ==> continuous_on s f"  | 
|
| 36359 | 3144  | 
unfolding uniformly_continuous_on_def continuous_on_iff by blast  | 
| 33175 | 3145  | 
|
3146  | 
lemma continuous_at_imp_continuous_within:  | 
|
3147  | 
"continuous (at x) f ==> continuous (at x within s) f"  | 
|
3148  | 
unfolding continuous_within continuous_at using Lim_at_within by auto  | 
|
3149  | 
||
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3150  | 
lemma Lim_trivial_limit: "trivial_limit net \<Longrightarrow> (f ---> l) net"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3151  | 
unfolding tendsto_def by (simp add: trivial_limit_eq)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3152  | 
|
| 36359 | 3153  | 
lemma continuous_at_imp_continuous_on:  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3154  | 
assumes "\<forall>x\<in>s. continuous (at x) f"  | 
| 33175 | 3155  | 
shows "continuous_on s f"  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3156  | 
unfolding continuous_on_def  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3157  | 
proof  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3158  | 
fix x assume "x \<in> s"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3159  | 
with assms have *: "(f ---> f (netlimit (at x))) (at x)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3160  | 
unfolding continuous_def by simp  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3161  | 
have "(f ---> f x) (at x)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3162  | 
proof (cases "trivial_limit (at x)")  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3163  | 
case True thus ?thesis  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3164  | 
by (rule Lim_trivial_limit)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3165  | 
next  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3166  | 
case False  | 
| 36667 | 3167  | 
hence 1: "netlimit (at x) = x"  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3168  | 
using netlimit_within [of x UNIV]  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3169  | 
by (simp add: within_UNIV)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3170  | 
with * show ?thesis by simp  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3171  | 
qed  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3172  | 
thus "(f ---> f x) (at x within s)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3173  | 
by (rule Lim_at_within)  | 
| 33175 | 3174  | 
qed  | 
3175  | 
||
3176  | 
lemma continuous_on_eq_continuous_within:  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3177  | 
"continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x within s) f)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3178  | 
unfolding continuous_on_def continuous_def  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3179  | 
apply (rule ball_cong [OF refl])  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3180  | 
apply (case_tac "trivial_limit (at x within s)")  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3181  | 
apply (simp add: Lim_trivial_limit)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3182  | 
apply (simp add: netlimit_within)  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3183  | 
done  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3184  | 
|
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3185  | 
lemmas continuous_on = continuous_on_def -- "legacy theorem name"  | 
| 33175 | 3186  | 
|
3187  | 
lemma continuous_on_eq_continuous_at:  | 
|
| 36359 | 3188  | 
shows "open s ==> (continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x) f))"  | 
| 33175 | 3189  | 
by (auto simp add: continuous_on continuous_at Lim_within_open)  | 
3190  | 
||
3191  | 
lemma continuous_within_subset:  | 
|
3192  | 
"continuous (at x within s) f \<Longrightarrow> t \<subseteq> s  | 
|
3193  | 
==> continuous (at x within t) f"  | 
|
3194  | 
unfolding continuous_within by(metis Lim_within_subset)  | 
|
3195  | 
||
3196  | 
lemma continuous_on_subset:  | 
|
| 36359 | 3197  | 
shows "continuous_on s f \<Longrightarrow> t \<subseteq> s ==> continuous_on t f"  | 
| 33175 | 3198  | 
unfolding continuous_on by (metis subset_eq Lim_within_subset)  | 
3199  | 
||
3200  | 
lemma continuous_on_interior:  | 
|
| 44519 | 3201  | 
shows "continuous_on s f \<Longrightarrow> x \<in> interior s \<Longrightarrow> continuous (at x) f"  | 
3202  | 
by (erule interiorE, drule (1) continuous_on_subset,  | 
|
3203  | 
simp add: continuous_on_eq_continuous_at)  | 
|
| 33175 | 3204  | 
|
3205  | 
lemma continuous_on_eq:  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3206  | 
"(\<forall>x \<in> s. f x = g x) \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on s g"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3207  | 
unfolding continuous_on_def tendsto_def Limits.eventually_within  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3208  | 
by simp  | 
| 33175 | 3209  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3210  | 
text {* Characterization of various kinds of continuity in terms of sequences. *}
 | 
| 33175 | 3211  | 
|
3212  | 
lemma continuous_within_sequentially:  | 
|
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3213  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"  | 
| 33175 | 3214  | 
shows "continuous (at a within s) f \<longleftrightarrow>  | 
3215  | 
(\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially  | 
|
3216  | 
--> ((f o x) ---> f a) sequentially)" (is "?lhs = ?rhs")  | 
|
3217  | 
proof  | 
|
3218  | 
assume ?lhs  | 
|
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3219  | 
  { fix x::"nat \<Rightarrow> 'a" assume x:"\<forall>n. x n \<in> s" "\<forall>e>0. eventually (\<lambda>n. dist (x n) a < e) sequentially"
 | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3220  | 
fix T::"'b set" assume "open T" and "f a \<in> T"  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3221  | 
with `?lhs` obtain d where "d>0" and d:"\<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> f x \<in> T"  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3222  | 
unfolding continuous_within tendsto_def eventually_within by auto  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3223  | 
have "eventually (\<lambda>n. dist (x n) a < d) sequentially"  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3224  | 
using x(2) `d>0` by simp  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3225  | 
hence "eventually (\<lambda>n. (f \<circ> x) n \<in> T) sequentially"  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3226  | 
proof (rule eventually_elim1)  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3227  | 
fix n assume "dist (x n) a < d" thus "(f \<circ> x) n \<in> T"  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3228  | 
using d x(1) `f a \<in> T` unfolding dist_nz[THEN sym] by auto  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3229  | 
qed  | 
| 33175 | 3230  | 
}  | 
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3231  | 
thus ?rhs unfolding tendsto_iff unfolding tendsto_def by simp  | 
| 33175 | 3232  | 
next  | 
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3233  | 
assume ?rhs thus ?lhs  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3234  | 
unfolding continuous_within tendsto_def [where l="f a"]  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3235  | 
by (simp add: sequentially_imp_eventually_within)  | 
| 33175 | 3236  | 
qed  | 
3237  | 
||
3238  | 
lemma continuous_at_sequentially:  | 
|
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3239  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"  | 
| 33175 | 3240  | 
shows "continuous (at a) f \<longleftrightarrow> (\<forall>x. (x ---> a) sequentially  | 
3241  | 
--> ((f o x) ---> f a) sequentially)"  | 
|
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3242  | 
using continuous_within_sequentially[of a UNIV f]  | 
| 
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3243  | 
unfolding within_UNIV by auto  | 
| 33175 | 3244  | 
|
3245  | 
lemma continuous_on_sequentially:  | 
|
| 
44533
 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 
huffman 
parents: 
44531 
diff
changeset
 | 
3246  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"  | 
| 36359 | 3247  | 
shows "continuous_on s f \<longleftrightarrow>  | 
3248  | 
(\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially  | 
|
| 33175 | 3249  | 
--> ((f o x) ---> f(a)) sequentially)" (is "?lhs = ?rhs")  | 
3250  | 
proof  | 
|
3251  | 
assume ?rhs thus ?lhs using continuous_within_sequentially[of _ s f] unfolding continuous_on_eq_continuous_within by auto  | 
|
3252  | 
next  | 
|
3253  | 
assume ?lhs thus ?rhs unfolding continuous_on_eq_continuous_within using continuous_within_sequentially[of _ s f] by auto  | 
|
3254  | 
qed  | 
|
3255  | 
||
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3256  | 
lemma uniformly_continuous_on_sequentially:  | 
| 36441 | 3257  | 
"uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and>  | 
3258  | 
((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially  | 
|
3259  | 
\<longrightarrow> ((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially)" (is "?lhs = ?rhs")  | 
|
| 33175 | 3260  | 
proof  | 
3261  | 
assume ?lhs  | 
|
| 36441 | 3262  | 
  { fix x y assume x:"\<forall>n. x n \<in> s" and y:"\<forall>n. y n \<in> s" and xy:"((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially"
 | 
| 33175 | 3263  | 
    { fix e::real assume "e>0"
 | 
3264  | 
then obtain d where "d>0" and d:"\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e"  | 
|
3265  | 
using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto  | 
|
| 36441 | 3266  | 
obtain N where N:"\<forall>n\<ge>N. dist (x n) (y n) < d" using xy[unfolded Lim_sequentially dist_norm] and `d>0` by auto  | 
| 33175 | 3267  | 
      { fix n assume "n\<ge>N"
 | 
| 36441 | 3268  | 
hence "dist (f (x n)) (f (y n)) < e"  | 
| 33175 | 3269  | 
using N[THEN spec[where x=n]] using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] using x and y  | 
| 36441 | 3270  | 
unfolding dist_commute by simp }  | 
3271  | 
hence "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" by auto }  | 
|
3272  | 
hence "((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially" unfolding Lim_sequentially and dist_real_def by auto }  | 
|
| 33175 | 3273  | 
thus ?rhs by auto  | 
3274  | 
next  | 
|
3275  | 
assume ?rhs  | 
|
3276  | 
  { assume "\<not> ?lhs"
 | 
|
3277  | 
then obtain e where "e>0" "\<forall>d>0. \<exists>x\<in>s. \<exists>x'\<in>s. dist x' x < d \<and> \<not> dist (f x') (f x) < e" unfolding uniformly_continuous_on_def by auto  | 
|
3278  | 
then obtain fa where fa:"\<forall>x. 0 < x \<longrightarrow> fst (fa x) \<in> s \<and> snd (fa x) \<in> s \<and> dist (fst (fa x)) (snd (fa x)) < x \<and> \<not> dist (f (fst (fa x))) (f (snd (fa x))) < e"  | 
|
3279  | 
using choice[of "\<lambda>d x. d>0 \<longrightarrow> fst x \<in> s \<and> snd x \<in> s \<and> dist (snd x) (fst x) < d \<and> \<not> dist (f (snd x)) (f (fst x)) < e"] unfolding Bex_def  | 
|
3280  | 
by (auto simp add: dist_commute)  | 
|
3281  | 
def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))"  | 
|
3282  | 
def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))"  | 
|
3283  | 
have xyn:"\<forall>n. x n \<in> s \<and> y n \<in> s" and xy0:"\<forall>n. dist (x n) (y n) < inverse (real n + 1)" and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e"  | 
|
3284  | 
unfolding x_def and y_def using fa by auto  | 
|
3285  | 
    { fix e::real assume "e>0"
 | 
|
3286  | 
then obtain N::nat where "N \<noteq> 0" and N:"0 < inverse (real N) \<and> inverse (real N) < e" unfolding real_arch_inv[of e] by auto  | 
|
3287  | 
      { fix n::nat assume "n\<ge>N"
 | 
|
3288  | 
hence "inverse (real n + 1) < inverse (real N)" using real_of_nat_ge_zero and `N\<noteq>0` by auto  | 
|
3289  | 
also have "\<dots> < e" using N by auto  | 
|
3290  | 
finally have "inverse (real n + 1) < e" by auto  | 
|
| 36441 | 3291  | 
hence "dist (x n) (y n) < e" using xy0[THEN spec[where x=n]] by auto }  | 
3292  | 
hence "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto }  | 
|
3293  | 
hence "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn unfolding Lim_sequentially dist_real_def by auto  | 
|
3294  | 
hence False using fxy and `e>0` by auto }  | 
|
| 33175 | 3295  | 
thus ?lhs unfolding uniformly_continuous_on_def by blast  | 
3296  | 
qed  | 
|
3297  | 
||
3298  | 
text{* The usual transformation theorems. *}
 | 
|
3299  | 
||
3300  | 
lemma continuous_transform_within:  | 
|
| 36667 | 3301  | 
fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space"  | 
| 33175 | 3302  | 
assumes "0 < d" "x \<in> s" "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'"  | 
3303  | 
"continuous (at x within s) f"  | 
|
3304  | 
shows "continuous (at x within s) g"  | 
|
| 36667 | 3305  | 
unfolding continuous_within  | 
3306  | 
proof (rule Lim_transform_within)  | 
|
3307  | 
show "0 < d" by fact  | 
|
3308  | 
show "\<forall>x'\<in>s. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"  | 
|
3309  | 
using assms(3) by auto  | 
|
3310  | 
have "f x = g x"  | 
|
3311  | 
using assms(1,2,3) by auto  | 
|
3312  | 
thus "(f ---> g x) (at x within s)"  | 
|
3313  | 
using assms(4) unfolding continuous_within by simp  | 
|
| 33175 | 3314  | 
qed  | 
3315  | 
||
3316  | 
lemma continuous_transform_at:  | 
|
| 36667 | 3317  | 
fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space"  | 
| 33175 | 3318  | 
assumes "0 < d" "\<forall>x'. dist x' x < d --> f x' = g x'"  | 
3319  | 
"continuous (at x) f"  | 
|
3320  | 
shows "continuous (at x) g"  | 
|
| 36667 | 3321  | 
using continuous_transform_within [of d x UNIV f g] assms  | 
3322  | 
by (simp add: within_UNIV)  | 
|
| 33175 | 3323  | 
|
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3324  | 
subsubsection {* Structural rules for pointwise continuity *}
 | 
| 33175 | 3325  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3326  | 
lemma continuous_within_id: "continuous (at a within s) (\<lambda>x. x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3327  | 
unfolding continuous_within by (rule tendsto_ident_at_within)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3328  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3329  | 
lemma continuous_at_id: "continuous (at a) (\<lambda>x. x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3330  | 
unfolding continuous_at by (rule tendsto_ident_at)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3331  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3332  | 
lemma continuous_const: "continuous F (\<lambda>x. c)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3333  | 
unfolding continuous_def by (rule tendsto_const)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3334  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3335  | 
lemma continuous_dist:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3336  | 
assumes "continuous F f" and "continuous F g"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3337  | 
shows "continuous F (\<lambda>x. dist (f x) (g x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3338  | 
using assms unfolding continuous_def by (rule tendsto_dist)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3339  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3340  | 
lemma continuous_norm:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3341  | 
shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. norm (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3342  | 
unfolding continuous_def by (rule tendsto_norm)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3343  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3344  | 
lemma continuous_infnorm:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3345  | 
shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3346  | 
unfolding continuous_def by (rule tendsto_infnorm)  | 
| 33175 | 3347  | 
|
3348  | 
lemma continuous_add:  | 
|
3349  | 
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3350  | 
shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x + g x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3351  | 
unfolding continuous_def by (rule tendsto_add)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3352  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3353  | 
lemma continuous_minus:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3354  | 
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3355  | 
shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. - f x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3356  | 
unfolding continuous_def by (rule tendsto_minus)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3357  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3358  | 
lemma continuous_diff:  | 
| 33175 | 3359  | 
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3360  | 
shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x - g x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3361  | 
unfolding continuous_def by (rule tendsto_diff)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3362  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3363  | 
lemma continuous_scaleR:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3364  | 
fixes g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3365  | 
shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x *\<^sub>R g x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3366  | 
unfolding continuous_def by (rule tendsto_scaleR)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3367  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3368  | 
lemma continuous_mult:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3369  | 
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_algebra"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3370  | 
shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x * g x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3371  | 
unfolding continuous_def by (rule tendsto_mult)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3372  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3373  | 
lemma continuous_inner:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3374  | 
assumes "continuous F f" and "continuous F g"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3375  | 
shows "continuous F (\<lambda>x. inner (f x) (g x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3376  | 
using assms unfolding continuous_def by (rule tendsto_inner)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3377  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3378  | 
lemma continuous_euclidean_component:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3379  | 
shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. f x $$ i)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3380  | 
unfolding continuous_def by (rule tendsto_euclidean_component)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3381  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3382  | 
lemma continuous_inverse:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3383  | 
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3384  | 
assumes "continuous F f" and "f (netlimit F) \<noteq> 0"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3385  | 
shows "continuous F (\<lambda>x. inverse (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3386  | 
using assms unfolding continuous_def by (rule tendsto_inverse)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3387  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3388  | 
lemma continuous_at_within_inverse:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3389  | 
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3390  | 
assumes "continuous (at a within s) f" and "f a \<noteq> 0"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3391  | 
shows "continuous (at a within s) (\<lambda>x. inverse (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3392  | 
using assms unfolding continuous_within by (rule tendsto_inverse)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3393  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3394  | 
lemma continuous_at_inverse:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3395  | 
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3396  | 
assumes "continuous (at a) f" and "f a \<noteq> 0"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3397  | 
shows "continuous (at a) (\<lambda>x. inverse (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3398  | 
using assms unfolding continuous_at by (rule tendsto_inverse)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3399  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3400  | 
lemmas continuous_intros = continuous_at_id continuous_within_id  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3401  | 
continuous_const continuous_dist continuous_norm continuous_infnorm  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3402  | 
continuous_add continuous_minus continuous_diff  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3403  | 
continuous_scaleR continuous_mult  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3404  | 
continuous_inner continuous_euclidean_component  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3405  | 
continuous_at_inverse continuous_at_within_inverse  | 
| 34964 | 3406  | 
|
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3407  | 
subsubsection {* Structural rules for setwise continuity *}
 | 
| 33175 | 3408  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3409  | 
lemma continuous_on_id: "continuous_on s (\<lambda>x. x)"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3410  | 
unfolding continuous_on_def by (fast intro: tendsto_ident_at_within)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3411  | 
|
| 
44531
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3412  | 
lemma continuous_on_const: "continuous_on s (\<lambda>x. c)"  | 
| 44125 | 3413  | 
unfolding continuous_on_def by (auto intro: tendsto_intros)  | 
| 33175 | 3414  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3415  | 
lemma continuous_on_norm:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3416  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. norm (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3417  | 
unfolding continuous_on_def by (fast intro: tendsto_norm)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3418  | 
|
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3419  | 
lemma continuous_on_infnorm:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3420  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. infnorm (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3421  | 
unfolding continuous_on by (fast intro: tendsto_infnorm)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3422  | 
|
| 
44531
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3423  | 
lemma continuous_on_minus:  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3424  | 
fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"  | 
| 33175 | 3425  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)"  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3426  | 
unfolding continuous_on_def by (auto intro: tendsto_intros)  | 
| 33175 | 3427  | 
|
3428  | 
lemma continuous_on_add:  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3429  | 
fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"  | 
| 33175 | 3430  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s g  | 
3431  | 
\<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)"  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3432  | 
unfolding continuous_on_def by (auto intro: tendsto_intros)  | 
| 33175 | 3433  | 
|
| 
44531
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3434  | 
lemma continuous_on_diff:  | 
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3435  | 
fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"  | 
| 33175 | 3436  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s g  | 
3437  | 
\<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3438  | 
unfolding continuous_on_def by (auto intro: tendsto_intros)  | 
| 33175 | 3439  | 
|
| 
44531
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3440  | 
lemma (in bounded_linear) continuous_on:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3441  | 
"continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f (g x))"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3442  | 
unfolding continuous_on_def by (fast intro: tendsto)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3443  | 
|
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3444  | 
lemma (in bounded_bilinear) continuous_on:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3445  | 
"\<lbrakk>continuous_on s f; continuous_on s g\<rbrakk> \<Longrightarrow> continuous_on s (\<lambda>x. f x ** g x)"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3446  | 
unfolding continuous_on_def by (fast intro: tendsto)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3447  | 
|
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3448  | 
lemma continuous_on_scaleR:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3449  | 
fixes g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3450  | 
assumes "continuous_on s f" and "continuous_on s g"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3451  | 
shows "continuous_on s (\<lambda>x. f x *\<^sub>R g x)"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3452  | 
using bounded_bilinear_scaleR assms  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3453  | 
by (rule bounded_bilinear.continuous_on)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3454  | 
|
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3455  | 
lemma continuous_on_mult:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3456  | 
fixes g :: "'a::topological_space \<Rightarrow> 'b::real_normed_algebra"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3457  | 
assumes "continuous_on s f" and "continuous_on s g"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3458  | 
shows "continuous_on s (\<lambda>x. f x * g x)"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3459  | 
using bounded_bilinear_mult assms  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3460  | 
by (rule bounded_bilinear.continuous_on)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3461  | 
|
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3462  | 
lemma continuous_on_inner:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3463  | 
fixes g :: "'a::topological_space \<Rightarrow> 'b::real_inner"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3464  | 
assumes "continuous_on s f" and "continuous_on s g"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3465  | 
shows "continuous_on s (\<lambda>x. inner (f x) (g x))"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3466  | 
using bounded_bilinear_inner assms  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3467  | 
by (rule bounded_bilinear.continuous_on)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3468  | 
|
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3469  | 
lemma continuous_on_euclidean_component:  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3470  | 
"continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. f x $$ i)"  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3471  | 
using bounded_linear_euclidean_component  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3472  | 
by (rule bounded_linear.continuous_on)  | 
| 
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
3473  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3474  | 
lemma continuous_on_inverse:  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3475  | 
fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_div_algebra"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3476  | 
assumes "continuous_on s f" and "\<forall>x\<in>s. f x \<noteq> 0"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3477  | 
shows "continuous_on s (\<lambda>x. inverse (f x))"  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3478  | 
using assms unfolding continuous_on by (fast intro: tendsto_inverse)  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3479  | 
|
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3480  | 
subsubsection {* Structural rules for uniform continuity *}
 | 
| 33175 | 3481  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3482  | 
lemma uniformly_continuous_on_id:  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3483  | 
shows "uniformly_continuous_on s (\<lambda>x. x)"  | 
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3484  | 
unfolding uniformly_continuous_on_def by auto  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3485  | 
|
| 33175 | 3486  | 
lemma uniformly_continuous_on_const:  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3487  | 
shows "uniformly_continuous_on s (\<lambda>x. c)"  | 
| 33175 | 3488  | 
unfolding uniformly_continuous_on_def by simp  | 
3489  | 
||
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3490  | 
lemma uniformly_continuous_on_dist:  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3491  | 
fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3492  | 
assumes "uniformly_continuous_on s f"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3493  | 
assumes "uniformly_continuous_on s g"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3494  | 
shows "uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3495  | 
proof -  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3496  | 
  { fix a b c d :: 'b have "\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d"
 | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3497  | 
using dist_triangle2 [of a b c] dist_triangle2 [of b c d]  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3498  | 
using dist_triangle3 [of c d a] dist_triangle [of a d b]  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3499  | 
by arith  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3500  | 
} note le = this  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3501  | 
  { fix x y
 | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3502  | 
assume f: "(\<lambda>n. dist (f (x n)) (f (y n))) ----> 0"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3503  | 
assume g: "(\<lambda>n. dist (g (x n)) (g (y n))) ----> 0"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3504  | 
have "(\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) ----> 0"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3505  | 
by (rule Lim_transform_bound [OF _ tendsto_add_zero [OF f g]],  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3506  | 
simp add: le)  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3507  | 
}  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3508  | 
thus ?thesis using assms unfolding uniformly_continuous_on_sequentially  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3509  | 
unfolding dist_real_def by simp  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3510  | 
qed  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3511  | 
|
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3512  | 
lemma uniformly_continuous_on_norm:  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3513  | 
assumes "uniformly_continuous_on s f"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3514  | 
shows "uniformly_continuous_on s (\<lambda>x. norm (f x))"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3515  | 
unfolding norm_conv_dist using assms  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3516  | 
by (intro uniformly_continuous_on_dist uniformly_continuous_on_const)  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3517  | 
|
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3518  | 
lemma (in bounded_linear) uniformly_continuous_on:  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3519  | 
assumes "uniformly_continuous_on s g"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3520  | 
shows "uniformly_continuous_on s (\<lambda>x. f (g x))"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3521  | 
using assms unfolding uniformly_continuous_on_sequentially  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3522  | 
unfolding dist_norm tendsto_norm_zero_iff diff[symmetric]  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3523  | 
by (auto intro: tendsto_zero)  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3524  | 
|
| 33175 | 3525  | 
lemma uniformly_continuous_on_cmul:  | 
| 36441 | 3526  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"  | 
| 33175 | 3527  | 
assumes "uniformly_continuous_on s f"  | 
3528  | 
shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))"  | 
|
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3529  | 
using bounded_linear_scaleR_right assms  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3530  | 
by (rule bounded_linear.uniformly_continuous_on)  | 
| 33175 | 3531  | 
|
3532  | 
lemma dist_minus:  | 
|
3533  | 
fixes x y :: "'a::real_normed_vector"  | 
|
3534  | 
shows "dist (- x) (- y) = dist x y"  | 
|
3535  | 
unfolding dist_norm minus_diff_minus norm_minus_cancel ..  | 
|
3536  | 
||
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3537  | 
lemma uniformly_continuous_on_minus:  | 
| 33175 | 3538  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3539  | 
shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. - f x)"  | 
| 33175 | 3540  | 
unfolding uniformly_continuous_on_def dist_minus .  | 
3541  | 
||
3542  | 
lemma uniformly_continuous_on_add:  | 
|
| 36441 | 3543  | 
fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3544  | 
assumes "uniformly_continuous_on s f"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3545  | 
assumes "uniformly_continuous_on s g"  | 
| 33175 | 3546  | 
shows "uniformly_continuous_on s (\<lambda>x. f x + g x)"  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3547  | 
using assms unfolding uniformly_continuous_on_sequentially  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3548  | 
unfolding dist_norm tendsto_norm_zero_iff add_diff_add  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3549  | 
by (auto intro: tendsto_add_zero)  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3550  | 
|
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3551  | 
lemma uniformly_continuous_on_diff:  | 
| 36441 | 3552  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3553  | 
assumes "uniformly_continuous_on s f" and "uniformly_continuous_on s g"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3554  | 
shows "uniformly_continuous_on s (\<lambda>x. f x - g x)"  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3555  | 
unfolding ab_diff_minus using assms  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3556  | 
by (intro uniformly_continuous_on_add uniformly_continuous_on_minus)  | 
| 33175 | 3557  | 
|
3558  | 
text{* Continuity of all kinds is preserved under composition. *}
 | 
|
3559  | 
||
| 36441 | 3560  | 
lemma continuous_within_topological:  | 
3561  | 
"continuous (at x within s) f \<longleftrightarrow>  | 
|
3562  | 
(\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow>  | 
|
3563  | 
(\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))"  | 
|
3564  | 
unfolding continuous_within  | 
|
3565  | 
unfolding tendsto_def Limits.eventually_within eventually_at_topological  | 
|
3566  | 
by (intro ball_cong [OF refl] all_cong imp_cong ex_cong conj_cong refl) auto  | 
|
3567  | 
||
| 33175 | 3568  | 
lemma continuous_within_compose:  | 
| 36441 | 3569  | 
assumes "continuous (at x within s) f"  | 
3570  | 
assumes "continuous (at (f x) within f ` s) g"  | 
|
| 33175 | 3571  | 
shows "continuous (at x within s) (g o f)"  | 
| 36441 | 3572  | 
using assms unfolding continuous_within_topological by simp metis  | 
| 33175 | 3573  | 
|
3574  | 
lemma continuous_at_compose:  | 
|
3575  | 
assumes "continuous (at x) f" "continuous (at (f x)) g"  | 
|
3576  | 
shows "continuous (at x) (g o f)"  | 
|
3577  | 
proof-  | 
|
3578  | 
have " continuous (at (f x) within range f) g" using assms(2) using continuous_within_subset[of "f x" UNIV g "range f", unfolded within_UNIV] by auto  | 
|
3579  | 
thus ?thesis using assms(1) using continuous_within_compose[of x UNIV f g, unfolded within_UNIV] by auto  | 
|
3580  | 
qed  | 
|
3581  | 
||
3582  | 
lemma continuous_on_compose:  | 
|
| 
36440
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3583  | 
"continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g o f)"  | 
| 
 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 
huffman 
parents: 
36439 
diff
changeset
 | 
3584  | 
unfolding continuous_on_topological by simp metis  | 
| 33175 | 3585  | 
|
3586  | 
lemma uniformly_continuous_on_compose:  | 
|
3587  | 
assumes "uniformly_continuous_on s f" "uniformly_continuous_on (f ` s) g"  | 
|
3588  | 
shows "uniformly_continuous_on s (g o f)"  | 
|
3589  | 
proof-  | 
|
3590  | 
  { fix e::real assume "e>0"
 | 
|
3591  | 
then obtain d where "d>0" and d:"\<forall>x\<in>f ` s. \<forall>x'\<in>f ` s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using assms(2) unfolding uniformly_continuous_on_def by auto  | 
|
3592  | 
obtain d' where "d'>0" "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d' \<longrightarrow> dist (f x') (f x) < d" using `d>0` using assms(1) unfolding uniformly_continuous_on_def by auto  | 
|
3593  | 
hence "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist ((g \<circ> f) x') ((g \<circ> f) x) < e" using `d>0` using d by auto }  | 
|
3594  | 
thus ?thesis using assms unfolding uniformly_continuous_on_def by auto  | 
|
3595  | 
qed  | 
|
3596  | 
||
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3597  | 
lemmas continuous_on_intros = continuous_on_id continuous_on_const  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3598  | 
continuous_on_compose continuous_on_norm continuous_on_infnorm  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3599  | 
continuous_on_add continuous_on_minus continuous_on_diff  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3600  | 
continuous_on_scaleR continuous_on_mult continuous_on_inverse  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3601  | 
continuous_on_inner continuous_on_euclidean_component  | 
| 
44648
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3602  | 
uniformly_continuous_on_id uniformly_continuous_on_const  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3603  | 
uniformly_continuous_on_dist uniformly_continuous_on_norm  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3604  | 
uniformly_continuous_on_compose uniformly_continuous_on_add  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3605  | 
uniformly_continuous_on_minus uniformly_continuous_on_diff  | 
| 
 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 
huffman 
parents: 
44647 
diff
changeset
 | 
3606  | 
uniformly_continuous_on_cmul  | 
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3607  | 
|
| 33175 | 3608  | 
text{* Continuity in terms of open preimages. *}
 | 
3609  | 
||
3610  | 
lemma continuous_at_open:  | 
|
| 36441 | 3611  | 
shows "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))"  | 
3612  | 
unfolding continuous_within_topological [of x UNIV f, unfolded within_UNIV]  | 
|
3613  | 
unfolding imp_conjL by (intro all_cong imp_cong ex_cong conj_cong refl) auto  | 
|
| 33175 | 3614  | 
|
3615  | 
lemma continuous_on_open:  | 
|
| 36441 | 3616  | 
shows "continuous_on s f \<longleftrightarrow>  | 
| 33175 | 3617  | 
(\<forall>t. openin (subtopology euclidean (f ` s)) t  | 
3618  | 
            --> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
 | 
|
| 36441 | 3619  | 
proof (safe)  | 
3620  | 
fix t :: "'b set"  | 
|
3621  | 
assume 1: "continuous_on s f"  | 
|
3622  | 
assume 2: "openin (subtopology euclidean (f ` s)) t"  | 
|
3623  | 
from 2 obtain B where B: "open B" and t: "t = f ` s \<inter> B"  | 
|
3624  | 
unfolding openin_open by auto  | 
|
3625  | 
  def U == "\<Union>{A. open A \<and> (\<forall>x\<in>s. x \<in> A \<longrightarrow> f x \<in> B)}"
 | 
|
3626  | 
have "open U" unfolding U_def by (simp add: open_Union)  | 
|
3627  | 
moreover have "\<forall>x\<in>s. x \<in> U \<longleftrightarrow> f x \<in> t"  | 
|
3628  | 
proof (intro ballI iffI)  | 
|
3629  | 
fix x assume "x \<in> s" and "x \<in> U" thus "f x \<in> t"  | 
|
3630  | 
unfolding U_def t by auto  | 
|
3631  | 
next  | 
|
3632  | 
fix x assume "x \<in> s" and "f x \<in> t"  | 
|
3633  | 
hence "x \<in> s" and "f x \<in> B"  | 
|
3634  | 
unfolding t by auto  | 
|
3635  | 
with 1 B obtain A where "open A" "x \<in> A" "\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B"  | 
|
3636  | 
unfolding t continuous_on_topological by metis  | 
|
3637  | 
then show "x \<in> U"  | 
|
3638  | 
unfolding U_def by auto  | 
|
3639  | 
qed  | 
|
3640  | 
  ultimately have "open U \<and> {x \<in> s. f x \<in> t} = s \<inter> U" by auto
 | 
|
3641  | 
  then show "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | 
|
3642  | 
unfolding openin_open by fast  | 
|
| 33175 | 3643  | 
next  | 
| 36441 | 3644  | 
assume "?rhs" show "continuous_on s f"  | 
3645  | 
unfolding continuous_on_topological  | 
|
3646  | 
proof (clarify)  | 
|
3647  | 
fix x and B assume "x \<in> s" and "open B" and "f x \<in> B"  | 
|
3648  | 
have "openin (subtopology euclidean (f ` s)) (f ` s \<inter> B)"  | 
|
3649  | 
unfolding openin_open using `open B` by auto  | 
|
3650  | 
    then have "openin (subtopology euclidean s) {x \<in> s. f x \<in> f ` s \<inter> B}"
 | 
|
3651  | 
using `?rhs` by fast  | 
|
3652  | 
then show "\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)"  | 
|
3653  | 
unfolding openin_open using `x \<in> s` and `f x \<in> B` by auto  | 
|
3654  | 
qed  | 
|
3655  | 
qed  | 
|
3656  | 
||
3657  | 
text {* Similarly in terms of closed sets. *}
 | 
|
| 33175 | 3658  | 
|
3659  | 
lemma continuous_on_closed:  | 
|
| 36359 | 3660  | 
  shows "continuous_on s f \<longleftrightarrow>  (\<forall>t. closedin (subtopology euclidean (f ` s)) t  --> closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
 | 
| 33175 | 3661  | 
proof  | 
3662  | 
assume ?lhs  | 
|
3663  | 
  { fix t
 | 
|
3664  | 
    have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
 | 
|
3665  | 
have **:"f ` s - (f ` s - (f ` s - t)) = f ` s - t" by auto  | 
|
3666  | 
assume as:"closedin (subtopology euclidean (f ` s)) t"  | 
|
3667  | 
hence "closedin (subtopology euclidean (f ` s)) (f ` s - (f ` s - t))" unfolding closedin_def topspace_euclidean_subtopology unfolding ** by auto  | 
|
3668  | 
    hence "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?lhs`[unfolded continuous_on_open, THEN spec[where x="(f ` s) - t"]]
 | 
|
3669  | 
unfolding openin_closedin_eq topspace_euclidean_subtopology unfolding * by auto }  | 
|
3670  | 
thus ?rhs by auto  | 
|
3671  | 
next  | 
|
3672  | 
assume ?rhs  | 
|
3673  | 
  { fix t
 | 
|
3674  | 
    have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
 | 
|
3675  | 
assume as:"openin (subtopology euclidean (f ` s)) t"  | 
|
3676  | 
    hence "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?rhs`[THEN spec[where x="(f ` s) - t"]]
 | 
|
3677  | 
unfolding openin_closedin_eq topspace_euclidean_subtopology *[THEN sym] closedin_subtopology by auto }  | 
|
3678  | 
thus ?lhs unfolding continuous_on_open by auto  | 
|
3679  | 
qed  | 
|
3680  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3681  | 
text {* Half-global and completely global cases. *}
 | 
| 33175 | 3682  | 
|
3683  | 
lemma continuous_open_in_preimage:  | 
|
3684  | 
assumes "continuous_on s f" "open t"  | 
|
3685  | 
  shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | 
|
3686  | 
proof-  | 
|
3687  | 
have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto  | 
|
3688  | 
have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"  | 
|
3689  | 
using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto  | 
|
3690  | 
thus ?thesis using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] using * by auto  | 
|
3691  | 
qed  | 
|
3692  | 
||
3693  | 
lemma continuous_closed_in_preimage:  | 
|
3694  | 
assumes "continuous_on s f" "closed t"  | 
|
3695  | 
  shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | 
|
3696  | 
proof-  | 
|
3697  | 
have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto  | 
|
3698  | 
have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"  | 
|
3699  | 
using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute by auto  | 
|
3700  | 
thus ?thesis  | 
|
3701  | 
using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] using * by auto  | 
|
3702  | 
qed  | 
|
3703  | 
||
3704  | 
lemma continuous_open_preimage:  | 
|
3705  | 
assumes "continuous_on s f" "open s" "open t"  | 
|
3706  | 
  shows "open {x \<in> s. f x \<in> t}"
 | 
|
3707  | 
proof-  | 
|
3708  | 
  obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | 
|
3709  | 
using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto  | 
|
3710  | 
thus ?thesis using open_Int[of s T, OF assms(2)] by auto  | 
|
3711  | 
qed  | 
|
3712  | 
||
3713  | 
lemma continuous_closed_preimage:  | 
|
3714  | 
assumes "continuous_on s f" "closed s" "closed t"  | 
|
3715  | 
  shows "closed {x \<in> s. f x \<in> t}"
 | 
|
3716  | 
proof-  | 
|
3717  | 
  obtain T where T: "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | 
|
3718  | 
using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto  | 
|
3719  | 
thus ?thesis using closed_Int[of s T, OF assms(2)] by auto  | 
|
3720  | 
qed  | 
|
3721  | 
||
3722  | 
lemma continuous_open_preimage_univ:  | 
|
3723  | 
  shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
 | 
|
3724  | 
using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto  | 
|
3725  | 
||
3726  | 
lemma continuous_closed_preimage_univ:  | 
|
3727  | 
  shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}"
 | 
|
3728  | 
using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto  | 
|
3729  | 
||
3730  | 
lemma continuous_open_vimage:  | 
|
3731  | 
shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)"  | 
|
3732  | 
unfolding vimage_def by (rule continuous_open_preimage_univ)  | 
|
3733  | 
||
3734  | 
lemma continuous_closed_vimage:  | 
|
3735  | 
shows "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)"  | 
|
3736  | 
unfolding vimage_def by (rule continuous_closed_preimage_univ)  | 
|
3737  | 
||
| 36441 | 3738  | 
lemma interior_image_subset:  | 
| 
35172
 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 
himmelma 
parents: 
35028 
diff
changeset
 | 
3739  | 
assumes "\<forall>x. continuous (at x) f" "inj f"  | 
| 
 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 
himmelma 
parents: 
35028 
diff
changeset
 | 
3740  | 
shows "interior (f ` s) \<subseteq> f ` (interior s)"  | 
| 44519 | 3741  | 
proof  | 
3742  | 
fix x assume "x \<in> interior (f ` s)"  | 
|
3743  | 
then obtain T where as: "open T" "x \<in> T" "T \<subseteq> f ` s" ..  | 
|
3744  | 
hence "x \<in> f ` s" by auto  | 
|
3745  | 
then obtain y where y: "y \<in> s" "x = f y" by auto  | 
|
3746  | 
have "open (vimage f T)"  | 
|
3747  | 
using assms(1) `open T` by (rule continuous_open_vimage)  | 
|
3748  | 
moreover have "y \<in> vimage f T"  | 
|
3749  | 
using `x = f y` `x \<in> T` by simp  | 
|
3750  | 
moreover have "vimage f T \<subseteq> s"  | 
|
3751  | 
using `T \<subseteq> image f s` `inj f` unfolding inj_on_def subset_eq by auto  | 
|
3752  | 
ultimately have "y \<in> interior s" ..  | 
|
3753  | 
with `x = f y` show "x \<in> f ` interior s" ..  | 
|
3754  | 
qed  | 
|
| 
35172
 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 
himmelma 
parents: 
35028 
diff
changeset
 | 
3755  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3756  | 
text {* Equality of continuous functions on closure and related results. *}
 | 
| 33175 | 3757  | 
|
3758  | 
lemma continuous_closed_in_preimage_constant:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3759  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 36359 | 3760  | 
  shows "continuous_on s f ==> closedin (subtopology euclidean s) {x \<in> s. f x = a}"
 | 
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3761  | 
  using continuous_closed_in_preimage[of s f "{a}"] by auto
 | 
| 33175 | 3762  | 
|
3763  | 
lemma continuous_closed_preimage_constant:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3764  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 36359 | 3765  | 
  shows "continuous_on s f \<Longrightarrow> closed s ==> closed {x \<in> s. f x = a}"
 | 
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3766  | 
  using continuous_closed_preimage[of s f "{a}"] by auto
 | 
| 33175 | 3767  | 
|
3768  | 
lemma continuous_constant_on_closure:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3769  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 33175 | 3770  | 
assumes "continuous_on (closure s) f"  | 
3771  | 
"\<forall>x \<in> s. f x = a"  | 
|
3772  | 
shows "\<forall>x \<in> (closure s). f x = a"  | 
|
3773  | 
using continuous_closed_preimage_constant[of "closure s" f a]  | 
|
3774  | 
    assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset unfolding subset_eq by auto
 | 
|
3775  | 
||
3776  | 
lemma image_closure_subset:  | 
|
3777  | 
assumes "continuous_on (closure s) f" "closed t" "(f ` s) \<subseteq> t"  | 
|
3778  | 
shows "f ` (closure s) \<subseteq> t"  | 
|
3779  | 
proof-  | 
|
3780  | 
  have "s \<subseteq> {x \<in> closure s. f x \<in> t}" using assms(3) closure_subset by auto
 | 
|
3781  | 
  moreover have "closed {x \<in> closure s. f x \<in> t}"
 | 
|
3782  | 
using continuous_closed_preimage[OF assms(1)] and assms(2) by auto  | 
|
3783  | 
  ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
 | 
|
3784  | 
    using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
 | 
|
3785  | 
thus ?thesis by auto  | 
|
3786  | 
qed  | 
|
3787  | 
||
3788  | 
lemma continuous_on_closure_norm_le:  | 
|
3789  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"  | 
|
3790  | 
assumes "continuous_on (closure s) f" "\<forall>y \<in> s. norm(f y) \<le> b" "x \<in> (closure s)"  | 
|
3791  | 
shows "norm(f x) \<le> b"  | 
|
3792  | 
proof-  | 
|
3793  | 
have *:"f ` s \<subseteq> cball 0 b" using assms(2)[unfolded mem_cball_0[THEN sym]] by auto  | 
|
3794  | 
show ?thesis  | 
|
3795  | 
using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3)  | 
|
3796  | 
unfolding subset_eq apply(erule_tac x="f x" in ballE) by (auto simp add: dist_norm)  | 
|
3797  | 
qed  | 
|
3798  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3799  | 
text {* Making a continuous function avoid some value in a neighbourhood. *}
 | 
| 33175 | 3800  | 
|
3801  | 
lemma continuous_within_avoid:  | 
|
3802  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)  | 
|
3803  | 
assumes "continuous (at x within s) f" "x \<in> s" "f x \<noteq> a"  | 
|
3804  | 
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a"  | 
|
3805  | 
proof-  | 
|
3806  | 
obtain d where "d>0" and d:"\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < dist (f x) a"  | 
|
3807  | 
using assms(1)[unfolded continuous_within Lim_within, THEN spec[where x="dist (f x) a"]] assms(3)[unfolded dist_nz] by auto  | 
|
3808  | 
  { fix y assume " y\<in>s"  "dist x y < d"
 | 
|
3809  | 
hence "f y \<noteq> a" using d[THEN bspec[where x=y]] assms(3)[unfolded dist_nz]  | 
|
3810  | 
apply auto unfolding dist_nz[THEN sym] by (auto simp add: dist_commute) }  | 
|
3811  | 
thus ?thesis using `d>0` by auto  | 
|
3812  | 
qed  | 
|
3813  | 
||
3814  | 
lemma continuous_at_avoid:  | 
|
3815  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)  | 
|
3816  | 
assumes "continuous (at x) f" "f x \<noteq> a"  | 
|
3817  | 
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"  | 
|
3818  | 
using assms using continuous_within_avoid[of x UNIV f a, unfolded within_UNIV] by auto  | 
|
3819  | 
||
3820  | 
lemma continuous_on_avoid:  | 
|
| 36359 | 3821  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *)  | 
| 33175 | 3822  | 
assumes "continuous_on s f" "x \<in> s" "f x \<noteq> a"  | 
3823  | 
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a"  | 
|
3824  | 
using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], OF assms(2)] continuous_within_avoid[of x s f a] assms(2,3) by auto  | 
|
3825  | 
||
3826  | 
lemma continuous_on_open_avoid:  | 
|
| 36359 | 3827  | 
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *)  | 
| 33175 | 3828  | 
assumes "continuous_on s f" "open s" "x \<in> s" "f x \<noteq> a"  | 
3829  | 
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"  | 
|
3830  | 
using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)] continuous_at_avoid[of x f a] assms(3,4) by auto  | 
|
3831  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3832  | 
text {* Proving a function is constant by proving open-ness of level set. *}
 | 
| 33175 | 3833  | 
|
3834  | 
lemma continuous_levelset_open_in_cases:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3835  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 36359 | 3836  | 
shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>  | 
| 33175 | 3837  | 
        openin (subtopology euclidean s) {x \<in> s. f x = a}
 | 
3838  | 
==> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)"  | 
|
3839  | 
unfolding connected_clopen using continuous_closed_in_preimage_constant by auto  | 
|
3840  | 
||
3841  | 
lemma continuous_levelset_open_in:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3842  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 36359 | 3843  | 
shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>  | 
| 33175 | 3844  | 
        openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
 | 
3845  | 
(\<exists>x \<in> s. f x = a) ==> (\<forall>x \<in> s. f x = a)"  | 
|
3846  | 
using continuous_levelset_open_in_cases[of s f ]  | 
|
3847  | 
by meson  | 
|
3848  | 
||
3849  | 
lemma continuous_levelset_open:  | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
3850  | 
fixes f :: "_ \<Rightarrow> 'b::t1_space"  | 
| 33175 | 3851  | 
  assumes "connected s"  "continuous_on s f"  "open {x \<in> s. f x = a}"  "\<exists>x \<in> s.  f x = a"
 | 
3852  | 
shows "\<forall>x \<in> s. f x = a"  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
3853  | 
using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] using assms (3,4) by fast  | 
| 33175 | 3854  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3855  | 
text {* Some arithmetical combinations (more to prove). *}
 | 
| 33175 | 3856  | 
|
3857  | 
lemma open_scaling[intro]:  | 
|
3858  | 
fixes s :: "'a::real_normed_vector set"  | 
|
3859  | 
assumes "c \<noteq> 0" "open s"  | 
|
3860  | 
shows "open((\<lambda>x. c *\<^sub>R x) ` s)"  | 
|
3861  | 
proof-  | 
|
3862  | 
  { fix x assume "x \<in> s"
 | 
|
3863  | 
then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> s" using assms(2)[unfolded open_dist, THEN bspec[where x=x]] by auto  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
3864  | 
have "e * abs c > 0" using assms(1)[unfolded zero_less_abs_iff[THEN sym]] using mult_pos_pos[OF `e>0`] by auto  | 
| 33175 | 3865  | 
moreover  | 
3866  | 
    { fix y assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>"
 | 
|
3867  | 
hence "norm ((1 / c) *\<^sub>R y - x) < e" unfolding dist_norm  | 
|
3868  | 
using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1)  | 
|
3869  | 
assms(1)[unfolded zero_less_abs_iff[THEN sym]] by (simp del:zero_less_abs_iff)  | 
|
3870  | 
hence "y \<in> op *\<^sub>R c ` s" using rev_image_eqI[of "(1 / c) *\<^sub>R y" s y "op *\<^sub>R c"] e[THEN spec[where x="(1 / c) *\<^sub>R y"]] assms(1) unfolding dist_norm scaleR_scaleR by auto }  | 
|
3871  | 
ultimately have "\<exists>e>0. \<forall>x'. dist x' (c *\<^sub>R x) < e \<longrightarrow> x' \<in> op *\<^sub>R c ` s" apply(rule_tac x="e * abs c" in exI) by auto }  | 
|
3872  | 
thus ?thesis unfolding open_dist by auto  | 
|
3873  | 
qed  | 
|
3874  | 
||
3875  | 
lemma minus_image_eq_vimage:  | 
|
3876  | 
fixes A :: "'a::ab_group_add set"  | 
|
3877  | 
shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A"  | 
|
3878  | 
by (auto intro!: image_eqI [where f="\<lambda>x. - x"])  | 
|
3879  | 
||
3880  | 
lemma open_negations:  | 
|
3881  | 
fixes s :: "'a::real_normed_vector set"  | 
|
3882  | 
shows "open s ==> open ((\<lambda> x. -x) ` s)"  | 
|
3883  | 
unfolding scaleR_minus1_left [symmetric]  | 
|
3884  | 
by (rule open_scaling, auto)  | 
|
3885  | 
||
3886  | 
lemma open_translation:  | 
|
3887  | 
fixes s :: "'a::real_normed_vector set"  | 
|
3888  | 
assumes "open s" shows "open((\<lambda>x. a + x) ` s)"  | 
|
3889  | 
proof-  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3890  | 
  { fix x have "continuous (at x) (\<lambda>x. x - a)"
 | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3891  | 
by (intro continuous_diff continuous_at_id continuous_const) }  | 
| 
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
3892  | 
  moreover have "{x. x - a \<in> s} = op + a ` s" by force
 | 
| 33175 | 3893  | 
ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto  | 
3894  | 
qed  | 
|
3895  | 
||
3896  | 
lemma open_affinity:  | 
|
3897  | 
fixes s :: "'a::real_normed_vector set"  | 
|
3898  | 
assumes "open s" "c \<noteq> 0"  | 
|
3899  | 
shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)"  | 
|
3900  | 
proof-  | 
|
3901  | 
have *:"(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" unfolding o_def ..  | 
|
3902  | 
have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" by auto  | 
|
3903  | 
thus ?thesis using assms open_translation[of "op *\<^sub>R c ` s" a] unfolding * by auto  | 
|
3904  | 
qed  | 
|
3905  | 
||
3906  | 
lemma interior_translation:  | 
|
3907  | 
fixes s :: "'a::real_normed_vector set"  | 
|
3908  | 
shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)"  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
3909  | 
proof (rule set_eqI, rule)  | 
| 33175 | 3910  | 
fix x assume "x \<in> interior (op + a ` s)"  | 
3911  | 
then obtain e where "e>0" and e:"ball x e \<subseteq> op + a ` s" unfolding mem_interior by auto  | 
|
3912  | 
hence "ball (x - a) e \<subseteq> s" unfolding subset_eq Ball_def mem_ball dist_norm apply auto apply(erule_tac x="a + xa" in allE) unfolding ab_group_add_class.diff_diff_eq[THEN sym] by auto  | 
|
3913  | 
thus "x \<in> op + a ` interior s" unfolding image_iff apply(rule_tac x="x - a" in bexI) unfolding mem_interior using `e > 0` by auto  | 
|
3914  | 
next  | 
|
3915  | 
fix x assume "x \<in> op + a ` interior s"  | 
|
3916  | 
then obtain y e where "e>0" and e:"ball y e \<subseteq> s" and y:"x = a + y" unfolding image_iff Bex_def mem_interior by auto  | 
|
3917  | 
  { fix z have *:"a + y - z = y + a - z" by auto
 | 
|
3918  | 
assume "z\<in>ball x e"  | 
|
3919  | 
hence "z - a \<in> s" using e[unfolded subset_eq, THEN bspec[where x="z - a"]] unfolding mem_ball dist_norm y ab_group_add_class.diff_diff_eq2 * by auto  | 
|
3920  | 
hence "z \<in> op + a ` s" unfolding image_iff by(auto intro!: bexI[where x="z - a"]) }  | 
|
3921  | 
hence "ball x e \<subseteq> op + a ` s" unfolding subset_eq by auto  | 
|
3922  | 
thus "x \<in> interior (op + a ` s)" unfolding mem_interior using `e>0` by auto  | 
|
3923  | 
qed  | 
|
3924  | 
||
| 36437 | 3925  | 
text {* Topological properties of linear functions. *}
 | 
3926  | 
||
3927  | 
lemma linear_lim_0:  | 
|
3928  | 
assumes "bounded_linear f" shows "(f ---> 0) (at (0))"  | 
|
3929  | 
proof-  | 
|
3930  | 
interpret f: bounded_linear f by fact  | 
|
3931  | 
have "(f ---> f 0) (at 0)"  | 
|
3932  | 
using tendsto_ident_at by (rule f.tendsto)  | 
|
3933  | 
thus ?thesis unfolding f.zero .  | 
|
3934  | 
qed  | 
|
3935  | 
||
3936  | 
lemma linear_continuous_at:  | 
|
3937  | 
assumes "bounded_linear f" shows "continuous (at a) f"  | 
|
3938  | 
unfolding continuous_at using assms  | 
|
3939  | 
apply (rule bounded_linear.tendsto)  | 
|
3940  | 
apply (rule tendsto_ident_at)  | 
|
3941  | 
done  | 
|
3942  | 
||
3943  | 
lemma linear_continuous_within:  | 
|
3944  | 
shows "bounded_linear f ==> continuous (at x within s) f"  | 
|
3945  | 
using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto  | 
|
3946  | 
||
3947  | 
lemma linear_continuous_on:  | 
|
3948  | 
shows "bounded_linear f ==> continuous_on s f"  | 
|
3949  | 
using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto  | 
|
3950  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3951  | 
text {* Also bilinear functions, in composition form. *}
 | 
| 36437 | 3952  | 
|
3953  | 
lemma bilinear_continuous_at_compose:  | 
|
3954  | 
shows "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h  | 
|
3955  | 
==> continuous (at x) (\<lambda>x. h (f x) (g x))"  | 
|
3956  | 
unfolding continuous_at using Lim_bilinear[of f "f x" "(at x)" g "g x" h] by auto  | 
|
3957  | 
||
3958  | 
lemma bilinear_continuous_within_compose:  | 
|
3959  | 
shows "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h  | 
|
3960  | 
==> continuous (at x within s) (\<lambda>x. h (f x) (g x))"  | 
|
3961  | 
unfolding continuous_within using Lim_bilinear[of f "f x"] by auto  | 
|
3962  | 
||
3963  | 
lemma bilinear_continuous_on_compose:  | 
|
3964  | 
shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h  | 
|
3965  | 
==> continuous_on s (\<lambda>x. h (f x) (g x))"  | 
|
| 36441 | 3966  | 
unfolding continuous_on_def  | 
3967  | 
by (fast elim: bounded_bilinear.tendsto)  | 
|
| 36437 | 3968  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
3969  | 
text {* Preservation of compactness and connectedness under continuous function. *}
 | 
| 33175 | 3970  | 
|
3971  | 
lemma compact_continuous_image:  | 
|
3972  | 
assumes "continuous_on s f" "compact s"  | 
|
3973  | 
shows "compact(f ` s)"  | 
|
3974  | 
proof-  | 
|
3975  | 
  { fix x assume x:"\<forall>n::nat. x n \<in> f ` s"
 | 
|
3976  | 
then obtain y where y:"\<forall>n. y n \<in> s \<and> x n = f (y n)" unfolding image_iff Bex_def using choice[of "\<lambda>n xa. xa \<in> s \<and> x n = f xa"] by auto  | 
|
3977  | 
then obtain l r where "l\<in>s" and r:"subseq r" and lr:"((y \<circ> r) ---> l) sequentially" using assms(2)[unfolded compact_def, THEN spec[where x=y]] by auto  | 
|
3978  | 
    { fix e::real assume "e>0"
 | 
|
| 36359 | 3979  | 
then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' l < d \<longrightarrow> dist (f x') (f l) < e" using assms(1)[unfolded continuous_on_iff, THEN bspec[where x=l], OF `l\<in>s`] by auto  | 
| 33175 | 3980  | 
then obtain N::nat where N:"\<forall>n\<ge>N. dist ((y \<circ> r) n) l < d" using lr[unfolded Lim_sequentially, THEN spec[where x=d]] by auto  | 
3981  | 
      { fix n::nat assume "n\<ge>N" hence "dist ((x \<circ> r) n) (f l) < e" using N[THEN spec[where x=n]] d[THEN bspec[where x="y (r n)"]] y[THEN spec[where x="r n"]] by auto  }
 | 
|
3982  | 
hence "\<exists>N. \<forall>n\<ge>N. dist ((x \<circ> r) n) (f l) < e" by auto }  | 
|
3983  | 
hence "\<exists>l\<in>f ` s. \<exists>r. subseq r \<and> ((x \<circ> r) ---> l) sequentially" unfolding Lim_sequentially using r lr `l\<in>s` by auto }  | 
|
3984  | 
thus ?thesis unfolding compact_def by auto  | 
|
3985  | 
qed  | 
|
3986  | 
||
3987  | 
lemma connected_continuous_image:  | 
|
3988  | 
assumes "continuous_on s f" "connected s"  | 
|
3989  | 
shows "connected(f ` s)"  | 
|
3990  | 
proof-  | 
|
3991  | 
  { fix T assume as: "T \<noteq> {}"  "T \<noteq> f ` s"  "openin (subtopology euclidean (f ` s)) T"  "closedin (subtopology euclidean (f ` s)) T"
 | 
|
3992  | 
    have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
 | 
|
3993  | 
using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]]  | 
|
3994  | 
using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]]  | 
|
3995  | 
      using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
 | 
|
3996  | 
hence False using as(1,2)  | 
|
3997  | 
using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto }  | 
|
3998  | 
thus ?thesis unfolding connected_clopen by auto  | 
|
3999  | 
qed  | 
|
4000  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4001  | 
text {* Continuity implies uniform continuity on a compact domain. *}
 | 
| 33175 | 4002  | 
|
4003  | 
lemma compact_uniformly_continuous:  | 
|
4004  | 
assumes "continuous_on s f" "compact s"  | 
|
4005  | 
shows "uniformly_continuous_on s f"  | 
|
4006  | 
proof-  | 
|
4007  | 
    { fix x assume x:"x\<in>s"
 | 
|
| 36359 | 4008  | 
hence "\<forall>xa. \<exists>y. 0 < xa \<longrightarrow> (y > 0 \<and> (\<forall>x'\<in>s. dist x' x < y \<longrightarrow> dist (f x') (f x) < xa))" using assms(1)[unfolded continuous_on_iff, THEN bspec[where x=x]] by auto  | 
| 33175 | 4009  | 
hence "\<exists>fa. \<forall>xa>0. \<forall>x'\<in>s. fa xa > 0 \<and> (dist x' x < fa xa \<longrightarrow> dist (f x') (f x) < xa)" using choice[of "\<lambda>e d. e>0 \<longrightarrow> d>0 \<and>(\<forall>x'\<in>s. (dist x' x < d \<longrightarrow> dist (f x') (f x) < e))"] by auto }  | 
4010  | 
then have "\<forall>x\<in>s. \<exists>y. \<forall>xa. 0 < xa \<longrightarrow> (\<forall>x'\<in>s. y xa > 0 \<and> (dist x' x < y xa \<longrightarrow> dist (f x') (f x) < xa))" by auto  | 
|
4011  | 
then obtain d where d:"\<forall>e>0. \<forall>x\<in>s. \<forall>x'\<in>s. d x e > 0 \<and> (dist x' x < d x e \<longrightarrow> dist (f x') (f x) < e)"  | 
|
4012  | 
using bchoice[of s "\<lambda>x fa. \<forall>xa>0. \<forall>x'\<in>s. fa xa > 0 \<and> (dist x' x < fa xa \<longrightarrow> dist (f x') (f x) < xa)"] by blast  | 
|
4013  | 
||
4014  | 
  { fix e::real assume "e>0"
 | 
|
4015  | 
||
4016  | 
    { fix x assume "x\<in>s" hence "x \<in> ball x (d x (e / 2))" unfolding centre_in_ball using d[THEN spec[where x="e/2"]] using `e>0` by auto  }
 | 
|
4017  | 
    hence "s \<subseteq> \<Union>{ball x (d x (e / 2)) |x. x \<in> s}" unfolding subset_eq by auto
 | 
|
4018  | 
moreover  | 
|
4019  | 
    { fix b assume "b\<in>{ball x (d x (e / 2)) |x. x \<in> s}" hence "open b" by auto  }
 | 
|
4020  | 
    ultimately obtain ea where "ea>0" and ea:"\<forall>x\<in>s. \<exists>b\<in>{ball x (d x (e / 2)) |x. x \<in> s}. ball x ea \<subseteq> b" using heine_borel_lemma[OF assms(2), of "{ball x (d x (e / 2)) | x. x\<in>s }"] by auto
 | 
|
4021  | 
||
4022  | 
    { fix x y assume "x\<in>s" "y\<in>s" and as:"dist y x < ea"
 | 
|
4023  | 
obtain z where "z\<in>s" and z:"ball x ea \<subseteq> ball z (d z (e / 2))" using ea[THEN bspec[where x=x]] and `x\<in>s` by auto  | 
|
4024  | 
hence "x\<in>ball z (d z (e / 2))" using `ea>0` unfolding subset_eq by auto  | 
|
4025  | 
hence "dist (f z) (f x) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `x\<in>s` and `z\<in>s`  | 
|
4026  | 
by (auto simp add: dist_commute)  | 
|
4027  | 
moreover have "y\<in>ball z (d z (e / 2))" using as and `ea>0` and z[unfolded subset_eq]  | 
|
4028  | 
by (auto simp add: dist_commute)  | 
|
4029  | 
hence "dist (f z) (f y) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `y\<in>s` and `z\<in>s`  | 
|
4030  | 
by (auto simp add: dist_commute)  | 
|
4031  | 
ultimately have "dist (f y) (f x) < e" using dist_triangle_half_r[of "f z" "f x" e "f y"]  | 
|
4032  | 
by (auto simp add: dist_commute) }  | 
|
4033  | 
then have "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using `ea>0` by auto }  | 
|
4034  | 
thus ?thesis unfolding uniformly_continuous_on_def by auto  | 
|
4035  | 
qed  | 
|
4036  | 
||
4037  | 
text{* Continuity of inverse function on compact domain. *}
 | 
|
4038  | 
||
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
4039  | 
lemma continuous_on_inv:  | 
| 33175 | 4040  | 
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"  | 
4041  | 
(* TODO: can this be generalized more? *)  | 
|
4042  | 
assumes "continuous_on s f" "compact s" "\<forall>x \<in> s. g (f x) = x"  | 
|
4043  | 
shows "continuous_on (f ` s) g"  | 
|
4044  | 
proof-  | 
|
4045  | 
have *:"g ` f ` s = s" using assms(3) by (auto simp add: image_iff)  | 
|
4046  | 
  { fix t assume t:"closedin (subtopology euclidean (g ` f ` s)) t"
 | 
|
4047  | 
then obtain T where T: "closed T" "t = s \<inter> T" unfolding closedin_closed unfolding * by auto  | 
|
4048  | 
have "continuous_on (s \<inter> T) f" using continuous_on_subset[OF assms(1), of "s \<inter> t"]  | 
|
4049  | 
unfolding T(2) and Int_left_absorb by auto  | 
|
4050  | 
moreover have "compact (s \<inter> T)"  | 
|
4051  | 
using assms(2) unfolding compact_eq_bounded_closed  | 
|
4052  | 
using bounded_subset[of s "s \<inter> T"] and T(1) by auto  | 
|
4053  | 
ultimately have "closed (f ` t)" using T(1) unfolding T(2)  | 
|
4054  | 
using compact_continuous_image [of "s \<inter> T" f] unfolding compact_eq_bounded_closed by auto  | 
|
4055  | 
    moreover have "{x \<in> f ` s. g x \<in> t} = f ` s \<inter> f ` t" using assms(3) unfolding T(2) by auto
 | 
|
4056  | 
    ultimately have "closedin (subtopology euclidean (f ` s)) {x \<in> f ` s. g x \<in> t}"
 | 
|
4057  | 
unfolding closedin_closed by auto }  | 
|
4058  | 
thus ?thesis unfolding continuous_on_closed by auto  | 
|
4059  | 
qed  | 
|
4060  | 
||
| 36437 | 4061  | 
text {* A uniformly convergent limit of continuous functions is continuous. *}
 | 
| 33175 | 4062  | 
|
4063  | 
lemma continuous_uniform_limit:  | 
|
| 
44212
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4064  | 
fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::metric_space"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4065  | 
assumes "\<not> trivial_limit F"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4066  | 
assumes "eventually (\<lambda>n. continuous_on s (f n)) F"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4067  | 
assumes "\<forall>e>0. eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e) F"  | 
| 33175 | 4068  | 
shows "continuous_on s g"  | 
4069  | 
proof-  | 
|
4070  | 
  { fix x and e::real assume "x\<in>s" "e>0"
 | 
|
| 
44212
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4071  | 
have "eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e / 3) F"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4072  | 
using `e>0` assms(3)[THEN spec[where x="e/3"]] by auto  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4073  | 
from eventually_happens [OF eventually_conj [OF this assms(2)]]  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4074  | 
obtain n where n:"\<forall>x\<in>s. dist (f n x) (g x) < e / 3" "continuous_on s (f n)"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4075  | 
using assms(1) by blast  | 
| 33175 | 4076  | 
have "e / 3 > 0" using `e>0` by auto  | 
4077  | 
then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f n x') (f n x) < e / 3"  | 
|
| 36359 | 4078  | 
using n(2)[unfolded continuous_on_iff, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast  | 
| 
44212
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4079  | 
    { fix y assume "y \<in> s" and "dist y x < d"
 | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4080  | 
hence "dist (f n y) (f n x) < e / 3"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4081  | 
by (rule d [rule_format])  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4082  | 
hence "dist (f n y) (g x) < 2 * e / 3"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4083  | 
using dist_triangle [of "f n y" "g x" "f n x"]  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4084  | 
using n(1)[THEN bspec[where x=x], OF `x\<in>s`]  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4085  | 
by auto  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4086  | 
hence "dist (g y) (g x) < e"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4087  | 
using n(1)[THEN bspec[where x=y], OF `y\<in>s`]  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4088  | 
using dist_triangle3 [of "g y" "g x" "f n y"]  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4089  | 
by auto }  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4090  | 
hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e"  | 
| 
 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 
huffman 
parents: 
44211 
diff
changeset
 | 
4091  | 
using `d>0` by auto }  | 
| 36359 | 4092  | 
thus ?thesis unfolding continuous_on_iff by auto  | 
| 33175 | 4093  | 
qed  | 
4094  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4095  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4096  | 
subsection {* Topological stuff lifted from and dropped to R *}
 | 
| 33175 | 4097  | 
|
4098  | 
lemma open_real:  | 
|
4099  | 
fixes s :: "real set" shows  | 
|
4100  | 
"open s \<longleftrightarrow>  | 
|
4101  | 
(\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" (is "?lhs = ?rhs")  | 
|
4102  | 
unfolding open_dist dist_norm by simp  | 
|
4103  | 
||
4104  | 
lemma islimpt_approachable_real:  | 
|
4105  | 
fixes s :: "real set"  | 
|
4106  | 
shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)"  | 
|
4107  | 
unfolding islimpt_approachable dist_norm by simp  | 
|
4108  | 
||
4109  | 
lemma closed_real:  | 
|
4110  | 
fixes s :: "real set"  | 
|
4111  | 
shows "closed s \<longleftrightarrow>  | 
|
4112  | 
(\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e)  | 
|
4113  | 
--> x \<in> s)"  | 
|
4114  | 
unfolding closed_limpt islimpt_approachable dist_norm by simp  | 
|
4115  | 
||
4116  | 
lemma continuous_at_real_range:  | 
|
4117  | 
fixes f :: "'a::real_normed_vector \<Rightarrow> real"  | 
|
4118  | 
shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.  | 
|
4119  | 
\<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)"  | 
|
4120  | 
unfolding continuous_at unfolding Lim_at  | 
|
4121  | 
unfolding dist_nz[THEN sym] unfolding dist_norm apply auto  | 
|
4122  | 
apply(erule_tac x=e in allE) apply auto apply (rule_tac x=d in exI) apply auto apply (erule_tac x=x' in allE) apply auto  | 
|
4123  | 
apply(erule_tac x=e in allE) by auto  | 
|
4124  | 
||
4125  | 
lemma continuous_on_real_range:  | 
|
4126  | 
fixes f :: "'a::real_normed_vector \<Rightarrow> real"  | 
|
4127  | 
shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))"  | 
|
| 36359 | 4128  | 
unfolding continuous_on_iff dist_norm by simp  | 
| 33175 | 4129  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4130  | 
text {* Hence some handy theorems on distance, diameter etc. of/from a set. *}
 | 
| 33175 | 4131  | 
|
4132  | 
lemma compact_attains_sup:  | 
|
4133  | 
fixes s :: "real set"  | 
|
4134  | 
  assumes "compact s"  "s \<noteq> {}"
 | 
|
4135  | 
shows "\<exists>x \<in> s. \<forall>y \<in> s. y \<le> x"  | 
|
4136  | 
proof-  | 
|
4137  | 
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto  | 
|
| 33270 | 4138  | 
  { fix e::real assume as: "\<forall>x\<in>s. x \<le> Sup s" "Sup s \<notin> s"  "0 < e" "\<forall>x'\<in>s. x' = Sup s \<or> \<not> Sup s - x' < e"
 | 
4139  | 
have "isLub UNIV s (Sup s)" using Sup[OF assms(2)] unfolding setle_def using as(1) by auto  | 
|
4140  | 
moreover have "isUb UNIV s (Sup s - e)" unfolding isUb_def unfolding setle_def using as(4,2) by auto  | 
|
4141  | 
ultimately have False using isLub_le_isUb[of UNIV s "Sup s" "Sup s - e"] using `e>0` by auto }  | 
|
4142  | 
thus ?thesis using bounded_has_Sup(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Sup s"]]  | 
|
4143  | 
apply(rule_tac x="Sup s" in bexI) by auto  | 
|
4144  | 
qed  | 
|
4145  | 
||
4146  | 
lemma Inf:  | 
|
4147  | 
fixes S :: "real set"  | 
|
4148  | 
  shows "S \<noteq> {} ==> (\<exists>b. b <=* S) ==> isGlb UNIV S (Inf S)"
 | 
|
4149  | 
by (auto simp add: isLb_def setle_def setge_def isGlb_def greatestP_def)  | 
|
| 33175 | 4150  | 
|
4151  | 
lemma compact_attains_inf:  | 
|
4152  | 
fixes s :: "real set"  | 
|
4153  | 
  assumes "compact s" "s \<noteq> {}"  shows "\<exists>x \<in> s. \<forall>y \<in> s. x \<le> y"
 | 
|
4154  | 
proof-  | 
|
4155  | 
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto  | 
|
| 33270 | 4156  | 
  { fix e::real assume as: "\<forall>x\<in>s. x \<ge> Inf s"  "Inf s \<notin> s"  "0 < e"
 | 
4157  | 
"\<forall>x'\<in>s. x' = Inf s \<or> \<not> abs (x' - Inf s) < e"  | 
|
4158  | 
have "isGlb UNIV s (Inf s)" using Inf[OF assms(2)] unfolding setge_def using as(1) by auto  | 
|
| 33175 | 4159  | 
moreover  | 
4160  | 
    { fix x assume "x \<in> s"
 | 
|
| 33270 | 4161  | 
hence *:"abs (x - Inf s) = x - Inf s" using as(1)[THEN bspec[where x=x]] by auto  | 
4162  | 
have "Inf s + e \<le> x" using as(4)[THEN bspec[where x=x]] using as(2) `x\<in>s` unfolding * by auto }  | 
|
4163  | 
hence "isLb UNIV s (Inf s + e)" unfolding isLb_def and setge_def by auto  | 
|
4164  | 
ultimately have False using isGlb_le_isLb[of UNIV s "Inf s" "Inf s + e"] using `e>0` by auto }  | 
|
4165  | 
thus ?thesis using bounded_has_Inf(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Inf s"]]  | 
|
4166  | 
apply(rule_tac x="Inf s" in bexI) by auto  | 
|
| 33175 | 4167  | 
qed  | 
4168  | 
||
4169  | 
lemma continuous_attains_sup:  | 
|
4170  | 
fixes f :: "'a::metric_space \<Rightarrow> real"  | 
|
4171  | 
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
 | 
|
4172  | 
==> (\<exists>x \<in> s. \<forall>y \<in> s. f y \<le> f x)"  | 
|
4173  | 
using compact_attains_sup[of "f ` s"]  | 
|
4174  | 
using compact_continuous_image[of s f] by auto  | 
|
4175  | 
||
4176  | 
lemma continuous_attains_inf:  | 
|
4177  | 
fixes f :: "'a::metric_space \<Rightarrow> real"  | 
|
4178  | 
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
 | 
|
4179  | 
\<Longrightarrow> (\<exists>x \<in> s. \<forall>y \<in> s. f x \<le> f y)"  | 
|
4180  | 
using compact_attains_inf[of "f ` s"]  | 
|
4181  | 
using compact_continuous_image[of s f] by auto  | 
|
4182  | 
||
4183  | 
lemma distance_attains_sup:  | 
|
4184  | 
  assumes "compact s" "s \<noteq> {}"
 | 
|
4185  | 
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a y \<le> dist a x"  | 
|
4186  | 
proof (rule continuous_attains_sup [OF assms])  | 
|
4187  | 
  { fix x assume "x\<in>s"
 | 
|
4188  | 
have "(dist a ---> dist a x) (at x within s)"  | 
|
| 
44568
 
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
 
huffman 
parents: 
44533 
diff
changeset
 | 
4189  | 
by (intro tendsto_dist tendsto_const Lim_at_within tendsto_ident_at)  | 
| 33175 | 4190  | 
}  | 
4191  | 
thus "continuous_on s (dist a)"  | 
|
4192  | 
unfolding continuous_on ..  | 
|
4193  | 
qed  | 
|
4194  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4195  | 
text {* For \emph{minimal} distance, we only need closure, not compactness. *}
 | 
| 33175 | 4196  | 
|
4197  | 
lemma distance_attains_inf:  | 
|
4198  | 
fixes a :: "'a::heine_borel"  | 
|
4199  | 
  assumes "closed s"  "s \<noteq> {}"
 | 
|
4200  | 
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a x \<le> dist a y"  | 
|
4201  | 
proof-  | 
|
4202  | 
from assms(2) obtain b where "b\<in>s" by auto  | 
|
4203  | 
let ?B = "cball a (dist b a) \<inter> s"  | 
|
4204  | 
have "b \<in> ?B" using `b\<in>s` by (simp add: dist_commute)  | 
|
4205  | 
  hence "?B \<noteq> {}" by auto
 | 
|
4206  | 
moreover  | 
|
4207  | 
  { fix x assume "x\<in>?B"
 | 
|
4208  | 
fix e::real assume "e>0"  | 
|
4209  | 
    { fix x' assume "x'\<in>?B" and as:"dist x' x < e"
 | 
|
4210  | 
from as have "\<bar>dist a x' - dist a x\<bar> < e"  | 
|
4211  | 
unfolding abs_less_iff minus_diff_eq  | 
|
4212  | 
using dist_triangle2 [of a x' x]  | 
|
4213  | 
using dist_triangle [of a x x']  | 
|
4214  | 
by arith  | 
|
4215  | 
}  | 
|
4216  | 
hence "\<exists>d>0. \<forall>x'\<in>?B. dist x' x < d \<longrightarrow> \<bar>dist a x' - dist a x\<bar> < e"  | 
|
4217  | 
using `e>0` by auto  | 
|
4218  | 
}  | 
|
4219  | 
hence "continuous_on (cball a (dist b a) \<inter> s) (dist a)"  | 
|
4220  | 
unfolding continuous_on Lim_within dist_norm real_norm_def  | 
|
4221  | 
by fast  | 
|
4222  | 
moreover have "compact ?B"  | 
|
4223  | 
using compact_cball[of a "dist b a"]  | 
|
4224  | 
unfolding compact_eq_bounded_closed  | 
|
4225  | 
using bounded_Int and closed_Int and assms(1) by auto  | 
|
4226  | 
ultimately obtain x where "x\<in>cball a (dist b a) \<inter> s" "\<forall>y\<in>cball a (dist b a) \<inter> s. dist a x \<le> dist a y"  | 
|
4227  | 
using continuous_attains_inf[of ?B "dist a"] by fastsimp  | 
|
4228  | 
thus ?thesis by fastsimp  | 
|
4229  | 
qed  | 
|
4230  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4231  | 
|
| 36437 | 4232  | 
subsection {* Pasted sets *}
 | 
| 33175 | 4233  | 
|
4234  | 
lemma bounded_Times:  | 
|
4235  | 
assumes "bounded s" "bounded t" shows "bounded (s \<times> t)"  | 
|
4236  | 
proof-  | 
|
4237  | 
obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b"  | 
|
4238  | 
using assms [unfolded bounded_def] by auto  | 
|
4239  | 
then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)"  | 
|
4240  | 
by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono)  | 
|
4241  | 
thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto  | 
|
4242  | 
qed  | 
|
4243  | 
||
4244  | 
lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B"  | 
|
4245  | 
by (induct x) simp  | 
|
4246  | 
||
4247  | 
lemma compact_Times: "compact s \<Longrightarrow> compact t \<Longrightarrow> compact (s \<times> t)"  | 
|
4248  | 
unfolding compact_def  | 
|
4249  | 
apply clarify  | 
|
4250  | 
apply (drule_tac x="fst \<circ> f" in spec)  | 
|
4251  | 
apply (drule mp, simp add: mem_Times_iff)  | 
|
4252  | 
apply (clarify, rename_tac l1 r1)  | 
|
4253  | 
apply (drule_tac x="snd \<circ> f \<circ> r1" in spec)  | 
|
4254  | 
apply (drule mp, simp add: mem_Times_iff)  | 
|
4255  | 
apply (clarify, rename_tac l2 r2)  | 
|
4256  | 
apply (rule_tac x="(l1, l2)" in rev_bexI, simp)  | 
|
4257  | 
apply (rule_tac x="r1 \<circ> r2" in exI)  | 
|
4258  | 
apply (rule conjI, simp add: subseq_def)  | 
|
4259  | 
apply (drule_tac r=r2 in lim_subseq [COMP swap_prems_rl], assumption)  | 
|
4260  | 
apply (drule (1) tendsto_Pair) back  | 
|
4261  | 
apply (simp add: o_def)  | 
|
4262  | 
done  | 
|
4263  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4264  | 
text{* Hence some useful properties follow quite easily. *}
 | 
| 33175 | 4265  | 
|
4266  | 
lemma compact_scaling:  | 
|
4267  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4268  | 
assumes "compact s" shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)"  | 
|
4269  | 
proof-  | 
|
4270  | 
let ?f = "\<lambda>x. scaleR c x"  | 
|
| 
44282
 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 
huffman 
parents: 
44252 
diff
changeset
 | 
4271  | 
have *:"bounded_linear ?f" by (rule bounded_linear_scaleR_right)  | 
| 33175 | 4272  | 
show ?thesis using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f]  | 
4273  | 
using linear_continuous_at[OF *] assms by auto  | 
|
4274  | 
qed  | 
|
4275  | 
||
4276  | 
lemma compact_negations:  | 
|
4277  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4278  | 
assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)"  | 
|
4279  | 
using compact_scaling [OF assms, of "- 1"] by auto  | 
|
4280  | 
||
4281  | 
lemma compact_sums:  | 
|
4282  | 
fixes s t :: "'a::real_normed_vector set"  | 
|
4283  | 
  assumes "compact s"  "compact t"  shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4284  | 
proof-  | 
|
4285  | 
  have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
 | 
|
4286  | 
apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto  | 
|
4287  | 
have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)"  | 
|
4288  | 
unfolding continuous_on by (rule ballI) (intro tendsto_intros)  | 
|
4289  | 
thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto  | 
|
4290  | 
qed  | 
|
4291  | 
||
4292  | 
lemma compact_differences:  | 
|
4293  | 
fixes s t :: "'a::real_normed_vector set"  | 
|
4294  | 
  assumes "compact s" "compact t"  shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4295  | 
proof-  | 
|
4296  | 
  have "{x - y | x y. x\<in>s \<and> y \<in> t} =  {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
 | 
|
4297  | 
apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto  | 
|
4298  | 
thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto  | 
|
4299  | 
qed  | 
|
4300  | 
||
4301  | 
lemma compact_translation:  | 
|
4302  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4303  | 
assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)"  | 
|
4304  | 
proof-  | 
|
4305  | 
  have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto
 | 
|
4306  | 
thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto  | 
|
4307  | 
qed  | 
|
4308  | 
||
4309  | 
lemma compact_affinity:  | 
|
4310  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4311  | 
assumes "compact s" shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)"  | 
|
4312  | 
proof-  | 
|
4313  | 
have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto  | 
|
4314  | 
thus ?thesis using compact_translation[OF compact_scaling[OF assms], of a c] by auto  | 
|
4315  | 
qed  | 
|
4316  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4317  | 
text {* Hence we get the following. *}
 | 
| 33175 | 4318  | 
|
4319  | 
lemma compact_sup_maxdistance:  | 
|
4320  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4321  | 
  assumes "compact s"  "s \<noteq> {}"
 | 
|
4322  | 
shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)"  | 
|
4323  | 
proof-  | 
|
4324  | 
  have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto
 | 
|
4325  | 
  then obtain x where x:"x\<in>{x - y |x y. x \<in> s \<and> y \<in> s}"  "\<forall>y\<in>{x - y |x y. x \<in> s \<and> y \<in> s}. norm y \<le> norm x"
 | 
|
4326  | 
using compact_differences[OF assms(1) assms(1)]  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4327  | 
    using distance_attains_sup[where 'a="'a", unfolded dist_norm, of "{x - y | x y . x\<in>s \<and> y\<in>s}" 0] by auto
 | 
| 33175 | 4328  | 
from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto  | 
4329  | 
thus ?thesis using x(2)[unfolded `x = a - b`] by blast  | 
|
4330  | 
qed  | 
|
4331  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4332  | 
text {* We can state this in terms of diameter of a set. *}
 | 
| 33175 | 4333  | 
|
| 33270 | 4334  | 
definition "diameter s = (if s = {} then 0::real else Sup {norm(x - y) | x y. x \<in> s \<and> y \<in> s})"
 | 
| 33175 | 4335  | 
(* TODO: generalize to class metric_space *)  | 
4336  | 
||
4337  | 
lemma diameter_bounded:  | 
|
4338  | 
assumes "bounded s"  | 
|
4339  | 
shows "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"  | 
|
4340  | 
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)"  | 
|
4341  | 
proof-  | 
|
4342  | 
  let ?D = "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}"
 | 
|
4343  | 
obtain a where a:"\<forall>x\<in>s. norm x \<le> a" using assms[unfolded bounded_iff] by auto  | 
|
4344  | 
  { fix x y assume "x \<in> s" "y \<in> s"
 | 
|
| 36350 | 4345  | 
hence "norm (x - y) \<le> 2 * a" using norm_triangle_ineq[of x "-y", unfolded norm_minus_cancel] a[THEN bspec[where x=x]] a[THEN bspec[where x=y]] by (auto simp add: field_simps) }  | 
| 33175 | 4346  | 
note * = this  | 
4347  | 
  { fix x y assume "x\<in>s" "y\<in>s"  hence "s \<noteq> {}" by auto
 | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4348  | 
    have "norm(x - y) \<le> diameter s" unfolding diameter_def using `s\<noteq>{}` *[OF `x\<in>s` `y\<in>s`] `x\<in>s` `y\<in>s`
 | 
| 44584 | 4349  | 
by simp (blast del: Sup_upper intro!: * Sup_upper) }  | 
| 33175 | 4350  | 
moreover  | 
4351  | 
  { fix d::real assume "d>0" "d < diameter s"
 | 
|
4352  | 
    hence "s\<noteq>{}" unfolding diameter_def by auto
 | 
|
4353  | 
have "\<exists>d' \<in> ?D. d' > d"  | 
|
4354  | 
proof(rule ccontr)  | 
|
4355  | 
      assume "\<not> (\<exists>d'\<in>{norm (x - y) |x y. x \<in> s \<and> y \<in> s}. d < d')"
 | 
|
| 33324 | 4356  | 
hence "\<forall>d'\<in>?D. d' \<le> d" by auto (metis not_leE)  | 
4357  | 
      thus False using `d < diameter s` `s\<noteq>{}` 
 | 
|
4358  | 
apply (auto simp add: diameter_def)  | 
|
4359  | 
apply (drule Sup_real_iff [THEN [2] rev_iffD2])  | 
|
4360  | 
apply (auto, force)  | 
|
4361  | 
done  | 
|
| 33175 | 4362  | 
qed  | 
4363  | 
hence "\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d" by auto }  | 
|
4364  | 
ultimately show "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"  | 
|
4365  | 
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)" by auto  | 
|
4366  | 
qed  | 
|
4367  | 
||
4368  | 
lemma diameter_bounded_bound:  | 
|
4369  | 
"bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s"  | 
|
4370  | 
using diameter_bounded by blast  | 
|
4371  | 
||
4372  | 
lemma diameter_compact_attained:  | 
|
4373  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4374  | 
  assumes "compact s"  "s \<noteq> {}"
 | 
|
4375  | 
shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)"  | 
|
4376  | 
proof-  | 
|
4377  | 
have b:"bounded s" using assms(1) by (rule compact_imp_bounded)  | 
|
4378  | 
then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. norm (u - v) \<le> norm (x - y)" using compact_sup_maxdistance[OF assms] by auto  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4379  | 
hence "diameter s \<le> norm (x - y)"  | 
| 
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4380  | 
unfolding diameter_def by clarsimp (rule Sup_least, fast+)  | 
| 33324 | 4381  | 
thus ?thesis  | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4382  | 
by (metis b diameter_bounded_bound order_antisym xys)  | 
| 33175 | 4383  | 
qed  | 
4384  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4385  | 
text {* Related results with closure as the conclusion. *}
 | 
| 33175 | 4386  | 
|
4387  | 
lemma closed_scaling:  | 
|
4388  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4389  | 
assumes "closed s" shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)"  | 
|
4390  | 
proof(cases "s={}")
 | 
|
4391  | 
case True thus ?thesis by auto  | 
|
4392  | 
next  | 
|
4393  | 
case False  | 
|
4394  | 
show ?thesis  | 
|
4395  | 
proof(cases "c=0")  | 
|
4396  | 
    have *:"(\<lambda>x. 0) ` s = {0}" using `s\<noteq>{}` by auto
 | 
|
| 
36668
 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 
huffman 
parents: 
36667 
diff
changeset
 | 
4397  | 
case True thus ?thesis apply auto unfolding * by auto  | 
| 33175 | 4398  | 
next  | 
4399  | 
case False  | 
|
4400  | 
    { fix x l assume as:"\<forall>n::nat. x n \<in> scaleR c ` s"  "(x ---> l) sequentially"
 | 
|
4401  | 
      { fix n::nat have "scaleR (1 / c) (x n) \<in> s"
 | 
|
4402  | 
using as(1)[THEN spec[where x=n]]  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4403  | 
using `c\<noteq>0` by auto  | 
| 33175 | 4404  | 
}  | 
4405  | 
moreover  | 
|
4406  | 
      { fix e::real assume "e>0"
 | 
|
4407  | 
hence "0 < e *\<bar>c\<bar>" using `c\<noteq>0` mult_pos_pos[of e "abs c"] by auto  | 
|
4408  | 
then obtain N where "\<forall>n\<ge>N. dist (x n) l < e * \<bar>c\<bar>"  | 
|
4409  | 
using as(2)[unfolded Lim_sequentially, THEN spec[where x="e * abs c"]] by auto  | 
|
4410  | 
hence "\<exists>N. \<forall>n\<ge>N. dist (scaleR (1 / c) (x n)) (scaleR (1 / c) l) < e"  | 
|
4411  | 
unfolding dist_norm unfolding scaleR_right_diff_distrib[THEN sym]  | 
|
4412  | 
using mult_imp_div_pos_less[of "abs c" _ e] `c\<noteq>0` by auto }  | 
|
4413  | 
hence "((\<lambda>n. scaleR (1 / c) (x n)) ---> scaleR (1 / c) l) sequentially" unfolding Lim_sequentially by auto  | 
|
4414  | 
ultimately have "l \<in> scaleR c ` s"  | 
|
4415  | 
using assms[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. scaleR (1/c) (x n)"], THEN spec[where x="scaleR (1/c) l"]]  | 
|
4416  | 
unfolding image_iff using `c\<noteq>0` apply(rule_tac x="scaleR (1 / c) l" in bexI) by auto }  | 
|
4417  | 
thus ?thesis unfolding closed_sequential_limits by fast  | 
|
4418  | 
qed  | 
|
4419  | 
qed  | 
|
4420  | 
||
4421  | 
lemma closed_negations:  | 
|
4422  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4423  | 
assumes "closed s" shows "closed ((\<lambda>x. -x) ` s)"  | 
|
4424  | 
using closed_scaling[OF assms, of "- 1"] by simp  | 
|
4425  | 
||
4426  | 
lemma compact_closed_sums:  | 
|
4427  | 
fixes s :: "'a::real_normed_vector set"  | 
|
4428  | 
  assumes "compact s"  "closed t"  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4429  | 
proof-  | 
|
4430  | 
  let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
 | 
|
4431  | 
  { fix x l assume as:"\<forall>n. x n \<in> ?S"  "(x ---> l) sequentially"
 | 
|
4432  | 
from as(1) obtain f where f:"\<forall>n. x n = fst (f n) + snd (f n)" "\<forall>n. fst (f n) \<in> s" "\<forall>n. snd (f n) \<in> t"  | 
|
4433  | 
using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto  | 
|
4434  | 
obtain l' r where "l'\<in>s" and r:"subseq r" and lr:"(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially"  | 
|
4435  | 
using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto  | 
|
4436  | 
have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially"  | 
|
| 44125 | 4437  | 
using tendsto_diff[OF lim_subseq[OF r as(2)] lr] and f(1) unfolding o_def by auto  | 
| 33175 | 4438  | 
hence "l - l' \<in> t"  | 
4439  | 
using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda> n. snd (f (r n))"], THEN spec[where x="l - l'"]]  | 
|
4440  | 
using f(3) by auto  | 
|
4441  | 
hence "l \<in> ?S" using `l' \<in> s` apply auto apply(rule_tac x=l' in exI) apply(rule_tac x="l - l'" in exI) by auto  | 
|
4442  | 
}  | 
|
4443  | 
thus ?thesis unfolding closed_sequential_limits by fast  | 
|
4444  | 
qed  | 
|
4445  | 
||
4446  | 
lemma closed_compact_sums:  | 
|
4447  | 
fixes s t :: "'a::real_normed_vector set"  | 
|
4448  | 
assumes "closed s" "compact t"  | 
|
4449  | 
  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4450  | 
proof-  | 
|
4451  | 
  have "{x + y |x y. x \<in> t \<and> y \<in> s} = {x + y |x y. x \<in> s \<and> y \<in> t}" apply auto
 | 
|
4452  | 
apply(rule_tac x=y in exI) apply auto apply(rule_tac x=y in exI) by auto  | 
|
4453  | 
thus ?thesis using compact_closed_sums[OF assms(2,1)] by simp  | 
|
4454  | 
qed  | 
|
4455  | 
||
4456  | 
lemma compact_closed_differences:  | 
|
4457  | 
fixes s t :: "'a::real_normed_vector set"  | 
|
4458  | 
assumes "compact s" "closed t"  | 
|
4459  | 
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4460  | 
proof-  | 
|
4461  | 
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} =  {x - y |x y. x \<in> s \<and> y \<in> t}"
 | 
|
4462  | 
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto  | 
|
4463  | 
thus ?thesis using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto  | 
|
4464  | 
qed  | 
|
4465  | 
||
4466  | 
lemma closed_compact_differences:  | 
|
4467  | 
fixes s t :: "'a::real_normed_vector set"  | 
|
4468  | 
assumes "closed s" "compact t"  | 
|
4469  | 
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | 
|
4470  | 
proof-  | 
|
4471  | 
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
 | 
|
4472  | 
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto  | 
|
4473  | 
thus ?thesis using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp  | 
|
4474  | 
qed  | 
|
4475  | 
||
4476  | 
lemma closed_translation:  | 
|
4477  | 
fixes a :: "'a::real_normed_vector"  | 
|
4478  | 
assumes "closed s" shows "closed ((\<lambda>x. a + x) ` s)"  | 
|
4479  | 
proof-  | 
|
4480  | 
  have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
 | 
|
4481  | 
thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto  | 
|
4482  | 
qed  | 
|
4483  | 
||
| 34105 | 4484  | 
lemma translation_Compl:  | 
4485  | 
fixes a :: "'a::ab_group_add"  | 
|
4486  | 
shows "(\<lambda>x. a + x) ` (- t) = - ((\<lambda>x. a + x) ` t)"  | 
|
4487  | 
apply (auto simp add: image_iff) apply(rule_tac x="x - a" in bexI) by auto  | 
|
4488  | 
||
| 33175 | 4489  | 
lemma translation_UNIV:  | 
4490  | 
fixes a :: "'a::ab_group_add" shows "range (\<lambda>x. a + x) = UNIV"  | 
|
4491  | 
apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto  | 
|
4492  | 
||
4493  | 
lemma translation_diff:  | 
|
4494  | 
fixes a :: "'a::ab_group_add"  | 
|
4495  | 
shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)"  | 
|
4496  | 
by auto  | 
|
4497  | 
||
4498  | 
lemma closure_translation:  | 
|
4499  | 
fixes a :: "'a::real_normed_vector"  | 
|
4500  | 
shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)"  | 
|
4501  | 
proof-  | 
|
| 34105 | 4502  | 
have *:"op + a ` (- s) = - op + a ` s"  | 
| 33175 | 4503  | 
apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto  | 
| 34105 | 4504  | 
show ?thesis unfolding closure_interior translation_Compl  | 
4505  | 
using interior_translation[of a "- s"] unfolding * by auto  | 
|
| 33175 | 4506  | 
qed  | 
4507  | 
||
4508  | 
lemma frontier_translation:  | 
|
4509  | 
fixes a :: "'a::real_normed_vector"  | 
|
4510  | 
shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)"  | 
|
4511  | 
unfolding frontier_def translation_diff interior_translation closure_translation by auto  | 
|
4512  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4513  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4514  | 
subsection {* Separation between points and sets *}
 | 
| 33175 | 4515  | 
|
4516  | 
lemma separate_point_closed:  | 
|
4517  | 
fixes s :: "'a::heine_borel set"  | 
|
4518  | 
shows "closed s \<Longrightarrow> a \<notin> s ==> (\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x)"  | 
|
4519  | 
proof(cases "s = {}")
 | 
|
4520  | 
case True  | 
|
4521  | 
thus ?thesis by(auto intro!: exI[where x=1])  | 
|
4522  | 
next  | 
|
4523  | 
case False  | 
|
4524  | 
assume "closed s" "a \<notin> s"  | 
|
4525  | 
  then obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" using `s \<noteq> {}` distance_attains_inf [of s a] by blast
 | 
|
4526  | 
with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast  | 
|
4527  | 
qed  | 
|
4528  | 
||
4529  | 
lemma separate_compact_closed:  | 
|
4530  | 
  fixes s t :: "'a::{heine_borel, real_normed_vector} set"
 | 
|
4531  | 
(* TODO: does this generalize to heine_borel? *)  | 
|
4532  | 
  assumes "compact s" and "closed t" and "s \<inter> t = {}"
 | 
|
4533  | 
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"  | 
|
4534  | 
proof-  | 
|
4535  | 
  have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto
 | 
|
4536  | 
  then obtain d where "d>0" and d:"\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. d \<le> dist 0 x"
 | 
|
4537  | 
using separate_point_closed[OF compact_closed_differences[OF assms(1,2)], of 0] by auto  | 
|
4538  | 
  { fix x y assume "x\<in>s" "y\<in>t"
 | 
|
4539  | 
    hence "x - y \<in> {x - y |x y. x \<in> s \<and> y \<in> t}" by auto
 | 
|
4540  | 
hence "d \<le> dist (x - y) 0" using d[THEN bspec[where x="x - y"]] using dist_commute  | 
|
4541  | 
by (auto simp add: dist_commute)  | 
|
4542  | 
hence "d \<le> dist x y" unfolding dist_norm by auto }  | 
|
4543  | 
thus ?thesis using `d>0` by auto  | 
|
4544  | 
qed  | 
|
4545  | 
||
4546  | 
lemma separate_closed_compact:  | 
|
4547  | 
  fixes s t :: "'a::{heine_borel, real_normed_vector} set"
 | 
|
4548  | 
  assumes "closed s" and "compact t" and "s \<inter> t = {}"
 | 
|
4549  | 
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"  | 
|
4550  | 
proof-  | 
|
4551  | 
  have *:"t \<inter> s = {}" using assms(3) by auto
 | 
|
4552  | 
show ?thesis using separate_compact_closed[OF assms(2,1) *]  | 
|
4553  | 
apply auto apply(rule_tac x=d in exI) apply auto apply (erule_tac x=y in ballE)  | 
|
4554  | 
by (auto simp add: dist_commute)  | 
|
4555  | 
qed  | 
|
4556  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4557  | 
|
| 36439 | 4558  | 
subsection {* Intervals *}
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4559  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4560  | 
lemma interval: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4561  | 
  "{a <..< b} = {x::'a. \<forall>i<DIM('a). a$$i < x$$i \<and> x$$i < b$$i}" and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4562  | 
  "{a .. b} = {x::'a. \<forall>i<DIM('a). a$$i \<le> x$$i \<and> x$$i \<le> b$$i}"
 | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
4563  | 
by(auto simp add:set_eq_iff eucl_le[where 'a='a] eucl_less[where 'a='a])  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4564  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4565  | 
lemma mem_interval: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4566  | 
  "x \<in> {a<..<b} \<longleftrightarrow> (\<forall>i<DIM('a). a$$i < x$$i \<and> x$$i < b$$i)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4567  | 
  "x \<in> {a .. b} \<longleftrightarrow> (\<forall>i<DIM('a). a$$i \<le> x$$i \<and> x$$i \<le> b$$i)"
 | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
4568  | 
using interval[of a b] by(auto simp add: set_eq_iff eucl_le[where 'a='a] eucl_less[where 'a='a])  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4569  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4570  | 
lemma interval_eq_empty: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4571  | 
 "({a <..< b} = {} \<longleftrightarrow> (\<exists>i<DIM('a). b$$i \<le> a$$i))" (is ?th1) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4572  | 
 "({a  ..  b} = {} \<longleftrightarrow> (\<exists>i<DIM('a). b$$i < a$$i))" (is ?th2)
 | 
| 33175 | 4573  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4574  | 
  { fix i x assume i:"i<DIM('a)" and as:"b$$i \<le> a$$i" and x:"x\<in>{a <..< b}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4575  | 
hence "a $$ i < x $$ i \<and> x $$ i < b $$ i" unfolding mem_interval by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4576  | 
hence "a$$i < b$$i" by auto  | 
| 33175 | 4577  | 
hence False using as by auto }  | 
4578  | 
moreover  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4579  | 
  { assume as:"\<forall>i<DIM('a). \<not> (b$$i \<le> a$$i)"
 | 
| 33175 | 4580  | 
let ?x = "(1/2) *\<^sub>R (a + b)"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4581  | 
    { fix i assume i:"i<DIM('a)" 
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4582  | 
have "a$$i < b$$i" using as[THEN spec[where x=i]] using i by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4583  | 
hence "a$$i < ((1/2) *\<^sub>R (a+b)) $$ i" "((1/2) *\<^sub>R (a+b)) $$ i < b$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4584  | 
unfolding euclidean_simps by auto }  | 
| 33175 | 4585  | 
    hence "{a <..< b} \<noteq> {}" using mem_interval(1)[of "?x" a b] by auto  }
 | 
4586  | 
ultimately show ?th1 by blast  | 
|
4587  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4588  | 
  { fix i x assume i:"i<DIM('a)" and as:"b$$i < a$$i" and x:"x\<in>{a .. b}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4589  | 
hence "a $$ i \<le> x $$ i \<and> x $$ i \<le> b $$ i" unfolding mem_interval by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4590  | 
hence "a$$i \<le> b$$i" by auto  | 
| 33175 | 4591  | 
hence False using as by auto }  | 
4592  | 
moreover  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4593  | 
  { assume as:"\<forall>i<DIM('a). \<not> (b$$i < a$$i)"
 | 
| 33175 | 4594  | 
let ?x = "(1/2) *\<^sub>R (a + b)"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4595  | 
    { fix i assume i:"i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4596  | 
have "a$$i \<le> b$$i" using as[THEN spec[where x=i]] by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4597  | 
hence "a$$i \<le> ((1/2) *\<^sub>R (a+b)) $$ i" "((1/2) *\<^sub>R (a+b)) $$ i \<le> b$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4598  | 
unfolding euclidean_simps by auto }  | 
| 33175 | 4599  | 
    hence "{a .. b} \<noteq> {}" using mem_interval(2)[of "?x" a b] by auto  }
 | 
4600  | 
ultimately show ?th2 by blast  | 
|
4601  | 
qed  | 
|
4602  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4603  | 
lemma interval_ne_empty: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4604  | 
  "{a  ..  b} \<noteq> {} \<longleftrightarrow> (\<forall>i<DIM('a). a$$i \<le> b$$i)" and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4605  | 
  "{a <..< b} \<noteq> {} \<longleftrightarrow> (\<forall>i<DIM('a). a$$i < b$$i)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4606  | 
unfolding interval_eq_empty[of a b] by fastsimp+  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4607  | 
|
| 44584 | 4608  | 
lemma interval_sing:  | 
4609  | 
fixes a :: "'a::ordered_euclidean_space"  | 
|
4610  | 
  shows "{a .. a} = {a}" and "{a<..<a} = {}"
 | 
|
4611  | 
unfolding set_eq_iff mem_interval eq_iff [symmetric]  | 
|
4612  | 
by (auto simp add: euclidean_eq[where 'a='a] eq_commute  | 
|
4613  | 
eucl_less[where 'a='a] eucl_le[where 'a='a])  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4614  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4615  | 
lemma subset_interval_imp: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4616  | 
 "(\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i) \<Longrightarrow> {c .. d} \<subseteq> {a .. b}" and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4617  | 
 "(\<forall>i<DIM('a). a$$i < c$$i \<and> d$$i < b$$i) \<Longrightarrow> {c .. d} \<subseteq> {a<..<b}" and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4618  | 
 "(\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i) \<Longrightarrow> {c<..<d} \<subseteq> {a .. b}" and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4619  | 
 "(\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i) \<Longrightarrow> {c<..<d} \<subseteq> {a<..<b}"
 | 
| 44584 | 4620  | 
unfolding subset_eq[unfolded Ball_def] unfolding mem_interval  | 
4621  | 
by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+  | 
|
4622  | 
||
4623  | 
lemma interval_open_subset_closed:  | 
|
4624  | 
fixes a :: "'a::ordered_euclidean_space"  | 
|
4625  | 
  shows "{a<..<b} \<subseteq> {a .. b}"
 | 
|
4626  | 
unfolding subset_eq [unfolded Ball_def] mem_interval  | 
|
4627  | 
by (fast intro: less_imp_le)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4628  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4629  | 
lemma subset_interval: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4630  | 
 "{c .. d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i<DIM('a). c$$i \<le> d$$i) --> (\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i)" (is ?th1) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4631  | 
 "{c .. d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i<DIM('a). c$$i \<le> d$$i) --> (\<forall>i<DIM('a). a$$i < c$$i \<and> d$$i < b$$i)" (is ?th2) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4632  | 
 "{c<..<d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i<DIM('a). c$$i < d$$i) --> (\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i)" (is ?th3) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4633  | 
 "{c<..<d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i<DIM('a). c$$i < d$$i) --> (\<forall>i<DIM('a). a$$i \<le> c$$i \<and> d$$i \<le> b$$i)" (is ?th4)
 | 
| 33175 | 4634  | 
proof-  | 
4635  | 
show ?th1 unfolding subset_eq and Ball_def and mem_interval by (auto intro: order_trans)  | 
|
4636  | 
show ?th2 unfolding subset_eq and Ball_def and mem_interval by (auto intro: le_less_trans less_le_trans order_trans less_imp_le)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4637  | 
  { assume as: "{c<..<d} \<subseteq> {a .. b}" "\<forall>i<DIM('a). c$$i < d$$i"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4638  | 
    hence "{c<..<d} \<noteq> {}" unfolding interval_eq_empty by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4639  | 
    fix i assume i:"i<DIM('a)"
 | 
| 33175 | 4640  | 
(** TODO combine the following two parts as done in the HOL_light version. **)  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4641  | 
    { let ?x = "(\<chi>\<chi> j. (if j=i then ((min (a$$j) (d$$j))+c$$j)/2 else (c$$j+d$$j)/2))::'a"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4642  | 
assume as2: "a$$i > c$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4643  | 
      { fix j assume j:"j<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4644  | 
hence "c $$ j < ?x $$ j \<and> ?x $$ j < d $$ j"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4645  | 
apply(cases "j=i") using as(2)[THEN spec[where x=j]] i  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4646  | 
by (auto simp add: as2) }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4647  | 
      hence "?x\<in>{c<..<d}" using i unfolding mem_interval by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4648  | 
moreover  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4649  | 
      have "?x\<notin>{a .. b}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4650  | 
unfolding mem_interval apply auto apply(rule_tac x=i in exI)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4651  | 
using as(2)[THEN spec[where x=i]] and as2 i  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4652  | 
by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4653  | 
ultimately have False using as by auto }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4654  | 
hence "a$$i \<le> c$$i" by(rule ccontr)auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4655  | 
moreover  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4656  | 
    { let ?x = "(\<chi>\<chi> j. (if j=i then ((max (b$$j) (c$$j))+d$$j)/2 else (c$$j+d$$j)/2))::'a"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4657  | 
assume as2: "b$$i < d$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4658  | 
      { fix j assume "j<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4659  | 
hence "d $$ j > ?x $$ j \<and> ?x $$ j > c $$ j"  | 
| 33175 | 4660  | 
apply(cases "j=i") using as(2)[THEN spec[where x=j]]  | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4661  | 
by (auto simp add: as2) }  | 
| 33175 | 4662  | 
      hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
 | 
4663  | 
moreover  | 
|
4664  | 
      have "?x\<notin>{a .. b}"
 | 
|
4665  | 
unfolding mem_interval apply auto apply(rule_tac x=i in exI)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4666  | 
using as(2)[THEN spec[where x=i]] and as2 using i  | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4667  | 
by auto  | 
| 33175 | 4668  | 
ultimately have False using as by auto }  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4669  | 
hence "b$$i \<ge> d$$i" by(rule ccontr)auto  | 
| 33175 | 4670  | 
ultimately  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4671  | 
have "a$$i \<le> c$$i \<and> d$$i \<le> b$$i" by auto  | 
| 33175 | 4672  | 
} note part1 = this  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4673  | 
show ?th3 unfolding subset_eq and Ball_def and mem_interval  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4674  | 
apply(rule,rule,rule,rule) apply(rule part1) unfolding subset_eq and Ball_def and mem_interval  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4675  | 
prefer 4 apply auto by(erule_tac x=i in allE,erule_tac x=i in allE,fastsimp)+  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4676  | 
  { assume as:"{c<..<d} \<subseteq> {a<..<b}" "\<forall>i<DIM('a). c$$i < d$$i"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4677  | 
    fix i assume i:"i<DIM('a)"
 | 
| 33175 | 4678  | 
    from as(1) have "{c<..<d} \<subseteq> {a..b}" using interval_open_subset_closed[of a b] by auto
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4679  | 
hence "a$$i \<le> c$$i \<and> d$$i \<le> b$$i" using part1 and as(2) using i by auto } note * = this  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4680  | 
show ?th4 unfolding subset_eq and Ball_def and mem_interval  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4681  | 
apply(rule,rule,rule,rule) apply(rule *) unfolding subset_eq and Ball_def and mem_interval prefer 4  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4682  | 
apply auto by(erule_tac x=i in allE, simp)+  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4683  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4684  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4685  | 
lemma disjoint_interval: fixes a::"'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4686  | 
  "{a .. b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i<DIM('a). (b$$i < a$$i \<or> d$$i < c$$i \<or> b$$i < c$$i \<or> d$$i < a$$i))" (is ?th1) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4687  | 
  "{a .. b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i<DIM('a). (b$$i < a$$i \<or> d$$i \<le> c$$i \<or> b$$i \<le> c$$i \<or> d$$i \<le> a$$i))" (is ?th2) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4688  | 
  "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i<DIM('a). (b$$i \<le> a$$i \<or> d$$i < c$$i \<or> b$$i \<le> c$$i \<or> d$$i \<le> a$$i))" (is ?th3) and
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4689  | 
  "{a<..<b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i<DIM('a). (b$$i \<le> a$$i \<or> d$$i \<le> c$$i \<or> b$$i \<le> c$$i \<or> d$$i \<le> a$$i))" (is ?th4)
 | 
| 33175 | 4690  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4691  | 
let ?z = "(\<chi>\<chi> i. ((max (a$$i) (c$$i)) + (min (b$$i) (d$$i))) / 2)::'a"  | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
4692  | 
note * = set_eq_iff Int_iff empty_iff mem_interval all_conj_distrib[THEN sym] eq_False  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4693  | 
show ?th1 unfolding * apply safe apply(erule_tac x="?z" in allE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4694  | 
unfolding not_all apply(erule exE,rule_tac x=x in exI) apply(erule_tac[2-] x=i in allE) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4695  | 
show ?th2 unfolding * apply safe apply(erule_tac x="?z" in allE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4696  | 
unfolding not_all apply(erule exE,rule_tac x=x in exI) apply(erule_tac[2-] x=i in allE) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4697  | 
show ?th3 unfolding * apply safe apply(erule_tac x="?z" in allE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4698  | 
unfolding not_all apply(erule exE,rule_tac x=x in exI) apply(erule_tac[2-] x=i in allE) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4699  | 
show ?th4 unfolding * apply safe apply(erule_tac x="?z" in allE)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4700  | 
unfolding not_all apply(erule exE,rule_tac x=x in exI) apply(erule_tac[2-] x=i in allE) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4701  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4702  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4703  | 
lemma inter_interval: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4704  | 
 "{a .. b} \<inter> {c .. d} =  {(\<chi>\<chi> i. max (a$$i) (c$$i)) .. (\<chi>\<chi> i. min (b$$i) (d$$i))}"
 | 
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
4705  | 
unfolding set_eq_iff and Int_iff and mem_interval  | 
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
4706  | 
by auto  | 
| 33175 | 4707  | 
|
4708  | 
(* Moved interval_open_subset_closed a bit upwards *)  | 
|
4709  | 
||
| 
44250
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4710  | 
lemma open_interval[intro]:  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4711  | 
  fixes a b :: "'a::ordered_euclidean_space" shows "open {a<..<b}"
 | 
| 33175 | 4712  | 
proof-  | 
| 
44250
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4713  | 
  have "open (\<Inter>i<DIM('a). (\<lambda>x. x$$i) -` {a$$i<..<b$$i})"
 | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4714  | 
by (intro open_INT finite_lessThan ballI continuous_open_vimage allI  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4715  | 
linear_continuous_at bounded_linear_euclidean_component  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4716  | 
open_real_greaterThanLessThan)  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4717  | 
  also have "(\<Inter>i<DIM('a). (\<lambda>x. x$$i) -` {a$$i<..<b$$i}) = {a<..<b}"
 | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4718  | 
by (auto simp add: eucl_less [where 'a='a])  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4719  | 
  finally show "open {a<..<b}" .
 | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4720  | 
qed  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4721  | 
|
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4722  | 
lemma closed_interval[intro]:  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4723  | 
  fixes a b :: "'a::ordered_euclidean_space" shows "closed {a .. b}"
 | 
| 33175 | 4724  | 
proof-  | 
| 
44250
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4725  | 
  have "closed (\<Inter>i<DIM('a). (\<lambda>x. x$$i) -` {a$$i .. b$$i})"
 | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4726  | 
by (intro closed_INT ballI continuous_closed_vimage allI  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4727  | 
linear_continuous_at bounded_linear_euclidean_component  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4728  | 
closed_real_atLeastAtMost)  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4729  | 
  also have "(\<Inter>i<DIM('a). (\<lambda>x. x$$i) -` {a$$i .. b$$i}) = {a .. b}"
 | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4730  | 
by (auto simp add: eucl_le [where 'a='a])  | 
| 
 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 
huffman 
parents: 
44233 
diff
changeset
 | 
4731  | 
  finally show "closed {a .. b}" .
 | 
| 33175 | 4732  | 
qed  | 
4733  | 
||
| 44519 | 4734  | 
lemma interior_closed_interval [intro]:  | 
4735  | 
fixes a b :: "'a::ordered_euclidean_space"  | 
|
4736  | 
  shows "interior {a..b} = {a<..<b}" (is "?L = ?R")
 | 
|
| 33175 | 4737  | 
proof(rule subset_antisym)  | 
| 44519 | 4738  | 
show "?R \<subseteq> ?L" using interval_open_subset_closed open_interval  | 
4739  | 
by (rule interior_maximal)  | 
|
| 33175 | 4740  | 
next  | 
| 44519 | 4741  | 
  { fix x assume "x \<in> interior {a..b}"
 | 
4742  | 
    then obtain s where s:"open s" "x \<in> s" "s \<subseteq> {a..b}" ..
 | 
|
| 33175 | 4743  | 
    then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> {a..b}" unfolding open_dist and subset_eq by auto
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4744  | 
    { fix i assume i:"i<DIM('a)"
 | 
| 33175 | 4745  | 
have "dist (x - (e / 2) *\<^sub>R basis i) x < e"  | 
4746  | 
"dist (x + (e / 2) *\<^sub>R basis i) x < e"  | 
|
4747  | 
unfolding dist_norm apply auto  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4748  | 
unfolding norm_minus_cancel using norm_basis and `e>0` by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4749  | 
hence "a $$ i \<le> (x - (e / 2) *\<^sub>R basis i) $$ i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4750  | 
"(x + (e / 2) *\<^sub>R basis i) $$ i \<le> b $$ i"  | 
| 33175 | 4751  | 
using e[THEN spec[where x="x - (e/2) *\<^sub>R basis i"]]  | 
4752  | 
and e[THEN spec[where x="x + (e/2) *\<^sub>R basis i"]]  | 
|
| 44584 | 4753  | 
unfolding mem_interval using i by blast+  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4754  | 
hence "a $$ i < x $$ i" and "x $$ i < b $$ i" unfolding euclidean_simps  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4755  | 
unfolding basis_component using `e>0` i by auto }  | 
| 33175 | 4756  | 
    hence "x \<in> {a<..<b}" unfolding mem_interval by auto  }
 | 
| 44519 | 4757  | 
thus "?L \<subseteq> ?R" ..  | 
| 33175 | 4758  | 
qed  | 
4759  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4760  | 
lemma bounded_closed_interval: fixes a :: "'a::ordered_euclidean_space" shows "bounded {a .. b}"
 | 
| 33175 | 4761  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4762  | 
  let ?b = "\<Sum>i<DIM('a). \<bar>a$$i\<bar> + \<bar>b$$i\<bar>"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4763  | 
  { fix x::"'a" assume x:"\<forall>i<DIM('a). a $$ i \<le> x $$ i \<and> x $$ i \<le> b $$ i"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4764  | 
    { fix i assume "i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4765  | 
hence "\<bar>x$$i\<bar> \<le> \<bar>a$$i\<bar> + \<bar>b$$i\<bar>" using x[THEN spec[where x=i]] by auto }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4766  | 
    hence "(\<Sum>i<DIM('a). \<bar>x $$ i\<bar>) \<le> ?b" apply-apply(rule setsum_mono) by auto
 | 
| 33175 | 4767  | 
hence "norm x \<le> ?b" using norm_le_l1[of x] by auto }  | 
4768  | 
thus ?thesis unfolding interval and bounded_iff by auto  | 
|
4769  | 
qed  | 
|
4770  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4771  | 
lemma bounded_interval: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 33175 | 4772  | 
 "bounded {a .. b} \<and> bounded {a<..<b}"
 | 
4773  | 
using bounded_closed_interval[of a b]  | 
|
4774  | 
using interval_open_subset_closed[of a b]  | 
|
4775  | 
  using bounded_subset[of "{a..b}" "{a<..<b}"]
 | 
|
4776  | 
by simp  | 
|
4777  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4778  | 
lemma not_interval_univ: fixes a :: "'a::ordered_euclidean_space" shows  | 
| 33175 | 4779  | 
 "({a .. b} \<noteq> UNIV) \<and> ({a<..<b} \<noteq> UNIV)"
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4780  | 
using bounded_interval[of a b] by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4781  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4782  | 
lemma compact_interval: fixes a :: "'a::ordered_euclidean_space" shows "compact {a .. b}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4783  | 
  using bounded_closed_imp_compact[of "{a..b}"] using bounded_interval[of a b]
 | 
| 33175 | 4784  | 
by auto  | 
4785  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4786  | 
lemma open_interval_midpoint: fixes a :: "'a::ordered_euclidean_space"  | 
| 33175 | 4787  | 
  assumes "{a<..<b} \<noteq> {}" shows "((1/2) *\<^sub>R (a + b)) \<in> {a<..<b}"
 | 
4788  | 
proof-  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4789  | 
  { fix i assume "i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4790  | 
hence "a $$ i < ((1 / 2) *\<^sub>R (a + b)) $$ i \<and> ((1 / 2) *\<^sub>R (a + b)) $$ i < b $$ i"  | 
| 33175 | 4791  | 
using assms[unfolded interval_ne_empty, THEN spec[where x=i]]  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4792  | 
unfolding euclidean_simps by auto }  | 
| 33175 | 4793  | 
thus ?thesis unfolding mem_interval by auto  | 
4794  | 
qed  | 
|
4795  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4796  | 
lemma open_closed_interval_convex: fixes x :: "'a::ordered_euclidean_space"  | 
| 33175 | 4797  | 
  assumes x:"x \<in> {a<..<b}" and y:"y \<in> {a .. b}" and e:"0 < e" "e \<le> 1"
 | 
4798  | 
  shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> {a<..<b}"
 | 
|
4799  | 
proof-  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4800  | 
  { fix i assume i:"i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4801  | 
have "a $$ i = e * a$$i + (1 - e) * a$$i" unfolding left_diff_distrib by simp  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4802  | 
also have "\<dots> < e * x $$ i + (1 - e) * y $$ i" apply(rule add_less_le_mono)  | 
| 33175 | 4803  | 
using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4804  | 
using x unfolding mem_interval using i apply simp  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4805  | 
using y unfolding mem_interval using i apply simp  | 
| 33175 | 4806  | 
done  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4807  | 
finally have "a $$ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $$ i" unfolding euclidean_simps by auto  | 
| 33175 | 4808  | 
    moreover {
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4809  | 
have "b $$ i = e * b$$i + (1 - e) * b$$i" unfolding left_diff_distrib by simp  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4810  | 
also have "\<dots> > e * x $$ i + (1 - e) * y $$ i" apply(rule add_less_le_mono)  | 
| 33175 | 4811  | 
using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4812  | 
using x unfolding mem_interval using i apply simp  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4813  | 
using y unfolding mem_interval using i apply simp  | 
| 33175 | 4814  | 
done  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4815  | 
finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) $$ i < b $$ i" unfolding euclidean_simps by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4816  | 
} ultimately have "a $$ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $$ i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) $$ i < b $$ i" by auto }  | 
| 33175 | 4817  | 
thus ?thesis unfolding mem_interval by auto  | 
4818  | 
qed  | 
|
4819  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4820  | 
lemma closure_open_interval: fixes a :: "'a::ordered_euclidean_space"  | 
| 33175 | 4821  | 
  assumes "{a<..<b} \<noteq> {}"
 | 
4822  | 
  shows "closure {a<..<b} = {a .. b}"
 | 
|
4823  | 
proof-  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4824  | 
have ab:"a < b" using assms[unfolded interval_ne_empty] apply(subst eucl_less) by auto  | 
| 33175 | 4825  | 
let ?c = "(1 / 2) *\<^sub>R (a + b)"  | 
4826  | 
  { fix x assume as:"x \<in> {a .. b}"
 | 
|
4827  | 
def f == "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)"  | 
|
4828  | 
    { fix n assume fn:"f n < b \<longrightarrow> a < f n \<longrightarrow> f n = x" and xc:"x \<noteq> ?c"
 | 
|
4829  | 
have *:"0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" unfolding inverse_le_1_iff by auto  | 
|
4830  | 
have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x =  | 
|
4831  | 
x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)"  | 
|
4832  | 
by (auto simp add: algebra_simps)  | 
|
4833  | 
hence "f n < b" and "a < f n" using open_closed_interval_convex[OF open_interval_midpoint[OF assms] as *] unfolding f_def by auto  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4834  | 
hence False using fn unfolding f_def using xc by auto }  | 
| 33175 | 4835  | 
moreover  | 
4836  | 
    { assume "\<not> (f ---> x) sequentially"
 | 
|
4837  | 
      { fix e::real assume "e>0"
 | 
|
4838  | 
hence "\<exists>N::nat. inverse (real (N + 1)) < e" using real_arch_inv[of e] apply (auto simp add: Suc_pred') apply(rule_tac x="n - 1" in exI) by auto  | 
|
4839  | 
then obtain N::nat where "inverse (real (N + 1)) < e" by auto  | 
|
4840  | 
hence "\<forall>n\<ge>N. inverse (real n + 1) < e" by (auto, metis Suc_le_mono le_SucE less_imp_inverse_less nat_le_real_less order_less_trans real_of_nat_Suc real_of_nat_Suc_gt_zero)  | 
|
4841  | 
hence "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto }  | 
|
4842  | 
hence "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially"  | 
|
4843  | 
unfolding Lim_sequentially by(auto simp add: dist_norm)  | 
|
4844  | 
hence "(f ---> x) sequentially" unfolding f_def  | 
|
| 44125 | 4845  | 
using tendsto_add[OF tendsto_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]  | 
| 
44282
 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 
huffman 
parents: 
44252 
diff
changeset
 | 
4846  | 
using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] by auto }  | 
| 33175 | 4847  | 
    ultimately have "x \<in> closure {a<..<b}"
 | 
4848  | 
using as and open_interval_midpoint[OF assms] unfolding closure_def unfolding islimpt_sequential by(cases "x=?c")auto }  | 
|
4849  | 
thus ?thesis using closure_minimal[OF interval_open_subset_closed closed_interval, of a b] by blast  | 
|
4850  | 
qed  | 
|
4851  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4852  | 
lemma bounded_subset_open_interval_symmetric: fixes s::"('a::ordered_euclidean_space) set"
 | 
| 33175 | 4853  | 
  assumes "bounded s"  shows "\<exists>a. s \<subseteq> {-a<..<a}"
 | 
4854  | 
proof-  | 
|
4855  | 
obtain b where "b>0" and b:"\<forall>x\<in>s. norm x \<le> b" using assms[unfolded bounded_pos] by auto  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4856  | 
def a \<equiv> "(\<chi>\<chi> i. b+1)::'a"  | 
| 33175 | 4857  | 
  { fix x assume "x\<in>s"
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4858  | 
    fix i assume i:"i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4859  | 
hence "(-a)$$i < x$$i" and "x$$i < a$$i" using b[THEN bspec[where x=x], OF `x\<in>s`]  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4860  | 
and component_le_norm[of x i] unfolding euclidean_simps and a_def by auto }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4861  | 
thus ?thesis by(auto intro: exI[where x=a] simp add: eucl_less[where 'a='a])  | 
| 33175 | 4862  | 
qed  | 
4863  | 
||
4864  | 
lemma bounded_subset_open_interval:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4865  | 
  fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 4866  | 
  shows "bounded s ==> (\<exists>a b. s \<subseteq> {a<..<b})"
 | 
4867  | 
by (auto dest!: bounded_subset_open_interval_symmetric)  | 
|
4868  | 
||
4869  | 
lemma bounded_subset_closed_interval_symmetric:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4870  | 
  fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 4871  | 
  assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a .. a}"
 | 
4872  | 
proof-  | 
|
4873  | 
  obtain a where "s \<subseteq> {- a<..<a}" using bounded_subset_open_interval_symmetric[OF assms] by auto
 | 
|
4874  | 
thus ?thesis using interval_open_subset_closed[of "-a" a] by auto  | 
|
4875  | 
qed  | 
|
4876  | 
||
4877  | 
lemma bounded_subset_closed_interval:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4878  | 
  fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 4879  | 
  shows "bounded s ==> (\<exists>a b. s \<subseteq> {a .. b})"
 | 
4880  | 
using bounded_subset_closed_interval_symmetric[of s] by auto  | 
|
4881  | 
||
4882  | 
lemma frontier_closed_interval:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4883  | 
fixes a b :: "'a::ordered_euclidean_space"  | 
| 33175 | 4884  | 
  shows "frontier {a .. b} = {a .. b} - {a<..<b}"
 | 
4885  | 
unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] ..  | 
|
4886  | 
||
4887  | 
lemma frontier_open_interval:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4888  | 
fixes a b :: "'a::ordered_euclidean_space"  | 
| 33175 | 4889  | 
  shows "frontier {a<..<b} = (if {a<..<b} = {} then {} else {a .. b} - {a<..<b})"
 | 
4890  | 
proof(cases "{a<..<b} = {}")
 | 
|
4891  | 
case True thus ?thesis using frontier_empty by auto  | 
|
4892  | 
next  | 
|
4893  | 
case False thus ?thesis unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] by auto  | 
|
4894  | 
qed  | 
|
4895  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4896  | 
lemma inter_interval_mixed_eq_empty: fixes a :: "'a::ordered_euclidean_space"  | 
| 33175 | 4897  | 
  assumes "{c<..<d} \<noteq> {}"  shows "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> {a<..<b} \<inter> {c<..<d} = {}"
 | 
4898  | 
unfolding closure_open_interval[OF assms, THEN sym] unfolding open_inter_closure_eq_empty[OF open_interval] ..  | 
|
4899  | 
||
4900  | 
||
4901  | 
(* Some stuff for half-infinite intervals too; FIXME: notation? *)  | 
|
4902  | 
||
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
4903  | 
lemma closed_interval_left: fixes b::"'a::euclidean_space"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4904  | 
  shows "closed {x::'a. \<forall>i<DIM('a). x$$i \<le> b$$i}"
 | 
| 33175 | 4905  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4906  | 
  { fix i assume i:"i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4907  | 
    fix x::"'a" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i<DIM('a). x $$ i \<le> b $$ i}. x' \<noteq> x \<and> dist x' x < e"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4908  | 
    { assume "x$$i > b$$i"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4909  | 
then obtain y where "y $$ i \<le> b $$ i" "y \<noteq> x" "dist y x < x$$i - b$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4910  | 
using x[THEN spec[where x="x$$i - b$$i"]] using i by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4911  | 
hence False using component_le_norm[of "y - x" i] unfolding dist_norm euclidean_simps using i  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4912  | 
by auto }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4913  | 
hence "x$$i \<le> b$$i" by(rule ccontr)auto }  | 
| 33175 | 4914  | 
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast  | 
4915  | 
qed  | 
|
4916  | 
||
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
4917  | 
lemma closed_interval_right: fixes a::"'a::euclidean_space"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4918  | 
  shows "closed {x::'a. \<forall>i<DIM('a). a$$i \<le> x$$i}"
 | 
| 33175 | 4919  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4920  | 
  { fix i assume i:"i<DIM('a)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4921  | 
    fix x::"'a" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i<DIM('a). a $$ i \<le> x $$ i}. x' \<noteq> x \<and> dist x' x < e"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4922  | 
    { assume "a$$i > x$$i"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4923  | 
then obtain y where "a $$ i \<le> y $$ i" "y \<noteq> x" "dist y x < a$$i - x$$i"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4924  | 
using x[THEN spec[where x="a$$i - x$$i"]] i by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4925  | 
hence False using component_le_norm[of "y - x" i] unfolding dist_norm and euclidean_simps by auto }  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4926  | 
hence "a$$i \<le> x$$i" by(rule ccontr)auto }  | 
| 33175 | 4927  | 
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast  | 
4928  | 
qed  | 
|
4929  | 
||
| 36439 | 4930  | 
text {* Intervals in general, including infinite and mixtures of open and closed. *}
 | 
| 33175 | 4931  | 
|
| 
37732
 
6432bf0d7191
generalize type of is_interval to class euclidean_space
 
huffman 
parents: 
37680 
diff
changeset
 | 
4932  | 
definition "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4933  | 
  (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i<DIM('a). ((a$$i \<le> x$$i \<and> x$$i \<le> b$$i) \<or> (b$$i \<le> x$$i \<and> x$$i \<le> a$$i))) \<longrightarrow> x \<in> s)"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4934  | 
|
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
4935  | 
lemma is_interval_interval: "is_interval {a .. b::'a::ordered_euclidean_space}" (is ?th1)
 | 
| 
39086
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
4936  | 
  "is_interval {a<..<b}" (is ?th2) proof -
 | 
| 33175 | 4937  | 
show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff  | 
| 44584 | 4938  | 
by(meson order_trans le_less_trans less_le_trans less_trans)+ qed  | 
| 33175 | 4939  | 
|
4940  | 
lemma is_interval_empty:  | 
|
4941  | 
 "is_interval {}"
 | 
|
4942  | 
unfolding is_interval_def  | 
|
4943  | 
by simp  | 
|
4944  | 
||
4945  | 
lemma is_interval_univ:  | 
|
4946  | 
"is_interval UNIV"  | 
|
4947  | 
unfolding is_interval_def  | 
|
4948  | 
by simp  | 
|
4949  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4950  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
4951  | 
subsection {* Closure of halfspaces and hyperplanes *}
 | 
| 33175 | 4952  | 
|
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4953  | 
lemma isCont_open_vimage:  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4954  | 
assumes "\<And>x. isCont f x" and "open s" shows "open (f -` s)"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4955  | 
proof -  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4956  | 
from assms(1) have "continuous_on UNIV f"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4957  | 
unfolding isCont_def continuous_on_def within_UNIV by simp  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4958  | 
  hence "open {x \<in> UNIV. f x \<in> s}"
 | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4959  | 
using open_UNIV `open s` by (rule continuous_open_preimage)  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4960  | 
thus "open (f -` s)"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4961  | 
by (simp add: vimage_def)  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4962  | 
qed  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4963  | 
|
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4964  | 
lemma isCont_closed_vimage:  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4965  | 
assumes "\<And>x. isCont f x" and "closed s" shows "closed (f -` s)"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4966  | 
using assms unfolding closed_def vimage_Compl [symmetric]  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4967  | 
by (rule isCont_open_vimage)  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4968  | 
|
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4969  | 
lemma open_Collect_less:  | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4970  | 
fixes f g :: "'a::topological_space \<Rightarrow> real"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4971  | 
assumes f: "\<And>x. isCont f x"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4972  | 
assumes g: "\<And>x. isCont g x"  | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4973  | 
  shows "open {x. f x < g x}"
 | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4974  | 
proof -  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4975  | 
  have "open ((\<lambda>x. g x - f x) -` {0<..})"
 | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4976  | 
using isCont_diff [OF g f] open_real_greaterThan  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4977  | 
by (rule isCont_open_vimage)  | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4978  | 
  also have "((\<lambda>x. g x - f x) -` {0<..}) = {x. f x < g x}"
 | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4979  | 
by auto  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4980  | 
finally show ?thesis .  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4981  | 
qed  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4982  | 
|
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4983  | 
lemma closed_Collect_le:  | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4984  | 
fixes f g :: "'a::topological_space \<Rightarrow> real"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4985  | 
assumes f: "\<And>x. isCont f x"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4986  | 
assumes g: "\<And>x. isCont g x"  | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4987  | 
  shows "closed {x. f x \<le> g x}"
 | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4988  | 
proof -  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4989  | 
  have "closed ((\<lambda>x. g x - f x) -` {0..})"
 | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4990  | 
using isCont_diff [OF g f] closed_real_atLeast  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4991  | 
by (rule isCont_closed_vimage)  | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4992  | 
  also have "((\<lambda>x. g x - f x) -` {0..}) = {x. f x \<le> g x}"
 | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4993  | 
by auto  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4994  | 
finally show ?thesis .  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4995  | 
qed  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4996  | 
|
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
4997  | 
lemma closed_Collect_eq:  | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4998  | 
fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
4999  | 
assumes f: "\<And>x. isCont f x"  | 
| 
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
5000  | 
assumes g: "\<And>x. isCont g x"  | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
5001  | 
  shows "closed {x. f x = g x}"
 | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
5002  | 
proof -  | 
| 44216 | 5003  | 
  have "open {(x::'b, y::'b). x \<noteq> y}"
 | 
5004  | 
unfolding open_prod_def by (auto dest!: hausdorff)  | 
|
5005  | 
  hence "closed {(x::'b, y::'b). x = y}"
 | 
|
5006  | 
unfolding closed_def split_def Collect_neg_eq .  | 
|
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
5007  | 
with isCont_Pair [OF f g]  | 
| 44216 | 5008  | 
  have "closed ((\<lambda>x. (f x, g x)) -` {(x, y). x = y})"
 | 
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
5009  | 
by (rule isCont_closed_vimage)  | 
| 44216 | 5010  | 
  also have "\<dots> = {x. f x = g x}" by auto
 | 
| 
44213
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
5011  | 
finally show ?thesis .  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
5012  | 
qed  | 
| 
 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 
huffman 
parents: 
44212 
diff
changeset
 | 
5013  | 
|
| 33175 | 5014  | 
lemma continuous_at_inner: "continuous (at x) (inner a)"  | 
5015  | 
unfolding continuous_at by (intro tendsto_intros)  | 
|
5016  | 
||
| 
39086
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5017  | 
lemma continuous_at_euclidean_component[intro!, simp]: "continuous (at x) (\<lambda>x. x $$ i)"  | 
| 
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5018  | 
unfolding euclidean_component_def by (rule continuous_at_inner)  | 
| 
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5019  | 
|
| 33175 | 5020  | 
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
 | 
| 44233 | 5021  | 
by (simp add: closed_Collect_le)  | 
| 33175 | 5022  | 
|
5023  | 
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
 | 
|
| 44233 | 5024  | 
by (simp add: closed_Collect_le)  | 
| 33175 | 5025  | 
|
5026  | 
lemma closed_hyperplane: "closed {x. inner a x = b}"
 | 
|
| 44233 | 5027  | 
by (simp add: closed_Collect_eq)  | 
| 33175 | 5028  | 
|
5029  | 
lemma closed_halfspace_component_le:  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5030  | 
  shows "closed {x::'a::euclidean_space. x$$i \<le> a}"
 | 
| 44233 | 5031  | 
by (simp add: closed_Collect_le)  | 
| 33175 | 5032  | 
|
5033  | 
lemma closed_halfspace_component_ge:  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5034  | 
  shows "closed {x::'a::euclidean_space. x$$i \<ge> a}"
 | 
| 44233 | 5035  | 
by (simp add: closed_Collect_le)  | 
| 33175 | 5036  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5037  | 
text {* Openness of halfspaces. *}
 | 
| 33175 | 5038  | 
|
5039  | 
lemma open_halfspace_lt: "open {x. inner a x < b}"
 | 
|
| 44233 | 5040  | 
by (simp add: open_Collect_less)  | 
| 33175 | 5041  | 
|
5042  | 
lemma open_halfspace_gt: "open {x. inner a x > b}"
 | 
|
| 44233 | 5043  | 
by (simp add: open_Collect_less)  | 
| 33175 | 5044  | 
|
5045  | 
lemma open_halfspace_component_lt:  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5046  | 
  shows "open {x::'a::euclidean_space. x$$i < a}"
 | 
| 44233 | 5047  | 
by (simp add: open_Collect_less)  | 
| 33175 | 5048  | 
|
5049  | 
lemma open_halfspace_component_gt:  | 
|
| 
44219
 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 
huffman 
parents: 
44216 
diff
changeset
 | 
5050  | 
  shows "open {x::'a::euclidean_space. x$$i > a}"
 | 
| 44233 | 5051  | 
by (simp add: open_Collect_less)  | 
| 33175 | 5052  | 
|
| 38656 | 5053  | 
text{* Instantiation for intervals on @{text ordered_euclidean_space} *}
 | 
5054  | 
||
5055  | 
lemma eucl_lessThan_eq_halfspaces:  | 
|
5056  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5057  | 
  shows "{..<a} = (\<Inter>i<DIM('a). {x. x $$ i < a $$ i})"
 | 
|
5058  | 
by (auto simp: eucl_less[where 'a='a])  | 
|
5059  | 
||
5060  | 
lemma eucl_greaterThan_eq_halfspaces:  | 
|
5061  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5062  | 
  shows "{a<..} = (\<Inter>i<DIM('a). {x. a $$ i < x $$ i})"
 | 
|
5063  | 
by (auto simp: eucl_less[where 'a='a])  | 
|
5064  | 
||
5065  | 
lemma eucl_atMost_eq_halfspaces:  | 
|
5066  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5067  | 
  shows "{.. a} = (\<Inter>i<DIM('a). {x. x $$ i \<le> a $$ i})"
 | 
|
5068  | 
by (auto simp: eucl_le[where 'a='a])  | 
|
5069  | 
||
5070  | 
lemma eucl_atLeast_eq_halfspaces:  | 
|
5071  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5072  | 
  shows "{a ..} = (\<Inter>i<DIM('a). {x. a $$ i \<le> x $$ i})"
 | 
|
5073  | 
by (auto simp: eucl_le[where 'a='a])  | 
|
5074  | 
||
5075  | 
lemma open_eucl_lessThan[simp, intro]:  | 
|
5076  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5077  | 
  shows "open {..< a}"
 | 
|
5078  | 
by (auto simp: eucl_lessThan_eq_halfspaces open_halfspace_component_lt)  | 
|
5079  | 
||
5080  | 
lemma open_eucl_greaterThan[simp, intro]:  | 
|
5081  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5082  | 
  shows "open {a <..}"
 | 
|
5083  | 
by (auto simp: eucl_greaterThan_eq_halfspaces open_halfspace_component_gt)  | 
|
5084  | 
||
5085  | 
lemma closed_eucl_atMost[simp, intro]:  | 
|
5086  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5087  | 
  shows "closed {.. a}"
 | 
|
5088  | 
unfolding eucl_atMost_eq_halfspaces  | 
|
| 44233 | 5089  | 
by (simp add: closed_INT closed_Collect_le)  | 
| 38656 | 5090  | 
|
5091  | 
lemma closed_eucl_atLeast[simp, intro]:  | 
|
5092  | 
fixes a :: "'a\<Colon>ordered_euclidean_space"  | 
|
5093  | 
  shows "closed {a ..}"
 | 
|
5094  | 
unfolding eucl_atLeast_eq_halfspaces  | 
|
| 44233 | 5095  | 
by (simp add: closed_INT closed_Collect_le)  | 
| 38656 | 5096  | 
|
| 
39086
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5097  | 
lemma open_vimage_euclidean_component: "open S \<Longrightarrow> open ((\<lambda>x. x $$ i) -` S)"  | 
| 
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5098  | 
by (auto intro!: continuous_open_vimage)  | 
| 
 
c4b809e57fe0
preimages of open sets over continuous function are open
 
hoelzl 
parents: 
38656 
diff
changeset
 | 
5099  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5100  | 
text {* This gives a simple derivation of limit component bounds. *}
 | 
| 33175 | 5101  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5102  | 
lemma Lim_component_le: fixes f :: "'a \<Rightarrow> 'b::euclidean_space"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5103  | 
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. f(x)$$i \<le> b) net"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5104  | 
shows "l$$i \<le> b"  | 
| 33175 | 5105  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5106  | 
  { fix x have "x \<in> {x::'b. inner (basis i) x \<le> b} \<longleftrightarrow> x$$i \<le> b"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5107  | 
unfolding euclidean_component_def by auto } note * = this  | 
| 33175 | 5108  | 
  show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<le> b}" f net l] unfolding *
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5109  | 
using closed_halfspace_le[of "(basis i)::'b" b] and assms(1,2,3) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5110  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5111  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5112  | 
lemma Lim_component_ge: fixes f :: "'a \<Rightarrow> 'b::euclidean_space"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5113  | 
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. b \<le> (f x)$$i) net"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5114  | 
shows "b \<le> l$$i"  | 
| 33175 | 5115  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5116  | 
  { fix x have "x \<in> {x::'b. inner (basis i) x \<ge> b} \<longleftrightarrow> x$$i \<ge> b"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5117  | 
unfolding euclidean_component_def by auto } note * = this  | 
| 33175 | 5118  | 
  show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<ge> b}" f net l] unfolding *
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5119  | 
using closed_halfspace_ge[of b "(basis i)"] and assms(1,2,3) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5120  | 
qed  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5121  | 
|
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5122  | 
lemma Lim_component_eq: fixes f :: "'a \<Rightarrow> 'b::euclidean_space"  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5123  | 
assumes net:"(f ---> l) net" "~(trivial_limit net)" and ev:"eventually (\<lambda>x. f(x)$$i = b) net"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5124  | 
shows "l$$i = b"  | 
| 
44211
 
bd7c586b902e
remove duplicate lemmas eventually_conjI, eventually_and, eventually_false
 
huffman 
parents: 
44210 
diff
changeset
 | 
5125  | 
using ev[unfolded order_eq_iff eventually_conj_iff] using Lim_component_ge[OF net, of b i] and Lim_component_le[OF net, of i b] by auto  | 
| 33175 | 5126  | 
text{* Limits relative to a union.                                               *}
 | 
5127  | 
||
5128  | 
lemma eventually_within_Un:  | 
|
5129  | 
"eventually P (net within (s \<union> t)) \<longleftrightarrow>  | 
|
5130  | 
eventually P (net within s) \<and> eventually P (net within t)"  | 
|
5131  | 
unfolding Limits.eventually_within  | 
|
5132  | 
by (auto elim!: eventually_rev_mp)  | 
|
5133  | 
||
5134  | 
lemma Lim_within_union:  | 
|
5135  | 
"(f ---> l) (net within (s \<union> t)) \<longleftrightarrow>  | 
|
5136  | 
(f ---> l) (net within s) \<and> (f ---> l) (net within t)"  | 
|
5137  | 
unfolding tendsto_def  | 
|
5138  | 
by (auto simp add: eventually_within_Un)  | 
|
5139  | 
||
| 36442 | 5140  | 
lemma Lim_topological:  | 
5141  | 
"(f ---> l) net \<longleftrightarrow>  | 
|
5142  | 
trivial_limit net \<or>  | 
|
5143  | 
(\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)"  | 
|
5144  | 
unfolding tendsto_def trivial_limit_eq by auto  | 
|
5145  | 
||
| 33175 | 5146  | 
lemma continuous_on_union:  | 
5147  | 
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t f"  | 
|
5148  | 
shows "continuous_on (s \<union> t) f"  | 
|
| 36442 | 5149  | 
using assms unfolding continuous_on Lim_within_union  | 
5150  | 
unfolding Lim_topological trivial_limit_within closed_limpt by auto  | 
|
| 33175 | 5151  | 
|
5152  | 
lemma continuous_on_cases:  | 
|
5153  | 
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t g"  | 
|
5154  | 
"\<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x"  | 
|
5155  | 
shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"  | 
|
5156  | 
proof-  | 
|
5157  | 
let ?h = "(\<lambda>x. if P x then f x else g x)"  | 
|
5158  | 
have "\<forall>x\<in>s. f x = (if P x then f x else g x)" using assms(5) by auto  | 
|
5159  | 
hence "continuous_on s ?h" using continuous_on_eq[of s f ?h] using assms(3) by auto  | 
|
5160  | 
moreover  | 
|
5161  | 
have "\<forall>x\<in>t. g x = (if P x then f x else g x)" using assms(5) by auto  | 
|
5162  | 
hence "continuous_on t ?h" using continuous_on_eq[of t g ?h] using assms(4) by auto  | 
|
5163  | 
ultimately show ?thesis using continuous_on_union[OF assms(1,2), of ?h] by auto  | 
|
5164  | 
qed  | 
|
5165  | 
||
5166  | 
||
5167  | 
text{* Some more convenient intermediate-value theorem formulations.             *}
 | 
|
5168  | 
||
5169  | 
lemma connected_ivt_hyperplane:  | 
|
5170  | 
assumes "connected s" "x \<in> s" "y \<in> s" "inner a x \<le> b" "b \<le> inner a y"  | 
|
5171  | 
shows "\<exists>z \<in> s. inner a z = b"  | 
|
5172  | 
proof(rule ccontr)  | 
|
5173  | 
assume as:"\<not> (\<exists>z\<in>s. inner a z = b)"  | 
|
5174  | 
  let ?A = "{x. inner a x < b}"
 | 
|
5175  | 
  let ?B = "{x. inner a x > b}"
 | 
|
5176  | 
have "open ?A" "open ?B" using open_halfspace_lt and open_halfspace_gt by auto  | 
|
5177  | 
  moreover have "?A \<inter> ?B = {}" by auto
 | 
|
5178  | 
moreover have "s \<subseteq> ?A \<union> ?B" using as by auto  | 
|
5179  | 
ultimately show False using assms(1)[unfolded connected_def not_ex, THEN spec[where x="?A"], THEN spec[where x="?B"]] and assms(2-5) by auto  | 
|
5180  | 
qed  | 
|
5181  | 
||
| 
37673
 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 
huffman 
parents: 
37649 
diff
changeset
 | 
5182  | 
lemma connected_ivt_component: fixes x::"'a::euclidean_space" shows  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5183  | 
"connected s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> x$$k \<le> a \<Longrightarrow> a \<le> y$$k \<Longrightarrow> (\<exists>z\<in>s. z$$k = a)"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5184  | 
using connected_ivt_hyperplane[of s x y "(basis k)::'a" a]  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5185  | 
unfolding euclidean_component_def by auto  | 
| 33175 | 5186  | 
|
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5187  | 
|
| 36437 | 5188  | 
subsection {* Homeomorphisms *}
 | 
| 33175 | 5189  | 
|
5190  | 
definition "homeomorphism s t f g \<equiv>  | 
|
5191  | 
(\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and>  | 
|
5192  | 
(\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g"  | 
|
5193  | 
||
5194  | 
definition  | 
|
5195  | 
homeomorphic :: "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> bool"  | 
|
5196  | 
(infixr "homeomorphic" 60) where  | 
|
5197  | 
homeomorphic_def: "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)"  | 
|
5198  | 
||
5199  | 
lemma homeomorphic_refl: "s homeomorphic s"  | 
|
5200  | 
unfolding homeomorphic_def  | 
|
5201  | 
unfolding homeomorphism_def  | 
|
5202  | 
using continuous_on_id  | 
|
5203  | 
apply(rule_tac x = "(\<lambda>x. x)" in exI)  | 
|
5204  | 
apply(rule_tac x = "(\<lambda>x. x)" in exI)  | 
|
5205  | 
by blast  | 
|
5206  | 
||
5207  | 
lemma homeomorphic_sym:  | 
|
5208  | 
"s homeomorphic t \<longleftrightarrow> t homeomorphic s"  | 
|
5209  | 
unfolding homeomorphic_def  | 
|
5210  | 
unfolding homeomorphism_def  | 
|
| 33324 | 5211  | 
by blast  | 
| 33175 | 5212  | 
|
5213  | 
lemma homeomorphic_trans:  | 
|
5214  | 
assumes "s homeomorphic t" "t homeomorphic u" shows "s homeomorphic u"  | 
|
5215  | 
proof-  | 
|
5216  | 
obtain f1 g1 where fg1:"\<forall>x\<in>s. g1 (f1 x) = x" "f1 ` s = t" "continuous_on s f1" "\<forall>y\<in>t. f1 (g1 y) = y" "g1 ` t = s" "continuous_on t g1"  | 
|
5217  | 
using assms(1) unfolding homeomorphic_def homeomorphism_def by auto  | 
|
5218  | 
obtain f2 g2 where fg2:"\<forall>x\<in>t. g2 (f2 x) = x" "f2 ` t = u" "continuous_on t f2" "\<forall>y\<in>u. f2 (g2 y) = y" "g2 ` u = t" "continuous_on u g2"  | 
|
5219  | 
using assms(2) unfolding homeomorphic_def homeomorphism_def by auto  | 
|
5220  | 
||
5221  | 
  { fix x assume "x\<in>s" hence "(g1 \<circ> g2) ((f2 \<circ> f1) x) = x" using fg1(1)[THEN bspec[where x=x]] and fg2(1)[THEN bspec[where x="f1 x"]] and fg1(2) by auto }
 | 
|
5222  | 
moreover have "(f2 \<circ> f1) ` s = u" using fg1(2) fg2(2) by auto  | 
|
5223  | 
moreover have "continuous_on s (f2 \<circ> f1)" using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto  | 
|
5224  | 
  moreover { fix y assume "y\<in>u" hence "(f2 \<circ> f1) ((g1 \<circ> g2) y) = y" using fg2(4)[THEN bspec[where x=y]] and fg1(4)[THEN bspec[where x="g2 y"]] and fg2(5) by auto }
 | 
|
5225  | 
moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto  | 
|
5226  | 
moreover have "continuous_on u (g1 \<circ> g2)" using continuous_on_compose[OF fg2(6)] and fg1(6) unfolding fg2(5) by auto  | 
|
5227  | 
ultimately show ?thesis unfolding homeomorphic_def homeomorphism_def apply(rule_tac x="f2 \<circ> f1" in exI) apply(rule_tac x="g1 \<circ> g2" in exI) by auto  | 
|
5228  | 
qed  | 
|
5229  | 
||
5230  | 
lemma homeomorphic_minimal:  | 
|
5231  | 
"s homeomorphic t \<longleftrightarrow>  | 
|
5232  | 
(\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and>  | 
|
5233  | 
(\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and>  | 
|
5234  | 
continuous_on s f \<and> continuous_on t g)"  | 
|
5235  | 
unfolding homeomorphic_def homeomorphism_def  | 
|
5236  | 
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI)  | 
|
5237  | 
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) apply auto  | 
|
5238  | 
unfolding image_iff  | 
|
5239  | 
apply(erule_tac x="g x" in ballE) apply(erule_tac x="x" in ballE)  | 
|
5240  | 
apply auto apply(rule_tac x="g x" in bexI) apply auto  | 
|
5241  | 
apply(erule_tac x="f x" in ballE) apply(erule_tac x="x" in ballE)  | 
|
5242  | 
apply auto apply(rule_tac x="f x" in bexI) by auto  | 
|
5243  | 
||
| 36437 | 5244  | 
text {* Relatively weak hypotheses if a set is compact. *}
 | 
| 33175 | 5245  | 
|
5246  | 
lemma homeomorphism_compact:  | 
|
5247  | 
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
5248  | 
(* class constraint due to continuous_on_inv *)  | 
| 33175 | 5249  | 
assumes "compact s" "continuous_on s f" "f ` s = t" "inj_on f s"  | 
5250  | 
shows "\<exists>g. homeomorphism s t f g"  | 
|
5251  | 
proof-  | 
|
5252  | 
def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x"  | 
|
5253  | 
have g:"\<forall>x\<in>s. g (f x) = x" using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto  | 
|
5254  | 
  { fix y assume "y\<in>t"
 | 
|
5255  | 
then obtain x where x:"f x = y" "x\<in>s" using assms(3) by auto  | 
|
5256  | 
hence "g (f x) = x" using g by auto  | 
|
5257  | 
hence "f (g y) = y" unfolding x(1)[THEN sym] by auto }  | 
|
5258  | 
hence g':"\<forall>x\<in>t. f (g x) = x" by auto  | 
|
5259  | 
moreover  | 
|
5260  | 
  { fix x
 | 
|
5261  | 
have "x\<in>s \<Longrightarrow> x \<in> g ` t" using g[THEN bspec[where x=x]] unfolding image_iff using assms(3) by(auto intro!: bexI[where x="f x"])  | 
|
5262  | 
moreover  | 
|
5263  | 
    { assume "x\<in>g ` t"
 | 
|
5264  | 
then obtain y where y:"y\<in>t" "g y = x" by auto  | 
|
5265  | 
then obtain x' where x':"x'\<in>s" "f x' = y" using assms(3) by auto  | 
|
5266  | 
hence "x \<in> s" unfolding g_def using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"] unfolding y(2)[THEN sym] and g_def by auto }  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
5267  | 
ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" .. }  | 
| 33175 | 5268  | 
hence "g ` t = s" by auto  | 
5269  | 
ultimately  | 
|
5270  | 
show ?thesis unfolding homeomorphism_def homeomorphic_def  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
5271  | 
apply(rule_tac x=g in exI) using g and assms(3) and continuous_on_inv[OF assms(2,1), of g, unfolded assms(3)] and assms(2) by auto  | 
| 33175 | 5272  | 
qed  | 
5273  | 
||
5274  | 
lemma homeomorphic_compact:  | 
|
5275  | 
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"  | 
|
| 
44647
 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 
huffman 
parents: 
44632 
diff
changeset
 | 
5276  | 
(* class constraint due to continuous_on_inv *)  | 
| 33175 | 5277  | 
shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s  | 
5278  | 
\<Longrightarrow> s homeomorphic t"  | 
|
| 
37486
 
b993fac7985b
beta-eta was too much, because it transformed SOME x. P x into Eps P, which caused problems later;
 
blanchet 
parents: 
37452 
diff
changeset
 | 
5279  | 
unfolding homeomorphic_def by (metis homeomorphism_compact)  | 
| 33175 | 5280  | 
|
5281  | 
text{* Preservation of topological properties.                                   *}
 | 
|
5282  | 
||
5283  | 
lemma homeomorphic_compactness:  | 
|
5284  | 
"s homeomorphic t ==> (compact s \<longleftrightarrow> compact t)"  | 
|
5285  | 
unfolding homeomorphic_def homeomorphism_def  | 
|
5286  | 
by (metis compact_continuous_image)  | 
|
5287  | 
||
5288  | 
text{* Results on translation, scaling etc.                                      *}
 | 
|
5289  | 
||
5290  | 
lemma homeomorphic_scaling:  | 
|
5291  | 
fixes s :: "'a::real_normed_vector set"  | 
|
5292  | 
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)"  | 
|
5293  | 
unfolding homeomorphic_minimal  | 
|
5294  | 
apply(rule_tac x="\<lambda>x. c *\<^sub>R x" in exI)  | 
|
5295  | 
apply(rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI)  | 
|
| 
44531
 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 
huffman 
parents: 
44530 
diff
changeset
 | 
5296  | 
using assms by (auto simp add: continuous_on_intros)  | 
| 33175 | 5297  | 
|
5298  | 
lemma homeomorphic_translation:  | 
|
5299  | 
fixes s :: "'a::real_normed_vector set"  | 
|
5300  | 
shows "s homeomorphic ((\<lambda>x. a + x) ` s)"  | 
|
5301  | 
unfolding homeomorphic_minimal  | 
|
5302  | 
apply(rule_tac x="\<lambda>x. a + x" in exI)  | 
|
5303  | 
apply(rule_tac x="\<lambda>x. -a + x" in exI)  | 
|
5304  | 
using continuous_on_add[OF continuous_on_const continuous_on_id] by auto  | 
|
5305  | 
||
5306  | 
lemma homeomorphic_affinity:  | 
|
5307  | 
fixes s :: "'a::real_normed_vector set"  | 
|
5308  | 
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)"  | 
|
5309  | 
proof-  | 
|
5310  | 
have *:"op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto  | 
|
5311  | 
show ?thesis  | 
|
5312  | 
using homeomorphic_trans  | 
|
5313  | 
using homeomorphic_scaling[OF assms, of s]  | 
|
5314  | 
using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] unfolding * by auto  | 
|
5315  | 
qed  | 
|
5316  | 
||
5317  | 
lemma homeomorphic_balls:  | 
|
5318  | 
fixes a b ::"'a::real_normed_vector" (* FIXME: generalize to metric_space *)  | 
|
5319  | 
assumes "0 < d" "0 < e"  | 
|
5320  | 
shows "(ball a d) homeomorphic (ball b e)" (is ?th)  | 
|
5321  | 
"(cball a d) homeomorphic (cball b e)" (is ?cth)  | 
|
5322  | 
proof-  | 
|
5323  | 
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto  | 
|
5324  | 
show ?th unfolding homeomorphic_minimal  | 
|
5325  | 
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)  | 
|
5326  | 
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)  | 
|
5327  | 
using assms apply (auto simp add: dist_commute)  | 
|
5328  | 
unfolding dist_norm  | 
|
5329  | 
apply (auto simp add: pos_divide_less_eq mult_strict_left_mono)  | 
|
5330  | 
unfolding continuous_on  | 
|
| 
36659
 
f794e92784aa
adapt to removed premise on tendsto lemma (cf. 88f0125c3bd2)
 
huffman 
parents: 
36623 
diff
changeset
 | 
5331  | 
by (intro ballI tendsto_intros, simp)+  | 
| 33175 | 5332  | 
next  | 
5333  | 
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto  | 
|
5334  | 
show ?cth unfolding homeomorphic_minimal  | 
|
5335  | 
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)  | 
|
5336  | 
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)  | 
|
5337  | 
using assms apply (auto simp add: dist_commute)  | 
|
5338  | 
unfolding dist_norm  | 
|
5339  | 
apply (auto simp add: pos_divide_le_eq)  | 
|
5340  | 
unfolding continuous_on  | 
|
| 
36659
 
f794e92784aa
adapt to removed premise on tendsto lemma (cf. 88f0125c3bd2)
 
huffman 
parents: 
36623 
diff
changeset
 | 
5341  | 
by (intro ballI tendsto_intros, simp)+  | 
| 33175 | 5342  | 
qed  | 
5343  | 
||
5344  | 
text{* "Isometry" (up to constant bounds) of injective linear map etc.           *}
 | 
|
5345  | 
||
5346  | 
lemma cauchy_isometric:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5347  | 
fixes x :: "nat \<Rightarrow> 'a::euclidean_space"  | 
| 33175 | 5348  | 
assumes e:"0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and xs:"\<forall>n::nat. x n \<in> s" and cf:"Cauchy(f o x)"  | 
5349  | 
shows "Cauchy x"  | 
|
5350  | 
proof-  | 
|
5351  | 
interpret f: bounded_linear f by fact  | 
|
5352  | 
  { fix d::real assume "d>0"
 | 
|
5353  | 
then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d"  | 
|
5354  | 
using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] and e and mult_pos_pos[of e d] by auto  | 
|
5355  | 
    { fix n assume "n\<ge>N"
 | 
|
5356  | 
hence "norm (f (x n - x N)) < e * d" using N[THEN spec[where x=n]] unfolding f.diff[THEN sym] by auto  | 
|
5357  | 
moreover have "e * norm (x n - x N) \<le> norm (f (x n - x N))"  | 
|
5358  | 
using subspace_sub[OF s, of "x n" "x N"] using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]]  | 
|
5359  | 
using normf[THEN bspec[where x="x n - x N"]] by auto  | 
|
5360  | 
ultimately have "norm (x n - x N) < d" using `e>0`  | 
|
5361  | 
using mult_left_less_imp_less[of e "norm (x n - x N)" d] by auto }  | 
|
5362  | 
hence "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto }  | 
|
5363  | 
thus ?thesis unfolding cauchy and dist_norm by auto  | 
|
5364  | 
qed  | 
|
5365  | 
||
5366  | 
lemma complete_isometric_image:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5367  | 
fixes f :: "'a::euclidean_space => 'b::euclidean_space"  | 
| 33175 | 5368  | 
assumes "0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and cs:"complete s"  | 
5369  | 
shows "complete(f ` s)"  | 
|
5370  | 
proof-  | 
|
5371  | 
  { fix g assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
 | 
|
| 33324 | 5372  | 
then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)"  | 
| 33175 | 5373  | 
using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto  | 
5374  | 
hence x:"\<forall>n. x n \<in> s" "\<forall>n. g n = f (x n)" by auto  | 
|
| 
39302
 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 
nipkow 
parents: 
39198 
diff
changeset
 | 
5375  | 
hence "f \<circ> x = g" unfolding fun_eq_iff by auto  | 
| 33175 | 5376  | 
then obtain l where "l\<in>s" and l:"(x ---> l) sequentially"  | 
5377  | 
using cs[unfolded complete_def, THEN spec[where x="x"]]  | 
|
5378  | 
using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto  | 
|
5379  | 
hence "\<exists>l\<in>f ` s. (g ---> l) sequentially"  | 
|
5380  | 
using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l]  | 
|
5381  | 
unfolding `f \<circ> x = g` by auto }  | 
|
5382  | 
thus ?thesis unfolding complete_def by auto  | 
|
5383  | 
qed  | 
|
5384  | 
||
5385  | 
lemma dist_0_norm:  | 
|
5386  | 
fixes x :: "'a::real_normed_vector"  | 
|
5387  | 
shows "dist 0 x = norm x"  | 
|
5388  | 
unfolding dist_norm by simp  | 
|
5389  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5390  | 
lemma injective_imp_isometric: fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space"  | 
| 33175 | 5391  | 
assumes s:"closed s" "subspace s" and f:"bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)"  | 
5392  | 
shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)"  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5393  | 
proof(cases "s \<subseteq> {0::'a}")
 | 
| 33175 | 5394  | 
case True  | 
5395  | 
  { fix x assume "x \<in> s"
 | 
|
5396  | 
hence "x = 0" using True by auto  | 
|
5397  | 
hence "norm x \<le> norm (f x)" by auto }  | 
|
5398  | 
thus ?thesis by(auto intro!: exI[where x=1])  | 
|
5399  | 
next  | 
|
5400  | 
interpret f: bounded_linear f by fact  | 
|
5401  | 
case False  | 
|
5402  | 
then obtain a where a:"a\<noteq>0" "a\<in>s" by auto  | 
|
5403  | 
  from False have "s \<noteq> {}" by auto
 | 
|
5404  | 
  let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
 | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5405  | 
  let ?S' = "{x::'a. x\<in>s \<and> norm x = norm a}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5406  | 
  let ?S'' = "{x::'a. norm x = norm a}"
 | 
| 33175 | 5407  | 
|
| 
36362
 
06475a1547cb
fix lots of looping simp calls and other warnings
 
huffman 
parents: 
36360 
diff
changeset
 | 
5408  | 
have "?S'' = frontier(cball 0 (norm a))" unfolding frontier_cball and dist_norm by auto  | 
| 33175 | 5409  | 
hence "compact ?S''" using compact_frontier[OF compact_cball, of 0 "norm a"] by auto  | 
5410  | 
moreover have "?S' = s \<inter> ?S''" by auto  | 
|
5411  | 
ultimately have "compact ?S'" using closed_inter_compact[of s ?S''] using s(1) by auto  | 
|
5412  | 
moreover have *:"f ` ?S' = ?S" by auto  | 
|
5413  | 
ultimately have "compact ?S" using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto  | 
|
5414  | 
hence "closed ?S" using compact_imp_closed by auto  | 
|
5415  | 
  moreover have "?S \<noteq> {}" using a by auto
 | 
|
5416  | 
ultimately obtain b' where "b'\<in>?S" "\<forall>y\<in>?S. norm b' \<le> norm y" using distance_attains_inf[of ?S 0] unfolding dist_0_norm by auto  | 
|
5417  | 
  then obtain b where "b\<in>s" and ba:"norm b = norm a" and b:"\<forall>x\<in>{x \<in> s. norm x = norm a}. norm (f b) \<le> norm (f x)" unfolding *[THEN sym] unfolding image_iff by auto
 | 
|
5418  | 
||
5419  | 
let ?e = "norm (f b) / norm b"  | 
|
5420  | 
have "norm b > 0" using ba and a and norm_ge_zero by auto  | 
|
5421  | 
moreover have "norm (f b) > 0" using f(2)[THEN bspec[where x=b], OF `b\<in>s`] using `norm b >0` unfolding zero_less_norm_iff by auto  | 
|
5422  | 
ultimately have "0 < norm (f b) / norm b" by(simp only: divide_pos_pos)  | 
|
5423  | 
moreover  | 
|
5424  | 
  { fix x assume "x\<in>s"
 | 
|
5425  | 
hence "norm (f b) / norm b * norm x \<le> norm (f x)"  | 
|
5426  | 
proof(cases "x=0")  | 
|
5427  | 
case True thus "norm (f b) / norm b * norm x \<le> norm (f x)" by auto  | 
|
5428  | 
next  | 
|
5429  | 
case False  | 
|
5430  | 
hence *:"0 < norm a / norm x" using `a\<noteq>0` unfolding zero_less_norm_iff[THEN sym] by(simp only: divide_pos_pos)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5431  | 
have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" using s[unfolded subspace_def] by auto  | 
| 33175 | 5432  | 
      hence "(norm a / norm x) *\<^sub>R x \<in> {x \<in> s. norm x = norm a}" using `x\<in>s` and `x\<noteq>0` by auto
 | 
5433  | 
thus "norm (f b) / norm b * norm x \<le> norm (f x)" using b[THEN bspec[where x="(norm a / norm x) *\<^sub>R x"]]  | 
|
5434  | 
unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0`  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5435  | 
by (auto simp add: mult_commute pos_le_divide_eq pos_divide_le_eq)  | 
| 33175 | 5436  | 
qed }  | 
5437  | 
ultimately  | 
|
5438  | 
show ?thesis by auto  | 
|
5439  | 
qed  | 
|
5440  | 
||
5441  | 
lemma closed_injective_image_subspace:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5442  | 
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"  | 
| 33175 | 5443  | 
assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 --> x = 0" "closed s"  | 
5444  | 
shows "closed(f ` s)"  | 
|
5445  | 
proof-  | 
|
5446  | 
obtain e where "e>0" and e:"\<forall>x\<in>s. e * norm x \<le> norm (f x)" using injective_imp_isometric[OF assms(4,1,2,3)] by auto  | 
|
5447  | 
show ?thesis using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4)  | 
|
5448  | 
unfolding complete_eq_closed[THEN sym] by auto  | 
|
5449  | 
qed  | 
|
5450  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5451  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5452  | 
subsection {* Some properties of a canonical subspace *}
 | 
| 33175 | 5453  | 
|
5454  | 
lemma subspace_substandard:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5455  | 
  "subspace {x::'a::euclidean_space. (\<forall>i<DIM('a). P i \<longrightarrow> x$$i = 0)}"
 | 
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5456  | 
unfolding subspace_def by auto  | 
| 33175 | 5457  | 
|
5458  | 
lemma closed_substandard:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5459  | 
 "closed {x::'a::euclidean_space. \<forall>i<DIM('a). P i --> x$$i = 0}" (is "closed ?A")
 | 
| 33175 | 5460  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5461  | 
  let ?D = "{i. P i} \<inter> {..<DIM('a)}"
 | 
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5462  | 
  have "closed (\<Inter>i\<in>?D. {x::'a. x$$i = 0})"
 | 
| 
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5463  | 
by (simp add: closed_INT closed_Collect_eq)  | 
| 
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5464  | 
  also have "(\<Inter>i\<in>?D. {x::'a. x$$i = 0}) = ?A"
 | 
| 
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5465  | 
by auto  | 
| 
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5466  | 
finally show "closed ?A" .  | 
| 33175 | 5467  | 
qed  | 
5468  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5469  | 
lemma dim_substandard: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5470  | 
  shows "dim {x::'a::euclidean_space. \<forall>i<DIM('a). i \<notin> d \<longrightarrow> x$$i = 0} = card d" (is "dim ?A = _")
 | 
| 33175 | 5471  | 
proof-  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5472  | 
  let ?D = "{..<DIM('a)}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5473  | 
let ?B = "(basis::nat => 'a) ` d"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5474  | 
let ?bas = "basis::nat \<Rightarrow> 'a"  | 
| 44167 | 5475  | 
have "?B \<subseteq> ?A" by auto  | 
| 33175 | 5476  | 
moreover  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5477  | 
  { fix x::"'a" assume "x\<in>?A"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5478  | 
hence "finite d" "x\<in>?A" using assms by(auto intro:finite_subset)  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5479  | 
hence "x\<in> span ?B"  | 
| 33175 | 5480  | 
proof(induct d arbitrary: x)  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5481  | 
case empty hence "x=0" apply(subst euclidean_eq) by auto  | 
| 33175 | 5482  | 
      thus ?case using subspace_0[OF subspace_span[of "{}"]] by auto
 | 
5483  | 
next  | 
|
5484  | 
case (insert k F)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5485  | 
      hence *:"\<forall>i<DIM('a). i \<notin> insert k F \<longrightarrow> x $$ i = 0" by auto
 | 
| 33175 | 5486  | 
have **:"F \<subseteq> insert k F" by auto  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5487  | 
def y \<equiv> "x - x$$k *\<^sub>R basis k"  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5488  | 
have y:"x = y + (x$$k) *\<^sub>R basis k" unfolding y_def by auto  | 
| 33175 | 5489  | 
      { fix i assume i':"i \<notin> F"
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5490  | 
hence "y $$ i = 0" unfolding y_def  | 
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5491  | 
using *[THEN spec[where x=i]] by auto }  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5492  | 
hence "y \<in> span (basis ` F)" using insert(3) by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5493  | 
hence "y \<in> span (basis ` (insert k F))"  | 
| 33175 | 5494  | 
using span_mono[of "?bas ` F" "?bas ` (insert k F)"]  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5495  | 
using image_mono[OF **, of basis] using assms by auto  | 
| 33175 | 5496  | 
moreover  | 
5497  | 
have "basis k \<in> span (?bas ` (insert k F))" by(rule span_superset, auto)  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5498  | 
hence "x$$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"  | 
| 
36593
 
fb69c8cd27bd
define linear algebra concepts using scaleR instead of (op *s); generalized many lemmas, though a few theorems that used to work on type int^'n are a bit less general
 
huffman 
parents: 
36590 
diff
changeset
 | 
5499  | 
using span_mul by auto  | 
| 33175 | 5500  | 
ultimately  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5501  | 
have "y + x$$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"  | 
| 33175 | 5502  | 
using span_add by auto  | 
5503  | 
thus ?case using y by auto  | 
|
5504  | 
qed  | 
|
5505  | 
}  | 
|
5506  | 
hence "?A \<subseteq> span ?B" by auto  | 
|
5507  | 
moreover  | 
|
5508  | 
  { fix x assume "x \<in> ?B"
 | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5509  | 
    hence "x\<in>{(basis i)::'a |i. i \<in> ?D}" using assms by auto  }
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5510  | 
hence "independent ?B" using independent_mono[OF independent_basis, of ?B] and assms by auto  | 
| 33175 | 5511  | 
moreover  | 
5512  | 
have "d \<subseteq> ?D" unfolding subset_eq using assms by auto  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5513  | 
hence *:"inj_on (basis::nat\<Rightarrow>'a) d" using subset_inj_on[OF basis_inj, of "d"] by auto  | 
| 33715 | 5514  | 
have "card ?B = card d" unfolding card_image[OF *] by auto  | 
| 33175 | 5515  | 
ultimately show ?thesis using dim_unique[of "basis ` d" ?A] by auto  | 
5516  | 
qed  | 
|
5517  | 
||
5518  | 
text{* Hence closure and completeness of all subspaces.                          *}
 | 
|
5519  | 
||
5520  | 
lemma closed_subspace_lemma: "n \<le> card (UNIV::'n::finite set) \<Longrightarrow> \<exists>A::'n set. card A = n"  | 
|
5521  | 
apply (induct n)  | 
|
5522  | 
apply (rule_tac x="{}" in exI, simp)
 | 
|
5523  | 
apply clarsimp  | 
|
5524  | 
apply (subgoal_tac "\<exists>x. x \<notin> A")  | 
|
5525  | 
apply (erule exE)  | 
|
5526  | 
apply (rule_tac x="insert x A" in exI, simp)  | 
|
5527  | 
apply (subgoal_tac "A \<noteq> UNIV", auto)  | 
|
5528  | 
done  | 
|
5529  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5530  | 
lemma closed_subspace: fixes s::"('a::euclidean_space) set"
 | 
| 33175 | 5531  | 
assumes "subspace s" shows "closed s"  | 
5532  | 
proof-  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5533  | 
  have *:"dim s \<le> DIM('a)" using dim_subset_UNIV by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5534  | 
  def d \<equiv> "{..<dim s}" have t:"card d = dim s" unfolding d_def by auto
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5535  | 
  let ?t = "{x::'a. \<forall>i<DIM('a). i \<notin> d \<longrightarrow> x$$i = 0}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5536  | 
  have "\<exists>f. linear f \<and> f ` {x::'a. \<forall>i<DIM('a). i \<notin> d \<longrightarrow> x $$ i = 0} = s \<and>
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5537  | 
      inj_on f {x::'a. \<forall>i<DIM('a). i \<notin> d \<longrightarrow> x $$ i = 0}"
 | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5538  | 
apply(rule subspace_isomorphism[OF subspace_substandard[of "\<lambda>i. i \<notin> d"]])  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5539  | 
using dim_substandard[of d,where 'a='a] and t unfolding d_def using * assms by auto  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5540  | 
then guess f apply-by(erule exE conjE)+ note f = this  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5541  | 
interpret f: bounded_linear f using f unfolding linear_conv_bounded_linear by auto  | 
| 33175 | 5542  | 
have "\<forall>x\<in>?t. f x = 0 \<longrightarrow> x = 0" using f.zero using f(3)[unfolded inj_on_def]  | 
5543  | 
by(erule_tac x=0 in ballE) auto  | 
|
5544  | 
moreover have "closed ?t" using closed_substandard .  | 
|
5545  | 
moreover have "subspace ?t" using subspace_substandard .  | 
|
5546  | 
ultimately show ?thesis using closed_injective_image_subspace[of ?t f]  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5547  | 
unfolding f(2) using f(1) unfolding linear_conv_bounded_linear by auto  | 
| 33175 | 5548  | 
qed  | 
5549  | 
||
5550  | 
lemma complete_subspace:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5551  | 
  fixes s :: "('a::euclidean_space) set" shows "subspace s ==> complete s"
 | 
| 33175 | 5552  | 
using complete_eq_closed closed_subspace  | 
5553  | 
by auto  | 
|
5554  | 
||
5555  | 
lemma dim_closure:  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5556  | 
  fixes s :: "('a::euclidean_space) set"
 | 
| 33175 | 5557  | 
shows "dim(closure s) = dim s" (is "?dc = ?d")  | 
5558  | 
proof-  | 
|
5559  | 
have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s]  | 
|
5560  | 
using closed_subspace[OF subspace_span, of s]  | 
|
5561  | 
using dim_subset[of "closure s" "span s"] unfolding dim_span by auto  | 
|
5562  | 
thus ?thesis using dim_subset[OF closure_subset, of s] by auto  | 
|
5563  | 
qed  | 
|
5564  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5565  | 
|
| 36437 | 5566  | 
subsection {* Affine transformations of intervals *}
 | 
| 33175 | 5567  | 
|
5568  | 
lemma real_affinity_le:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5569  | 
"0 < (m::'a::linordered_field) ==> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))"  | 
| 33175 | 5570  | 
by (simp add: field_simps inverse_eq_divide)  | 
5571  | 
||
5572  | 
lemma real_le_affinity:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5573  | 
"0 < (m::'a::linordered_field) ==> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)"  | 
| 33175 | 5574  | 
by (simp add: field_simps inverse_eq_divide)  | 
5575  | 
||
5576  | 
lemma real_affinity_lt:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5577  | 
"0 < (m::'a::linordered_field) ==> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))"  | 
| 33175 | 5578  | 
by (simp add: field_simps inverse_eq_divide)  | 
5579  | 
||
5580  | 
lemma real_lt_affinity:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5581  | 
"0 < (m::'a::linordered_field) ==> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)"  | 
| 33175 | 5582  | 
by (simp add: field_simps inverse_eq_divide)  | 
5583  | 
||
5584  | 
lemma real_affinity_eq:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5585  | 
"(m::'a::linordered_field) \<noteq> 0 ==> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))"  | 
| 33175 | 5586  | 
by (simp add: field_simps inverse_eq_divide)  | 
5587  | 
||
5588  | 
lemma real_eq_affinity:  | 
|
| 
35028
 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 
haftmann 
parents: 
34999 
diff
changeset
 | 
5589  | 
"(m::'a::linordered_field) \<noteq> 0 ==> (y = m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) = x)"  | 
| 33175 | 5590  | 
by (simp add: field_simps inverse_eq_divide)  | 
5591  | 
||
5592  | 
lemma image_affinity_interval: fixes m::real  | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5593  | 
fixes a b c :: "'a::ordered_euclidean_space"  | 
| 33175 | 5594  | 
  shows "(\<lambda>x. m *\<^sub>R x + c) ` {a .. b} =
 | 
5595  | 
            (if {a .. b} = {} then {}
 | 
|
5596  | 
            else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c}
 | 
|
5597  | 
            else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))"
 | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5598  | 
proof(cases "m=0")  | 
| 33175 | 5599  | 
  { fix x assume "x \<le> c" "c \<le> x"
 | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5600  | 
hence "x=c" unfolding eucl_le[where 'a='a] apply-  | 
| 
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5601  | 
apply(subst euclidean_eq) by (auto intro: order_antisym) }  | 
| 33175 | 5602  | 
moreover case True  | 
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5603  | 
  moreover have "c \<in> {m *\<^sub>R a + c..m *\<^sub>R b + c}" unfolding True by(auto simp add: eucl_le[where 'a='a])
 | 
| 33175 | 5604  | 
ultimately show ?thesis by auto  | 
5605  | 
next  | 
|
5606  | 
case False  | 
|
5607  | 
  { fix y assume "a \<le> y" "y \<le> b" "m > 0"
 | 
|
5608  | 
hence "m *\<^sub>R a + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R b + c"  | 
|
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5609  | 
unfolding eucl_le[where 'a='a] by auto  | 
| 33175 | 5610  | 
} moreover  | 
5611  | 
  { fix y assume "a \<le> y" "y \<le> b" "m < 0"
 | 
|
5612  | 
hence "m *\<^sub>R b + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R a + c"  | 
|
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5613  | 
unfolding eucl_le[where 'a='a] by(auto simp add: mult_left_mono_neg)  | 
| 33175 | 5614  | 
} moreover  | 
5615  | 
  { fix y assume "m > 0"  "m *\<^sub>R a + c \<le> y"  "y \<le> m *\<^sub>R b + c"
 | 
|
5616  | 
    hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
 | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5617  | 
unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a]  | 
| 
44516
 
d9a496ae5d9d
move everything related to 'norm' method into new theory file Norm_Arith.thy
 
huffman 
parents: 
44457 
diff
changeset
 | 
5618  | 
apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"])  | 
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5619  | 
by(auto simp add: pos_le_divide_eq pos_divide_le_eq mult_commute diff_le_iff)  | 
| 33175 | 5620  | 
} moreover  | 
5621  | 
  { fix y assume "m *\<^sub>R b + c \<le> y" "y \<le> m *\<^sub>R a + c" "m < 0"
 | 
|
5622  | 
    hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
 | 
|
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5623  | 
unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a]  | 
| 
44516
 
d9a496ae5d9d
move everything related to 'norm' method into new theory file Norm_Arith.thy
 
huffman 
parents: 
44457 
diff
changeset
 | 
5624  | 
apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"])  | 
| 
44457
 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 
huffman 
parents: 
44365 
diff
changeset
 | 
5625  | 
by(auto simp add: neg_le_divide_eq neg_divide_le_eq mult_commute diff_le_iff)  | 
| 33175 | 5626  | 
}  | 
5627  | 
ultimately show ?thesis using False by auto  | 
|
5628  | 
qed  | 
|
5629  | 
||
| 
37489
 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 
hoelzl 
parents: 
37452 
diff
changeset
 | 
5630  | 
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a..b} =
 | 
| 33175 | 5631  | 
  (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})"
 | 
5632  | 
using image_affinity_interval[of m 0 a b] by auto  | 
|
5633  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5634  | 
|
| 
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5635  | 
subsection {* Banach fixed point theorem (not really topological...) *}
 | 
| 33175 | 5636  | 
|
5637  | 
lemma banach_fix:  | 
|
5638  | 
  assumes s:"complete s" "s \<noteq> {}" and c:"0 \<le> c" "c < 1" and f:"(f ` s) \<subseteq> s" and
 | 
|
5639  | 
lipschitz:"\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y"  | 
|
5640  | 
shows "\<exists>! x\<in>s. (f x = x)"  | 
|
5641  | 
proof-  | 
|
5642  | 
have "1 - c > 0" using c by auto  | 
|
5643  | 
||
5644  | 
from s(2) obtain z0 where "z0 \<in> s" by auto  | 
|
5645  | 
def z \<equiv> "\<lambda>n. (f ^^ n) z0"  | 
|
5646  | 
  { fix n::nat
 | 
|
5647  | 
have "z n \<in> s" unfolding z_def  | 
|
5648  | 
proof(induct n) case 0 thus ?case using `z0 \<in>s` by auto  | 
|
5649  | 
next case Suc thus ?case using f by auto qed }  | 
|
5650  | 
note z_in_s = this  | 
|
5651  | 
||
5652  | 
def d \<equiv> "dist (z 0) (z 1)"  | 
|
5653  | 
||
5654  | 
have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto  | 
|
5655  | 
  { fix n::nat
 | 
|
5656  | 
have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d"  | 
|
5657  | 
proof(induct n)  | 
|
5658  | 
case 0 thus ?case unfolding d_def by auto  | 
|
5659  | 
next  | 
|
5660  | 
case (Suc m)  | 
|
5661  | 
hence "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d"  | 
|
| 
38642
 
8fa437809c67
dropped type classes mult_mono and mult_mono1; tuned names of technical rule duplicates
 
haftmann 
parents: 
37732 
diff
changeset
 | 
5662  | 
using `0 \<le> c` using mult_left_mono[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by auto  | 
| 33175 | 5663  | 
thus ?case using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s]  | 
5664  | 
unfolding fzn and mult_le_cancel_left by auto  | 
|
5665  | 
qed  | 
|
5666  | 
} note cf_z = this  | 
|
5667  | 
||
5668  | 
  { fix n m::nat
 | 
|
5669  | 
have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)"  | 
|
5670  | 
proof(induct n)  | 
|
5671  | 
case 0 show ?case by auto  | 
|
5672  | 
next  | 
|
5673  | 
case (Suc k)  | 
|
5674  | 
have "(1 - c) * dist (z m) (z (m + Suc k)) \<le> (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))"  | 
|
5675  | 
using dist_triangle and c by(auto simp add: dist_triangle)  | 
|
5676  | 
also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)"  | 
|
5677  | 
using cf_z[of "m + k"] and c by auto  | 
|
5678  | 
also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d"  | 
|
| 36350 | 5679  | 
using Suc by (auto simp add: field_simps)  | 
| 33175 | 5680  | 
also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)"  | 
| 36350 | 5681  | 
unfolding power_add by (auto simp add: field_simps)  | 
| 33175 | 5682  | 
also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)"  | 
| 36350 | 5683  | 
using c by (auto simp add: field_simps)  | 
| 33175 | 5684  | 
finally show ?case by auto  | 
5685  | 
qed  | 
|
5686  | 
} note cf_z2 = this  | 
|
5687  | 
  { fix e::real assume "e>0"
 | 
|
5688  | 
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e"  | 
|
5689  | 
proof(cases "d = 0")  | 
|
5690  | 
case True  | 
|
| 41863 | 5691  | 
have *: "\<And>x. ((1 - c) * x \<le> 0) = (x \<le> 0)" using `1 - c > 0`  | 
5692  | 
by (metis mult_zero_left real_mult_commute real_mult_le_cancel_iff1)  | 
|
5693  | 
from True have "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def  | 
|
5694  | 
by (simp add: *)  | 
|
| 33175 | 5695  | 
thus ?thesis using `e>0` by auto  | 
5696  | 
next  | 
|
5697  | 
case False hence "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"]  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5698  | 
by (metis False d_def less_le)  | 
| 33175 | 5699  | 
hence "0 < e * (1 - c) / d" using `e>0` and `1-c>0`  | 
5700  | 
using divide_pos_pos[of "e * (1 - c)" d] and mult_pos_pos[of e "1 - c"] by auto  | 
|
5701  | 
then obtain N where N:"c ^ N < e * (1 - c) / d" using real_arch_pow_inv[of "e * (1 - c) / d" c] and c by auto  | 
|
5702  | 
      { fix m n::nat assume "m>n" and as:"m\<ge>N" "n\<ge>N"
 | 
|
5703  | 
have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c using power_decreasing[OF `n\<ge>N`, of c] by auto  | 
|
5704  | 
have "1 - c ^ (m - n) > 0" using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto  | 
|
5705  | 
hence **:"d * (1 - c ^ (m - n)) / (1 - c) > 0"  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5706  | 
using mult_pos_pos[OF `d>0`, of "1 - c ^ (m - n)"]  | 
| 33175 | 5707  | 
using divide_pos_pos[of "d * (1 - c ^ (m - n))" "1 - c"]  | 
5708  | 
using `0 < 1 - c` by auto  | 
|
5709  | 
||
5710  | 
have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)"  | 
|
5711  | 
using cf_z2[of n "m - n"] and `m>n` unfolding pos_le_divide_eq[OF `1-c>0`]  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5712  | 
by (auto simp add: mult_commute dist_commute)  | 
| 33175 | 5713  | 
also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)"  | 
5714  | 
using mult_right_mono[OF * order_less_imp_le[OF **]]  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5715  | 
unfolding mult_assoc by auto  | 
| 33175 | 5716  | 
also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)"  | 
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5717  | 
using mult_strict_right_mono[OF N **] unfolding mult_assoc by auto  | 
| 33175 | 5718  | 
also have "\<dots> = e * (1 - c ^ (m - n))" using c and `d>0` and `1 - c > 0` by auto  | 
5719  | 
also have "\<dots> \<le> e" using c and `1 - c ^ (m - n) > 0` and `e>0` using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto  | 
|
5720  | 
finally have "dist (z m) (z n) < e" by auto  | 
|
5721  | 
} note * = this  | 
|
5722  | 
      { fix m n::nat assume as:"N\<le>m" "N\<le>n"
 | 
|
5723  | 
hence "dist (z n) (z m) < e"  | 
|
5724  | 
proof(cases "n = m")  | 
|
5725  | 
case True thus ?thesis using `e>0` by auto  | 
|
5726  | 
next  | 
|
5727  | 
case False thus ?thesis using as and *[of n m] *[of m n] unfolding nat_neq_iff by (auto simp add: dist_commute)  | 
|
5728  | 
qed }  | 
|
5729  | 
thus ?thesis by auto  | 
|
5730  | 
qed  | 
|
5731  | 
}  | 
|
5732  | 
hence "Cauchy z" unfolding cauchy_def by auto  | 
|
5733  | 
then obtain x where "x\<in>s" and x:"(z ---> x) sequentially" using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto  | 
|
5734  | 
||
5735  | 
def e \<equiv> "dist (f x) x"  | 
|
5736  | 
have "e = 0" proof(rule ccontr)  | 
|
5737  | 
assume "e \<noteq> 0" hence "e>0" unfolding e_def using zero_le_dist[of "f x" x]  | 
|
5738  | 
by (metis dist_eq_0_iff dist_nz e_def)  | 
|
5739  | 
then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2"  | 
|
5740  | 
using x[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto  | 
|
5741  | 
hence N':"dist (z N) x < e / 2" by auto  | 
|
5742  | 
||
5743  | 
have *:"c * dist (z N) x \<le> dist (z N) x" unfolding mult_le_cancel_right2  | 
|
5744  | 
using zero_le_dist[of "z N" x] and c  | 
|
| 
36778
 
739a9379e29b
avoid using real-specific versions of generic lemmas
 
huffman 
parents: 
36669 
diff
changeset
 | 
5745  | 
by (metis dist_eq_0_iff dist_nz order_less_asym less_le)  | 
| 33175 | 5746  | 
have "dist (f (z N)) (f x) \<le> c * dist (z N) x" using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]]  | 
5747  | 
using z_in_s[of N] `x\<in>s` using c by auto  | 
|
5748  | 
also have "\<dots> < e / 2" using N' and c using * by auto  | 
|
5749  | 
finally show False unfolding fzn  | 
|
5750  | 
using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x]  | 
|
5751  | 
unfolding e_def by auto  | 
|
5752  | 
qed  | 
|
5753  | 
hence "f x = x" unfolding e_def by auto  | 
|
5754  | 
moreover  | 
|
5755  | 
  { fix y assume "f y = y" "y\<in>s"
 | 
|
5756  | 
hence "dist x y \<le> c * dist x y" using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]]  | 
|
5757  | 
using `x\<in>s` and `f x = x` by auto  | 
|
5758  | 
hence "dist x y = 0" unfolding mult_le_cancel_right1  | 
|
5759  | 
using c and zero_le_dist[of x y] by auto  | 
|
5760  | 
hence "y = x" by auto  | 
|
5761  | 
}  | 
|
| 
34999
 
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
 
hoelzl 
parents: 
34964 
diff
changeset
 | 
5762  | 
ultimately show ?thesis using `x\<in>s` by blast+  | 
| 33175 | 5763  | 
qed  | 
5764  | 
||
| 
44210
 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 
huffman 
parents: 
44207 
diff
changeset
 | 
5765  | 
subsection {* Edelstein fixed point theorem *}
 | 
| 33175 | 5766  | 
|
5767  | 
lemma edelstein_fix:  | 
|
5768  | 
fixes s :: "'a::real_normed_vector set"  | 
|
5769  | 
  assumes s:"compact s" "s \<noteq> {}" and gs:"(g ` s) \<subseteq> s"
 | 
|
5770  | 
and dist:"\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y"  | 
|
5771  | 
shows "\<exists>! x\<in>s. g x = x"  | 
|
5772  | 
proof(cases "\<exists>x\<in>s. g x \<noteq> x")  | 
|
5773  | 
obtain x where "x\<in>s" using s(2) by auto  | 
|
5774  | 
case False hence g:"\<forall>x\<in>s. g x = x" by auto  | 
|
5775  | 
  { fix y assume "y\<in>s"
 | 
|
5776  | 
hence "x = y" using `x\<in>s` and dist[THEN bspec[where x=x], THEN bspec[where x=y]]  | 
|
5777  | 
unfolding g[THEN bspec[where x=x], OF `x\<in>s`]  | 
|
5778  | 
unfolding g[THEN bspec[where x=y], OF `y\<in>s`] by auto }  | 
|
| 
34999
 
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
 
hoelzl 
parents: 
34964 
diff
changeset
 | 
5779  | 
thus ?thesis using `x\<in>s` and g by blast+  | 
| 33175 | 5780  | 
next  | 
5781  | 
case True  | 
|
5782  | 
then obtain x where [simp]:"x\<in>s" and "g x \<noteq> x" by auto  | 
|
5783  | 
  { fix x y assume "x \<in> s" "y \<in> s"
 | 
|
5784  | 
hence "dist (g x) (g y) \<le> dist x y"  | 
|
5785  | 
using dist[THEN bspec[where x=x], THEN bspec[where x=y]] by auto } note dist' = this  | 
|
5786  | 
def y \<equiv> "g x"  | 
|
5787  | 
have [simp]:"y\<in>s" unfolding y_def using gs[unfolded image_subset_iff] and `x\<in>s` by blast  | 
|
5788  | 
def f \<equiv> "\<lambda>n. g ^^ n"  | 
|
5789  | 
have [simp]:"\<And>n z. g (f n z) = f (Suc n) z" unfolding f_def by auto  | 
|
5790  | 
have [simp]:"\<And>z. f 0 z = z" unfolding f_def by auto  | 
|
5791  | 
  { fix n::nat and z assume "z\<in>s"
 | 
|
5792  | 
have "f n z \<in> s" unfolding f_def  | 
|
5793  | 
proof(induct n)  | 
|
5794  | 
case 0 thus ?case using `z\<in>s` by simp  | 
|
5795  | 
next  | 
|
5796  | 
case (Suc n) thus ?case using gs[unfolded image_subset_iff] by auto  | 
|
5797  | 
qed } note fs = this  | 
|
5798  | 
  { fix m n ::nat assume "m\<le>n"
 | 
|
5799  | 
fix w z assume "w\<in>s" "z\<in>s"  | 
|
5800  | 
have "dist (f n w) (f n z) \<le> dist (f m w) (f m z)" using `m\<le>n`  | 
|
5801  | 
proof(induct n)  | 
|
5802  | 
case 0 thus ?case by auto  | 
|
5803  | 
next  | 
|
5804  | 
case (Suc n)  | 
|
5805  | 
thus ?case proof(cases "m\<le>n")  | 
|
5806  | 
case True thus ?thesis using Suc(1)  | 
|
5807  | 
using dist'[OF fs fs, OF `w\<in>s` `z\<in>s`, of n n] by auto  | 
|
5808  | 
next  | 
|
5809  | 
case False hence mn:"m = Suc n" using Suc(2) by simp  | 
|
5810  | 
show ?thesis unfolding mn by auto  | 
|
5811  | 
qed  | 
|
5812  | 
qed } note distf = this  | 
|
5813  | 
||
5814  | 
def h \<equiv> "\<lambda>n. (f n x, f n y)"  | 
|
5815  | 
let ?s2 = "s \<times> s"  | 
|
5816  | 
obtain l r where "l\<in>?s2" and r:"subseq r" and lr:"((h \<circ> r) ---> l) sequentially"  | 
|
5817  | 
using compact_Times [OF s(1) s(1), unfolded compact_def, THEN spec[where x=h]] unfolding h_def  | 
|
5818  | 
using fs[OF `x\<in>s`] and fs[OF `y\<in>s`] by blast  | 
|
5819  | 
def a \<equiv> "fst l" def b \<equiv> "snd l"  | 
|
5820  | 
have lab:"l = (a, b)" unfolding a_def b_def by simp  | 
|
5821  | 
have [simp]:"a\<in>s" "b\<in>s" unfolding a_def b_def using `l\<in>?s2` by auto  | 
|
5822  | 
||
5823  | 
have lima:"((fst \<circ> (h \<circ> r)) ---> a) sequentially"  | 
|
5824  | 
and limb:"((snd \<circ> (h \<circ> r)) ---> b) sequentially"  | 
|
5825  | 
using lr  | 
|
| 44167 | 5826  | 
unfolding o_def a_def b_def by (rule tendsto_intros)+  | 
| 33175 | 5827  | 
|
5828  | 
  { fix n::nat
 | 
|
5829  | 
have *:"\<And>fx fy (x::'a) y. dist fx fy \<le> dist x y \<Longrightarrow> \<not> (dist (fx - fy) (a - b) < dist a b - dist x y)" unfolding dist_norm by norm  | 
|
5830  | 
    { fix x y :: 'a
 | 
|
5831  | 
have "dist (-x) (-y) = dist x y" unfolding dist_norm  | 
|
5832  | 
using norm_minus_cancel[of "x - y"] by (auto simp add: uminus_add_conv_diff) } note ** = this  | 
|
5833  | 
||
5834  | 
    { assume as:"dist a b > dist (f n x) (f n y)"
 | 
|
5835  | 
then obtain Na Nb where "\<forall>m\<ge>Na. dist (f (r m) x) a < (dist a b - dist (f n x) (f n y)) / 2"  | 
|
5836  | 
and "\<forall>m\<ge>Nb. dist (f (r m) y) b < (dist a b - dist (f n x) (f n y)) / 2"  | 
|
5837  | 
using lima limb unfolding h_def Lim_sequentially by (fastsimp simp del: less_divide_eq_number_of1)  | 
|
5838  | 
hence "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) < dist a b - dist (f n x) (f n y)"  | 
|
5839  | 
apply(erule_tac x="Na+Nb+n" in allE)  | 
|
5840  | 
apply(erule_tac x="Na+Nb+n" in allE) apply simp  | 
|
5841  | 
using dist_triangle_add_half[of a "f (r (Na + Nb + n)) x" "dist a b - dist (f n x) (f n y)"  | 
|
5842  | 
"-b" "- f (r (Na + Nb + n)) y"]  | 
|
| 36350 | 5843  | 
unfolding ** by (auto simp add: algebra_simps dist_commute)  | 
| 33175 | 5844  | 
moreover  | 
5845  | 
have "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) \<ge> dist a b - dist (f n x) (f n y)"  | 
|
5846  | 
using distf[of n "r (Na+Nb+n)", OF _ `x\<in>s` `y\<in>s`]  | 
|
5847  | 
using subseq_bigger[OF r, of "Na+Nb+n"]  | 
|
5848  | 
using *[of "f (r (Na + Nb + n)) x" "f (r (Na + Nb + n)) y" "f n x" "f n y"] by auto  | 
|
5849  | 
ultimately have False by simp  | 
|
5850  | 
}  | 
|
5851  | 
hence "dist a b \<le> dist (f n x) (f n y)" by(rule ccontr)auto }  | 
|
5852  | 
note ab_fn = this  | 
|
5853  | 
||
5854  | 
have [simp]:"a = b" proof(rule ccontr)  | 
|
5855  | 
def e \<equiv> "dist a b - dist (g a) (g b)"  | 
|
5856  | 
assume "a\<noteq>b" hence "e > 0" unfolding e_def using dist by fastsimp  | 
|
5857  | 
hence "\<exists>n. dist (f n x) a < e/2 \<and> dist (f n y) b < e/2"  | 
|
5858  | 
using lima limb unfolding Lim_sequentially  | 
|
5859  | 
apply (auto elim!: allE[where x="e/2"]) apply(rule_tac x="r (max N Na)" in exI) unfolding h_def by fastsimp  | 
|
5860  | 
then obtain n where n:"dist (f n x) a < e/2 \<and> dist (f n y) b < e/2" by auto  | 
|
5861  | 
have "dist (f (Suc n) x) (g a) \<le> dist (f n x) a"  | 
|
5862  | 
using dist[THEN bspec[where x="f n x"], THEN bspec[where x="a"]] and fs by auto  | 
|
5863  | 
moreover have "dist (f (Suc n) y) (g b) \<le> dist (f n y) b"  | 
|
5864  | 
using dist[THEN bspec[where x="f n y"], THEN bspec[where x="b"]] and fs by auto  | 
|
5865  | 
ultimately have "dist (f (Suc n) x) (g a) + dist (f (Suc n) y) (g b) < e" using n by auto  | 
|
5866  | 
thus False unfolding e_def using ab_fn[of "Suc n"] by norm  | 
|
5867  | 
qed  | 
|
5868  | 
||
5869  | 
have [simp]:"\<And>n. f (Suc n) x = f n y" unfolding f_def y_def by(induct_tac n)auto  | 
|
5870  | 
  { fix x y assume "x\<in>s" "y\<in>s" moreover
 | 
|
5871  | 
fix e::real assume "e>0" ultimately  | 
|
5872  | 
have "dist y x < e \<longrightarrow> dist (g y) (g x) < e" using dist by fastsimp }  | 
|
| 36359 | 5873  | 
hence "continuous_on s g" unfolding continuous_on_iff by auto  | 
| 33175 | 5874  | 
|
5875  | 
hence "((snd \<circ> h \<circ> r) ---> g a) sequentially" unfolding continuous_on_sequentially  | 
|
5876  | 
apply (rule allE[where x="\<lambda>n. (fst \<circ> h \<circ> r) n"]) apply (erule ballE[where x=a])  | 
|
5877  | 
using lima unfolding h_def o_def using fs[OF `x\<in>s`] by (auto simp add: y_def)  | 
|
| 41970 | 5878  | 
hence "g a = a" using tendsto_unique[OF trivial_limit_sequentially limb, of "g a"]  | 
| 33175 | 5879  | 
unfolding `a=b` and o_assoc by auto  | 
5880  | 
moreover  | 
|
5881  | 
  { fix x assume "x\<in>s" "g x = x" "x\<noteq>a"
 | 
|
5882  | 
hence "False" using dist[THEN bspec[where x=a], THEN bspec[where x=x]]  | 
|
5883  | 
using `g a = a` and `a\<in>s` by auto }  | 
|
| 
34999
 
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
 
hoelzl 
parents: 
34964 
diff
changeset
 | 
5884  | 
ultimately show "\<exists>!x\<in>s. g x = x" using `a\<in>s` by blast  | 
| 33175 | 5885  | 
qed  | 
5886  | 
||
| 
44131
 
5fc334b94e00
declare tendsto_const [intro] (accidentally removed in 230a8665c919)
 
huffman 
parents: 
44129 
diff
changeset
 | 
5887  | 
declare tendsto_const [intro] (* FIXME: move *)  | 
| 
 
5fc334b94e00
declare tendsto_const [intro] (accidentally removed in 230a8665c919)
 
huffman 
parents: 
44129 
diff
changeset
 | 
5888  | 
|
| 33175 | 5889  | 
end  |