src/HOL/Series.thy
author paulson <lp15@cam.ac.uk>
Wed, 02 May 2018 12:47:56 +0100
changeset 68064 b249fab48c76
parent 67268 bdf25939a550
child 68127 137d5d0112bb
permissions -rw-r--r--
type class generalisations; some work on infinite products
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     1
(*  Title       : Series.thy
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     3
    Copyright   : 1998  University of Cambridge
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
     4
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
     5
Converted to Isar and polished by lcp
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
     6
Converted to sum and polished yet more by TNN
16819
00d8f9300d13 Additions to the Real (and Hyperreal) libraries:
avigad
parents: 16733
diff changeset
     7
Additional contributions by Jeremy Avigad
41970
47d6e13d1710 generalize infinite sums
hoelzl
parents: 36660
diff changeset
     8
*)
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     9
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
    10
section \<open>Infinite Series\<close>
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    11
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15085
diff changeset
    12
theory Series
59712
6c013328b885 add inequalities (move from AFP/Amortized_Complexity)
hoelzl
parents: 59613
diff changeset
    13
imports Limits Inequalities
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
    14
begin
15561
045a07ac35a7 another reorganization of setsums and intervals
nipkow
parents: 15546
diff changeset
    15
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
    16
subsection \<open>Definition of infinite summability\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    17
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    18
definition sums :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a \<Rightarrow> bool"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    19
    (infixr "sums" 80)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    20
  where "f sums s \<longleftrightarrow> (\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> s"
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
    21
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    22
definition summable :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> bool"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    23
  where "summable f \<longleftrightarrow> (\<exists>s. f sums s)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    24
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    25
definition suminf :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    26
    (binder "\<Sum>" 10)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    27
  where "suminf f = (THE s. f sums s)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    28
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63680
diff changeset
    29
text\<open>Variants of the definition\<close>
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    30
lemma sums_def': "f sums s \<longleftrightarrow> (\<lambda>n. \<Sum>i = 0..n. f i) \<longlonglongrightarrow> s"
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    31
  apply (simp add: sums_def)
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    32
  apply (subst LIMSEQ_Suc_iff [symmetric])
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    33
  apply (simp only: lessThan_Suc_atMost atLeast0AtMost)
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    34
  done
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
    35
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63680
diff changeset
    36
lemma sums_def_le: "f sums s \<longleftrightarrow> (\<lambda>n. \<Sum>i\<le>n. f i) \<longlonglongrightarrow> s"
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63680
diff changeset
    37
  by (simp add: sums_def' atMost_atLeast0)
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63680
diff changeset
    38
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    39
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
    40
subsection \<open>Infinite summability on topological monoids\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    41
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    42
lemma sums_subst[trans]: "f = g \<Longrightarrow> g sums z \<Longrightarrow> f sums z"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    43
  by simp
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    44
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    45
lemma sums_cong: "(\<And>n. f n = g n) \<Longrightarrow> f sums c \<longleftrightarrow> g sums c"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    46
  by (drule ext) simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    47
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    48
lemma sums_summable: "f sums l \<Longrightarrow> summable f"
41970
47d6e13d1710 generalize infinite sums
hoelzl
parents: 36660
diff changeset
    49
  by (simp add: sums_def summable_def, blast)
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
    50
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    51
lemma summable_iff_convergent: "summable f \<longleftrightarrow> convergent (\<lambda>n. \<Sum>i<n. f i)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    52
  by (simp add: summable_def sums_def convergent_def)
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
    53
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    54
lemma summable_iff_convergent': "summable f \<longleftrightarrow> convergent (\<lambda>n. sum f {..n})"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
    55
  by (simp_all only: summable_iff_convergent convergent_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    56
        lessThan_Suc_atMost [symmetric] LIMSEQ_Suc_iff[of "\<lambda>n. sum f {..<n}"])
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    57
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
    58
lemma suminf_eq_lim: "suminf f = lim (\<lambda>n. \<Sum>i<n. f i)"
41970
47d6e13d1710 generalize infinite sums
hoelzl
parents: 36660
diff changeset
    59
  by (simp add: suminf_def sums_def lim_def)
32707
836ec9d0a0c8 New lemmas involving the real numbers, especially limits and series
paulson
parents: 31336
diff changeset
    60
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    61
lemma sums_zero[simp, intro]: "(\<lambda>n. 0) sums 0"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57418
diff changeset
    62
  unfolding sums_def by simp
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    63
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    64
lemma summable_zero[simp, intro]: "summable (\<lambda>n. 0)"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    65
  by (rule sums_zero [THEN sums_summable])
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    66
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    67
lemma sums_group: "f sums s \<Longrightarrow> 0 < k \<Longrightarrow> (\<lambda>n. sum f {n * k ..< n * k + k}) sums s"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    68
  apply (simp only: sums_def sum_nat_group tendsto_def eventually_sequentially)
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    69
  apply safe
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    70
  apply (erule_tac x=S in allE)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    71
  apply safe
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    72
  apply (rule_tac x="N" in exI, safe)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    73
  apply (drule_tac x="n*k" in spec)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    74
  apply (erule mp)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    75
  apply (erule order_trans)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    76
  apply simp
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    77
  done
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
    78
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    79
lemma suminf_cong: "(\<And>n. f n = g n) \<Longrightarrow> suminf f = suminf g"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    80
  by (rule arg_cong[of f g], rule ext) simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    81
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    82
lemma summable_cong:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    83
  fixes f g :: "nat \<Rightarrow> 'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    84
  assumes "eventually (\<lambda>x. f x = g x) sequentially"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    85
  shows "summable f = summable g"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    86
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    87
  from assms obtain N where N: "\<forall>n\<ge>N. f n = g n"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    88
    by (auto simp: eventually_at_top_linorder)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62381
diff changeset
    89
  define C where "C = (\<Sum>k<N. f k - g k)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
    90
  from eventually_ge_at_top[of N]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    91
  have "eventually (\<lambda>n. sum f {..<n} = C + sum g {..<n}) sequentially"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
    92
  proof eventually_elim
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    93
    case (elim n)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    94
    then have "{..<n} = {..<N} \<union> {N..<n}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
    95
      by auto
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    96
    also have "sum f ... = sum f {..<N} + sum f {N..<n}"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    97
      by (intro sum.union_disjoint) auto
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    98
    also from N have "sum f {N..<n} = sum g {N..<n}"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
    99
      by (intro sum.cong) simp_all
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   100
    also have "sum f {..<N} + sum g {N..<n} = C + (sum g {..<N} + sum g {N..<n})"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   101
      unfolding C_def by (simp add: algebra_simps sum_subtractf)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   102
    also have "sum g {..<N} + sum g {N..<n} = sum g ({..<N} \<union> {N..<n})"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   103
      by (intro sum.union_disjoint [symmetric]) auto
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   104
    also from elim have "{..<N} \<union> {N..<n} = {..<n}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   105
      by auto
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   106
    finally show "sum f {..<n} = C + sum g {..<n}" .
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   107
  qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   108
  from convergent_cong[OF this] show ?thesis
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   109
    by (simp add: summable_iff_convergent convergent_add_const_iff)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   110
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   111
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   112
lemma sums_finite:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   113
  assumes [simp]: "finite N"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   114
    and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0"
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   115
  shows "f sums (\<Sum>n\<in>N. f n)"
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   116
proof -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   117
  have eq: "sum f {..<n + Suc (Max N)} = sum f N" for n
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   118
  proof (cases "N = {}")
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   119
    case True
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   120
    with f have "f = (\<lambda>x. 0)" by auto
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   121
    then show ?thesis by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   122
  next
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   123
    case [simp]: False
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   124
    show ?thesis
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   125
    proof (safe intro!: sum.mono_neutral_right f)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   126
      fix i
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   127
      assume "i \<in> N"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   128
      then have "i \<le> Max N" by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   129
      then show "i < n + Suc (Max N)" by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   130
    qed
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   131
  qed
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   132
  show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   133
    unfolding sums_def
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   134
    by (rule LIMSEQ_offset[of _ "Suc (Max N)"])
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57418
diff changeset
   135
       (simp add: eq atLeast0LessThan del: add_Suc_right)
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   136
qed
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   137
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   138
corollary sums_0: "(\<And>n. f n = 0) \<Longrightarrow> (f sums 0)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   139
    by (metis (no_types) finite.emptyI sum.empty sums_finite)
62217
527488dc8b90 Reorganised a huge proof
paulson <lp15@cam.ac.uk>
parents: 62087
diff changeset
   140
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   141
lemma summable_finite: "finite N \<Longrightarrow> (\<And>n. n \<notin> N \<Longrightarrow> f n = 0) \<Longrightarrow> summable f"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   142
  by (rule sums_summable) (rule sums_finite)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   143
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   144
lemma sums_If_finite_set: "finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else 0) sums (\<Sum>r\<in>A. f r)"
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   145
  using sums_finite[of A "(\<lambda>r. if r \<in> A then f r else 0)"] by simp
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47108
diff changeset
   146
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   147
lemma summable_If_finite_set[simp, intro]: "finite A \<Longrightarrow> summable (\<lambda>r. if r \<in> A then f r else 0)"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   148
  by (rule sums_summable) (rule sums_If_finite_set)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   149
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   150
lemma sums_If_finite: "finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else 0) sums (\<Sum>r | P r. f r)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   151
  using sums_If_finite_set[of "{r. P r}"] by simp
16819
00d8f9300d13 Additions to the Real (and Hyperreal) libraries:
avigad
parents: 16733
diff changeset
   152
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   153
lemma summable_If_finite[simp, intro]: "finite {r. P r} \<Longrightarrow> summable (\<lambda>r. if P r then f r else 0)"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   154
  by (rule sums_summable) (rule sums_If_finite)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   155
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   156
lemma sums_single: "(\<lambda>r. if r = i then f r else 0) sums f i"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   157
  using sums_If_finite[of "\<lambda>r. r = i"] by simp
29803
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29197
diff changeset
   158
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   159
lemma summable_single[simp, intro]: "summable (\<lambda>r. if r = i then f r else 0)"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   160
  by (rule sums_summable) (rule sums_single)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   161
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   162
context
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   163
  fixes f :: "nat \<Rightarrow> 'a::{t2_space,comm_monoid_add}"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   164
begin
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   165
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   166
lemma summable_sums[intro]: "summable f \<Longrightarrow> f sums (suminf f)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   167
  by (simp add: summable_def sums_def suminf_def)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   168
     (metis convergent_LIMSEQ_iff convergent_def lim_def)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   169
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   170
lemma summable_LIMSEQ: "summable f \<Longrightarrow> (\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> suminf f"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   171
  by (rule summable_sums [unfolded sums_def])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   172
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67268
diff changeset
   173
lemma summable_LIMSEQ': "summable f \<Longrightarrow> (\<lambda>n. \<Sum>i\<le>n. f i) \<longlonglongrightarrow> suminf f"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67268
diff changeset
   174
  using sums_def_le by blast
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67268
diff changeset
   175
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   176
lemma sums_unique: "f sums s \<Longrightarrow> s = suminf f"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   177
  by (metis limI suminf_eq_lim sums_def)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   178
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   179
lemma sums_iff: "f sums x \<longleftrightarrow> summable f \<and> suminf f = x"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   180
  by (metis summable_sums sums_summable sums_unique)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   181
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   182
lemma summable_sums_iff: "summable f \<longleftrightarrow> f sums suminf f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   183
  by (auto simp: sums_iff summable_sums)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   184
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   185
lemma sums_unique2: "f sums a \<Longrightarrow> f sums b \<Longrightarrow> a = b"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   186
  for a b :: 'a
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   187
  by (simp add: sums_iff)
59613
7103019278f0 The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents: 59025
diff changeset
   188
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   189
lemma suminf_finite:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   190
  assumes N: "finite N"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   191
    and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   192
  shows "suminf f = (\<Sum>n\<in>N. f n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   193
  using sums_finite[OF assms, THEN sums_unique] by simp
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   194
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   195
end
16819
00d8f9300d13 Additions to the Real (and Hyperreal) libraries:
avigad
parents: 16733
diff changeset
   196
41970
47d6e13d1710 generalize infinite sums
hoelzl
parents: 36660
diff changeset
   197
lemma suminf_zero[simp]: "suminf (\<lambda>n. 0::'a::{t2_space, comm_monoid_add}) = 0"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   198
  by (rule sums_zero [THEN sums_unique, symmetric])
16819
00d8f9300d13 Additions to the Real (and Hyperreal) libraries:
avigad
parents: 16733
diff changeset
   199
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   200
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   201
subsection \<open>Infinite summability on ordered, topological monoids\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   202
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   203
lemma sums_le: "\<forall>n. f n \<le> g n \<Longrightarrow> f sums s \<Longrightarrow> g sums t \<Longrightarrow> s \<le> t"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   204
  for f g :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add,linorder_topology}"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   205
  by (rule LIMSEQ_le) (auto intro: sum_mono simp: sums_def)
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   206
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   207
context
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   208
  fixes f :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add,linorder_topology}"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   209
