(* Title: HOL/Nonstandard_Analysis/HSEQ.thy Author: Jacques D. Fleuriot Copyright: 1998 University of Cambridge
Convergence of sequences and series.
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 Additional contributions by Jeremy Avigad and Brian Huffman.
*)
section \<open>Sequences and Convergence (Nonstandard)\<close>
theory imports Complex_Main
abbrevs"-"=\<longlonglongrightarrow>\<^sub>N\<^sub>S" begin
X :" \ 'a::banach" by( intro NSconvergent_NSCauchy \<comment> \<open>Nonstandard definition of convergence of sequence\<close> " \<^sub>N\<^sub>S L \ (\N \ HNatInfinite. ( *f* X) N \ star_of L)"
definitiontext where nslim THEX \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" \<comment> \<open>Nonstandard definition of limit using choice operator\<close>
definition NSconvergent :: "(nat \ 'a::real_normed_vector) \ bool" where"NSconvergent X \ (\L. X \\<^sub>N\<^sub>S L)" \<comment> \<open>Nonstandard definition of convergence\<close>
definition NSBseq :: "(nat \ 'a::real_normed_vector) \ bool" where"NSBseq X \ (\N \ HNatInfinite. ( *f* X) N \ HFinite)" \<comment> \<open>Nonstandard definition for bounded sequence\<close>
definition NSCauchy \<open>We now use NS criterion to bring proof of theorem through.\<close> where" X \ (\M \ HNatInfinite. \N \ HNatInfinite. ( *f* X) M \ ( *f* X) N)" \<comment> \<open>Nonstandard definition\<close>assumes"
subsection \<open>Limits of Sequences\<close>
lemma NSLIMSEQ_Iproof "(** () )N \ 0"
lemma NSLIMSEQ_D: "X \\<^sub>N\<^sub>S L \ N \ HNatInfinite \ starfun X N \ star_of L" by (simp add: NSLIMSEQ_defproof -
lemma NSLIMSEQ_const: "(\n. k) \\<^sub>N\<^sub>S k" by (simp add: NSLIMSEQ_def)
lemma NSLIMSEQ_add: "X \\<^sub>N\<^sub>S a \ Y \\<^sub>N\<^sub>S b \ (\n. X n + Y n) \\<^sub>N\<^sub>S a + b" by (auto metis NNSCauchy_NSconvergent_iff x)
lemma NSLIMSEQ_add_const Lwhere" x pow N \ hypreal_of_real L" by (simp only: NSLIMSEQ_add NSconvergentD x]Nby( simp: NSLIMSEQ_def)
lemmahave hypreal_of_real \<approx> hypreal_of_real L * hypreal_of_real x" for ( add approx_mult_subst_star_of ) by (auto have" L hypreal_of_real L * hypreal_of_real x"
lemma NSLIMSEQ_minus: "X \\<^sub>N\<^sub>S a \ (\n. - X n) \\<^sub>N\<^sub>S - a" by (auto simp add: NSLIMSEQ_def L byblast
lemma NSLIMSEQ_diff assms ? using ( dest simp:NSLIMSEQ_def)
lemma by (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lemma forlemmaNSLIMSEQ_abs_realpow_zero2 \> by (simp :real
NSLIMSEQ_mult_inverse for a b :: "'a::real_normed_field" by java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lemma starfun_hnorm: "\x. hnorm (( *f* f) x) = ( *f* (\x. norm (f x))) x" by transfer simp
lemma NSLIMSEQ_norm: "X \\<^sub>N\<^sub>S a \ (\n. norm (X n)) \\<^sub>N\<^sub>S norm a" by (simp add: NSLIMSEQ_def starfun_hnorm [symmetric] approx_hnorm)
text\<open>Uniqueness of limit.\<close> lemma NSLIMSEQ_unique: "X \\<^sub>N\<^sub>S a \ X \\<^sub>N\<^sub>S b \ a = b" unfolding NSLIMSEQ_def using HNatInfinite_whn approx_trans3 star_of_approx_iff by blast
lemma NSLIMSEQ_pow [rule_format]: "(X \\<^sub>N\<^sub>S a) \ ((\n. (X n) ^ m) \\<^sub>N\<^sub>S a ^ m)" for a :: "'a::{real_normed_algebra,power}" by (induct m) (auto intro: NSLIMSEQ_mult NSLIMSEQ_const)
text\<open>We can now try and derive a few properties of sequences,
starting with thelimit propertyjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
lemma NSLIMSEQ_le form: real unfolding NSLIMSEQ_def by (metis HNatInfinite_whn bex_Infinitesimal_iff2 hypnat_of_nat_le_whn hypreal_of_real_le_add_Infininitesimal_cancel2 starfun_le_mono)
lemma NSLIMSEQ_le_const: "X java.lang.StringIndexOutOfBoundsException: Range [0, 72) out of bounds for length 30 for a r :: real by ( NSLIMSEQ_le[FNSLIMSEQ_const
lemma NSLIMSEQ_le_const2 definition convergencesequence java.lang.StringIndexOutOfBoundsException: Index 135 out of bounds for length 135 for" X (\L. X \\<^sub>N\<^sub>S L)" by (erule NSLIMSEQ_le [OF _ <>\openNonstandard convergence
\<open>Shift a convergent series by 1:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
successorinfinite is.\<close>
NSLIMSEQ_Suc_iff( proof assume *: "f \\<^sub>N\<^sub>S l" "(\n. f(Suc n)) \\<^sub>N\<^sub>S l"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fix
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 by( addHNatInfinite_add NSLIMSEQ_D) by( introapprox_add add)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 qed nextby( only ) assume:( showfor:':java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 proof auto:) lemmaNSLIMSEQ_minus_cancel (>- assume"N by (drule NSLIMSEQ_minus) simp have(*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l" using * by (simp add: HNatInfinite_diff NSLIMSEQ_D) then show "(*f* f) N \<approx> star_of l" by (simp add: \<open>N \<in> HNatInfinite\<close> one_le_HNatInfinite starfun_shift_one) qed qed
subsubsection \<open>Equivalence of \<^term>\<open>LIMSEQ\<close> and \<^term>\<open>NSLIMSEQ\<close>\<close>
lemma LIMSEQ_NSLIMSEQ: assumes X: "X \<longlonglongrightarrow> L" shows "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L" proof (rule NSLIMSEQ_I) fix N assume N: "N \<in> HNatInfinite" have "starfun X N - star_of L \<in> Infinitesimal" proof (rule InfinitesimalI2) fix r :: real assume r: "0 < r" from LIMSEQ_D [OF X r] obtain no where "\<forall>n\<ge>no. norm (X n - L) < r" .. then have "\<forall>n\<ge>star_of no. hnorm (starfun X n - star_of L) < star_of r" by transfer then show "hnorm (starfun X N - star_of L) < star_of r" using N by (simp add: star_of_le_HNatInfinite) qed then show "starfun X N \<approx> star_of L" by (simp only: approx_def) qed
lemma NSLIMSEQ_LIMSEQ: assumes X: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L" shows "X \<longlonglongrightarrow> L" proof (rule LIMSEQ_I) fix r :: real assume r: "0 < r" have "\<exists>no. \<forall>n\<ge>no. hnorm (starfun X n - star_of L) < star_of r" proof (intro exI allI impI) fix n assume "whn \<le> n" with HNatInfinite_whn have "n \<in> HNatInfinite" by (rule HNatInfinite_upward_closed) with X have "starfun X n \<approx> star_of L" by (rule NSLIMSEQ_D) then have "starfun X n - star_of L \<in> Infinitesimal" by (simp only: approx_def) then show "hnorm (starfun X n - star_of L) < star_of r" using r by (rule InfinitesimalD2) qed then show "\<exists>no. \<forall>n\<ge>no. norm (X n - L) < r" by transfer qed
theorem LIMSEQ_NSLIMSEQ_iff: "f \<longlonglongrightarrow> L \<longleftrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S L" by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ)
subsubsection \<open>Derived theorems about \<^term>\<open>NSLIMSEQ\<close>\<close>
text \<open>We prove the NS version from the standard one, since the NS proof seems more complicated than the standard one above!\<close> lemma NSLIMSEQ_norm_zero: "(\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0 \<longleftrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_norm_zero_iff)
lemma NSLIMSEQ_rabs_zero: "(\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0 \<longleftrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S (0::real)" by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_rabs_zero_iff)
text \<open>Generalization to other limits.\<close> lemma NSLIMSEQ_imp_rabs: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>" for l :: real by (simp add: NSLIMSEQ_def) (auto intro: approx_hrabs simp add: starfun_abs)
lemma NSLIMSEQ_inverse_zero: "\<forall>y::real. \<exists>N. \<forall>n \<ge> N. y < f n \<Longrightarrow> (\<lambda>n. inverse (f n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_zero)
lemma NSBseqD: "NSBseq X \<Longrightarrow> N \<in> HNatInfinite \<Longrightarrow> ( *f* X) N \<in> HFinite" by (simp add: NSBseq_def)
lemma Standard_subset_HFinite: "Standard \<subseteq> HFinite" by (auto simp: Standard_def)
lemma NSBseqD2: "NSBseq X \<Longrightarrow> ( *f* X) N \<in> HFinite" using HNatInfinite_def NSBseq_def Nats_eq_Standard Standard_starfun Standard_subset_HFinite by blast
lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *f* X) N \<in> HFinite \<Longrightarrow> NSBseq X" by (simp add: NSBseq_def)
text \<open>The standard definition implies the nonstandard definition.\<close> lemma Bseq_NSBseq: "Bseq X \<Longrightarrow> NSBseq X" unfolding NSBseq_def proof safe assume X: "Bseq X" fix N assume N: "N \<in> HNatInfinite" from BseqD [OF X] obtain K where "\<forall>n. norm (X n) \<le> K" by fast then have "\<forall>N. hnorm (starfun X N) \<le> star_of K" by transfer then have "hnorm (starfun X N) \<le> star_of K" by simp also have "star_of K < star_of (K + 1)" by simp finally have "\<exists>x\<in>Reals. hnorm (starfun X N) < x" by (rule bexI) simp then show "starfun X N \<in> HFinite" by (simp add: HFinite_def) qed
text \<open>The nonstandard definition implies the standard definition.\<close> lemma SReal_less_omega: "r \<in> \<real> \<Longrightarrow> r < \<omega>" using HInfinite_omega by (simp add: HInfinite_def) (simp add: order_less_imp_le)
lemma NSBseq_Bseq: "NSBseq X \<Longrightarrow> Bseq X" proof (rule ccontr) let ?n = "\<lambda>K. LEAST n. K < norm (X n)" assume "NSBseq X" then have finite: "( *f* X) (( *f* ?n) \<omega>) \<in> HFinite" by (rule NSBseqD2) assume "\<not> Bseq X" then have "\<forall>K>0. \<exists>n. K < norm (X n)" by (simp add: Bseq_def linorder_not_le) then have "\<forall>K>0. K < norm (X (?n K))" by (auto intro: LeastI_ex) then have "\<forall>K>0. K < hnorm (( *f* X) (( *f* ?n) K))" by transfer then have "\<omega> < hnorm (( *f* X) (( *f* ?n) \<omega>))" by simp then have "\<forall>r\<in>\<real>. r < hnorm (( *f* X) (( *f* ?n) \<omega>))" by (simp add: order_less_trans [OF SReal_less_omega]) then have "( *f* X) (( *f* ?n) \<omega>) \<in> HInfinite" by (simp add: HInfinite_def) with finite show "False" by (simp add: HFinite_HInfinite_iff) qed
text \<open>Equivalence of nonstandard and standard definitions for a bounded sequence.\<close> lemma Bseq_NSBseq_iff: "Bseq X = NSBseq X" by (blast intro!: NSBseq_Bseq Bseq_NSBseq)
text \<open>A convergent sequence is bounded: Boundedness as a necessary condition for convergence. The nonstandard version has no existential, as usual.\<close> lemma NSconvergent_NSBseq: "NSconvergent X \<Longrightarrow> NSBseq X" by (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def) (blast intro: HFinite_star_of approx_sym approx_HFinite)
text \<open>Standard Version: easily now proved using equivalence of NS and standard definitions.\<close>
lemma convergent_Bseq: "convergent X \<Longrightarrow> Bseq X" for X :: "nat \<Rightarrow> 'b::real_normed_vector" by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff)
subsubsection \<open>Upper Bounds and Lubs of Bounded Sequences\<close>
lemma NSBseq_isUb: "NSBseq X \<Longrightarrow> \<exists>U::real. isUb UNIV {x. \<exists>n. X n = x} U" by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb)
lemma NSBseq_isLub: "NSBseq X \<Longrightarrow> \<exists>U::real. isLub UNIV {x. \<exists>n. X n = x} U" by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub)
subsubsection \<open>A Bounded and Monotonic Sequence Converges\<close>
text \<open>The best of both worlds: Easier to prove this result as a standard theorem and then use equivalence to "transfer" it into the equivalent nonstandard form if needed!\<close>
lemma Bmonoseq_NSLIMSEQ: "\<forall>\<^sub>F k in sequentially. X k = X m \<Longrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S X m" unfolding LIMSEQ_NSLIMSEQ_iff[symmetric] by (simp add: eventually_mono eventually_nhds_x_imp_x filterlim_iff)
lemma NSBseq_mono_NSconvergent: "NSBseq X \<Longrightarrow> \<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> NSconvergent X" for X :: "nat \<Rightarrow> real" by (auto intro: Bseq_mono_convergent simp: convergent_NSconvergent_iff [symmetric] Bseq_NSBseq_iff [symmetric])
subsection \<open>Cauchy Sequences\<close>
lemma NSCauchyI: "(\<And>M N. M \<in> HNatInfinite \<Longrightarrow> N \<in> HNatInfinite \<Longrightarrow> starfun X M \<approx> starfun X N) \<Longrightarrow> NSCauchy X" by (simp add: NSCauchy_def)
lemma NSCauchyD: "NSCauchy X \<Longrightarrow> M \<in> HNatInfinite \<Longrightarrow> N \<in> HNatInfinite \<Longrightarrow> starfun X M \<approx> starfun X N" by (simp add: NSCauchy_def)
subsubsection \<open>Equivalence Between NS and Standard\<close>
lemma Cauchy_NSCauchy: assumes X: "Cauchy X" shows "NSCauchy X" proof (rule NSCauchyI) fix M assume M: "M \<in> HNatInfinite" fix N assume N: "N \<in> HNatInfinite" have "starfun X M - starfun X N \<in> Infinitesimal" proof (rule InfinitesimalI2) fix r :: real assume r: "0 < r" from CauchyD [OF X r] obtain k where "\<forall>m\<ge>k. \<forall>n\<ge>k. norm (X m - X n) < r" .. then have "\<forall>m\<ge>star_of k. \<forall>n\<ge>star_of k. hnorm (starfun X m - starfun X n) < star_of r" by transfer then show "hnorm (starfun X M - starfun X N) < star_of r" using M N by (simp add: star_of_le_HNatInfinite) qed then show "starfun X M \<approx> starfun X N" by (simp only: approx_def) qed
lemma NSCauchy_Cauchy: assumes X: "NSCauchy X" shows "Cauchy X" proof (rule CauchyI) fix r :: real assume r: "0 < r" have "\<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. hnorm (starfun X m - starfun X n) < star_of r" proof (intro exI allI impI) fix M assume "whn \<le> M" with HNatInfinite_whn have M: "M \<in> HNatInfinite" by (rule HNatInfinite_upward_closed) fix N assume "whn \<le> N" with HNatInfinite_whn have N: "N \<in> HNatInfinite" by (rule HNatInfinite_upward_closed) from X M N have "starfun X M \<approx> starfun X N" by (rule NSCauchyD) then have "starfun X M - starfun X N \<in> Infinitesimal" by (simp only: approx_def) then show "hnorm (starfun X M - starfun X N) < star_of r" using r by (rule InfinitesimalD2) qed then show "\<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. norm (X m - X n) < r" by transfer qed
theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X" by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy)
subsubsection \<open>Cauchy Sequences are Bounded\<close>
text \<open>A Cauchy sequence is bounded -- nonstandard version.\<close>
lemma NSCauchy_NSBseq: "NSCauchy X \<Longrightarrow> NSBseq X" by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff)
subsubsection \<open>Cauchy Sequences are Convergent\<close>
text \<open>Equivalence of Cauchy criterion and convergence: We will prove this using our NS formulation which provides a much easier proof than using the standard definition. We do not need to use properties of subsequences such as boundedness, monotonicity etc... Compare with Harrison's corresponding proof in HOL which is much longer and more complicated. Of course, we do not have problems which he encountered with guessing the right instantiations for his 'espsilon-delta' proof(s) in this case since the NS formulations do not involve existential quantifiers.\<close>
lemma NSconvergent_NSCauchy: "NSconvergent X \<Longrightarrow> NSCauchy X" by (simp add: NSconvergent_def NSLIMSEQ_def NSCauchy_def) (auto intro: approx_trans2)
lemma real_NSCauchy_NSconvergent: fixes X :: "nat \<Rightarrow> real" assumes "NSCauchy X" shows "NSconvergent X" unfolding NSconvergent_def NSLIMSEQ_def proof - have "( *f* X) whn \<in> HFinite" by (simp add: NSBseqD2 NSCauchy_NSBseq assms) moreover have "\<forall>N\<in>HNatInfinite. ( *f* X) whn \<approx> ( *f* X) N" using HNatInfinite_whn NSCauchy_def assms by blast ultimately show "\<exists>L. \<forall>N\<in>HNatInfinite. ( *f* X) N \<approx> hypreal_of_real L" by (force dest!: st_part_Ex simp add: SReal_iff intro: approx_trans3) qed
lemma NSCauchy_NSconvergent: "NSCauchy X \<Longrightarrow> NSconvergent X" for X :: "nat \<Rightarrow> 'a::banach" using Cauchy_convergent NSCauchy_Cauchy convergent_NSconvergent_iff by auto
lemma NSCauchy_NSconvergent_iff: "NSCauchy X = NSconvergent X" for X :: "nat \<Rightarrow> 'a::banach" by (fast intro: NSCauchy_NSconvergent NSconvergent_NSCauchy)
subsection \<open>Power Sequences\<close>
text \<open>The sequence \<^term>\<open>x^n\<close> tends to 0 if \<^term>\<open>0\<le>x\<close> and \<^term>\<open>x<1\<close>. Proof will use (NS) Cauchy equivalence for convergence and also fact that bounded and monotonic sequence converges.\<close>
text \<open>We now use NS criterion to bring proof of theorem through.\<close> lemma NSLIMSEQ_realpow_zero: fixes x :: real assumes "0 \<le> x" "x < 1" shows "(\<lambda>n. x ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" proof - have "( *f* (^) x) N \<approx> 0" if N: "N \<in> HNatInfinite" and x: "NSconvergent ((^) x)" for N proof - have "hypreal_of_real x pow N \<approx> hypreal_of_real x pow (N + 1)" by (metis HNatInfinite_add N NSCauchy_NSconvergent_iff NSCauchy_def starfun_pow x) moreover obtain L where L: "hypreal_of_real x pow N \<approx> hypreal_of_real L" using NSconvergentD [OF x] N by (auto simp add: NSLIMSEQ_def starfun_pow) ultimately have "hypreal_of_real x pow N \<approx> hypreal_of_real L * hypreal_of_real x" by (simp add: approx_mult_subst_star_of hyperpow_add) then have "hypreal_of_real L \<approx> hypreal_of_real L * hypreal_of_real x" using L approx_trans3 by blast then show ?thesis by (metis L \<open>x < 1\<close> hyperpow_def less_irrefl mult.right_neutral mult_left_cancel star_of_approx_iff star_of_mult star_of_simps(9) starfun2_star_of) qed with assms show ?thesis by (force dest!: convergent_realpow simp add: NSLIMSEQ_def convergent_NSconvergent_iff) qed
lemma NSLIMSEQ_abs_realpow_zero: "\<bar>c\<bar> < 1 \<Longrightarrow> (\<lambda>n. \<bar>c\<bar> ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" for c :: real by (simp add: LIMSEQ_abs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric])
lemma NSLIMSEQ_abs_realpow_zero2: "\<bar>c\<bar> < 1 \<Longrightarrow> (\<lambda>n. c ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" for c :: real by (simp add: LIMSEQ_abs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric])
end
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.20Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.