8 imports RealVector |
8 imports RealVector |
9 begin |
9 begin |
10 |
10 |
11 definition at_infinity :: "'a::real_normed_vector filter" where |
11 definition at_infinity :: "'a::real_normed_vector filter" where |
12 "at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)" |
12 "at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)" |
13 |
|
14 |
|
15 lemma eventually_nhds_metric: |
|
16 "eventually P (nhds a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> P x)" |
|
17 unfolding eventually_nhds open_dist |
|
18 apply safe |
|
19 apply fast |
|
20 apply (rule_tac x="{x. dist x a < d}" in exI, simp) |
|
21 apply clarsimp |
|
22 apply (rule_tac x="d - dist x a" in exI, clarsimp) |
|
23 apply (simp only: less_diff_eq) |
|
24 apply (erule le_less_trans [OF dist_triangle]) |
|
25 done |
|
26 |
|
27 lemma eventually_at: |
|
28 fixes a :: "'a::metric_space" |
|
29 shows "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> P x)" |
|
30 unfolding at_def eventually_within eventually_nhds_metric by auto |
|
31 lemma eventually_within_less: (* COPY FROM Topo/eventually_within *) |
|
32 "eventually P (at a within S) \<longleftrightarrow> (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)" |
|
33 unfolding eventually_within eventually_at dist_nz by auto |
|
34 |
|
35 lemma eventually_within_le: (* COPY FROM Topo/eventually_within_le *) |
|
36 "eventually P (at a within S) \<longleftrightarrow> (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" |
|
37 unfolding eventually_within_less by auto (metis dense order_le_less_trans) |
|
38 |
13 |
39 lemma eventually_at_infinity: |
14 lemma eventually_at_infinity: |
40 "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> P x)" |
15 "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> P x)" |
41 unfolding at_infinity_def |
16 unfolding at_infinity_def |
42 proof (rule eventually_Abs_filter, rule is_filter.intro) |
17 proof (rule eventually_Abs_filter, rule is_filter.intro) |
244 lemmas Zfun_mult_left = bounded_bilinear.Zfun_left [OF bounded_bilinear_mult] |
219 lemmas Zfun_mult_left = bounded_bilinear.Zfun_left [OF bounded_bilinear_mult] |
245 |
220 |
246 lemma tendsto_Zfun_iff: "(f ---> a) F = Zfun (\<lambda>x. f x - a) F" |
221 lemma tendsto_Zfun_iff: "(f ---> a) F = Zfun (\<lambda>x. f x - a) F" |
247 by (simp only: tendsto_iff Zfun_def dist_norm) |
222 by (simp only: tendsto_iff Zfun_def dist_norm) |
248 |
223 |
249 |
|
250 lemma metric_tendsto_imp_tendsto: |
|
251 assumes f: "(f ---> a) F" |
|
252 assumes le: "eventually (\<lambda>x. dist (g x) b \<le> dist (f x) a) F" |
|
253 shows "(g ---> b) F" |
|
254 proof (rule tendstoI) |
|
255 fix e :: real assume "0 < e" |
|
256 with f have "eventually (\<lambda>x. dist (f x) a < e) F" by (rule tendstoD) |
|
257 with le show "eventually (\<lambda>x. dist (g x) b < e) F" |
|
258 using le_less_trans by (rule eventually_elim2) |
|
259 qed |
|
260 subsubsection {* Distance and norms *} |
224 subsubsection {* Distance and norms *} |
261 |
|
262 lemma tendsto_dist [tendsto_intros]: |
|
263 assumes f: "(f ---> l) F" and g: "(g ---> m) F" |
|
264 shows "((\<lambda>x. dist (f x) (g x)) ---> dist l m) F" |
|
265 proof (rule tendstoI) |
|
266 fix e :: real assume "0 < e" |
|
267 hence e2: "0 < e/2" by simp |
|
268 from tendstoD [OF f e2] tendstoD [OF g e2] |
|
269 show "eventually (\<lambda>x. dist (dist (f x) (g x)) (dist l m) < e) F" |
|
270 proof (eventually_elim) |
|
271 case (elim x) |
|
272 then show "dist (dist (f x) (g x)) (dist l m) < e" |
|
273 unfolding dist_real_def |
|
274 using dist_triangle2 [of "f x" "g x" "l"] |
|
275 using dist_triangle2 [of "g x" "l" "m"] |
|
276 using dist_triangle3 [of "l" "m" "f x"] |
|
277 using dist_triangle [of "f x" "m" "g x"] |
|
278 by arith |
|
279 qed |
|
280 qed |
|
281 |
225 |
282 lemma norm_conv_dist: "norm x = dist x 0" |
226 lemma norm_conv_dist: "norm x = dist x 0" |
283 unfolding dist_norm by simp |
227 unfolding dist_norm by simp |
284 |
228 |
285 lemma tendsto_norm [tendsto_intros]: |
229 lemma tendsto_norm [tendsto_intros]: |
542 lemma tendsto_sgn [tendsto_intros]: |
486 lemma tendsto_sgn [tendsto_intros]: |
543 fixes l :: "'a::real_normed_vector" |
487 fixes l :: "'a::real_normed_vector" |
544 shows "\<lbrakk>(f ---> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. sgn (f x)) ---> sgn l) F" |
488 shows "\<lbrakk>(f ---> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. sgn (f x)) ---> sgn l) F" |
545 unfolding sgn_div_norm by (simp add: tendsto_intros) |
489 unfolding sgn_div_norm by (simp add: tendsto_intros) |
546 |
490 |
547 lemma filterlim_at_bot_at_right: |
|
548 fixes f :: "real \<Rightarrow> 'b::linorder" |
|
549 assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" |
|
550 assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" |
|
551 assumes Q: "eventually Q (at_right a)" and bound: "\<And>b. Q b \<Longrightarrow> a < b" |
|
552 assumes P: "eventually P at_bot" |
|
553 shows "filterlim f at_bot (at_right a)" |
|
554 proof - |
|
555 from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y" |
|
556 unfolding eventually_at_bot_linorder by auto |
|
557 show ?thesis |
|
558 proof (intro filterlim_at_bot_le[THEN iffD2] allI impI) |
|
559 fix z assume "z \<le> x" |
|
560 with x have "P z" by auto |
|
561 have "eventually (\<lambda>x. x \<le> g z) (at_right a)" |
|
562 using bound[OF bij(2)[OF `P z`]] |
|
563 by (auto simp add: eventually_within_less dist_real_def intro!: exI[of _ "g z - a"]) |
|
564 with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)" |
|
565 by eventually_elim (metis bij `P z` mono) |
|
566 qed |
|
567 qed |
|
568 |
|
569 lemma filterlim_at_top_at_left: |
|
570 fixes f :: "real \<Rightarrow> 'b::linorder" |
|
571 assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" |
|
572 assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" |
|
573 assumes Q: "eventually Q (at_left a)" and bound: "\<And>b. Q b \<Longrightarrow> b < a" |
|
574 assumes P: "eventually P at_top" |
|
575 shows "filterlim f at_top (at_left a)" |
|
576 proof - |
|
577 from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y" |
|
578 unfolding eventually_at_top_linorder by auto |
|
579 show ?thesis |
|
580 proof (intro filterlim_at_top_ge[THEN iffD2] allI impI) |
|
581 fix z assume "x \<le> z" |
|
582 with x have "P z" by auto |
|
583 have "eventually (\<lambda>x. g z \<le> x) (at_left a)" |
|
584 using bound[OF bij(2)[OF `P z`]] |
|
585 by (auto simp add: eventually_within_less dist_real_def intro!: exI[of _ "a - g z"]) |
|
586 with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)" |
|
587 by eventually_elim (metis bij `P z` mono) |
|
588 qed |
|
589 qed |
|
590 |
|
591 lemma filterlim_at_infinity: |
491 lemma filterlim_at_infinity: |
592 fixes f :: "_ \<Rightarrow> 'a\<Colon>real_normed_vector" |
492 fixes f :: "_ \<Rightarrow> 'a\<Colon>real_normed_vector" |
593 assumes "0 \<le> c" |
493 assumes "0 \<le> c" |
594 shows "(LIM x F. f x :> at_infinity) \<longleftrightarrow> (\<forall>r>c. eventually (\<lambda>x. r \<le> norm (f x)) F)" |
494 shows "(LIM x F. f x :> at_infinity) \<longleftrightarrow> (\<forall>r>c. eventually (\<lambda>x. r \<le> norm (f x)) F)" |
595 unfolding filterlim_iff eventually_at_infinity |
495 unfolding filterlim_iff eventually_at_infinity |
604 proof eventually_elim |
504 proof eventually_elim |
605 fix x assume "max b (c + 1) \<le> norm (f x)" |
505 fix x assume "max b (c + 1) \<le> norm (f x)" |
606 with P show "P (f x)" by auto |
506 with P show "P (f x)" by auto |
607 qed |
507 qed |
608 qed force |
508 qed force |
609 |
|
610 lemma filterlim_real_sequentially: "LIM x sequentially. real x :> at_top" |
|
611 unfolding filterlim_at_top |
|
612 apply (intro allI) |
|
613 apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI) |
|
614 apply (auto simp: natceiling_le_eq) |
|
615 done |
|
616 |
509 |
617 subsection {* Relate @{const at}, @{const at_left} and @{const at_right} *} |
510 subsection {* Relate @{const at}, @{const at_left} and @{const at_right} *} |
618 |
511 |
619 text {* |
512 text {* |
620 |
513 |