begin
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   210
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   211
lemma suminf_le: "\<forall>n. f n \<le> g n \<Longrightarrow> summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f \<le> suminf g"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   212
  by (auto dest: sums_summable intro: sums_le)
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   213
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   214
lemma sum_le_suminf: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 \<le> f m \<Longrightarrow> sum f {..<n} \<le> suminf f"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   215
  by (rule sums_le[OF _ sums_If_finite_set summable_sums]) auto
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   216
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   217
lemma suminf_nonneg: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 \<le> suminf f"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   218
  using sum_le_suminf[of 0] by simp
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   219
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   220
lemma suminf_le_const: "summable f \<Longrightarrow> (\<And>n. sum f {..<n} \<le> x) \<Longrightarrow> suminf f \<le> x"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   221
  by (metis LIMSEQ_le_const2 summable_LIMSEQ)
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   222
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   223
lemma suminf_eq_zero_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> suminf f = 0 \<longleftrightarrow> (\<forall>n. f n = 0)"
50999
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   224
proof
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   225
  assume "summable f" "suminf f = 0" and pos: "\<forall>n. 0 \<le> f n"
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   226
  then have f: "(\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> 0"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   227
    using summable_LIMSEQ[of f] by simp
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   228
  then have "\<And>i. (\<Sum>n\<in>{i}. f n) \<le> 0"
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   229
  proof (rule LIMSEQ_le_const)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   230
    show "\<exists>N. \<forall>n\<ge>N. (\<Sum>n\<in>{i}. f n) \<le> sum f {..<n}" for i
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   231
      using pos by (intro exI[of _ "Suc i"] allI impI sum_mono2) auto
50999
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   232
  qed
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   233
  with pos show "\<forall>n. f n = 0"
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   234
    by (auto intro!: antisym)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   235
qed (metis suminf_zero fun_eq_iff)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   236
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   237
lemma suminf_pos_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 < suminf f \<longleftrightarrow> (\<exists>i. 0 < f i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   238
  using sum_le_suminf[of 0] suminf_eq_zero_iff by (simp add: less_le)
62377
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   239
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   240
lemma suminf_pos2:
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   241
  assumes "summable f" "\<forall>n. 0 \<le> f n" "0 < f i"
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   242
  shows "0 < suminf f"
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   243
proof -
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   244
  have "0 < (\<Sum>n<Suc i. f n)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   245
    using assms by (intro sum_pos2[where i=i]) auto
62377
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   246
  also have "\<dots> \<le> suminf f"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   247
    using assms by (intro sum_le_suminf) auto
62377
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   248
  finally show ?thesis .
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   249
qed
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   250
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   251
lemma suminf_pos: "summable f \<Longrightarrow> \<forall>n. 0 < f n \<Longrightarrow> 0 < suminf f"
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   252
  by (intro suminf_pos2[where i=0]) (auto intro: less_imp_le)
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   253
62376
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   254
end
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   255
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   256
context
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   257
  fixes f :: "nat \<Rightarrow> 'a::{ordered_cancel_comm_monoid_add,linorder_topology}"
62376
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   258
begin
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   259
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   260
lemma sum_less_suminf2:
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   261
  "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 \<le> f m \<Longrightarrow> n \<le> i \<Longrightarrow> 0 < f i \<Longrightarrow> sum f {..<n} < suminf f"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   262
  using sum_le_suminf[of f "Suc i"]
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   263
    and add_strict_increasing[of "f i" "sum f {..<n}" "sum f {..<i}"]
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   264
    and sum_mono2[of "{..<i}" "{..<n}" f]
62376
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   265
  by (auto simp: less_imp_le ac_simps)
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   266
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   267
lemma sum_less_suminf: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 < f m \<Longrightarrow> sum f {..<n} < suminf f"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   268
  using sum_less_suminf2[of n n] by (simp add: less_imp_le)
62376
85f38d5f8807 Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents: 62368
diff changeset
   269
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   270
end
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   271
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   272
lemma summableI_nonneg_bounded:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   273
  fixes f :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add,linorder_topology,conditionally_complete_linorder}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   274
  assumes pos[simp]: "\<And>n. 0 \<le> f n"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   275
    and le: "\<And>n. (\<Sum>i<n. f i) \<le> x"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   276
  shows "summable f"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   277
  unfolding summable_def sums_def [abs_def]
62377
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   278
proof (rule exI LIMSEQ_incseq_SUP)+
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   279
  show "bdd_above (range (\<lambda>n. sum f {..<n}))"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   280
    using le by (auto simp: bdd_above_def)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   281
  show "incseq (\<lambda>n. sum f {..<n})"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   282
    by (auto simp: mono_def intro!: sum_mono2)
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   283
qed
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   284
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   285
lemma summableI[intro, simp]: "summable f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   286
  for f :: "nat \<Rightarrow> 'a::{canonically_ordered_monoid_add,linorder_topology,complete_linorder}"
62377
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   287
  by (intro summableI_nonneg_bounded[where x=top] zero_le top_greatest)
ace69956d018 moved more proofs to ordered_comm_monoid_add; introduced strict_ordered_ab_semigroup/comm_monoid_add
hoelzl
parents: 62376
diff changeset
   288
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   289
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   290
subsection \<open>Infinite summability on topological monoids\<close>
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   291
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   292
context
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   293
  fixes f g :: "nat \<Rightarrow> 'a::{t2_space,topological_comm_monoid_add}"
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   294
begin
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   295
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   296
lemma sums_Suc:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   297
  assumes "(\<lambda>n. f (Suc n)) sums l"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   298
  shows "f sums (l + f 0)"
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   299
proof  -
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   300
  have "(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0"
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   301
    using assms by (auto intro!: tendsto_add simp: sums_def)
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   302
  moreover have "(\<Sum>i<n. f (Suc i)) + f 0 = (\<Sum>i<Suc n. f i)" for n
