| author | wenzelm | 
| Thu, 20 Aug 2015 17:39:07 +0200 | |
| changeset 60986 | 077f663b6c24 | 
| parent 60867 | 86e7560e07d0 | 
| child 61531 | ab2e862263e7 | 
| 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 | |
| 15539 | 6 | Converted to setsum 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 | 
| 
6c013328b885
add inequalities (move from AFP/Amortized_Complexity)
 hoelzl parents: 
59613diff
changeset | 14 | begin | 
| 15561 | 15 | |
| 60758 | 16 | subsection \<open>Definition of infinite summability\<close> | 
| 56213 | 17 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 18 | definition | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 19 |   sums :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a \<Rightarrow> bool"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 20 | (infixr "sums" 80) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 21 | where | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 22 | "f sums s \<longleftrightarrow> (\<lambda>n. \<Sum>i<n. f i) ----> s" | 
| 14416 | 23 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 24 | definition summable :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> bool" where
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 25 | "summable f \<longleftrightarrow> (\<exists>s. f sums s)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 26 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 27 | definition | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 28 |   suminf :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 29 | (binder "\<Sum>" 10) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 30 | where | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 31 | "suminf f = (THE s. f sums s)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 32 | |
| 60758 | 33 | subsection \<open>Infinite summability on topological monoids\<close> | 
| 56213 | 34 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 35 | 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 | 36 | by simp | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 37 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 38 | lemma sums_summable: "f sums l \<Longrightarrow> summable f" | 
| 41970 | 39 | by (simp add: sums_def summable_def, blast) | 
| 14416 | 40 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 41 | 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 | 42 | by (simp add: summable_def sums_def convergent_def) | 
| 14416 | 43 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 44 | lemma suminf_eq_lim: "suminf f = lim (\<lambda>n. \<Sum>i<n. f i)" | 
| 41970 | 45 | 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 | 46 | |
| 56213 | 47 | 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 | 48 | unfolding sums_def by simp | 
| 56213 | 49 | |
| 50 | lemma summable_zero[simp, intro]: "summable (\<lambda>n. 0)" | |
| 51 | by (rule sums_zero [THEN sums_summable]) | |
| 52 | ||
| 53 | lemma sums_group: "f sums s \<Longrightarrow> 0 < k \<Longrightarrow> (\<lambda>n. setsum f {n * k ..< n * k + k}) sums s"
 | |
| 54 | apply (simp only: sums_def setsum_nat_group tendsto_def eventually_sequentially) | |
| 55 | apply safe | |
| 56 | apply (erule_tac x=S in allE) | |
| 57 | apply safe | |
| 58 | apply (rule_tac x="N" in exI, safe) | |
| 59 | apply (drule_tac x="n*k" in spec) | |
| 60 | apply (erule mp) | |
| 61 | apply (erule order_trans) | |
| 62 | apply simp | |
| 63 | done | |
| 64 | ||
| 47761 | 65 | lemma sums_finite: | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 66 | assumes [simp]: "finite N" and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0" | 
| 47761 | 67 | shows "f sums (\<Sum>n\<in>N. f n)" | 
| 68 | proof - | |
| 69 |   { fix n
 | |
| 70 |     have "setsum f {..<n + Suc (Max N)} = setsum f N"
 | |
| 71 | proof cases | |
| 72 |       assume "N = {}"
 | |
| 73 | with f have "f = (\<lambda>x. 0)" by auto | |
| 74 | then show ?thesis by simp | |
| 75 | next | |
| 76 |       assume [simp]: "N \<noteq> {}"
 | |
| 77 | show ?thesis | |
| 57418 | 78 | proof (safe intro!: setsum.mono_neutral_right f) | 
| 47761 | 79 | fix i assume "i \<in> N" | 
| 80 | then have "i \<le> Max N" by simp | |
| 81 | then show "i < n + Suc (Max N)" by simp | |
| 82 | qed | |
| 83 | qed } | |
| 84 | note eq = this | |
| 85 | show ?thesis unfolding sums_def | |
| 86 | by (rule LIMSEQ_offset[of _ "Suc (Max N)"]) | |
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57418diff
changeset | 87 | (simp add: eq atLeast0LessThan del: add_Suc_right) | 
| 47761 | 88 | qed | 
| 89 | ||
| 56213 | 90 | lemma summable_finite: "finite N \<Longrightarrow> (\<And>n. n \<notin> N \<Longrightarrow> f n = 0) \<Longrightarrow> summable f" | 
| 91 | by (rule sums_summable) (rule sums_finite) | |
| 92 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 93 | 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 | 94 | using sums_finite[of A "(\<lambda>r. if r \<in> A then f r else 0)"] by simp | 
| 95 | ||
| 56213 | 96 | lemma summable_If_finite_set[simp, intro]: "finite A \<Longrightarrow> summable (\<lambda>r. if r \<in> A then f r else 0)" | 
| 97 | by (rule sums_summable) (rule sums_If_finite_set) | |
| 98 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 99 | 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 | 100 |   using sums_If_finite_set[of "{r. P r}"] by simp
 | 
| 16819 | 101 | |
| 56213 | 102 | lemma summable_If_finite[simp, intro]: "finite {r. P r} \<Longrightarrow> summable (\<lambda>r. if P r then f r else 0)"
 | 
