author | wenzelm |
Fri, 02 Jun 2006 23:22:29 +0200 | |
changeset 19765 | dfe940911617 |
parent 18585 | 5d379fe2eb74 |
child 20217 | 25b068a99d2b |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : SEQ.thy |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : Convergence of sequences and series |
|
15082 | 5 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
16819 | 6 |
Additional contributions by Jeremy Avigad |
15082 | 7 |
*) |
10751 | 8 |
|
17439 | 9 |
header {* Sequences and Series *} |
10 |
||
15131 | 11 |
theory SEQ |
15236
f289e8ba2bb3
Proofs needed to be updated because induction now preserves name of
nipkow
parents:
15229
diff
changeset
|
12 |
imports NatStar |
15131 | 13 |
begin |
10751 | 14 |
|
19765 | 15 |
definition |
10751 | 16 |
|
15082 | 17 |
LIMSEQ :: "[nat=>real,real] => bool" ("((_)/ ----> (_))" [60, 60] 60) |
18 |
--{*Standard definition of convergence of sequence*} |
|
19765 | 19 |
"X ----> L = (\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>X n + -L\<bar> < r))" |
10751 | 20 |
|
15082 | 21 |
NSLIMSEQ :: "[nat=>real,real] => bool" ("((_)/ ----NS> (_))" [60, 60] 60) |
22 |
--{*Nonstandard definition of convergence of sequence*} |
|
19765 | 23 |
"X ----NS> L = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> hypreal_of_real L)" |
15082 | 24 |
|
25 |
lim :: "(nat => real) => real" |
|
26 |
--{*Standard definition of limit using choice operator*} |
|
19765 | 27 |
"lim X = (SOME L. (X ----> L))" |
10751 | 28 |
|
15082 | 29 |
nslim :: "(nat => real) => real" |
30 |
--{*Nonstandard definition of limit using choice operator*} |
|
19765 | 31 |
"nslim X = (SOME L. (X ----NS> L))" |
10751 | 32 |
|
15082 | 33 |
convergent :: "(nat => real) => bool" |
34 |
--{*Standard definition of convergence*} |
|
19765 | 35 |
"convergent X = (\<exists>L. (X ----> L))" |
10751 | 36 |
|
15082 | 37 |
NSconvergent :: "(nat => real) => bool" |
38 |
--{*Nonstandard definition of convergence*} |
|
19765 | 39 |
"NSconvergent X = (\<exists>L. (X ----NS> L))" |
15082 | 40 |
|
41 |
Bseq :: "(nat => real) => bool" |
|
42 |
--{*Standard definition for bounded sequence*} |
|
19765 | 43 |
"Bseq X = (\<exists>K>0.\<forall>n. \<bar>X n\<bar> \<le> K)" |
10751 | 44 |
|
15082 | 45 |
NSBseq :: "(nat=>real) => bool" |
46 |
--{*Nonstandard definition for bounded sequence*} |
|
19765 | 47 |
"NSBseq X = (\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite)" |
15082 | 48 |
|
49 |
monoseq :: "(nat=>real)=>bool" |
|
50 |
--{*Definition for monotonicity*} |
|
19765 | 51 |
"monoseq X = ((\<forall>m. \<forall>n\<ge>m. X m \<le> X n) | (\<forall>m. \<forall>n\<ge>m. X n \<le> X m))" |
10751 | 52 |
|
15082 | 53 |
subseq :: "(nat => nat) => bool" |
54 |
--{*Definition of subsequence*} |
|
19765 | 55 |
"subseq f = (\<forall>m. \<forall>n>m. (f m) < (f n))" |
10751 | 56 |
|
15082 | 57 |
Cauchy :: "(nat => real) => bool" |
58 |
--{*Standard definition of the Cauchy condition*} |
|
19765 | 59 |
"Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. abs((X m) + -(X n)) < e)" |
10751 | 60 |
|
15082 | 61 |
NSCauchy :: "(nat => real) => bool" |
62 |
--{*Nonstandard definition*} |
|
19765 | 63 |
"NSCauchy X = (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite. ( *f* X) M \<approx> ( *f* X) N)" |
15082 | 64 |
|
65 |
||
66 |
||
67 |
text{* Example of an hypersequence (i.e. an extended standard sequence) |
|
68 |
whose term with an hypernatural suffix is an infinitesimal i.e. |
|
69 |
the whn'nth term of the hypersequence is a member of Infinitesimal*} |
|
70 |
||
71 |
lemma SEQ_Infinitesimal: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
72 |
"( *f* (%n::nat. inverse(real(Suc n)))) whn : Infinitesimal" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
73 |
apply (simp add: hypnat_omega_def Infinitesimal_FreeUltrafilterNat_iff starfun) |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
74 |
apply (simp add: star_n_inverse) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
75 |
apply (rule bexI [OF _ Rep_star_star_n]) |
15229 | 76 |
apply (simp add: real_of_nat_Suc_gt_zero FreeUltrafilterNat_inverse_real_of_posnat) |
15082 | 77 |
done |
78 |
||
79 |
||
80 |
subsection{*LIMSEQ and NSLIMSEQ*} |
|
81 |
||
82 |
lemma LIMSEQ_iff: |
|
15360 | 83 |
"(X ----> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. \<bar>X n + -L\<bar> < r)" |
15082 | 84 |
by (simp add: LIMSEQ_def) |
85 |
||
86 |
lemma NSLIMSEQ_iff: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
87 |
"(X ----NS> L) = (\<forall>N \<in> HNatInfinite. ( *f* X) N \<approx> hypreal_of_real L)" |
15082 | 88 |
by (simp add: NSLIMSEQ_def) |
89 |
||
90 |
||
91 |
text{*LIMSEQ ==> NSLIMSEQ*} |
|
92 |
||
93 |
lemma LIMSEQ_NSLIMSEQ: |
|
94 |
"X ----> L ==> X ----NS> L" |
|
95 |
apply (simp add: LIMSEQ_def NSLIMSEQ_def) |
|
96 |
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
97 |
apply (rule_tac x = N in star_cases) |
15082 | 98 |
apply (rule approx_minus_iff [THEN iffD2]) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
99 |
apply (auto simp add: starfun mem_infmal_iff [symmetric] star_of_def |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
100 |
star_n_minus star_n_add Infinitesimal_FreeUltrafilterNat_iff) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
101 |
apply (rule bexI [OF _ Rep_star_star_n], safe) |
15082 | 102 |
apply (drule_tac x = u in spec, safe) |
103 |
apply (drule_tac x = no in spec, fuf) |
|
104 |
apply (blast dest: less_imp_le) |
|
105 |
done |
|
106 |
||
107 |
||
108 |
text{*NSLIMSEQ ==> LIMSEQ*} |
|
109 |
||
110 |
lemma lemma_NSLIMSEQ1: "!!(f::nat=>nat). \<forall>n. n \<le> f n |
|
111 |
==> {n. f n = 0} = {0} | {n. f n = 0} = {}" |
|
112 |
apply auto |
|
113 |
apply (drule_tac x = xa in spec) |
|
114 |
apply (drule_tac [2] x = x in spec, auto) |
|
115 |
done |
|
116 |
||
117 |
lemma lemma_NSLIMSEQ2: "{n. f n \<le> Suc u} = {n. f n \<le> u} Un {n. f n = Suc u}" |
|
118 |
by (auto simp add: le_Suc_eq) |
|
119 |
||
120 |
lemma lemma_NSLIMSEQ3: |
|
121 |
"!!(f::nat=>nat). \<forall>n. n \<le> f n ==> {n. f n = Suc u} \<le> {n. n \<le> Suc u}" |
|
122 |
apply auto |
|
123 |
apply (drule_tac x = x in spec, auto) |
|
124 |
done |
|
125 |
||
126 |
text{* the following sequence @{term "f(n)"} defines a hypernatural *} |
|
127 |
lemma NSLIMSEQ_finite_set: |
|
128 |
"!!(f::nat=>nat). \<forall>n. n \<le> f n ==> finite {n. f n \<le> u}" |
|
129 |
apply (induct u) |
|
130 |
apply (auto simp add: lemma_NSLIMSEQ2) |
|
131 |
apply (auto intro: lemma_NSLIMSEQ3 [THEN finite_subset] finite_atMost [unfolded atMost_def]) |
|
132 |
apply (drule lemma_NSLIMSEQ1, safe) |
|
133 |
apply (simp_all (no_asm_simp)) |
|
134 |
done |
|
135 |
||
136 |
lemma Compl_less_set: "- {n. u < (f::nat=>nat) n} = {n. f n \<le> u}" |
|
137 |
by (auto dest: less_le_trans simp add: le_def) |
|
138 |
||
139 |
text{* the index set is in the free ultrafilter *} |
|
140 |
lemma FreeUltrafilterNat_NSLIMSEQ: |
|
141 |
"!!(f::nat=>nat). \<forall>n. n \<le> f n ==> {n. u < f n} : FreeUltrafilterNat" |
|
142 |
apply (rule FreeUltrafilterNat_Compl_iff2 [THEN iffD2]) |
|
143 |
apply (rule FreeUltrafilterNat_finite) |
|
144 |
apply (auto dest: NSLIMSEQ_finite_set simp add: Compl_less_set) |
|
145 |
done |
|
146 |
||
147 |
text{* thus, the sequence defines an infinite hypernatural! *} |
|
148 |
lemma HNatInfinite_NSLIMSEQ: "\<forall>n. n \<le> f n |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
149 |
==> star_n f : HNatInfinite" |
15082 | 150 |
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
151 |
apply (rule bexI [OF _ Rep_star_star_n], safe) |
15082 | 152 |
apply (erule FreeUltrafilterNat_NSLIMSEQ) |
153 |
done |
|
154 |
||
155 |
lemma lemmaLIM: |
|
156 |
"{n. X (f n) + - L = Y n} Int {n. \<bar>Y n\<bar> < r} \<le> |
|
157 |
{n. \<bar>X (f n) + - L\<bar> < r}" |
|
158 |
by auto |
|
159 |
||
160 |
lemma lemmaLIM2: |
|
161 |
"{n. \<bar>X (f n) + - L\<bar> < r} Int {n. r \<le> abs (X (f n) + - (L::real))} = {}" |
|
162 |
by auto |
|
163 |
||
164 |
lemma lemmaLIM3: "[| 0 < r; \<forall>n. r \<le> \<bar>X (f n) + - L\<bar>; |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
165 |
( *f* X) (star_n f) + |
15082 | 166 |
- hypreal_of_real L \<approx> 0 |] ==> False" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
167 |
apply (auto simp add: starfun mem_infmal_iff [symmetric] star_of_def star_n_minus star_n_add Infinitesimal_FreeUltrafilterNat_iff) |
15082 | 168 |
apply (rename_tac "Y") |
169 |
apply (drule_tac x = r in spec, safe) |
|
170 |
apply (drule FreeUltrafilterNat_Int, assumption) |
|
171 |
apply (drule lemmaLIM [THEN [2] FreeUltrafilterNat_subset]) |
|
172 |
apply (drule FreeUltrafilterNat_all) |
|
173 |
apply (erule_tac V = "{n. \<bar>Y n\<bar> < r} : FreeUltrafilterNat" in thin_rl) |
|
174 |
apply (drule FreeUltrafilterNat_Int, assumption) |
|
15539 | 175 |
apply (simp add: lemmaLIM2) |
15082 | 176 |
done |
177 |
||
178 |
lemma NSLIMSEQ_LIMSEQ: "X ----NS> L ==> X ----> L" |
|
179 |
apply (simp add: LIMSEQ_def NSLIMSEQ_def) |
|
180 |
apply (rule ccontr, simp, safe) |
|
181 |
txt{* skolemization step *} |
|
182 |
apply (drule choice, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
183 |
apply (drule_tac x = "star_n f" in bspec) |
15082 | 184 |
apply (drule_tac [2] approx_minus_iff [THEN iffD1]) |
185 |
apply (simp_all add: linorder_not_less) |
|
186 |
apply (blast intro: HNatInfinite_NSLIMSEQ) |
|
187 |
apply (blast intro: lemmaLIM3) |
|
188 |
done |
|
189 |
||
190 |
text{* Now, the all-important result is trivially proved! *} |
|
191 |
theorem LIMSEQ_NSLIMSEQ_iff: "(f ----> L) = (f ----NS> L)" |
|
192 |
by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ) |
|
193 |
||
194 |
||
195 |
subsection{*Theorems About Sequences*} |
|
196 |
||
197 |
lemma NSLIMSEQ_const: "(%n. k) ----NS> k" |
|
198 |
by (simp add: NSLIMSEQ_def) |
|
199 |
||
200 |
lemma LIMSEQ_const: "(%n. k) ----> k" |
|
201 |
by (simp add: LIMSEQ_def) |
|
202 |
||
203 |
lemma NSLIMSEQ_add: |
|
204 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n + Y n) ----NS> a + b" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
205 |
by (auto intro: approx_add simp add: NSLIMSEQ_def starfun_add [symmetric]) |
15082 | 206 |
|
207 |
lemma LIMSEQ_add: "[| X ----> a; Y ----> b |] ==> (%n. X n + Y n) ----> a + b" |
|
208 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_add) |
|
209 |
||
16819 | 210 |
lemma LIMSEQ_add_const: "f ----> a ==> (%n.(f n + b)) ----> a + b" |
211 |
apply (subgoal_tac "%n. (f n + b) == %n. (f n + (%n. b) n)") |
|
212 |
apply (subgoal_tac "(%n. b) ----> b") |
|
213 |
apply (auto simp add: LIMSEQ_add LIMSEQ_const) |
|
214 |
done |
|
215 |
||
216 |
lemma NSLIMSEQ_add_const: "f ----NS> a ==> (%n.(f n + b)) ----NS> a + b" |
|
217 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [THEN sym] LIMSEQ_add_const) |
|
218 |
||
15082 | 219 |
lemma NSLIMSEQ_mult: |
220 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n * Y n) ----NS> a * b" |
|
221 |
by (auto intro!: approx_mult_HFinite |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
222 |
simp add: NSLIMSEQ_def starfun_mult [symmetric]) |
15082 | 223 |
|
224 |
lemma LIMSEQ_mult: "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b" |
|
225 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_mult) |
|
226 |
||
227 |
lemma NSLIMSEQ_minus: "X ----NS> a ==> (%n. -(X n)) ----NS> -a" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
228 |
by (auto simp add: NSLIMSEQ_def starfun_minus [symmetric]) |
15082 | 229 |
|
230 |
lemma LIMSEQ_minus: "X ----> a ==> (%n. -(X n)) ----> -a" |
|
231 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_minus) |
|
232 |
||
233 |
lemma LIMSEQ_minus_cancel: "(%n. -(X n)) ----> -a ==> X ----> a" |
|
234 |
by (drule LIMSEQ_minus, simp) |
|
235 |
||
236 |
lemma NSLIMSEQ_minus_cancel: "(%n. -(X n)) ----NS> -a ==> X ----NS> a" |
|
237 |
by (drule NSLIMSEQ_minus, simp) |
|
238 |
||
239 |
lemma NSLIMSEQ_add_minus: |
|
240 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n + -Y n) ----NS> a + -b" |
|
241 |
by (simp add: NSLIMSEQ_add NSLIMSEQ_minus [of Y]) |
|
242 |
||
243 |
lemma LIMSEQ_add_minus: |
|
244 |
"[| X ----> a; Y ----> b |] ==> (%n. X n + -Y n) ----> a + -b" |
|
245 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_add_minus) |
|
246 |
||
247 |
lemma LIMSEQ_diff: "[| X ----> a; Y ----> b |] ==> (%n. X n - Y n) ----> a - b" |
|
248 |
apply (simp add: diff_minus) |
|
249 |
apply (blast intro: LIMSEQ_add_minus) |
|
250 |
done |
|
251 |
||
252 |
lemma NSLIMSEQ_diff: |
|
253 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n - Y n) ----NS> a - b" |
|
254 |
apply (simp add: diff_minus) |
|
255 |
apply (blast intro: NSLIMSEQ_add_minus) |
|
256 |
done |
|
257 |
||
16819 | 258 |
lemma LIMSEQ_diff_const: "f ----> a ==> (%n.(f n - b)) ----> a - b" |
259 |
apply (subgoal_tac "%n. (f n - b) == %n. (f n - (%n. b) n)") |
|
260 |
apply (subgoal_tac "(%n. b) ----> b") |
|
261 |
apply (auto simp add: LIMSEQ_diff LIMSEQ_const) |
|
262 |
done |
|
263 |
||
264 |
lemma NSLIMSEQ_diff_const: "f ----NS> a ==> (%n.(f n - b)) ----NS> a - b" |
|
265 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [THEN sym] LIMSEQ_diff_const) |
|
266 |
||
15082 | 267 |
text{*Proof is like that of @{text NSLIM_inverse}.*} |
268 |
lemma NSLIMSEQ_inverse: |
|
269 |
"[| X ----NS> a; a ~= 0 |] ==> (%n. inverse(X n)) ----NS> inverse(a)" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
270 |
by (simp add: NSLIMSEQ_def starfun_inverse [symmetric] |
15082 | 271 |
hypreal_of_real_approx_inverse) |
272 |
||
273 |
||
274 |
text{*Standard version of theorem*} |
|
275 |
lemma LIMSEQ_inverse: |
|
276 |
"[| X ----> a; a ~= 0 |] ==> (%n. inverse(X n)) ----> inverse(a)" |
|
277 |
by (simp add: NSLIMSEQ_inverse LIMSEQ_NSLIMSEQ_iff) |
|
278 |
||
279 |
lemma NSLIMSEQ_mult_inverse: |
|
280 |
"[| X ----NS> a; Y ----NS> b; b ~= 0 |] ==> (%n. X n / Y n) ----NS> a/b" |
|
281 |
by (simp add: NSLIMSEQ_mult NSLIMSEQ_inverse divide_inverse) |
|
282 |
||
283 |
lemma LIMSEQ_divide: |
|
284 |
"[| X ----> a; Y ----> b; b ~= 0 |] ==> (%n. X n / Y n) ----> a/b" |
|
285 |
by (simp add: LIMSEQ_mult LIMSEQ_inverse divide_inverse) |
|
286 |
||
287 |
text{*Uniqueness of limit*} |
|
288 |
lemma NSLIMSEQ_unique: "[| X ----NS> a; X ----NS> b |] ==> a = b" |
|
289 |
apply (simp add: NSLIMSEQ_def) |
|
290 |
apply (drule HNatInfinite_whn [THEN [2] bspec])+ |
|
291 |
apply (auto dest: approx_trans3) |
|
292 |
done |
|
293 |
||
294 |
lemma LIMSEQ_unique: "[| X ----> a; X ----> b |] ==> a = b" |
|
295 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_unique) |
|
296 |
||
15312 | 297 |
lemma LIMSEQ_setsum: |
298 |
assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n" |
|
299 |
shows "(\<lambda>m. \<Sum>n\<in>S. X n m) ----> (\<Sum>n\<in>S. L n)" |
|
300 |
proof (cases "finite S") |
|
301 |
case True |
|
302 |
thus ?thesis using n |
|
303 |
proof (induct) |
|
304 |
case empty |
|
305 |
show ?case |
|
306 |
by (simp add: LIMSEQ_const) |
|
307 |
next |
|
308 |
case insert |
|
309 |
thus ?case |
|
310 |
by (simp add: LIMSEQ_add) |
|
311 |
qed |
|
312 |
next |
|
313 |
case False |
|
314 |
thus ?thesis |
|
315 |
by (simp add: setsum_def LIMSEQ_const) |
|
316 |
qed |
|
317 |
||
16819 | 318 |
lemma LIMSEQ_setprod: |
319 |
assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n" |
|
320 |
shows "(\<lambda>m. \<Prod>n\<in>S. X n m) ----> (\<Prod>n\<in>S. L n)" |
|
321 |
proof (cases "finite S") |
|
322 |
case True |
|
323 |
thus ?thesis using n |
|
324 |
proof (induct) |
|
325 |
case empty |
|
326 |
show ?case |
|
327 |
by (simp add: LIMSEQ_const) |
|
328 |
next |
|
329 |
case insert |
|
330 |
thus ?case |
|
331 |
by (simp add: LIMSEQ_mult) |
|
332 |
qed |
|
333 |
next |
|
334 |
case False |
|
335 |
thus ?thesis |
|
336 |
by (simp add: setprod_def LIMSEQ_const) |
|
337 |
qed |
|
338 |
||
339 |
lemma LIMSEQ_ignore_initial_segment: "f ----> a |
|
340 |
==> (%n. f(n + k)) ----> a" |
|
341 |
apply (unfold LIMSEQ_def) |
|
342 |
apply (clarify) |
|
343 |
apply (drule_tac x = r in spec) |
|
344 |
apply (clarify) |
|
345 |
apply (rule_tac x = "no + k" in exI) |
|
346 |
by auto |
|
347 |
||
348 |
lemma LIMSEQ_offset: "(%x. f (x + k)) ----> a ==> |
|
349 |
f ----> a" |
|
350 |
apply (unfold LIMSEQ_def) |
|
351 |
apply clarsimp |
|
352 |
apply (drule_tac x = r in spec) |
|
353 |
apply clarsimp |
|
354 |
apply (rule_tac x = "no + k" in exI) |
|
355 |
apply clarsimp |
|
356 |
apply (drule_tac x = "n - k" in spec) |
|
357 |
apply (frule mp) |
|
358 |
apply arith |
|
359 |
apply simp |
|
360 |
done |
|
361 |
||
362 |
lemma LIMSEQ_diff_approach_zero: |
|
363 |
"g ----> L ==> (%x. f x - g x) ----> 0 ==> |
|
364 |
f ----> L" |
|
365 |
apply (drule LIMSEQ_add) |
|
366 |
apply assumption |
|
367 |
apply simp |
|
368 |
done |
|
369 |
||
370 |
lemma LIMSEQ_diff_approach_zero2: |
|
371 |
"f ----> L ==> (%x. f x - g x) ----> 0 ==> |
|
372 |
g ----> L"; |
|
373 |
apply (drule LIMSEQ_diff) |
|
374 |
apply assumption |
|
375 |
apply simp |
|
376 |
done |
|
377 |
||
15082 | 378 |
|
379 |
subsection{*Nslim and Lim*} |
|
380 |
||
381 |
lemma limI: "X ----> L ==> lim X = L" |
|
382 |
apply (simp add: lim_def) |
|
383 |
apply (blast intro: LIMSEQ_unique) |
|
384 |
done |
|
385 |
||
386 |
lemma nslimI: "X ----NS> L ==> nslim X = L" |
|
387 |
apply (simp add: nslim_def) |
|
388 |
apply (blast intro: NSLIMSEQ_unique) |
|
389 |
done |
|
390 |
||
391 |
lemma lim_nslim_iff: "lim X = nslim X" |
|
392 |
by (simp add: lim_def nslim_def LIMSEQ_NSLIMSEQ_iff) |
|
393 |
||
394 |
||
395 |
subsection{*Convergence*} |
|
396 |
||
397 |
lemma convergentD: "convergent X ==> \<exists>L. (X ----> L)" |
|
398 |
by (simp add: convergent_def) |
|
399 |
||
400 |
lemma convergentI: "(X ----> L) ==> convergent X" |
|
401 |
by (auto simp add: convergent_def) |
|
402 |
||
403 |
lemma NSconvergentD: "NSconvergent X ==> \<exists>L. (X ----NS> L)" |
|
404 |
by (simp add: NSconvergent_def) |
|
405 |
||
406 |
lemma NSconvergentI: "(X ----NS> L) ==> NSconvergent X" |
|
407 |
by (auto simp add: NSconvergent_def) |
|
408 |
||
409 |
lemma convergent_NSconvergent_iff: "convergent X = NSconvergent X" |
|
410 |
by (simp add: convergent_def NSconvergent_def LIMSEQ_NSLIMSEQ_iff) |
|
411 |
||
412 |
lemma NSconvergent_NSLIMSEQ_iff: "NSconvergent X = (X ----NS> nslim X)" |
|
413 |
by (auto intro: someI simp add: NSconvergent_def nslim_def) |
|
414 |
||
415 |
lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)" |
|
416 |
by (auto intro: someI simp add: convergent_def lim_def) |
|
417 |
||
418 |
text{*Subsequence (alternative definition, (e.g. Hoskins)*} |
|
419 |
||
420 |
lemma subseq_Suc_iff: "subseq f = (\<forall>n. (f n) < (f (Suc n)))" |
|
421 |
apply (simp add: subseq_def) |
|
422 |
apply (auto dest!: less_imp_Suc_add) |
|
423 |
apply (induct_tac k) |
|
424 |
apply (auto intro: less_trans) |
|
425 |
done |
|
426 |
||
427 |
||
428 |
subsection{*Monotonicity*} |
|
429 |
||
430 |
lemma monoseq_Suc: |
|
431 |
"monoseq X = ((\<forall>n. X n \<le> X (Suc n)) |
|
432 |
| (\<forall>n. X (Suc n) \<le> X n))" |
|
433 |
apply (simp add: monoseq_def) |
|
434 |
apply (auto dest!: le_imp_less_or_eq) |
|
435 |
apply (auto intro!: lessI [THEN less_imp_le] dest!: less_imp_Suc_add) |
|
436 |
apply (induct_tac "ka") |
|
437 |
apply (auto intro: order_trans) |
|
18585 | 438 |
apply (erule contrapos_np) |
15082 | 439 |
apply (induct_tac "k") |
440 |
apply (auto intro: order_trans) |
|
441 |
done |
|
442 |
||
15360 | 443 |
lemma monoI1: "\<forall>m. \<forall> n \<ge> m. X m \<le> X n ==> monoseq X" |
15082 | 444 |
by (simp add: monoseq_def) |
445 |
||
15360 | 446 |
lemma monoI2: "\<forall>m. \<forall> n \<ge> m. X n \<le> X m ==> monoseq X" |
15082 | 447 |
by (simp add: monoseq_def) |
448 |
||
449 |
lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) ==> monoseq X" |
|
450 |
by (simp add: monoseq_Suc) |
|
451 |
||
452 |
lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X" |
|
453 |
by (simp add: monoseq_Suc) |
|
454 |
||
455 |
||
456 |
subsection{*Bounded Sequence*} |
|
457 |
||
458 |
lemma BseqD: "Bseq X ==> \<exists>K. 0 < K & (\<forall>n. \<bar>X n\<bar> \<le> K)" |
|
459 |
by (simp add: Bseq_def) |
|
460 |
||
461 |
lemma BseqI: "[| 0 < K; \<forall>n. \<bar>X n\<bar> \<le> K |] ==> Bseq X" |
|
462 |
by (auto simp add: Bseq_def) |
|
463 |
||
464 |
lemma lemma_NBseq_def: |
|
15360 | 465 |
"(\<exists>K > 0. \<forall>n. \<bar>X n\<bar> \<le> K) = |
15082 | 466 |
(\<exists>N. \<forall>n. \<bar>X n\<bar> \<le> real(Suc N))" |
467 |
apply auto |
|
468 |
prefer 2 apply force |
|
469 |
apply (cut_tac x = K in reals_Archimedean2, clarify) |
|
470 |
apply (rule_tac x = n in exI, clarify) |
|
471 |
apply (drule_tac x = na in spec) |
|
472 |
apply (auto simp add: real_of_nat_Suc) |
|
473 |
done |
|
474 |
||
475 |
text{* alternative definition for Bseq *} |
|
476 |
lemma Bseq_iff: "Bseq X = (\<exists>N. \<forall>n. \<bar>X n\<bar> \<le> real(Suc N))" |
|
477 |
apply (simp add: Bseq_def) |
|
478 |
apply (simp (no_asm) add: lemma_NBseq_def) |
|
479 |
done |
|
480 |
||
481 |
lemma lemma_NBseq_def2: |
|
15360 | 482 |
"(\<exists>K > 0. \<forall>n. \<bar>X n\<bar> \<le> K) = (\<exists>N. \<forall>n. \<bar>X n\<bar> < real(Suc N))" |
15082 | 483 |
apply (subst lemma_NBseq_def, auto) |
484 |
apply (rule_tac x = "Suc N" in exI) |
|
485 |
apply (rule_tac [2] x = N in exI) |
|
486 |
apply (auto simp add: real_of_nat_Suc) |
|
487 |
prefer 2 apply (blast intro: order_less_imp_le) |
|
488 |
apply (drule_tac x = n in spec, simp) |
|
489 |
done |
|
490 |
||
491 |
(* yet another definition for Bseq *) |
|
492 |
lemma Bseq_iff1a: "Bseq X = (\<exists>N. \<forall>n. \<bar>X n\<bar> < real(Suc N))" |
|
493 |
by (simp add: Bseq_def lemma_NBseq_def2) |
|
494 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
495 |
lemma NSBseqD: "[| NSBseq X; N: HNatInfinite |] ==> ( *f* X) N : HFinite" |
15082 | 496 |
by (simp add: NSBseq_def) |
497 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
498 |
lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *f* X) N : HFinite ==> NSBseq X" |
15082 | 499 |
by (simp add: NSBseq_def) |
500 |
||
501 |
text{*The standard definition implies the nonstandard definition*} |
|
502 |
||
503 |
lemma lemma_Bseq: "\<forall>n. \<bar>X n\<bar> \<le> K ==> \<forall>n. abs(X((f::nat=>nat) n)) \<le> K" |
|
504 |
by auto |
|
505 |
||
506 |
lemma Bseq_NSBseq: "Bseq X ==> NSBseq X" |
|
507 |
apply (simp add: Bseq_def NSBseq_def, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
508 |
apply (rule_tac x = N in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
509 |
apply (auto simp add: starfun HFinite_FreeUltrafilterNat_iff |
15082 | 510 |
HNatInfinite_FreeUltrafilterNat_iff) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
511 |
apply (rule bexI [OF _ Rep_star_star_n]) |
15082 | 512 |
apply (drule_tac f = Xa in lemma_Bseq) |
513 |
apply (rule_tac x = "K+1" in exI) |
|
514 |
apply (drule_tac P="%n. ?f n \<le> K" in FreeUltrafilterNat_all, ultra) |
|
515 |
done |
|
516 |
||
517 |
text{*The nonstandard definition implies the standard definition*} |
|
518 |
||
519 |
(* similar to NSLIM proof in REALTOPOS *) |
|
520 |
||
521 |
text{* We need to get rid of the real variable and do so by proving the |
|
522 |
following, which relies on the Archimedean property of the reals. |
|
523 |
When we skolemize we then get the required function @{term "f::nat=>nat"}. |
|
524 |
Otherwise, we would be stuck with a skolem function @{term "f::real=>nat"} |
|
525 |
which woulid be useless.*} |
|
526 |
||
527 |
lemma lemmaNSBseq: |
|
15360 | 528 |
"\<forall>K > 0. \<exists>n. K < \<bar>X n\<bar> |
15082 | 529 |
==> \<forall>N. \<exists>n. real(Suc N) < \<bar>X n\<bar>" |
530 |
apply safe |
|
531 |
apply (cut_tac n = N in real_of_nat_Suc_gt_zero, blast) |
|
532 |
done |
|
533 |
||
15360 | 534 |
lemma lemmaNSBseq2: "\<forall>K > 0. \<exists>n. K < \<bar>X n\<bar> |
15082 | 535 |
==> \<exists>f. \<forall>N. real(Suc N) < \<bar>X (f N)\<bar>" |
536 |
apply (drule lemmaNSBseq) |
|
537 |
apply (drule choice, blast) |
|
538 |
done |
|
539 |
||
540 |
lemma real_seq_to_hypreal_HInfinite: |
|
541 |
"\<forall>N. real(Suc N) < \<bar>X (f N)\<bar> |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
542 |
==> star_n (X o f) : HInfinite" |
15082 | 543 |
apply (auto simp add: HInfinite_FreeUltrafilterNat_iff o_def) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
544 |
apply (rule bexI [OF _ Rep_star_star_n], clarify) |
15082 | 545 |
apply (cut_tac u = u in FreeUltrafilterNat_nat_gt_real) |
546 |
apply (drule FreeUltrafilterNat_all) |
|
547 |
apply (erule FreeUltrafilterNat_Int [THEN FreeUltrafilterNat_subset]) |
|
548 |
apply (auto simp add: real_of_nat_Suc) |
|
549 |
done |
|
550 |
||
551 |
text{* Now prove that we can get out an infinite hypernatural as well |
|
552 |
defined using the skolem function @{term "f::nat=>nat"} above*} |
|
553 |
||
554 |
lemma lemma_finite_NSBseq: |
|
555 |
"{n. f n \<le> Suc u & real(Suc n) < \<bar>X (f n)\<bar>} \<le> |
|
556 |
{n. f n \<le> u & real(Suc n) < \<bar>X (f n)\<bar>} Un |
|
557 |
{n. real(Suc n) < \<bar>X (Suc u)\<bar>}" |
|
558 |
by (auto dest!: le_imp_less_or_eq) |
|
559 |
||
560 |
lemma lemma_finite_NSBseq2: |
|
561 |
"finite {n. f n \<le> (u::nat) & real(Suc n) < \<bar>X(f n)\<bar>}" |
|
15251 | 562 |
apply (induct "u") |
15082 | 563 |
apply (rule_tac [2] lemma_finite_NSBseq [THEN finite_subset]) |
564 |
apply (rule_tac B = "{n. real (Suc n) < \<bar>X 0\<bar> }" in finite_subset) |
|
565 |
apply (auto intro: finite_real_of_nat_less_real |
|
566 |
simp add: real_of_nat_Suc less_diff_eq [symmetric]) |
|
567 |
done |
|
568 |
||
569 |
lemma HNatInfinite_skolem_f: |
|
570 |
"\<forall>N. real(Suc N) < \<bar>X (f N)\<bar> |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
571 |
==> star_n f : HNatInfinite" |
15082 | 572 |
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
573 |
apply (rule bexI [OF _ Rep_star_star_n], safe) |
15082 | 574 |
apply (rule ccontr, drule FreeUltrafilterNat_Compl_mem) |
575 |
apply (rule lemma_finite_NSBseq2 [THEN FreeUltrafilterNat_finite, THEN notE]) |
|
576 |
apply (subgoal_tac "{n. f n \<le> u & real (Suc n) < \<bar>X (f n)\<bar>} = |
|
577 |
{n. f n \<le> u} \<inter> {N. real (Suc N) < \<bar>X (f N)\<bar>}") |
|
578 |
apply (erule ssubst) |
|
579 |
apply (auto simp add: linorder_not_less Compl_def) |
|
580 |
done |
|
581 |
||
582 |
lemma NSBseq_Bseq: "NSBseq X ==> Bseq X" |
|
583 |
apply (simp add: Bseq_def NSBseq_def) |
|
584 |
apply (rule ccontr) |
|
585 |
apply (auto simp add: linorder_not_less [symmetric]) |
|
586 |
apply (drule lemmaNSBseq2, safe) |
|
587 |
apply (frule_tac X = X and f = f in real_seq_to_hypreal_HInfinite) |
|
588 |
apply (drule HNatInfinite_skolem_f [THEN [2] bspec]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
589 |
apply (auto simp add: starfun o_def HFinite_HInfinite_iff) |
15082 | 590 |
done |
591 |
||
592 |
text{* Equivalence of nonstandard and standard definitions |
|
593 |
for a bounded sequence*} |
|
594 |
lemma Bseq_NSBseq_iff: "(Bseq X) = (NSBseq X)" |
|
595 |
by (blast intro!: NSBseq_Bseq Bseq_NSBseq) |
|
596 |
||
597 |
text{*A convergent sequence is bounded: |
|
598 |
Boundedness as a necessary condition for convergence. |
|
599 |
The nonstandard version has no existential, as usual *} |
|
600 |
||
601 |
lemma NSconvergent_NSBseq: "NSconvergent X ==> NSBseq X" |
|
602 |
apply (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def) |
|
603 |
apply (blast intro: HFinite_hypreal_of_real approx_sym approx_HFinite) |
|
604 |
done |
|
605 |
||
606 |
text{*Standard Version: easily now proved using equivalence of NS and |
|
607 |
standard definitions *} |
|
608 |
lemma convergent_Bseq: "convergent X ==> Bseq X" |
|
609 |
by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff) |
|
610 |
||
611 |
||
612 |
subsection{*Upper Bounds and Lubs of Bounded Sequences*} |
|
613 |
||
614 |
lemma Bseq_isUb: |
|
615 |
"!!(X::nat=>real). Bseq X ==> \<exists>U. isUb (UNIV::real set) {x. \<exists>n. X n = x} U" |
|
616 |
by (auto intro: isUbI setleI simp add: Bseq_def abs_le_interval_iff) |
|
617 |
||
618 |
||
619 |
text{* Use completeness of reals (supremum property) |
|
620 |
to show that any bounded sequence has a least upper bound*} |
|
621 |
||
622 |
lemma Bseq_isLub: |
|
623 |
"!!(X::nat=>real). Bseq X ==> |
|
624 |
\<exists>U. isLub (UNIV::real set) {x. \<exists>n. X n = x} U" |
|
625 |
by (blast intro: reals_complete Bseq_isUb) |
|
626 |
||
627 |
lemma NSBseq_isUb: "NSBseq X ==> \<exists>U. isUb UNIV {x. \<exists>n. X n = x} U" |
|
628 |
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb) |
|
629 |
||
630 |
lemma NSBseq_isLub: "NSBseq X ==> \<exists>U. isLub UNIV {x. \<exists>n. X n = x} U" |
|
631 |
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub) |
|
632 |
||
633 |
||
634 |
subsection{*A Bounded and Monotonic Sequence Converges*} |
|
635 |
||
636 |
lemma lemma_converg1: |
|
15360 | 637 |
"!!(X::nat=>real). [| \<forall>m. \<forall> n \<ge> m. X m \<le> X n; |
15082 | 638 |
isLub (UNIV::real set) {x. \<exists>n. X n = x} (X ma) |
15360 | 639 |
|] ==> \<forall>n \<ge> ma. X n = X ma" |
15082 | 640 |
apply safe |
641 |
apply (drule_tac y = "X n" in isLubD2) |
|
642 |
apply (blast dest: order_antisym)+ |
|
643 |
done |
|
644 |
||
645 |
text{* The best of both worlds: Easier to prove this result as a standard |
|
646 |
theorem and then use equivalence to "transfer" it into the |
|
647 |
equivalent nonstandard form if needed!*} |
|
648 |
||
649 |
lemma Bmonoseq_LIMSEQ: "\<forall>n. m \<le> n --> X n = X m ==> \<exists>L. (X ----> L)" |
|
650 |
apply (simp add: LIMSEQ_def) |
|
651 |
apply (rule_tac x = "X m" in exI, safe) |
|
652 |
apply (rule_tac x = m in exI, safe) |
|
653 |
apply (drule spec, erule impE, auto) |
|
654 |
done |
|
655 |
||
656 |
text{*Now, the same theorem in terms of NS limit *} |
|
15360 | 657 |
lemma Bmonoseq_NSLIMSEQ: "\<forall>n \<ge> m. X n = X m ==> \<exists>L. (X ----NS> L)" |
15082 | 658 |
by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff) |
659 |
||
660 |
lemma lemma_converg2: |
|
661 |
"!!(X::nat=>real). |
|
662 |
[| \<forall>m. X m ~= U; isLub UNIV {x. \<exists>n. X n = x} U |] ==> \<forall>m. X m < U" |
|
663 |
apply safe |
|
664 |
apply (drule_tac y = "X m" in isLubD2) |
|
665 |
apply (auto dest!: order_le_imp_less_or_eq) |
|
666 |
done |
|
667 |
||
668 |
lemma lemma_converg3: "!!(X ::nat=>real). \<forall>m. X m \<le> U ==> isUb UNIV {x. \<exists>n. X n = x} U" |
|
669 |
by (rule setleI [THEN isUbI], auto) |
|
670 |
||
671 |
text{* FIXME: @{term "U - T < U"} is redundant *} |
|
672 |
lemma lemma_converg4: "!!(X::nat=> real). |
|
673 |
[| \<forall>m. X m ~= U; |
|
674 |
isLub UNIV {x. \<exists>n. X n = x} U; |
|
675 |
0 < T; |
|
676 |
U + - T < U |
|
677 |
|] ==> \<exists>m. U + -T < X m & X m < U" |
|
678 |
apply (drule lemma_converg2, assumption) |
|
679 |
apply (rule ccontr, simp) |
|
680 |
apply (simp add: linorder_not_less) |
|
681 |
apply (drule lemma_converg3) |
|
682 |
apply (drule isLub_le_isUb, assumption) |
|
683 |
apply (auto dest: order_less_le_trans) |
|
684 |
done |
|
685 |
||
686 |
text{*A standard proof of the theorem for monotone increasing sequence*} |
|
687 |
||
688 |
lemma Bseq_mono_convergent: |
|
15360 | 689 |
"[| Bseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> convergent X" |
15082 | 690 |
apply (simp add: convergent_def) |
691 |
apply (frule Bseq_isLub, safe) |
|
692 |
apply (case_tac "\<exists>m. X m = U", auto) |
|
693 |
apply (blast dest: lemma_converg1 Bmonoseq_LIMSEQ) |
|
694 |
(* second case *) |
|
695 |
apply (rule_tac x = U in exI) |
|
696 |
apply (subst LIMSEQ_iff, safe) |
|
697 |
apply (frule lemma_converg2, assumption) |
|
698 |
apply (drule lemma_converg4, auto) |
|
699 |
apply (rule_tac x = m in exI, safe) |
|
700 |
apply (subgoal_tac "X m \<le> X n") |
|
701 |
prefer 2 apply blast |
|
702 |
apply (drule_tac x=n and P="%m. X m < U" in spec, arith) |
|
703 |
done |
|
704 |
||
705 |
text{*Nonstandard version of the theorem*} |
|
706 |
||
707 |
lemma NSBseq_mono_NSconvergent: |
|
15360 | 708 |
"[| NSBseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> NSconvergent X" |
15082 | 709 |
by (auto intro: Bseq_mono_convergent |
710 |
simp add: convergent_NSconvergent_iff [symmetric] |
|
711 |
Bseq_NSBseq_iff [symmetric]) |
|
712 |
||
713 |
lemma convergent_minus_iff: "(convergent X) = (convergent (%n. -(X n)))" |
|
714 |
apply (simp add: convergent_def) |
|
715 |
apply (auto dest: LIMSEQ_minus) |
|
716 |
apply (drule LIMSEQ_minus, auto) |
|
717 |
done |
|
718 |
||
719 |
lemma Bseq_minus_iff: "Bseq (%n. -(X n)) = Bseq X" |
|
720 |
by (simp add: Bseq_def) |
|
721 |
||
722 |
text{*Main monotonicity theorem*} |
|
723 |
lemma Bseq_monoseq_convergent: "[| Bseq X; monoseq X |] ==> convergent X" |
|
724 |
apply (simp add: monoseq_def, safe) |
|
725 |
apply (rule_tac [2] convergent_minus_iff [THEN ssubst]) |
|
726 |
apply (drule_tac [2] Bseq_minus_iff [THEN ssubst]) |
|
727 |
apply (auto intro!: Bseq_mono_convergent) |
|
728 |
done |
|
729 |
||
730 |
||
731 |
subsection{*A Few More Equivalence Theorems for Boundedness*} |
|
732 |
||
733 |
text{*alternative formulation for boundedness*} |
|
15360 | 734 |
lemma Bseq_iff2: "Bseq X = (\<exists>k > 0. \<exists>x. \<forall>n. \<bar>X(n) + -x\<bar> \<le> k)" |
15082 | 735 |
apply (unfold Bseq_def, safe) |
736 |
apply (rule_tac [2] x = "k + \<bar>x\<bar> " in exI) |
|
15360 | 737 |
apply (rule_tac x = K in exI, simp) |
15221 | 738 |
apply (rule exI [where x = 0], auto) |
739 |
apply (drule_tac x=n in spec, arith)+ |
|
15082 | 740 |
done |
741 |
||
742 |
text{*alternative formulation for boundedness*} |
|
15360 | 743 |
lemma Bseq_iff3: "Bseq X = (\<exists>k > 0. \<exists>N. \<forall>n. abs(X(n) + -X(N)) \<le> k)" |
15082 | 744 |
apply safe |
745 |
apply (simp add: Bseq_def, safe) |
|
746 |
apply (rule_tac x = "K + \<bar>X N\<bar> " in exI) |
|
747 |
apply auto |
|
748 |
apply arith |
|
749 |
apply (rule_tac x = N in exI, safe) |
|
750 |
apply (drule_tac x = n in spec, arith) |
|
751 |
apply (auto simp add: Bseq_iff2) |
|
752 |
done |
|
753 |
||
754 |
lemma BseqI2: "(\<forall>n. k \<le> f n & f n \<le> K) ==> Bseq f" |
|
755 |
apply (simp add: Bseq_def) |
|
15221 | 756 |
apply (rule_tac x = " (\<bar>k\<bar> + \<bar>K\<bar>) + 1" in exI, auto) |
15082 | 757 |
apply (drule_tac [2] x = n in spec, arith+) |
758 |
done |
|
759 |
||
760 |
||
761 |
subsection{*Equivalence Between NS and Standard Cauchy Sequences*} |
|
762 |
||
763 |
subsubsection{*Standard Implies Nonstandard*} |
|
764 |
||
765 |
lemma lemmaCauchy1: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
766 |
"star_n x : HNatInfinite |
15082 | 767 |
==> {n. M \<le> x n} : FreeUltrafilterNat" |
768 |
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff) |
|
769 |
apply (drule_tac x = M in spec, ultra) |
|
770 |
done |
|
771 |
||
772 |
lemma lemmaCauchy2: |
|
773 |
"{n. \<forall>m n. M \<le> m & M \<le> (n::nat) --> \<bar>X m + - X n\<bar> < u} Int |
|
774 |
{n. M \<le> xa n} Int {n. M \<le> x n} \<le> |
|
775 |
{n. abs (X (xa n) + - X (x n)) < u}" |
|
776 |
by blast |
|
777 |
||
778 |
lemma Cauchy_NSCauchy: "Cauchy X ==> NSCauchy X" |
|
779 |
apply (simp add: Cauchy_def NSCauchy_def, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
780 |
apply (rule_tac x = M in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
781 |
apply (rule_tac x = N in star_cases) |
15082 | 782 |
apply (rule approx_minus_iff [THEN iffD2]) |
783 |
apply (rule mem_infmal_iff [THEN iffD1]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
784 |
apply (auto simp add: starfun star_n_minus star_n_add Infinitesimal_FreeUltrafilterNat_iff) |
15082 | 785 |
apply (rule bexI, auto) |
786 |
apply (drule spec, auto) |
|
787 |
apply (drule_tac M = M in lemmaCauchy1) |
|
788 |
apply (drule_tac M = M in lemmaCauchy1) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
789 |
apply (rule_tac x1 = Xaa in lemmaCauchy2 [THEN [2] FreeUltrafilterNat_subset]) |
15082 | 790 |
apply (rule FreeUltrafilterNat_Int) |
15539 | 791 |
apply (auto intro: FreeUltrafilterNat_Int) |
15082 | 792 |
done |
793 |
||
794 |
subsubsection{*Nonstandard Implies Standard*} |
|
795 |
||
796 |
lemma NSCauchy_Cauchy: "NSCauchy X ==> Cauchy X" |
|
797 |
apply (auto simp add: Cauchy_def NSCauchy_def) |
|
798 |
apply (rule ccontr, simp) |
|
799 |
apply (auto dest!: choice HNatInfinite_NSLIMSEQ simp add: all_conj_distrib) |
|
800 |
apply (drule bspec, assumption) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
801 |
apply (drule_tac x = "star_n fa" in bspec); |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
802 |
apply (auto simp add: starfun) |
15082 | 803 |
apply (drule approx_minus_iff [THEN iffD1]) |
804 |
apply (drule mem_infmal_iff [THEN iffD2]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
805 |
apply (auto simp add: star_n_minus star_n_add Infinitesimal_FreeUltrafilterNat_iff) |
15082 | 806 |
apply (rename_tac "Y") |
807 |
apply (drule_tac x = e in spec, auto) |
|
808 |
apply (drule FreeUltrafilterNat_Int, assumption) |
|
809 |
apply (subgoal_tac "{n. \<bar>X (f n) + - X (fa n)\<bar> < e} \<in> \<U>") |
|
810 |
prefer 2 apply (erule FreeUltrafilterNat_subset, force) |
|
811 |
apply (rule FreeUltrafilterNat_empty [THEN notE]) |
|
812 |
apply (subgoal_tac |
|
813 |
"{n. abs (X (f n) + - X (fa n)) < e} Int |
|
814 |
{M. ~ abs (X (f M) + - X (fa M)) < e} = {}") |
|
815 |
apply auto |
|
816 |
done |
|
817 |
||
818 |
||
819 |
theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X" |
|
820 |
by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy) |
|
821 |
||
822 |
text{*A Cauchy sequence is bounded -- this is the standard |
|
823 |
proof mechanization rather than the nonstandard proof*} |
|
824 |
||
15360 | 825 |
lemma lemmaCauchy: "\<forall>n \<ge> M. \<bar>X M + - X n\<bar> < (1::real) |
826 |
==> \<forall>n \<ge> M. \<bar>X n\<bar> < 1 + \<bar>X M\<bar>" |
|
15082 | 827 |
apply safe |
828 |
apply (drule spec, auto, arith) |
|
829 |
done |
|
830 |
||
831 |
lemma less_Suc_cancel_iff: "(n < Suc M) = (n \<le> M)" |
|
832 |
by auto |
|
833 |
||
834 |
text{* FIXME: Long. Maximal element in subsequence *} |
|
835 |
lemma SUP_rabs_subseq: |
|
15360 | 836 |
"\<exists>m \<le> M. \<forall>n \<le> M. \<bar>(X::nat=> real) n\<bar> \<le> \<bar>X m\<bar>" |
15082 | 837 |
apply (induct M) |
838 |
apply (rule_tac x = 0 in exI, simp, safe) |
|
15236
f289e8ba2bb3
Proofs needed to be updated because induction now preserves name of
nipkow
parents:
15229
diff
changeset
|
839 |
apply (cut_tac x = "\<bar>X (Suc M)\<bar>" and y = "\<bar>X m\<bar> " in linorder_less_linear) |
15082 | 840 |
apply safe |
841 |
apply (rule_tac x = m in exI) |
|
842 |
apply (rule_tac [2] x = m in exI) |
|
15236
f289e8ba2bb3
Proofs needed to be updated because induction now preserves name of
nipkow
parents:
15229
diff
changeset
|
843 |
apply (rule_tac [3] x = "Suc M" in exI, simp_all, safe) |
f289e8ba2bb3
Proofs needed to be updated because induction now preserves name of
nipkow
parents:
15229
diff
changeset
|
844 |
apply (erule_tac [!] m1 = n in le_imp_less_or_eq [THEN disjE]) |
15082 | 845 |
apply (simp_all add: less_Suc_cancel_iff) |
846 |
apply (blast intro: order_le_less_trans [THEN order_less_imp_le]) |
|
847 |
done |
|
848 |
||
849 |
lemma lemma_Nat_covered: |
|
850 |
"[| \<forall>m::nat. m \<le> M --> P M m; |
|
15360 | 851 |
\<forall>m \<ge> M. P M m |] |
15082 | 852 |
==> \<forall>m. P M m" |
853 |
by (auto elim: less_asym simp add: le_def) |
|
854 |
||
855 |
||
856 |
lemma lemma_trans1: |
|
15360 | 857 |
"[| \<forall>n \<le> M. \<bar>(X::nat=>real) n\<bar> \<le> a; a < b |] |
858 |
==> \<forall>n \<le> M. \<bar>X n\<bar> \<le> b" |
|
15082 | 859 |
by (blast intro: order_le_less_trans [THEN order_less_imp_le]) |
860 |
||
861 |
lemma lemma_trans2: |
|
15360 | 862 |
"[| \<forall>n \<ge> M. \<bar>(X::nat=>real) n\<bar> < a; a < b |] |
863 |
==> \<forall>n \<ge> M. \<bar>X n\<bar>\<le> b" |
|
15082 | 864 |
by (blast intro: order_less_trans [THEN order_less_imp_le]) |
865 |
||
866 |
lemma lemma_trans3: |
|
15360 | 867 |
"[| \<forall>n \<le> M. \<bar>X n\<bar> \<le> a; a = b |] |
868 |
==> \<forall>n \<le> M. \<bar>X n\<bar> \<le> b" |
|
15082 | 869 |
by auto |
870 |
||
15360 | 871 |
lemma lemma_trans4: "\<forall>n \<ge> M. \<bar>(X::nat=>real) n\<bar> < a |
872 |
==> \<forall>n \<ge> M. \<bar>X n\<bar> \<le> a" |
|
15082 | 873 |
by (blast intro: order_less_imp_le) |
874 |
||
875 |
||
876 |
text{*Proof is more involved than outlines sketched by various authors |
|
877 |
would suggest*} |
|
878 |
||
879 |
lemma Cauchy_Bseq: "Cauchy X ==> Bseq X" |
|
880 |
apply (simp add: Cauchy_def Bseq_def) |
|
881 |
apply (drule_tac x = 1 in spec) |
|
882 |
apply (erule zero_less_one [THEN [2] impE], safe) |
|
883 |
apply (drule_tac x = M in spec, simp) |
|
884 |
apply (drule lemmaCauchy) |
|
885 |
apply (cut_tac M = M and X = X in SUP_rabs_subseq, safe) |
|
886 |
apply (cut_tac x = "\<bar>X m\<bar> " and y = "1 + \<bar>X M\<bar> " in linorder_less_linear) |
|
887 |
apply safe |
|
888 |
apply (drule lemma_trans1, assumption) |
|
889 |
apply (drule_tac [3] lemma_trans2, erule_tac [3] asm_rl) |
|
890 |
apply (drule_tac [2] lemma_trans3, erule_tac [2] asm_rl) |
|
891 |
apply (drule_tac [3] abs_add_one_gt_zero [THEN order_less_trans]) |
|
892 |
apply (drule lemma_trans4) |
|
893 |
apply (drule_tac [2] lemma_trans4) |
|
894 |
apply (rule_tac x = "1 + \<bar>X M\<bar> " in exI) |
|
895 |
apply (rule_tac [2] x = "1 + \<bar>X M\<bar> " in exI) |
|
896 |
apply (rule_tac [3] x = "\<bar>X m\<bar> " in exI) |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15082
diff
changeset
|
897 |
apply (auto elim!: lemma_Nat_covered) |
15082 | 898 |
done |
899 |
||
900 |
text{*A Cauchy sequence is bounded -- nonstandard version*} |
|
901 |
||
902 |
lemma NSCauchy_NSBseq: "NSCauchy X ==> NSBseq X" |
|
903 |
by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff) |
|
904 |
||
905 |
||
906 |
text{*Equivalence of Cauchy criterion and convergence: |
|
907 |
We will prove this using our NS formulation which provides a |
|
908 |
much easier proof than using the standard definition. We do not |
|
909 |
need to use properties of subsequences such as boundedness, |
|
910 |
monotonicity etc... Compare with Harrison's corresponding proof |
|
911 |
in HOL which is much longer and more complicated. Of course, we do |
|
912 |
not have problems which he encountered with guessing the right |
|
913 |
instantiations for his 'espsilon-delta' proof(s) in this case |
|
914 |
since the NS formulations do not involve existential quantifiers.*} |
|
915 |
||
916 |
lemma NSCauchy_NSconvergent_iff: "NSCauchy X = NSconvergent X" |
|
917 |
apply (simp add: NSconvergent_def NSLIMSEQ_def, safe) |
|
918 |
apply (frule NSCauchy_NSBseq) |
|
919 |
apply (auto intro: approx_trans2 simp add: NSBseq_def NSCauchy_def) |
|
920 |
apply (drule HNatInfinite_whn [THEN [2] bspec]) |
|
921 |
apply (drule HNatInfinite_whn [THEN [2] bspec]) |
|
922 |
apply (auto dest!: st_part_Ex simp add: SReal_iff) |
|
923 |
apply (blast intro: approx_trans3) |
|
924 |
done |
|
925 |
||
926 |
text{*Standard proof for free*} |
|
927 |
lemma Cauchy_convergent_iff: "Cauchy X = convergent X" |
|
928 |
by (simp add: NSCauchy_Cauchy_iff [symmetric] convergent_NSconvergent_iff NSCauchy_NSconvergent_iff) |
|
929 |
||
930 |
||
931 |
text{*We can now try and derive a few properties of sequences, |
|
932 |
starting with the limit comparison property for sequences.*} |
|
933 |
||
934 |
lemma NSLIMSEQ_le: |
|
935 |
"[| f ----NS> l; g ----NS> m; |
|
15360 | 936 |
\<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n) |
937 |
|] ==> l \<le> m" |
|
15082 | 938 |
apply (simp add: NSLIMSEQ_def, safe) |
939 |
apply (drule starfun_le_mono) |
|
940 |
apply (drule HNatInfinite_whn [THEN [2] bspec])+ |
|
941 |
apply (drule_tac x = whn in spec) |
|
942 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2])+ |
|
943 |
apply clarify |
|
944 |
apply (auto intro: hypreal_of_real_le_add_Infininitesimal_cancel2) |
|
945 |
done |
|
946 |
||
947 |
(* standard version *) |
|
948 |
lemma LIMSEQ_le: |
|
15360 | 949 |
"[| f ----> l; g ----> m; \<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n) |] |
15082 | 950 |
==> l \<le> m" |
951 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_le) |
|
952 |
||
953 |
lemma LIMSEQ_le_const: "[| X ----> r; \<forall>n. a \<le> X n |] ==> a \<le> r" |
|
954 |
apply (rule LIMSEQ_le) |
|
955 |
apply (rule LIMSEQ_const, auto) |
|
956 |
done |
|
957 |
||
958 |
lemma NSLIMSEQ_le_const: "[| X ----NS> r; \<forall>n. a \<le> X n |] ==> a \<le> r" |
|
959 |
by (simp add: LIMSEQ_NSLIMSEQ_iff LIMSEQ_le_const) |
|
960 |
||
961 |
lemma LIMSEQ_le_const2: "[| X ----> r; \<forall>n. X n \<le> a |] ==> r \<le> a" |
|
962 |
apply (rule LIMSEQ_le) |
|
963 |
apply (rule_tac [2] LIMSEQ_const, auto) |
|
964 |
done |
|
965 |
||
966 |
lemma NSLIMSEQ_le_const2: "[| X ----NS> r; \<forall>n. X n \<le> a |] ==> r \<le> a" |
|
967 |
by (simp add: LIMSEQ_NSLIMSEQ_iff LIMSEQ_le_const2) |
|
968 |
||
969 |
text{*Shift a convergent series by 1: |
|
970 |
By the equivalence between Cauchiness and convergence and because |
|
971 |
the successor of an infinite hypernatural is also infinite.*} |
|
972 |
||
973 |
lemma NSLIMSEQ_Suc: "f ----NS> l ==> (%n. f(Suc n)) ----NS> l" |
|
974 |
apply (frule NSconvergentI [THEN NSCauchy_NSconvergent_iff [THEN iffD2]]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
975 |
apply (auto simp add: NSCauchy_def NSLIMSEQ_def starfun_shift_one) |
15082 | 976 |
apply (drule bspec, assumption) |
977 |
apply (drule bspec, assumption) |
|
978 |
apply (drule Nats_1 [THEN [2] HNatInfinite_SHNat_add]) |
|
979 |
apply (blast intro: approx_trans3) |
|
980 |
done |
|
981 |
||
982 |
text{* standard version *} |
|
983 |
lemma LIMSEQ_Suc: "f ----> l ==> (%n. f(Suc n)) ----> l" |
|
984 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_Suc) |
|
985 |
||
986 |
lemma NSLIMSEQ_imp_Suc: "(%n. f(Suc n)) ----NS> l ==> f ----NS> l" |
|
987 |
apply (frule NSconvergentI [THEN NSCauchy_NSconvergent_iff [THEN iffD2]]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
988 |
apply (auto simp add: NSCauchy_def NSLIMSEQ_def starfun_shift_one) |
15082 | 989 |
apply (drule bspec, assumption) |
990 |
apply (drule bspec, assumption) |
|
991 |
apply (frule Nats_1 [THEN [2] HNatInfinite_SHNat_diff]) |
|
992 |
apply (drule_tac x="N - 1" in bspec) |
|
993 |
apply (auto intro: approx_trans3) |
|
994 |
done |
|
995 |
||
996 |
lemma LIMSEQ_imp_Suc: "(%n. f(Suc n)) ----> l ==> f ----> l" |
|
997 |
apply (simp add: LIMSEQ_NSLIMSEQ_iff) |
|
998 |
apply (erule NSLIMSEQ_imp_Suc) |
|
999 |
done |
|
1000 |
||
1001 |
lemma LIMSEQ_Suc_iff: "((%n. f(Suc n)) ----> l) = (f ----> l)" |
|
1002 |
by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc) |
|
1003 |
||
1004 |
lemma NSLIMSEQ_Suc_iff: "((%n. f(Suc n)) ----NS> l) = (f ----NS> l)" |
|
1005 |
by (blast intro: NSLIMSEQ_imp_Suc NSLIMSEQ_Suc) |
|
1006 |
||
1007 |
text{*A sequence tends to zero iff its abs does*} |
|
1008 |
lemma LIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----> 0) = (f ----> 0)" |
|
1009 |
by (simp add: LIMSEQ_def) |
|
1010 |
||
1011 |
text{*We prove the NS version from the standard one, since the NS proof |
|
1012 |
seems more complicated than the standard one above!*} |
|
1013 |
lemma NSLIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----NS> 0) = (f ----NS> 0)" |
|
1014 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_rabs_zero) |
|
1015 |
||
1016 |
text{*Generalization to other limits*} |
|
1017 |
lemma NSLIMSEQ_imp_rabs: "f ----NS> l ==> (%n. \<bar>f n\<bar>) ----NS> \<bar>l\<bar>" |
|
1018 |
apply (simp add: NSLIMSEQ_def) |
|
1019 |
apply (auto intro: approx_hrabs |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1020 |
simp add: starfun_abs hypreal_of_real_hrabs [symmetric]) |
15082 | 1021 |
done |
1022 |
||
1023 |
text{* standard version *} |
|
1024 |
lemma LIMSEQ_imp_rabs: "f ----> l ==> (%n. \<bar>f n\<bar>) ----> \<bar>l\<bar>" |
|
1025 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_imp_rabs) |
|
1026 |
||
1027 |
text{*An unbounded sequence's inverse tends to 0*} |
|
1028 |
||
1029 |
text{* standard proof seems easier *} |
|
1030 |
lemma LIMSEQ_inverse_zero: |
|
15360 | 1031 |
"\<forall>y. \<exists>N. \<forall>n \<ge> N. y < f(n) ==> (%n. inverse(f n)) ----> 0" |
15082 | 1032 |
apply (simp add: LIMSEQ_def, safe) |
1033 |
apply (drule_tac x = "inverse r" in spec, safe) |
|
1034 |
apply (rule_tac x = N in exI, safe) |
|
1035 |
apply (drule spec, auto) |
|
1036 |
apply (frule positive_imp_inverse_positive) |
|
1037 |
apply (frule order_less_trans, assumption) |
|
1038 |
apply (frule_tac a = "f n" in positive_imp_inverse_positive) |
|
1039 |
apply (simp add: abs_if) |
|
1040 |
apply (rule_tac t = r in inverse_inverse_eq [THEN subst]) |
|
1041 |
apply (auto intro: inverse_less_iff_less [THEN iffD2] |
|
1042 |
simp del: inverse_inverse_eq) |
|
1043 |
done |
|
1044 |
||
1045 |
lemma NSLIMSEQ_inverse_zero: |
|
15360 | 1046 |
"\<forall>y. \<exists>N. \<forall>n \<ge> N. y < f(n) |
15082 | 1047 |
==> (%n. inverse(f n)) ----NS> 0" |
1048 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_zero) |
|
1049 |
||
1050 |
text{*The sequence @{term "1/n"} tends to 0 as @{term n} tends to infinity*} |
|
1051 |
||
1052 |
lemma LIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) ----> 0" |
|
1053 |
apply (rule LIMSEQ_inverse_zero, safe) |
|
1054 |
apply (cut_tac x = y in reals_Archimedean2) |
|
1055 |
apply (safe, rule_tac x = n in exI) |
|
1056 |
apply (auto simp add: real_of_nat_Suc) |
|
1057 |
done |
|
1058 |
||
1059 |
lemma NSLIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) ----NS> 0" |
|
1060 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat) |
|
1061 |
||
1062 |
text{*The sequence @{term "r + 1/n"} tends to @{term r} as @{term n} tends to |
|
1063 |
infinity is now easily proved*} |
|
1064 |
||
1065 |
lemma LIMSEQ_inverse_real_of_nat_add: |
|
1066 |
"(%n. r + inverse(real(Suc n))) ----> r" |
|
1067 |
by (cut_tac LIMSEQ_add [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto) |
|
1068 |
||
1069 |
lemma NSLIMSEQ_inverse_real_of_nat_add: |
|
1070 |
"(%n. r + inverse(real(Suc n))) ----NS> r" |
|
1071 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add) |
|
1072 |
||
1073 |
lemma LIMSEQ_inverse_real_of_nat_add_minus: |
|
1074 |
"(%n. r + -inverse(real(Suc n))) ----> r" |
|
1075 |
by (cut_tac LIMSEQ_add_minus [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto) |
|
1076 |
||
1077 |
lemma NSLIMSEQ_inverse_real_of_nat_add_minus: |
|
1078 |
"(%n. r + -inverse(real(Suc n))) ----NS> r" |
|
1079 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add_minus) |
|
1080 |
||
1081 |
lemma LIMSEQ_inverse_real_of_nat_add_minus_mult: |
|
1082 |
"(%n. r*( 1 + -inverse(real(Suc n)))) ----> r" |
|
1083 |
by (cut_tac b=1 in |
|
1084 |
LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat_add_minus], auto) |
|
1085 |
||
1086 |
lemma NSLIMSEQ_inverse_real_of_nat_add_minus_mult: |
|
1087 |
"(%n. r*( 1 + -inverse(real(Suc n)))) ----NS> r" |
|
1088 |
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add_minus_mult) |
|
1089 |
||
1090 |
||
1091 |
text{* Real Powers*} |
|
1092 |
||
1093 |
lemma NSLIMSEQ_pow [rule_format]: |
|
1094 |
"(X ----NS> a) --> ((%n. (X n) ^ m) ----NS> a ^ m)" |
|
15251 | 1095 |
apply (induct "m") |
15082 | 1096 |
apply (auto intro: NSLIMSEQ_mult NSLIMSEQ_const) |
1097 |
done |
|
1098 |
||
1099 |
lemma LIMSEQ_pow: "X ----> a ==> (%n. (X n) ^ m) ----> a ^ m" |
|
1100 |
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_pow) |
|
1101 |
||
1102 |
text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term |
|
1103 |
"x<1"}. Proof will use (NS) Cauchy equivalence for convergence and |
|
1104 |
also fact that bounded and monotonic sequence converges.*} |
|
1105 |
||
1106 |
lemma Bseq_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> Bseq (%n. x ^ n)" |
|
1107 |
apply (simp add: Bseq_def) |
|
1108 |
apply (rule_tac x = 1 in exI) |
|
1109 |
apply (simp add: power_abs) |
|
1110 |
apply (auto dest: power_mono intro: order_less_imp_le simp add: abs_if) |
|
1111 |
done |
|
1112 |
||
1113 |
lemma monoseq_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> monoseq (%n. x ^ n)" |
|
1114 |
apply (clarify intro!: mono_SucI2) |
|
1115 |
apply (cut_tac n = n and N = "Suc n" and a = x in power_decreasing, auto) |
|
1116 |
done |
|
1117 |
||
1118 |
lemma convergent_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> convergent (%n. x ^ n)" |
|
1119 |
by (blast intro!: Bseq_monoseq_convergent Bseq_realpow monoseq_realpow) |
|
1120 |
||
1121 |
text{* We now use NS criterion to bring proof of theorem through *} |
|
1122 |
||
1123 |
lemma NSLIMSEQ_realpow_zero: "[| 0 \<le> x; x < 1 |] ==> (%n. x ^ n) ----NS> 0" |
|
1124 |
apply (simp add: NSLIMSEQ_def) |
|
1125 |
apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff) |
|
1126 |
apply (frule NSconvergentD) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1127 |
apply (auto simp add: NSLIMSEQ_def NSCauchy_NSconvergent_iff [symmetric] NSCauchy_def starfun_pow) |
15082 | 1128 |
apply (frule HNatInfinite_add_one) |
1129 |
apply (drule bspec, assumption) |
|
1130 |
apply (drule bspec, assumption) |
|
1131 |
apply (drule_tac x = "N + (1::hypnat) " in bspec, assumption) |
|
1132 |
apply (simp add: hyperpow_add) |
|
1133 |
apply (drule approx_mult_subst_SReal, assumption) |
|
1134 |
apply (drule approx_trans3, assumption) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1135 |
apply (auto simp del: star_of_mult simp add: star_of_mult [symmetric]) |
15082 | 1136 |
done |
1137 |
||
1138 |
text{* standard version *} |
|
1139 |
lemma LIMSEQ_realpow_zero: "[| 0 \<le> x; x < 1 |] ==> (%n. x ^ n) ----> 0" |
|
1140 |
by (simp add: NSLIMSEQ_realpow_zero LIMSEQ_NSLIMSEQ_iff) |
|
1141 |
||
1142 |
lemma LIMSEQ_divide_realpow_zero: "1 < x ==> (%n. a / (x ^ n)) ----> 0" |
|
1143 |
apply (cut_tac a = a and x1 = "inverse x" in |
|
1144 |
LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_realpow_zero]) |
|
1145 |
apply (auto simp add: divide_inverse power_inverse) |
|
1146 |
apply (simp add: inverse_eq_divide pos_divide_less_eq) |
|
1147 |
done |
|
1148 |
||
15102 | 1149 |
text{*Limit of @{term "c^n"} for @{term"\<bar>c\<bar> < 1"}*} |
15082 | 1150 |
|
1151 |
lemma LIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < 1 ==> (%n. \<bar>c\<bar> ^ n) ----> 0" |
|
1152 |
by (blast intro!: LIMSEQ_realpow_zero abs_ge_zero) |
|
1153 |
||
1154 |
lemma NSLIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < 1 ==> (%n. \<bar>c\<bar> ^ n) ----NS> 0" |
|
1155 |
by (simp add: LIMSEQ_rabs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric]) |
|
1156 |
||
1157 |
lemma LIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < 1 ==> (%n. c ^ n) ----> 0" |
|
1158 |
apply (rule LIMSEQ_rabs_zero [THEN iffD1]) |
|
1159 |
apply (auto intro: LIMSEQ_rabs_realpow_zero simp add: power_abs) |
|
1160 |
done |
|
1161 |
||
1162 |
lemma NSLIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < 1 ==> (%n. c ^ n) ----NS> 0" |
|
1163 |
by (simp add: LIMSEQ_rabs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric]) |
|
1164 |
||
1165 |
subsection{*Hyperreals and Sequences*} |
|
1166 |
||
1167 |
text{*A bounded sequence is a finite hyperreal*} |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1168 |
lemma NSBseq_HFinite_hypreal: "NSBseq X ==> star_n X : HFinite" |
17298 | 1169 |
by (auto intro!: bexI lemma_starrel_refl |
15082 | 1170 |
intro: FreeUltrafilterNat_all [THEN FreeUltrafilterNat_subset] |
1171 |
simp add: HFinite_FreeUltrafilterNat_iff Bseq_NSBseq_iff [symmetric] |
|
1172 |
Bseq_iff1a) |
|
1173 |
||
1174 |
text{*A sequence converging to zero defines an infinitesimal*} |
|
1175 |
lemma NSLIMSEQ_zero_Infinitesimal_hypreal: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1176 |
"X ----NS> 0 ==> star_n X : Infinitesimal" |
15082 | 1177 |
apply (simp add: NSLIMSEQ_def) |
1178 |
apply (drule_tac x = whn in bspec) |
|
1179 |
apply (simp add: HNatInfinite_whn) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17299
diff
changeset
|
1180 |
apply (auto simp add: hypnat_omega_def mem_infmal_iff [symmetric] starfun) |
15082 | 1181 |
done |
1182 |
||
1183 |
(***--------------------------------------------------------------- |
|
1184 |
Theorems proved by Harrison in HOL that we do not need |
|
1185 |
in order to prove equivalence between Cauchy criterion |
|
1186 |
and convergence: |
|
1187 |
-- Show that every sequence contains a monotonic subsequence |
|
1188 |
Goal "\<exists>f. subseq f & monoseq (%n. s (f n))" |
|
1189 |
-- Show that a subsequence of a bounded sequence is bounded |
|
1190 |
Goal "Bseq X ==> Bseq (%n. X (f n))"; |
|
1191 |
-- Show we can take subsequential terms arbitrarily far |
|
1192 |
up a sequence |
|
1193 |
Goal "subseq f ==> n \<le> f(n)"; |
|
1194 |
Goal "subseq f ==> \<exists>n. N1 \<le> n & N2 \<le> f(n)"; |
|
1195 |
---------------------------------------------------------------***) |
|
1196 |
||
10751 | 1197 |
end |