63365
5340fb6633d0 more theorems
haftmann
parents: 63145
diff changeset
   303
    unfolding lessThan_Suc_eq_insert_0
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   304
    by (simp add: ac_simps sum_atLeast1_atMost_eq image_Suc_lessThan)
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   305
  ultimately show ?thesis
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   306
    by (auto simp: sums_def simp del: sum_lessThan_Suc intro: LIMSEQ_Suc_iff[THEN iffD1])
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   307
qed
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   308
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   309
lemma sums_add: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n + g n) sums (a + b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   310
  unfolding sums_def by (simp add: sum.distrib tendsto_add)
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   311
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   312
lemma summable_add: "summable f \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. f n + g n)"
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   313
  unfolding summable_def by (auto intro: sums_add)
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   314
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   315
lemma suminf_add: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f + suminf g = (\<Sum>n. f n + g n)"
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   316
  by (intro sums_unique sums_add summable_sums)
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   317
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   318
end
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   319
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   320
context
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   321
  fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::{t2_space,topological_comm_monoid_add}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   322
    and I :: "'i set"
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   323
begin
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   324
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   325
lemma sums_sum: "(\<And>i. i \<in> I \<Longrightarrow> (f i) sums (x i)) \<Longrightarrow> (\<lambda>n. \<Sum>i\<in>I. f i n) sums (\<Sum>i\<in>I. x i)"
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   326
  by (induct I rule: infinite_finite_induct) (auto intro!: sums_add)
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   327
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   328
lemma suminf_sum: "(\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> (\<Sum>n. \<Sum>i\<in>I. f i n) = (\<Sum>i\<in>I. \<Sum>n. f i n)"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   329
  using sums_unique[OF sums_sum, OF summable_sums] by simp
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   330
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   331
lemma summable_sum: "(\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   332
  using sums_summable[OF sums_sum[OF summable_sums]] .
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   333
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   334
end
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   335
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   336
subsection \<open>Infinite summability on real normed vector spaces\<close>
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   337
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   338
context
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   339
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   340
begin
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   341
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   342
lemma sums_Suc_iff: "(\<lambda>n. f (Suc n)) sums s \<longleftrightarrow> f sums (s + f 0)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   343
proof -
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   344
  have "f sums (s + f 0) \<longleftrightarrow> (\<lambda>i. \<Sum>j<Suc i. f j) \<longlonglongrightarrow> s + f 0"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   345
    by (subst LIMSEQ_Suc_iff) (simp add: sums_def)
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   346
  also have "\<dots> \<longleftrightarrow> (\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) \<longlonglongrightarrow> s + f 0"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   347
    by (simp add: ac_simps lessThan_Suc_eq_insert_0 image_Suc_lessThan sum_atLeast1_atMost_eq)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   348
  also have "\<dots> \<longleftrightarrow> (\<lambda>n. f (Suc n)) sums s"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   349
  proof
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   350
    assume "(\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) \<longlonglongrightarrow> s + f 0"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   351
    with tendsto_add[OF this tendsto_const, of "- f 0"] show "(\<lambda>i. f (Suc i)) sums s"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   352
      by (simp add: sums_def)
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57418
diff changeset
   353
  qed (auto intro: tendsto_add simp: sums_def)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   354
  finally show ?thesis ..
50999
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   355
qed
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   356
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   357
lemma summable_Suc_iff: "summable (\<lambda>n. f (Suc n)) = summable f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   358
proof
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   359
  assume "summable f"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   360
  then have "f sums suminf f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   361
    by (rule summable_sums)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   362
  then have "(\<lambda>n. f (Suc n)) sums (suminf f - f 0)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   363
    by (simp add: sums_Suc_iff)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   364
  then show "summable (\<lambda>n. f (Suc n))"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   365
    unfolding summable_def by blast
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   366
qed (auto simp: sums_Suc_iff summable_def)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   367
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   368
lemma sums_Suc_imp: "f 0 = 0 \<Longrightarrow> (\<lambda>n. f (Suc n)) sums s \<Longrightarrow> (\<lambda>n. f n) sums s"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   369
  using sums_Suc_iff by simp
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   370
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   371
end
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   372
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   373
context (* Separate contexts are necessary to allow general use of the results above, here. *)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   374
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   375
begin
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   376
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   377
lemma sums_diff: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n - g n) sums (a - b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   378
  unfolding sums_def by (simp add: sum_subtractf tendsto_diff)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   379
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   380
lemma summable_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. f n - g n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   381
  unfolding summable_def by (auto intro: sums_diff)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   382
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   383
lemma suminf_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f - suminf g = (\<Sum>n. f n - g n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   384
  by (intro sums_unique sums_diff summable_sums)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   385
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   386
lemma sums_minus: "f sums a \<Longrightarrow> (\<lambda>n. - f n) sums (- a)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   387
  unfolding sums_def by (simp add: sum_negf tendsto_minus)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   388
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   389
lemma summable_minus: "summable f \<Longrightarrow> summable (\<lambda>n. - f n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   390
  unfolding summable_def by (auto intro: sums_minus)
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   391
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   392
lemma suminf_minus: "summable f \<Longrightarrow> (\<Sum>n. - f n) = - (\<Sum>n. f n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   393
  by (intro sums_unique [symmetric] sums_minus summable_sums)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   394
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   395
lemma sums_iff_shift: "(\<lambda>i. f (i + n)) sums s \<longleftrightarrow> f sums (s + (\<Sum>i<n. f i))"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   396
proof (induct n arbitrary: s)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   397
  case 0
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   398
  then show ?case by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   399
next
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   400
  case (Suc n)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   401
  then have "(\<lambda>i. f (Suc i + n)) sums s \<longleftrightarrow> (\<lambda>i. f (i + n)) sums (s + f n)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   402
    by (subst sums_Suc_iff) simp
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   403
  with Suc show ?case
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   404
    by (simp add: ac_simps)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   405
qed
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   406
62379
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   407
corollary sums_iff_shift': "(\<lambda>i. f (i + n)) sums (s - (\<Sum>i<n. f i)) \<longleftrightarrow> f sums s"
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   408
  by (simp add: sums_iff_shift)
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   409
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   410
lemma sums_zero_iff_shift:
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   411
  assumes "\<And>i. i < n \<Longrightarrow> f i = 0"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   412
  shows "(\<lambda>i. f (i+n)) sums s \<longleftrightarrow> (\<lambda>i. f i) sums s"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   413
  by (simp add: assms sums_iff_shift)
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62379
diff changeset
   414
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   415
lemma summable_iff_shift: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   416
  by (metis diff_add_cancel summable_def sums_iff_shift [abs_def])
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   417
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   418
lemma sums_split_initial_segment: "f sums s \<Longrightarrow> (\<lambda>i. f (i + n)) sums (s - (\<Sum>i<n. f i))"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   419
  by (simp add: sums_iff_shift)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   420
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   421
lemma summable_ignore_initial_segment: "summable f \<Longrightarrow> summable (\<lambda>n. f(n + k))"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   422
  by (simp add: summable_iff_shift)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   423
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   424
lemma suminf_minus_initial_segment: "summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n) - (\<Sum>i<k. f i)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   425
  by (rule sums_unique[symmetric]) (auto simp: sums_iff_shift)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   426
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   427
lemma suminf_split_initial_segment: "summable f \<Longrightarrow> suminf f = (\<Sum>n. f(n + k)) + (\<Sum>i<k. f i)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   428
  by (auto simp add: suminf_minus_initial_segment)
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   429
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   430
lemma suminf_split_head: "summable f \<Longrightarrow> (\<Sum>n. f (Suc n)) = suminf f - f 0"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   431
  using suminf_split_initial_segment[of 1] by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   432
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   433
lemma suminf_exist_split:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   434
  fixes r :: real
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   435
  assumes "0 < r" and "summable f"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   436
  shows "\<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   437
proof -
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   438
  from LIMSEQ_D[OF summable_LIMSEQ[OF \<open>summable f\<close>] \<open>0 < r\<close>]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   439
  obtain N :: nat where "\<forall> n \<ge> N. norm (sum f {..<n} - suminf f) < r"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   440
    by auto
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   441
  then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   442
    by (auto simp: norm_minus_commute suminf_minus_initial_segment[OF \<open>summable f\<close>])
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   443
qed
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   444
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   445
lemma summable_LIMSEQ_zero: "summable f \<Longrightarrow> f \<longlonglongrightarrow> 0"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   446
  apply (drule summable_iff_convergent [THEN iffD1])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   447
  apply (drule convergent_Cauchy)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   448
  apply (simp only: Cauchy_iff LIMSEQ_iff)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   449
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   450
  apply (drule_tac x="r" in spec)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   451
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   452
  apply (rule_tac x="M" in exI)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   453
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   454
  apply (drule_tac x="Suc n" in spec)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   455
  apply simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   456
  apply (drule_tac x="n" in spec)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   457
  apply simp
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   458
  done
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   459
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   460
lemma summable_imp_convergent: "summable f \<Longrightarrow> convergent f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   461
  by (force dest!: summable_LIMSEQ_zero simp: convergent_def)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   462
62368
106569399cd6 add type class for topological monoids
hoelzl
parents: 62217
diff changeset
   463
lemma summable_imp_Bseq: "summable f \<Longrightarrow> Bseq f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   464
  by (simp add: convergent_imp_Bseq summable_imp_convergent)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   465
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   466
end
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   467
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   468
lemma summable_minus_iff: "summable (\<lambda>n. - f n) \<longleftrightarrow> summable f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   469
  for f :: "nat \<Rightarrow> 'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   470
  by (auto dest: summable_minus)  (* used two ways, hence must be outside the context above *)
59613
7103019278f0 The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents: 59025
diff changeset
   471
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   472
lemma (in bounded_linear) sums: "(\<lambda>n. X n) sums a \<Longrightarrow> (\<lambda>n. f (X n)) sums (f a)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   473
  unfolding sums_def by (drule tendsto) (simp only: sum)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   474
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   475
lemma (in bounded_linear) summable: "summable (\<lambda>n. X n) \<Longrightarrow> summable (\<lambda>n. f (X n))"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   476
  unfolding summable_def by (auto intro: sums)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   477
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   478
lemma (in bounded_linear) suminf: "summable (\<lambda>n. X n) \<Longrightarrow> f (\<Sum>n. X n) = (\<Sum>n. f (X n))"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   479
  by (intro sums_unique sums summable_sums)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   480
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   481
lemmas sums_of_real = bounded_linear.sums [OF bounded_linear_of_real]
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   482
lemmas summable_of_real = bounded_linear.summable [OF bounded_linear_of_real]
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   483
lemmas suminf_of_real = bounded_linear.suminf [OF bounded_linear_of_real]
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   484
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   485
lemmas sums_scaleR_left = bounded_linear.sums[OF bounded_linear_scaleR_left]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   486
lemmas summable_scaleR_left = bounded_linear.summable[OF bounded_linear_scaleR_left]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   487
lemmas suminf_scaleR_left = bounded_linear.suminf[OF bounded_linear_scaleR_left]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   488
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   489
lemmas sums_scaleR_right = bounded_linear.sums[OF bounded_linear_scaleR_right]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   490
lemmas summable_scaleR_right = bounded_linear.summable[OF bounded_linear_scaleR_right]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   491
lemmas suminf_scaleR_right = bounded_linear.suminf[OF bounded_linear_scaleR_right]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57129
diff changeset
   492
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   493
lemma summable_const_iff: "summable (\<lambda>_. c) \<longleftrightarrow> c = 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   494
  for c :: "'a::real_normed_vector"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   495
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   496
  have "\<not> summable (\<lambda>_. c)" if "c \<noteq> 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   497
  proof -
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   498
    from that have "filterlim (\<lambda>n. of_nat n * norm c) at_top sequentially"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   499
      by (subst mult.commute)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   500
        (auto intro!: filterlim_tendsto_pos_mult_at_top filterlim_real_sequentially)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   501
    then have "\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   502
      by (intro filterlim_at_infinity_imp_not_convergent filterlim_at_top_imp_at_infinity)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   503
        (simp_all add: sum_constant_scaleR)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   504
    then show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   505
      unfolding summable_iff_convergent using convergent_norm by blast
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   506
  qed
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   507
  then show ?thesis by auto
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   508
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   509
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   510
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   511
subsection \<open>Infinite summability on real normed algebras\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   512
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   513
context
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   514
  fixes f :: "nat \<Rightarrow> 'a::real_normed_algebra"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   515
begin
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   516
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   517
lemma sums_mult: "f sums a \<Longrightarrow> (\<lambda>n. c * f n) sums (c * a)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   518
  by (rule bounded_linear.sums [OF bounded_linear_mult_right])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   519
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   520
lemma summable_mult: "summable f \<Longrightarrow> summable (\<lambda>n. c * f n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   521
  by (rule bounded_linear.summable [OF bounded_linear_mult_right])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   522
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   523
lemma suminf_mult: "summable f \<Longrightarrow> suminf (\<lambda>n. c * f n) = c * suminf f"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   524
  by (rule bounded_linear.suminf [OF bounded_linear_mult_right, symmetric])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   525
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   526
lemma sums_mult2: "f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   527
  by (rule bounded_linear.sums [OF bounded_linear_mult_left])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   528
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   529
lemma summable_mult2: "summable f \<Longrightarrow> summable (\<lambda>n. f n * c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   530
  by (rule bounded_linear.summable [OF bounded_linear_mult_left])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   531
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   532
lemma suminf_mult2: "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   533
  by (rule bounded_linear.suminf [OF bounded_linear_mult_left])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   534
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   535
end
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   536
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   537
lemma sums_mult_iff:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   538
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_algebra,field}"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   539
  assumes "c \<noteq> 0"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   540
  shows "(\<lambda>n. c * f n) sums (c * d) \<longleftrightarrow> f sums d"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   541
  using sums_mult[of f d c] sums_mult[of "\<lambda>n. c * f n" "c * d" "inverse c"]
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   542
  by (force simp: field_simps assms)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   543
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   544
lemma sums_mult2_iff:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   545
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_algebra,field}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   546
  assumes "c \<noteq> 0"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   547
  shows   "(\<lambda>n. f n * c) sums (d * c) \<longleftrightarrow> f sums d"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   548
  using sums_mult_iff[OF assms, of f d] by (simp add: mult.commute)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   549
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   550
lemma sums_of_real_iff:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   551
  "(\<lambda>n. of_real (f n) :: 'a::real_normed_div_algebra) sums of_real c \<longleftrightarrow> f sums c"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   552
  by (simp add: sums_def of_real_sum[symmetric] tendsto_of_real_iff del: of_real_sum)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   553
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   554
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   555
subsection \<open>Infinite summability on real normed fields\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   556
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   557
context
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   558
  fixes c :: "'a::real_normed_field"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   559