| 103 | by (rule sums_summable) (rule sums_If_finite) | |
| 104 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 105 | 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 | 106 | 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 | 107 | |
| 56213 | 108 | lemma summable_single[simp, intro]: "summable (\<lambda>r. if r = i then f r else 0)" | 
| 109 | by (rule sums_summable) (rule sums_single) | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 110 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 111 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 112 |   fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 113 | begin | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 114 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 115 | 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 | 116 | 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 | 117 | (metis convergent_LIMSEQ_iff convergent_def lim_def) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 118 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 119 | lemma summable_LIMSEQ: "summable f \<Longrightarrow> (\<lambda>n. \<Sum>i<n. f i) ----> suminf f" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 120 | by (rule summable_sums [unfolded sums_def]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 121 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 122 | 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 | 123 | by (metis limI suminf_eq_lim sums_def) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 124 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 125 | lemma sums_iff: "f sums x \<longleftrightarrow> summable f \<and> (suminf f = x)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 126 | by (metis summable_sums sums_summable sums_unique) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 127 | |
| 59613 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 128 | lemma sums_unique2: | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 129 |   fixes a b :: "'a::{comm_monoid_add,t2_space}"
 | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 130 | shows "f sums a \<Longrightarrow> f sums b \<Longrightarrow> a = b" | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 131 | by (simp add: sums_iff) | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 132 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 133 | lemma suminf_finite: | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 134 | assumes N: "finite N" and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 135 | 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 | 136 | 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 | 137 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 138 | end | 
| 16819 | 139 | |
| 41970 | 140 | 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 | 141 | by (rule sums_zero [THEN sums_unique, symmetric]) | 
| 16819 | 142 | |
| 56213 | 143 | |
| 60758 | 144 | subsection \<open>Infinite summability on ordered, topological monoids\<close> | 
| 56213 | 145 | |
| 146 | lemma sums_le: | |
| 147 |   fixes f g :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add, linorder_topology}"
 | |
| 148 | shows "\<forall>n. f n \<le> g n \<Longrightarrow> f sums s \<Longrightarrow> g sums t \<Longrightarrow> s \<le> t" | |
| 149 | by (rule LIMSEQ_le) (auto intro: setsum_mono simp: sums_def) | |
| 150 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 151 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 152 |   fixes f :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add, linorder_topology}"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 153 | begin | 
| 14416 | 154 | |
| 56213 | 155 | lemma suminf_le: "\<lbrakk>\<forall>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g" | 
| 156 | by (auto dest: sums_summable intro: sums_le) | |
| 157 | ||
| 158 | lemma setsum_le_suminf: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 \<le> f m \<Longrightarrow> setsum f {..<n} \<le> suminf f"
 | |
| 159 | by (rule sums_le[OF _ sums_If_finite_set summable_sums]) auto | |
| 160 | ||
| 161 | lemma suminf_nonneg: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 \<le> suminf f" | |
| 162 | using setsum_le_suminf[of 0] by simp | |
| 163 | ||
| 164 | lemma setsum_less_suminf2: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 \<le> f m \<Longrightarrow> n \<le> i \<Longrightarrow> 0 < f i \<Longrightarrow> setsum f {..<n} < suminf f"
 | |
| 165 | using | |
| 166 | setsum_le_suminf[of "Suc i"] | |
| 167 |     add_strict_increasing[of "f i" "setsum f {..<n}" "setsum f {..<i}"]
 | |
| 168 |     setsum_mono2[of "{..<i}" "{..<n}" f]
 | |
| 169 | by (auto simp: less_imp_le ac_simps) | |
| 170 | ||
| 171 | lemma setsum_less_suminf: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 < f m \<Longrightarrow> setsum f {..<n} < suminf f"
 | |
| 172 | using setsum_less_suminf2[of n n] by (simp add: less_imp_le) | |
| 173 | ||
| 174 | lemma suminf_pos2: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 < f i \<Longrightarrow> 0 < suminf f" | |
| 175 | using setsum_less_suminf2[of 0 i] by simp | |
| 176 | ||
| 177 | lemma suminf_pos: "summable f \<Longrightarrow> \<forall>n. 0 < f n \<Longrightarrow> 0 < suminf f" | |
| 178 | using suminf_pos2[of 0] by (simp add: less_imp_le) | |
| 179 | ||
| 180 | lemma suminf_le_const: "summable f \<Longrightarrow> (\<And>n. setsum f {..<n} \<le> x) \<Longrightarrow> suminf f \<le> x"
 | |
| 181 | by (metis LIMSEQ_le_const2 summable_LIMSEQ) | |
| 14416 | 182 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 183 | lemma suminf_eq_zero_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> suminf f = 0 \<longleftrightarrow> (\<forall>n. f n = 0)" | 
| 50999 | 184 | proof | 
| 185 | assume "summable f" "suminf f = 0" and pos: "\<forall>n. 0 \<le> f n" | |
| 186 | then have f: "(\<lambda>n. \<Sum>i<n. f i) ----> 0" | |
| 56213 | 187 | using summable_LIMSEQ[of f] by simp | 
| 188 |   then have "\<And>i. (\<Sum>n\<in>{i}. f n) \<le> 0"
 | |
