src/HOL/NSA/HSEQ.thy
changeset 61975 b4b11391c676
parent 61970 6226261144d7
equal deleted inserted replaced
61974:5b067c681989 61975:b4b11391c676
     4     Description : Convergence of sequences and series
     4     Description : Convergence of sequences and series
     5     Conversion to Isar and new proofs by Lawrence C Paulson, 2004
     5     Conversion to Isar and new proofs by Lawrence C Paulson, 2004
     6     Additional contributions by Jeremy Avigad and Brian Huffman
     6     Additional contributions by Jeremy Avigad and Brian Huffman
     7 *)
     7 *)
     8 
     8 
     9 section {* Sequences and Convergence (Nonstandard) *}
     9 section \<open>Sequences and Convergence (Nonstandard)\<close>
    10 
    10 
    11 theory HSEQ
    11 theory HSEQ
    12 imports Limits NatStar
    12 imports Limits NatStar
    13 begin
    13 begin
    14 
    14 
    15 definition
    15 definition
    16   NSLIMSEQ :: "[nat => 'a::real_normed_vector, 'a] => bool"
    16   NSLIMSEQ :: "[nat => 'a::real_normed_vector, 'a] => bool"
    17     ("((_)/ \<longlonglongrightarrow>\<^sub>N\<^sub>S (_))" [60, 60] 60) where
    17     ("((_)/ \<longlonglongrightarrow>\<^sub>N\<^sub>S (_))" [60, 60] 60) where
    18     --{*Nonstandard definition of convergence of sequence*}
    18     \<comment>\<open>Nonstandard definition of convergence of sequence\<close>
    19   "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)"
    19   "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)"
    20 
    20 
    21 definition
    21 definition
    22   nslim :: "(nat => 'a::real_normed_vector) => 'a" where
    22   nslim :: "(nat => 'a::real_normed_vector) => 'a" where
    23     --{*Nonstandard definition of limit using choice operator*}
    23     \<comment>\<open>Nonstandard definition of limit using choice operator\<close>
    24   "nslim X = (THE L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
    24   "nslim X = (THE L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
    25 
    25 
    26 definition
    26 definition
    27   NSconvergent :: "(nat => 'a::real_normed_vector) => bool" where
    27   NSconvergent :: "(nat => 'a::real_normed_vector) => bool" where
    28     --{*Nonstandard definition of convergence*}
    28     \<comment>\<open>Nonstandard definition of convergence\<close>
    29   "NSconvergent X = (\<exists>L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
    29   "NSconvergent X = (\<exists>L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
    30 
    30 
    31 definition
    31 definition
    32   NSBseq :: "(nat => 'a::real_normed_vector) => bool" where
    32   NSBseq :: "(nat => 'a::real_normed_vector) => bool" where
    33     --{*Nonstandard definition for bounded sequence*}
    33     \<comment>\<open>Nonstandard definition for bounded sequence\<close>
    34   "NSBseq X = (\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite)"
    34   "NSBseq X = (\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite)"
    35 
    35 
    36 definition
    36 definition
    37   NSCauchy :: "(nat => 'a::real_normed_vector) => bool" where
    37   NSCauchy :: "(nat => 'a::real_normed_vector) => bool" where
    38     --{*Nonstandard definition*}
    38     \<comment>\<open>Nonstandard definition\<close>
    39   "NSCauchy X = (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite. ( *f* X) M \<approx> ( *f* X) N)"
    39   "NSCauchy X = (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite. ( *f* X) M \<approx> ( *f* X) N)"
    40 
    40 
    41 subsection {* Limits of Sequences *}
    41 subsection \<open>Limits of Sequences\<close>
    42 
    42 
    43 lemma NSLIMSEQ_iff:
    43 lemma NSLIMSEQ_iff:
    44     "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S L) = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)"
    44     "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S L) = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)"
    45 by (simp add: NSLIMSEQ_def)
    45 by (simp add: NSLIMSEQ_def)
    46 
    46 
   100 by transfer simp
   100 by transfer simp
   101 
   101 
   102 lemma NSLIMSEQ_norm: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S norm a"
   102 lemma NSLIMSEQ_norm: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S norm a"
   103 by (simp add: NSLIMSEQ_def starfun_hnorm [symmetric] approx_hnorm)
   103 by (simp add: NSLIMSEQ_def starfun_hnorm [symmetric] approx_hnorm)
   104 
   104 
   105 text{*Uniqueness of limit*}
   105 text\<open>Uniqueness of limit\<close>
   106 lemma NSLIMSEQ_unique: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; X \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> a = b"
   106 lemma NSLIMSEQ_unique: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; X \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> a = b"
   107 apply (simp add: NSLIMSEQ_def)
   107 apply (simp add: NSLIMSEQ_def)
   108 apply (drule HNatInfinite_whn [THEN [2] bspec])+
   108 apply (drule HNatInfinite_whn [THEN [2] bspec])+
   109 apply (auto dest: approx_trans3)
   109 apply (auto dest: approx_trans3)
   110 done
   110 done
   114   shows "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S a) --> ((%n. (X n) ^ m) \<longlonglongrightarrow>\<^sub>N\<^sub>S a ^ m)"
   114   shows "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S a) --> ((%n. (X n) ^ m) \<longlonglongrightarrow>\<^sub>N\<^sub>S a ^ m)"
   115 apply (induct "m")
   115 apply (induct "m")
   116 apply (auto simp add: power_Suc intro: NSLIMSEQ_mult NSLIMSEQ_const)
   116 apply (auto simp add: power_Suc intro: NSLIMSEQ_mult NSLIMSEQ_const)
   117 done
   117 done
   118 
   118 
   119 text{*We can now try and derive a few properties of sequences,
   119 text\<open>We can now try and derive a few properties of sequences,
   120      starting with the limit comparison property for sequences.*}
   120      starting with the limit comparison property for sequences.\<close>
   121 
   121 
   122 lemma NSLIMSEQ_le:
   122 lemma NSLIMSEQ_le:
   123        "[| f \<longlonglongrightarrow>\<^sub>N\<^sub>S l; g \<longlonglongrightarrow>\<^sub>N\<^sub>S m;
   123        "[| f \<longlonglongrightarrow>\<^sub>N\<^sub>S l; g \<longlonglongrightarrow>\<^sub>N\<^sub>S m;
   124            \<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n)
   124            \<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n)
   125         |] ==> l \<le> (m::real)"
   125         |] ==> l \<le> (m::real)"
   136 by (erule NSLIMSEQ_le [OF NSLIMSEQ_const], auto)
   136 by (erule NSLIMSEQ_le [OF NSLIMSEQ_const], auto)
   137 
   137 
   138 lemma NSLIMSEQ_le_const2: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S (r::real); \<forall>n. X n \<le> a |] ==> r \<le> a"
   138 lemma NSLIMSEQ_le_const2: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S (r::real); \<forall>n. X n \<le> a |] ==> r \<le> a"
   139 by (erule NSLIMSEQ_le [OF _ NSLIMSEQ_const], auto)
   139 by (erule NSLIMSEQ_le [OF _ NSLIMSEQ_const], auto)
   140 
   140 
   141 text{*Shift a convergent series by 1:
   141 text\<open>Shift a convergent series by 1:
   142   By the equivalence between Cauchiness and convergence and because
   142   By the equivalence between Cauchiness and convergence and because
   143   the successor of an infinite hypernatural is also infinite.*}
   143   the successor of an infinite hypernatural is also infinite.\<close>
   144 
   144 
   145 lemma NSLIMSEQ_Suc: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l ==> (%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
   145 lemma NSLIMSEQ_Suc: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l ==> (%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
   146 apply (unfold NSLIMSEQ_def, safe)
   146 apply (unfold NSLIMSEQ_def, safe)
   147 apply (drule_tac x="N + 1" in bspec)
   147 apply (drule_tac x="N + 1" in bspec)
   148 apply (erule HNatInfinite_add)
   148 apply (erule HNatInfinite_add)
   157 done
   157 done
   158 
   158 
   159 lemma NSLIMSEQ_Suc_iff: "((%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S l)"
   159 lemma NSLIMSEQ_Suc_iff: "((%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S l)"
   160 by (blast intro: NSLIMSEQ_imp_Suc NSLIMSEQ_Suc)
   160 by (blast intro: NSLIMSEQ_imp_Suc NSLIMSEQ_Suc)
   161 
   161 
   162 subsubsection {* Equivalence of @{term LIMSEQ} and @{term NSLIMSEQ} *}
   162 subsubsection \<open>Equivalence of @{term LIMSEQ} and @{term NSLIMSEQ}\<close>
   163 
   163 
   164 lemma LIMSEQ_NSLIMSEQ:
   164 lemma LIMSEQ_NSLIMSEQ:
   165   assumes X: "X \<longlonglongrightarrow> L" shows "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L"
   165   assumes X: "X \<longlonglongrightarrow> L" shows "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L"
   166 proof (rule NSLIMSEQ_I)
   166 proof (rule NSLIMSEQ_I)
   167   fix N assume N: "N \<in> HNatInfinite"
   167   fix N assume N: "N \<in> HNatInfinite"
   200 qed
   200 qed
   201 
   201 
   202 theorem LIMSEQ_NSLIMSEQ_iff: "(f \<longlonglongrightarrow> L) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
   202 theorem LIMSEQ_NSLIMSEQ_iff: "(f \<longlonglongrightarrow> L) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
   203 by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ)
   203 by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ)
   204 
   204 
   205 subsubsection {* Derived theorems about @{term NSLIMSEQ} *}
   205 subsubsection \<open>Derived theorems about @{term NSLIMSEQ}\<close>
   206 
   206 
   207 text{*We prove the NS version from the standard one, since the NS proof
   207 text\<open>We prove the NS version from the standard one, since the NS proof
   208    seems more complicated than the standard one above!*}
   208    seems more complicated than the standard one above!\<close>
   209 lemma NSLIMSEQ_norm_zero: "((\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S 0)"
   209 lemma NSLIMSEQ_norm_zero: "((\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S 0)"
   210 by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_norm_zero_iff)
   210 by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_norm_zero_iff)
   211 
   211 
   212 lemma NSLIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S (0::real))"
   212 lemma NSLIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S (0::real))"
   213 by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_rabs_zero_iff)
   213 by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_rabs_zero_iff)
   214 
   214 
   215 text{*Generalization to other limits*}
   215 text\<open>Generalization to other limits\<close>
   216 lemma NSLIMSEQ_imp_rabs: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S (l::real) ==> (%n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>"
   216 lemma NSLIMSEQ_imp_rabs: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S (l::real) ==> (%n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>"
   217 apply (simp add: NSLIMSEQ_def)
   217 apply (simp add: NSLIMSEQ_def)
   218 apply (auto intro: approx_hrabs 
   218 apply (auto intro: approx_hrabs 
   219             simp add: starfun_abs)
   219             simp add: starfun_abs)
   220 done
   220 done
   238 lemma NSLIMSEQ_inverse_real_of_nat_add_minus_mult:
   238 lemma NSLIMSEQ_inverse_real_of_nat_add_minus_mult:
   239      "(%n. r*( 1 + -inverse(real(Suc n)))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r"
   239      "(%n. r*( 1 + -inverse(real(Suc n)))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r"
   240   using LIMSEQ_inverse_real_of_nat_add_minus_mult by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric])
   240   using LIMSEQ_inverse_real_of_nat_add_minus_mult by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric])
   241 
   241 
   242 
   242 
   243 subsection {* Convergence *}
   243 subsection \<open>Convergence\<close>
   244 
   244 
   245 lemma nslimI: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L ==> nslim X = L"
   245 lemma nslimI: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L ==> nslim X = L"
   246 apply (simp add: nslim_def)
   246 apply (simp add: nslim_def)
   247 apply (blast intro: NSLIMSEQ_unique)
   247 apply (blast intro: NSLIMSEQ_unique)
   248 done
   248 done
   261 
   261 
   262 lemma NSconvergent_NSLIMSEQ_iff: "NSconvergent X = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S nslim X)"
   262 lemma NSconvergent_NSLIMSEQ_iff: "NSconvergent X = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S nslim X)"
   263 by (auto intro: theI NSLIMSEQ_unique simp add: NSconvergent_def nslim_def)
   263 by (auto intro: theI NSLIMSEQ_unique simp add: NSconvergent_def nslim_def)
   264 
   264 
   265 
   265 
   266 subsection {* Bounded Monotonic Sequences *}
   266 subsection \<open>Bounded Monotonic Sequences\<close>
   267 
   267 
   268 lemma NSBseqD: "[| NSBseq X;  N: HNatInfinite |] ==> ( *f* X) N : HFinite"
   268 lemma NSBseqD: "[| NSBseq X;  N: HNatInfinite |] ==> ( *f* X) N : HFinite"
   269 by (simp add: NSBseq_def)
   269 by (simp add: NSBseq_def)
   270 
   270 
   271 lemma Standard_subset_HFinite: "Standard \<subseteq> HFinite"
   271 lemma Standard_subset_HFinite: "Standard \<subseteq> HFinite"
   279 done
   279 done
   280 
   280 
   281 lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite ==> NSBseq X"
   281 lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite ==> NSBseq X"
   282 by (simp add: NSBseq_def)
   282 by (simp add: NSBseq_def)
   283 
   283 
   284 text{*The standard definition implies the nonstandard definition*}
   284 text\<open>The standard definition implies the nonstandard definition\<close>
   285 
   285 
   286 lemma Bseq_NSBseq: "Bseq X ==> NSBseq X"
   286 lemma Bseq_NSBseq: "Bseq X ==> NSBseq X"
   287 proof (unfold NSBseq_def, safe)
   287 proof (unfold NSBseq_def, safe)
   288   assume X: "Bseq X"
   288   assume X: "Bseq X"
   289   fix N assume N: "N \<in> HNatInfinite"
   289   fix N assume N: "N \<in> HNatInfinite"
   293   also have "star_of K < star_of (K + 1)" by simp
   293   also have "star_of K < star_of (K + 1)" by simp
   294   finally have "\<exists>x\<in>Reals. hnorm (starfun X N) < x" by (rule bexI, simp)
   294   finally have "\<exists>x\<in>Reals. hnorm (starfun X N) < x" by (rule bexI, simp)
   295   thus "starfun X N \<in> HFinite" by (simp add: HFinite_def)
   295   thus "starfun X N \<in> HFinite" by (simp add: HFinite_def)
   296 qed
   296 qed
   297 
   297 
   298 text{*The nonstandard definition implies the standard definition*}
   298 text\<open>The nonstandard definition implies the standard definition\<close>
   299 
   299 
   300 lemma SReal_less_omega: "r \<in> \<real> \<Longrightarrow> r < \<omega>"
   300 lemma SReal_less_omega: "r \<in> \<real> \<Longrightarrow> r < \<omega>"
   301 apply (insert HInfinite_omega)
   301 apply (insert HInfinite_omega)
   302 apply (simp add: HInfinite_def)
   302 apply (simp add: HInfinite_def)
   303 apply (simp add: order_less_imp_le)
   303 apply (simp add: order_less_imp_le)
   324     by (simp add: HInfinite_def)
   324     by (simp add: HInfinite_def)
   325   with finite show "False"
   325   with finite show "False"
   326     by (simp add: HFinite_HInfinite_iff)
   326     by (simp add: HFinite_HInfinite_iff)
   327 qed
   327 qed
   328 
   328 
   329 text{* Equivalence of nonstandard and standard definitions
   329 text\<open>Equivalence of nonstandard and standard definitions
   330   for a bounded sequence*}
   330   for a bounded sequence\<close>
   331 lemma Bseq_NSBseq_iff: "(Bseq X) = (NSBseq X)"
   331 lemma Bseq_NSBseq_iff: "(Bseq X) = (NSBseq X)"
   332 by (blast intro!: NSBseq_Bseq Bseq_NSBseq)
   332 by (blast intro!: NSBseq_Bseq Bseq_NSBseq)
   333 
   333 
   334 text{*A convergent sequence is bounded: 
   334 text\<open>A convergent sequence is bounded: 
   335  Boundedness as a necessary condition for convergence. 
   335  Boundedness as a necessary condition for convergence. 
   336  The nonstandard version has no existential, as usual *}
   336  The nonstandard version has no existential, as usual\<close>
   337 
   337 
   338 lemma NSconvergent_NSBseq: "NSconvergent X ==> NSBseq X"
   338 lemma NSconvergent_NSBseq: "NSconvergent X ==> NSBseq X"
   339 apply (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def)
   339 apply (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def)
   340 apply (blast intro: HFinite_star_of approx_sym approx_HFinite)
   340 apply (blast intro: HFinite_star_of approx_sym approx_HFinite)
   341 done
   341 done
   342 
   342 
   343 text{*Standard Version: easily now proved using equivalence of NS and
   343 text\<open>Standard Version: easily now proved using equivalence of NS and
   344  standard definitions *}
   344  standard definitions\<close>
   345 
   345 
   346 lemma convergent_Bseq: "convergent X ==> Bseq (X::nat \<Rightarrow> _::real_normed_vector)"
   346 lemma convergent_Bseq: "convergent X ==> Bseq (X::nat \<Rightarrow> _::real_normed_vector)"
   347 by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff)
   347 by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff)
   348 
   348 
   349 subsubsection{*Upper Bounds and Lubs of Bounded Sequences*}
   349 subsubsection\<open>Upper Bounds and Lubs of Bounded Sequences\<close>
   350 
   350 
   351 lemma NSBseq_isUb: "NSBseq X ==> \<exists>U::real. isUb UNIV {x. \<exists>n. X n = x} U"
   351 lemma NSBseq_isUb: "NSBseq X ==> \<exists>U::real. isUb UNIV {x. \<exists>n. X n = x} U"
   352 by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb)
   352 by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb)
   353 
   353 
   354 lemma NSBseq_isLub: "NSBseq X ==> \<exists>U::real. isLub UNIV {x. \<exists>n. X n = x} U"
   354 lemma NSBseq_isLub: "NSBseq X ==> \<exists>U::real. isLub UNIV {x. \<exists>n. X n = x} U"
   355 by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub)
   355 by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub)
   356 
   356 
   357 subsubsection{*A Bounded and Monotonic Sequence Converges*}
   357 subsubsection\<open>A Bounded and Monotonic Sequence Converges\<close>
   358 
   358 
   359 text{* The best of both worlds: Easier to prove this result as a standard
   359 text\<open>The best of both worlds: Easier to prove this result as a standard
   360    theorem and then use equivalence to "transfer" it into the
   360    theorem and then use equivalence to "transfer" it into the
   361    equivalent nonstandard form if needed!*}
   361    equivalent nonstandard form if needed!\<close>
   362 
   362 
   363 lemma Bmonoseq_NSLIMSEQ: "\<forall>n \<ge> m. X n = X m ==> \<exists>L. (X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
   363 lemma Bmonoseq_NSLIMSEQ: "\<forall>n \<ge> m. X n = X m ==> \<exists>L. (X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)"
   364 by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff)
   364 by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff)
   365 
   365 
   366 lemma NSBseq_mono_NSconvergent:
   366 lemma NSBseq_mono_NSconvergent:
   368 by (auto intro: Bseq_mono_convergent 
   368 by (auto intro: Bseq_mono_convergent 
   369          simp add: convergent_NSconvergent_iff [symmetric] 
   369          simp add: convergent_NSconvergent_iff [symmetric] 
   370                    Bseq_NSBseq_iff [symmetric])
   370                    Bseq_NSBseq_iff [symmetric])
   371 
   371 
   372 
   372 
   373 subsection {* Cauchy Sequences *}
   373 subsection \<open>Cauchy Sequences\<close>
   374 
   374 
   375 lemma NSCauchyI:
   375 lemma NSCauchyI:
   376   "(\<And>M N. \<lbrakk>M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk> \<Longrightarrow> starfun X M \<approx> starfun X N)
   376   "(\<And>M N. \<lbrakk>M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk> \<Longrightarrow> starfun X M \<approx> starfun X N)
   377    \<Longrightarrow> NSCauchy X"
   377    \<Longrightarrow> NSCauchy X"
   378 by (simp add: NSCauchy_def)
   378 by (simp add: NSCauchy_def)
   380 lemma NSCauchyD:
   380 lemma NSCauchyD:
   381   "\<lbrakk>NSCauchy X; M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk>
   381   "\<lbrakk>NSCauchy X; M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk>
   382    \<Longrightarrow> starfun X M \<approx> starfun X N"
   382    \<Longrightarrow> starfun X M \<approx> starfun X N"
   383 by (simp add: NSCauchy_def)
   383 by (simp add: NSCauchy_def)
   384 
   384 
   385 subsubsection{*Equivalence Between NS and Standard*}
   385 subsubsection\<open>Equivalence Between NS and Standard\<close>
   386 
   386 
   387 lemma Cauchy_NSCauchy:
   387 lemma Cauchy_NSCauchy:
   388   assumes X: "Cauchy X" shows "NSCauchy X"
   388   assumes X: "Cauchy X" shows "NSCauchy X"
   389 proof (rule NSCauchyI)
   389 proof (rule NSCauchyI)
   390   fix M assume M: "M \<in> HNatInfinite"
   390   fix M assume M: "M \<in> HNatInfinite"
   428 qed
   428 qed
   429 
   429 
   430 theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X"
   430 theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X"
   431 by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy)
   431 by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy)
   432 
   432 
   433 subsubsection {* Cauchy Sequences are Bounded *}
   433 subsubsection \<open>Cauchy Sequences are Bounded\<close>
   434 
   434 
   435 text{*A Cauchy sequence is bounded -- nonstandard version*}
   435 text\<open>A Cauchy sequence is bounded -- nonstandard version\<close>
   436 
   436 
   437 lemma NSCauchy_NSBseq: "NSCauchy X ==> NSBseq X"
   437 lemma NSCauchy_NSBseq: "NSCauchy X ==> NSBseq X"
   438 by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff)
   438 by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff)
   439 
   439 
   440 subsubsection {* Cauchy Sequences are Convergent *}
   440 subsubsection \<open>Cauchy Sequences are Convergent\<close>
   441 
   441 
   442 text{*Equivalence of Cauchy criterion and convergence:
   442 text\<open>Equivalence of Cauchy criterion and convergence:
   443   We will prove this using our NS formulation which provides a
   443   We will prove this using our NS formulation which provides a
   444   much easier proof than using the standard definition. We do not
   444   much easier proof than using the standard definition. We do not
   445   need to use properties of subsequences such as boundedness,
   445   need to use properties of subsequences such as boundedness,
   446   monotonicity etc... Compare with Harrison's corresponding proof
   446   monotonicity etc... Compare with Harrison's corresponding proof
   447   in HOL which is much longer and more complicated. Of course, we do
   447   in HOL which is much longer and more complicated. Of course, we do
   448   not have problems which he encountered with guessing the right
   448   not have problems which he encountered with guessing the right
   449   instantiations for his 'espsilon-delta' proof(s) in this case
   449   instantiations for his 'espsilon-delta' proof(s) in this case
   450   since the NS formulations do not involve existential quantifiers.*}
   450   since the NS formulations do not involve existential quantifiers.\<close>
   451 
   451 
   452 lemma NSconvergent_NSCauchy: "NSconvergent X \<Longrightarrow> NSCauchy X"
   452 lemma NSconvergent_NSCauchy: "NSconvergent X \<Longrightarrow> NSCauchy X"
   453 apply (simp add: NSconvergent_def NSLIMSEQ_def NSCauchy_def, safe)
   453 apply (simp add: NSconvergent_def NSLIMSEQ_def NSCauchy_def, safe)
   454 apply (auto intro: approx_trans2)
   454 apply (auto intro: approx_trans2)
   455 done
   455 done
   477   fixes X :: "nat \<Rightarrow> 'a::banach"
   477   fixes X :: "nat \<Rightarrow> 'a::banach"
   478   shows "NSCauchy X = NSconvergent X"
   478   shows "NSCauchy X = NSconvergent X"
   479 by (fast intro: NSCauchy_NSconvergent NSconvergent_NSCauchy)
   479 by (fast intro: NSCauchy_NSconvergent NSconvergent_NSCauchy)
   480 
   480 
   481 
   481 
   482 subsection {* Power Sequences *}
   482 subsection \<open>Power Sequences\<close>
   483 
   483 
   484 text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term
   484 text\<open>The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term
   485 "x<1"}.  Proof will use (NS) Cauchy equivalence for convergence and
   485 "x<1"}.  Proof will use (NS) Cauchy equivalence for convergence and
   486   also fact that bounded and monotonic sequence converges.*}
   486   also fact that bounded and monotonic sequence converges.\<close>
   487 
   487 
   488 text{* We now use NS criterion to bring proof of theorem through *}
   488 text\<open>We now use NS criterion to bring proof of theorem through\<close>
   489 
   489 
   490 lemma NSLIMSEQ_realpow_zero:
   490 lemma NSLIMSEQ_realpow_zero:
   491   "[| 0 \<le> (x::real); x < 1 |] ==> (%n. x ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
   491   "[| 0 \<le> (x::real); x < 1 |] ==> (%n. x ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
   492 apply (simp add: NSLIMSEQ_def)
   492 apply (simp add: NSLIMSEQ_def)
   493 apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff)
   493 apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff)