64 definition |
68 definition |
65 Cauchy :: "(nat \<Rightarrow> 'a::metric_space) \<Rightarrow> bool" where |
69 Cauchy :: "(nat \<Rightarrow> 'a::metric_space) \<Rightarrow> bool" where |
66 --{*Standard definition of the Cauchy condition*} |
70 --{*Standard definition of the Cauchy condition*} |
67 [code del]: "Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. dist (X m) (X n) < e)" |
71 [code del]: "Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. dist (X m) (X n) < e)" |
68 |
72 |
|
73 |
|
74 subsection {* Sequentially *} |
|
75 |
|
76 lemma eventually_sequentially: |
|
77 "eventually P sequentially \<longleftrightarrow> (\<exists>N. \<forall>n\<ge>N. P n)" |
|
78 unfolding sequentially_def |
|
79 apply (rule eventually_Abs_filter) |
|
80 apply simp |
|
81 apply (clarify, rule_tac x=N in exI, simp) |
|
82 apply (clarify, rename_tac M N) |
|
83 apply (rule_tac x="max M N" in exI, simp) |
|
84 done |
|
85 |
|
86 lemma Zseq_conv_Zfun: "Zseq X \<longleftrightarrow> Zfun X sequentially" |
|
87 unfolding Zseq_def Zfun_def eventually_sequentially .. |
|
88 |
|
89 lemma LIMSEQ_conv_tendsto: "(X ----> L) \<longleftrightarrow> tendsto X L sequentially" |
|
90 unfolding LIMSEQ_def tendsto_def eventually_sequentially .. |
69 |
91 |
70 subsection {* Bounded Sequences *} |
92 subsection {* Bounded Sequences *} |
71 |
93 |
72 lemma BseqI': assumes K: "\<And>n. norm (X n) \<le> K" shows "Bseq X" |
94 lemma BseqI': assumes K: "\<And>n. norm (X n) \<le> K" shows "Bseq X" |
73 unfolding Bseq_def |
95 unfolding Bseq_def |
132 |
154 |
133 lemma Zseq_imp_Zseq: |
155 lemma Zseq_imp_Zseq: |
134 assumes X: "Zseq X" |
156 assumes X: "Zseq X" |
135 assumes Y: "\<And>n. norm (Y n) \<le> norm (X n) * K" |
157 assumes Y: "\<And>n. norm (Y n) \<le> norm (X n) * K" |
136 shows "Zseq (\<lambda>n. Y n)" |
158 shows "Zseq (\<lambda>n. Y n)" |
137 proof (cases) |
159 using assms unfolding Zseq_conv_Zfun by (rule Zfun_imp_Zfun) |
138 assume K: "0 < K" |
|
139 show ?thesis |
|
140 proof (rule ZseqI) |
|
141 fix r::real assume "0 < r" |
|
142 hence "0 < r / K" |
|
143 using K by (rule divide_pos_pos) |
|
144 then obtain N where "\<forall>n\<ge>N. norm (X n) < r / K" |
|
145 using ZseqD [OF X] by fast |
|
146 hence "\<forall>n\<ge>N. norm (X n) * K < r" |
|
147 by (simp add: pos_less_divide_eq K) |
|
148 hence "\<forall>n\<ge>N. norm (Y n) < r" |
|
149 by (simp add: order_le_less_trans [OF Y]) |
|
150 thus "\<exists>N. \<forall>n\<ge>N. norm (Y n) < r" .. |
|
151 qed |
|
152 next |
|
153 assume "\<not> 0 < K" |
|
154 hence K: "K \<le> 0" by (simp only: linorder_not_less) |
|
155 { |
|
156 fix n::nat |
|
157 have "norm (Y n) \<le> norm (X n) * K" by (rule Y) |
|
158 also have "\<dots> \<le> norm (X n) * 0" |
|
159 using K norm_ge_zero by (rule mult_left_mono) |
|
160 finally have "norm (Y n) = 0" by simp |
|
161 } |
|
162 thus ?thesis by (simp add: Zseq_zero) |
|
163 qed |
|
164 |
160 |
165 lemma Zseq_le: "\<lbrakk>Zseq Y; \<forall>n. norm (X n) \<le> norm (Y n)\<rbrakk> \<Longrightarrow> Zseq X" |
161 lemma Zseq_le: "\<lbrakk>Zseq Y; \<forall>n. norm (X n) \<le> norm (Y n)\<rbrakk> \<Longrightarrow> Zseq X" |
166 by (erule_tac K="1" in Zseq_imp_Zseq, simp) |
162 by (erule_tac K="1" in Zseq_imp_Zseq, simp) |
167 |
163 |
168 lemma Zseq_add: |
164 lemma Zseq_add: |
169 assumes X: "Zseq X" |
165 "Zseq X \<Longrightarrow> Zseq Y \<Longrightarrow> Zseq (\<lambda>n. X n + Y n)" |
170 assumes Y: "Zseq Y" |
166 unfolding Zseq_conv_Zfun by (rule Zfun_add) |
171 shows "Zseq (\<lambda>n. X n + Y n)" |
|
172 proof (rule ZseqI) |
|
173 fix r::real assume "0 < r" |
|
174 hence r: "0 < r / 2" by simp |
|
175 obtain M where M: "\<forall>n\<ge>M. norm (X n) < r/2" |
|
176 using ZseqD [OF X r] by fast |
|
177 obtain N where N: "\<forall>n\<ge>N. norm (Y n) < r/2" |
|
178 using ZseqD [OF Y r] by fast |
|
179 show "\<exists>N. \<forall>n\<ge>N. norm (X n + Y n) < r" |
|
180 proof (intro exI allI impI) |
|
181 fix n assume n: "max M N \<le> n" |
|
182 have "norm (X n + Y n) \<le> norm (X n) + norm (Y n)" |
|
183 by (rule norm_triangle_ineq) |
|
184 also have "\<dots> < r/2 + r/2" |
|
185 proof (rule add_strict_mono) |
|
186 from M n show "norm (X n) < r/2" by simp |
|
187 from N n show "norm (Y n) < r/2" by simp |
|
188 qed |
|
189 finally show "norm (X n + Y n) < r" by simp |
|
190 qed |
|
191 qed |
|
192 |
167 |
193 lemma Zseq_minus: "Zseq X \<Longrightarrow> Zseq (\<lambda>n. - X n)" |
168 lemma Zseq_minus: "Zseq X \<Longrightarrow> Zseq (\<lambda>n. - X n)" |
194 unfolding Zseq_def by simp |
169 unfolding Zseq_def by simp |
195 |
170 |
196 lemma Zseq_diff: "\<lbrakk>Zseq X; Zseq Y\<rbrakk> \<Longrightarrow> Zseq (\<lambda>n. X n - Y n)" |
171 lemma Zseq_diff: "\<lbrakk>Zseq X; Zseq Y\<rbrakk> \<Longrightarrow> Zseq (\<lambda>n. X n - Y n)" |
197 by (simp only: diff_minus Zseq_add Zseq_minus) |
172 by (simp only: diff_minus Zseq_add Zseq_minus) |
198 |
173 |
199 lemma (in bounded_linear) Zseq: |
174 lemma (in bounded_linear) Zseq: |
200 assumes X: "Zseq X" |
175 "Zseq X \<Longrightarrow> Zseq (\<lambda>n. f (X n))" |
201 shows "Zseq (\<lambda>n. f (X n))" |
176 unfolding Zseq_conv_Zfun by (rule Zfun) |
202 proof - |
|
203 obtain K where "\<And>x. norm (f x) \<le> norm x * K" |
|
204 using bounded by fast |
|
205 with X show ?thesis |
|
206 by (rule Zseq_imp_Zseq) |
|
207 qed |
|
208 |
177 |
209 lemma (in bounded_bilinear) Zseq: |
178 lemma (in bounded_bilinear) Zseq: |
210 assumes X: "Zseq X" |
179 "Zseq X \<Longrightarrow> Zseq Y \<Longrightarrow> Zseq (\<lambda>n. X n ** Y n)" |
211 assumes Y: "Zseq Y" |
180 unfolding Zseq_conv_Zfun by (rule Zfun) |
212 shows "Zseq (\<lambda>n. X n ** Y n)" |
|
213 proof (rule ZseqI) |
|
214 fix r::real assume r: "0 < r" |
|
215 obtain K where K: "0 < K" |
|
216 and norm_le: "\<And>x y. norm (x ** y) \<le> norm x * norm y * K" |
|
217 using pos_bounded by fast |
|
218 from K have K': "0 < inverse K" |
|
219 by (rule positive_imp_inverse_positive) |
|
220 obtain M where M: "\<forall>n\<ge>M. norm (X n) < r" |
|
221 using ZseqD [OF X r] by fast |
|
222 obtain N where N: "\<forall>n\<ge>N. norm (Y n) < inverse K" |
|
223 using ZseqD [OF Y K'] by fast |
|
224 show "\<exists>N. \<forall>n\<ge>N. norm (X n ** Y n) < r" |
|
225 proof (intro exI allI impI) |
|
226 fix n assume n: "max M N \<le> n" |
|
227 have "norm (X n ** Y n) \<le> norm (X n) * norm (Y n) * K" |
|
228 by (rule norm_le) |
|
229 also have "norm (X n) * norm (Y n) * K < r * inverse K * K" |
|
230 proof (intro mult_strict_right_mono mult_strict_mono' norm_ge_zero K) |
|
231 from M n show Xn: "norm (X n) < r" by simp |
|
232 from N n show Yn: "norm (Y n) < inverse K" by simp |
|
233 qed |
|
234 also from K have "r * inverse K * K = r" by simp |
|
235 finally show "norm (X n ** Y n) < r" . |
|
236 qed |
|
237 qed |
|
238 |
181 |
239 lemma (in bounded_bilinear) Zseq_prod_Bseq: |
182 lemma (in bounded_bilinear) Zseq_prod_Bseq: |
240 assumes X: "Zseq X" |
183 assumes X: "Zseq X" |
241 assumes Y: "Bseq Y" |
184 assumes Y: "Bseq Y" |
242 shows "Zseq (\<lambda>n. X n ** Y n)" |
185 shows "Zseq (\<lambda>n. X n ** Y n)" |
339 done |
282 done |
340 |
283 |
341 lemma LIMSEQ_norm: |
284 lemma LIMSEQ_norm: |
342 fixes a :: "'a::real_normed_vector" |
285 fixes a :: "'a::real_normed_vector" |
343 shows "X ----> a \<Longrightarrow> (\<lambda>n. norm (X n)) ----> norm a" |
286 shows "X ----> a \<Longrightarrow> (\<lambda>n. norm (X n)) ----> norm a" |
344 apply (simp add: LIMSEQ_iff, safe) |
287 unfolding LIMSEQ_conv_tendsto by (rule tendsto_norm) |
345 apply (drule_tac x="r" in spec, safe) |
|
346 apply (rule_tac x="no" in exI, safe) |
|
347 apply (drule_tac x="n" in spec, safe) |
|
348 apply (erule order_le_less_trans [OF norm_triangle_ineq3]) |
|
349 done |
|
350 |
288 |
351 lemma LIMSEQ_ignore_initial_segment: |
289 lemma LIMSEQ_ignore_initial_segment: |
352 "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a" |
290 "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a" |
353 apply (rule metric_LIMSEQ_I) |
291 apply (rule metric_LIMSEQ_I) |
354 apply (drule (1) metric_LIMSEQ_D) |
292 apply (drule (1) metric_LIMSEQ_D) |
379 |
317 |
380 lemma LIMSEQ_linear: "\<lbrakk> X ----> x ; l > 0 \<rbrakk> \<Longrightarrow> (\<lambda> n. X (n * l)) ----> x" |
318 lemma LIMSEQ_linear: "\<lbrakk> X ----> x ; l > 0 \<rbrakk> \<Longrightarrow> (\<lambda> n. X (n * l)) ----> x" |
381 unfolding LIMSEQ_def |
319 unfolding LIMSEQ_def |
382 by (metis div_le_dividend div_mult_self1_is_m le_trans nat_mult_commute) |
320 by (metis div_le_dividend div_mult_self1_is_m le_trans nat_mult_commute) |
383 |
321 |
384 |
|
385 lemma add_diff_add: |
|
386 fixes a b c d :: "'a::ab_group_add" |
|
387 shows "(a + c) - (b + d) = (a - b) + (c - d)" |
|
388 by simp |
|
389 |
|
390 lemma minus_diff_minus: |
|
391 fixes a b :: "'a::ab_group_add" |
|
392 shows "(- a) - (- b) = - (a - b)" |
|
393 by simp |
|
394 |
|
395 lemma LIMSEQ_add: |
322 lemma LIMSEQ_add: |
396 fixes a b :: "'a::real_normed_vector" |
323 fixes a b :: "'a::real_normed_vector" |
397 shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) ----> a + b" |
324 shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) ----> a + b" |
398 by (simp only: LIMSEQ_Zseq_iff add_diff_add Zseq_add) |
325 unfolding LIMSEQ_conv_tendsto by (rule tendsto_add) |
399 |
326 |
400 lemma LIMSEQ_minus: |
327 lemma LIMSEQ_minus: |
401 fixes a :: "'a::real_normed_vector" |
328 fixes a :: "'a::real_normed_vector" |
402 shows "X ----> a \<Longrightarrow> (\<lambda>n. - X n) ----> - a" |
329 shows "X ----> a \<Longrightarrow> (\<lambda>n. - X n) ----> - a" |
403 by (simp only: LIMSEQ_Zseq_iff minus_diff_minus Zseq_minus) |
330 unfolding LIMSEQ_conv_tendsto by (rule tendsto_minus) |
404 |
331 |
405 lemma LIMSEQ_minus_cancel: |
332 lemma LIMSEQ_minus_cancel: |
406 fixes a :: "'a::real_normed_vector" |
333 fixes a :: "'a::real_normed_vector" |
407 shows "(\<lambda>n. - X n) ----> - a \<Longrightarrow> X ----> a" |
334 shows "(\<lambda>n. - X n) ----> - a \<Longrightarrow> X ----> a" |
408 by (drule LIMSEQ_minus, simp) |
335 by (drule LIMSEQ_minus, simp) |
409 |
336 |
410 lemma LIMSEQ_diff: |
337 lemma LIMSEQ_diff: |
411 fixes a b :: "'a::real_normed_vector" |
338 fixes a b :: "'a::real_normed_vector" |
412 shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) ----> a - b" |
339 shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) ----> a - b" |
413 by (simp add: diff_minus LIMSEQ_add LIMSEQ_minus) |
340 unfolding LIMSEQ_conv_tendsto by (rule tendsto_diff) |
414 |
341 |
415 lemma LIMSEQ_unique: "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b" |
342 lemma LIMSEQ_unique: "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b" |
416 apply (rule ccontr) |
343 apply (rule ccontr) |
417 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff) |
344 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff) |
418 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff) |
345 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff) |
423 apply (subst dist_commute, rule dist_triangle) |
350 apply (subst dist_commute, rule dist_triangle) |
424 done |
351 done |
425 |
352 |
426 lemma (in bounded_linear) LIMSEQ: |
353 lemma (in bounded_linear) LIMSEQ: |
427 "X ----> a \<Longrightarrow> (\<lambda>n. f (X n)) ----> f a" |
354 "X ----> a \<Longrightarrow> (\<lambda>n. f (X n)) ----> f a" |
428 by (simp only: LIMSEQ_Zseq_iff diff [symmetric] Zseq) |
355 unfolding LIMSEQ_conv_tendsto by (rule tendsto) |
429 |
356 |
430 lemma (in bounded_bilinear) LIMSEQ: |
357 lemma (in bounded_bilinear) LIMSEQ: |
431 "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n ** Y n) ----> a ** b" |
358 "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n ** Y n) ----> a ** b" |
432 by (simp only: LIMSEQ_Zseq_iff prod_diff_prod |
359 unfolding LIMSEQ_conv_tendsto by (rule tendsto) |
433 Zseq_add Zseq Zseq_left Zseq_right) |
|
434 |
360 |
435 lemma LIMSEQ_mult: |
361 lemma LIMSEQ_mult: |
436 fixes a b :: "'a::real_normed_algebra" |
362 fixes a b :: "'a::real_normed_algebra" |
437 shows "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b" |
363 shows "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b" |
438 by (rule mult.LIMSEQ) |
364 by (rule mult.LIMSEQ) |