author | wenzelm |
Sun, 02 Oct 2016 14:07:43 +0200 | |
changeset 63992 | 3aa9837d05c7 |
parent 63579 | 73939a9b70a3 |
child 64604 | 2bf8cfc98c4d |
permissions | -rw-r--r-- |
62479 | 1 |
(* Title: HOL/Nonstandard_Analysis/HSEQ.thy |
2 |
Author: Jacques D. Fleuriot |
|
3 |
Copyright: 1998 University of Cambridge |
|
4 |
||
5 |
Convergence of sequences and series. |
|
6 |
||
7 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
|
8 |
Additional contributions by Jeremy Avigad and Brian Huffman. |
|
27468 | 9 |
*) |
10 |
||
61975 | 11 |
section \<open>Sequences and Convergence (Nonstandard)\<close> |
27468 | 12 |
|
13 |
theory HSEQ |
|
63579 | 14 |
imports Limits NatStar |
15 |
abbrevs "--->" = "\<longlonglongrightarrow>\<^sub>N\<^sub>S" |
|
27468 | 16 |
begin |
17 |
||
18 |
definition |
|
19 |
NSLIMSEQ :: "[nat => 'a::real_normed_vector, 'a] => bool" |
|
61970 | 20 |
("((_)/ \<longlonglongrightarrow>\<^sub>N\<^sub>S (_))" [60, 60] 60) where |
61975 | 21 |
\<comment>\<open>Nonstandard definition of convergence of sequence\<close> |
61970 | 22 |
"X \<longlonglongrightarrow>\<^sub>N\<^sub>S L = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)" |
27468 | 23 |
|
24 |
definition |
|
25 |
nslim :: "(nat => 'a::real_normed_vector) => 'a" where |
|
61975 | 26 |
\<comment>\<open>Nonstandard definition of limit using choice operator\<close> |
61970 | 27 |
"nslim X = (THE L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" |
27468 | 28 |
|
29 |
definition |
|
30 |
NSconvergent :: "(nat => 'a::real_normed_vector) => bool" where |
|
61975 | 31 |
\<comment>\<open>Nonstandard definition of convergence\<close> |
61970 | 32 |
"NSconvergent X = (\<exists>L. X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" |
27468 | 33 |
|
34 |
definition |
|
35 |
NSBseq :: "(nat => 'a::real_normed_vector) => bool" where |
|
61975 | 36 |
\<comment>\<open>Nonstandard definition for bounded sequence\<close> |
37765 | 37 |
"NSBseq X = (\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite)" |
27468 | 38 |
|
39 |
definition |
|
40 |
NSCauchy :: "(nat => 'a::real_normed_vector) => bool" where |
|
61975 | 41 |
\<comment>\<open>Nonstandard definition\<close> |
37765 | 42 |
"NSCauchy X = (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite. ( *f* X) M \<approx> ( *f* X) N)" |
27468 | 43 |
|
61975 | 44 |
subsection \<open>Limits of Sequences\<close> |
27468 | 45 |
|
46 |
lemma NSLIMSEQ_iff: |
|
61970 | 47 |
"(X \<longlonglongrightarrow>\<^sub>N\<^sub>S L) = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> star_of L)" |
27468 | 48 |
by (simp add: NSLIMSEQ_def) |
49 |
||
50 |
lemma NSLIMSEQ_I: |
|
61970 | 51 |
"(\<And>N. N \<in> HNatInfinite \<Longrightarrow> starfun X N \<approx> star_of L) \<Longrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S L" |
27468 | 52 |
by (simp add: NSLIMSEQ_def) |
53 |
||
54 |
lemma NSLIMSEQ_D: |
|
61970 | 55 |
"\<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S L; N \<in> HNatInfinite\<rbrakk> \<Longrightarrow> starfun X N \<approx> star_of L" |
27468 | 56 |
by (simp add: NSLIMSEQ_def) |
57 |
||
61970 | 58 |
lemma NSLIMSEQ_const: "(%n. k) \<longlonglongrightarrow>\<^sub>N\<^sub>S k" |
27468 | 59 |
by (simp add: NSLIMSEQ_def) |
60 |
||
61 |
lemma NSLIMSEQ_add: |
|
61970 | 62 |
"[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> (%n. X n + Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + b" |
27468 | 63 |
by (auto intro: approx_add simp add: NSLIMSEQ_def starfun_add [symmetric]) |
64 |
||
61970 | 65 |
lemma NSLIMSEQ_add_const: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S a ==> (%n.(f n + b)) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + b" |
27468 | 66 |
by (simp only: NSLIMSEQ_add NSLIMSEQ_const) |
67 |
||
68 |
lemma NSLIMSEQ_mult: |
|
69 |
fixes a b :: "'a::real_normed_algebra" |
|
61970 | 70 |
shows "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> (%n. X n * Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a * b" |
27468 | 71 |
by (auto intro!: approx_mult_HFinite simp add: NSLIMSEQ_def) |
72 |
||
61970 | 73 |
lemma NSLIMSEQ_minus: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a ==> (%n. -(X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S -a" |
27468 | 74 |
by (auto simp add: NSLIMSEQ_def) |
75 |
||
61970 | 76 |
lemma NSLIMSEQ_minus_cancel: "(%n. -(X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S -a ==> X \<longlonglongrightarrow>\<^sub>N\<^sub>S a" |
27468 | 77 |
by (drule NSLIMSEQ_minus, simp) |
78 |
||
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
79 |
lemma NSLIMSEQ_diff: |
61970 | 80 |
"[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> (%n. X n - Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
81 |
using NSLIMSEQ_add [of X a "- Y" "- b"] by (simp add: NSLIMSEQ_minus fun_Compl_def) |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
82 |
|
27468 | 83 |
(* FIXME: delete *) |
84 |
lemma NSLIMSEQ_add_minus: |
|
61970 | 85 |
"[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> (%n. X n + -Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + -b" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
86 |
by (simp add: NSLIMSEQ_diff) |
27468 | 87 |
|
61970 | 88 |
lemma NSLIMSEQ_diff_const: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S a ==> (%n.(f n - b)) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b" |
27468 | 89 |
by (simp add: NSLIMSEQ_diff NSLIMSEQ_const) |
90 |
||
91 |
lemma NSLIMSEQ_inverse: |
|
92 |
fixes a :: "'a::real_normed_div_algebra" |
|
61970 | 93 |
shows "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; a ~= 0 |] ==> (%n. inverse(X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S inverse(a)" |
27468 | 94 |
by (simp add: NSLIMSEQ_def star_of_approx_inverse) |
95 |
||
96 |
lemma NSLIMSEQ_mult_inverse: |
|
97 |
fixes a b :: "'a::real_normed_field" |
|
98 |
shows |
|
61970 | 99 |
"[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b; b ~= 0 |] ==> (%n. X n / Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a/b" |
27468 | 100 |
by (simp add: NSLIMSEQ_mult NSLIMSEQ_inverse divide_inverse) |
101 |
||
102 |
lemma starfun_hnorm: "\<And>x. hnorm (( *f* f) x) = ( *f* (\<lambda>x. norm (f x))) x" |
|
103 |
by transfer simp |
|
104 |
||
61970 | 105 |
lemma NSLIMSEQ_norm: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S norm a" |
27468 | 106 |
by (simp add: NSLIMSEQ_def starfun_hnorm [symmetric] approx_hnorm) |
107 |
||
61975 | 108 |
text\<open>Uniqueness of limit\<close> |
61970 | 109 |
lemma NSLIMSEQ_unique: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; X \<longlonglongrightarrow>\<^sub>N\<^sub>S b |] ==> a = b" |
27468 | 110 |
apply (simp add: NSLIMSEQ_def) |
111 |
apply (drule HNatInfinite_whn [THEN [2] bspec])+ |
|
112 |
apply (auto dest: approx_trans3) |
|
113 |
done |
|
114 |
||
115 |
lemma NSLIMSEQ_pow [rule_format]: |
|
31017 | 116 |
fixes a :: "'a::{real_normed_algebra,power}" |
61970 | 117 |
shows "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S a) --> ((%n. (X n) ^ m) \<longlonglongrightarrow>\<^sub>N\<^sub>S a ^ m)" |
27468 | 118 |
apply (induct "m") |
119 |
apply (auto simp add: power_Suc intro: NSLIMSEQ_mult NSLIMSEQ_const) |
|
120 |
done |
|
121 |
||
61975 | 122 |
text\<open>We can now try and derive a few properties of sequences, |
123 |
starting with the limit comparison property for sequences.\<close> |
|
27468 | 124 |
|
125 |
lemma NSLIMSEQ_le: |
|
61970 | 126 |
"[| f \<longlonglongrightarrow>\<^sub>N\<^sub>S l; g \<longlonglongrightarrow>\<^sub>N\<^sub>S m; |
27468 | 127 |
\<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n) |
128 |
|] ==> l \<le> (m::real)" |
|
129 |
apply (simp add: NSLIMSEQ_def, safe) |
|
130 |
apply (drule starfun_le_mono) |
|
131 |
apply (drule HNatInfinite_whn [THEN [2] bspec])+ |
|
132 |
apply (drule_tac x = whn in spec) |
|
133 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2])+ |
|
134 |
apply clarify |
|
135 |
apply (auto intro: hypreal_of_real_le_add_Infininitesimal_cancel2) |
|
136 |
done |
|
137 |
||
61970 | 138 |
lemma NSLIMSEQ_le_const: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S (r::real); \<forall>n. a \<le> X n |] ==> a \<le> r" |
27468 | 139 |
by (erule NSLIMSEQ_le [OF NSLIMSEQ_const], auto) |
140 |
||
61970 | 141 |
lemma NSLIMSEQ_le_const2: "[| X \<longlonglongrightarrow>\<^sub>N\<^sub>S (r::real); \<forall>n. X n \<le> a |] ==> r \<le> a" |
27468 | 142 |
by (erule NSLIMSEQ_le [OF _ NSLIMSEQ_const], auto) |
143 |
||
61975 | 144 |
text\<open>Shift a convergent series by 1: |
27468 | 145 |
By the equivalence between Cauchiness and convergence and because |
61975 | 146 |
the successor of an infinite hypernatural is also infinite.\<close> |
27468 | 147 |
|
61970 | 148 |
lemma NSLIMSEQ_Suc: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l ==> (%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l" |
27468 | 149 |
apply (unfold NSLIMSEQ_def, safe) |
150 |
apply (drule_tac x="N + 1" in bspec) |
|
151 |
apply (erule HNatInfinite_add) |
|
152 |
apply (simp add: starfun_shift_one) |
|
153 |
done |
|
154 |
||
61970 | 155 |
lemma NSLIMSEQ_imp_Suc: "(%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l ==> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l" |
27468 | 156 |
apply (unfold NSLIMSEQ_def, safe) |
157 |
apply (drule_tac x="N - 1" in bspec) |
|
158 |
apply (erule Nats_1 [THEN [2] HNatInfinite_diff]) |
|
159 |
apply (simp add: starfun_shift_one one_le_HNatInfinite) |
|
160 |
done |
|
161 |
||
61970 | 162 |
lemma NSLIMSEQ_Suc_iff: "((%n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S l)" |
27468 | 163 |
by (blast intro: NSLIMSEQ_imp_Suc NSLIMSEQ_Suc) |
164 |
||
61975 | 165 |
subsubsection \<open>Equivalence of @{term LIMSEQ} and @{term NSLIMSEQ}\<close> |
27468 | 166 |
|
167 |
lemma LIMSEQ_NSLIMSEQ: |
|
61970 | 168 |
assumes X: "X \<longlonglongrightarrow> L" shows "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L" |
27468 | 169 |
proof (rule NSLIMSEQ_I) |
170 |
fix N assume N: "N \<in> HNatInfinite" |
|
171 |
have "starfun X N - star_of L \<in> Infinitesimal" |
|
172 |
proof (rule InfinitesimalI2) |
|
173 |
fix r::real assume r: "0 < r" |
|
174 |
from LIMSEQ_D [OF X r] |
|
175 |
obtain no where "\<forall>n\<ge>no. norm (X n - L) < r" .. |
|
176 |
hence "\<forall>n\<ge>star_of no. hnorm (starfun X n - star_of L) < star_of r" |
|
177 |
by transfer |
|
178 |
thus "hnorm (starfun X N - star_of L) < star_of r" |
|
179 |
using N by (simp add: star_of_le_HNatInfinite) |
|
180 |
qed |
|
181 |
thus "starfun X N \<approx> star_of L" |
|
182 |
by (unfold approx_def) |
|
183 |
qed |
|
184 |
||
185 |
lemma NSLIMSEQ_LIMSEQ: |
|
61970 | 186 |
assumes X: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L" shows "X \<longlonglongrightarrow> L" |
27468 | 187 |
proof (rule LIMSEQ_I) |
188 |
fix r::real assume r: "0 < r" |
|
189 |
have "\<exists>no. \<forall>n\<ge>no. hnorm (starfun X n - star_of L) < star_of r" |
|
190 |
proof (intro exI allI impI) |
|
191 |
fix n assume "whn \<le> n" |
|
192 |
with HNatInfinite_whn have "n \<in> HNatInfinite" |
|
193 |
by (rule HNatInfinite_upward_closed) |
|
194 |
with X have "starfun X n \<approx> star_of L" |
|
195 |
by (rule NSLIMSEQ_D) |
|
196 |
hence "starfun X n - star_of L \<in> Infinitesimal" |
|
197 |
by (unfold approx_def) |
|
198 |
thus "hnorm (starfun X n - star_of L) < star_of r" |
|
199 |
using r by (rule InfinitesimalD2) |
|
200 |
qed |
|
201 |
thus "\<exists>no. \<forall>n\<ge>no. norm (X n - L) < r" |
|
202 |
by transfer |
|
203 |
qed |
|
204 |
||
61970 | 205 |
theorem LIMSEQ_NSLIMSEQ_iff: "(f \<longlonglongrightarrow> L) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" |
27468 | 206 |
by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ) |
207 |
||
61975 | 208 |
subsubsection \<open>Derived theorems about @{term NSLIMSEQ}\<close> |
27468 | 209 |
|
61975 | 210 |
text\<open>We prove the NS version from the standard one, since the NS proof |
211 |
seems more complicated than the standard one above!\<close> |
|
61970 | 212 |
lemma NSLIMSEQ_norm_zero: "((\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S 0)" |
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
37765
diff
changeset
|
213 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_norm_zero_iff) |
27468 | 214 |
|
61970 | 215 |
lemma NSLIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0) = (f \<longlonglongrightarrow>\<^sub>N\<^sub>S (0::real))" |
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
37765
diff
changeset
|
216 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_rabs_zero_iff) |
27468 | 217 |
|
61975 | 218 |
text\<open>Generalization to other limits\<close> |
61970 | 219 |
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>" |
27468 | 220 |
apply (simp add: NSLIMSEQ_def) |
221 |
apply (auto intro: approx_hrabs |
|
222 |
simp add: starfun_abs) |
|
223 |
done |
|
224 |
||
225 |
lemma NSLIMSEQ_inverse_zero: |
|
226 |
"\<forall>y::real. \<exists>N. \<forall>n \<ge> N. y < f(n) |
|
61970 | 227 |
==> (%n. inverse(f n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" |
27468 | 228 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_zero) |
229 |
||
61970 | 230 |
lemma NSLIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61284
diff
changeset
|
231 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat del: of_nat_Suc) |
27468 | 232 |
|
233 |
lemma NSLIMSEQ_inverse_real_of_nat_add: |
|
61970 | 234 |
"(%n. r + inverse(real(Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r" |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61284
diff
changeset
|
235 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add del: of_nat_Suc) |
27468 | 236 |
|
237 |
lemma NSLIMSEQ_inverse_real_of_nat_add_minus: |
|
61970 | 238 |
"(%n. r + -inverse(real(Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
239 |
using LIMSEQ_inverse_real_of_nat_add_minus by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric]) |
27468 | 240 |
|
241 |
lemma NSLIMSEQ_inverse_real_of_nat_add_minus_mult: |
|
61970 | 242 |
"(%n. r*( 1 + -inverse(real(Suc n)))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51525
diff
changeset
|
243 |
using LIMSEQ_inverse_real_of_nat_add_minus_mult by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric]) |
27468 | 244 |
|
245 |
||
61975 | 246 |
subsection \<open>Convergence\<close> |
27468 | 247 |
|
61970 | 248 |
lemma nslimI: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S L ==> nslim X = L" |
27468 | 249 |
apply (simp add: nslim_def) |
250 |
apply (blast intro: NSLIMSEQ_unique) |
|
251 |
done |
|
252 |
||
253 |
lemma lim_nslim_iff: "lim X = nslim X" |
|
254 |
by (simp add: lim_def nslim_def LIMSEQ_NSLIMSEQ_iff) |
|
255 |
||
61970 | 256 |
lemma NSconvergentD: "NSconvergent X ==> \<exists>L. (X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" |
27468 | 257 |
by (simp add: NSconvergent_def) |
258 |
||
61970 | 259 |
lemma NSconvergentI: "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S L) ==> NSconvergent X" |
27468 | 260 |
by (auto simp add: NSconvergent_def) |
261 |
||
262 |
lemma convergent_NSconvergent_iff: "convergent X = NSconvergent X" |
|
263 |
by (simp add: convergent_def NSconvergent_def LIMSEQ_NSLIMSEQ_iff) |
|
264 |
||
61970 | 265 |
lemma NSconvergent_NSLIMSEQ_iff: "NSconvergent X = (X \<longlonglongrightarrow>\<^sub>N\<^sub>S nslim X)" |
27468 | 266 |
by (auto intro: theI NSLIMSEQ_unique simp add: NSconvergent_def nslim_def) |
267 |
||
268 |
||
61975 | 269 |
subsection \<open>Bounded Monotonic Sequences\<close> |
27468 | 270 |
|
271 |
lemma NSBseqD: "[| NSBseq X; N: HNatInfinite |] ==> ( *f* X) N : HFinite" |
|
272 |
by (simp add: NSBseq_def) |
|
273 |
||
274 |
lemma Standard_subset_HFinite: "Standard \<subseteq> HFinite" |
|
275 |
unfolding Standard_def by auto |
|
276 |
||
277 |
lemma NSBseqD2: "NSBseq X \<Longrightarrow> ( *f* X) N \<in> HFinite" |
|
278 |
apply (cases "N \<in> HNatInfinite") |
|
279 |
apply (erule (1) NSBseqD) |
|
280 |
apply (rule subsetD [OF Standard_subset_HFinite]) |
|
281 |
apply (simp add: HNatInfinite_def Nats_eq_Standard) |
|
282 |
done |
|
283 |
||
284 |
lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite ==> NSBseq X" |
|
285 |
by (simp add: NSBseq_def) |
|
286 |
||
61975 | 287 |
text\<open>The standard definition implies the nonstandard definition\<close> |
27468 | 288 |
|
289 |
lemma Bseq_NSBseq: "Bseq X ==> NSBseq X" |
|
290 |
proof (unfold NSBseq_def, safe) |
|
291 |
assume X: "Bseq X" |
|
292 |
fix N assume N: "N \<in> HNatInfinite" |
|
293 |
from BseqD [OF X] obtain K where "\<forall>n. norm (X n) \<le> K" by fast |
|
294 |
hence "\<forall>N. hnorm (starfun X N) \<le> star_of K" by transfer |
|
295 |
hence "hnorm (starfun X N) \<le> star_of K" by simp |
|
296 |
also have "star_of K < star_of (K + 1)" by simp |
|
297 |
finally have "\<exists>x\<in>Reals. hnorm (starfun X N) < x" by (rule bexI, simp) |
|
298 |
thus "starfun X N \<in> HFinite" by (simp add: HFinite_def) |
|
299 |
qed |
|
300 |
||
61975 | 301 |
text\<open>The nonstandard definition implies the standard definition\<close> |
27468 | 302 |
|
303 |
lemma SReal_less_omega: "r \<in> \<real> \<Longrightarrow> r < \<omega>" |
|
304 |
apply (insert HInfinite_omega) |
|
305 |
apply (simp add: HInfinite_def) |
|
306 |
apply (simp add: order_less_imp_le) |
|
307 |
done |
|
308 |
||
309 |
lemma NSBseq_Bseq: "NSBseq X \<Longrightarrow> Bseq X" |
|
310 |
proof (rule ccontr) |
|
311 |
let ?n = "\<lambda>K. LEAST n. K < norm (X n)" |
|
312 |
assume "NSBseq X" |
|
313 |
hence finite: "( *f* X) (( *f* ?n) \<omega>) \<in> HFinite" |
|
314 |
by (rule NSBseqD2) |
|
315 |
assume "\<not> Bseq X" |
|
316 |
hence "\<forall>K>0. \<exists>n. K < norm (X n)" |
|
317 |
by (simp add: Bseq_def linorder_not_le) |
|
318 |
hence "\<forall>K>0. K < norm (X (?n K))" |
|
319 |
by (auto intro: LeastI_ex) |
|
320 |
hence "\<forall>K>0. K < hnorm (( *f* X) (( *f* ?n) K))" |
|
321 |
by transfer |
|
322 |
hence "\<omega> < hnorm (( *f* X) (( *f* ?n) \<omega>))" |
|
323 |
by simp |
|
324 |
hence "\<forall>r\<in>\<real>. r < hnorm (( *f* X) (( *f* ?n) \<omega>))" |
|
325 |
by (simp add: order_less_trans [OF SReal_less_omega]) |
|
326 |
hence "( *f* X) (( *f* ?n) \<omega>) \<in> HInfinite" |
|
327 |
by (simp add: HInfinite_def) |
|
328 |
with finite show "False" |
|
329 |
by (simp add: HFinite_HInfinite_iff) |
|
330 |
qed |
|
331 |
||
61975 | 332 |
text\<open>Equivalence of nonstandard and standard definitions |
333 |
for a bounded sequence\<close> |
|
27468 | 334 |
lemma Bseq_NSBseq_iff: "(Bseq X) = (NSBseq X)" |
335 |
by (blast intro!: NSBseq_Bseq Bseq_NSBseq) |
|
336 |
||
61975 | 337 |
text\<open>A convergent sequence is bounded: |
27468 | 338 |
Boundedness as a necessary condition for convergence. |
61975 | 339 |
The nonstandard version has no existential, as usual\<close> |
27468 | 340 |
|
341 |
lemma NSconvergent_NSBseq: "NSconvergent X ==> NSBseq X" |
|
342 |
apply (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def) |
|
343 |
apply (blast intro: HFinite_star_of approx_sym approx_HFinite) |
|
344 |
done |
|
345 |
||
61975 | 346 |
text\<open>Standard Version: easily now proved using equivalence of NS and |
347 |
standard definitions\<close> |
|
27468 | 348 |
|
51474
1e9e68247ad1
generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
hoelzl
parents:
44568
diff
changeset
|
349 |
lemma convergent_Bseq: "convergent X ==> Bseq (X::nat \<Rightarrow> _::real_normed_vector)" |
27468 | 350 |
by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff) |
351 |
||
61975 | 352 |
subsubsection\<open>Upper Bounds and Lubs of Bounded Sequences\<close> |
27468 | 353 |
|
354 |
lemma NSBseq_isUb: "NSBseq X ==> \<exists>U::real. isUb UNIV {x. \<exists>n. X n = x} U" |
|
355 |
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb) |
|
356 |
||
357 |
lemma NSBseq_isLub: "NSBseq X ==> \<exists>U::real. isLub UNIV {x. \<exists>n. X n = x} U" |
|
358 |
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub) |
|
359 |
||
61975 | 360 |
subsubsection\<open>A Bounded and Monotonic Sequence Converges\<close> |
27468 | 361 |
|
61975 | 362 |
text\<open>The best of both worlds: Easier to prove this result as a standard |
27468 | 363 |
theorem and then use equivalence to "transfer" it into the |
61975 | 364 |
equivalent nonstandard form if needed!\<close> |
27468 | 365 |
|
61970 | 366 |
lemma Bmonoseq_NSLIMSEQ: "\<forall>n \<ge> m. X n = X m ==> \<exists>L. (X \<longlonglongrightarrow>\<^sub>N\<^sub>S L)" |
27468 | 367 |
by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff) |
368 |
||
369 |
lemma NSBseq_mono_NSconvergent: |
|
370 |
"[| NSBseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> NSconvergent (X::nat=>real)" |
|
371 |
by (auto intro: Bseq_mono_convergent |
|
372 |
simp add: convergent_NSconvergent_iff [symmetric] |
|
373 |
Bseq_NSBseq_iff [symmetric]) |
|
374 |
||
375 |
||
61975 | 376 |
subsection \<open>Cauchy Sequences\<close> |
27468 | 377 |
|
378 |
lemma NSCauchyI: |
|
379 |
"(\<And>M N. \<lbrakk>M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk> \<Longrightarrow> starfun X M \<approx> starfun X N) |
|
380 |
\<Longrightarrow> NSCauchy X" |
|
381 |
by (simp add: NSCauchy_def) |
|
382 |
||
383 |
lemma NSCauchyD: |
|
384 |
"\<lbrakk>NSCauchy X; M \<in> HNatInfinite; N \<in> HNatInfinite\<rbrakk> |
|
385 |
\<Longrightarrow> starfun X M \<approx> starfun X N" |
|
386 |
by (simp add: NSCauchy_def) |
|
387 |
||
61975 | 388 |
subsubsection\<open>Equivalence Between NS and Standard\<close> |
27468 | 389 |
|
390 |
lemma Cauchy_NSCauchy: |
|
391 |
assumes X: "Cauchy X" shows "NSCauchy X" |
|
392 |
proof (rule NSCauchyI) |
|
393 |
fix M assume M: "M \<in> HNatInfinite" |
|
394 |
fix N assume N: "N \<in> HNatInfinite" |
|
395 |
have "starfun X M - starfun X N \<in> Infinitesimal" |
|
396 |
proof (rule InfinitesimalI2) |
|
397 |
fix r :: real assume r: "0 < r" |
|
398 |
from CauchyD [OF X r] |
|
399 |
obtain k where "\<forall>m\<ge>k. \<forall>n\<ge>k. norm (X m - X n) < r" .. |
|
400 |
hence "\<forall>m\<ge>star_of k. \<forall>n\<ge>star_of k. |
|
401 |
hnorm (starfun X m - starfun X n) < star_of r" |
|
402 |
by transfer |
|
403 |
thus "hnorm (starfun X M - starfun X N) < star_of r" |
|
404 |
using M N by (simp add: star_of_le_HNatInfinite) |
|
405 |
qed |
|
406 |
thus "starfun X M \<approx> starfun X N" |
|
407 |
by (unfold approx_def) |
|
408 |
qed |
|
409 |
||
410 |
lemma NSCauchy_Cauchy: |
|
411 |
assumes X: "NSCauchy X" shows "Cauchy X" |
|
412 |
proof (rule CauchyI) |
|
413 |
fix r::real assume r: "0 < r" |
|
414 |
have "\<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. hnorm (starfun X m - starfun X n) < star_of r" |
|
415 |
proof (intro exI allI impI) |
|
416 |
fix M assume "whn \<le> M" |
|
417 |
with HNatInfinite_whn have M: "M \<in> HNatInfinite" |
|
418 |
by (rule HNatInfinite_upward_closed) |
|
419 |
fix N assume "whn \<le> N" |
|
420 |
with HNatInfinite_whn have N: "N \<in> HNatInfinite" |
|
421 |
by (rule HNatInfinite_upward_closed) |
|
422 |
from X M N have "starfun X M \<approx> starfun X N" |
|
423 |
by (rule NSCauchyD) |
|
424 |
hence "starfun X M - starfun X N \<in> Infinitesimal" |
|
425 |
by (unfold approx_def) |
|
426 |
thus "hnorm (starfun X M - starfun X N) < star_of r" |
|
427 |
using r by (rule InfinitesimalD2) |
|
428 |
qed |
|
429 |
thus "\<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. norm (X m - X n) < r" |
|
430 |
by transfer |
|
431 |
qed |
|
432 |
||
433 |
theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X" |
|
434 |
by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy) |
|
435 |
||
61975 | 436 |
subsubsection \<open>Cauchy Sequences are Bounded\<close> |
27468 | 437 |
|
61975 | 438 |
text\<open>A Cauchy sequence is bounded -- nonstandard version\<close> |
27468 | 439 |
|
440 |
lemma NSCauchy_NSBseq: "NSCauchy X ==> NSBseq X" |
|
441 |
by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff) |
|
442 |
||
61975 | 443 |
subsubsection \<open>Cauchy Sequences are Convergent\<close> |
27468 | 444 |
|
61975 | 445 |
text\<open>Equivalence of Cauchy criterion and convergence: |
27468 | 446 |
We will prove this using our NS formulation which provides a |
447 |
much easier proof than using the standard definition. We do not |
|
448 |
need to use properties of subsequences such as boundedness, |
|
449 |
monotonicity etc... Compare with Harrison's corresponding proof |
|
450 |
in HOL which is much longer and more complicated. Of course, we do |
|
451 |
not have problems which he encountered with guessing the right |
|
452 |
instantiations for his 'espsilon-delta' proof(s) in this case |
|
61975 | 453 |
since the NS formulations do not involve existential quantifiers.\<close> |
27468 | 454 |
|
455 |
lemma NSconvergent_NSCauchy: "NSconvergent X \<Longrightarrow> NSCauchy X" |
|
456 |
apply (simp add: NSconvergent_def NSLIMSEQ_def NSCauchy_def, safe) |
|
457 |
apply (auto intro: approx_trans2) |
|
458 |
done |
|
459 |
||
460 |
lemma real_NSCauchy_NSconvergent: |
|
461 |
fixes X :: "nat \<Rightarrow> real" |
|
462 |
shows "NSCauchy X \<Longrightarrow> NSconvergent X" |
|
463 |
apply (simp add: NSconvergent_def NSLIMSEQ_def) |
|
464 |
apply (frule NSCauchy_NSBseq) |
|
465 |
apply (simp add: NSBseq_def NSCauchy_def) |
|
466 |
apply (drule HNatInfinite_whn [THEN [2] bspec]) |
|
467 |
apply (drule HNatInfinite_whn [THEN [2] bspec]) |
|
468 |
apply (auto dest!: st_part_Ex simp add: SReal_iff) |
|
469 |
apply (blast intro: approx_trans3) |
|
470 |
done |
|
471 |
||
472 |
lemma NSCauchy_NSconvergent: |
|
473 |
fixes X :: "nat \<Rightarrow> 'a::banach" |
|
474 |
shows "NSCauchy X \<Longrightarrow> NSconvergent X" |
|
475 |
apply (drule NSCauchy_Cauchy [THEN Cauchy_convergent]) |
|
476 |
apply (erule convergent_NSconvergent_iff [THEN iffD1]) |
|
477 |
done |
|
478 |
||
479 |
lemma NSCauchy_NSconvergent_iff: |
|
480 |
fixes X :: "nat \<Rightarrow> 'a::banach" |
|
481 |
shows "NSCauchy X = NSconvergent X" |
|
482 |
by (fast intro: NSCauchy_NSconvergent NSconvergent_NSCauchy) |
|
483 |
||
484 |
||
61975 | 485 |
subsection \<open>Power Sequences\<close> |
27468 | 486 |
|
61975 | 487 |
text\<open>The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term |
27468 | 488 |
"x<1"}. Proof will use (NS) Cauchy equivalence for convergence and |
61975 | 489 |
also fact that bounded and monotonic sequence converges.\<close> |
27468 | 490 |
|
61975 | 491 |
text\<open>We now use NS criterion to bring proof of theorem through\<close> |
27468 | 492 |
|
493 |
lemma NSLIMSEQ_realpow_zero: |
|
61970 | 494 |
"[| 0 \<le> (x::real); x < 1 |] ==> (%n. x ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" |
27468 | 495 |
apply (simp add: NSLIMSEQ_def) |
496 |
apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff) |
|
497 |
apply (frule NSconvergentD) |
|
498 |
apply (auto simp add: NSLIMSEQ_def NSCauchy_NSconvergent_iff [symmetric] NSCauchy_def starfun_pow) |
|
499 |
apply (frule HNatInfinite_add_one) |
|
500 |
apply (drule bspec, assumption) |
|
501 |
apply (drule bspec, assumption) |
|
502 |
apply (drule_tac x = "N + (1::hypnat) " in bspec, assumption) |
|
503 |
apply (simp add: hyperpow_add) |
|
504 |
apply (drule approx_mult_subst_star_of, assumption) |
|
505 |
apply (drule approx_trans3, assumption) |
|
506 |
apply (auto simp del: star_of_mult simp add: star_of_mult [symmetric]) |
|
507 |
done |
|
508 |
||
61970 | 509 |
lemma NSLIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < (1::real) ==> (%n. \<bar>c\<bar> ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" |
27468 | 510 |
by (simp add: LIMSEQ_rabs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric]) |
511 |
||
61970 | 512 |
lemma NSLIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < (1::real) ==> (%n. c ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0" |
27468 | 513 |
by (simp add: LIMSEQ_rabs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric]) |
514 |
||
515 |
(***--------------------------------------------------------------- |
|
516 |
Theorems proved by Harrison in HOL that we do not need |
|
517 |
in order to prove equivalence between Cauchy criterion |
|
518 |
and convergence: |
|
519 |
-- Show that every sequence contains a monotonic subsequence |
|
520 |
Goal "\<exists>f. subseq f & monoseq (%n. s (f n))" |
|
521 |
-- Show that a subsequence of a bounded sequence is bounded |
|
522 |
Goal "Bseq X ==> Bseq (%n. X (f n))"; |
|
523 |
-- Show we can take subsequential terms arbitrarily far |
|
524 |
up a sequence |
|
525 |
Goal "subseq f ==> n \<le> f(n)"; |
|
526 |
Goal "subseq f ==> \<exists>n. N1 \<le> n & N2 \<le> f(n)"; |
|
527 |
---------------------------------------------------------------***) |
|
528 |
||
529 |
end |