33175
|
1 |
(* Title: HOL/Library/Topology_Euclidian_Space.thy
|
|
2 |
Author: Amine Chaieb, University of Cambridge
|
|
3 |
Author: Robert Himmelmann, TU Muenchen
|
|
4 |
*)
|
|
5 |
|
|
6 |
header {* Elementary topology in Euclidean space. *}
|
|
7 |
|
|
8 |
theory Topology_Euclidean_Space
|
|
9 |
imports SEQ Euclidean_Space Product_Vector
|
|
10 |
begin
|
|
11 |
|
|
12 |
declare fstcart_pastecart[simp] sndcart_pastecart[simp]
|
|
13 |
|
|
14 |
subsection{* General notion of a topology *}
|
|
15 |
|
|
16 |
definition "istopology L \<longleftrightarrow> {} \<in> L \<and> (\<forall>S \<in>L. \<forall>T \<in>L. S \<inter> T \<in> L) \<and> (\<forall>K. K \<subseteq>L \<longrightarrow> \<Union> K \<in> L)"
|
|
17 |
typedef (open) 'a topology = "{L::('a set) set. istopology L}"
|
|
18 |
morphisms "openin" "topology"
|
|
19 |
unfolding istopology_def by blast
|
|
20 |
|
|
21 |
lemma istopology_open_in[intro]: "istopology(openin U)"
|
|
22 |
using openin[of U] by blast
|
|
23 |
|
|
24 |
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"
|
|
25 |
using topology_inverse[unfolded mem_def Collect_def] .
|
|
26 |
|
|
27 |
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"
|
|
28 |
using topology_inverse[of U] istopology_open_in[of "topology U"] by auto
|
|
29 |
|
|
30 |
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"
|
|
31 |
proof-
|
|
32 |
{assume "T1=T2" hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp}
|
|
33 |
moreover
|
|
34 |
{assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
|
|
35 |
hence "openin T1 = openin T2" by (metis mem_def set_ext)
|
|
36 |
hence "topology (openin T1) = topology (openin T2)" by simp
|
|
37 |
hence "T1 = T2" unfolding openin_inverse .}
|
|
38 |
ultimately show ?thesis by blast
|
|
39 |
qed
|
|
40 |
|
|
41 |
text{* Infer the "universe" from union of all sets in the topology. *}
|
|
42 |
|
|
43 |
definition "topspace T = \<Union>{S. openin T S}"
|
|
44 |
|
|
45 |
subsection{* Main properties of open sets *}
|
|
46 |
|
|
47 |
lemma openin_clauses:
|
|
48 |
fixes U :: "'a topology"
|
|
49 |
shows "openin U {}"
|
|
50 |
"\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)"
|
|
51 |
"\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
|
|
52 |
using openin[of U] unfolding istopology_def Collect_def mem_def
|
|
53 |
by (metis mem_def subset_eq)+
|
|
54 |
|
|
55 |
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"
|
|
56 |
unfolding topspace_def by blast
|
|
57 |
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
|
|
58 |
|
|
59 |
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)"
|
|
60 |
by (simp add: openin_clauses)
|
|
61 |
|
|
62 |
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)" by (simp add: openin_clauses)
|
|
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")
|
|
70 |
proof-
|
|
71 |
{assume ?lhs then have ?rhs by auto }
|
|
72 |
moreover
|
|
73 |
{assume H: ?rhs
|
|
74 |
then obtain t where t: "\<forall>x\<in>S. openin U (t x) \<and> x \<in> t x \<and> t x \<subseteq> S"
|
|
75 |
unfolding Ball_def ex_simps(6)[symmetric] choice_iff by blast
|
|
76 |
from t have th0: "\<forall>x\<in> t`S. openin U x" by auto
|
|
77 |
have "\<Union> t`S = S" using t by auto
|
|
78 |
with openin_Union[OF th0] have "openin U S" by simp }
|
|
79 |
ultimately show ?thesis by blast
|
|
80 |
qed
|
|
81 |
|
|
82 |
subsection{* Closed sets *}
|
|
83 |
|
|
84 |
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)"
|
|
85 |
|
|
86 |
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def)
|
|
87 |
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
|
|
88 |
lemma closedin_topspace[intro,simp]:
|
|
89 |
"closedin U (topspace U)" by (simp add: closedin_def)
|
|
90 |
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)"
|
|
91 |
by (auto simp add: Diff_Un closedin_def)
|
|
92 |
|
|
93 |
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto
|
|
94 |
lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S"
|
|
95 |
shows "closedin U (\<Inter> K)" using Ke Kc unfolding closedin_def Diff_Inter by auto
|
|
96 |
|
|
97 |
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"
|
|
98 |
using closedin_Inter[of "{S,T}" U] by auto
|
|
99 |
|
|
100 |
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast
|
|
101 |
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"
|
|
102 |
apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2)
|
|
103 |
apply (metis openin_subset subset_eq)
|
|
104 |
done
|
|
105 |
|
|
106 |
lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"
|
|
107 |
by (simp add: openin_closedin_eq)
|
|
108 |
|
|
109 |
lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)"
|
|
110 |
proof-
|
|
111 |
have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S] oS cT
|
|
112 |
by (auto simp add: topspace_def openin_subset)
|
|
113 |
then show ?thesis using oS cT by (auto simp add: closedin_def)
|
|
114 |
qed
|
|
115 |
|
|
116 |
lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)"
|
|
117 |
proof-
|
|
118 |
have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S] oS cT
|
|
119 |
by (auto simp add: topspace_def )
|
|
120 |
then show ?thesis using oS cT by (auto simp add: openin_closedin_eq)
|
|
121 |
qed
|
|
122 |
|
|
123 |
subsection{* Subspace topology. *}
|
|
124 |
|
|
125 |
definition "subtopology U V = topology {S \<inter> V |S. openin U S}"
|
|
126 |
|
|
127 |
lemma istopology_subtopology: "istopology {S \<inter> V |S. openin U S}" (is "istopology ?L")
|
|
128 |
proof-
|
|
129 |
have "{} \<in> ?L" by blast
|
|
130 |
{fix A B assume A: "A \<in> ?L" and B: "B \<in> ?L"
|
|
131 |
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
|
|
132 |
have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)" using Sa Sb by blast+
|
|
133 |
then have "A \<inter> B \<in> ?L" by blast}
|
|
134 |
moreover
|
|
135 |
{fix K assume K: "K \<subseteq> ?L"
|
|
136 |
have th0: "?L = (\<lambda>S. S \<inter> V) ` openin U "
|
|
137 |
apply (rule set_ext)
|
|
138 |
apply (simp add: Ball_def image_iff)
|
|
139 |
by (metis mem_def)
|
|
140 |
from K[unfolded th0 subset_image_iff]
|
|
141 |
obtain Sk where Sk: "Sk \<subseteq> openin U" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast
|
|
142 |
have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto
|
|
143 |
moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq mem_def)
|
|
144 |
ultimately have "\<Union>K \<in> ?L" by blast}
|
|
145 |
ultimately show ?thesis unfolding istopology_def by blast
|
|
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]
|
|
151 |
by (auto simp add: Collect_def)
|
|
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 |
|
|
188 |
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"
|
|
189 |
by (simp add: subtopology_superset)
|
|
190 |
|
|
191 |
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"
|
|
192 |
by (simp add: subtopology_superset)
|
|
193 |
|
|
194 |
subsection{* The universal Euclidean versions are what we use most of the time *}
|
|
195 |
|
|
196 |
definition
|
|
197 |
euclidean :: "'a::topological_space topology" where
|
|
198 |
"euclidean = topology open"
|
|
199 |
|
|
200 |
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"
|
|
201 |
unfolding euclidean_def
|
|
202 |
apply (rule cong[where x=S and y=S])
|
|
203 |
apply (rule topology_inverse[symmetric])
|
|
204 |
apply (auto simp add: istopology_def)
|
|
205 |
by (auto simp add: mem_def subset_eq)
|
|
206 |
|
|
207 |
lemma topspace_euclidean: "topspace euclidean = UNIV"
|
|
208 |
apply (simp add: topspace_def)
|
|
209 |
apply (rule set_ext)
|
|
210 |
by (auto simp add: open_openin[symmetric])
|
|
211 |
|
|
212 |
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
|
|
213 |
by (simp add: topspace_euclidean topspace_subtopology)
|
|
214 |
|
|
215 |
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
|
|
216 |
by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV)
|
|
217 |
|
|
218 |
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
|
|
219 |
by (simp add: open_openin openin_subopen[symmetric])
|
|
220 |
|
|
221 |
subsection{* Open and closed balls. *}
|
|
222 |
|
|
223 |
definition
|
|
224 |
ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
|
|
225 |
"ball x e = {y. dist x y < e}"
|
|
226 |
|
|
227 |
definition
|
|
228 |
cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
|
|
229 |
"cball x e = {y. dist x y \<le> e}"
|
|
230 |
|
|
231 |
lemma mem_ball[simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" by (simp add: ball_def)
|
|
232 |
lemma mem_cball[simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" by (simp add: cball_def)
|
|
233 |
|
|
234 |
lemma mem_ball_0 [simp]:
|
|
235 |
fixes x :: "'a::real_normed_vector"
|
|
236 |
shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"
|
|
237 |
by (simp add: dist_norm)
|
|
238 |
|
|
239 |
lemma mem_cball_0 [simp]:
|
|
240 |
fixes x :: "'a::real_normed_vector"
|
|
241 |
shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
|
|
242 |
by (simp add: dist_norm)
|
|
243 |
|
|
244 |
lemma centre_in_cball[simp]: "x \<in> cball x e \<longleftrightarrow> 0\<le> e" by simp
|
|
245 |
lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq)
|
|
246 |
lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq)
|
|
247 |
lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq)
|
|
248 |
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"
|
|
249 |
by (simp add: expand_set_eq) arith
|
|
250 |
|
|
251 |
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"
|
|
252 |
by (simp add: expand_set_eq)
|
|
253 |
|
|
254 |
subsection{* Topological properties of open balls *}
|
|
255 |
|
|
256 |
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b"
|
|
257 |
"(a::real) - b < 0 \<longleftrightarrow> a < b"
|
|
258 |
"a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+
|
|
259 |
lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b"
|
|
260 |
"a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b" by arith+
|
|
261 |
|
|
262 |
lemma open_ball[intro, simp]: "open (ball x e)"
|
|
263 |
unfolding open_dist ball_def Collect_def Ball_def mem_def
|
|
264 |
unfolding dist_commute
|
|
265 |
apply clarify
|
|
266 |
apply (rule_tac x="e - dist xa x" in exI)
|
|
267 |
using dist_triangle_alt[where z=x]
|
|
268 |
apply (clarsimp simp add: diff_less_iff)
|
|
269 |
apply atomize
|
|
270 |
apply (erule_tac x="y" in allE)
|
|
271 |
apply (erule_tac x="xa" in allE)
|
|
272 |
by arith
|
|
273 |
|
|
274 |
lemma centre_in_ball[simp]: "x \<in> ball x e \<longleftrightarrow> e > 0" by (metis mem_ball dist_self)
|
|
275 |
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)"
|
|
276 |
unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..
|
|
277 |
|
|
278 |
lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
|
|
279 |
by (metis open_contains_ball subset_eq centre_in_ball)
|
|
280 |
|
|
281 |
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
|
|
282 |
unfolding mem_ball expand_set_eq
|
|
283 |
apply (simp add: not_less)
|
|
284 |
by (metis zero_le_dist order_trans dist_self)
|
|
285 |
|
|
286 |
lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
|
|
287 |
|
|
288 |
subsection{* Basic "localization" results are handy for connectedness. *}
|
|
289 |
|
|
290 |
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
|
|
291 |
by (auto simp add: openin_subtopology open_openin[symmetric])
|
|
292 |
|
|
293 |
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
|
|
294 |
by (auto simp add: openin_open)
|
|
295 |
|
|
296 |
lemma open_openin_trans[trans]:
|
|
297 |
"open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
|
|
298 |
by (metis Int_absorb1 openin_open_Int)
|
|
299 |
|
|
300 |
lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
|
|
301 |
by (auto simp add: openin_open)
|
|
302 |
|
|
303 |
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
|
|
304 |
by (simp add: closedin_subtopology closed_closedin Int_ac)
|
|
305 |
|
|
306 |
lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)"
|
|
307 |
by (metis closedin_closed)
|
|
308 |
|
|
309 |
lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"
|
|
310 |
apply (subgoal_tac "S \<inter> T = T" )
|
|
311 |
apply auto
|
|
312 |
apply (frule closedin_closed_Int[of T S])
|
|
313 |
by simp
|
|
314 |
|
|
315 |
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
|
|
316 |
by (auto simp add: closedin_closed)
|
|
317 |
|
|
318 |
lemma openin_euclidean_subtopology_iff:
|
|
319 |
fixes S U :: "'a::metric_space set"
|
|
320 |
shows "openin (subtopology euclidean U) S
|
|
321 |
\<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")
|
|
322 |
proof-
|
|
323 |
{assume ?lhs hence ?rhs unfolding openin_subtopology open_openin[symmetric]
|
|
324 |
by (simp add: open_dist) blast}
|
|
325 |
moreover
|
|
326 |
{assume SU: "S \<subseteq> U" and H: "\<And>x. x \<in> S \<Longrightarrow> \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x' \<in> S"
|
|
327 |
from H obtain d where d: "\<And>x . x\<in> S \<Longrightarrow> d x > 0 \<and> (\<forall>x' \<in> U. dist x' x < d x \<longrightarrow> x' \<in> S)"
|
|
328 |
by metis
|
|
329 |
let ?T = "\<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
|
|
330 |
have oT: "open ?T" by auto
|
|
331 |
{ fix x assume "x\<in>S"
|
|
332 |
hence "x \<in> \<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
|
|
333 |
apply simp apply(rule_tac x="ball x(d x)" in exI) apply auto
|
|
334 |
by (rule d [THEN conjunct1])
|
|
335 |
hence "x\<in> ?T \<inter> U" using SU and `x\<in>S` by auto }
|
|
336 |
moreover
|
|
337 |
{ fix y assume "y\<in>?T"
|
|
338 |
then obtain B where "y\<in>B" "B\<in>{B. \<exists>x\<in>S. B = ball x (d x)}" by auto
|
|
339 |
then obtain x where "x\<in>S" and x:"y \<in> ball x (d x)" by auto
|
|
340 |
assume "y\<in>U"
|
|
341 |
hence "y\<in>S" using d[OF `x\<in>S`] and x by(auto simp add: dist_commute) }
|
|
342 |
ultimately have "S = ?T \<inter> U" by blast
|
|
343 |
with oT have ?lhs unfolding openin_subtopology open_openin[symmetric] by blast}
|
|
344 |
ultimately show ?thesis by blast
|
|
345 |
qed
|
|
346 |
|
|
347 |
text{* These "transitivity" results are handy too. *}
|
|
348 |
|
|
349 |
lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T
|
|
350 |
\<Longrightarrow> openin (subtopology euclidean U) S"
|
|
351 |
unfolding open_openin openin_open by blast
|
|
352 |
|
|
353 |
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
|
|
354 |
by (auto simp add: openin_open intro: openin_trans)
|
|
355 |
|
|
356 |
lemma closedin_trans[trans]:
|
|
357 |
"closedin (subtopology euclidean T) S \<Longrightarrow>
|
|
358 |
closedin (subtopology euclidean U) T
|
|
359 |
==> closedin (subtopology euclidean U) S"
|
|
360 |
by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)
|
|
361 |
|
|
362 |
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
|
|
363 |
by (auto simp add: closedin_closed intro: closedin_trans)
|
|
364 |
|
|
365 |
subsection{* Connectedness *}
|
|
366 |
|
|
367 |
definition "connected S \<longleftrightarrow>
|
|
368 |
~(\<exists>e1 e2. open e1 \<and> open e2 \<and> S \<subseteq> (e1 \<union> e2) \<and> (e1 \<inter> e2 \<inter> S = {})
|
|
369 |
\<and> ~(e1 \<inter> S = {}) \<and> ~(e2 \<inter> S = {}))"
|
|
370 |
|
|
371 |
lemma connected_local:
|
|
372 |
"connected S \<longleftrightarrow> ~(\<exists>e1 e2.
|
|
373 |
openin (subtopology euclidean S) e1 \<and>
|
|
374 |
openin (subtopology euclidean S) e2 \<and>
|
|
375 |
S \<subseteq> e1 \<union> e2 \<and>
|
|
376 |
e1 \<inter> e2 = {} \<and>
|
|
377 |
~(e1 = {}) \<and>
|
|
378 |
~(e2 = {}))"
|
|
379 |
unfolding connected_def openin_open by (safe, blast+)
|
|
380 |
|
|
381 |
lemma exists_diff: "(\<exists>S. P(UNIV - S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs")
|
|
382 |
proof-
|
|
383 |
|
|
384 |
{assume "?lhs" hence ?rhs by blast }
|
|
385 |
moreover
|
|
386 |
{fix S assume H: "P S"
|
|
387 |
have "S = UNIV - (UNIV - S)" by auto
|
|
388 |
with H have "P (UNIV - (UNIV - S))" by metis }
|
|
389 |
ultimately show ?thesis by metis
|
|
390 |
qed
|
|
391 |
|
|
392 |
lemma connected_clopen: "connected S \<longleftrightarrow>
|
|
393 |
(\<forall>T. openin (subtopology euclidean S) T \<and>
|
|
394 |
closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
|
|
395 |
proof-
|
|
396 |
have " \<not> connected S \<longleftrightarrow> (\<exists>e1 e2. open e1 \<and> open (UNIV - e2) \<and> S \<subseteq> e1 \<union> (UNIV - e2) \<and> e1 \<inter> (UNIV - e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (UNIV - e2) \<inter> S \<noteq> {})"
|
|
397 |
unfolding connected_def openin_open closedin_closed
|
|
398 |
apply (subst exists_diff) by blast
|
|
399 |
hence th0: "connected S \<longleftrightarrow> \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (UNIV - e2) \<and> e1 \<inter> (UNIV - e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (UNIV - e2) \<inter> S \<noteq> {})"
|
|
400 |
(is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def Compl_eq_Diff_UNIV) by metis
|
|
401 |
|
|
402 |
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'))"
|
|
403 |
(is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
|
|
404 |
unfolding connected_def openin_open closedin_closed by auto
|
|
405 |
{fix e2
|
|
406 |
{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)"
|
|
407 |
by auto}
|
|
408 |
then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis}
|
|
409 |
then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast
|
|
410 |
then show ?thesis unfolding th0 th1 by simp
|
|
411 |
qed
|
|
412 |
|
|
413 |
lemma connected_empty[simp, intro]: "connected {}"
|
|
414 |
by (simp add: connected_def)
|
|
415 |
|
|
416 |
subsection{* Hausdorff and other separation properties *}
|
|
417 |
|
|
418 |
class t0_space =
|
|
419 |
assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)"
|
|
420 |
|
|
421 |
class t1_space =
|
|
422 |
assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<notin> U \<and> x \<notin> V \<and> y \<in> V"
|
|
423 |
begin
|
|
424 |
|
|
425 |
subclass t0_space
|
|
426 |
proof
|
|
427 |
qed (fast dest: t1_space)
|
|
428 |
|
|
429 |
end
|
|
430 |
|
|
431 |
text {* T2 spaces are also known as Hausdorff spaces. *}
|
|
432 |
|
|
433 |
class t2_space =
|
|
434 |
assumes hausdorff: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
|
|
435 |
begin
|
|
436 |
|
|
437 |
subclass t1_space
|
|
438 |
proof
|
|
439 |
qed (fast dest: hausdorff)
|
|
440 |
|
|
441 |
end
|
|
442 |
|
|
443 |
instance metric_space \<subseteq> t2_space
|
|
444 |
proof
|
|
445 |
fix x y :: "'a::metric_space"
|
|
446 |
assume xy: "x \<noteq> y"
|
|
447 |
let ?U = "ball x (dist x y / 2)"
|
|
448 |
let ?V = "ball y (dist x y / 2)"
|
|
449 |
have th0: "\<And>d x y z. (d x z :: real) <= d x y + d y z \<Longrightarrow> d y z = d z y
|
|
450 |
==> ~(d x y * 2 < d x z \<and> d z y * 2 < d x z)" by arith
|
|
451 |
have "open ?U \<and> open ?V \<and> x \<in> ?U \<and> y \<in> ?V \<and> ?U \<inter> ?V = {}"
|
|
452 |
using dist_pos_lt[OF xy] th0[of dist,OF dist_triangle dist_commute]
|
|
453 |
by (auto simp add: expand_set_eq)
|
|
454 |
then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
|
|
455 |
by blast
|
|
456 |
qed
|
|
457 |
|
|
458 |
lemma separation_t2:
|
|
459 |
fixes x y :: "'a::t2_space"
|
|
460 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {})"
|
|
461 |
using hausdorff[of x y] by blast
|
|
462 |
|
|
463 |
lemma separation_t1:
|
|
464 |
fixes x y :: "'a::t1_space"
|
|
465 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in>U \<and> y\<notin> U \<and> x\<notin>V \<and> y\<in>V)"
|
|
466 |
using t1_space[of x y] by blast
|
|
467 |
|
|
468 |
lemma separation_t0:
|
|
469 |
fixes x y :: "'a::t0_space"
|
|
470 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> ~(x\<in>U \<longleftrightarrow> y\<in>U))"
|
|
471 |
using t0_space[of x y] by blast
|
|
472 |
|
|
473 |
subsection{* Limit points *}
|
|
474 |
|
|
475 |
definition
|
|
476 |
islimpt:: "'a::topological_space \<Rightarrow> 'a set \<Rightarrow> bool"
|
|
477 |
(infixr "islimpt" 60) where
|
|
478 |
"x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))"
|
|
479 |
|
|
480 |
lemma islimptI:
|
|
481 |
assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"
|
|
482 |
shows "x islimpt S"
|
|
483 |
using assms unfolding islimpt_def by auto
|
|
484 |
|
|
485 |
lemma islimptE:
|
|
486 |
assumes "x islimpt S" and "x \<in> T" and "open T"
|
|
487 |
obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"
|
|
488 |
using assms unfolding islimpt_def by auto
|
|
489 |
|
|
490 |
lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T ==> x islimpt T" by (auto simp add: islimpt_def)
|
|
491 |
|
|
492 |
lemma islimpt_approachable:
|
|
493 |
fixes x :: "'a::metric_space"
|
|
494 |
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)"
|
|
495 |
unfolding islimpt_def
|
|
496 |
apply auto
|
|
497 |
apply(erule_tac x="ball x e" in allE)
|
|
498 |
apply auto
|
|
499 |
apply(rule_tac x=y in bexI)
|
|
500 |
apply (auto simp add: dist_commute)
|
|
501 |
apply (simp add: open_dist, drule (1) bspec)
|
|
502 |
apply (clarify, drule spec, drule (1) mp, auto)
|
|
503 |
done
|
|
504 |
|
|
505 |
lemma islimpt_approachable_le:
|
|
506 |
fixes x :: "'a::metric_space"
|
|
507 |
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)"
|
|
508 |
unfolding islimpt_approachable
|
|
509 |
using approachable_lt_le[where f="\<lambda>x'. dist x' x" and P="\<lambda>x'. \<not> (x'\<in>S \<and> x'\<noteq>x)"]
|
33324
|
510 |
by metis
|
33175
|
511 |
|
|
512 |
class perfect_space =
|
|
513 |
(* FIXME: perfect_space should inherit from topological_space *)
|
|
514 |
assumes islimpt_UNIV [simp, intro]: "(x::'a::metric_space) islimpt UNIV"
|
|
515 |
|
|
516 |
lemma perfect_choose_dist:
|
|
517 |
fixes x :: "'a::perfect_space"
|
|
518 |
shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
|
|
519 |
using islimpt_UNIV [of x]
|
|
520 |
by (simp add: islimpt_approachable)
|
|
521 |
|
|
522 |
instance real :: perfect_space
|
|
523 |
apply default
|
|
524 |
apply (rule islimpt_approachable [THEN iffD2])
|
|
525 |
apply (clarify, rule_tac x="x + e/2" in bexI)
|
|
526 |
apply (auto simp add: dist_norm)
|
|
527 |
done
|
|
528 |
|
|
529 |
instance "^" :: (perfect_space, finite) perfect_space
|
|
530 |
proof
|
|
531 |
fix x :: "'a ^ 'b"
|
|
532 |
{
|
|
533 |
fix e :: real assume "0 < e"
|
|
534 |
def a \<equiv> "x $ undefined"
|
|
535 |
have "a islimpt UNIV" by (rule islimpt_UNIV)
|
|
536 |
with `0 < e` obtain b where "b \<noteq> a" and "dist b a < e"
|
|
537 |
unfolding islimpt_approachable by auto
|
|
538 |
def y \<equiv> "Cart_lambda ((Cart_nth x)(undefined := b))"
|
|
539 |
from `b \<noteq> a` have "y \<noteq> x"
|
|
540 |
unfolding a_def y_def by (simp add: Cart_eq)
|
|
541 |
from `dist b a < e` have "dist y x < e"
|
|
542 |
unfolding dist_vector_def a_def y_def
|
|
543 |
apply simp
|
|
544 |
apply (rule le_less_trans [OF setL2_le_setsum [OF zero_le_dist]])
|
|
545 |
apply (subst setsum_diff1' [where a=undefined], simp, simp, simp)
|
|
546 |
done
|
|
547 |
from `y \<noteq> x` and `dist y x < e`
|
|
548 |
have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto
|
|
549 |
}
|
|
550 |
then show "x islimpt UNIV" unfolding islimpt_approachable by blast
|
|
551 |
qed
|
|
552 |
|
|
553 |
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)"
|
|
554 |
unfolding closed_def
|
|
555 |
apply (subst open_subopen)
|
|
556 |
apply (simp add: islimpt_def subset_eq Compl_eq_Diff_UNIV)
|
|
557 |
by (metis DiffE DiffI UNIV_I insertCI insert_absorb mem_def)
|
|
558 |
|
|
559 |
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
|
|
560 |
unfolding islimpt_def by auto
|
|
561 |
|
|
562 |
lemma closed_positive_orthant: "closed {x::real^'n::finite. \<forall>i. 0 \<le>x$i}"
|
|
563 |
proof-
|
|
564 |
let ?U = "UNIV :: 'n set"
|
|
565 |
let ?O = "{x::real^'n. \<forall>i. x$i\<ge>0}"
|
|
566 |
{fix x:: "real^'n" and i::'n assume H: "\<forall>e>0. \<exists>x'\<in>?O. x' \<noteq> x \<and> dist x' x < e"
|
|
567 |
and xi: "x$i < 0"
|
|
568 |
from xi have th0: "-x$i > 0" by arith
|
|
569 |
from H[rule_format, OF th0] obtain x' where x': "x' \<in>?O" "x' \<noteq> x" "dist x' x < -x $ i" by blast
|
|
570 |
have th:" \<And>b a (x::real). abs x <= b \<Longrightarrow> b <= a ==> ~(a + x < 0)" by arith
|
|
571 |
have th': "\<And>x (y::real). x < 0 \<Longrightarrow> 0 <= y ==> abs x <= abs (y - x)" by arith
|
|
572 |
have th1: "\<bar>x$i\<bar> \<le> \<bar>(x' - x)$i\<bar>" using x'(1) xi
|
|
573 |
apply (simp only: vector_component)
|
|
574 |
by (rule th') auto
|
|
575 |
have th2: "\<bar>dist x x'\<bar> \<ge> \<bar>(x' - x)$i\<bar>" using component_le_norm[of "x'-x" i]
|
|
576 |
apply (simp add: dist_norm) by norm
|
|
577 |
from th[OF th1 th2] x'(3) have False by (simp add: dist_commute) }
|
|
578 |
then show ?thesis unfolding closed_limpt islimpt_approachable
|
|
579 |
unfolding not_le[symmetric] by blast
|
|
580 |
qed
|
|
581 |
|
|
582 |
lemma finite_set_avoid:
|
|
583 |
fixes a :: "'a::metric_space"
|
|
584 |
assumes fS: "finite S" shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x"
|
|
585 |
proof(induct rule: finite_induct[OF fS])
|
|
586 |
case 1 thus ?case apply auto by ferrack
|
|
587 |
next
|
|
588 |
case (2 x F)
|
|
589 |
from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast
|
|
590 |
{assume "x = a" hence ?case using d by auto }
|
|
591 |
moreover
|
|
592 |
{assume xa: "x\<noteq>a"
|
|
593 |
let ?d = "min d (dist a x)"
|
|
594 |
have dp: "?d > 0" using xa d(1) using dist_nz by auto
|
|
595 |
from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto
|
|
596 |
with dp xa have ?case by(auto intro!: exI[where x="?d"]) }
|
|
597 |
ultimately show ?case by blast
|
|
598 |
qed
|
|
599 |
|
|
600 |
lemma islimpt_finite:
|
|
601 |
fixes S :: "'a::metric_space set"
|
|
602 |
assumes fS: "finite S" shows "\<not> a islimpt S"
|
|
603 |
unfolding islimpt_approachable
|
|
604 |
using finite_set_avoid[OF fS, of a] by (metis dist_commute not_le)
|
|
605 |
|
|
606 |
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"
|
|
607 |
apply (rule iffI)
|
|
608 |
defer
|
|
609 |
apply (metis Un_upper1 Un_upper2 islimpt_subset)
|
|
610 |
unfolding islimpt_def
|
|
611 |
apply (rule ccontr, clarsimp, rename_tac A B)
|
|
612 |
apply (drule_tac x="A \<inter> B" in spec)
|
|
613 |
apply (auto simp add: open_Int)
|
|
614 |
done
|
|
615 |
|
|
616 |
lemma discrete_imp_closed:
|
|
617 |
fixes S :: "'a::metric_space set"
|
|
618 |
assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x"
|
|
619 |
shows "closed S"
|
|
620 |
proof-
|
|
621 |
{fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
|
|
622 |
from e have e2: "e/2 > 0" by arith
|
|
623 |
from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast
|
|
624 |
let ?m = "min (e/2) (dist x y) "
|
|
625 |
from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym])
|
|
626 |
from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast
|
|
627 |
have th: "dist z y < e" using z y
|
|
628 |
by (intro dist_triangle_lt [where z=x], simp)
|
|
629 |
from d[rule_format, OF y(1) z(1) th] y z
|
|
630 |
have False by (auto simp add: dist_commute)}
|
|
631 |
then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a])
|
|
632 |
qed
|
|
633 |
|
|
634 |
subsection{* Interior of a Set *}
|
|
635 |
definition "interior S = {x. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S}"
|
|
636 |
|
|
637 |
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"
|
|
638 |
apply (simp add: expand_set_eq interior_def)
|
|
639 |
apply (subst (2) open_subopen) by (safe, blast+)
|
|
640 |
|
|
641 |
lemma interior_open: "open S ==> (interior S = S)" by (metis interior_eq)
|
|
642 |
|
|
643 |
lemma interior_empty[simp]: "interior {} = {}" by (simp add: interior_def)
|
|
644 |
|
|
645 |
lemma open_interior[simp, intro]: "open(interior S)"
|
|
646 |
apply (simp add: interior_def)
|
|
647 |
apply (subst open_subopen) by blast
|
|
648 |
|
|
649 |
lemma interior_interior[simp]: "interior(interior S) = interior S" by (metis interior_eq open_interior)
|
|
650 |
lemma interior_subset: "interior S \<subseteq> S" by (auto simp add: interior_def)
|
|
651 |
lemma subset_interior: "S \<subseteq> T ==> (interior S) \<subseteq> (interior T)" by (auto simp add: interior_def)
|
|
652 |
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T ==> T \<subseteq> (interior S)" by (auto simp add: interior_def)
|
|
653 |
lemma interior_unique: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> (\<forall>T'. T' \<subseteq> S \<and> open T' \<longrightarrow> T' \<subseteq> T) \<Longrightarrow> interior S = T"
|
|
654 |
by (metis equalityI interior_maximal interior_subset open_interior)
|
|
655 |
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e. 0 < e \<and> ball x e \<subseteq> S)"
|
|
656 |
apply (simp add: interior_def)
|
|
657 |
by (metis open_contains_ball centre_in_ball open_ball subset_trans)
|
|
658 |
|
|
659 |
lemma open_subset_interior: "open S ==> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"
|
|
660 |
by (metis interior_maximal interior_subset subset_trans)
|
|
661 |
|
|
662 |
lemma interior_inter[simp]: "interior(S \<inter> T) = interior S \<inter> interior T"
|
|
663 |
apply (rule equalityI, simp)
|
|
664 |
apply (metis Int_lower1 Int_lower2 subset_interior)
|
|
665 |
by (metis Int_mono interior_subset open_Int open_interior open_subset_interior)
|
|
666 |
|
|
667 |
lemma interior_limit_point [intro]:
|
|
668 |
fixes x :: "'a::perfect_space"
|
|
669 |
assumes x: "x \<in> interior S" shows "x islimpt S"
|
|
670 |
proof-
|
|
671 |
from x obtain e where e: "e>0" "\<forall>x'. dist x x' < e \<longrightarrow> x' \<in> S"
|
|
672 |
unfolding mem_interior subset_eq Ball_def mem_ball by blast
|
|
673 |
{
|
|
674 |
fix d::real assume d: "d>0"
|
|
675 |
let ?m = "min d e"
|
|
676 |
have mde2: "0 < ?m" using e(1) d(1) by simp
|
|
677 |
from perfect_choose_dist [OF mde2, of x]
|
|
678 |
obtain y where "y \<noteq> x" and "dist y x < ?m" by blast
|
|
679 |
then have "dist y x < e" "dist y x < d" by simp_all
|
|
680 |
from `dist y x < e` e(2) have "y \<in> S" by (simp add: dist_commute)
|
|
681 |
have "\<exists>x'\<in>S. x'\<noteq> x \<and> dist x' x < d"
|
|
682 |
using `y \<in> S` `y \<noteq> x` `dist y x < d` by fast
|
|
683 |
}
|
|
684 |
then show ?thesis unfolding islimpt_approachable by blast
|
|
685 |
qed
|
|
686 |
|
|
687 |
lemma interior_closed_Un_empty_interior:
|
|
688 |
assumes cS: "closed S" and iT: "interior T = {}"
|
|
689 |
shows "interior(S \<union> T) = interior S"
|
|
690 |
proof
|
|
691 |
show "interior S \<subseteq> interior (S\<union>T)"
|
|
692 |
by (rule subset_interior, blast)
|
|
693 |
next
|
|
694 |
show "interior (S \<union> T) \<subseteq> interior S"
|
|
695 |
proof
|
|
696 |
fix x assume "x \<in> interior (S \<union> T)"
|
|
697 |
then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T"
|
|
698 |
unfolding interior_def by fast
|
|
699 |
show "x \<in> interior S"
|
|
700 |
proof (rule ccontr)
|
|
701 |
assume "x \<notin> interior S"
|
|
702 |
with `x \<in> R` `open R` obtain y where "y \<in> R - S"
|
|
703 |
unfolding interior_def expand_set_eq by fast
|
|
704 |
from `open R` `closed S` have "open (R - S)" by (rule open_Diff)
|
|
705 |
from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast
|
|
706 |
from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
|
|
707 |
show "False" unfolding interior_def by fast
|
|
708 |
qed
|
|
709 |
qed
|
|
710 |
qed
|
|
711 |
|
|
712 |
|
|
713 |
subsection{* Closure of a Set *}
|
|
714 |
|
|
715 |
definition "closure S = S \<union> {x | x. x islimpt S}"
|
|
716 |
|
|
717 |
lemma closure_interior: "closure S = UNIV - interior (UNIV - S)"
|
|
718 |
proof-
|
|
719 |
{ fix x
|
|
720 |
have "x\<in>UNIV - interior (UNIV - S) \<longleftrightarrow> x \<in> closure S" (is "?lhs = ?rhs")
|
|
721 |
proof
|
|
722 |
let ?exT = "\<lambda> y. (\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> UNIV - S)"
|
|
723 |
assume "?lhs"
|
|
724 |
hence *:"\<not> ?exT x"
|
|
725 |
unfolding interior_def
|
|
726 |
by simp
|
|
727 |
{ assume "\<not> ?rhs"
|
|
728 |
hence False using *
|
|
729 |
unfolding closure_def islimpt_def
|
|
730 |
by blast
|
|
731 |
}
|
|
732 |
thus "?rhs"
|
|
733 |
by blast
|
|
734 |
next
|
|
735 |
assume "?rhs" thus "?lhs"
|
|
736 |
unfolding closure_def interior_def islimpt_def
|
|
737 |
by blast
|
|
738 |
qed
|
|
739 |
}
|
|
740 |
thus ?thesis
|
|
741 |
by blast
|
|
742 |
qed
|
|
743 |
|
|
744 |
lemma interior_closure: "interior S = UNIV - (closure (UNIV - S))"
|
|
745 |
proof-
|
|
746 |
{ fix x
|
|
747 |
have "x \<in> interior S \<longleftrightarrow> x \<in> UNIV - (closure (UNIV - S))"
|
|
748 |
unfolding interior_def closure_def islimpt_def
|
33324
|
749 |
by auto
|
33175
|
750 |
}
|
|
751 |
thus ?thesis
|
|
752 |
by blast
|
|
753 |
qed
|
|
754 |
|
|
755 |
lemma closed_closure[simp, intro]: "closed (closure S)"
|
|
756 |
proof-
|
|
757 |
have "closed (UNIV - interior (UNIV -S))" by blast
|
|
758 |
thus ?thesis using closure_interior[of S] by simp
|
|
759 |
qed
|
|
760 |
|
|
761 |
lemma closure_hull: "closure S = closed hull S"
|
|
762 |
proof-
|
|
763 |
have "S \<subseteq> closure S"
|
|
764 |
unfolding closure_def
|
|
765 |
by blast
|
|
766 |
moreover
|
|
767 |
have "closed (closure S)"
|
|
768 |
using closed_closure[of S]
|
|
769 |
by assumption
|
|
770 |
moreover
|
|
771 |
{ fix t
|
|
772 |
assume *:"S \<subseteq> t" "closed t"
|
|
773 |
{ fix x
|
|
774 |
assume "x islimpt S"
|
|
775 |
hence "x islimpt t" using *(1)
|
|
776 |
using islimpt_subset[of x, of S, of t]
|
|
777 |
by blast
|
|
778 |
}
|
|
779 |
with * have "closure S \<subseteq> t"
|
|
780 |
unfolding closure_def
|
|
781 |
using closed_limpt[of t]
|
|
782 |
by auto
|
|
783 |
}
|
|
784 |
ultimately show ?thesis
|
|
785 |
using hull_unique[of S, of "closure S", of closed]
|
|
786 |
unfolding mem_def
|
|
787 |
by simp
|
|
788 |
qed
|
|
789 |
|
|
790 |
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"
|
|
791 |
unfolding closure_hull
|
|
792 |
using hull_eq[of closed, unfolded mem_def, OF closed_Inter, of S]
|
|
793 |
by (metis mem_def subset_eq)
|
|
794 |
|
|
795 |
lemma closure_closed[simp]: "closed S \<Longrightarrow> closure S = S"
|
|
796 |
using closure_eq[of S]
|
|
797 |
by simp
|
|
798 |
|
|
799 |
lemma closure_closure[simp]: "closure (closure S) = closure S"
|
|
800 |
unfolding closure_hull
|
|
801 |
using hull_hull[of closed S]
|
|
802 |
by assumption
|
|
803 |
|
|
804 |
lemma closure_subset: "S \<subseteq> closure S"
|
|
805 |
unfolding closure_hull
|
|
806 |
using hull_subset[of S closed]
|
|
807 |
by assumption
|
|
808 |
|
|
809 |
lemma subset_closure: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"
|
|
810 |
unfolding closure_hull
|
|
811 |
using hull_mono[of S T closed]
|
|
812 |
by assumption
|
|
813 |
|
|
814 |
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T"
|
|
815 |
using hull_minimal[of S T closed]
|
|
816 |
unfolding closure_hull mem_def
|
|
817 |
by simp
|
|
818 |
|
|
819 |
lemma closure_unique: "S \<subseteq> T \<and> closed T \<and> (\<forall> T'. S \<subseteq> T' \<and> closed T' \<longrightarrow> T \<subseteq> T') \<Longrightarrow> closure S = T"
|
|
820 |
using hull_unique[of S T closed]
|
|
821 |
unfolding closure_hull mem_def
|
|
822 |
by simp
|
|
823 |
|
|
824 |
lemma closure_empty[simp]: "closure {} = {}"
|
|
825 |
using closed_empty closure_closed[of "{}"]
|
|
826 |
by simp
|
|
827 |
|
|
828 |
lemma closure_univ[simp]: "closure UNIV = UNIV"
|
|
829 |
using closure_closed[of UNIV]
|
|
830 |
by simp
|
|
831 |
|
|
832 |
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
|
|
833 |
using closure_empty closure_subset[of S]
|
|
834 |
by blast
|
|
835 |
|
|
836 |
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"
|
|
837 |
using closure_eq[of S] closure_subset[of S]
|
|
838 |
by simp
|
|
839 |
|
|
840 |
lemma open_inter_closure_eq_empty:
|
|
841 |
"open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
|
|
842 |
using open_subset_interior[of S "UNIV - T"]
|
|
843 |
using interior_subset[of "UNIV - T"]
|
|
844 |
unfolding closure_interior
|
|
845 |
by auto
|
|
846 |
|
|
847 |
lemma open_inter_closure_subset:
|
|
848 |
"open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"
|
|
849 |
proof
|
|
850 |
fix x
|
|
851 |
assume as: "open S" "x \<in> S \<inter> closure T"
|
|
852 |
{ assume *:"x islimpt T"
|
|
853 |
have "x islimpt (S \<inter> T)"
|
|
854 |
proof (rule islimptI)
|
|
855 |
fix A
|
|
856 |
assume "x \<in> A" "open A"
|
|
857 |
with as have "x \<in> A \<inter> S" "open (A \<inter> S)"
|
|
858 |
by (simp_all add: open_Int)
|
|
859 |
with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x"
|
|
860 |
by (rule islimptE)
|
|
861 |
hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"
|
|
862 |
by simp_all
|
|
863 |
thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..
|
|
864 |
qed
|
|
865 |
}
|
|
866 |
then show "x \<in> closure (S \<inter> T)" using as
|
|
867 |
unfolding closure_def
|
|
868 |
by blast
|
|
869 |
qed
|
|
870 |
|
|
871 |
lemma closure_complement: "closure(UNIV - S) = UNIV - interior(S)"
|
|
872 |
proof-
|
|
873 |
have "S = UNIV - (UNIV - S)"
|
|
874 |
by auto
|
|
875 |
thus ?thesis
|
|
876 |
unfolding closure_interior
|
|
877 |
by auto
|
|
878 |
qed
|
|
879 |
|
|
880 |
lemma interior_complement: "interior(UNIV - S) = UNIV - closure(S)"
|
|
881 |
unfolding closure_interior
|
|
882 |
by blast
|
|
883 |
|
|
884 |
subsection{* Frontier (aka boundary) *}
|
|
885 |
|
|
886 |
definition "frontier S = closure S - interior S"
|
|
887 |
|
|
888 |
lemma frontier_closed: "closed(frontier S)"
|
|
889 |
by (simp add: frontier_def closed_Diff)
|
|
890 |
|
|
891 |
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(UNIV - S))"
|
|
892 |
by (auto simp add: frontier_def interior_closure)
|
|
893 |
|
|
894 |
lemma frontier_straddle:
|
|
895 |
fixes a :: "'a::metric_space"
|
|
896 |
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")
|
|
897 |
proof
|
|
898 |
assume "?lhs"
|
|
899 |
{ fix e::real
|
|
900 |
assume "e > 0"
|
|
901 |
let ?rhse = "(\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)"
|
|
902 |
{ assume "a\<in>S"
|
|
903 |
have "\<exists>x\<in>S. dist a x < e" using `e>0` `a\<in>S` by(rule_tac x=a in bexI) auto
|
|
904 |
moreover have "\<exists>x. x \<notin> S \<and> dist a x < e" using `?lhs` `a\<in>S`
|
|
905 |
unfolding frontier_closures closure_def islimpt_def using `e>0`
|
|
906 |
by (auto, erule_tac x="ball a e" in allE, auto)
|
|
907 |
ultimately have ?rhse by auto
|
|
908 |
}
|
|
909 |
moreover
|
|
910 |
{ assume "a\<notin>S"
|
|
911 |
hence ?rhse using `?lhs`
|
|
912 |
unfolding frontier_closures closure_def islimpt_def
|
|
913 |
using open_ball[of a e] `e > 0`
|
33324
|
914 |
by simp (metis centre_in_ball mem_ball open_ball)
|
33175
|
915 |
}
|
|
916 |
ultimately have ?rhse by auto
|
|
917 |
}
|
|
918 |
thus ?rhs by auto
|
|
919 |
next
|
|
920 |
assume ?rhs
|
|
921 |
moreover
|
|
922 |
{ fix T assume "a\<notin>S" and
|
|
923 |
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"
|
|
924 |
from `open T` `a \<in> T` have "\<exists>e>0. ball a e \<subseteq> T" unfolding open_contains_ball[of T] by auto
|
|
925 |
then obtain e where "e>0" "ball a e \<subseteq> T" by auto
|
|
926 |
then obtain y where y:"y\<in>S" "dist a y < e" using as(1) by auto
|
|
927 |
have "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> a"
|
|
928 |
using `dist a y < e` `ball a e \<subseteq> T` unfolding ball_def using `y\<in>S` `a\<notin>S` by auto
|
|
929 |
}
|
|
930 |
hence "a \<in> closure S" unfolding closure_def islimpt_def using `?rhs` by auto
|
|
931 |
moreover
|
|
932 |
{ fix T assume "a \<in> T" "open T" "a\<in>S"
|
|
933 |
then obtain e where "e>0" and balle: "ball a e \<subseteq> T" unfolding open_contains_ball using `?rhs` by auto
|
|
934 |
obtain x where "x \<notin> S" "dist a x < e" using `?rhs` using `e>0` by auto
|
|
935 |
hence "\<exists>y\<in>UNIV - S. y \<in> T \<and> y \<noteq> a" using balle `a\<in>S` unfolding ball_def by (rule_tac x=x in bexI)auto
|
|
936 |
}
|
|
937 |
hence "a islimpt (UNIV - S) \<or> a\<notin>S" unfolding islimpt_def by auto
|
|
938 |
ultimately show ?lhs unfolding frontier_closures using closure_def[of "UNIV - S"] by auto
|
|
939 |
qed
|
|
940 |
|
|
941 |
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"
|
|
942 |
by (metis frontier_def closure_closed Diff_subset)
|
|
943 |
|
|
944 |
lemma frontier_empty: "frontier {} = {}"
|
|
945 |
by (simp add: frontier_def closure_empty)
|
|
946 |
|
|
947 |
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"
|
|
948 |
proof-
|
|
949 |
{ assume "frontier S \<subseteq> S"
|
|
950 |
hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto
|
|
951 |
hence "closed S" using closure_subset_eq by auto
|
|
952 |
}
|
|
953 |
thus ?thesis using frontier_subset_closed[of S] by auto
|
|
954 |
qed
|
|
955 |
|
|
956 |
lemma frontier_complement: "frontier(UNIV - S) = frontier S"
|
|
957 |
by (auto simp add: frontier_def closure_complement interior_complement)
|
|
958 |
|
|
959 |
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
|
|
960 |
using frontier_complement frontier_subset_eq[of "UNIV - S"]
|
|
961 |
unfolding open_closed Compl_eq_Diff_UNIV by auto
|
|
962 |
|
|
963 |
subsection{* Common nets and The "within" modifier for nets. *}
|
|
964 |
|
|
965 |
definition
|
|
966 |
at_infinity :: "'a::real_normed_vector net" where
|
|
967 |
"at_infinity = Abs_net (range (\<lambda>r. {x. r \<le> norm x}))"
|
|
968 |
|
|
969 |
definition
|
|
970 |
indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a net" (infixr "indirection" 70) where
|
|
971 |
"a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
|
|
972 |
|
|
973 |
text{* Prove That They are all nets. *}
|
|
974 |
|
|
975 |
lemma Rep_net_at_infinity:
|
|
976 |
"Rep_net at_infinity = range (\<lambda>r. {x. r \<le> norm x})"
|
|
977 |
unfolding at_infinity_def
|
|
978 |
apply (rule Abs_net_inverse')
|
|
979 |
apply (rule image_nonempty, simp)
|
|
980 |
apply (clarsimp, rename_tac r s)
|
|
981 |
apply (rule_tac x="max r s" in exI, auto)
|
|
982 |
done
|
|
983 |
|
|
984 |
lemma within_UNIV: "net within UNIV = net"
|
|
985 |
by (simp add: Rep_net_inject [symmetric] Rep_net_within)
|
|
986 |
|
|
987 |
subsection{* Identify Trivial limits, where we can't approach arbitrarily closely. *}
|
|
988 |
|
|
989 |
definition
|
|
990 |
trivial_limit :: "'a net \<Rightarrow> bool" where
|
|
991 |
"trivial_limit net \<longleftrightarrow> {} \<in> Rep_net net"
|
|
992 |
|
|
993 |
lemma trivial_limit_within:
|
|
994 |
shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"
|
|
995 |
proof
|
|
996 |
assume "trivial_limit (at a within S)"
|
|
997 |
thus "\<not> a islimpt S"
|
|
998 |
unfolding trivial_limit_def
|
|
999 |
unfolding Rep_net_within Rep_net_at
|
|
1000 |
unfolding islimpt_def
|
|
1001 |
apply (clarsimp simp add: expand_set_eq)
|
|
1002 |
apply (rename_tac T, rule_tac x=T in exI)
|
|
1003 |
apply (clarsimp, drule_tac x=y in spec, simp)
|
|
1004 |
done
|
|
1005 |
next
|
|
1006 |
assume "\<not> a islimpt S"
|
|
1007 |
thus "trivial_limit (at a within S)"
|
|
1008 |
unfolding trivial_limit_def
|
|
1009 |
unfolding Rep_net_within Rep_net_at
|
|
1010 |
unfolding islimpt_def
|
|
1011 |
apply (clarsimp simp add: image_image)
|
|
1012 |
apply (rule_tac x=T in image_eqI)
|
|
1013 |
apply (auto simp add: expand_set_eq)
|
|
1014 |
done
|
|
1015 |
qed
|
|
1016 |
|
|
1017 |
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"
|
|
1018 |
using trivial_limit_within [of a UNIV]
|
|
1019 |
by (simp add: within_UNIV)
|
|
1020 |
|
|
1021 |
lemma trivial_limit_at:
|
|
1022 |
fixes a :: "'a::perfect_space"
|
|
1023 |
shows "\<not> trivial_limit (at a)"
|
|
1024 |
by (simp add: trivial_limit_at_iff)
|
|
1025 |
|
|
1026 |
lemma trivial_limit_at_infinity:
|
|
1027 |
"\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,zero_neq_one}) net)"
|
|
1028 |
(* FIXME: find a more appropriate type class *)
|
|
1029 |
unfolding trivial_limit_def Rep_net_at_infinity
|
|
1030 |
apply (clarsimp simp add: expand_set_eq)
|
|
1031 |
apply (drule_tac x="scaleR r (sgn 1)" in spec)
|
|
1032 |
apply (simp add: norm_sgn)
|
|
1033 |
done
|
|
1034 |
|
|
1035 |
lemma trivial_limit_sequentially: "\<not> trivial_limit sequentially"
|
|
1036 |
by (auto simp add: trivial_limit_def Rep_net_sequentially)
|
|
1037 |
|
|
1038 |
subsection{* Some property holds "sufficiently close" to the limit point. *}
|
|
1039 |
|
|
1040 |
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
|
|
1041 |
"eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
|
|
1042 |
unfolding eventually_at dist_nz by auto
|
|
1043 |
|
|
1044 |
lemma eventually_at_infinity:
|
|
1045 |
"eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)"
|
|
1046 |
unfolding eventually_def Rep_net_at_infinity by auto
|
|
1047 |
|
|
1048 |
lemma eventually_within: "eventually P (at a within S) \<longleftrightarrow>
|
|
1049 |
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
|
|
1050 |
unfolding eventually_within eventually_at dist_nz by auto
|
|
1051 |
|
|
1052 |
lemma eventually_within_le: "eventually P (at a within S) \<longleftrightarrow>
|
|
1053 |
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" (is "?lhs = ?rhs")
|
|
1054 |
unfolding eventually_within
|
33324
|
1055 |
by auto (metis Rats_dense_in_nn_real order_le_less_trans order_refl)
|
33175
|
1056 |
|
|
1057 |
lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)"
|
|
1058 |
unfolding eventually_def trivial_limit_def
|
|
1059 |
using Rep_net_nonempty [of net] by auto
|
|
1060 |
|
|
1061 |
lemma always_eventually: "(\<forall>x. P x) ==> eventually P net"
|
|
1062 |
unfolding eventually_def trivial_limit_def
|
|
1063 |
using Rep_net_nonempty [of net] by auto
|
|
1064 |
|
|
1065 |
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
|
|
1066 |
unfolding trivial_limit_def eventually_def by auto
|
|
1067 |
|
|
1068 |
lemma eventually_False: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
|
|
1069 |
unfolding trivial_limit_def eventually_def by auto
|
|
1070 |
|
|
1071 |
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"
|
|
1072 |
apply (safe elim!: trivial_limit_eventually)
|
|
1073 |
apply (simp add: eventually_False [symmetric])
|
|
1074 |
done
|
|
1075 |
|
|
1076 |
text{* Combining theorems for "eventually" *}
|
|
1077 |
|
|
1078 |
lemma eventually_conjI:
|
|
1079 |
"\<lbrakk>eventually (\<lambda>x. P x) net; eventually (\<lambda>x. Q x) net\<rbrakk>
|
|
1080 |
\<Longrightarrow> eventually (\<lambda>x. P x \<and> Q x) net"
|
|
1081 |
by (rule eventually_conj)
|
|
1082 |
|
|
1083 |
lemma eventually_rev_mono:
|
|
1084 |
"eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net"
|
|
1085 |
using eventually_mono [of P Q] by fast
|
|
1086 |
|
|
1087 |
lemma eventually_and: " eventually (\<lambda>x. P x \<and> Q x) net \<longleftrightarrow> eventually P net \<and> eventually Q net"
|
|
1088 |
by (auto intro!: eventually_conjI elim: eventually_rev_mono)
|
|
1089 |
|
|
1090 |
lemma eventually_false: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
|
|
1091 |
by (auto simp add: eventually_False)
|
|
1092 |
|
|
1093 |
lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)"
|
|
1094 |
by (simp add: eventually_False)
|
|
1095 |
|
|
1096 |
subsection{* Limits, defined as vacuously true when the limit is trivial. *}
|
|
1097 |
|
|
1098 |
text{* Notation Lim to avoid collition with lim defined in analysis *}
|
|
1099 |
definition
|
|
1100 |
Lim :: "'a net \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b" where
|
|
1101 |
"Lim net f = (THE l. (f ---> l) net)"
|
|
1102 |
|
|
1103 |
lemma Lim:
|
|
1104 |
"(f ---> l) net \<longleftrightarrow>
|
|
1105 |
trivial_limit net \<or>
|
|
1106 |
(\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"
|
|
1107 |
unfolding tendsto_iff trivial_limit_eq by auto
|
|
1108 |
|
|
1109 |
|
|
1110 |
text{* Show that they yield usual definitions in the various cases. *}
|
|
1111 |
|
|
1112 |
lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow>
|
|
1113 |
(\<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)"
|
|
1114 |
by (auto simp add: tendsto_iff eventually_within_le)
|
|
1115 |
|
|
1116 |
lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow>
|
|
1117 |
(\<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)"
|
|
1118 |
by (auto simp add: tendsto_iff eventually_within)
|
|
1119 |
|
|
1120 |
lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow>
|
|
1121 |
(\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)"
|
|
1122 |
by (auto simp add: tendsto_iff eventually_at)
|
|
1123 |
|
|
1124 |
lemma Lim_at_iff_LIM: "(f ---> l) (at a) \<longleftrightarrow> f -- a --> l"
|
|
1125 |
unfolding Lim_at LIM_def by (simp only: zero_less_dist_iff)
|
|
1126 |
|
|
1127 |
lemma Lim_at_infinity:
|
|
1128 |
"(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)"
|
|
1129 |
by (auto simp add: tendsto_iff eventually_at_infinity)
|
|
1130 |
|
|
1131 |
lemma Lim_sequentially:
|
|
1132 |
"(S ---> l) sequentially \<longleftrightarrow>
|
|
1133 |
(\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (S n) l < e)"
|
|
1134 |
by (auto simp add: tendsto_iff eventually_sequentially)
|
|
1135 |
|
|
1136 |
lemma Lim_sequentially_iff_LIMSEQ: "(S ---> l) sequentially \<longleftrightarrow> S ----> l"
|
|
1137 |
unfolding Lim_sequentially LIMSEQ_def ..
|
|
1138 |
|
|
1139 |
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net"
|
|
1140 |
by (rule topological_tendstoI, auto elim: eventually_rev_mono)
|
|
1141 |
|
|
1142 |
text{* The expected monotonicity property. *}
|
|
1143 |
|
|
1144 |
lemma Lim_within_empty: "(f ---> l) (net within {})"
|
|
1145 |
unfolding tendsto_def Limits.eventually_within by simp
|
|
1146 |
|
|
1147 |
lemma Lim_within_subset: "(f ---> l) (net within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f ---> l) (net within T)"
|
|
1148 |
unfolding tendsto_def Limits.eventually_within
|
|
1149 |
by (auto elim!: eventually_elim1)
|
|
1150 |
|
|
1151 |
lemma Lim_Un: assumes "(f ---> l) (net within S)" "(f ---> l) (net within T)"
|
|
1152 |
shows "(f ---> l) (net within (S \<union> T))"
|
|
1153 |
using assms unfolding tendsto_def Limits.eventually_within
|
|
1154 |
apply clarify
|
|
1155 |
apply (drule spec, drule (1) mp, drule (1) mp)
|
|
1156 |
apply (drule spec, drule (1) mp, drule (1) mp)
|
|
1157 |
apply (auto elim: eventually_elim2)
|
|
1158 |
done
|
|
1159 |
|
|
1160 |
lemma Lim_Un_univ:
|
|
1161 |
"(f ---> l) (net within S) \<Longrightarrow> (f ---> l) (net within T) \<Longrightarrow> S \<union> T = UNIV
|
|
1162 |
==> (f ---> l) net"
|
|
1163 |
by (metis Lim_Un within_UNIV)
|
|
1164 |
|
|
1165 |
text{* Interrelations between restricted and unrestricted limits. *}
|
|
1166 |
|
|
1167 |
lemma Lim_at_within: "(f ---> l) net ==> (f ---> l)(net within S)"
|
|
1168 |
(* FIXME: rename *)
|
|
1169 |
unfolding tendsto_def Limits.eventually_within
|
|
1170 |
apply (clarify, drule spec, drule (1) mp, drule (1) mp)
|
|
1171 |
by (auto elim!: eventually_elim1)
|
|
1172 |
|
|
1173 |
lemma Lim_within_open:
|
|
1174 |
fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
|
|
1175 |
assumes"a \<in> S" "open S"
|
|
1176 |
shows "(f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)" (is "?lhs \<longleftrightarrow> ?rhs")
|
|
1177 |
proof
|
|
1178 |
assume ?lhs
|
|
1179 |
{ fix A assume "open A" "l \<in> A"
|
|
1180 |
with `?lhs` have "eventually (\<lambda>x. f x \<in> A) (at a within S)"
|
|
1181 |
by (rule topological_tendstoD)
|
|
1182 |
hence "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x \<in> A) (at a)"
|
|
1183 |
unfolding Limits.eventually_within .
|
|
1184 |
then obtain T where "open T" "a \<in> T" "\<forall>x\<in>T. x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> f x \<in> A"
|
|
1185 |
unfolding eventually_at_topological by fast
|
|
1186 |
hence "open (T \<inter> S)" "a \<in> T \<inter> S" "\<forall>x\<in>(T \<inter> S). x \<noteq> a \<longrightarrow> f x \<in> A"
|
|
1187 |
using assms by auto
|
|
1188 |
hence "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. x \<noteq> a \<longrightarrow> f x \<in> A)"
|
|
1189 |
by fast
|
|
1190 |
hence "eventually (\<lambda>x. f x \<in> A) (at a)"
|
|
1191 |
unfolding eventually_at_topological .
|
|
1192 |
}
|
|
1193 |
thus ?rhs by (rule topological_tendstoI)
|
|
1194 |
next
|
|
1195 |
assume ?rhs
|
|
1196 |
thus ?lhs by (rule Lim_at_within)
|
|
1197 |
qed
|
|
1198 |
|
|
1199 |
text{* Another limit point characterization. *}
|
|
1200 |
|
|
1201 |
lemma islimpt_sequential:
|
|
1202 |
fixes x :: "'a::metric_space" (* FIXME: generalize to topological_space *)
|
|
1203 |
shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)"
|
|
1204 |
(is "?lhs = ?rhs")
|
|
1205 |
proof
|
|
1206 |
assume ?lhs
|
|
1207 |
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"
|
|
1208 |
unfolding islimpt_approachable using choice[of "\<lambda>e y. e>0 \<longrightarrow> y\<in>S \<and> y\<noteq>x \<and> dist y x < e"] by auto
|
|
1209 |
{ fix n::nat
|
|
1210 |
have "f (inverse (real n + 1)) \<in> S - {x}" using f by auto
|
|
1211 |
}
|
|
1212 |
moreover
|
|
1213 |
{ fix e::real assume "e>0"
|
|
1214 |
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
|
|
1215 |
then obtain N::nat where "inverse (real (N + 1)) < e" by auto
|
|
1216 |
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)
|
|
1217 |
moreover have "\<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < (inverse (real n + 1))" using f `e>0` by auto
|
|
1218 |
ultimately have "\<exists>N::nat. \<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < e" apply(rule_tac x=N in exI) apply auto apply(erule_tac x=n in allE)+ by auto
|
|
1219 |
}
|
|
1220 |
hence " ((\<lambda>n. f (inverse (real n + 1))) ---> x) sequentially"
|
|
1221 |
unfolding Lim_sequentially using f by auto
|
|
1222 |
ultimately show ?rhs apply (rule_tac x="(\<lambda>n::nat. f (inverse (real n + 1)))" in exI) by auto
|
|
1223 |
next
|
|
1224 |
assume ?rhs
|
|
1225 |
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
|
|
1226 |
{ fix e::real assume "e>0"
|
|
1227 |
then obtain N where "dist (f N) x < e" using f(2) by auto
|
|
1228 |
moreover have "f N\<in>S" "f N \<noteq> x" using f(1) by auto
|
|
1229 |
ultimately have "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" by auto
|
|
1230 |
}
|
|
1231 |
thus ?lhs unfolding islimpt_approachable by auto
|
|
1232 |
qed
|
|
1233 |
|
|
1234 |
text{* Basic arithmetical combining theorems for limits. *}
|
|
1235 |
|
|
1236 |
lemma Lim_linear:
|
|
1237 |
assumes "(f ---> l) net" "bounded_linear h"
|
|
1238 |
shows "((\<lambda>x. h (f x)) ---> h l) net"
|
|
1239 |
using `bounded_linear h` `(f ---> l) net`
|
|
1240 |
by (rule bounded_linear.tendsto)
|
|
1241 |
|
|
1242 |
lemma Lim_ident_at: "((\<lambda>x. x) ---> a) (at a)"
|
|
1243 |
unfolding tendsto_def Limits.eventually_at_topological by fast
|
|
1244 |
|
|
1245 |
lemma Lim_const: "((\<lambda>x. a) ---> a) net"
|
|
1246 |
by (rule tendsto_const)
|
|
1247 |
|
|
1248 |
lemma Lim_cmul:
|
|
1249 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1250 |
shows "(f ---> l) net ==> ((\<lambda>x. c *\<^sub>R f x) ---> c *\<^sub>R l) net"
|
|
1251 |
by (intro tendsto_intros)
|
|
1252 |
|
|
1253 |
lemma Lim_neg:
|
|
1254 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1255 |
shows "(f ---> l) net ==> ((\<lambda>x. -(f x)) ---> -l) net"
|
|
1256 |
by (rule tendsto_minus)
|
|
1257 |
|
|
1258 |
lemma Lim_add: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" shows
|
|
1259 |
"(f ---> l) net \<Longrightarrow> (g ---> m) net \<Longrightarrow> ((\<lambda>x. f(x) + g(x)) ---> l + m) net"
|
|
1260 |
by (rule tendsto_add)
|
|
1261 |
|
|
1262 |
lemma Lim_sub:
|
|
1263 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1264 |
shows "(f ---> l) net \<Longrightarrow> (g ---> m) net \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) ---> l - m) net"
|
|
1265 |
by (rule tendsto_diff)
|
|
1266 |
|
|
1267 |
lemma Lim_null:
|
|
1268 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1269 |
shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net" by (simp add: Lim dist_norm)
|
|
1270 |
|
|
1271 |
lemma Lim_null_norm:
|
|
1272 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1273 |
shows "(f ---> 0) net \<longleftrightarrow> ((\<lambda>x. norm(f x)) ---> 0) net"
|
|
1274 |
by (simp add: Lim dist_norm)
|
|
1275 |
|
|
1276 |
lemma Lim_null_comparison:
|
|
1277 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1278 |
assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net"
|
|
1279 |
shows "(f ---> 0) net"
|
|
1280 |
proof(simp add: tendsto_iff, rule+)
|
|
1281 |
fix e::real assume "0<e"
|
|
1282 |
{ fix x
|
|
1283 |
assume "norm (f x) \<le> g x" "dist (g x) 0 < e"
|
|
1284 |
hence "dist (f x) 0 < e" by (simp add: dist_norm)
|
|
1285 |
}
|
|
1286 |
thus "eventually (\<lambda>x. dist (f x) 0 < e) net"
|
|
1287 |
using eventually_and[of "\<lambda>x. norm(f x) <= g x" "\<lambda>x. dist (g x) 0 < e" net]
|
|
1288 |
using eventually_mono[of "(\<lambda>x. norm (f x) \<le> g x \<and> dist (g x) 0 < e)" "(\<lambda>x. dist (f x) 0 < e)" net]
|
|
1289 |
using assms `e>0` unfolding tendsto_iff by auto
|
|
1290 |
qed
|
|
1291 |
|
|
1292 |
lemma Lim_component:
|
|
1293 |
fixes f :: "'a \<Rightarrow> 'b::metric_space ^ 'n::finite"
|
|
1294 |
shows "(f ---> l) net \<Longrightarrow> ((\<lambda>a. f a $i) ---> l$i) net"
|
|
1295 |
unfolding tendsto_iff
|
|
1296 |
apply (clarify)
|
|
1297 |
apply (drule spec, drule (1) mp)
|
|
1298 |
apply (erule eventually_elim1)
|
|
1299 |
apply (erule le_less_trans [OF dist_nth_le])
|
|
1300 |
done
|
|
1301 |
|
|
1302 |
lemma Lim_transform_bound:
|
|
1303 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1304 |
fixes g :: "'a \<Rightarrow> 'c::real_normed_vector"
|
|
1305 |
assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net" "(g ---> 0) net"
|
|
1306 |
shows "(f ---> 0) net"
|
|
1307 |
proof (rule tendstoI)
|
|
1308 |
fix e::real assume "e>0"
|
|
1309 |
{ fix x
|
|
1310 |
assume "norm (f x) \<le> norm (g x)" "dist (g x) 0 < e"
|
|
1311 |
hence "dist (f x) 0 < e" by (simp add: dist_norm)}
|
|
1312 |
thus "eventually (\<lambda>x. dist (f x) 0 < e) net"
|
|
1313 |
using eventually_and[of "\<lambda>x. norm (f x) \<le> norm (g x)" "\<lambda>x. dist (g x) 0 < e" net]
|
|
1314 |
using eventually_mono[of "\<lambda>x. norm (f x) \<le> norm (g x) \<and> dist (g x) 0 < e" "\<lambda>x. dist (f x) 0 < e" net]
|
|
1315 |
using assms `e>0` unfolding tendsto_iff by blast
|
|
1316 |
qed
|
|
1317 |
|
|
1318 |
text{* Deducing things about the limit from the elements. *}
|
|
1319 |
|
|
1320 |
lemma Lim_in_closed_set:
|
|
1321 |
assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) net" "\<not>(trivial_limit net)" "(f ---> l) net"
|
|
1322 |
shows "l \<in> S"
|
|
1323 |
proof (rule ccontr)
|
|
1324 |
assume "l \<notin> S"
|
|
1325 |
with `closed S` have "open (- S)" "l \<in> - S"
|
|
1326 |
by (simp_all add: open_Compl)
|
|
1327 |
with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net"
|
|
1328 |
by (rule topological_tendstoD)
|
|
1329 |
with assms(2) have "eventually (\<lambda>x. False) net"
|
|
1330 |
by (rule eventually_elim2) simp
|
|
1331 |
with assms(3) show "False"
|
|
1332 |
by (simp add: eventually_False)
|
|
1333 |
qed
|
|
1334 |
|
|
1335 |
text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *}
|
|
1336 |
|
|
1337 |
lemma Lim_dist_ubound:
|
|
1338 |
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. dist a (f x) <= e) net"
|
|
1339 |
shows "dist a l <= e"
|
|
1340 |
proof (rule ccontr)
|
|
1341 |
assume "\<not> dist a l \<le> e"
|
|
1342 |
then have "0 < dist a l - e" by simp
|
|
1343 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < dist a l - e) net"
|
|
1344 |
by (rule tendstoD)
|
|
1345 |
with assms(3) have "eventually (\<lambda>x. dist a (f x) \<le> e \<and> dist (f x) l < dist a l - e) net"
|
|
1346 |
by (rule eventually_conjI)
|
|
1347 |
then obtain w where "dist a (f w) \<le> e" "dist (f w) l < dist a l - e"
|
|
1348 |
using assms(1) eventually_happens by auto
|
|
1349 |
hence "dist a (f w) + dist (f w) l < e + (dist a l - e)"
|
|
1350 |
by (rule add_le_less_mono)
|
|
1351 |
hence "dist a (f w) + dist (f w) l < dist a l"
|
|
1352 |
by simp
|
|
1353 |
also have "\<dots> \<le> dist a (f w) + dist (f w) l"
|
|
1354 |
by (rule dist_triangle)
|
|
1355 |
finally show False by simp
|
|
1356 |
qed
|
|
1357 |
|
|
1358 |
lemma Lim_norm_ubound:
|
|
1359 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1360 |
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) <= e) net"
|
|
1361 |
shows "norm(l) <= e"
|
|
1362 |
proof (rule ccontr)
|
|
1363 |
assume "\<not> norm l \<le> e"
|
|
1364 |
then have "0 < norm l - e" by simp
|
|
1365 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < norm l - e) net"
|
|
1366 |
by (rule tendstoD)
|
|
1367 |
with assms(3) have "eventually (\<lambda>x. norm (f x) \<le> e \<and> dist (f x) l < norm l - e) net"
|
|
1368 |
by (rule eventually_conjI)
|
|
1369 |
then obtain w where "norm (f w) \<le> e" "dist (f w) l < norm l - e"
|
|
1370 |
using assms(1) eventually_happens by auto
|
|
1371 |
hence "norm (f w - l) < norm l - e" "norm (f w) \<le> e" by (simp_all add: dist_norm)
|
|
1372 |
hence "norm (f w - l) + norm (f w) < norm l" by simp
|
|
1373 |
hence "norm (f w - l - f w) < norm l" by (rule le_less_trans [OF norm_triangle_ineq4])
|
|
1374 |
thus False using `\<not> norm l \<le> e` by simp
|
|
1375 |
qed
|
|
1376 |
|
|
1377 |
lemma Lim_norm_lbound:
|
|
1378 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
1379 |
assumes "\<not> (trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. e <= norm(f x)) net"
|
|
1380 |
shows "e \<le> norm l"
|
|
1381 |
proof (rule ccontr)
|
|
1382 |
assume "\<not> e \<le> norm l"
|
|
1383 |
then have "0 < e - norm l" by simp
|
|
1384 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < e - norm l) net"
|
|
1385 |
by (rule tendstoD)
|
|
1386 |
with assms(3) have "eventually (\<lambda>x. e \<le> norm (f x) \<and> dist (f x) l < e - norm l) net"
|
|
1387 |
by (rule eventually_conjI)
|
|
1388 |
then obtain w where "e \<le> norm (f w)" "dist (f w) l < e - norm l"
|
|
1389 |
using assms(1) eventually_happens by auto
|
|
1390 |
hence "norm (f w - l) + norm l < e" "e \<le> norm (f w)" by (simp_all add: dist_norm)
|
|
1391 |
hence "norm (f w - l) + norm l < norm (f w)" by (rule less_le_trans)
|
|
1392 |
hence "norm (f w - l + l) < norm (f w)" by (rule le_less_trans [OF norm_triangle_ineq])
|
|
1393 |
thus False by simp
|
|
1394 |
qed
|
|
1395 |
|
|
1396 |
text{* Uniqueness of the limit, when nontrivial. *}
|
|
1397 |
|
|
1398 |
lemma Lim_unique:
|
|
1399 |
fixes f :: "'a \<Rightarrow> 'b::t2_space"
|
|
1400 |
assumes "\<not> trivial_limit net" "(f ---> l) net" "(f ---> l') net"
|
|
1401 |
shows "l = l'"
|
|
1402 |
proof (rule ccontr)
|
|
1403 |
assume "l \<noteq> l'"
|
|
1404 |
obtain U V where "open U" "open V" "l \<in> U" "l' \<in> V" "U \<inter> V = {}"
|
|
1405 |
using hausdorff [OF `l \<noteq> l'`] by fast
|
|
1406 |
have "eventually (\<lambda>x. f x \<in> U) net"
|
|
1407 |
using `(f ---> l) net` `open U` `l \<in> U` by (rule topological_tendstoD)
|
|
1408 |
moreover
|
|
1409 |
have "eventually (\<lambda>x. f x \<in> V) net"
|
|
1410 |
using `(f ---> l') net` `open V` `l' \<in> V` by (rule topological_tendstoD)
|
|
1411 |
ultimately
|
|
1412 |
have "eventually (\<lambda>x. False) net"
|
|
1413 |
proof (rule eventually_elim2)
|
|
1414 |
fix x
|
|
1415 |
assume "f x \<in> U" "f x \<in> V"
|
|
1416 |
hence "f x \<in> U \<inter> V" by simp
|
|
1417 |
with `U \<inter> V = {}` show "False" by simp
|
|
1418 |
qed
|
|
1419 |
with `\<not> trivial_limit net` show "False"
|
|
1420 |
by (simp add: eventually_False)
|
|
1421 |
qed
|
|
1422 |
|
|
1423 |
lemma tendsto_Lim:
|
|
1424 |
fixes f :: "'a \<Rightarrow> 'b::t2_space"
|
|
1425 |
shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l"
|
|
1426 |
unfolding Lim_def using Lim_unique[of net f] by auto
|
|
1427 |
|
|
1428 |
text{* Limit under bilinear function *}
|
|
1429 |
|
|
1430 |
lemma Lim_bilinear:
|
|
1431 |
assumes "(f ---> l) net" and "(g ---> m) net" and "bounded_bilinear h"
|
|
1432 |
shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net"
|
|
1433 |
using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net`
|
|
1434 |
by (rule bounded_bilinear.tendsto)
|
|
1435 |
|
|
1436 |
text{* These are special for limits out of the same vector space. *}
|
|
1437 |
|
|
1438 |
lemma Lim_within_id: "(id ---> a) (at a within s)"
|
|
1439 |
unfolding tendsto_def Limits.eventually_within eventually_at_topological
|
|
1440 |
by auto
|
|
1441 |
|
|
1442 |
lemma Lim_at_id: "(id ---> a) (at a)"
|
|
1443 |
apply (subst within_UNIV[symmetric]) by (simp add: Lim_within_id)
|
|
1444 |
|
|
1445 |
lemma Lim_at_zero:
|
|
1446 |
fixes a :: "'a::real_normed_vector"
|
|
1447 |
fixes l :: "'b::topological_space"
|
|
1448 |
shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" (is "?lhs = ?rhs")
|
|
1449 |
proof
|
|
1450 |
assume "?lhs"
|
|
1451 |
{ fix S assume "open S" "l \<in> S"
|
|
1452 |
with `?lhs` have "eventually (\<lambda>x. f x \<in> S) (at a)"
|
|
1453 |
by (rule topological_tendstoD)
|
|
1454 |
then obtain d where d: "d>0" "\<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S"
|
|
1455 |
unfolding Limits.eventually_at by fast
|
|
1456 |
{ fix x::"'a" assume "x \<noteq> 0 \<and> dist x 0 < d"
|
|
1457 |
hence "f (a + x) \<in> S" using d
|
|
1458 |
apply(erule_tac x="x+a" in allE)
|
|
1459 |
by(auto simp add: comm_monoid_add.mult_commute dist_norm dist_commute)
|
|
1460 |
}
|
|
1461 |
hence "\<exists>d>0. \<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S"
|
|
1462 |
using d(1) by auto
|
|
1463 |
hence "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)"
|
|
1464 |
unfolding Limits.eventually_at .
|
|
1465 |
}
|
|
1466 |
thus "?rhs" by (rule topological_tendstoI)
|
|
1467 |
next
|
|
1468 |
assume "?rhs"
|
|
1469 |
{ fix S assume "open S" "l \<in> S"
|
|
1470 |
with `?rhs` have "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)"
|
|
1471 |
by (rule topological_tendstoD)
|
|
1472 |
then obtain d where d: "d>0" "\<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S"
|
|
1473 |
unfolding Limits.eventually_at by fast
|
|
1474 |
{ fix x::"'a" assume "x \<noteq> a \<and> dist x a < d"
|
|
1475 |
hence "f x \<in> S" using d apply(erule_tac x="x-a" in allE)
|
|
1476 |
by(auto simp add: comm_monoid_add.mult_commute dist_norm dist_commute)
|
|
1477 |
}
|
|
1478 |
hence "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S" using d(1) by auto
|
|
1479 |
hence "eventually (\<lambda>x. f x \<in> S) (at a)" unfolding Limits.eventually_at .
|
|
1480 |
}
|
|
1481 |
thus "?lhs" by (rule topological_tendstoI)
|
|
1482 |
qed
|
|
1483 |
|
|
1484 |
text{* It's also sometimes useful to extract the limit point from the net. *}
|
|
1485 |
|
|
1486 |
definition
|
|
1487 |
netlimit :: "'a::t2_space net \<Rightarrow> 'a" where
|
|
1488 |
"netlimit net = (SOME a. ((\<lambda>x. x) ---> a) net)"
|
|
1489 |
|
|
1490 |
lemma netlimit_within:
|
|
1491 |
assumes "\<not> trivial_limit (at a within S)"
|
|
1492 |
shows "netlimit (at a within S) = a"
|
|
1493 |
unfolding netlimit_def
|
|
1494 |
apply (rule some_equality)
|
|
1495 |
apply (rule Lim_at_within)
|
|
1496 |
apply (rule Lim_ident_at)
|
|
1497 |
apply (erule Lim_unique [OF assms])
|
|
1498 |
apply (rule Lim_at_within)
|
|
1499 |
apply (rule Lim_ident_at)
|
|
1500 |
done
|
|
1501 |
|
|
1502 |
lemma netlimit_at:
|
|
1503 |
fixes a :: "'a::perfect_space"
|
|
1504 |
shows "netlimit (at a) = a"
|
|
1505 |
apply (subst within_UNIV[symmetric])
|
|
1506 |
using netlimit_within[of a UNIV]
|
|
1507 |
by (simp add: trivial_limit_at within_UNIV)
|
|
1508 |
|
|
1509 |
text{* Transformation of limit. *}
|
|
1510 |
|
|
1511 |
lemma Lim_transform:
|
|
1512 |
fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector"
|
|
1513 |
assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net"
|
|
1514 |
shows "(g ---> l) net"
|
|
1515 |
proof-
|
|
1516 |
from assms have "((\<lambda>x. f x - g x - f x) ---> 0 - l) net" using Lim_sub[of "\<lambda>x. f x - g x" 0 net f l] by auto
|
|
1517 |
thus "?thesis" using Lim_neg [of "\<lambda> x. - g x" "-l" net] by auto
|
|
1518 |
qed
|
|
1519 |
|
|
1520 |
lemma Lim_transform_eventually:
|
|
1521 |
"eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net ==> (g ---> l) net"
|
|
1522 |
apply (rule topological_tendstoI)
|
|
1523 |
apply (drule (2) topological_tendstoD)
|
|
1524 |
apply (erule (1) eventually_elim2, simp)
|
|
1525 |
done
|
|
1526 |
|
|
1527 |
lemma Lim_transform_within:
|
|
1528 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1529 |
assumes "0 < d" "(\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x')"
|
|
1530 |
"(f ---> l) (at x within S)"
|
|
1531 |
shows "(g ---> l) (at x within S)"
|
|
1532 |
using assms(1,3) unfolding Lim_within
|
|
1533 |
apply -
|
|
1534 |
apply (clarify, rename_tac e)
|
|
1535 |
apply (drule_tac x=e in spec, clarsimp, rename_tac r)
|
|
1536 |
apply (rule_tac x="min d r" in exI, clarsimp, rename_tac y)
|
|
1537 |
apply (drule_tac x=y in bspec, assumption, clarsimp)
|
|
1538 |
apply (simp add: assms(2))
|
|
1539 |
done
|
|
1540 |
|
|
1541 |
lemma Lim_transform_at:
|
|
1542 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1543 |
shows "0 < d \<Longrightarrow> (\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x') \<Longrightarrow>
|
|
1544 |
(f ---> l) (at x) ==> (g ---> l) (at x)"
|
|
1545 |
apply (subst within_UNIV[symmetric])
|
|
1546 |
using Lim_transform_within[of d UNIV x f g l]
|
|
1547 |
by (auto simp add: within_UNIV)
|
|
1548 |
|
|
1549 |
text{* Common case assuming being away from some crucial point like 0. *}
|
|
1550 |
|
|
1551 |
lemma Lim_transform_away_within:
|
|
1552 |
fixes a b :: "'a::metric_space"
|
|
1553 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1554 |
assumes "a\<noteq>b" "\<forall>x\<in> S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
|
|
1555 |
and "(f ---> l) (at a within S)"
|
|
1556 |
shows "(g ---> l) (at a within S)"
|
|
1557 |
proof-
|
|
1558 |
have "\<forall>x'\<in>S. 0 < dist x' a \<and> dist x' a < dist a b \<longrightarrow> f x' = g x'" using assms(2)
|
|
1559 |
apply auto apply(erule_tac x=x' in ballE) by (auto simp add: dist_commute)
|
|
1560 |
thus ?thesis using Lim_transform_within[of "dist a b" S a f g l] using assms(1,3) unfolding dist_nz by auto
|
|
1561 |
qed
|
|
1562 |
|
|
1563 |
lemma Lim_transform_away_at:
|
|
1564 |
fixes a b :: "'a::metric_space"
|
|
1565 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1566 |
assumes ab: "a\<noteq>b" and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
|
|
1567 |
and fl: "(f ---> l) (at a)"
|
|
1568 |
shows "(g ---> l) (at a)"
|
|
1569 |
using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl
|
|
1570 |
by (auto simp add: within_UNIV)
|
|
1571 |
|
|
1572 |
text{* Alternatively, within an open set. *}
|
|
1573 |
|
|
1574 |
lemma Lim_transform_within_open:
|
|
1575 |
fixes a :: "'a::metric_space"
|
|
1576 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1577 |
assumes "open S" "a \<in> S" "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x" "(f ---> l) (at a)"
|
|
1578 |
shows "(g ---> l) (at a)"
|
|
1579 |
proof-
|
|
1580 |
from assms(1,2) obtain e::real where "e>0" and e:"ball a e \<subseteq> S" unfolding open_contains_ball by auto
|
|
1581 |
hence "\<forall>x'. 0 < dist x' a \<and> dist x' a < e \<longrightarrow> f x' = g x'" using assms(3)
|
|
1582 |
unfolding ball_def subset_eq apply auto apply(erule_tac x=x' in allE) apply(erule_tac x=x' in ballE) by(auto simp add: dist_commute)
|
|
1583 |
thus ?thesis using Lim_transform_at[of e a f g l] `e>0` assms(4) by auto
|
|
1584 |
qed
|
|
1585 |
|
|
1586 |
text{* A congruence rule allowing us to transform limits assuming not at point. *}
|
|
1587 |
|
|
1588 |
(* FIXME: Only one congruence rule for tendsto can be used at a time! *)
|
|
1589 |
|
|
1590 |
lemma Lim_cong_within[cong add]:
|
|
1591 |
fixes a :: "'a::metric_space"
|
|
1592 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1593 |
shows "(\<And>x. x \<noteq> a \<Longrightarrow> f x = g x) ==> ((\<lambda>x. f x) ---> l) (at a within S) \<longleftrightarrow> ((g ---> l) (at a within S))"
|
|
1594 |
by (simp add: Lim_within dist_nz[symmetric])
|
|
1595 |
|
|
1596 |
lemma Lim_cong_at[cong add]:
|
|
1597 |
fixes a :: "'a::metric_space"
|
|
1598 |
fixes l :: "'b::metric_space" (* TODO: generalize *)
|
|
1599 |
shows "(\<And>x. x \<noteq> a ==> f x = g x) ==> (((\<lambda>x. f x) ---> l) (at a) \<longleftrightarrow> ((g ---> l) (at a)))"
|
|
1600 |
by (simp add: Lim_at dist_nz[symmetric])
|
|
1601 |
|
|
1602 |
text{* Useful lemmas on closure and set of possible sequential limits.*}
|
|
1603 |
|
|
1604 |
lemma closure_sequential:
|
|
1605 |
fixes l :: "'a::metric_space" (* TODO: generalize *)
|
|
1606 |
shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" (is "?lhs = ?rhs")
|
|
1607 |
proof
|
|
1608 |
assume "?lhs" moreover
|
|
1609 |
{ assume "l \<in> S"
|
|
1610 |
hence "?rhs" using Lim_const[of l sequentially] by auto
|
|
1611 |
} moreover
|
|
1612 |
{ assume "l islimpt S"
|
|
1613 |
hence "?rhs" unfolding islimpt_sequential by auto
|
|
1614 |
} ultimately
|
|
1615 |
show "?rhs" unfolding closure_def by auto
|
|
1616 |
next
|
|
1617 |
assume "?rhs"
|
|
1618 |
thus "?lhs" unfolding closure_def unfolding islimpt_sequential by auto
|
|
1619 |
qed
|
|
1620 |
|
|
1621 |
lemma closed_sequential_limits:
|
|
1622 |
fixes S :: "'a::metric_space set"
|
|
1623 |
shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)"
|
|
1624 |
unfolding closed_limpt
|
|
1625 |
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]
|
|
1626 |
by metis
|
|
1627 |
|
|
1628 |
lemma closure_approachable:
|
|
1629 |
fixes S :: "'a::metric_space set"
|
|
1630 |
shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)"
|
|
1631 |
apply (auto simp add: closure_def islimpt_approachable)
|
|
1632 |
by (metis dist_self)
|
|
1633 |
|
|
1634 |
lemma closed_approachable:
|
|
1635 |
fixes S :: "'a::metric_space set"
|
|
1636 |
shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"
|
|
1637 |
by (metis closure_closed closure_approachable)
|
|
1638 |
|
|
1639 |
text{* Some other lemmas about sequences. *}
|
|
1640 |
|
|
1641 |
lemma seq_offset:
|
|
1642 |
fixes l :: "'a::metric_space" (* TODO: generalize *)
|
|
1643 |
shows "(f ---> l) sequentially ==> ((\<lambda>i. f( i + k)) ---> l) sequentially"
|
|
1644 |
apply (auto simp add: Lim_sequentially)
|
|
1645 |
by (metis trans_le_add1 )
|
|
1646 |
|
|
1647 |
lemma seq_offset_neg:
|
|
1648 |
"(f ---> l) sequentially ==> ((\<lambda>i. f(i - k)) ---> l) sequentially"
|
|
1649 |
apply (rule topological_tendstoI)
|
|
1650 |
apply (drule (2) topological_tendstoD)
|
|
1651 |
apply (simp only: eventually_sequentially)
|
|
1652 |
apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k")
|
|
1653 |
apply metis
|
|
1654 |
by arith
|
|
1655 |
|
|
1656 |
lemma seq_offset_rev:
|
|
1657 |
"((\<lambda>i. f(i + k)) ---> l) sequentially ==> (f ---> l) sequentially"
|
|
1658 |
apply (rule topological_tendstoI)
|
|
1659 |
apply (drule (2) topological_tendstoD)
|
|
1660 |
apply (simp only: eventually_sequentially)
|
|
1661 |
apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k \<and> (n - k) + k = n")
|
|
1662 |
by metis arith
|
|
1663 |
|
|
1664 |
lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially"
|
|
1665 |
proof-
|
|
1666 |
{ fix e::real assume "e>0"
|
|
1667 |
hence "\<exists>N::nat. \<forall>n::nat\<ge>N. inverse (real n) < e"
|
|
1668 |
using real_arch_inv[of e] apply auto apply(rule_tac x=n in exI)
|
|
1669 |
by (metis not_le le_imp_inverse_le not_less real_of_nat_gt_zero_cancel_iff real_of_nat_less_iff xt1(7))
|
|
1670 |
}
|
|
1671 |
thus ?thesis unfolding Lim_sequentially dist_norm by simp
|
|
1672 |
qed
|
|
1673 |
|
|
1674 |
text{* More properties of closed balls. *}
|
|
1675 |
|
|
1676 |
lemma closed_cball: "closed (cball x e)"
|
|
1677 |
unfolding cball_def closed_def
|
|
1678 |
unfolding Collect_neg_eq [symmetric] not_le
|
|
1679 |
apply (clarsimp simp add: open_dist, rename_tac y)
|
|
1680 |
apply (rule_tac x="dist x y - e" in exI, clarsimp)
|
|
1681 |
apply (rename_tac x')
|
|
1682 |
apply (cut_tac x=x and y=x' and z=y in dist_triangle)
|
|
1683 |
apply simp
|
|
1684 |
done
|
|
1685 |
|
|
1686 |
lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)"
|
|
1687 |
proof-
|
|
1688 |
{ fix x and e::real assume "x\<in>S" "e>0" "ball x e \<subseteq> S"
|
|
1689 |
hence "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto)
|
|
1690 |
} moreover
|
|
1691 |
{ fix x and e::real assume "x\<in>S" "e>0" "cball x e \<subseteq> S"
|
|
1692 |
hence "\<exists>d>0. ball x d \<subseteq> S" unfolding subset_eq apply(rule_tac x="e/2" in exI) by auto
|
|
1693 |
} ultimately
|
|
1694 |
show ?thesis unfolding open_contains_ball by auto
|
|
1695 |
qed
|
|
1696 |
|
|
1697 |
lemma open_contains_cball_eq: "open S ==> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"
|
|
1698 |
by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball mem_def)
|
|
1699 |
|
|
1700 |
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)"
|
|
1701 |
apply (simp add: interior_def, safe)
|
|
1702 |
apply (force simp add: open_contains_cball)
|
|
1703 |
apply (rule_tac x="ball x e" in exI)
|
|
1704 |
apply (simp add: open_ball centre_in_ball subset_trans [OF ball_subset_cball])
|
|
1705 |
done
|
|
1706 |
|
|
1707 |
lemma islimpt_ball:
|
|
1708 |
fixes x y :: "'a::{real_normed_vector,perfect_space}"
|
|
1709 |
shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" (is "?lhs = ?rhs")
|
|
1710 |
proof
|
|
1711 |
assume "?lhs"
|
|
1712 |
{ assume "e \<le> 0"
|
|
1713 |
hence *:"ball x e = {}" using ball_eq_empty[of x e] by auto
|
|
1714 |
have False using `?lhs` unfolding * using islimpt_EMPTY[of y] by auto
|
|
1715 |
}
|
|
1716 |
hence "e > 0" by (metis not_less)
|
|
1717 |
moreover
|
|
1718 |
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
|
|
1719 |
ultimately show "?rhs" by auto
|
|
1720 |
next
|
|
1721 |
assume "?rhs" hence "e>0" by auto
|
|
1722 |
{ fix d::real assume "d>0"
|
|
1723 |
have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
|
|
1724 |
proof(cases "d \<le> dist x y")
|
|
1725 |
case True thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
|
|
1726 |
proof(cases "x=y")
|
|
1727 |
case True hence False using `d \<le> dist x y` `d>0` by auto
|
|
1728 |
thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by auto
|
|
1729 |
next
|
|
1730 |
case False
|
|
1731 |
|
|
1732 |
have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x))
|
|
1733 |
= norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))"
|
|
1734 |
unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[THEN sym] by auto
|
|
1735 |
also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)"
|
|
1736 |
using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", THEN sym, of "y - x"]
|
|
1737 |
unfolding scaleR_minus_left scaleR_one
|
|
1738 |
by (auto simp add: norm_minus_commute)
|
|
1739 |
also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>"
|
|
1740 |
unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]]
|
|
1741 |
unfolding real_add_mult_distrib using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] by auto
|
|
1742 |
also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` by(auto simp add: dist_norm)
|
|
1743 |
finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` by auto
|
|
1744 |
|
|
1745 |
moreover
|
|
1746 |
|
|
1747 |
have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0"
|
|
1748 |
using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff by (auto simp add: dist_commute)
|
|
1749 |
moreover
|
|
1750 |
have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" unfolding dist_norm apply simp unfolding norm_minus_cancel
|
|
1751 |
using `d>0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y]
|
|
1752 |
unfolding dist_norm by auto
|
|
1753 |
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
|
|
1754 |
qed
|
|
1755 |
next
|
|
1756 |
case False hence "d > dist x y" by auto
|
|
1757 |
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
|
|
1758 |
proof(cases "x=y")
|
|
1759 |
case True
|
|
1760 |
obtain z where **: "z \<noteq> y" "dist z y < min e d"
|
|
1761 |
using perfect_choose_dist[of "min e d" y]
|
|
1762 |
using `d > 0` `e>0` by auto
|
|
1763 |
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
|
|
1764 |
unfolding `x = y`
|
|
1765 |
using `z \<noteq> y` **
|
|
1766 |
by (rule_tac x=z in bexI, auto simp add: dist_commute)
|
|
1767 |
next
|
|
1768 |
case False thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
|
|
1769 |
using `d>0` `d > dist x y` `?rhs` by(rule_tac x=x in bexI, auto)
|
|
1770 |
qed
|
|
1771 |
qed }
|
|
1772 |
thus "?lhs" unfolding mem_cball islimpt_approachable mem_ball by auto
|
|
1773 |
qed
|
|
1774 |
|
|
1775 |
lemma closure_ball_lemma:
|
|
1776 |
fixes x y :: "'a::real_normed_vector"
|
|
1777 |
assumes "x \<noteq> y" shows "y islimpt ball x (dist x y)"
|
|
1778 |
proof (rule islimptI)
|
|
1779 |
fix T assume "y \<in> T" "open T"
|
|
1780 |
then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T"
|
|
1781 |
unfolding open_dist by fast
|
|
1782 |
(* choose point between x and y, within distance r of y. *)
|
|
1783 |
def k \<equiv> "min 1 (r / (2 * dist x y))"
|
|
1784 |
def z \<equiv> "y + scaleR k (x - y)"
|
|
1785 |
have z_def2: "z = x + scaleR (1 - k) (y - x)"
|
|
1786 |
unfolding z_def by (simp add: algebra_simps)
|
|
1787 |
have "dist z y < r"
|
|
1788 |
unfolding z_def k_def using `0 < r`
|
|
1789 |
by (simp add: dist_norm min_def)
|
|
1790 |
hence "z \<in> T" using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp
|
|
1791 |
have "dist x z < dist x y"
|
|
1792 |
unfolding z_def2 dist_norm
|
|
1793 |
apply (simp add: norm_minus_commute)
|
|
1794 |
apply (simp only: dist_norm [symmetric])
|
|
1795 |
apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp)
|
|
1796 |
apply (rule mult_strict_right_mono)
|
|
1797 |
apply (simp add: k_def divide_pos_pos zero_less_dist_iff `0 < r` `x \<noteq> y`)
|
|
1798 |
apply (simp add: zero_less_dist_iff `x \<noteq> y`)
|
|
1799 |
done
|
|
1800 |
hence "z \<in> ball x (dist x y)" by simp
|
|
1801 |
have "z \<noteq> y"
|
|
1802 |
unfolding z_def k_def using `x \<noteq> y` `0 < r`
|
|
1803 |
by (simp add: min_def)
|
|
1804 |
show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y"
|
|
1805 |
using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y`
|
|
1806 |
by fast
|
|
1807 |
qed
|
|
1808 |
|
|
1809 |
lemma closure_ball:
|
|
1810 |
fixes x :: "'a::real_normed_vector"
|
|
1811 |
shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e"
|
|
1812 |
apply (rule equalityI)
|
|
1813 |
apply (rule closure_minimal)
|
|
1814 |
apply (rule ball_subset_cball)
|
|
1815 |
apply (rule closed_cball)
|
|
1816 |
apply (rule subsetI, rename_tac y)
|
|
1817 |
apply (simp add: le_less [where 'a=real])
|
|
1818 |
apply (erule disjE)
|
|
1819 |
apply (rule subsetD [OF closure_subset], simp)
|
|
1820 |
apply (simp add: closure_def)
|
|
1821 |
apply clarify
|
|
1822 |
apply (rule closure_ball_lemma)
|
|
1823 |
apply (simp add: zero_less_dist_iff)
|
|
1824 |
done
|
|
1825 |
|
|
1826 |
(* In a trivial vector space, this fails for e = 0. *)
|
|
1827 |
lemma interior_cball:
|
|
1828 |
fixes x :: "'a::{real_normed_vector, perfect_space}"
|
|
1829 |
shows "interior (cball x e) = ball x e"
|
|
1830 |
proof(cases "e\<ge>0")
|
|
1831 |
case False note cs = this
|
|
1832 |
from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover
|
|
1833 |
{ fix y assume "y \<in> cball x e"
|
|
1834 |
hence False unfolding mem_cball using dist_nz[of x y] cs by auto }
|
|
1835 |
hence "cball x e = {}" by auto
|
|
1836 |
hence "interior (cball x e) = {}" using interior_empty by auto
|
|
1837 |
ultimately show ?thesis by blast
|
|
1838 |
next
|
|
1839 |
case True note cs = this
|
|
1840 |
have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover
|
|
1841 |
{ fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S"
|
|
1842 |
then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast
|
|
1843 |
|
|
1844 |
then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d"
|
|
1845 |
using perfect_choose_dist [of d] by auto
|
|
1846 |
have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute)
|
|
1847 |
hence xa_cball:"xa \<in> cball x e" using as(1) by auto
|
|
1848 |
|
|
1849 |
hence "y \<in> ball x e" proof(cases "x = y")
|
|
1850 |
case True
|
|
1851 |
hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute)
|
|
1852 |
thus "y \<in> ball x e" using `x = y ` by simp
|
|
1853 |
next
|
|
1854 |
case False
|
|
1855 |
have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm
|
|
1856 |
using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto
|
|
1857 |
hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast
|
|
1858 |
have "y - x \<noteq> 0" using `x \<noteq> y` by auto
|
|
1859 |
hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym]
|
|
1860 |
using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto
|
|
1861 |
|
|
1862 |
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)"
|
|
1863 |
by (auto simp add: dist_norm algebra_simps)
|
|
1864 |
also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))"
|
|
1865 |
by (auto simp add: algebra_simps)
|
|
1866 |
also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)"
|
|
1867 |
using ** by auto
|
|
1868 |
also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm)
|
|
1869 |
finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute)
|
|
1870 |
thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto
|
|
1871 |
qed }
|
|
1872 |
hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto
|
|
1873 |
ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto
|
|
1874 |
qed
|
|
1875 |
|
|
1876 |
lemma frontier_ball:
|
|
1877 |
fixes a :: "'a::real_normed_vector"
|
|
1878 |
shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}"
|
|
1879 |
apply (simp add: frontier_def closure_ball interior_open open_ball order_less_imp_le)
|
|
1880 |
apply (simp add: expand_set_eq)
|
|
1881 |
by arith
|
|
1882 |
|
|
1883 |
lemma frontier_cball:
|
|
1884 |
fixes a :: "'a::{real_normed_vector, perfect_space}"
|
|
1885 |
shows "frontier(cball a e) = {x. dist a x = e}"
|
|
1886 |
apply (simp add: frontier_def interior_cball closed_cball closure_closed order_less_imp_le)
|
|
1887 |
apply (simp add: expand_set_eq)
|
|
1888 |
by arith
|
|
1889 |
|
|
1890 |
lemma cball_eq_empty: "(cball x e = {}) \<longleftrightarrow> e < 0"
|
|
1891 |
apply (simp add: expand_set_eq not_le)
|
|
1892 |
by (metis zero_le_dist dist_self order_less_le_trans)
|
|
1893 |
lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty)
|
|
1894 |
|
|
1895 |
lemma cball_eq_sing:
|
|
1896 |
fixes x :: "'a::perfect_space"
|
|
1897 |
shows "(cball x e = {x}) \<longleftrightarrow> e = 0"
|
|
1898 |
proof (rule linorder_cases)
|
|
1899 |
assume e: "0 < e"
|
|
1900 |
obtain a where "a \<noteq> x" "dist a x < e"
|
|
1901 |
using perfect_choose_dist [OF e] by auto
|
|
1902 |
hence "a \<noteq> x" "dist x a \<le> e" by (auto simp add: dist_commute)
|
|
1903 |
with e show ?thesis by (auto simp add: expand_set_eq)
|
|
1904 |
qed auto
|
|
1905 |
|
|
1906 |
lemma cball_sing:
|
|
1907 |
fixes x :: "'a::metric_space"
|
|
1908 |
shows "e = 0 ==> cball x e = {x}"
|
|
1909 |
by (auto simp add: expand_set_eq)
|
|
1910 |
|
|
1911 |
text{* For points in the interior, localization of limits makes no difference. *}
|
|
1912 |
|
|
1913 |
lemma eventually_within_interior:
|
|
1914 |
assumes "x \<in> interior S"
|
|
1915 |
shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" (is "?lhs = ?rhs")
|
|
1916 |
proof-
|
|
1917 |
from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S"
|
|
1918 |
unfolding interior_def by fast
|
|
1919 |
{ assume "?lhs"
|
|
1920 |
then obtain A where "open A" "x \<in> A" "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"
|
|
1921 |
unfolding Limits.eventually_within Limits.eventually_at_topological
|
|
1922 |
by auto
|
|
1923 |
with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y"
|
|
1924 |
by auto
|
|
1925 |
then have "?rhs"
|
|
1926 |
unfolding Limits.eventually_at_topological by auto
|
|
1927 |
} moreover
|
|
1928 |
{ assume "?rhs" hence "?lhs"
|
|
1929 |
unfolding Limits.eventually_within
|
|
1930 |
by (auto elim: eventually_elim1)
|
|
1931 |
} ultimately
|
|
1932 |
show "?thesis" ..
|
|
1933 |
qed
|
|
1934 |
|
|
1935 |
lemma lim_within_interior:
|
|
1936 |
"x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)"
|
|
1937 |
unfolding tendsto_def by (simp add: eventually_within_interior)
|
|
1938 |
|
|
1939 |
lemma netlimit_within_interior:
|
|
1940 |
fixes x :: "'a::{perfect_space, real_normed_vector}"
|
|
1941 |
(* FIXME: generalize to perfect_space *)
|
|
1942 |
assumes "x \<in> interior S"
|
|
1943 |
shows "netlimit(at x within S) = x" (is "?lhs = ?rhs")
|
|
1944 |
proof-
|
|
1945 |
from assms obtain e::real where e:"e>0" "ball x e \<subseteq> S" using open_interior[of S] unfolding open_contains_ball using interior_subset[of S] by auto
|
|
1946 |
hence "\<not> trivial_limit (at x within S)" using islimpt_subset[of x "ball x e" S] unfolding trivial_limit_within islimpt_ball centre_in_cball by auto
|
|
1947 |
thus ?thesis using netlimit_within by auto
|
|
1948 |
qed
|
|
1949 |
|
|
1950 |
subsection{* Boundedness. *}
|
|
1951 |
|
|
1952 |
(* FIXME: This has to be unified with BSEQ!! *)
|
|
1953 |
definition
|
|
1954 |
bounded :: "'a::metric_space set \<Rightarrow> bool" where
|
|
1955 |
"bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)"
|
|
1956 |
|
|
1957 |
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"
|
|
1958 |
unfolding bounded_def
|
|
1959 |
apply safe
|
|
1960 |
apply (rule_tac x="dist a x + e" in exI, clarify)
|
|
1961 |
apply (drule (1) bspec)
|
|
1962 |
apply (erule order_trans [OF dist_triangle add_left_mono])
|
|
1963 |
apply auto
|
|
1964 |
done
|
|
1965 |
|
|
1966 |
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)"
|
|
1967 |
unfolding bounded_any_center [where a=0]
|
|
1968 |
by (simp add: dist_norm)
|
|
1969 |
|
|
1970 |
lemma bounded_empty[simp]: "bounded {}" by (simp add: bounded_def)
|
|
1971 |
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S"
|
|
1972 |
by (metis bounded_def subset_eq)
|
|
1973 |
|
|
1974 |
lemma bounded_interior[intro]: "bounded S ==> bounded(interior S)"
|
|
1975 |
by (metis bounded_subset interior_subset)
|
|
1976 |
|
|
1977 |
lemma bounded_closure[intro]: assumes "bounded S" shows "bounded(closure S)"
|
|
1978 |
proof-
|
|
1979 |
from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" unfolding bounded_def by auto
|
|
1980 |
{ fix y assume "y \<in> closure S"
|
|
1981 |
then obtain f where f: "\<forall>n. f n \<in> S" "(f ---> y) sequentially"
|
|
1982 |
unfolding closure_sequential by auto
|
|
1983 |
have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp
|
|
1984 |
hence "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially"
|
|
1985 |
by (rule eventually_mono, simp add: f(1))
|
|
1986 |
have "dist x y \<le> a"
|
|
1987 |
apply (rule Lim_dist_ubound [of sequentially f])
|
|
1988 |
apply (rule trivial_limit_sequentially)
|
|
1989 |
apply (rule f(2))
|
|
1990 |
apply fact
|
|
1991 |
done
|
|
1992 |
}
|
|
1993 |
thus ?thesis unfolding bounded_def by auto
|
|
1994 |
qed
|
|
1995 |
|
|
1996 |
lemma bounded_cball[simp,intro]: "bounded (cball x e)"
|
|
1997 |
apply (simp add: bounded_def)
|
|
1998 |
apply (rule_tac x=x in exI)
|
|
1999 |
apply (rule_tac x=e in exI)
|
|
2000 |
apply auto
|
|
2001 |
done
|
|
2002 |
|
|
2003 |
lemma bounded_ball[simp,intro]: "bounded(ball x e)"
|
|
2004 |
by (metis ball_subset_cball bounded_cball bounded_subset)
|
|
2005 |
|
|
2006 |
lemma finite_imp_bounded[intro]: assumes "finite S" shows "bounded S"
|
|
2007 |
proof-
|
|
2008 |
{ fix a F assume as:"bounded F"
|
|
2009 |
then obtain x e where "\<forall>y\<in>F. dist x y \<le> e" unfolding bounded_def by auto
|
|
2010 |
hence "\<forall>y\<in>(insert a F). dist x y \<le> max e (dist x a)" by auto
|
|
2011 |
hence "bounded (insert a F)" unfolding bounded_def by (intro exI)
|
|
2012 |
}
|
|
2013 |
thus ?thesis using finite_induct[of S bounded] using bounded_empty assms by auto
|
|
2014 |
qed
|
|
2015 |
|
|
2016 |
lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T"
|
|
2017 |
apply (auto simp add: bounded_def)
|
|
2018 |
apply (rename_tac x y r s)
|
|
2019 |
apply (rule_tac x=x in exI)
|
|
2020 |
apply (rule_tac x="max r (dist x y + s)" in exI)
|
|
2021 |
apply (rule ballI, rename_tac z, safe)
|
|
2022 |
apply (drule (1) bspec, simp)
|
|
2023 |
apply (drule (1) bspec)
|
|
2024 |
apply (rule min_max.le_supI2)
|
|
2025 |
apply (erule order_trans [OF dist_triangle add_left_mono])
|
|
2026 |
done
|
|
2027 |
|
|
2028 |
lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)"
|
|
2029 |
by (induct rule: finite_induct[of F], auto)
|
|
2030 |
|
|
2031 |
lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)"
|
|
2032 |
apply (simp add: bounded_iff)
|
|
2033 |
apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)")
|
|
2034 |
by metis arith
|
|
2035 |
|
|
2036 |
lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)"
|
|
2037 |
by (metis Int_lower1 Int_lower2 bounded_subset)
|
|
2038 |
|
|
2039 |
lemma bounded_diff[intro]: "bounded S ==> bounded (S - T)"
|
|
2040 |
apply (metis Diff_subset bounded_subset)
|
|
2041 |
done
|
|
2042 |
|
|
2043 |
lemma bounded_insert[intro]:"bounded(insert x S) \<longleftrightarrow> bounded S"
|
|
2044 |
by (metis Diff_cancel Un_empty_right Un_insert_right bounded_Un bounded_subset finite.emptyI finite_imp_bounded infinite_remove subset_insertI)
|
|
2045 |
|
|
2046 |
lemma not_bounded_UNIV[simp, intro]:
|
|
2047 |
"\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
|
|
2048 |
proof(auto simp add: bounded_pos not_le)
|
|
2049 |
obtain x :: 'a where "x \<noteq> 0"
|
|
2050 |
using perfect_choose_dist [OF zero_less_one] by fast
|
|
2051 |
fix b::real assume b: "b >0"
|
|
2052 |
have b1: "b +1 \<ge> 0" using b by simp
|
|
2053 |
with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))"
|
|
2054 |
by (simp add: norm_sgn)
|
|
2055 |
then show "\<exists>x::'a. b < norm x" ..
|
|
2056 |
qed
|
|
2057 |
|
|
2058 |
lemma bounded_linear_image:
|
|
2059 |
assumes "bounded S" "bounded_linear f"
|
|
2060 |
shows "bounded(f ` S)"
|
|
2061 |
proof-
|
|
2062 |
from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto
|
|
2063 |
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)
|
|
2064 |
{ fix x assume "x\<in>S"
|
|
2065 |
hence "norm x \<le> b" using b by auto
|
|
2066 |
hence "norm (f x) \<le> B * b" using B(2) apply(erule_tac x=x in allE)
|
|
2067 |
by (metis B(1) B(2) real_le_trans real_mult_le_cancel_iff2)
|
|
2068 |
}
|
|
2069 |
thus ?thesis unfolding bounded_pos apply(rule_tac x="b*B" in exI)
|
|
2070 |
using b B real_mult_order[of b B] by (auto simp add: real_mult_commute)
|
|
2071 |
qed
|
|
2072 |
|
|
2073 |
lemma bounded_scaling:
|
|
2074 |
fixes S :: "'a::real_normed_vector set"
|
|
2075 |
shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)"
|
|
2076 |
apply (rule bounded_linear_image, assumption)
|
|
2077 |
apply (rule scaleR.bounded_linear_right)
|
|
2078 |
done
|
|
2079 |
|
|
2080 |
lemma bounded_translation:
|
|
2081 |
fixes S :: "'a::real_normed_vector set"
|
|
2082 |
assumes "bounded S" shows "bounded ((\<lambda>x. a + x) ` S)"
|
|
2083 |
proof-
|
|
2084 |
from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto
|
|
2085 |
{ fix x assume "x\<in>S"
|
|
2086 |
hence "norm (a + x) \<le> b + norm a" using norm_triangle_ineq[of a x] b by auto
|
|
2087 |
}
|
|
2088 |
thus ?thesis unfolding bounded_pos using norm_ge_zero[of a] b(1) using add_strict_increasing[of b 0 "norm a"]
|
|
2089 |
by (auto intro!: add exI[of _ "b + norm a"])
|
|
2090 |
qed
|
|
2091 |
|
|
2092 |
|
|
2093 |
text{* Some theorems on sups and infs using the notion "bounded". *}
|
|
2094 |
|
|
2095 |
lemma bounded_real:
|
|
2096 |
fixes S :: "real set"
|
|
2097 |
shows "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. abs x <= a)"
|
|
2098 |
by (simp add: bounded_iff)
|
|
2099 |
|
33270
|
2100 |
lemma bounded_has_Sup:
|
|
2101 |
fixes S :: "real set"
|
|
2102 |
assumes "bounded S" "S \<noteq> {}"
|
|
2103 |
shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b"
|
|
2104 |
proof
|
|
2105 |
fix x assume "x\<in>S"
|
|
2106 |
thus "x \<le> Sup S"
|
|
2107 |
by (metis SupInf.Sup_upper abs_le_D1 assms(1) bounded_real)
|
|
2108 |
next
|
|
2109 |
show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms
|
|
2110 |
by (metis SupInf.Sup_least)
|
|
2111 |
qed
|
|
2112 |
|
|
2113 |
lemma Sup_insert:
|
|
2114 |
fixes S :: "real set"
|
|
2115 |
shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
|
|
2116 |
by auto (metis Int_absorb Sup_insert_nonempty assms bounded_has_Sup(1) disjoint_iff_not_equal)
|
|
2117 |
|
|
2118 |
lemma Sup_insert_finite:
|
|
2119 |
fixes S :: "real set"
|
|
2120 |
shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
|
|
2121 |
apply (rule Sup_insert)
|
|
2122 |
apply (rule finite_imp_bounded)
|
|
2123 |
by simp
|
|
2124 |
|
|
2125 |
lemma bounded_has_Inf:
|
|
2126 |
fixes S :: "real set"
|
|
2127 |
assumes "bounded S" "S \<noteq> {}"
|
|
2128 |
shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b"
|
33175
|
2129 |
proof
|
|
2130 |
fix x assume "x\<in>S"
|
|
2131 |
from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto
|
33270
|
2132 |
thus "x \<ge> Inf S" using `x\<in>S`
|
|
2133 |
by (metis Inf_lower_EX abs_le_D2 minus_le_iff)
|
33175
|
2134 |
next
|
33270
|
2135 |
show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms
|
|
2136 |
by (metis SupInf.Inf_greatest)
|
|
2137 |
qed
|
|
2138 |
|
|
2139 |
lemma Inf_insert:
|
|
2140 |
fixes S :: "real set"
|
|
2141 |
shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
|
|
2142 |
by auto (metis Int_absorb Inf_insert_nonempty bounded_has_Inf(1) disjoint_iff_not_equal)
|
|
2143 |
lemma Inf_insert_finite:
|
|
2144 |
fixes S :: "real set"
|
|
2145 |
shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
|
|
2146 |
by (rule Inf_insert, rule finite_imp_bounded, simp)
|
|
2147 |
|
33175
|
2148 |
|
|
2149 |
(* TODO: Move this to RComplete.thy -- would need to include Glb into RComplete *)
|
|
2150 |
lemma real_isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::real)"
|
|
2151 |
apply (frule isGlb_isLb)
|
|
2152 |
apply (frule_tac x = y in isGlb_isLb)
|
|
2153 |
apply (blast intro!: order_antisym dest!: isGlb_le_isLb)
|
|
2154 |
done
|
|
2155 |
|
|
2156 |
subsection{* Compactness (the definition is the one based on convegent subsequences). *}
|
|
2157 |
|
|
2158 |
definition
|
|
2159 |
compact :: "'a::metric_space set \<Rightarrow> bool" where (* TODO: generalize *)
|
|
2160 |
"compact S \<longleftrightarrow>
|
|
2161 |
(\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow>
|
|
2162 |
(\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))"
|
|
2163 |
|
|
2164 |
text {*
|
|
2165 |
A metric space (or topological vector space) is said to have the
|
|
2166 |
Heine-Borel property if every closed and bounded subset is compact.
|
|
2167 |
*}
|
|
2168 |
|
|
2169 |
class heine_borel =
|
|
2170 |
assumes bounded_imp_convergent_subsequence:
|
|
2171 |
"bounded s \<Longrightarrow> \<forall>n. f n \<in> s
|
|
2172 |
\<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
|
|
2173 |
|
|
2174 |
lemma bounded_closed_imp_compact:
|
|
2175 |
fixes s::"'a::heine_borel set"
|
|
2176 |
assumes "bounded s" and "closed s" shows "compact s"
|
|
2177 |
proof (unfold compact_def, clarify)
|
|
2178 |
fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s"
|
|
2179 |
obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"
|
|
2180 |
using bounded_imp_convergent_subsequence [OF `bounded s` `\<forall>n. f n \<in> s`] by auto
|
|
2181 |
from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" by simp
|
|
2182 |
have "l \<in> s" using `closed s` fr l
|
|
2183 |
unfolding closed_sequential_limits by blast
|
|
2184 |
show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
|
|
2185 |
using `l \<in> s` r l by blast
|
|
2186 |
qed
|
|
2187 |
|
|
2188 |
lemma subseq_bigger: assumes "subseq r" shows "n \<le> r n"
|
|
2189 |
proof(induct n)
|
|
2190 |
show "0 \<le> r 0" by auto
|
|
2191 |
next
|
|
2192 |
fix n assume "n \<le> r n"
|
|
2193 |
moreover have "r n < r (Suc n)"
|
|
2194 |
using assms [unfolded subseq_def] by auto
|
|
2195 |
ultimately show "Suc n \<le> r (Suc n)" by auto
|
|
2196 |
qed
|
|
2197 |
|
|
2198 |
lemma eventually_subseq:
|
|
2199 |
assumes r: "subseq r"
|
|
2200 |
shows "eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
|
|
2201 |
unfolding eventually_sequentially
|
|
2202 |
by (metis subseq_bigger [OF r] le_trans)
|
|
2203 |
|
|
2204 |
lemma lim_subseq:
|
|
2205 |
"subseq r \<Longrightarrow> (s ---> l) sequentially \<Longrightarrow> ((s o r) ---> l) sequentially"
|
|
2206 |
unfolding tendsto_def eventually_sequentially o_def
|
|
2207 |
by (metis subseq_bigger le_trans)
|
|
2208 |
|
|
2209 |
lemma num_Axiom: "EX! g. g 0 = e \<and> (\<forall>n. g (Suc n) = f n (g n))"
|
|
2210 |
unfolding Ex1_def
|
|
2211 |
apply (rule_tac x="nat_rec e f" in exI)
|
|
2212 |
apply (rule conjI)+
|
|
2213 |
apply (rule def_nat_rec_0, simp)
|
|
2214 |
apply (rule allI, rule def_nat_rec_Suc, simp)
|
|
2215 |
apply (rule allI, rule impI, rule ext)
|
|
2216 |
apply (erule conjE)
|
|
2217 |
apply (induct_tac x)
|
|
2218 |
apply (simp add: nat_rec_0)
|
|
2219 |
apply (erule_tac x="n" in allE)
|
|
2220 |
apply (simp)
|
|
2221 |
done
|
|
2222 |
|
|
2223 |
lemma convergent_bounded_increasing: fixes s ::"nat\<Rightarrow>real"
|
|
2224 |
assumes "incseq s" and "\<forall>n. abs(s n) \<le> b"
|
|
2225 |
shows "\<exists> l. \<forall>e::real>0. \<exists> N. \<forall>n \<ge> N. abs(s n - l) < e"
|
|
2226 |
proof-
|
|
2227 |
have "isUb UNIV (range s) b" using assms(2) and abs_le_D1 unfolding isUb_def and setle_def by auto
|
|
2228 |
then obtain t where t:"isLub UNIV (range s) t" using reals_complete[of "range s" ] by auto
|
|
2229 |
{ fix e::real assume "e>0" and as:"\<forall>N. \<exists>n\<ge>N. \<not> \<bar>s n - t\<bar> < e"
|
|
2230 |
{ fix n::nat
|
|
2231 |
obtain N where "N\<ge>n" and n:"\<bar>s N - t\<bar> \<ge> e" using as[THEN spec[where x=n]] by auto
|
|
2232 |
have "t \<ge> s N" using isLub_isUb[OF t, unfolded isUb_def setle_def] by auto
|
|
2233 |
with n have "s N \<le> t - e" using `e>0` by auto
|
|
2234 |
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 }
|
|
2235 |
hence "isUb UNIV (range s) (t - e)" unfolding isUb_def and setle_def by auto
|
|
2236 |
hence False using isLub_le_isUb[OF t, of "t - e"] and `e>0` by auto }
|
|
2237 |
thus ?thesis by blast
|
|
2238 |
qed
|
|
2239 |
|
|
2240 |
lemma convergent_bounded_monotone: fixes s::"nat \<Rightarrow> real"
|
|
2241 |
assumes "\<forall>n. abs(s n) \<le> b" and "monoseq s"
|
|
2242 |
shows "\<exists>l. \<forall>e::real>0. \<exists>N. \<forall>n\<ge>N. abs(s n - l) < e"
|
|
2243 |
using convergent_bounded_increasing[of s b] assms using convergent_bounded_increasing[of "\<lambda>n. - s n" b]
|
|
2244 |
unfolding monoseq_def incseq_def
|
|
2245 |
apply auto unfolding minus_add_distrib[THEN sym, unfolded diff_minus[THEN sym]]
|
|
2246 |
unfolding abs_minus_cancel by(rule_tac x="-l" in exI)auto
|
|
2247 |
|
|
2248 |
lemma compact_real_lemma:
|
|
2249 |
assumes "\<forall>n::nat. abs(s n) \<le> b"
|
|
2250 |
shows "\<exists>(l::real) r. subseq r \<and> ((s \<circ> r) ---> l) sequentially"
|
|
2251 |
proof-
|
|
2252 |
obtain r where r:"subseq r" "monoseq (\<lambda>n. s (r n))"
|
|
2253 |
using seq_monosub[of s] by auto
|
|
2254 |
thus ?thesis using convergent_bounded_monotone[of "\<lambda>n. s (r n)" b] and assms
|
|
2255 |
unfolding tendsto_iff dist_norm eventually_sequentially by auto
|
|
2256 |
qed
|
|
2257 |
|
|
2258 |
instance real :: heine_borel
|
|
2259 |
proof
|
|
2260 |
fix s :: "real set" and f :: "nat \<Rightarrow> real"
|
|
2261 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
|
|
2262 |
then obtain b where b: "\<forall>n. abs (f n) \<le> b"
|
|
2263 |
unfolding bounded_iff by auto
|
|
2264 |
obtain l :: real and r :: "nat \<Rightarrow> nat" where
|
|
2265 |
r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"
|
|
2266 |
using compact_real_lemma [OF b] by auto
|
|
2267 |
thus "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
|
|
2268 |
by auto
|
|
2269 |
qed
|
|
2270 |
|
|
2271 |
lemma bounded_component: "bounded s \<Longrightarrow> bounded ((\<lambda>x. x $ i) ` s)"
|
|
2272 |
unfolding bounded_def
|
|
2273 |
apply clarify
|
|
2274 |
apply (rule_tac x="x $ i" in exI)
|
|
2275 |
apply (rule_tac x="e" in exI)
|
|
2276 |
apply clarify
|
|
2277 |
apply (rule order_trans [OF dist_nth_le], simp)
|
|
2278 |
done
|
|
2279 |
|
|
2280 |
lemma compact_lemma:
|
|
2281 |
fixes f :: "nat \<Rightarrow> 'a::heine_borel ^ 'n::finite"
|
|
2282 |
assumes "bounded s" and "\<forall>n. f n \<in> s"
|
|
2283 |
shows "\<forall>d.
|
|
2284 |
\<exists>l r. subseq r \<and>
|
|
2285 |
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)"
|
|
2286 |
proof
|
|
2287 |
fix d::"'n set" have "finite d" by simp
|
|
2288 |
thus "\<exists>l::'a ^ 'n. \<exists>r. subseq r \<and>
|
|
2289 |
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)"
|
|
2290 |
proof(induct d) case empty thus ?case unfolding subseq_def by auto
|
|
2291 |
next case (insert k d)
|
|
2292 |
have s': "bounded ((\<lambda>x. x $ k) ` s)" using `bounded s` by (rule bounded_component)
|
|
2293 |
obtain l1::"'a^'n" and r1 where r1:"subseq r1" and lr1:"\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially"
|
|
2294 |
using insert(3) by auto
|
|
2295 |
have f': "\<forall>n. f (r1 n) $ k \<in> (\<lambda>x. x $ k) ` s" using `\<forall>n. f n \<in> s` by simp
|
|
2296 |
obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) $ k) ---> l2) sequentially"
|
|
2297 |
using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto
|
|
2298 |
def r \<equiv> "r1 \<circ> r2" have r:"subseq r"
|
|
2299 |
using r1 and r2 unfolding r_def o_def subseq_def by auto
|
|
2300 |
moreover
|
|
2301 |
def l \<equiv> "(\<chi> i. if i = k then l2 else l1$i)::'a^'n"
|
|
2302 |
{ fix e::real assume "e>0"
|
|
2303 |
from lr1 `e>0` have N1:"eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" by blast
|
|
2304 |
from lr2 `e>0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) $ k) l2 < e) sequentially" by (rule tendstoD)
|
|
2305 |
from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) $ i) (l1 $ i) < e) sequentially"
|
|
2306 |
by (rule eventually_subseq)
|
|
2307 |
have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) $ i) (l $ i) < e) sequentially"
|
|
2308 |
using N1' N2 by (rule eventually_elim2, simp add: l_def r_def)
|
|
2309 |
}
|
|
2310 |
ultimately show ?case by auto
|
|
2311 |
qed
|
|
2312 |
qed
|
|
2313 |
|
|
2314 |
instance "^" :: (heine_borel, finite) heine_borel
|
|
2315 |
proof
|
|
2316 |
fix s :: "('a ^ 'b) set" and f :: "nat \<Rightarrow> 'a ^ 'b"
|
|
2317 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
|
|
2318 |
then obtain l r where r: "subseq r"
|
|
2319 |
and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>UNIV. dist (f (r n) $ i) (l $ i) < e) sequentially"
|
|
2320 |
using compact_lemma [OF s f] by blast
|
|
2321 |
let ?d = "UNIV::'b set"
|
|
2322 |
{ fix e::real assume "e>0"
|
|
2323 |
hence "0 < e / (real_of_nat (card ?d))"
|
|
2324 |
using zero_less_card_finite using divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto
|
|
2325 |
with l have "eventually (\<lambda>n. \<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))) sequentially"
|
|
2326 |
by simp
|
|
2327 |
moreover
|
|
2328 |
{ fix n assume n: "\<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))"
|
|
2329 |
have "dist (f (r n)) l \<le> (\<Sum>i\<in>?d. dist (f (r n) $ i) (l $ i))"
|
|
2330 |
unfolding dist_vector_def using zero_le_dist by (rule setL2_le_setsum)
|
|
2331 |
also have "\<dots> < (\<Sum>i\<in>?d. e / (real_of_nat (card ?d)))"
|
|
2332 |
by (rule setsum_strict_mono) (simp_all add: n)
|
|
2333 |
finally have "dist (f (r n)) l < e" by simp
|
|
2334 |
}
|
|
2335 |
ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
|
|
2336 |
by (rule eventually_elim1)
|
|
2337 |
}
|
|
2338 |
hence *:"((f \<circ> r) ---> l) sequentially" unfolding o_def tendsto_iff by simp
|
|
2339 |
with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" by auto
|
|
2340 |
qed
|
|
2341 |
|
|
2342 |
lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)"
|
|
2343 |
unfolding bounded_def
|
|
2344 |
apply clarify
|
|
2345 |
apply (rule_tac x="a" in exI)
|
|
2346 |
apply (rule_tac x="e" in exI)
|
|
2347 |
apply clarsimp
|
|
2348 |
apply (drule (1) bspec)
|
|
2349 |
apply (simp add: dist_Pair_Pair)
|
|
2350 |
apply (erule order_trans [OF real_sqrt_sum_squares_ge1])
|
|
2351 |
done
|
|
2352 |
|
|
2353 |
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)"
|
|
2354 |
unfolding bounded_def
|
|
2355 |
apply clarify
|
|
2356 |
apply (rule_tac x="b" in exI)
|
|
2357 |
apply (rule_tac x="e" in exI)
|
|
2358 |
apply clarsimp
|
|
2359 |
apply (drule (1) bspec)
|
|
2360 |
apply (simp add: dist_Pair_Pair)
|
|
2361 |
apply (erule order_trans [OF real_sqrt_sum_squares_ge2])
|
|
2362 |
done
|
|
2363 |
|
|
2364 |
instance "*" :: (heine_borel, heine_borel) heine_borel
|
|
2365 |
proof
|
|
2366 |
fix s :: "('a * 'b) set" and f :: "nat \<Rightarrow> 'a * 'b"
|
|
2367 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
|
|
2368 |
from s have s1: "bounded (fst ` s)" by (rule bounded_fst)
|
|
2369 |
from f have f1: "\<forall>n. fst (f n) \<in> fst ` s" by simp
|
|
2370 |
obtain l1 r1 where r1: "subseq r1"
|
|
2371 |
and l1: "((\<lambda>n. fst (f (r1 n))) ---> l1) sequentially"
|
|
2372 |
using bounded_imp_convergent_subsequence [OF s1 f1]
|
|
2373 |
unfolding o_def by fast
|
|
2374 |
from s have s2: "bounded (snd ` s)" by (rule bounded_snd)
|
|
2375 |
from f have f2: "\<forall>n. snd (f (r1 n)) \<in> snd ` s" by simp
|
|
2376 |
obtain l2 r2 where r2: "subseq r2"
|
|
2377 |
and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially"
|
|
2378 |
using bounded_imp_convergent_subsequence [OF s2 f2]
|
|
2379 |
unfolding o_def by fast
|
|
2380 |
have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially"
|
|
2381 |
using lim_subseq [OF r2 l1] unfolding o_def .
|
|
2382 |
have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially"
|
|
2383 |
using tendsto_Pair [OF l1' l2] unfolding o_def by simp
|
|
2384 |
have r: "subseq (r1 \<circ> r2)"
|
|
2385 |
using r1 r2 unfolding subseq_def by simp
|
|
2386 |
show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
|
|
2387 |
using l r by fast
|
|
2388 |
qed
|
|
2389 |
|
|
2390 |
subsection{* Completeness. *}
|
|
2391 |
|
|
2392 |
lemma cauchy_def:
|
|
2393 |
"Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"
|
|
2394 |
unfolding Cauchy_def by blast
|
|
2395 |
|
|
2396 |
definition
|
|
2397 |
complete :: "'a::metric_space set \<Rightarrow> bool" where
|
|
2398 |
"complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f
|
|
2399 |
--> (\<exists>l \<in> s. (f ---> l) sequentially))"
|
|
2400 |
|
|
2401 |
lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs")
|
|
2402 |
proof-
|
|
2403 |
{ assume ?rhs
|
|
2404 |
{ fix e::real
|
|
2405 |
assume "e>0"
|
|
2406 |
with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2"
|
|
2407 |
by (erule_tac x="e/2" in allE) auto
|
|
2408 |
{ fix n m
|
|
2409 |
assume nm:"N \<le> m \<and> N \<le> n"
|
|
2410 |
hence "dist (s m) (s n) < e" using N
|
|
2411 |
using dist_triangle_half_l[of "s m" "s N" "e" "s n"]
|
|
2412 |
by blast
|
|
2413 |
}
|
|
2414 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e"
|
|
2415 |
by blast
|
|
2416 |
}
|
|
2417 |
hence ?lhs
|
|
2418 |
unfolding cauchy_def
|
|
2419 |
by blast
|
|
2420 |
}
|
|
2421 |
thus ?thesis
|
|
2422 |
unfolding cauchy_def
|
|
2423 |
using dist_triangle_half_l
|
|
2424 |
by blast
|
|
2425 |
qed
|
|
2426 |
|
|
2427 |
lemma convergent_imp_cauchy:
|
|
2428 |
"(s ---> l) sequentially ==> Cauchy s"
|
|
2429 |
proof(simp only: cauchy_def, rule, rule)
|
|
2430 |
fix e::real assume "e>0" "(s ---> l) sequentially"
|
|
2431 |
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
|
|
2432 |
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
|
|
2433 |
qed
|
|
2434 |
|
|
2435 |
lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded {y. (\<exists>n::nat. y = s n)}"
|
|
2436 |
proof-
|
|
2437 |
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
|
|
2438 |
hence N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto
|
|
2439 |
moreover
|
|
2440 |
have "bounded (s ` {0..N})" using finite_imp_bounded[of "s ` {1..N}"] by auto
|
|
2441 |
then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
|
|
2442 |
unfolding bounded_any_center [where a="s N"] by auto
|
|
2443 |
ultimately show "?thesis"
|
|
2444 |
unfolding bounded_any_center [where a="s N"]
|
|
2445 |
apply(rule_tac x="max a 1" in exI) apply auto
|
|
2446 |
apply(erule_tac x=n in allE) apply(erule_tac x=n in ballE) by auto
|
|
2447 |
qed
|
|
2448 |
|
|
2449 |
lemma compact_imp_complete: assumes "compact s" shows "complete s"
|
|
2450 |
proof-
|
|
2451 |
{ fix f assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f"
|
|
2452 |
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
|
|
2453 |
|
|
2454 |
note lr' = subseq_bigger [OF lr(2)]
|
|
2455 |
|
|
2456 |
{ fix e::real assume "e>0"
|
|
2457 |
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
|
|
2458 |
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
|
|
2459 |
{ fix n::nat assume n:"n \<ge> max N M"
|
|
2460 |
have "dist ((f \<circ> r) n) l < e/2" using n M by auto
|
|
2461 |
moreover have "r n \<ge> N" using lr'[of n] n by auto
|
|
2462 |
hence "dist (f n) ((f \<circ> r) n) < e / 2" using N using n by auto
|
|
2463 |
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) }
|
|
2464 |
hence "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast }
|
|
2465 |
hence "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` unfolding Lim_sequentially by auto }
|
|
2466 |
thus ?thesis unfolding complete_def by auto
|
|
2467 |
qed
|
|
2468 |
|
|
2469 |
instance heine_borel < complete_space
|
|
2470 |
proof
|
|
2471 |
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
|
|
2472 |
hence "bounded (range f)" unfolding image_def
|
|
2473 |
using cauchy_imp_bounded [of f] by auto
|
|
2474 |
hence "compact (closure (range f))"
|
|
2475 |
using bounded_closed_imp_compact [of "closure (range f)"] by auto
|
|
2476 |
hence "complete (closure (range f))"
|
|
2477 |
using compact_imp_complete by auto
|
|
2478 |
moreover have "\<forall>n. f n \<in> closure (range f)"
|
|
2479 |
using closure_subset [of "range f"] by auto
|
|
2480 |
ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially"
|
|
2481 |
using `Cauchy f` unfolding complete_def by auto
|
|
2482 |
then show "convergent f"
|
|
2483 |
unfolding convergent_def LIMSEQ_conv_tendsto [symmetric] by auto
|
|
2484 |
qed
|
|
2485 |
|
|
2486 |
lemma complete_univ: "complete (UNIV :: 'a::complete_space set)"
|
|
2487 |
proof(simp add: complete_def, rule, rule)
|
|
2488 |
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
|
|
2489 |
hence "convergent f" by (rule Cauchy_convergent)
|
|
2490 |
hence "\<exists>l. f ----> l" unfolding convergent_def .
|
|
2491 |
thus "\<exists>l. (f ---> l) sequentially" unfolding LIMSEQ_conv_tendsto .
|
|
2492 |
qed
|
|
2493 |
|
|
2494 |
lemma complete_imp_closed: assumes "complete s" shows "closed s"
|
|
2495 |
proof -
|
|
2496 |
{ fix x assume "x islimpt s"
|
|
2497 |
then obtain f where f: "\<forall>n. f n \<in> s - {x}" "(f ---> x) sequentially"
|
|
2498 |
unfolding islimpt_sequential by auto
|
|
2499 |
then obtain l where l: "l\<in>s" "(f ---> l) sequentially"
|
|
2500 |
using `complete s`[unfolded complete_def] using convergent_imp_cauchy[of f x] by auto
|
|
2501 |
hence "x \<in> s" using Lim_unique[of sequentially f l x] trivial_limit_sequentially f(2) by auto
|
|
2502 |
}
|
|
2503 |
thus "closed s" unfolding closed_limpt by auto
|
|
2504 |
qed
|
|
2505 |
|
|
2506 |
lemma complete_eq_closed:
|
|
2507 |
fixes s :: "'a::complete_space set"
|
|
2508 |
shows "complete s \<longleftrightarrow> closed s" (is "?lhs = ?rhs")
|
|
2509 |
proof
|
|
2510 |
assume ?lhs thus ?rhs by (rule complete_imp_closed)
|
|
2511 |
next
|
|
2512 |
assume ?rhs
|
|
2513 |
{ fix f assume as:"\<forall>n::nat. f n \<in> s" "Cauchy f"
|
|
2514 |
then obtain l where "(f ---> l) sequentially" using complete_univ[unfolded complete_def, THEN spec[where x=f]] by auto
|
|
2515 |
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 }
|
|
2516 |
thus ?lhs unfolding complete_def by auto
|
|
2517 |
qed
|
|
2518 |
|
|
2519 |
lemma convergent_eq_cauchy:
|
|
2520 |
fixes s :: "nat \<Rightarrow> 'a::complete_space"
|
|
2521 |
shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s" (is "?lhs = ?rhs")
|
|
2522 |
proof
|
|
2523 |
assume ?lhs then obtain l where "(s ---> l) sequentially" by auto
|
|
2524 |
thus ?rhs using convergent_imp_cauchy by auto
|
|
2525 |
next
|
|
2526 |
assume ?rhs thus ?lhs using complete_univ[unfolded complete_def, THEN spec[where x=s]] by auto
|
|
2527 |
qed
|
|
2528 |
|
|
2529 |
lemma convergent_imp_bounded:
|
|
2530 |
fixes s :: "nat \<Rightarrow> 'a::metric_space"
|
|
2531 |
shows "(s ---> l) sequentially ==> bounded (s ` (UNIV::(nat set)))"
|
|
2532 |
using convergent_imp_cauchy[of s]
|
|
2533 |
using cauchy_imp_bounded[of s]
|
|
2534 |
unfolding image_def
|
|
2535 |
by auto
|
|
2536 |
|
|
2537 |
subsection{* Total boundedness. *}
|
|
2538 |
|
|
2539 |
fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
|
|
2540 |
"helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))"
|
|
2541 |
declare helper_1.simps[simp del]
|
|
2542 |
|
|
2543 |
lemma compact_imp_totally_bounded:
|
|
2544 |
assumes "compact s"
|
|
2545 |
shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k))"
|
|
2546 |
proof(rule, rule, rule ccontr)
|
|
2547 |
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)"
|
|
2548 |
def x \<equiv> "helper_1 s e"
|
|
2549 |
{ fix n
|
|
2550 |
have "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)"
|
|
2551 |
proof(induct_tac rule:nat_less_induct)
|
|
2552 |
fix n def Q \<equiv> "(\<lambda>y. y \<in> s \<and> (\<forall>m<n. \<not> dist (x m) y < e))"
|
|
2553 |
assume as:"\<forall>m<n. x m \<in> s \<and> (\<forall>ma<m. \<not> dist (x ma) (x m) < e)"
|
|
2554 |
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
|
|
2555 |
then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)" unfolding subset_eq by auto
|
|
2556 |
have "Q (x n)" unfolding x_def and helper_1.simps[of s e n]
|
|
2557 |
apply(rule someI2[where a=z]) unfolding x_def[symmetric] and Q_def using z by auto
|
|
2558 |
thus "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" unfolding Q_def by auto
|
|
2559 |
qed }
|
|
2560 |
hence "\<forall>n::nat. x n \<in> s" and x:"\<forall>n. \<forall>m < n. \<not> (dist (x m) (x n) < e)" by blast+
|
|
2561 |
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
|
|
2562 |
from this(3) have "Cauchy (x \<circ> r)" using convergent_imp_cauchy by auto
|
|
2563 |
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
|
|
2564 |
show False
|
|
2565 |
using N[THEN spec[where x=N], THEN spec[where x="N+1"]]
|
|
2566 |
using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]]
|
|
2567 |
using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto
|
|
2568 |
qed
|
|
2569 |
|
|
2570 |
subsection{* Heine-Borel theorem (following Burkill \& Burkill vol. 2) *}
|
|
2571 |
|
|
2572 |
lemma heine_borel_lemma: fixes s::"'a::metric_space set"
|
|
2573 |
assumes "compact s" "s \<subseteq> (\<Union> t)" "\<forall>b \<in> t. open b"
|
|
2574 |
shows "\<exists>e>0. \<forall>x \<in> s. \<exists>b \<in> t. ball x e \<subseteq> b"
|
|
2575 |
proof(rule ccontr)
|
|
2576 |
assume "\<not> (\<exists>e>0. \<forall>x\<in>s. \<exists>b\<in>t. ball x e \<subseteq> b)"
|
|
2577 |
hence cont:"\<forall>e>0. \<exists>x\<in>s. \<forall>xa\<in>t. \<not> (ball x e \<subseteq> xa)" by auto
|
|
2578 |
{ fix n::nat
|
|
2579 |
have "1 / real (n + 1) > 0" by auto
|
|
2580 |
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 }
|
|
2581 |
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
|
|
2582 |
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)"
|
|
2583 |
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
|
|
2584 |
|
|
2585 |
then obtain l r where l:"l\<in>s" and r:"subseq r" and lr:"((f \<circ> r) ---> l) sequentially"
|
|
2586 |
using assms(1)[unfolded compact_def, THEN spec[where x=f]] by auto
|
|
2587 |
|
|
2588 |
obtain b where "l\<in>b" "b\<in>t" using assms(2) and l by auto
|
|
2589 |
then obtain e where "e>0" and e:"\<forall>z. dist z l < e \<longrightarrow> z\<in>b"
|
|
2590 |
using assms(3)[THEN bspec[where x=b]] unfolding open_dist by auto
|
|
2591 |
|
|
2592 |
then obtain N1 where N1:"\<forall>n\<ge>N1. dist ((f \<circ> r) n) l < e / 2"
|
|
2593 |
using lr[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
|
|
2594 |
|
|
2595 |
obtain N2::nat where N2:"N2>0" "inverse (real N2) < e /2" using real_arch_inv[of "e/2"] and `e>0` by auto
|
|
2596 |
have N2':"inverse (real (r (N1 + N2) +1 )) < e/2"
|
|
2597 |
apply(rule order_less_trans) apply(rule less_imp_inverse_less) using N2
|
|
2598 |
using subseq_bigger[OF r, of "N1 + N2"] by auto
|
|
2599 |
|
|
2600 |
def x \<equiv> "(f (r (N1 + N2)))"
|
|
2601 |
have x:"\<not> ball x (inverse (real (r (N1 + N2) + 1))) \<subseteq> b" unfolding x_def
|
|
2602 |
using f[THEN spec[where x="r (N1 + N2)"]] using `b\<in>t` by auto
|
|
2603 |
have "\<exists>y\<in>ball x (inverse (real (r (N1 + N2) + 1))). y\<notin>b" apply(rule ccontr) using x by auto
|
|
2604 |
then obtain y where y:"y \<in> ball x (inverse (real (r (N1 + N2) + 1)))" "y \<notin> b" by auto
|
|
2605 |
|
|
2606 |
have "dist x l < e/2" using N1 unfolding x_def o_def by auto
|
|
2607 |
hence "dist y l < e" using y N2' using dist_triangle[of y l x]by (auto simp add:dist_commute)
|
|
2608 |
|
|
2609 |
thus False using e and `y\<notin>b` by auto
|
|
2610 |
qed
|
|
2611 |
|
|
2612 |
lemma compact_imp_heine_borel: "compact s ==> (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)
|
|
2613 |
\<longrightarrow> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))"
|
|
2614 |
proof clarify
|
|
2615 |
fix f assume "compact s" " \<forall>t\<in>f. open t" "s \<subseteq> \<Union>f"
|
|
2616 |
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
|
|
2617 |
hence "\<forall>x\<in>s. \<exists>b. b\<in>f \<and> ball x e \<subseteq> b" by auto
|
|
2618 |
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
|
|
2619 |
then obtain bb where bb:"\<forall>x\<in>s. (bb x) \<in> f \<and> ball x e \<subseteq> (bb x)" by blast
|
|
2620 |
|
|
2621 |
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
|
|
2622 |
then obtain k where k:"finite k" "k \<subseteq> s" "s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" by auto
|
|
2623 |
|
|
2624 |
have "finite (bb ` k)" using k(1) by auto
|
|
2625 |
moreover
|
|
2626 |
{ fix x assume "x\<in>s"
|
|
2627 |
hence "x\<in>\<Union>(\<lambda>x. ball x e) ` k" using k(3) unfolding subset_eq by auto
|
|
2628 |
hence "\<exists>X\<in>bb ` k. x \<in> X" using bb k(2) by blast
|
|
2629 |
hence "x \<in> \<Union>(bb ` k)" using Union_iff[of x "bb ` k"] by auto
|
|
2630 |
}
|
|
2631 |
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
|
|
2632 |
qed
|
|
2633 |
|
|
2634 |
subsection{* Bolzano-Weierstrass property. *}
|
|
2635 |
|
|
2636 |
lemma heine_borel_imp_bolzano_weierstrass:
|
|
2637 |
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'))"
|
|
2638 |
"infinite t" "t \<subseteq> s"
|
|
2639 |
shows "\<exists>x \<in> s. x islimpt t"
|
|
2640 |
proof(rule ccontr)
|
|
2641 |
assume "\<not> (\<exists>x \<in> s. x islimpt t)"
|
|
2642 |
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
|
|
2643 |
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
|
|
2644 |
obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
|
|
2645 |
using assms(1)[THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto
|
|
2646 |
from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto
|
|
2647 |
{ fix x y assume "x\<in>t" "y\<in>t" "f x = f y"
|
|
2648 |
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
|
|
2649 |
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 }
|
|
2650 |
hence "infinite (f ` t)" using assms(2) using finite_imageD[unfolded inj_on_def, of f t] by auto
|
|
2651 |
moreover
|
|
2652 |
{ fix x assume "x\<in>t" "f x \<notin> g"
|
|
2653 |
from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto
|
|
2654 |
then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto
|
|
2655 |
hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto
|
|
2656 |
hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto }
|
|
2657 |
hence "f ` t \<subseteq> g" by auto
|
|
2658 |
ultimately show False using g(2) using finite_subset by auto
|
|
2659 |
qed
|
|
2660 |
|
|
2661 |
subsection{* Complete the chain of compactness variants. *}
|
|
2662 |
|
|
2663 |
primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where
|
|
2664 |
"helper_2 beyond 0 = beyond 0" |
|
|
2665 |
"helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )"
|
|
2666 |
|
|
2667 |
lemma bolzano_weierstrass_imp_bounded: fixes s::"'a::metric_space set"
|
|
2668 |
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
|
|
2669 |
shows "bounded s"
|
|
2670 |
proof(rule ccontr)
|
|
2671 |
assume "\<not> bounded s"
|
|
2672 |
then obtain beyond where "\<forall>a. beyond a \<in>s \<and> \<not> dist undefined (beyond a) \<le> a"
|
|
2673 |
unfolding bounded_any_center [where a=undefined]
|
|
2674 |
apply simp using choice[of "\<lambda>a x. x\<in>s \<and> \<not> dist undefined x \<le> a"] by auto
|
|
2675 |
hence beyond:"\<And>a. beyond a \<in>s" "\<And>a. dist undefined (beyond a) > a"
|
|
2676 |
unfolding linorder_not_le by auto
|
|
2677 |
def x \<equiv> "helper_2 beyond"
|
|
2678 |
|
|
2679 |
{ fix m n ::nat assume "m<n"
|
|
2680 |
hence "dist undefined (x m) + 1 < dist undefined (x n)"
|
|
2681 |
proof(induct n)
|
|
2682 |
case 0 thus ?case by auto
|
|
2683 |
next
|
|
2684 |
case (Suc n)
|
|
2685 |
have *:"dist undefined (x n) + 1 < dist undefined (x (Suc n))"
|
|
2686 |
unfolding x_def and helper_2.simps
|
|
2687 |
using beyond(2)[of "dist undefined (helper_2 beyond n) + 1"] by auto
|
|
2688 |
thus ?case proof(cases "m < n")
|
|
2689 |
case True thus ?thesis using Suc and * by auto
|
|
2690 |
next
|
|
2691 |
case False hence "m = n" using Suc(2) by auto
|
|
2692 |
thus ?thesis using * by auto
|
|
2693 |
qed
|
|
2694 |
qed } note * = this
|
|
2695 |
{ fix m n ::nat assume "m\<noteq>n"
|
|
2696 |
have "1 < dist (x m) (x n)"
|
|
2697 |
proof(cases "m<n")
|
|
2698 |
case True
|
|
2699 |
hence "1 < dist undefined (x n) - dist undefined (x m)" using *[of m n] by auto
|
|
2700 |
thus ?thesis using dist_triangle [of undefined "x n" "x m"] by arith
|
|
2701 |
next
|
|
2702 |
case False hence "n<m" using `m\<noteq>n` by auto
|
|
2703 |
hence "1 < dist undefined (x m) - dist undefined (x n)" using *[of n m] by auto
|
|
2704 |
thus ?thesis using dist_triangle2 [of undefined "x m" "x n"] by arith
|
|
2705 |
qed } note ** = this
|
|
2706 |
{ fix a b assume "x a = x b" "a \<noteq> b"
|
|
2707 |
hence False using **[of a b] by auto }
|
|
2708 |
hence "inj x" unfolding inj_on_def by auto
|
|
2709 |
moreover
|
|
2710 |
{ fix n::nat
|
|
2711 |
have "x n \<in> s"
|
|
2712 |
proof(cases "n = 0")
|
|
2713 |
case True thus ?thesis unfolding x_def using beyond by auto
|
|
2714 |
next
|
|
2715 |
case False then obtain z where "n = Suc z" using not0_implies_Suc by auto
|
|
2716 |
thus ?thesis unfolding x_def using beyond by auto
|
|
2717 |
qed }
|
|
2718 |
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
|
|
2719 |
|
|
2720 |
then obtain l where "l\<in>s" and l:"l islimpt range x" using assms[THEN spec[where x="range x"]] by auto
|
|
2721 |
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
|
|
2722 |
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"]]
|
|
2723 |
unfolding dist_nz by auto
|
|
2724 |
show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto
|
|
2725 |
qed
|
|
2726 |
|
|
2727 |
lemma sequence_infinite_lemma:
|
|
2728 |
fixes l :: "'a::metric_space" (* TODO: generalize *)
|
|
2729 |
assumes "\<forall>n::nat. (f n \<noteq> l)" "(f ---> l) sequentially"
|
|
2730 |
shows "infinite {y. (\<exists> n. y = f n)}"
|
|
2731 |
proof(rule ccontr)
|
|
2732 |
let ?A = "(\<lambda>x. dist x l) ` {y. \<exists>n. y = f n}"
|
|
2733 |
assume "\<not> infinite {y. \<exists>n. y = f n}"
|
|
2734 |
hence **:"finite ?A" "?A \<noteq> {}" by auto
|
|
2735 |
obtain k where k:"dist (f k) l = Min ?A" using Min_in[OF **] by auto
|
|
2736 |
have "0 < Min ?A" using assms(1) unfolding dist_nz unfolding Min_gr_iff[OF **] by auto
|
|
2737 |
then obtain N where "dist (f N) l < Min ?A" using assms(2)[unfolded Lim_sequentially, THEN spec[where x="Min ?A"]] by auto
|
|
2738 |
moreover have "dist (f N) l \<in> ?A" by auto
|
|
2739 |
ultimately show False using Min_le[OF **(1), of "dist (f N) l"] by auto
|
|
2740 |
qed
|
|
2741 |
|
|
2742 |
lemma sequence_unique_limpt:
|
|
2743 |
fixes l :: "'a::metric_space" (* TODO: generalize *)
|
|
2744 |
assumes "\<forall>n::nat. (f n \<noteq> l)" "(f ---> l) sequentially" "l' islimpt {y. (\<exists>n. y = f n)}"
|
|
2745 |
shows "l' = l"
|
|
2746 |
proof(rule ccontr)
|
|
2747 |
def e \<equiv> "dist l' l"
|
|
2748 |
assume "l' \<noteq> l" hence "e>0" unfolding dist_nz e_def by auto
|
|
2749 |
then obtain N::nat where N:"\<forall>n\<ge>N. dist (f n) l < e / 2"
|
|
2750 |
using assms(2)[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
|
|
2751 |
def d \<equiv> "Min (insert (e/2) ((\<lambda>n. if dist (f n) l' = 0 then e/2 else dist (f n) l') ` {0 .. N}))"
|
|
2752 |
have "d>0" using `e>0` unfolding d_def e_def using zero_le_dist[of _ l', unfolded order_le_less] by auto
|
|
2753 |
obtain k where k:"f k \<noteq> l'" "dist (f k) l' < d" using `d>0` and assms(3)[unfolded islimpt_approachable, THEN spec[where x="d"]] by auto
|
|
2754 |
have "k\<ge>N" using k(1)[unfolded dist_nz] using k(2)[unfolded d_def]
|
|
2755 |
by force
|
|
2756 |
hence "dist l' l < e" using N[THEN spec[where x=k]] using k(2)[unfolded d_def] and dist_triangle_half_r[of "f k" l' e l] by auto
|
|
2757 |
thus False unfolding e_def by auto
|
|
2758 |
qed
|
|
2759 |
|
|
2760 |
lemma bolzano_weierstrass_imp_closed:
|
|
2761 |
fixes s :: "'a::metric_space set" (* TODO: can this be generalized? *)
|
|
2762 |
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
|
|
2763 |
shows "closed s"
|
|
2764 |
proof-
|
|
2765 |
{ fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially"
|
|
2766 |
hence "l \<in> s"
|
|
2767 |
proof(cases "\<forall>n. x n \<noteq> l")
|
|
2768 |
case False thus "l\<in>s" using as(1) by auto
|
|
2769 |
next
|
|
2770 |
case True note cas = this
|
|
2771 |
with as(2) have "infinite {y. \<exists>n. y = x n}" using sequence_infinite_lemma[of x l] by auto
|
|
2772 |
then obtain l' where "l'\<in>s" "l' islimpt {y. \<exists>n. y = x n}" using assms[THEN spec[where x="{y. \<exists>n. y = x n}"]] as(1) by auto
|
|
2773 |
thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto
|
|
2774 |
qed }
|
|
2775 |
thus ?thesis unfolding closed_sequential_limits by fast
|
|
2776 |
qed
|
|
2777 |
|
|
2778 |
text{* Hence express everything as an equivalence. *}
|
|
2779 |
|
|
2780 |
lemma compact_eq_heine_borel:
|
|
2781 |
fixes s :: "'a::heine_borel set"
|
|
2782 |
shows "compact s \<longleftrightarrow>
|
|
2783 |
(\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)
|
|
2784 |
--> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" (is "?lhs = ?rhs")
|
|
2785 |
proof
|
|
2786 |
assume ?lhs thus ?rhs using compact_imp_heine_borel[of s] by blast
|
|
2787 |
next
|
|
2788 |
assume ?rhs
|
|
2789 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. x islimpt t)"
|
|
2790 |
by (blast intro: heine_borel_imp_bolzano_weierstrass[of s])
|
|
2791 |
thus ?lhs using bolzano_weierstrass_imp_bounded[of s] bolzano_weierstrass_imp_closed[of s] bounded_closed_imp_compact[of s] by blast
|
|
2792 |
qed
|
|
2793 |
|
|
2794 |
lemma compact_eq_bolzano_weierstrass:
|
|
2795 |
fixes s :: "'a::heine_borel set"
|
|
2796 |
shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs")
|
|
2797 |
proof
|
|
2798 |
assume ?lhs thus ?rhs unfolding compact_eq_heine_borel using heine_borel_imp_bolzano_weierstrass[of s] by auto
|
|
2799 |
next
|
|
2800 |
assume ?rhs thus ?lhs using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed bounded_closed_imp_compact by auto
|
|
2801 |
qed
|
|
2802 |
|
|
2803 |
lemma compact_eq_bounded_closed:
|
|
2804 |
fixes s :: "'a::heine_borel set"
|
|
2805 |
shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs")
|
|
2806 |
proof
|
|
2807 |
assume ?lhs thus ?rhs unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto
|
|
2808 |
next
|
|
2809 |
assume ?rhs thus ?lhs using bounded_closed_imp_compact by auto
|
|
2810 |
qed
|
|
2811 |
|
|
2812 |
lemma compact_imp_bounded:
|
|
2813 |
fixes s :: "'a::metric_space set"
|
|
2814 |
shows "compact s ==> bounded s"
|
|
2815 |
proof -
|
|
2816 |
assume "compact s"
|
|
2817 |
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')"
|
|
2818 |
by (rule compact_imp_heine_borel)
|
|
2819 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"
|
|
2820 |
using heine_borel_imp_bolzano_weierstrass[of s] by auto
|
|
2821 |
thus "bounded s"
|
|
2822 |
by (rule bolzano_weierstrass_imp_bounded)
|
|
2823 |
qed
|
|
2824 |
|
|
2825 |
lemma compact_imp_closed:
|
|
2826 |
fixes s :: "'a::metric_space set"
|
|
2827 |
shows "compact s ==> closed s"
|
|
2828 |
proof -
|
|
2829 |
assume "compact s"
|
|
2830 |
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')"
|
|
2831 |
by (rule compact_imp_heine_borel)
|
|
2832 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"
|
|
2833 |
using heine_borel_imp_bolzano_weierstrass[of s] by auto
|
|
2834 |
thus "closed s"
|
|
2835 |
by (rule bolzano_weierstrass_imp_closed)
|
|
2836 |
qed
|
|
2837 |
|
|
2838 |
text{* In particular, some common special cases. *}
|
|
2839 |
|
|
2840 |
lemma compact_empty[simp]:
|
|
2841 |
"compact {}"
|
|
2842 |
unfolding compact_def
|
|
2843 |
by simp
|
|
2844 |
|
|
2845 |
(* TODO: can any of the next 3 lemmas be generalized to metric spaces? *)
|
|
2846 |
|
|
2847 |
(* FIXME : Rename *)
|
|
2848 |
lemma compact_union[intro]:
|
|
2849 |
fixes s t :: "'a::heine_borel set"
|
|
2850 |
shows "compact s \<Longrightarrow> compact t ==> compact (s \<union> t)"
|
|
2851 |
unfolding compact_eq_bounded_closed
|
|
2852 |
using bounded_Un[of s t]
|
|
2853 |
using closed_Un[of s t]
|
|
2854 |
by simp
|
|
2855 |
|
|
2856 |
lemma compact_inter[intro]:
|
|
2857 |
fixes s t :: "'a::heine_borel set"
|
|
2858 |
shows "compact s \<Longrightarrow> compact t ==> compact (s \<inter> t)"
|
|
2859 |
unfolding compact_eq_bounded_closed
|
|
2860 |
using bounded_Int[of s t]
|
|
2861 |
using closed_Int[of s t]
|
|
2862 |
by simp
|
|
2863 |
|
|
2864 |
lemma compact_inter_closed[intro]:
|
|
2865 |
fixes s t :: "'a::heine_borel set"
|
|
2866 |
shows "compact s \<Longrightarrow> closed t ==> compact (s \<inter> t)"
|
|
2867 |
unfolding compact_eq_bounded_closed
|
|
2868 |
using closed_Int[of s t]
|
|
2869 |
using bounded_subset[of "s \<inter> t" s]
|
|
2870 |
by blast
|
|
2871 |
|
|
2872 |
lemma closed_inter_compact[intro]:
|
|
2873 |
fixes s t :: "'a::heine_borel set"
|
|
2874 |
shows "closed s \<Longrightarrow> compact t ==> compact (s \<inter> t)"
|
|
2875 |
proof-
|
|
2876 |
assume "closed s" "compact t"
|
|
2877 |
moreover
|
|
2878 |
have "s \<inter> t = t \<inter> s" by auto ultimately
|
|
2879 |
show ?thesis
|
|
2880 |
using compact_inter_closed[of t s]
|
|
2881 |
by auto
|
|
2882 |
qed
|
|
2883 |
|
|
2884 |
lemma closed_sing [simp]:
|
|
2885 |
fixes a :: "'a::metric_space"
|
|
2886 |
shows "closed {a}"
|
|
2887 |
apply (clarsimp simp add: closed_def open_dist)
|
|
2888 |
apply (rule ccontr)
|
|
2889 |
apply (drule_tac x="dist x a" in spec)
|
|
2890 |
apply (simp add: dist_nz dist_commute)
|
|
2891 |
done
|
|
2892 |
|
|
2893 |
lemma finite_imp_closed:
|
|
2894 |
fixes s :: "'a::metric_space set"
|
|
2895 |
shows "finite s ==> closed s"
|
|
2896 |
proof (induct set: finite)
|
|
2897 |
case empty show "closed {}" by simp
|
|
2898 |
next
|
|
2899 |
case (insert x F)
|
|
2900 |
hence "closed ({x} \<union> F)" by (simp only: closed_Un closed_sing)
|
|
2901 |
thus "closed (insert x F)" by simp
|
|
2902 |
qed
|
|
2903 |
|
|
2904 |
lemma finite_imp_compact:
|
|
2905 |
fixes s :: "'a::heine_borel set"
|
|
2906 |
shows "finite s ==> compact s"
|
|
2907 |
unfolding compact_eq_bounded_closed
|
|
2908 |
using finite_imp_closed finite_imp_bounded
|
|
2909 |
by blast
|
|
2910 |
|
|
2911 |
lemma compact_sing [simp]: "compact {a}"
|
|
2912 |
unfolding compact_def o_def subseq_def
|
|
2913 |
by (auto simp add: tendsto_const)
|
|
2914 |
|
|
2915 |
lemma compact_cball[simp]:
|
|
2916 |
fixes x :: "'a::heine_borel"
|
|
2917 |
shows "compact(cball x e)"
|
|
2918 |
using compact_eq_bounded_closed bounded_cball closed_cball
|
|
2919 |
by blast
|
|
2920 |
|
|
2921 |
lemma compact_frontier_bounded[intro]:
|
|
2922 |
fixes s :: "'a::heine_borel set"
|
|
2923 |
shows "bounded s ==> compact(frontier s)"
|
|
2924 |
unfolding frontier_def
|
|
2925 |
using compact_eq_bounded_closed
|
|
2926 |
by blast
|
|
2927 |
|
|
2928 |
lemma compact_frontier[intro]:
|
|
2929 |
fixes s :: "'a::heine_borel set"
|
|
2930 |
shows "compact s ==> compact (frontier s)"
|
|
2931 |
using compact_eq_bounded_closed compact_frontier_bounded
|
|
2932 |
by blast
|
|
2933 |
|
|
2934 |
lemma frontier_subset_compact:
|
|
2935 |
fixes s :: "'a::heine_borel set"
|
|
2936 |
shows "compact s ==> frontier s \<subseteq> s"
|
|
2937 |
using frontier_subset_closed compact_eq_bounded_closed
|
|
2938 |
by blast
|
|
2939 |
|
|
2940 |
lemma open_delete:
|
|
2941 |
fixes s :: "'a::metric_space set"
|
|
2942 |
shows "open s ==> open(s - {x})"
|
|
2943 |
using open_Diff[of s "{x}"] closed_sing
|
|
2944 |
by blast
|
|
2945 |
|
|
2946 |
text{* Finite intersection property. I could make it an equivalence in fact. *}
|
|
2947 |
|
|
2948 |
lemma compact_imp_fip:
|
|
2949 |
fixes s :: "'a::heine_borel set"
|
|
2950 |
assumes "compact s" "\<forall>t \<in> f. closed t"
|
|
2951 |
"\<forall>f'. finite f' \<and> f' \<subseteq> f --> (s \<inter> (\<Inter> f') \<noteq> {})"
|
|
2952 |
shows "s \<inter> (\<Inter> f) \<noteq> {}"
|
|
2953 |
proof
|
|
2954 |
assume as:"s \<inter> (\<Inter> f) = {}"
|
|
2955 |
hence "s \<subseteq> \<Union>op - UNIV ` f" by auto
|
|
2956 |
moreover have "Ball (op - UNIV ` f) open" using open_Diff closed_Diff using assms(2) by auto
|
|
2957 |
ultimately obtain f' where f':"f' \<subseteq> op - UNIV ` f" "finite f'" "s \<subseteq> \<Union>f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\<lambda>t. UNIV - t) ` f"]] by auto
|
|
2958 |
hence "finite (op - UNIV ` f') \<and> op - UNIV ` f' \<subseteq> f" by(auto simp add: Diff_Diff_Int)
|
|
2959 |
hence "s \<inter> \<Inter>op - UNIV ` f' \<noteq> {}" using assms(3)[THEN spec[where x="op - UNIV ` f'"]] by auto
|
|
2960 |
thus False using f'(3) unfolding subset_eq and Union_iff by blast
|
|
2961 |
qed
|
|
2962 |
|
|
2963 |
subsection{* Bounded closed nest property (proof does not use Heine-Borel). *}
|
|
2964 |
|
|
2965 |
lemma bounded_closed_nest:
|
|
2966 |
assumes "\<forall>n. closed(s n)" "\<forall>n. (s n \<noteq> {})"
|
|
2967 |
"(\<forall>m n. m \<le> n --> s n \<subseteq> s m)" "bounded(s 0)"
|
|
2968 |
shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s(n)"
|
|
2969 |
proof-
|
|
2970 |
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
|
|
2971 |
from assms(4,1) have *:"compact (s 0)" using bounded_closed_imp_compact[of "s 0"] by auto
|
|
2972 |
|
|
2973 |
then obtain l r where lr:"l\<in>s 0" "subseq r" "((x \<circ> r) ---> l) sequentially"
|
|
2974 |
unfolding compact_def apply(erule_tac x=x in allE) using x using assms(3) by blast
|
|
2975 |
|
|
2976 |
{ fix n::nat
|
|
2977 |
{ fix e::real assume "e>0"
|
|
2978 |
with lr(3) obtain N where N:"\<forall>m\<ge>N. dist ((x \<circ> r) m) l < e" unfolding Lim_sequentially by auto
|
|
2979 |
hence "dist ((x \<circ> r) (max N n)) l < e" by auto
|
|
2980 |
moreover
|
|
2981 |
have "r (max N n) \<ge> n" using lr(2) using subseq_bigger[of r "max N n"] by auto
|
|
2982 |
hence "(x \<circ> r) (max N n) \<in> s n"
|
|
2983 |
using x apply(erule_tac x=n in allE)
|
|
2984 |
using x apply(erule_tac x="r (max N n)" in allE)
|
|
2985 |
using assms(3) apply(erule_tac x=n in allE)apply( erule_tac x="r (max N n)" in allE) by auto
|
|
2986 |
ultimately have "\<exists>y\<in>s n. dist y l < e" by auto
|
|
2987 |
}
|
|
2988 |
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by blast
|
|
2989 |
}
|
|
2990 |
thus ?thesis by auto
|
|
2991 |
qed
|
|
2992 |
|
|
2993 |
text{* Decreasing case does not even need compactness, just completeness. *}
|
|
2994 |
|
|
2995 |
lemma decreasing_closed_nest:
|
|
2996 |
assumes "\<forall>n. closed(s n)"
|
|
2997 |
"\<forall>n. (s n \<noteq> {})"
|
|
2998 |
"\<forall>m n. m \<le> n --> s n \<subseteq> s m"
|
|
2999 |
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y \<in> (s n). dist x y < e"
|
|
3000 |
shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s n"
|
|
3001 |
proof-
|
|
3002 |
have "\<forall>n. \<exists> x. x\<in>s n" using assms(2) by auto
|
|
3003 |
hence "\<exists>t. \<forall>n. t n \<in> s n" using choice[of "\<lambda> n x. x \<in> s n"] by auto
|
|
3004 |
then obtain t where t: "\<forall>n. t n \<in> s n" by auto
|
|
3005 |
{ fix e::real assume "e>0"
|
|
3006 |
then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" using assms(4) by auto
|
|
3007 |
{ fix m n ::nat assume "N \<le> m \<and> N \<le> n"
|
|
3008 |
hence "t m \<in> s N" "t n \<in> s N" using assms(3) t unfolding subset_eq t by blast+
|
|
3009 |
hence "dist (t m) (t n) < e" using N by auto
|
|
3010 |
}
|
|
3011 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" by auto
|
|
3012 |
}
|
|
3013 |
hence "Cauchy t" unfolding cauchy_def by auto
|
|
3014 |
then obtain l where l:"(t ---> l) sequentially" using complete_univ unfolding complete_def by auto
|
|
3015 |
{ fix n::nat
|
|
3016 |
{ fix e::real assume "e>0"
|
|
3017 |
then obtain N::nat where N:"\<forall>n\<ge>N. dist (t n) l < e" using l[unfolded Lim_sequentially] by auto
|
|
3018 |
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
|
|
3019 |
hence "\<exists>y\<in>s n. dist y l < e" apply(rule_tac x="t (max n N)" in bexI) using N by auto
|
|
3020 |
}
|
|
3021 |
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by auto
|
|
3022 |
}
|
|
3023 |
then show ?thesis by auto
|
|
3024 |
qed
|
|
3025 |
|
|
3026 |
text{* Strengthen it to the intersection actually being a singleton. *}
|
|
3027 |
|
|
3028 |
lemma decreasing_closed_nest_sing:
|
|
3029 |
assumes "\<forall>n. closed(s n)"
|
|
3030 |
"\<forall>n. s n \<noteq> {}"
|
|
3031 |
"\<forall>m n. m \<le> n --> s n \<subseteq> s m"
|
|
3032 |
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e"
|
|
3033 |
shows "\<exists>a::'a::heine_borel. \<Inter> {t. (\<exists>n::nat. t = s n)} = {a}"
|
|
3034 |
proof-
|
|
3035 |
obtain a where a:"\<forall>n. a \<in> s n" using decreasing_closed_nest[of s] using assms by auto
|
|
3036 |
{ fix b assume b:"b \<in> \<Inter>{t. \<exists>n. t = s n}"
|
|
3037 |
{ fix e::real assume "e>0"
|
|
3038 |
hence "dist a b < e" using assms(4 )using b using a by blast
|
|
3039 |
}
|
|
3040 |
hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz real_less_def)
|
|
3041 |
}
|
|
3042 |
with a have "\<Inter>{t. \<exists>n. t = s n} = {a}" by auto
|
|
3043 |
thus ?thesis by auto
|
|
3044 |
qed
|
|
3045 |
|
|
3046 |
text{* Cauchy-type criteria for uniform convergence. *}
|
|
3047 |
|
|
3048 |
lemma uniformly_convergent_eq_cauchy: fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::heine_borel" shows
|
|
3049 |
"(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e) \<longleftrightarrow>
|
|
3050 |
(\<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")
|
|
3051 |
proof(rule)
|
|
3052 |
assume ?lhs
|
|
3053 |
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
|
|
3054 |
{ fix e::real assume "e>0"
|
|
3055 |
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
|
|
3056 |
{ fix n m::nat and x::"'b" assume "N \<le> m \<and> N \<le> n \<and> P x"
|
|
3057 |
hence "dist (s m x) (s n x) < e"
|
|
3058 |
using N[THEN spec[where x=m], THEN spec[where x=x]]
|
|
3059 |
using N[THEN spec[where x=n], THEN spec[where x=x]]
|
|
3060 |
using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto }
|
|
3061 |
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 }
|
|
3062 |
thus ?rhs by auto
|
|
3063 |
next
|
|
3064 |
assume ?rhs
|
|
3065 |
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
|
|
3066 |
then obtain l where l:"\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" unfolding convergent_eq_cauchy[THEN sym]
|
|
3067 |
using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] by auto
|
|
3068 |
{ fix e::real assume "e>0"
|
|
3069 |
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"
|
|
3070 |
using `?rhs`[THEN spec[where x="e/2"]] by auto
|
|
3071 |
{ fix x assume "P x"
|
|
3072 |
then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2"
|
|
3073 |
using l[THEN spec[where x=x], unfolded Lim_sequentially] using `e>0` by(auto elim!: allE[where x="e/2"])
|
|
3074 |
fix n::nat assume "n\<ge>N"
|
|
3075 |
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]]
|
|
3076 |
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) }
|
|
3077 |
hence "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" by auto }
|
|
3078 |
thus ?lhs by auto
|
|
3079 |
qed
|
|
3080 |
|
|
3081 |
lemma uniformly_cauchy_imp_uniformly_convergent:
|
|
3082 |
fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::heine_borel"
|
|
3083 |
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"
|
|
3084 |
"\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n --> dist(s n x)(l x) < e)"
|
|
3085 |
shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e"
|
|
3086 |
proof-
|
|
3087 |
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"
|
|
3088 |
using assms(1) unfolding uniformly_convergent_eq_cauchy[THEN sym] by auto
|
|
3089 |
moreover
|
|
3090 |
{ fix x assume "P x"
|
|
3091 |
hence "l x = l' x" using Lim_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"]
|
|
3092 |
using l and assms(2) unfolding Lim_sequentially by blast }
|
|
3093 |
ultimately show ?thesis by auto
|
|
3094 |
qed
|
|
3095 |
|
|
3096 |
subsection{* Define continuity over a net to take in restrictions of the set. *}
|
|
3097 |
|
|
3098 |
definition
|
|
3099 |
continuous :: "'a::t2_space net \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool" where
|
|
3100 |
"continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net"
|
|
3101 |
|
|
3102 |
lemma continuous_trivial_limit:
|
|
3103 |
"trivial_limit net ==> continuous net f"
|
|
3104 |
unfolding continuous_def tendsto_def trivial_limit_eq by auto
|
|
3105 |
|
|
3106 |
lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f ---> f(x)) (at x within s)"
|
|
3107 |
unfolding continuous_def
|
|
3108 |
unfolding tendsto_def
|
|
3109 |
using netlimit_within[of x s]
|
|
3110 |
by (cases "trivial_limit (at x within s)") (auto simp add: trivial_limit_eventually)
|
|
3111 |
|
|
3112 |
lemma continuous_at: "continuous (at x) f \<longleftrightarrow> (f ---> f(x)) (at x)"
|
|
3113 |
using continuous_within [of x UNIV f] by (simp add: within_UNIV)
|
|
3114 |
|
|
3115 |
lemma continuous_at_within:
|
|
3116 |
assumes "continuous (at x) f" shows "continuous (at x within s) f"
|
|
3117 |
using assms unfolding continuous_at continuous_within
|
|
3118 |
by (rule Lim_at_within)
|
|
3119 |
|
|
3120 |
text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
|
|
3121 |
|
|
3122 |
lemma continuous_within_eps_delta:
|
|
3123 |
"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)"
|
|
3124 |
unfolding continuous_within and Lim_within
|
|
3125 |
apply auto unfolding dist_nz[THEN sym] apply(auto elim!:allE) apply(rule_tac x=d in exI) by auto
|
|
3126 |
|
|
3127 |
lemma continuous_at_eps_delta: "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.
|
|
3128 |
\<forall>x'. dist x' x < d --> dist(f x')(f x) < e)"
|
|
3129 |
using continuous_within_eps_delta[of x UNIV f]
|
|
3130 |
unfolding within_UNIV by blast
|
|
3131 |
|
|
3132 |
text{* Versions in terms of open balls. *}
|
|
3133 |
|
|
3134 |
lemma continuous_within_ball:
|
|
3135 |
"continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.
|
|
3136 |
f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
|
|
3137 |
proof
|
|
3138 |
assume ?lhs
|
|
3139 |
{ fix e::real assume "e>0"
|
|
3140 |
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"
|
|
3141 |
using `?lhs`[unfolded continuous_within Lim_within] by auto
|
|
3142 |
{ fix y assume "y\<in>f ` (ball x d \<inter> s)"
|
|
3143 |
hence "y \<in> ball (f x) e" using d(2) unfolding dist_nz[THEN sym]
|
|
3144 |
apply (auto simp add: dist_commute mem_ball) apply(erule_tac x=xa in ballE) apply auto using `e>0` by auto
|
|
3145 |
}
|
|
3146 |
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) }
|
|
3147 |
thus ?rhs by auto
|
|
3148 |
next
|
|
3149 |
assume ?rhs thus ?lhs unfolding continuous_within Lim_within ball_def subset_eq
|
|
3150 |
apply (auto simp add: dist_commute) apply(erule_tac x=e in allE) by auto
|
|
3151 |
qed
|
|
3152 |
|
|
3153 |
lemma continuous_at_ball:
|
|
3154 |
"continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
|
|
3155 |
proof
|
|
3156 |
assume ?lhs thus ?rhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
|
|
3157 |
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)
|
|
3158 |
unfolding dist_nz[THEN sym] by auto
|
|
3159 |
next
|
|
3160 |
assume ?rhs thus ?lhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
|
|
3161 |
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)
|
|
3162 |
qed
|
|
3163 |
|
|
3164 |
text{* For setwise continuity, just start from the epsilon-delta definitions. *}
|
|
3165 |
|
|
3166 |
definition
|
|
3167 |
continuous_on :: "'a::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> bool" where
|
|
3168 |
"continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d::real>0. \<forall>x' \<in> s. dist x' x < d --> dist (f x') (f x) < e)"
|
|
3169 |
|
|
3170 |
|
|
3171 |
definition
|
|
3172 |
uniformly_continuous_on ::
|
|
3173 |
"'a::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> bool" where
|
|
3174 |
"uniformly_continuous_on s f \<longleftrightarrow>
|
|
3175 |
(\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall> x'\<in>s. dist x' x < d
|
|
3176 |
--> dist (f x') (f x) < e)"
|
|
3177 |
|
|
3178 |
text{* Some simple consequential lemmas. *}
|
|
3179 |
|
|
3180 |
lemma uniformly_continuous_imp_continuous:
|
|
3181 |
" uniformly_continuous_on s f ==> continuous_on s f"
|
|
3182 |
unfolding uniformly_continuous_on_def continuous_on_def by blast
|
|
3183 |
|
|
3184 |
lemma continuous_at_imp_continuous_within:
|
|
3185 |
"continuous (at x) f ==> continuous (at x within s) f"
|
|
3186 |
unfolding continuous_within continuous_at using Lim_at_within by auto
|
|
3187 |
|
|
3188 |
lemma continuous_at_imp_continuous_on: assumes "(\<forall>x \<in> s. continuous (at x) f)"
|
|
3189 |
shows "continuous_on s f"
|
|
3190 |
proof(simp add: continuous_at continuous_on_def, rule, rule, rule)
|
|
3191 |
fix x and e::real assume "x\<in>s" "e>0"
|
|
3192 |
hence "eventually (\<lambda>xa. dist (f xa) (f x) < e) (at x)" using assms unfolding continuous_at tendsto_iff by auto
|
|
3193 |
then obtain d where d:"d>0" "\<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" unfolding eventually_at by auto
|
|
3194 |
{ fix x' assume "\<not> 0 < dist x' x"
|
|
3195 |
hence "x=x'"
|
|
3196 |
using dist_nz[of x' x] by auto
|
|
3197 |
hence "dist (f x') (f x) < e" using `e>0` by auto
|
|
3198 |
}
|
|
3199 |
thus "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using d by auto
|
|
3200 |
qed
|
|
3201 |
|
|
3202 |
lemma continuous_on_eq_continuous_within:
|
|
3203 |
"continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x within s) f)" (is "?lhs = ?rhs")
|
|
3204 |
proof
|
|
3205 |
assume ?rhs
|
|
3206 |
{ fix x assume "x\<in>s"
|
|
3207 |
fix e::real assume "e>0"
|
|
3208 |
assume "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e"
|
|
3209 |
then 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) < e" by auto
|
|
3210 |
{ fix x' assume as:"x'\<in>s" "dist x' x < d"
|
|
3211 |
hence "dist (f x') (f x) < e" using `e>0` d `x'\<in>s` dist_eq_0_iff[of x' x] zero_le_dist[of x' x] as(2) by (metis dist_eq_0_iff dist_nz) }
|
|
3212 |
hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using `d>0` by auto
|
|
3213 |
}
|
|
3214 |
thus ?lhs using `?rhs` unfolding continuous_on_def continuous_within Lim_within by auto
|
|
3215 |
next
|
|
3216 |
assume ?lhs
|
|
3217 |
thus ?rhs unfolding continuous_on_def continuous_within Lim_within by blast
|
|
3218 |
qed
|
|
3219 |
|
|
3220 |
lemma continuous_on:
|
|
3221 |
"continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. (f ---> f(x)) (at x within s))"
|
|
3222 |
by (auto simp add: continuous_on_eq_continuous_within continuous_within)
|
|
3223 |
|
|
3224 |
lemma continuous_on_eq_continuous_at:
|
|
3225 |
"open s ==> (continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x) f))"
|
|
3226 |
by (auto simp add: continuous_on continuous_at Lim_within_open)
|
|
3227 |
|
|
3228 |
lemma continuous_within_subset:
|
|
3229 |
"continuous (at x within s) f \<Longrightarrow> t \<subseteq> s
|
|
3230 |
==> continuous (at x within t) f"
|
|
3231 |
unfolding continuous_within by(metis Lim_within_subset)
|
|
3232 |
|
|
3233 |
lemma continuous_on_subset:
|
|
3234 |
"continuous_on s f \<Longrightarrow> t \<subseteq> s ==> continuous_on t f"
|
|
3235 |
unfolding continuous_on by (metis subset_eq Lim_within_subset)
|
|
3236 |
|
|
3237 |
lemma continuous_on_interior:
|
|
3238 |
"continuous_on s f \<Longrightarrow> x \<in> interior s ==> continuous (at x) f"
|
|
3239 |
unfolding interior_def
|
|
3240 |
apply simp
|
|
3241 |
by (meson continuous_on_eq_continuous_at continuous_on_subset)
|
|
3242 |
|
|
3243 |
lemma continuous_on_eq:
|
|
3244 |
"(\<forall>x \<in> s. f x = g x) \<Longrightarrow> continuous_on s f
|
|
3245 |
==> continuous_on s g"
|
|
3246 |
by (simp add: continuous_on_def)
|
|
3247 |
|
|
3248 |
text{* Characterization of various kinds of continuity in terms of sequences. *}
|
|
3249 |
|
|
3250 |
(* \<longrightarrow> could be generalized, but \<longleftarrow> requires metric space *)
|
|
3251 |
lemma continuous_within_sequentially:
|
|
3252 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space"
|
|
3253 |
shows "continuous (at a within s) f \<longleftrightarrow>
|
|
3254 |
(\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially
|
|
3255 |
--> ((f o x) ---> f a) sequentially)" (is "?lhs = ?rhs")
|
|
3256 |
proof
|
|
3257 |
assume ?lhs
|
|
3258 |
{ fix x::"nat \<Rightarrow> 'a" assume x:"\<forall>n. x n \<in> s" "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (x n) a < e"
|
|
3259 |
fix e::real assume "e>0"
|
|
3260 |
from `?lhs` obtain d where "d>0" and d:"\<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) (f a) < e" unfolding continuous_within Lim_within using `e>0` by auto
|
|
3261 |
from x(2) `d>0` obtain N where N:"\<forall>n\<ge>N. dist (x n) a < d" by auto
|
|
3262 |
hence "\<exists>N. \<forall>n\<ge>N. dist ((f \<circ> x) n) (f a) < e"
|
|
3263 |
apply(rule_tac x=N in exI) using N d apply auto using x(1)
|
|
3264 |
apply(erule_tac x=n in allE) apply(erule_tac x=n in allE)
|
|
3265 |
apply(erule_tac x="x n" in ballE) apply auto unfolding dist_nz[THEN sym] apply auto using `e>0` by auto
|
|
3266 |
}
|
|
3267 |
thus ?rhs unfolding continuous_within unfolding Lim_sequentially by simp
|
|
3268 |
next
|
|
3269 |
assume ?rhs
|
|
3270 |
{ fix e::real assume "e>0"
|
|
3271 |
assume "\<not> (\<exists>d>0. \<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) (f a) < e)"
|
|
3272 |
hence "\<forall>d. \<exists>x. d>0 \<longrightarrow> x\<in>s \<and> (0 < dist x a \<and> dist x a < d \<and> \<not> dist (f x) (f a) < e)" by blast
|
|
3273 |
then obtain x where x:"\<forall>d>0. x d \<in> s \<and> (0 < dist (x d) a \<and> dist (x d) a < d \<and> \<not> dist (f (x d)) (f a) < e)"
|
|
3274 |
using choice[of "\<lambda>d x.0<d \<longrightarrow> x\<in>s \<and> (0 < dist x a \<and> dist x a < d \<and> \<not> dist (f x) (f a) < e)"] by auto
|
|
3275 |
{ fix d::real assume "d>0"
|
|
3276 |
hence "\<exists>N::nat. inverse (real (N + 1)) < d" using real_arch_inv[of d] by (auto, rule_tac x="n - 1" in exI)auto
|
|
3277 |
then obtain N::nat where N:"inverse (real (N + 1)) < d" by auto
|
|
3278 |
{ fix n::nat assume n:"n\<ge>N"
|
|
3279 |
hence "dist (x (inverse (real (n + 1)))) a < inverse (real (n + 1))" using x[THEN spec[where x="inverse (real (n + 1))"]] by auto
|
|
3280 |
moreover have "inverse (real (n + 1)) < d" using N n 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)
|
|
3281 |
ultimately have "dist (x (inverse (real (n + 1)))) a < d" by auto
|
|
3282 |
}
|
|
3283 |
hence "\<exists>N::nat. \<forall>n\<ge>N. dist (x (inverse (real (n + 1)))) a < d" by auto
|
|
3284 |
}
|
|
3285 |
hence "(\<forall>n::nat. x (inverse (real (n + 1))) \<in> s) \<and> (\<forall>e>0. \<exists>N::nat. \<forall>n\<ge>N. dist (x (inverse (real (n + 1)))) a < e)" using x by auto
|
|
3286 |
hence "\<forall>e>0. \<exists>N::nat. \<forall>n\<ge>N. dist (f (x (inverse (real (n + 1))))) (f a) < e" using `?rhs`[THEN spec[where x="\<lambda>n::nat. x (inverse (real (n+1)))"], unfolded Lim_sequentially] by auto
|
|
3287 |
hence "False" apply(erule_tac x=e in allE) using `e>0` using x by auto
|
|
3288 |
}
|
|
3289 |
thus ?lhs unfolding continuous_within unfolding Lim_within unfolding Lim_sequentially by blast
|
|
3290 |
qed
|
|
3291 |
|
|
3292 |
lemma continuous_at_sequentially:
|
|
3293 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space"
|
|
3294 |
shows "continuous (at a) f \<longleftrightarrow> (\<forall>x. (x ---> a) sequentially
|
|
3295 |
--> ((f o x) ---> f a) sequentially)"
|
|
3296 |
using continuous_within_sequentially[of a UNIV f] unfolding within_UNIV by auto
|
|
3297 |
|
|
3298 |
lemma continuous_on_sequentially:
|
|
3299 |
"continuous_on s f \<longleftrightarrow> (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially
|
|
3300 |
--> ((f o x) ---> f(a)) sequentially)" (is "?lhs = ?rhs")
|
|
3301 |
proof
|
|
3302 |
assume ?rhs thus ?lhs using continuous_within_sequentially[of _ s f] unfolding continuous_on_eq_continuous_within by auto
|
|
3303 |
next
|
|
3304 |
assume ?lhs thus ?rhs unfolding continuous_on_eq_continuous_within using continuous_within_sequentially[of _ s f] by auto
|
|
3305 |
qed
|
|
3306 |
|
|
3307 |
lemma uniformly_continuous_on_sequentially:
|
|
3308 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
|
|
3309 |
shows "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and>
|
|
3310 |
((\<lambda>n. x n - y n) ---> 0) sequentially
|
|
3311 |
\<longrightarrow> ((\<lambda>n. f(x n) - f(y n)) ---> 0) sequentially)" (is "?lhs = ?rhs")
|
|
3312 |
proof
|
|
3313 |
assume ?lhs
|
|
3314 |
{ fix x y assume x:"\<forall>n. x n \<in> s" and y:"\<forall>n. y n \<in> s" and xy:"((\<lambda>n. x n - y n) ---> 0) sequentially"
|
|
3315 |
{ fix e::real assume "e>0"
|
|
3316 |
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"
|
|
3317 |
using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto
|
|
3318 |
obtain N where N:"\<forall>n\<ge>N. norm (x n - y n - 0) < d" using xy[unfolded Lim_sequentially dist_norm] and `d>0` by auto
|
|
3319 |
{ fix n assume "n\<ge>N"
|
|
3320 |
hence "norm (f (x n) - f (y n) - 0) < e"
|
|
3321 |
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
|
|
3322 |
unfolding dist_commute and dist_norm by simp }
|
|
3323 |
hence "\<exists>N. \<forall>n\<ge>N. norm (f (x n) - f (y n) - 0) < e" by auto }
|
|
3324 |
hence "((\<lambda>n. f(x n) - f(y n)) ---> 0) sequentially" unfolding Lim_sequentially and dist_norm by auto }
|
|
3325 |
thus ?rhs by auto
|
|
3326 |
next
|
|
3327 |
assume ?rhs
|
|
3328 |
{ assume "\<not> ?lhs"
|
|
3329 |
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
|
|
3330 |
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"
|
|
3331 |
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
|
|
3332 |
by (auto simp add: dist_commute)
|
|
3333 |
def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))"
|
|
3334 |
def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))"
|
|
3335 |
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"
|
|
3336 |
unfolding x_def and y_def using fa by auto
|
|
3337 |
have 1:"\<And>(x::'a) y. dist (x - y) 0 = dist x y" unfolding dist_norm by auto
|
|
3338 |
have 2:"\<And>(x::'b) y. dist (x - y) 0 = dist x y" unfolding dist_norm by auto
|
|
3339 |
{ fix e::real assume "e>0"
|
|
3340 |
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
|
|
3341 |
{ fix n::nat assume "n\<ge>N"
|
|
3342 |
hence "inverse (real n + 1) < inverse (real N)" using real_of_nat_ge_zero and `N\<noteq>0` by auto
|
|
3343 |
also have "\<dots> < e" using N by auto
|
|
3344 |
finally have "inverse (real n + 1) < e" by auto
|
|
3345 |
hence "dist (x n - y n) 0 < e" unfolding 1 using xy0[THEN spec[where x=n]] by auto }
|
|
3346 |
hence "\<exists>N. \<forall>n\<ge>N. dist (x n - y n) 0 < e" by auto }
|
|
3347 |
hence "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n) - f (y n)) 0 < e" using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn unfolding Lim_sequentially by auto
|
|
3348 |
hence False unfolding 2 using fxy and `e>0` by auto }
|
|
3349 |
thus ?lhs unfolding uniformly_continuous_on_def by blast
|
|
3350 |
qed
|
|
3351 |
|
|
3352 |
text{* The usual transformation theorems. *}
|
|
3353 |
|
|
3354 |
lemma continuous_transform_within:
|
|
3355 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
|
|
3356 |
assumes "0 < d" "x \<in> s" "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'"
|
|
3357 |
"continuous (at x within s) f"
|
|
3358 |
shows "continuous (at x within s) g"
|
|
3359 |
proof-
|
|
3360 |
{ fix e::real assume "e>0"
|
|
3361 |
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" using assms(4) unfolding continuous_within Lim_within by auto
|
|
3362 |
{ fix x' assume "x'\<in>s" "0 < dist x' x" "dist x' x < (min d d')"
|
|
3363 |
hence "dist (f x') (g x) < e" using assms(2,3) apply(erule_tac x=x in ballE) using d' by auto }
|
|
3364 |
hence "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < (min d d') \<longrightarrow> dist (f xa) (g x) < e" by blast
|
|
3365 |
hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (g x) < e" using `d>0` `d'>0` by(rule_tac x="min d d'" in exI)auto }
|
|
3366 |
hence "(f ---> g x) (at x within s)" unfolding Lim_within using assms(1) by auto
|
|
3367 |
thus ?thesis unfolding continuous_within using Lim_transform_within[of d s x f g "g x"] using assms by blast
|
|
3368 |
qed
|
|
3369 |
|
|
3370 |
lemma continuous_transform_at:
|
|
3371 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
|
|
3372 |
assumes "0 < d" "\<forall>x'. dist x' x < d --> f x' = g x'"
|
|
3373 |
"continuous (at x) f"
|
|
3374 |
shows "continuous (at x) g"
|
|
3375 |
proof-
|
|
3376 |
{ fix e::real assume "e>0"
|
|
3377 |
then obtain d' where d':"d'>0" "\<forall>xa. 0 < dist xa x \<and> dist xa x < d' \<longrightarrow> dist (f xa) (f x) < e" using assms(3) unfolding continuous_at Lim_at by auto
|
|
3378 |
{ fix x' assume "0 < dist x' x" "dist x' x < (min d d')"
|
|
3379 |
hence "dist (f x') (g x) < e" using assms(2) apply(erule_tac x=x in allE) using d' by auto
|
|
3380 |
}
|
|
3381 |
hence "\<forall>xa. 0 < dist xa x \<and> dist xa x < (min d d') \<longrightarrow> dist (f xa) (g x) < e" by blast
|
|
3382 |
hence "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (g x) < e" using `d>0` `d'>0` by(rule_tac x="min d d'" in exI)auto
|
|
3383 |
}
|
|
3384 |
hence "(f ---> g x) (at x)" unfolding Lim_at using assms(1) by auto
|
|
3385 |
thus ?thesis unfolding continuous_at using Lim_transform_at[of d x f g "g x"] using assms by blast
|
|
3386 |
qed
|
|
3387 |
|
|
3388 |
text{* Combination results for pointwise continuity. *}
|
|
3389 |
|
|
3390 |
lemma continuous_const: "continuous net (\<lambda>x. c)"
|
|
3391 |
by (auto simp add: continuous_def Lim_const)
|
|
3392 |
|
|
3393 |
lemma continuous_cmul:
|
|
3394 |
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
|
|
3395 |
shows "continuous net f ==> continuous net (\<lambda>x. c *\<^sub>R f x)"
|
|
3396 |
by (auto simp add: continuous_def Lim_cmul)
|
|
3397 |
|
|
3398 |
lemma continuous_neg:
|
|
3399 |
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
|
|
3400 |
shows "continuous net f ==> continuous net (\<lambda>x. -(f x))"
|
|
3401 |
by (auto simp add: continuous_def Lim_neg)
|
|
3402 |
|
|
3403 |
lemma continuous_add:
|
|
3404 |
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
|
|
3405 |
shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x + g x)"
|
|
3406 |
by (auto simp add: continuous_def Lim_add)
|
|
3407 |
|
|
3408 |
lemma continuous_sub:
|
|
3409 |
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
|
|
3410 |
shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x - g x)"
|
|
3411 |
by (auto simp add: continuous_def Lim_sub)
|
|
3412 |
|
|
3413 |
text{* Same thing for setwise continuity. *}
|
|
3414 |
|
|
3415 |
lemma continuous_on_const:
|
|
3416 |
"continuous_on s (\<lambda>x. c)"
|
|
3417 |
unfolding continuous_on_eq_continuous_within using continuous_const by blast
|
|
3418 |
|
|
3419 |
lemma continuous_on_cmul:
|
|
3420 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3421 |
shows "continuous_on s f ==> continuous_on s (\<lambda>x. c *\<^sub>R (f x))"
|
|
3422 |
unfolding continuous_on_eq_continuous_within using continuous_cmul by blast
|
|
3423 |
|
|
3424 |
lemma continuous_on_neg:
|
|
3425 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3426 |
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)"
|
|
3427 |
unfolding continuous_on_eq_continuous_within using continuous_neg by blast
|
|
3428 |
|
|
3429 |
lemma continuous_on_add:
|
|
3430 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3431 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g
|
|
3432 |
\<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)"
|
|
3433 |
unfolding continuous_on_eq_continuous_within using continuous_add by blast
|
|
3434 |
|
|
3435 |
lemma continuous_on_sub:
|
|
3436 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3437 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g
|
|
3438 |
\<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"
|
|
3439 |
unfolding continuous_on_eq_continuous_within using continuous_sub by blast
|
|
3440 |
|
|
3441 |
text{* Same thing for uniform continuity, using sequential formulations. *}
|
|
3442 |
|
|
3443 |
lemma uniformly_continuous_on_const:
|
|
3444 |
"uniformly_continuous_on s (\<lambda>x. c)"
|
|
3445 |
unfolding uniformly_continuous_on_def by simp
|
|
3446 |
|
|
3447 |
lemma uniformly_continuous_on_cmul:
|
|
3448 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
|
|
3449 |
(* FIXME: generalize 'a to metric_space *)
|
|
3450 |
assumes "uniformly_continuous_on s f"
|
|
3451 |
shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))"
|
|
3452 |
proof-
|
|
3453 |
{ fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially"
|
|
3454 |
hence "((\<lambda>n. c *\<^sub>R f (x n) - c *\<^sub>R f (y n)) ---> 0) sequentially"
|
|
3455 |
using Lim_cmul[of "(\<lambda>n. f (x n) - f (y n))" 0 sequentially c]
|
|
3456 |
unfolding scaleR_zero_right scaleR_right_diff_distrib by auto
|
|
3457 |
}
|
|
3458 |
thus ?thesis using assms unfolding uniformly_continuous_on_sequentially by auto
|
|
3459 |
qed
|
|
3460 |
|
|
3461 |
lemma dist_minus:
|
|
3462 |
fixes x y :: "'a::real_normed_vector"
|
|
3463 |
shows "dist (- x) (- y) = dist x y"
|
|
3464 |
unfolding dist_norm minus_diff_minus norm_minus_cancel ..
|
|
3465 |
|
|
3466 |
lemma uniformly_continuous_on_neg:
|
|
3467 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3468 |
shows "uniformly_continuous_on s f
|
|
3469 |
==> uniformly_continuous_on s (\<lambda>x. -(f x))"
|
|
3470 |
unfolding uniformly_continuous_on_def dist_minus .
|
|
3471 |
|
|
3472 |
lemma uniformly_continuous_on_add:
|
|
3473 |
fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" (* FIXME: generalize 'a *)
|
|
3474 |
assumes "uniformly_continuous_on s f" "uniformly_continuous_on s g"
|
|
3475 |
shows "uniformly_continuous_on s (\<lambda>x. f x + g x)"
|
|
3476 |
proof-
|
|
3477 |
{ fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially"
|
|
3478 |
"((\<lambda>n. g (x n) - g (y n)) ---> 0) sequentially"
|
|
3479 |
hence "((\<lambda>xa. f (x xa) - f (y xa) + (g (x xa) - g (y xa))) ---> 0 + 0) sequentially"
|
|
3480 |
using Lim_add[of "\<lambda> n. f (x n) - f (y n)" 0 sequentially "\<lambda> n. g (x n) - g (y n)" 0] by auto
|
|
3481 |
hence "((\<lambda>n. f (x n) + g (x n) - (f (y n) + g (y n))) ---> 0) sequentially" unfolding Lim_sequentially and add_diff_add [symmetric] by auto }
|
|
3482 |
thus ?thesis using assms unfolding uniformly_continuous_on_sequentially by auto
|
|
3483 |
qed
|
|
3484 |
|
|
3485 |
lemma uniformly_continuous_on_sub:
|
|
3486 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" (* FIXME: generalize 'a *)
|
|
3487 |
shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s g
|
|
3488 |
==> uniformly_continuous_on s (\<lambda>x. f x - g x)"
|
|
3489 |
unfolding ab_diff_minus
|
|
3490 |
using uniformly_continuous_on_add[of s f "\<lambda>x. - g x"]
|
|
3491 |
using uniformly_continuous_on_neg[of s g] by auto
|
|
3492 |
|
|
3493 |
text{* Identity function is continuous in every sense. *}
|
|
3494 |
|
|
3495 |
lemma continuous_within_id:
|
|
3496 |
"continuous (at a within s) (\<lambda>x. x)"
|
|
3497 |
unfolding continuous_within by (rule Lim_at_within [OF Lim_ident_at])
|
|
3498 |
|
|
3499 |
lemma continuous_at_id:
|
|
3500 |
"continuous (at a) (\<lambda>x. x)"
|
|
3501 |
unfolding continuous_at by (rule Lim_ident_at)
|
|
3502 |
|
|
3503 |
lemma continuous_on_id:
|
|
3504 |
"continuous_on s (\<lambda>x. x)"
|
|
3505 |
unfolding continuous_on Lim_within by auto
|
|
3506 |
|
|
3507 |
lemma uniformly_continuous_on_id:
|
|
3508 |
"uniformly_continuous_on s (\<lambda>x. x)"
|
|
3509 |
unfolding uniformly_continuous_on_def by auto
|
|
3510 |
|
|
3511 |
text{* Continuity of all kinds is preserved under composition. *}
|
|
3512 |
|
|
3513 |
lemma continuous_within_compose:
|
|
3514 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3515 |
fixes g :: "'b::metric_space \<Rightarrow> 'c::metric_space"
|
|
3516 |
assumes "continuous (at x within s) f" "continuous (at (f x) within f ` s) g"
|
|
3517 |
shows "continuous (at x within s) (g o f)"
|
|
3518 |
proof-
|
|
3519 |
{ fix e::real assume "e>0"
|
|
3520 |
with assms(2)[unfolded continuous_within Lim_within] obtain d where "d>0" and d:"\<forall>xa\<in>f ` s. 0 < dist xa (f x) \<and> dist xa (f x) < d \<longrightarrow> dist (g xa) (g (f x)) < e" by auto
|
|
3521 |
from assms(1)[unfolded continuous_within Lim_within] 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) < d" using `d>0` by auto
|
|
3522 |
{ fix y assume as:"y\<in>s" "0 < dist y x" "dist y x < d'"
|
|
3523 |
hence "dist (f y) (f x) < d" using d'[THEN bspec[where x=y]] by (auto simp add:dist_commute)
|
|
3524 |
hence "dist (g (f y)) (g (f x)) < e" using as(1) d[THEN bspec[where x="f y"]] unfolding dist_nz[THEN sym] using `e>0` by auto }
|
|
3525 |
hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (g (f xa)) (g (f x)) < e" using `d'>0` by auto }
|
|
3526 |
thus ?thesis unfolding continuous_within Lim_within by auto
|
|
3527 |
qed
|
|
3528 |
|
|
3529 |
lemma continuous_at_compose:
|
|
3530 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3531 |
fixes g :: "'b::metric_space \<Rightarrow> 'c::metric_space"
|
|
3532 |
assumes "continuous (at x) f" "continuous (at (f x)) g"
|
|
3533 |
shows "continuous (at x) (g o f)"
|
|
3534 |
proof-
|
|
3535 |
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
|
|
3536 |
thus ?thesis using assms(1) using continuous_within_compose[of x UNIV f g, unfolded within_UNIV] by auto
|
|
3537 |
qed
|
|
3538 |
|
|
3539 |
lemma continuous_on_compose:
|
|
3540 |
"continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g o f)"
|
|
3541 |
unfolding continuous_on_eq_continuous_within using continuous_within_compose[of _ s f g] by auto
|
|
3542 |
|
|
3543 |
lemma uniformly_continuous_on_compose:
|
|
3544 |
assumes "uniformly_continuous_on s f" "uniformly_continuous_on (f ` s) g"
|
|
3545 |
shows "uniformly_continuous_on s (g o f)"
|
|
3546 |
proof-
|
|
3547 |
{ fix e::real assume "e>0"
|
|
3548 |
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
|
|
3549 |
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
|
|
3550 |
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 }
|
|
3551 |
thus ?thesis using assms unfolding uniformly_continuous_on_def by auto
|
|
3552 |
qed
|
|
3553 |
|
|
3554 |
text{* Continuity in terms of open preimages. *}
|
|
3555 |
|
|
3556 |
lemma continuous_at_open:
|
|
3557 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3558 |
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)))" (is "?lhs = ?rhs")
|
|
3559 |
proof
|
|
3560 |
assume ?lhs
|
|
3561 |
{ fix t assume as: "open t" "f x \<in> t"
|
|
3562 |
then obtain e where "e>0" and e:"ball (f x) e \<subseteq> t" unfolding open_contains_ball by auto
|
|
3563 |
|
|
3564 |
obtain d where "d>0" and d:"\<forall>y. 0 < dist y x \<and> dist y x < d \<longrightarrow> dist (f y) (f x) < e" using `e>0` using `?lhs`[unfolded continuous_at Lim_at open_dist] by auto
|
|
3565 |
|
|
3566 |
have "open (ball x d)" using open_ball by auto
|
|
3567 |
moreover have "x \<in> ball x d" unfolding centre_in_ball using `d>0` by simp
|
|
3568 |
moreover
|
|
3569 |
{ fix x' assume "x'\<in>ball x d" hence "f x' \<in> t"
|
|
3570 |
using e[unfolded subset_eq Ball_def mem_ball, THEN spec[where x="f x'"]] d[THEN spec[where x=x']]
|
|
3571 |
unfolding mem_ball apply (auto simp add: dist_commute)
|
|
3572 |
unfolding dist_nz[THEN sym] using as(2) by auto }
|
|
3573 |
hence "\<forall>x'\<in>ball x d. f x' \<in> t" by auto
|
|
3574 |
ultimately have "\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x'\<in>s. f x' \<in> t)"
|
|
3575 |
apply(rule_tac x="ball x d" in exI) by simp }
|
|
3576 |
thus ?rhs by auto
|
|
3577 |
next
|
|
3578 |
assume ?rhs
|
|
3579 |
{ fix e::real assume "e>0"
|
|
3580 |
then obtain s where s: "open s" "x \<in> s" "\<forall>x'\<in>s. f x' \<in> ball (f x) e" using `?rhs`[unfolded continuous_at Lim_at, THEN spec[where x="ball (f x) e"]]
|
|
3581 |
unfolding centre_in_ball[of "f x" e, THEN sym] by auto
|
|
3582 |
then obtain d where "d>0" and d:"ball x d \<subseteq> s" unfolding open_contains_ball by auto
|
|
3583 |
{ fix y assume "0 < dist y x \<and> dist y x < d"
|
|
3584 |
hence "dist (f y) (f x) < e" using d[unfolded subset_eq Ball_def mem_ball, THEN spec[where x=y]]
|
|
3585 |
using s(3)[THEN bspec[where x=y], unfolded mem_ball] by (auto simp add: dist_commute) }
|
|
3586 |
hence "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" using `d>0` by auto }
|
|
3587 |
thus ?lhs unfolding continuous_at Lim_at by auto
|
|
3588 |
qed
|
|
3589 |
|
|
3590 |
lemma continuous_on_open:
|
|
3591 |
"continuous_on s f \<longleftrightarrow>
|
|
3592 |
(\<forall>t. openin (subtopology euclidean (f ` s)) t
|
|
3593 |
--> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
|
|
3594 |
proof
|
|
3595 |
assume ?lhs
|
|
3596 |
{ fix t assume as:"openin (subtopology euclidean (f ` s)) t"
|
|
3597 |
have "{x \<in> s. f x \<in> t} \<subseteq> s" using as[unfolded openin_euclidean_subtopology_iff] by auto
|
|
3598 |
moreover
|
|
3599 |
{ fix x assume as':"x\<in>{x \<in> s. f x \<in> t}"
|
|
3600 |
then obtain e where e: "e>0" "\<forall>x'\<in>f ` s. dist x' (f x) < e \<longrightarrow> x' \<in> t" using as[unfolded openin_euclidean_subtopology_iff, THEN conjunct2, THEN bspec[where x="f x"]] by auto
|
|
3601 |
from this(1) 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" using `?lhs`[unfolded continuous_on Lim_within, THEN bspec[where x=x]] using as' by auto
|
|
3602 |
have "\<exists>e>0. \<forall>x'\<in>s. dist x' x < e \<longrightarrow> x' \<in> {x \<in> s. f x \<in> t}" using d e unfolding dist_nz[THEN sym] by (rule_tac x=d in exI, auto) }
|
|
3603 |
ultimately have "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" unfolding openin_euclidean_subtopology_iff by auto }
|
|
3604 |
thus ?rhs unfolding continuous_on Lim_within using openin by auto
|
|
3605 |
next
|
|
3606 |
assume ?rhs
|
|
3607 |
{ fix e::real and x assume "x\<in>s" "e>0"
|
|
3608 |
{ fix xa x' assume "dist (f xa) (f x) < e" "xa \<in> s" "x' \<in> s" "dist (f xa) (f x') < e - dist (f xa) (f x)"
|
|
3609 |
hence "dist (f x') (f x) < e" using dist_triangle[of "f x'" "f x" "f xa"]
|
|
3610 |
by (auto simp add: dist_commute) }
|
|
3611 |
hence "ball (f x) e \<inter> f ` s \<subseteq> f ` s \<and> (\<forall>xa\<in>ball (f x) e \<inter> f ` s. \<exists>ea>0. \<forall>x'\<in>f ` s. dist x' xa < ea \<longrightarrow> x' \<in> ball (f x) e \<inter> f ` s)" apply auto
|
|
3612 |
apply(rule_tac x="e - dist (f xa) (f x)" in exI) using `e>0` by (auto simp add: dist_commute)
|
|
3613 |
hence "\<forall>xa\<in>{xa \<in> s. f xa \<in> ball (f x) e \<inter> f ` s}. \<exists>ea>0. \<forall>x'\<in>s. dist x' xa < ea \<longrightarrow> x' \<in> {xa \<in> s. f xa \<in> ball (f x) e \<inter> f ` s}"
|
|
3614 |
using `?rhs`[unfolded openin_euclidean_subtopology_iff, THEN spec[where x="ball (f x) e \<inter> f ` s"]] by auto
|
|
3615 |
hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" apply(erule_tac x=x in ballE) apply auto using `e>0` `x\<in>s` by (auto simp add: dist_commute) }
|
|
3616 |
thus ?lhs unfolding continuous_on Lim_within by auto
|
|
3617 |
qed
|
|
3618 |
|
|
3619 |
(* ------------------------------------------------------------------------- *)
|
|
3620 |
(* Similarly in terms of closed sets. *)
|
|
3621 |
(* ------------------------------------------------------------------------- *)
|
|
3622 |
|
|
3623 |
lemma continuous_on_closed:
|
|
3624 |
"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")
|
|
3625 |
proof
|
|
3626 |
assume ?lhs
|
|
3627 |
{ fix t
|
|
3628 |
have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
|
|
3629 |
have **:"f ` s - (f ` s - (f ` s - t)) = f ` s - t" by auto
|
|
3630 |
assume as:"closedin (subtopology euclidean (f ` s)) t"
|
|
3631 |
hence "closedin (subtopology euclidean (f ` s)) (f ` s - (f ` s - t))" unfolding closedin_def topspace_euclidean_subtopology unfolding ** by auto
|
|
3632 |
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"]]
|
|
3633 |
unfolding openin_closedin_eq topspace_euclidean_subtopology unfolding * by auto }
|
|
3634 |
thus ?rhs by auto
|
|
3635 |
next
|
|
3636 |
assume ?rhs
|
|
3637 |
{ fix t
|
|
3638 |
have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
|
|
3639 |
assume as:"openin (subtopology euclidean (f ` s)) t"
|
|
3640 |
hence "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?rhs`[THEN spec[where x="(f ` s) - t"]]
|
|
3641 |
unfolding openin_closedin_eq topspace_euclidean_subtopology *[THEN sym] closedin_subtopology by auto }
|
|
3642 |
thus ?lhs unfolding continuous_on_open by auto
|
|
3643 |
qed
|
|
3644 |
|
|
3645 |
text{* Half-global and completely global cases. *}
|
|
3646 |
|
|
3647 |
lemma continuous_open_in_preimage:
|
|
3648 |
assumes "continuous_on s f" "open t"
|
|
3649 |
shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
|
|
3650 |
proof-
|
|
3651 |
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
|
|
3652 |
have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
|
|
3653 |
using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto
|
|
3654 |
thus ?thesis using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] using * by auto
|
|
3655 |
qed
|
|
3656 |
|
|
3657 |
lemma continuous_closed_in_preimage:
|
|
3658 |
assumes "continuous_on s f" "closed t"
|
|
3659 |
shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
|
|
3660 |
proof-
|
|
3661 |
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
|
|
3662 |
have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
|
|
3663 |
using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute by auto
|
|
3664 |
thus ?thesis
|
|
3665 |
using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] using * by auto
|
|
3666 |
qed
|
|
3667 |
|
|
3668 |
lemma continuous_open_preimage:
|
|
3669 |
assumes "continuous_on s f" "open s" "open t"
|
|
3670 |
shows "open {x \<in> s. f x \<in> t}"
|
|
3671 |
proof-
|
|
3672 |
obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
|
|
3673 |
using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto
|
|
3674 |
thus ?thesis using open_Int[of s T, OF assms(2)] by auto
|
|
3675 |
qed
|
|
3676 |
|
|
3677 |
lemma continuous_closed_preimage:
|
|
3678 |
assumes "continuous_on s f" "closed s" "closed t"
|
|
3679 |
shows "closed {x \<in> s. f x \<in> t}"
|
|
3680 |
proof-
|
|
3681 |
obtain T where T: "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
|
|
3682 |
using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto
|
|
3683 |
thus ?thesis using closed_Int[of s T, OF assms(2)] by auto
|
|
3684 |
qed
|
|
3685 |
|
|
3686 |
lemma continuous_open_preimage_univ:
|
|
3687 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3688 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
|
|
3689 |
using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto
|
|
3690 |
|
|
3691 |
lemma continuous_closed_preimage_univ:
|
|
3692 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3693 |
shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}"
|
|
3694 |
using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto
|
|
3695 |
|
|
3696 |
lemma continuous_open_vimage:
|
|
3697 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3698 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)"
|
|
3699 |
unfolding vimage_def by (rule continuous_open_preimage_univ)
|
|
3700 |
|
|
3701 |
lemma continuous_closed_vimage:
|
|
3702 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3703 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)"
|
|
3704 |
unfolding vimage_def by (rule continuous_closed_preimage_univ)
|
|
3705 |
|
|
3706 |
text{* Equality of continuous functions on closure and related results. *}
|
|
3707 |
|
|
3708 |
lemma continuous_closed_in_preimage_constant:
|
|
3709 |
"continuous_on s f ==> closedin (subtopology euclidean s) {x \<in> s. f x = a}"
|
|
3710 |
using continuous_closed_in_preimage[of s f "{a}"] closed_sing by auto
|
|
3711 |
|
|
3712 |
lemma continuous_closed_preimage_constant:
|
|
3713 |
"continuous_on s f \<Longrightarrow> closed s ==> closed {x \<in> s. f x = a}"
|
|
3714 |
using continuous_closed_preimage[of s f "{a}"] closed_sing by auto
|
|
3715 |
|
|
3716 |
lemma continuous_constant_on_closure:
|
|
3717 |
assumes "continuous_on (closure s) f"
|
|
3718 |
"\<forall>x \<in> s. f x = a"
|
|
3719 |
shows "\<forall>x \<in> (closure s). f x = a"
|
|
3720 |
using continuous_closed_preimage_constant[of "closure s" f a]
|
|
3721 |
assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset unfolding subset_eq by auto
|
|
3722 |
|
|
3723 |
lemma image_closure_subset:
|
|
3724 |
assumes "continuous_on (closure s) f" "closed t" "(f ` s) \<subseteq> t"
|
|
3725 |
shows "f ` (closure s) \<subseteq> t"
|
|
3726 |
proof-
|
|
3727 |
have "s \<subseteq> {x \<in> closure s. f x \<in> t}" using assms(3) closure_subset by auto
|
|
3728 |
moreover have "closed {x \<in> closure s. f x \<in> t}"
|
|
3729 |
using continuous_closed_preimage[OF assms(1)] and assms(2) by auto
|
|
3730 |
ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
|
|
3731 |
using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
|
|
3732 |
thus ?thesis by auto
|
|
3733 |
qed
|
|
3734 |
|
|
3735 |
lemma continuous_on_closure_norm_le:
|
|
3736 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
3737 |
assumes "continuous_on (closure s) f" "\<forall>y \<in> s. norm(f y) \<le> b" "x \<in> (closure s)"
|
|
3738 |
shows "norm(f x) \<le> b"
|
|
3739 |
proof-
|
|
3740 |
have *:"f ` s \<subseteq> cball 0 b" using assms(2)[unfolded mem_cball_0[THEN sym]] by auto
|
|
3741 |
show ?thesis
|
|
3742 |
using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3)
|
|
3743 |
unfolding subset_eq apply(erule_tac x="f x" in ballE) by (auto simp add: dist_norm)
|
|
3744 |
qed
|
|
3745 |
|
|
3746 |
text{* Making a continuous function avoid some value in a neighbourhood. *}
|
|
3747 |
|
|
3748 |
lemma continuous_within_avoid:
|
|
3749 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3750 |
assumes "continuous (at x within s) f" "x \<in> s" "f x \<noteq> a"
|
|
3751 |
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a"
|
|
3752 |
proof-
|
|
3753 |
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"
|
|
3754 |
using assms(1)[unfolded continuous_within Lim_within, THEN spec[where x="dist (f x) a"]] assms(3)[unfolded dist_nz] by auto
|
|
3755 |
{ fix y assume " y\<in>s" "dist x y < d"
|
|
3756 |
hence "f y \<noteq> a" using d[THEN bspec[where x=y]] assms(3)[unfolded dist_nz]
|
|
3757 |
apply auto unfolding dist_nz[THEN sym] by (auto simp add: dist_commute) }
|
|
3758 |
thus ?thesis using `d>0` by auto
|
|
3759 |
qed
|
|
3760 |
|
|
3761 |
lemma continuous_at_avoid:
|
|
3762 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
|
|
3763 |
assumes "continuous (at x) f" "f x \<noteq> a"
|
|
3764 |
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
|
|
3765 |
using assms using continuous_within_avoid[of x UNIV f a, unfolded within_UNIV] by auto
|
|
3766 |
|
|
3767 |
lemma continuous_on_avoid:
|
|
3768 |
assumes "continuous_on s f" "x \<in> s" "f x \<noteq> a"
|
|
3769 |
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a"
|
|
3770 |
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
|
|
3771 |
|
|
3772 |
lemma continuous_on_open_avoid:
|
|
3773 |
assumes "continuous_on s f" "open s" "x \<in> s" "f x \<noteq> a"
|
|
3774 |
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
|
|
3775 |
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
|
|
3776 |
|
|
3777 |
text{* Proving a function is constant by proving open-ness of level set. *}
|
|
3778 |
|
|
3779 |
lemma continuous_levelset_open_in_cases:
|
|
3780 |
"connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
|
|
3781 |
openin (subtopology euclidean s) {x \<in> s. f x = a}
|
|
3782 |
==> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)"
|
|
3783 |
unfolding connected_clopen using continuous_closed_in_preimage_constant by auto
|
|
3784 |
|
|
3785 |
lemma continuous_levelset_open_in:
|
|
3786 |
"connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
|
|
3787 |
openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
|
|
3788 |
(\<exists>x \<in> s. f x = a) ==> (\<forall>x \<in> s. f x = a)"
|
|
3789 |
using continuous_levelset_open_in_cases[of s f ]
|
|
3790 |
by meson
|
|
3791 |
|
|
3792 |
lemma continuous_levelset_open:
|
|
3793 |
assumes "connected s" "continuous_on s f" "open {x \<in> s. f x = a}" "\<exists>x \<in> s. f x = a"
|
|
3794 |
shows "\<forall>x \<in> s. f x = a"
|
|
3795 |
using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] using assms (3,4) by auto
|
|
3796 |
|
|
3797 |
text{* Some arithmetical combinations (more to prove). *}
|
|
3798 |
|
|
3799 |
lemma open_scaling[intro]:
|
|
3800 |
fixes s :: "'a::real_normed_vector set"
|
|
3801 |
assumes "c \<noteq> 0" "open s"
|
|
3802 |
shows "open((\<lambda>x. c *\<^sub>R x) ` s)"
|
|
3803 |
proof-
|
|
3804 |
{ fix x assume "x \<in> s"
|
|
3805 |
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
|
|
3806 |
have "e * abs c > 0" using assms(1)[unfolded zero_less_abs_iff[THEN sym]] using real_mult_order[OF `e>0`] by auto
|
|
3807 |
moreover
|
|
3808 |
{ fix y assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>"
|
|
3809 |
hence "norm ((1 / c) *\<^sub>R y - x) < e" unfolding dist_norm
|
|
3810 |
using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1)
|
|
3811 |
assms(1)[unfolded zero_less_abs_iff[THEN sym]] by (simp del:zero_less_abs_iff)
|
|
3812 |
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 }
|
|
3813 |
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 }
|
|
3814 |
thus ?thesis unfolding open_dist by auto
|
|
3815 |
qed
|
|
3816 |
|
|
3817 |
lemma minus_image_eq_vimage:
|
|
3818 |
fixes A :: "'a::ab_group_add set"
|
|
3819 |
shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A"
|
|
3820 |
by (auto intro!: image_eqI [where f="\<lambda>x. - x"])
|
|
3821 |
|
|
3822 |
lemma open_negations:
|
|
3823 |
fixes s :: "'a::real_normed_vector set"
|
|
3824 |
shows "open s ==> open ((\<lambda> x. -x) ` s)"
|
|
3825 |
unfolding scaleR_minus1_left [symmetric]
|
|
3826 |
by (rule open_scaling, auto)
|
|
3827 |
|
|
3828 |
lemma open_translation:
|
|
3829 |
fixes s :: "'a::real_normed_vector set"
|
|
3830 |
assumes "open s" shows "open((\<lambda>x. a + x) ` s)"
|
|
3831 |
proof-
|
|
3832 |
{ fix x have "continuous (at x) (\<lambda>x. x - a)" using continuous_sub[of "at x" "\<lambda>x. x" "\<lambda>x. a"] continuous_at_id[of x] continuous_const[of "at x" a] by auto }
|
|
3833 |
moreover have "{x. x - a \<in> s} = op + a ` s" apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto
|
|
3834 |
ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto
|
|
3835 |
qed
|
|
3836 |
|
|
3837 |
lemma open_affinity:
|
|
3838 |
fixes s :: "'a::real_normed_vector set"
|
|
3839 |
assumes "open s" "c \<noteq> 0"
|
|
3840 |
shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)"
|
|
3841 |
proof-
|
|
3842 |
have *:"(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" unfolding o_def ..
|
|
3843 |
have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" by auto
|
|
3844 |
thus ?thesis using assms open_translation[of "op *\<^sub>R c ` s" a] unfolding * by auto
|
|
3845 |
qed
|
|
3846 |
|
|
3847 |
lemma interior_translation:
|
|
3848 |
fixes s :: "'a::real_normed_vector set"
|
|
3849 |
shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)"
|
|
3850 |
proof (rule set_ext, rule)
|
|
3851 |
fix x assume "x \<in> interior (op + a ` s)"
|
|
3852 |
then obtain e where "e>0" and e:"ball x e \<subseteq> op + a ` s" unfolding mem_interior by auto
|
|
3853 |
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
|
|
3854 |
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
|
|
3855 |
next
|
|
3856 |
fix x assume "x \<in> op + a ` interior s"
|
|
3857 |
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
|
|
3858 |
{ fix z have *:"a + y - z = y + a - z" by auto
|
|
3859 |
assume "z\<in>ball x e"
|
|
3860 |
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
|
|
3861 |
hence "z \<in> op + a ` s" unfolding image_iff by(auto intro!: bexI[where x="z - a"]) }
|
|
3862 |
hence "ball x e \<subseteq> op + a ` s" unfolding subset_eq by auto
|
|
3863 |
thus "x \<in> interior (op + a ` s)" unfolding mem_interior using `e>0` by auto
|
|
3864 |
qed
|
|
3865 |
|
|
3866 |
subsection {* Preservation of compactness and connectedness under continuous function. *}
|
|
3867 |
|
|
3868 |
lemma compact_continuous_image:
|
|
3869 |
assumes "continuous_on s f" "compact s"
|
|
3870 |
shows "compact(f ` s)"
|
|
3871 |
proof-
|
|
3872 |
{ fix x assume x:"\<forall>n::nat. x n \<in> f ` s"
|
|
3873 |
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
|
|
3874 |
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
|
|
3875 |
{ fix e::real assume "e>0"
|
|
3876 |
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_def, THEN bspec[where x=l], OF `l\<in>s`] by auto
|
|
3877 |
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
|
|
3878 |
{ 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 }
|
|
3879 |
hence "\<exists>N. \<forall>n\<ge>N. dist ((x \<circ> r) n) (f l) < e" by auto }
|
|
3880 |
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 }
|
|
3881 |
thus ?thesis unfolding compact_def by auto
|
|
3882 |
qed
|
|
3883 |
|
|
3884 |
lemma connected_continuous_image:
|
|
3885 |
assumes "continuous_on s f" "connected s"
|
|
3886 |
shows "connected(f ` s)"
|
|
3887 |
proof-
|
|
3888 |
{ fix T assume as: "T \<noteq> {}" "T \<noteq> f ` s" "openin (subtopology euclidean (f ` s)) T" "closedin (subtopology euclidean (f ` s)) T"
|
|
3889 |
have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
|
|
3890 |
using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]]
|
|
3891 |
using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]]
|
|
3892 |
using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
|
|
3893 |
hence False using as(1,2)
|
|
3894 |
using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto }
|
|
3895 |
thus ?thesis unfolding connected_clopen by auto
|
|
3896 |
qed
|
|
3897 |
|
|
3898 |
text{* Continuity implies uniform continuity on a compact domain. *}
|
|
3899 |
|
|
3900 |
lemma compact_uniformly_continuous:
|
|
3901 |
assumes "continuous_on s f" "compact s"
|
|
3902 |
shows "uniformly_continuous_on s f"
|
|
3903 |
proof-
|
|
3904 |
{ fix x assume x:"x\<in>s"
|
|
3905 |
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_def, THEN bspec[where x=x]] by auto
|
|
3906 |
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 }
|
|
3907 |
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
|
|
3908 |
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)"
|
|
3909 |
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
|
|
3910 |
|
|
3911 |
{ fix e::real assume "e>0"
|
|
3912 |
|
|
3913 |
{ 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 }
|
|
3914 |
hence "s \<subseteq> \<Union>{ball x (d x (e / 2)) |x. x \<in> s}" unfolding subset_eq by auto
|
|
3915 |
moreover
|
|
3916 |
{ fix b assume "b\<in>{ball x (d x (e / 2)) |x. x \<in> s}" hence "open b" by auto }
|
|
3917 |
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
|
|
3918 |
|
|
3919 |
{ fix x y assume "x\<in>s" "y\<in>s" and as:"dist y x < ea"
|
|
3920 |
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
|
|
3921 |
hence "x\<in>ball z (d z (e / 2))" using `ea>0` unfolding subset_eq by auto
|
|
3922 |
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`
|
|
3923 |
by (auto simp add: dist_commute)
|
|
3924 |
moreover have "y\<in>ball z (d z (e / 2))" using as and `ea>0` and z[unfolded subset_eq]
|
|
3925 |
by (auto simp add: dist_commute)
|
|
3926 |
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`
|
|
3927 |
by (auto simp add: dist_commute)
|
|
3928 |
ultimately have "dist (f y) (f x) < e" using dist_triangle_half_r[of "f z" "f x" e "f y"]
|
|
3929 |
by (auto simp add: dist_commute) }
|
|
3930 |
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 }
|
|
3931 |
thus ?thesis unfolding uniformly_continuous_on_def by auto
|
|
3932 |
qed
|
|
3933 |
|
|
3934 |
text{* Continuity of inverse function on compact domain. *}
|
|
3935 |
|
|
3936 |
lemma continuous_on_inverse:
|
|
3937 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
|
|
3938 |
(* TODO: can this be generalized more? *)
|
|
3939 |
assumes "continuous_on s f" "compact s" "\<forall>x \<in> s. g (f x) = x"
|
|
3940 |
shows "continuous_on (f ` s) g"
|
|
3941 |
proof-
|
|
3942 |
have *:"g ` f ` s = s" using assms(3) by (auto simp add: image_iff)
|
|
3943 |
{ fix t assume t:"closedin (subtopology euclidean (g ` f ` s)) t"
|
|
3944 |
then obtain T where T: "closed T" "t = s \<inter> T" unfolding closedin_closed unfolding * by auto
|
|
3945 |
have "continuous_on (s \<inter> T) f" using continuous_on_subset[OF assms(1), of "s \<inter> t"]
|
|
3946 |
unfolding T(2) and Int_left_absorb by auto
|
|
3947 |
moreover have "compact (s \<inter> T)"
|
|
3948 |
using assms(2) unfolding compact_eq_bounded_closed
|
|
3949 |
using bounded_subset[of s "s \<inter> T"] and T(1) by auto
|
|
3950 |
ultimately have "closed (f ` t)" using T(1) unfolding T(2)
|
|
3951 |
using compact_continuous_image [of "s \<inter> T" f] unfolding compact_eq_bounded_closed by auto
|
|
3952 |
moreover have "{x \<in> f ` s. g x \<in> t} = f ` s \<inter> f ` t" using assms(3) unfolding T(2) by auto
|
|
3953 |
ultimately have "closedin (subtopology euclidean (f ` s)) {x \<in> f ` s. g x \<in> t}"
|
|
3954 |
unfolding closedin_closed by auto }
|
|
3955 |
thus ?thesis unfolding continuous_on_closed by auto
|
|
3956 |
qed
|
|
3957 |
|
|
3958 |
subsection{* A uniformly convergent limit of continuous functions is continuous. *}
|
|
3959 |
|
|
3960 |
lemma norm_triangle_lt:
|
|
3961 |
fixes x y :: "'a::real_normed_vector"
|
|
3962 |
shows "norm x + norm y < e \<Longrightarrow> norm (x + y) < e"
|
|
3963 |
by (rule le_less_trans [OF norm_triangle_ineq])
|
|
3964 |
|
|
3965 |
lemma continuous_uniform_limit:
|
|
3966 |
fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::real_normed_vector"
|
|
3967 |
assumes "\<not> (trivial_limit net)" "eventually (\<lambda>n. continuous_on s (f n)) net"
|
|
3968 |
"\<forall>e>0. eventually (\<lambda>n. \<forall>x \<in> s. norm(f n x - g x) < e) net"
|
|
3969 |
shows "continuous_on s g"
|
|
3970 |
proof-
|
|
3971 |
{ fix x and e::real assume "x\<in>s" "e>0"
|
|
3972 |
have "eventually (\<lambda>n. \<forall>x\<in>s. norm (f n x - g x) < e / 3) net" using `e>0` assms(3)[THEN spec[where x="e/3"]] by auto
|
|
3973 |
then obtain n where n:"\<forall>xa\<in>s. norm (f n xa - g xa) < e / 3" "continuous_on s (f n)"
|
|
3974 |
using eventually_and[of "(\<lambda>n. \<forall>x\<in>s. norm (f n x - g x) < e / 3)" "(\<lambda>n. continuous_on s (f n))" net] assms(1,2) eventually_happens by blast
|
|
3975 |
have "e / 3 > 0" using `e>0` by auto
|
|
3976 |
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"
|
|
3977 |
using n(2)[unfolded continuous_on_def, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast
|
|
3978 |
{ fix y assume "y\<in>s" "dist y x < d"
|
|
3979 |
hence "dist (f n y) (f n x) < e / 3" using d[THEN bspec[where x=y]] by auto
|
|
3980 |
hence "norm (f n y - g x) < 2 * e / 3" using norm_triangle_lt[of "f n y - f n x" "f n x - g x" "2*e/3"]
|
|
3981 |
using n(1)[THEN bspec[where x=x], OF `x\<in>s`] unfolding dist_norm unfolding ab_group_add_class.ab_diff_minus by auto
|
|
3982 |
hence "dist (g y) (g x) < e" unfolding dist_norm using n(1)[THEN bspec[where x=y], OF `y\<in>s`]
|
|
3983 |
unfolding norm_minus_cancel[of "f n y - g y", THEN sym] using norm_triangle_lt[of "f n y - g x" "g y - f n y" e] by (auto simp add: uminus_add_conv_diff) }
|
|
3984 |
hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using `d>0` by auto }
|
|
3985 |
thus ?thesis unfolding continuous_on_def by auto
|
|
3986 |
qed
|
|
3987 |
|
|
3988 |
subsection{* Topological properties of linear functions. *}
|
|
3989 |
|
|
3990 |
lemma linear_lim_0:
|
|
3991 |
assumes "bounded_linear f" shows "(f ---> 0) (at (0))"
|
|
3992 |
proof-
|
|
3993 |
interpret f: bounded_linear f by fact
|
|
3994 |
have "(f ---> f 0) (at 0)"
|
|
3995 |
using tendsto_ident_at by (rule f.tendsto)
|
|
3996 |
thus ?thesis unfolding f.zero .
|
|
3997 |
qed
|
|
3998 |
|
|
3999 |
lemma linear_continuous_at:
|
|
4000 |
assumes "bounded_linear f" shows "continuous (at a) f"
|
|
4001 |
unfolding continuous_at using assms
|
|
4002 |
apply (rule bounded_linear.tendsto)
|
|
4003 |
apply (rule tendsto_ident_at)
|
|
4004 |
done
|
|
4005 |
|
|
4006 |
lemma linear_continuous_within:
|
|
4007 |
shows "bounded_linear f ==> continuous (at x within s) f"
|
|
4008 |
using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto
|
|
4009 |
|
|
4010 |
lemma linear_continuous_on:
|
|
4011 |
shows "bounded_linear f ==> continuous_on s f"
|
|
4012 |
using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto
|
|
4013 |
|
|
4014 |
text{* Also bilinear functions, in composition form. *}
|
|
4015 |
|
|
4016 |
lemma bilinear_continuous_at_compose:
|
|
4017 |
shows "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h
|
|
4018 |
==> continuous (at x) (\<lambda>x. h (f x) (g x))"
|
|
4019 |
unfolding continuous_at using Lim_bilinear[of f "f x" "(at x)" g "g x" h] by auto
|
|
4020 |
|
|
4021 |
lemma bilinear_continuous_within_compose:
|
|
4022 |
shows "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h
|
|
4023 |
==> continuous (at x within s) (\<lambda>x. h (f x) (g x))"
|
|
4024 |
unfolding continuous_within using Lim_bilinear[of f "f x"] by auto
|
|
4025 |
|
|
4026 |
lemma bilinear_continuous_on_compose:
|
|
4027 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h
|
|
4028 |
==> continuous_on s (\<lambda>x. h (f x) (g x))"
|
|
4029 |
unfolding continuous_on_eq_continuous_within apply auto apply(erule_tac x=x in ballE) apply auto apply(erule_tac x=x in ballE) apply auto
|
|
4030 |
using bilinear_continuous_within_compose[of _ s f g h] by auto
|
|
4031 |
|
|
4032 |
subsection{* Topological stuff lifted from and dropped to R *}
|
|
4033 |
|
|
4034 |
|
|
4035 |
lemma open_real:
|
|
4036 |
fixes s :: "real set" shows
|
|
4037 |
"open s \<longleftrightarrow>
|
|
4038 |
(\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" (is "?lhs = ?rhs")
|
|
4039 |
unfolding open_dist dist_norm by simp
|
|
4040 |
|
|
4041 |
lemma islimpt_approachable_real:
|
|
4042 |
fixes s :: "real set"
|
|
4043 |
shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)"
|
|
4044 |
unfolding islimpt_approachable dist_norm by simp
|
|
4045 |
|
|
4046 |
lemma closed_real:
|
|
4047 |
fixes s :: "real set"
|
|
4048 |
shows "closed s \<longleftrightarrow>
|
|
4049 |
(\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e)
|
|
4050 |
--> x \<in> s)"
|
|
4051 |
unfolding closed_limpt islimpt_approachable dist_norm by simp
|
|
4052 |
|
|
4053 |
lemma continuous_at_real_range:
|
|
4054 |
fixes f :: "'a::real_normed_vector \<Rightarrow> real"
|
|
4055 |
shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.
|
|
4056 |
\<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)"
|
|
4057 |
unfolding continuous_at unfolding Lim_at
|
|
4058 |
unfolding dist_nz[THEN sym] unfolding dist_norm apply auto
|
|
4059 |
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
|
|
4060 |
apply(erule_tac x=e in allE) by auto
|
|
4061 |
|
|
4062 |
lemma continuous_on_real_range:
|
|
4063 |
fixes f :: "'a::real_normed_vector \<Rightarrow> real"
|
|
4064 |
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))"
|
|
4065 |
unfolding continuous_on_def dist_norm by simp
|
|
4066 |
|
|
4067 |
lemma continuous_at_norm: "continuous (at x) norm"
|
|
4068 |
unfolding continuous_at by (intro tendsto_intros)
|
|
4069 |
|
|
4070 |
lemma continuous_on_norm: "continuous_on s norm"
|
|
4071 |
unfolding continuous_on by (intro ballI tendsto_intros)
|
|
4072 |
|
|
4073 |
lemma continuous_at_component: "continuous (at a) (\<lambda>x. x $ i)"
|
|
4074 |
unfolding continuous_at by (intro tendsto_intros)
|
|
4075 |
|
|
4076 |
lemma continuous_on_component: "continuous_on s (\<lambda>x. x $ i)"
|
|
4077 |
unfolding continuous_on by (intro ballI tendsto_intros)
|
|
4078 |
|
|
4079 |
lemma continuous_at_infnorm: "continuous (at x) infnorm"
|
|
4080 |
unfolding continuous_at Lim_at o_def unfolding dist_norm
|
|
4081 |
apply auto apply (rule_tac x=e in exI) apply auto
|
|
4082 |
using order_trans[OF real_abs_sub_infnorm infnorm_le_norm, of _ x] by (metis xt1(7))
|
|
4083 |
|
|
4084 |
text{* Hence some handy theorems on distance, diameter etc. of/from a set. *}
|
|
4085 |
|
|
4086 |
lemma compact_attains_sup:
|
|
4087 |
fixes s :: "real set"
|
|
4088 |
assumes "compact s" "s \<noteq> {}"
|
|
4089 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. y \<le> x"
|
|
4090 |
proof-
|
|
4091 |
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto
|
33270
|
4092 |
{ 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"
|
|
4093 |
have "isLub UNIV s (Sup s)" using Sup[OF assms(2)] unfolding setle_def using as(1) by auto
|
|
4094 |
moreover have "isUb UNIV s (Sup s - e)" unfolding isUb_def unfolding setle_def using as(4,2) by auto
|
|
4095 |
ultimately have False using isLub_le_isUb[of UNIV s "Sup s" "Sup s - e"] using `e>0` by auto }
|
|
4096 |
thus ?thesis using bounded_has_Sup(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Sup s"]]
|
|
4097 |
apply(rule_tac x="Sup s" in bexI) by auto
|
|
4098 |
qed
|
|
4099 |
|
|
4100 |
lemma Inf:
|
|
4101 |
fixes S :: "real set"
|
|
4102 |
shows "S \<noteq> {} ==> (\<exists>b. b <=* S) ==> isGlb UNIV S (Inf S)"
|
|
4103 |
by (auto simp add: isLb_def setle_def setge_def isGlb_def greatestP_def)
|
33175
|
4104 |
|
|
4105 |
lemma compact_attains_inf:
|
|
4106 |
fixes s :: "real set"
|
|
4107 |
assumes "compact s" "s \<noteq> {}" shows "\<exists>x \<in> s. \<forall>y \<in> s. x \<le> y"
|
|
4108 |
proof-
|
|
4109 |
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto
|
33270
|
4110 |
{ fix e::real assume as: "\<forall>x\<in>s. x \<ge> Inf s" "Inf s \<notin> s" "0 < e"
|
|
4111 |
"\<forall>x'\<in>s. x' = Inf s \<or> \<not> abs (x' - Inf s) < e"
|
|
4112 |
have "isGlb UNIV s (Inf s)" using Inf[OF assms(2)] unfolding setge_def using as(1) by auto
|
33175
|
4113 |
moreover
|
|
4114 |
{ fix x assume "x \<in> s"
|
33270
|
4115 |
hence *:"abs (x - Inf s) = x - Inf s" using as(1)[THEN bspec[where x=x]] by auto
|
|
4116 |
have "Inf s + e \<le> x" using as(4)[THEN bspec[where x=x]] using as(2) `x\<in>s` unfolding * by auto }
|
|
4117 |
hence "isLb UNIV s (Inf s + e)" unfolding isLb_def and setge_def by auto
|
|
4118 |
ultimately have False using isGlb_le_isLb[of UNIV s "Inf s" "Inf s + e"] using `e>0` by auto }
|
|
4119 |
thus ?thesis using bounded_has_Inf(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Inf s"]]
|
|
4120 |
apply(rule_tac x="Inf s" in bexI) by auto
|
33175
|
4121 |
qed
|
|
4122 |
|
|
4123 |
lemma continuous_attains_sup:
|
|
4124 |
fixes f :: "'a::metric_space \<Rightarrow> real"
|
|
4125 |
shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
|
|
4126 |
==> (\<exists>x \<in> s. \<forall>y \<in> s. f y \<le> f x)"
|
|
4127 |
using compact_attains_sup[of "f ` s"]
|
|
4128 |
using compact_continuous_image[of s f] by auto
|
|
4129 |
|
|
4130 |
lemma continuous_attains_inf:
|
|
4131 |
fixes f :: "'a::metric_space \<Rightarrow> real"
|
|
4132 |
shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
|
|
4133 |
\<Longrightarrow> (\<exists>x \<in> s. \<forall>y \<in> s. f x \<le> f y)"
|
|
4134 |
using compact_attains_inf[of "f ` s"]
|
|
4135 |
using compact_continuous_image[of s f] by auto
|
|
4136 |
|
|
4137 |
lemma distance_attains_sup:
|
|
4138 |
assumes "compact s" "s \<noteq> {}"
|
|
4139 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a y \<le> dist a x"
|
|
4140 |
proof (rule continuous_attains_sup [OF assms])
|
|
4141 |
{ fix x assume "x\<in>s"
|
|
4142 |
have "(dist a ---> dist a x) (at x within s)"
|
|
4143 |
by (intro tendsto_dist tendsto_const Lim_at_within Lim_ident_at)
|
|
4144 |
}
|
|
4145 |
thus "continuous_on s (dist a)"
|
|
4146 |
unfolding continuous_on ..
|
|
4147 |
qed
|
|
4148 |
|
|
4149 |
text{* For *minimal* distance, we only need closure, not compactness. *}
|
|
4150 |
|
|
4151 |
lemma distance_attains_inf:
|
|
4152 |
fixes a :: "'a::heine_borel"
|
|
4153 |
assumes "closed s" "s \<noteq> {}"
|
|
4154 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a x \<le> dist a y"
|
|
4155 |
proof-
|
|
4156 |
from assms(2) obtain b where "b\<in>s" by auto
|
|
4157 |
let ?B = "cball a (dist b a) \<inter> s"
|
|
4158 |
have "b \<in> ?B" using `b\<in>s` by (simp add: dist_commute)
|
|
4159 |
hence "?B \<noteq> {}" by auto
|
|
4160 |
moreover
|
|
4161 |
{ fix x assume "x\<in>?B"
|
|
4162 |
fix e::real assume "e>0"
|
|
4163 |
{ fix x' assume "x'\<in>?B" and as:"dist x' x < e"
|
|
4164 |
from as have "\<bar>dist a x' - dist a x\<bar> < e"
|
|
4165 |
unfolding abs_less_iff minus_diff_eq
|
|
4166 |
using dist_triangle2 [of a x' x]
|
|
4167 |
using dist_triangle [of a x x']
|
|
4168 |
by arith
|
|
4169 |
}
|
|
4170 |
hence "\<exists>d>0. \<forall>x'\<in>?B. dist x' x < d \<longrightarrow> \<bar>dist a x' - dist a x\<bar> < e"
|
|
4171 |
using `e>0` by auto
|
|
4172 |
}
|
|
4173 |
hence "continuous_on (cball a (dist b a) \<inter> s) (dist a)"
|
|
4174 |
unfolding continuous_on Lim_within dist_norm real_norm_def
|
|
4175 |
by fast
|
|
4176 |
moreover have "compact ?B"
|
|
4177 |
using compact_cball[of a "dist b a"]
|
|
4178 |
unfolding compact_eq_bounded_closed
|
|
4179 |
using bounded_Int and closed_Int and assms(1) by auto
|
|
4180 |
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"
|
|
4181 |
using continuous_attains_inf[of ?B "dist a"] by fastsimp
|
|
4182 |
thus ?thesis by fastsimp
|
|
4183 |
qed
|
|
4184 |
|
|
4185 |
subsection{* We can now extend limit compositions to consider the scalar multiplier. *}
|
|
4186 |
|
|
4187 |
lemma Lim_mul:
|
|
4188 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
|
|
4189 |
assumes "(c ---> d) net" "(f ---> l) net"
|
|
4190 |
shows "((\<lambda>x. c(x) *\<^sub>R f x) ---> (d *\<^sub>R l)) net"
|
|
4191 |
using assms by (rule scaleR.tendsto)
|
|
4192 |
|
|
4193 |
lemma Lim_vmul:
|
|
4194 |
fixes c :: "'a \<Rightarrow> real" and v :: "'b::real_normed_vector"
|
|
4195 |
shows "(c ---> d) net ==> ((\<lambda>x. c(x) *\<^sub>R v) ---> d *\<^sub>R v) net"
|
|
4196 |
by (intro tendsto_intros)
|
|
4197 |
|
|
4198 |
lemma continuous_vmul:
|
|
4199 |
fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector"
|
|
4200 |
shows "continuous net c ==> continuous net (\<lambda>x. c(x) *\<^sub>R v)"
|
|
4201 |
unfolding continuous_def using Lim_vmul[of c] by auto
|
|
4202 |
|
|
4203 |
lemma continuous_mul:
|
|
4204 |
fixes c :: "'a::metric_space \<Rightarrow> real"
|
|
4205 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
4206 |
shows "continuous net c \<Longrightarrow> continuous net f
|
|
4207 |
==> continuous net (\<lambda>x. c(x) *\<^sub>R f x) "
|
|
4208 |
unfolding continuous_def by (intro tendsto_intros)
|
|
4209 |
|
|
4210 |
lemma continuous_on_vmul:
|
|
4211 |
fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector"
|
|
4212 |
shows "continuous_on s c ==> continuous_on s (\<lambda>x. c(x) *\<^sub>R v)"
|
|
4213 |
unfolding continuous_on_eq_continuous_within using continuous_vmul[of _ c] by auto
|
|
4214 |
|
|
4215 |
lemma continuous_on_mul:
|
|
4216 |
fixes c :: "'a::metric_space \<Rightarrow> real"
|
|
4217 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
|
|
4218 |
shows "continuous_on s c \<Longrightarrow> continuous_on s f
|
|
4219 |
==> continuous_on s (\<lambda>x. c(x) *\<^sub>R f x)"
|
|
4220 |
unfolding continuous_on_eq_continuous_within using continuous_mul[of _ c] by auto
|
|
4221 |
|
|
4222 |
text{* And so we have continuity of inverse. *}
|
|
4223 |
|
|
4224 |
lemma Lim_inv:
|
|
4225 |
fixes f :: "'a \<Rightarrow> real"
|
|
4226 |
assumes "(f ---> l) (net::'a net)" "l \<noteq> 0"
|
|
4227 |
shows "((inverse o f) ---> inverse l) net"
|
|
4228 |
unfolding o_def using assms by (rule tendsto_inverse)
|
|
4229 |
|
|
4230 |
lemma continuous_inv:
|
|
4231 |
fixes f :: "'a::metric_space \<Rightarrow> real"
|
|
4232 |
shows "continuous net f \<Longrightarrow> f(netlimit net) \<noteq> 0
|
|
4233 |
==> continuous net (inverse o f)"
|
|
4234 |
unfolding continuous_def using Lim_inv by auto
|
|
4235 |
|
|
4236 |
lemma continuous_at_within_inv:
|
|
4237 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field"
|
|
4238 |
assumes "continuous (at a within s) f" "f a \<noteq> 0"
|
|
4239 |
shows "continuous (at a within s) (inverse o f)"
|
|
4240 |
using assms unfolding continuous_within o_def
|
|
4241 |
by (intro tendsto_intros)
|
|
4242 |
|
|
4243 |
lemma continuous_at_inv:
|
|
4244 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field"
|
|
4245 |
shows "continuous (at a) f \<Longrightarrow> f a \<noteq> 0
|
|
4246 |
==> continuous (at a) (inverse o f) "
|
|
4247 |
using within_UNIV[THEN sym, of "at a"] using continuous_at_within_inv[of a UNIV] by auto
|
|
4248 |
|
|
4249 |
subsection{* Preservation properties for pasted sets. *}
|
|
4250 |
|
|
4251 |
lemma bounded_pastecart:
|
|
4252 |
fixes s :: "('a::real_normed_vector ^ _) set" (* FIXME: generalize to metric_space *)
|
|
4253 |
assumes "bounded s" "bounded t"
|
|
4254 |
shows "bounded { pastecart x y | x y . (x \<in> s \<and> y \<in> t)}"
|
|
4255 |
proof-
|
|
4256 |
obtain a b where ab:"\<forall>x\<in>s. norm x \<le> a" "\<forall>x\<in>t. norm x \<le> b" using assms[unfolded bounded_iff] by auto
|
|
4257 |
{ fix x y assume "x\<in>s" "y\<in>t"
|
|
4258 |
hence "norm x \<le> a" "norm y \<le> b" using ab by auto
|
|
4259 |
hence "norm (pastecart x y) \<le> a + b" using norm_pastecart[of x y] by auto }
|
|
4260 |
thus ?thesis unfolding bounded_iff by auto
|
|
4261 |
qed
|
|
4262 |
|
|
4263 |
lemma bounded_Times:
|
|
4264 |
assumes "bounded s" "bounded t" shows "bounded (s \<times> t)"
|
|
4265 |
proof-
|
|
4266 |
obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b"
|
|
4267 |
using assms [unfolded bounded_def] by auto
|
|
4268 |
then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)"
|
|
4269 |
by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono)
|
|
4270 |
thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto
|
|
4271 |
qed
|
|
4272 |
|
|
4273 |
lemma closed_pastecart:
|
|
4274 |
fixes s :: "(real ^ 'a::finite) set" (* FIXME: generalize *)
|
|
4275 |
assumes "closed s" "closed t"
|
|
4276 |
shows "closed {pastecart x y | x y . x \<in> s \<and> y \<in> t}"
|
|
4277 |
proof-
|
|
4278 |
{ fix x l assume as:"\<forall>n::nat. x n \<in> {pastecart x y |x y. x \<in> s \<and> y \<in> t}" "(x ---> l) sequentially"
|
|
4279 |
{ fix n::nat have "fstcart (x n) \<in> s" "sndcart (x n) \<in> t" using as(1)[THEN spec[where x=n]] by auto } note * = this
|
|
4280 |
moreover
|
|
4281 |
{ fix e::real assume "e>0"
|
|
4282 |
then obtain N::nat where N:"\<forall>n\<ge>N. dist (x n) l < e" using as(2)[unfolded Lim_sequentially, THEN spec[where x=e]] by auto
|
|
4283 |
{ fix n::nat assume "n\<ge>N"
|
|
4284 |
hence "dist (fstcart (x n)) (fstcart l) < e" "dist (sndcart (x n)) (sndcart l) < e"
|
|
4285 |
using N[THEN spec[where x=n]] dist_fstcart[of "x n" l] dist_sndcart[of "x n" l] by auto }
|
|
4286 |
hence "\<exists>N. \<forall>n\<ge>N. dist (fstcart (x n)) (fstcart l) < e" "\<exists>N. \<forall>n\<ge>N. dist (sndcart (x n)) (sndcart l) < e" by auto }
|
|
4287 |
ultimately have "fstcart l \<in> s" "sndcart l \<in> t"
|
|
4288 |
using assms(1)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. fstcart (x n)"], THEN spec[where x="fstcart l"]]
|
|
4289 |
using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. sndcart (x n)"], THEN spec[where x="sndcart l"]]
|
|
4290 |
unfolding Lim_sequentially by auto
|
|
4291 |
hence "l \<in> {pastecart x y |x y. x \<in> s \<and> y \<in> t}" using pastecart_fst_snd[THEN sym, of l] by auto }
|
|
4292 |
thus ?thesis unfolding closed_sequential_limits by auto
|
|
4293 |
qed
|
|
4294 |
|
|
4295 |
lemma compact_pastecart:
|
|
4296 |
fixes s t :: "(real ^ _) set"
|
|
4297 |
shows "compact s \<Longrightarrow> compact t ==> compact {pastecart x y | x y . x \<in> s \<and> y \<in> t}"
|
|
4298 |
unfolding compact_eq_bounded_closed using bounded_pastecart[of s t] closed_pastecart[of s t] by auto
|
|
4299 |
|
|
4300 |
lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B"
|
|
4301 |
by (induct x) simp
|
|
4302 |
|
|
4303 |
lemma compact_Times: "compact s \<Longrightarrow> compact t \<Longrightarrow> compact (s \<times> t)"
|
|
4304 |
unfolding compact_def
|
|
4305 |
apply clarify
|
|
4306 |
apply (drule_tac x="fst \<circ> f" in spec)
|
|
4307 |
apply (drule mp, simp add: mem_Times_iff)
|
|
4308 |
apply (clarify, rename_tac l1 r1)
|
|
4309 |
apply (drule_tac x="snd \<circ> f \<circ> r1" in spec)
|
|
4310 |
apply (drule mp, simp add: mem_Times_iff)
|
|
4311 |
apply (clarify, rename_tac l2 r2)
|
|
4312 |
apply (rule_tac x="(l1, l2)" in rev_bexI, simp)
|
|
4313 |
apply (rule_tac x="r1 \<circ> r2" in exI)
|
|
4314 |
apply (rule conjI, simp add: subseq_def)
|
|
4315 |
apply (drule_tac r=r2 in lim_subseq [COMP swap_prems_rl], assumption)
|
|
4316 |
apply (drule (1) tendsto_Pair) back
|
|
4317 |
apply (simp add: o_def)
|
|
4318 |
done
|
|
4319 |
|
|
4320 |
text{* Hence some useful properties follow quite easily. *}
|
|
4321 |
|
|
4322 |
lemma compact_scaling:
|
|
4323 |
fixes s :: "'a::real_normed_vector set"
|
|
4324 |
assumes "compact s" shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)"
|
|
4325 |
proof-
|
|
4326 |
let ?f = "\<lambda>x. scaleR c x"
|
|
4327 |
have *:"bounded_linear ?f" by (rule scaleR.bounded_linear_right)
|
|
4328 |
show ?thesis using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f]
|
|
4329 |
using linear_continuous_at[OF *] assms by auto
|
|
4330 |
qed
|
|
4331 |
|
|
4332 |
lemma compact_negations:
|
|
4333 |
fixes s :: "'a::real_normed_vector set"
|
|
4334 |
assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)"
|
|
4335 |
using compact_scaling [OF assms, of "- 1"] by auto
|
|
4336 |
|
|
4337 |
lemma compact_sums:
|
|
4338 |
fixes s t :: "'a::real_normed_vector set"
|
|
4339 |
assumes "compact s" "compact t" shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
|
|
4340 |
proof-
|
|
4341 |
have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
|
|
4342 |
apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto
|
|
4343 |
have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)"
|
|
4344 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros)
|
|
4345 |
thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto
|
|
4346 |
qed
|
|
4347 |
|
|
4348 |
lemma compact_differences:
|
|
4349 |
fixes s t :: "'a::real_normed_vector set"
|
|
4350 |
assumes "compact s" "compact t" shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
|
|
4351 |
proof-
|
|
4352 |
have "{x - y | x y. x\<in>s \<and> y \<in> t} = {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
|
|
4353 |
apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
|
|
4354 |
thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto
|
|
4355 |
qed
|
|
4356 |
|
|
4357 |
lemma compact_translation:
|
|
4358 |
fixes s :: "'a::real_normed_vector set"
|
|
4359 |
assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)"
|
|
4360 |
proof-
|
|
4361 |
have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto
|
|
4362 |
thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto
|
|
4363 |
qed
|
|
4364 |
|
|
4365 |
lemma compact_affinity:
|
|
4366 |
fixes s :: "'a::real_normed_vector set"
|
|
4367 |
assumes "compact s" shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)"
|
|
4368 |
proof-
|
|
4369 |
have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto
|
|
4370 |
thus ?thesis using compact_translation[OF compact_scaling[OF assms], of a c] by auto
|
|
4371 |
qed
|
|
4372 |
|
|
4373 |
text{* Hence we get the following. *}
|
|
4374 |
|
|
4375 |
lemma compact_sup_maxdistance:
|
|
4376 |
fixes s :: "'a::real_normed_vector set"
|
|
4377 |
assumes "compact s" "s \<noteq> {}"
|
|
4378 |
shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)"
|
|
4379 |
proof-
|
|
4380 |
have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto
|
|
4381 |
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"
|
|
4382 |
using compact_differences[OF assms(1) assms(1)]
|
|
4383 |
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 simp add: norm_minus_cancel)
|
|
4384 |
from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto
|
|
4385 |
thus ?thesis using x(2)[unfolded `x = a - b`] by blast
|
|
4386 |
qed
|
|
4387 |
|
|
4388 |
text{* We can state this in terms of diameter of a set. *}
|
|
4389 |
|
33270
|
4390 |
definition "diameter s = (if s = {} then 0::real else Sup {norm(x - y) | x y. x \<in> s \<and> y \<in> s})"
|
33175
|
4391 |
(* TODO: generalize to class metric_space *)
|
|
4392 |
|
|
4393 |
lemma diameter_bounded:
|
|
4394 |
assumes "bounded s"
|
|
4395 |
shows "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"
|
|
4396 |
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)"
|
|
4397 |
proof-
|
|
4398 |
let ?D = "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}"
|
|
4399 |
obtain a where a:"\<forall>x\<in>s. norm x \<le> a" using assms[unfolded bounded_iff] by auto
|
|
4400 |
{ fix x y assume "x \<in> s" "y \<in> s"
|
|
4401 |
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: ring_simps) }
|
|
4402 |
note * = this
|
|
4403 |
{ fix x y assume "x\<in>s" "y\<in>s" hence "s \<noteq> {}" by auto
|
33324
|
4404 |
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`
|
|
4405 |
by simp (blast intro!: Sup_upper *) }
|
33175
|
4406 |
moreover
|
|
4407 |
{ fix d::real assume "d>0" "d < diameter s"
|
|
4408 |
hence "s\<noteq>{}" unfolding diameter_def by auto
|
|
4409 |
have "\<exists>d' \<in> ?D. d' > d"
|
|
4410 |
proof(rule ccontr)
|
|
4411 |
assume "\<not> (\<exists>d'\<in>{norm (x - y) |x y. x \<in> s \<and> y \<in> s}. d < d')"
|
33324
|
4412 |
hence "\<forall>d'\<in>?D. d' \<le> d" by auto (metis not_leE)
|
|
4413 |
thus False using `d < diameter s` `s\<noteq>{}`
|
|
4414 |
apply (auto simp add: diameter_def)
|
|
4415 |
apply (drule Sup_real_iff [THEN [2] rev_iffD2])
|
|
4416 |
apply (auto, force)
|
|
4417 |
done
|
33175
|
4418 |
qed
|
|
4419 |
hence "\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d" by auto }
|
|
4420 |
ultimately show "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"
|
|
4421 |
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)" by auto
|
|
4422 |
qed
|
|
4423 |
|
|
4424 |
lemma diameter_bounded_bound:
|
|
4425 |
"bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s"
|
|
4426 |
using diameter_bounded by blast
|
|
4427 |
|
|
4428 |
lemma diameter_compact_attained:
|
|
4429 |
fixes s :: "'a::real_normed_vector set"
|
|
4430 |
assumes "compact s" "s \<noteq> {}"
|
|
4431 |
shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)"
|
|
4432 |
proof-
|
|
4433 |
have b:"bounded s" using assms(1) by (rule compact_imp_bounded)
|
|
4434 |
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
|
33270
|
4435 |
hence "diameter s \<le> norm (x - y)"
|
|
4436 |
by (force simp add: diameter_def intro!: Sup_least)
|
33324
|
4437 |
thus ?thesis
|
|
4438 |
by (metis b diameter_bounded_bound order_antisym xys)
|
33175
|
4439 |
qed
|
|
4440 |
|
|
4441 |
text{* Related results with closure as the conclusion. *}
|
|
4442 |
|
|
4443 |
lemma closed_scaling:
|
|
4444 |
fixes s :: "'a::real_normed_vector set"
|
|
4445 |
assumes "closed s" shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)"
|
|
4446 |
proof(cases "s={}")
|
|
4447 |
case True thus ?thesis by auto
|
|
4448 |
next
|
|
4449 |
case False
|
|
4450 |
show ?thesis
|
|
4451 |
proof(cases "c=0")
|
|
4452 |
have *:"(\<lambda>x. 0) ` s = {0}" using `s\<noteq>{}` by auto
|
|
4453 |
case True thus ?thesis apply auto unfolding * using closed_sing by auto
|
|
4454 |
next
|
|
4455 |
case False
|
|
4456 |
{ fix x l assume as:"\<forall>n::nat. x n \<in> scaleR c ` s" "(x ---> l) sequentially"
|
|
4457 |
{ fix n::nat have "scaleR (1 / c) (x n) \<in> s"
|
|
4458 |
using as(1)[THEN spec[where x=n]]
|
|
4459 |
using `c\<noteq>0` by (auto simp add: vector_smult_assoc)
|
|
4460 |
}
|
|
4461 |
moreover
|
|
4462 |
{ fix e::real assume "e>0"
|
|
4463 |
hence "0 < e *\<bar>c\<bar>" using `c\<noteq>0` mult_pos_pos[of e "abs c"] by auto
|
|
4464 |
then obtain N where "\<forall>n\<ge>N. dist (x n) l < e * \<bar>c\<bar>"
|
|
4465 |
using as(2)[unfolded Lim_sequentially, THEN spec[where x="e * abs c"]] by auto
|
|
4466 |
hence "\<exists>N. \<forall>n\<ge>N. dist (scaleR (1 / c) (x n)) (scaleR (1 / c) l) < e"
|
|
4467 |
unfolding dist_norm unfolding scaleR_right_diff_distrib[THEN sym]
|
|
4468 |
using mult_imp_div_pos_less[of "abs c" _ e] `c\<noteq>0` by auto }
|
|
4469 |
hence "((\<lambda>n. scaleR (1 / c) (x n)) ---> scaleR (1 / c) l) sequentially" unfolding Lim_sequentially by auto
|
|
4470 |
ultimately have "l \<in> scaleR c ` s"
|
|
4471 |
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"]]
|
|
4472 |
unfolding image_iff using `c\<noteq>0` apply(rule_tac x="scaleR (1 / c) l" in bexI) by auto }
|
|
4473 |
thus ?thesis unfolding closed_sequential_limits by fast
|
|
4474 |
qed
|
|
4475 |
qed
|
|
4476 |
|
|
4477 |
lemma closed_negations:
|
|
4478 |
fixes s :: "'a::real_normed_vector set"
|
|
4479 |
assumes "closed s" shows "closed ((\<lambda>x. -x) ` s)"
|
|
4480 |
using closed_scaling[OF assms, of "- 1"] by simp
|
|
4481 |
|
|
4482 |
lemma compact_closed_sums:
|
|
4483 |
fixes s :: "'a::real_normed_vector set"
|
|
4484 |
assumes "compact s" "closed t" shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
|
|
4485 |
proof-
|
|
4486 |
let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
|
|
4487 |
{ fix x l assume as:"\<forall>n. x n \<in> ?S" "(x ---> l) sequentially"
|
|
4488 |
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"
|
|
4489 |
using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto
|
|
4490 |
obtain l' r where "l'\<in>s" and r:"subseq r" and lr:"(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially"
|
|
4491 |
using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto
|
|
4492 |
have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially"
|
|
4493 |
using Lim_sub[OF lim_subseq[OF r as(2)] lr] and f(1) unfolding o_def by auto
|
|
4494 |
hence "l - l' \<in> t"
|
|
4495 |
using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda> n. snd (f (r n))"], THEN spec[where x="l - l'"]]
|
|
4496 |
using f(3) by auto
|
|
4497 |
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
|
|
4498 |
}
|
|
4499 |
thus ?thesis unfolding closed_sequential_limits by fast
|
|
4500 |
qed
|
|
4501 |
|
|
4502 |
lemma closed_compact_sums:
|
|
4503 |
fixes s t :: "'a::real_normed_vector set"
|
|
4504 |
assumes "closed s" "compact t"
|
|
4505 |
shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
|
|
4506 |
proof-
|
|
4507 |
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
|
|
4508 |
apply(rule_tac x=y in exI) apply auto apply(rule_tac x=y in exI) by auto
|
|
4509 |
thus ?thesis using compact_closed_sums[OF assms(2,1)] by simp
|
|
4510 |
qed
|
|
4511 |
|
|
4512 |
lemma compact_closed_differences:
|
|
4513 |
fixes s t :: "'a::real_normed_vector set"
|
|
4514 |
assumes "compact s" "closed t"
|
|
4515 |
shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
|
|
4516 |
proof-
|
|
4517 |
have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
|
|
4518 |
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
|
|
4519 |
thus ?thesis using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto
|
|
4520 |
qed
|
|
4521 |
|
|
4522 |
lemma closed_compact_differences:
|
|
4523 |
fixes s t :: "'a::real_normed_vector set"
|
|
4524 |
assumes "closed s" "compact t"
|
|
4525 |
shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
|
|
4526 |
proof-
|
|
4527 |
have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
|
|
4528 |
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
|
|
4529 |
thus ?thesis using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp
|
|
4530 |
qed
|
|
4531 |
|
|
4532 |
lemma closed_translation:
|
|
4533 |
fixes a :: "'a::real_normed_vector"
|
|
4534 |
assumes "closed s" shows "closed ((\<lambda>x. a + x) ` s)"
|
|
4535 |
proof-
|
|
4536 |
have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
|
|
4537 |
thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto
|
|
4538 |
qed
|
|
4539 |
|
|
4540 |
lemma translation_UNIV:
|
|
4541 |
fixes a :: "'a::ab_group_add" shows "range (\<lambda>x. a + x) = UNIV"
|
|
4542 |
apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto
|
|
4543 |
|
|
4544 |
lemma translation_diff:
|
|
4545 |
fixes a :: "'a::ab_group_add"
|
|
4546 |
shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)"
|
|
4547 |
by auto
|
|
4548 |
|
|
4549 |
lemma closure_translation:
|
|
4550 |
fixes a :: "'a::real_normed_vector"
|
|
4551 |
shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)"
|
|
4552 |
proof-
|
|
4553 |
have *:"op + a ` (UNIV - s) = UNIV - op + a ` s"
|
|
4554 |
apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto
|
|
4555 |
show ?thesis unfolding closure_interior translation_diff translation_UNIV
|
|
4556 |
using interior_translation[of a "UNIV - s"] unfolding * by auto
|
|
4557 |
qed
|
|
4558 |
|
|
4559 |
lemma frontier_translation:
|
|
4560 |
fixes a :: "'a::real_normed_vector"
|
|
4561 |
shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)"
|
|
4562 |
unfolding frontier_def translation_diff interior_translation closure_translation by auto
|
|
4563 |
|
|
4564 |
subsection{* Separation between points and sets. *}
|
|
4565 |
|
|
4566 |
lemma separate_point_closed:
|
|
4567 |
fixes s :: "'a::heine_borel set"
|
|
4568 |
shows "closed s \<Longrightarrow> a \<notin> s ==> (\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x)"
|
|
4569 |
proof(cases "s = {}")
|
|
4570 |
case True
|
|
4571 |
thus ?thesis by(auto intro!: exI[where x=1])
|
|
4572 |
next
|
|
4573 |
case False
|
|
4574 |
assume "closed s" "a \<notin> s"
|
|
4575 |
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
|
|
4576 |
with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast
|
|
4577 |
qed
|
|
4578 |
|
|
4579 |
lemma separate_compact_closed:
|
|
4580 |
fixes s t :: "'a::{heine_borel, real_normed_vector} set"
|
|
4581 |
(* TODO: does this generalize to heine_borel? *)
|
|
4582 |
assumes "compact s" and "closed t" and "s \<inter> t = {}"
|
|
4583 |
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
|
|
4584 |
proof-
|
|
4585 |
have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto
|
|
4586 |
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"
|
|
4587 |
using separate_point_closed[OF compact_closed_differences[OF assms(1,2)], of 0] by auto
|
|
4588 |
{ fix x y assume "x\<in>s" "y\<in>t"
|
|
4589 |
hence "x - y \<in> {x - y |x y. x \<in> s \<and> y \<in> t}" by auto
|
|
4590 |
hence "d \<le> dist (x - y) 0" using d[THEN bspec[where x="x - y"]] using dist_commute
|
|
4591 |
by (auto simp add: dist_commute)
|
|
4592 |
hence "d \<le> dist x y" unfolding dist_norm by auto }
|
|
4593 |
thus ?thesis using `d>0` by auto
|
|
4594 |
qed
|
|
4595 |
|
|
4596 |
lemma separate_closed_compact:
|
|
4597 |
fixes s t :: "'a::{heine_borel, real_normed_vector} set"
|
|
4598 |
assumes "closed s" and "compact t" and "s \<inter> t = {}"
|
|
4599 |
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
|
|
4600 |
proof-
|
|
4601 |
have *:"t \<inter> s = {}" using assms(3) by auto
|
|
4602 |
show ?thesis using separate_compact_closed[OF assms(2,1) *]
|
|
4603 |
apply auto apply(rule_tac x=d in exI) apply auto apply (erule_tac x=y in ballE)
|
|
4604 |
by (auto simp add: dist_commute)
|
|
4605 |
qed
|
|
4606 |
|
|
4607 |
(* A cute way of denoting open and closed intervals using overloading. *)
|
|
4608 |
|
|
4609 |
lemma interval: fixes a :: "'a::ord^'n::finite" shows
|
|
4610 |
"{a <..< b} = {x::'a^'n. \<forall>i. a$i < x$i \<and> x$i < b$i}" and
|
|
4611 |
"{a .. b} = {x::'a^'n. \<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i}"
|
|
4612 |
by (auto simp add: expand_set_eq vector_less_def vector_less_eq_def)
|
|
4613 |
|
|
4614 |
lemma mem_interval: fixes a :: "'a::ord^'n::finite" shows
|
|
4615 |
"x \<in> {a<..<b} \<longleftrightarrow> (\<forall>i. a$i < x$i \<and> x$i < b$i)"
|
|
4616 |
"x \<in> {a .. b} \<longleftrightarrow> (\<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i)"
|
|
4617 |
using interval[of a b] by(auto simp add: expand_set_eq vector_less_def vector_less_eq_def)
|
|
4618 |
|
|
4619 |
lemma mem_interval_1: fixes x :: "real^1" shows
|
|
4620 |
"(x \<in> {a .. b} \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b)"
|
|
4621 |
"(x \<in> {a<..<b} \<longleftrightarrow> dest_vec1 a < dest_vec1 x \<and> dest_vec1 x < dest_vec1 b)"
|
|
4622 |
by(simp_all add: Cart_eq vector_less_def vector_less_eq_def dest_vec1_def forall_1)
|
|
4623 |
|
|
4624 |
lemma interval_eq_empty: fixes a :: "real^'n::finite" shows
|
|
4625 |
"({a <..< b} = {} \<longleftrightarrow> (\<exists>i. b$i \<le> a$i))" (is ?th1) and
|
|
4626 |
"({a .. b} = {} \<longleftrightarrow> (\<exists>i. b$i < a$i))" (is ?th2)
|
|
4627 |
proof-
|
|
4628 |
{ fix i x assume as:"b$i \<le> a$i" and x:"x\<in>{a <..< b}"
|
|
4629 |
hence "a $ i < x $ i \<and> x $ i < b $ i" unfolding mem_interval by auto
|
|
4630 |
hence "a$i < b$i" by auto
|
|
4631 |
hence False using as by auto }
|
|
4632 |
moreover
|
|
4633 |
{ assume as:"\<forall>i. \<not> (b$i \<le> a$i)"
|
|
4634 |
let ?x = "(1/2) *\<^sub>R (a + b)"
|
|
4635 |
{ fix i
|
|
4636 |
have "a$i < b$i" using as[THEN spec[where x=i]] by auto
|
|
4637 |
hence "a$i < ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i < b$i"
|
|
4638 |
unfolding vector_smult_component and vector_add_component
|
|
4639 |
by (auto simp add: less_divide_eq_number_of1) }
|
|
4640 |
hence "{a <..< b} \<noteq> {}" using mem_interval(1)[of "?x" a b] by auto }
|
|
4641 |
ultimately show ?th1 by blast
|
|
4642 |
|
|
4643 |
{ fix i x assume as:"b$i < a$i" and x:"x\<in>{a .. b}"
|
|
4644 |
hence "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" unfolding mem_interval by auto
|
|
4645 |
hence "a$i \<le> b$i" by auto
|
|
4646 |
hence False using as by auto }
|
|
4647 |
moreover
|
|
4648 |
{ assume as:"\<forall>i. \<not> (b$i < a$i)"
|
|
4649 |
let ?x = "(1/2) *\<^sub>R (a + b)"
|
|
4650 |
{ fix i
|
|
4651 |
have "a$i \<le> b$i" using as[THEN spec[where x=i]] by auto
|
|
4652 |
hence "a$i \<le> ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i \<le> b$i"
|
|
4653 |
unfolding vector_smult_component and vector_add_component
|
|
4654 |
by (auto simp add: less_divide_eq_number_of1) }
|
|
4655 |
hence "{a .. b} \<noteq> {}" using mem_interval(2)[of "?x" a b] by auto }
|
|
4656 |
ultimately show ?th2 by blast
|
|
4657 |
qed
|
|
4658 |
|
|
4659 |
lemma interval_ne_empty: fixes a :: "real^'n::finite" shows
|
|
4660 |
"{a .. b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i \<le> b$i)" and
|
|
4661 |
"{a <..< b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i < b$i)"
|
|
4662 |
unfolding interval_eq_empty[of a b] by (auto simp add: not_less not_le) (* BH: Why doesn't just "auto" work here? *)
|
|
4663 |
|
|
4664 |
lemma subset_interval_imp: fixes a :: "real^'n::finite" shows
|
|
4665 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c .. d} \<subseteq> {a .. b}" and
|
|
4666 |
"(\<forall>i. a$i < c$i \<and> d$i < b$i) \<Longrightarrow> {c .. d} \<subseteq> {a<..<b}" and
|
|
4667 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a .. b}" and
|
|
4668 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a<..<b}"
|
|
4669 |
unfolding subset_eq[unfolded Ball_def] unfolding mem_interval
|
|
4670 |
by (auto intro: order_trans less_le_trans le_less_trans less_imp_le) (* BH: Why doesn't just "auto" work here? *)
|
|
4671 |
|
|
4672 |
lemma interval_sing: fixes a :: "'a::linorder^'n::finite" shows
|
|
4673 |
"{a .. a} = {a} \<and> {a<..<a} = {}"
|
|
4674 |
apply(auto simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
|
|
4675 |
apply (simp add: order_eq_iff)
|
|
4676 |
apply (auto simp add: not_less less_imp_le)
|
|
4677 |
done
|
|
4678 |
|
|
4679 |
lemma interval_open_subset_closed: fixes a :: "'a::preorder^'n::finite" shows
|
|
4680 |
"{a<..<b} \<subseteq> {a .. b}"
|
|
4681 |
proof(simp add: subset_eq, rule)
|
|
4682 |
fix x
|
|
4683 |
assume x:"x \<in>{a<..<b}"
|
|
4684 |
{ fix i
|
|
4685 |
have "a $ i \<le> x $ i"
|
|
4686 |
using x order_less_imp_le[of "a$i" "x$i"]
|
|
4687 |
by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
|
|
4688 |
}
|
|
4689 |
moreover
|
|
4690 |
{ fix i
|
|
4691 |
have "x $ i \<le> b $ i"
|
|
4692 |
using x order_less_imp_le[of "x$i" "b$i"]
|
|
4693 |
by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
|
|
4694 |
}
|
|
4695 |
ultimately
|
|
4696 |
show "a \<le> x \<and> x \<le> b"
|
|
4697 |
by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
|
|
4698 |
qed
|
|
4699 |
|
|
4700 |
lemma subset_interval: fixes a :: "real^'n::finite" shows
|
|
4701 |
"{c .. d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th1) and
|
|
4702 |
"{c .. d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i < c$i \<and> d$i < b$i)" (is ?th2) and
|
|
4703 |
"{c<..<d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th3) and
|
|
4704 |
"{c<..<d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th4)
|
|
4705 |
proof-
|
|
4706 |
show ?th1 unfolding subset_eq and Ball_def and mem_interval by (auto intro: order_trans)
|
|
4707 |
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)
|
|
4708 |
{ assume as: "{c<..<d} \<subseteq> {a .. b}" "\<forall>i. c$i < d$i"
|
|
4709 |
hence "{c<..<d} \<noteq> {}" unfolding interval_eq_empty by (auto, drule_tac x=i in spec, simp) (* BH: Why doesn't just "auto" work? *)
|
|
4710 |
fix i
|
|
4711 |
(** TODO combine the following two parts as done in the HOL_light version. **)
|
|
4712 |
{ let ?x = "(\<chi> j. (if j=i then ((min (a$j) (d$j))+c$j)/2 else (c$j+d$j)/2))::real^'n"
|
|
4713 |
assume as2: "a$i > c$i"
|
|
4714 |
{ fix j
|
|
4715 |
have "c $ j < ?x $ j \<and> ?x $ j < d $ j" unfolding Cart_lambda_beta
|
|
4716 |
apply(cases "j=i") using as(2)[THEN spec[where x=j]]
|
|
4717 |
by (auto simp add: less_divide_eq_number_of1 as2) }
|
|
4718 |
hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
|
|
4719 |
moreover
|
|
4720 |
have "?x\<notin>{a .. b}"
|
|
4721 |
unfolding mem_interval apply auto apply(rule_tac x=i in exI)
|
|
4722 |
using as(2)[THEN spec[where x=i]] and as2
|
|
4723 |
by (auto simp add: less_divide_eq_number_of1)
|
|
4724 |
ultimately have False using as by auto }
|
|
4725 |
hence "a$i \<le> c$i" by(rule ccontr)auto
|
|
4726 |
moreover
|
|
4727 |
{ let ?x = "(\<chi> j. (if j=i then ((max (b$j) (c$j))+d$j)/2 else (c$j+d$j)/2))::real^'n"
|
|
4728 |
assume as2: "b$i < d$i"
|
|
4729 |
{ fix j
|
|
4730 |
have "d $ j > ?x $ j \<and> ?x $ j > c $ j" unfolding Cart_lambda_beta
|
|
4731 |
apply(cases "j=i") using as(2)[THEN spec[where x=j]]
|
|
4732 |
by (auto simp add: less_divide_eq_number_of1 as2) }
|
|
4733 |
hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
|
|
4734 |
moreover
|
|
4735 |
have "?x\<notin>{a .. b}"
|
|
4736 |
unfolding mem_interval apply auto apply(rule_tac x=i in exI)
|
|
4737 |
using as(2)[THEN spec[where x=i]] and as2
|
|
4738 |
by (auto simp add: less_divide_eq_number_of1)
|
|
4739 |
ultimately have False using as by auto }
|
|
4740 |
hence "b$i \<ge> d$i" by(rule ccontr)auto
|
|
4741 |
ultimately
|
|
4742 |
have "a$i \<le> c$i \<and> d$i \<le> b$i" by auto
|
|
4743 |
} note part1 = this
|
|
4744 |
thus ?th3 unfolding subset_eq and Ball_def and mem_interval apply auto apply (erule_tac x=ia in allE, simp)+ by (erule_tac x=i in allE, erule_tac x=i in allE, simp)+
|
|
4745 |
{ assume as:"{c<..<d} \<subseteq> {a<..<b}" "\<forall>i. c$i < d$i"
|
|
4746 |
fix i
|
|
4747 |
from as(1) have "{c<..<d} \<subseteq> {a..b}" using interval_open_subset_closed[of a b] by auto
|
|
4748 |
hence "a$i \<le> c$i \<and> d$i \<le> b$i" using part1 and as(2) by auto } note * = this
|
|
4749 |
thus ?th4 unfolding subset_eq and Ball_def and mem_interval apply auto apply (erule_tac x=ia in allE, simp)+ by (erule_tac x=i in allE, erule_tac x=i in allE, simp)+
|
|
4750 |
qed
|
|
4751 |
|
|
4752 |
lemma disjoint_interval: fixes a::"real^'n::finite" shows
|
|
4753 |
"{a .. b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i. (b$i < a$i \<or> d$i < c$i \<or> b$i < c$i \<or> d$i < a$i))" (is ?th1) and
|
|
4754 |
"{a .. b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i. (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
|
|
4755 |
"{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i. (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
|
|
4756 |
"{a<..<b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i. (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)
|
|
4757 |
proof-
|
|
4758 |
let ?z = "(\<chi> i. ((max (a$i) (c$i)) + (min (b$i) (d$i))) / 2)::real^'n"
|
|
4759 |
show ?th1 ?th2 ?th3 ?th4
|
|
4760 |
unfolding expand_set_eq and Int_iff and empty_iff and mem_interval and all_conj_distrib[THEN sym] and eq_False
|
|
4761 |
apply (auto elim!: allE[where x="?z"])
|
|
4762 |
apply ((rule_tac x=x in exI, force) | (rule_tac x=i in exI, force))+
|
|
4763 |
done
|
|
4764 |
qed
|
|
4765 |
|
|
4766 |
lemma inter_interval: fixes a :: "'a::linorder^'n::finite" shows
|
|
4767 |
"{a .. b} \<inter> {c .. d} = {(\<chi> i. max (a$i) (c$i)) .. (\<chi> i. min (b$i) (d$i))}"
|
|
4768 |
unfolding expand_set_eq and Int_iff and mem_interval
|
|
4769 |
by (auto simp add: less_divide_eq_number_of1 intro!: bexI)
|
|
4770 |
|
|
4771 |
(* Moved interval_open_subset_closed a bit upwards *)
|
|
4772 |
|
|
4773 |
lemma open_interval_lemma: fixes x :: "real" shows
|
|
4774 |
"a < x \<Longrightarrow> x < b ==> (\<exists>d>0. \<forall>x'. abs(x' - x) < d --> a < x' \<and> x' < b)"
|
|
4775 |
by(rule_tac x="min (x - a) (b - x)" in exI, auto)
|
|
4776 |
|
|
4777 |
lemma open_interval: fixes a :: "real^'n::finite" shows "open {a<..<b}"
|
|
4778 |
proof-
|
|
4779 |
{ fix x assume x:"x\<in>{a<..<b}"
|
|
4780 |
{ fix i
|
|
4781 |
have "\<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i"
|
|
4782 |
using x[unfolded mem_interval, THEN spec[where x=i]]
|
|
4783 |
using open_interval_lemma[of "a$i" "x$i" "b$i"] by auto }
|
|
4784 |
|
|
4785 |
hence "\<forall>i. \<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i" by auto
|
|
4786 |
then obtain d where d:"\<forall>i. 0 < d i \<and> (\<forall>x'. \<bar>x' - x $ i\<bar> < d i \<longrightarrow> a $ i < x' \<and> x' < b $ i)"
|
|
4787 |
using bchoice[of "UNIV" "\<lambda>i d. d>0 \<and> (\<forall>x'. \<bar>x' - x $ i\<bar> < d \<longrightarrow> a $ i < x' \<and> x' < b $ i)"] by auto
|
|
4788 |
|
|
4789 |
let ?d = "Min (range d)"
|
|
4790 |
have **:"finite (range d)" "range d \<noteq> {}" by auto
|
|
4791 |
have "?d>0" unfolding Min_gr_iff[OF **] using d by auto
|
|
4792 |
moreover
|
|
4793 |
{ fix x' assume as:"dist x' x < ?d"
|
|
4794 |
{ fix i
|
|
4795 |
have "\<bar>x'$i - x $ i\<bar> < d i"
|
|
4796 |
using norm_bound_component_lt[OF as[unfolded dist_norm], of i]
|
|
4797 |
unfolding vector_minus_component and Min_gr_iff[OF **] by auto
|
|
4798 |
hence "a $ i < x' $ i" "x' $ i < b $ i" using d[THEN spec[where x=i]] by auto }
|
|
4799 |
hence "a < x' \<and> x' < b" unfolding vector_less_def by auto }
|
|
4800 |
ultimately have "\<exists>e>0. \<forall>x'. dist x' x < e \<longrightarrow> x' \<in> {a<..<b}" by (auto, rule_tac x="?d" in exI, simp)
|
|
4801 |
}
|
|
4802 |
thus ?thesis unfolding open_dist using open_interval_lemma by auto
|
|
4803 |
qed
|
|
4804 |
|
|
4805 |
lemma closed_interval: fixes a :: "real^'n::finite" shows "closed {a .. b}"
|
|
4806 |
proof-
|
|
4807 |
{ fix x i assume as:"\<forall>e>0. \<exists>x'\<in>{a..b}. x' \<noteq> x \<and> dist x' x < e"(* and xab:"a$i > x$i \<or> b$i < x$i"*)
|
|
4808 |
{ assume xa:"a$i > x$i"
|
|
4809 |
with as obtain y where y:"y\<in>{a..b}" "y \<noteq> x" "dist y x < a$i - x$i" by(erule_tac x="a$i - x$i" in allE)auto
|
|
4810 |
hence False unfolding mem_interval and dist_norm
|
|
4811 |
using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xa by(auto elim!: allE[where x=i])
|
|
4812 |
} hence "a$i \<le> x$i" by(rule ccontr)auto
|
|
4813 |
moreover
|
|
4814 |
{ assume xb:"b$i < x$i"
|
|
4815 |
with as obtain y where y:"y\<in>{a..b}" "y \<noteq> x" "dist y x < x$i - b$i" by(erule_tac x="x$i - b$i" in allE)auto
|
|
4816 |
hence False unfolding mem_interval and dist_norm
|
|
4817 |
using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xb by(auto elim!: allE[where x=i])
|
|
4818 |
} hence "x$i \<le> b$i" by(rule ccontr)auto
|
|
4819 |
ultimately
|
|
4820 |
have "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" by auto }
|
|
4821 |
thus ?thesis unfolding closed_limpt islimpt_approachable mem_interval by auto
|
|
4822 |
qed
|
|
4823 |
|
|
4824 |
lemma interior_closed_interval: fixes a :: "real^'n::finite" shows
|
|
4825 |
"interior {a .. b} = {a<..<b}" (is "?L = ?R")
|
|
4826 |
proof(rule subset_antisym)
|
|
4827 |
show "?R \<subseteq> ?L" using interior_maximal[OF interval_open_subset_closed open_interval] by auto
|
|
4828 |
next
|
|
4829 |
{ fix x assume "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> {a..b}"
|
|
4830 |
then obtain s where s:"open s" "x \<in> s" "s \<subseteq> {a..b}" by auto
|
|
4831 |
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
|
|
4832 |
{ fix i
|
|
4833 |
have "dist (x - (e / 2) *\<^sub>R basis i) x < e"
|
|
4834 |
"dist (x + (e / 2) *\<^sub>R basis i) x < e"
|
|
4835 |
unfolding dist_norm apply auto
|
|
4836 |
unfolding norm_minus_cancel using norm_basis[of i] and `e>0` by auto
|
|
4837 |
hence "a $ i \<le> (x - (e / 2) *\<^sub>R basis i) $ i"
|
|
4838 |
"(x + (e / 2) *\<^sub>R basis i) $ i \<le> b $ i"
|
|
4839 |
using e[THEN spec[where x="x - (e/2) *\<^sub>R basis i"]]
|
|
4840 |
and e[THEN spec[where x="x + (e/2) *\<^sub>R basis i"]]
|
|
4841 |
unfolding mem_interval by (auto elim!: allE[where x=i])
|
|
4842 |
hence "a $ i < x $ i" and "x $ i < b $ i"
|
|
4843 |
unfolding vector_minus_component and vector_add_component
|
|
4844 |
unfolding vector_smult_component and basis_component using `e>0` by auto }
|
|
4845 |
hence "x \<in> {a<..<b}" unfolding mem_interval by auto }
|
|
4846 |
thus "?L \<subseteq> ?R" unfolding interior_def and subset_eq by auto
|
|
4847 |
qed
|
|
4848 |
|
|
4849 |
lemma bounded_closed_interval: fixes a :: "real^'n::finite" shows
|
|
4850 |
"bounded {a .. b}"
|
|
4851 |
proof-
|
|
4852 |
let ?b = "\<Sum>i\<in>UNIV. \<bar>a$i\<bar> + \<bar>b$i\<bar>"
|
|
4853 |
{ fix x::"real^'n" assume x:"\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i"
|
|
4854 |
{ fix i
|
|
4855 |
have "\<bar>x$i\<bar> \<le> \<bar>a$i\<bar> + \<bar>b$i\<bar>" using x[THEN spec[where x=i]] by auto }
|
|
4856 |
hence "(\<Sum>i\<in>UNIV. \<bar>x $ i\<bar>) \<le> ?b" by(rule setsum_mono)
|
|
4857 |
hence "norm x \<le> ?b" using norm_le_l1[of x] by auto }
|
|
4858 |
thus ?thesis unfolding interval and bounded_iff by auto
|
|
4859 |
qed
|
|
4860 |
|
|
4861 |
lemma bounded_interval: fixes a :: "real^'n::finite" shows
|
|
4862 |
"bounded {a .. b} \<and> bounded {a<..<b}"
|
|
4863 |
using bounded_closed_interval[of a b]
|
|
4864 |
using interval_open_subset_closed[of a b]
|
|
4865 |
using bounded_subset[of "{a..b}" "{a<..<b}"]
|
|
4866 |
by simp
|
|
4867 |
|
|
4868 |
lemma not_interval_univ: fixes a :: "real^'n::finite" shows
|
|
4869 |
"({a .. b} \<noteq> UNIV) \<and> ({a<..<b} \<noteq> UNIV)"
|
|
4870 |
using bounded_interval[of a b]
|
|
4871 |
by auto
|
|
4872 |
|
|
4873 |
lemma compact_interval: fixes a :: "real^'n::finite" shows
|
|
4874 |
"compact {a .. b}"
|
|
4875 |
using bounded_closed_imp_compact using bounded_interval[of a b] using closed_interval[of a b] by auto
|
|
4876 |
|
|
4877 |
lemma open_interval_midpoint: fixes a :: "real^'n::finite"
|
|
4878 |
assumes "{a<..<b} \<noteq> {}" shows "((1/2) *\<^sub>R (a + b)) \<in> {a<..<b}"
|
|
4879 |
proof-
|
|
4880 |
{ fix i
|
|
4881 |
have "a $ i < ((1 / 2) *\<^sub>R (a + b)) $ i \<and> ((1 / 2) *\<^sub>R (a + b)) $ i < b $ i"
|
|
4882 |
using assms[unfolded interval_ne_empty, THEN spec[where x=i]]
|
|
4883 |
unfolding vector_smult_component and vector_add_component
|
|
4884 |
by(auto simp add: less_divide_eq_number_of1) }
|
|
4885 |
thus ?thesis unfolding mem_interval by auto
|
|
4886 |
qed
|
|
4887 |
|
|
4888 |
lemma open_closed_interval_convex: fixes x :: "real^'n::finite"
|
|
4889 |
assumes x:"x \<in> {a<..<b}" and y:"y \<in> {a .. b}" and e:"0 < e" "e \<le> 1"
|
|
4890 |
shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> {a<..<b}"
|
|
4891 |
proof-
|
|
4892 |
{ fix i
|
|
4893 |
have "a $ i = e * a$i + (1 - e) * a$i" unfolding left_diff_distrib by simp
|
|
4894 |
also have "\<dots> < e * x $ i + (1 - e) * y $ i" apply(rule add_less_le_mono)
|
|
4895 |
using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all
|
|
4896 |
using x unfolding mem_interval apply simp
|
|
4897 |
using y unfolding mem_interval apply simp
|
|
4898 |
done
|
|
4899 |
finally have "a $ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i" by auto
|
|
4900 |
moreover {
|
|
4901 |
have "b $ i = e * b$i + (1 - e) * b$i" unfolding left_diff_distrib by simp
|
|
4902 |
also have "\<dots> > e * x $ i + (1 - e) * y $ i" apply(rule add_less_le_mono)
|
|
4903 |
using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all
|
|
4904 |
using x unfolding mem_interval apply simp
|
|
4905 |
using y unfolding mem_interval apply simp
|
|
4906 |
done
|
|
4907 |
finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i < b $ i" by auto
|
|
4908 |
} 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 }
|
|
4909 |
thus ?thesis unfolding mem_interval by auto
|
|
4910 |
qed
|
|
4911 |
|
|
4912 |
lemma closure_open_interval: fixes a :: "real^'n::finite"
|
|
4913 |
assumes "{a<..<b} \<noteq> {}"
|
|
4914 |
shows "closure {a<..<b} = {a .. b}"
|
|
4915 |
proof-
|
|
4916 |
have ab:"a < b" using assms[unfolded interval_ne_empty] unfolding vector_less_def by auto
|
|
4917 |
let ?c = "(1 / 2) *\<^sub>R (a + b)"
|
|
4918 |
{ fix x assume as:"x \<in> {a .. b}"
|
|
4919 |
def f == "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)"
|
|
4920 |
{ fix n assume fn:"f n < b \<longrightarrow> a < f n \<longrightarrow> f n = x" and xc:"x \<noteq> ?c"
|
|
4921 |
have *:"0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" unfolding inverse_le_1_iff by auto
|
|
4922 |
have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x =
|
|
4923 |
x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)"
|
|
4924 |
by (auto simp add: algebra_simps)
|
|
4925 |
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
|
|
4926 |
hence False using fn unfolding f_def using xc by(auto simp add: vector_mul_lcancel vector_ssub_ldistrib) }
|
|
4927 |
moreover
|
|
4928 |
{ assume "\<not> (f ---> x) sequentially"
|
|
4929 |
{ fix e::real assume "e>0"
|
|
4930 |
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
|
|
4931 |
then obtain N::nat where "inverse (real (N + 1)) < e" by auto
|
|
4932 |
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)
|
|
4933 |
hence "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto }
|
|
4934 |
hence "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially"
|
|
4935 |
unfolding Lim_sequentially by(auto simp add: dist_norm)
|
|
4936 |
hence "(f ---> x) sequentially" unfolding f_def
|
|
4937 |
using Lim_add[OF Lim_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]
|
|
4938 |
using Lim_vmul[of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] by auto }
|
|
4939 |
ultimately have "x \<in> closure {a<..<b}"
|
|
4940 |
using as and open_interval_midpoint[OF assms] unfolding closure_def unfolding islimpt_sequential by(cases "x=?c")auto }
|
|
4941 |
thus ?thesis using closure_minimal[OF interval_open_subset_closed closed_interval, of a b] by blast
|
|
4942 |
qed
|
|
4943 |
|
|
4944 |
lemma bounded_subset_open_interval_symmetric: fixes s::"(real^'n::finite) set"
|
|
4945 |
assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a<..<a}"
|
|
4946 |
proof-
|
|
4947 |
obtain b where "b>0" and b:"\<forall>x\<in>s. norm x \<le> b" using assms[unfolded bounded_pos] by auto
|
|
4948 |
def a \<equiv> "(\<chi> i. b+1)::real^'n"
|
|
4949 |
{ fix x assume "x\<in>s"
|
|
4950 |
fix i
|
|
4951 |
have "(-a)$i < x$i" and "x$i < a$i" using b[THEN bspec[where x=x], OF `x\<in>s`] and component_le_norm[of x i]
|
|
4952 |
unfolding vector_uminus_component and a_def and Cart_lambda_beta by auto
|
|
4953 |
}
|
|
4954 |
thus ?thesis by(auto intro: exI[where x=a] simp add: vector_less_def)
|
|
4955 |
qed
|
|
4956 |
|
|
4957 |
lemma bounded_subset_open_interval:
|
|
4958 |
fixes s :: "(real ^ 'n::finite) set"
|
|
4959 |
shows "bounded s ==> (\<exists>a b. s \<subseteq> {a<..<b})"
|
|
4960 |
by (auto dest!: bounded_subset_open_interval_symmetric)
|
|
4961 |
|
|
4962 |
lemma bounded_subset_closed_interval_symmetric:
|
|
4963 |
fixes s :: "(real ^ 'n::finite) set"
|
|
4964 |
assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a .. a}"
|
|
4965 |
proof-
|
|
4966 |
obtain a where "s \<subseteq> {- a<..<a}" using bounded_subset_open_interval_symmetric[OF assms] by auto
|
|
4967 |
thus ?thesis using interval_open_subset_closed[of "-a" a] by auto
|
|
4968 |
qed
|
|
4969 |
|
|
4970 |
lemma bounded_subset_closed_interval:
|
|
4971 |
fixes s :: "(real ^ 'n::finite) set"
|
|
4972 |
shows "bounded s ==> (\<exists>a b. s \<subseteq> {a .. b})"
|
|
4973 |
using bounded_subset_closed_interval_symmetric[of s] by auto
|
|
4974 |
|
|
4975 |
lemma frontier_closed_interval:
|
|
4976 |
fixes a b :: "real ^ _"
|
|
4977 |
shows "frontier {a .. b} = {a .. b} - {a<..<b}"
|
|
4978 |
unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] ..
|
|
4979 |
|
|
4980 |
lemma frontier_open_interval:
|
|
4981 |
fixes a b :: "real ^ _"
|
|
4982 |
shows "frontier {a<..<b} = (if {a<..<b} = {} then {} else {a .. b} - {a<..<b})"
|
|
4983 |
proof(cases "{a<..<b} = {}")
|
|
4984 |
case True thus ?thesis using frontier_empty by auto
|
|
4985 |
next
|
|
4986 |
case False thus ?thesis unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] by auto
|
|
4987 |
qed
|
|
4988 |
|
|
4989 |
lemma inter_interval_mixed_eq_empty: fixes a :: "real^'n::finite"
|
|
4990 |
assumes "{c<..<d} \<noteq> {}" shows "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> {a<..<b} \<inter> {c<..<d} = {}"
|
|
4991 |
unfolding closure_open_interval[OF assms, THEN sym] unfolding open_inter_closure_eq_empty[OF open_interval] ..
|
|
4992 |
|
|
4993 |
|
|
4994 |
(* Some special cases for intervals in R^1. *)
|
|
4995 |
|
|
4996 |
lemma all_1: "(\<forall>x::1. P x) \<longleftrightarrow> P 1"
|
|
4997 |
by (metis num1_eq_iff)
|
|
4998 |
|
|
4999 |
lemma ex_1: "(\<exists>x::1. P x) \<longleftrightarrow> P 1"
|
|
5000 |
by auto (metis num1_eq_iff)
|
|
5001 |
|
|
5002 |
lemma interval_cases_1: fixes x :: "real^1" shows
|
|
5003 |
"x \<in> {a .. b} ==> x \<in> {a<..<b} \<or> (x = a) \<or> (x = b)"
|
|
5004 |
by(simp add: Cart_eq vector_less_def vector_less_eq_def all_1, auto)
|
|
5005 |
|
|
5006 |
lemma in_interval_1: fixes x :: "real^1" shows
|
|
5007 |
"(x \<in> {a .. b} \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b) \<and>
|
|
5008 |
(x \<in> {a<..<b} \<longleftrightarrow> dest_vec1 a < dest_vec1 x \<and> dest_vec1 x < dest_vec1 b)"
|
|
5009 |
by(simp add: Cart_eq vector_less_def vector_less_eq_def all_1 dest_vec1_def)
|
|
5010 |
|
|
5011 |
lemma interval_eq_empty_1: fixes a :: "real^1" shows
|
|
5012 |
"{a .. b} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a"
|
|
5013 |
"{a<..<b} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a"
|
|
5014 |
unfolding interval_eq_empty and ex_1 and dest_vec1_def by auto
|
|
5015 |
|
|
5016 |
lemma subset_interval_1: fixes a :: "real^1" shows
|
|
5017 |
"({a .. b} \<subseteq> {c .. d} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or>
|
|
5018 |
dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a \<le> dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
|
|
5019 |
"({a .. b} \<subseteq> {c<..<d} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or>
|
|
5020 |
dest_vec1 c < dest_vec1 a \<and> dest_vec1 a \<le> dest_vec1 b \<and> dest_vec1 b < dest_vec1 d)"
|
|
5021 |
"({a<..<b} \<subseteq> {c .. d} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or>
|
|
5022 |
dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a < dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
|
|
5023 |
"({a<..<b} \<subseteq> {c<..<d} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or>
|
|
5024 |
dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a < dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
|
|
5025 |
unfolding subset_interval[of a b c d] unfolding all_1 and dest_vec1_def by auto
|
|
5026 |
|
|
5027 |
lemma eq_interval_1: fixes a :: "real^1" shows
|
|
5028 |
"{a .. b} = {c .. d} \<longleftrightarrow>
|
|
5029 |
dest_vec1 b < dest_vec1 a \<and> dest_vec1 d < dest_vec1 c \<or>
|
|
5030 |
dest_vec1 a = dest_vec1 c \<and> dest_vec1 b = dest_vec1 d"
|
|
5031 |
using set_eq_subset[of "{a .. b}" "{c .. d}"]
|
|
5032 |
using subset_interval_1(1)[of a b c d]
|
|
5033 |
using subset_interval_1(1)[of c d a b]
|
|
5034 |
by auto (* FIXME: slow *)
|
|
5035 |
|
|
5036 |
lemma disjoint_interval_1: fixes a :: "real^1" shows
|
|
5037 |
"{a .. b} \<inter> {c .. d} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or> dest_vec1 d < dest_vec1 c \<or> dest_vec1 b < dest_vec1 c \<or> dest_vec1 d < dest_vec1 a"
|
|
5038 |
"{a .. b} \<inter> {c<..<d} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or> dest_vec1 d \<le> dest_vec1 c \<or> dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
|
|
5039 |
"{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or> dest_vec1 d < dest_vec1 c \<or> dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
|
|
5040 |
"{a<..<b} \<inter> {c<..<d} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or> dest_vec1 d \<le> dest_vec1 c \<or> dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
|
|
5041 |
unfolding disjoint_interval and dest_vec1_def ex_1 by auto
|
|
5042 |
|
|
5043 |
lemma open_closed_interval_1: fixes a :: "real^1" shows
|
|
5044 |
"{a<..<b} = {a .. b} - {a, b}"
|
|
5045 |
unfolding expand_set_eq apply simp unfolding vector_less_def and vector_less_eq_def and all_1 and dest_vec1_eq[THEN sym] and dest_vec1_def by auto
|
|
5046 |
|
|
5047 |
lemma closed_open_interval_1: "dest_vec1 (a::real^1) \<le> dest_vec1 b ==> {a .. b} = {a<..<b} \<union> {a,b}"
|
|
5048 |
unfolding expand_set_eq apply simp unfolding vector_less_def and vector_less_eq_def and all_1 and dest_vec1_eq[THEN sym] and dest_vec1_def by auto
|
|
5049 |
|
|
5050 |
(* Some stuff for half-infinite intervals too; FIXME: notation? *)
|
|
5051 |
|
|
5052 |
lemma closed_interval_left: fixes b::"real^'n::finite"
|
|
5053 |
shows "closed {x::real^'n. \<forall>i. x$i \<le> b$i}"
|
|
5054 |
proof-
|
|
5055 |
{ fix i
|
|
5056 |
fix x::"real^'n" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i. x $ i \<le> b $ i}. x' \<noteq> x \<and> dist x' x < e"
|
|
5057 |
{ assume "x$i > b$i"
|
|
5058 |
then obtain y where "y $ i \<le> b $ i" "y \<noteq> x" "dist y x < x$i - b$i" using x[THEN spec[where x="x$i - b$i"]] by auto
|
|
5059 |
hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto }
|
|
5060 |
hence "x$i \<le> b$i" by(rule ccontr)auto }
|
|
5061 |
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast
|
|
5062 |
qed
|
|
5063 |
|
|
5064 |
lemma closed_interval_right: fixes a::"real^'n::finite"
|
|
5065 |
shows "closed {x::real^'n. \<forall>i. a$i \<le> x$i}"
|
|
5066 |
proof-
|
|
5067 |
{ fix i
|
|
5068 |
fix x::"real^'n" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i. a $ i \<le> x $ i}. x' \<noteq> x \<and> dist x' x < e"
|
|
5069 |
{ assume "a$i > x$i"
|
|
5070 |
then obtain y where "a $ i \<le> y $ i" "y \<noteq> x" "dist y x < a$i - x$i" using x[THEN spec[where x="a$i - x$i"]] by auto
|
|
5071 |
hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto }
|
|
5072 |
hence "a$i \<le> x$i" by(rule ccontr)auto }
|
|
5073 |
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast
|
|
5074 |
qed
|
|
5075 |
|
|
5076 |
subsection{* Intervals in general, including infinite and mixtures of open and closed. *}
|
|
5077 |
|
|
5078 |
definition "is_interval s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i. ((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)"
|
|
5079 |
|
|
5080 |
lemma is_interval_interval: "is_interval {a .. b::real^'n::finite}" (is ?th1) "is_interval {a<..<b}" (is ?th2) proof -
|
|
5081 |
have *:"\<And>x y z::real. x < y \<Longrightarrow> y < z \<Longrightarrow> x < z" by auto
|
|
5082 |
show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff
|
|
5083 |
by(meson real_le_trans le_less_trans less_le_trans *)+ qed
|
|
5084 |
|
|
5085 |
lemma is_interval_empty:
|
|
5086 |
"is_interval {}"
|
|
5087 |
unfolding is_interval_def
|
|
5088 |
by simp
|
|
5089 |
|
|
5090 |
lemma is_interval_univ:
|
|
5091 |
"is_interval UNIV"
|
|
5092 |
unfolding is_interval_def
|
|
5093 |
by simp
|
|
5094 |
|
|
5095 |
subsection{* Closure of halfspaces and hyperplanes. *}
|
|
5096 |
|
|
5097 |
lemma Lim_inner:
|
|
5098 |
assumes "(f ---> l) net" shows "((\<lambda>y. inner a (f y)) ---> inner a l) net"
|
|
5099 |
by (intro tendsto_intros assms)
|
|
5100 |
|
|
5101 |
lemma continuous_at_inner: "continuous (at x) (inner a)"
|
|
5102 |
unfolding continuous_at by (intro tendsto_intros)
|
|
5103 |
|
|
5104 |
lemma continuous_on_inner:
|
|
5105 |
fixes s :: "'a::real_inner set"
|
|
5106 |
shows "continuous_on s (inner a)"
|
|
5107 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros)
|
|
5108 |
|
|
5109 |
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
|
|
5110 |
proof-
|
|
5111 |
have "\<forall>x. continuous (at x) (inner a)"
|
|
5112 |
unfolding continuous_at by (rule allI) (intro tendsto_intros)
|
|
5113 |
hence "closed (inner a -` {..b})"
|
|
5114 |
using closed_real_atMost by (rule continuous_closed_vimage)
|
|
5115 |
moreover have "{x. inner a x \<le> b} = inner a -` {..b}" by auto
|
|
5116 |
ultimately show ?thesis by simp
|
|
5117 |
qed
|
|
5118 |
|
|
5119 |
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
|
|
5120 |
using closed_halfspace_le[of "-a" "-b"] unfolding inner_minus_left by auto
|
|
5121 |
|
|
5122 |
lemma closed_hyperplane: "closed {x. inner a x = b}"
|
|
5123 |
proof-
|
|
5124 |
have "{x. inner a x = b} = {x. inner a x \<ge> b} \<inter> {x. inner a x \<le> b}" by auto
|
|
5125 |
thus ?thesis using closed_halfspace_le[of a b] and closed_halfspace_ge[of b a] using closed_Int by auto
|
|
5126 |
qed
|
|
5127 |
|
|
5128 |
lemma closed_halfspace_component_le:
|
|
5129 |
shows "closed {x::real^'n::finite. x$i \<le> a}"
|
|
5130 |
using closed_halfspace_le[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto
|
|
5131 |
|
|
5132 |
lemma closed_halfspace_component_ge:
|
|
5133 |
shows "closed {x::real^'n::finite. x$i \<ge> a}"
|
|
5134 |
using closed_halfspace_ge[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto
|
|
5135 |
|
|
5136 |
text{* Openness of halfspaces. *}
|
|
5137 |
|
|
5138 |
lemma open_halfspace_lt: "open {x. inner a x < b}"
|
|
5139 |
proof-
|
|
5140 |
have "UNIV - {x. b \<le> inner a x} = {x. inner a x < b}" by auto
|
|
5141 |
thus ?thesis using closed_halfspace_ge[unfolded closed_def Compl_eq_Diff_UNIV, of b a] by auto
|
|
5142 |
qed
|
|
5143 |
|
|
5144 |
lemma open_halfspace_gt: "open {x. inner a x > b}"
|
|
5145 |
proof-
|
|
5146 |
have "UNIV - {x. b \<ge> inner a x} = {x. inner a x > b}" by auto
|
|
5147 |
thus ?thesis using closed_halfspace_le[unfolded closed_def Compl_eq_Diff_UNIV, of a b] by auto
|
|
5148 |
qed
|
|
5149 |
|
|
5150 |
lemma open_halfspace_component_lt:
|
|
5151 |
shows "open {x::real^'n::finite. x$i < a}"
|
|
5152 |
using open_halfspace_lt[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto
|
|
5153 |
|
|
5154 |
lemma open_halfspace_component_gt:
|
|
5155 |
shows "open {x::real^'n::finite. x$i > a}"
|
|
5156 |
using open_halfspace_gt[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto
|
|
5157 |
|
|
5158 |
text{* This gives a simple derivation of limit component bounds. *}
|
|
5159 |
|
|
5160 |
lemma Lim_component_le: fixes f :: "'a \<Rightarrow> real^'n::finite"
|
|
5161 |
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. f(x)$i \<le> b) net"
|
|
5162 |
shows "l$i \<le> b"
|
|
5163 |
proof-
|
|
5164 |
{ fix x have "x \<in> {x::real^'n. inner (basis i) x \<le> b} \<longleftrightarrow> x$i \<le> b" unfolding inner_basis by auto } note * = this
|
|
5165 |
show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<le> b}" f net l] unfolding *
|
|
5166 |
using closed_halfspace_le[of "(basis i)::real^'n" b] and assms(1,2,3) by auto
|
|
5167 |
qed
|
|
5168 |
|
|
5169 |
lemma Lim_component_ge: fixes f :: "'a \<Rightarrow> real^'n::finite"
|
|
5170 |
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. b \<le> (f x)$i) net"
|
|
5171 |
shows "b \<le> l$i"
|
|
5172 |
proof-
|
|
5173 |
{ fix x have "x \<in> {x::real^'n. inner (basis i) x \<ge> b} \<longleftrightarrow> x$i \<ge> b" unfolding inner_basis by auto } note * = this
|
|
5174 |
show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<ge> b}" f net l] unfolding *
|
|
5175 |
using closed_halfspace_ge[of b "(basis i)::real^'n"] and assms(1,2,3) by auto
|
|
5176 |
qed
|
|
5177 |
|
|
5178 |
lemma Lim_component_eq: fixes f :: "'a \<Rightarrow> real^'n::finite"
|
|
5179 |
assumes net:"(f ---> l) net" "~(trivial_limit net)" and ev:"eventually (\<lambda>x. f(x)$i = b) net"
|
|
5180 |
shows "l$i = b"
|
|
5181 |
using ev[unfolded order_eq_iff eventually_and] using Lim_component_ge[OF net, of b i] and Lim_component_le[OF net, of i b] by auto
|
|
5182 |
|
|
5183 |
lemma Lim_drop_le: fixes f :: "'a \<Rightarrow> real^1" shows
|
|
5184 |
"(f ---> l) net \<Longrightarrow> ~(trivial_limit net) \<Longrightarrow> eventually (\<lambda>x. dest_vec1 (f x) \<le> b) net ==> dest_vec1 l \<le> b"
|
|
5185 |
using Lim_component_le[of f l net 1 b] unfolding dest_vec1_def by auto
|
|
5186 |
|
|
5187 |
lemma Lim_drop_ge: fixes f :: "'a \<Rightarrow> real^1" shows
|
|
5188 |
"(f ---> l) net \<Longrightarrow> ~(trivial_limit net) \<Longrightarrow> eventually (\<lambda>x. b \<le> dest_vec1 (f x)) net ==> b \<le> dest_vec1 l"
|
|
5189 |
using Lim_component_ge[of f l net b 1] unfolding dest_vec1_def by auto
|
|
5190 |
|
|
5191 |
text{* Limits relative to a union. *}
|
|
5192 |
|
|
5193 |
lemma eventually_within_Un:
|
|
5194 |
"eventually P (net within (s \<union> t)) \<longleftrightarrow>
|
|
5195 |
eventually P (net within s) \<and> eventually P (net within t)"
|
|
5196 |
unfolding Limits.eventually_within
|
|
5197 |
by (auto elim!: eventually_rev_mp)
|
|
5198 |
|
|
5199 |
lemma Lim_within_union:
|
|
5200 |
"(f ---> l) (net within (s \<union> t)) \<longleftrightarrow>
|
|
5201 |
(f ---> l) (net within s) \<and> (f ---> l) (net within t)"
|
|
5202 |
unfolding tendsto_def
|
|
5203 |
by (auto simp add: eventually_within_Un)
|
|
5204 |
|
|
5205 |
lemma continuous_on_union:
|
|
5206 |
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t f"
|
|
5207 |
shows "continuous_on (s \<union> t) f"
|
|
5208 |
using assms unfolding continuous_on unfolding Lim_within_union
|
|
5209 |
unfolding Lim unfolding trivial_limit_within unfolding closed_limpt by auto
|
|
5210 |
|
|
5211 |
lemma continuous_on_cases:
|
|
5212 |
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t g"
|
|
5213 |
"\<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x"
|
|
5214 |
shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
|
|
5215 |
proof-
|
|
5216 |
let ?h = "(\<lambda>x. if P x then f x else g x)"
|
|
5217 |
have "\<forall>x\<in>s. f x = (if P x then f x else g x)" using assms(5) by auto
|
|
5218 |
hence "continuous_on s ?h" using continuous_on_eq[of s f ?h] using assms(3) by auto
|
|
5219 |
moreover
|
|
5220 |
have "\<forall>x\<in>t. g x = (if P x then f x else g x)" using assms(5) by auto
|
|
5221 |
hence "continuous_on t ?h" using continuous_on_eq[of t g ?h] using assms(4) by auto
|
|
5222 |
ultimately show ?thesis using continuous_on_union[OF assms(1,2), of ?h] by auto
|
|
5223 |
qed
|
|
5224 |
|
|
5225 |
|
|
5226 |
text{* Some more convenient intermediate-value theorem formulations. *}
|
|
5227 |
|
|
5228 |
lemma connected_ivt_hyperplane:
|
|
5229 |
assumes "connected s" "x \<in> s" "y \<in> s" "inner a x \<le> b" "b \<le> inner a y"
|
|
5230 |
shows "\<exists>z \<in> s. inner a z = b"
|
|
5231 |
proof(rule ccontr)
|
|
5232 |
assume as:"\<not> (\<exists>z\<in>s. inner a z = b)"
|
|
5233 |
let ?A = "{x. inner a x < b}"
|
|
5234 |
let ?B = "{x. inner a x > b}"
|
|
5235 |
have "open ?A" "open ?B" using open_halfspace_lt and open_halfspace_gt by auto
|
|
5236 |
moreover have "?A \<inter> ?B = {}" by auto
|
|
5237 |
moreover have "s \<subseteq> ?A \<union> ?B" using as by auto
|
|
5238 |
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
|
|
5239 |
qed
|
|
5240 |
|
|
5241 |
lemma connected_ivt_component: fixes x::"real^'n::finite" shows
|
|
5242 |
"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)"
|
|
5243 |
using connected_ivt_hyperplane[of s x y "(basis k)::real^'n" a] by (auto simp add: inner_basis)
|
|
5244 |
|
|
5245 |
text{* Also more convenient formulations of monotone convergence. *}
|
|
5246 |
|
|
5247 |
lemma bounded_increasing_convergent: fixes s::"nat \<Rightarrow> real^1"
|
|
5248 |
assumes "bounded {s n| n::nat. True}" "\<forall>n. dest_vec1(s n) \<le> dest_vec1(s(Suc n))"
|
|
5249 |
shows "\<exists>l. (s ---> l) sequentially"
|
|
5250 |
proof-
|
|
5251 |
obtain a where a:"\<forall>n. \<bar>dest_vec1 (s n)\<bar> \<le> a" using assms(1)[unfolded bounded_iff abs_dest_vec1] by auto
|
|
5252 |
{ fix m::nat
|
|
5253 |
have "\<And> n. n\<ge>m \<longrightarrow> dest_vec1 (s m) \<le> dest_vec1 (s n)"
|
|
5254 |
apply(induct_tac n) apply simp using assms(2) apply(erule_tac x="na" in allE) by(auto simp add: not_less_eq_eq) }
|
|
5255 |
hence "\<forall>m n. m \<le> n \<longrightarrow> dest_vec1 (s m) \<le> dest_vec1 (s n)" by auto
|
|
5256 |
then obtain l where "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<bar>dest_vec1 (s n) - l\<bar> < e" using convergent_bounded_monotone[OF a] unfolding monoseq_def by auto
|
|
5257 |
thus ?thesis unfolding Lim_sequentially apply(rule_tac x="vec1 l" in exI)
|
|
5258 |
unfolding dist_norm unfolding abs_dest_vec1 and dest_vec1_sub by auto
|
|
5259 |
qed
|
|
5260 |
|
|
5261 |
subsection{* Basic homeomorphism definitions. *}
|
|
5262 |
|
|
5263 |
definition "homeomorphism s t f g \<equiv>
|
|
5264 |
(\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and>
|
|
5265 |
(\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g"
|
|
5266 |
|
|
5267 |
definition
|
|
5268 |
homeomorphic :: "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> bool"
|
|
5269 |
(infixr "homeomorphic" 60) where
|
|
5270 |
homeomorphic_def: "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)"
|
|
5271 |
|
|
5272 |
lemma homeomorphic_refl: "s homeomorphic s"
|
|
5273 |
unfolding homeomorphic_def
|
|
5274 |
unfolding homeomorphism_def
|
|
5275 |
using continuous_on_id
|
|
5276 |
apply(rule_tac x = "(\<lambda>x. x)" in exI)
|
|
5277 |
apply(rule_tac x = "(\<lambda>x. x)" in exI)
|
|
5278 |
by blast
|
|
5279 |
|
|
5280 |
lemma homeomorphic_sym:
|
|
5281 |
"s homeomorphic t \<longleftrightarrow> t homeomorphic s"
|
|
5282 |
unfolding homeomorphic_def
|
|
5283 |
unfolding homeomorphism_def
|
33324
|
5284 |
by blast
|
33175
|
5285 |
|
|
5286 |
lemma homeomorphic_trans:
|
|
5287 |
assumes "s homeomorphic t" "t homeomorphic u" shows "s homeomorphic u"
|
|
5288 |
proof-
|
|
5289 |
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"
|
|
5290 |
using assms(1) unfolding homeomorphic_def homeomorphism_def by auto
|
|
5291 |
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"
|
|
5292 |
using assms(2) unfolding homeomorphic_def homeomorphism_def by auto
|
|
5293 |
|
|
5294 |
{ 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 }
|
|
5295 |
moreover have "(f2 \<circ> f1) ` s = u" using fg1(2) fg2(2) by auto
|
|
5296 |
moreover have "continuous_on s (f2 \<circ> f1)" using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto
|
|
5297 |
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 }
|
|
5298 |
moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto
|
|
5299 |
moreover have "continuous_on u (g1 \<circ> g2)" using continuous_on_compose[OF fg2(6)] and fg1(6) unfolding fg2(5) by auto
|
|
5300 |
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
|
|
5301 |
qed
|
|
5302 |
|
|
5303 |
lemma homeomorphic_minimal:
|
|
5304 |
"s homeomorphic t \<longleftrightarrow>
|
|
5305 |
(\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and>
|
|
5306 |
(\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and>
|
|
5307 |
continuous_on s f \<and> continuous_on t g)"
|
|
5308 |
unfolding homeomorphic_def homeomorphism_def
|
|
5309 |
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI)
|
|
5310 |
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) apply auto
|
|
5311 |
unfolding image_iff
|
|
5312 |
apply(erule_tac x="g x" in ballE) apply(erule_tac x="x" in ballE)
|
|
5313 |
apply auto apply(rule_tac x="g x" in bexI) apply auto
|
|
5314 |
apply(erule_tac x="f x" in ballE) apply(erule_tac x="x" in ballE)
|
|
5315 |
apply auto apply(rule_tac x="f x" in bexI) by auto
|
|
5316 |
|
|
5317 |
subsection{* Relatively weak hypotheses if a set is compact. *}
|
|
5318 |
|
|
5319 |
definition "inv_on f s = (\<lambda>x. SOME y. y\<in>s \<and> f y = x)"
|
|
5320 |
|
|
5321 |
lemma assumes "inj_on f s" "x\<in>s"
|
|
5322 |
shows "inv_on f s (f x) = x"
|
|
5323 |
using assms unfolding inj_on_def inv_on_def by auto
|
|
5324 |
|
|
5325 |
lemma homeomorphism_compact:
|
|
5326 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
|
|
5327 |
(* class constraint due to continuous_on_inverse *)
|
|
5328 |
assumes "compact s" "continuous_on s f" "f ` s = t" "inj_on f s"
|
|
5329 |
shows "\<exists>g. homeomorphism s t f g"
|
|
5330 |
proof-
|
|
5331 |
def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x"
|
|
5332 |
have g:"\<forall>x\<in>s. g (f x) = x" using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto
|
|
5333 |
{ fix y assume "y\<in>t"
|
|
5334 |
then obtain x where x:"f x = y" "x\<in>s" using assms(3) by auto
|
|
5335 |
hence "g (f x) = x" using g by auto
|
|
5336 |
hence "f (g y) = y" unfolding x(1)[THEN sym] by auto }
|
|
5337 |
hence g':"\<forall>x\<in>t. f (g x) = x" by auto
|
|
5338 |
moreover
|
|
5339 |
{ fix x
|
|
5340 |
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"])
|
|
5341 |
moreover
|
|
5342 |
{ assume "x\<in>g ` t"
|
|
5343 |
then obtain y where y:"y\<in>t" "g y = x" by auto
|
|
5344 |
then obtain x' where x':"x'\<in>s" "f x' = y" using assms(3) by auto
|
|
5345 |
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 }
|
|
5346 |
ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" by auto }
|
|
5347 |
hence "g ` t = s" by auto
|
|
5348 |
ultimately
|
|
5349 |
show ?thesis unfolding homeomorphism_def homeomorphic_def
|
|
5350 |
apply(rule_tac x=g in exI) using g and assms(3) and continuous_on_inverse[OF assms(2,1), of g, unfolded assms(3)] and assms(2) by auto
|
|
5351 |
qed
|
|
5352 |
|
|
5353 |
lemma homeomorphic_compact:
|
|
5354 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
|
|
5355 |
(* class constraint due to continuous_on_inverse *)
|
|
5356 |
shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s
|
|
5357 |
\<Longrightarrow> s homeomorphic t"
|
|
5358 |
unfolding homeomorphic_def by(metis homeomorphism_compact)
|
|
5359 |
|
|
5360 |
text{* Preservation of topological properties. *}
|
|
5361 |
|
|
5362 |
lemma homeomorphic_compactness:
|
|
5363 |
"s homeomorphic t ==> (compact s \<longleftrightarrow> compact t)"
|
|
5364 |
unfolding homeomorphic_def homeomorphism_def
|
|
5365 |
by (metis compact_continuous_image)
|
|
5366 |
|
|
5367 |
text{* Results on translation, scaling etc. *}
|
|
5368 |
|
|
5369 |
lemma homeomorphic_scaling:
|
|
5370 |
fixes s :: "'a::real_normed_vector set"
|
|
5371 |
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)"
|
|
5372 |
unfolding homeomorphic_minimal
|
|
5373 |
apply(rule_tac x="\<lambda>x. c *\<^sub>R x" in exI)
|
|
5374 |
apply(rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI)
|
|
5375 |
using assms apply auto
|
|
5376 |
using continuous_on_cmul[OF continuous_on_id] by auto
|
|
5377 |
|
|
5378 |
lemma homeomorphic_translation:
|
|
5379 |
fixes s :: "'a::real_normed_vector set"
|
|
5380 |
shows "s homeomorphic ((\<lambda>x. a + x) ` s)"
|
|
5381 |
unfolding homeomorphic_minimal
|
|
5382 |
apply(rule_tac x="\<lambda>x. a + x" in exI)
|
|
5383 |
apply(rule_tac x="\<lambda>x. -a + x" in exI)
|
|
5384 |
using continuous_on_add[OF continuous_on_const continuous_on_id] by auto
|
|
5385 |
|
|
5386 |
lemma homeomorphic_affinity:
|
|
5387 |
fixes s :: "'a::real_normed_vector set"
|
|
5388 |
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)"
|
|
5389 |
proof-
|
|
5390 |
have *:"op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto
|
|
5391 |
show ?thesis
|
|
5392 |
using homeomorphic_trans
|
|
5393 |
using homeomorphic_scaling[OF assms, of s]
|
|
5394 |
using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] unfolding * by auto
|
|
5395 |
qed
|
|
5396 |
|
|
5397 |
lemma homeomorphic_balls:
|
|
5398 |
fixes a b ::"'a::real_normed_vector" (* FIXME: generalize to metric_space *)
|
|
5399 |
assumes "0 < d" "0 < e"
|
|
5400 |
shows "(ball a d) homeomorphic (ball b e)" (is ?th)
|
|
5401 |
"(cball a d) homeomorphic (cball b e)" (is ?cth)
|
|
5402 |
proof-
|
|
5403 |
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto
|
|
5404 |
show ?th unfolding homeomorphic_minimal
|
|
5405 |
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
|
|
5406 |
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
|
|
5407 |
using assms apply (auto simp add: dist_commute)
|
|
5408 |
unfolding dist_norm
|
|
5409 |
apply (auto simp add: pos_divide_less_eq mult_strict_left_mono)
|
|
5410 |
unfolding continuous_on
|
|
5411 |
by (intro ballI tendsto_intros, simp, assumption)+
|
|
5412 |
next
|
|
5413 |
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto
|
|
5414 |
show ?cth unfolding homeomorphic_minimal
|
|
5415 |
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
|
|
5416 |
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
|
|
5417 |
using assms apply (auto simp add: dist_commute)
|
|
5418 |
unfolding dist_norm
|
|
5419 |
apply (auto simp add: pos_divide_le_eq)
|
|
5420 |
unfolding continuous_on
|
|
5421 |
by (intro ballI tendsto_intros, simp, assumption)+
|
|
5422 |
qed
|
|
5423 |
|
|
5424 |
text{* "Isometry" (up to constant bounds) of injective linear map etc. *}
|
|
5425 |
|
|
5426 |
lemma cauchy_isometric:
|
|
5427 |
fixes x :: "nat \<Rightarrow> real ^ 'n::finite"
|
|
5428 |
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)"
|
|
5429 |
shows "Cauchy x"
|
|
5430 |
proof-
|
|
5431 |
interpret f: bounded_linear f by fact
|
|
5432 |
{ fix d::real assume "d>0"
|
|
5433 |
then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d"
|
|
5434 |
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
|
|
5435 |
{ fix n assume "n\<ge>N"
|
|
5436 |
hence "norm (f (x n - x N)) < e * d" using N[THEN spec[where x=n]] unfolding f.diff[THEN sym] by auto
|
|
5437 |
moreover have "e * norm (x n - x N) \<le> norm (f (x n - x N))"
|
|
5438 |
using subspace_sub[OF s, of "x n" "x N"] using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]]
|
|
5439 |
using normf[THEN bspec[where x="x n - x N"]] by auto
|
|
5440 |
ultimately have "norm (x n - x N) < d" using `e>0`
|
|
5441 |
using mult_left_less_imp_less[of e "norm (x n - x N)" d] by auto }
|
|
5442 |
hence "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto }
|
|
5443 |
thus ?thesis unfolding cauchy and dist_norm by auto
|
|
5444 |
qed
|
|
5445 |
|
|
5446 |
lemma complete_isometric_image:
|
|
5447 |
fixes f :: "real ^ _ \<Rightarrow> real ^ _"
|
|
5448 |
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"
|
|
5449 |
shows "complete(f ` s)"
|
|
5450 |
proof-
|
|
5451 |
{ fix g assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
|
33324
|
5452 |
then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)"
|
33175
|
5453 |
using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto
|
|
5454 |
hence x:"\<forall>n. x n \<in> s" "\<forall>n. g n = f (x n)" by auto
|
|
5455 |
hence "f \<circ> x = g" unfolding expand_fun_eq by auto
|
|
5456 |
then obtain l where "l\<in>s" and l:"(x ---> l) sequentially"
|
|
5457 |
using cs[unfolded complete_def, THEN spec[where x="x"]]
|
|
5458 |
using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto
|
|
5459 |
hence "\<exists>l\<in>f ` s. (g ---> l) sequentially"
|
|
5460 |
using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l]
|
|
5461 |
unfolding `f \<circ> x = g` by auto }
|
|
5462 |
thus ?thesis unfolding complete_def by auto
|
|
5463 |
qed
|
|
5464 |
|
|
5465 |
lemma dist_0_norm:
|
|
5466 |
fixes x :: "'a::real_normed_vector"
|
|
5467 |
shows "dist 0 x = norm x"
|
|
5468 |
unfolding dist_norm by simp
|
|
5469 |
|
|
5470 |
lemma injective_imp_isometric: fixes f::"real^'m::finite \<Rightarrow> real^'n::finite"
|
|
5471 |
assumes s:"closed s" "subspace s" and f:"bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)"
|
|
5472 |
shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)"
|
|
5473 |
proof(cases "s \<subseteq> {0::real^'m}")
|
|
5474 |
case True
|
|
5475 |
{ fix x assume "x \<in> s"
|
|
5476 |
hence "x = 0" using True by auto
|
|
5477 |
hence "norm x \<le> norm (f x)" by auto }
|
|
5478 |
thus ?thesis by(auto intro!: exI[where x=1])
|
|
5479 |
next
|
|
5480 |
interpret f: bounded_linear f by fact
|
|
5481 |
case False
|
|
5482 |
then obtain a where a:"a\<noteq>0" "a\<in>s" by auto
|
|
5483 |
from False have "s \<noteq> {}" by auto
|
|
5484 |
let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
|
|
5485 |
let ?S' = "{x::real^'m. x\<in>s \<and> norm x = norm a}"
|
|
5486 |
let ?S'' = "{x::real^'m. norm x = norm a}"
|
|
5487 |
|
|
5488 |
have "?S'' = frontier(cball 0 (norm a))" unfolding frontier_cball and dist_norm by (auto simp add: norm_minus_cancel)
|
|
5489 |
hence "compact ?S''" using compact_frontier[OF compact_cball, of 0 "norm a"] by auto
|
|
5490 |
moreover have "?S' = s \<inter> ?S''" by auto
|
|
5491 |
ultimately have "compact ?S'" using closed_inter_compact[of s ?S''] using s(1) by auto
|
|
5492 |
moreover have *:"f ` ?S' = ?S" by auto
|
|
5493 |
ultimately have "compact ?S" using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto
|
|
5494 |
hence "closed ?S" using compact_imp_closed by auto
|
|
5495 |
moreover have "?S \<noteq> {}" using a by auto
|
|
5496 |
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
|
|
5497 |
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
|
|
5498 |
|
|
5499 |
let ?e = "norm (f b) / norm b"
|
|
5500 |
have "norm b > 0" using ba and a and norm_ge_zero by auto
|
|
5501 |
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
|
|
5502 |
ultimately have "0 < norm (f b) / norm b" by(simp only: divide_pos_pos)
|
|
5503 |
moreover
|
|
5504 |
{ fix x assume "x\<in>s"
|
|
5505 |
hence "norm (f b) / norm b * norm x \<le> norm (f x)"
|
|
5506 |
proof(cases "x=0")
|
|
5507 |
case True thus "norm (f b) / norm b * norm x \<le> norm (f x)" by auto
|
|
5508 |
next
|
|
5509 |
case False
|
|
5510 |
hence *:"0 < norm a / norm x" using `a\<noteq>0` unfolding zero_less_norm_iff[THEN sym] by(simp only: divide_pos_pos)
|
|
5511 |
have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" using s[unfolded subspace_def smult_conv_scaleR] by auto
|
|
5512 |
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
|
|
5513 |
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"]]
|
|
5514 |
unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0`
|
|
5515 |
by (auto simp add: real_mult_commute pos_le_divide_eq pos_divide_le_eq)
|
|
5516 |
qed }
|
|
5517 |
ultimately
|
|
5518 |
show ?thesis by auto
|
|
5519 |
qed
|
|
5520 |
|
|
5521 |
lemma closed_injective_image_subspace:
|
|
5522 |
fixes f :: "real ^ _ \<Rightarrow> real ^ _"
|
|
5523 |
assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 --> x = 0" "closed s"
|
|
5524 |
shows "closed(f ` s)"
|
|
5525 |
proof-
|
|
5526 |
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
|
|
5527 |
show ?thesis using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4)
|
|
5528 |
unfolding complete_eq_closed[THEN sym] by auto
|
|
5529 |
qed
|
|
5530 |
|
|
5531 |
subsection{* Some properties of a canonical subspace. *}
|
|
5532 |
|
|
5533 |
lemma subspace_substandard:
|
|
5534 |
"subspace {x::real^'n. (\<forall>i. P i \<longrightarrow> x$i = 0)}"
|
|
5535 |
unfolding subspace_def by(auto simp add: vector_add_component vector_smult_component elim!: ballE)
|
|
5536 |
|
|
5537 |
lemma closed_substandard:
|
|
5538 |
"closed {x::real^'n::finite. \<forall>i. P i --> x$i = 0}" (is "closed ?A")
|
|
5539 |
proof-
|
|
5540 |
let ?D = "{i. P i}"
|
|
5541 |
let ?Bs = "{{x::real^'n. inner (basis i) x = 0}| i. i \<in> ?D}"
|
|
5542 |
{ fix x
|
|
5543 |
{ assume "x\<in>?A"
|
|
5544 |
hence x:"\<forall>i\<in>?D. x $ i = 0" by auto
|
|
5545 |
hence "x\<in> \<Inter> ?Bs" by(auto simp add: inner_basis x) }
|
|
5546 |
moreover
|
|
5547 |
{ assume x:"x\<in>\<Inter>?Bs"
|
|
5548 |
{ fix i assume i:"i \<in> ?D"
|
|
5549 |
then obtain B where BB:"B \<in> ?Bs" and B:"B = {x::real^'n. inner (basis i) x = 0}" by auto
|
|
5550 |
hence "x $ i = 0" unfolding B using x unfolding inner_basis by auto }
|
|
5551 |
hence "x\<in>?A" by auto }
|
|
5552 |
ultimately have "x\<in>?A \<longleftrightarrow> x\<in> \<Inter>?Bs" by auto }
|
|
5553 |
hence "?A = \<Inter> ?Bs" by auto
|
|
5554 |
thus ?thesis by(auto simp add: closed_Inter closed_hyperplane)
|
|
5555 |
qed
|
|
5556 |
|
|
5557 |
lemma dim_substandard:
|
|
5558 |
shows "dim {x::real^'n::finite. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0} = card d" (is "dim ?A = _")
|
|
5559 |
proof-
|
|
5560 |
let ?D = "UNIV::'n set"
|
|
5561 |
let ?B = "(basis::'n\<Rightarrow>real^'n) ` d"
|
|
5562 |
|
|
5563 |
let ?bas = "basis::'n \<Rightarrow> real^'n"
|
|
5564 |
|
|
5565 |
have "?B \<subseteq> ?A" by auto
|
|
5566 |
|
|
5567 |
moreover
|
|
5568 |
{ fix x::"real^'n" assume "x\<in>?A"
|
|
5569 |
with finite[of d]
|
|
5570 |
have "x\<in> span ?B"
|
|
5571 |
proof(induct d arbitrary: x)
|
|
5572 |
case empty hence "x=0" unfolding Cart_eq by auto
|
|
5573 |
thus ?case using subspace_0[OF subspace_span[of "{}"]] by auto
|
|
5574 |
next
|
|
5575 |
case (insert k F)
|
|
5576 |
hence *:"\<forall>i. i \<notin> insert k F \<longrightarrow> x $ i = 0" by auto
|
|
5577 |
have **:"F \<subseteq> insert k F" by auto
|
|
5578 |
def y \<equiv> "x - x$k *\<^sub>R basis k"
|
|
5579 |
have y:"x = y + (x$k) *\<^sub>R basis k" unfolding y_def by auto
|
|
5580 |
{ fix i assume i':"i \<notin> F"
|
|
5581 |
hence "y $ i = 0" unfolding y_def unfolding vector_minus_component
|
|
5582 |
and vector_smult_component and basis_component
|
|
5583 |
using *[THEN spec[where x=i]] by auto }
|
|
5584 |
hence "y \<in> span (basis ` (insert k F))" using insert(3)
|
|
5585 |
using span_mono[of "?bas ` F" "?bas ` (insert k F)"]
|
|
5586 |
using image_mono[OF **, of basis] by auto
|
|
5587 |
moreover
|
|
5588 |
have "basis k \<in> span (?bas ` (insert k F))" by(rule span_superset, auto)
|
|
5589 |
hence "x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"
|
|
5590 |
using span_mul [where 'a=real, unfolded smult_conv_scaleR] by auto
|
|
5591 |
ultimately
|
|
5592 |
have "y + x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"
|
|
5593 |
using span_add by auto
|
|
5594 |
thus ?case using y by auto
|
|
5595 |
qed
|
|
5596 |
}
|
|
5597 |
hence "?A \<subseteq> span ?B" by auto
|
|
5598 |
|
|
5599 |
moreover
|
|
5600 |
{ fix x assume "x \<in> ?B"
|
|
5601 |
hence "x\<in>{(basis i)::real^'n |i. i \<in> ?D}" using assms by auto }
|
|
5602 |
hence "independent ?B" using independent_mono[OF independent_stdbasis, of ?B] and assms by auto
|
|
5603 |
|
|
5604 |
moreover
|
|
5605 |
have "d \<subseteq> ?D" unfolding subset_eq using assms by auto
|
|
5606 |
hence *:"inj_on (basis::'n\<Rightarrow>real^'n) d" using subset_inj_on[OF basis_inj, of "d"] by auto
|
|
5607 |
have "?B hassize (card d)" unfolding hassize_def and card_image[OF *] by auto
|
|
5608 |
|
|
5609 |
ultimately show ?thesis using dim_unique[of "basis ` d" ?A] by auto
|
|
5610 |
qed
|
|
5611 |
|
|
5612 |
text{* Hence closure and completeness of all subspaces. *}
|
|
5613 |
|
|
5614 |
lemma closed_subspace_lemma: "n \<le> card (UNIV::'n::finite set) \<Longrightarrow> \<exists>A::'n set. card A = n"
|
|
5615 |
apply (induct n)
|
|
5616 |
apply (rule_tac x="{}" in exI, simp)
|
|
5617 |
apply clarsimp
|
|
5618 |
apply (subgoal_tac "\<exists>x. x \<notin> A")
|
|
5619 |
apply (erule exE)
|
|
5620 |
apply (rule_tac x="insert x A" in exI, simp)
|
|
5621 |
apply (subgoal_tac "A \<noteq> UNIV", auto)
|
|
5622 |
done
|
|
5623 |
|
|
5624 |
lemma closed_subspace: fixes s::"(real^'n::finite) set"
|
|
5625 |
assumes "subspace s" shows "closed s"
|
|
5626 |
proof-
|
|
5627 |
have "dim s \<le> card (UNIV :: 'n set)" using dim_subset_univ by auto
|
|
5628 |
then obtain d::"'n set" where t: "card d = dim s"
|
|
5629 |
using closed_subspace_lemma by auto
|
|
5630 |
let ?t = "{x::real^'n. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0}"
|
|
5631 |
obtain f where f:"bounded_linear f" "f ` ?t = s" "inj_on f ?t"
|
|
5632 |
using subspace_isomorphism[unfolded linear_conv_bounded_linear, OF subspace_substandard[of "\<lambda>i. i \<notin> d"] assms]
|
|
5633 |
using dim_substandard[of d] and t by auto
|
|
5634 |
interpret f: bounded_linear f by fact
|
|
5635 |
have "\<forall>x\<in>?t. f x = 0 \<longrightarrow> x = 0" using f.zero using f(3)[unfolded inj_on_def]
|
|
5636 |
by(erule_tac x=0 in ballE) auto
|
|
5637 |
moreover have "closed ?t" using closed_substandard .
|
|
5638 |
moreover have "subspace ?t" using subspace_substandard .
|
|
5639 |
ultimately show ?thesis using closed_injective_image_subspace[of ?t f]
|
|
5640 |
unfolding f(2) using f(1) by auto
|
|
5641 |
qed
|
|
5642 |
|
|
5643 |
lemma complete_subspace:
|
|
5644 |
fixes s :: "(real ^ _) set" shows "subspace s ==> complete s"
|
|
5645 |
using complete_eq_closed closed_subspace
|
|
5646 |
by auto
|
|
5647 |
|
|
5648 |
lemma dim_closure:
|
|
5649 |
fixes s :: "(real ^ _) set"
|
|
5650 |
shows "dim(closure s) = dim s" (is "?dc = ?d")
|
|
5651 |
proof-
|
|
5652 |
have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s]
|
|
5653 |
using closed_subspace[OF subspace_span, of s]
|
|
5654 |
using dim_subset[of "closure s" "span s"] unfolding dim_span by auto
|
|
5655 |
thus ?thesis using dim_subset[OF closure_subset, of s] by auto
|
|
5656 |
qed
|
|
5657 |
|
|
5658 |
text{* Affine transformations of intervals. *}
|
|
5659 |
|
|
5660 |
lemma affinity_inverses:
|
|
5661 |
assumes m0: "m \<noteq> (0::'a::field)"
|
|
5662 |
shows "(\<lambda>x. m *s x + c) o (\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) = id"
|
|
5663 |
"(\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) o (\<lambda>x. m *s x + c) = id"
|
|
5664 |
using m0
|
|
5665 |
apply (auto simp add: expand_fun_eq vector_add_ldistrib vector_smult_assoc)
|
|
5666 |
by (simp add: vector_smult_lneg[symmetric] vector_smult_assoc vector_sneg_minus1[symmetric])
|
|
5667 |
|
|
5668 |
lemma real_affinity_le:
|
|
5669 |
"0 < (m::'a::ordered_field) ==> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))"
|
|
5670 |
by (simp add: field_simps inverse_eq_divide)
|
|
5671 |
|
|
5672 |
lemma real_le_affinity:
|
|
5673 |
"0 < (m::'a::ordered_field) ==> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)"
|
|
5674 |
by (simp add: field_simps inverse_eq_divide)
|
|
5675 |
|
|
5676 |
lemma real_affinity_lt:
|
|
5677 |
"0 < (m::'a::ordered_field) ==> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))"
|
|
5678 |
by (simp add: field_simps inverse_eq_divide)
|
|
5679 |
|
|
5680 |
lemma real_lt_affinity:
|
|
5681 |
"0 < (m::'a::ordered_field) ==> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)"
|
|
5682 |
by (simp add: field_simps inverse_eq_divide)
|
|
5683 |
|
|
5684 |
lemma real_affinity_eq:
|
|
5685 |
"(m::'a::ordered_field) \<noteq> 0 ==> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))"
|
|
5686 |
by (simp add: field_simps inverse_eq_divide)
|
|
5687 |
|
|
5688 |
lemma real_eq_affinity:
|
|
5689 |
"(m::'a::ordered_field) \<noteq> 0 ==> (y = m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) = x)"
|
|
5690 |
by (simp add: field_simps inverse_eq_divide)
|
|
5691 |
|
|
5692 |
lemma vector_affinity_eq:
|
|
5693 |
assumes m0: "(m::'a::field) \<noteq> 0"
|
|
5694 |
shows "m *s x + c = y \<longleftrightarrow> x = inverse m *s y + -(inverse m *s c)"
|
|
5695 |
proof
|
|
5696 |
assume h: "m *s x + c = y"
|
|
5697 |
hence "m *s x = y - c" by (simp add: ring_simps)
|
|
5698 |
hence "inverse m *s (m *s x) = inverse m *s (y - c)" by simp
|
|
5699 |
then show "x = inverse m *s y + - (inverse m *s c)"
|
|
5700 |
using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib)
|
|
5701 |
next
|
|
5702 |
assume h: "x = inverse m *s y + - (inverse m *s c)"
|
|
5703 |
show "m *s x + c = y" unfolding h diff_minus[symmetric]
|
|
5704 |
using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib)
|
|
5705 |
qed
|
|
5706 |
|
|
5707 |
lemma vector_eq_affinity:
|
|
5708 |
"(m::'a::field) \<noteq> 0 ==> (y = m *s x + c \<longleftrightarrow> inverse(m) *s y + -(inverse(m) *s c) = x)"
|
|
5709 |
using vector_affinity_eq[where m=m and x=x and y=y and c=c]
|
|
5710 |
by metis
|
|
5711 |
|
|
5712 |
lemma image_affinity_interval: fixes m::real
|
|
5713 |
fixes a b c :: "real^'n::finite"
|
|
5714 |
shows "(\<lambda>x. m *\<^sub>R x + c) ` {a .. b} =
|
|
5715 |
(if {a .. b} = {} then {}
|
|
5716 |
else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c}
|
|
5717 |
else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))"
|
|
5718 |
proof(cases "m=0")
|
|
5719 |
{ fix x assume "x \<le> c" "c \<le> x"
|
|
5720 |
hence "x=c" unfolding vector_less_eq_def and Cart_eq by (auto intro: order_antisym) }
|
|
5721 |
moreover case True
|
|
5722 |
moreover have "c \<in> {m *\<^sub>R a + c..m *\<^sub>R b + c}" unfolding True by(auto simp add: vector_less_eq_def)
|
|
5723 |
ultimately show ?thesis by auto
|
|
5724 |
next
|
|
5725 |
case False
|
|
5726 |
{ fix y assume "a \<le> y" "y \<le> b" "m > 0"
|
|
5727 |
hence "m *\<^sub>R a + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R b + c"
|
|
5728 |
unfolding vector_less_eq_def by(auto simp add: vector_smult_component vector_add_component)
|
|
5729 |
} moreover
|
|
5730 |
{ fix y assume "a \<le> y" "y \<le> b" "m < 0"
|
|
5731 |
hence "m *\<^sub>R b + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R a + c"
|
|
5732 |
unfolding vector_less_eq_def by(auto simp add: vector_smult_component vector_add_component mult_left_mono_neg elim!:ballE)
|
|
5733 |
} moreover
|
|
5734 |
{ fix y assume "m > 0" "m *\<^sub>R a + c \<le> y" "y \<le> m *\<^sub>R b + c"
|
|
5735 |
hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
|
|
5736 |
unfolding image_iff Bex_def mem_interval vector_less_eq_def
|
|
5737 |
apply(auto simp add: vector_smult_component vector_add_component vector_minus_component vector_smult_assoc pth_3[symmetric]
|
|
5738 |
intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"])
|
|
5739 |
by(auto simp add: pos_le_divide_eq pos_divide_le_eq real_mult_commute diff_le_iff)
|
|
5740 |
} moreover
|
|
5741 |
{ fix y assume "m *\<^sub>R b + c \<le> y" "y \<le> m *\<^sub>R a + c" "m < 0"
|
|
5742 |
hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
|
|
5743 |
unfolding image_iff Bex_def mem_interval vector_less_eq_def
|
|
5744 |
apply(auto simp add: vector_smult_component vector_add_component vector_minus_component vector_smult_assoc pth_3[symmetric]
|
|
5745 |
intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"])
|
|
5746 |
by(auto simp add: neg_le_divide_eq neg_divide_le_eq real_mult_commute diff_le_iff)
|
|
5747 |
}
|
|
5748 |
ultimately show ?thesis using False by auto
|
|
5749 |
qed
|
|
5750 |
|
|
5751 |
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::real^'n::finite)) ` {a..b} =
|
|
5752 |
(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})"
|
|
5753 |
using image_affinity_interval[of m 0 a b] by auto
|
|
5754 |
|
|
5755 |
subsection{* Banach fixed point theorem (not really topological...) *}
|
|
5756 |
|
|
5757 |
lemma banach_fix:
|
|
5758 |
assumes s:"complete s" "s \<noteq> {}" and c:"0 \<le> c" "c < 1" and f:"(f ` s) \<subseteq> s" and
|
|
5759 |
lipschitz:"\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y"
|
|
5760 |
shows "\<exists>! x\<in>s. (f x = x)"
|
|
5761 |
proof-
|
|
5762 |
have "1 - c > 0" using c by auto
|
|
5763 |
|
|
5764 |
from s(2) obtain z0 where "z0 \<in> s" by auto
|
|
5765 |
def z \<equiv> "\<lambda>n. (f ^^ n) z0"
|
|
5766 |
{ fix n::nat
|
|
5767 |
have "z n \<in> s" unfolding z_def
|
|
5768 |
proof(induct n) case 0 thus ?case using `z0 \<in>s` by auto
|
|
5769 |
next case Suc thus ?case using f by auto qed }
|
|
5770 |
note z_in_s = this
|
|
5771 |
|
|
5772 |
def d \<equiv> "dist (z 0) (z 1)"
|
|
5773 |
|
|
5774 |
have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto
|
|
5775 |
{ fix n::nat
|
|
5776 |
have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d"
|
|
5777 |
proof(induct n)
|
|
5778 |
case 0 thus ?case unfolding d_def by auto
|
|
5779 |
next
|
|
5780 |
case (Suc m)
|
|
5781 |
hence "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d"
|
|
5782 |
using `0 \<le> c` using mult_mono1_class.mult_mono1[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by auto
|
|
5783 |
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]
|
|
5784 |
unfolding fzn and mult_le_cancel_left by auto
|
|
5785 |
qed
|
|
5786 |
} note cf_z = this
|
|
5787 |
|
|
5788 |
{ fix n m::nat
|
|
5789 |
have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)"
|
|
5790 |
proof(induct n)
|
|
5791 |
case 0 show ?case by auto
|
|
5792 |
next
|
|
5793 |
case (Suc k)
|
|
5794 |
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))))"
|
|
5795 |
using dist_triangle and c by(auto simp add: dist_triangle)
|
|
5796 |
also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)"
|
|
5797 |
using cf_z[of "m + k"] and c by auto
|
|
5798 |
also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d"
|
|
5799 |
using Suc by (auto simp add: ring_simps)
|
|
5800 |
also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)"
|
|
5801 |
unfolding power_add by (auto simp add: ring_simps)
|
|
5802 |
also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)"
|
|
5803 |
using c by (auto simp add: ring_simps)
|
|
5804 |
finally show ?case by auto
|
|
5805 |
qed
|
|
5806 |
} note cf_z2 = this
|
|
5807 |
{ fix e::real assume "e>0"
|
|
5808 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e"
|
|
5809 |
proof(cases "d = 0")
|
|
5810 |
case True
|
|
5811 |
hence "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def by (auto simp add: pos_prod_le[OF `1 - c > 0`])
|
|
5812 |
thus ?thesis using `e>0` by auto
|
|
5813 |
next
|
|
5814 |
case False hence "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"]
|
|
5815 |
by (metis False d_def real_less_def)
|
|
5816 |
hence "0 < e * (1 - c) / d" using `e>0` and `1-c>0`
|
|
5817 |
using divide_pos_pos[of "e * (1 - c)" d] and mult_pos_pos[of e "1 - c"] by auto
|
|
5818 |
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
|
|
5819 |
{ fix m n::nat assume "m>n" and as:"m\<ge>N" "n\<ge>N"
|
|
5820 |
have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c using power_decreasing[OF `n\<ge>N`, of c] by auto
|
|
5821 |
have "1 - c ^ (m - n) > 0" using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto
|
|
5822 |
hence **:"d * (1 - c ^ (m - n)) / (1 - c) > 0"
|
|
5823 |
using real_mult_order[OF `d>0`, of "1 - c ^ (m - n)"]
|
|
5824 |
using divide_pos_pos[of "d * (1 - c ^ (m - n))" "1 - c"]
|
|
5825 |
using `0 < 1 - c` by auto
|
|
5826 |
|
|
5827 |
have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)"
|
|
5828 |
using cf_z2[of n "m - n"] and `m>n` unfolding pos_le_divide_eq[OF `1-c>0`]
|
|
5829 |
by (auto simp add: real_mult_commute dist_commute)
|
|
5830 |
also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)"
|
|
5831 |
using mult_right_mono[OF * order_less_imp_le[OF **]]
|
|
5832 |
unfolding real_mult_assoc by auto
|
|
5833 |
also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)"
|
|
5834 |
using mult_strict_right_mono[OF N **] unfolding real_mult_assoc by auto
|
|
5835 |
also have "\<dots> = e * (1 - c ^ (m - n))" using c and `d>0` and `1 - c > 0` by auto
|
|
5836 |
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
|
|
5837 |
finally have "dist (z m) (z n) < e" by auto
|
|
5838 |
} note * = this
|
|
5839 |
{ fix m n::nat assume as:"N\<le>m" "N\<le>n"
|
|
5840 |
hence "dist (z n) (z m) < e"
|
|
5841 |
proof(cases "n = m")
|
|
5842 |
case True thus ?thesis using `e>0` by auto
|
|
5843 |
next
|
|
5844 |
case False thus ?thesis using as and *[of n m] *[of m n] unfolding nat_neq_iff by (auto simp add: dist_commute)
|
|
5845 |
qed }
|
|
5846 |
thus ?thesis by auto
|
|
5847 |
qed
|
|
5848 |
}
|
|
5849 |
hence "Cauchy z" unfolding cauchy_def by auto
|
|
5850 |
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
|
|
5851 |
|
|
5852 |
def e \<equiv> "dist (f x) x"
|
|
5853 |
have "e = 0" proof(rule ccontr)
|
|
5854 |
assume "e \<noteq> 0" hence "e>0" unfolding e_def using zero_le_dist[of "f x" x]
|
|
5855 |
by (metis dist_eq_0_iff dist_nz e_def)
|
|
5856 |
then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2"
|
|
5857 |
using x[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
|
|
5858 |
hence N':"dist (z N) x < e / 2" by auto
|
|
5859 |
|
|
5860 |
have *:"c * dist (z N) x \<le> dist (z N) x" unfolding mult_le_cancel_right2
|
|
5861 |
using zero_le_dist[of "z N" x] and c
|
|
5862 |
by (metis dist_eq_0_iff dist_nz order_less_asym real_less_def)
|
|
5863 |
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]]
|
|
5864 |
using z_in_s[of N] `x\<in>s` using c by auto
|
|
5865 |
also have "\<dots> < e / 2" using N' and c using * by auto
|
|
5866 |
finally show False unfolding fzn
|
|
5867 |
using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x]
|
|
5868 |
unfolding e_def by auto
|
|
5869 |
qed
|
|
5870 |
hence "f x = x" unfolding e_def by auto
|
|
5871 |
moreover
|
|
5872 |
{ fix y assume "f y = y" "y\<in>s"
|
|
5873 |
hence "dist x y \<le> c * dist x y" using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]]
|
|
5874 |
using `x\<in>s` and `f x = x` by auto
|
|
5875 |
hence "dist x y = 0" unfolding mult_le_cancel_right1
|
|
5876 |
using c and zero_le_dist[of x y] by auto
|
|
5877 |
hence "y = x" by auto
|
|
5878 |
}
|
|
5879 |
ultimately show ?thesis unfolding Bex1_def using `x\<in>s` by blast+
|
|
5880 |
qed
|
|
5881 |
|
|
5882 |
subsection{* Edelstein fixed point theorem. *}
|
|
5883 |
|
|
5884 |
lemma edelstein_fix:
|
|
5885 |
fixes s :: "'a::real_normed_vector set"
|
|
5886 |
assumes s:"compact s" "s \<noteq> {}" and gs:"(g ` s) \<subseteq> s"
|
|
5887 |
and dist:"\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y"
|
|
5888 |
shows "\<exists>! x\<in>s. g x = x"
|
|
5889 |
proof(cases "\<exists>x\<in>s. g x \<noteq> x")
|
|
5890 |
obtain x where "x\<in>s" using s(2) by auto
|
|
5891 |
case False hence g:"\<forall>x\<in>s. g x = x" by auto
|
|
5892 |
{ fix y assume "y\<in>s"
|
|
5893 |
hence "x = y" using `x\<in>s` and dist[THEN bspec[where x=x], THEN bspec[where x=y]]
|
|
5894 |
unfolding g[THEN bspec[where x=x], OF `x\<in>s`]
|
|
5895 |
unfolding g[THEN bspec[where x=y], OF `y\<in>s`] by auto }
|
|
5896 |
thus ?thesis unfolding Bex1_def using `x\<in>s` and g by blast+
|
|
5897 |
next
|
|
5898 |
case True
|
|
5899 |
then obtain x where [simp]:"x\<in>s" and "g x \<noteq> x" by auto
|
|
5900 |
{ fix x y assume "x \<in> s" "y \<in> s"
|
|
5901 |
hence "dist (g x) (g y) \<le> dist x y"
|
|
5902 |
using dist[THEN bspec[where x=x], THEN bspec[where x=y]] by auto } note dist' = this
|
|
5903 |
def y \<equiv> "g x"
|
|
5904 |
have [simp]:"y\<in>s" unfolding y_def using gs[unfolded image_subset_iff] and `x\<in>s` by blast
|
|
5905 |
def f \<equiv> "\<lambda>n. g ^^ n"
|
|
5906 |
have [simp]:"\<And>n z. g (f n z) = f (Suc n) z" unfolding f_def by auto
|
|
5907 |
have [simp]:"\<And>z. f 0 z = z" unfolding f_def by auto
|
|
5908 |
{ fix n::nat and z assume "z\<in>s"
|
|
5909 |
have "f n z \<in> s" unfolding f_def
|
|
5910 |
proof(induct n)
|
|
5911 |
case 0 thus ?case using `z\<in>s` by simp
|
|
5912 |
next
|
|
5913 |
case (Suc n) thus ?case using gs[unfolded image_subset_iff] by auto
|
|
5914 |
qed } note fs = this
|
|
5915 |
{ fix m n ::nat assume "m\<le>n"
|
|
5916 |
fix w z assume "w\<in>s" "z\<in>s"
|
|
5917 |
have "dist (f n w) (f n z) \<le> dist (f m w) (f m z)" using `m\<le>n`
|
|
5918 |
proof(induct n)
|
|
5919 |
case 0 thus ?case by auto
|
|
5920 |
next
|
|
5921 |
case (Suc n)
|
|
5922 |
thus ?case proof(cases "m\<le>n")
|
|
5923 |
case True thus ?thesis using Suc(1)
|
|
5924 |
using dist'[OF fs fs, OF `w\<in>s` `z\<in>s`, of n n] by auto
|
|
5925 |
next
|
|
5926 |
case False hence mn:"m = Suc n" using Suc(2) by simp
|
|
5927 |
show ?thesis unfolding mn by auto
|
|
5928 |
qed
|
|
5929 |
qed } note distf = this
|
|
5930 |
|
|
5931 |
def h \<equiv> "\<lambda>n. (f n x, f n y)"
|
|
5932 |
let ?s2 = "s \<times> s"
|
|
5933 |
obtain l r where "l\<in>?s2" and r:"subseq r" and lr:"((h \<circ> r) ---> l) sequentially"
|
|
5934 |
using compact_Times [OF s(1) s(1), unfolded compact_def, THEN spec[where x=h]] unfolding h_def
|
|
5935 |
using fs[OF `x\<in>s`] and fs[OF `y\<in>s`] by blast
|
|
5936 |
def a \<equiv> "fst l" def b \<equiv> "snd l"
|
|
5937 |
have lab:"l = (a, b)" unfolding a_def b_def by simp
|
|
5938 |
have [simp]:"a\<in>s" "b\<in>s" unfolding a_def b_def using `l\<in>?s2` by auto
|
|
5939 |
|
|
5940 |
have lima:"((fst \<circ> (h \<circ> r)) ---> a) sequentially"
|
|
5941 |
and limb:"((snd \<circ> (h \<circ> r)) ---> b) sequentially"
|
|
5942 |
using lr
|
|
5943 |
unfolding o_def a_def b_def by (simp_all add: tendsto_intros)
|
|
5944 |
|
|
5945 |
{ fix n::nat
|
|
5946 |
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
|
|
5947 |
{ fix x y :: 'a
|
|
5948 |
have "dist (-x) (-y) = dist x y" unfolding dist_norm
|
|
5949 |
using norm_minus_cancel[of "x - y"] by (auto simp add: uminus_add_conv_diff) } note ** = this
|
|
5950 |
|
|
5951 |
{ assume as:"dist a b > dist (f n x) (f n y)"
|
|
5952 |
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"
|
|
5953 |
and "\<forall>m\<ge>Nb. dist (f (r m) y) b < (dist a b - dist (f n x) (f n y)) / 2"
|
|
5954 |
using lima limb unfolding h_def Lim_sequentially by (fastsimp simp del: less_divide_eq_number_of1)
|
|
5955 |
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)"
|
|
5956 |
apply(erule_tac x="Na+Nb+n" in allE)
|
|
5957 |
apply(erule_tac x="Na+Nb+n" in allE) apply simp
|
|
5958 |
using dist_triangle_add_half[of a "f (r (Na + Nb + n)) x" "dist a b - dist (f n x) (f n y)"
|
|
5959 |
"-b" "- f (r (Na + Nb + n)) y"]
|
|
5960 |
unfolding ** unfolding group_simps(12) by (auto simp add: dist_commute)
|
|
5961 |
moreover
|
|
5962 |
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)"
|
|
5963 |
using distf[of n "r (Na+Nb+n)", OF _ `x\<in>s` `y\<in>s`]
|
|
5964 |
using subseq_bigger[OF r, of "Na+Nb+n"]
|
|
5965 |
using *[of "f (r (Na + Nb + n)) x" "f (r (Na + Nb + n)) y" "f n x" "f n y"] by auto
|
|
5966 |
ultimately have False by simp
|
|
5967 |
}
|
|
5968 |
hence "dist a b \<le> dist (f n x) (f n y)" by(rule ccontr)auto }
|
|
5969 |
note ab_fn = this
|
|
5970 |
|
|
5971 |
have [simp]:"a = b" proof(rule ccontr)
|
|
5972 |
def e \<equiv> "dist a b - dist (g a) (g b)"
|
|
5973 |
assume "a\<noteq>b" hence "e > 0" unfolding e_def using dist by fastsimp
|
|
5974 |
hence "\<exists>n. dist (f n x) a < e/2 \<and> dist (f n y) b < e/2"
|
|
5975 |
using lima limb unfolding Lim_sequentially
|
|
5976 |
apply (auto elim!: allE[where x="e/2"]) apply(rule_tac x="r (max N Na)" in exI) unfolding h_def by fastsimp
|
|
5977 |
then obtain n where n:"dist (f n x) a < e/2 \<and> dist (f n y) b < e/2" by auto
|
|
5978 |
have "dist (f (Suc n) x) (g a) \<le> dist (f n x) a"
|
|
5979 |
using dist[THEN bspec[where x="f n x"], THEN bspec[where x="a"]] and fs by auto
|
|
5980 |
moreover have "dist (f (Suc n) y) (g b) \<le> dist (f n y) b"
|
|
5981 |
using dist[THEN bspec[where x="f n y"], THEN bspec[where x="b"]] and fs by auto
|
|
5982 |
ultimately have "dist (f (Suc n) x) (g a) + dist (f (Suc n) y) (g b) < e" using n by auto
|
|
5983 |
thus False unfolding e_def using ab_fn[of "Suc n"] by norm
|
|
5984 |
qed
|
|
5985 |
|
|
5986 |
have [simp]:"\<And>n. f (Suc n) x = f n y" unfolding f_def y_def by(induct_tac n)auto
|
|
5987 |
{ fix x y assume "x\<in>s" "y\<in>s" moreover
|
|
5988 |
fix e::real assume "e>0" ultimately
|
|
5989 |
have "dist y x < e \<longrightarrow> dist (g y) (g x) < e" using dist by fastsimp }
|
|
5990 |
hence "continuous_on s g" unfolding continuous_on_def by auto
|
|
5991 |
|
|
5992 |
hence "((snd \<circ> h \<circ> r) ---> g a) sequentially" unfolding continuous_on_sequentially
|
|
5993 |
apply (rule allE[where x="\<lambda>n. (fst \<circ> h \<circ> r) n"]) apply (erule ballE[where x=a])
|
|
5994 |
using lima unfolding h_def o_def using fs[OF `x\<in>s`] by (auto simp add: y_def)
|
|
5995 |
hence "g a = a" using Lim_unique[OF trivial_limit_sequentially limb, of "g a"]
|
|
5996 |
unfolding `a=b` and o_assoc by auto
|
|
5997 |
moreover
|
|
5998 |
{ fix x assume "x\<in>s" "g x = x" "x\<noteq>a"
|
|
5999 |
hence "False" using dist[THEN bspec[where x=a], THEN bspec[where x=x]]
|
|
6000 |
using `g a = a` and `a\<in>s` by auto }
|
|
6001 |
ultimately show "\<exists>!x\<in>s. g x = x" unfolding Bex1_def using `a\<in>s` by blast
|
|
6002 |
qed
|
|
6003 |
|
|
6004 |
end
|