begin
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   560
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   561
lemma sums_divide: "f sums a \<Longrightarrow> (\<lambda>n. f n / c) sums (a / c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   562
  by (rule bounded_linear.sums [OF bounded_linear_divide])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   563
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   564
lemma summable_divide: "summable f \<Longrightarrow> summable (\<lambda>n. f n / c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   565
  by (rule bounded_linear.summable [OF bounded_linear_divide])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   566
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   567
lemma suminf_divide: "summable f \<Longrightarrow> suminf (\<lambda>n. f n / c) = suminf f / c"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   568
  by (rule bounded_linear.suminf [OF bounded_linear_divide, symmetric])
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   569
67268
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   570
lemma summable_inverse_divide: "summable (inverse \<circ> f) \<Longrightarrow> summable (\<lambda>n. c / f n)"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   571
  by (auto dest: summable_mult [of _ c] simp: field_simps)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   572
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   573
lemma sums_mult_D: "(\<lambda>n. c * f n) sums a \<Longrightarrow> c \<noteq> 0 \<Longrightarrow> f sums (a/c)"
62379
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   574
  using sums_mult_iff by fastforce
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   575
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   576
lemma summable_mult_D: "summable (\<lambda>n. c * f n) \<Longrightarrow> c \<noteq> 0 \<Longrightarrow> summable f"
62379
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   577
  by (auto dest: summable_divide)
340738057c8c An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents: 62377
diff changeset
   578
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   579
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   580
text \<open>Sum of a geometric progression.\<close>
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   581
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   582
lemma geometric_sums:
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   583
  assumes less_1: "norm c < 1"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   584
  shows "(\<lambda>n. c^n) sums (1 / (1 - c))"
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   585
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   586
  from less_1 have neq_1: "c \<noteq> 1" by auto
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   587
  then have neq_0: "c - 1 \<noteq> 0" by simp
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   588
  from less_1 have lim_0: "(\<lambda>n. c^n) \<longlonglongrightarrow> 0"
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   589
    by (rule LIMSEQ_power_zero)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   590
  then have "(\<lambda>n. c ^ n / (c - 1) - 1 / (c - 1)) \<longlonglongrightarrow> 0 / (c - 1) - 1 / (c - 1)"
44568
e6f291cb5810 discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents: 44289
diff changeset
   591
    using neq_0 by (intro tendsto_intros)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   592
  then have "(\<lambda>n. (c ^ n - 1) / (c - 1)) \<longlonglongrightarrow> 1 / (1 - c)"
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   593
    by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   594
  then show "(\<lambda>n. c ^ n) sums (1 / (1 - c))"
20692
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   595
    by (simp add: sums_def geometric_sum neq_1)
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   596
qed
6df83a636e67 generalized types of sums, summable, and suminf
huffman
parents: 20689
diff changeset
   597
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   598
lemma summable_geometric: "norm c < 1 \<Longrightarrow> summable (\<lambda>n. c^n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   599
  by (rule geometric_sums [THEN sums_summable])
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   600
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   601
lemma suminf_geometric: "norm c < 1 \<Longrightarrow> suminf (\<lambda>n. c^n) = 1 / (1 - c)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   602
  by (rule sums_unique[symmetric]) (rule geometric_sums)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   603
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   604
lemma summable_geometric_iff: "summable (\<lambda>n. c ^ n) \<longleftrightarrow> norm c < 1"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   605
proof
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   606
  assume "summable (\<lambda>n. c ^ n :: 'a :: real_normed_field)"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   607
  then have "(\<lambda>n. norm c ^ n) \<longlonglongrightarrow> 0"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   608
    by (simp add: norm_power [symmetric] tendsto_norm_zero_iff summable_LIMSEQ_zero)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   609
  from order_tendstoD(2)[OF this zero_less_one] obtain n where "norm c ^ n < 1"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   610
    by (auto simp: eventually_at_top_linorder)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   611
  then show "norm c < 1" using one_le_power[of "norm c" n]
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   612
    by (cases "norm c \<ge> 1") (linarith, simp)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   613
qed (rule summable_geometric)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   614
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   615
end
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   616
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   617
lemma power_half_series: "(\<lambda>n. (1/2::real)^Suc n) sums 1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   618
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   619
  have 2: "(\<lambda>n. (1/2::real)^n) sums 2"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   620
    using geometric_sums [of "1/2::real"] by auto
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   621
  have "(\<lambda>n. (1/2::real)^Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)"
