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