author | paulson |
Thu, 27 Nov 2003 10:47:55 +0100 | |
changeset 14268 | 5cf13e80be0e |
parent 13810 | c3fbfd472365 |
child 14269 | 502a7c95de73 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : SEQ.ML |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : Theory of sequence and series of real numbers |
|
5 |
*) |
|
6 |
||
7 |
(*--------------------------------------------------------------------------- |
|
8 |
Example of an hypersequence (i.e. an extended standard sequence) |
|
9 |
whose term with an hypernatural suffix is an infinitesimal i.e. |
|
10 |
the whn'nth term of the hypersequence is a member of Infinitesimal |
|
11 |
-------------------------------------------------------------------------- *) |
|
12 |
||
13 |
Goalw [hypnat_omega_def] |
|
13810 | 14 |
"( *fNat* (%n::nat. inverse(real(Suc n)))) whn : Infinitesimal"; |
10751 | 15 |
by (auto_tac (claset(), |
16 |
simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff,starfunNat])); |
|
17 |
by (rtac bexI 1 THEN rtac lemma_hyprel_refl 2); |
|
18 |
by (auto_tac (claset(), |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
19 |
simpset() addsimps [real_of_nat_Suc_gt_zero, abs_eqI2, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
20 |
FreeUltrafilterNat_inverse_real_of_posnat])); |
10751 | 21 |
qed "SEQ_Infinitesimal"; |
22 |
||
23 |
(*-------------------------------------------------------------------------- |
|
24 |
Rules for LIMSEQ and NSLIMSEQ etc. |
|
25 |
--------------------------------------------------------------------------*) |
|
26 |
||
27 |
Goalw [LIMSEQ_def] |
|
28 |
"(X ----> L) = \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
29 |
\ (ALL r. 0 <r --> (EX no. ALL n. no <= n --> abs(X n + -L) < r))"; |
10751 | 30 |
by (Simp_tac 1); |
31 |
qed "LIMSEQ_iff"; |
|
32 |
||
33 |
Goalw [NSLIMSEQ_def] |
|
13810 | 34 |
"(X ----NS> L) = (ALL N: HNatInfinite. ( *fNat* X) N @= hypreal_of_real L)"; |
10751 | 35 |
by (Simp_tac 1); |
36 |
qed "NSLIMSEQ_iff"; |
|
37 |
||
38 |
(*---------------------------------------- |
|
39 |
LIMSEQ ==> NSLIMSEQ |
|
40 |
---------------------------------------*) |
|
41 |
Goalw [LIMSEQ_def,NSLIMSEQ_def] |
|
42 |
"X ----> L ==> X ----NS> L"; |
|
43 |
by (auto_tac (claset(),simpset() addsimps |
|
44 |
[HNatInfinite_FreeUltrafilterNat_iff])); |
|
45 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
46 |
by (rtac (approx_minus_iff RS iffD2) 1); |
10751 | 47 |
by (auto_tac (claset(),simpset() addsimps [starfunNat, |
48 |
mem_infmal_iff RS sym,hypreal_of_real_def, |
|
49 |
hypreal_minus,hypreal_add, |
|
50 |
Infinitesimal_FreeUltrafilterNat_iff])); |
|
51 |
by (EVERY[rtac bexI 1, rtac lemma_hyprel_refl 2, Step_tac 1]); |
|
52 |
by (dres_inst_tac [("x","u")] spec 1 THEN Step_tac 1); |
|
53 |
by (dres_inst_tac [("x","no")] spec 1); |
|
54 |
by (Fuf_tac 1); |
|
55 |
by (blast_tac (claset() addDs [less_imp_le]) 1); |
|
56 |
qed "LIMSEQ_NSLIMSEQ"; |
|
57 |
||
58 |
(*------------------------------------------------------------- |
|
59 |
NSLIMSEQ ==> LIMSEQ |
|
60 |
proving NS def ==> Standard def is trickier as usual |
|
61 |
-------------------------------------------------------------*) |
|
62 |
(* the following sequence f(n) defines a hypernatural *) |
|
63 |
(* lemmas etc. first *) |
|
64 |
Goal "!!(f::nat=>nat). ALL n. n <= f n \ |
|
65 |
\ ==> {n. f n = 0} = {0} | {n. f n = 0} = {}"; |
|
66 |
by (Auto_tac); |
|
67 |
by (dres_inst_tac [("x","xa")] spec 1); |
|
68 |
by (dres_inst_tac [("x","x")] spec 2); |
|
69 |
by (Auto_tac); |
|
70 |
val lemma_NSLIMSEQ1 = result(); |
|
71 |
||
72 |
Goal "{n. f n <= Suc u} = {n. f n <= u} Un {n. f n = Suc u}"; |
|
73 |
by (auto_tac (claset(),simpset() addsimps [le_Suc_eq])); |
|
74 |
val lemma_NSLIMSEQ2 = result(); |
|
75 |
||
76 |
Goal "!!(f::nat=>nat). ALL n. n <= f n \ |
|
77 |
\ ==> {n. f n = Suc u} <= {n. n <= Suc u}"; |
|
78 |
by (Auto_tac); |
|
79 |
by (dres_inst_tac [("x","x")] spec 1); |
|
80 |
by (Auto_tac); |
|
81 |
val lemma_NSLIMSEQ3 = result(); |
|
82 |
||
83 |
Goal "!!(f::nat=>nat). ALL n. n <= f n \ |
|
84 |
\ ==> finite {n. f n <= u}"; |
|
85 |
by (induct_tac "u" 1); |
|
86 |
by (auto_tac (claset(),simpset() addsimps [lemma_NSLIMSEQ2])); |
|
87 |
by (auto_tac (claset() addIs [(lemma_NSLIMSEQ3 RS finite_subset), |
|
88 |
finite_nat_le_segment], simpset())); |
|
89 |
by (dtac lemma_NSLIMSEQ1 1 THEN Step_tac 1); |
|
90 |
by (ALLGOALS(Asm_simp_tac)); |
|
91 |
qed "NSLIMSEQ_finite_set"; |
|
92 |
||
93 |
Goal "- {n. u < (f::nat=>nat) n} = {n. f n <= u}"; |
|
94 |
by (auto_tac (claset() addDs [less_le_trans], |
|
95 |
simpset() addsimps [le_def])); |
|
96 |
qed "Compl_less_set"; |
|
97 |
||
98 |
(* the index set is in the free ultrafilter *) |
|
99 |
Goal "!!(f::nat=>nat). ALL n. n <= f n \ |
|
100 |
\ ==> {n. u < f n} : FreeUltrafilterNat"; |
|
101 |
by (rtac (FreeUltrafilterNat_Compl_iff2 RS iffD2) 1); |
|
102 |
by (rtac FreeUltrafilterNat_finite 1); |
|
103 |
by (auto_tac (claset() addDs [NSLIMSEQ_finite_set], |
|
104 |
simpset() addsimps [Compl_less_set])); |
|
105 |
qed "FreeUltrafilterNat_NSLIMSEQ"; |
|
106 |
||
107 |
(* thus, the sequence defines an infinite hypernatural! *) |
|
108 |
Goal "ALL n. n <= f n \ |
|
10834 | 109 |
\ ==> Abs_hypnat (hypnatrel `` {f}) : HNatInfinite"; |
10751 | 110 |
by (auto_tac (claset(),simpset() addsimps [HNatInfinite_FreeUltrafilterNat_iff])); |
111 |
by (EVERY[rtac bexI 1, rtac lemma_hypnatrel_refl 2, Step_tac 1]); |
|
112 |
by (etac FreeUltrafilterNat_NSLIMSEQ 1); |
|
113 |
qed "HNatInfinite_NSLIMSEQ"; |
|
114 |
||
115 |
val lemmaLIM = CLAIM "{n. X (f n) + - L = Y n} Int {n. abs (Y n) < r} <= \ |
|
116 |
\ {n. abs (X (f n) + - L) < r}"; |
|
117 |
||
118 |
Goal "{n. abs (X (f n) + - L) < r} Int {n. r <= abs (X (f n) + - (L::real))} \ |
|
119 |
\ = {}"; |
|
120 |
by Auto_tac; |
|
121 |
val lemmaLIM2 = result(); |
|
122 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
123 |
Goal "[| 0 < r; ALL n. r <= abs (X (f n) + - L); \ |
13810 | 124 |
\ ( *fNat* X) (Abs_hypnat (hypnatrel `` {f})) + \ |
10751 | 125 |
\ - hypreal_of_real L @= 0 |] ==> False"; |
126 |
by (auto_tac (claset(),simpset() addsimps [starfunNat, |
|
127 |
mem_infmal_iff RS sym,hypreal_of_real_def, |
|
128 |
hypreal_minus,hypreal_add, |
|
129 |
Infinitesimal_FreeUltrafilterNat_iff])); |
|
130 |
by (dres_inst_tac [("x","r")] spec 1 THEN Step_tac 1); |
|
131 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
132 |
by (dtac (lemmaLIM RSN (2,FreeUltrafilterNat_subset)) 1); |
|
133 |
by (dtac FreeUltrafilterNat_all 1); |
|
134 |
by (thin_tac "{n. abs (Y n) < r} : FreeUltrafilterNat" 1); |
|
135 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
136 |
by (asm_full_simp_tac (simpset() addsimps [lemmaLIM2, |
|
137 |
FreeUltrafilterNat_empty]) 1); |
|
138 |
val lemmaLIM3 = result(); |
|
139 |
||
140 |
Goalw [LIMSEQ_def,NSLIMSEQ_def] |
|
141 |
"X ----NS> L ==> X ----> L"; |
|
142 |
by (rtac ccontr 1 THEN Asm_full_simp_tac 1); |
|
143 |
by (Step_tac 1); |
|
144 |
(* skolemization step *) |
|
145 |
by (dtac choice 1 THEN Step_tac 1); |
|
10834 | 146 |
by (dres_inst_tac [("x","Abs_hypnat(hypnatrel``{f})")] bspec 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
147 |
by (dtac (approx_minus_iff RS iffD1) 2); |
10751 | 148 |
by (fold_tac [real_le_def]); |
149 |
by (blast_tac (claset() addIs [HNatInfinite_NSLIMSEQ]) 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
150 |
by (blast_tac (claset() addIs [lemmaLIM3]) 1); |
10751 | 151 |
qed "NSLIMSEQ_LIMSEQ"; |
152 |
||
153 |
(* Now the all important result is trivially proved! *) |
|
154 |
Goal "(f ----> L) = (f ----NS> L)"; |
|
155 |
by (blast_tac (claset() addIs [LIMSEQ_NSLIMSEQ,NSLIMSEQ_LIMSEQ]) 1); |
|
156 |
qed "LIMSEQ_NSLIMSEQ_iff"; |
|
157 |
||
158 |
(*------------------------------------------------------------------- |
|
159 |
Theorems about sequences |
|
160 |
------------------------------------------------------------------*) |
|
161 |
Goalw [NSLIMSEQ_def] "(%n. k) ----NS> k"; |
|
162 |
by (Auto_tac); |
|
163 |
qed "NSLIMSEQ_const"; |
|
164 |
||
165 |
Goalw [LIMSEQ_def] "(%n. k) ----> k"; |
|
166 |
by (Auto_tac); |
|
167 |
qed "LIMSEQ_const"; |
|
168 |
||
169 |
Goalw [NSLIMSEQ_def] |
|
170 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n + Y n) ----NS> a + b"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
171 |
by (auto_tac (claset() addIs [approx_add], |
10751 | 172 |
simpset() addsimps [starfunNat_add RS sym])); |
173 |
qed "NSLIMSEQ_add"; |
|
174 |
||
175 |
Goal "[| X ----> a; Y ----> b |] ==> (%n. X n + Y n) ----> a + b"; |
|
176 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
177 |
NSLIMSEQ_add]) 1); |
|
178 |
qed "LIMSEQ_add"; |
|
179 |
||
180 |
Goalw [NSLIMSEQ_def] |
|
181 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n * Y n) ----NS> a * b"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
182 |
by (auto_tac (claset() addSIs [approx_mult_HFinite], |
10751 | 183 |
simpset() addsimps [hypreal_of_real_mult, starfunNat_mult RS sym])); |
184 |
qed "NSLIMSEQ_mult"; |
|
185 |
||
186 |
Goal "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b"; |
|
187 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
188 |
NSLIMSEQ_mult]) 1); |
|
189 |
qed "LIMSEQ_mult"; |
|
190 |
||
191 |
Goalw [NSLIMSEQ_def] |
|
192 |
"X ----NS> a ==> (%n. -(X n)) ----NS> -a"; |
|
193 |
by (auto_tac (claset(), simpset() addsimps [starfunNat_minus RS sym])); |
|
194 |
qed "NSLIMSEQ_minus"; |
|
195 |
||
196 |
Goal "X ----> a ==> (%n. -(X n)) ----> -a"; |
|
197 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
198 |
NSLIMSEQ_minus]) 1); |
|
199 |
qed "LIMSEQ_minus"; |
|
200 |
||
201 |
Goal "(%n. -(X n)) ----> -a ==> X ----> a"; |
|
202 |
by (dtac LIMSEQ_minus 1); |
|
203 |
by (Asm_full_simp_tac 1); |
|
204 |
qed "LIMSEQ_minus_cancel"; |
|
205 |
||
206 |
Goal "(%n. -(X n)) ----NS> -a ==> X ----NS> a"; |
|
207 |
by (dtac NSLIMSEQ_minus 1); |
|
208 |
by (Asm_full_simp_tac 1); |
|
209 |
qed "NSLIMSEQ_minus_cancel"; |
|
210 |
||
211 |
Goal "[| X ----NS> a; Y ----NS> b |] \ |
|
212 |
\ ==> (%n. X n + -Y n) ----NS> a + -b"; |
|
213 |
by (dres_inst_tac [("X","Y")] NSLIMSEQ_minus 1); |
|
214 |
by (auto_tac (claset(),simpset() addsimps [NSLIMSEQ_add])); |
|
215 |
qed "NSLIMSEQ_add_minus"; |
|
216 |
||
217 |
Goal "[| X ----> a; Y ----> b |] \ |
|
218 |
\ ==> (%n. X n + -Y n) ----> a + -b"; |
|
219 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
220 |
NSLIMSEQ_add_minus]) 1); |
|
221 |
qed "LIMSEQ_add_minus"; |
|
222 |
||
223 |
Goalw [real_diff_def] |
|
224 |
"[| X ----> a; Y ----> b |] ==> (%n. X n - Y n) ----> a - b"; |
|
225 |
by (blast_tac (claset() addIs [LIMSEQ_add_minus]) 1); |
|
226 |
qed "LIMSEQ_diff"; |
|
227 |
||
228 |
Goalw [real_diff_def] |
|
229 |
"[| X ----NS> a; Y ----NS> b |] ==> (%n. X n - Y n) ----NS> a - b"; |
|
230 |
by (blast_tac (claset() addIs [NSLIMSEQ_add_minus]) 1); |
|
231 |
qed "NSLIMSEQ_diff"; |
|
232 |
||
233 |
(*--------------------------------------------------------------- |
|
234 |
Proof is like that of NSLIM_inverse. |
|
235 |
--------------------------------------------------------------*) |
|
236 |
Goalw [NSLIMSEQ_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
237 |
"[| X ----NS> a; a ~= 0 |] ==> (%n. inverse(X n)) ----NS> inverse(a)"; |
10751 | 238 |
by (Clarify_tac 1); |
239 |
by (dtac bspec 1); |
|
240 |
by (auto_tac (claset(), |
|
241 |
simpset() addsimps [starfunNat_inverse RS sym, |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
242 |
hypreal_of_real_approx_inverse])); |
10751 | 243 |
qed "NSLIMSEQ_inverse"; |
244 |
||
245 |
||
246 |
(*------ Standard version of theorem -------*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
247 |
Goal "[| X ----> a; a ~= 0 |] ==> (%n. inverse(X n)) ----> inverse(a)"; |
10751 | 248 |
by (asm_full_simp_tac (simpset() addsimps [NSLIMSEQ_inverse, |
249 |
LIMSEQ_NSLIMSEQ_iff]) 1); |
|
250 |
qed "LIMSEQ_inverse"; |
|
251 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
252 |
Goal "[| X ----NS> a; Y ----NS> b; b ~= 0 |] \ |
10751 | 253 |
\ ==> (%n. X n / Y n) ----NS> a/b"; |
254 |
by (asm_full_simp_tac (simpset() addsimps [NSLIMSEQ_mult, NSLIMSEQ_inverse, |
|
255 |
real_divide_def]) 1); |
|
256 |
qed "NSLIMSEQ_mult_inverse"; |
|
257 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
258 |
Goal "[| X ----> a; Y ----> b; b ~= 0 |] ==> (%n. X n / Y n) ----> a/b"; |
10751 | 259 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_mult, LIMSEQ_inverse, |
260 |
real_divide_def]) 1); |
|
261 |
qed "LIMSEQ_divide"; |
|
262 |
||
263 |
(*----------------------------------------------- |
|
264 |
Uniqueness of limit |
|
265 |
----------------------------------------------*) |
|
266 |
Goalw [NSLIMSEQ_def] |
|
267 |
"[| X ----NS> a; X ----NS> b |] ==> a = b"; |
|
268 |
by (REPEAT(dtac (HNatInfinite_whn RSN (2,bspec)) 1)); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
269 |
by (auto_tac (claset() addDs [approx_trans3], simpset())); |
10751 | 270 |
qed "NSLIMSEQ_unique"; |
271 |
||
272 |
Goal "[| X ----> a; X ----> b |] ==> a = b"; |
|
273 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
274 |
NSLIMSEQ_unique]) 1); |
|
275 |
qed "LIMSEQ_unique"; |
|
276 |
||
277 |
(*----------------------------------------------------------------- |
|
278 |
theorems about nslim and lim |
|
279 |
----------------------------------------------------------------*) |
|
280 |
Goalw [lim_def] "X ----> L ==> lim X = L"; |
|
281 |
by (blast_tac (claset() addIs [LIMSEQ_unique]) 1); |
|
282 |
qed "limI"; |
|
283 |
||
284 |
Goalw [nslim_def] "X ----NS> L ==> nslim X = L"; |
|
285 |
by (blast_tac (claset() addIs [NSLIMSEQ_unique]) 1); |
|
286 |
qed "nslimI"; |
|
287 |
||
288 |
Goalw [lim_def,nslim_def] "lim X = nslim X"; |
|
289 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff]) 1); |
|
290 |
qed "lim_nslim_iff"; |
|
291 |
||
292 |
(*------------------------------------------------------------------ |
|
293 |
Convergence |
|
294 |
-----------------------------------------------------------------*) |
|
295 |
Goalw [convergent_def] |
|
296 |
"convergent X ==> EX L. (X ----> L)"; |
|
297 |
by (assume_tac 1); |
|
298 |
qed "convergentD"; |
|
299 |
||
300 |
Goalw [convergent_def] |
|
301 |
"(X ----> L) ==> convergent X"; |
|
302 |
by (Blast_tac 1); |
|
303 |
qed "convergentI"; |
|
304 |
||
305 |
Goalw [NSconvergent_def] |
|
306 |
"NSconvergent X ==> EX L. (X ----NS> L)"; |
|
307 |
by (assume_tac 1); |
|
308 |
qed "NSconvergentD"; |
|
309 |
||
310 |
Goalw [NSconvergent_def] |
|
311 |
"(X ----NS> L) ==> NSconvergent X"; |
|
312 |
by (Blast_tac 1); |
|
313 |
qed "NSconvergentI"; |
|
314 |
||
315 |
Goalw [convergent_def,NSconvergent_def] |
|
316 |
"convergent X = NSconvergent X"; |
|
317 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff]) 1); |
|
318 |
qed "convergent_NSconvergent_iff"; |
|
319 |
||
320 |
Goalw [NSconvergent_def,nslim_def] |
|
321 |
"NSconvergent X = (X ----NS> nslim X)"; |
|
322 |
by (auto_tac (claset() addIs [someI], simpset())); |
|
323 |
qed "NSconvergent_NSLIMSEQ_iff"; |
|
324 |
||
325 |
Goalw [convergent_def,lim_def] |
|
326 |
"convergent X = (X ----> lim X)"; |
|
327 |
by (auto_tac (claset() addIs [someI], simpset())); |
|
328 |
qed "convergent_LIMSEQ_iff"; |
|
329 |
||
330 |
(*------------------------------------------------------------------- |
|
331 |
Subsequence (alternative definition) (e.g. Hoskins) |
|
332 |
------------------------------------------------------------------*) |
|
333 |
Goalw [subseq_def] "subseq f = (ALL n. (f n) < (f (Suc n)))"; |
|
334 |
by (auto_tac (claset() addSDs [less_imp_Suc_add], simpset())); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
335 |
by (induct_tac "k" 1); |
10751 | 336 |
by (auto_tac (claset() addIs [less_trans], simpset())); |
337 |
qed "subseq_Suc_iff"; |
|
338 |
||
339 |
(*------------------------------------------------------------------- |
|
340 |
Monotonicity |
|
341 |
------------------------------------------------------------------*) |
|
342 |
||
343 |
Goalw [monoseq_def] |
|
344 |
"monoseq X = ((ALL n. X n <= X (Suc n)) \ |
|
345 |
\ | (ALL n. X (Suc n) <= X n))"; |
|
346 |
by (auto_tac (claset () addSDs [le_imp_less_or_eq], simpset())); |
|
347 |
by (auto_tac (claset() addSIs [lessI RS less_imp_le] |
|
348 |
addSDs [less_imp_Suc_add], |
|
349 |
simpset())); |
|
350 |
by (induct_tac "ka" 1); |
|
351 |
by (auto_tac (claset() addIs [order_trans], simpset())); |
|
352 |
by (EVERY1[rtac ccontr, rtac swap, Simp_tac]); |
|
353 |
by (induct_tac "k" 1); |
|
354 |
by (auto_tac (claset() addIs [order_trans], simpset())); |
|
355 |
qed "monoseq_Suc"; |
|
356 |
||
357 |
Goalw [monoseq_def] |
|
358 |
"ALL m n. m <= n --> X m <= X n ==> monoseq X"; |
|
359 |
by (Blast_tac 1); |
|
360 |
qed "monoI1"; |
|
361 |
||
362 |
Goalw [monoseq_def] |
|
363 |
"ALL m n. m <= n --> X n <= X m ==> monoseq X"; |
|
364 |
by (Blast_tac 1); |
|
365 |
qed "monoI2"; |
|
366 |
||
367 |
Goal "ALL n. X n <= X (Suc n) ==> monoseq X"; |
|
368 |
by (asm_simp_tac (simpset() addsimps [monoseq_Suc]) 1); |
|
369 |
qed "mono_SucI1"; |
|
370 |
||
371 |
Goal "ALL n. X (Suc n) <= X n ==> monoseq X"; |
|
372 |
by (asm_simp_tac (simpset() addsimps [monoseq_Suc]) 1); |
|
373 |
qed "mono_SucI2"; |
|
374 |
||
375 |
(*------------------------------------------------------------------- |
|
376 |
Bounded Sequence |
|
377 |
------------------------------------------------------------------*) |
|
378 |
Goalw [Bseq_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
379 |
"Bseq X ==> EX K. 0 < K & (ALL n. abs(X n) <= K)"; |
10751 | 380 |
by (assume_tac 1); |
381 |
qed "BseqD"; |
|
382 |
||
383 |
Goalw [Bseq_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
384 |
"[| 0 < K; ALL n. abs(X n) <= K |] ==> Bseq X"; |
10751 | 385 |
by (Blast_tac 1); |
386 |
qed "BseqI"; |
|
387 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
388 |
Goal "(EX K. 0 < K & (ALL n. abs(X n) <= K)) = \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
389 |
\ (EX N. ALL n. abs(X n) <= real(Suc N))"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
390 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
391 |
by (cut_inst_tac [("x","K")] reals_Archimedean2 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
392 |
by (Clarify_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
393 |
by (res_inst_tac [("x","n")] exI 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
394 |
by (Clarify_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
395 |
by (dres_inst_tac [("x","na")] spec 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
396 |
by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc])); |
10751 | 397 |
qed "lemma_NBseq_def"; |
398 |
||
399 |
(* alternative definition for Bseq *) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
400 |
Goalw [Bseq_def] "Bseq X = (EX N. ALL n. abs(X n) <= real(Suc N))"; |
10751 | 401 |
by (simp_tac (simpset() addsimps [lemma_NBseq_def]) 1); |
402 |
qed "Bseq_iff"; |
|
403 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
404 |
Goal "(EX K. 0 < K & (ALL n. abs(X n) <= K)) = \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
405 |
\ (EX N. ALL n. abs(X n) < real(Suc N))"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
406 |
by (stac lemma_NBseq_def 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
407 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
408 |
by (res_inst_tac [("x","Suc N")] exI 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
409 |
by (res_inst_tac [("x","N")] exI 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
410 |
by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
411 |
by (blast_tac (claset() addIs [order_less_imp_le]) 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
412 |
by (dres_inst_tac [("x","n")] spec 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
413 |
by (Asm_simp_tac 1); |
10751 | 414 |
qed "lemma_NBseq_def2"; |
415 |
||
416 |
(* yet another definition for Bseq *) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
417 |
Goalw [Bseq_def] "Bseq X = (EX N. ALL n. abs(X n) < real(Suc N))"; |
10751 | 418 |
by (simp_tac (simpset() addsimps [lemma_NBseq_def2]) 1); |
419 |
qed "Bseq_iff1a"; |
|
420 |
||
421 |
Goalw [NSBseq_def] |
|
13810 | 422 |
"[| NSBseq X; N: HNatInfinite |] ==> ( *fNat* X) N : HFinite"; |
10751 | 423 |
by (Blast_tac 1); |
424 |
qed "NSBseqD"; |
|
425 |
||
426 |
Goalw [NSBseq_def] |
|
13810 | 427 |
"ALL N: HNatInfinite. ( *fNat* X) N : HFinite ==> NSBseq X"; |
10751 | 428 |
by (assume_tac 1); |
429 |
qed "NSBseqI"; |
|
430 |
||
431 |
(*----------------------------------------------------------- |
|
432 |
Standard definition ==> NS definition |
|
433 |
----------------------------------------------------------*) |
|
434 |
(* a few lemmas *) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
435 |
Goal "ALL n. abs(X n) <= K ==> ALL n. abs(X((f::nat=>nat) n)) <= K"; |
10751 | 436 |
by (Auto_tac); |
437 |
val lemma_Bseq = result(); |
|
438 |
||
439 |
Goalw [Bseq_def,NSBseq_def] "Bseq X ==> NSBseq X"; |
|
440 |
by (Step_tac 1); |
|
441 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
442 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
443 |
simpset() addsimps [starfunNat, HFinite_FreeUltrafilterNat_iff, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
444 |
HNatInfinite_FreeUltrafilterNat_iff])); |
10751 | 445 |
by (EVERY[rtac bexI 1, rtac lemma_hyprel_refl 2]); |
446 |
by (dres_inst_tac [("f","Xa")] lemma_Bseq 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
447 |
by (res_inst_tac [("x","K+1")] exI 1); |
10751 | 448 |
by (rotate_tac 2 1 THEN dtac FreeUltrafilterNat_all 1); |
449 |
by (Ultra_tac 1); |
|
450 |
qed "Bseq_NSBseq"; |
|
451 |
||
452 |
(*--------------------------------------------------------------- |
|
453 |
NS definition ==> Standard definition |
|
454 |
---------------------------------------------------------------*) |
|
455 |
(* similar to NSLIM proof in REALTOPOS *) |
|
456 |
(*------------------------------------------------------------------- |
|
457 |
We need to get rid of the real variable and do so by proving the |
|
458 |
following which relies on the Archimedean property of the reals |
|
459 |
When we skolemize we then get the required function f::nat=>nat |
|
460 |
o/w we would be stuck with a skolem function f :: real=>nat which |
|
461 |
is not what we want (read useless!) |
|
462 |
-------------------------------------------------------------------*) |
|
463 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
464 |
Goal "ALL K. 0 < K --> (EX n. K < abs (X n)) \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
465 |
\ ==> ALL N. EX n. real(Suc N) < abs (X n)"; |
10751 | 466 |
by (Step_tac 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
467 |
by (cut_inst_tac [("n","N")] real_of_nat_Suc_gt_zero 1); |
10751 | 468 |
by (Blast_tac 1); |
469 |
val lemmaNSBseq = result(); |
|
470 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
471 |
Goal "ALL K. 0 < K --> (EX n. K < abs (X n)) \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
472 |
\ ==> EX f. ALL N. real(Suc N) < abs (X (f N))"; |
10751 | 473 |
by (dtac lemmaNSBseq 1); |
474 |
by (dtac choice 1); |
|
475 |
by (Blast_tac 1); |
|
476 |
val lemmaNSBseq2 = result(); |
|
477 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
478 |
Goal "ALL N. real(Suc N) < abs (X (f N)) \ |
10834 | 479 |
\ ==> Abs_hypreal(hyprel``{X o f}) : HInfinite"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
480 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
481 |
simpset() addsimps [HInfinite_FreeUltrafilterNat_iff,o_def])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
482 |
by (EVERY[rtac bexI 1, rtac lemma_hyprel_refl 2, Step_tac 1]); |
10751 | 483 |
by (cut_inst_tac [("u","u")] FreeUltrafilterNat_nat_gt_real 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
484 |
by (dtac FreeUltrafilterNat_all 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
485 |
by (etac (FreeUltrafilterNat_Int RS FreeUltrafilterNat_subset) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
486 |
by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc])); |
10751 | 487 |
qed "real_seq_to_hypreal_HInfinite"; |
488 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
489 |
(*----------------------------------------------------------------------------- |
10751 | 490 |
Now prove that we can get out an infinite hypernatural as well |
491 |
defined using the skolem function f::nat=>nat above |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
492 |
----------------------------------------------------------------------------*) |
10751 | 493 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
494 |
Goal "{n. f n <= Suc u & real(Suc n) < abs (X (f n))} <= \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
495 |
\ {n. f n <= u & real(Suc n) < abs (X (f n))} \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
496 |
\ Un {n. real(Suc n) < abs (X (Suc u))}"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
497 |
by (auto_tac (claset() addSDs [le_imp_less_or_eq], simpset())); |
10751 | 498 |
val lemma_finite_NSBseq = result(); |
499 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
500 |
Goal "finite {n. f n <= (u::nat) & real(Suc n) < abs(X(f n))}"; |
10751 | 501 |
by (induct_tac "u" 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
502 |
by (res_inst_tac [("B","{n. real(Suc n) < abs(X 0)}")] finite_subset 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
503 |
by (Force_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
504 |
by (rtac (lemma_finite_NSBseq RS finite_subset) 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
505 |
by (auto_tac (claset() addIs [finite_real_of_nat_less_real], |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
506 |
simpset() addsimps [real_of_nat_Suc, real_less_diff_eq RS sym])); |
10751 | 507 |
val lemma_finite_NSBseq2 = result(); |
508 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
509 |
Goal "ALL N. real(Suc N) < abs (X (f N)) \ |
10834 | 510 |
\ ==> Abs_hypnat(hypnatrel``{f}) : HNatInfinite"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
511 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
512 |
simpset() addsimps [HNatInfinite_FreeUltrafilterNat_iff])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
513 |
by (EVERY[rtac bexI 1, rtac lemma_hypnatrel_refl 2, Step_tac 1]); |
10751 | 514 |
by (rtac ccontr 1 THEN dtac FreeUltrafilterNat_Compl_mem 1); |
515 |
by (asm_full_simp_tac (simpset() addsimps |
|
516 |
[CLAIM_SIMP "- {n. u < (f::nat=>nat) n} \ |
|
517 |
\ = {n. f n <= u}" [le_def]]) 1); |
|
518 |
by (dtac FreeUltrafilterNat_all 1); |
|
519 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
520 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
521 |
simpset() addsimps |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
522 |
[CLAIM "({n. f n <= u} Int {n. real(Suc n) < abs(X(f n))}) = \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
523 |
\ {n. f n <= (u::nat) & real(Suc n) < abs(X(f n))}", |
10751 | 524 |
lemma_finite_NSBseq2 RS FreeUltrafilterNat_finite])); |
525 |
qed "HNatInfinite_skolem_f"; |
|
526 |
||
527 |
Goalw [Bseq_def,NSBseq_def] |
|
528 |
"NSBseq X ==> Bseq X"; |
|
529 |
by (rtac ccontr 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
530 |
by (auto_tac (claset(), simpset() addsimps [real_le_def])); |
10751 | 531 |
by (dtac lemmaNSBseq2 1 THEN Step_tac 1); |
532 |
by (forw_inst_tac [("X","X"),("f","f")] real_seq_to_hypreal_HInfinite 1); |
|
533 |
by (dtac (HNatInfinite_skolem_f RSN (2,bspec)) 1 THEN assume_tac 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
534 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
535 |
simpset() addsimps [starfunNat, o_def,HFinite_HInfinite_iff])); |
10751 | 536 |
qed "NSBseq_Bseq"; |
537 |
||
538 |
(*---------------------------------------------------------------------- |
|
539 |
Equivalence of nonstandard and standard definitions |
|
540 |
for a bounded sequence |
|
541 |
-----------------------------------------------------------------------*) |
|
542 |
Goal "(Bseq X) = (NSBseq X)"; |
|
543 |
by (blast_tac (claset() addSIs [NSBseq_Bseq,Bseq_NSBseq]) 1); |
|
544 |
qed "Bseq_NSBseq_iff"; |
|
545 |
||
546 |
(*---------------------------------------------------------------------- |
|
547 |
A convergent sequence is bounded |
|
548 |
(Boundedness as a necessary condition for convergence) |
|
549 |
-----------------------------------------------------------------------*) |
|
550 |
(* easier --- nonstandard version - no existential as usual *) |
|
551 |
Goalw [NSconvergent_def,NSBseq_def,NSLIMSEQ_def] |
|
552 |
"NSconvergent X ==> NSBseq X"; |
|
553 |
by (blast_tac (claset() addDs [HFinite_hypreal_of_real RS |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
554 |
(approx_sym RSN (2,approx_HFinite))]) 1); |
10751 | 555 |
qed "NSconvergent_NSBseq"; |
556 |
||
557 |
(* standard version - easily now proved using *) |
|
558 |
(* equivalence of NS and standard definitions *) |
|
559 |
Goal "convergent X ==> Bseq X"; |
|
560 |
by (asm_full_simp_tac (simpset() addsimps [NSconvergent_NSBseq, |
|
561 |
convergent_NSconvergent_iff,Bseq_NSBseq_iff]) 1); |
|
562 |
qed "convergent_Bseq"; |
|
563 |
||
564 |
(*---------------------------------------------------------------------- |
|
565 |
Results about Ubs and Lubs of bounded sequences |
|
566 |
-----------------------------------------------------------------------*) |
|
567 |
Goalw [Bseq_def] |
|
568 |
"!!(X::nat=>real). Bseq X ==> \ |
|
569 |
\ EX U. isUb (UNIV::real set) {x. EX n. X n = x} U"; |
|
570 |
by (auto_tac (claset() addIs [isUbI,setleI], |
|
571 |
simpset() addsimps [abs_le_interval_iff])); |
|
572 |
qed "Bseq_isUb"; |
|
573 |
||
574 |
(*---------------------------------------------------------------------- |
|
575 |
Use completeness of reals (supremum property) |
|
576 |
to show that any bounded sequence has a lub |
|
577 |
-----------------------------------------------------------------------*) |
|
578 |
Goal |
|
579 |
"!!(X::nat=>real). Bseq X ==> \ |
|
580 |
\ EX U. isLub (UNIV::real set) {x. EX n. X n = x} U"; |
|
581 |
by (blast_tac (claset() addIs [reals_complete, |
|
582 |
Bseq_isUb]) 1); |
|
583 |
qed "Bseq_isLub"; |
|
584 |
||
585 |
(* nonstandard version of premise will be *) |
|
586 |
(* handy when we work in NS universe *) |
|
587 |
Goal "NSBseq X ==> \ |
|
588 |
\ EX U. isUb (UNIV::real set) {x. EX n. X n = x} U"; |
|
589 |
by (asm_full_simp_tac (simpset() addsimps |
|
590 |
[Bseq_NSBseq_iff RS sym,Bseq_isUb]) 1); |
|
591 |
qed "NSBseq_isUb"; |
|
592 |
||
593 |
Goal |
|
594 |
"NSBseq X ==> \ |
|
595 |
\ EX U. isLub (UNIV::real set) {x. EX n. X n = x} U"; |
|
596 |
by (asm_full_simp_tac (simpset() addsimps |
|
597 |
[Bseq_NSBseq_iff RS sym,Bseq_isLub]) 1); |
|
598 |
qed "NSBseq_isLub"; |
|
599 |
||
600 |
(*-------------------------------------------------------------------- |
|
601 |
Bounded and monotonic sequence converges |
|
602 |
--------------------------------------------------------------------*) |
|
603 |
(* lemmas *) |
|
604 |
Goal |
|
605 |
"!!(X::nat=>real). [| ALL m n. m <= n --> X m <= X n; \ |
|
606 |
\ isLub (UNIV::real set) {x. EX n. X n = x} (X ma) \ |
|
607 |
\ |] ==> ALL n. ma <= n --> X n = X ma"; |
|
608 |
by (Step_tac 1); |
|
609 |
by (dres_inst_tac [("y","X n")] isLubD2 1); |
|
610 |
by (ALLGOALS(blast_tac (claset() addDs [real_le_anti_sym]))); |
|
611 |
val lemma_converg1 = result(); |
|
612 |
||
613 |
(*------------------------------------------------------------------- |
|
614 |
The best of both world: Easier to prove this result as a standard |
|
615 |
theorem and then use equivalence to "transfer" it into the |
|
616 |
equivalent nonstandard form if needed! |
|
617 |
-------------------------------------------------------------------*) |
|
618 |
Goalw [LIMSEQ_def] |
|
619 |
"ALL n. m <= n --> X n = X m \ |
|
620 |
\ ==> EX L. (X ----> L)"; |
|
621 |
by (res_inst_tac [("x","X m")] exI 1); |
|
622 |
by (Step_tac 1); |
|
623 |
by (res_inst_tac [("x","m")] exI 1); |
|
624 |
by (Step_tac 1); |
|
625 |
by (dtac spec 1 THEN etac impE 1); |
|
626 |
by (Auto_tac); |
|
627 |
qed "Bmonoseq_LIMSEQ"; |
|
628 |
||
629 |
(* Now same theorem in terms of NS limit *) |
|
630 |
Goal "ALL n. m <= n --> X n = X m \ |
|
631 |
\ ==> EX L. (X ----NS> L)"; |
|
632 |
by (auto_tac (claset() addSDs [Bmonoseq_LIMSEQ], |
|
633 |
simpset() addsimps [LIMSEQ_NSLIMSEQ_iff])); |
|
634 |
qed "Bmonoseq_NSLIMSEQ"; |
|
635 |
||
636 |
(* a few more lemmas *) |
|
637 |
Goal "!!(X::nat=>real). \ |
|
638 |
\ [| ALL m. X m ~= U; isLub UNIV {x. EX n. X n = x} U |] ==> ALL m. X m < U"; |
|
639 |
by (Step_tac 1); |
|
640 |
by (dres_inst_tac [("y","X m")] isLubD2 1); |
|
641 |
by (auto_tac (claset() addSDs [order_le_imp_less_or_eq], |
|
642 |
simpset())); |
|
643 |
val lemma_converg2 = result(); |
|
644 |
||
645 |
Goal "!!(X ::nat=>real). ALL m. X m <= U ==> \ |
|
646 |
\ isUb UNIV {x. EX n. X n = x} U"; |
|
647 |
by (rtac (setleI RS isUbI) 1); |
|
648 |
by (Auto_tac); |
|
649 |
val lemma_converg3 = result(); |
|
650 |
||
651 |
(* FIXME: U - T < U redundant *) |
|
652 |
Goal "!!(X::nat=> real). \ |
|
653 |
\ [| ALL m. X m ~= U; \ |
|
654 |
\ isLub UNIV {x. EX n. X n = x} U; \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
655 |
\ 0 < T; \ |
10751 | 656 |
\ U + - T < U \ |
657 |
\ |] ==> EX m. U + -T < X m & X m < U"; |
|
658 |
by (dtac lemma_converg2 1 THEN assume_tac 1); |
|
659 |
by (rtac ccontr 1 THEN Asm_full_simp_tac 1); |
|
660 |
by (fold_tac [real_le_def]); |
|
661 |
by (dtac lemma_converg3 1); |
|
662 |
by (dtac isLub_le_isUb 1 THEN assume_tac 1); |
|
663 |
by (auto_tac (claset() addDs [order_less_le_trans], |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
664 |
simpset())); |
10751 | 665 |
val lemma_converg4 = result(); |
666 |
||
667 |
(*------------------------------------------------------------------- |
|
668 |
A standard proof of the theorem for monotone increasing sequence |
|
669 |
------------------------------------------------------------------*) |
|
670 |
||
671 |
Goalw [convergent_def] |
|
672 |
"[| Bseq X; ALL m n. m <= n --> X m <= X n |] \ |
|
673 |
\ ==> convergent X"; |
|
12486 | 674 |
by (ftac Bseq_isLub 1); |
10751 | 675 |
by (Step_tac 1); |
676 |
by (case_tac "EX m. X m = U" 1 THEN Auto_tac); |
|
677 |
by (blast_tac (claset() addDs [lemma_converg1, |
|
678 |
Bmonoseq_LIMSEQ]) 1); |
|
679 |
(* second case *) |
|
680 |
by (res_inst_tac [("x","U")] exI 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
681 |
by (stac LIMSEQ_iff 1 THEN Step_tac 1); |
12486 | 682 |
by (ftac lemma_converg2 1 THEN assume_tac 1); |
10751 | 683 |
by (dtac lemma_converg4 1 THEN Auto_tac); |
684 |
by (res_inst_tac [("x","m")] exI 1 THEN Step_tac 1); |
|
685 |
by (subgoal_tac "X m <= X n" 1 THEN Fast_tac 2); |
|
686 |
by (rotate_tac 3 1 THEN dres_inst_tac [("x","n")] spec 1); |
|
687 |
by (arith_tac 1); |
|
688 |
qed "Bseq_mono_convergent"; |
|
689 |
||
690 |
(* NS version of theorem *) |
|
691 |
Goalw [convergent_def] |
|
692 |
"[| NSBseq X; ALL m n. m <= n --> X m <= X n |] \ |
|
693 |
\ ==> NSconvergent X"; |
|
694 |
by (auto_tac (claset() addIs [Bseq_mono_convergent], |
|
695 |
simpset() addsimps [convergent_NSconvergent_iff RS sym, |
|
696 |
Bseq_NSBseq_iff RS sym])); |
|
697 |
qed "NSBseq_mono_NSconvergent"; |
|
698 |
||
699 |
Goalw [convergent_def] |
|
700 |
"(convergent X) = (convergent (%n. -(X n)))"; |
|
701 |
by (auto_tac (claset() addDs [LIMSEQ_minus], simpset())); |
|
702 |
by (dtac LIMSEQ_minus 1 THEN Auto_tac); |
|
703 |
qed "convergent_minus_iff"; |
|
704 |
||
705 |
Goalw [Bseq_def] "Bseq (%n. -(X n)) = Bseq X"; |
|
706 |
by (Asm_full_simp_tac 1); |
|
707 |
qed "Bseq_minus_iff"; |
|
708 |
||
709 |
(*-------------------------------- |
|
710 |
**** main mono theorem **** |
|
711 |
-------------------------------*) |
|
712 |
Goalw [monoseq_def] "[| Bseq X; monoseq X |] ==> convergent X"; |
|
713 |
by (Step_tac 1); |
|
12486 | 714 |
by (stac convergent_minus_iff 2); |
10751 | 715 |
by (dtac (Bseq_minus_iff RS ssubst) 2); |
716 |
by (auto_tac (claset() addSIs [Bseq_mono_convergent], simpset())); |
|
717 |
qed "Bseq_monoseq_convergent"; |
|
718 |
||
719 |
(*---------------------------------------------------------------- |
|
720 |
A few more equivalence theorems for boundedness |
|
721 |
---------------------------------------------------------------*) |
|
722 |
||
723 |
(***--- alternative formulation for boundedness---***) |
|
724 |
Goalw [Bseq_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
725 |
"Bseq X = (EX k x. 0 < k & (ALL n. abs(X(n) + -x) <= k))"; |
10751 | 726 |
by (Step_tac 1); |
727 |
by (res_inst_tac [("x","k + abs(x)")] exI 2); |
|
728 |
by (res_inst_tac [("x","K")] exI 1); |
|
729 |
by (res_inst_tac [("x","0")] exI 1); |
|
730 |
by (Auto_tac); |
|
731 |
by (ALLGOALS (dres_inst_tac [("x","n")] spec)); |
|
732 |
by (ALLGOALS arith_tac); |
|
733 |
qed "Bseq_iff2"; |
|
734 |
||
735 |
(***--- alternative formulation for boundedness ---***) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
736 |
Goal "Bseq X = (EX k N. 0 < k & (ALL n. abs(X(n) + -X(N)) <= k))"; |
10751 | 737 |
by (Step_tac 1); |
738 |
by (asm_full_simp_tac (simpset() addsimps [Bseq_def]) 1); |
|
739 |
by (Step_tac 1); |
|
740 |
by (res_inst_tac [("x","K + abs(X N)")] exI 1); |
|
741 |
by (Auto_tac); |
|
742 |
by (arith_tac 1); |
|
743 |
by (res_inst_tac [("x","N")] exI 1); |
|
744 |
by (Step_tac 1); |
|
745 |
by (dres_inst_tac [("x","n")] spec 1); |
|
746 |
by (arith_tac 1); |
|
747 |
by (auto_tac (claset(), simpset() addsimps [Bseq_iff2])); |
|
748 |
qed "Bseq_iff3"; |
|
749 |
||
750 |
Goalw [Bseq_def] "(ALL n. k <= f n & f n <= K) ==> Bseq f"; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
751 |
by (res_inst_tac [("x","(abs(k) + abs(K)) + 1")] exI 1); |
10751 | 752 |
by (Auto_tac); |
753 |
by (dres_inst_tac [("x","n")] spec 2); |
|
754 |
by (ALLGOALS arith_tac); |
|
755 |
qed "BseqI2"; |
|
756 |
||
757 |
(*------------------------------------------------------------------- |
|
758 |
Equivalence between NS and standard definitions of Cauchy seqs |
|
759 |
------------------------------------------------------------------*) |
|
760 |
(*------------------------------- |
|
761 |
Standard def => NS def |
|
762 |
-------------------------------*) |
|
10834 | 763 |
Goal "Abs_hypnat (hypnatrel `` {x}) : HNatInfinite \ |
10751 | 764 |
\ ==> {n. M <= x n} : FreeUltrafilterNat"; |
765 |
by (auto_tac (claset(), |
|
766 |
simpset() addsimps [HNatInfinite_FreeUltrafilterNat_iff])); |
|
767 |
by (dres_inst_tac [("x","M")] spec 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
768 |
by (ultra_tac (claset(), simpset() addsimps [less_imp_le]) 1); |
10751 | 769 |
val lemmaCauchy1 = result(); |
770 |
||
771 |
Goal "{n. ALL m n. M <= m & M <= (n::nat) --> abs (X m + - X n) < u} Int \ |
|
772 |
\ {n. M <= xa n} Int {n. M <= x n} <= \ |
|
773 |
\ {n. abs (X (xa n) + - X (x n)) < u}"; |
|
774 |
by (Blast_tac 1); |
|
775 |
val lemmaCauchy2 = result(); |
|
776 |
||
777 |
Goalw [Cauchy_def,NSCauchy_def] |
|
778 |
"Cauchy X ==> NSCauchy X"; |
|
779 |
by (Step_tac 1); |
|
780 |
by (res_inst_tac [("z","M")] eq_Abs_hypnat 1); |
|
781 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
782 |
by (rtac (approx_minus_iff RS iffD2) 1); |
10751 | 783 |
by (rtac (mem_infmal_iff RS iffD1) 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
784 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
785 |
simpset() addsimps [starfunNat, hypreal_minus,hypreal_add, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
786 |
Infinitesimal_FreeUltrafilterNat_iff])); |
10751 | 787 |
by (EVERY[rtac bexI 1, Auto_tac]); |
788 |
by (dtac spec 1 THEN Auto_tac); |
|
789 |
by (dres_inst_tac [("M","M")] lemmaCauchy1 1); |
|
790 |
by (dres_inst_tac [("M","M")] lemmaCauchy1 1); |
|
791 |
by (res_inst_tac [("x1","xa")] |
|
792 |
(lemmaCauchy2 RSN (2,FreeUltrafilterNat_subset)) 1); |
|
793 |
by (rtac FreeUltrafilterNat_Int 1 THEN assume_tac 2); |
|
794 |
by (auto_tac (claset() addIs [FreeUltrafilterNat_Int, |
|
795 |
FreeUltrafilterNat_Nat_set], simpset())); |
|
796 |
qed "Cauchy_NSCauchy"; |
|
797 |
||
798 |
(*----------------------------------------------- |
|
799 |
NS def => Standard def -- rather long but |
|
800 |
straightforward proof in this case |
|
801 |
---------------------------------------------*) |
|
802 |
Goalw [Cauchy_def,NSCauchy_def] |
|
803 |
"NSCauchy X ==> Cauchy X"; |
|
804 |
by (EVERY1[Step_tac, rtac ccontr,Asm_full_simp_tac]); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
805 |
by (dtac choice 1 THEN |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
806 |
auto_tac (claset(), simpset() addsimps [all_conj_distrib])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
807 |
by (dtac choice 1 THEN |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
808 |
step_tac (claset() addSDs [all_conj_distrib RS iffD1]) 1); |
10751 | 809 |
by (REPEAT(dtac HNatInfinite_NSLIMSEQ 1)); |
810 |
by (dtac bspec 1 THEN assume_tac 1); |
|
10834 | 811 |
by (dres_inst_tac [("x","Abs_hypnat (hypnatrel `` {fa})")] bspec 1 |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
812 |
THEN auto_tac (claset(), simpset() addsimps [starfunNat])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
813 |
by (dtac (approx_minus_iff RS iffD1) 1); |
10751 | 814 |
by (dtac (mem_infmal_iff RS iffD2) 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
815 |
by (auto_tac (claset(), simpset() addsimps [hypreal_minus, |
10751 | 816 |
hypreal_add,Infinitesimal_FreeUltrafilterNat_iff])); |
817 |
by (dres_inst_tac [("x","e")] spec 1 THEN Auto_tac); |
|
818 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
819 |
by (dtac (CLAIM "{n. X (f n) + - X (fa n) = Y n} Int \ |
|
820 |
\ {n. abs (Y n) < e} <= \ |
|
821 |
\ {n. abs (X (f n) + - X (fa n)) < e}" RSN |
|
822 |
(2,FreeUltrafilterNat_subset)) 1); |
|
823 |
by (thin_tac "{n. abs (Y n) < e} : FreeUltrafilterNat" 1); |
|
824 |
by (dtac FreeUltrafilterNat_all 1); |
|
825 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
826 |
by (asm_full_simp_tac (simpset() addsimps |
|
827 |
[CLAIM "{n. abs (X (f n) + - X (fa n)) < e} Int \ |
|
828 |
\ {M. ~ abs (X (f M) + - X (fa M)) < e} = {}", |
|
829 |
FreeUltrafilterNat_empty]) 1); |
|
830 |
qed "NSCauchy_Cauchy"; |
|
831 |
||
832 |
(*----- Equivalence -----*) |
|
833 |
Goal "NSCauchy X = Cauchy X"; |
|
834 |
by (blast_tac (claset() addSIs[NSCauchy_Cauchy, |
|
835 |
Cauchy_NSCauchy]) 1); |
|
836 |
qed "NSCauchy_Cauchy_iff"; |
|
837 |
||
838 |
(*------------------------------------------------------- |
|
839 |
Cauchy sequence is bounded -- this is the standard |
|
840 |
proof mechanization rather than the nonstandard proof |
|
841 |
-------------------------------------------------------*) |
|
842 |
||
843 |
(***------------- VARIOUS LEMMAS --------------***) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
844 |
Goal "ALL n. M <= n --> abs (X M + - X n) < (1::real) \ |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
845 |
\ ==> ALL n. M <= n --> abs(X n) < 1 + abs(X M)"; |
10751 | 846 |
by (Step_tac 1); |
847 |
by (dtac spec 1 THEN Auto_tac); |
|
848 |
by (arith_tac 1); |
|
849 |
val lemmaCauchy = result(); |
|
850 |
||
851 |
Goal "(n < Suc M) = (n <= M)"; |
|
852 |
by Auto_tac; |
|
853 |
qed "less_Suc_cancel_iff"; |
|
854 |
||
855 |
(* FIXME: Long. Maximal element in subsequence *) |
|
856 |
Goal "EX m. m <= M & (ALL n. n <= M --> \ |
|
857 |
\ abs ((X::nat=> real) n) <= abs (X m))"; |
|
858 |
by (induct_tac "M" 1); |
|
859 |
by (res_inst_tac [("x","0")] exI 1); |
|
860 |
by (Asm_full_simp_tac 1); |
|
861 |
by (Step_tac 1); |
|
862 |
by (cut_inst_tac [("R1.0","abs (X (Suc n))"),("R2.0","abs(X m)")] |
|
863 |
real_linear 1); |
|
864 |
by (Step_tac 1); |
|
865 |
by (res_inst_tac [("x","m")] exI 1); |
|
866 |
by (res_inst_tac [("x","m")] exI 2); |
|
867 |
by (res_inst_tac [("x","Suc n")] exI 3); |
|
868 |
by (ALLGOALS(Asm_full_simp_tac)); |
|
869 |
by (Step_tac 1); |
|
870 |
by (ALLGOALS(eres_inst_tac [("m1","na")] |
|
871 |
(le_imp_less_or_eq RS disjE))); |
|
872 |
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps |
|
873 |
[less_Suc_cancel_iff, order_less_imp_le]))); |
|
874 |
by (blast_tac (claset() addIs [order_le_less_trans RS order_less_imp_le]) 1); |
|
875 |
qed "SUP_rabs_subseq"; |
|
876 |
||
877 |
(* lemmas to help proof - mostly trivial *) |
|
878 |
Goal "[| ALL m::nat. m <= M --> P M m; \ |
|
879 |
\ ALL m. M <= m --> P M m |] \ |
|
880 |
\ ==> ALL m. P M m"; |
|
881 |
by (Step_tac 1); |
|
882 |
by (REPEAT(dres_inst_tac [("x","m")] spec 1)); |
|
883 |
by (auto_tac (claset() addEs [less_asym], |
|
884 |
simpset() addsimps [le_def])); |
|
885 |
val lemma_Nat_covered = result(); |
|
886 |
||
887 |
Goal "[| ALL n. n <= M --> abs ((X::nat=>real) n) <= a; a < b |] \ |
|
888 |
\ ==> ALL n. n <= M --> abs(X n) <= b"; |
|
889 |
by (blast_tac (claset() addIs [order_le_less_trans RS order_less_imp_le]) 1); |
|
890 |
val lemma_trans1 = result(); |
|
891 |
||
892 |
Goal "[| ALL n. M <= n --> abs ((X::nat=>real) n) < a; \ |
|
893 |
\ a < b |] \ |
|
894 |
\ ==> ALL n. M <= n --> abs(X n)<= b"; |
|
895 |
by (blast_tac (claset() addIs [order_less_trans RS order_less_imp_le]) 1); |
|
896 |
val lemma_trans2 = result(); |
|
897 |
||
898 |
Goal "[| ALL n. n <= M --> abs (X n) <= a; \ |
|
899 |
\ a = b |] \ |
|
900 |
\ ==> ALL n. n <= M --> abs(X n) <= b"; |
|
901 |
by (Auto_tac); |
|
902 |
val lemma_trans3 = result(); |
|
903 |
||
904 |
Goal "ALL n. M <= n --> abs ((X::nat=>real) n) < a \ |
|
905 |
\ ==> ALL n. M <= n --> abs (X n) <= a"; |
|
906 |
by (blast_tac (claset() addIs [order_less_imp_le]) 1); |
|
907 |
val lemma_trans4 = result(); |
|
908 |
||
909 |
(*---------------------------------------------------------- |
|
910 |
Trickier than expected --- proof is more involved than |
|
911 |
outlines sketched by various authors would suggest |
|
912 |
---------------------------------------------------------*) |
|
913 |
Goalw [Cauchy_def,Bseq_def] "Cauchy X ==> Bseq X"; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
914 |
by (dres_inst_tac [("x","1")] spec 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
915 |
by (etac (real_zero_less_one RSN (2,impE)) 1); |
10751 | 916 |
by (Step_tac 1); |
917 |
by (dres_inst_tac [("x","M")] spec 1); |
|
918 |
by (Asm_full_simp_tac 1); |
|
919 |
by (dtac lemmaCauchy 1); |
|
920 |
by (cut_inst_tac [("M","M"),("X","X")] SUP_rabs_subseq 1); |
|
921 |
by (Step_tac 1); |
|
922 |
by (cut_inst_tac [("R1.0","abs(X m)"), |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
923 |
("R2.0","1 + abs(X M)")] real_linear 1); |
10751 | 924 |
by (Step_tac 1); |
925 |
by (dtac lemma_trans1 1 THEN assume_tac 1); |
|
926 |
by (dtac lemma_trans2 3 THEN assume_tac 3); |
|
927 |
by (dtac lemma_trans3 2 THEN assume_tac 2); |
|
928 |
by (dtac (abs_add_one_gt_zero RS order_less_trans) 3); |
|
929 |
by (dtac lemma_trans4 1); |
|
930 |
by (dtac lemma_trans4 2); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
931 |
by (res_inst_tac [("x","1 + abs(X M)")] exI 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
932 |
by (res_inst_tac [("x","1 + abs(X M)")] exI 2); |
10751 | 933 |
by (res_inst_tac [("x","abs(X m)")] exI 3); |
934 |
by (auto_tac (claset() addSEs [lemma_Nat_covered], |
|
935 |
simpset())); |
|
936 |
by (ALLGOALS arith_tac); |
|
937 |
qed "Cauchy_Bseq"; |
|
938 |
||
939 |
(*------------------------------------------------ |
|
940 |
Cauchy sequence is bounded -- NSformulation |
|
941 |
------------------------------------------------*) |
|
942 |
Goal "NSCauchy X ==> NSBseq X"; |
|
943 |
by (asm_full_simp_tac (simpset() addsimps [Cauchy_Bseq, |
|
944 |
Bseq_NSBseq_iff RS sym,NSCauchy_Cauchy_iff]) 1); |
|
945 |
qed "NSCauchy_NSBseq"; |
|
946 |
||
947 |
||
948 |
(*----------------------------------------------------------------- |
|
949 |
Equivalence of Cauchy criterion and convergence |
|
950 |
||
951 |
We will prove this using our NS formulation which provides a |
|
952 |
much easier proof than using the standard definition. We do not |
|
953 |
need to use properties of subsequences such as boundedness, |
|
954 |
monotonicity etc... Compare with Harrison's corresponding proof |
|
955 |
in HOL which is much longer and more complicated. Of course, we do |
|
956 |
not have problems which he encountered with guessing the right |
|
957 |
instantiations for his 'espsilon-delta' proof(s) in this case |
|
958 |
since the NS formulations do not involve existential quantifiers. |
|
959 |
-----------------------------------------------------------------*) |
|
960 |
Goalw [NSconvergent_def,NSLIMSEQ_def] |
|
961 |
"NSCauchy X = NSconvergent X"; |
|
962 |
by (Step_tac 1); |
|
12486 | 963 |
by (ftac NSCauchy_NSBseq 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
964 |
by (auto_tac (claset() addIs [approx_trans2], |
10751 | 965 |
simpset() addsimps |
966 |
[NSBseq_def,NSCauchy_def])); |
|
967 |
by (dtac (HNatInfinite_whn RSN (2,bspec)) 1); |
|
968 |
by (dtac (HNatInfinite_whn RSN (2,bspec)) 1); |
|
969 |
by (auto_tac (claset() addSDs [st_part_Ex], simpset() |
|
970 |
addsimps [SReal_iff])); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
971 |
by (blast_tac (claset() addIs [approx_trans3]) 1); |
10751 | 972 |
qed "NSCauchy_NSconvergent_iff"; |
973 |
||
974 |
(* Standard proof for free *) |
|
975 |
Goal "Cauchy X = convergent X"; |
|
976 |
by (simp_tac (simpset() addsimps [NSCauchy_Cauchy_iff RS sym, |
|
977 |
convergent_NSconvergent_iff, NSCauchy_NSconvergent_iff]) 1); |
|
978 |
qed "Cauchy_convergent_iff"; |
|
979 |
||
980 |
(*----------------------------------------------------------------- |
|
981 |
We can now try and derive a few properties of sequences |
|
982 |
starting with the limit comparison property for sequences |
|
983 |
-----------------------------------------------------------------*) |
|
984 |
Goalw [NSLIMSEQ_def] |
|
985 |
"[| f ----NS> l; g ----NS> m; \ |
|
986 |
\ EX N. ALL n. N <= n --> f(n) <= g(n) \ |
|
987 |
\ |] ==> l <= m"; |
|
988 |
by (Step_tac 1); |
|
989 |
by (dtac starfun_le_mono 1); |
|
990 |
by (REPEAT(dtac (HNatInfinite_whn RSN (2,bspec)) 1)); |
|
991 |
by (dres_inst_tac [("x","whn")] spec 1); |
|
992 |
by (REPEAT(dtac (bex_Infinitesimal_iff2 RS iffD2) 1)); |
|
993 |
by Auto_tac; |
|
994 |
by (auto_tac (claset() addIs |
|
995 |
[hypreal_of_real_le_add_Infininitesimal_cancel2], simpset())); |
|
996 |
qed "NSLIMSEQ_le"; |
|
997 |
||
998 |
(* standard version *) |
|
999 |
Goal "[| f ----> l; g ----> m; \ |
|
1000 |
\ EX N. ALL n. N <= n --> f(n) <= g(n) |] \ |
|
1001 |
\ ==> l <= m"; |
|
1002 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1003 |
NSLIMSEQ_le]) 1); |
|
1004 |
qed "LIMSEQ_le"; |
|
1005 |
||
1006 |
(*--------------- |
|
1007 |
Also... |
|
1008 |
--------------*) |
|
1009 |
Goal "[| X ----> r; ALL n. a <= X n |] ==> a <= r"; |
|
1010 |
by (rtac LIMSEQ_le 1); |
|
1011 |
by (rtac LIMSEQ_const 1); |
|
1012 |
by (Auto_tac); |
|
1013 |
qed "LIMSEQ_le_const"; |
|
1014 |
||
1015 |
Goal "[| X ----NS> r; ALL n. a <= X n |] ==> a <= r"; |
|
1016 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1017 |
LIMSEQ_le_const]) 1); |
|
1018 |
qed "NSLIMSEQ_le_const"; |
|
1019 |
||
1020 |
Goal "[| X ----> r; ALL n. X n <= a |] ==> r <= a"; |
|
1021 |
by (rtac LIMSEQ_le 1); |
|
1022 |
by (rtac LIMSEQ_const 2); |
|
1023 |
by (Auto_tac); |
|
1024 |
qed "LIMSEQ_le_const2"; |
|
1025 |
||
1026 |
Goal "[| X ----NS> r; ALL n. X n <= a |] ==> r <= a"; |
|
1027 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1028 |
LIMSEQ_le_const2]) 1); |
|
1029 |
qed "NSLIMSEQ_le_const2"; |
|
1030 |
||
1031 |
(*----------------------------------------------------- |
|
1032 |
Shift a convergent series by 1 |
|
1033 |
We use the fact that Cauchyness and convergence |
|
1034 |
are equivalent and also that the successor of an |
|
1035 |
infinite hypernatural is also infinite. |
|
1036 |
-----------------------------------------------------*) |
|
1037 |
Goal "f ----NS> l ==> (%n. f(Suc n)) ----NS> l"; |
|
1038 |
by (forward_tac [NSconvergentI RS |
|
1039 |
(NSCauchy_NSconvergent_iff RS iffD2)] 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1040 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1041 |
simpset() addsimps [NSCauchy_def, NSLIMSEQ_def,starfunNat_shift_one])); |
10751 | 1042 |
by (dtac bspec 1 THEN assume_tac 1); |
1043 |
by (dtac bspec 1 THEN assume_tac 1); |
|
1044 |
by (dtac (SHNat_one RSN (2,HNatInfinite_SHNat_add)) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1045 |
by (blast_tac (claset() addIs [approx_trans3]) 1); |
10751 | 1046 |
qed "NSLIMSEQ_Suc"; |
1047 |
||
1048 |
(* standard version *) |
|
1049 |
Goal "f ----> l ==> (%n. f(Suc n)) ----> l"; |
|
1050 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1051 |
NSLIMSEQ_Suc]) 1); |
|
1052 |
qed "LIMSEQ_Suc"; |
|
1053 |
||
1054 |
Goal "(%n. f(Suc n)) ----NS> l ==> f ----NS> l"; |
|
1055 |
by (forward_tac [NSconvergentI RS |
|
1056 |
(NSCauchy_NSconvergent_iff RS iffD2)] 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1057 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1058 |
simpset() addsimps [NSCauchy_def, NSLIMSEQ_def,starfunNat_shift_one])); |
10751 | 1059 |
by (dtac bspec 1 THEN assume_tac 1); |
1060 |
by (dtac bspec 1 THEN assume_tac 1); |
|
1061 |
by (ftac (SHNat_one RSN (2,HNatInfinite_SHNat_diff)) 1); |
|
1062 |
by (rotate_tac 2 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1063 |
by (auto_tac (claset() addSDs [bspec] addIs [approx_trans3], |
10751 | 1064 |
simpset())); |
1065 |
qed "NSLIMSEQ_imp_Suc"; |
|
1066 |
||
1067 |
Goal "(%n. f(Suc n)) ----> l ==> f ----> l"; |
|
1068 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff]) 1); |
|
1069 |
by (etac NSLIMSEQ_imp_Suc 1); |
|
1070 |
qed "LIMSEQ_imp_Suc"; |
|
1071 |
||
1072 |
Goal "((%n. f(Suc n)) ----> l) = (f ----> l)"; |
|
1073 |
by (blast_tac (claset() addIs [LIMSEQ_imp_Suc,LIMSEQ_Suc]) 1); |
|
1074 |
qed "LIMSEQ_Suc_iff"; |
|
1075 |
||
1076 |
Goal "((%n. f(Suc n)) ----NS> l) = (f ----NS> l)"; |
|
1077 |
by (blast_tac (claset() addIs [NSLIMSEQ_imp_Suc,NSLIMSEQ_Suc]) 1); |
|
1078 |
qed "NSLIMSEQ_Suc_iff"; |
|
1079 |
||
1080 |
(*----------------------------------------------------- |
|
1081 |
A sequence tends to zero iff its abs does |
|
1082 |
----------------------------------------------------*) |
|
1083 |
(* we can prove this directly since proof is trivial *) |
|
1084 |
Goalw [LIMSEQ_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1085 |
"((%n. abs(f n)) ----> 0) = (f ----> 0)"; |
10751 | 1086 |
by (simp_tac (simpset() addsimps [abs_idempotent]) 1); |
1087 |
qed "LIMSEQ_rabs_zero"; |
|
1088 |
||
1089 |
(*-----------------------------------------------------*) |
|
1090 |
(* We prove the NS version from the standard one *) |
|
1091 |
(* Actually pure NS proof seems more complicated *) |
|
1092 |
(* than the direct standard one above! *) |
|
1093 |
(*-----------------------------------------------------*) |
|
1094 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1095 |
Goal "((%n. abs(f n)) ----NS> 0) = (f ----NS> 0)"; |
10751 | 1096 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
1097 |
LIMSEQ_rabs_zero]) 1); |
|
1098 |
qed "NSLIMSEQ_rabs_zero"; |
|
1099 |
||
1100 |
(*---------------------------------------- |
|
1101 |
Also we have for a general limit |
|
1102 |
(NS proof much easier) |
|
1103 |
---------------------------------------*) |
|
1104 |
Goalw [NSLIMSEQ_def] |
|
1105 |
"f ----NS> l ==> (%n. abs(f n)) ----NS> abs(l)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1106 |
by (auto_tac (claset() addIs [approx_hrabs], simpset() |
10751 | 1107 |
addsimps [starfunNat_rabs,hypreal_of_real_hrabs RS sym])); |
1108 |
qed "NSLIMSEQ_imp_rabs"; |
|
1109 |
||
1110 |
(* standard version *) |
|
1111 |
Goal "f ----> l ==> (%n. abs(f n)) ----> abs(l)"; |
|
1112 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1113 |
NSLIMSEQ_imp_rabs]) 1); |
|
1114 |
qed "LIMSEQ_imp_rabs"; |
|
1115 |
||
1116 |
(*----------------------------------------------------- |
|
1117 |
An unbounded sequence's inverse tends to 0 |
|
1118 |
----------------------------------------------------*) |
|
1119 |
(* standard proof seems easier *) |
|
1120 |
Goalw [LIMSEQ_def] |
|
1121 |
"ALL y. EX N. ALL n. N <= n --> y < f(n) \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1122 |
\ ==> (%n. inverse(f n)) ----> 0"; |
10751 | 1123 |
by (Step_tac 1 THEN Asm_full_simp_tac 1); |
1124 |
by (dres_inst_tac [("x","inverse r")] spec 1 THEN Step_tac 1); |
|
1125 |
by (res_inst_tac [("x","N")] exI 1 THEN Step_tac 1); |
|
1126 |
by (dtac spec 1 THEN Auto_tac); |
|
12486 | 1127 |
by (ftac real_inverse_gt_0 1); |
1128 |
by (ftac order_less_trans 1 THEN assume_tac 1); |
|
10751 | 1129 |
by (forw_inst_tac [("x","f n")] real_inverse_gt_0 1); |
1130 |
by (asm_simp_tac (simpset() addsimps [abs_eqI2]) 1); |
|
1131 |
by (res_inst_tac [("t","r")] (real_inverse_inverse RS subst) 1); |
|
1132 |
by (auto_tac (claset() addIs [real_inverse_less_iff RS iffD2], |
|
1133 |
simpset() delsimps [real_inverse_inverse])); |
|
1134 |
qed "LIMSEQ_inverse_zero"; |
|
1135 |
||
1136 |
Goal "ALL y. EX N. ALL n. N <= n --> y < f(n) \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1137 |
\ ==> (%n. inverse(f n)) ----NS> 0"; |
10751 | 1138 |
by (asm_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
1139 |
LIMSEQ_inverse_zero]) 1); |
|
1140 |
qed "NSLIMSEQ_inverse_zero"; |
|
1141 |
||
1142 |
(*-------------------------------------------------------------- |
|
1143 |
Sequence 1/n --> 0 as n --> infinity |
|
1144 |
-------------------------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1145 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1146 |
Goal "(%n. inverse(real(Suc n))) ----> 0"; |
10751 | 1147 |
by (rtac LIMSEQ_inverse_zero 1 THEN Step_tac 1); |
1148 |
by (cut_inst_tac [("x","y")] reals_Archimedean2 1); |
|
1149 |
by (Step_tac 1 THEN res_inst_tac [("x","n")] exI 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1150 |
by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1151 |
by (subgoal_tac "y < real na" 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1152 |
by (Asm_simp_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1153 |
by (blast_tac (claset() addIs [order_less_le_trans]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1154 |
qed "LIMSEQ_inverse_real_of_nat"; |
10751 | 1155 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1156 |
Goal "(%n. inverse(real(Suc n))) ----NS> 0"; |
10751 | 1157 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1158 |
LIMSEQ_inverse_real_of_nat]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1159 |
qed "NSLIMSEQ_inverse_real_of_nat"; |
10751 | 1160 |
|
1161 |
(*-------------------------------------------- |
|
1162 |
Sequence r + 1/n --> r as n --> infinity |
|
1163 |
now easily proved |
|
1164 |
--------------------------------------------*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1165 |
Goal "(%n. r + inverse(real(Suc n))) ----> r"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1166 |
by (cut_facts_tac |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1167 |
[ [LIMSEQ_const,LIMSEQ_inverse_real_of_nat] MRS LIMSEQ_add ] 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1168 |
by Auto_tac; |
10751 | 1169 |
qed "LIMSEQ_inverse_real_of_posnat_add"; |
1170 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1171 |
Goal "(%n. r + inverse(real(Suc n))) ----NS> r"; |
10751 | 1172 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
1173 |
LIMSEQ_inverse_real_of_posnat_add]) 1); |
|
1174 |
qed "NSLIMSEQ_inverse_real_of_posnat_add"; |
|
1175 |
||
1176 |
(*-------------- |
|
1177 |
Also... |
|
1178 |
--------------*) |
|
1179 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1180 |
Goal "(%n. r + -inverse(real(Suc n))) ----> r"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1181 |
by (cut_facts_tac [[LIMSEQ_const,LIMSEQ_inverse_real_of_nat] |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1182 |
MRS LIMSEQ_add_minus] 1); |
10751 | 1183 |
by (Auto_tac); |
1184 |
qed "LIMSEQ_inverse_real_of_posnat_add_minus"; |
|
1185 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1186 |
Goal "(%n. r + -inverse(real(Suc n))) ----NS> r"; |
10751 | 1187 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
1188 |
LIMSEQ_inverse_real_of_posnat_add_minus]) 1); |
|
1189 |
qed "NSLIMSEQ_inverse_real_of_posnat_add_minus"; |
|
1190 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1191 |
Goal "(%n. r*( 1 + -inverse(real(Suc n)))) ----> r"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1192 |
by (cut_inst_tac [("b","1")] ([LIMSEQ_const, |
10751 | 1193 |
LIMSEQ_inverse_real_of_posnat_add_minus] MRS LIMSEQ_mult) 1); |
1194 |
by (Auto_tac); |
|
1195 |
qed "LIMSEQ_inverse_real_of_posnat_add_minus_mult"; |
|
1196 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1197 |
Goal "(%n. r*( 1 + -inverse(real(Suc n)))) ----NS> r"; |
10751 | 1198 |
by (simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff RS sym, |
1199 |
LIMSEQ_inverse_real_of_posnat_add_minus_mult]) 1); |
|
1200 |
qed "NSLIMSEQ_inverse_real_of_posnat_add_minus_mult"; |
|
1201 |
||
1202 |
(*--------------------------------------------------------------- |
|
1203 |
Real Powers |
|
1204 |
--------------------------------------------------------------*) |
|
1205 |
Goal "(X ----NS> a) --> ((%n. (X n) ^ m) ----NS> a ^ m)"; |
|
1206 |
by (induct_tac "m" 1); |
|
1207 |
by (auto_tac (claset() addIs [NSLIMSEQ_mult,NSLIMSEQ_const], |
|
1208 |
simpset())); |
|
1209 |
qed_spec_mp "NSLIMSEQ_pow"; |
|
1210 |
||
1211 |
Goal "X ----> a ==> (%n. (X n) ^ m) ----> a ^ m"; |
|
1212 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_NSLIMSEQ_iff, |
|
1213 |
NSLIMSEQ_pow]) 1); |
|
1214 |
qed "LIMSEQ_pow"; |
|
1215 |
||
1216 |
(*---------------------------------------------------------------- |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1217 |
0 <= x < 1 ==> (x ^ n ----> 0) |
10751 | 1218 |
Proof will use (NS) Cauchy equivalence for convergence and |
1219 |
also fact that bounded and monotonic sequence converges. |
|
1220 |
---------------------------------------------------------------*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1221 |
Goalw [Bseq_def] "[| 0 <= x; x < 1 |] ==> Bseq (%n. x ^ n)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1222 |
by (res_inst_tac [("x","1")] exI 1); |
10784 | 1223 |
by (auto_tac (claset() addDs [conjI RS realpow_le] |
10751 | 1224 |
addIs [order_less_imp_le], |
12330 | 1225 |
simpset() addsimps [abs_eqI1, realpow_abs] )); |
10751 | 1226 |
qed "Bseq_realpow"; |
1227 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1228 |
Goal "[| 0 <= x; x < 1 |] ==> monoseq (%n. x ^ n)"; |
10751 | 1229 |
by (blast_tac (claset() addSIs [mono_SucI2,realpow_Suc_le3]) 1); |
1230 |
qed "monoseq_realpow"; |
|
1231 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1232 |
Goal "[| 0 <= x; x < 1 |] ==> convergent (%n. x ^ n)"; |
10751 | 1233 |
by (blast_tac (claset() addSIs [Bseq_monoseq_convergent, |
1234 |
Bseq_realpow,monoseq_realpow]) 1); |
|
1235 |
qed "convergent_realpow"; |
|
1236 |
||
1237 |
(* We now use NS criterion to bring proof of theorem through *) |
|
1238 |
||
1239 |
||
1240 |
Goalw [NSLIMSEQ_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1241 |
"[| 0 <= x; x < 1 |] ==> (%n. x ^ n) ----NS> 0"; |
10751 | 1242 |
by (auto_tac (claset() addSDs [convergent_realpow], |
1243 |
simpset() addsimps [convergent_NSconvergent_iff])); |
|
12486 | 1244 |
by (ftac NSconvergentD 1); |
10751 | 1245 |
by (auto_tac (claset(), |
1246 |
simpset() addsimps [NSLIMSEQ_def, NSCauchy_NSconvergent_iff RS sym, |
|
1247 |
NSCauchy_def, starfunNat_pow])); |
|
12486 | 1248 |
by (ftac HNatInfinite_add_one 1); |
10751 | 1249 |
by (dtac bspec 1 THEN assume_tac 1); |
1250 |
by (dtac bspec 1 THEN assume_tac 1); |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
1251 |
by (dres_inst_tac [("x","N + (1::hypnat)")] bspec 1 THEN assume_tac 1); |
10751 | 1252 |
by (asm_full_simp_tac (simpset() addsimps [hyperpow_add]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1253 |
by (dtac approx_mult_subst_SReal 1 THEN assume_tac 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1254 |
by (dtac approx_trans3 1 THEN assume_tac 1); |
10751 | 1255 |
by (auto_tac (claset(), |
1256 |
simpset() delsimps [hypreal_of_real_mult] |
|
1257 |
addsimps [hypreal_of_real_mult RS sym])); |
|
1258 |
qed "NSLIMSEQ_realpow_zero"; |
|
1259 |
||
1260 |
(*--------------- standard version ---------------*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1261 |
Goal "[| 0 <= x; x < 1 |] ==> (%n. x ^ n) ----> 0"; |
10751 | 1262 |
by (asm_simp_tac (simpset() addsimps [NSLIMSEQ_realpow_zero, |
1263 |
LIMSEQ_NSLIMSEQ_iff]) 1); |
|
1264 |
qed "LIMSEQ_realpow_zero"; |
|
1265 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1266 |
Goal "1 < x ==> (%n. a / (x ^ n)) ----> 0"; |
10751 | 1267 |
by (cut_inst_tac [("a","a"),("x1","inverse x")] |
1268 |
([LIMSEQ_const, LIMSEQ_realpow_zero] MRS LIMSEQ_mult) 1); |
|
1269 |
by (auto_tac (claset(), |
|
1270 |
simpset() addsimps [real_divide_def, realpow_inverse])); |
|
1271 |
by (asm_simp_tac (simpset() addsimps [real_inverse_eq_divide, |
|
1272 |
pos_real_divide_less_eq]) 1); |
|
1273 |
qed "LIMSEQ_divide_realpow_zero"; |
|
1274 |
||
1275 |
(*---------------------------------------------------------------- |
|
1276 |
Limit of c^n for |c| < 1 |
|
1277 |
---------------------------------------------------------------*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1278 |
Goal "abs(c) < 1 ==> (%n. abs(c) ^ n) ----> 0"; |
10751 | 1279 |
by (blast_tac (claset() addSIs [LIMSEQ_realpow_zero,abs_ge_zero]) 1); |
1280 |
qed "LIMSEQ_rabs_realpow_zero"; |
|
1281 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1282 |
Goal "abs(c) < 1 ==> (%n. abs(c) ^ n) ----NS> 0"; |
10751 | 1283 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_rabs_realpow_zero, |
1284 |
LIMSEQ_NSLIMSEQ_iff RS sym]) 1); |
|
1285 |
qed "NSLIMSEQ_rabs_realpow_zero"; |
|
1286 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1287 |
Goal "abs(c) < 1 ==> (%n. c ^ n) ----> 0"; |
10751 | 1288 |
by (rtac (LIMSEQ_rabs_zero RS iffD1) 1); |
1289 |
by (auto_tac (claset() addIs [LIMSEQ_rabs_realpow_zero], |
|
12330 | 1290 |
simpset() addsimps [realpow_abs])); |
10751 | 1291 |
qed "LIMSEQ_rabs_realpow_zero2"; |
1292 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1293 |
Goal "abs(c) < 1 ==> (%n. c ^ n) ----NS> 0"; |
10751 | 1294 |
by (asm_full_simp_tac (simpset() addsimps [LIMSEQ_rabs_realpow_zero2, |
1295 |
LIMSEQ_NSLIMSEQ_iff RS sym]) 1); |
|
1296 |
qed "NSLIMSEQ_rabs_realpow_zero2"; |
|
1297 |
||
1298 |
(***--------------------------------------------------------------- |
|
1299 |
Hyperreals and Sequences |
|
1300 |
---------------------------------------------------------------***) |
|
1301 |
(*** A bounded sequence is a finite hyperreal ***) |
|
10834 | 1302 |
Goal "NSBseq X ==> Abs_hypreal(hyprel``{X}) : HFinite"; |
10751 | 1303 |
by (auto_tac (claset() addSIs [bexI,lemma_hyprel_refl] addIs |
1304 |
[FreeUltrafilterNat_all RS FreeUltrafilterNat_subset], |
|
1305 |
simpset() addsimps [HFinite_FreeUltrafilterNat_iff, |
|
1306 |
Bseq_NSBseq_iff RS sym, Bseq_iff1a])); |
|
1307 |
qed "NSBseq_HFinite_hypreal"; |
|
1308 |
||
1309 |
(*** A sequence converging to zero defines an infinitesimal ***) |
|
1310 |
Goalw [NSLIMSEQ_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1311 |
"X ----NS> 0 ==> Abs_hypreal(hyprel``{X}) : Infinitesimal"; |
10751 | 1312 |
by (dres_inst_tac [("x","whn")] bspec 1); |
1313 |
by (simp_tac (simpset() addsimps [HNatInfinite_whn]) 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1314 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1315 |
simpset() addsimps [hypnat_omega_def, mem_infmal_iff RS sym, |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1316 |
starfunNat])); |
10751 | 1317 |
qed "NSLIMSEQ_zero_Infinitesimal_hypreal"; |
1318 |
||
1319 |
(***--------------------------------------------------------------- |
|
1320 |
Theorems proved by Harrison in HOL that we do not need |
|
1321 |
in order to prove equivalence between Cauchy criterion |
|
1322 |
and convergence: |
|
1323 |
-- Show that every sequence contains a monotonic subsequence |
|
1324 |
Goal "EX f. subseq f & monoseq (%n. s (f n))"; |
|
1325 |
-- Show that a subsequence of a bounded sequence is bounded |
|
1326 |
Goal "Bseq X ==> Bseq (%n. X (f n))"; |
|
1327 |
-- Show we can take subsequential terms arbitrarily far |
|
1328 |
up a sequence |
|
1329 |
Goal "subseq f ==> n <= f(n)"; |
|
1330 |
Goal "subseq f ==> EX n. N1 <= n & N2 <= f(n)"; |
|
1331 |
---------------------------------------------------------------***) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1332 |
|
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1333 |