(* 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 HSEQ imports Complex_Main NatStar
abbrevs "--->" = "\\<^sub>N\<^sub>S" begin
definition NSLIMSEQ :: "(nat \ 'a::real_normed_vector) \ 'a \ bool"
(\<open>(\<open>notation=\<open>mixfix NSLIMSEQ\<close>\<close>(_)/ \<longlonglongrightarrow>\<^sub>N\<^sub>S (_))\<close> [60, 60] 60) where \<comment> \<open>Nonstandard definition of convergence of sequence\<close> "X \\<^sub>N\<^sub>S L \ (\N \ HNatInfinite. ( *f* X) N \ star_of L)"
definition nslim :: "(nat \ 'a::real_normed_vector) \ 'a" where"nslim X = (THE L. X \\<^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>
lemma NSLIMSEQ_I: "(\N. N \ HNatInfinite \ starfun X N \ star_of L) \ X \\<^sub>N\<^sub>S L" by (simp add: NSLIMSEQ_def)
lemma NSLIMSEQ_D: "X \\<^sub>N\<^sub>S L \ N \ HNatInfinite \ starfun X N \ star_of L" by (simp add: NSLIMSEQ_def)
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 intro: approx_add simp add: NSLIMSEQ_def)
lemma NSLIMSEQ_add_const(* Title: HOL/Nonstandard_Analysis/HSEQ.thy by (simp only: NSLIMSEQ_add NSLIMSEQ_const)
lemma NSLIMSEQ_mult: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> (\<lambda>n. X n * Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a * b" for a b :: "'a::real_normed_algebra" by (auto intro!: approx_mult_HFinite simp add: NSLIMSEQ_def)
lemma NSLIMSEQ_minus: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. - X n) \<longlonglongrightarrow>\<^sub>N\<^sub>S - a" by (auto simp add: NSLIMSEQ_def)
lemma NSLIMSEQ_minus_cancel: "(\<lambda>n. - X n) \<longlonglongrightarrow>\<^sub>N\<^sub>S -a \<Longrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S a" by (drule NSLIMSEQ_minus) simp
lemma NSLIMSEQ_diff: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> (\<lambda>n. X n - Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b" using NSLIMSEQ_add [of X a "- Y" "- b"] by (simp add: NSLIMSEQ_minus fun_Compl_def)
lemma NSLIMSEQ_diff_const: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. f n - b) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b" by (simp add: NSLIMSEQ_diff NSLIMSEQ_const)
lemma NSLIMSEQ_inverse: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> (\<lambda>n. inverse (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S inverse a" for a :: "'a::real_normed_div_algebra" by (simp add: NSLIMSEQ_def star_of_approx_inverse)
lemma NSLIMSEQ_mult_inverse: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> (\<lambda>n. X n / Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a / b" for a b :: "'a::real_normed_field" by (simp add: NSLIMSEQ_mult NSLIMSEQ_inverse divide_inverse)
lemma starfun_hnorm: "\<And>x. hnorm (( *f* f) x) = ( *f* (\<lambda>x. norm (f x))) x" by transfer simp
lemma NSLIMSEQ_norm: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^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 \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> a = b" unfolding NSLIMSEQ_def using HNatInfinite_whn approx_trans3 star_of_approx_iff by blast
lemma NSLIMSEQ_pow [rule_format]: "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S a) \<longrightarrow> ((\<lambda>n. (X n) ^ m) \<longlonglongrightarrow>\<^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 the limit comparison property for sequences.\<close>
lemma NSLIMSEQ_le: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<longlonglongrightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> \<exists>N. \<forall>n \<ge> N. f n \<le> g n \<Longrightarrow> l \<le> m" for l m :: 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 \<longlonglongrightarrow>\<^sub>N\<^sub>S r \<Longrightarrow> \<forall>n. a \<le> X n \<Longrightarrow> a \<le> r" for a r :: real by (erule NSLIMSEQ_le [OF NSLIMSEQ_const]) auto
lemma NSLIMSEQ_le_const2: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S r \<Longrightarrow> \<forall>n. X n \<le> a \<Longrightarrow> r \<le> a" for a r :: real by (erule NSLIMSEQ_le [OF _ NSLIMSEQ_const]) auto
text \<open>Shift a convergent series by 1: By the equivalence between Cauchiness and convergence and because the successor of an infinite hypernatural is also infinite.\<close>
lemma NSLIMSEQ_Suc_iff: "((\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l) \<longleftrightarrow> (f \<longlonglongrightarrow>\<^sub>N\<^sub>S l)" proof assume *: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l" show "(\<lambda>n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l" proof (rule NSLIMSEQ_I) fix N assume "N \<in> HNatInfinite" then have "(*f* f) (N + 1) \<approx> star_of l"
by (simp add: HNatInfinite_add NSLIMSEQ_D *) by add)
NSLIMSEQ_const \>nk java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
auto simp:) next
rightarrow proof (rule onlyNSLIMSEQ_const
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
subsubsection \<open>Equivalence of \<^term>\<open>LIMSEQ\<close> and \<^term>\<open>NSLIMSEQ\<close>\<close>
: assumes X: "X \\<^sub>N\<^sub>S L" proofrule)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 assume: in have"starfun X N - java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fora: ':real_normed_div_algebrajava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 fixr: java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
0<r from then java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86 by transfer then" (starfun XN- L) < star_of rjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
N simp) qed then
simp: approx_def) qed
lemma NSLIMSEQ_LIMSEQ: lemmaNSLIMSEQ_unique: X shows" NSLIMSEQ_def proofrule) fix lemmaNSLIMSEQ_pow]: "X\\<^sub>N\<^sub>S a) \ ((\n. (X n) ^ m) \\<^sub>N\<^sub>S a ^ m)" have"\no. \n\no. hnorm (starfun X n - star_of L) < star_of r" prooffor :: 'a:{power" fix n assume"whn \ n" with HNatInfinite_whn have"n \ HNatInfinite"
HNatInfinite_upward_closed with X java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 byrule) thenhave"starfun X n - star_of L
simp: approx_def thenshowfor :real
r by( InfinitesimalD2
: "X \\<^sub>N\<^sub>S r \ \n. a \ X n \ a \ r" then"<>no. \n\no. norm (X n - L) < r"
qed
lemma: "X\
erule [ _ ]) auto
\<open>Derived theorems about \<^term>\<open>NSLIMSEQ\<close>\<close> successor an hypernatural also.\<close>
text
more thanthe standard one above!\<close> lemma NSLIMSEQ_norm_zero: "(\n. norm (X n)) \\<^sub>N\<^sub>S 0 \ X \\<^sub>N\<^sub>S 0" by (simp: LIMSEQ_NSLIMSEQ_iffsymmetrictendsto_norm_zero_iff)
lemma"(\n. f(Suc n)) \\<^sub>N\<^sub>S l" by (simp symmetric)
text\<open>Generalization to other limits.\<close> lemmaNSLIMSEQ_imp_rabsf\<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>" bysimp:HNatInfinite_addNSLIMSEQ_D
simp:N) (auto: simp: starfun_abs
Standard_subset_HFiniteStandard byshows java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
:" X \ ( *f* X) N \ HFinite" using HNatInfinite_def proofintro allI)
lemma HNatInfinite_whn "\ HNatInfinite" by ( HNatInfinite_upward_closed
text\<open>The standard definition implies the nonstandard definition.\<close> lemma Bseq_NSBseq: "Bseq X \ NSBseq X" by rule) proofsafe assume X: "Bseq X" fix N assume N: "N \ HNatInfinite" from BseqD [OF X] obtain K where"\n. norm (X n) \ K" by then\> ( )\le" by transfer then" (starfun XN \ star_of K" bythen"existsno.\n\no. norm (X n - L) < r" alsojava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
simp
showXjava.lang.NullPointerException text qed
text\<open>The nonstandard definition implies the standard definition.\<close> more than standard above\<close> lemma SReal_less_omega: "r \ \ \ r < \" using (imp: [symmetric) lemma: "(\n. \f n\) \\<^sub>N\<^sub>S 0 \ f \\<^sub>N\<^sub>S (0::real)"
lemma NSBseq_Bseq: "NSBseq X \ Bseq X" by (simp: LIMSEQ_NSLIMSEQ_iff] tendsto_rabs_zero_iff text\<open>Generalization to other limits.\<close> " X" then l : real by( NSBseqD2 assume"lemmaNSLIMSEQ_inverse_zero:"<>y:. \<exists>N. \<forall>n \<ge> N. y < f n \<Longrightarrow> (\<lambda>n. inverse (f n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" : [symmetric then (impadd: LIMSEQ_NSLIMSEQ_iffsymmetric )
then NSLIMSEQ_inverse_real_of_nat_add(<lambda +( Suc longlonglongrightarrow by auto:LeastI_ex lemmaNSLIMSEQ_inverse_real_of_nat_add_minus( by simp: [symmetric then NSLIMSEQ_inverse_real_of_nat_add_minus_multjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
thenhave bysimp:order_less_trans SReal_less_omega then by( add) with finite simp:nslim_def intro: NSLIMSEQ_unique) bylemma lim_nslim_iff " X = X" qed
\<open>Equivalence of nonstandard and standard definitions for a bounded sequence.\<close> : )
emma: BseqNSBseq Xjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(blastjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
: "NSconvergentX X \\<^sub>N\<^sub>S nslim X"
Boundedness as a necessary condition for convergence.
The nonstandard version has no existential, as usual.\<close>byauto: NSLIMSEQ_unique addNSconvergent_def nslim_def)
NSconvergent_NSBseq"SconvergentX\Longrightarrow " lemma: " X \ N \ HNatInfinite \ ( *f* X) N \ HFinite"
blast: approx_sym)
textjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
definitions
lemma convergent_Bseq: "convergent X \ Bseq X" forlemma NSBseqI "<>N\in . ( ** X) N \ HFinite \ NSBseq X" by simp: )
subsubsection \<open>Upper Bounds and Lubs of Bounded Sequences\<close>
X\<Longrightarrow> \<exists>U::real. isUb UNIV {x. \<exists>n. X n = x} U"
( add [symmetric)
NSBseq_isLub NSBseqX \<Longrightarrow> \<exists>U::real. isLub UNIV {x. \<exists>n. X n = x} U" byadd]java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
subsubsection \<open>A Bounded and Monotonic Sequence Converges\<close>
text by (rule bexI) simp theoremandthen equivalence transfer into
equivalent nonstandard formby( addHFinite_def)
lemma Bmonoseq_NSLIMSEQ: "\\<^sub>F k in sequentially. X k = X m \ X \\<^sub>N\<^sub>S X m"
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 bysimp:eventually_monoeventually_nhds_x_imp_x )
lemma NSBseq_mono_NSconvergentlemma: "r \ \ r < \"
X : "simp) by (auto
: convergent_NSconvergent_iff[] Bseq_NSBseq_iff])
subsection n \>. . (X n)"
lemma NSCauchyI: "(\M N. M \ HNatInfinite \ N \ HNatInfinite \ starfun X M \ starfun X N) \ NSCauchy X"
(:java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
lemma NSCauchyD: "NSCauchy X \ M \ HNatInfinite \ N \ HNatInfinite \ starfun X M \ starfun X N" by (
subsubsection \<open>Equivalence Between NS and Standard\<close>
lemmathenhave"K>. assumesCauchy showsthen" proof (rule NSCauchyI)
M assume M: " then \omega < hnorm (( **X ( f n fixbysimp assumeN " HNatInfinite" have"starfun X M - starfun X N \ Infinitesimal" proof (rule InfinitesimalI2) fix: assume r: "0 < r" from OF]obtainwhere thenhave"\m\star_of k. \n\star_of k. hnorm (starfun X m - starfun X n) < star_of r" byjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 thenshow"hnorm (starfun X M - starfun X N) < star_of r"
MNbysimp:) qed thenshow"starfun X M \ starfun X N" by (simp: approx_def qed
lemma <>Equivalence nonstandard definitionsforabounded. lemma: "Bseq X = NSBseq " shows"Cauchy X" proof (rule CauchyI) fix r :: real
r 0<r have proofintro allI)
asa necessary for. "\ M" withlemmaNSconvergent_NSBseq " X \ NSBseq X" by( HNatInfinite_upward_closed fix N assumewhn withHNatInfinite_whn :"
definitions\<close> from X M N have"starfun X M \ starfun X N" by (rule NSCauchyD have" X M starfun N\<> Infinitesimal"
( only) thenshow"hnorm ( (simpadd:NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff) usingby ( InfinitesimalD2 qed thenshow"\k. \m\k. \n\k. norm (X m - X n) < r" by transfer qed
theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X" bylemmaNSBseq_isUbNSBseqjava.lang.StringIndexOutOfBoundsException: Index 102 out of bounds for length 102
( add Bseq_NSBseq_iffsymmetric)
text
lemma NSCauchy_NSBseq" X \ NSBseq X" bytext\<open>The best of both worlds: Easier to prove this result as a standard
subsubsection nonstandard if!\<close>
text LIMSEQ_NSLIMSEQ_iff]
simp: eventually_nhds_x_imp_x)
much easier
need use ofsubsequences such boundedness
monotonicity.. Compare 's proof in intro
not have : convergent_NSconvergent_iffsymmetric [symmetric
subsection
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lemma
( add NSLIMSEQ_def) ( introapprox_trans2
lemma" X\ M \ HNatInfinite \ N \ HNatInfinite \ starfun X M \ starfun X N" fixes X :: "nat \ real" assumes"NSCauchy X"shows"NSconvergent X"
subsubs \<open>Equivalence Between NS and Standard\<close> haveassumes" X" by( add NSCauchy_NSBseq)
M M\<in> HNatInfinite"
ssume "\ by dest: simp: SReal_iff:approx_trans3 qed
lemma NSCauchy_NSconvergent: "NSCauchy X \ NSconvergent X" for X r ::java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
NSCauchy_Cauchy by
lemma NSCauchy_NSconvergent_iff: have for : " \ 'a::banach" show XN < r"
subsection \<open>Power Sequences\<close>
using simpstar_of_le_HNatInfinite also that and converges
\<open>We now use NS criterion to bring proof of theorem through.\<close>
:
X: " X" assumes proof -
( **^ ) iffix : real proof havehave"<> forall>m\k. \n\k. hnorm (starfun X m - starfun X n) < star_of r" by (metis HNatInfinite_add N NSCauchy_NSconvergent_iff NSCauchy_def starfun_pow x)
L L:"x pow N \ hypreal_of_real L" using NSconvergentD [OF x] fixM ultimatelyM Mjava.lang.NullPointerException
simp: hyperpow_add thenhavefixjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 using L approx_trans3XM " X M approx> starfun X N" show bythen starfun-
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
r by( InfinitesimalD2 bythen"\k. \m\k. \n\k. norm (X m - X n) < r" qed
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 for c :: real
(imp: LIMSEQ_abs_realpow_zeroLIMSEQ_NSLIMSEQ_iffsymmetric])
lemmajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 for:real by (simp add: LIMSEQ_abs_realpow_zero2 java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
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.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.