437 fixes X :: "nat \<Rightarrow> 'a :: {complete_linorder,linorder_topology}" |
437 fixes X :: "nat \<Rightarrow> 'a :: {complete_linorder,linorder_topology}" |
438 shows "convergent X \<longleftrightarrow> limsup X = liminf X" |
438 shows "convergent X \<longleftrightarrow> limsup X = liminf X" |
439 using tendsto_iff_Liminf_eq_Limsup[of sequentially] |
439 using tendsto_iff_Liminf_eq_Limsup[of sequentially] |
440 by (auto simp: convergent_def) |
440 by (auto simp: convergent_def) |
441 |
441 |
|
442 lemma limsup_le_liminf_real: |
|
443 fixes X :: "nat \<Rightarrow> real" and L :: real |
|
444 assumes 1: "limsup X \<le> L" and 2: "L \<le> liminf X" |
|
445 shows "X ----> L" |
|
446 proof - |
|
447 from 1 2 have "limsup X \<le> liminf X" by auto |
|
448 hence 3: "limsup X = liminf X" |
|
449 apply (subst eq_iff, rule conjI) |
|
450 by (rule Liminf_le_Limsup, auto) |
|
451 hence 4: "convergent (\<lambda>n. ereal (X n))" |
|
452 by (subst convergent_ereal) |
|
453 hence "limsup X = lim (\<lambda>n. ereal(X n))" |
|
454 by (rule convergent_limsup_cl) |
|
455 also from 1 2 3 have "limsup X = L" by auto |
|
456 finally have "lim (\<lambda>n. ereal(X n)) = L" .. |
|
457 hence "(\<lambda>n. ereal (X n)) ----> L" |
|
458 apply (elim subst) |
|
459 by (subst convergent_LIMSEQ_iff [symmetric], rule 4) |
|
460 thus ?thesis by simp |
|
461 qed |
|
462 |
442 lemma liminf_PInfty: |
463 lemma liminf_PInfty: |
443 fixes X :: "nat \<Rightarrow> ereal" |
464 fixes X :: "nat \<Rightarrow> ereal" |
444 shows "X ----> \<infinity> \<longleftrightarrow> liminf X = \<infinity>" |
465 shows "X ----> \<infinity> \<longleftrightarrow> liminf X = \<infinity>" |
445 by (metis Liminf_PInfty trivial_limit_sequentially) |
466 by (metis Liminf_PInfty trivial_limit_sequentially) |
446 |
467 |
570 } |
591 } |
571 then show ?thesis |
592 then show ?thesis |
572 unfolding continuous_at_open by blast |
593 unfolding continuous_at_open by blast |
573 qed |
594 qed |
574 |
595 |
|
596 lemma nhds_ereal: "nhds (ereal r) = filtermap ereal (nhds r)" |
|
597 by (simp add: filtermap_nhds_open_map open_ereal continuous_at_of_ereal) |
|
598 |
|
599 lemma at_ereal: "at (ereal r) = filtermap ereal (at r)" |
|
600 by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
601 |
|
602 lemma at_left_ereal: "at_left (ereal r) = filtermap ereal (at_left r)" |
|
603 by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
604 |
|
605 lemma at_right_ereal: "at_right (ereal r) = filtermap ereal (at_right r)" |
|
606 by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
607 |
|
608 lemma |
|
609 shows at_left_PInf: "at_left \<infinity> = filtermap ereal at_top" |
|
610 and at_right_MInf: "at_right (-\<infinity>) = filtermap ereal at_bot" |
|
611 unfolding filter_eq_iff eventually_filtermap eventually_at_top_dense eventually_at_bot_dense |
|
612 eventually_at_left[OF ereal_less(5)] eventually_at_right[OF ereal_less(6)] |
|
613 by (auto simp add: ereal_all_split ereal_ex_split) |
|
614 |
|
615 lemma ereal_tendsto_simps1: |
|
616 "((f \<circ> real) ---> y) (at_left (ereal x)) \<longleftrightarrow> (f ---> y) (at_left x)" |
|
617 "((f \<circ> real) ---> y) (at_right (ereal x)) \<longleftrightarrow> (f ---> y) (at_right x)" |
|
618 "((f \<circ> real) ---> y) (at_left (\<infinity>::ereal)) \<longleftrightarrow> (f ---> y) at_top" |
|
619 "((f \<circ> real) ---> y) (at_right (-\<infinity>::ereal)) \<longleftrightarrow> (f ---> y) at_bot" |
|
620 unfolding tendsto_compose_filtermap at_left_ereal at_right_ereal at_left_PInf at_right_MInf |
|
621 by (auto simp: filtermap_filtermap filtermap_ident) |
|
622 |
|
623 lemma ereal_tendsto_simps2: |
|
624 "((ereal \<circ> f) ---> ereal a) F \<longleftrightarrow> (f ---> a) F" |
|
625 "((ereal \<circ> f) ---> \<infinity>) F \<longleftrightarrow> (LIM x F. f x :> at_top)" |
|
626 "((ereal \<circ> f) ---> -\<infinity>) F \<longleftrightarrow> (LIM x F. f x :> at_bot)" |
|
627 unfolding tendsto_PInfty filterlim_at_top_dense tendsto_MInfty filterlim_at_bot_dense |
|
628 using lim_ereal by (simp_all add: comp_def) |
|
629 |
|
630 lemmas ereal_tendsto_simps = ereal_tendsto_simps1 ereal_tendsto_simps2 |
|
631 |
575 lemma continuous_at_iff_ereal: |
632 lemma continuous_at_iff_ereal: |
576 fixes f :: "'a::t2_space \<Rightarrow> real" |
633 fixes f :: "'a::t2_space \<Rightarrow> real" |
577 shows "continuous (at x0) f \<longleftrightarrow> continuous (at x0) (ereal \<circ> f)" |
634 shows "continuous (at x0 within s) f \<longleftrightarrow> continuous (at x0 within s) (ereal \<circ> f)" |
578 proof - |
635 unfolding continuous_within comp_def lim_ereal .. |
579 { |
|
580 assume "continuous (at x0) f" |
|
581 then have "continuous (at x0) (ereal \<circ> f)" |
|
582 using continuous_at_ereal continuous_at_compose[of x0 f ereal] |
|
583 by auto |
|
584 } |
|
585 moreover |
|
586 { |
|
587 assume "continuous (at x0) (ereal \<circ> f)" |
|
588 then have "continuous (at x0) (real \<circ> (ereal \<circ> f))" |
|
589 using continuous_at_of_ereal |
|
590 by (intro continuous_at_compose[of x0 "ereal \<circ> f"]) auto |
|
591 moreover have "real \<circ> (ereal \<circ> f) = f" |
|
592 using real_ereal_id by (simp add: o_assoc) |
|
593 ultimately have "continuous (at x0) f" |
|
594 by auto |
|
595 } |
|
596 ultimately show ?thesis |
|
597 by auto |
|
598 qed |
|
599 |
|
600 |
636 |
601 lemma continuous_on_iff_ereal: |
637 lemma continuous_on_iff_ereal: |
602 fixes f :: "'a::t2_space => real" |
638 fixes f :: "'a::t2_space => real" |
603 assumes "open A" |
639 assumes "open A" |
604 shows "continuous_on A f \<longleftrightarrow> continuous_on A (ereal \<circ> f)" |
640 shows "continuous_on A f \<longleftrightarrow> continuous_on A (ereal \<circ> f)" |
605 using continuous_at_iff_ereal assms |
641 unfolding continuous_on_def comp_def lim_ereal .. |
606 by (auto simp add: continuous_on_eq_continuous_at cong del: continuous_on_cong) |
|
607 |
642 |
608 lemma continuous_on_real: "continuous_on (UNIV - {\<infinity>, -\<infinity>::ereal}) real" |
643 lemma continuous_on_real: "continuous_on (UNIV - {\<infinity>, -\<infinity>::ereal}) real" |
609 using continuous_at_of_ereal continuous_on_eq_continuous_at open_image_ereal |
644 using continuous_at_of_ereal continuous_on_eq_continuous_at open_image_ereal |
610 by auto |
645 by auto |
611 |
646 |
612 lemma continuous_on_iff_real: |
647 lemma continuous_on_iff_real: |
613 fixes f :: "'a::t2_space \<Rightarrow> ereal" |
648 fixes f :: "'a::t2_space \<Rightarrow> ereal" |
614 assumes "\<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>" |
649 assumes *: "\<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>" |
615 shows "continuous_on A f \<longleftrightarrow> continuous_on A (real \<circ> f)" |
650 shows "continuous_on A f \<longleftrightarrow> continuous_on A (real \<circ> f)" |
616 proof - |
651 proof - |
617 have "f ` A \<subseteq> UNIV - {\<infinity>, -\<infinity>}" |
652 have "f ` A \<subseteq> UNIV - {\<infinity>, -\<infinity>}" |
618 using assms by force |
653 using assms by force |
619 then have *: "continuous_on (f ` A) real" |
654 then have *: "continuous_on (f ` A) real" |