author | haftmann |
Tue, 04 May 2010 08:55:43 +0200 | |
changeset 36635 | 080b755377c0 |
parent 36623 | d26348b667f2 |
child 36659 | f794e92784aa |
permissions | -rw-r--r-- |
33714
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
1 |
(* title: HOL/Library/Topology_Euclidian_Space.thy |
33175 | 2 |
Author: Amine Chaieb, University of Cambridge |
3 |
Author: Robert Himmelmann, TU Muenchen |
|
4 |
*) |
|
5 |
||
6 |
header {* Elementary topology in Euclidean space. *} |
|
7 |
||
8 |
theory Topology_Euclidean_Space |
|
36623 | 9 |
imports SEQ Euclidean_Space Glbs |
33175 | 10 |
begin |
11 |
||
12 |
subsection{* General notion of a topology *} |
|
13 |
||
14 |
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)" |
|
15 |
typedef (open) 'a topology = "{L::('a set) set. istopology L}" |
|
16 |
morphisms "openin" "topology" |
|
17 |
unfolding istopology_def by blast |
|
18 |
||
19 |
lemma istopology_open_in[intro]: "istopology(openin U)" |
|
20 |
using openin[of U] by blast |
|
21 |
||
22 |
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U" |
|
23 |
using topology_inverse[unfolded mem_def Collect_def] . |
|
24 |
||
25 |
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U" |
|
26 |
using topology_inverse[of U] istopology_open_in[of "topology U"] by auto |
|
27 |
||
28 |
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)" |
|
29 |
proof- |
|
30 |
{assume "T1=T2" hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp} |
|
31 |
moreover |
|
32 |
{assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" |
|
33 |
hence "openin T1 = openin T2" by (metis mem_def set_ext) |
|
34 |
hence "topology (openin T1) = topology (openin T2)" by simp |
|
35 |
hence "T1 = T2" unfolding openin_inverse .} |
|
36 |
ultimately show ?thesis by blast |
|
37 |
qed |
|
38 |
||
39 |
text{* Infer the "universe" from union of all sets in the topology. *} |
|
40 |
||
41 |
definition "topspace T = \<Union>{S. openin T S}" |
|
42 |
||
43 |
subsection{* Main properties of open sets *} |
|
44 |
||
45 |
lemma openin_clauses: |
|
46 |
fixes U :: "'a topology" |
|
47 |
shows "openin U {}" |
|
48 |
"\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)" |
|
49 |
"\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)" |
|
50 |
using openin[of U] unfolding istopology_def Collect_def mem_def |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
51 |
unfolding subset_eq Ball_def mem_def by auto |
33175 | 52 |
|
53 |
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U" |
|
54 |
unfolding topspace_def by blast |
|
55 |
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses) |
|
56 |
||
57 |
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
58 |
using openin_clauses by simp |
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
59 |
|
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
60 |
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)" |
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
61 |
using openin_clauses by simp |
33175 | 62 |
|
63 |
lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)" |
|
64 |
using openin_Union[of "{S,T}" U] by auto |
|
65 |
||
66 |
lemma openin_topspace[intro, simp]: "openin U (topspace U)" by (simp add: openin_Union topspace_def) |
|
67 |
||
68 |
lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)" (is "?lhs \<longleftrightarrow> ?rhs") |
|
36584 | 69 |
proof |
70 |
assume ?lhs then show ?rhs by auto |
|
71 |
next |
|
72 |
assume H: ?rhs |
|
73 |
let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}" |
|
74 |
have "openin U ?t" by (simp add: openin_Union) |
|
75 |
also have "?t = S" using H by auto |
|
76 |
finally show "openin U S" . |
|
33175 | 77 |
qed |
78 |
||
79 |
subsection{* Closed sets *} |
|
80 |
||
81 |
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)" |
|
82 |
||
83 |
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def) |
|
84 |
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def) |
|
85 |
lemma closedin_topspace[intro,simp]: |
|
86 |
"closedin U (topspace U)" by (simp add: closedin_def) |
|
87 |
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)" |
|
88 |
by (auto simp add: Diff_Un closedin_def) |
|
89 |
||
90 |
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto |
|
91 |
lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S" |
|
92 |
shows "closedin U (\<Inter> K)" using Ke Kc unfolding closedin_def Diff_Inter by auto |
|
93 |
||
94 |
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)" |
|
95 |
using closedin_Inter[of "{S,T}" U] by auto |
|
96 |
||
97 |
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast |
|
98 |
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)" |
|
99 |
apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2) |
|
100 |
apply (metis openin_subset subset_eq) |
|
101 |
done |
|
102 |
||
103 |
lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))" |
|
104 |
by (simp add: openin_closedin_eq) |
|
105 |
||
106 |
lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)" |
|
107 |
proof- |
|
108 |
have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S] oS cT |
|
109 |
by (auto simp add: topspace_def openin_subset) |
|
110 |
then show ?thesis using oS cT by (auto simp add: closedin_def) |
|
111 |
qed |
|
112 |
||
113 |
lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)" |
|
114 |
proof- |
|
115 |
have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S] oS cT |
|
116 |
by (auto simp add: topspace_def ) |
|
117 |
then show ?thesis using oS cT by (auto simp add: openin_closedin_eq) |
|
118 |
qed |
|
119 |
||
120 |
subsection{* Subspace topology. *} |
|
121 |
||
122 |
definition "subtopology U V = topology {S \<inter> V |S. openin U S}" |
|
123 |
||
124 |
lemma istopology_subtopology: "istopology {S \<inter> V |S. openin U S}" (is "istopology ?L") |
|
125 |
proof- |
|
126 |
have "{} \<in> ?L" by blast |
|
127 |
{fix A B assume A: "A \<in> ?L" and B: "B \<in> ?L" |
|
128 |
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 |
|
129 |
have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)" using Sa Sb by blast+ |
|
130 |
then have "A \<inter> B \<in> ?L" by blast} |
|
131 |
moreover |
|
132 |
{fix K assume K: "K \<subseteq> ?L" |
|
133 |
have th0: "?L = (\<lambda>S. S \<inter> V) ` openin U " |
|
134 |
apply (rule set_ext) |
|
135 |
apply (simp add: Ball_def image_iff) |
|
136 |
by (metis mem_def) |
|
137 |
from K[unfolded th0 subset_image_iff] |
|
138 |
obtain Sk where Sk: "Sk \<subseteq> openin U" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast |
|
139 |
have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto |
|
140 |
moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq mem_def) |
|
141 |
ultimately have "\<Union>K \<in> ?L" by blast} |
|
142 |
ultimately show ?thesis unfolding istopology_def by blast |
|
143 |
qed |
|
144 |
||
145 |
lemma openin_subtopology: |
|
146 |
"openin (subtopology U V) S \<longleftrightarrow> (\<exists> T. (openin U T) \<and> (S = T \<inter> V))" |
|
147 |
unfolding subtopology_def topology_inverse'[OF istopology_subtopology] |
|
148 |
by (auto simp add: Collect_def) |
|
149 |
||
150 |
lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V" |
|
151 |
by (auto simp add: topspace_def openin_subtopology) |
|
152 |
||
153 |
lemma closedin_subtopology: |
|
154 |
"closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)" |
|
155 |
unfolding closedin_def topspace_subtopology |
|
156 |
apply (simp add: openin_subtopology) |
|
157 |
apply (rule iffI) |
|
158 |
apply clarify |
|
159 |
apply (rule_tac x="topspace U - T" in exI) |
|
160 |
by auto |
|
161 |
||
162 |
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U" |
|
163 |
unfolding openin_subtopology |
|
164 |
apply (rule iffI, clarify) |
|
165 |
apply (frule openin_subset[of U]) apply blast |
|
166 |
apply (rule exI[where x="topspace U"]) |
|
167 |
by auto |
|
168 |
||
169 |
lemma subtopology_superset: assumes UV: "topspace U \<subseteq> V" |
|
170 |
shows "subtopology U V = U" |
|
171 |
proof- |
|
172 |
{fix S |
|
173 |
{fix T assume T: "openin U T" "S = T \<inter> V" |
|
174 |
from T openin_subset[OF T(1)] UV have eq: "S = T" by blast |
|
175 |
have "openin U S" unfolding eq using T by blast} |
|
176 |
moreover |
|
177 |
{assume S: "openin U S" |
|
178 |
hence "\<exists>T. openin U T \<and> S = T \<inter> V" |
|
179 |
using openin_subset[OF S] UV by auto} |
|
180 |
ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" by blast} |
|
181 |
then show ?thesis unfolding topology_eq openin_subtopology by blast |
|
182 |
qed |
|
183 |
||
184 |
||
185 |
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U" |
|
186 |
by (simp add: subtopology_superset) |
|
187 |
||
188 |
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U" |
|
189 |
by (simp add: subtopology_superset) |
|
190 |
||
191 |
subsection{* The universal Euclidean versions are what we use most of the time *} |
|
192 |
||
193 |
definition |
|
194 |
euclidean :: "'a::topological_space topology" where |
|
195 |
"euclidean = topology open" |
|
196 |
||
197 |
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S" |
|
198 |
unfolding euclidean_def |
|
199 |
apply (rule cong[where x=S and y=S]) |
|
200 |
apply (rule topology_inverse[symmetric]) |
|
201 |
apply (auto simp add: istopology_def) |
|
202 |
by (auto simp add: mem_def subset_eq) |
|
203 |
||
204 |
lemma topspace_euclidean: "topspace euclidean = UNIV" |
|
205 |
apply (simp add: topspace_def) |
|
206 |
apply (rule set_ext) |
|
207 |
by (auto simp add: open_openin[symmetric]) |
|
208 |
||
209 |
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S" |
|
210 |
by (simp add: topspace_euclidean topspace_subtopology) |
|
211 |
||
212 |
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S" |
|
213 |
by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV) |
|
214 |
||
215 |
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)" |
|
216 |
by (simp add: open_openin openin_subopen[symmetric]) |
|
217 |
||
218 |
subsection{* Open and closed balls. *} |
|
219 |
||
220 |
definition |
|
221 |
ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where |
|
222 |
"ball x e = {y. dist x y < e}" |
|
223 |
||
224 |
definition |
|
225 |
cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where |
|
226 |
"cball x e = {y. dist x y \<le> e}" |
|
227 |
||
228 |
lemma mem_ball[simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" by (simp add: ball_def) |
|
229 |
lemma mem_cball[simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" by (simp add: cball_def) |
|
230 |
||
231 |
lemma mem_ball_0 [simp]: |
|
232 |
fixes x :: "'a::real_normed_vector" |
|
233 |
shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e" |
|
234 |
by (simp add: dist_norm) |
|
235 |
||
236 |
lemma mem_cball_0 [simp]: |
|
237 |
fixes x :: "'a::real_normed_vector" |
|
238 |
shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e" |
|
239 |
by (simp add: dist_norm) |
|
240 |
||
241 |
lemma centre_in_cball[simp]: "x \<in> cball x e \<longleftrightarrow> 0\<le> e" by simp |
|
242 |
lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq) |
|
243 |
lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq) |
|
244 |
lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq) |
|
245 |
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s" |
|
246 |
by (simp add: expand_set_eq) arith |
|
247 |
||
248 |
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s" |
|
249 |
by (simp add: expand_set_eq) |
|
250 |
||
251 |
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b" |
|
252 |
"(a::real) - b < 0 \<longleftrightarrow> a < b" |
|
253 |
"a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+ |
|
254 |
lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b" |
|
255 |
"a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b" by arith+ |
|
256 |
||
257 |
lemma open_ball[intro, simp]: "open (ball x e)" |
|
258 |
unfolding open_dist ball_def Collect_def Ball_def mem_def |
|
259 |
unfolding dist_commute |
|
260 |
apply clarify |
|
261 |
apply (rule_tac x="e - dist xa x" in exI) |
|
262 |
using dist_triangle_alt[where z=x] |
|
263 |
apply (clarsimp simp add: diff_less_iff) |
|
264 |
apply atomize |
|
265 |
apply (erule_tac x="y" in allE) |
|
266 |
apply (erule_tac x="xa" in allE) |
|
267 |
by arith |
|
268 |
||
269 |
lemma centre_in_ball[simp]: "x \<in> ball x e \<longleftrightarrow> e > 0" by (metis mem_ball dist_self) |
|
270 |
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)" |
|
271 |
unfolding open_dist subset_eq mem_ball Ball_def dist_commute .. |
|
272 |
||
33714
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
273 |
lemma openE[elim?]: |
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
274 |
assumes "open S" "x\<in>S" |
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
275 |
obtains e where "e>0" "ball x e \<subseteq> S" |
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
276 |
using assms unfolding open_contains_ball by auto |
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
277 |
|
33175 | 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 |
||
34105 | 381 |
lemma exists_diff: |
382 |
fixes P :: "'a set \<Rightarrow> bool" |
|
383 |
shows "(\<exists>S. P(- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs") |
|
33175 | 384 |
proof- |
385 |
{assume "?lhs" hence ?rhs by blast } |
|
386 |
moreover |
|
387 |
{fix S assume H: "P S" |
|
34105 | 388 |
have "S = - (- S)" by auto |
389 |
with H have "P (- (- S))" by metis } |
|
33175 | 390 |
ultimately show ?thesis by metis |
391 |
qed |
|
392 |
||
393 |
lemma connected_clopen: "connected S \<longleftrightarrow> |
|
394 |
(\<forall>T. openin (subtopology euclidean S) T \<and> |
|
395 |
closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs") |
|
396 |
proof- |
|
34105 | 397 |
have " \<not> connected S \<longleftrightarrow> (\<exists>e1 e2. open e1 \<and> open (- e2) \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})" |
33175 | 398 |
unfolding connected_def openin_open closedin_closed |
399 |
apply (subst exists_diff) by blast |
|
34105 | 400 |
hence th0: "connected S \<longleftrightarrow> \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})" |
401 |
(is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis |
|
33175 | 402 |
|
403 |
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'))" |
|
404 |
(is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)") |
|
405 |
unfolding connected_def openin_open closedin_closed by auto |
|
406 |
{fix e2 |
|
407 |
{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)" |
|
408 |
by auto} |
|
409 |
then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis} |
|
410 |
then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast |
|
411 |
then show ?thesis unfolding th0 th1 by simp |
|
412 |
qed |
|
413 |
||
414 |
lemma connected_empty[simp, intro]: "connected {}" |
|
415 |
by (simp add: connected_def) |
|
416 |
||
417 |
subsection{* Hausdorff and other separation properties *} |
|
418 |
||
419 |
class t0_space = |
|
420 |
assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)" |
|
421 |
||
422 |
class t1_space = |
|
423 |
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" |
|
424 |
begin |
|
425 |
||
426 |
subclass t0_space |
|
427 |
proof |
|
428 |
qed (fast dest: t1_space) |
|
429 |
||
430 |
end |
|
431 |
||
432 |
text {* T2 spaces are also known as Hausdorff spaces. *} |
|
433 |
||
434 |
class t2_space = |
|
435 |
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 = {}" |
|
436 |
begin |
|
437 |
||
438 |
subclass t1_space |
|
439 |
proof |
|
440 |
qed (fast dest: hausdorff) |
|
441 |
||
442 |
end |
|
443 |
||
444 |
instance metric_space \<subseteq> t2_space |
|
445 |
proof |
|
446 |
fix x y :: "'a::metric_space" |
|
447 |
assume xy: "x \<noteq> y" |
|
448 |
let ?U = "ball x (dist x y / 2)" |
|
449 |
let ?V = "ball y (dist x y / 2)" |
|
450 |
have th0: "\<And>d x y z. (d x z :: real) <= d x y + d y z \<Longrightarrow> d y z = d z y |
|
451 |
==> ~(d x y * 2 < d x z \<and> d z y * 2 < d x z)" by arith |
|
452 |
have "open ?U \<and> open ?V \<and> x \<in> ?U \<and> y \<in> ?V \<and> ?U \<inter> ?V = {}" |
|
453 |
using dist_pos_lt[OF xy] th0[of dist,OF dist_triangle dist_commute] |
|
454 |
by (auto simp add: expand_set_eq) |
|
455 |
then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}" |
|
456 |
by blast |
|
457 |
qed |
|
458 |
||
459 |
lemma separation_t2: |
|
460 |
fixes x y :: "'a::t2_space" |
|
461 |
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 = {})" |
|
462 |
using hausdorff[of x y] by blast |
|
463 |
||
464 |
lemma separation_t1: |
|
465 |
fixes x y :: "'a::t1_space" |
|
466 |
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)" |
|
467 |
using t1_space[of x y] by blast |
|
468 |
||
469 |
lemma separation_t0: |
|
470 |
fixes x y :: "'a::t0_space" |
|
471 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> ~(x\<in>U \<longleftrightarrow> y\<in>U))" |
|
472 |
using t0_space[of x y] by blast |
|
473 |
||
474 |
subsection{* Limit points *} |
|
475 |
||
476 |
definition |
|
477 |
islimpt:: "'a::topological_space \<Rightarrow> 'a set \<Rightarrow> bool" |
|
478 |
(infixr "islimpt" 60) where |
|
479 |
"x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))" |
|
480 |
||
481 |
lemma islimptI: |
|
482 |
assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x" |
|
483 |
shows "x islimpt S" |
|
484 |
using assms unfolding islimpt_def by auto |
|
485 |
||
486 |
lemma islimptE: |
|
487 |
assumes "x islimpt S" and "x \<in> T" and "open T" |
|
488 |
obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x" |
|
489 |
using assms unfolding islimpt_def by auto |
|
490 |
||
491 |
lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T ==> x islimpt T" by (auto simp add: islimpt_def) |
|
492 |
||
493 |
lemma islimpt_approachable: |
|
494 |
fixes x :: "'a::metric_space" |
|
495 |
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)" |
|
496 |
unfolding islimpt_def |
|
497 |
apply auto |
|
498 |
apply(erule_tac x="ball x e" in allE) |
|
499 |
apply auto |
|
500 |
apply(rule_tac x=y in bexI) |
|
501 |
apply (auto simp add: dist_commute) |
|
502 |
apply (simp add: open_dist, drule (1) bspec) |
|
503 |
apply (clarify, drule spec, drule (1) mp, auto) |
|
504 |
done |
|
505 |
||
506 |
lemma islimpt_approachable_le: |
|
507 |
fixes x :: "'a::metric_space" |
|
508 |
shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)" |
|
509 |
unfolding islimpt_approachable |
|
510 |
using approachable_lt_le[where f="\<lambda>x'. dist x' x" and P="\<lambda>x'. \<not> (x'\<in>S \<and> x'\<noteq>x)"] |
|
33324 | 511 |
by metis |
33175 | 512 |
|
513 |
class perfect_space = |
|
514 |
(* FIXME: perfect_space should inherit from topological_space *) |
|
515 |
assumes islimpt_UNIV [simp, intro]: "(x::'a::metric_space) islimpt UNIV" |
|
516 |
||
517 |
lemma perfect_choose_dist: |
|
518 |
fixes x :: "'a::perfect_space" |
|
519 |
shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r" |
|
520 |
using islimpt_UNIV [of x] |
|
521 |
by (simp add: islimpt_approachable) |
|
522 |
||
523 |
instance real :: perfect_space |
|
524 |
apply default |
|
525 |
apply (rule islimpt_approachable [THEN iffD2]) |
|
526 |
apply (clarify, rule_tac x="x + e/2" in bexI) |
|
527 |
apply (auto simp add: dist_norm) |
|
528 |
done |
|
529 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
530 |
instance cart :: (perfect_space, finite) perfect_space |
33175 | 531 |
proof |
532 |
fix x :: "'a ^ 'b" |
|
533 |
{ |
|
534 |
fix e :: real assume "0 < e" |
|
535 |
def a \<equiv> "x $ undefined" |
|
536 |
have "a islimpt UNIV" by (rule islimpt_UNIV) |
|
537 |
with `0 < e` obtain b where "b \<noteq> a" and "dist b a < e" |
|
538 |
unfolding islimpt_approachable by auto |
|
539 |
def y \<equiv> "Cart_lambda ((Cart_nth x)(undefined := b))" |
|
540 |
from `b \<noteq> a` have "y \<noteq> x" |
|
541 |
unfolding a_def y_def by (simp add: Cart_eq) |
|
542 |
from `dist b a < e` have "dist y x < e" |
|
543 |
unfolding dist_vector_def a_def y_def |
|
544 |
apply simp |
|
545 |
apply (rule le_less_trans [OF setL2_le_setsum [OF zero_le_dist]]) |
|
546 |
apply (subst setsum_diff1' [where a=undefined], simp, simp, simp) |
|
547 |
done |
|
548 |
from `y \<noteq> x` and `dist y x < e` |
|
549 |
have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto |
|
550 |
} |
|
551 |
then show "x islimpt UNIV" unfolding islimpt_approachable by blast |
|
552 |
qed |
|
553 |
||
554 |
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)" |
|
555 |
unfolding closed_def |
|
556 |
apply (subst open_subopen) |
|
34105 | 557 |
apply (simp add: islimpt_def subset_eq) |
558 |
by (metis ComplE ComplI insertCI insert_absorb mem_def) |
|
33175 | 559 |
|
560 |
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}" |
|
561 |
unfolding islimpt_def by auto |
|
562 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
563 |
lemma closed_positive_orthant: "closed {x::real^'n. \<forall>i. 0 \<le>x$i}" |
33175 | 564 |
proof- |
565 |
let ?U = "UNIV :: 'n set" |
|
566 |
let ?O = "{x::real^'n. \<forall>i. x$i\<ge>0}" |
|
567 |
{fix x:: "real^'n" and i::'n assume H: "\<forall>e>0. \<exists>x'\<in>?O. x' \<noteq> x \<and> dist x' x < e" |
|
568 |
and xi: "x$i < 0" |
|
569 |
from xi have th0: "-x$i > 0" by arith |
|
570 |
from H[rule_format, OF th0] obtain x' where x': "x' \<in>?O" "x' \<noteq> x" "dist x' x < -x $ i" by blast |
|
571 |
have th:" \<And>b a (x::real). abs x <= b \<Longrightarrow> b <= a ==> ~(a + x < 0)" by arith |
|
572 |
have th': "\<And>x (y::real). x < 0 \<Longrightarrow> 0 <= y ==> abs x <= abs (y - x)" by arith |
|
573 |
have th1: "\<bar>x$i\<bar> \<le> \<bar>(x' - x)$i\<bar>" using x'(1) xi |
|
574 |
apply (simp only: vector_component) |
|
575 |
by (rule th') auto |
|
576 |
have th2: "\<bar>dist x x'\<bar> \<ge> \<bar>(x' - x)$i\<bar>" using component_le_norm[of "x'-x" i] |
|
577 |
apply (simp add: dist_norm) by norm |
|
578 |
from th[OF th1 th2] x'(3) have False by (simp add: dist_commute) } |
|
579 |
then show ?thesis unfolding closed_limpt islimpt_approachable |
|
580 |
unfolding not_le[symmetric] by blast |
|
581 |
qed |
|
582 |
||
583 |
lemma finite_set_avoid: |
|
584 |
fixes a :: "'a::metric_space" |
|
585 |
assumes fS: "finite S" shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x" |
|
586 |
proof(induct rule: finite_induct[OF fS]) |
|
587 |
case 1 thus ?case apply auto by ferrack |
|
588 |
next |
|
589 |
case (2 x F) |
|
590 |
from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast |
|
591 |
{assume "x = a" hence ?case using d by auto } |
|
592 |
moreover |
|
593 |
{assume xa: "x\<noteq>a" |
|
594 |
let ?d = "min d (dist a x)" |
|
595 |
have dp: "?d > 0" using xa d(1) using dist_nz by auto |
|
596 |
from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto |
|
597 |
with dp xa have ?case by(auto intro!: exI[where x="?d"]) } |
|
598 |
ultimately show ?case by blast |
|
599 |
qed |
|
600 |
||
601 |
lemma islimpt_finite: |
|
602 |
fixes S :: "'a::metric_space set" |
|
603 |
assumes fS: "finite S" shows "\<not> a islimpt S" |
|
604 |
unfolding islimpt_approachable |
|
605 |
using finite_set_avoid[OF fS, of a] by (metis dist_commute not_le) |
|
606 |
||
607 |
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T" |
|
608 |
apply (rule iffI) |
|
609 |
defer |
|
610 |
apply (metis Un_upper1 Un_upper2 islimpt_subset) |
|
611 |
unfolding islimpt_def |
|
612 |
apply (rule ccontr, clarsimp, rename_tac A B) |
|
613 |
apply (drule_tac x="A \<inter> B" in spec) |
|
614 |
apply (auto simp add: open_Int) |
|
615 |
done |
|
616 |
||
617 |
lemma discrete_imp_closed: |
|
618 |
fixes S :: "'a::metric_space set" |
|
619 |
assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x" |
|
620 |
shows "closed S" |
|
621 |
proof- |
|
622 |
{fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" |
|
623 |
from e have e2: "e/2 > 0" by arith |
|
624 |
from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast |
|
625 |
let ?m = "min (e/2) (dist x y) " |
|
626 |
from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym]) |
|
627 |
from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast |
|
628 |
have th: "dist z y < e" using z y |
|
629 |
by (intro dist_triangle_lt [where z=x], simp) |
|
630 |
from d[rule_format, OF y(1) z(1) th] y z |
|
631 |
have False by (auto simp add: dist_commute)} |
|
632 |
then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a]) |
|
633 |
qed |
|
634 |
||
635 |
subsection{* Interior of a Set *} |
|
636 |
definition "interior S = {x. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S}" |
|
637 |
||
638 |
lemma interior_eq: "interior S = S \<longleftrightarrow> open S" |
|
639 |
apply (simp add: expand_set_eq interior_def) |
|
640 |
apply (subst (2) open_subopen) by (safe, blast+) |
|
641 |
||
642 |
lemma interior_open: "open S ==> (interior S = S)" by (metis interior_eq) |
|
643 |
||
644 |
lemma interior_empty[simp]: "interior {} = {}" by (simp add: interior_def) |
|
645 |
||
646 |
lemma open_interior[simp, intro]: "open(interior S)" |
|
647 |
apply (simp add: interior_def) |
|
648 |
apply (subst open_subopen) by blast |
|
649 |
||
650 |
lemma interior_interior[simp]: "interior(interior S) = interior S" by (metis interior_eq open_interior) |
|
651 |
lemma interior_subset: "interior S \<subseteq> S" by (auto simp add: interior_def) |
|
652 |
lemma subset_interior: "S \<subseteq> T ==> (interior S) \<subseteq> (interior T)" by (auto simp add: interior_def) |
|
653 |
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T ==> T \<subseteq> (interior S)" by (auto simp add: interior_def) |
|
654 |
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" |
|
655 |
by (metis equalityI interior_maximal interior_subset open_interior) |
|
656 |
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e. 0 < e \<and> ball x e \<subseteq> S)" |
|
657 |
apply (simp add: interior_def) |
|
658 |
by (metis open_contains_ball centre_in_ball open_ball subset_trans) |
|
659 |
||
660 |
lemma open_subset_interior: "open S ==> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T" |
|
661 |
by (metis interior_maximal interior_subset subset_trans) |
|
662 |
||
663 |
lemma interior_inter[simp]: "interior(S \<inter> T) = interior S \<inter> interior T" |
|
664 |
apply (rule equalityI, simp) |
|
665 |
apply (metis Int_lower1 Int_lower2 subset_interior) |
|
666 |
by (metis Int_mono interior_subset open_Int open_interior open_subset_interior) |
|
667 |
||
668 |
lemma interior_limit_point [intro]: |
|
669 |
fixes x :: "'a::perfect_space" |
|
670 |
assumes x: "x \<in> interior S" shows "x islimpt S" |
|
671 |
proof- |
|
672 |
from x obtain e where e: "e>0" "\<forall>x'. dist x x' < e \<longrightarrow> x' \<in> S" |
|
673 |
unfolding mem_interior subset_eq Ball_def mem_ball by blast |
|
674 |
{ |
|
675 |
fix d::real assume d: "d>0" |
|
676 |
let ?m = "min d e" |
|
677 |
have mde2: "0 < ?m" using e(1) d(1) by simp |
|
678 |
from perfect_choose_dist [OF mde2, of x] |
|
679 |
obtain y where "y \<noteq> x" and "dist y x < ?m" by blast |
|
680 |
then have "dist y x < e" "dist y x < d" by simp_all |
|
681 |
from `dist y x < e` e(2) have "y \<in> S" by (simp add: dist_commute) |
|
682 |
have "\<exists>x'\<in>S. x'\<noteq> x \<and> dist x' x < d" |
|
683 |
using `y \<in> S` `y \<noteq> x` `dist y x < d` by fast |
|
684 |
} |
|
685 |
then show ?thesis unfolding islimpt_approachable by blast |
|
686 |
qed |
|
687 |
||
688 |
lemma interior_closed_Un_empty_interior: |
|
689 |
assumes cS: "closed S" and iT: "interior T = {}" |
|
690 |
shows "interior(S \<union> T) = interior S" |
|
691 |
proof |
|
692 |
show "interior S \<subseteq> interior (S\<union>T)" |
|
693 |
by (rule subset_interior, blast) |
|
694 |
next |
|
695 |
show "interior (S \<union> T) \<subseteq> interior S" |
|
696 |
proof |
|
697 |
fix x assume "x \<in> interior (S \<union> T)" |
|
698 |
then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" |
|
699 |
unfolding interior_def by fast |
|
700 |
show "x \<in> interior S" |
|
701 |
proof (rule ccontr) |
|
702 |
assume "x \<notin> interior S" |
|
703 |
with `x \<in> R` `open R` obtain y where "y \<in> R - S" |
|
704 |
unfolding interior_def expand_set_eq by fast |
|
705 |
from `open R` `closed S` have "open (R - S)" by (rule open_Diff) |
|
706 |
from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast |
|
707 |
from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}` |
|
708 |
show "False" unfolding interior_def by fast |
|
709 |
qed |
|
710 |
qed |
|
711 |
qed |
|
712 |
||
713 |
||
714 |
subsection{* Closure of a Set *} |
|
715 |
||
716 |
definition "closure S = S \<union> {x | x. x islimpt S}" |
|
717 |
||
34105 | 718 |
lemma closure_interior: "closure S = - interior (- S)" |
33175 | 719 |
proof- |
720 |
{ fix x |
|
34105 | 721 |
have "x\<in>- interior (- S) \<longleftrightarrow> x \<in> closure S" (is "?lhs = ?rhs") |
33175 | 722 |
proof |
34105 | 723 |
let ?exT = "\<lambda> y. (\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> - S)" |
33175 | 724 |
assume "?lhs" |
725 |
hence *:"\<not> ?exT x" |
|
726 |
unfolding interior_def |
|
727 |
by simp |
|
728 |
{ assume "\<not> ?rhs" |
|
729 |
hence False using * |
|
730 |
unfolding closure_def islimpt_def |
|
731 |
by blast |
|
732 |
} |
|
733 |
thus "?rhs" |
|
734 |
by blast |
|
735 |
next |
|
736 |
assume "?rhs" thus "?lhs" |
|
737 |
unfolding closure_def interior_def islimpt_def |
|
738 |
by blast |
|
739 |
qed |
|
740 |
} |
|
741 |
thus ?thesis |
|
742 |
by blast |
|
743 |
qed |
|
744 |
||
34105 | 745 |
lemma interior_closure: "interior S = - (closure (- S))" |
33175 | 746 |
proof- |
747 |
{ fix x |
|
34105 | 748 |
have "x \<in> interior S \<longleftrightarrow> x \<in> - (closure (- S))" |
33175 | 749 |
unfolding interior_def closure_def islimpt_def |
33324 | 750 |
by auto |
33175 | 751 |
} |
752 |
thus ?thesis |
|
753 |
by blast |
|
754 |
qed |
|
755 |
||
756 |
lemma closed_closure[simp, intro]: "closed (closure S)" |
|
757 |
proof- |
|
34105 | 758 |
have "closed (- interior (-S))" by blast |
33175 | 759 |
thus ?thesis using closure_interior[of S] by simp |
760 |
qed |
|
761 |
||
762 |
lemma closure_hull: "closure S = closed hull S" |
|
763 |
proof- |
|
764 |
have "S \<subseteq> closure S" |
|
765 |
unfolding closure_def |
|
766 |
by blast |
|
767 |
moreover |
|
768 |
have "closed (closure S)" |
|
769 |
using closed_closure[of S] |
|
770 |
by assumption |
|
771 |
moreover |
|
772 |
{ fix t |
|
773 |
assume *:"S \<subseteq> t" "closed t" |
|
774 |
{ fix x |
|
775 |
assume "x islimpt S" |
|
776 |
hence "x islimpt t" using *(1) |
|
777 |
using islimpt_subset[of x, of S, of t] |
|
778 |
by blast |
|
779 |
} |
|
780 |
with * have "closure S \<subseteq> t" |
|
781 |
unfolding closure_def |
|
782 |
using closed_limpt[of t] |
|
783 |
by auto |
|
784 |
} |
|
785 |
ultimately show ?thesis |
|
786 |
using hull_unique[of S, of "closure S", of closed] |
|
787 |
unfolding mem_def |
|
788 |
by simp |
|
789 |
qed |
|
790 |
||
791 |
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S" |
|
792 |
unfolding closure_hull |
|
793 |
using hull_eq[of closed, unfolded mem_def, OF closed_Inter, of S] |
|
794 |
by (metis mem_def subset_eq) |
|
795 |
||
796 |
lemma closure_closed[simp]: "closed S \<Longrightarrow> closure S = S" |
|
797 |
using closure_eq[of S] |
|
798 |
by simp |
|
799 |
||
800 |
lemma closure_closure[simp]: "closure (closure S) = closure S" |
|
801 |
unfolding closure_hull |
|
802 |
using hull_hull[of closed S] |
|
803 |
by assumption |
|
804 |
||
805 |
lemma closure_subset: "S \<subseteq> closure S" |
|
806 |
unfolding closure_hull |
|
807 |
using hull_subset[of S closed] |
|
808 |
by assumption |
|
809 |
||
810 |
lemma subset_closure: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T" |
|
811 |
unfolding closure_hull |
|
812 |
using hull_mono[of S T closed] |
|
813 |
by assumption |
|
814 |
||
815 |
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T" |
|
816 |
using hull_minimal[of S T closed] |
|
817 |
unfolding closure_hull mem_def |
|
818 |
by simp |
|
819 |
||
820 |
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" |
|
821 |
using hull_unique[of S T closed] |
|
822 |
unfolding closure_hull mem_def |
|
823 |
by simp |
|
824 |
||
825 |
lemma closure_empty[simp]: "closure {} = {}" |
|
826 |
using closed_empty closure_closed[of "{}"] |
|
827 |
by simp |
|
828 |
||
829 |
lemma closure_univ[simp]: "closure UNIV = UNIV" |
|
830 |
using closure_closed[of UNIV] |
|
831 |
by simp |
|
832 |
||
833 |
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}" |
|
834 |
using closure_empty closure_subset[of S] |
|
835 |
by blast |
|
836 |
||
837 |
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S" |
|
838 |
using closure_eq[of S] closure_subset[of S] |
|
839 |
by simp |
|
840 |
||
841 |
lemma open_inter_closure_eq_empty: |
|
842 |
"open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}" |
|
34105 | 843 |
using open_subset_interior[of S "- T"] |
844 |
using interior_subset[of "- T"] |
|
33175 | 845 |
unfolding closure_interior |
846 |
by auto |
|
847 |
||
848 |
lemma open_inter_closure_subset: |
|
849 |
"open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)" |
|
850 |
proof |
|
851 |
fix x |
|
852 |
assume as: "open S" "x \<in> S \<inter> closure T" |
|
853 |
{ assume *:"x islimpt T" |
|
854 |
have "x islimpt (S \<inter> T)" |
|
855 |
proof (rule islimptI) |
|
856 |
fix A |
|
857 |
assume "x \<in> A" "open A" |
|
858 |
with as have "x \<in> A \<inter> S" "open (A \<inter> S)" |
|
859 |
by (simp_all add: open_Int) |
|
860 |
with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x" |
|
861 |
by (rule islimptE) |
|
862 |
hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x" |
|
863 |
by simp_all |
|
864 |
thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" .. |
|
865 |
qed |
|
866 |
} |
|
867 |
then show "x \<in> closure (S \<inter> T)" using as |
|
868 |
unfolding closure_def |
|
869 |
by blast |
|
870 |
qed |
|
871 |
||
34105 | 872 |
lemma closure_complement: "closure(- S) = - interior(S)" |
33175 | 873 |
proof- |
34105 | 874 |
have "S = - (- S)" |
33175 | 875 |
by auto |
876 |
thus ?thesis |
|
877 |
unfolding closure_interior |
|
878 |
by auto |
|
879 |
qed |
|
880 |
||
34105 | 881 |
lemma interior_complement: "interior(- S) = - closure(S)" |
33175 | 882 |
unfolding closure_interior |
883 |
by blast |
|
884 |
||
885 |
subsection{* Frontier (aka boundary) *} |
|
886 |
||
887 |
definition "frontier S = closure S - interior S" |
|
888 |
||
889 |
lemma frontier_closed: "closed(frontier S)" |
|
890 |
by (simp add: frontier_def closed_Diff) |
|
891 |
||
34105 | 892 |
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))" |
33175 | 893 |
by (auto simp add: frontier_def interior_closure) |
894 |
||
895 |
lemma frontier_straddle: |
|
896 |
fixes a :: "'a::metric_space" |
|
897 |
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") |
|
898 |
proof |
|
899 |
assume "?lhs" |
|
900 |
{ fix e::real |
|
901 |
assume "e > 0" |
|
902 |
let ?rhse = "(\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)" |
|
903 |
{ assume "a\<in>S" |
|
904 |
have "\<exists>x\<in>S. dist a x < e" using `e>0` `a\<in>S` by(rule_tac x=a in bexI) auto |
|
905 |
moreover have "\<exists>x. x \<notin> S \<and> dist a x < e" using `?lhs` `a\<in>S` |
|
906 |
unfolding frontier_closures closure_def islimpt_def using `e>0` |
|
907 |
by (auto, erule_tac x="ball a e" in allE, auto) |
|
908 |
ultimately have ?rhse by auto |
|
909 |
} |
|
910 |
moreover |
|
911 |
{ assume "a\<notin>S" |
|
912 |
hence ?rhse using `?lhs` |
|
913 |
unfolding frontier_closures closure_def islimpt_def |
|
914 |
using open_ball[of a e] `e > 0` |
|
33324 | 915 |
by simp (metis centre_in_ball mem_ball open_ball) |
33175 | 916 |
} |
917 |
ultimately have ?rhse by auto |
|
918 |
} |
|
919 |
thus ?rhs by auto |
|
920 |
next |
|
921 |
assume ?rhs |
|
922 |
moreover |
|
923 |
{ fix T assume "a\<notin>S" and |
|
924 |
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" |
|
925 |
from `open T` `a \<in> T` have "\<exists>e>0. ball a e \<subseteq> T" unfolding open_contains_ball[of T] by auto |
|
926 |
then obtain e where "e>0" "ball a e \<subseteq> T" by auto |
|
927 |
then obtain y where y:"y\<in>S" "dist a y < e" using as(1) by auto |
|
928 |
have "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> a" |
|
929 |
using `dist a y < e` `ball a e \<subseteq> T` unfolding ball_def using `y\<in>S` `a\<notin>S` by auto |
|
930 |
} |
|
931 |
hence "a \<in> closure S" unfolding closure_def islimpt_def using `?rhs` by auto |
|
932 |
moreover |
|
933 |
{ fix T assume "a \<in> T" "open T" "a\<in>S" |
|
934 |
then obtain e where "e>0" and balle: "ball a e \<subseteq> T" unfolding open_contains_ball using `?rhs` by auto |
|
935 |
obtain x where "x \<notin> S" "dist a x < e" using `?rhs` using `e>0` by auto |
|
34105 | 936 |
hence "\<exists>y\<in>- S. y \<in> T \<and> y \<noteq> a" using balle `a\<in>S` unfolding ball_def by (rule_tac x=x in bexI)auto |
33175 | 937 |
} |
34105 | 938 |
hence "a islimpt (- S) \<or> a\<notin>S" unfolding islimpt_def by auto |
939 |
ultimately show ?lhs unfolding frontier_closures using closure_def[of "- S"] by auto |
|
33175 | 940 |
qed |
941 |
||
942 |
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S" |
|
943 |
by (metis frontier_def closure_closed Diff_subset) |
|
944 |
||
34964 | 945 |
lemma frontier_empty[simp]: "frontier {} = {}" |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
946 |
by (simp add: frontier_def) |
33175 | 947 |
|
948 |
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S" |
|
949 |
proof- |
|
950 |
{ assume "frontier S \<subseteq> S" |
|
951 |
hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto |
|
952 |
hence "closed S" using closure_subset_eq by auto |
|
953 |
} |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
954 |
thus ?thesis using frontier_subset_closed[of S] .. |
33175 | 955 |
qed |
956 |
||
34105 | 957 |
lemma frontier_complement: "frontier(- S) = frontier S" |
33175 | 958 |
by (auto simp add: frontier_def closure_complement interior_complement) |
959 |
||
960 |
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S" |
|
34105 | 961 |
using frontier_complement frontier_subset_eq[of "- S"] |
962 |
unfolding open_closed by auto |
|
33175 | 963 |
|
36437 | 964 |
subsection {* Nets and the ``eventually true'' quantifier *} |
965 |
||
966 |
text {* Common nets and The "within" modifier for nets. *} |
|
33175 | 967 |
|
968 |
definition |
|
969 |
at_infinity :: "'a::real_normed_vector net" where |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
970 |
"at_infinity = Abs_net (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)" |
33175 | 971 |
|
972 |
definition |
|
973 |
indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a net" (infixr "indirection" 70) where |
|
974 |
"a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}" |
|
975 |
||
976 |
text{* Prove That They are all nets. *} |
|
977 |
||
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
978 |
lemma eventually_at_infinity: |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
979 |
"eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)" |
33175 | 980 |
unfolding at_infinity_def |
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
981 |
proof (rule eventually_Abs_net, rule is_filter.intro) |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
982 |
fix P Q :: "'a \<Rightarrow> bool" |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
983 |
assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x" |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
984 |
then obtain r s where |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
985 |
"\<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<forall>x. s \<le> norm x \<longrightarrow> Q x" by auto |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
986 |
then have "\<forall>x. max r s \<le> norm x \<longrightarrow> P x \<and> Q x" by simp |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
987 |
then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x \<and> Q x" .. |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
988 |
qed auto |
33175 | 989 |
|
36437 | 990 |
text {* Identify Trivial limits, where we can't approach arbitrarily closely. *} |
33175 | 991 |
|
992 |
definition |
|
993 |
trivial_limit :: "'a net \<Rightarrow> bool" where |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
994 |
"trivial_limit net \<longleftrightarrow> eventually (\<lambda>x. False) net" |
33175 | 995 |
|
996 |
lemma trivial_limit_within: |
|
997 |
shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S" |
|
998 |
proof |
|
999 |
assume "trivial_limit (at a within S)" |
|
1000 |
thus "\<not> a islimpt S" |
|
1001 |
unfolding trivial_limit_def |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1002 |
unfolding eventually_within eventually_at_topological |
33175 | 1003 |
unfolding islimpt_def |
1004 |
apply (clarsimp simp add: expand_set_eq) |
|
1005 |
apply (rename_tac T, rule_tac x=T in exI) |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1006 |
apply (clarsimp, drule_tac x=y in bspec, simp_all) |
33175 | 1007 |
done |
1008 |
next |
|
1009 |
assume "\<not> a islimpt S" |
|
1010 |
thus "trivial_limit (at a within S)" |
|
1011 |
unfolding trivial_limit_def |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1012 |
unfolding eventually_within eventually_at_topological |
33175 | 1013 |
unfolding islimpt_def |
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1014 |
apply clarsimp |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1015 |
apply (rule_tac x=T in exI) |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1016 |
apply auto |
33175 | 1017 |
done |
1018 |
qed |
|
1019 |
||
1020 |
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV" |
|
1021 |
using trivial_limit_within [of a UNIV] |
|
1022 |
by (simp add: within_UNIV) |
|
1023 |
||
1024 |
lemma trivial_limit_at: |
|
1025 |
fixes a :: "'a::perfect_space" |
|
1026 |
shows "\<not> trivial_limit (at a)" |
|
1027 |
by (simp add: trivial_limit_at_iff) |
|
1028 |
||
1029 |
lemma trivial_limit_at_infinity: |
|
1030 |
"\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,zero_neq_one}) net)" |
|
1031 |
(* FIXME: find a more appropriate type class *) |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1032 |
unfolding trivial_limit_def eventually_at_infinity |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1033 |
apply clarsimp |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1034 |
apply (rule_tac x="scaleR b (sgn 1)" in exI) |
33175 | 1035 |
apply (simp add: norm_sgn) |
1036 |
done |
|
1037 |
||
34964 | 1038 |
lemma trivial_limit_sequentially[intro]: "\<not> trivial_limit sequentially" |
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1039 |
by (auto simp add: trivial_limit_def eventually_sequentially) |
33175 | 1040 |
|
36437 | 1041 |
text {* Some property holds "sufficiently close" to the limit point. *} |
33175 | 1042 |
|
1043 |
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *) |
|
1044 |
"eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)" |
|
1045 |
unfolding eventually_at dist_nz by auto |
|
1046 |
||
1047 |
lemma eventually_within: "eventually P (at a within S) \<longleftrightarrow> |
|
1048 |
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)" |
|
1049 |
unfolding eventually_within eventually_at dist_nz by auto |
|
1050 |
||
1051 |
lemma eventually_within_le: "eventually P (at a within S) \<longleftrightarrow> |
|
1052 |
(\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" (is "?lhs = ?rhs") |
|
1053 |
unfolding eventually_within |
|
33324 | 1054 |
by auto (metis Rats_dense_in_nn_real order_le_less_trans order_refl) |
33175 | 1055 |
|
1056 |
lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)" |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1057 |
unfolding trivial_limit_def |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1058 |
by (auto elim: eventually_rev_mp) |
33175 | 1059 |
|
1060 |
lemma always_eventually: "(\<forall>x. P x) ==> eventually P net" |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1061 |
proof - |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1062 |
assume "\<forall>x. P x" hence "P = (\<lambda>x. True)" by (simp add: ext) |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1063 |
thus "eventually P net" by simp |
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1064 |
qed |
33175 | 1065 |
|
1066 |
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net" |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1067 |
unfolding trivial_limit_def by (auto elim: eventually_rev_mp) |
33175 | 1068 |
|
1069 |
lemma eventually_False: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net" |
|
36358
246493d61204
define nets directly as filters, instead of as filter bases
huffman
parents:
36336
diff
changeset
|
1070 |
unfolding trivial_limit_def .. |
33175 | 1071 |
|
1072 |
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)" |
|
1073 |
apply (safe elim!: trivial_limit_eventually) |
|
1074 |
apply (simp add: eventually_False [symmetric]) |
|
1075 |
done |
|
1076 |
||
1077 |
text{* Combining theorems for "eventually" *} |
|
1078 |
||
1079 |
lemma eventually_conjI: |
|
1080 |
"\<lbrakk>eventually (\<lambda>x. P x) net; eventually (\<lambda>x. Q x) net\<rbrakk> |
|
1081 |
\<Longrightarrow> eventually (\<lambda>x. P x \<and> Q x) net" |
|
1082 |
by (rule eventually_conj) |
|
1083 |
||
1084 |
lemma eventually_rev_mono: |
|
1085 |
"eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net" |
|
1086 |
using eventually_mono [of P Q] by fast |
|
1087 |
||
1088 |
lemma eventually_and: " eventually (\<lambda>x. P x \<and> Q x) net \<longleftrightarrow> eventually P net \<and> eventually Q net" |
|
1089 |
by (auto intro!: eventually_conjI elim: eventually_rev_mono) |
|
1090 |
||
1091 |
lemma eventually_false: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net" |
|
1092 |
by (auto simp add: eventually_False) |
|
1093 |
||
1094 |
lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)" |
|
1095 |
by (simp add: eventually_False) |
|
1096 |
||
36437 | 1097 |
subsection {* Limits *} |
33175 | 1098 |
|
1099 |
text{* Notation Lim to avoid collition with lim defined in analysis *} |
|
1100 |
definition |
|
1101 |
Lim :: "'a net \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b" where |
|
1102 |
"Lim net f = (THE l. (f ---> l) net)" |
|
1103 |
||
1104 |
lemma Lim: |
|
1105 |
"(f ---> l) net \<longleftrightarrow> |
|
1106 |
trivial_limit net \<or> |
|
1107 |
(\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)" |
|
1108 |
unfolding tendsto_iff trivial_limit_eq by auto |
|
1109 |
||
1110 |
||
1111 |
text{* Show that they yield usual definitions in the various cases. *} |
|
1112 |
||
1113 |
lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow> |
|
1114 |
(\<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)" |
|
1115 |
by (auto simp add: tendsto_iff eventually_within_le) |
|
1116 |
||
1117 |
lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow> |
|
1118 |
(\<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)" |
|
1119 |
by (auto simp add: tendsto_iff eventually_within) |
|
1120 |
||
1121 |
lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow> |
|
1122 |
(\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)" |
|
1123 |
by (auto simp add: tendsto_iff eventually_at) |
|
1124 |
||
1125 |
lemma Lim_at_iff_LIM: "(f ---> l) (at a) \<longleftrightarrow> f -- a --> l" |
|
1126 |
unfolding Lim_at LIM_def by (simp only: zero_less_dist_iff) |
|
1127 |
||
1128 |
lemma Lim_at_infinity: |
|
1129 |
"(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)" |
|
1130 |
by (auto simp add: tendsto_iff eventually_at_infinity) |
|
1131 |
||
1132 |
lemma Lim_sequentially: |
|
1133 |
"(S ---> l) sequentially \<longleftrightarrow> |
|
1134 |
(\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (S n) l < e)" |
|
1135 |
by (auto simp add: tendsto_iff eventually_sequentially) |
|
1136 |
||
1137 |
lemma Lim_sequentially_iff_LIMSEQ: "(S ---> l) sequentially \<longleftrightarrow> S ----> l" |
|
1138 |
unfolding Lim_sequentially LIMSEQ_def .. |
|
1139 |
||
1140 |
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net" |
|
1141 |
by (rule topological_tendstoI, auto elim: eventually_rev_mono) |
|
1142 |
||
1143 |
text{* The expected monotonicity property. *} |
|
1144 |
||
1145 |
lemma Lim_within_empty: "(f ---> l) (net within {})" |
|
1146 |
unfolding tendsto_def Limits.eventually_within by simp |
|
1147 |
||
1148 |
lemma Lim_within_subset: "(f ---> l) (net within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f ---> l) (net within T)" |
|
1149 |
unfolding tendsto_def Limits.eventually_within |
|
1150 |
by (auto elim!: eventually_elim1) |
|
1151 |
||
1152 |
lemma Lim_Un: assumes "(f ---> l) (net within S)" "(f ---> l) (net within T)" |
|
1153 |
shows "(f ---> l) (net within (S \<union> T))" |
|
1154 |
using assms unfolding tendsto_def Limits.eventually_within |
|
1155 |
apply clarify |
|
1156 |
apply (drule spec, drule (1) mp, drule (1) mp) |
|
1157 |
apply (drule spec, drule (1) mp, drule (1) mp) |
|
1158 |
apply (auto elim: eventually_elim2) |
|
1159 |
done |
|
1160 |
||
1161 |
lemma Lim_Un_univ: |
|
1162 |
"(f ---> l) (net within S) \<Longrightarrow> (f ---> l) (net within T) \<Longrightarrow> S \<union> T = UNIV |
|
1163 |
==> (f ---> l) net" |
|
1164 |
by (metis Lim_Un within_UNIV) |
|
1165 |
||
1166 |
text{* Interrelations between restricted and unrestricted limits. *} |
|
1167 |
||
1168 |
lemma Lim_at_within: "(f ---> l) net ==> (f ---> l)(net within S)" |
|
1169 |
(* FIXME: rename *) |
|
1170 |
unfolding tendsto_def Limits.eventually_within |
|
1171 |
apply (clarify, drule spec, drule (1) mp, drule (1) mp) |
|
1172 |
by (auto elim!: eventually_elim1) |
|
1173 |
||
1174 |
lemma Lim_within_open: |
|
1175 |
fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space" |
|
1176 |
assumes"a \<in> S" "open S" |
|
1177 |
shows "(f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)" (is "?lhs \<longleftrightarrow> ?rhs") |
|
1178 |
proof |
|
1179 |
assume ?lhs |
|
1180 |
{ fix A assume "open A" "l \<in> A" |
|
1181 |
with `?lhs` have "eventually (\<lambda>x. f x \<in> A) (at a within S)" |
|
1182 |
by (rule topological_tendstoD) |
|
1183 |
hence "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x \<in> A) (at a)" |
|
1184 |
unfolding Limits.eventually_within . |
|
1185 |
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" |
|
1186 |
unfolding eventually_at_topological by fast |
|
1187 |
hence "open (T \<inter> S)" "a \<in> T \<inter> S" "\<forall>x\<in>(T \<inter> S). x \<noteq> a \<longrightarrow> f x \<in> A" |
|
1188 |
using assms by auto |
|
1189 |
hence "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. x \<noteq> a \<longrightarrow> f x \<in> A)" |
|
1190 |
by fast |
|
1191 |
hence "eventually (\<lambda>x. f x \<in> A) (at a)" |
|
1192 |
unfolding eventually_at_topological . |
|
1193 |
} |
|
1194 |
thus ?rhs by (rule topological_tendstoI) |
|
1195 |
next |
|
1196 |
assume ?rhs |
|
1197 |
thus ?lhs by (rule Lim_at_within) |
|
1198 |
qed |
|
1199 |
||
1200 |
text{* Another limit point characterization. *} |
|
1201 |
||
1202 |
lemma islimpt_sequential: |
|
1203 |
fixes x :: "'a::metric_space" (* FIXME: generalize to topological_space *) |
|
1204 |
shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)" |
|
1205 |
(is "?lhs = ?rhs") |
|
1206 |
proof |
|
1207 |
assume ?lhs |
|
1208 |
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" |
|
1209 |
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 |
|
1210 |
{ fix n::nat |
|
1211 |
have "f (inverse (real n + 1)) \<in> S - {x}" using f by auto |
|
1212 |
} |
|
1213 |
moreover |
|
1214 |
{ fix e::real assume "e>0" |
|
1215 |
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 |
|
1216 |
then obtain N::nat where "inverse (real (N + 1)) < e" by auto |
|
1217 |
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) |
|
1218 |
moreover have "\<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < (inverse (real n + 1))" using f `e>0` by auto |
|
1219 |
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 |
|
1220 |
} |
|
1221 |
hence " ((\<lambda>n. f (inverse (real n + 1))) ---> x) sequentially" |
|
1222 |
unfolding Lim_sequentially using f by auto |
|
1223 |
ultimately show ?rhs apply (rule_tac x="(\<lambda>n::nat. f (inverse (real n + 1)))" in exI) by auto |
|
1224 |
next |
|
1225 |
assume ?rhs |
|
1226 |
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 |
|
1227 |
{ fix e::real assume "e>0" |
|
1228 |
then obtain N where "dist (f N) x < e" using f(2) by auto |
|
1229 |
moreover have "f N\<in>S" "f N \<noteq> x" using f(1) by auto |
|
1230 |
ultimately have "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" by auto |
|
1231 |
} |
|
1232 |
thus ?lhs unfolding islimpt_approachable by auto |
|
1233 |
qed |
|
1234 |
||
1235 |
text{* Basic arithmetical combining theorems for limits. *} |
|
1236 |
||
1237 |
lemma Lim_linear: |
|
1238 |
assumes "(f ---> l) net" "bounded_linear h" |
|
1239 |
shows "((\<lambda>x. h (f x)) ---> h l) net" |
|
1240 |
using `bounded_linear h` `(f ---> l) net` |
|
1241 |
by (rule bounded_linear.tendsto) |
|
1242 |
||
1243 |
lemma Lim_ident_at: "((\<lambda>x. x) ---> a) (at a)" |
|
1244 |
unfolding tendsto_def Limits.eventually_at_topological by fast |
|
1245 |
||
34964 | 1246 |
lemma Lim_const[intro]: "((\<lambda>x. a) ---> a) net" by (rule tendsto_const) |
1247 |
||
1248 |
lemma Lim_cmul[intro]: |
|
33175 | 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 |
||
36437 | 1267 |
lemma Lim_mul: |
1268 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1269 |
assumes "(c ---> d) net" "(f ---> l) net" |
|
1270 |
shows "((\<lambda>x. c(x) *\<^sub>R f x) ---> (d *\<^sub>R l)) net" |
|
1271 |
using assms by (rule scaleR.tendsto) |
|
1272 |
||
1273 |
lemma Lim_inv: |
|
1274 |
fixes f :: "'a \<Rightarrow> real" |
|
1275 |
assumes "(f ---> l) (net::'a net)" "l \<noteq> 0" |
|
1276 |
shows "((inverse o f) ---> inverse l) net" |
|
1277 |
unfolding o_def using assms by (rule tendsto_inverse) |
|
1278 |
||
1279 |
lemma Lim_vmul: |
|
1280 |
fixes c :: "'a \<Rightarrow> real" and v :: "'b::real_normed_vector" |
|
1281 |
shows "(c ---> d) net ==> ((\<lambda>x. c(x) *\<^sub>R v) ---> d *\<^sub>R v) net" |
|
1282 |
by (intro tendsto_intros) |
|
1283 |
||
33175 | 1284 |
lemma Lim_null: |
1285 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1286 |
shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net" by (simp add: Lim dist_norm) |
|
1287 |
||
1288 |
lemma Lim_null_norm: |
|
1289 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1290 |
shows "(f ---> 0) net \<longleftrightarrow> ((\<lambda>x. norm(f x)) ---> 0) net" |
|
1291 |
by (simp add: Lim dist_norm) |
|
1292 |
||
1293 |
lemma Lim_null_comparison: |
|
1294 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1295 |
assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net" |
|
1296 |
shows "(f ---> 0) net" |
|
1297 |
proof(simp add: tendsto_iff, rule+) |
|
1298 |
fix e::real assume "0<e" |
|
1299 |
{ fix x |
|
1300 |
assume "norm (f x) \<le> g x" "dist (g x) 0 < e" |
|
1301 |
hence "dist (f x) 0 < e" by (simp add: dist_norm) |
|
1302 |
} |
|
1303 |
thus "eventually (\<lambda>x. dist (f x) 0 < e) net" |
|
1304 |
using eventually_and[of "\<lambda>x. norm(f x) <= g x" "\<lambda>x. dist (g x) 0 < e" net] |
|
1305 |
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] |
|
1306 |
using assms `e>0` unfolding tendsto_iff by auto |
|
1307 |
qed |
|
1308 |
||
1309 |
lemma Lim_component: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
1310 |
fixes f :: "'a \<Rightarrow> 'b::metric_space ^ 'n" |
33175 | 1311 |
shows "(f ---> l) net \<Longrightarrow> ((\<lambda>a. f a $i) ---> l$i) net" |
1312 |
unfolding tendsto_iff |
|
1313 |
apply (clarify) |
|
1314 |
apply (drule spec, drule (1) mp) |
|
1315 |
apply (erule eventually_elim1) |
|
1316 |
apply (erule le_less_trans [OF dist_nth_le]) |
|
1317 |
done |
|
1318 |
||
1319 |
lemma Lim_transform_bound: |
|
1320 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1321 |
fixes g :: "'a \<Rightarrow> 'c::real_normed_vector" |
|
1322 |
assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net" "(g ---> 0) net" |
|
1323 |
shows "(f ---> 0) net" |
|
1324 |
proof (rule tendstoI) |
|
1325 |
fix e::real assume "e>0" |
|
1326 |
{ fix x |
|
1327 |
assume "norm (f x) \<le> norm (g x)" "dist (g x) 0 < e" |
|
1328 |
hence "dist (f x) 0 < e" by (simp add: dist_norm)} |
|
1329 |
thus "eventually (\<lambda>x. dist (f x) 0 < e) net" |
|
1330 |
using eventually_and[of "\<lambda>x. norm (f x) \<le> norm (g x)" "\<lambda>x. dist (g x) 0 < e" net] |
|
1331 |
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] |
|
1332 |
using assms `e>0` unfolding tendsto_iff by blast |
|
1333 |
qed |
|
1334 |
||
1335 |
text{* Deducing things about the limit from the elements. *} |
|
1336 |
||
1337 |
lemma Lim_in_closed_set: |
|
1338 |
assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) net" "\<not>(trivial_limit net)" "(f ---> l) net" |
|
1339 |
shows "l \<in> S" |
|
1340 |
proof (rule ccontr) |
|
1341 |
assume "l \<notin> S" |
|
1342 |
with `closed S` have "open (- S)" "l \<in> - S" |
|
1343 |
by (simp_all add: open_Compl) |
|
1344 |
with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net" |
|
1345 |
by (rule topological_tendstoD) |
|
1346 |
with assms(2) have "eventually (\<lambda>x. False) net" |
|
1347 |
by (rule eventually_elim2) simp |
|
1348 |
with assms(3) show "False" |
|
1349 |
by (simp add: eventually_False) |
|
1350 |
qed |
|
1351 |
||
1352 |
text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *} |
|
1353 |
||
1354 |
lemma Lim_dist_ubound: |
|
1355 |
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. dist a (f x) <= e) net" |
|
1356 |
shows "dist a l <= e" |
|
1357 |
proof (rule ccontr) |
|
1358 |
assume "\<not> dist a l \<le> e" |
|
1359 |
then have "0 < dist a l - e" by simp |
|
1360 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < dist a l - e) net" |
|
1361 |
by (rule tendstoD) |
|
1362 |
with assms(3) have "eventually (\<lambda>x. dist a (f x) \<le> e \<and> dist (f x) l < dist a l - e) net" |
|
1363 |
by (rule eventually_conjI) |
|
1364 |
then obtain w where "dist a (f w) \<le> e" "dist (f w) l < dist a l - e" |
|
1365 |
using assms(1) eventually_happens by auto |
|
1366 |
hence "dist a (f w) + dist (f w) l < e + (dist a l - e)" |
|
1367 |
by (rule add_le_less_mono) |
|
1368 |
hence "dist a (f w) + dist (f w) l < dist a l" |
|
1369 |
by simp |
|
1370 |
also have "\<dots> \<le> dist a (f w) + dist (f w) l" |
|
1371 |
by (rule dist_triangle) |
|
1372 |
finally show False by simp |
|
1373 |
qed |
|
1374 |
||
1375 |
lemma Lim_norm_ubound: |
|
1376 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1377 |
assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) <= e) net" |
|
1378 |
shows "norm(l) <= e" |
|
1379 |
proof (rule ccontr) |
|
1380 |
assume "\<not> norm l \<le> e" |
|
1381 |
then have "0 < norm l - e" by simp |
|
1382 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < norm l - e) net" |
|
1383 |
by (rule tendstoD) |
|
1384 |
with assms(3) have "eventually (\<lambda>x. norm (f x) \<le> e \<and> dist (f x) l < norm l - e) net" |
|
1385 |
by (rule eventually_conjI) |
|
1386 |
then obtain w where "norm (f w) \<le> e" "dist (f w) l < norm l - e" |
|
1387 |
using assms(1) eventually_happens by auto |
|
1388 |
hence "norm (f w - l) < norm l - e" "norm (f w) \<le> e" by (simp_all add: dist_norm) |
|
1389 |
hence "norm (f w - l) + norm (f w) < norm l" by simp |
|
1390 |
hence "norm (f w - l - f w) < norm l" by (rule le_less_trans [OF norm_triangle_ineq4]) |
|
1391 |
thus False using `\<not> norm l \<le> e` by simp |
|
1392 |
qed |
|
1393 |
||
1394 |
lemma Lim_norm_lbound: |
|
1395 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
1396 |
assumes "\<not> (trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. e <= norm(f x)) net" |
|
1397 |
shows "e \<le> norm l" |
|
1398 |
proof (rule ccontr) |
|
1399 |
assume "\<not> e \<le> norm l" |
|
1400 |
then have "0 < e - norm l" by simp |
|
1401 |
with assms(2) have "eventually (\<lambda>x. dist (f x) l < e - norm l) net" |
|
1402 |
by (rule tendstoD) |
|
1403 |
with assms(3) have "eventually (\<lambda>x. e \<le> norm (f x) \<and> dist (f x) l < e - norm l) net" |
|
1404 |
by (rule eventually_conjI) |
|
1405 |
then obtain w where "e \<le> norm (f w)" "dist (f w) l < e - norm l" |
|
1406 |
using assms(1) eventually_happens by auto |
|
1407 |
hence "norm (f w - l) + norm l < e" "e \<le> norm (f w)" by (simp_all add: dist_norm) |
|
1408 |
hence "norm (f w - l) + norm l < norm (f w)" by (rule less_le_trans) |
|
1409 |
hence "norm (f w - l + l) < norm (f w)" by (rule le_less_trans [OF norm_triangle_ineq]) |
|
1410 |
thus False by simp |
|
1411 |
qed |
|
1412 |
||
1413 |
text{* Uniqueness of the limit, when nontrivial. *} |
|
1414 |
||
1415 |
lemma Lim_unique: |
|
1416 |
fixes f :: "'a \<Rightarrow> 'b::t2_space" |
|
1417 |
assumes "\<not> trivial_limit net" "(f ---> l) net" "(f ---> l') net" |
|
1418 |
shows "l = l'" |
|
1419 |
proof (rule ccontr) |
|
1420 |
assume "l \<noteq> l'" |
|
1421 |
obtain U V where "open U" "open V" "l \<in> U" "l' \<in> V" "U \<inter> V = {}" |
|
1422 |
using hausdorff [OF `l \<noteq> l'`] by fast |
|
1423 |
have "eventually (\<lambda>x. f x \<in> U) net" |
|
1424 |
using `(f ---> l) net` `open U` `l \<in> U` by (rule topological_tendstoD) |
|
1425 |
moreover |
|
1426 |
have "eventually (\<lambda>x. f x \<in> V) net" |
|
1427 |
using `(f ---> l') net` `open V` `l' \<in> V` by (rule topological_tendstoD) |
|
1428 |
ultimately |
|
1429 |
have "eventually (\<lambda>x. False) net" |
|
1430 |
proof (rule eventually_elim2) |
|
1431 |
fix x |
|
1432 |
assume "f x \<in> U" "f x \<in> V" |
|
1433 |
hence "f x \<in> U \<inter> V" by simp |
|
1434 |
with `U \<inter> V = {}` show "False" by simp |
|
1435 |
qed |
|
1436 |
with `\<not> trivial_limit net` show "False" |
|
1437 |
by (simp add: eventually_False) |
|
1438 |
qed |
|
1439 |
||
1440 |
lemma tendsto_Lim: |
|
1441 |
fixes f :: "'a \<Rightarrow> 'b::t2_space" |
|
1442 |
shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l" |
|
1443 |
unfolding Lim_def using Lim_unique[of net f] by auto |
|
1444 |
||
1445 |
text{* Limit under bilinear function *} |
|
1446 |
||
1447 |
lemma Lim_bilinear: |
|
1448 |
assumes "(f ---> l) net" and "(g ---> m) net" and "bounded_bilinear h" |
|
1449 |
shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net" |
|
1450 |
using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net` |
|
1451 |
by (rule bounded_bilinear.tendsto) |
|
1452 |
||
1453 |
text{* These are special for limits out of the same vector space. *} |
|
1454 |
||
1455 |
lemma Lim_within_id: "(id ---> a) (at a within s)" |
|
1456 |
unfolding tendsto_def Limits.eventually_within eventually_at_topological |
|
1457 |
by auto |
|
1458 |
||
36437 | 1459 |
lemmas Lim_intros = Lim_add Lim_const Lim_sub Lim_cmul Lim_vmul Lim_within_id |
1460 |
||
33175 | 1461 |
lemma Lim_at_id: "(id ---> a) (at a)" |
1462 |
apply (subst within_UNIV[symmetric]) by (simp add: Lim_within_id) |
|
1463 |
||
1464 |
lemma Lim_at_zero: |
|
1465 |
fixes a :: "'a::real_normed_vector" |
|
1466 |
fixes l :: "'b::topological_space" |
|
1467 |
shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" (is "?lhs = ?rhs") |
|
1468 |
proof |
|
1469 |
assume "?lhs" |
|
1470 |
{ fix S assume "open S" "l \<in> S" |
|
1471 |
with `?lhs` have "eventually (\<lambda>x. f x \<in> S) (at a)" |
|
1472 |
by (rule topological_tendstoD) |
|
1473 |
then obtain d where d: "d>0" "\<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S" |
|
1474 |
unfolding Limits.eventually_at by fast |
|
1475 |
{ fix x::"'a" assume "x \<noteq> 0 \<and> dist x 0 < d" |
|
1476 |
hence "f (a + x) \<in> S" using d |
|
1477 |
apply(erule_tac x="x+a" in allE) |
|
35820
b57c3afd1484
dropped odd interpretation of comm_monoid_mult into comm_monoid_add; consider Min.insert_idem as default simp rule
haftmann
parents:
35172
diff
changeset
|
1478 |
by (auto simp add: add_commute dist_norm dist_commute) |
33175 | 1479 |
} |
1480 |
hence "\<exists>d>0. \<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S" |
|
1481 |
using d(1) by auto |
|
1482 |
hence "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)" |
|
1483 |
unfolding Limits.eventually_at . |
|
1484 |
} |
|
1485 |
thus "?rhs" by (rule topological_tendstoI) |
|
1486 |
next |
|
1487 |
assume "?rhs" |
|
1488 |
{ fix S assume "open S" "l \<in> S" |
|
1489 |
with `?rhs` have "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)" |
|
1490 |
by (rule topological_tendstoD) |
|
1491 |
then obtain d where d: "d>0" "\<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S" |
|
1492 |
unfolding Limits.eventually_at by fast |
|
1493 |
{ fix x::"'a" assume "x \<noteq> a \<and> dist x a < d" |
|
1494 |
hence "f x \<in> S" using d apply(erule_tac x="x-a" in allE) |
|
35820
b57c3afd1484
dropped odd interpretation of comm_monoid_mult into comm_monoid_add; consider Min.insert_idem as default simp rule
haftmann
parents:
35172
diff
changeset
|
1495 |
by(auto simp add: add_commute dist_norm dist_commute) |
33175 | 1496 |
} |
1497 |
hence "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S" using d(1) by auto |
|
1498 |
hence "eventually (\<lambda>x. f x \<in> S) (at a)" unfolding Limits.eventually_at . |
|
1499 |
} |
|
1500 |
thus "?lhs" by (rule topological_tendstoI) |
|
1501 |
qed |
|
1502 |
||
1503 |
text{* It's also sometimes useful to extract the limit point from the net. *} |
|
1504 |
||
1505 |
definition |
|
1506 |
netlimit :: "'a::t2_space net \<Rightarrow> 'a" where |
|
1507 |
"netlimit net = (SOME a. ((\<lambda>x. x) ---> a) net)" |
|
1508 |
||
1509 |
lemma netlimit_within: |
|
1510 |
assumes "\<not> trivial_limit (at a within S)" |
|
1511 |
shows "netlimit (at a within S) = a" |
|
1512 |
unfolding netlimit_def |
|
1513 |
apply (rule some_equality) |
|
1514 |
apply (rule Lim_at_within) |
|
1515 |
apply (rule Lim_ident_at) |
|
1516 |
apply (erule Lim_unique [OF assms]) |
|
1517 |
apply (rule Lim_at_within) |
|
1518 |
apply (rule Lim_ident_at) |
|
1519 |
done |
|
1520 |
||
1521 |
lemma netlimit_at: |
|
1522 |
fixes a :: "'a::perfect_space" |
|
1523 |
shows "netlimit (at a) = a" |
|
1524 |
apply (subst within_UNIV[symmetric]) |
|
1525 |
using netlimit_within[of a UNIV] |
|
1526 |
by (simp add: trivial_limit_at within_UNIV) |
|
1527 |
||
1528 |
text{* Transformation of limit. *} |
|
1529 |
||
1530 |
lemma Lim_transform: |
|
1531 |
fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector" |
|
1532 |
assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net" |
|
1533 |
shows "(g ---> l) net" |
|
1534 |
proof- |
|
1535 |
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 |
|
1536 |
thus "?thesis" using Lim_neg [of "\<lambda> x. - g x" "-l" net] by auto |
|
1537 |
qed |
|
1538 |
||
1539 |
lemma Lim_transform_eventually: |
|
1540 |
"eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net ==> (g ---> l) net" |
|
1541 |
apply (rule topological_tendstoI) |
|
1542 |
apply (drule (2) topological_tendstoD) |
|
1543 |
apply (erule (1) eventually_elim2, simp) |
|
1544 |
done |
|
1545 |
||
1546 |
lemma Lim_transform_within: |
|
1547 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1548 |
assumes "0 < d" "(\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x')" |
|
1549 |
"(f ---> l) (at x within S)" |
|
1550 |
shows "(g ---> l) (at x within S)" |
|
1551 |
using assms(1,3) unfolding Lim_within |
|
1552 |
apply - |
|
1553 |
apply (clarify, rename_tac e) |
|
1554 |
apply (drule_tac x=e in spec, clarsimp, rename_tac r) |
|
1555 |
apply (rule_tac x="min d r" in exI, clarsimp, rename_tac y) |
|
1556 |
apply (drule_tac x=y in bspec, assumption, clarsimp) |
|
1557 |
apply (simp add: assms(2)) |
|
1558 |
done |
|
1559 |
||
1560 |
lemma Lim_transform_at: |
|
1561 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1562 |
shows "0 < d \<Longrightarrow> (\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x') \<Longrightarrow> |
|
1563 |
(f ---> l) (at x) ==> (g ---> l) (at x)" |
|
1564 |
apply (subst within_UNIV[symmetric]) |
|
1565 |
using Lim_transform_within[of d UNIV x f g l] |
|
1566 |
by (auto simp add: within_UNIV) |
|
1567 |
||
1568 |
text{* Common case assuming being away from some crucial point like 0. *} |
|
1569 |
||
1570 |
lemma Lim_transform_away_within: |
|
1571 |
fixes a b :: "'a::metric_space" |
|
1572 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1573 |
assumes "a\<noteq>b" "\<forall>x\<in> S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" |
|
1574 |
and "(f ---> l) (at a within S)" |
|
1575 |
shows "(g ---> l) (at a within S)" |
|
1576 |
proof- |
|
1577 |
have "\<forall>x'\<in>S. 0 < dist x' a \<and> dist x' a < dist a b \<longrightarrow> f x' = g x'" using assms(2) |
|
1578 |
apply auto apply(erule_tac x=x' in ballE) by (auto simp add: dist_commute) |
|
1579 |
thus ?thesis using Lim_transform_within[of "dist a b" S a f g l] using assms(1,3) unfolding dist_nz by auto |
|
1580 |
qed |
|
1581 |
||
1582 |
lemma Lim_transform_away_at: |
|
1583 |
fixes a b :: "'a::metric_space" |
|
1584 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1585 |
assumes ab: "a\<noteq>b" and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" |
|
1586 |
and fl: "(f ---> l) (at a)" |
|
1587 |
shows "(g ---> l) (at a)" |
|
1588 |
using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl |
|
1589 |
by (auto simp add: within_UNIV) |
|
1590 |
||
1591 |
text{* Alternatively, within an open set. *} |
|
1592 |
||
1593 |
lemma Lim_transform_within_open: |
|
1594 |
fixes a :: "'a::metric_space" |
|
1595 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1596 |
assumes "open S" "a \<in> S" "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x" "(f ---> l) (at a)" |
|
1597 |
shows "(g ---> l) (at a)" |
|
1598 |
proof- |
|
1599 |
from assms(1,2) obtain e::real where "e>0" and e:"ball a e \<subseteq> S" unfolding open_contains_ball by auto |
|
1600 |
hence "\<forall>x'. 0 < dist x' a \<and> dist x' a < e \<longrightarrow> f x' = g x'" using assms(3) |
|
1601 |
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) |
|
1602 |
thus ?thesis using Lim_transform_at[of e a f g l] `e>0` assms(4) by auto |
|
1603 |
qed |
|
1604 |
||
1605 |
text{* A congruence rule allowing us to transform limits assuming not at point. *} |
|
1606 |
||
1607 |
(* FIXME: Only one congruence rule for tendsto can be used at a time! *) |
|
1608 |
||
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
1609 |
lemma Lim_cong_within(*[cong add]*): |
33175 | 1610 |
fixes a :: "'a::metric_space" |
1611 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1612 |
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))" |
|
1613 |
by (simp add: Lim_within dist_nz[symmetric]) |
|
1614 |
||
1615 |
lemma Lim_cong_at[cong add]: |
|
1616 |
fixes a :: "'a::metric_space" |
|
1617 |
fixes l :: "'b::metric_space" (* TODO: generalize *) |
|
1618 |
shows "(\<And>x. x \<noteq> a ==> f x = g x) ==> (((\<lambda>x. f x) ---> l) (at a) \<longleftrightarrow> ((g ---> l) (at a)))" |
|
1619 |
by (simp add: Lim_at dist_nz[symmetric]) |
|
1620 |
||
1621 |
text{* Useful lemmas on closure and set of possible sequential limits.*} |
|
1622 |
||
1623 |
lemma closure_sequential: |
|
1624 |
fixes l :: "'a::metric_space" (* TODO: generalize *) |
|
1625 |
shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" (is "?lhs = ?rhs") |
|
1626 |
proof |
|
1627 |
assume "?lhs" moreover |
|
1628 |
{ assume "l \<in> S" |
|
1629 |
hence "?rhs" using Lim_const[of l sequentially] by auto |
|
1630 |
} moreover |
|
1631 |
{ assume "l islimpt S" |
|
1632 |
hence "?rhs" unfolding islimpt_sequential by auto |
|
1633 |
} ultimately |
|
1634 |
show "?rhs" unfolding closure_def by auto |
|
1635 |
next |
|
1636 |
assume "?rhs" |
|
1637 |
thus "?lhs" unfolding closure_def unfolding islimpt_sequential by auto |
|
1638 |
qed |
|
1639 |
||
1640 |
lemma closed_sequential_limits: |
|
1641 |
fixes S :: "'a::metric_space set" |
|
1642 |
shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)" |
|
1643 |
unfolding closed_limpt |
|
1644 |
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] |
|
1645 |
by metis |
|
1646 |
||
1647 |
lemma closure_approachable: |
|
1648 |
fixes S :: "'a::metric_space set" |
|
1649 |
shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)" |
|
1650 |
apply (auto simp add: closure_def islimpt_approachable) |
|
1651 |
by (metis dist_self) |
|
1652 |
||
1653 |
lemma closed_approachable: |
|
1654 |
fixes S :: "'a::metric_space set" |
|
1655 |
shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S" |
|
1656 |
by (metis closure_closed closure_approachable) |
|
1657 |
||
1658 |
text{* Some other lemmas about sequences. *} |
|
1659 |
||
36441 | 1660 |
lemma sequentially_offset: |
1661 |
assumes "eventually (\<lambda>i. P i) sequentially" |
|
1662 |
shows "eventually (\<lambda>i. P (i + k)) sequentially" |
|
1663 |
using assms unfolding eventually_sequentially by (metis trans_le_add1) |
|
1664 |
||
33175 | 1665 |
lemma seq_offset: |
36441 | 1666 |
assumes "(f ---> l) sequentially" |
1667 |
shows "((\<lambda>i. f (i + k)) ---> l) sequentially" |
|
1668 |
using assms unfolding tendsto_def |
|
1669 |
by clarify (rule sequentially_offset, simp) |
|
33175 | 1670 |
|
1671 |
lemma seq_offset_neg: |
|
1672 |
"(f ---> l) sequentially ==> ((\<lambda>i. f(i - k)) ---> l) sequentially" |
|
1673 |
apply (rule topological_tendstoI) |
|
1674 |
apply (drule (2) topological_tendstoD) |
|
1675 |
apply (simp only: eventually_sequentially) |
|
1676 |
apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k") |
|
1677 |
apply metis |
|
1678 |
by arith |
|
1679 |
||
1680 |
lemma seq_offset_rev: |
|
1681 |
"((\<lambda>i. f(i + k)) ---> l) sequentially ==> (f ---> l) sequentially" |
|
1682 |
apply (rule topological_tendstoI) |
|
1683 |
apply (drule (2) topological_tendstoD) |
|
1684 |
apply (simp only: eventually_sequentially) |
|
1685 |
apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k \<and> (n - k) + k = n") |
|
1686 |
by metis arith |
|
1687 |
||
1688 |
lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially" |
|
1689 |
proof- |
|
1690 |
{ fix e::real assume "e>0" |
|
1691 |
hence "\<exists>N::nat. \<forall>n::nat\<ge>N. inverse (real n) < e" |
|
1692 |
using real_arch_inv[of e] apply auto apply(rule_tac x=n in exI) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
1693 |
by (metis le_imp_inverse_le not_less real_of_nat_gt_zero_cancel_iff real_of_nat_less_iff xt1(7)) |
33175 | 1694 |
} |
1695 |
thus ?thesis unfolding Lim_sequentially dist_norm by simp |
|
1696 |
qed |
|
1697 |
||
36437 | 1698 |
subsection {* More properties of closed balls. *} |
33175 | 1699 |
|
1700 |
lemma closed_cball: "closed (cball x e)" |
|
1701 |
unfolding cball_def closed_def |
|
1702 |
unfolding Collect_neg_eq [symmetric] not_le |
|
1703 |
apply (clarsimp simp add: open_dist, rename_tac y) |
|
1704 |
apply (rule_tac x="dist x y - e" in exI, clarsimp) |
|
1705 |
apply (rename_tac x') |
|
1706 |
apply (cut_tac x=x and y=x' and z=y in dist_triangle) |
|
1707 |
apply simp |
|
1708 |
done |
|
1709 |
||
1710 |
lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)" |
|
1711 |
proof- |
|
1712 |
{ fix x and e::real assume "x\<in>S" "e>0" "ball x e \<subseteq> S" |
|
1713 |
hence "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto) |
|
1714 |
} moreover |
|
1715 |
{ fix x and e::real assume "x\<in>S" "e>0" "cball x e \<subseteq> S" |
|
1716 |
hence "\<exists>d>0. ball x d \<subseteq> S" unfolding subset_eq apply(rule_tac x="e/2" in exI) by auto |
|
1717 |
} ultimately |
|
1718 |
show ?thesis unfolding open_contains_ball by auto |
|
1719 |
qed |
|
1720 |
||
1721 |
lemma open_contains_cball_eq: "open S ==> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))" |
|
1722 |
by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball mem_def) |
|
1723 |
||
1724 |
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)" |
|
1725 |
apply (simp add: interior_def, safe) |
|
1726 |
apply (force simp add: open_contains_cball) |
|
1727 |
apply (rule_tac x="ball x e" in exI) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
1728 |
apply (simp add: subset_trans [OF ball_subset_cball]) |
33175 | 1729 |
done |
1730 |
||
1731 |
lemma islimpt_ball: |
|
1732 |
fixes x y :: "'a::{real_normed_vector,perfect_space}" |
|
1733 |
shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" (is "?lhs = ?rhs") |
|
1734 |
proof |
|
1735 |
assume "?lhs" |
|
1736 |
{ assume "e \<le> 0" |
|
1737 |
hence *:"ball x e = {}" using ball_eq_empty[of x e] by auto |
|
1738 |
have False using `?lhs` unfolding * using islimpt_EMPTY[of y] by auto |
|
1739 |
} |
|
1740 |
hence "e > 0" by (metis not_less) |
|
1741 |
moreover |
|
1742 |
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 |
|
1743 |
ultimately show "?rhs" by auto |
|
1744 |
next |
|
1745 |
assume "?rhs" hence "e>0" by auto |
|
1746 |
{ fix d::real assume "d>0" |
|
1747 |
have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" |
|
1748 |
proof(cases "d \<le> dist x y") |
|
1749 |
case True thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" |
|
1750 |
proof(cases "x=y") |
|
1751 |
case True hence False using `d \<le> dist x y` `d>0` by auto |
|
1752 |
thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by auto |
|
1753 |
next |
|
1754 |
case False |
|
1755 |
||
1756 |
have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) |
|
1757 |
= norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))" |
|
1758 |
unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[THEN sym] by auto |
|
1759 |
also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)" |
|
1760 |
using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", THEN sym, of "y - x"] |
|
1761 |
unfolding scaleR_minus_left scaleR_one |
|
1762 |
by (auto simp add: norm_minus_commute) |
|
1763 |
also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>" |
|
1764 |
unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]] |
|
1765 |
unfolding real_add_mult_distrib using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] by auto |
|
1766 |
also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` by(auto simp add: dist_norm) |
|
1767 |
finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` by auto |
|
1768 |
||
1769 |
moreover |
|
1770 |
||
1771 |
have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0" |
|
1772 |
using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff by (auto simp add: dist_commute) |
|
1773 |
moreover |
|
1774 |
have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" unfolding dist_norm apply simp unfolding norm_minus_cancel |
|
1775 |
using `d>0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y] |
|
1776 |
unfolding dist_norm by auto |
|
1777 |
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 |
|
1778 |
qed |
|
1779 |
next |
|
1780 |
case False hence "d > dist x y" by auto |
|
1781 |
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" |
|
1782 |
proof(cases "x=y") |
|
1783 |
case True |
|
1784 |
obtain z where **: "z \<noteq> y" "dist z y < min e d" |
|
1785 |
using perfect_choose_dist[of "min e d" y] |
|
1786 |
using `d > 0` `e>0` by auto |
|
1787 |
show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" |
|
1788 |
unfolding `x = y` |
|
1789 |
using `z \<noteq> y` ** |
|
1790 |
by (rule_tac x=z in bexI, auto simp add: dist_commute) |
|
1791 |
next |
|
1792 |
case False thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" |
|
1793 |
using `d>0` `d > dist x y` `?rhs` by(rule_tac x=x in bexI, auto) |
|
1794 |
qed |
|
1795 |
qed } |
|
1796 |
thus "?lhs" unfolding mem_cball islimpt_approachable mem_ball by auto |
|
1797 |
qed |
|
1798 |
||
1799 |
lemma closure_ball_lemma: |
|
1800 |
fixes x y :: "'a::real_normed_vector" |
|
1801 |
assumes "x \<noteq> y" shows "y islimpt ball x (dist x y)" |
|
1802 |
proof (rule islimptI) |
|
1803 |
fix T assume "y \<in> T" "open T" |
|
1804 |
then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T" |
|
1805 |
unfolding open_dist by fast |
|
1806 |
(* choose point between x and y, within distance r of y. *) |
|
1807 |
def k \<equiv> "min 1 (r / (2 * dist x y))" |
|
1808 |
def z \<equiv> "y + scaleR k (x - y)" |
|
1809 |
have z_def2: "z = x + scaleR (1 - k) (y - x)" |
|
1810 |
unfolding z_def by (simp add: algebra_simps) |
|
1811 |
have "dist z y < r" |
|
1812 |
unfolding z_def k_def using `0 < r` |
|
1813 |
by (simp add: dist_norm min_def) |
|
1814 |
hence "z \<in> T" using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp |
|
1815 |
have "dist x z < dist x y" |
|
1816 |
unfolding z_def2 dist_norm |
|
1817 |
apply (simp add: norm_minus_commute) |
|
1818 |
apply (simp only: dist_norm [symmetric]) |
|
1819 |
apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp) |
|
1820 |
apply (rule mult_strict_right_mono) |
|
1821 |
apply (simp add: k_def divide_pos_pos zero_less_dist_iff `0 < r` `x \<noteq> y`) |
|
1822 |
apply (simp add: zero_less_dist_iff `x \<noteq> y`) |
|
1823 |
done |
|
1824 |
hence "z \<in> ball x (dist x y)" by simp |
|
1825 |
have "z \<noteq> y" |
|
1826 |
unfolding z_def k_def using `x \<noteq> y` `0 < r` |
|
1827 |
by (simp add: min_def) |
|
1828 |
show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y" |
|
1829 |
using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y` |
|
1830 |
by fast |
|
1831 |
qed |
|
1832 |
||
1833 |
lemma closure_ball: |
|
1834 |
fixes x :: "'a::real_normed_vector" |
|
1835 |
shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e" |
|
1836 |
apply (rule equalityI) |
|
1837 |
apply (rule closure_minimal) |
|
1838 |
apply (rule ball_subset_cball) |
|
1839 |
apply (rule closed_cball) |
|
1840 |
apply (rule subsetI, rename_tac y) |
|
1841 |
apply (simp add: le_less [where 'a=real]) |
|
1842 |
apply (erule disjE) |
|
1843 |
apply (rule subsetD [OF closure_subset], simp) |
|
1844 |
apply (simp add: closure_def) |
|
1845 |
apply clarify |
|
1846 |
apply (rule closure_ball_lemma) |
|
1847 |
apply (simp add: zero_less_dist_iff) |
|
1848 |
done |
|
1849 |
||
1850 |
(* In a trivial vector space, this fails for e = 0. *) |
|
1851 |
lemma interior_cball: |
|
1852 |
fixes x :: "'a::{real_normed_vector, perfect_space}" |
|
1853 |
shows "interior (cball x e) = ball x e" |
|
1854 |
proof(cases "e\<ge>0") |
|
1855 |
case False note cs = this |
|
1856 |
from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover |
|
1857 |
{ fix y assume "y \<in> cball x e" |
|
1858 |
hence False unfolding mem_cball using dist_nz[of x y] cs by auto } |
|
1859 |
hence "cball x e = {}" by auto |
|
1860 |
hence "interior (cball x e) = {}" using interior_empty by auto |
|
1861 |
ultimately show ?thesis by blast |
|
1862 |
next |
|
1863 |
case True note cs = this |
|
1864 |
have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover |
|
1865 |
{ fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S" |
|
1866 |
then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast |
|
1867 |
||
1868 |
then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d" |
|
1869 |
using perfect_choose_dist [of d] by auto |
|
1870 |
have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute) |
|
1871 |
hence xa_cball:"xa \<in> cball x e" using as(1) by auto |
|
1872 |
||
1873 |
hence "y \<in> ball x e" proof(cases "x = y") |
|
1874 |
case True |
|
1875 |
hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute) |
|
1876 |
thus "y \<in> ball x e" using `x = y ` by simp |
|
1877 |
next |
|
1878 |
case False |
|
1879 |
have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm |
|
1880 |
using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto |
|
1881 |
hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast |
|
1882 |
have "y - x \<noteq> 0" using `x \<noteq> y` by auto |
|
1883 |
hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym] |
|
1884 |
using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto |
|
1885 |
||
1886 |
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)" |
|
1887 |
by (auto simp add: dist_norm algebra_simps) |
|
1888 |
also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))" |
|
1889 |
by (auto simp add: algebra_simps) |
|
1890 |
also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)" |
|
1891 |
using ** by auto |
|
1892 |
also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm) |
|
1893 |
finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute) |
|
1894 |
thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto |
|
1895 |
qed } |
|
1896 |
hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto |
|
1897 |
ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto |
|
1898 |
qed |
|
1899 |
||
1900 |
lemma frontier_ball: |
|
1901 |
fixes a :: "'a::real_normed_vector" |
|
1902 |
shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
1903 |
apply (simp add: frontier_def closure_ball interior_open order_less_imp_le) |
33175 | 1904 |
apply (simp add: expand_set_eq) |
1905 |
by arith |
|
1906 |
||
1907 |
lemma frontier_cball: |
|
1908 |
fixes a :: "'a::{real_normed_vector, perfect_space}" |
|
1909 |
shows "frontier(cball a e) = {x. dist a x = e}" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
1910 |
apply (simp add: frontier_def interior_cball closed_cball order_less_imp_le) |
33175 | 1911 |
apply (simp add: expand_set_eq) |
1912 |
by arith |
|
1913 |
||
1914 |
lemma cball_eq_empty: "(cball x e = {}) \<longleftrightarrow> e < 0" |
|
1915 |
apply (simp add: expand_set_eq not_le) |
|
1916 |
by (metis zero_le_dist dist_self order_less_le_trans) |
|
1917 |
lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty) |
|
1918 |
||
1919 |
lemma cball_eq_sing: |
|
1920 |
fixes x :: "'a::perfect_space" |
|
1921 |
shows "(cball x e = {x}) \<longleftrightarrow> e = 0" |
|
1922 |
proof (rule linorder_cases) |
|
1923 |
assume e: "0 < e" |
|
1924 |
obtain a where "a \<noteq> x" "dist a x < e" |
|
1925 |
using perfect_choose_dist [OF e] by auto |
|
1926 |
hence "a \<noteq> x" "dist x a \<le> e" by (auto simp add: dist_commute) |
|
1927 |
with e show ?thesis by (auto simp add: expand_set_eq) |
|
1928 |
qed auto |
|
1929 |
||
1930 |
lemma cball_sing: |
|
1931 |
fixes x :: "'a::metric_space" |
|
1932 |
shows "e = 0 ==> cball x e = {x}" |
|
1933 |
by (auto simp add: expand_set_eq) |
|
1934 |
||
1935 |
text{* For points in the interior, localization of limits makes no difference. *} |
|
1936 |
||
1937 |
lemma eventually_within_interior: |
|
1938 |
assumes "x \<in> interior S" |
|
1939 |
shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" (is "?lhs = ?rhs") |
|
1940 |
proof- |
|
1941 |
from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" |
|
1942 |
unfolding interior_def by fast |
|
1943 |
{ assume "?lhs" |
|
1944 |
then obtain A where "open A" "x \<in> A" "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y" |
|
1945 |
unfolding Limits.eventually_within Limits.eventually_at_topological |
|
1946 |
by auto |
|
1947 |
with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y" |
|
1948 |
by auto |
|
1949 |
then have "?rhs" |
|
1950 |
unfolding Limits.eventually_at_topological by auto |
|
1951 |
} moreover |
|
1952 |
{ assume "?rhs" hence "?lhs" |
|
1953 |
unfolding Limits.eventually_within |
|
1954 |
by (auto elim: eventually_elim1) |
|
1955 |
} ultimately |
|
1956 |
show "?thesis" .. |
|
1957 |
qed |
|
1958 |
||
1959 |
lemma lim_within_interior: |
|
1960 |
"x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)" |
|
1961 |
unfolding tendsto_def by (simp add: eventually_within_interior) |
|
1962 |
||
1963 |
lemma netlimit_within_interior: |
|
1964 |
fixes x :: "'a::{perfect_space, real_normed_vector}" |
|
1965 |
(* FIXME: generalize to perfect_space *) |
|
1966 |
assumes "x \<in> interior S" |
|
1967 |
shows "netlimit(at x within S) = x" (is "?lhs = ?rhs") |
|
1968 |
proof- |
|
1969 |
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 |
|
1970 |
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 |
|
1971 |
thus ?thesis using netlimit_within by auto |
|
1972 |
qed |
|
1973 |
||
1974 |
subsection{* Boundedness. *} |
|
1975 |
||
1976 |
(* FIXME: This has to be unified with BSEQ!! *) |
|
1977 |
definition |
|
1978 |
bounded :: "'a::metric_space set \<Rightarrow> bool" where |
|
1979 |
"bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)" |
|
1980 |
||
1981 |
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)" |
|
1982 |
unfolding bounded_def |
|
1983 |
apply safe |
|
1984 |
apply (rule_tac x="dist a x + e" in exI, clarify) |
|
1985 |
apply (drule (1) bspec) |
|
1986 |
apply (erule order_trans [OF dist_triangle add_left_mono]) |
|
1987 |
apply auto |
|
1988 |
done |
|
1989 |
||
1990 |
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)" |
|
1991 |
unfolding bounded_any_center [where a=0] |
|
1992 |
by (simp add: dist_norm) |
|
1993 |
||
1994 |
lemma bounded_empty[simp]: "bounded {}" by (simp add: bounded_def) |
|
1995 |
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S" |
|
1996 |
by (metis bounded_def subset_eq) |
|
1997 |
||
1998 |
lemma bounded_interior[intro]: "bounded S ==> bounded(interior S)" |
|
1999 |
by (metis bounded_subset interior_subset) |
|
2000 |
||
2001 |
lemma bounded_closure[intro]: assumes "bounded S" shows "bounded(closure S)" |
|
2002 |
proof- |
|
2003 |
from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" unfolding bounded_def by auto |
|
2004 |
{ fix y assume "y \<in> closure S" |
|
2005 |
then obtain f where f: "\<forall>n. f n \<in> S" "(f ---> y) sequentially" |
|
2006 |
unfolding closure_sequential by auto |
|
2007 |
have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp |
|
2008 |
hence "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially" |
|
2009 |
by (rule eventually_mono, simp add: f(1)) |
|
2010 |
have "dist x y \<le> a" |
|
2011 |
apply (rule Lim_dist_ubound [of sequentially f]) |
|
2012 |
apply (rule trivial_limit_sequentially) |
|
2013 |
apply (rule f(2)) |
|
2014 |
apply fact |
|
2015 |
done |
|
2016 |
} |
|
2017 |
thus ?thesis unfolding bounded_def by auto |
|
2018 |
qed |
|
2019 |
||
2020 |
lemma bounded_cball[simp,intro]: "bounded (cball x e)" |
|
2021 |
apply (simp add: bounded_def) |
|
2022 |
apply (rule_tac x=x in exI) |
|
2023 |
apply (rule_tac x=e in exI) |
|
2024 |
apply auto |
|
2025 |
done |
|
2026 |
||
2027 |
lemma bounded_ball[simp,intro]: "bounded(ball x e)" |
|
2028 |
by (metis ball_subset_cball bounded_cball bounded_subset) |
|
2029 |
||
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2030 |
lemma finite_imp_bounded[intro]: |
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2031 |
fixes S :: "'a::metric_space set" assumes "finite S" shows "bounded S" |
33175 | 2032 |
proof- |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2033 |
{ fix a and F :: "'a set" assume as:"bounded F" |
33175 | 2034 |
then obtain x e where "\<forall>y\<in>F. dist x y \<le> e" unfolding bounded_def by auto |
2035 |
hence "\<forall>y\<in>(insert a F). dist x y \<le> max e (dist x a)" by auto |
|
2036 |
hence "bounded (insert a F)" unfolding bounded_def by (intro exI) |
|
2037 |
} |
|
2038 |
thus ?thesis using finite_induct[of S bounded] using bounded_empty assms by auto |
|
2039 |
qed |
|
2040 |
||
2041 |
lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T" |
|
2042 |
apply (auto simp add: bounded_def) |
|
2043 |
apply (rename_tac x y r s) |
|
2044 |
apply (rule_tac x=x in exI) |
|
2045 |
apply (rule_tac x="max r (dist x y + s)" in exI) |
|
2046 |
apply (rule ballI, rename_tac z, safe) |
|
2047 |
apply (drule (1) bspec, simp) |
|
2048 |
apply (drule (1) bspec) |
|
2049 |
apply (rule min_max.le_supI2) |
|
2050 |
apply (erule order_trans [OF dist_triangle add_left_mono]) |
|
2051 |
done |
|
2052 |
||
2053 |
lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)" |
|
2054 |
by (induct rule: finite_induct[of F], auto) |
|
2055 |
||
2056 |
lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)" |
|
2057 |
apply (simp add: bounded_iff) |
|
2058 |
apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)") |
|
2059 |
by metis arith |
|
2060 |
||
2061 |
lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)" |
|
2062 |
by (metis Int_lower1 Int_lower2 bounded_subset) |
|
2063 |
||
2064 |
lemma bounded_diff[intro]: "bounded S ==> bounded (S - T)" |
|
2065 |
apply (metis Diff_subset bounded_subset) |
|
2066 |
done |
|
2067 |
||
2068 |
lemma bounded_insert[intro]:"bounded(insert x S) \<longleftrightarrow> bounded S" |
|
2069 |
by (metis Diff_cancel Un_empty_right Un_insert_right bounded_Un bounded_subset finite.emptyI finite_imp_bounded infinite_remove subset_insertI) |
|
2070 |
||
2071 |
lemma not_bounded_UNIV[simp, intro]: |
|
2072 |
"\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)" |
|
2073 |
proof(auto simp add: bounded_pos not_le) |
|
2074 |
obtain x :: 'a where "x \<noteq> 0" |
|
2075 |
using perfect_choose_dist [OF zero_less_one] by fast |
|
2076 |
fix b::real assume b: "b >0" |
|
2077 |
have b1: "b +1 \<ge> 0" using b by simp |
|
2078 |
with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))" |
|
2079 |
by (simp add: norm_sgn) |
|
2080 |
then show "\<exists>x::'a. b < norm x" .. |
|
2081 |
qed |
|
2082 |
||
2083 |
lemma bounded_linear_image: |
|
2084 |
assumes "bounded S" "bounded_linear f" |
|
2085 |
shows "bounded(f ` S)" |
|
2086 |
proof- |
|
2087 |
from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto |
|
2088 |
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) |
|
2089 |
{ fix x assume "x\<in>S" |
|
2090 |
hence "norm x \<le> b" using b by auto |
|
2091 |
hence "norm (f x) \<le> B * b" using B(2) apply(erule_tac x=x in allE) |
|
2092 |
by (metis B(1) B(2) real_le_trans real_mult_le_cancel_iff2) |
|
2093 |
} |
|
2094 |
thus ?thesis unfolding bounded_pos apply(rule_tac x="b*B" in exI) |
|
2095 |
using b B real_mult_order[of b B] by (auto simp add: real_mult_commute) |
|
2096 |
qed |
|
2097 |
||
2098 |
lemma bounded_scaling: |
|
2099 |
fixes S :: "'a::real_normed_vector set" |
|
2100 |
shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)" |
|
2101 |
apply (rule bounded_linear_image, assumption) |
|
2102 |
apply (rule scaleR.bounded_linear_right) |
|
2103 |
done |
|
2104 |
||
2105 |
lemma bounded_translation: |
|
2106 |
fixes S :: "'a::real_normed_vector set" |
|
2107 |
assumes "bounded S" shows "bounded ((\<lambda>x. a + x) ` S)" |
|
2108 |
proof- |
|
2109 |
from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto |
|
2110 |
{ fix x assume "x\<in>S" |
|
2111 |
hence "norm (a + x) \<le> b + norm a" using norm_triangle_ineq[of a x] b by auto |
|
2112 |
} |
|
2113 |
thus ?thesis unfolding bounded_pos using norm_ge_zero[of a] b(1) using add_strict_increasing[of b 0 "norm a"] |
|
2114 |
by (auto intro!: add exI[of _ "b + norm a"]) |
|
2115 |
qed |
|
2116 |
||
2117 |
||
2118 |
text{* Some theorems on sups and infs using the notion "bounded". *} |
|
2119 |
||
2120 |
lemma bounded_real: |
|
2121 |
fixes S :: "real set" |
|
2122 |
shows "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. abs x <= a)" |
|
2123 |
by (simp add: bounded_iff) |
|
2124 |
||
33270 | 2125 |
lemma bounded_has_Sup: |
2126 |
fixes S :: "real set" |
|
2127 |
assumes "bounded S" "S \<noteq> {}" |
|
2128 |
shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b" |
|
2129 |
proof |
|
2130 |
fix x assume "x\<in>S" |
|
2131 |
thus "x \<le> Sup S" |
|
2132 |
by (metis SupInf.Sup_upper abs_le_D1 assms(1) bounded_real) |
|
2133 |
next |
|
2134 |
show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms |
|
2135 |
by (metis SupInf.Sup_least) |
|
2136 |
qed |
|
2137 |
||
2138 |
lemma Sup_insert: |
|
2139 |
fixes S :: "real set" |
|
2140 |
shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))" |
|
2141 |
by auto (metis Int_absorb Sup_insert_nonempty assms bounded_has_Sup(1) disjoint_iff_not_equal) |
|
2142 |
||
2143 |
lemma Sup_insert_finite: |
|
2144 |
fixes S :: "real set" |
|
2145 |
shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))" |
|
2146 |
apply (rule Sup_insert) |
|
2147 |
apply (rule finite_imp_bounded) |
|
2148 |
by simp |
|
2149 |
||
2150 |
lemma bounded_has_Inf: |
|
2151 |
fixes S :: "real set" |
|
2152 |
assumes "bounded S" "S \<noteq> {}" |
|
2153 |
shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b" |
|
33175 | 2154 |
proof |
2155 |
fix x assume "x\<in>S" |
|
2156 |
from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto |
|
33270 | 2157 |
thus "x \<ge> Inf S" using `x\<in>S` |
2158 |
by (metis Inf_lower_EX abs_le_D2 minus_le_iff) |
|
33175 | 2159 |
next |
33270 | 2160 |
show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms |
2161 |
by (metis SupInf.Inf_greatest) |
|
2162 |
qed |
|
2163 |
||
2164 |
lemma Inf_insert: |
|
2165 |
fixes S :: "real set" |
|
2166 |
shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" |
|
2167 |
by auto (metis Int_absorb Inf_insert_nonempty bounded_has_Inf(1) disjoint_iff_not_equal) |
|
2168 |
lemma Inf_insert_finite: |
|
2169 |
fixes S :: "real set" |
|
2170 |
shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" |
|
2171 |
by (rule Inf_insert, rule finite_imp_bounded, simp) |
|
2172 |
||
33175 | 2173 |
|
2174 |
(* TODO: Move this to RComplete.thy -- would need to include Glb into RComplete *) |
|
2175 |
lemma real_isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::real)" |
|
2176 |
apply (frule isGlb_isLb) |
|
2177 |
apply (frule_tac x = y in isGlb_isLb) |
|
2178 |
apply (blast intro!: order_antisym dest!: isGlb_le_isLb) |
|
2179 |
done |
|
2180 |
||
36437 | 2181 |
subsection {* Equivalent versions of compactness *} |
2182 |
||
2183 |
subsubsection{* Sequential compactness *} |
|
33175 | 2184 |
|
2185 |
definition |
|
2186 |
compact :: "'a::metric_space set \<Rightarrow> bool" where (* TODO: generalize *) |
|
2187 |
"compact S \<longleftrightarrow> |
|
2188 |
(\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> |
|
2189 |
(\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))" |
|
2190 |
||
2191 |
text {* |
|
2192 |
A metric space (or topological vector space) is said to have the |
|
2193 |
Heine-Borel property if every closed and bounded subset is compact. |
|
2194 |
*} |
|
2195 |
||
2196 |
class heine_borel = |
|
2197 |
assumes bounded_imp_convergent_subsequence: |
|
2198 |
"bounded s \<Longrightarrow> \<forall>n. f n \<in> s |
|
2199 |
\<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2200 |
||
2201 |
lemma bounded_closed_imp_compact: |
|
2202 |
fixes s::"'a::heine_borel set" |
|
2203 |
assumes "bounded s" and "closed s" shows "compact s" |
|
2204 |
proof (unfold compact_def, clarify) |
|
2205 |
fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s" |
|
2206 |
obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially" |
|
2207 |
using bounded_imp_convergent_subsequence [OF `bounded s` `\<forall>n. f n \<in> s`] by auto |
|
2208 |
from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" by simp |
|
2209 |
have "l \<in> s" using `closed s` fr l |
|
2210 |
unfolding closed_sequential_limits by blast |
|
2211 |
show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2212 |
using `l \<in> s` r l by blast |
|
2213 |
qed |
|
2214 |
||
2215 |
lemma subseq_bigger: assumes "subseq r" shows "n \<le> r n" |
|
2216 |
proof(induct n) |
|
2217 |
show "0 \<le> r 0" by auto |
|
2218 |
next |
|
2219 |
fix n assume "n \<le> r n" |
|
2220 |
moreover have "r n < r (Suc n)" |
|
2221 |
using assms [unfolded subseq_def] by auto |
|
2222 |
ultimately show "Suc n \<le> r (Suc n)" by auto |
|
2223 |
qed |
|
2224 |
||
2225 |
lemma eventually_subseq: |
|
2226 |
assumes r: "subseq r" |
|
2227 |
shows "eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially" |
|
2228 |
unfolding eventually_sequentially |
|
2229 |
by (metis subseq_bigger [OF r] le_trans) |
|
2230 |
||
2231 |
lemma lim_subseq: |
|
2232 |
"subseq r \<Longrightarrow> (s ---> l) sequentially \<Longrightarrow> ((s o r) ---> l) sequentially" |
|
2233 |
unfolding tendsto_def eventually_sequentially o_def |
|
2234 |
by (metis subseq_bigger le_trans) |
|
2235 |
||
2236 |
lemma num_Axiom: "EX! g. g 0 = e \<and> (\<forall>n. g (Suc n) = f n (g n))" |
|
2237 |
unfolding Ex1_def |
|
2238 |
apply (rule_tac x="nat_rec e f" in exI) |
|
2239 |
apply (rule conjI)+ |
|
2240 |
apply (rule def_nat_rec_0, simp) |
|
2241 |
apply (rule allI, rule def_nat_rec_Suc, simp) |
|
2242 |
apply (rule allI, rule impI, rule ext) |
|
2243 |
apply (erule conjE) |
|
2244 |
apply (induct_tac x) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2245 |
apply simp |
33175 | 2246 |
apply (erule_tac x="n" in allE) |
2247 |
apply (simp) |
|
2248 |
done |
|
2249 |
||
2250 |
lemma convergent_bounded_increasing: fixes s ::"nat\<Rightarrow>real" |
|
2251 |
assumes "incseq s" and "\<forall>n. abs(s n) \<le> b" |
|
2252 |
shows "\<exists> l. \<forall>e::real>0. \<exists> N. \<forall>n \<ge> N. abs(s n - l) < e" |
|
2253 |
proof- |
|
2254 |
have "isUb UNIV (range s) b" using assms(2) and abs_le_D1 unfolding isUb_def and setle_def by auto |
|
2255 |
then obtain t where t:"isLub UNIV (range s) t" using reals_complete[of "range s" ] by auto |
|
2256 |
{ fix e::real assume "e>0" and as:"\<forall>N. \<exists>n\<ge>N. \<not> \<bar>s n - t\<bar> < e" |
|
2257 |
{ fix n::nat |
|
2258 |
obtain N where "N\<ge>n" and n:"\<bar>s N - t\<bar> \<ge> e" using as[THEN spec[where x=n]] by auto |
|
2259 |
have "t \<ge> s N" using isLub_isUb[OF t, unfolded isUb_def setle_def] by auto |
|
2260 |
with n have "s N \<le> t - e" using `e>0` by auto |
|
2261 |
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 } |
|
2262 |
hence "isUb UNIV (range s) (t - e)" unfolding isUb_def and setle_def by auto |
|
2263 |
hence False using isLub_le_isUb[OF t, of "t - e"] and `e>0` by auto } |
|
2264 |
thus ?thesis by blast |
|
2265 |
qed |
|
2266 |
||
2267 |
lemma convergent_bounded_monotone: fixes s::"nat \<Rightarrow> real" |
|
2268 |
assumes "\<forall>n. abs(s n) \<le> b" and "monoseq s" |
|
2269 |
shows "\<exists>l. \<forall>e::real>0. \<exists>N. \<forall>n\<ge>N. abs(s n - l) < e" |
|
2270 |
using convergent_bounded_increasing[of s b] assms using convergent_bounded_increasing[of "\<lambda>n. - s n" b] |
|
2271 |
unfolding monoseq_def incseq_def |
|
2272 |
apply auto unfolding minus_add_distrib[THEN sym, unfolded diff_minus[THEN sym]] |
|
2273 |
unfolding abs_minus_cancel by(rule_tac x="-l" in exI)auto |
|
2274 |
||
2275 |
lemma compact_real_lemma: |
|
2276 |
assumes "\<forall>n::nat. abs(s n) \<le> b" |
|
2277 |
shows "\<exists>(l::real) r. subseq r \<and> ((s \<circ> r) ---> l) sequentially" |
|
2278 |
proof- |
|
2279 |
obtain r where r:"subseq r" "monoseq (\<lambda>n. s (r n))" |
|
2280 |
using seq_monosub[of s] by auto |
|
2281 |
thus ?thesis using convergent_bounded_monotone[of "\<lambda>n. s (r n)" b] and assms |
|
2282 |
unfolding tendsto_iff dist_norm eventually_sequentially by auto |
|
2283 |
qed |
|
2284 |
||
2285 |
instance real :: heine_borel |
|
2286 |
proof |
|
2287 |
fix s :: "real set" and f :: "nat \<Rightarrow> real" |
|
2288 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s" |
|
2289 |
then obtain b where b: "\<forall>n. abs (f n) \<le> b" |
|
2290 |
unfolding bounded_iff by auto |
|
2291 |
obtain l :: real and r :: "nat \<Rightarrow> nat" where |
|
2292 |
r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially" |
|
2293 |
using compact_real_lemma [OF b] by auto |
|
2294 |
thus "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2295 |
by auto |
|
2296 |
qed |
|
2297 |
||
2298 |
lemma bounded_component: "bounded s \<Longrightarrow> bounded ((\<lambda>x. x $ i) ` s)" |
|
2299 |
unfolding bounded_def |
|
2300 |
apply clarify |
|
2301 |
apply (rule_tac x="x $ i" in exI) |
|
2302 |
apply (rule_tac x="e" in exI) |
|
2303 |
apply clarify |
|
2304 |
apply (rule order_trans [OF dist_nth_le], simp) |
|
2305 |
done |
|
2306 |
||
2307 |
lemma compact_lemma: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
2308 |
fixes f :: "nat \<Rightarrow> 'a::heine_borel ^ 'n" |
33175 | 2309 |
assumes "bounded s" and "\<forall>n. f n \<in> s" |
2310 |
shows "\<forall>d. |
|
2311 |
\<exists>l r. subseq r \<and> |
|
2312 |
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)" |
|
2313 |
proof |
|
2314 |
fix d::"'n set" have "finite d" by simp |
|
2315 |
thus "\<exists>l::'a ^ 'n. \<exists>r. subseq r \<and> |
|
2316 |
(\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)" |
|
2317 |
proof(induct d) case empty thus ?case unfolding subseq_def by auto |
|
2318 |
next case (insert k d) |
|
2319 |
have s': "bounded ((\<lambda>x. x $ k) ` s)" using `bounded s` by (rule bounded_component) |
|
2320 |
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" |
|
2321 |
using insert(3) by auto |
|
2322 |
have f': "\<forall>n. f (r1 n) $ k \<in> (\<lambda>x. x $ k) ` s" using `\<forall>n. f n \<in> s` by simp |
|
2323 |
obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) $ k) ---> l2) sequentially" |
|
2324 |
using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto |
|
2325 |
def r \<equiv> "r1 \<circ> r2" have r:"subseq r" |
|
2326 |
using r1 and r2 unfolding r_def o_def subseq_def by auto |
|
2327 |
moreover |
|
2328 |
def l \<equiv> "(\<chi> i. if i = k then l2 else l1$i)::'a^'n" |
|
2329 |
{ fix e::real assume "e>0" |
|
2330 |
from lr1 `e>0` have N1:"eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" by blast |
|
2331 |
from lr2 `e>0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) $ k) l2 < e) sequentially" by (rule tendstoD) |
|
2332 |
from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) $ i) (l1 $ i) < e) sequentially" |
|
2333 |
by (rule eventually_subseq) |
|
2334 |
have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) $ i) (l $ i) < e) sequentially" |
|
2335 |
using N1' N2 by (rule eventually_elim2, simp add: l_def r_def) |
|
2336 |
} |
|
2337 |
ultimately show ?case by auto |
|
2338 |
qed |
|
2339 |
qed |
|
2340 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
2341 |
instance cart :: (heine_borel, finite) heine_borel |
33175 | 2342 |
proof |
2343 |
fix s :: "('a ^ 'b) set" and f :: "nat \<Rightarrow> 'a ^ 'b" |
|
2344 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s" |
|
2345 |
then obtain l r where r: "subseq r" |
|
2346 |
and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>UNIV. dist (f (r n) $ i) (l $ i) < e) sequentially" |
|
2347 |
using compact_lemma [OF s f] by blast |
|
2348 |
let ?d = "UNIV::'b set" |
|
2349 |
{ fix e::real assume "e>0" |
|
2350 |
hence "0 < e / (real_of_nat (card ?d))" |
|
2351 |
using zero_less_card_finite using divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto |
|
2352 |
with l have "eventually (\<lambda>n. \<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))) sequentially" |
|
2353 |
by simp |
|
2354 |
moreover |
|
2355 |
{ fix n assume n: "\<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))" |
|
2356 |
have "dist (f (r n)) l \<le> (\<Sum>i\<in>?d. dist (f (r n) $ i) (l $ i))" |
|
2357 |
unfolding dist_vector_def using zero_le_dist by (rule setL2_le_setsum) |
|
2358 |
also have "\<dots> < (\<Sum>i\<in>?d. e / (real_of_nat (card ?d)))" |
|
2359 |
by (rule setsum_strict_mono) (simp_all add: n) |
|
2360 |
finally have "dist (f (r n)) l < e" by simp |
|
2361 |
} |
|
2362 |
ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially" |
|
2363 |
by (rule eventually_elim1) |
|
2364 |
} |
|
2365 |
hence *:"((f \<circ> r) ---> l) sequentially" unfolding o_def tendsto_iff by simp |
|
2366 |
with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" by auto |
|
2367 |
qed |
|
2368 |
||
2369 |
lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)" |
|
2370 |
unfolding bounded_def |
|
2371 |
apply clarify |
|
2372 |
apply (rule_tac x="a" in exI) |
|
2373 |
apply (rule_tac x="e" in exI) |
|
2374 |
apply clarsimp |
|
2375 |
apply (drule (1) bspec) |
|
2376 |
apply (simp add: dist_Pair_Pair) |
|
2377 |
apply (erule order_trans [OF real_sqrt_sum_squares_ge1]) |
|
2378 |
done |
|
2379 |
||
2380 |
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)" |
|
2381 |
unfolding bounded_def |
|
2382 |
apply clarify |
|
2383 |
apply (rule_tac x="b" in exI) |
|
2384 |
apply (rule_tac x="e" in exI) |
|
2385 |
apply clarsimp |
|
2386 |
apply (drule (1) bspec) |
|
2387 |
apply (simp add: dist_Pair_Pair) |
|
2388 |
apply (erule order_trans [OF real_sqrt_sum_squares_ge2]) |
|
2389 |
done |
|
2390 |
||
2391 |
instance "*" :: (heine_borel, heine_borel) heine_borel |
|
2392 |
proof |
|
2393 |
fix s :: "('a * 'b) set" and f :: "nat \<Rightarrow> 'a * 'b" |
|
2394 |
assume s: "bounded s" and f: "\<forall>n. f n \<in> s" |
|
2395 |
from s have s1: "bounded (fst ` s)" by (rule bounded_fst) |
|
2396 |
from f have f1: "\<forall>n. fst (f n) \<in> fst ` s" by simp |
|
2397 |
obtain l1 r1 where r1: "subseq r1" |
|
2398 |
and l1: "((\<lambda>n. fst (f (r1 n))) ---> l1) sequentially" |
|
2399 |
using bounded_imp_convergent_subsequence [OF s1 f1] |
|
2400 |
unfolding o_def by fast |
|
2401 |
from s have s2: "bounded (snd ` s)" by (rule bounded_snd) |
|
2402 |
from f have f2: "\<forall>n. snd (f (r1 n)) \<in> snd ` s" by simp |
|
2403 |
obtain l2 r2 where r2: "subseq r2" |
|
2404 |
and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially" |
|
2405 |
using bounded_imp_convergent_subsequence [OF s2 f2] |
|
2406 |
unfolding o_def by fast |
|
2407 |
have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially" |
|
2408 |
using lim_subseq [OF r2 l1] unfolding o_def . |
|
2409 |
have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially" |
|
2410 |
using tendsto_Pair [OF l1' l2] unfolding o_def by simp |
|
2411 |
have r: "subseq (r1 \<circ> r2)" |
|
2412 |
using r1 r2 unfolding subseq_def by simp |
|
2413 |
show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2414 |
using l r by fast |
|
2415 |
qed |
|
2416 |
||
36437 | 2417 |
subsubsection{* Completeness *} |
33175 | 2418 |
|
2419 |
lemma cauchy_def: |
|
2420 |
"Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)" |
|
2421 |
unfolding Cauchy_def by blast |
|
2422 |
||
2423 |
definition |
|
2424 |
complete :: "'a::metric_space set \<Rightarrow> bool" where |
|
2425 |
"complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f |
|
2426 |
--> (\<exists>l \<in> s. (f ---> l) sequentially))" |
|
2427 |
||
2428 |
lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs") |
|
2429 |
proof- |
|
2430 |
{ assume ?rhs |
|
2431 |
{ fix e::real |
|
2432 |
assume "e>0" |
|
2433 |
with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2" |
|
2434 |
by (erule_tac x="e/2" in allE) auto |
|
2435 |
{ fix n m |
|
2436 |
assume nm:"N \<le> m \<and> N \<le> n" |
|
2437 |
hence "dist (s m) (s n) < e" using N |
|
2438 |
using dist_triangle_half_l[of "s m" "s N" "e" "s n"] |
|
2439 |
by blast |
|
2440 |
} |
|
2441 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e" |
|
2442 |
by blast |
|
2443 |
} |
|
2444 |
hence ?lhs |
|
2445 |
unfolding cauchy_def |
|
2446 |
by blast |
|
2447 |
} |
|
2448 |
thus ?thesis |
|
2449 |
unfolding cauchy_def |
|
2450 |
using dist_triangle_half_l |
|
2451 |
by blast |
|
2452 |
qed |
|
2453 |
||
2454 |
lemma convergent_imp_cauchy: |
|
2455 |
"(s ---> l) sequentially ==> Cauchy s" |
|
2456 |
proof(simp only: cauchy_def, rule, rule) |
|
2457 |
fix e::real assume "e>0" "(s ---> l) sequentially" |
|
2458 |
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 |
|
2459 |
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 |
|
2460 |
qed |
|
2461 |
||
34104 | 2462 |
lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded (range s)" |
33175 | 2463 |
proof- |
2464 |
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 |
|
2465 |
hence N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto |
|
2466 |
moreover |
|
2467 |
have "bounded (s ` {0..N})" using finite_imp_bounded[of "s ` {1..N}"] by auto |
|
2468 |
then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a" |
|
2469 |
unfolding bounded_any_center [where a="s N"] by auto |
|
2470 |
ultimately show "?thesis" |
|
2471 |
unfolding bounded_any_center [where a="s N"] |
|
2472 |
apply(rule_tac x="max a 1" in exI) apply auto |
|
34104 | 2473 |
apply(erule_tac x=y in allE) apply(erule_tac x=y in ballE) by auto |
33175 | 2474 |
qed |
2475 |
||
2476 |
lemma compact_imp_complete: assumes "compact s" shows "complete s" |
|
2477 |
proof- |
|
2478 |
{ fix f assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f" |
|
2479 |
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 |
|
2480 |
||
2481 |
note lr' = subseq_bigger [OF lr(2)] |
|
2482 |
||
2483 |
{ fix e::real assume "e>0" |
|
2484 |
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 |
|
2485 |
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 |
|
2486 |
{ fix n::nat assume n:"n \<ge> max N M" |
|
2487 |
have "dist ((f \<circ> r) n) l < e/2" using n M by auto |
|
2488 |
moreover have "r n \<ge> N" using lr'[of n] n by auto |
|
2489 |
hence "dist (f n) ((f \<circ> r) n) < e / 2" using N using n by auto |
|
2490 |
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) } |
|
2491 |
hence "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast } |
|
2492 |
hence "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` unfolding Lim_sequentially by auto } |
|
2493 |
thus ?thesis unfolding complete_def by auto |
|
2494 |
qed |
|
2495 |
||
2496 |
instance heine_borel < complete_space |
|
2497 |
proof |
|
2498 |
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" |
|
34104 | 2499 |
hence "bounded (range f)" |
2500 |
by (rule cauchy_imp_bounded) |
|
33175 | 2501 |
hence "compact (closure (range f))" |
2502 |
using bounded_closed_imp_compact [of "closure (range f)"] by auto |
|
2503 |
hence "complete (closure (range f))" |
|
34104 | 2504 |
by (rule compact_imp_complete) |
33175 | 2505 |
moreover have "\<forall>n. f n \<in> closure (range f)" |
2506 |
using closure_subset [of "range f"] by auto |
|
2507 |
ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially" |
|
2508 |
using `Cauchy f` unfolding complete_def by auto |
|
2509 |
then show "convergent f" |
|
2510 |
unfolding convergent_def LIMSEQ_conv_tendsto [symmetric] by auto |
|
2511 |
qed |
|
2512 |
||
2513 |
lemma complete_univ: "complete (UNIV :: 'a::complete_space set)" |
|
2514 |
proof(simp add: complete_def, rule, rule) |
|
2515 |
fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" |
|
2516 |
hence "convergent f" by (rule Cauchy_convergent) |
|
2517 |
hence "\<exists>l. f ----> l" unfolding convergent_def . |
|
2518 |
thus "\<exists>l. (f ---> l) sequentially" unfolding LIMSEQ_conv_tendsto . |
|
2519 |
qed |
|
2520 |
||
2521 |
lemma complete_imp_closed: assumes "complete s" shows "closed s" |
|
2522 |
proof - |
|
2523 |
{ fix x assume "x islimpt s" |
|
2524 |
then obtain f where f: "\<forall>n. f n \<in> s - {x}" "(f ---> x) sequentially" |
|
2525 |
unfolding islimpt_sequential by auto |
|
2526 |
then obtain l where l: "l\<in>s" "(f ---> l) sequentially" |
|
2527 |
using `complete s`[unfolded complete_def] using convergent_imp_cauchy[of f x] by auto |
|
2528 |
hence "x \<in> s" using Lim_unique[of sequentially f l x] trivial_limit_sequentially f(2) by auto |
|
2529 |
} |
|
2530 |
thus "closed s" unfolding closed_limpt by auto |
|
2531 |
qed |
|
2532 |
||
2533 |
lemma complete_eq_closed: |
|
2534 |
fixes s :: "'a::complete_space set" |
|
2535 |
shows "complete s \<longleftrightarrow> closed s" (is "?lhs = ?rhs") |
|
2536 |
proof |
|
2537 |
assume ?lhs thus ?rhs by (rule complete_imp_closed) |
|
2538 |
next |
|
2539 |
assume ?rhs |
|
2540 |
{ fix f assume as:"\<forall>n::nat. f n \<in> s" "Cauchy f" |
|
2541 |
then obtain l where "(f ---> l) sequentially" using complete_univ[unfolded complete_def, THEN spec[where x=f]] by auto |
|
2542 |
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 } |
|
2543 |
thus ?lhs unfolding complete_def by auto |
|
2544 |
qed |
|
2545 |
||
2546 |
lemma convergent_eq_cauchy: |
|
2547 |
fixes s :: "nat \<Rightarrow> 'a::complete_space" |
|
2548 |
shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s" (is "?lhs = ?rhs") |
|
2549 |
proof |
|
2550 |
assume ?lhs then obtain l where "(s ---> l) sequentially" by auto |
|
2551 |
thus ?rhs using convergent_imp_cauchy by auto |
|
2552 |
next |
|
2553 |
assume ?rhs thus ?lhs using complete_univ[unfolded complete_def, THEN spec[where x=s]] by auto |
|
2554 |
qed |
|
2555 |
||
2556 |
lemma convergent_imp_bounded: |
|
2557 |
fixes s :: "nat \<Rightarrow> 'a::metric_space" |
|
2558 |
shows "(s ---> l) sequentially ==> bounded (s ` (UNIV::(nat set)))" |
|
2559 |
using convergent_imp_cauchy[of s] |
|
2560 |
using cauchy_imp_bounded[of s] |
|
2561 |
unfolding image_def |
|
2562 |
by auto |
|
2563 |
||
36437 | 2564 |
subsubsection{* Total boundedness *} |
33175 | 2565 |
|
2566 |
fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where |
|
2567 |
"helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))" |
|
2568 |
declare helper_1.simps[simp del] |
|
2569 |
||
2570 |
lemma compact_imp_totally_bounded: |
|
2571 |
assumes "compact s" |
|
2572 |
shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k))" |
|
2573 |
proof(rule, rule, rule ccontr) |
|
2574 |
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)" |
|
2575 |
def x \<equiv> "helper_1 s e" |
|
2576 |
{ fix n |
|
2577 |
have "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" |
|
2578 |
proof(induct_tac rule:nat_less_induct) |
|
2579 |
fix n def Q \<equiv> "(\<lambda>y. y \<in> s \<and> (\<forall>m<n. \<not> dist (x m) y < e))" |
|
2580 |
assume as:"\<forall>m<n. x m \<in> s \<and> (\<forall>ma<m. \<not> dist (x ma) (x m) < e)" |
|
2581 |
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 |
|
2582 |
then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)" unfolding subset_eq by auto |
|
2583 |
have "Q (x n)" unfolding x_def and helper_1.simps[of s e n] |
|
2584 |
apply(rule someI2[where a=z]) unfolding x_def[symmetric] and Q_def using z by auto |
|
2585 |
thus "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" unfolding Q_def by auto |
|
2586 |
qed } |
|
2587 |
hence "\<forall>n::nat. x n \<in> s" and x:"\<forall>n. \<forall>m < n. \<not> (dist (x m) (x n) < e)" by blast+ |
|
2588 |
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 |
|
2589 |
from this(3) have "Cauchy (x \<circ> r)" using convergent_imp_cauchy by auto |
|
2590 |
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 |
|
2591 |
show False |
|
2592 |
using N[THEN spec[where x=N], THEN spec[where x="N+1"]] |
|
2593 |
using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]] |
|
2594 |
using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto |
|
2595 |
qed |
|
2596 |
||
36437 | 2597 |
subsubsection{* Heine-Borel theorem *} |
2598 |
||
2599 |
text {* Following Burkill \& Burkill vol. 2. *} |
|
33175 | 2600 |
|
2601 |
lemma heine_borel_lemma: fixes s::"'a::metric_space set" |
|
2602 |
assumes "compact s" "s \<subseteq> (\<Union> t)" "\<forall>b \<in> t. open b" |
|
2603 |
shows "\<exists>e>0. \<forall>x \<in> s. \<exists>b \<in> t. ball x e \<subseteq> b" |
|
2604 |
proof(rule ccontr) |
|
2605 |
assume "\<not> (\<exists>e>0. \<forall>x\<in>s. \<exists>b\<in>t. ball x e \<subseteq> b)" |
|
2606 |
hence cont:"\<forall>e>0. \<exists>x\<in>s. \<forall>xa\<in>t. \<not> (ball x e \<subseteq> xa)" by auto |
|
2607 |
{ fix n::nat |
|
2608 |
have "1 / real (n + 1) > 0" by auto |
|
2609 |
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 } |
|
2610 |
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 |
|
2611 |
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)" |
|
2612 |
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 |
|
2613 |
||
2614 |
then obtain l r where l:"l\<in>s" and r:"subseq r" and lr:"((f \<circ> r) ---> l) sequentially" |
|
2615 |
using assms(1)[unfolded compact_def, THEN spec[where x=f]] by auto |
|
2616 |
||
2617 |
obtain b where "l\<in>b" "b\<in>t" using assms(2) and l by auto |
|
2618 |
then obtain e where "e>0" and e:"\<forall>z. dist z l < e \<longrightarrow> z\<in>b" |
|
2619 |
using assms(3)[THEN bspec[where x=b]] unfolding open_dist by auto |
|
2620 |
||
2621 |
then obtain N1 where N1:"\<forall>n\<ge>N1. dist ((f \<circ> r) n) l < e / 2" |
|
2622 |
using lr[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto |
|
2623 |
||
2624 |
obtain N2::nat where N2:"N2>0" "inverse (real N2) < e /2" using real_arch_inv[of "e/2"] and `e>0` by auto |
|
2625 |
have N2':"inverse (real (r (N1 + N2) +1 )) < e/2" |
|
2626 |
apply(rule order_less_trans) apply(rule less_imp_inverse_less) using N2 |
|
2627 |
using subseq_bigger[OF r, of "N1 + N2"] by auto |
|
2628 |
||
2629 |
def x \<equiv> "(f (r (N1 + N2)))" |
|
2630 |
have x:"\<not> ball x (inverse (real (r (N1 + N2) + 1))) \<subseteq> b" unfolding x_def |
|
2631 |
using f[THEN spec[where x="r (N1 + N2)"]] using `b\<in>t` by auto |
|
2632 |
have "\<exists>y\<in>ball x (inverse (real (r (N1 + N2) + 1))). y\<notin>b" apply(rule ccontr) using x by auto |
|
2633 |
then obtain y where y:"y \<in> ball x (inverse (real (r (N1 + N2) + 1)))" "y \<notin> b" by auto |
|
2634 |
||
2635 |
have "dist x l < e/2" using N1 unfolding x_def o_def by auto |
|
2636 |
hence "dist y l < e" using y N2' using dist_triangle[of y l x]by (auto simp add:dist_commute) |
|
2637 |
||
2638 |
thus False using e and `y\<notin>b` by auto |
|
2639 |
qed |
|
2640 |
||
2641 |
lemma compact_imp_heine_borel: "compact s ==> (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) |
|
2642 |
\<longrightarrow> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" |
|
2643 |
proof clarify |
|
2644 |
fix f assume "compact s" " \<forall>t\<in>f. open t" "s \<subseteq> \<Union>f" |
|
2645 |
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 |
|
2646 |
hence "\<forall>x\<in>s. \<exists>b. b\<in>f \<and> ball x e \<subseteq> b" by auto |
|
2647 |
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 |
|
2648 |
then obtain bb where bb:"\<forall>x\<in>s. (bb x) \<in> f \<and> ball x e \<subseteq> (bb x)" by blast |
|
2649 |
||
2650 |
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 |
|
2651 |
then obtain k where k:"finite k" "k \<subseteq> s" "s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" by auto |
|
2652 |
||
2653 |
have "finite (bb ` k)" using k(1) by auto |
|
2654 |
moreover |
|
2655 |
{ fix x assume "x\<in>s" |
|
2656 |
hence "x\<in>\<Union>(\<lambda>x. ball x e) ` k" using k(3) unfolding subset_eq by auto |
|
2657 |
hence "\<exists>X\<in>bb ` k. x \<in> X" using bb k(2) by blast |
|
2658 |
hence "x \<in> \<Union>(bb ` k)" using Union_iff[of x "bb ` k"] by auto |
|
2659 |
} |
|
2660 |
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 |
|
2661 |
qed |
|
2662 |
||
36437 | 2663 |
subsubsection {* Bolzano-Weierstrass property *} |
33175 | 2664 |
|
2665 |
lemma heine_borel_imp_bolzano_weierstrass: |
|
2666 |
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'))" |
|
2667 |
"infinite t" "t \<subseteq> s" |
|
2668 |
shows "\<exists>x \<in> s. x islimpt t" |
|
2669 |
proof(rule ccontr) |
|
2670 |
assume "\<not> (\<exists>x \<in> s. x islimpt t)" |
|
2671 |
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 |
|
2672 |
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 |
|
2673 |
obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g" |
|
2674 |
using assms(1)[THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto |
|
2675 |
from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto |
|
2676 |
{ fix x y assume "x\<in>t" "y\<in>t" "f x = f y" |
|
2677 |
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 |
|
2678 |
hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto } |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2679 |
hence "inj_on f t" unfolding inj_on_def by simp |
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
2680 |
hence "infinite (f ` t)" using assms(2) using finite_imageD by auto |
33175 | 2681 |
moreover |
2682 |
{ fix x assume "x\<in>t" "f x \<notin> g" |
|
2683 |
from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto |
|
2684 |
then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto |
|
2685 |
hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto |
|
2686 |
hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto } |
|
2687 |
hence "f ` t \<subseteq> g" by auto |
|
2688 |
ultimately show False using g(2) using finite_subset by auto |
|
2689 |
qed |
|
2690 |
||
36437 | 2691 |
subsubsection {* Complete the chain of compactness variants *} |
33175 | 2692 |
|
2693 |
primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where |
|
2694 |
"helper_2 beyond 0 = beyond 0" | |
|
2695 |
"helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )" |
|
2696 |
||
2697 |
lemma bolzano_weierstrass_imp_bounded: fixes s::"'a::metric_space set" |
|
2698 |
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
2699 |
shows "bounded s" |
|
2700 |
proof(rule ccontr) |
|
2701 |
assume "\<not> bounded s" |
|
2702 |
then obtain beyond where "\<forall>a. beyond a \<in>s \<and> \<not> dist undefined (beyond a) \<le> a" |
|
2703 |
unfolding bounded_any_center [where a=undefined] |
|
2704 |
apply simp using choice[of "\<lambda>a x. x\<in>s \<and> \<not> dist undefined x \<le> a"] by auto |
|
2705 |
hence beyond:"\<And>a. beyond a \<in>s" "\<And>a. dist undefined (beyond a) > a" |
|
2706 |
unfolding linorder_not_le by auto |
|
2707 |
def x \<equiv> "helper_2 beyond" |
|
2708 |
||
2709 |
{ fix m n ::nat assume "m<n" |
|
2710 |
hence "dist undefined (x m) + 1 < dist undefined (x n)" |
|
2711 |
proof(induct n) |
|
2712 |
case 0 thus ?case by auto |
|
2713 |
next |
|
2714 |
case (Suc n) |
|
2715 |
have *:"dist undefined (x n) + 1 < dist undefined (x (Suc n))" |
|
2716 |
unfolding x_def and helper_2.simps |
|
2717 |
using beyond(2)[of "dist undefined (helper_2 beyond n) + 1"] by auto |
|
2718 |
thus ?case proof(cases "m < n") |
|
2719 |
case True thus ?thesis using Suc and * by auto |
|
2720 |
next |
|
2721 |
case False hence "m = n" using Suc(2) by auto |
|
2722 |
thus ?thesis using * by auto |
|
2723 |
qed |
|
2724 |
qed } note * = this |
|
2725 |
{ fix m n ::nat assume "m\<noteq>n" |
|
2726 |
have "1 < dist (x m) (x n)" |
|
2727 |
proof(cases "m<n") |
|
2728 |
case True |
|
2729 |
hence "1 < dist undefined (x n) - dist undefined (x m)" using *[of m n] by auto |
|
2730 |
thus ?thesis using dist_triangle [of undefined "x n" "x m"] by arith |
|
2731 |
next |
|
2732 |
case False hence "n<m" using `m\<noteq>n` by auto |
|
2733 |
hence "1 < dist undefined (x m) - dist undefined (x n)" using *[of n m] by auto |
|
2734 |
thus ?thesis using dist_triangle2 [of undefined "x m" "x n"] by arith |
|
2735 |
qed } note ** = this |
|
2736 |
{ fix a b assume "x a = x b" "a \<noteq> b" |
|
2737 |
hence False using **[of a b] by auto } |
|
2738 |
hence "inj x" unfolding inj_on_def by auto |
|
2739 |
moreover |
|
2740 |
{ fix n::nat |
|
2741 |
have "x n \<in> s" |
|
2742 |
proof(cases "n = 0") |
|
2743 |
case True thus ?thesis unfolding x_def using beyond by auto |
|
2744 |
next |
|
2745 |
case False then obtain z where "n = Suc z" using not0_implies_Suc by auto |
|
2746 |
thus ?thesis unfolding x_def using beyond by auto |
|
2747 |
qed } |
|
2748 |
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 |
|
2749 |
||
2750 |
then obtain l where "l\<in>s" and l:"l islimpt range x" using assms[THEN spec[where x="range x"]] by auto |
|
2751 |
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 |
|
2752 |
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"]] |
|
2753 |
unfolding dist_nz by auto |
|
2754 |
show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto |
|
2755 |
qed |
|
2756 |
||
2757 |
lemma sequence_infinite_lemma: |
|
2758 |
fixes l :: "'a::metric_space" (* TODO: generalize *) |
|
2759 |
assumes "\<forall>n::nat. (f n \<noteq> l)" "(f ---> l) sequentially" |
|
34104 | 2760 |
shows "infinite (range f)" |
2761 |
proof |
|
2762 |
let ?A = "(\<lambda>x. dist x l) ` range f" |
|
2763 |
assume "finite (range f)" |
|
33175 | 2764 |
hence **:"finite ?A" "?A \<noteq> {}" by auto |
2765 |
obtain k where k:"dist (f k) l = Min ?A" using Min_in[OF **] by auto |
|
2766 |
have "0 < Min ?A" using assms(1) unfolding dist_nz unfolding Min_gr_iff[OF **] by auto |
|
2767 |
then obtain N where "dist (f N) l < Min ?A" using assms(2)[unfolded Lim_sequentially, THEN spec[where x="Min ?A"]] by auto |
|
2768 |
moreover have "dist (f N) l \<in> ?A" by auto |
|
2769 |
ultimately show False using Min_le[OF **(1), of "dist (f N) l"] by auto |
|
2770 |
qed |
|
2771 |
||
2772 |
lemma sequence_unique_limpt: |
|
2773 |
fixes l :: "'a::metric_space" (* TODO: generalize *) |
|
34104 | 2774 |
assumes "\<forall>n::nat. (f n \<noteq> l)" "(f ---> l) sequentially" "l' islimpt (range f)" |
33175 | 2775 |
shows "l' = l" |
2776 |
proof(rule ccontr) |
|
2777 |
def e \<equiv> "dist l' l" |
|
2778 |
assume "l' \<noteq> l" hence "e>0" unfolding dist_nz e_def by auto |
|
2779 |
then obtain N::nat where N:"\<forall>n\<ge>N. dist (f n) l < e / 2" |
|
2780 |
using assms(2)[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto |
|
2781 |
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}))" |
|
2782 |
have "d>0" using `e>0` unfolding d_def e_def using zero_le_dist[of _ l', unfolded order_le_less] by auto |
|
2783 |
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 |
|
2784 |
have "k\<ge>N" using k(1)[unfolded dist_nz] using k(2)[unfolded d_def] |
|
35820
b57c3afd1484
dropped odd interpretation of comm_monoid_mult into comm_monoid_add; consider Min.insert_idem as default simp rule
haftmann
parents:
35172
diff
changeset
|
2785 |
by (force simp del: Min.insert_idem) |
b57c3afd1484
dropped odd interpretation of comm_monoid_mult into comm_monoid_add; consider Min.insert_idem as default simp rule
haftmann
parents:
35172
diff
changeset
|
2786 |
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 simp del: Min.insert_idem) |
33175 | 2787 |
thus False unfolding e_def by auto |
2788 |
qed |
|
2789 |
||
2790 |
lemma bolzano_weierstrass_imp_closed: |
|
2791 |
fixes s :: "'a::metric_space set" (* TODO: can this be generalized? *) |
|
2792 |
assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
2793 |
shows "closed s" |
|
2794 |
proof- |
|
2795 |
{ fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially" |
|
2796 |
hence "l \<in> s" |
|
2797 |
proof(cases "\<forall>n. x n \<noteq> l") |
|
2798 |
case False thus "l\<in>s" using as(1) by auto |
|
2799 |
next |
|
2800 |
case True note cas = this |
|
34104 | 2801 |
with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto |
2802 |
then obtain l' where "l'\<in>s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto |
|
33175 | 2803 |
thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto |
2804 |
qed } |
|
2805 |
thus ?thesis unfolding closed_sequential_limits by fast |
|
2806 |
qed |
|
2807 |
||
2808 |
text{* Hence express everything as an equivalence. *} |
|
2809 |
||
2810 |
lemma compact_eq_heine_borel: |
|
2811 |
fixes s :: "'a::heine_borel set" |
|
2812 |
shows "compact s \<longleftrightarrow> |
|
2813 |
(\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) |
|
2814 |
--> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" (is "?lhs = ?rhs") |
|
2815 |
proof |
|
2816 |
assume ?lhs thus ?rhs using compact_imp_heine_borel[of s] by blast |
|
2817 |
next |
|
2818 |
assume ?rhs |
|
2819 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. x islimpt t)" |
|
2820 |
by (blast intro: heine_borel_imp_bolzano_weierstrass[of s]) |
|
2821 |
thus ?lhs using bolzano_weierstrass_imp_bounded[of s] bolzano_weierstrass_imp_closed[of s] bounded_closed_imp_compact[of s] by blast |
|
2822 |
qed |
|
2823 |
||
2824 |
lemma compact_eq_bolzano_weierstrass: |
|
2825 |
fixes s :: "'a::heine_borel set" |
|
2826 |
shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs") |
|
2827 |
proof |
|
2828 |
assume ?lhs thus ?rhs unfolding compact_eq_heine_borel using heine_borel_imp_bolzano_weierstrass[of s] by auto |
|
2829 |
next |
|
2830 |
assume ?rhs thus ?lhs using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed bounded_closed_imp_compact by auto |
|
2831 |
qed |
|
2832 |
||
2833 |
lemma compact_eq_bounded_closed: |
|
2834 |
fixes s :: "'a::heine_borel set" |
|
2835 |
shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs") |
|
2836 |
proof |
|
2837 |
assume ?lhs thus ?rhs unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto |
|
2838 |
next |
|
2839 |
assume ?rhs thus ?lhs using bounded_closed_imp_compact by auto |
|
2840 |
qed |
|
2841 |
||
2842 |
lemma compact_imp_bounded: |
|
2843 |
fixes s :: "'a::metric_space set" |
|
2844 |
shows "compact s ==> bounded s" |
|
2845 |
proof - |
|
2846 |
assume "compact s" |
|
2847 |
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')" |
|
2848 |
by (rule compact_imp_heine_borel) |
|
2849 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
|
2850 |
using heine_borel_imp_bolzano_weierstrass[of s] by auto |
|
2851 |
thus "bounded s" |
|
2852 |
by (rule bolzano_weierstrass_imp_bounded) |
|
2853 |
qed |
|
2854 |
||
2855 |
lemma compact_imp_closed: |
|
2856 |
fixes s :: "'a::metric_space set" |
|
2857 |
shows "compact s ==> closed s" |
|
2858 |
proof - |
|
2859 |
assume "compact s" |
|
2860 |
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')" |
|
2861 |
by (rule compact_imp_heine_borel) |
|
2862 |
hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
|
2863 |
using heine_borel_imp_bolzano_weierstrass[of s] by auto |
|
2864 |
thus "closed s" |
|
2865 |
by (rule bolzano_weierstrass_imp_closed) |
|
2866 |
qed |
|
2867 |
||
2868 |
text{* In particular, some common special cases. *} |
|
2869 |
||
2870 |
lemma compact_empty[simp]: |
|
2871 |
"compact {}" |
|
2872 |
unfolding compact_def |
|
2873 |
by simp |
|
2874 |
||
2875 |
(* TODO: can any of the next 3 lemmas be generalized to metric spaces? *) |
|
2876 |
||
2877 |
(* FIXME : Rename *) |
|
2878 |
lemma compact_union[intro]: |
|
2879 |
fixes s t :: "'a::heine_borel set" |
|
2880 |
shows "compact s \<Longrightarrow> compact t ==> compact (s \<union> t)" |
|
2881 |
unfolding compact_eq_bounded_closed |
|
2882 |
using bounded_Un[of s t] |
|
2883 |
using closed_Un[of s t] |
|
2884 |
by simp |
|
2885 |
||
2886 |
lemma compact_inter[intro]: |
|
2887 |
fixes s t :: "'a::heine_borel set" |
|
2888 |
shows "compact s \<Longrightarrow> compact t ==> compact (s \<inter> t)" |
|
2889 |
unfolding compact_eq_bounded_closed |
|
2890 |
using bounded_Int[of s t] |
|
2891 |
using closed_Int[of s t] |
|
2892 |
by simp |
|
2893 |
||
2894 |
lemma compact_inter_closed[intro]: |
|
2895 |
fixes s t :: "'a::heine_borel set" |
|
2896 |
shows "compact s \<Longrightarrow> closed t ==> compact (s \<inter> t)" |
|
2897 |
unfolding compact_eq_bounded_closed |
|
2898 |
using closed_Int[of s t] |
|
2899 |
using bounded_subset[of "s \<inter> t" s] |
|
2900 |
by blast |
|
2901 |
||
2902 |
lemma closed_inter_compact[intro]: |
|
2903 |
fixes s t :: "'a::heine_borel set" |
|
2904 |
shows "closed s \<Longrightarrow> compact t ==> compact (s \<inter> t)" |
|
2905 |
proof- |
|
2906 |
assume "closed s" "compact t" |
|
2907 |
moreover |
|
2908 |
have "s \<inter> t = t \<inter> s" by auto ultimately |
|
2909 |
show ?thesis |
|
2910 |
using compact_inter_closed[of t s] |
|
2911 |
by auto |
|
2912 |
qed |
|
2913 |
||
2914 |
lemma closed_sing [simp]: |
|
2915 |
fixes a :: "'a::metric_space" |
|
2916 |
shows "closed {a}" |
|
2917 |
apply (clarsimp simp add: closed_def open_dist) |
|
2918 |
apply (rule ccontr) |
|
2919 |
apply (drule_tac x="dist x a" in spec) |
|
2920 |
apply (simp add: dist_nz dist_commute) |
|
2921 |
done |
|
2922 |
||
2923 |
lemma finite_imp_closed: |
|
2924 |
fixes s :: "'a::metric_space set" |
|
2925 |
shows "finite s ==> closed s" |
|
2926 |
proof (induct set: finite) |
|
2927 |
case empty show "closed {}" by simp |
|
2928 |
next |
|
2929 |
case (insert x F) |
|
2930 |
hence "closed ({x} \<union> F)" by (simp only: closed_Un closed_sing) |
|
2931 |
thus "closed (insert x F)" by simp |
|
2932 |
qed |
|
2933 |
||
2934 |
lemma finite_imp_compact: |
|
2935 |
fixes s :: "'a::heine_borel set" |
|
2936 |
shows "finite s ==> compact s" |
|
2937 |
unfolding compact_eq_bounded_closed |
|
2938 |
using finite_imp_closed finite_imp_bounded |
|
2939 |
by blast |
|
2940 |
||
2941 |
lemma compact_sing [simp]: "compact {a}" |
|
2942 |
unfolding compact_def o_def subseq_def |
|
2943 |
by (auto simp add: tendsto_const) |
|
2944 |
||
2945 |
lemma compact_cball[simp]: |
|
2946 |
fixes x :: "'a::heine_borel" |
|
2947 |
shows "compact(cball x e)" |
|
2948 |
using compact_eq_bounded_closed bounded_cball closed_cball |
|
2949 |
by blast |
|
2950 |
||
2951 |
lemma compact_frontier_bounded[intro]: |
|
2952 |
fixes s :: "'a::heine_borel set" |
|
2953 |
shows "bounded s ==> compact(frontier s)" |
|
2954 |
unfolding frontier_def |
|
2955 |
using compact_eq_bounded_closed |
|
2956 |
by blast |
|
2957 |
||
2958 |
lemma compact_frontier[intro]: |
|
2959 |
fixes s :: "'a::heine_borel set" |
|
2960 |
shows "compact s ==> compact (frontier s)" |
|
2961 |
using compact_eq_bounded_closed compact_frontier_bounded |
|
2962 |
by blast |
|
2963 |
||
2964 |
lemma frontier_subset_compact: |
|
2965 |
fixes s :: "'a::heine_borel set" |
|
2966 |
shows "compact s ==> frontier s \<subseteq> s" |
|
2967 |
using frontier_subset_closed compact_eq_bounded_closed |
|
2968 |
by blast |
|
2969 |
||
2970 |
lemma open_delete: |
|
2971 |
fixes s :: "'a::metric_space set" |
|
2972 |
shows "open s ==> open(s - {x})" |
|
2973 |
using open_Diff[of s "{x}"] closed_sing |
|
2974 |
by blast |
|
2975 |
||
2976 |
text{* Finite intersection property. I could make it an equivalence in fact. *} |
|
2977 |
||
2978 |
lemma compact_imp_fip: |
|
2979 |
fixes s :: "'a::heine_borel set" |
|
2980 |
assumes "compact s" "\<forall>t \<in> f. closed t" |
|
2981 |
"\<forall>f'. finite f' \<and> f' \<subseteq> f --> (s \<inter> (\<Inter> f') \<noteq> {})" |
|
2982 |
shows "s \<inter> (\<Inter> f) \<noteq> {}" |
|
2983 |
proof |
|
2984 |
assume as:"s \<inter> (\<Inter> f) = {}" |
|
34105 | 2985 |
hence "s \<subseteq> \<Union> uminus ` f" by auto |
2986 |
moreover have "Ball (uminus ` f) open" using open_Diff closed_Diff using assms(2) by auto |
|
2987 |
ultimately obtain f' where f':"f' \<subseteq> uminus ` f" "finite f'" "s \<subseteq> \<Union>f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\<lambda>t. - t) ` f"]] by auto |
|
2988 |
hence "finite (uminus ` f') \<and> uminus ` f' \<subseteq> f" by(auto simp add: Diff_Diff_Int) |
|
2989 |
hence "s \<inter> \<Inter>uminus ` f' \<noteq> {}" using assms(3)[THEN spec[where x="uminus ` f'"]] by auto |
|
33175 | 2990 |
thus False using f'(3) unfolding subset_eq and Union_iff by blast |
2991 |
qed |
|
2992 |
||
2993 |
subsection{* Bounded closed nest property (proof does not use Heine-Borel). *} |
|
2994 |
||
2995 |
lemma bounded_closed_nest: |
|
2996 |
assumes "\<forall>n. closed(s n)" "\<forall>n. (s n \<noteq> {})" |
|
2997 |
"(\<forall>m n. m \<le> n --> s n \<subseteq> s m)" "bounded(s 0)" |
|
2998 |
shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s(n)" |
|
2999 |
proof- |
|
3000 |
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 |
|
3001 |
from assms(4,1) have *:"compact (s 0)" using bounded_closed_imp_compact[of "s 0"] by auto |
|
3002 |
||
3003 |
then obtain l r where lr:"l\<in>s 0" "subseq r" "((x \<circ> r) ---> l) sequentially" |
|
3004 |
unfolding compact_def apply(erule_tac x=x in allE) using x using assms(3) by blast |
|
3005 |
||
3006 |
{ fix n::nat |
|
3007 |
{ fix e::real assume "e>0" |
|
3008 |
with lr(3) obtain N where N:"\<forall>m\<ge>N. dist ((x \<circ> r) m) l < e" unfolding Lim_sequentially by auto |
|
3009 |
hence "dist ((x \<circ> r) (max N n)) l < e" by auto |
|
3010 |
moreover |
|
3011 |
have "r (max N n) \<ge> n" using lr(2) using subseq_bigger[of r "max N n"] by auto |
|
3012 |
hence "(x \<circ> r) (max N n) \<in> s n" |
|
3013 |
using x apply(erule_tac x=n in allE) |
|
3014 |
using x apply(erule_tac x="r (max N n)" in allE) |
|
3015 |
using assms(3) apply(erule_tac x=n in allE)apply( erule_tac x="r (max N n)" in allE) by auto |
|
3016 |
ultimately have "\<exists>y\<in>s n. dist y l < e" by auto |
|
3017 |
} |
|
3018 |
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by blast |
|
3019 |
} |
|
3020 |
thus ?thesis by auto |
|
3021 |
qed |
|
3022 |
||
3023 |
text{* Decreasing case does not even need compactness, just completeness. *} |
|
3024 |
||
3025 |
lemma decreasing_closed_nest: |
|
3026 |
assumes "\<forall>n. closed(s n)" |
|
3027 |
"\<forall>n. (s n \<noteq> {})" |
|
3028 |
"\<forall>m n. m \<le> n --> s n \<subseteq> s m" |
|
3029 |
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y \<in> (s n). dist x y < e" |
|
3030 |
shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s n" |
|
3031 |
proof- |
|
3032 |
have "\<forall>n. \<exists> x. x\<in>s n" using assms(2) by auto |
|
3033 |
hence "\<exists>t. \<forall>n. t n \<in> s n" using choice[of "\<lambda> n x. x \<in> s n"] by auto |
|
3034 |
then obtain t where t: "\<forall>n. t n \<in> s n" by auto |
|
3035 |
{ fix e::real assume "e>0" |
|
3036 |
then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" using assms(4) by auto |
|
3037 |
{ fix m n ::nat assume "N \<le> m \<and> N \<le> n" |
|
3038 |
hence "t m \<in> s N" "t n \<in> s N" using assms(3) t unfolding subset_eq t by blast+ |
|
3039 |
hence "dist (t m) (t n) < e" using N by auto |
|
3040 |
} |
|
3041 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" by auto |
|
3042 |
} |
|
3043 |
hence "Cauchy t" unfolding cauchy_def by auto |
|
3044 |
then obtain l where l:"(t ---> l) sequentially" using complete_univ unfolding complete_def by auto |
|
3045 |
{ fix n::nat |
|
3046 |
{ fix e::real assume "e>0" |
|
3047 |
then obtain N::nat where N:"\<forall>n\<ge>N. dist (t n) l < e" using l[unfolded Lim_sequentially] by auto |
|
3048 |
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 |
|
3049 |
hence "\<exists>y\<in>s n. dist y l < e" apply(rule_tac x="t (max n N)" in bexI) using N by auto |
|
3050 |
} |
|
3051 |
hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by auto |
|
3052 |
} |
|
3053 |
then show ?thesis by auto |
|
3054 |
qed |
|
3055 |
||
3056 |
text{* Strengthen it to the intersection actually being a singleton. *} |
|
3057 |
||
3058 |
lemma decreasing_closed_nest_sing: |
|
34104 | 3059 |
fixes s :: "nat \<Rightarrow> 'a::heine_borel set" |
33175 | 3060 |
assumes "\<forall>n. closed(s n)" |
3061 |
"\<forall>n. s n \<noteq> {}" |
|
3062 |
"\<forall>m n. m \<le> n --> s n \<subseteq> s m" |
|
3063 |
"\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e" |
|
34104 | 3064 |
shows "\<exists>a. \<Inter>(range s) = {a}" |
33175 | 3065 |
proof- |
3066 |
obtain a where a:"\<forall>n. a \<in> s n" using decreasing_closed_nest[of s] using assms by auto |
|
34104 | 3067 |
{ fix b assume b:"b \<in> \<Inter>(range s)" |
33175 | 3068 |
{ fix e::real assume "e>0" |
3069 |
hence "dist a b < e" using assms(4 )using b using a by blast |
|
3070 |
} |
|
3071 |
hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz real_less_def) |
|
3072 |
} |
|
34104 | 3073 |
with a have "\<Inter>(range s) = {a}" unfolding image_def by auto |
3074 |
thus ?thesis .. |
|
33175 | 3075 |
qed |
3076 |
||
3077 |
text{* Cauchy-type criteria for uniform convergence. *} |
|
3078 |
||
3079 |
lemma uniformly_convergent_eq_cauchy: fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::heine_borel" shows |
|
3080 |
"(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e) \<longleftrightarrow> |
|
3081 |
(\<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") |
|
3082 |
proof(rule) |
|
3083 |
assume ?lhs |
|
3084 |
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 |
|
3085 |
{ fix e::real assume "e>0" |
|
3086 |
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 |
|
3087 |
{ fix n m::nat and x::"'b" assume "N \<le> m \<and> N \<le> n \<and> P x" |
|
3088 |
hence "dist (s m x) (s n x) < e" |
|
3089 |
using N[THEN spec[where x=m], THEN spec[where x=x]] |
|
3090 |
using N[THEN spec[where x=n], THEN spec[where x=x]] |
|
3091 |
using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto } |
|
3092 |
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 } |
|
3093 |
thus ?rhs by auto |
|
3094 |
next |
|
3095 |
assume ?rhs |
|
3096 |
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 |
|
3097 |
then obtain l where l:"\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" unfolding convergent_eq_cauchy[THEN sym] |
|
3098 |
using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] by auto |
|
3099 |
{ fix e::real assume "e>0" |
|
3100 |
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" |
|
3101 |
using `?rhs`[THEN spec[where x="e/2"]] by auto |
|
3102 |
{ fix x assume "P x" |
|
3103 |
then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2" |
|
3104 |
using l[THEN spec[where x=x], unfolded Lim_sequentially] using `e>0` by(auto elim!: allE[where x="e/2"]) |
|
3105 |
fix n::nat assume "n\<ge>N" |
|
3106 |
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]] |
|
3107 |
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) } |
|
3108 |
hence "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" by auto } |
|
3109 |
thus ?lhs by auto |
|
3110 |
qed |
|
3111 |
||
3112 |
lemma uniformly_cauchy_imp_uniformly_convergent: |
|
3113 |
fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::heine_borel" |
|
3114 |
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" |
|
3115 |
"\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n --> dist(s n x)(l x) < e)" |
|
3116 |
shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e" |
|
3117 |
proof- |
|
3118 |
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" |
|
3119 |
using assms(1) unfolding uniformly_convergent_eq_cauchy[THEN sym] by auto |
|
3120 |
moreover |
|
3121 |
{ fix x assume "P x" |
|
3122 |
hence "l x = l' x" using Lim_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"] |
|
3123 |
using l and assms(2) unfolding Lim_sequentially by blast } |
|
3124 |
ultimately show ?thesis by auto |
|
3125 |
qed |
|
3126 |
||
36437 | 3127 |
subsection {* Continuity *} |
3128 |
||
3129 |
text {* Define continuity over a net to take in restrictions of the set. *} |
|
33175 | 3130 |
|
3131 |
definition |
|
3132 |
continuous :: "'a::t2_space net \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool" where |
|
3133 |
"continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net" |
|
3134 |
||
3135 |
lemma continuous_trivial_limit: |
|
3136 |
"trivial_limit net ==> continuous net f" |
|
3137 |
unfolding continuous_def tendsto_def trivial_limit_eq by auto |
|
3138 |
||
3139 |
lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f ---> f(x)) (at x within s)" |
|
3140 |
unfolding continuous_def |
|
3141 |
unfolding tendsto_def |
|
3142 |
using netlimit_within[of x s] |
|
3143 |
by (cases "trivial_limit (at x within s)") (auto simp add: trivial_limit_eventually) |
|
3144 |
||
3145 |
lemma continuous_at: "continuous (at x) f \<longleftrightarrow> (f ---> f(x)) (at x)" |
|
3146 |
using continuous_within [of x UNIV f] by (simp add: within_UNIV) |
|
3147 |
||
3148 |
lemma continuous_at_within: |
|
3149 |
assumes "continuous (at x) f" shows "continuous (at x within s) f" |
|
3150 |
using assms unfolding continuous_at continuous_within |
|
3151 |
by (rule Lim_at_within) |
|
3152 |
||
3153 |
text{* Derive the epsilon-delta forms, which we often use as "definitions" *} |
|
3154 |
||
3155 |
lemma continuous_within_eps_delta: |
|
3156 |
"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)" |
|
3157 |
unfolding continuous_within and Lim_within |
|
3158 |
apply auto unfolding dist_nz[THEN sym] apply(auto elim!:allE) apply(rule_tac x=d in exI) by auto |
|
3159 |
||
3160 |
lemma continuous_at_eps_delta: "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. |
|
3161 |
\<forall>x'. dist x' x < d --> dist(f x')(f x) < e)" |
|
3162 |
using continuous_within_eps_delta[of x UNIV f] |
|
3163 |
unfolding within_UNIV by blast |
|
3164 |
||
3165 |
text{* Versions in terms of open balls. *} |
|
3166 |
||
3167 |
lemma continuous_within_ball: |
|
3168 |
"continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. |
|
3169 |
f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") |
|
3170 |
proof |
|
3171 |
assume ?lhs |
|
3172 |
{ fix e::real assume "e>0" |
|
3173 |
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" |
|
3174 |
using `?lhs`[unfolded continuous_within Lim_within] by auto |
|
3175 |
{ fix y assume "y\<in>f ` (ball x d \<inter> s)" |
|
3176 |
hence "y \<in> ball (f x) e" using d(2) unfolding dist_nz[THEN sym] |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
3177 |
apply (auto simp add: dist_commute) apply(erule_tac x=xa in ballE) apply auto using `e>0` by auto |
33175 | 3178 |
} |
3179 |
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) } |
|
3180 |
thus ?rhs by auto |
|
3181 |
next |
|
3182 |
assume ?rhs thus ?lhs unfolding continuous_within Lim_within ball_def subset_eq |
|
3183 |
apply (auto simp add: dist_commute) apply(erule_tac x=e in allE) by auto |
|
3184 |
qed |
|
3185 |
||
3186 |
lemma continuous_at_ball: |
|
3187 |
"continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") |
|
3188 |
proof |
|
3189 |
assume ?lhs thus ?rhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball |
|
3190 |
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) |
|
3191 |
unfolding dist_nz[THEN sym] by auto |
|
3192 |
next |
|
3193 |
assume ?rhs thus ?lhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball |
|
3194 |
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) |
|
3195 |
qed |
|
3196 |
||
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3197 |
text{* Define setwise continuity in terms of limits within the set. *} |
33175 | 3198 |
|
3199 |
definition |
|
36359 | 3200 |
continuous_on :: |
3201 |
"'a set \<Rightarrow> ('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool" |
|
3202 |
where |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3203 |
"continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. (f ---> f x) (at x within s))" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3204 |
|
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3205 |
lemma continuous_on_topological: |
36359 | 3206 |
"continuous_on s f \<longleftrightarrow> |
3207 |
(\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3208 |
(\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3209 |
unfolding continuous_on_def tendsto_def |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3210 |
unfolding Limits.eventually_within eventually_at_topological |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3211 |
by (intro ball_cong [OF refl] all_cong imp_cong ex_cong conj_cong refl) auto |
36359 | 3212 |
|
3213 |
lemma continuous_on_iff: |
|
3214 |
"continuous_on s f \<longleftrightarrow> |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3215 |
(\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3216 |
unfolding continuous_on_def Lim_within |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3217 |
apply (intro ball_cong [OF refl] all_cong ex_cong) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3218 |
apply (rename_tac y, case_tac "y = x", simp) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3219 |
apply (simp add: dist_nz) |
36359 | 3220 |
done |
33175 | 3221 |
|
3222 |
definition |
|
3223 |
uniformly_continuous_on :: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3224 |
"'a set \<Rightarrow> ('a::metric_space \<Rightarrow> 'b::metric_space) \<Rightarrow> bool" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3225 |
where |
33175 | 3226 |
"uniformly_continuous_on s f \<longleftrightarrow> |
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3227 |
(\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" |
35172
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3228 |
|
33175 | 3229 |
text{* Some simple consequential lemmas. *} |
3230 |
||
3231 |
lemma uniformly_continuous_imp_continuous: |
|
3232 |
" uniformly_continuous_on s f ==> continuous_on s f" |
|
36359 | 3233 |
unfolding uniformly_continuous_on_def continuous_on_iff by blast |
33175 | 3234 |
|
3235 |
lemma continuous_at_imp_continuous_within: |
|
3236 |
"continuous (at x) f ==> continuous (at x within s) f" |
|
3237 |
unfolding continuous_within continuous_at using Lim_at_within by auto |
|
3238 |
||
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3239 |
lemma Lim_trivial_limit: "trivial_limit net \<Longrightarrow> (f ---> l) net" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3240 |
unfolding tendsto_def by (simp add: trivial_limit_eq) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3241 |
|
36359 | 3242 |
lemma continuous_at_imp_continuous_on: |
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3243 |
assumes "\<forall>x\<in>s. continuous (at x) f" |
33175 | 3244 |
shows "continuous_on s f" |
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3245 |
unfolding continuous_on_def |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3246 |
proof |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3247 |
fix x assume "x \<in> s" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3248 |
with assms have *: "(f ---> f (netlimit (at x))) (at x)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3249 |
unfolding continuous_def by simp |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3250 |
have "(f ---> f x) (at x)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3251 |
proof (cases "trivial_limit (at x)") |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3252 |
case True thus ?thesis |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3253 |
by (rule Lim_trivial_limit) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3254 |
next |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3255 |
case False |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3256 |
hence "netlimit (at x) = x" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3257 |
using netlimit_within [of x UNIV] |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3258 |
by (simp add: within_UNIV) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3259 |
with * show ?thesis by simp |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3260 |
qed |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3261 |
thus "(f ---> f x) (at x within s)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3262 |
by (rule Lim_at_within) |
33175 | 3263 |
qed |
3264 |
||
3265 |
lemma continuous_on_eq_continuous_within: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3266 |
"continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x within s) f)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3267 |
unfolding continuous_on_def continuous_def |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3268 |
apply (rule ball_cong [OF refl]) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3269 |
apply (case_tac "trivial_limit (at x within s)") |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3270 |
apply (simp add: Lim_trivial_limit) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3271 |
apply (simp add: netlimit_within) |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3272 |
done |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3273 |
|
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3274 |
lemmas continuous_on = continuous_on_def -- "legacy theorem name" |
33175 | 3275 |
|
3276 |
lemma continuous_on_eq_continuous_at: |
|
36359 | 3277 |
shows "open s ==> (continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x) f))" |
33175 | 3278 |
by (auto simp add: continuous_on continuous_at Lim_within_open) |
3279 |
||
3280 |
lemma continuous_within_subset: |
|
3281 |
"continuous (at x within s) f \<Longrightarrow> t \<subseteq> s |
|
3282 |
==> continuous (at x within t) f" |
|
3283 |
unfolding continuous_within by(metis Lim_within_subset) |
|
3284 |
||
3285 |
lemma continuous_on_subset: |
|
36359 | 3286 |
shows "continuous_on s f \<Longrightarrow> t \<subseteq> s ==> continuous_on t f" |
33175 | 3287 |
unfolding continuous_on by (metis subset_eq Lim_within_subset) |
3288 |
||
3289 |
lemma continuous_on_interior: |
|
36359 | 3290 |
shows "continuous_on s f \<Longrightarrow> x \<in> interior s ==> continuous (at x) f" |
33175 | 3291 |
unfolding interior_def |
3292 |
apply simp |
|
3293 |
by (meson continuous_on_eq_continuous_at continuous_on_subset) |
|
3294 |
||
3295 |
lemma continuous_on_eq: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3296 |
"(\<forall>x \<in> s. f x = g x) \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on s g" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3297 |
unfolding continuous_on_def tendsto_def Limits.eventually_within |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3298 |
by simp |
33175 | 3299 |
|
3300 |
text{* Characterization of various kinds of continuity in terms of sequences. *} |
|
3301 |
||
3302 |
(* \<longrightarrow> could be generalized, but \<longleftarrow> requires metric space *) |
|
3303 |
lemma continuous_within_sequentially: |
|
3304 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" |
|
3305 |
shows "continuous (at a within s) f \<longleftrightarrow> |
|
3306 |
(\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially |
|
3307 |
--> ((f o x) ---> f a) sequentially)" (is "?lhs = ?rhs") |
|
3308 |
proof |
|
3309 |
assume ?lhs |
|
3310 |
{ 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" |
|
3311 |
fix e::real assume "e>0" |
|
3312 |
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 |
|
3313 |
from x(2) `d>0` obtain N where N:"\<forall>n\<ge>N. dist (x n) a < d" by auto |
|
3314 |
hence "\<exists>N. \<forall>n\<ge>N. dist ((f \<circ> x) n) (f a) < e" |
|
3315 |
apply(rule_tac x=N in exI) using N d apply auto using x(1) |
|
3316 |
apply(erule_tac x=n in allE) apply(erule_tac x=n in allE) |
|
3317 |
apply(erule_tac x="x n" in ballE) apply auto unfolding dist_nz[THEN sym] apply auto using `e>0` by auto |
|
3318 |
} |
|
3319 |
thus ?rhs unfolding continuous_within unfolding Lim_sequentially by simp |
|
3320 |
next |
|
3321 |
assume ?rhs |
|
3322 |
{ fix e::real assume "e>0" |
|
3323 |
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)" |
|
3324 |
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 |
|
3325 |
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)" |
|
3326 |
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 |
|
3327 |
{ fix d::real assume "d>0" |
|
3328 |
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 |
|
3329 |
then obtain N::nat where N:"inverse (real (N + 1)) < d" by auto |
|
3330 |
{ fix n::nat assume n:"n\<ge>N" |
|
3331 |
hence "dist (x (inverse (real (n + 1)))) a < inverse (real (n + 1))" using x[THEN spec[where x="inverse (real (n + 1))"]] by auto |
|
3332 |
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) |
|
3333 |
ultimately have "dist (x (inverse (real (n + 1)))) a < d" by auto |
|
3334 |
} |
|
3335 |
hence "\<exists>N::nat. \<forall>n\<ge>N. dist (x (inverse (real (n + 1)))) a < d" by auto |
|
3336 |
} |
|
3337 |
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 |
|
3338 |
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 |
|
3339 |
hence "False" apply(erule_tac x=e in allE) using `e>0` using x by auto |
|
3340 |
} |
|
3341 |
thus ?lhs unfolding continuous_within unfolding Lim_within unfolding Lim_sequentially by blast |
|
3342 |
qed |
|
3343 |
||
3344 |
lemma continuous_at_sequentially: |
|
3345 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" |
|
3346 |
shows "continuous (at a) f \<longleftrightarrow> (\<forall>x. (x ---> a) sequentially |
|
3347 |
--> ((f o x) ---> f a) sequentially)" |
|
3348 |
using continuous_within_sequentially[of a UNIV f] unfolding within_UNIV by auto |
|
3349 |
||
3350 |
lemma continuous_on_sequentially: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3351 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" |
36359 | 3352 |
shows "continuous_on s f \<longleftrightarrow> |
3353 |
(\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially |
|
33175 | 3354 |
--> ((f o x) ---> f(a)) sequentially)" (is "?lhs = ?rhs") |
3355 |
proof |
|
3356 |
assume ?rhs thus ?lhs using continuous_within_sequentially[of _ s f] unfolding continuous_on_eq_continuous_within by auto |
|
3357 |
next |
|
3358 |
assume ?lhs thus ?rhs unfolding continuous_on_eq_continuous_within using continuous_within_sequentially[of _ s f] by auto |
|
3359 |
qed |
|
3360 |
||
36441 | 3361 |
lemma uniformly_continuous_on_sequentially': |
3362 |
"uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> |
|
3363 |
((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially |
|
3364 |
\<longrightarrow> ((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially)" (is "?lhs = ?rhs") |
|
33175 | 3365 |
proof |
3366 |
assume ?lhs |
|
36441 | 3367 |
{ fix x y assume x:"\<forall>n. x n \<in> s" and y:"\<forall>n. y n \<in> s" and xy:"((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially" |
33175 | 3368 |
{ fix e::real assume "e>0" |
3369 |
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" |
|
3370 |
using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto |
|
36441 | 3371 |
obtain N where N:"\<forall>n\<ge>N. dist (x n) (y n) < d" using xy[unfolded Lim_sequentially dist_norm] and `d>0` by auto |
33175 | 3372 |
{ fix n assume "n\<ge>N" |
36441 | 3373 |
hence "dist (f (x n)) (f (y n)) < e" |
33175 | 3374 |
using N[THEN spec[where x=n]] using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] using x and y |
36441 | 3375 |
unfolding dist_commute by simp } |
3376 |
hence "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" by auto } |
|
3377 |
hence "((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially" unfolding Lim_sequentially and dist_real_def by auto } |
|
33175 | 3378 |
thus ?rhs by auto |
3379 |
next |
|
3380 |
assume ?rhs |
|
3381 |
{ assume "\<not> ?lhs" |
|
3382 |
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 |
|
3383 |
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" |
|
3384 |
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 |
|
3385 |
by (auto simp add: dist_commute) |
|
3386 |
def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))" |
|
3387 |
def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))" |
|
3388 |
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" |
|
3389 |
unfolding x_def and y_def using fa by auto |
|
3390 |
{ fix e::real assume "e>0" |
|
3391 |
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 |
|
3392 |
{ fix n::nat assume "n\<ge>N" |
|
3393 |
hence "inverse (real n + 1) < inverse (real N)" using real_of_nat_ge_zero and `N\<noteq>0` by auto |
|
3394 |
also have "\<dots> < e" using N by auto |
|
3395 |
finally have "inverse (real n + 1) < e" by auto |
|
36441 | 3396 |
hence "dist (x n) (y n) < e" using xy0[THEN spec[where x=n]] by auto } |
3397 |
hence "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto } |
|
3398 |
hence "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn unfolding Lim_sequentially dist_real_def by auto |
|
3399 |
hence False using fxy and `e>0` by auto } |
|
33175 | 3400 |
thus ?lhs unfolding uniformly_continuous_on_def by blast |
3401 |
qed |
|
3402 |
||
36441 | 3403 |
lemma uniformly_continuous_on_sequentially: |
3404 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" |
|
3405 |
shows "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> |
|
3406 |
((\<lambda>n. x n - y n) ---> 0) sequentially |
|
3407 |
\<longrightarrow> ((\<lambda>n. f(x n) - f(y n)) ---> 0) sequentially)" (is "?lhs = ?rhs") |
|
3408 |
(* BH: maybe the previous lemma should replace this one? *) |
|
3409 |
unfolding uniformly_continuous_on_sequentially' |
|
3410 |
unfolding dist_norm Lim_null_norm [symmetric] .. |
|
3411 |
||
33175 | 3412 |
text{* The usual transformation theorems. *} |
3413 |
||
3414 |
lemma continuous_transform_within: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3415 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *) |
33175 | 3416 |
assumes "0 < d" "x \<in> s" "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'" |
3417 |
"continuous (at x within s) f" |
|
3418 |
shows "continuous (at x within s) g" |
|
3419 |
proof- |
|
3420 |
{ fix e::real assume "e>0" |
|
3421 |
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 |
|
3422 |
{ fix x' assume "x'\<in>s" "0 < dist x' x" "dist x' x < (min d d')" |
|
3423 |
hence "dist (f x') (g x) < e" using assms(2,3) apply(erule_tac x=x in ballE) using d' by auto } |
|
3424 |
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 |
|
3425 |
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 } |
|
3426 |
hence "(f ---> g x) (at x within s)" unfolding Lim_within using assms(1) by auto |
|
3427 |
thus ?thesis unfolding continuous_within using Lim_transform_within[of d s x f g "g x"] using assms by blast |
|
3428 |
qed |
|
3429 |
||
3430 |
lemma continuous_transform_at: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3431 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *) |
33175 | 3432 |
assumes "0 < d" "\<forall>x'. dist x' x < d --> f x' = g x'" |
3433 |
"continuous (at x) f" |
|
3434 |
shows "continuous (at x) g" |
|
3435 |
proof- |
|
3436 |
{ fix e::real assume "e>0" |
|
3437 |
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 |
|
3438 |
{ fix x' assume "0 < dist x' x" "dist x' x < (min d d')" |
|
3439 |
hence "dist (f x') (g x) < e" using assms(2) apply(erule_tac x=x in allE) using d' by auto |
|
3440 |
} |
|
3441 |
hence "\<forall>xa. 0 < dist xa x \<and> dist xa x < (min d d') \<longrightarrow> dist (f xa) (g x) < e" by blast |
|
3442 |
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 |
|
3443 |
} |
|
3444 |
hence "(f ---> g x) (at x)" unfolding Lim_at using assms(1) by auto |
|
3445 |
thus ?thesis unfolding continuous_at using Lim_transform_at[of d x f g "g x"] using assms by blast |
|
3446 |
qed |
|
3447 |
||
3448 |
text{* Combination results for pointwise continuity. *} |
|
3449 |
||
3450 |
lemma continuous_const: "continuous net (\<lambda>x. c)" |
|
3451 |
by (auto simp add: continuous_def Lim_const) |
|
3452 |
||
3453 |
lemma continuous_cmul: |
|
3454 |
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector" |
|
3455 |
shows "continuous net f ==> continuous net (\<lambda>x. c *\<^sub>R f x)" |
|
3456 |
by (auto simp add: continuous_def Lim_cmul) |
|
3457 |
||
3458 |
lemma continuous_neg: |
|
3459 |
fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector" |
|
3460 |
shows "continuous net f ==> continuous net (\<lambda>x. -(f x))" |
|
3461 |
by (auto simp add: continuous_def Lim_neg) |
|
3462 |
||
3463 |
lemma continuous_add: |
|
3464 |
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector" |
|
3465 |
shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x + g x)" |
|
3466 |
by (auto simp add: continuous_def Lim_add) |
|
3467 |
||
3468 |
lemma continuous_sub: |
|
3469 |
fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector" |
|
3470 |
shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x - g x)" |
|
3471 |
by (auto simp add: continuous_def Lim_sub) |
|
3472 |
||
34964 | 3473 |
|
33175 | 3474 |
text{* Same thing for setwise continuity. *} |
3475 |
||
3476 |
lemma continuous_on_const: |
|
3477 |
"continuous_on s (\<lambda>x. c)" |
|
36359 | 3478 |
unfolding continuous_on_def by auto |
33175 | 3479 |
|
3480 |
lemma continuous_on_cmul: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3481 |
fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3482 |
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. c *\<^sub>R (f x))" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3483 |
unfolding continuous_on_def by (auto intro: tendsto_intros) |
33175 | 3484 |
|
3485 |
lemma continuous_on_neg: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3486 |
fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3487 |
shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)" |
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3488 |
unfolding continuous_on_def by (auto intro: tendsto_intros) |
33175 | 3489 |
|
3490 |
lemma continuous_on_add: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3491 |
fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3492 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g |
3493 |
\<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)" |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3494 |
unfolding continuous_on_def by (auto intro: tendsto_intros) |
33175 | 3495 |
|
3496 |
lemma continuous_on_sub: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3497 |
fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3498 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g |
3499 |
\<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)" |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3500 |
unfolding continuous_on_def by (auto intro: tendsto_intros) |
33175 | 3501 |
|
3502 |
text{* Same thing for uniform continuity, using sequential formulations. *} |
|
3503 |
||
3504 |
lemma uniformly_continuous_on_const: |
|
3505 |
"uniformly_continuous_on s (\<lambda>x. c)" |
|
3506 |
unfolding uniformly_continuous_on_def by simp |
|
3507 |
||
3508 |
lemma uniformly_continuous_on_cmul: |
|
36441 | 3509 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3510 |
assumes "uniformly_continuous_on s f" |
3511 |
shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))" |
|
3512 |
proof- |
|
3513 |
{ fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially" |
|
3514 |
hence "((\<lambda>n. c *\<^sub>R f (x n) - c *\<^sub>R f (y n)) ---> 0) sequentially" |
|
3515 |
using Lim_cmul[of "(\<lambda>n. f (x n) - f (y n))" 0 sequentially c] |
|
3516 |
unfolding scaleR_zero_right scaleR_right_diff_distrib by auto |
|
3517 |
} |
|
36441 | 3518 |
thus ?thesis using assms unfolding uniformly_continuous_on_sequentially' |
3519 |
unfolding dist_norm Lim_null_norm [symmetric] by auto |
|
33175 | 3520 |
qed |
3521 |
||
3522 |
lemma dist_minus: |
|
3523 |
fixes x y :: "'a::real_normed_vector" |
|
3524 |
shows "dist (- x) (- y) = dist x y" |
|
3525 |
unfolding dist_norm minus_diff_minus norm_minus_cancel .. |
|
3526 |
||
3527 |
lemma uniformly_continuous_on_neg: |
|
3528 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
|
3529 |
shows "uniformly_continuous_on s f |
|
3530 |
==> uniformly_continuous_on s (\<lambda>x. -(f x))" |
|
3531 |
unfolding uniformly_continuous_on_def dist_minus . |
|
3532 |
||
3533 |
lemma uniformly_continuous_on_add: |
|
36441 | 3534 |
fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3535 |
assumes "uniformly_continuous_on s f" "uniformly_continuous_on s g" |
3536 |
shows "uniformly_continuous_on s (\<lambda>x. f x + g x)" |
|
3537 |
proof- |
|
3538 |
{ fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially" |
|
3539 |
"((\<lambda>n. g (x n) - g (y n)) ---> 0) sequentially" |
|
3540 |
hence "((\<lambda>xa. f (x xa) - f (y xa) + (g (x xa) - g (y xa))) ---> 0 + 0) sequentially" |
|
3541 |
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 |
|
3542 |
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 } |
|
36441 | 3543 |
thus ?thesis using assms unfolding uniformly_continuous_on_sequentially' |
3544 |
unfolding dist_norm Lim_null_norm [symmetric] by auto |
|
33175 | 3545 |
qed |
3546 |
||
3547 |
lemma uniformly_continuous_on_sub: |
|
36441 | 3548 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
33175 | 3549 |
shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s g |
3550 |
==> uniformly_continuous_on s (\<lambda>x. f x - g x)" |
|
3551 |
unfolding ab_diff_minus |
|
3552 |
using uniformly_continuous_on_add[of s f "\<lambda>x. - g x"] |
|
3553 |
using uniformly_continuous_on_neg[of s g] by auto |
|
3554 |
||
3555 |
text{* Identity function is continuous in every sense. *} |
|
3556 |
||
3557 |
lemma continuous_within_id: |
|
3558 |
"continuous (at a within s) (\<lambda>x. x)" |
|
3559 |
unfolding continuous_within by (rule Lim_at_within [OF Lim_ident_at]) |
|
3560 |
||
3561 |
lemma continuous_at_id: |
|
3562 |
"continuous (at a) (\<lambda>x. x)" |
|
3563 |
unfolding continuous_at by (rule Lim_ident_at) |
|
3564 |
||
3565 |
lemma continuous_on_id: |
|
3566 |
"continuous_on s (\<lambda>x. x)" |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3567 |
unfolding continuous_on_def by (auto intro: tendsto_ident_at_within) |
33175 | 3568 |
|
3569 |
lemma uniformly_continuous_on_id: |
|
3570 |
"uniformly_continuous_on s (\<lambda>x. x)" |
|
3571 |
unfolding uniformly_continuous_on_def by auto |
|
3572 |
||
3573 |
text{* Continuity of all kinds is preserved under composition. *} |
|
3574 |
||
36441 | 3575 |
lemma continuous_within_topological: |
3576 |
"continuous (at x within s) f \<longleftrightarrow> |
|
3577 |
(\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> |
|
3578 |
(\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))" |
|
3579 |
unfolding continuous_within |
|
3580 |
unfolding tendsto_def Limits.eventually_within eventually_at_topological |
|
3581 |
by (intro ball_cong [OF refl] all_cong imp_cong ex_cong conj_cong refl) auto |
|
3582 |
||
33175 | 3583 |
lemma continuous_within_compose: |
36441 | 3584 |
assumes "continuous (at x within s) f" |
3585 |
assumes "continuous (at (f x) within f ` s) g" |
|
33175 | 3586 |
shows "continuous (at x within s) (g o f)" |
36441 | 3587 |
using assms unfolding continuous_within_topological by simp metis |
33175 | 3588 |
|
3589 |
lemma continuous_at_compose: |
|
3590 |
assumes "continuous (at x) f" "continuous (at (f x)) g" |
|
3591 |
shows "continuous (at x) (g o f)" |
|
3592 |
proof- |
|
3593 |
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 |
|
3594 |
thus ?thesis using assms(1) using continuous_within_compose[of x UNIV f g, unfolded within_UNIV] by auto |
|
3595 |
qed |
|
3596 |
||
3597 |
lemma continuous_on_compose: |
|
36440
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3598 |
"continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g o f)" |
89a70297564d
simplify definition of continuous_on; generalize some lemmas
huffman
parents:
36439
diff
changeset
|
3599 |
unfolding continuous_on_topological by simp metis |
33175 | 3600 |
|
3601 |
lemma uniformly_continuous_on_compose: |
|
3602 |
assumes "uniformly_continuous_on s f" "uniformly_continuous_on (f ` s) g" |
|
3603 |
shows "uniformly_continuous_on s (g o f)" |
|
3604 |
proof- |
|
3605 |
{ fix e::real assume "e>0" |
|
3606 |
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 |
|
3607 |
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 |
|
3608 |
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 } |
|
3609 |
thus ?thesis using assms unfolding uniformly_continuous_on_def by auto |
|
3610 |
qed |
|
3611 |
||
3612 |
text{* Continuity in terms of open preimages. *} |
|
3613 |
||
3614 |
lemma continuous_at_open: |
|
36441 | 3615 |
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)))" |
3616 |
unfolding continuous_within_topological [of x UNIV f, unfolded within_UNIV] |
|
3617 |
unfolding imp_conjL by (intro all_cong imp_cong ex_cong conj_cong refl) auto |
|
33175 | 3618 |
|
3619 |
lemma continuous_on_open: |
|
36441 | 3620 |
shows "continuous_on s f \<longleftrightarrow> |
33175 | 3621 |
(\<forall>t. openin (subtopology euclidean (f ` s)) t |
3622 |
--> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs") |
|
36441 | 3623 |
proof (safe) |
3624 |
fix t :: "'b set" |
|
3625 |
assume 1: "continuous_on s f" |
|
3626 |
assume 2: "openin (subtopology euclidean (f ` s)) t" |
|
3627 |
from 2 obtain B where B: "open B" and t: "t = f ` s \<inter> B" |
|
3628 |
unfolding openin_open by auto |
|
3629 |
def U == "\<Union>{A. open A \<and> (\<forall>x\<in>s. x \<in> A \<longrightarrow> f x \<in> B)}" |
|
3630 |
have "open U" unfolding U_def by (simp add: open_Union) |
|
3631 |
moreover have "\<forall>x\<in>s. x \<in> U \<longleftrightarrow> f x \<in> t" |
|
3632 |
proof (intro ballI iffI) |
|
3633 |
fix x assume "x \<in> s" and "x \<in> U" thus "f x \<in> t" |
|
3634 |
unfolding U_def t by auto |
|
3635 |
next |
|
3636 |
fix x assume "x \<in> s" and "f x \<in> t" |
|
3637 |
hence "x \<in> s" and "f x \<in> B" |
|
3638 |
unfolding t by auto |
|
3639 |
with 1 B obtain A where "open A" "x \<in> A" "\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B" |
|
3640 |
unfolding t continuous_on_topological by metis |
|
3641 |
then show "x \<in> U" |
|
3642 |
unfolding U_def by auto |
|
3643 |
qed |
|
3644 |
ultimately have "open U \<and> {x \<in> s. f x \<in> t} = s \<inter> U" by auto |
|
3645 |
then show "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" |
|
3646 |
unfolding openin_open by fast |
|
33175 | 3647 |
next |
36441 | 3648 |
assume "?rhs" show "continuous_on s f" |
3649 |
unfolding continuous_on_topological |
|
3650 |
proof (clarify) |
|
3651 |
fix x and B assume "x \<in> s" and "open B" and "f x \<in> B" |
|
3652 |
have "openin (subtopology euclidean (f ` s)) (f ` s \<inter> B)" |
|
3653 |
unfolding openin_open using `open B` by auto |
|
3654 |
then have "openin (subtopology euclidean s) {x \<in> s. f x \<in> f ` s \<inter> B}" |
|
3655 |
using `?rhs` by fast |
|
3656 |
then show "\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)" |
|
3657 |
unfolding openin_open using `x \<in> s` and `f x \<in> B` by auto |
|
3658 |
qed |
|
3659 |
qed |
|
3660 |
||
3661 |
text {* Similarly in terms of closed sets. *} |
|
33175 | 3662 |
|
3663 |
lemma continuous_on_closed: |
|
36359 | 3664 |
shows "continuous_on s f \<longleftrightarrow> (\<forall>t. closedin (subtopology euclidean (f ` s)) t --> closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs") |
33175 | 3665 |
proof |
3666 |
assume ?lhs |
|
3667 |
{ fix t |
|
3668 |
have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto |
|
3669 |
have **:"f ` s - (f ` s - (f ` s - t)) = f ` s - t" by auto |
|
3670 |
assume as:"closedin (subtopology euclidean (f ` s)) t" |
|
3671 |
hence "closedin (subtopology euclidean (f ` s)) (f ` s - (f ` s - t))" unfolding closedin_def topspace_euclidean_subtopology unfolding ** by auto |
|
3672 |
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"]] |
|
3673 |
unfolding openin_closedin_eq topspace_euclidean_subtopology unfolding * by auto } |
|
3674 |
thus ?rhs by auto |
|
3675 |
next |
|
3676 |
assume ?rhs |
|
3677 |
{ fix t |
|
3678 |
have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto |
|
3679 |
assume as:"openin (subtopology euclidean (f ` s)) t" |
|
3680 |
hence "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?rhs`[THEN spec[where x="(f ` s) - t"]] |
|
3681 |
unfolding openin_closedin_eq topspace_euclidean_subtopology *[THEN sym] closedin_subtopology by auto } |
|
3682 |
thus ?lhs unfolding continuous_on_open by auto |
|
3683 |
qed |
|
3684 |
||
3685 |
text{* Half-global and completely global cases. *} |
|
3686 |
||
3687 |
lemma continuous_open_in_preimage: |
|
3688 |
assumes "continuous_on s f" "open t" |
|
3689 |
shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" |
|
3690 |
proof- |
|
3691 |
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 |
|
3692 |
have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" |
|
3693 |
using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto |
|
3694 |
thus ?thesis using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] using * by auto |
|
3695 |
qed |
|
3696 |
||
3697 |
lemma continuous_closed_in_preimage: |
|
3698 |
assumes "continuous_on s f" "closed t" |
|
3699 |
shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}" |
|
3700 |
proof- |
|
3701 |
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 |
|
3702 |
have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" |
|
3703 |
using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute by auto |
|
3704 |
thus ?thesis |
|
3705 |
using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] using * by auto |
|
3706 |
qed |
|
3707 |
||
3708 |
lemma continuous_open_preimage: |
|
3709 |
assumes "continuous_on s f" "open s" "open t" |
|
3710 |
shows "open {x \<in> s. f x \<in> t}" |
|
3711 |
proof- |
|
3712 |
obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T" |
|
3713 |
using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto |
|
3714 |
thus ?thesis using open_Int[of s T, OF assms(2)] by auto |
|
3715 |
qed |
|
3716 |
||
3717 |
lemma continuous_closed_preimage: |
|
3718 |
assumes "continuous_on s f" "closed s" "closed t" |
|
3719 |
shows "closed {x \<in> s. f x \<in> t}" |
|
3720 |
proof- |
|
3721 |
obtain T where T: "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T" |
|
3722 |
using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto |
|
3723 |
thus ?thesis using closed_Int[of s T, OF assms(2)] by auto |
|
3724 |
qed |
|
3725 |
||
3726 |
lemma continuous_open_preimage_univ: |
|
3727 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}" |
|
3728 |
using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto |
|
3729 |
||
3730 |
lemma continuous_closed_preimage_univ: |
|
3731 |
shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}" |
|
3732 |
using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto |
|
3733 |
||
3734 |
lemma continuous_open_vimage: |
|
3735 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)" |
|
3736 |
unfolding vimage_def by (rule continuous_open_preimage_univ) |
|
3737 |
||
3738 |
lemma continuous_closed_vimage: |
|
3739 |
shows "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)" |
|
3740 |
unfolding vimage_def by (rule continuous_closed_preimage_univ) |
|
3741 |
||
36441 | 3742 |
lemma interior_image_subset: |
35172
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3743 |
assumes "\<forall>x. continuous (at x) f" "inj f" |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3744 |
shows "interior (f ` s) \<subseteq> f ` (interior s)" |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3745 |
apply rule unfolding interior_def mem_Collect_eq image_iff apply safe |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3746 |
proof- fix x T assume as:"open T" "x \<in> T" "T \<subseteq> f ` s" |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3747 |
hence "x \<in> f ` s" by auto then guess y unfolding image_iff .. note y=this |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3748 |
thus "\<exists>xa\<in>{x. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> s}. x = f xa" apply(rule_tac x=y in bexI) using assms as |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3749 |
apply safe apply(rule_tac x="{x. f x \<in> T}" in exI) apply(safe,rule continuous_open_preimage_univ) |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3750 |
proof- fix x assume "f x \<in> T" hence "f x \<in> f ` s" using as by auto |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3751 |
thus "x \<in> s" unfolding inj_image_mem_iff[OF assms(2)] . qed auto qed |
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
35028
diff
changeset
|
3752 |
|
33175 | 3753 |
text{* Equality of continuous functions on closure and related results. *} |
3754 |
||
3755 |
lemma continuous_closed_in_preimage_constant: |
|
36441 | 3756 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
36359 | 3757 |
shows "continuous_on s f ==> closedin (subtopology euclidean s) {x \<in> s. f x = a}" |
33175 | 3758 |
using continuous_closed_in_preimage[of s f "{a}"] closed_sing by auto |
3759 |
||
3760 |
lemma continuous_closed_preimage_constant: |
|
36441 | 3761 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
36359 | 3762 |
shows "continuous_on s f \<Longrightarrow> closed s ==> closed {x \<in> s. f x = a}" |
33175 | 3763 |
using continuous_closed_preimage[of s f "{a}"] closed_sing by auto |
3764 |
||
3765 |
lemma continuous_constant_on_closure: |
|
36441 | 3766 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
33175 | 3767 |
assumes "continuous_on (closure s) f" |
3768 |
"\<forall>x \<in> s. f x = a" |
|
3769 |
shows "\<forall>x \<in> (closure s). f x = a" |
|
3770 |
using continuous_closed_preimage_constant[of "closure s" f a] |
|
3771 |
assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset unfolding subset_eq by auto |
|
3772 |
||
3773 |
lemma image_closure_subset: |
|
3774 |
assumes "continuous_on (closure s) f" "closed t" "(f ` s) \<subseteq> t" |
|
3775 |
shows "f ` (closure s) \<subseteq> t" |
|
3776 |
proof- |
|
3777 |
have "s \<subseteq> {x \<in> closure s. f x \<in> t}" using assms(3) closure_subset by auto |
|
3778 |
moreover have "closed {x \<in> closure s. f x \<in> t}" |
|
3779 |
using continuous_closed_preimage[OF assms(1)] and assms(2) by auto |
|
3780 |
ultimately have "closure s = {x \<in> closure s . f x \<in> t}" |
|
3781 |
using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto |
|
3782 |
thus ?thesis by auto |
|
3783 |
qed |
|
3784 |
||
3785 |
lemma continuous_on_closure_norm_le: |
|
3786 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
|
3787 |
assumes "continuous_on (closure s) f" "\<forall>y \<in> s. norm(f y) \<le> b" "x \<in> (closure s)" |
|
3788 |
shows "norm(f x) \<le> b" |
|
3789 |
proof- |
|
3790 |
have *:"f ` s \<subseteq> cball 0 b" using assms(2)[unfolded mem_cball_0[THEN sym]] by auto |
|
3791 |
show ?thesis |
|
3792 |
using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3) |
|
3793 |
unfolding subset_eq apply(erule_tac x="f x" in ballE) by (auto simp add: dist_norm) |
|
3794 |
qed |
|
3795 |
||
3796 |
text{* Making a continuous function avoid some value in a neighbourhood. *} |
|
3797 |
||
3798 |
lemma continuous_within_avoid: |
|
3799 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *) |
|
3800 |
assumes "continuous (at x within s) f" "x \<in> s" "f x \<noteq> a" |
|
3801 |
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a" |
|
3802 |
proof- |
|
3803 |
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" |
|
3804 |
using assms(1)[unfolded continuous_within Lim_within, THEN spec[where x="dist (f x) a"]] assms(3)[unfolded dist_nz] by auto |
|
3805 |
{ fix y assume " y\<in>s" "dist x y < d" |
|
3806 |
hence "f y \<noteq> a" using d[THEN bspec[where x=y]] assms(3)[unfolded dist_nz] |
|
3807 |
apply auto unfolding dist_nz[THEN sym] by (auto simp add: dist_commute) } |
|
3808 |
thus ?thesis using `d>0` by auto |
|
3809 |
qed |
|
3810 |
||
3811 |
lemma continuous_at_avoid: |
|
3812 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *) |
|
3813 |
assumes "continuous (at x) f" "f x \<noteq> a" |
|
3814 |
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" |
|
3815 |
using assms using continuous_within_avoid[of x UNIV f a, unfolded within_UNIV] by auto |
|
3816 |
||
3817 |
lemma continuous_on_avoid: |
|
36359 | 3818 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *) |
33175 | 3819 |
assumes "continuous_on s f" "x \<in> s" "f x \<noteq> a" |
3820 |
shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a" |
|
3821 |
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 |
|
3822 |
||
3823 |
lemma continuous_on_open_avoid: |
|
36359 | 3824 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* TODO: generalize *) |
33175 | 3825 |
assumes "continuous_on s f" "open s" "x \<in> s" "f x \<noteq> a" |
3826 |
shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" |
|
3827 |
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 |
|
3828 |
||
3829 |
text{* Proving a function is constant by proving open-ness of level set. *} |
|
3830 |
||
3831 |
lemma continuous_levelset_open_in_cases: |
|
36441 | 3832 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
36359 | 3833 |
shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> |
33175 | 3834 |
openin (subtopology euclidean s) {x \<in> s. f x = a} |
3835 |
==> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)" |
|
3836 |
unfolding connected_clopen using continuous_closed_in_preimage_constant by auto |
|
3837 |
||
3838 |
lemma continuous_levelset_open_in: |
|
36441 | 3839 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
36359 | 3840 |
shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> |
33175 | 3841 |
openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow> |
3842 |
(\<exists>x \<in> s. f x = a) ==> (\<forall>x \<in> s. f x = a)" |
|
3843 |
using continuous_levelset_open_in_cases[of s f ] |
|
3844 |
by meson |
|
3845 |
||
3846 |
lemma continuous_levelset_open: |
|
36441 | 3847 |
fixes f :: "_ \<Rightarrow> 'b::metric_space" (* class constraint due to closed_sing *) |
33175 | 3848 |
assumes "connected s" "continuous_on s f" "open {x \<in> s. f x = a}" "\<exists>x \<in> s. f x = a" |
3849 |
shows "\<forall>x \<in> s. f x = a" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
3850 |
using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] using assms (3,4) by fast |
33175 | 3851 |
|
3852 |
text{* Some arithmetical combinations (more to prove). *} |
|
3853 |
||
3854 |
lemma open_scaling[intro]: |
|
3855 |
fixes s :: "'a::real_normed_vector set" |
|
3856 |
assumes "c \<noteq> 0" "open s" |
|
3857 |
shows "open((\<lambda>x. c *\<^sub>R x) ` s)" |
|
3858 |
proof- |
|
3859 |
{ fix x assume "x \<in> s" |
|
3860 |
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 |
|
3861 |
have "e * abs c > 0" using assms(1)[unfolded zero_less_abs_iff[THEN sym]] using real_mult_order[OF `e>0`] by auto |
|
3862 |
moreover |
|
3863 |
{ fix y assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>" |
|
3864 |
hence "norm ((1 / c) *\<^sub>R y - x) < e" unfolding dist_norm |
|
3865 |
using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1) |
|
3866 |
assms(1)[unfolded zero_less_abs_iff[THEN sym]] by (simp del:zero_less_abs_iff) |
|
3867 |
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 } |
|
3868 |
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 } |
|
3869 |
thus ?thesis unfolding open_dist by auto |
|
3870 |
qed |
|
3871 |
||
3872 |
lemma minus_image_eq_vimage: |
|
3873 |
fixes A :: "'a::ab_group_add set" |
|
3874 |
shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A" |
|
3875 |
by (auto intro!: image_eqI [where f="\<lambda>x. - x"]) |
|
3876 |
||
3877 |
lemma open_negations: |
|
3878 |
fixes s :: "'a::real_normed_vector set" |
|
3879 |
shows "open s ==> open ((\<lambda> x. -x) ` s)" |
|
3880 |
unfolding scaleR_minus1_left [symmetric] |
|
3881 |
by (rule open_scaling, auto) |
|
3882 |
||
3883 |
lemma open_translation: |
|
3884 |
fixes s :: "'a::real_normed_vector set" |
|
3885 |
assumes "open s" shows "open((\<lambda>x. a + x) ` s)" |
|
3886 |
proof- |
|
3887 |
{ 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 } |
|
3888 |
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 |
|
3889 |
ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto |
|
3890 |
qed |
|
3891 |
||
3892 |
lemma open_affinity: |
|
3893 |
fixes s :: "'a::real_normed_vector set" |
|
3894 |
assumes "open s" "c \<noteq> 0" |
|
3895 |
shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)" |
|
3896 |
proof- |
|
3897 |
have *:"(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" unfolding o_def .. |
|
3898 |
have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" by auto |
|
3899 |
thus ?thesis using assms open_translation[of "op *\<^sub>R c ` s" a] unfolding * by auto |
|
3900 |
qed |
|
3901 |
||
3902 |
lemma interior_translation: |
|
3903 |
fixes s :: "'a::real_normed_vector set" |
|
3904 |
shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)" |
|
3905 |
proof (rule set_ext, rule) |
|
3906 |
fix x assume "x \<in> interior (op + a ` s)" |
|
3907 |
then obtain e where "e>0" and e:"ball x e \<subseteq> op + a ` s" unfolding mem_interior by auto |
|
3908 |
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 |
|
3909 |
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 |
|
3910 |
next |
|
3911 |
fix x assume "x \<in> op + a ` interior s" |
|
3912 |
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 |
|
3913 |
{ fix z have *:"a + y - z = y + a - z" by auto |
|
3914 |
assume "z\<in>ball x e" |
|
3915 |
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 |
|
3916 |
hence "z \<in> op + a ` s" unfolding image_iff by(auto intro!: bexI[where x="z - a"]) } |
|
3917 |
hence "ball x e \<subseteq> op + a ` s" unfolding subset_eq by auto |
|
3918 |
thus "x \<in> interior (op + a ` s)" unfolding mem_interior using `e>0` by auto |
|
3919 |
qed |
|
3920 |
||
36437 | 3921 |
text {* We can now extend limit compositions to consider the scalar multiplier. *} |
3922 |
||
3923 |
lemma continuous_vmul: |
|
3924 |
fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector" |
|
3925 |
shows "continuous net c ==> continuous net (\<lambda>x. c(x) *\<^sub>R v)" |
|
3926 |
unfolding continuous_def using Lim_vmul[of c] by auto |
|
3927 |
||
3928 |
lemma continuous_mul: |
|
3929 |
fixes c :: "'a::metric_space \<Rightarrow> real" |
|
3930 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
|
3931 |
shows "continuous net c \<Longrightarrow> continuous net f |
|
3932 |
==> continuous net (\<lambda>x. c(x) *\<^sub>R f x) " |
|
3933 |
unfolding continuous_def by (intro tendsto_intros) |
|
3934 |
||
3935 |
lemmas continuous_intros = continuous_add continuous_vmul continuous_cmul continuous_const continuous_sub continuous_at_id continuous_within_id continuous_mul |
|
3936 |
||
3937 |
lemma continuous_on_vmul: |
|
3938 |
fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector" |
|
3939 |
shows "continuous_on s c ==> continuous_on s (\<lambda>x. c(x) *\<^sub>R v)" |
|
3940 |
unfolding continuous_on_eq_continuous_within using continuous_vmul[of _ c] by auto |
|
3941 |
||
3942 |
lemma continuous_on_mul: |
|
3943 |
fixes c :: "'a::metric_space \<Rightarrow> real" |
|
3944 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" |
|
3945 |
shows "continuous_on s c \<Longrightarrow> continuous_on s f |
|
3946 |
==> continuous_on s (\<lambda>x. c(x) *\<^sub>R f x)" |
|
3947 |
unfolding continuous_on_eq_continuous_within using continuous_mul[of _ c] by auto |
|
3948 |
||
3949 |
lemmas continuous_on_intros = continuous_on_add continuous_on_const continuous_on_id continuous_on_compose continuous_on_cmul continuous_on_neg continuous_on_sub |
|
3950 |
uniformly_continuous_on_add uniformly_continuous_on_const uniformly_continuous_on_id uniformly_continuous_on_compose uniformly_continuous_on_cmul uniformly_continuous_on_neg uniformly_continuous_on_sub |
|
3951 |
continuous_on_mul continuous_on_vmul |
|
3952 |
||
3953 |
text{* And so we have continuity of inverse. *} |
|
3954 |
||
3955 |
lemma continuous_inv: |
|
3956 |
fixes f :: "'a::metric_space \<Rightarrow> real" |
|
3957 |
shows "continuous net f \<Longrightarrow> f(netlimit net) \<noteq> 0 |
|
3958 |
==> continuous net (inverse o f)" |
|
3959 |
unfolding continuous_def using Lim_inv by auto |
|
3960 |
||
3961 |
lemma continuous_at_within_inv: |
|
3962 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field" |
|
3963 |
assumes "continuous (at a within s) f" "f a \<noteq> 0" |
|
3964 |
shows "continuous (at a within s) (inverse o f)" |
|
3965 |
using assms unfolding continuous_within o_def |
|
3966 |
by (intro tendsto_intros) |
|
3967 |
||
3968 |
lemma continuous_at_inv: |
|
3969 |
fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field" |
|
3970 |
shows "continuous (at a) f \<Longrightarrow> f a \<noteq> 0 |
|
3971 |
==> continuous (at a) (inverse o f) " |
|
3972 |
using within_UNIV[THEN sym, of "at a"] using continuous_at_within_inv[of a UNIV] by auto |
|
3973 |
||
3974 |
text {* Topological properties of linear functions. *} |
|
3975 |
||
3976 |
lemma linear_lim_0: |
|
3977 |
assumes "bounded_linear f" shows "(f ---> 0) (at (0))" |
|
3978 |
proof- |
|
3979 |
interpret f: bounded_linear f by fact |
|
3980 |
have "(f ---> f 0) (at 0)" |
|
3981 |
using tendsto_ident_at by (rule f.tendsto) |
|
3982 |
thus ?thesis unfolding f.zero . |
|
3983 |
qed |
|
3984 |
||
3985 |
lemma linear_continuous_at: |
|
3986 |
assumes "bounded_linear f" shows "continuous (at a) f" |
|
3987 |
unfolding continuous_at using assms |
|
3988 |
apply (rule bounded_linear.tendsto) |
|
3989 |
apply (rule tendsto_ident_at) |
|
3990 |
done |
|
3991 |
||
3992 |
lemma linear_continuous_within: |
|
3993 |
shows "bounded_linear f ==> continuous (at x within s) f" |
|
3994 |
using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto |
|
3995 |
||
3996 |
lemma linear_continuous_on: |
|
3997 |
shows "bounded_linear f ==> continuous_on s f" |
|
3998 |
using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto |
|
3999 |
||
4000 |
text{* Also bilinear functions, in composition form. *} |
|
4001 |
||
4002 |
lemma bilinear_continuous_at_compose: |
|
4003 |
shows "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h |
|
4004 |
==> continuous (at x) (\<lambda>x. h (f x) (g x))" |
|
4005 |
unfolding continuous_at using Lim_bilinear[of f "f x" "(at x)" g "g x" h] by auto |
|
4006 |
||
4007 |
lemma bilinear_continuous_within_compose: |
|
4008 |
shows "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h |
|
4009 |
==> continuous (at x within s) (\<lambda>x. h (f x) (g x))" |
|
4010 |
unfolding continuous_within using Lim_bilinear[of f "f x"] by auto |
|
4011 |
||
4012 |
lemma bilinear_continuous_on_compose: |
|
4013 |
shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h |
|
4014 |
==> continuous_on s (\<lambda>x. h (f x) (g x))" |
|
36441 | 4015 |
unfolding continuous_on_def |
4016 |
by (fast elim: bounded_bilinear.tendsto) |
|
36437 | 4017 |
|
4018 |
text {* Preservation of compactness and connectedness under continuous function. *} |
|
33175 | 4019 |
|
4020 |
lemma compact_continuous_image: |
|
4021 |
assumes "continuous_on s f" "compact s" |
|
4022 |
shows "compact(f ` s)" |
|
4023 |
proof- |
|
4024 |
{ fix x assume x:"\<forall>n::nat. x n \<in> f ` s" |
|
4025 |
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 |
|
4026 |
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 |
|
4027 |
{ fix e::real assume "e>0" |
|
36359 | 4028 |
then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' l < d \<longrightarrow> dist (f x') (f l) < e" using assms(1)[unfolded continuous_on_iff, THEN bspec[where x=l], OF `l\<in>s`] by auto |
33175 | 4029 |
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 |
4030 |
{ 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 } |
|
4031 |
hence "\<exists>N. \<forall>n\<ge>N. dist ((x \<circ> r) n) (f l) < e" by auto } |
|
4032 |
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 } |
|
4033 |
thus ?thesis unfolding compact_def by auto |
|
4034 |
qed |
|
4035 |
||
4036 |
lemma connected_continuous_image: |
|
4037 |
assumes "continuous_on s f" "connected s" |
|
4038 |
shows "connected(f ` s)" |
|
4039 |
proof- |
|
4040 |
{ fix T assume as: "T \<noteq> {}" "T \<noteq> f ` s" "openin (subtopology euclidean (f ` s)) T" "closedin (subtopology euclidean (f ` s)) T" |
|
4041 |
have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s" |
|
4042 |
using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]] |
|
4043 |
using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]] |
|
4044 |
using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto |
|
4045 |
hence False using as(1,2) |
|
4046 |
using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto } |
|
4047 |
thus ?thesis unfolding connected_clopen by auto |
|
4048 |
qed |
|
4049 |
||
4050 |
text{* Continuity implies uniform continuity on a compact domain. *} |
|
4051 |
||
4052 |
lemma compact_uniformly_continuous: |
|
4053 |
assumes "continuous_on s f" "compact s" |
|
4054 |
shows "uniformly_continuous_on s f" |
|
4055 |
proof- |
|
4056 |
{ fix x assume x:"x\<in>s" |
|
36359 | 4057 |
hence "\<forall>xa. \<exists>y. 0 < xa \<longrightarrow> (y > 0 \<and> (\<forall>x'\<in>s. dist x' x < y \<longrightarrow> dist (f x') (f x) < xa))" using assms(1)[unfolded continuous_on_iff, THEN bspec[where x=x]] by auto |
33175 | 4058 |
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 } |
4059 |
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 |
|
4060 |
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)" |
|
4061 |
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 |
|
4062 |
||
4063 |
{ fix e::real assume "e>0" |
|
4064 |
||
4065 |
{ 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 } |
|
4066 |
hence "s \<subseteq> \<Union>{ball x (d x (e / 2)) |x. x \<in> s}" unfolding subset_eq by auto |
|
4067 |
moreover |
|
4068 |
{ fix b assume "b\<in>{ball x (d x (e / 2)) |x. x \<in> s}" hence "open b" by auto } |
|
4069 |
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 |
|
4070 |
||
4071 |
{ fix x y assume "x\<in>s" "y\<in>s" and as:"dist y x < ea" |
|
4072 |
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 |
|
4073 |
hence "x\<in>ball z (d z (e / 2))" using `ea>0` unfolding subset_eq by auto |
|
4074 |
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` |
|
4075 |
by (auto simp add: dist_commute) |
|
4076 |
moreover have "y\<in>ball z (d z (e / 2))" using as and `ea>0` and z[unfolded subset_eq] |
|
4077 |
by (auto simp add: dist_commute) |
|
4078 |
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` |
|
4079 |
by (auto simp add: dist_commute) |
|
4080 |
ultimately have "dist (f y) (f x) < e" using dist_triangle_half_r[of "f z" "f x" e "f y"] |
|
4081 |
by (auto simp add: dist_commute) } |
|
4082 |
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 } |
|
4083 |
thus ?thesis unfolding uniformly_continuous_on_def by auto |
|
4084 |
qed |
|
4085 |
||
4086 |
text{* Continuity of inverse function on compact domain. *} |
|
4087 |
||
4088 |
lemma continuous_on_inverse: |
|
4089 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel" |
|
4090 |
(* TODO: can this be generalized more? *) |
|
4091 |
assumes "continuous_on s f" "compact s" "\<forall>x \<in> s. g (f x) = x" |
|
4092 |
shows "continuous_on (f ` s) g" |
|
4093 |
proof- |
|
4094 |
have *:"g ` f ` s = s" using assms(3) by (auto simp add: image_iff) |
|
4095 |
{ fix t assume t:"closedin (subtopology euclidean (g ` f ` s)) t" |
|
4096 |
then obtain T where T: "closed T" "t = s \<inter> T" unfolding closedin_closed unfolding * by auto |
|
4097 |
have "continuous_on (s \<inter> T) f" using continuous_on_subset[OF assms(1), of "s \<inter> t"] |
|
4098 |
unfolding T(2) and Int_left_absorb by auto |
|
4099 |
moreover have "compact (s \<inter> T)" |
|
4100 |
using assms(2) unfolding compact_eq_bounded_closed |
|
4101 |
using bounded_subset[of s "s \<inter> T"] and T(1) by auto |
|
4102 |
ultimately have "closed (f ` t)" using T(1) unfolding T(2) |
|
4103 |
using compact_continuous_image [of "s \<inter> T" f] unfolding compact_eq_bounded_closed by auto |
|
4104 |
moreover have "{x \<in> f ` s. g x \<in> t} = f ` s \<inter> f ` t" using assms(3) unfolding T(2) by auto |
|
4105 |
ultimately have "closedin (subtopology euclidean (f ` s)) {x \<in> f ` s. g x \<in> t}" |
|
4106 |
unfolding closedin_closed by auto } |
|
4107 |
thus ?thesis unfolding continuous_on_closed by auto |
|
4108 |
qed |
|
4109 |
||
36437 | 4110 |
text {* A uniformly convergent limit of continuous functions is continuous. *} |
33175 | 4111 |
|
4112 |
lemma norm_triangle_lt: |
|
4113 |
fixes x y :: "'a::real_normed_vector" |
|
4114 |
shows "norm x + norm y < e \<Longrightarrow> norm (x + y) < e" |
|
4115 |
by (rule le_less_trans [OF norm_triangle_ineq]) |
|
4116 |
||
4117 |
lemma continuous_uniform_limit: |
|
4118 |
fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::real_normed_vector" |
|
4119 |
assumes "\<not> (trivial_limit net)" "eventually (\<lambda>n. continuous_on s (f n)) net" |
|
4120 |
"\<forall>e>0. eventually (\<lambda>n. \<forall>x \<in> s. norm(f n x - g x) < e) net" |
|
4121 |
shows "continuous_on s g" |
|
4122 |
proof- |
|
4123 |
{ fix x and e::real assume "x\<in>s" "e>0" |
|
4124 |
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 |
|
4125 |
then obtain n where n:"\<forall>xa\<in>s. norm (f n xa - g xa) < e / 3" "continuous_on s (f n)" |
|
4126 |
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 |
|
4127 |
have "e / 3 > 0" using `e>0` by auto |
|
4128 |
then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f n x') (f n x) < e / 3" |
|
36359 | 4129 |
using n(2)[unfolded continuous_on_iff, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast |
33175 | 4130 |
{ fix y assume "y\<in>s" "dist y x < d" |
4131 |
hence "dist (f n y) (f n x) < e / 3" using d[THEN bspec[where x=y]] by auto |
|
4132 |
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"] |
|
4133 |
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 |
|
4134 |
hence "dist (g y) (g x) < e" unfolding dist_norm using n(1)[THEN bspec[where x=y], OF `y\<in>s`] |
|
4135 |
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) } |
|
4136 |
hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using `d>0` by auto } |
|
36359 | 4137 |
thus ?thesis unfolding continuous_on_iff by auto |
33175 | 4138 |
qed |
4139 |
||
4140 |
subsection{* Topological stuff lifted from and dropped to R *} |
|
4141 |
||
4142 |
||
4143 |
lemma open_real: |
|
4144 |
fixes s :: "real set" shows |
|
4145 |
"open s \<longleftrightarrow> |
|
4146 |
(\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" (is "?lhs = ?rhs") |
|
4147 |
unfolding open_dist dist_norm by simp |
|
4148 |
||
4149 |
lemma islimpt_approachable_real: |
|
4150 |
fixes s :: "real set" |
|
4151 |
shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)" |
|
4152 |
unfolding islimpt_approachable dist_norm by simp |
|
4153 |
||
4154 |
lemma closed_real: |
|
4155 |
fixes s :: "real set" |
|
4156 |
shows "closed s \<longleftrightarrow> |
|
4157 |
(\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e) |
|
4158 |
--> x \<in> s)" |
|
4159 |
unfolding closed_limpt islimpt_approachable dist_norm by simp |
|
4160 |
||
4161 |
lemma continuous_at_real_range: |
|
4162 |
fixes f :: "'a::real_normed_vector \<Rightarrow> real" |
|
4163 |
shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. |
|
4164 |
\<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)" |
|
4165 |
unfolding continuous_at unfolding Lim_at |
|
4166 |
unfolding dist_nz[THEN sym] unfolding dist_norm apply auto |
|
4167 |
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 |
|
4168 |
apply(erule_tac x=e in allE) by auto |
|
4169 |
||
4170 |
lemma continuous_on_real_range: |
|
4171 |
fixes f :: "'a::real_normed_vector \<Rightarrow> real" |
|
4172 |
shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))" |
|
36359 | 4173 |
unfolding continuous_on_iff dist_norm by simp |
33175 | 4174 |
|
4175 |
lemma continuous_at_norm: "continuous (at x) norm" |
|
4176 |
unfolding continuous_at by (intro tendsto_intros) |
|
4177 |
||
4178 |
lemma continuous_on_norm: "continuous_on s norm" |
|
4179 |
unfolding continuous_on by (intro ballI tendsto_intros) |
|
4180 |
||
4181 |
lemma continuous_at_component: "continuous (at a) (\<lambda>x. x $ i)" |
|
4182 |
unfolding continuous_at by (intro tendsto_intros) |
|
4183 |
||
36441 | 4184 |
lemma continuous_on_component: "continuous_on s (\<lambda>x. x $ i)" |
4185 |
unfolding continuous_on_def by (intro ballI tendsto_intros) |
|
33175 | 4186 |
|
4187 |
lemma continuous_at_infnorm: "continuous (at x) infnorm" |
|
4188 |
unfolding continuous_at Lim_at o_def unfolding dist_norm |
|
4189 |
apply auto apply (rule_tac x=e in exI) apply auto |
|
4190 |
using order_trans[OF real_abs_sub_infnorm infnorm_le_norm, of _ x] by (metis xt1(7)) |
|
4191 |
||
4192 |
text{* Hence some handy theorems on distance, diameter etc. of/from a set. *} |
|
4193 |
||
4194 |
lemma compact_attains_sup: |
|
4195 |
fixes s :: "real set" |
|
4196 |
assumes "compact s" "s \<noteq> {}" |
|
4197 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. y \<le> x" |
|
4198 |
proof- |
|
4199 |
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto |
|
33270 | 4200 |
{ 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" |
4201 |
have "isLub UNIV s (Sup s)" using Sup[OF assms(2)] unfolding setle_def using as(1) by auto |
|
4202 |
moreover have "isUb UNIV s (Sup s - e)" unfolding isUb_def unfolding setle_def using as(4,2) by auto |
|
4203 |
ultimately have False using isLub_le_isUb[of UNIV s "Sup s" "Sup s - e"] using `e>0` by auto } |
|
4204 |
thus ?thesis using bounded_has_Sup(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Sup s"]] |
|
4205 |
apply(rule_tac x="Sup s" in bexI) by auto |
|
4206 |
qed |
|
4207 |
||
4208 |
lemma Inf: |
|
4209 |
fixes S :: "real set" |
|
4210 |
shows "S \<noteq> {} ==> (\<exists>b. b <=* S) ==> isGlb UNIV S (Inf S)" |
|
4211 |
by (auto simp add: isLb_def setle_def setge_def isGlb_def greatestP_def) |
|
33175 | 4212 |
|
4213 |
lemma compact_attains_inf: |
|
4214 |
fixes s :: "real set" |
|
4215 |
assumes "compact s" "s \<noteq> {}" shows "\<exists>x \<in> s. \<forall>y \<in> s. x \<le> y" |
|
4216 |
proof- |
|
4217 |
from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto |
|
33270 | 4218 |
{ fix e::real assume as: "\<forall>x\<in>s. x \<ge> Inf s" "Inf s \<notin> s" "0 < e" |
4219 |
"\<forall>x'\<in>s. x' = Inf s \<or> \<not> abs (x' - Inf s) < e" |
|
4220 |
have "isGlb UNIV s (Inf s)" using Inf[OF assms(2)] unfolding setge_def using as(1) by auto |
|
33175 | 4221 |
moreover |
4222 |
{ fix x assume "x \<in> s" |
|
33270 | 4223 |
hence *:"abs (x - Inf s) = x - Inf s" using as(1)[THEN bspec[where x=x]] by auto |
4224 |
have "Inf s + e \<le> x" using as(4)[THEN bspec[where x=x]] using as(2) `x\<in>s` unfolding * by auto } |
|
4225 |
hence "isLb UNIV s (Inf s + e)" unfolding isLb_def and setge_def by auto |
|
4226 |
ultimately have False using isGlb_le_isLb[of UNIV s "Inf s" "Inf s + e"] using `e>0` by auto } |
|
4227 |
thus ?thesis using bounded_has_Inf(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="Inf s"]] |
|
4228 |
apply(rule_tac x="Inf s" in bexI) by auto |
|
33175 | 4229 |
qed |
4230 |
||
4231 |
lemma continuous_attains_sup: |
|
4232 |
fixes f :: "'a::metric_space \<Rightarrow> real" |
|
4233 |
shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f |
|
4234 |
==> (\<exists>x \<in> s. \<forall>y \<in> s. f y \<le> f x)" |
|
4235 |
using compact_attains_sup[of "f ` s"] |
|
4236 |
using compact_continuous_image[of s f] by auto |
|
4237 |
||
4238 |
lemma continuous_attains_inf: |
|
4239 |
fixes f :: "'a::metric_space \<Rightarrow> real" |
|
4240 |
shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f |
|
4241 |
\<Longrightarrow> (\<exists>x \<in> s. \<forall>y \<in> s. f x \<le> f y)" |
|
4242 |
using compact_attains_inf[of "f ` s"] |
|
4243 |
using compact_continuous_image[of s f] by auto |
|
4244 |
||
4245 |
lemma distance_attains_sup: |
|
4246 |
assumes "compact s" "s \<noteq> {}" |
|
4247 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a y \<le> dist a x" |
|
4248 |
proof (rule continuous_attains_sup [OF assms]) |
|
4249 |
{ fix x assume "x\<in>s" |
|
4250 |
have "(dist a ---> dist a x) (at x within s)" |
|
4251 |
by (intro tendsto_dist tendsto_const Lim_at_within Lim_ident_at) |
|
4252 |
} |
|
4253 |
thus "continuous_on s (dist a)" |
|
4254 |
unfolding continuous_on .. |
|
4255 |
qed |
|
4256 |
||
4257 |
text{* For *minimal* distance, we only need closure, not compactness. *} |
|
4258 |
||
4259 |
lemma distance_attains_inf: |
|
4260 |
fixes a :: "'a::heine_borel" |
|
4261 |
assumes "closed s" "s \<noteq> {}" |
|
4262 |
shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a x \<le> dist a y" |
|
4263 |
proof- |
|
4264 |
from assms(2) obtain b where "b\<in>s" by auto |
|
4265 |
let ?B = "cball a (dist b a) \<inter> s" |
|
4266 |
have "b \<in> ?B" using `b\<in>s` by (simp add: dist_commute) |
|
4267 |
hence "?B \<noteq> {}" by auto |
|
4268 |
moreover |
|
4269 |
{ fix x assume "x\<in>?B" |
|
4270 |
fix e::real assume "e>0" |
|
4271 |
{ fix x' assume "x'\<in>?B" and as:"dist x' x < e" |
|
4272 |
from as have "\<bar>dist a x' - dist a x\<bar> < e" |
|
4273 |
unfolding abs_less_iff minus_diff_eq |
|
4274 |
using dist_triangle2 [of a x' x] |
|
4275 |
using dist_triangle [of a x x'] |
|
4276 |
by arith |
|
4277 |
} |
|
4278 |
hence "\<exists>d>0. \<forall>x'\<in>?B. dist x' x < d \<longrightarrow> \<bar>dist a x' - dist a x\<bar> < e" |
|
4279 |
using `e>0` by auto |
|
4280 |
} |
|
4281 |
hence "continuous_on (cball a (dist b a) \<inter> s) (dist a)" |
|
4282 |
unfolding continuous_on Lim_within dist_norm real_norm_def |
|
4283 |
by fast |
|
4284 |
moreover have "compact ?B" |
|
4285 |
using compact_cball[of a "dist b a"] |
|
4286 |
unfolding compact_eq_bounded_closed |
|
4287 |
using bounded_Int and closed_Int and assms(1) by auto |
|
4288 |
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" |
|
4289 |
using continuous_attains_inf[of ?B "dist a"] by fastsimp |
|
4290 |
thus ?thesis by fastsimp |
|
4291 |
qed |
|
4292 |
||
36437 | 4293 |
subsection {* Pasted sets *} |
33175 | 4294 |
|
4295 |
lemma bounded_Times: |
|
4296 |
assumes "bounded s" "bounded t" shows "bounded (s \<times> t)" |
|
4297 |
proof- |
|
4298 |
obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b" |
|
4299 |
using assms [unfolded bounded_def] by auto |
|
4300 |
then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)" |
|
4301 |
by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono) |
|
4302 |
thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto |
|
4303 |
qed |
|
4304 |
||
4305 |
lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B" |
|
4306 |
by (induct x) simp |
|
4307 |
||
4308 |
lemma compact_Times: "compact s \<Longrightarrow> compact t \<Longrightarrow> compact (s \<times> t)" |
|
4309 |
unfolding compact_def |
|
4310 |
apply clarify |
|
4311 |
apply (drule_tac x="fst \<circ> f" in spec) |
|
4312 |
apply (drule mp, simp add: mem_Times_iff) |
|
4313 |
apply (clarify, rename_tac l1 r1) |
|
4314 |
apply (drule_tac x="snd \<circ> f \<circ> r1" in spec) |
|
4315 |
apply (drule mp, simp add: mem_Times_iff) |
|
4316 |
apply (clarify, rename_tac l2 r2) |
|
4317 |
apply (rule_tac x="(l1, l2)" in rev_bexI, simp) |
|
4318 |
apply (rule_tac x="r1 \<circ> r2" in exI) |
|
4319 |
apply (rule conjI, simp add: subseq_def) |
|
4320 |
apply (drule_tac r=r2 in lim_subseq [COMP swap_prems_rl], assumption) |
|
4321 |
apply (drule (1) tendsto_Pair) back |
|
4322 |
apply (simp add: o_def) |
|
4323 |
done |
|
4324 |
||
4325 |
text{* Hence some useful properties follow quite easily. *} |
|
4326 |
||
4327 |
lemma compact_scaling: |
|
4328 |
fixes s :: "'a::real_normed_vector set" |
|
4329 |
assumes "compact s" shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)" |
|
4330 |
proof- |
|
4331 |
let ?f = "\<lambda>x. scaleR c x" |
|
4332 |
have *:"bounded_linear ?f" by (rule scaleR.bounded_linear_right) |
|
4333 |
show ?thesis using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f] |
|
4334 |
using linear_continuous_at[OF *] assms by auto |
|
4335 |
qed |
|
4336 |
||
4337 |
lemma compact_negations: |
|
4338 |
fixes s :: "'a::real_normed_vector set" |
|
4339 |
assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)" |
|
4340 |
using compact_scaling [OF assms, of "- 1"] by auto |
|
4341 |
||
4342 |
lemma compact_sums: |
|
4343 |
fixes s t :: "'a::real_normed_vector set" |
|
4344 |
assumes "compact s" "compact t" shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}" |
|
4345 |
proof- |
|
4346 |
have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)" |
|
4347 |
apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto |
|
4348 |
have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)" |
|
4349 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros) |
|
4350 |
thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto |
|
4351 |
qed |
|
4352 |
||
4353 |
lemma compact_differences: |
|
4354 |
fixes s t :: "'a::real_normed_vector set" |
|
4355 |
assumes "compact s" "compact t" shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}" |
|
4356 |
proof- |
|
4357 |
have "{x - y | x y. x\<in>s \<and> y \<in> t} = {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}" |
|
4358 |
apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto |
|
4359 |
thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto |
|
4360 |
qed |
|
4361 |
||
4362 |
lemma compact_translation: |
|
4363 |
fixes s :: "'a::real_normed_vector set" |
|
4364 |
assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)" |
|
4365 |
proof- |
|
4366 |
have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto |
|
4367 |
thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto |
|
4368 |
qed |
|
4369 |
||
4370 |
lemma compact_affinity: |
|
4371 |
fixes s :: "'a::real_normed_vector set" |
|
4372 |
assumes "compact s" shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)" |
|
4373 |
proof- |
|
4374 |
have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto |
|
4375 |
thus ?thesis using compact_translation[OF compact_scaling[OF assms], of a c] by auto |
|
4376 |
qed |
|
4377 |
||
4378 |
text{* Hence we get the following. *} |
|
4379 |
||
4380 |
lemma compact_sup_maxdistance: |
|
4381 |
fixes s :: "'a::real_normed_vector set" |
|
4382 |
assumes "compact s" "s \<noteq> {}" |
|
4383 |
shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)" |
|
4384 |
proof- |
|
4385 |
have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto |
|
4386 |
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" |
|
4387 |
using compact_differences[OF assms(1) assms(1)] |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4388 |
using distance_attains_sup[where 'a="'a", unfolded dist_norm, of "{x - y | x y . x\<in>s \<and> y\<in>s}" 0] by auto |
33175 | 4389 |
from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto |
4390 |
thus ?thesis using x(2)[unfolded `x = a - b`] by blast |
|
4391 |
qed |
|
4392 |
||
4393 |
text{* We can state this in terms of diameter of a set. *} |
|
4394 |
||
33270 | 4395 |
definition "diameter s = (if s = {} then 0::real else Sup {norm(x - y) | x y. x \<in> s \<and> y \<in> s})" |
33175 | 4396 |
(* TODO: generalize to class metric_space *) |
4397 |
||
4398 |
lemma diameter_bounded: |
|
4399 |
assumes "bounded s" |
|
4400 |
shows "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s" |
|
4401 |
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)" |
|
4402 |
proof- |
|
4403 |
let ?D = "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}" |
|
4404 |
obtain a where a:"\<forall>x\<in>s. norm x \<le> a" using assms[unfolded bounded_iff] by auto |
|
4405 |
{ fix x y assume "x \<in> s" "y \<in> s" |
|
36350 | 4406 |
hence "norm (x - y) \<le> 2 * a" using norm_triangle_ineq[of x "-y", unfolded norm_minus_cancel] a[THEN bspec[where x=x]] a[THEN bspec[where x=y]] by (auto simp add: field_simps) } |
33175 | 4407 |
note * = this |
4408 |
{ fix x y assume "x\<in>s" "y\<in>s" hence "s \<noteq> {}" by auto |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4409 |
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` |
33324 | 4410 |
by simp (blast intro!: Sup_upper *) } |
33175 | 4411 |
moreover |
4412 |
{ fix d::real assume "d>0" "d < diameter s" |
|
4413 |
hence "s\<noteq>{}" unfolding diameter_def by auto |
|
4414 |
have "\<exists>d' \<in> ?D. d' > d" |
|
4415 |
proof(rule ccontr) |
|
4416 |
assume "\<not> (\<exists>d'\<in>{norm (x - y) |x y. x \<in> s \<and> y \<in> s}. d < d')" |
|
33324 | 4417 |
hence "\<forall>d'\<in>?D. d' \<le> d" by auto (metis not_leE) |
4418 |
thus False using `d < diameter s` `s\<noteq>{}` |
|
4419 |
apply (auto simp add: diameter_def) |
|
4420 |
apply (drule Sup_real_iff [THEN [2] rev_iffD2]) |
|
4421 |
apply (auto, force) |
|
4422 |
done |
|
33175 | 4423 |
qed |
4424 |
hence "\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d" by auto } |
|
4425 |
ultimately show "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s" |
|
4426 |
"\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)" by auto |
|
4427 |
qed |
|
4428 |
||
4429 |
lemma diameter_bounded_bound: |
|
4430 |
"bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s" |
|
4431 |
using diameter_bounded by blast |
|
4432 |
||
4433 |
lemma diameter_compact_attained: |
|
4434 |
fixes s :: "'a::real_normed_vector set" |
|
4435 |
assumes "compact s" "s \<noteq> {}" |
|
4436 |
shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)" |
|
4437 |
proof- |
|
4438 |
have b:"bounded s" using assms(1) by (rule compact_imp_bounded) |
|
4439 |
then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. norm (u - v) \<le> norm (x - y)" using compact_sup_maxdistance[OF assms] by auto |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4440 |
hence "diameter s \<le> norm (x - y)" |
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4441 |
unfolding diameter_def by clarsimp (rule Sup_least, fast+) |
33324 | 4442 |
thus ?thesis |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4443 |
by (metis b diameter_bounded_bound order_antisym xys) |
33175 | 4444 |
qed |
4445 |
||
4446 |
text{* Related results with closure as the conclusion. *} |
|
4447 |
||
4448 |
lemma closed_scaling: |
|
4449 |
fixes s :: "'a::real_normed_vector set" |
|
4450 |
assumes "closed s" shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)" |
|
4451 |
proof(cases "s={}") |
|
4452 |
case True thus ?thesis by auto |
|
4453 |
next |
|
4454 |
case False |
|
4455 |
show ?thesis |
|
4456 |
proof(cases "c=0") |
|
4457 |
have *:"(\<lambda>x. 0) ` s = {0}" using `s\<noteq>{}` by auto |
|
4458 |
case True thus ?thesis apply auto unfolding * using closed_sing by auto |
|
4459 |
next |
|
4460 |
case False |
|
4461 |
{ fix x l assume as:"\<forall>n::nat. x n \<in> scaleR c ` s" "(x ---> l) sequentially" |
|
4462 |
{ fix n::nat have "scaleR (1 / c) (x n) \<in> s" |
|
4463 |
using as(1)[THEN spec[where x=n]] |
|
4464 |
using `c\<noteq>0` by (auto simp add: vector_smult_assoc) |
|
4465 |
} |
|
4466 |
moreover |
|
4467 |
{ fix e::real assume "e>0" |
|
4468 |
hence "0 < e *\<bar>c\<bar>" using `c\<noteq>0` mult_pos_pos[of e "abs c"] by auto |
|
4469 |
then obtain N where "\<forall>n\<ge>N. dist (x n) l < e * \<bar>c\<bar>" |
|
4470 |
using as(2)[unfolded Lim_sequentially, THEN spec[where x="e * abs c"]] by auto |
|
4471 |
hence "\<exists>N. \<forall>n\<ge>N. dist (scaleR (1 / c) (x n)) (scaleR (1 / c) l) < e" |
|
4472 |
unfolding dist_norm unfolding scaleR_right_diff_distrib[THEN sym] |
|
4473 |
using mult_imp_div_pos_less[of "abs c" _ e] `c\<noteq>0` by auto } |
|
4474 |
hence "((\<lambda>n. scaleR (1 / c) (x n)) ---> scaleR (1 / c) l) sequentially" unfolding Lim_sequentially by auto |
|
4475 |
ultimately have "l \<in> scaleR c ` s" |
|
4476 |
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"]] |
|
4477 |
unfolding image_iff using `c\<noteq>0` apply(rule_tac x="scaleR (1 / c) l" in bexI) by auto } |
|
4478 |
thus ?thesis unfolding closed_sequential_limits by fast |
|
4479 |
qed |
|
4480 |
qed |
|
4481 |
||
4482 |
lemma closed_negations: |
|
4483 |
fixes s :: "'a::real_normed_vector set" |
|
4484 |
assumes "closed s" shows "closed ((\<lambda>x. -x) ` s)" |
|
4485 |
using closed_scaling[OF assms, of "- 1"] by simp |
|
4486 |
||
4487 |
lemma compact_closed_sums: |
|
4488 |
fixes s :: "'a::real_normed_vector set" |
|
4489 |
assumes "compact s" "closed t" shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}" |
|
4490 |
proof- |
|
4491 |
let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}" |
|
4492 |
{ fix x l assume as:"\<forall>n. x n \<in> ?S" "(x ---> l) sequentially" |
|
4493 |
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" |
|
4494 |
using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto |
|
4495 |
obtain l' r where "l'\<in>s" and r:"subseq r" and lr:"(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially" |
|
4496 |
using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto |
|
4497 |
have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially" |
|
4498 |
using Lim_sub[OF lim_subseq[OF r as(2)] lr] and f(1) unfolding o_def by auto |
|
4499 |
hence "l - l' \<in> t" |
|
4500 |
using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda> n. snd (f (r n))"], THEN spec[where x="l - l'"]] |
|
4501 |
using f(3) by auto |
|
4502 |
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 |
|
4503 |
} |
|
4504 |
thus ?thesis unfolding closed_sequential_limits by fast |
|
4505 |
qed |
|
4506 |
||
4507 |
lemma closed_compact_sums: |
|
4508 |
fixes s t :: "'a::real_normed_vector set" |
|
4509 |
assumes "closed s" "compact t" |
|
4510 |
shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}" |
|
4511 |
proof- |
|
4512 |
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 |
|
4513 |
apply(rule_tac x=y in exI) apply auto apply(rule_tac x=y in exI) by auto |
|
4514 |
thus ?thesis using compact_closed_sums[OF assms(2,1)] by simp |
|
4515 |
qed |
|
4516 |
||
4517 |
lemma compact_closed_differences: |
|
4518 |
fixes s t :: "'a::real_normed_vector set" |
|
4519 |
assumes "compact s" "closed t" |
|
4520 |
shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}" |
|
4521 |
proof- |
|
4522 |
have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}" |
|
4523 |
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto |
|
4524 |
thus ?thesis using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto |
|
4525 |
qed |
|
4526 |
||
4527 |
lemma closed_compact_differences: |
|
4528 |
fixes s t :: "'a::real_normed_vector set" |
|
4529 |
assumes "closed s" "compact t" |
|
4530 |
shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}" |
|
4531 |
proof- |
|
4532 |
have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}" |
|
4533 |
apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto |
|
4534 |
thus ?thesis using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp |
|
4535 |
qed |
|
4536 |
||
4537 |
lemma closed_translation: |
|
4538 |
fixes a :: "'a::real_normed_vector" |
|
4539 |
assumes "closed s" shows "closed ((\<lambda>x. a + x) ` s)" |
|
4540 |
proof- |
|
4541 |
have "{a + y |y. y \<in> s} = (op + a ` s)" by auto |
|
4542 |
thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto |
|
4543 |
qed |
|
4544 |
||
34105 | 4545 |
lemma translation_Compl: |
4546 |
fixes a :: "'a::ab_group_add" |
|
4547 |
shows "(\<lambda>x. a + x) ` (- t) = - ((\<lambda>x. a + x) ` t)" |
|
4548 |
apply (auto simp add: image_iff) apply(rule_tac x="x - a" in bexI) by auto |
|
4549 |
||
33175 | 4550 |
lemma translation_UNIV: |
4551 |
fixes a :: "'a::ab_group_add" shows "range (\<lambda>x. a + x) = UNIV" |
|
4552 |
apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto |
|
4553 |
||
4554 |
lemma translation_diff: |
|
4555 |
fixes a :: "'a::ab_group_add" |
|
4556 |
shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)" |
|
4557 |
by auto |
|
4558 |
||
4559 |
lemma closure_translation: |
|
4560 |
fixes a :: "'a::real_normed_vector" |
|
4561 |
shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)" |
|
4562 |
proof- |
|
34105 | 4563 |
have *:"op + a ` (- s) = - op + a ` s" |
33175 | 4564 |
apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto |
34105 | 4565 |
show ?thesis unfolding closure_interior translation_Compl |
4566 |
using interior_translation[of a "- s"] unfolding * by auto |
|
33175 | 4567 |
qed |
4568 |
||
4569 |
lemma frontier_translation: |
|
4570 |
fixes a :: "'a::real_normed_vector" |
|
4571 |
shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)" |
|
4572 |
unfolding frontier_def translation_diff interior_translation closure_translation by auto |
|
4573 |
||
4574 |
subsection{* Separation between points and sets. *} |
|
4575 |
||
4576 |
lemma separate_point_closed: |
|
4577 |
fixes s :: "'a::heine_borel set" |
|
4578 |
shows "closed s \<Longrightarrow> a \<notin> s ==> (\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x)" |
|
4579 |
proof(cases "s = {}") |
|
4580 |
case True |
|
4581 |
thus ?thesis by(auto intro!: exI[where x=1]) |
|
4582 |
next |
|
4583 |
case False |
|
4584 |
assume "closed s" "a \<notin> s" |
|
4585 |
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 |
|
4586 |
with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast |
|
4587 |
qed |
|
4588 |
||
4589 |
lemma separate_compact_closed: |
|
4590 |
fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
|
4591 |
(* TODO: does this generalize to heine_borel? *) |
|
4592 |
assumes "compact s" and "closed t" and "s \<inter> t = {}" |
|
4593 |
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
|
4594 |
proof- |
|
4595 |
have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto |
|
4596 |
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" |
|
4597 |
using separate_point_closed[OF compact_closed_differences[OF assms(1,2)], of 0] by auto |
|
4598 |
{ fix x y assume "x\<in>s" "y\<in>t" |
|
4599 |
hence "x - y \<in> {x - y |x y. x \<in> s \<and> y \<in> t}" by auto |
|
4600 |
hence "d \<le> dist (x - y) 0" using d[THEN bspec[where x="x - y"]] using dist_commute |
|
4601 |
by (auto simp add: dist_commute) |
|
4602 |
hence "d \<le> dist x y" unfolding dist_norm by auto } |
|
4603 |
thus ?thesis using `d>0` by auto |
|
4604 |
qed |
|
4605 |
||
4606 |
lemma separate_closed_compact: |
|
4607 |
fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
|
4608 |
assumes "closed s" and "compact t" and "s \<inter> t = {}" |
|
4609 |
shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
|
4610 |
proof- |
|
4611 |
have *:"t \<inter> s = {}" using assms(3) by auto |
|
4612 |
show ?thesis using separate_compact_closed[OF assms(2,1) *] |
|
4613 |
apply auto apply(rule_tac x=d in exI) apply auto apply (erule_tac x=y in ballE) |
|
4614 |
by (auto simp add: dist_commute) |
|
4615 |
qed |
|
4616 |
||
36439 | 4617 |
subsection {* Intervals *} |
33175 | 4618 |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4619 |
lemma interval: fixes a :: "'a::ord^'n" shows |
33175 | 4620 |
"{a <..< b} = {x::'a^'n. \<forall>i. a$i < x$i \<and> x$i < b$i}" and |
4621 |
"{a .. b} = {x::'a^'n. \<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i}" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4622 |
by (auto simp add: expand_set_eq vector_less_def vector_le_def) |
33175 | 4623 |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4624 |
lemma mem_interval: fixes a :: "'a::ord^'n" shows |
33175 | 4625 |
"x \<in> {a<..<b} \<longleftrightarrow> (\<forall>i. a$i < x$i \<and> x$i < b$i)" |
4626 |
"x \<in> {a .. b} \<longleftrightarrow> (\<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i)" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4627 |
using interval[of a b] by(auto simp add: expand_set_eq vector_less_def vector_le_def) |
33175 | 4628 |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4629 |
lemma interval_eq_empty: fixes a :: "real^'n" shows |
33175 | 4630 |
"({a <..< b} = {} \<longleftrightarrow> (\<exists>i. b$i \<le> a$i))" (is ?th1) and |
4631 |
"({a .. b} = {} \<longleftrightarrow> (\<exists>i. b$i < a$i))" (is ?th2) |
|
4632 |
proof- |
|
4633 |
{ fix i x assume as:"b$i \<le> a$i" and x:"x\<in>{a <..< b}" |
|
4634 |
hence "a $ i < x $ i \<and> x $ i < b $ i" unfolding mem_interval by auto |
|
4635 |
hence "a$i < b$i" by auto |
|
4636 |
hence False using as by auto } |
|
4637 |
moreover |
|
4638 |
{ assume as:"\<forall>i. \<not> (b$i \<le> a$i)" |
|
4639 |
let ?x = "(1/2) *\<^sub>R (a + b)" |
|
4640 |
{ fix i |
|
4641 |
have "a$i < b$i" using as[THEN spec[where x=i]] by auto |
|
4642 |
hence "a$i < ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i < b$i" |
|
4643 |
unfolding vector_smult_component and vector_add_component |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4644 |
by auto } |
33175 | 4645 |
hence "{a <..< b} \<noteq> {}" using mem_interval(1)[of "?x" a b] by auto } |
4646 |
ultimately show ?th1 by blast |
|
4647 |
||
4648 |
{ fix i x assume as:"b$i < a$i" and x:"x\<in>{a .. b}" |
|
4649 |
hence "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" unfolding mem_interval by auto |
|
4650 |
hence "a$i \<le> b$i" by auto |
|
4651 |
hence False using as by auto } |
|
4652 |
moreover |
|
4653 |
{ assume as:"\<forall>i. \<not> (b$i < a$i)" |
|
4654 |
let ?x = "(1/2) *\<^sub>R (a + b)" |
|
4655 |
{ fix i |
|
4656 |
have "a$i \<le> b$i" using as[THEN spec[where x=i]] by auto |
|
4657 |
hence "a$i \<le> ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i \<le> b$i" |
|
4658 |
unfolding vector_smult_component and vector_add_component |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4659 |
by auto } |
33175 | 4660 |
hence "{a .. b} \<noteq> {}" using mem_interval(2)[of "?x" a b] by auto } |
4661 |
ultimately show ?th2 by blast |
|
4662 |
qed |
|
4663 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4664 |
lemma interval_ne_empty: fixes a :: "real^'n" shows |
33175 | 4665 |
"{a .. b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i \<le> b$i)" and |
4666 |
"{a <..< b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i < b$i)" |
|
4667 |
unfolding interval_eq_empty[of a b] by (auto simp add: not_less not_le) (* BH: Why doesn't just "auto" work here? *) |
|
4668 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4669 |
lemma subset_interval_imp: fixes a :: "real^'n" shows |
33175 | 4670 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c .. d} \<subseteq> {a .. b}" and |
4671 |
"(\<forall>i. a$i < c$i \<and> d$i < b$i) \<Longrightarrow> {c .. d} \<subseteq> {a<..<b}" and |
|
4672 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a .. b}" and |
|
4673 |
"(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a<..<b}" |
|
4674 |
unfolding subset_eq[unfolded Ball_def] unfolding mem_interval |
|
4675 |
by (auto intro: order_trans less_le_trans le_less_trans less_imp_le) (* BH: Why doesn't just "auto" work here? *) |
|
4676 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4677 |
lemma interval_sing: fixes a :: "'a::linorder^'n" shows |
33175 | 4678 |
"{a .. a} = {a} \<and> {a<..<a} = {}" |
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4679 |
apply(auto simp add: expand_set_eq vector_less_def vector_le_def Cart_eq) |
33175 | 4680 |
apply (simp add: order_eq_iff) |
4681 |
apply (auto simp add: not_less less_imp_le) |
|
4682 |
done |
|
4683 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4684 |
lemma interval_open_subset_closed: fixes a :: "'a::preorder^'n" shows |
33175 | 4685 |
"{a<..<b} \<subseteq> {a .. b}" |
4686 |
proof(simp add: subset_eq, rule) |
|
4687 |
fix x |
|
4688 |
assume x:"x \<in>{a<..<b}" |
|
4689 |
{ fix i |
|
4690 |
have "a $ i \<le> x $ i" |
|
4691 |
using x order_less_imp_le[of "a$i" "x$i"] |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4692 |
by(simp add: expand_set_eq vector_less_def vector_le_def Cart_eq) |
33175 | 4693 |
} |
4694 |
moreover |
|
4695 |
{ fix i |
|
4696 |
have "x $ i \<le> b $ i" |
|
4697 |
using x order_less_imp_le[of "x$i" "b$i"] |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4698 |
by(simp add: expand_set_eq vector_less_def vector_le_def Cart_eq) |
33175 | 4699 |
} |
4700 |
ultimately |
|
4701 |
show "a \<le> x \<and> x \<le> b" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
4702 |
by(simp add: expand_set_eq vector_less_def vector_le_def Cart_eq) |
33175 | 4703 |
qed |
4704 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4705 |
lemma subset_interval: fixes a :: "real^'n" shows |
33175 | 4706 |
"{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 |
4707 |
"{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 |
|
4708 |
"{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 |
|
4709 |
"{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) |
|
4710 |
proof- |
|
4711 |
show ?th1 unfolding subset_eq and Ball_def and mem_interval by (auto intro: order_trans) |
|
4712 |
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) |
|
4713 |
{ assume as: "{c<..<d} \<subseteq> {a .. b}" "\<forall>i. c$i < d$i" |
|
4714 |
hence "{c<..<d} \<noteq> {}" unfolding interval_eq_empty by (auto, drule_tac x=i in spec, simp) (* BH: Why doesn't just "auto" work? *) |
|
4715 |
fix i |
|
4716 |
(** TODO combine the following two parts as done in the HOL_light version. **) |
|
4717 |
{ let ?x = "(\<chi> j. (if j=i then ((min (a$j) (d$j))+c$j)/2 else (c$j+d$j)/2))::real^'n" |
|
4718 |
assume as2: "a$i > c$i" |
|
4719 |
{ fix j |
|
4720 |
have "c $ j < ?x $ j \<and> ?x $ j < d $ j" unfolding Cart_lambda_beta |
|
4721 |
apply(cases "j=i") using as(2)[THEN spec[where x=j]] |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4722 |
by (auto simp add: as2) } |
33175 | 4723 |
hence "?x\<in>{c<..<d}" unfolding mem_interval by auto |
4724 |
moreover |
|
4725 |
have "?x\<notin>{a .. b}" |
|
4726 |
unfolding mem_interval apply auto apply(rule_tac x=i in exI) |
|
4727 |
using as(2)[THEN spec[where x=i]] and as2 |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4728 |
by auto |
33175 | 4729 |
ultimately have False using as by auto } |
4730 |
hence "a$i \<le> c$i" by(rule ccontr)auto |
|
4731 |
moreover |
|
4732 |
{ let ?x = "(\<chi> j. (if j=i then ((max (b$j) (c$j))+d$j)/2 else (c$j+d$j)/2))::real^'n" |
|
4733 |
assume as2: "b$i < d$i" |
|
4734 |
{ fix j |
|
4735 |
have "d $ j > ?x $ j \<and> ?x $ j > c $ j" unfolding Cart_lambda_beta |
|
4736 |
apply(cases "j=i") using as(2)[THEN spec[where x=j]] |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4737 |
by (auto simp add: as2) } |
33175 | 4738 |
hence "?x\<in>{c<..<d}" unfolding mem_interval by auto |
4739 |
moreover |
|
4740 |
have "?x\<notin>{a .. b}" |
|
4741 |
unfolding mem_interval apply auto apply(rule_tac x=i in exI) |
|
4742 |
using as(2)[THEN spec[where x=i]] and as2 |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4743 |
by auto |
33175 | 4744 |
ultimately have False using as by auto } |
4745 |
hence "b$i \<ge> d$i" by(rule ccontr)auto |
|
4746 |
ultimately |
|
4747 |
have "a$i \<le> c$i \<and> d$i \<le> b$i" by auto |
|
4748 |
} note part1 = this |
|
4749 |
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)+ |
|
4750 |
{ assume as:"{c<..<d} \<subseteq> {a<..<b}" "\<forall>i. c$i < d$i" |
|
4751 |
fix i |
|
4752 |
from as(1) have "{c<..<d} \<subseteq> {a..b}" using interval_open_subset_closed[of a b] by auto |
|
4753 |
hence "a$i \<le> c$i \<and> d$i \<le> b$i" using part1 and as(2) by auto } note * = this |
|
4754 |
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)+ |
|
4755 |
qed |
|
4756 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4757 |
lemma disjoint_interval: fixes a::"real^'n" shows |
33175 | 4758 |
"{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 |
4759 |
"{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 |
|
4760 |
"{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 |
|
4761 |
"{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) |
|
4762 |
proof- |
|
4763 |
let ?z = "(\<chi> i. ((max (a$i) (c$i)) + (min (b$i) (d$i))) / 2)::real^'n" |
|
4764 |
show ?th1 ?th2 ?th3 ?th4 |
|
4765 |
unfolding expand_set_eq and Int_iff and empty_iff and mem_interval and all_conj_distrib[THEN sym] and eq_False |
|
4766 |
apply (auto elim!: allE[where x="?z"]) |
|
4767 |
apply ((rule_tac x=x in exI, force) | (rule_tac x=i in exI, force))+ |
|
4768 |
done |
|
4769 |
qed |
|
4770 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4771 |
lemma inter_interval: fixes a :: "'a::linorder^'n" shows |
33175 | 4772 |
"{a .. b} \<inter> {c .. d} = {(\<chi> i. max (a$i) (c$i)) .. (\<chi> i. min (b$i) (d$i))}" |
4773 |
unfolding expand_set_eq and Int_iff and mem_interval |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4774 |
by auto |
33175 | 4775 |
|
4776 |
(* Moved interval_open_subset_closed a bit upwards *) |
|
4777 |
||
4778 |
lemma open_interval_lemma: fixes x :: "real" shows |
|
4779 |
"a < x \<Longrightarrow> x < b ==> (\<exists>d>0. \<forall>x'. abs(x' - x) < d --> a < x' \<and> x' < b)" |
|
4780 |
by(rule_tac x="min (x - a) (b - x)" in exI, auto) |
|
4781 |
||
34964 | 4782 |
lemma open_interval[intro]: fixes a :: "real^'n" shows "open {a<..<b}" |
33175 | 4783 |
proof- |
4784 |
{ fix x assume x:"x\<in>{a<..<b}" |
|
4785 |
{ fix i |
|
4786 |
have "\<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i" |
|
4787 |
using x[unfolded mem_interval, THEN spec[where x=i]] |
|
4788 |
using open_interval_lemma[of "a$i" "x$i" "b$i"] by auto } |
|
4789 |
||
4790 |
hence "\<forall>i. \<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i" by auto |
|
4791 |
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)" |
|
4792 |
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 |
|
4793 |
||
4794 |
let ?d = "Min (range d)" |
|
4795 |
have **:"finite (range d)" "range d \<noteq> {}" by auto |
|
4796 |
have "?d>0" unfolding Min_gr_iff[OF **] using d by auto |
|
4797 |
moreover |
|
4798 |
{ fix x' assume as:"dist x' x < ?d" |
|
4799 |
{ fix i |
|
4800 |
have "\<bar>x'$i - x $ i\<bar> < d i" |
|
4801 |
using norm_bound_component_lt[OF as[unfolded dist_norm], of i] |
|
4802 |
unfolding vector_minus_component and Min_gr_iff[OF **] by auto |
|
4803 |
hence "a $ i < x' $ i" "x' $ i < b $ i" using d[THEN spec[where x=i]] by auto } |
|
4804 |
hence "a < x' \<and> x' < b" unfolding vector_less_def by auto } |
|
4805 |
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) |
|
4806 |
} |
|
4807 |
thus ?thesis unfolding open_dist using open_interval_lemma by auto |
|
4808 |
qed |
|
4809 |
||
34964 | 4810 |
lemma open_interval_real[intro]: fixes a :: "real" shows "open {a<..<b}" |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
4811 |
by (rule open_real_greaterThanLessThan) |
33714
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents:
33324
diff
changeset
|
4812 |
|
34964 | 4813 |
lemma closed_interval[intro]: fixes a :: "real^'n" shows "closed {a .. b}" |
33175 | 4814 |
proof- |
4815 |
{ 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"*) |
|
4816 |
{ assume xa:"a$i > x$i" |
|
4817 |
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 |
|
4818 |
hence False unfolding mem_interval and dist_norm |
|
4819 |
using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xa by(auto elim!: allE[where x=i]) |
|
4820 |
} hence "a$i \<le> x$i" by(rule ccontr)auto |
|
4821 |
moreover |
|
4822 |
{ assume xb:"b$i < x$i" |
|
4823 |
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 |
|
4824 |
hence False unfolding mem_interval and dist_norm |
|
4825 |
using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xb by(auto elim!: allE[where x=i]) |
|
4826 |
} hence "x$i \<le> b$i" by(rule ccontr)auto |
|
4827 |
ultimately |
|
4828 |
have "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" by auto } |
|
4829 |
thus ?thesis unfolding closed_limpt islimpt_approachable mem_interval by auto |
|
4830 |
qed |
|
4831 |
||
34964 | 4832 |
lemma interior_closed_interval[intro]: fixes a :: "real^'n" shows |
33175 | 4833 |
"interior {a .. b} = {a<..<b}" (is "?L = ?R") |
4834 |
proof(rule subset_antisym) |
|
4835 |
show "?R \<subseteq> ?L" using interior_maximal[OF interval_open_subset_closed open_interval] by auto |
|
4836 |
next |
|
4837 |
{ fix x assume "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> {a..b}" |
|
4838 |
then obtain s where s:"open s" "x \<in> s" "s \<subseteq> {a..b}" by auto |
|
4839 |
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 |
|
4840 |
{ fix i |
|
4841 |
have "dist (x - (e / 2) *\<^sub>R basis i) x < e" |
|
4842 |
"dist (x + (e / 2) *\<^sub>R basis i) x < e" |
|
4843 |
unfolding dist_norm apply auto |
|
4844 |
unfolding norm_minus_cancel using norm_basis[of i] and `e>0` by auto |
|
4845 |
hence "a $ i \<le> (x - (e / 2) *\<^sub>R basis i) $ i" |
|
4846 |
"(x + (e / 2) *\<^sub>R basis i) $ i \<le> b $ i" |
|
4847 |
using e[THEN spec[where x="x - (e/2) *\<^sub>R basis i"]] |
|
4848 |
and e[THEN spec[where x="x + (e/2) *\<^sub>R basis i"]] |
|
4849 |
unfolding mem_interval by (auto elim!: allE[where x=i]) |
|
4850 |
hence "a $ i < x $ i" and "x $ i < b $ i" |
|
4851 |
unfolding vector_minus_component and vector_add_component |
|
4852 |
unfolding vector_smult_component and basis_component using `e>0` by auto } |
|
4853 |
hence "x \<in> {a<..<b}" unfolding mem_interval by auto } |
|
4854 |
thus "?L \<subseteq> ?R" unfolding interior_def and subset_eq by auto |
|
4855 |
qed |
|
4856 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4857 |
lemma bounded_closed_interval: fixes a :: "real^'n" shows |
33175 | 4858 |
"bounded {a .. b}" |
4859 |
proof- |
|
4860 |
let ?b = "\<Sum>i\<in>UNIV. \<bar>a$i\<bar> + \<bar>b$i\<bar>" |
|
4861 |
{ fix x::"real^'n" assume x:"\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i" |
|
4862 |
{ fix i |
|
4863 |
have "\<bar>x$i\<bar> \<le> \<bar>a$i\<bar> + \<bar>b$i\<bar>" using x[THEN spec[where x=i]] by auto } |
|
4864 |
hence "(\<Sum>i\<in>UNIV. \<bar>x $ i\<bar>) \<le> ?b" by(rule setsum_mono) |
|
4865 |
hence "norm x \<le> ?b" using norm_le_l1[of x] by auto } |
|
4866 |
thus ?thesis unfolding interval and bounded_iff by auto |
|
4867 |
qed |
|
4868 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4869 |
lemma bounded_interval: fixes a :: "real^'n" shows |
33175 | 4870 |
"bounded {a .. b} \<and> bounded {a<..<b}" |
4871 |
using bounded_closed_interval[of a b] |
|
4872 |
using interval_open_subset_closed[of a b] |
|
4873 |
using bounded_subset[of "{a..b}" "{a<..<b}"] |
|
4874 |
by simp |
|
4875 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4876 |
lemma not_interval_univ: fixes a :: "real^'n" shows |
33175 | 4877 |
"({a .. b} \<noteq> UNIV) \<and> ({a<..<b} \<noteq> UNIV)" |
4878 |
using bounded_interval[of a b] |
|
4879 |
by auto |
|
4880 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4881 |
lemma compact_interval: fixes a :: "real^'n" shows |
33175 | 4882 |
"compact {a .. b}" |
4883 |
using bounded_closed_imp_compact using bounded_interval[of a b] using closed_interval[of a b] by auto |
|
4884 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4885 |
lemma open_interval_midpoint: fixes a :: "real^'n" |
33175 | 4886 |
assumes "{a<..<b} \<noteq> {}" shows "((1/2) *\<^sub>R (a + b)) \<in> {a<..<b}" |
4887 |
proof- |
|
4888 |
{ fix i |
|
4889 |
have "a $ i < ((1 / 2) *\<^sub>R (a + b)) $ i \<and> ((1 / 2) *\<^sub>R (a + b)) $ i < b $ i" |
|
4890 |
using assms[unfolded interval_ne_empty, THEN spec[where x=i]] |
|
4891 |
unfolding vector_smult_component and vector_add_component |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4892 |
by auto } |
33175 | 4893 |
thus ?thesis unfolding mem_interval by auto |
4894 |
qed |
|
4895 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4896 |
lemma open_closed_interval_convex: fixes x :: "real^'n" |
33175 | 4897 |
assumes x:"x \<in> {a<..<b}" and y:"y \<in> {a .. b}" and e:"0 < e" "e \<le> 1" |
4898 |
shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> {a<..<b}" |
|
4899 |
proof- |
|
4900 |
{ fix i |
|
4901 |
have "a $ i = e * a$i + (1 - e) * a$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 "a $ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i" by auto |
|
4908 |
moreover { |
|
4909 |
have "b $ i = e * b$i + (1 - e) * b$i" unfolding left_diff_distrib by simp |
|
4910 |
also have "\<dots> > e * x $ i + (1 - e) * y $ i" apply(rule add_less_le_mono) |
|
4911 |
using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all |
|
4912 |
using x unfolding mem_interval apply simp |
|
4913 |
using y unfolding mem_interval apply simp |
|
4914 |
done |
|
4915 |
finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i < b $ i" by auto |
|
4916 |
} 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 } |
|
4917 |
thus ?thesis unfolding mem_interval by auto |
|
4918 |
qed |
|
4919 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4920 |
lemma closure_open_interval: fixes a :: "real^'n" |
33175 | 4921 |
assumes "{a<..<b} \<noteq> {}" |
4922 |
shows "closure {a<..<b} = {a .. b}" |
|
4923 |
proof- |
|
4924 |
have ab:"a < b" using assms[unfolded interval_ne_empty] unfolding vector_less_def by auto |
|
4925 |
let ?c = "(1 / 2) *\<^sub>R (a + b)" |
|
4926 |
{ fix x assume as:"x \<in> {a .. b}" |
|
4927 |
def f == "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)" |
|
4928 |
{ fix n assume fn:"f n < b \<longrightarrow> a < f n \<longrightarrow> f n = x" and xc:"x \<noteq> ?c" |
|
4929 |
have *:"0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" unfolding inverse_le_1_iff by auto |
|
4930 |
have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x = |
|
4931 |
x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)" |
|
4932 |
by (auto simp add: algebra_simps) |
|
4933 |
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 |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
4934 |
hence False using fn unfolding f_def using xc by(auto simp add: vector_ssub_ldistrib) } |
33175 | 4935 |
moreover |
4936 |
{ assume "\<not> (f ---> x) sequentially" |
|
4937 |
{ fix e::real assume "e>0" |
|
4938 |
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 |
|
4939 |
then obtain N::nat where "inverse (real (N + 1)) < e" by auto |
|
4940 |
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) |
|
4941 |
hence "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto } |
|
4942 |
hence "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially" |
|
4943 |
unfolding Lim_sequentially by(auto simp add: dist_norm) |
|
4944 |
hence "(f ---> x) sequentially" unfolding f_def |
|
4945 |
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] |
|
4946 |
using Lim_vmul[of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] by auto } |
|
4947 |
ultimately have "x \<in> closure {a<..<b}" |
|
4948 |
using as and open_interval_midpoint[OF assms] unfolding closure_def unfolding islimpt_sequential by(cases "x=?c")auto } |
|
4949 |
thus ?thesis using closure_minimal[OF interval_open_subset_closed closed_interval, of a b] by blast |
|
4950 |
qed |
|
4951 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4952 |
lemma bounded_subset_open_interval_symmetric: fixes s::"(real^'n) set" |
33175 | 4953 |
assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a<..<a}" |
4954 |
proof- |
|
4955 |
obtain b where "b>0" and b:"\<forall>x\<in>s. norm x \<le> b" using assms[unfolded bounded_pos] by auto |
|
4956 |
def a \<equiv> "(\<chi> i. b+1)::real^'n" |
|
4957 |
{ fix x assume "x\<in>s" |
|
4958 |
fix i |
|
4959 |
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] |
|
4960 |
unfolding vector_uminus_component and a_def and Cart_lambda_beta by auto |
|
4961 |
} |
|
4962 |
thus ?thesis by(auto intro: exI[where x=a] simp add: vector_less_def) |
|
4963 |
qed |
|
4964 |
||
4965 |
lemma bounded_subset_open_interval: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4966 |
fixes s :: "(real ^ 'n) set" |
33175 | 4967 |
shows "bounded s ==> (\<exists>a b. s \<subseteq> {a<..<b})" |
4968 |
by (auto dest!: bounded_subset_open_interval_symmetric) |
|
4969 |
||
4970 |
lemma bounded_subset_closed_interval_symmetric: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4971 |
fixes s :: "(real ^ 'n) set" |
33175 | 4972 |
assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a .. a}" |
4973 |
proof- |
|
4974 |
obtain a where "s \<subseteq> {- a<..<a}" using bounded_subset_open_interval_symmetric[OF assms] by auto |
|
4975 |
thus ?thesis using interval_open_subset_closed[of "-a" a] by auto |
|
4976 |
qed |
|
4977 |
||
4978 |
lemma bounded_subset_closed_interval: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4979 |
fixes s :: "(real ^ 'n) set" |
33175 | 4980 |
shows "bounded s ==> (\<exists>a b. s \<subseteq> {a .. b})" |
4981 |
using bounded_subset_closed_interval_symmetric[of s] by auto |
|
4982 |
||
4983 |
lemma frontier_closed_interval: |
|
4984 |
fixes a b :: "real ^ _" |
|
4985 |
shows "frontier {a .. b} = {a .. b} - {a<..<b}" |
|
4986 |
unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] .. |
|
4987 |
||
4988 |
lemma frontier_open_interval: |
|
4989 |
fixes a b :: "real ^ _" |
|
4990 |
shows "frontier {a<..<b} = (if {a<..<b} = {} then {} else {a .. b} - {a<..<b})" |
|
4991 |
proof(cases "{a<..<b} = {}") |
|
4992 |
case True thus ?thesis using frontier_empty by auto |
|
4993 |
next |
|
4994 |
case False thus ?thesis unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] by auto |
|
4995 |
qed |
|
4996 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
4997 |
lemma inter_interval_mixed_eq_empty: fixes a :: "real^'n" |
33175 | 4998 |
assumes "{c<..<d} \<noteq> {}" shows "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> {a<..<b} \<inter> {c<..<d} = {}" |
4999 |
unfolding closure_open_interval[OF assms, THEN sym] unfolding open_inter_closure_eq_empty[OF open_interval] .. |
|
5000 |
||
5001 |
||
5002 |
(* Some stuff for half-infinite intervals too; FIXME: notation? *) |
|
5003 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5004 |
lemma closed_interval_left: fixes b::"real^'n" |
33175 | 5005 |
shows "closed {x::real^'n. \<forall>i. x$i \<le> b$i}" |
5006 |
proof- |
|
5007 |
{ fix i |
|
5008 |
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" |
|
5009 |
{ assume "x$i > b$i" |
|
5010 |
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 |
|
5011 |
hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto } |
|
5012 |
hence "x$i \<le> b$i" by(rule ccontr)auto } |
|
5013 |
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast |
|
5014 |
qed |
|
5015 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5016 |
lemma closed_interval_right: fixes a::"real^'n" |
33175 | 5017 |
shows "closed {x::real^'n. \<forall>i. a$i \<le> x$i}" |
5018 |
proof- |
|
5019 |
{ fix i |
|
5020 |
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" |
|
5021 |
{ assume "a$i > x$i" |
|
5022 |
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 |
|
5023 |
hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto } |
|
5024 |
hence "a$i \<le> x$i" by(rule ccontr)auto } |
|
5025 |
thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast |
|
5026 |
qed |
|
5027 |
||
36439 | 5028 |
text {* Intervals in general, including infinite and mixtures of open and closed. *} |
33175 | 5029 |
|
5030 |
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)" |
|
5031 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5032 |
lemma is_interval_interval: "is_interval {a .. b::real^'n}" (is ?th1) "is_interval {a<..<b}" (is ?th2) proof - |
33175 | 5033 |
have *:"\<And>x y z::real. x < y \<Longrightarrow> y < z \<Longrightarrow> x < z" by auto |
5034 |
show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff |
|
5035 |
by(meson real_le_trans le_less_trans less_le_trans *)+ qed |
|
5036 |
||
5037 |
lemma is_interval_empty: |
|
5038 |
"is_interval {}" |
|
5039 |
unfolding is_interval_def |
|
5040 |
by simp |
|
5041 |
||
5042 |
lemma is_interval_univ: |
|
5043 |
"is_interval UNIV" |
|
5044 |
unfolding is_interval_def |
|
5045 |
by simp |
|
5046 |
||
5047 |
subsection{* Closure of halfspaces and hyperplanes. *} |
|
5048 |
||
5049 |
lemma Lim_inner: |
|
5050 |
assumes "(f ---> l) net" shows "((\<lambda>y. inner a (f y)) ---> inner a l) net" |
|
5051 |
by (intro tendsto_intros assms) |
|
5052 |
||
5053 |
lemma continuous_at_inner: "continuous (at x) (inner a)" |
|
5054 |
unfolding continuous_at by (intro tendsto_intros) |
|
5055 |
||
5056 |
lemma continuous_on_inner: |
|
5057 |
fixes s :: "'a::real_inner set" |
|
5058 |
shows "continuous_on s (inner a)" |
|
5059 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros) |
|
5060 |
||
5061 |
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}" |
|
5062 |
proof- |
|
5063 |
have "\<forall>x. continuous (at x) (inner a)" |
|
5064 |
unfolding continuous_at by (rule allI) (intro tendsto_intros) |
|
5065 |
hence "closed (inner a -` {..b})" |
|
5066 |
using closed_real_atMost by (rule continuous_closed_vimage) |
|
5067 |
moreover have "{x. inner a x \<le> b} = inner a -` {..b}" by auto |
|
5068 |
ultimately show ?thesis by simp |
|
5069 |
qed |
|
5070 |
||
5071 |
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}" |
|
5072 |
using closed_halfspace_le[of "-a" "-b"] unfolding inner_minus_left by auto |
|
5073 |
||
5074 |
lemma closed_hyperplane: "closed {x. inner a x = b}" |
|
5075 |
proof- |
|
5076 |
have "{x. inner a x = b} = {x. inner a x \<ge> b} \<inter> {x. inner a x \<le> b}" by auto |
|
5077 |
thus ?thesis using closed_halfspace_le[of a b] and closed_halfspace_ge[of b a] using closed_Int by auto |
|
5078 |
qed |
|
5079 |
||
5080 |
lemma closed_halfspace_component_le: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5081 |
shows "closed {x::real^'n. x$i \<le> a}" |
33175 | 5082 |
using closed_halfspace_le[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto |
5083 |
||
5084 |
lemma closed_halfspace_component_ge: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5085 |
shows "closed {x::real^'n. x$i \<ge> a}" |
33175 | 5086 |
using closed_halfspace_ge[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto |
5087 |
||
5088 |
text{* Openness of halfspaces. *} |
|
5089 |
||
5090 |
lemma open_halfspace_lt: "open {x. inner a x < b}" |
|
5091 |
proof- |
|
34105 | 5092 |
have "- {x. b \<le> inner a x} = {x. inner a x < b}" by auto |
5093 |
thus ?thesis using closed_halfspace_ge[unfolded closed_def, of b a] by auto |
|
33175 | 5094 |
qed |
5095 |
||
5096 |
lemma open_halfspace_gt: "open {x. inner a x > b}" |
|
5097 |
proof- |
|
34105 | 5098 |
have "- {x. b \<ge> inner a x} = {x. inner a x > b}" by auto |
5099 |
thus ?thesis using closed_halfspace_le[unfolded closed_def, of a b] by auto |
|
33175 | 5100 |
qed |
5101 |
||
5102 |
lemma open_halfspace_component_lt: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5103 |
shows "open {x::real^'n. x$i < a}" |
33175 | 5104 |
using open_halfspace_lt[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto |
5105 |
||
5106 |
lemma open_halfspace_component_gt: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5107 |
shows "open {x::real^'n. x$i > a}" |
33175 | 5108 |
using open_halfspace_gt[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto |
5109 |
||
5110 |
text{* This gives a simple derivation of limit component bounds. *} |
|
5111 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5112 |
lemma Lim_component_le: fixes f :: "'a \<Rightarrow> real^'n" |
33175 | 5113 |
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. f(x)$i \<le> b) net" |
5114 |
shows "l$i \<le> b" |
|
5115 |
proof- |
|
5116 |
{ 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 |
|
5117 |
show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<le> b}" f net l] unfolding * |
|
5118 |
using closed_halfspace_le[of "(basis i)::real^'n" b] and assms(1,2,3) by auto |
|
5119 |
qed |
|
5120 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5121 |
lemma Lim_component_ge: fixes f :: "'a \<Rightarrow> real^'n" |
33175 | 5122 |
assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. b \<le> (f x)$i) net" |
5123 |
shows "b \<le> l$i" |
|
5124 |
proof- |
|
5125 |
{ 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 |
|
5126 |
show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<ge> b}" f net l] unfolding * |
|
5127 |
using closed_halfspace_ge[of b "(basis i)::real^'n"] and assms(1,2,3) by auto |
|
5128 |
qed |
|
5129 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5130 |
lemma Lim_component_eq: fixes f :: "'a \<Rightarrow> real^'n" |
33175 | 5131 |
assumes net:"(f ---> l) net" "~(trivial_limit net)" and ev:"eventually (\<lambda>x. f(x)$i = b) net" |
5132 |
shows "l$i = b" |
|
5133 |
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 |
|
5134 |
||
5135 |
text{* Limits relative to a union. *} |
|
5136 |
||
5137 |
lemma eventually_within_Un: |
|
5138 |
"eventually P (net within (s \<union> t)) \<longleftrightarrow> |
|
5139 |
eventually P (net within s) \<and> eventually P (net within t)" |
|
5140 |
unfolding Limits.eventually_within |
|
5141 |
by (auto elim!: eventually_rev_mp) |
|
5142 |
||
5143 |
lemma Lim_within_union: |
|
5144 |
"(f ---> l) (net within (s \<union> t)) \<longleftrightarrow> |
|
5145 |
(f ---> l) (net within s) \<and> (f ---> l) (net within t)" |
|
5146 |
unfolding tendsto_def |
|
5147 |
by (auto simp add: eventually_within_Un) |
|
5148 |
||
36442 | 5149 |
lemma Lim_topological: |
5150 |
"(f ---> l) net \<longleftrightarrow> |
|
5151 |
trivial_limit net \<or> |
|
5152 |
(\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)" |
|
5153 |
unfolding tendsto_def trivial_limit_eq by auto |
|
5154 |
||
33175 | 5155 |
lemma continuous_on_union: |
5156 |
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t f" |
|
5157 |
shows "continuous_on (s \<union> t) f" |
|
36442 | 5158 |
using assms unfolding continuous_on Lim_within_union |
5159 |
unfolding Lim_topological trivial_limit_within closed_limpt by auto |
|
33175 | 5160 |
|
5161 |
lemma continuous_on_cases: |
|
5162 |
assumes "closed s" "closed t" "continuous_on s f" "continuous_on t g" |
|
5163 |
"\<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x" |
|
5164 |
shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" |
|
5165 |
proof- |
|
5166 |
let ?h = "(\<lambda>x. if P x then f x else g x)" |
|
5167 |
have "\<forall>x\<in>s. f x = (if P x then f x else g x)" using assms(5) by auto |
|
5168 |
hence "continuous_on s ?h" using continuous_on_eq[of s f ?h] using assms(3) by auto |
|
5169 |
moreover |
|
5170 |
have "\<forall>x\<in>t. g x = (if P x then f x else g x)" using assms(5) by auto |
|
5171 |
hence "continuous_on t ?h" using continuous_on_eq[of t g ?h] using assms(4) by auto |
|
5172 |
ultimately show ?thesis using continuous_on_union[OF assms(1,2), of ?h] by auto |
|
5173 |
qed |
|
5174 |
||
5175 |
||
5176 |
text{* Some more convenient intermediate-value theorem formulations. *} |
|
5177 |
||
5178 |
lemma connected_ivt_hyperplane: |
|
5179 |
assumes "connected s" "x \<in> s" "y \<in> s" "inner a x \<le> b" "b \<le> inner a y" |
|
5180 |
shows "\<exists>z \<in> s. inner a z = b" |
|
5181 |
proof(rule ccontr) |
|
5182 |
assume as:"\<not> (\<exists>z\<in>s. inner a z = b)" |
|
5183 |
let ?A = "{x. inner a x < b}" |
|
5184 |
let ?B = "{x. inner a x > b}" |
|
5185 |
have "open ?A" "open ?B" using open_halfspace_lt and open_halfspace_gt by auto |
|
5186 |
moreover have "?A \<inter> ?B = {}" by auto |
|
5187 |
moreover have "s \<subseteq> ?A \<union> ?B" using as by auto |
|
5188 |
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 |
|
5189 |
qed |
|
5190 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5191 |
lemma connected_ivt_component: fixes x::"real^'n" shows |
33175 | 5192 |
"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)" |
5193 |
using connected_ivt_hyperplane[of s x y "(basis k)::real^'n" a] by (auto simp add: inner_basis) |
|
5194 |
||
36437 | 5195 |
subsection {* Homeomorphisms *} |
33175 | 5196 |
|
5197 |
definition "homeomorphism s t f g \<equiv> |
|
5198 |
(\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and> |
|
5199 |
(\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g" |
|
5200 |
||
5201 |
definition |
|
5202 |
homeomorphic :: "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> bool" |
|
5203 |
(infixr "homeomorphic" 60) where |
|
5204 |
homeomorphic_def: "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)" |
|
5205 |
||
5206 |
lemma homeomorphic_refl: "s homeomorphic s" |
|
5207 |
unfolding homeomorphic_def |
|
5208 |
unfolding homeomorphism_def |
|
5209 |
using continuous_on_id |
|
5210 |
apply(rule_tac x = "(\<lambda>x. x)" in exI) |
|
5211 |
apply(rule_tac x = "(\<lambda>x. x)" in exI) |
|
5212 |
by blast |
|
5213 |
||
5214 |
lemma homeomorphic_sym: |
|
5215 |
"s homeomorphic t \<longleftrightarrow> t homeomorphic s" |
|
5216 |
unfolding homeomorphic_def |
|
5217 |
unfolding homeomorphism_def |
|
33324 | 5218 |
by blast |
33175 | 5219 |
|
5220 |
lemma homeomorphic_trans: |
|
5221 |
assumes "s homeomorphic t" "t homeomorphic u" shows "s homeomorphic u" |
|
5222 |
proof- |
|
5223 |
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" |
|
5224 |
using assms(1) unfolding homeomorphic_def homeomorphism_def by auto |
|
5225 |
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" |
|
5226 |
using assms(2) unfolding homeomorphic_def homeomorphism_def by auto |
|
5227 |
||
5228 |
{ 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 } |
|
5229 |
moreover have "(f2 \<circ> f1) ` s = u" using fg1(2) fg2(2) by auto |
|
5230 |
moreover have "continuous_on s (f2 \<circ> f1)" using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto |
|
5231 |
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 } |
|
5232 |
moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto |
|
5233 |
moreover have "continuous_on u (g1 \<circ> g2)" using continuous_on_compose[OF fg2(6)] and fg1(6) unfolding fg2(5) by auto |
|
5234 |
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 |
|
5235 |
qed |
|
5236 |
||
5237 |
lemma homeomorphic_minimal: |
|
5238 |
"s homeomorphic t \<longleftrightarrow> |
|
5239 |
(\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and> |
|
5240 |
(\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and> |
|
5241 |
continuous_on s f \<and> continuous_on t g)" |
|
5242 |
unfolding homeomorphic_def homeomorphism_def |
|
5243 |
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) |
|
5244 |
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) apply auto |
|
5245 |
unfolding image_iff |
|
5246 |
apply(erule_tac x="g x" in ballE) apply(erule_tac x="x" in ballE) |
|
5247 |
apply auto apply(rule_tac x="g x" in bexI) apply auto |
|
5248 |
apply(erule_tac x="f x" in ballE) apply(erule_tac x="x" in ballE) |
|
5249 |
apply auto apply(rule_tac x="f x" in bexI) by auto |
|
5250 |
||
36437 | 5251 |
text {* Relatively weak hypotheses if a set is compact. *} |
33175 | 5252 |
|
5253 |
lemma homeomorphism_compact: |
|
5254 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel" |
|
5255 |
(* class constraint due to continuous_on_inverse *) |
|
5256 |
assumes "compact s" "continuous_on s f" "f ` s = t" "inj_on f s" |
|
5257 |
shows "\<exists>g. homeomorphism s t f g" |
|
5258 |
proof- |
|
5259 |
def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x" |
|
5260 |
have g:"\<forall>x\<in>s. g (f x) = x" using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto |
|
5261 |
{ fix y assume "y\<in>t" |
|
5262 |
then obtain x where x:"f x = y" "x\<in>s" using assms(3) by auto |
|
5263 |
hence "g (f x) = x" using g by auto |
|
5264 |
hence "f (g y) = y" unfolding x(1)[THEN sym] by auto } |
|
5265 |
hence g':"\<forall>x\<in>t. f (g x) = x" by auto |
|
5266 |
moreover |
|
5267 |
{ fix x |
|
5268 |
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"]) |
|
5269 |
moreover |
|
5270 |
{ assume "x\<in>g ` t" |
|
5271 |
then obtain y where y:"y\<in>t" "g y = x" by auto |
|
5272 |
then obtain x' where x':"x'\<in>s" "f x' = y" using assms(3) by auto |
|
5273 |
hence "x \<in> s" unfolding g_def using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"] unfolding y(2)[THEN sym] and g_def by auto } |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5274 |
ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" .. } |
33175 | 5275 |
hence "g ` t = s" by auto |
5276 |
ultimately |
|
5277 |
show ?thesis unfolding homeomorphism_def homeomorphic_def |
|
5278 |
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 |
|
5279 |
qed |
|
5280 |
||
5281 |
lemma homeomorphic_compact: |
|
5282 |
fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel" |
|
5283 |
(* class constraint due to continuous_on_inverse *) |
|
5284 |
shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s |
|
5285 |
\<Longrightarrow> s homeomorphic t" |
|
5286 |
unfolding homeomorphic_def by(metis homeomorphism_compact) |
|
5287 |
||
5288 |
text{* Preservation of topological properties. *} |
|
5289 |
||
5290 |
lemma homeomorphic_compactness: |
|
5291 |
"s homeomorphic t ==> (compact s \<longleftrightarrow> compact t)" |
|
5292 |
unfolding homeomorphic_def homeomorphism_def |
|
5293 |
by (metis compact_continuous_image) |
|
5294 |
||
5295 |
text{* Results on translation, scaling etc. *} |
|
5296 |
||
5297 |
lemma homeomorphic_scaling: |
|
5298 |
fixes s :: "'a::real_normed_vector set" |
|
5299 |
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)" |
|
5300 |
unfolding homeomorphic_minimal |
|
5301 |
apply(rule_tac x="\<lambda>x. c *\<^sub>R x" in exI) |
|
5302 |
apply(rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI) |
|
5303 |
using assms apply auto |
|
5304 |
using continuous_on_cmul[OF continuous_on_id] by auto |
|
5305 |
||
5306 |
lemma homeomorphic_translation: |
|
5307 |
fixes s :: "'a::real_normed_vector set" |
|
5308 |
shows "s homeomorphic ((\<lambda>x. a + x) ` s)" |
|
5309 |
unfolding homeomorphic_minimal |
|
5310 |
apply(rule_tac x="\<lambda>x. a + x" in exI) |
|
5311 |
apply(rule_tac x="\<lambda>x. -a + x" in exI) |
|
5312 |
using continuous_on_add[OF continuous_on_const continuous_on_id] by auto |
|
5313 |
||
5314 |
lemma homeomorphic_affinity: |
|
5315 |
fixes s :: "'a::real_normed_vector set" |
|
5316 |
assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)" |
|
5317 |
proof- |
|
5318 |
have *:"op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto |
|
5319 |
show ?thesis |
|
5320 |
using homeomorphic_trans |
|
5321 |
using homeomorphic_scaling[OF assms, of s] |
|
5322 |
using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] unfolding * by auto |
|
5323 |
qed |
|
5324 |
||
5325 |
lemma homeomorphic_balls: |
|
5326 |
fixes a b ::"'a::real_normed_vector" (* FIXME: generalize to metric_space *) |
|
5327 |
assumes "0 < d" "0 < e" |
|
5328 |
shows "(ball a d) homeomorphic (ball b e)" (is ?th) |
|
5329 |
"(cball a d) homeomorphic (cball b e)" (is ?cth) |
|
5330 |
proof- |
|
5331 |
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto |
|
5332 |
show ?th unfolding homeomorphic_minimal |
|
5333 |
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) |
|
5334 |
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) |
|
5335 |
using assms apply (auto simp add: dist_commute) |
|
5336 |
unfolding dist_norm |
|
5337 |
apply (auto simp add: pos_divide_less_eq mult_strict_left_mono) |
|
5338 |
unfolding continuous_on |
|
5339 |
by (intro ballI tendsto_intros, simp, assumption)+ |
|
5340 |
next |
|
5341 |
have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto |
|
5342 |
show ?cth unfolding homeomorphic_minimal |
|
5343 |
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) |
|
5344 |
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) |
|
5345 |
using assms apply (auto simp add: dist_commute) |
|
5346 |
unfolding dist_norm |
|
5347 |
apply (auto simp add: pos_divide_le_eq) |
|
5348 |
unfolding continuous_on |
|
5349 |
by (intro ballI tendsto_intros, simp, assumption)+ |
|
5350 |
qed |
|
5351 |
||
5352 |
text{* "Isometry" (up to constant bounds) of injective linear map etc. *} |
|
5353 |
||
5354 |
lemma cauchy_isometric: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5355 |
fixes x :: "nat \<Rightarrow> real ^ 'n" |
33175 | 5356 |
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)" |
5357 |
shows "Cauchy x" |
|
5358 |
proof- |
|
5359 |
interpret f: bounded_linear f by fact |
|
5360 |
{ fix d::real assume "d>0" |
|
5361 |
then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d" |
|
5362 |
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 |
|
5363 |
{ fix n assume "n\<ge>N" |
|
5364 |
hence "norm (f (x n - x N)) < e * d" using N[THEN spec[where x=n]] unfolding f.diff[THEN sym] by auto |
|
5365 |
moreover have "e * norm (x n - x N) \<le> norm (f (x n - x N))" |
|
5366 |
using subspace_sub[OF s, of "x n" "x N"] using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]] |
|
5367 |
using normf[THEN bspec[where x="x n - x N"]] by auto |
|
5368 |
ultimately have "norm (x n - x N) < d" using `e>0` |
|
5369 |
using mult_left_less_imp_less[of e "norm (x n - x N)" d] by auto } |
|
5370 |
hence "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto } |
|
5371 |
thus ?thesis unfolding cauchy and dist_norm by auto |
|
5372 |
qed |
|
5373 |
||
5374 |
lemma complete_isometric_image: |
|
5375 |
fixes f :: "real ^ _ \<Rightarrow> real ^ _" |
|
5376 |
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" |
|
5377 |
shows "complete(f ` s)" |
|
5378 |
proof- |
|
5379 |
{ fix g assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g" |
|
33324 | 5380 |
then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)" |
33175 | 5381 |
using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto |
5382 |
hence x:"\<forall>n. x n \<in> s" "\<forall>n. g n = f (x n)" by auto |
|
5383 |
hence "f \<circ> x = g" unfolding expand_fun_eq by auto |
|
5384 |
then obtain l where "l\<in>s" and l:"(x ---> l) sequentially" |
|
5385 |
using cs[unfolded complete_def, THEN spec[where x="x"]] |
|
5386 |
using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto |
|
5387 |
hence "\<exists>l\<in>f ` s. (g ---> l) sequentially" |
|
5388 |
using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l] |
|
5389 |
unfolding `f \<circ> x = g` by auto } |
|
5390 |
thus ?thesis unfolding complete_def by auto |
|
5391 |
qed |
|
5392 |
||
5393 |
lemma dist_0_norm: |
|
5394 |
fixes x :: "'a::real_normed_vector" |
|
5395 |
shows "dist 0 x = norm x" |
|
5396 |
unfolding dist_norm by simp |
|
5397 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5398 |
lemma injective_imp_isometric: fixes f::"real^'m \<Rightarrow> real^'n" |
33175 | 5399 |
assumes s:"closed s" "subspace s" and f:"bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)" |
5400 |
shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)" |
|
5401 |
proof(cases "s \<subseteq> {0::real^'m}") |
|
5402 |
case True |
|
5403 |
{ fix x assume "x \<in> s" |
|
5404 |
hence "x = 0" using True by auto |
|
5405 |
hence "norm x \<le> norm (f x)" by auto } |
|
5406 |
thus ?thesis by(auto intro!: exI[where x=1]) |
|
5407 |
next |
|
5408 |
interpret f: bounded_linear f by fact |
|
5409 |
case False |
|
5410 |
then obtain a where a:"a\<noteq>0" "a\<in>s" by auto |
|
5411 |
from False have "s \<noteq> {}" by auto |
|
5412 |
let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}" |
|
5413 |
let ?S' = "{x::real^'m. x\<in>s \<and> norm x = norm a}" |
|
5414 |
let ?S'' = "{x::real^'m. norm x = norm a}" |
|
5415 |
||
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5416 |
have "?S'' = frontier(cball 0 (norm a))" unfolding frontier_cball and dist_norm by auto |
33175 | 5417 |
hence "compact ?S''" using compact_frontier[OF compact_cball, of 0 "norm a"] by auto |
5418 |
moreover have "?S' = s \<inter> ?S''" by auto |
|
5419 |
ultimately have "compact ?S'" using closed_inter_compact[of s ?S''] using s(1) by auto |
|
5420 |
moreover have *:"f ` ?S' = ?S" by auto |
|
5421 |
ultimately have "compact ?S" using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto |
|
5422 |
hence "closed ?S" using compact_imp_closed by auto |
|
5423 |
moreover have "?S \<noteq> {}" using a by auto |
|
5424 |
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 |
|
5425 |
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 |
|
5426 |
||
5427 |
let ?e = "norm (f b) / norm b" |
|
5428 |
have "norm b > 0" using ba and a and norm_ge_zero by auto |
|
5429 |
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 |
|
5430 |
ultimately have "0 < norm (f b) / norm b" by(simp only: divide_pos_pos) |
|
5431 |
moreover |
|
5432 |
{ fix x assume "x\<in>s" |
|
5433 |
hence "norm (f b) / norm b * norm x \<le> norm (f x)" |
|
5434 |
proof(cases "x=0") |
|
5435 |
case True thus "norm (f b) / norm b * norm x \<le> norm (f x)" by auto |
|
5436 |
next |
|
5437 |
case False |
|
5438 |
hence *:"0 < norm a / norm x" using `a\<noteq>0` unfolding zero_less_norm_iff[THEN sym] by(simp only: divide_pos_pos) |
|
5439 |
have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" using s[unfolded subspace_def smult_conv_scaleR] by auto |
|
5440 |
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 |
|
5441 |
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"]] |
|
5442 |
unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0` |
|
5443 |
by (auto simp add: real_mult_commute pos_le_divide_eq pos_divide_le_eq) |
|
5444 |
qed } |
|
5445 |
ultimately |
|
5446 |
show ?thesis by auto |
|
5447 |
qed |
|
5448 |
||
5449 |
lemma closed_injective_image_subspace: |
|
5450 |
fixes f :: "real ^ _ \<Rightarrow> real ^ _" |
|
5451 |
assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 --> x = 0" "closed s" |
|
5452 |
shows "closed(f ` s)" |
|
5453 |
proof- |
|
5454 |
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 |
|
5455 |
show ?thesis using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4) |
|
5456 |
unfolding complete_eq_closed[THEN sym] by auto |
|
5457 |
qed |
|
5458 |
||
5459 |
subsection{* Some properties of a canonical subspace. *} |
|
5460 |
||
5461 |
lemma subspace_substandard: |
|
34289 | 5462 |
"subspace {x::real^_. (\<forall>i. P i \<longrightarrow> x$i = 0)}" |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5463 |
unfolding subspace_def by auto |
33175 | 5464 |
|
5465 |
lemma closed_substandard: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5466 |
"closed {x::real^'n. \<forall>i. P i --> x$i = 0}" (is "closed ?A") |
33175 | 5467 |
proof- |
5468 |
let ?D = "{i. P i}" |
|
5469 |
let ?Bs = "{{x::real^'n. inner (basis i) x = 0}| i. i \<in> ?D}" |
|
5470 |
{ fix x |
|
5471 |
{ assume "x\<in>?A" |
|
5472 |
hence x:"\<forall>i\<in>?D. x $ i = 0" by auto |
|
5473 |
hence "x\<in> \<Inter> ?Bs" by(auto simp add: inner_basis x) } |
|
5474 |
moreover |
|
5475 |
{ assume x:"x\<in>\<Inter>?Bs" |
|
5476 |
{ fix i assume i:"i \<in> ?D" |
|
5477 |
then obtain B where BB:"B \<in> ?Bs" and B:"B = {x::real^'n. inner (basis i) x = 0}" by auto |
|
5478 |
hence "x $ i = 0" unfolding B using x unfolding inner_basis by auto } |
|
5479 |
hence "x\<in>?A" by auto } |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5480 |
ultimately have "x\<in>?A \<longleftrightarrow> x\<in> \<Inter>?Bs" .. } |
33175 | 5481 |
hence "?A = \<Inter> ?Bs" by auto |
5482 |
thus ?thesis by(auto simp add: closed_Inter closed_hyperplane) |
|
5483 |
qed |
|
5484 |
||
5485 |
lemma dim_substandard: |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5486 |
shows "dim {x::real^'n. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0} = card d" (is "dim ?A = _") |
33175 | 5487 |
proof- |
5488 |
let ?D = "UNIV::'n set" |
|
5489 |
let ?B = "(basis::'n\<Rightarrow>real^'n) ` d" |
|
5490 |
||
5491 |
let ?bas = "basis::'n \<Rightarrow> real^'n" |
|
5492 |
||
5493 |
have "?B \<subseteq> ?A" by auto |
|
5494 |
||
5495 |
moreover |
|
5496 |
{ fix x::"real^'n" assume "x\<in>?A" |
|
5497 |
with finite[of d] |
|
5498 |
have "x\<in> span ?B" |
|
5499 |
proof(induct d arbitrary: x) |
|
5500 |
case empty hence "x=0" unfolding Cart_eq by auto |
|
5501 |
thus ?case using subspace_0[OF subspace_span[of "{}"]] by auto |
|
5502 |
next |
|
5503 |
case (insert k F) |
|
5504 |
hence *:"\<forall>i. i \<notin> insert k F \<longrightarrow> x $ i = 0" by auto |
|
5505 |
have **:"F \<subseteq> insert k F" by auto |
|
5506 |
def y \<equiv> "x - x$k *\<^sub>R basis k" |
|
5507 |
have y:"x = y + (x$k) *\<^sub>R basis k" unfolding y_def by auto |
|
5508 |
{ fix i assume i':"i \<notin> F" |
|
5509 |
hence "y $ i = 0" unfolding y_def unfolding vector_minus_component |
|
5510 |
and vector_smult_component and basis_component |
|
5511 |
using *[THEN spec[where x=i]] by auto } |
|
5512 |
hence "y \<in> span (basis ` (insert k F))" using insert(3) |
|
5513 |
using span_mono[of "?bas ` F" "?bas ` (insert k F)"] |
|
5514 |
using image_mono[OF **, of basis] by auto |
|
5515 |
moreover |
|
5516 |
have "basis k \<in> span (?bas ` (insert k F))" by(rule span_superset, auto) |
|
5517 |
hence "x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))" |
|
36593
fb69c8cd27bd
define linear algebra concepts using scaleR instead of (op *s); generalized many lemmas, though a few theorems that used to work on type int^'n are a bit less general
huffman
parents:
36590
diff
changeset
|
5518 |
using span_mul by auto |
33175 | 5519 |
ultimately |
5520 |
have "y + x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))" |
|
5521 |
using span_add by auto |
|
5522 |
thus ?case using y by auto |
|
5523 |
qed |
|
5524 |
} |
|
5525 |
hence "?A \<subseteq> span ?B" by auto |
|
5526 |
||
5527 |
moreover |
|
5528 |
{ fix x assume "x \<in> ?B" |
|
5529 |
hence "x\<in>{(basis i)::real^'n |i. i \<in> ?D}" using assms by auto } |
|
5530 |
hence "independent ?B" using independent_mono[OF independent_stdbasis, of ?B] and assms by auto |
|
5531 |
||
5532 |
moreover |
|
5533 |
have "d \<subseteq> ?D" unfolding subset_eq using assms by auto |
|
5534 |
hence *:"inj_on (basis::'n\<Rightarrow>real^'n) d" using subset_inj_on[OF basis_inj, of "d"] by auto |
|
33715 | 5535 |
have "card ?B = card d" unfolding card_image[OF *] by auto |
33175 | 5536 |
|
5537 |
ultimately show ?thesis using dim_unique[of "basis ` d" ?A] by auto |
|
5538 |
qed |
|
5539 |
||
5540 |
text{* Hence closure and completeness of all subspaces. *} |
|
5541 |
||
5542 |
lemma closed_subspace_lemma: "n \<le> card (UNIV::'n::finite set) \<Longrightarrow> \<exists>A::'n set. card A = n" |
|
5543 |
apply (induct n) |
|
5544 |
apply (rule_tac x="{}" in exI, simp) |
|
5545 |
apply clarsimp |
|
5546 |
apply (subgoal_tac "\<exists>x. x \<notin> A") |
|
5547 |
apply (erule exE) |
|
5548 |
apply (rule_tac x="insert x A" in exI, simp) |
|
5549 |
apply (subgoal_tac "A \<noteq> UNIV", auto) |
|
5550 |
done |
|
5551 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5552 |
lemma closed_subspace: fixes s::"(real^'n) set" |
33175 | 5553 |
assumes "subspace s" shows "closed s" |
5554 |
proof- |
|
5555 |
have "dim s \<le> card (UNIV :: 'n set)" using dim_subset_univ by auto |
|
5556 |
then obtain d::"'n set" where t: "card d = dim s" |
|
5557 |
using closed_subspace_lemma by auto |
|
5558 |
let ?t = "{x::real^'n. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0}" |
|
5559 |
obtain f where f:"bounded_linear f" "f ` ?t = s" "inj_on f ?t" |
|
5560 |
using subspace_isomorphism[unfolded linear_conv_bounded_linear, OF subspace_substandard[of "\<lambda>i. i \<notin> d"] assms] |
|
5561 |
using dim_substandard[of d] and t by auto |
|
5562 |
interpret f: bounded_linear f by fact |
|
5563 |
have "\<forall>x\<in>?t. f x = 0 \<longrightarrow> x = 0" using f.zero using f(3)[unfolded inj_on_def] |
|
5564 |
by(erule_tac x=0 in ballE) auto |
|
5565 |
moreover have "closed ?t" using closed_substandard . |
|
5566 |
moreover have "subspace ?t" using subspace_substandard . |
|
5567 |
ultimately show ?thesis using closed_injective_image_subspace[of ?t f] |
|
5568 |
unfolding f(2) using f(1) by auto |
|
5569 |
qed |
|
5570 |
||
5571 |
lemma complete_subspace: |
|
5572 |
fixes s :: "(real ^ _) set" shows "subspace s ==> complete s" |
|
5573 |
using complete_eq_closed closed_subspace |
|
5574 |
by auto |
|
5575 |
||
5576 |
lemma dim_closure: |
|
5577 |
fixes s :: "(real ^ _) set" |
|
5578 |
shows "dim(closure s) = dim s" (is "?dc = ?d") |
|
5579 |
proof- |
|
5580 |
have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s] |
|
5581 |
using closed_subspace[OF subspace_span, of s] |
|
5582 |
using dim_subset[of "closure s" "span s"] unfolding dim_span by auto |
|
5583 |
thus ?thesis using dim_subset[OF closure_subset, of s] by auto |
|
5584 |
qed |
|
5585 |
||
36437 | 5586 |
subsection {* Affine transformations of intervals *} |
33175 | 5587 |
|
5588 |
lemma affinity_inverses: |
|
5589 |
assumes m0: "m \<noteq> (0::'a::field)" |
|
5590 |
shows "(\<lambda>x. m *s x + c) o (\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) = id" |
|
5591 |
"(\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) o (\<lambda>x. m *s x + c) = id" |
|
5592 |
using m0 |
|
5593 |
apply (auto simp add: expand_fun_eq vector_add_ldistrib vector_smult_assoc) |
|
5594 |
by (simp add: vector_smult_lneg[symmetric] vector_smult_assoc vector_sneg_minus1[symmetric]) |
|
5595 |
||
5596 |
lemma real_affinity_le: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5597 |
"0 < (m::'a::linordered_field) ==> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))" |
33175 | 5598 |
by (simp add: field_simps inverse_eq_divide) |
5599 |
||
5600 |
lemma real_le_affinity: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5601 |
"0 < (m::'a::linordered_field) ==> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)" |
33175 | 5602 |
by (simp add: field_simps inverse_eq_divide) |
5603 |
||
5604 |
lemma real_affinity_lt: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5605 |
"0 < (m::'a::linordered_field) ==> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))" |
33175 | 5606 |
by (simp add: field_simps inverse_eq_divide) |
5607 |
||
5608 |
lemma real_lt_affinity: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5609 |
"0 < (m::'a::linordered_field) ==> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)" |
33175 | 5610 |
by (simp add: field_simps inverse_eq_divide) |
5611 |
||
5612 |
lemma real_affinity_eq: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5613 |
"(m::'a::linordered_field) \<noteq> 0 ==> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))" |
33175 | 5614 |
by (simp add: field_simps inverse_eq_divide) |
5615 |
||
5616 |
lemma real_eq_affinity: |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34999
diff
changeset
|
5617 |
"(m::'a::linordered_field) \<noteq> 0 ==> (y = m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) = x)" |
33175 | 5618 |
by (simp add: field_simps inverse_eq_divide) |
5619 |
||
5620 |
lemma vector_affinity_eq: |
|
5621 |
assumes m0: "(m::'a::field) \<noteq> 0" |
|
5622 |
shows "m *s x + c = y \<longleftrightarrow> x = inverse m *s y + -(inverse m *s c)" |
|
5623 |
proof |
|
5624 |
assume h: "m *s x + c = y" |
|
36350 | 5625 |
hence "m *s x = y - c" by (simp add: field_simps) |
33175 | 5626 |
hence "inverse m *s (m *s x) = inverse m *s (y - c)" by simp |
5627 |
then show "x = inverse m *s y + - (inverse m *s c)" |
|
5628 |
using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib) |
|
5629 |
next |
|
5630 |
assume h: "x = inverse m *s y + - (inverse m *s c)" |
|
5631 |
show "m *s x + c = y" unfolding h diff_minus[symmetric] |
|
5632 |
using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib) |
|
5633 |
qed |
|
5634 |
||
5635 |
lemma vector_eq_affinity: |
|
5636 |
"(m::'a::field) \<noteq> 0 ==> (y = m *s x + c \<longleftrightarrow> inverse(m) *s y + -(inverse(m) *s c) = x)" |
|
5637 |
using vector_affinity_eq[where m=m and x=x and y=y and c=c] |
|
5638 |
by metis |
|
5639 |
||
5640 |
lemma image_affinity_interval: fixes m::real |
|
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5641 |
fixes a b c :: "real^'n" |
33175 | 5642 |
shows "(\<lambda>x. m *\<^sub>R x + c) ` {a .. b} = |
5643 |
(if {a .. b} = {} then {} |
|
5644 |
else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c} |
|
5645 |
else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))" |
|
5646 |
proof(cases "m=0") |
|
5647 |
{ fix x assume "x \<le> c" "c \<le> x" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
5648 |
hence "x=c" unfolding vector_le_def and Cart_eq by (auto intro: order_antisym) } |
33175 | 5649 |
moreover case True |
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
5650 |
moreover have "c \<in> {m *\<^sub>R a + c..m *\<^sub>R b + c}" unfolding True by(auto simp add: vector_le_def) |
33175 | 5651 |
ultimately show ?thesis by auto |
5652 |
next |
|
5653 |
case False |
|
5654 |
{ fix y assume "a \<le> y" "y \<le> b" "m > 0" |
|
5655 |
hence "m *\<^sub>R a + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R b + c" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5656 |
unfolding vector_le_def by auto |
33175 | 5657 |
} moreover |
5658 |
{ fix y assume "a \<le> y" "y \<le> b" "m < 0" |
|
5659 |
hence "m *\<^sub>R b + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R a + c" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5660 |
unfolding vector_le_def by(auto simp add: mult_left_mono_neg) |
33175 | 5661 |
} moreover |
5662 |
{ fix y assume "m > 0" "m *\<^sub>R a + c \<le> y" "y \<le> m *\<^sub>R b + c" |
|
5663 |
hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
5664 |
unfolding image_iff Bex_def mem_interval vector_le_def |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5665 |
apply(auto simp add: vector_smult_assoc pth_3[symmetric] |
33175 | 5666 |
intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"]) |
5667 |
by(auto simp add: pos_le_divide_eq pos_divide_le_eq real_mult_commute diff_le_iff) |
|
5668 |
} moreover |
|
5669 |
{ fix y assume "m *\<^sub>R b + c \<le> y" "y \<le> m *\<^sub>R a + c" "m < 0" |
|
5670 |
hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}" |
|
33758
53078b0d21f5
Renamed vector_less_eq_def to the more usual name vector_le_def.
hoelzl
parents:
33715
diff
changeset
|
5671 |
unfolding image_iff Bex_def mem_interval vector_le_def |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36360
diff
changeset
|
5672 |
apply(auto simp add: vector_smult_assoc pth_3[symmetric] |
33175 | 5673 |
intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"]) |
5674 |
by(auto simp add: neg_le_divide_eq neg_divide_le_eq real_mult_commute diff_le_iff) |
|
5675 |
} |
|
5676 |
ultimately show ?thesis using False by auto |
|
5677 |
qed |
|
5678 |
||
34291
4e896680897e
finite annotation on cartesian product is now implicit.
hoelzl
parents:
34289
diff
changeset
|
5679 |
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::real^'n)) ` {a..b} = |
33175 | 5680 |
(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})" |
5681 |
using image_affinity_interval[of m 0 a b] by auto |
|
5682 |
||
5683 |
subsection{* Banach fixed point theorem (not really topological...) *} |
|
5684 |
||
5685 |
lemma banach_fix: |
|
5686 |
assumes s:"complete s" "s \<noteq> {}" and c:"0 \<le> c" "c < 1" and f:"(f ` s) \<subseteq> s" and |
|
5687 |
lipschitz:"\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y" |
|
5688 |
shows "\<exists>! x\<in>s. (f x = x)" |
|
5689 |
proof- |
|
5690 |
have "1 - c > 0" using c by auto |
|
5691 |
||
5692 |
from s(2) obtain z0 where "z0 \<in> s" by auto |
|
5693 |
def z \<equiv> "\<lambda>n. (f ^^ n) z0" |
|
5694 |
{ fix n::nat |
|
5695 |
have "z n \<in> s" unfolding z_def |
|
5696 |
proof(induct n) case 0 thus ?case using `z0 \<in>s` by auto |
|
5697 |
next case Suc thus ?case using f by auto qed } |
|
5698 |
note z_in_s = this |
|
5699 |
||
5700 |
def d \<equiv> "dist (z 0) (z 1)" |
|
5701 |
||
5702 |
have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto |
|
5703 |
{ fix n::nat |
|
5704 |
have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d" |
|
5705 |
proof(induct n) |
|
5706 |
case 0 thus ?case unfolding d_def by auto |
|
5707 |
next |
|
5708 |
case (Suc m) |
|
5709 |
hence "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d" |
|
5710 |
using `0 \<le> c` using mult_mono1_class.mult_mono1[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by auto |
|
5711 |
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] |
|
5712 |
unfolding fzn and mult_le_cancel_left by auto |
|
5713 |
qed |
|
5714 |
} note cf_z = this |
|
5715 |
||
5716 |
{ fix n m::nat |
|
5717 |
have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)" |
|
5718 |
proof(induct n) |
|
5719 |
case 0 show ?case by auto |
|
5720 |
next |
|
5721 |
case (Suc k) |
|
5722 |
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))))" |
|
5723 |
using dist_triangle and c by(auto simp add: dist_triangle) |
|
5724 |
also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)" |
|
5725 |
using cf_z[of "m + k"] and c by auto |
|
5726 |
also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d" |
|
36350 | 5727 |
using Suc by (auto simp add: field_simps) |
33175 | 5728 |
also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)" |
36350 | 5729 |
unfolding power_add by (auto simp add: field_simps) |
33175 | 5730 |
also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)" |
36350 | 5731 |
using c by (auto simp add: field_simps) |
33175 | 5732 |
finally show ?case by auto |
5733 |
qed |
|
5734 |
} note cf_z2 = this |
|
5735 |
{ fix e::real assume "e>0" |
|
5736 |
hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e" |
|
5737 |
proof(cases "d = 0") |
|
5738 |
case True |
|
5739 |
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`]) |
|
5740 |
thus ?thesis using `e>0` by auto |
|
5741 |
next |
|
5742 |
case False hence "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"] |
|
5743 |
by (metis False d_def real_less_def) |
|
5744 |
hence "0 < e * (1 - c) / d" using `e>0` and `1-c>0` |
|
5745 |
using divide_pos_pos[of "e * (1 - c)" d] and mult_pos_pos[of e "1 - c"] by auto |
|
5746 |
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 |
|
5747 |
{ fix m n::nat assume "m>n" and as:"m\<ge>N" "n\<ge>N" |
|
5748 |
have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c using power_decreasing[OF `n\<ge>N`, of c] by auto |
|
5749 |
have "1 - c ^ (m - n) > 0" using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto |
|
5750 |
hence **:"d * (1 - c ^ (m - n)) / (1 - c) > 0" |
|
5751 |
using real_mult_order[OF `d>0`, of "1 - c ^ (m - n)"] |
|
5752 |
using divide_pos_pos[of "d * (1 - c ^ (m - n))" "1 - c"] |
|
5753 |
using `0 < 1 - c` by auto |
|
5754 |
||
5755 |
have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)" |
|
5756 |
using cf_z2[of n "m - n"] and `m>n` unfolding pos_le_divide_eq[OF `1-c>0`] |
|
5757 |
by (auto simp add: real_mult_commute dist_commute) |
|
5758 |
also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)" |
|
5759 |
using mult_right_mono[OF * order_less_imp_le[OF **]] |
|
5760 |
unfolding real_mult_assoc by auto |
|
5761 |
also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)" |
|
5762 |
using mult_strict_right_mono[OF N **] unfolding real_mult_assoc by auto |
|
5763 |
also have "\<dots> = e * (1 - c ^ (m - n))" using c and `d>0` and `1 - c > 0` by auto |
|
5764 |
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 |
|
5765 |
finally have "dist (z m) (z n) < e" by auto |
|
5766 |
} note * = this |
|
5767 |
{ fix m n::nat assume as:"N\<le>m" "N\<le>n" |
|
5768 |
hence "dist (z n) (z m) < e" |
|
5769 |
proof(cases "n = m") |
|
5770 |
case True thus ?thesis using `e>0` by auto |
|
5771 |
next |
|
5772 |
case False thus ?thesis using as and *[of n m] *[of m n] unfolding nat_neq_iff by (auto simp add: dist_commute) |
|
5773 |
qed } |
|
5774 |
thus ?thesis by auto |
|
5775 |
qed |
|
5776 |
} |
|
5777 |
hence "Cauchy z" unfolding cauchy_def by auto |
|
5778 |
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 |
|
5779 |
||
5780 |
def e \<equiv> "dist (f x) x" |
|
5781 |
have "e = 0" proof(rule ccontr) |
|
5782 |
assume "e \<noteq> 0" hence "e>0" unfolding e_def using zero_le_dist[of "f x" x] |
|
5783 |
by (metis dist_eq_0_iff dist_nz e_def) |
|
5784 |
then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2" |
|
5785 |
using x[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto |
|
5786 |
hence N':"dist (z N) x < e / 2" by auto |
|
5787 |
||
5788 |
have *:"c * dist (z N) x \<le> dist (z N) x" unfolding mult_le_cancel_right2 |
|
5789 |
using zero_le_dist[of "z N" x] and c |
|
5790 |
by (metis dist_eq_0_iff dist_nz order_less_asym real_less_def) |
|
5791 |
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]] |
|
5792 |
using z_in_s[of N] `x\<in>s` using c by auto |
|
5793 |
also have "\<dots> < e / 2" using N' and c using * by auto |
|
5794 |
finally show False unfolding fzn |
|
5795 |
using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x] |
|
5796 |
unfolding e_def by auto |
|
5797 |
qed |
|
5798 |
hence "f x = x" unfolding e_def by auto |
|
5799 |
moreover |
|
5800 |
{ fix y assume "f y = y" "y\<in>s" |
|
5801 |
hence "dist x y \<le> c * dist x y" using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]] |
|
5802 |
using `x\<in>s` and `f x = x` by auto |
|
5803 |
hence "dist x y = 0" unfolding mult_le_cancel_right1 |
|
5804 |
using c and zero_le_dist[of x y] by auto |
|
5805 |
hence "y = x" by auto |
|
5806 |
} |
|
34999
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
hoelzl
parents:
34964
diff
changeset
|
5807 |
ultimately show ?thesis using `x\<in>s` by blast+ |
33175 | 5808 |
qed |
5809 |
||
5810 |
subsection{* Edelstein fixed point theorem. *} |
|
5811 |
||
5812 |
lemma edelstein_fix: |
|
5813 |
fixes s :: "'a::real_normed_vector set" |
|
5814 |
assumes s:"compact s" "s \<noteq> {}" and gs:"(g ` s) \<subseteq> s" |
|
5815 |
and dist:"\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y" |
|
5816 |
shows "\<exists>! x\<in>s. g x = x" |
|
5817 |
proof(cases "\<exists>x\<in>s. g x \<noteq> x") |
|
5818 |
obtain x where "x\<in>s" using s(2) by auto |
|
5819 |
case False hence g:"\<forall>x\<in>s. g x = x" by auto |
|
5820 |
{ fix y assume "y\<in>s" |
|
5821 |
hence "x = y" using `x\<in>s` and dist[THEN bspec[where x=x], THEN bspec[where x=y]] |
|
5822 |
unfolding g[THEN bspec[where x=x], OF `x\<in>s`] |
|
5823 |
unfolding g[THEN bspec[where x=y], OF `y\<in>s`] by auto } |
|
34999
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
hoelzl
parents:
34964
diff
changeset
|
5824 |
thus ?thesis using `x\<in>s` and g by blast+ |
33175 | 5825 |
next |
5826 |
case True |
|
5827 |
then obtain x where [simp]:"x\<in>s" and "g x \<noteq> x" by auto |
|
5828 |
{ fix x y assume "x \<in> s" "y \<in> s" |
|
5829 |
hence "dist (g x) (g y) \<le> dist x y" |
|
5830 |
using dist[THEN bspec[where x=x], THEN bspec[where x=y]] by auto } note dist' = this |
|
5831 |
def y \<equiv> "g x" |
|
5832 |
have [simp]:"y\<in>s" unfolding y_def using gs[unfolded image_subset_iff] and `x\<in>s` by blast |
|
5833 |
def f \<equiv> "\<lambda>n. g ^^ n" |
|
5834 |
have [simp]:"\<And>n z. g (f n z) = f (Suc n) z" unfolding f_def by auto |
|
5835 |
have [simp]:"\<And>z. f 0 z = z" unfolding f_def by auto |
|
5836 |
{ fix n::nat and z assume "z\<in>s" |
|
5837 |
have "f n z \<in> s" unfolding f_def |
|
5838 |
proof(induct n) |
|
5839 |
case 0 thus ?case using `z\<in>s` by simp |
|
5840 |
next |
|
5841 |
case (Suc n) thus ?case using gs[unfolded image_subset_iff] by auto |
|
5842 |
qed } note fs = this |
|
5843 |
{ fix m n ::nat assume "m\<le>n" |
|
5844 |
fix w z assume "w\<in>s" "z\<in>s" |
|
5845 |
have "dist (f n w) (f n z) \<le> dist (f m w) (f m z)" using `m\<le>n` |
|
5846 |
proof(induct n) |
|
5847 |
case 0 thus ?case by auto |
|
5848 |
next |
|
5849 |
case (Suc n) |
|
5850 |
thus ?case proof(cases "m\<le>n") |
|
5851 |
case True thus ?thesis using Suc(1) |
|
5852 |
using dist'[OF fs fs, OF `w\<in>s` `z\<in>s`, of n n] by auto |
|
5853 |
next |
|
5854 |
case False hence mn:"m = Suc n" using Suc(2) by simp |
|
5855 |
show ?thesis unfolding mn by auto |
|
5856 |
qed |
|
5857 |
qed } note distf = this |
|
5858 |
||
5859 |
def h \<equiv> "\<lambda>n. (f n x, f n y)" |
|
5860 |
let ?s2 = "s \<times> s" |
|
5861 |
obtain l r where "l\<in>?s2" and r:"subseq r" and lr:"((h \<circ> r) ---> l) sequentially" |
|
5862 |
using compact_Times [OF s(1) s(1), unfolded compact_def, THEN spec[where x=h]] unfolding h_def |
|
5863 |
using fs[OF `x\<in>s`] and fs[OF `y\<in>s`] by blast |
|
5864 |
def a \<equiv> "fst l" def b \<equiv> "snd l" |
|
5865 |
have lab:"l = (a, b)" unfolding a_def b_def by simp |
|
5866 |
have [simp]:"a\<in>s" "b\<in>s" unfolding a_def b_def using `l\<in>?s2` by auto |
|
5867 |
||
5868 |
have lima:"((fst \<circ> (h \<circ> r)) ---> a) sequentially" |
|
5869 |
and limb:"((snd \<circ> (h \<circ> r)) ---> b) sequentially" |
|
5870 |
using lr |
|
5871 |
unfolding o_def a_def b_def by (simp_all add: tendsto_intros) |
|
5872 |
||
5873 |
{ fix n::nat |
|
5874 |
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 |
|
5875 |
{ fix x y :: 'a |
|
5876 |
have "dist (-x) (-y) = dist x y" unfolding dist_norm |
|
5877 |
using norm_minus_cancel[of "x - y"] by (auto simp add: uminus_add_conv_diff) } note ** = this |
|
5878 |
||
5879 |
{ assume as:"dist a b > dist (f n x) (f n y)" |
|
5880 |
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" |
|
5881 |
and "\<forall>m\<ge>Nb. dist (f (r m) y) b < (dist a b - dist (f n x) (f n y)) / 2" |
|
5882 |
using lima limb unfolding h_def Lim_sequentially by (fastsimp simp del: less_divide_eq_number_of1) |
|
5883 |
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)" |
|
5884 |
apply(erule_tac x="Na+Nb+n" in allE) |
|
5885 |
apply(erule_tac x="Na+Nb+n" in allE) apply simp |
|
5886 |
using dist_triangle_add_half[of a "f (r (Na + Nb + n)) x" "dist a b - dist (f n x) (f n y)" |
|
5887 |
"-b" "- f (r (Na + Nb + n)) y"] |
|
36350 | 5888 |
unfolding ** by (auto simp add: algebra_simps dist_commute) |
33175 | 5889 |
moreover |
5890 |
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)" |
|
5891 |
using distf[of n "r (Na+Nb+n)", OF _ `x\<in>s` `y\<in>s`] |
|
5892 |
using subseq_bigger[OF r, of "Na+Nb+n"] |
|
5893 |
using *[of "f (r (Na + Nb + n)) x" "f (r (Na + Nb + n)) y" "f n x" "f n y"] by auto |
|
5894 |
ultimately have False by simp |
|
5895 |
} |
|
5896 |
hence "dist a b \<le> dist (f n x) (f n y)" by(rule ccontr)auto } |
|
5897 |
note ab_fn = this |
|
5898 |
||
5899 |
have [simp]:"a = b" proof(rule ccontr) |
|
5900 |
def e \<equiv> "dist a b - dist (g a) (g b)" |
|
5901 |
assume "a\<noteq>b" hence "e > 0" unfolding e_def using dist by fastsimp |
|
5902 |
hence "\<exists>n. dist (f n x) a < e/2 \<and> dist (f n y) b < e/2" |
|
5903 |
using lima limb unfolding Lim_sequentially |
|
5904 |
apply (auto elim!: allE[where x="e/2"]) apply(rule_tac x="r (max N Na)" in exI) unfolding h_def by fastsimp |
|
5905 |
then obtain n where n:"dist (f n x) a < e/2 \<and> dist (f n y) b < e/2" by auto |
|
5906 |
have "dist (f (Suc n) x) (g a) \<le> dist (f n x) a" |
|
5907 |
using dist[THEN bspec[where x="f n x"], THEN bspec[where x="a"]] and fs by auto |
|
5908 |
moreover have "dist (f (Suc n) y) (g b) \<le> dist (f n y) b" |
|
5909 |
using dist[THEN bspec[where x="f n y"], THEN bspec[where x="b"]] and fs by auto |
|
5910 |
ultimately have "dist (f (Suc n) x) (g a) + dist (f (Suc n) y) (g b) < e" using n by auto |
|
5911 |
thus False unfolding e_def using ab_fn[of "Suc n"] by norm |
|
5912 |
qed |
|
5913 |
||
5914 |
have [simp]:"\<And>n. f (Suc n) x = f n y" unfolding f_def y_def by(induct_tac n)auto |
|
5915 |
{ fix x y assume "x\<in>s" "y\<in>s" moreover |
|
5916 |
fix e::real assume "e>0" ultimately |
|
5917 |
have "dist y x < e \<longrightarrow> dist (g y) (g x) < e" using dist by fastsimp } |
|
36359 | 5918 |
hence "continuous_on s g" unfolding continuous_on_iff by auto |
33175 | 5919 |
|
5920 |
hence "((snd \<circ> h \<circ> r) ---> g a) sequentially" unfolding continuous_on_sequentially |
|
5921 |
apply (rule allE[where x="\<lambda>n. (fst \<circ> h \<circ> r) n"]) apply (erule ballE[where x=a]) |
|
5922 |
using lima unfolding h_def o_def using fs[OF `x\<in>s`] by (auto simp add: y_def) |
|
5923 |
hence "g a = a" using Lim_unique[OF trivial_limit_sequentially limb, of "g a"] |
|
5924 |
unfolding `a=b` and o_assoc by auto |
|
5925 |
moreover |
|
5926 |
{ fix x assume "x\<in>s" "g x = x" "x\<noteq>a" |
|
5927 |
hence "False" using dist[THEN bspec[where x=a], THEN bspec[where x=x]] |
|
5928 |
using `g a = a` and `a\<in>s` by auto } |
|
34999
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
hoelzl
parents:
34964
diff
changeset
|
5929 |
ultimately show "\<exists>!x\<in>s. g x = x" using `a\<in>s` by blast |
33175 | 5930 |
qed |
5931 |
||
5932 |
end |