src/HOL/Library/Extended_Real.thy
changeset 68532 f8b98d31ad45
parent 68484 59793df7f853
child 68752 f221bc388ad0
equal deleted inserted replaced
68528:d31e986fbebc 68532:f8b98d31ad45
  2919   unfolding tendsto_def eventually_sequentially by auto
  2919   unfolding tendsto_def eventually_sequentially by auto
  2920 
  2920 
  2921 lemma Lim_bounded_PInfty2: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>N. f n \<le> ereal B \<Longrightarrow> l \<noteq> \<infinity>"
  2921 lemma Lim_bounded_PInfty2: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>N. f n \<le> ereal B \<Longrightarrow> l \<noteq> \<infinity>"
  2922   using LIMSEQ_le_const2[of f l "ereal B"] by fastforce
  2922   using LIMSEQ_le_const2[of f l "ereal B"] by fastforce
  2923 
  2923 
  2924 lemma Lim_bounded_ereal: "f \<longlonglongrightarrow> (l :: 'a::linorder_topology) \<Longrightarrow> \<forall>n\<ge>M. f n \<le> C \<Longrightarrow> l \<le> C"
       
  2925   by (intro LIMSEQ_le_const2) auto
       
  2926 
       
  2927 lemma Lim_bounded2_ereal:
       
  2928   assumes lim:"f \<longlonglongrightarrow> (l :: 'a::linorder_topology)"
       
  2929     and ge: "\<forall>n\<ge>N. f n \<ge> C"
       
  2930   shows "l \<ge> C"
       
  2931   using ge
       
  2932   by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const])
       
  2933      (auto simp: eventually_sequentially)
       
  2934 
       
  2935 lemma real_of_ereal_mult[simp]:
  2924 lemma real_of_ereal_mult[simp]:
  2936   fixes a b :: ereal
  2925   fixes a b :: ereal
  2937   shows "real_of_ereal (a * b) = real_of_ereal a * real_of_ereal b"
  2926   shows "real_of_ereal (a * b) = real_of_ereal a * real_of_ereal b"
  2938   by (cases rule: ereal2_cases[of a b]) auto
  2927   by (cases rule: ereal2_cases[of a b]) auto
  2939 
  2928 
  3339 lemma suminf_bound:
  3328 lemma suminf_bound:
  3340   fixes f :: "nat \<Rightarrow> ereal"
  3329   fixes f :: "nat \<Rightarrow> ereal"
  3341   assumes "\<forall>N. (\<Sum>n<N. f n) \<le> x"
  3330   assumes "\<forall>N. (\<Sum>n<N. f n) \<le> x"
  3342     and pos: "\<And>n. 0 \<le> f n"
  3331     and pos: "\<And>n. 0 \<le> f n"
  3343   shows "suminf f \<le> x"
  3332   shows "suminf f \<le> x"
  3344 proof (rule Lim_bounded_ereal)
  3333 proof (rule Lim_bounded)
  3345   have "summable f" using pos[THEN summable_ereal_pos] .
  3334   have "summable f" using pos[THEN summable_ereal_pos] .
  3346   then show "(\<lambda>N. \<Sum>n<N. f n) \<longlonglongrightarrow> suminf f"
  3335   then show "(\<lambda>N. \<Sum>n<N. f n) \<longlonglongrightarrow> suminf f"
  3347     by (auto dest!: summable_sums simp: sums_def atLeast0LessThan)
  3336     by (auto dest!: summable_sums simp: sums_def atLeast0LessThan)
  3348   show "\<forall>n\<ge>0. sum f {..<n} \<le> x"
  3337   show "\<forall>n\<ge>0. sum f {..<n} \<le> x"
  3349     using assms by auto
  3338     using assms by auto
  3877 lemma limsup_MInfty:
  3866 lemma limsup_MInfty:
  3878   fixes X :: "nat \<Rightarrow> ereal"
  3867   fixes X :: "nat \<Rightarrow> ereal"
  3879   shows "X \<longlonglongrightarrow> -\<infinity> \<longleftrightarrow> limsup X = -\<infinity>"
  3868   shows "X \<longlonglongrightarrow> -\<infinity> \<longleftrightarrow> limsup X = -\<infinity>"
  3880   by (metis Limsup_MInfty trivial_limit_sequentially)
  3869   by (metis Limsup_MInfty trivial_limit_sequentially)
  3881 
  3870 
  3882 lemma ereal_lim_mono:
       
  3883   fixes X Y :: "nat \<Rightarrow> 'a::linorder_topology"
       
  3884   assumes "\<And>n. N \<le> n \<Longrightarrow> X n \<le> Y n"
       
  3885     and "X \<longlonglongrightarrow> x"
       
  3886     and "Y \<longlonglongrightarrow> y"
       
  3887   shows "x \<le> y"
       
  3888   using assms(1) by (intro LIMSEQ_le[OF assms(2,3)]) auto
       
  3889 
       
  3890 lemma incseq_le_ereal:
       
  3891   fixes X :: "nat \<Rightarrow> 'a::linorder_topology"
       
  3892   assumes inc: "incseq X"
       
  3893     and lim: "X \<longlonglongrightarrow> L"
       
  3894   shows "X N \<le> L"
       
  3895   using inc
       
  3896   by (intro ereal_lim_mono[of N, OF _ tendsto_const lim]) (simp add: incseq_def)
       
  3897 
       
  3898 lemma decseq_ge_ereal:
       
  3899   assumes dec: "decseq X"
       
  3900     and lim: "X \<longlonglongrightarrow> (L::'a::linorder_topology)"
       
  3901   shows "X N \<ge> L"
       
  3902   using dec by (intro ereal_lim_mono[of N, OF _ lim tendsto_const]) (simp add: decseq_def)
       
  3903 
       
  3904 lemma bounded_abs:
       
  3905   fixes a :: real
       
  3906   assumes "a \<le> x"
       
  3907     and "x \<le> b"
       
  3908   shows "\<bar>x\<bar> \<le> max \<bar>a\<bar> \<bar>b\<bar>"
       
  3909   by (metis abs_less_iff assms leI le_max_iff_disj
       
  3910     less_eq_real_def less_le_not_le less_minus_iff minus_minus)
       
  3911 
       
  3912 lemma ereal_Sup_lim:
       
  3913   fixes a :: "'a::{complete_linorder,linorder_topology}"
       
  3914   assumes "\<And>n. b n \<in> s"
       
  3915     and "b \<longlonglongrightarrow> a"
       
  3916   shows "a \<le> Sup s"
       
  3917   by (metis Lim_bounded_ereal assms complete_lattice_class.Sup_upper)
       
  3918 
       
  3919 lemma ereal_Inf_lim:
       
  3920   fixes a :: "'a::{complete_linorder,linorder_topology}"
       
  3921   assumes "\<And>n. b n \<in> s"
       
  3922     and "b \<longlonglongrightarrow> a"
       
  3923   shows "Inf s \<le> a"
       
  3924   by (metis Lim_bounded2_ereal assms complete_lattice_class.Inf_lower)
       
  3925 
       
  3926 lemma SUP_Lim_ereal:
       
  3927   fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
       
  3928   assumes inc: "incseq X"
       
  3929     and l: "X \<longlonglongrightarrow> l"
       
  3930   shows "(SUP n. X n) = l"
       
  3931   using LIMSEQ_SUP[OF inc] tendsto_unique[OF trivial_limit_sequentially l]
       
  3932   by simp
       
  3933 
       
  3934 lemma INF_Lim_ereal:
       
  3935   fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
       
  3936   assumes dec: "decseq X"
       
  3937     and l: "X \<longlonglongrightarrow> l"
       
  3938   shows "(INF n. X n) = l"
       
  3939   using LIMSEQ_INF[OF dec] tendsto_unique[OF trivial_limit_sequentially l]
       
  3940   by simp
       
  3941 
       
  3942 lemma SUP_eq_LIMSEQ:
  3871 lemma SUP_eq_LIMSEQ:
  3943   assumes "mono f"
  3872   assumes "mono f"
  3944   shows "(SUP n. ereal (f n)) = ereal x \<longleftrightarrow> f \<longlonglongrightarrow> x"
  3873   shows "(SUP n. ereal (f n)) = ereal x \<longleftrightarrow> f \<longlonglongrightarrow> x"
  3945 proof
  3874 proof
  3946   have inc: "incseq (\<lambda>i. ereal (f i))"
  3875   have inc: "incseq (\<lambda>i. ereal (f i))"
  3947     using \<open>mono f\<close> unfolding mono_def incseq_def by auto
  3876     using \<open>mono f\<close> unfolding mono_def incseq_def by auto
  3948   {
  3877   {
  3949     assume "f \<longlonglongrightarrow> x"
  3878     assume "f \<longlonglongrightarrow> x"
  3950     then have "(\<lambda>i. ereal (f i)) \<longlonglongrightarrow> ereal x"
  3879     then have "(\<lambda>i. ereal (f i)) \<longlonglongrightarrow> ereal x"
  3951       by auto
  3880       by auto
  3952     from SUP_Lim_ereal[OF inc this] show "(SUP n. ereal (f n)) = ereal x" .
  3881     from SUP_Lim[OF inc this] show "(SUP n. ereal (f n)) = ereal x" .
  3953   next
  3882   next
  3954     assume "(SUP n. ereal (f n)) = ereal x"
  3883     assume "(SUP n. ereal (f n)) = ereal x"
  3955     with LIMSEQ_SUP[OF inc] show "f \<longlonglongrightarrow> x" by auto
  3884     with LIMSEQ_SUP[OF inc] show "f \<longlonglongrightarrow> x" by auto
  3956   }
  3885   }
  3957 qed
  3886 qed