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