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