283 subsection {* Order filters *} |
283 subsection {* Order filters *} |
284 |
284 |
285 definition at_top :: "('a::order) filter" |
285 definition at_top :: "('a::order) filter" |
286 where "at_top = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)" |
286 where "at_top = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)" |
287 |
287 |
288 lemma eventually_at_top_linorder: |
288 lemma eventually_at_top_linorder: "eventually P at_top \<longleftrightarrow> (\<exists>N::'a::linorder. \<forall>n\<ge>N. P n)" |
289 fixes P :: "'a::linorder \<Rightarrow> bool" shows "eventually P at_top \<longleftrightarrow> (\<exists>N. \<forall>n\<ge>N. P n)" |
|
290 unfolding at_top_def |
289 unfolding at_top_def |
291 proof (rule eventually_Abs_filter, rule is_filter.intro) |
290 proof (rule eventually_Abs_filter, rule is_filter.intro) |
292 fix P Q :: "'a \<Rightarrow> bool" |
291 fix P Q :: "'a \<Rightarrow> bool" |
293 assume "\<exists>i. \<forall>n\<ge>i. P n" and "\<exists>j. \<forall>n\<ge>j. Q n" |
292 assume "\<exists>i. \<forall>n\<ge>i. P n" and "\<exists>j. \<forall>n\<ge>j. Q n" |
294 then obtain i j where "\<forall>n\<ge>i. P n" and "\<forall>n\<ge>j. Q n" by auto |
293 then obtain i j where "\<forall>n\<ge>i. P n" and "\<forall>n\<ge>j. Q n" by auto |
295 then have "\<forall>n\<ge>max i j. P n \<and> Q n" by simp |
294 then have "\<forall>n\<ge>max i j. P n \<and> Q n" by simp |
296 then show "\<exists>k. \<forall>n\<ge>k. P n \<and> Q n" .. |
295 then show "\<exists>k. \<forall>n\<ge>k. P n \<and> Q n" .. |
297 qed auto |
296 qed auto |
298 |
297 |
299 lemma eventually_at_top_dense: |
298 lemma eventually_at_top_dense: "eventually P at_top \<longleftrightarrow> (\<exists>N::'a::dense_linorder. \<forall>n>N. P n)" |
300 fixes P :: "'a::dense_linorder \<Rightarrow> bool" shows "eventually P at_top \<longleftrightarrow> (\<exists>N. \<forall>n>N. P n)" |
|
301 unfolding eventually_at_top_linorder |
299 unfolding eventually_at_top_linorder |
302 proof safe |
300 proof safe |
303 fix N assume "\<forall>n\<ge>N. P n" then show "\<exists>N. \<forall>n>N. P n" by (auto intro!: exI[of _ N]) |
301 fix N assume "\<forall>n\<ge>N. P n" then show "\<exists>N. \<forall>n>N. P n" by (auto intro!: exI[of _ N]) |
304 next |
302 next |
305 fix N assume "\<forall>n>N. P n" |
303 fix N assume "\<forall>n>N. P n" |
306 moreover from gt_ex[of N] guess y .. |
304 moreover from gt_ex[of N] guess y .. |
307 ultimately show "\<exists>N. \<forall>n\<ge>N. P n" by (auto intro!: exI[of _ y]) |
305 ultimately show "\<exists>N. \<forall>n\<ge>N. P n" by (auto intro!: exI[of _ y]) |
308 qed |
306 qed |
309 |
307 |
310 definition at_bot :: "('a::order) filter" |
308 definition at_bot :: "('a::order) filter" |
373 where "nhds a = Abs_filter (\<lambda>P. \<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))" |
371 where "nhds a = Abs_filter (\<lambda>P. \<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))" |
374 |
372 |
375 definition (in topological_space) at :: "'a \<Rightarrow> 'a filter" |
373 definition (in topological_space) at :: "'a \<Rightarrow> 'a filter" |
376 where "at a = nhds a within - {a}" |
374 where "at a = nhds a within - {a}" |
377 |
375 |
|
376 definition at_infinity :: "'a::real_normed_vector filter" where |
|
377 "at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)" |
|
378 |
378 lemma eventually_within: |
379 lemma eventually_within: |
379 "eventually P (F within S) = eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) F" |
380 "eventually P (F within S) = eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) F" |
380 unfolding within_def |
381 unfolding within_def |
381 by (rule eventually_Abs_filter, rule is_filter.intro) |
382 by (rule eventually_Abs_filter, rule is_filter.intro) |
382 (auto elim!: eventually_rev_mp) |
383 (auto elim!: eventually_rev_mp) |
399 lemma eventually_nhds: |
400 lemma eventually_nhds: |
400 "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))" |
401 "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))" |
401 unfolding nhds_def |
402 unfolding nhds_def |
402 proof (rule eventually_Abs_filter, rule is_filter.intro) |
403 proof (rule eventually_Abs_filter, rule is_filter.intro) |
403 have "open UNIV \<and> a \<in> UNIV \<and> (\<forall>x\<in>UNIV. True)" by simp |
404 have "open UNIV \<and> a \<in> UNIV \<and> (\<forall>x\<in>UNIV. True)" by simp |
404 thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. True)" by - rule |
405 thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. True)" .. |
405 next |
406 next |
406 fix P Q |
407 fix P Q |
407 assume "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)" |
408 assume "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)" |
408 and "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)" |
409 and "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)" |
409 then obtain S T where |
410 then obtain S T where |
410 "open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)" |
411 "open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)" |
411 "open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)" by auto |
412 "open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)" by auto |
412 hence "open (S \<inter> T) \<and> a \<in> S \<inter> T \<and> (\<forall>x\<in>(S \<inter> T). P x \<and> Q x)" |
413 hence "open (S \<inter> T) \<and> a \<in> S \<inter> T \<and> (\<forall>x\<in>(S \<inter> T). P x \<and> Q x)" |
413 by (simp add: open_Int) |
414 by (simp add: open_Int) |
414 thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x \<and> Q x)" by - rule |
415 thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x \<and> Q x)" .. |
415 qed auto |
416 qed auto |
416 |
417 |
417 lemma eventually_nhds_metric: |
418 lemma eventually_nhds_metric: |
418 "eventually P (nhds a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> P x)" |
419 "eventually P (nhds a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> P x)" |
419 unfolding eventually_nhds open_dist |
420 unfolding eventually_nhds open_dist |
443 by (safe, case_tac "S = {a}", simp, fast, fast) |
444 by (safe, case_tac "S = {a}", simp, fast, fast) |
444 |
445 |
445 lemma at_neq_bot [simp]: "at (a::'a::perfect_space) \<noteq> bot" |
446 lemma at_neq_bot [simp]: "at (a::'a::perfect_space) \<noteq> bot" |
446 by (simp add: at_eq_bot_iff not_open_singleton) |
447 by (simp add: at_eq_bot_iff not_open_singleton) |
447 |
448 |
|
449 lemma eventually_at_infinity: |
|
450 "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)" |
|
451 unfolding at_infinity_def |
|
452 proof (rule eventually_Abs_filter, rule is_filter.intro) |
|
453 fix P Q :: "'a \<Rightarrow> bool" |
|
454 assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x" |
|
455 then obtain r s where |
|
456 "\<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<forall>x. s \<le> norm x \<longrightarrow> Q x" by auto |
|
457 then have "\<forall>x. max r s \<le> norm x \<longrightarrow> P x \<and> Q x" by simp |
|
458 then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x \<and> Q x" .. |
|
459 qed auto |
448 |
460 |
449 subsection {* Boundedness *} |
461 subsection {* Boundedness *} |
450 |
462 |
451 definition Bfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool" |
463 definition Bfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool" |
452 where "Bfun f F = (\<exists>K>0. eventually (\<lambda>x. norm (f x) \<le> K) F)" |
464 where "Bfun f F = (\<exists>K>0. eventually (\<lambda>x. norm (f x) \<le> K) F)" |
1162 by (blast intro: minus_less_iff[THEN iffD1]) |
1174 by (blast intro: minus_less_iff[THEN iffD1]) |
1163 |
1175 |
1164 lemma filterlim_uminus_at_bot: "LIM x F. f x :> at_top \<Longrightarrow> LIM x F. - (f x) :: real :> at_bot" |
1176 lemma filterlim_uminus_at_bot: "LIM x F. f x :> at_top \<Longrightarrow> LIM x F. - (f x) :: real :> at_bot" |
1165 by (rule filterlim_compose[OF filterlim_uminus_at_bot_at_top]) |
1177 by (rule filterlim_compose[OF filterlim_uminus_at_bot_at_top]) |
1166 |
1178 |
|
1179 text {* |
|
1180 |
|
1181 We only show rules for multiplication and addition when the functions are either against a real |
|
1182 value or against infinity. Further rules are easy to derive by using @{thm filterlim_uminus_at_top}. |
|
1183 |
|
1184 *} |
|
1185 |
|
1186 lemma filterlim_tendsto_pos_mult_at_top: |
|
1187 assumes f: "(f ---> c) F" and c: "0 < c" |
|
1188 assumes g: "LIM x F. g x :> at_top" |
|
1189 shows "LIM x F. (f x * g x :: real) :> at_top" |
|
1190 unfolding filterlim_at_top_gt[where c=0] |
|
1191 proof safe |
|
1192 fix Z :: real assume "0 < Z" |
|
1193 from f `0 < c` have "eventually (\<lambda>x. c / 2 < f x) F" |
|
1194 by (auto dest!: tendstoD[where e="c / 2"] elim!: eventually_elim1 |
|
1195 simp: dist_real_def abs_real_def split: split_if_asm) |
|
1196 moreover from g have "eventually (\<lambda>x. (Z / c * 2) < g x) F" |
|
1197 unfolding filterlim_at_top by auto |
|
1198 ultimately show "eventually (\<lambda>x. Z < f x * g x) F" |
|
1199 proof eventually_elim |
|
1200 fix x assume "c / 2 < f x" "Z / c * 2 < g x" |
|
1201 with `0 < Z` `0 < c` have "c / 2 * (Z / c * 2) < f x * g x" |
|
1202 by (intro mult_strict_mono) (auto simp: zero_le_divide_iff) |
|
1203 with `0 < c` show "Z < f x * g x" |
|
1204 by simp |
|
1205 qed |
|
1206 qed |
|
1207 |
|
1208 lemma filterlim_at_top_mult_at_top: |
|
1209 assumes f: "LIM x F. f x :> at_top" |
|
1210 assumes g: "LIM x F. g x :> at_top" |
|
1211 shows "LIM x F. (f x * g x :: real) :> at_top" |
|
1212 unfolding filterlim_at_top_gt[where c=0] |
|
1213 proof safe |
|
1214 fix Z :: real assume "0 < Z" |
|
1215 from f have "eventually (\<lambda>x. 1 < f x) F" |
|
1216 unfolding filterlim_at_top by auto |
|
1217 moreover from g have "eventually (\<lambda>x. Z < g x) F" |
|
1218 unfolding filterlim_at_top by auto |
|
1219 ultimately show "eventually (\<lambda>x. Z < f x * g x) F" |
|
1220 proof eventually_elim |
|
1221 fix x assume "1 < f x" "Z < g x" |
|
1222 with `0 < Z` have "1 * Z < f x * g x" |
|
1223 by (intro mult_strict_mono) (auto simp: zero_le_divide_iff) |
|
1224 then show "Z < f x * g x" |
|
1225 by simp |
|
1226 qed |
|
1227 qed |
|
1228 |
|
1229 lemma filterlim_tendsto_add_at_top: |
|
1230 assumes f: "(f ---> c) F" |
|
1231 assumes g: "LIM x F. g x :> at_top" |
|
1232 shows "LIM x F. (f x + g x :: real) :> at_top" |
|
1233 unfolding filterlim_at_top_gt[where c=0] |
|
1234 proof safe |
|
1235 fix Z :: real assume "0 < Z" |
|
1236 from f have "eventually (\<lambda>x. c - 1 < f x) F" |
|
1237 by (auto dest!: tendstoD[where e=1] elim!: eventually_elim1 simp: dist_real_def) |
|
1238 moreover from g have "eventually (\<lambda>x. Z - (c - 1) < g x) F" |
|
1239 unfolding filterlim_at_top by auto |
|
1240 ultimately show "eventually (\<lambda>x. Z < f x + g x) F" |
|
1241 by eventually_elim simp |
|
1242 qed |
|
1243 |
|
1244 lemma filterlim_at_top_add_at_top: |
|
1245 assumes f: "LIM x F. f x :> at_top" |
|
1246 assumes g: "LIM x F. g x :> at_top" |
|
1247 shows "LIM x F. (f x + g x :: real) :> at_top" |
|
1248 unfolding filterlim_at_top_gt[where c=0] |
|
1249 proof safe |
|
1250 fix Z :: real assume "0 < Z" |
|
1251 from f have "eventually (\<lambda>x. 0 < f x) F" |
|
1252 unfolding filterlim_at_top by auto |
|
1253 moreover from g have "eventually (\<lambda>x. Z < g x) F" |
|
1254 unfolding filterlim_at_top by auto |
|
1255 ultimately show "eventually (\<lambda>x. Z < f x + g x) F" |
|
1256 by eventually_elim simp |
|
1257 qed |
|
1258 |
1167 end |
1259 end |
|
1260 |