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