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