375 apply (drule_tac x="Suc n" in spec, simp) |
375 apply (drule_tac x="Suc n" in spec, simp) |
376 apply (drule_tac x="n" in spec, simp) |
376 apply (drule_tac x="n" in spec, simp) |
377 done |
377 done |
378 |
378 |
379 lemma summable_Cauchy: |
379 lemma summable_Cauchy: |
380 "summable (f::nat \<Rightarrow> real) = |
380 "summable (f::nat \<Rightarrow> 'a::banach) = |
381 (\<forall>e > 0. \<exists>N. \<forall>m \<ge> N. \<forall>n. abs(setsum f {m..<n}) < e)" |
381 (\<forall>e > 0. \<exists>N. \<forall>m \<ge> N. \<forall>n. norm (setsum f {m..<n}) < e)" |
382 apply (simp only: summable_convergent_sumr_iff Cauchy_convergent_iff [symmetric] Cauchy_def diff_minus [symmetric], safe) |
382 apply (simp only: summable_convergent_sumr_iff Cauchy_convergent_iff [symmetric] Cauchy_def, safe) |
383 apply (drule spec, drule (1) mp) |
383 apply (drule spec, drule (1) mp) |
384 apply (erule exE, rule_tac x="M" in exI, clarify) |
384 apply (erule exE, rule_tac x="M" in exI, clarify) |
385 apply (rule_tac x="m" and y="n" in linorder_le_cases) |
385 apply (rule_tac x="m" and y="n" in linorder_le_cases) |
386 apply (frule (1) order_trans) |
386 apply (frule (1) order_trans) |
387 apply (drule_tac x="n" in spec, drule (1) mp) |
387 apply (drule_tac x="n" in spec, drule (1) mp) |
408 apply (erule order_trans [OF norm_triangle_ineq add_left_mono]) |
408 apply (erule order_trans [OF norm_triangle_ineq add_left_mono]) |
409 apply simp |
409 apply simp |
410 done |
410 done |
411 |
411 |
412 lemma summable_comparison_test: |
412 lemma summable_comparison_test: |
413 fixes f :: "nat \<Rightarrow> real" |
413 fixes f :: "nat \<Rightarrow> 'a::banach" |
414 shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f" |
414 shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f" |
415 apply (simp add: summable_Cauchy, safe) |
415 apply (simp add: summable_Cauchy, safe) |
416 apply (drule_tac x="e" in spec, safe) |
416 apply (drule_tac x="e" in spec, safe) |
417 apply (rule_tac x = "N + Na" in exI, safe) |
417 apply (rule_tac x = "N + Na" in exI, safe) |
418 apply (rotate_tac 2) |
418 apply (rotate_tac 2) |
419 apply (drule_tac x = m in spec) |
419 apply (drule_tac x = m in spec) |
420 apply (auto, rotate_tac 2, drule_tac x = n in spec) |
420 apply (auto, rotate_tac 2, drule_tac x = n in spec) |
421 apply (rule_tac y = "\<Sum>k=m..<n. abs(f k)" in order_le_less_trans) |
421 apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) |
422 apply (rule setsum_abs) |
422 apply (rule norm_setsum) |
423 apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) |
423 apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) |
424 apply (auto intro: setsum_mono simp add: abs_interval_iff) |
424 apply (auto intro: setsum_mono simp add: abs_interval_iff) |
|
425 done |
|
426 |
|
427 lemma summable_norm_comparison_test: |
|
428 fixes f :: "nat \<Rightarrow> 'a::banach" |
|
429 shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> |
|
430 \<Longrightarrow> summable (\<lambda>n. norm (f n))" |
|
431 apply (rule summable_comparison_test) |
|
432 apply (auto) |
425 done |
433 done |
426 |
434 |
427 lemma summable_rabs_comparison_test: |
435 lemma summable_rabs_comparison_test: |
428 fixes f :: "nat \<Rightarrow> real" |
436 fixes f :: "nat \<Rightarrow> real" |
429 shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)" |
437 shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)" |
443 done |
451 done |
444 |
452 |
445 lemma summable_le2: |
453 lemma summable_le2: |
446 fixes f g :: "nat \<Rightarrow> real" |
454 fixes f g :: "nat \<Rightarrow> real" |
447 shows "\<lbrakk>\<forall>n. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f \<and> suminf f \<le> suminf g" |
455 shows "\<lbrakk>\<forall>n. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f \<and> suminf f \<le> suminf g" |
448 apply (auto intro: summable_comparison_test intro!: summable_le) |
456 apply (subgoal_tac "summable f") |
|
457 apply (auto intro!: summable_le) |
449 apply (simp add: abs_le_interval_iff) |
458 apply (simp add: abs_le_interval_iff) |
|
459 apply (rule_tac g="g" in summable_comparison_test, simp_all) |
450 done |
460 done |
451 |
461 |
452 (* specialisation for the common 0 case *) |
462 (* specialisation for the common 0 case *) |
453 lemma suminf_0_le: |
463 lemma suminf_0_le: |
454 fixes f::"nat\<Rightarrow>real" |
464 fixes f::"nat\<Rightarrow>real" |
463 then show "0 \<le> suminf f" by (simp add: suminf_zero) |
473 then show "0 \<le> suminf f" by (simp add: suminf_zero) |
464 qed |
474 qed |
465 |
475 |
466 |
476 |
467 text{*Absolute convergence imples normal convergence*} |
477 text{*Absolute convergence imples normal convergence*} |
468 lemma summable_rabs_cancel: |
478 lemma summable_norm_cancel: |
469 fixes f :: "nat \<Rightarrow> real" |
479 fixes f :: "nat \<Rightarrow> 'a::banach" |
470 shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f" |
480 shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" |
471 apply (simp only: summable_Cauchy, safe) |
481 apply (simp only: summable_Cauchy, safe) |
472 apply (drule_tac x="e" in spec, safe) |
482 apply (drule_tac x="e" in spec, safe) |
473 apply (rule_tac x="N" in exI, safe) |
483 apply (rule_tac x="N" in exI, safe) |
474 apply (drule_tac x="m" in spec, safe) |
484 apply (drule_tac x="m" in spec, safe) |
475 apply (rule order_le_less_trans [OF setsum_abs]) |
485 apply (rule order_le_less_trans [OF norm_setsum]) |
476 apply simp |
486 apply (rule order_le_less_trans [OF abs_ge_self]) |
477 done |
487 apply simp |
|
488 done |
|
489 |
|
490 lemma summable_rabs_cancel: |
|
491 fixes f :: "nat \<Rightarrow> real" |
|
492 shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f" |
|
493 by (rule summable_norm_cancel, simp) |
478 |
494 |
479 text{*Absolute convergence of series*} |
495 text{*Absolute convergence of series*} |
|
496 lemma summable_norm: |
|
497 fixes f :: "nat \<Rightarrow> 'a::banach" |
|
498 shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" |
|
499 by (auto intro: LIMSEQ_le LIMSEQ_norm summable_norm_cancel |
|
500 summable_sumr_LIMSEQ_suminf norm_setsum) |
|
501 |
480 lemma summable_rabs: |
502 lemma summable_rabs: |
481 fixes f :: "nat \<Rightarrow> real" |
503 fixes f :: "nat \<Rightarrow> real" |
482 shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" |
504 shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" |
483 by (auto intro: LIMSEQ_le LIMSEQ_imp_rabs summable_rabs_cancel summable_sumr_LIMSEQ_suminf) |
505 by (fold real_norm_def, rule summable_norm) |
484 |
|
485 |
506 |
486 subsection{* The Ratio Test*} |
507 subsection{* The Ratio Test*} |
487 |
508 |
|
509 lemma norm_ratiotest_lemma: |
|
510 fixes x y :: "'a::normed" |
|
511 shows "\<lbrakk>c \<le> 0; norm x \<le> c * norm y\<rbrakk> \<Longrightarrow> x = 0" |
|
512 apply (subgoal_tac "norm x \<le> 0", simp) |
|
513 apply (erule order_trans) |
|
514 apply (simp add: mult_le_0_iff) |
|
515 done |
|
516 |
488 lemma rabs_ratiotest_lemma: "[| c \<le> 0; abs x \<le> c * abs y |] ==> x = (0::real)" |
517 lemma rabs_ratiotest_lemma: "[| c \<le> 0; abs x \<le> c * abs y |] ==> x = (0::real)" |
489 apply (drule order_le_imp_less_or_eq, auto) |
518 by (erule norm_ratiotest_lemma, simp) |
490 apply (subgoal_tac "0 \<le> c * abs y") |
|
491 apply (simp add: zero_le_mult_iff, arith) |
|
492 done |
|
493 |
519 |
494 lemma le_Suc_ex: "(k::nat) \<le> l ==> (\<exists>n. l = k + n)" |
520 lemma le_Suc_ex: "(k::nat) \<le> l ==> (\<exists>n. l = k + n)" |
495 apply (drule le_imp_less_or_eq) |
521 apply (drule le_imp_less_or_eq) |
496 apply (auto dest: less_imp_Suc_add) |
522 apply (auto dest: less_imp_Suc_add) |
497 done |
523 done |
499 lemma le_Suc_ex_iff: "((k::nat) \<le> l) = (\<exists>n. l = k + n)" |
525 lemma le_Suc_ex_iff: "((k::nat) \<le> l) = (\<exists>n. l = k + n)" |
500 by (auto simp add: le_Suc_ex) |
526 by (auto simp add: le_Suc_ex) |
501 |
527 |
502 (*All this trouble just to get 0<c *) |
528 (*All this trouble just to get 0<c *) |
503 lemma ratio_test_lemma2: |
529 lemma ratio_test_lemma2: |
504 fixes f :: "nat \<Rightarrow> real" |
530 fixes f :: "nat \<Rightarrow> 'a::banach" |
505 shows "\<lbrakk>\<forall>n\<ge>N. \<bar>f (Suc n)\<bar> \<le> c * \<bar>f n\<bar>\<rbrakk> \<Longrightarrow> 0 < c \<or> summable f" |
531 shows "\<lbrakk>\<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> 0 < c \<or> summable f" |
506 apply (simp (no_asm) add: linorder_not_le [symmetric]) |
532 apply (simp (no_asm) add: linorder_not_le [symmetric]) |
507 apply (simp add: summable_Cauchy) |
533 apply (simp add: summable_Cauchy) |
508 apply (safe, subgoal_tac "\<forall>n. N < n --> f (n) = 0") |
534 apply (safe, subgoal_tac "\<forall>n. N < n --> f (n) = 0") |
509 prefer 2 |
535 prefer 2 |
510 apply clarify |
536 apply clarify |
511 apply(erule_tac x = "n - 1" in allE) |
537 apply(erule_tac x = "n - 1" in allE) |
512 apply (simp add:diff_Suc split:nat.splits) |
538 apply (simp add:diff_Suc split:nat.splits) |
513 apply (blast intro: rabs_ratiotest_lemma) |
539 apply (blast intro: norm_ratiotest_lemma) |
514 apply (rule_tac x = "Suc N" in exI, clarify) |
540 apply (rule_tac x = "Suc N" in exI, clarify) |
515 apply(simp cong:setsum_ivl_cong) |
541 apply(simp cong:setsum_ivl_cong) |
516 done |
542 done |
517 |
543 |
518 lemma ratio_test: |
544 lemma ratio_test: |
519 fixes f :: "nat \<Rightarrow> real" |
545 fixes f :: "nat \<Rightarrow> 'a::banach" |
520 shows "\<lbrakk>c < 1; \<forall>n\<ge>N. \<bar>f (Suc n)\<bar> \<le> c * \<bar>f n\<bar>\<rbrakk> \<Longrightarrow> summable f" |
546 shows "\<lbrakk>c < 1; \<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> summable f" |
521 apply (frule ratio_test_lemma2, auto) |
547 apply (frule ratio_test_lemma2, auto) |
522 apply (rule_tac g = "%n. (abs (f N) / (c ^ N))*c ^ n" |
548 apply (rule_tac g = "%n. (norm (f N) / (c ^ N))*c ^ n" |
523 in summable_comparison_test) |
549 in summable_comparison_test) |
524 apply (rule_tac x = N in exI, safe) |
550 apply (rule_tac x = N in exI, safe) |
525 apply (drule le_Suc_ex_iff [THEN iffD1]) |
551 apply (drule le_Suc_ex_iff [THEN iffD1]) |
526 apply (auto simp add: power_add realpow_not_zero) |
552 apply (auto simp add: power_add realpow_not_zero) |
527 apply (induct_tac "na", auto) |
553 apply (induct_tac "na", auto) |
528 apply (rule_tac y = "c*abs (f (N + n))" in order_trans) |
554 apply (rule_tac y = "c * norm (f (N + n))" in order_trans) |
529 apply (auto intro: mult_right_mono simp add: summable_def) |
555 apply (auto intro: mult_right_mono simp add: summable_def) |
530 apply (simp add: mult_ac) |
556 apply (simp add: mult_ac) |
531 apply (rule_tac x = "abs (f N) * (1/ (1 - c)) / (c ^ N)" in exI) |
557 apply (rule_tac x = "norm (f N) * (1/ (1 - c)) / (c ^ N)" in exI) |
532 apply (rule sums_divide) |
558 apply (rule sums_divide) |
533 apply (rule sums_mult) |
559 apply (rule sums_mult) |
534 apply (auto intro!: geometric_sums) |
560 apply (auto intro!: geometric_sums) |
535 done |
561 done |
536 |
562 |