|
| 1 | +/- |
| 2 | +Copyright (c) 2017 Johannes Hölzl. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Johannes Hölzl |
| 5 | +
|
| 6 | +! This file was ported from Lean 3 source module topology.algebra.infinite_sum.order |
| 7 | +! leanprover-community/mathlib commit 32253a1a1071173b33dc7d6a218cf722c6feb514 |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.Algebra.Order.Archimedean |
| 12 | +import Mathlib.Topology.Algebra.InfiniteSum.Basic |
| 13 | +import Mathlib.Topology.Algebra.Order.Field |
| 14 | +import Mathlib.Topology.Algebra.Order.MonotoneConvergence |
| 15 | + |
| 16 | +/-! |
| 17 | +# Infinite sum in an order |
| 18 | +
|
| 19 | +This file provides lemmas about the interaction of infinite sums and order operations. |
| 20 | +-/ |
| 21 | + |
| 22 | + |
| 23 | +open Finset Filter Function BigOperators |
| 24 | +open scoped Classical |
| 25 | + |
| 26 | +variable {ι κ α : Type _} |
| 27 | + |
| 28 | +section Preorder |
| 29 | + |
| 30 | +variable [Preorder α] [AddCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] [T2Space α] |
| 31 | + {f : ℕ → α} {c : α} |
| 32 | + |
| 33 | +theorem tsum_le_of_sum_range_le (hf : Summable f) (h : ∀ n, (∑ i in range n, f i) ≤ c) : |
| 34 | + (∑' n, f n) ≤ c := |
| 35 | + let ⟨_l, hl⟩ := hf |
| 36 | + hl.tsum_eq.symm ▸ le_of_tendsto' hl.tendsto_sum_nat h |
| 37 | +#align tsum_le_of_sum_range_le tsum_le_of_sum_range_le |
| 38 | + |
| 39 | +end Preorder |
| 40 | + |
| 41 | +section OrderedAddCommMonoid |
| 42 | + |
| 43 | +variable [OrderedAddCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f g : ι → α} |
| 44 | + {a a₁ a₂ : α} |
| 45 | + |
| 46 | +theorem hasSum_le (h : ∀ i, f i ≤ g i) (hf : HasSum f a₁) (hg : HasSum g a₂) : a₁ ≤ a₂ := |
| 47 | + le_of_tendsto_of_tendsto' hf hg fun _ => sum_le_sum fun i _ => h i |
| 48 | +#align has_sum_le hasSum_le |
| 49 | + |
| 50 | +@[mono] |
| 51 | +theorem hasSum_mono (hf : HasSum f a₁) (hg : HasSum g a₂) (h : f ≤ g) : a₁ ≤ a₂ := |
| 52 | + hasSum_le h hf hg |
| 53 | +#align has_sum_mono hasSum_mono |
| 54 | + |
| 55 | +theorem hasSum_le_of_sum_le (hf : HasSum f a) (h : ∀ s, (∑ i in s, f i) ≤ a₂) : a ≤ a₂ := |
| 56 | + le_of_tendsto' hf h |
| 57 | +#align has_sum_le_of_sum_le hasSum_le_of_sum_le |
| 58 | + |
| 59 | +theorem le_hasSum_of_le_sum (hf : HasSum f a) (h : ∀ s, a₂ ≤ ∑ i in s, f i) : a₂ ≤ a := |
| 60 | + ge_of_tendsto' hf h |
| 61 | +#align le_has_sum_of_le_sum le_hasSum_of_le_sum |
| 62 | + |
| 63 | +theorem hasSum_le_inj {g : κ → α} (e : ι → κ) (he : Injective e) |
| 64 | + (hs : ∀ c, c ∉ Set.range e → 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : HasSum f a₁) |
| 65 | + (hg : HasSum g a₂) : a₁ ≤ a₂ := by |
| 66 | + rw [← hasSum_extend_zero he] at hf |
| 67 | + refine hasSum_le (fun c => ?_) hf hg |
| 68 | + obtain ⟨i, rfl⟩ | h := em (c ∈ Set.range e) |
| 69 | + · rw [he.extend_apply] |
| 70 | + exact h _ |
| 71 | + · rw [extend_apply' _ _ _ h] |
| 72 | + exact hs _ h |
| 73 | +#align has_sum_le_inj hasSum_le_inj |
| 74 | + |
| 75 | +theorem tsum_le_tsum_of_inj {g : κ → α} (e : ι → κ) (he : Injective e) |
| 76 | + (hs : ∀ c, c ∉ Set.range e → 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : Summable f) |
| 77 | + (hg : Summable g) : tsum f ≤ tsum g := |
| 78 | + hasSum_le_inj _ he hs h hf.hasSum hg.hasSum |
| 79 | +#align tsum_le_tsum_of_inj tsum_le_tsum_of_inj |
| 80 | + |
| 81 | +theorem sum_le_hasSum (s : Finset ι) (hs : ∀ i, i ∉ s → 0 ≤ f i) (hf : HasSum f a) : |
| 82 | + (∑ i in s, f i) ≤ a := |
| 83 | + ge_of_tendsto hf (eventually_atTop.2 |
| 84 | + ⟨s, fun _t hst => sum_le_sum_of_subset_of_nonneg hst fun i _ hbs => hs i hbs⟩) |
| 85 | +#align sum_le_has_sum sum_le_hasSum |
| 86 | + |
| 87 | +theorem isLUB_hasSum (h : ∀ i, 0 ≤ f i) (hf : HasSum f a) : |
| 88 | + IsLUB (Set.range fun s => ∑ i in s, f i) a := |
| 89 | + isLUB_of_tendsto_atTop (Finset.sum_mono_set_of_nonneg h) hf |
| 90 | +#align is_lub_has_sum isLUB_hasSum |
| 91 | + |
| 92 | +theorem le_hasSum (hf : HasSum f a) (i : ι) (hb : ∀ j, j ≠ i → 0 ≤ f j) : f i ≤ a := |
| 93 | + calc |
| 94 | + f i = ∑ i in {i}, f i := Finset.sum_singleton.symm |
| 95 | + _ ≤ a := sum_le_hasSum _ (by simpa) hf |
| 96 | + |
| 97 | +#align le_has_sum le_hasSum |
| 98 | + |
| 99 | +theorem sum_le_tsum {f : ι → α} (s : Finset ι) (hs : ∀ i, i ∉ s → 0 ≤ f i) (hf : Summable f) : |
| 100 | + (∑ i in s, f i) ≤ ∑' i, f i := |
| 101 | + sum_le_hasSum s hs hf.hasSum |
| 102 | +#align sum_le_tsum sum_le_tsum |
| 103 | + |
| 104 | +theorem le_tsum (hf : Summable f) (i : ι) (hb : ∀ j, j ≠ i → 0 ≤ f j) : f i ≤ ∑' i, f i := |
| 105 | + le_hasSum hf.hasSum i hb |
| 106 | +#align le_tsum le_tsum |
| 107 | + |
| 108 | +theorem tsum_le_tsum (h : ∀ i, f i ≤ g i) (hf : Summable f) (hg : Summable g) : |
| 109 | + (∑' i, f i) ≤ ∑' i, g i := |
| 110 | + hasSum_le h hf.hasSum hg.hasSum |
| 111 | +#align tsum_le_tsum tsum_le_tsum |
| 112 | + |
| 113 | +@[mono] |
| 114 | +theorem tsum_mono (hf : Summable f) (hg : Summable g) (h : f ≤ g) : (∑' n, f n) ≤ ∑' n, g n := |
| 115 | + tsum_le_tsum h hf hg |
| 116 | +#align tsum_mono tsum_mono |
| 117 | + |
| 118 | +theorem tsum_le_of_sum_le (hf : Summable f) (h : ∀ s, (∑ i in s, f i) ≤ a₂) : (∑' i, f i) ≤ a₂ := |
| 119 | + hasSum_le_of_sum_le hf.hasSum h |
| 120 | +#align tsum_le_of_sum_le tsum_le_of_sum_le |
| 121 | + |
| 122 | +theorem tsum_le_of_sum_le' (ha₂ : 0 ≤ a₂) (h : ∀ s, (∑ i in s, f i) ≤ a₂) : (∑' i, f i) ≤ a₂ := by |
| 123 | + by_cases hf : Summable f |
| 124 | + · exact tsum_le_of_sum_le hf h |
| 125 | + · rw [tsum_eq_zero_of_not_summable hf] |
| 126 | + exact ha₂ |
| 127 | +#align tsum_le_of_sum_le' tsum_le_of_sum_le' |
| 128 | + |
| 129 | +theorem HasSum.nonneg (h : ∀ i, 0 ≤ g i) (ha : HasSum g a) : 0 ≤ a := |
| 130 | + hasSum_le h hasSum_zero ha |
| 131 | +#align has_sum.nonneg HasSum.nonneg |
| 132 | + |
| 133 | +theorem HasSum.nonpos (h : ∀ i, g i ≤ 0) (ha : HasSum g a) : a ≤ 0 := |
| 134 | + hasSum_le h ha hasSum_zero |
| 135 | +#align has_sum.nonpos HasSum.nonpos |
| 136 | + |
| 137 | +theorem tsum_nonneg (h : ∀ i, 0 ≤ g i) : 0 ≤ ∑' i, g i := by |
| 138 | + by_cases hg : Summable g |
| 139 | + · exact hg.hasSum.nonneg h |
| 140 | + · rw [tsum_eq_zero_of_not_summable hg] |
| 141 | +#align tsum_nonneg tsum_nonneg |
| 142 | + |
| 143 | +theorem tsum_nonpos (h : ∀ i, f i ≤ 0) : (∑' i, f i) ≤ 0 := by |
| 144 | + by_cases hf : Summable f |
| 145 | + · exact hf.hasSum.nonpos h |
| 146 | + · rw [tsum_eq_zero_of_not_summable hf] |
| 147 | +#align tsum_nonpos tsum_nonpos |
| 148 | + |
| 149 | +-- porting note: generalized from `OrderedAddCommGroup` to `OrderedAddCommMonoid` |
| 150 | +theorem hasSum_zero_iff_of_nonneg (hf : ∀ i, 0 ≤ f i) : HasSum f 0 ↔ f = 0 := by |
| 151 | + refine' ⟨fun hf' => _, _⟩ |
| 152 | + · ext i |
| 153 | + exact (hf i).antisymm' (le_hasSum hf' _ fun j _ => hf j) |
| 154 | + · rintro rfl |
| 155 | + exact hasSum_zero |
| 156 | +#align has_sum_zero_iff_of_nonneg hasSum_zero_iff_of_nonneg |
| 157 | + |
| 158 | +end OrderedAddCommMonoid |
| 159 | + |
| 160 | +section OrderedAddCommGroup |
| 161 | + |
| 162 | +variable [OrderedAddCommGroup α] [TopologicalSpace α] [TopologicalAddGroup α] |
| 163 | + [OrderClosedTopology α] {f g : ι → α} {a₁ a₂ : α} {i : ι} |
| 164 | + |
| 165 | +theorem hasSum_lt (h : f ≤ g) (hi : f i < g i) (hf : HasSum f a₁) (hg : HasSum g a₂) : a₁ < a₂ := by |
| 166 | + have : update f i 0 ≤ update g i 0 := update_le_update_iff.mpr ⟨rfl.le, fun i _ => h i⟩ |
| 167 | + have : 0 - f i + a₁ ≤ 0 - g i + a₂ := hasSum_le this (hf.update i 0) (hg.update i 0) |
| 168 | + simpa only [zero_sub, add_neg_cancel_left] using add_lt_add_of_lt_of_le hi this |
| 169 | +#align has_sum_lt hasSum_lt |
| 170 | + |
| 171 | +@[mono] |
| 172 | +theorem hasSum_strict_mono (hf : HasSum f a₁) (hg : HasSum g a₂) (h : f < g) : a₁ < a₂ := |
| 173 | + let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h |
| 174 | + hasSum_lt hle hi hf hg |
| 175 | +#align has_sum_strict_mono hasSum_strict_mono |
| 176 | + |
| 177 | +theorem tsum_lt_tsum (h : f ≤ g) (hi : f i < g i) (hf : Summable f) (hg : Summable g) : |
| 178 | + (∑' n, f n) < ∑' n, g n := |
| 179 | + hasSum_lt h hi hf.hasSum hg.hasSum |
| 180 | +#align tsum_lt_tsum tsum_lt_tsum |
| 181 | + |
| 182 | +@[mono] |
| 183 | +theorem tsum_strict_mono (hf : Summable f) (hg : Summable g) (h : f < g) : |
| 184 | + (∑' n, f n) < ∑' n, g n := |
| 185 | + let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h |
| 186 | + tsum_lt_tsum hle hi hf hg |
| 187 | +#align tsum_strict_mono tsum_strict_mono |
| 188 | + |
| 189 | +theorem tsum_pos (hsum : Summable g) (hg : ∀ i, 0 ≤ g i) (i : ι) (hi : 0 < g i) : |
| 190 | + 0 < ∑' i, g i := by |
| 191 | + rw [← tsum_zero] |
| 192 | + exact tsum_lt_tsum hg hi summable_zero hsum |
| 193 | +#align tsum_pos tsum_pos |
| 194 | + |
| 195 | +end OrderedAddCommGroup |
| 196 | + |
| 197 | +section CanonicallyOrderedAddMonoid |
| 198 | + |
| 199 | +variable [CanonicallyOrderedAddMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f : ι → α} |
| 200 | + {a : α} |
| 201 | + |
| 202 | +theorem le_has_sum' (hf : HasSum f a) (i : ι) : f i ≤ a := |
| 203 | + le_hasSum hf i fun _ _ => zero_le _ |
| 204 | +#align le_has_sum' le_has_sum' |
| 205 | + |
| 206 | +theorem le_tsum' (hf : Summable f) (i : ι) : f i ≤ ∑' i, f i := |
| 207 | + le_tsum hf i fun _ _ => zero_le _ |
| 208 | +#align le_tsum' le_tsum' |
| 209 | + |
| 210 | +theorem hasSum_zero_iff : HasSum f 0 ↔ ∀ x, f x = 0 := |
| 211 | + (hasSum_zero_iff_of_nonneg fun _ => zero_le _).trans funext_iff |
| 212 | +#align has_sum_zero_iff hasSum_zero_iff |
| 213 | + |
| 214 | +theorem tsum_eq_zero_iff (hf : Summable f) : (∑' i, f i) = 0 ↔ ∀ x, f x = 0 := by |
| 215 | + rw [← hasSum_zero_iff, hf.hasSum_iff] |
| 216 | +#align tsum_eq_zero_iff tsum_eq_zero_iff |
| 217 | + |
| 218 | +theorem tsum_ne_zero_iff (hf : Summable f) : (∑' i, f i) ≠ 0 ↔ ∃ x, f x ≠ 0 := by |
| 219 | + rw [Ne.def, tsum_eq_zero_iff hf, not_forall] |
| 220 | +#align tsum_ne_zero_iff tsum_ne_zero_iff |
| 221 | + |
| 222 | +theorem isLUB_has_sum' (hf : HasSum f a) : IsLUB (Set.range fun s => ∑ i in s, f i) a := |
| 223 | + isLUB_of_tendsto_atTop (Finset.sum_mono_set f) hf |
| 224 | +#align is_lub_has_sum' isLUB_has_sum' |
| 225 | + |
| 226 | +end CanonicallyOrderedAddMonoid |
| 227 | + |
| 228 | +section LinearOrder |
| 229 | + |
| 230 | +/-! |
| 231 | +For infinite sums taking values in a linearly ordered monoid, the existence of a least upper |
| 232 | +bound for the finite sums is a criterion for summability. |
| 233 | +
|
| 234 | +This criterion is useful when applied in a linearly ordered monoid which is also a complete or |
| 235 | +conditionally complete linear order, such as `ℝ`, `ℝ≥0`, `ℝ≥0∞`, because it is then easy to check |
| 236 | +the existence of a least upper bound. |
| 237 | +-/ |
| 238 | + |
| 239 | +theorem hasSum_of_isLUB_of_nonneg [LinearOrderedAddCommMonoid α] [TopologicalSpace α] |
| 240 | + [OrderTopology α] {f : ι → α} (i : α) (h : ∀ i, 0 ≤ f i) |
| 241 | + (hf : IsLUB (Set.range fun s => ∑ i in s, f i) i) : HasSum f i := |
| 242 | + tendsto_atTop_isLUB (Finset.sum_mono_set_of_nonneg h) hf |
| 243 | +#align has_sum_of_is_lub_of_nonneg hasSum_of_isLUB_of_nonneg |
| 244 | + |
| 245 | +theorem hasSum_of_isLUB [CanonicallyLinearOrderedAddMonoid α] [TopologicalSpace α] [OrderTopology α] |
| 246 | + {f : ι → α} (b : α) (hf : IsLUB (Set.range fun s => ∑ i in s, f i) b) : HasSum f b := |
| 247 | + tendsto_atTop_isLUB (Finset.sum_mono_set f) hf |
| 248 | +#align has_sum_of_is_lub hasSum_of_isLUB |
| 249 | + |
| 250 | +theorem summable_abs_iff [LinearOrderedAddCommGroup α] [UniformSpace α] [UniformAddGroup α] |
| 251 | + [CompleteSpace α] {f : ι → α} : (Summable fun x => |f x|) ↔ Summable f := |
| 252 | + let s := { x | 0 ≤ f x } |
| 253 | + have h1 : ∀ x : s, |f x| = f x := fun x => abs_of_nonneg x.2 |
| 254 | + have h2 : ∀ x : ↑(sᶜ), |f x| = -f x := fun x => abs_of_neg (not_le.1 x.2) |
| 255 | + calc (Summable fun x => |f x|) ↔ |
| 256 | + (Summable fun x : s => |f x|) ∧ Summable fun x : ↑(sᶜ) => |f x| := |
| 257 | + summable_subtype_and_compl.symm |
| 258 | + _ ↔ (Summable fun x : s => f x) ∧ Summable fun x : ↑(sᶜ) => -f x := by simp only [h1, h2] |
| 259 | + _ ↔ Summable f := by simp only [summable_neg_iff, summable_subtype_and_compl] |
| 260 | +#align summable_abs_iff summable_abs_iff |
| 261 | + |
| 262 | +alias summable_abs_iff ↔ Summable.of_abs Summable.abs |
| 263 | +#align summable.of_abs Summable.of_abs |
| 264 | +#align summable.abs Summable.abs |
| 265 | + |
| 266 | +theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α] |
| 267 | + [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) : |
| 268 | + Finite ι := by |
| 269 | + have H : ∀ s : Finset ι, s.card • b ≤ ∑' _i : ι, b := fun s => by |
| 270 | + simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum |
| 271 | + obtain ⟨n, hn⟩ := Archimedean.arch (∑' _i : ι, b) hb |
| 272 | + have : ∀ s : Finset ι, s.card ≤ n := fun s => by |
| 273 | + simpa [nsmul_le_nsmul_iff hb] using (H s).trans hn |
| 274 | + have : Fintype ι := fintypeOfFinsetCardLe n this |
| 275 | + infer_instance |
| 276 | + |
| 277 | +theorem Set.Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] |
| 278 | + [Archimedean α] [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) : |
| 279 | + (Set.univ : Set ι).Finite := |
| 280 | + finite_univ_iff.2 <| .of_summable_const hb hf |
| 281 | +#align finite_of_summable_const Set.Finite.of_summable_const |
| 282 | + |
| 283 | +end LinearOrder |
| 284 | + |
| 285 | +theorem Summable.tendsto_atTop_of_pos [LinearOrderedField α] [TopologicalSpace α] [OrderTopology α] |
| 286 | + {f : ℕ → α} (hf : Summable f⁻¹) (hf' : ∀ n, 0 < f n) : Tendsto f atTop atTop := |
| 287 | + inv_inv f ▸ Filter.Tendsto.inv_tendsto_zero <| |
| 288 | + tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hf.tendsto_atTop_zero <| |
| 289 | + eventually_of_forall fun _ => inv_pos.2 (hf' _) |
| 290 | +#align summable.tendsto_top_of_pos Summable.tendsto_atTop_of_pos |
0 commit comments