59741
5b762cd73a8e Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents: 59712
diff changeset
   622
    by (simp add: mult.commute)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   623
  then show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   624
    using sums_divide [OF 2, of 2] by simp
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   625
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 32877
diff changeset
   626
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   627
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   628
subsection \<open>Telescoping\<close>
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   629
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   630
lemma telescope_sums:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   631
  fixes c :: "'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   632
  assumes "f \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   633
  shows "(\<lambda>n. f (Suc n) - f n) sums (c - f 0)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   634
  unfolding sums_def
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   635
proof (subst LIMSEQ_Suc_iff [symmetric])
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   636
  have "(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) = (\<lambda>n. f (Suc n) - f 0)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   637
    by (simp add: lessThan_Suc_atMost atLeast0AtMost [symmetric] sum_Suc_diff)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   638
  also have "\<dots> \<longlonglongrightarrow> c - f 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   639
    by (intro tendsto_diff LIMSEQ_Suc[OF assms] tendsto_const)
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   640
  finally show "(\<lambda>n. \<Sum>n<Suc n. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0" .
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   641
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   642
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   643
lemma telescope_sums':
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   644
  fixes c :: "'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   645
  assumes "f \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   646
  shows "(\<lambda>n. f n - f (Suc n)) sums (f 0 - c)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   647
  using sums_minus[OF telescope_sums[OF assms]] by (simp add: algebra_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   648
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   649
lemma telescope_summable:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   650
  fixes c :: "'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   651
  assumes "f \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   652
  shows "summable (\<lambda>n. f (Suc n) - f n)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   653
  using telescope_sums[OF assms] by (simp add: sums_iff)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   654
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   655
lemma telescope_summable':
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   656
  fixes c :: "'a::real_normed_vector"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   657
  assumes "f \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   658
  shows "summable (\<lambda>n. f n - f (Suc n))"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   659
  using summable_minus[OF telescope_summable[OF assms]] by (simp add: algebra_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   660
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   661
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   662
subsection \<open>Infinite summability on Banach spaces\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   663
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   664
text \<open>Cauchy-type criterion for convergence of series (c.f. Harrison).\<close>
15085
5693a977a767 removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents: 15053
diff changeset
   665
67268
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   666
lemma summable_Cauchy: "summable f \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. norm (sum f {m..<n}) < e)" (is "_ = ?rhs")
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   667
  for f :: "nat \<Rightarrow> 'a::banach"
67268
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   668
proof
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   669
  assume f: "summable f"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   670
  show ?rhs
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   671
  proof clarify
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   672
    fix e :: real
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   673
    assume "0 < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   674
    then obtain M where M: "\<And>m n. \<lbrakk>m\<ge>M; n\<ge>M\<rbrakk> \<Longrightarrow> norm (sum f {..<m} - sum f {..<n}) < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   675
      using f by (force simp add: summable_iff_convergent Cauchy_convergent_iff [symmetric] Cauchy_iff)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   676
    have "norm (sum f {m..<n}) < e" if "m \<ge> M" for m n
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   677
    proof (cases m n rule: linorder_class.le_cases)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   678
      assume "m \<le> n"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   679
      then show ?thesis
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   680
        by (metis (mono_tags, hide_lams) M atLeast0LessThan order_trans sum_diff_nat_ivl that zero_le)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   681
    next
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   682
      assume "n \<le> m"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   683
      then show ?thesis
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   684
        by (simp add: \<open>0 < e\<close>)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   685
    qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   686
    then show "\<exists>N. \<forall>m\<ge>N. \<forall>n. norm (sum f {m..<n}) < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   687
      by blast
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   688
  qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   689
next
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   690
  assume r: ?rhs
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   691
  then show "summable f"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   692
    unfolding summable_iff_convergent Cauchy_convergent_iff [symmetric] Cauchy_iff
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   693
  proof clarify
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   694
    fix e :: real
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   695
    assume "0 < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   696
    with r obtain N where N: "\<And>m n. m \<ge> N \<Longrightarrow> norm (sum f {m..<n}) < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   697
      by blast
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   698
    have "norm (sum f {..<m} - sum f {..<n}) < e" if "m\<ge>N" "n\<ge>N" for m n
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   699
    proof (cases m n rule: linorder_class.le_cases)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   700
      assume "m \<le> n"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   701
      then show ?thesis
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   702
        by (metis Groups_Big.sum_diff N finite_lessThan lessThan_minus_lessThan lessThan_subset_iff norm_minus_commute \<open>m\<ge>N\<close>)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   703
    next
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   704
      assume "n \<le> m"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   705
      then show ?thesis
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   706
        by (metis Groups_Big.sum_diff N finite_lessThan lessThan_minus_lessThan lessThan_subset_iff \<open>n\<ge>N\<close>)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   707
    qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   708
    then show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (sum f {..<m} - sum f {..<n}) < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   709
      by blast
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   710
  qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   711
qed
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   712
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   713
context
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   714
  fixes f :: "nat \<Rightarrow> 'a::banach"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   715
begin
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   716
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   717
text \<open>Absolute convergence imples normal convergence.\<close>
20689
4950e45442b8 add proof of summable_LIMSEQ_zero
huffman
parents: 20688
diff changeset
   718
56194
9ffbb4004c81 fix HOL-NSA; move lemmas
hoelzl
parents: 56193
diff changeset
   719
lemma summable_norm_cancel: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   720
  apply (simp only: summable_Cauchy)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   721
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   722
  apply (drule_tac x="e" in spec)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   723
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   724
  apply (rule_tac x="N" in exI)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   725
  apply safe
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   726
  apply (drule_tac x="m" in spec)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   727
  apply safe
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   728
  apply (rule order_le_less_trans [OF norm_sum])
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   729
  apply (rule order_le_less_trans [OF abs_ge_self])
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   730
  apply simp
50999
3de230ed0547 introduce order topology
hoelzl
parents: 50331
diff changeset
   731
  done
32707
836ec9d0a0c8 New lemmas involving the real numbers, especially limits and series
paulson
parents: 31336
diff changeset
   732
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   733
lemma summable_norm: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   734
  by (auto intro: LIMSEQ_le tendsto_norm summable_norm_cancel summable_LIMSEQ norm_sum)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   735
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   736
text \<open>Comparison tests.\<close>
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   737
67268
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   738
lemma summable_comparison_test: 
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   739
  assumes fg: "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n" and g: "summable g"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   740
  shows "summable f"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   741
proof -
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   742
  obtain N where N: "\<And>n. n\<ge>N \<Longrightarrow> norm (f n) \<le> g n" 
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   743
    using assms by blast
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   744
  show ?thesis
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   745
  proof (clarsimp simp add: summable_Cauchy)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   746
    fix e :: real
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   747
    assume "0 < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   748
    then obtain Ng where Ng: "\<And>m n. m \<ge> Ng \<Longrightarrow> norm (sum g {m..<n}) < e" 
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   749
      using g by (fastforce simp: summable_Cauchy)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   750
    with N have "norm (sum f {m..<n}) < e" if "m\<ge>max N Ng" for m n
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   751
    proof -
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   752
      have "norm (sum f {m..<n}) \<le> sum g {m..<n}"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   753
        using N that by (force intro: sum_norm_le)
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   754
      also have "... \<le> norm (sum g {m..<n})"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   755
        by simp
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   756
      also have "... < e"
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   757
        using Ng that by auto
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   758
      finally show ?thesis .
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   759
    qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   760
    then show "\<exists>N. \<forall>m\<ge>N. \<forall>n. norm (sum f {m..<n}) < e" 
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   761
      by blast
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   762
  qed
bdf25939a550 new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
paulson <lp15@cam.ac.uk>
parents: 67167
diff changeset
   763
qed
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   764
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   765
lemma summable_comparison_test_ev:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   766
  "eventually (\<lambda>n. norm (f n) \<le> g n) sequentially \<Longrightarrow> summable g \<Longrightarrow> summable f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   767
  by (rule summable_comparison_test) (auto simp: eventually_at_top_linorder)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   768
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   769
text \<open>A better argument order.\<close>
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   770
lemma summable_comparison_test': "summable g \<Longrightarrow> (\<And>n. n \<ge> N \<Longrightarrow> norm (f n) \<le> g n) \<Longrightarrow> summable f"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   771
  by (rule summable_comparison_test) auto
56217
dc429a5b13c4 Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents: 56213
diff changeset
   772
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   773
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   774
subsection \<open>The Ratio Test\<close>
15085
5693a977a767 removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents: 15053
diff changeset
   775
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   776
lemma summable_ratio_test:
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   777
  assumes "c < 1" "\<And>n. n \<ge> N \<Longrightarrow> norm (f (Suc n)) \<le> c * norm (f n)"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   778
  shows "summable f"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   779
proof (cases "0 < c")
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   780
  case True
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   781
  show "summable f"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   782
  proof (rule summable_comparison_test)
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   783
    show "\<exists>N'. \<forall>n\<ge>N'. norm (f n) \<le> (norm (f N) / (c ^ N)) * c ^ n"
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   784
    proof (intro exI allI impI)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   785
      fix n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   786
      assume "N \<le> n"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   787
      then show "norm (f n) \<le> (norm (f N) / (c ^ N)) * c ^ n"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   788
      proof (induct rule: inc_induct)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   789
        case base
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   790
        with True show ?case by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   791
      next
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   792
        case (step m)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   793
        have "norm (f (Suc m)) / c ^ Suc m * c ^ n \<le> norm (f m) / c ^ m * c ^ n"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   794
          using \<open>0 < c\<close> \<open>c < 1\<close> assms(2)[OF \<open>N \<le> m\<close>] by (simp add: field_simps)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   795
        with step show ?case by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   796
      qed
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   797
    qed
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   798
    show "summable (\<lambda>n. norm (f N) / c ^ N * c ^ n)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   799
      using \<open>0 < c\<close> \<open>c < 1\<close> by (intro summable_mult summable_geometric) simp
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   800
  qed
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   801
next
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   802
  case False
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   803
  have "f (Suc n) = 0" if "n \<ge> N" for n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   804
  proof -
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   805
    from that have "norm (f (Suc n)) \<le> c * norm (f n)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   806
      by (rule assms(2))
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   807
    also have "\<dots> \<le> 0"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   808
      using False by (simp add: not_less mult_nonpos_nonneg)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   809
    finally show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   810
      by auto
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   811
  qed
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   812
  then show "summable f"
56194
9ffbb4004c81 fix HOL-NSA; move lemmas
hoelzl
parents: 56193
diff changeset
   813
    by (intro sums_summable[OF sums_finite, of "{.. Suc N}"]) (auto simp: not_le Suc_less_eq2)
56178
2a6f58938573 a few new theorems
paulson <lp15@cam.ac.uk>
parents: 54703
diff changeset
   814
qed
2a6f58938573 a few new theorems
paulson <lp15@cam.ac.uk>
parents: 54703
diff changeset
   815
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   816
end
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
   817
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   818
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   819
text \<open>Relations among convergence and absolute convergence for power series.\<close>
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   820
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
   821
lemma Abel_lemma:
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   822
  fixes a :: "nat \<Rightarrow> 'a::real_normed_vector"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   823
  assumes r: "0 \<le> r"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   824
    and r0: "r < r0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   825
    and M: "\<And>n. norm (a n) * r0^n \<le> M"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   826
  shows "summable (\<lambda>n. norm (a n) * r^n)"
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   827
proof (rule summable_comparison_test')
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   828
  show "summable (\<lambda>n. M * (r / r0) ^ n)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   829
    using assms
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   830
    by (auto simp add: summable_mult summable_geometric)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   831
  show "norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n" for n
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   832
    using r r0 M [of n]
60867
86e7560e07d0 slight cleanup of lemmas
haftmann
parents: 60758
diff changeset
   833
    apply (auto simp add: abs_mult field_simps)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   834
    apply (cases "r = 0")
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   835
     apply simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   836
     apply (cases n)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   837
      apply auto
56369
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   838
    done
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   839
qed
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   840
2704ca85be98 moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents: 56217
diff changeset
   841
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   842
text \<open>Summability of geometric series for real algebras.\<close>
23084
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   843
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   844
lemma complete_algebra_summable_geometric:
31017
2c227493ea56 stripped class recpower further
haftmann
parents: 30649
diff changeset
   845
  fixes x :: "'a::{real_normed_algebra_1,banach}"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   846
  assumes "norm x < 1"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   847
  shows "summable (\<lambda>n. x ^ n)"
23084
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   848
proof (rule summable_comparison_test)
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   849
  show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n"
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   850
    by (simp add: norm_power_ineq)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   851
  from assms show "summable (\<lambda>n. norm x ^ n)"
23084
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   852
    by (simp add: summable_geometric)
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   853
qed
bc000fc64fce add lemma complete_algebra_summable_geometric
huffman
parents: 22998
diff changeset
   854
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   855
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   856
subsection \<open>Cauchy Product Formula\<close>
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   857
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   858
text \<open>
54703
499f92dc6e45 more antiquotations;
wenzelm
parents: 54230
diff changeset
   859
  Proof based on Analysis WebNotes: Chapter 07, Class 41
63680
6e1e8b5abbfa more symbols;
wenzelm
parents: 63550
diff changeset
   860
  \<^url>\<open>http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm\<close>
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   861
\<close>
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   862
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   863
lemma Cauchy_product_sums:
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   864
  fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   865
  assumes a: "summable (\<lambda>k. norm (a k))"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   866
    and b: "summable (\<lambda>k. norm (b k))"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   867
  shows "(\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   868
proof -
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   869
  let ?S1 = "\<lambda>n::nat. {..<n} \<times> {..<n}"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   870
  let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}"
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   871
  have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   872
  have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   873
  have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   874
  have finite_S1: "\<And>n. finite (?S1 n)" by simp
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   875
  with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset)
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   876
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   877
  let ?g = "\<lambda>(i,j). a i * b j"
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   878
  let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   879
  have f_nonneg: "\<And>x. 0 \<le> ?f x" by auto
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   880
  then have norm_sum_f: "\<And>A. norm (sum ?f A) = sum ?f A"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   881
    unfolding real_norm_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   882
    by (simp only: abs_of_nonneg sum_nonneg [rule_format])
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   883
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   884
  have "(\<lambda>n. (\<Sum>k<n. a k) * (\<Sum>k<n. b k)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   885
    by (intro tendsto_mult summable_LIMSEQ summable_norm_cancel [OF a] summable_norm_cancel [OF b])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   886
  then have 1: "(\<lambda>n. sum ?g (?S1 n)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   887
    by (simp only: sum_product sum.Sigma [rule_format] finite_lessThan)
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   888
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
   889
  have "(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56178
diff changeset
   890
    using a b by (intro tendsto_mult summable_LIMSEQ)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   891
  then have "(\<lambda>n. sum ?f (?S1 n)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   892
    by (simp only: sum_product sum.Sigma [rule_format] finite_lessThan)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   893
  then have "convergent (\<lambda>n. sum ?f (?S1 n))"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   894
    by (rule convergentI)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   895
  then have Cauchy: "Cauchy (\<lambda>n. sum ?f (?S1 n))"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   896
    by (rule convergent_Cauchy)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   897
  have "Zfun (\<lambda>n. sum ?f (?S1 n - ?S2 n)) sequentially"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   898
  proof (rule ZfunI, simp only: eventually_sequentially norm_sum_f)
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   899
    fix r :: real
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   900
    assume r: "0 < r"
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   901
    from CauchyD [OF Cauchy r] obtain N
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   902
      where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (sum ?f (?S1 m) - sum ?f (?S1 n)) < r" ..
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   903
    then have "\<And>m n. N \<le> n \<Longrightarrow> n \<le> m \<Longrightarrow> norm (sum ?f (?S1 m - ?S1 n)) < r"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   904
      by (simp only: sum_diff finite_S1 S1_mono)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   905
    then have N: "\<And>m n. N \<le> n \<Longrightarrow> n \<le> m \<Longrightarrow> sum ?f (?S1 m - ?S1 n) < r"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   906
      by (simp only: norm_sum_f)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   907
    show "\<exists>N. \<forall>n\<ge>N. sum ?f (?S1 n - ?S2 n) < r"
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   908
    proof (intro exI allI impI)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   909
      fix n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   910
      assume "2 * N \<le> n"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   911
      then have n: "N \<le> n div 2" by simp
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   912
      have "sum ?f (?S1 n - ?S2 n) \<le> sum ?f (?S1 n - ?S1 (n div 2))"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   913
        by (intro sum_mono2 finite_Diff finite_S1 f_nonneg Diff_mono subset_refl S1_le_S2)
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   914
      also have "\<dots> < r"
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   915
        using n div_le_dividend by (rule N)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   916
      finally show "sum ?f (?S1 n - ?S2 n) < r" .
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   917
    qed
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   918
  qed
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   919
  then have "Zfun (\<lambda>n. sum ?g (?S1 n - ?S2 n)) sequentially"
36657
f376af79f6b7 remove unneeded constant Zseq
huffman
parents: 36409
diff changeset
   920
    apply (rule Zfun_le [rule_format])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   921
    apply (simp only: norm_sum_f)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   922
    apply (rule order_trans [OF norm_sum sum_mono])
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   923
    apply (auto simp add: norm_mult_ineq)
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   924
    done
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   925
  then have 2: "(\<lambda>n. sum ?g (?S1 n) - sum ?g (?S2 n)) \<longlonglongrightarrow> 0"
36660
1cc4ab4b7ff7 make (X ----> L) an abbreviation for (X ---> L) sequentially
huffman
parents: 36657
diff changeset
   926
    unfolding tendsto_Zfun_iff diff_0_right
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   927
    by (simp only: sum_diff finite_S1 S2_le_S1)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   928
  with 1 have "(\<lambda>n. sum ?g (?S2 n)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
60141
833adf7db7d8 New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents: 59741
diff changeset
   929
    by (rule Lim_transform2)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   930
  then show ?thesis
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
   931
    by (simp only: sums_def sum_triangle_reindex)
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   932
qed
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   933
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   934
lemma Cauchy_product:
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   935
  fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   936
  assumes "summable (\<lambda>k. norm (a k))"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   937
    and "summable (\<lambda>k. norm (b k))"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   938
  shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i\<le>k. a i * b (k - i))"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   939
  using assms by (rule Cauchy_product_sums [THEN sums_unique])
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   940
62049
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61969
diff changeset
   941