| 189 | proof (rule LIMSEQ_le_const) | |
| 50999 | 190 |     fix i show "\<exists>N. \<forall>n\<ge>N. (\<Sum>n\<in>{i}. f n) \<le> setsum f {..<n}"
 | 
| 191 | using pos by (intro exI[of _ "Suc i"] allI impI setsum_mono2) auto | |
| 192 | qed | |
| 193 | with pos show "\<forall>n. f n = 0" | |
| 194 | by (auto intro!: antisym) | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 195 | qed (metis suminf_zero fun_eq_iff) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 196 | |
| 56213 | 197 | lemma suminf_pos_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 < suminf f \<longleftrightarrow> (\<exists>i. 0 < f i)" | 
| 198 | using setsum_le_suminf[of 0] suminf_eq_zero_iff by (simp add: less_le) | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 199 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 200 | end | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 201 | |
| 56213 | 202 | lemma summableI_nonneg_bounded: | 
| 203 |   fixes f:: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add, linorder_topology, conditionally_complete_linorder}"
 | |
| 204 | assumes pos[simp]: "\<And>n. 0 \<le> f n" and le: "\<And>n. (\<Sum>i<n. f i) \<le> x" | |
| 205 | shows "summable f" | |
| 206 | unfolding summable_def sums_def[abs_def] | |
| 207 | proof (intro exI order_tendstoI) | |
| 208 | have [simp, intro]: "bdd_above (range (\<lambda>n. \<Sum>i<n. f i))" | |
| 209 | using le by (auto simp: bdd_above_def) | |
| 210 |   { fix a assume "a < (SUP n. \<Sum>i<n. f i)"
 | |
| 211 | then obtain n where "a < (\<Sum>i<n. f i)" | |
| 212 | by (auto simp add: less_cSUP_iff) | |
| 213 | then have "\<And>m. n \<le> m \<Longrightarrow> a < (\<Sum>i<m. f i)" | |
| 214 | by (rule less_le_trans) (auto intro!: setsum_mono2) | |
| 215 | then show "eventually (\<lambda>n. a < (\<Sum>i<n. f i)) sequentially" | |
| 216 | by (auto simp: eventually_sequentially) } | |
| 217 |   { fix a assume "(SUP n. \<Sum>i<n. f i) < a"
 | |
| 218 | moreover have "\<And>n. (\<Sum>i<n. f i) \<le> (SUP n. \<Sum>i<n. f i)" | |
| 219 | by (auto intro: cSUP_upper) | |
| 220 | ultimately show "eventually (\<lambda>n. (\<Sum>i<n. f i) < a) sequentially" | |
| 221 | by (auto intro: le_less_trans simp: eventually_sequentially) } | |
| 222 | qed | |
| 223 | ||
| 60758 | 224 | 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 | 225 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 226 | lemma sums_Suc_iff: | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 227 | fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 228 | shows "(\<lambda>n. f (Suc n)) sums s \<longleftrightarrow> f sums (s + f 0)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 229 | proof - | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 230 | have "f sums (s + f 0) \<longleftrightarrow> (\<lambda>i. \<Sum>j<Suc i. f j) ----> s + f 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 231 | by (subst LIMSEQ_Suc_iff) (simp add: sums_def) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 232 | also have "\<dots> \<longleftrightarrow> (\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) ----> s + f 0" | 
| 57418 | 233 | by (simp add: ac_simps setsum.reindex image_iff lessThan_Suc_eq_insert_0) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 234 | 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 | 235 | proof | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 236 | assume "(\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) ----> s + f 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 237 | with tendsto_add[OF this tendsto_const, of "- f 0"] | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 238 | show "(\<lambda>i. f (Suc i)) sums s" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 239 | by (simp add: sums_def) | 
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57418diff
changeset | 240 | 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 | 241 | finally show ?thesis .. | 
| 50999 | 242 | qed | 
| 243 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 244 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 245 | fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 246 | begin | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 247 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 248 | lemma sums_add: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n + g n) sums (a + b)" | 
| 57418 | 249 | unfolding sums_def by (simp add: setsum.distrib tendsto_add) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 250 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 251 | lemma summable_add: "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 | 252 | unfolding summable_def by (auto intro: sums_add) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 253 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 254 | lemma suminf_add: "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 | 255 | by (intro sums_unique sums_add summable_sums) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 256 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 257 | lemma sums_diff: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n - g n) sums (a - b)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 258 | unfolding sums_def by (simp add: setsum_subtractf tendsto_diff) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 259 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 260 | 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 | 261 | unfolding summable_def by (auto intro: sums_diff) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 262 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 263 | 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 | 264 | by (intro sums_unique sums_diff summable_sums) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 265 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 266 | lemma sums_minus: "f sums a \<Longrightarrow> (\<lambda>n. - f n) sums (- a)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 267 | unfolding sums_def by (simp add: setsum_negf tendsto_minus) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 268 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 269 | 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 | 270 | unfolding summable_def by (auto intro: sums_minus) | 
| 20692 | 271 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 272 | 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 | 273 | 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 | 274 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 275 | lemma sums_Suc: "(\<lambda> n. f (Suc n)) sums l \<Longrightarrow> f sums (l + f 0)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 276 | by (simp add: sums_Suc_iff) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 277 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 278 | 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 | 279 | proof (induct n arbitrary: s) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 280 | case (Suc n) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 281 | moreover have "(\<lambda>i. f (Suc i + n)) sums s \<longleftrightarrow> (\<lambda>i. f (i + n)) sums (s + f n)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 282 | by (subst sums_Suc_iff) simp | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 283 | ultimately show ?case | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 284 | by (simp add: ac_simps) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 285 | qed simp | 
| 20692 | 286 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 287 | lemma summable_iff_shift: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 288 | by (metis diff_add_cancel summable_def sums_iff_shift[abs_def]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 289 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 290 | 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 | 291 | by (simp add: sums_iff_shift) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 292 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 293 | 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 | 294 | by (simp add: summable_iff_shift) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 295 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 296 | 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 | 297 | 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 | 298 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 299 | 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 | 300 | by (auto simp add: suminf_minus_initial_segment) | 
| 20692 | 301 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 302 | lemma suminf_exist_split: | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 303 | fixes r :: real assumes "0 < r" and "summable f" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 304 | 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 | 305 | proof - | 
| 60758 | 306 | from LIMSEQ_D[OF summable_LIMSEQ[OF \<open>summable f\<close>] \<open>0 < r\<close>] | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 307 |   obtain N :: nat where "\<forall> n \<ge> N. norm (setsum f {..<n} - suminf f) < r" by auto
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 308 | thus ?thesis | 
| 60758 | 309 | 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 | 310 | qed | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 311 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 312 | lemma summable_LIMSEQ_zero: "summable f \<Longrightarrow> f ----> 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 313 | apply (drule summable_iff_convergent [THEN iffD1]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 314 | apply (drule convergent_Cauchy) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 315 | apply (simp only: Cauchy_iff LIMSEQ_iff, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 316 | apply (drule_tac x="r" in spec, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 317 | apply (rule_tac x="M" in exI, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 318 | apply (drule_tac x="Suc n" in spec, simp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 319 | apply (drule_tac x="n" in spec, simp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 320 | done | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 321 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 322 | end | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 323 | |
| 59613 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 324 | lemma summable_minus_iff: | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 325 | fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" | 
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 326 | shows "summable (\<lambda>n. - f n) \<longleftrightarrow> summable f" | 
| 60758 | 327 | by (auto dest: summable_minus) --\<open>used two ways, hence must be outside the context above\<close> | 
| 59613 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 328 | |
| 
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
 paulson <lp15@cam.ac.uk> parents: 
59025diff
changeset | 329 | |
| 57025 | 330 | context | 
| 331 | fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::real_normed_vector" and I :: "'i set" | |
| 332 | begin | |
| 333 | ||
| 334 | lemma sums_setsum: "(\<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)" | |
| 335 | by (induct I rule: infinite_finite_induct) (auto intro!: sums_add) | |
| 336 | ||
| 337 | lemma suminf_setsum: "(\<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)" | |
| 338 | using sums_unique[OF sums_setsum, OF summable_sums] by simp | |
| 339 | ||
| 340 | lemma summable_setsum: "(\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)" | |
| 341 | using sums_summable[OF sums_setsum[OF summable_sums]] . | |
| 342 | ||
| 343 | end | |
| 344 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 345 | lemma (in bounded_linear) sums: "(\<lambda>n. X n) sums a \<Longrightarrow> (\<lambda>n. f (X n)) sums (f a)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 346 | unfolding sums_def by (drule tendsto, simp only: setsum) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 347 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 348 | 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 | 349 | unfolding summable_def by (auto intro: sums) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 350 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 351 | 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 | 352 | by (intro sums_unique sums summable_sums) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 353 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 354 | 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 | 355 | 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 | 356 | 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 | 357 | |
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57129diff
changeset | 358 | 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 | 359 | 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 | 360 | 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 | 361 | |
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57129diff
changeset | 362 | 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 | 363 | 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 | 364 | 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 | 365 | |
| 60758 | 366 | subsection \<open>Infinite summability on real normed algebras\<close> | 
| 56213 | 367 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 368 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 369 | fixes f :: "nat \<Rightarrow> 'a::real_normed_algebra" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 370 | begin | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 371 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 372 | 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 | 373 | 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 | 374 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 375 | 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 | 376 | 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 | 377 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 378 | 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 | 379 | 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 | 380 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 381 | 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 | 382 | 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 | 383 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 384 | 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 | 385 | 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 | 386 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 387 | 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 | 388 | 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 | 389 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 390 | end | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 391 | |
| 60758 | 392 | subsection \<open>Infinite summability on real normed fields\<close> | 
| 56213 | 393 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 394 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 395 | fixes c :: "'a::real_normed_field" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 396 | begin | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 397 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 398 | 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 | 399 | 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 | 400 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 401 | 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 | 402 | 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 | 403 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 404 | 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 | 405 | by (rule bounded_linear.suminf [OF bounded_linear_divide, symmetric]) | 
| 14416 | 406 | |
| 60758 | 407 | text\<open>Sum of a geometric progression.\<close> | 
| 14416 | 408 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 409 | lemma geometric_sums: "norm c < 1 \<Longrightarrow> (\<lambda>n. c^n) sums (1 / (1 - c))" | 
| 20692 | 410 | proof - | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 411 | assume less_1: "norm c < 1" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 412 | hence neq_1: "c \<noteq> 1" by auto | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 413 | hence neq_0: "c - 1 \<noteq> 0" by simp | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 414 | from less_1 have lim_0: "(\<lambda>n. c^n) ----> 0" | 
| 20692 | 415 | by (rule LIMSEQ_power_zero) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 416 | hence "(\<lambda>n. c ^ n / (c - 1) - 1 / (c - 1)) ----> 0 / (c - 1) - 1 / (c - 1)" | 
| 44568 
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
 huffman parents: 
44289diff
changeset | 417 | using neq_0 by (intro tendsto_intros) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 418 | hence "(\<lambda>n. (c ^ n - 1) / (c - 1)) ----> 1 / (1 - c)" | 
| 20692 | 419 | by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 420 | thus "(\<lambda>n. c ^ n) sums (1 / (1 - c))" | 
| 20692 | 421 | by (simp add: sums_def geometric_sum neq_1) | 
| 422 | qed | |
| 423 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 424 | 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 | 425 | by (rule geometric_sums [THEN sums_summable]) | 
| 14416 | 426 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 427 | 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 | 428 | by (rule sums_unique[symmetric]) (rule geometric_sums) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 429 | |
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 430 | end | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 431 | |
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 432 | 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 | 433 | proof - | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 434 | have 2: "(\<lambda>n. (1/2::real)^n) sums 2" using geometric_sums [of "1/2::real"] | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 435 | by auto | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 436 | 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 | 437 | by (simp add: mult.commute) | 
| 44282 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 huffman parents: 
41970diff
changeset | 438 | thus ?thesis using sums_divide [OF 2, of 2] | 
| 33271 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 439 | by simp | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 440 | qed | 
| 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
 paulson parents: 
32877diff
changeset | 441 | |
| 60758 | 442 | subsection \<open>Infinite summability on Banach spaces\<close> | 
| 56213 | 443 | |
| 60758 | 444 | 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 | 445 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 446 | lemma summable_Cauchy: | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 447 | fixes f :: "nat \<Rightarrow> 'a::banach" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 448 |   shows "summable f \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. norm (setsum f {m..<n}) < e)"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 449 | apply (simp only: summable_iff_convergent Cauchy_convergent_iff [symmetric] Cauchy_iff, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 450 | apply (drule spec, drule (1) mp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 451 | apply (erule exE, rule_tac x="M" in exI, clarify) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 452 | apply (rule_tac x="m" and y="n" in linorder_le_cases) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 453 | apply (frule (1) order_trans) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 454 | apply (drule_tac x="n" in spec, drule (1) mp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 455 | apply (drule_tac x="m" in spec, drule (1) mp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 456 | apply (simp_all add: setsum_diff [symmetric]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 457 | apply (drule spec, drule (1) mp) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 458 | apply (erule exE, rule_tac x="N" in exI, clarify) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 459 | apply (rule_tac x="m" and y="n" in linorder_le_cases) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 460 | apply (subst norm_minus_commute) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 461 | apply (simp_all add: setsum_diff [symmetric]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 462 | done | 
| 14416 | 463 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 464 | context | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 465 | fixes f :: "nat \<Rightarrow> 'a::banach" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 466 | begin | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 467 | |
| 60758 | 468 | text\<open>Absolute convergence imples normal convergence\<close> | 
| 20689 | 469 | |
| 56194 | 470 | lemma summable_norm_cancel: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 471 | apply (simp only: summable_Cauchy, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 472 | apply (drule_tac x="e" in spec, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 473 | apply (rule_tac x="N" in exI, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 474 | apply (drule_tac x="m" in spec, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 475 | apply (rule order_le_less_trans [OF norm_setsum]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 476 | apply (rule order_le_less_trans [OF abs_ge_self]) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 477 | apply simp | 
| 50999 | 478 | done | 
| 32707 
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
 paulson parents: 
31336diff
changeset | 479 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 480 | lemma summable_norm: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 481 | by (auto intro: LIMSEQ_le tendsto_norm summable_norm_cancel summable_LIMSEQ norm_setsum) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 482 | |
| 60758 | 483 | text \<open>Comparison tests\<close> | 
| 14416 | 484 | |
| 56194 | 485 | lemma summable_comparison_test: "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable f" | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 486 | apply (simp add: summable_Cauchy, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 487 | apply (drule_tac x="e" in spec, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 488 | apply (rule_tac x = "N + Na" in exI, safe) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 489 | apply (rotate_tac 2) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 490 | apply (drule_tac x = m in spec) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 491 | apply (auto, rotate_tac 2, drule_tac x = n in spec) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 492 | apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 493 | apply (rule norm_setsum) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 494 |   apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans)
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 495 | apply (auto intro: setsum_mono simp add: abs_less_iff) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 496 | done | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 497 | |
| 56217 
dc429a5b13c4
Some rationalisation of basic lemmas
 paulson <lp15@cam.ac.uk> parents: 
56213diff
changeset | 498 | (*A better argument order*) | 
| 
dc429a5b13c4
Some rationalisation of basic lemmas
 paulson <lp15@cam.ac.uk> parents: 
56213diff
changeset | 499 | 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 | 500 | by (rule summable_comparison_test) auto | 
| 56217 
dc429a5b13c4
Some rationalisation of basic lemmas
 paulson <lp15@cam.ac.uk> parents: 
56213diff
changeset | 501 | |
| 60758 | 502 | subsection \<open>The Ratio Test\<close> | 
| 15085 
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
 paulson parents: 
15053diff
changeset | 503 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 504 | lemma summable_ratio_test: | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 505 | 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 | 506 | shows "summable f" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 507 | proof cases | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 508 | assume "0 < c" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 509 | show "summable f" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 510 | proof (rule summable_comparison_test) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 511 | 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 | 512 | proof (intro exI allI impI) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 513 | fix n assume "N \<le> n" then show "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 | 514 | proof (induct rule: inc_induct) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 515 | case (step m) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 516 | moreover have "norm (f (Suc m)) / c ^ Suc m * c ^ n \<le> norm (f m) / c ^ m * c ^ n" | 
| 60758 | 517 | using \<open>0 < c\<close> \<open>c < 1\<close> assms(2)[OF \<open>N \<le> m\<close>] by (simp add: field_simps) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 518 | ultimately show ?case by simp | 
| 60758 | 519 | qed (insert \<open>0 < c\<close>, simp) | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 520 | qed | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 521 | show "summable (\<lambda>n. norm (f N) / c ^ N * c ^ n)" | 
| 60758 | 522 | 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 | 523 | qed | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 524 | next | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 525 | assume c: "\<not> 0 < c" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 526 |   { fix n assume "n \<ge> N"
 | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 527 | then have "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 | 528 | by fact | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 529 | also have "\<dots> \<le> 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 530 | using c by (simp add: not_less mult_nonpos_nonneg) | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 531 | finally have "f (Suc n) = 0" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 532 | by auto } | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 533 | then show "summable f" | 
| 56194 | 534 |     by (intro sums_summable[OF sums_finite, of "{.. Suc N}"]) (auto simp: not_le Suc_less_eq2)
 | 
| 56178 | 535 | qed | 
| 536 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 537 | end | 
| 14416 | 538 | |
| 60758 | 539 | 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 | 540 | |
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 541 | lemma abel_lemma: | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 542 | fixes a :: "nat \<Rightarrow> 'a::real_normed_vector" | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 543 | assumes r: "0 \<le> r" and r0: "r < r0" and M: "\<And>n. norm (a n) * r0^n \<le> M" | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 544 | shows "summable (\<lambda>n. norm (a n) * r^n)" | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 545 | proof (rule summable_comparison_test') | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 546 | show "summable (\<lambda>n. M * (r / r0) ^ n)" | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 547 | using assms | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 548 | by (auto simp add: summable_mult summable_geometric) | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 549 | next | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 550 | fix n | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 551 | show "norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n" | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 552 | using r r0 M [of n] | 
| 60867 | 553 | apply (auto simp add: abs_mult field_simps) | 
| 56369 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 554 | apply (cases "r=0", simp) | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 555 | apply (cases n, auto) | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 556 | done | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 557 | qed | 
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 558 | |
| 
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
 hoelzl parents: 
56217diff
changeset | 559 | |
| 60758 | 560 | text\<open>Summability of geometric series for real algebras\<close> | 
| 23084 | 561 | |
| 562 | lemma complete_algebra_summable_geometric: | |
| 31017 | 563 |   fixes x :: "'a::{real_normed_algebra_1,banach}"
 | 
| 23084 | 564 | shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" | 
| 565 | proof (rule summable_comparison_test) | |
| 566 | show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n" | |
| 567 | by (simp add: norm_power_ineq) | |
| 568 | show "norm x < 1 \<Longrightarrow> summable (\<lambda>n. norm x ^ n)" | |
| 569 | by (simp add: summable_geometric) | |
| 570 | qed | |
| 571 | ||
| 60758 | 572 | subsection \<open>Cauchy Product Formula\<close> | 
| 23111 | 573 | |
| 60758 | 574 | text \<open> | 
| 54703 | 575 | Proof based on Analysis WebNotes: Chapter 07, Class 41 | 
| 576 |   @{url "http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm"}
 | |
| 60758 | 577 | \<close> | 
| 23111 | 578 | |
| 579 | lemma Cauchy_product_sums: | |
| 580 |   fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
 | |
| 581 | assumes a: "summable (\<lambda>k. norm (a k))" | |
| 582 | assumes b: "summable (\<lambda>k. norm (b k))" | |
| 56213 | 583 | shows "(\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))" | 
| 23111 | 584 | proof - | 
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 585 |   let ?S1 = "\<lambda>n::nat. {..<n} \<times> {..<n}"
 | 
| 23111 | 586 |   let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}"
 | 
| 587 | have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto | |
| 588 | have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto | |
| 589 | have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto | |
| 590 | have finite_S1: "\<And>n. finite (?S1 n)" by simp | |
| 591 | with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset) | |
| 592 | ||
| 593 | let ?g = "\<lambda>(i,j). a i * b j" | |
| 594 | let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)" | |
| 56536 | 595 | have f_nonneg: "\<And>x. 0 \<le> ?f x" by (auto) | 
| 23111 | 596 | hence norm_setsum_f: "\<And>A. norm (setsum ?f A) = setsum ?f A" | 
| 597 | unfolding real_norm_def | |
| 598 | by (simp only: abs_of_nonneg setsum_nonneg [rule_format]) | |
| 599 | ||
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 600 | have "(\<lambda>n. (\<Sum>k<n. a k) * (\<Sum>k<n. b k)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 601 | by (intro tendsto_mult summable_LIMSEQ summable_norm_cancel [OF a] summable_norm_cancel [OF b]) | 
| 23111 | 602 | hence 1: "(\<lambda>n. setsum ?g (?S1 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" | 
| 57418 | 603 | by (simp only: setsum_product setsum.Sigma [rule_format] finite_lessThan) | 
| 23111 | 604 | |
| 56193 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 605 | have "(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) ----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" | 
| 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
 hoelzl parents: 
56178diff
changeset | 606 | using a b by (intro tendsto_mult summable_LIMSEQ) | 
| 23111 | 607 | hence "(\<lambda>n. setsum ?f (?S1 n)) ----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" | 
| 57418 | 608 | by (simp only: setsum_product setsum.Sigma [rule_format] finite_lessThan) | 
| 23111 | 609 | hence "convergent (\<lambda>n. setsum ?f (?S1 n))" | 
| 610 | by (rule convergentI) | |
| 611 | hence Cauchy: "Cauchy (\<lambda>n. setsum ?f (?S1 n))" | |
| 612 | by (rule convergent_Cauchy) | |
| 36657 | 613 | have "Zfun (\<lambda>n. setsum ?f (?S1 n - ?S2 n)) sequentially" | 
| 614 | proof (rule ZfunI, simp only: eventually_sequentially norm_setsum_f) | |
| 23111 | 615 | fix r :: real | 
| 616 | assume r: "0 < r" | |
| 617 | from CauchyD [OF Cauchy r] obtain N | |
| 618 | where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (setsum ?f (?S1 m) - setsum ?f (?S1 n)) < r" .. | |
| 619 | hence "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (setsum ?f (?S1 m - ?S1 n)) < r" | |
| 620 | by (simp only: setsum_diff finite_S1 S1_mono) | |
| 621 | hence N: "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> setsum ?f (?S1 m - ?S1 n) < r" | |
| 622 | by (simp only: norm_setsum_f) | |
| 623 | show "\<exists>N. \<forall>n\<ge>N. setsum ?f (?S1 n - ?S2 n) < r" | |
| 624 | proof (intro exI allI impI) | |
| 625 | fix n assume "2 * N \<le> n" | |
| 626 | hence n: "N \<le> n div 2" by simp | |
| 627 | have "setsum ?f (?S1 n - ?S2 n) \<le> setsum ?f (?S1 n - ?S1 (n div 2))" | |
| 628 | by (intro setsum_mono2 finite_Diff finite_S1 f_nonneg | |
| 629 | Diff_mono subset_refl S1_le_S2) | |
| 630 | also have "\<dots> < r" | |
| 631 | using n div_le_dividend by (rule N) | |
| 632 | finally show "setsum ?f (?S1 n - ?S2 n) < r" . | |
| 633 | qed | |
| 634 | qed | |
| 36657 | 635 | hence "Zfun (\<lambda>n. setsum ?g (?S1 n - ?S2 n)) sequentially" | 
| 636 | apply (rule Zfun_le [rule_format]) | |
| 23111 | 637 | apply (simp only: norm_setsum_f) | 
| 638 | apply (rule order_trans [OF norm_setsum setsum_mono]) | |
| 639 | apply (auto simp add: norm_mult_ineq) | |
| 640 | done | |
| 641 | hence 2: "(\<lambda>n. setsum ?g (?S1 n) - setsum ?g (?S2 n)) ----> 0" | |
| 36660 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 huffman parents: 
36657diff
changeset | 642 | unfolding tendsto_Zfun_iff diff_0_right | 
| 36657 | 643 | by (simp only: setsum_diff finite_S1 S2_le_S1) | 
| 23111 | 644 | |
| 645 | with 1 have "(\<lambda>n. setsum ?g (?S2 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" | |
| 60141 
833adf7db7d8
New material, mostly about limits. Consolidation.
 paulson <lp15@cam.ac.uk> parents: 
59741diff
changeset | 646 | by (rule Lim_transform2) | 
| 23111 | 647 | thus ?thesis by (simp only: sums_def setsum_triangle_reindex) | 
| 648 | qed | |
| 649 | ||
| 650 | lemma Cauchy_product: | |
| 651 |   fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
 | |
| 652 | assumes a: "summable (\<lambda>k. norm (a k))" | |
| 653 | assumes b: "summable (\<lambda>k. norm (b k))" | |
| 56213 | 654 | shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i\<le>k. a i * b (k - i))" | 
| 655 | using a b | |
| 656 | by (rule Cauchy_product_sums [THEN sums_unique]) | |
| 657 | ||
| 60758 | 658 | subsection \<open>Series on @{typ real}s\<close>
 | 
| 56213 | 659 | |
| 660 | lemma summable_norm_comparison_test: "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. norm (f n))" | |
| 661 | by (rule summable_comparison_test) auto | |
| 662 | ||
| 663 | lemma summable_rabs_comparison_test: "\<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<bar>f n :: real\<bar>)" | |
| 664 | by (rule summable_comparison_test) auto | |
| 665 | ||
| 666 | lemma summable_rabs_cancel: "summable (\<lambda>n. \<bar>f n :: real\<bar>) \<Longrightarrow> summable f" | |
| 667 | by (rule summable_norm_cancel) simp | |
| 668 | ||
| 669 | lemma summable_rabs: "summable (\<lambda>n. \<bar>f n :: real\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" | |
| 670 | by (fold real_norm_def) (rule summable_norm) | |
| 23111 | 671 | |
| 59000 | 672 | lemma summable_power_series: | 
| 673 | fixes z :: real | |
| 674 | assumes le_1: "\<And>i. f i \<le> 1" and nonneg: "\<And>i. 0 \<le> f i" and z: "0 \<le> z" "z < 1" | |
| 675 | shows "summable (\<lambda>i. f i * z^i)" | |
| 676 | proof (rule summable_comparison_test[OF _ summable_geometric]) | |
| 677 | show "norm z < 1" using z by (auto simp: less_imp_le) | |
| 678 | show "\<And>n. \<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na" | |
| 679 | using z by (auto intro!: exI[of _ 0] mult_left_le_one_le simp: abs_mult nonneg power_abs less_imp_le le_1) | |
| 680 | qed | |
| 681 | ||
| 59025 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 682 | lemma | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 683 | fixes f :: "nat \<Rightarrow> real" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 684 | assumes "summable f" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 685 | and "inj g" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 686 | and pos: "!!x. 0 \<le> f x" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 687 | shows summable_reindex: "summable (f o g)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 688 | and suminf_reindex_mono: "suminf (f o g) \<le> suminf f" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 689 | and suminf_reindex: "(\<And>x. x \<notin> range g \<Longrightarrow> f x = 0) \<Longrightarrow> suminf (f \<circ> g) = suminf f" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 690 | proof - | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 691 | from \<open>inj g\<close> have [simp]: "\<And>A. inj_on g A" by(rule subset_inj_on) simp | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 692 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 693 | 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 | 694 | proof | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 695 | fix n | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 696 |     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 | 697 | by(metis Max_ge finite_imageI finite_lessThan not_le not_less_eq) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 698 | then obtain m where n: "\<And>n'. n' < n \<Longrightarrow> g n' < m" by blast | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 699 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 700 |     have "(\<Sum>i<n. f (g i)) = setsum f (g ` {..<n})"
 | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 701 | by (simp add: setsum.reindex) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 702 | also have "\<dots> \<le> (\<Sum>i<m. f i)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 703 | by (rule setsum_mono3) (auto simp add: pos n[rule_format]) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 704 | also have "\<dots> \<le> suminf f" | 
| 60758 | 705 | using \<open>summable f\<close> | 
| 59025 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 706 | by (rule setsum_le_suminf) (simp add: pos) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 707 | finally show "(\<Sum>i<n. (f \<circ> g) i) \<le> suminf f" by simp | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 708 | qed | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 709 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 710 | 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 | 711 | by (rule incseq_SucI) (auto simp add: pos) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 712 | then obtain L where L: "(\<lambda> n. \<Sum>i<n. (f \<circ> g) i) ----> L" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 713 | using smaller by(rule incseq_convergent) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 714 | hence "(f \<circ> g) sums L" by (simp add: sums_def) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 715 | thus "summable (f o g)" by (auto simp add: sums_iff) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 716 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 717 | hence "(\<lambda>n. \<Sum>i<n. (f \<circ> g) i) ----> suminf (f \<circ> g)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 718 | by(rule summable_LIMSEQ) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 719 | thus le: "suminf (f \<circ> g) \<le> suminf f" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 720 | 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 | 721 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 722 | 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 | 723 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 724 | from \<open>summable f\<close> have "suminf f \<le> suminf (f \<circ> g)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 725 | proof(rule suminf_le_const) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 726 | fix n | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 727 |     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 | 728 | by(auto intro: Max_ge simp add: finite_vimageI less_Suc_eq_le) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 729 | then obtain m where n: "\<And>n'. g n' < n \<Longrightarrow> n' < m" by blast | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 730 | |
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 731 |     have "(\<Sum>i<n. f i) = (\<Sum>i\<in>{..<n} \<inter> range g. f i)"
 | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 732 | using f by(auto intro: setsum.mono_neutral_cong_right) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 733 |     also have "\<dots> = (\<Sum>i\<in>g -` {..<n}. (f \<circ> g) i)"
 | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 734 | by(rule setsum.reindex_cong[where l=g])(auto) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 735 | also have "\<dots> \<le> (\<Sum>i<m. (f \<circ> g) i)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 736 | by(rule setsum_mono3)(auto simp add: pos n) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 737 | also have "\<dots> \<le> suminf (f \<circ> g)" | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 738 | using \<open>summable (f o g)\<close> | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 739 | by(rule setsum_le_suminf)(simp add: pos) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 740 |     finally show "setsum f {..<n} \<le> suminf (f \<circ> g)" .
 | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 741 | qed | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 742 | with le show "suminf (f \<circ> g) = suminf f" by(rule antisym) | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 743 | qed | 
| 
d885cff91200
add lemma following a proof suggestion by Joachim Breitner
 Andreas Lochbihler parents: 
59000diff
changeset | 744 | |
| 14416 | 745 | end |