lemma summable_Cauchy_product:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   942
  fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   943
  assumes "summable (\<lambda>k. norm (a k))"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   944
    and "summable (\<lambda>k. norm (b k))"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   945
  shows "summable (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i))"
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 62049
diff changeset
   946
  using Cauchy_product_sums[OF assms] by (simp add: sums_iff)
62049
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61969
diff changeset
   947
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   948
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60141
diff changeset
   949
subsection \<open>Series on @{typ real}s\<close>
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   950
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   951
lemma summable_norm_comparison_test:
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   952
  "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. norm (f n))"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   953
  by (rule summable_comparison_test) auto
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   954
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   955
lemma summable_rabs_comparison_test: "\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   956
  for f :: "nat \<Rightarrow> real"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   957
  by (rule summable_comparison_test) auto
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   958
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   959
lemma summable_rabs_cancel: "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   960
  for f :: "nat \<Rightarrow> real"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   961
  by (rule summable_norm_cancel) simp
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   962
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   963
lemma summable_rabs: "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   964
  for f :: "nat \<Rightarrow> real"
56213
e5720d3c18f0 further renaming in Series
hoelzl
parents: 56194
diff changeset
   965
  by (fold real_norm_def) (rule summable_norm)
23111
f8583c2a491a new proof of Cauchy product formula for series
huffman
parents: 23084
diff changeset
   966
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   967
lemma summable_zero_power [simp]: "summable (\<lambda>n. 0 ^ n :: 'a::{comm_ring_1,topological_space})"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   968
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   969
  have "(\<lambda>n. 0 ^ n :: 'a) = (\<lambda>n. if n = 0 then 0^0 else 0)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   970
    by (intro ext) (simp add: zero_power)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   971
  moreover have "summable \<dots>" by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   972
  ultimately show ?thesis by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   973
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   974
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   975
lemma summable_zero_power' [simp]: "summable (\<lambda>n. f n * 0 ^ n :: 'a::{ring_1,topological_space})"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   976
proof -
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
   977
  have "(\<lambda>n. f n * 0 ^ n :: 'a) = (\<lambda>n. if n = 0 then f 0 * 0^0 else 0)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   978
    by (intro ext) (simp add: zero_power)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   979
  moreover have "summable \<dots>" by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   980
  ultimately show ?thesis by simp
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   981
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   982
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   983
lemma summable_power_series:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   984
  fixes z :: real
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   985
  assumes le_1: "\<And>i. f i \<le> 1"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   986
    and nonneg: "\<And>i. 0 \<le> f i"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   987
    and z: "0 \<le> z" "z < 1"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   988
  shows "summable (\<lambda>i. f i * z^i)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   989
proof (rule summable_comparison_test[OF _ summable_geometric])
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   990
  show "norm z < 1"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   991
    using z by (auto simp: less_imp_le)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   992
  show "\<And>n. \<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   993
    using z
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   994
    by (auto intro!: exI[of _ 0] mult_left_le_one_le simp: abs_mult nonneg power_abs less_imp_le le_1)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   995
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58889
diff changeset
   996
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
   997
lemma summable_0_powser: "summable (\<lambda>n. f n * 0 ^ n :: 'a::real_normed_div_algebra)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   998
proof -
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
   999
  have A: "(\<lambda>n. f n * 0 ^ n) = (\<lambda>n. if n = 0 then f n else 0)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1000
    by (intro ext) auto
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1001
  then show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1002
    by (subst A) simp_all
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1003
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1004
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1005
lemma summable_powser_split_head:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1006
  "summable (\<lambda>n. f (Suc n) * z ^ n :: 'a::real_normed_div_algebra) = summable (\<lambda>n. f n * z ^ n)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1007
proof -
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1008
  have "summable (\<lambda>n. f (Suc n) * z ^ n) \<longleftrightarrow> summable (\<lambda>n. f (Suc n) * z ^ Suc n)"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1009
    (is "?lhs \<longleftrightarrow> ?rhs")
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1010
  proof
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1011
    show ?rhs if ?lhs
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1012
      using summable_mult2[OF that, of z]
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1013
      by (simp add: power_commutes algebra_simps)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1014
    show ?lhs if ?rhs
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1015
      using summable_mult2[OF that, of "inverse z"]
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1016
      by (cases "z \<noteq> 0", subst (asm) power_Suc2) (simp_all add: algebra_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1017
  qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1018
  also have "\<dots> \<longleftrightarrow> summable (\<lambda>n. f n * z ^ n)" by (rule summable_Suc_iff)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1019
  finally show ?thesis .
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1020
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1021
66456
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1022
lemma summable_powser_ignore_initial_segment:
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1023
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1024
  shows "summable (\<lambda>n. f (n + m) * z ^ n) \<longleftrightarrow> summable (\<lambda>n. f n * z ^ n)"
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1025
proof (induction m)
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1026
  case (Suc m)
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1027
  have "summable (\<lambda>n. f (n + Suc m) * z ^ n) = summable (\<lambda>n. f (Suc n + m) * z ^ n)"
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1028
    by simp
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1029
  also have "\<dots> = summable (\<lambda>n. f (n + m) * z ^ n)"
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1030
    by (rule summable_powser_split_head)
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1031
  also have "\<dots> = summable (\<lambda>n. f n * z ^ n)"
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1032
    by (rule Suc.IH)
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1033
  finally show ?case .
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1034
qed simp_all
621897f47fab Various lemmas for HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 66447
diff changeset
  1035
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1036
lemma powser_split_head:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1037
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1038
  assumes "summable (\<lambda>n. f n * z ^ n)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1039
  shows "suminf (\<lambda>n. f n * z ^ n) = f 0 + suminf (\<lambda>n. f (Suc n) * z ^ n) * z"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1040
    and "suminf (\<lambda>n. f (Suc n) * z ^ n) * z = suminf (\<lambda>n. f n * z ^ n) - f 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1041
    and "summable (\<lambda>n. f (Suc n) * z ^ n)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1042
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1043
  from assms show "summable (\<lambda>n. f (Suc n) * z ^ n)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1044
    by (subst summable_powser_split_head)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1045
  from suminf_mult2[OF this, of z]
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1046
    have "(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ Suc n)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1047
    by (simp add: power_commutes algebra_simps)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1048
  also from assms have "\<dots> = suminf (\<lambda>n. f n * z ^ n) - f 0"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1049
    by (subst suminf_split_head) simp_all
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1050
  finally show "suminf (\<lambda>n. f n * z ^ n) = f 0 + suminf (\<lambda>n. f (Suc n) * z ^ n) * z"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1051
    by simp
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1052
  then show "suminf (\<lambda>n. f (Suc n) * z ^ n) * z = suminf (\<lambda>n. f n * z ^ n) - f 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1053
    by simp
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1054
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1055
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1056
lemma summable_partial_sum_bound:
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1057
  fixes f :: "nat \<Rightarrow> 'a :: banach"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1058
    and e :: real
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1059
  assumes summable: "summable f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1060
    and e: "e > 0"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1061
  obtains N where "\<And>m n. m \<ge> N \<Longrightarrow> norm (\<Sum>k=m..n. f k) < e"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1062
proof -
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1063
  from summable have "Cauchy (\<lambda>n. \<Sum>k<n. f k)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1064
    by (simp add: Cauchy_convergent_iff summable_iff_convergent)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1065
  from CauchyD [OF this e] obtain N
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1066
    where N: "\<And>m n. m \<ge> N \<Longrightarrow> n \<ge> N \<Longrightarrow> norm ((\<Sum>k<m. f k) - (\<Sum>k<n. f k)) < e"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1067
    by blast
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1068
  have "norm (\<Sum>k=m..n. f k) < e" if m: "m \<ge> N" for m n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1069
  proof (cases "n \<ge> m")
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1070
    case True
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1071
    with m have "norm ((\<Sum>k<Suc n. f k) - (\<Sum>k<m. f k)) < e"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1072
      by (intro N) simp_all
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1073
    also from True have "(\<Sum>k<Suc n. f k) - (\<Sum>k<m. f k) = (\<Sum>k=m..n. f k)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1074
      by (subst sum_diff [symmetric]) (simp_all add: sum_last_plus)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1075
    finally show ?thesis .
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1076
  next
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1077
    case False
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1078
    with e show ?thesis by simp_all
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1079
  qed
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1080
  then show ?thesis by (rule that)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1081
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1082
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1083
lemma powser_sums_if:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1084
  "(\<lambda>n. (if n = m then (1 :: 'a::{ring_1,topological_space}) else 0) * z^n) sums z^m"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1085
proof -
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1086
  have "(\<lambda>n. (if n = m then 1 else 0) * z^n) = (\<lambda>n. if n = m then z^n else 0)"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1087
    by (intro ext) auto
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1088
  then show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1089
    by (simp add: sums_single)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1090
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1091
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1092
lemma
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1093
  fixes f :: "nat \<Rightarrow> real"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1094
  assumes "summable f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1095
    and "inj g"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1096
    and pos: "\<And>x. 0 \<le> f x"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1097
  shows summable_reindex: "summable (f \<circ> g)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1098
    and suminf_reindex_mono: "suminf (f \<circ> g) \<le> suminf f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1099
    and suminf_reindex: "(\<And>x. x \<notin> range g \<Longrightarrow> f x = 0) \<Longrightarrow> suminf (f \<circ> g) = suminf f"
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1100
proof -
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1101
  from \<open>inj g\<close> have [simp]: "\<And>A. inj_on g A"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1102
    by (rule subset_inj_on) simp
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1103
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1104
  have smaller: "\<forall>n. (\<Sum>i<n. (f \<circ> g) i) \<le> suminf f"
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1105
  proof
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1106
    fix n
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1107
    have "\<forall> n' \<in> (g ` {..<n}). n' < Suc (Max (g ` {..<n}))"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1108
      by (metis Max_ge finite_imageI finite_lessThan not_le not_less_eq)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1109
    then obtain m where n: "\<And>n'. n' < n \<Longrightarrow> g n' < m"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1110
      by blast
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1111
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1112
    have "(\<Sum>i<n. f (g i)) = sum f (g ` {..<n})"
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1113
      by (simp add: sum.reindex)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1114
    also have "\<dots> \<le> (\<Sum>i<m. f i)"
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 64267
diff changeset
  1115
      by (rule sum_mono2) (auto simp add: pos n[rule_format])
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1116
    also have "\<dots> \<le> suminf f"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1117
      using \<open>summable f\<close> by (rule sum_le_suminf) (simp add: pos)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1118
    finally show "(\<Sum>i<n. (f \<circ>  g) i) \<le> suminf f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1119
      by simp
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1120
  qed
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1121
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1122
  have "incseq (\<lambda>n. \<Sum>i<n. (f \<circ> g) i)"
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1123
    by (rule incseq_SucI) (auto simp add: pos)
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
  1124
  then obtain  L where L: "(\<lambda> n. \<Sum>i<n. (f \<circ> g) i) \<longlonglongrightarrow> L"
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1125
    using smaller by(rule incseq_convergent)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1126
  then have "(f \<circ> g) sums L"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1127
    by (simp add: sums_def)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1128
  then show "summable (f \<circ> g)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1129
    by (auto simp add: sums_iff)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1130
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1131
  then have "(\<lambda>n. \<Sum>i<n. (f \<circ> g) i) \<longlonglongrightarrow> suminf (f \<circ> g)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1132
    by (rule summable_LIMSEQ)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1133
  then show le: "suminf (f \<circ> g) \<le> suminf f"
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1134
    by(rule LIMSEQ_le_const2)(blast intro: smaller[rule_format])
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1135
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1136
  assume f: "\<And>x. x \<notin> range g \<Longrightarrow> f x = 0"
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1137
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1138
  from \<open>summable f\<close> have "suminf f \<le> suminf (f \<circ> g)"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1139
  proof (rule suminf_le_const)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1140
    fix n
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1141
    have "\<forall> n' \<in> (g -` {..<n}). n' < Suc (Max (g -` {..<n}))"
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1142
      by(auto intro: Max_ge simp add: finite_vimageI less_Suc_eq_le)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1143
    then obtain m where n: "\<And>n'. g n' < n \<Longrightarrow> n' < m"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1144
      by blast
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1145
    have "(\<Sum>i<n. f i) = (\<Sum>i\<in>{..<n} \<inter> range g. f i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1146
      using f by(auto intro: sum.mono_neutral_cong_right)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1147
    also have "\<dots> = (\<Sum>i\<in>g -` {..<n}. (f \<circ> g) i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1148
      by (rule sum.reindex_cong[where l=g])(auto)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1149
    also have "\<dots> \<le> (\<Sum>i<m. (f \<circ> g) i)"
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 64267
diff changeset
  1150
      by (rule sum_mono2)(auto simp add: pos n)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1151
    also have "\<dots> \<le> suminf (f \<circ> g)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1152
      using \<open>summable (f \<circ> g)\<close> by (rule sum_le_suminf) (simp add: pos)
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1153
    finally show "sum f {..<n} \<le> suminf (f \<circ> g)" .
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1154
  qed
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1155
  with le show "suminf (f \<circ> g) = suminf f"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1156
    by (rule antisym)
59025
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1157
qed
d885cff91200 add lemma following a proof suggestion by Joachim Breitner
Andreas Lochbihler
parents: 59000
diff changeset
  1158
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1159
lemma sums_mono_reindex:
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1160
  assumes subseq: "strict_mono g"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1161
    and zero: "\<And>n. n \<notin> range g \<Longrightarrow> f n = 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1162
  shows "(\<lambda>n. f (g n)) sums c \<longleftrightarrow> f sums c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1163
  unfolding sums_def
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1164
proof
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
  1165
  assume lim: "(\<lambda>n. \<Sum>k<n. f k) \<longlonglongrightarrow> c"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1166
  have "(\<lambda>n. \<Sum>k<n. f (g k)) = (\<lambda>n. \<Sum>k<g n. f k)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1167
  proof
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1168
    fix n :: nat
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1169
    from subseq have "(\<Sum>k<n. f (g k)) = (\<Sum>k\<in>g`{..<n}. f k)"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1170
      by (subst sum.reindex) (auto intro: strict_mono_imp_inj_on)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1171
    also from subseq have "\<dots> = (\<Sum>k<g n. f k)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1172
      by (intro sum.mono_neutral_left ballI zero)
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1173
        (auto simp: strict_mono_less strict_mono_less_eq)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1174
    finally show "(\<Sum>k<n. f (g k)) = (\<Sum>k<g n. f k)" .
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1175
  qed
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1176
  also from LIMSEQ_subseq_LIMSEQ[OF lim subseq] have "\<dots> \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1177
    by (simp only: o_def)
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
  1178
  finally show "(\<lambda>n. \<Sum>k<n. f (g k)) \<longlonglongrightarrow> c" .
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1179
next
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
  1180
  assume lim: "(\<lambda>n. \<Sum>k<n. f (g k)) \<longlonglongrightarrow> c"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62381
diff changeset
  1181
  define g_inv where "g_inv n = (LEAST m. g m \<ge> n)" for n
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1182
  from filterlim_subseq[OF subseq] have g_inv_ex: "\<exists>m. g m \<ge> n" for n
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1183
    by (auto simp: filterlim_at_top eventually_at_top_linorder)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1184
  then have g_inv: "g (g_inv n) \<ge> n" for n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1185
    unfolding g_inv_def by (rule LeastI_ex)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1186
  have g_inv_least: "m \<ge> g_inv n" if "g m \<ge> n" for m n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1187
    using that unfolding g_inv_def by (rule Least_le)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1188
  have g_inv_least': "g m < n" if "m < g_inv n" for m n
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1189
    using that g_inv_least[of n m] by linarith
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1190
  have "(\<lambda>n. \<Sum>k<n. f k) = (\<lambda>n. \<Sum>k<g_inv n. f (g k))"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1191
  proof
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1192
    fix n :: nat
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1193
    {
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1194
      fix k
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1195
      assume k: "k \<in> {..<n} - g`{..<g_inv n}"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1196
      have "k \<notin> range g"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1197
      proof (rule notI, elim imageE)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1198
        fix l
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1199
        assume l: "k = g l"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1200
        have "g l < g (g_inv n)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1201
          by (rule less_le_trans[OF _ g_inv]) (use k l in simp_all)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1202
        with subseq have "l < g_inv n"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1203
          by (simp add: strict_mono_less)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1204
        with k l show False
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1205
          by simp
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1206
      qed
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1207
      then have "f k = 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1208
        by (rule zero)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1209
    }
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1210
    with g_inv_least' g_inv have "(\<Sum>k<n. f k) = (\<Sum>k\<in>g`{..<g_inv n}. f k)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63952
diff changeset
  1211
      by (intro sum.mono_neutral_right) auto
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1212
    also from subseq have "\<dots> = (\<Sum>k<g_inv n. f (g k))"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1213
      using strict_mono_imp_inj_on by (subst sum.reindex) simp_all
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1214
    finally show "(\<Sum>k<n. f k) = (\<Sum>k<g_inv n. f (g k))" .
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1215
  qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1216
  also {
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1217
    fix K n :: nat
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1218
    assume "g K \<le> n"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1219
    also have "n \<le> g (g_inv n)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1220
      by (rule g_inv)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1221
    finally have "K \<le> g_inv n"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1222
      using subseq by (simp add: strict_mono_less_eq)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1223
  }
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1224
  then have "filterlim g_inv at_top sequentially"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1225
    by (auto simp: filterlim_at_top eventually_at_top_linorder)
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1226
  with lim have "(\<lambda>n. \<Sum>k<g_inv n. f (g k)) \<longlonglongrightarrow> c"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1227
    by (rule filterlim_compose)
61969
e01015e49041 more symbols;
wenzelm
parents: 61799
diff changeset
  1228
  finally show "(\<lambda>n. \<Sum>k<n. f k) \<longlonglongrightarrow> c" .
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1229
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1230
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1231
lemma summable_mono_reindex:
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1232
  assumes subseq: "strict_mono g"
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1233
    and zero: "\<And>n. n \<notin> range g \<Longrightarrow> f n = 0"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1234
  shows "summable (\<lambda>n. f (g n)) \<longleftrightarrow> summable f"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1235
  using sums_mono_reindex[of g f, OF assms] by (simp add: summable_def)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1236
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  1237
lemma suminf_mono_reindex:
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1238
  fixes f :: "nat \<Rightarrow> 'a::{t2_space,comm_monoid_add}"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 65680
diff changeset
  1239
  assumes "strict_mono g" "\<And>n. n \<notin> range g \<Longrightarrow> f n = 0"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1240
  shows   "suminf (\<lambda>n. f (g n)) = suminf f"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1241
proof (cases "summable f")
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1242
  case True
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1243
  with sums_mono_reindex [of g f, OF assms]
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1244
    and summable_mono_reindex [of g f, OF assms]
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1245
  show ?thesis
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1246
    by (simp add: sums_iff)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1247
next
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1248
  case False
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1249
  then have "\<not>(\<exists>c. f sums c)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1250
    unfolding summable_def by blast
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1251
  then have "suminf f = The (\<lambda>_. False)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1252
    by (simp add: suminf_def)
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1253
  moreover from False have "\<not> summable (\<lambda>n. f (g n))"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1254
    using summable_mono_reindex[of g f, OF assms] by simp
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1255
  then have "\<not>(\<exists>c. (\<lambda>n. f (g n)) sums c)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1256
    unfolding summable_def by blast
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1257
  then have "suminf (\<lambda>n. f (g n)) = The (\<lambda>_. False)"
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1258
    by (simp add: suminf_def)
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1259
  ultimately show ?thesis by simp
63550
3a0f40a6fa42 misc tuning and modernization;
wenzelm
parents: 63365
diff changeset
  1260
qed
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 60867
diff changeset
  1261
67167
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1262
lemma summable_bounded_partials:
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1263
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_vector,complete_space}"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1264
  assumes bound: "eventually (\<lambda>x0. \<forall>a\<ge>x0. \<forall>b>a. norm (sum f {a<..b}) \<le> g a) sequentially"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1265
  assumes g: "g \<longlonglongrightarrow> 0"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1266
  shows   "summable f" unfolding summable_iff_convergent'
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1267
proof (intro Cauchy_convergent CauchyI', goal_cases)
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1268
  case (1 \<epsilon>)
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1269
  with g have "eventually (\<lambda>x. \<bar>g x\<bar> < \<epsilon>) sequentially"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1270
    by (auto simp: tendsto_iff)
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1271
  from eventually_conj[OF this bound] obtain x0 where x0:
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1272
    "\<And>x. x \<ge> x0 \<Longrightarrow> \<bar>g x\<bar> < \<epsilon>" "\<And>a b. x0 \<le> a \<Longrightarrow> a < b \<Longrightarrow> norm (sum f {a<..b}) \<le> g a" 
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1273
    unfolding eventually_at_top_linorder by auto
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1274
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1275
  show ?case
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1276
  proof (intro exI[of _ x0] allI impI)
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1277
    fix m n assume mn: "x0 \<le> m" "m < n"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1278
    have "dist (sum f {..m}) (sum f {..n}) = norm (sum f {..n} - sum f {..m})"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1279
      by (simp add: dist_norm norm_minus_commute)
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1280
    also have "sum f {..n} - sum f {..m} = sum f ({..n} - {..m})"
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1281
      using mn by (intro Groups_Big.sum_diff [symmetric]) auto
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1282
    also have "{..n} - {..m} = {m<..n}" using mn by auto
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1283
    also have "norm (sum f {m<..n}) \<le> g m" using mn by (intro x0) auto
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1284
    also have "\<dots> \<le> \<bar>g m\<bar>" by simp
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1285
    also have "\<dots> < \<epsilon>" using mn by (intro x0) auto
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1286
    finally show "dist (sum f {..m}) (sum f {..n}) < \<epsilon>" .
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1287
  qed
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1288
qed
88d1c9d86f48 Moved analysis material from AFP
Manuel Eberl <eberlm@in.tum.de>
parents: 66456
diff changeset
  1289
14416
1f256287d4f0 converted Hyperreal/Series to Isar script
paulson
parents: 12018
diff changeset
  1290
end