@@ -20,9 +20,8 @@ This file provides lemmas about the interaction of infinite sums and order opera
2020-/
2121
2222
23- open Finset Filter Function
24-
25- open BigOperators Classical
23+ open Finset Filter Function BigOperators
24+ open scoped Classical
2625
2726variable {ι κ α : Type _}
2827
@@ -33,7 +32,7 @@ variable [Preorder α] [AddCommMonoid α] [TopologicalSpace α] [OrderClosedTopo
3332
3433theorem tsum_le_of_sum_range_le (hf : Summable f) (h : ∀ n, (∑ i in range n, f i) ≤ c) :
3534 (∑' n, f n) ≤ c :=
36- let ⟨l , hl⟩ := hf
35+ let ⟨_l , hl⟩ := hf
3736 hl.tsum_eq.symm ▸ le_of_tendsto' hl.tendsto_sum_nat h
3837#align tsum_le_of_sum_range_le tsum_le_of_sum_range_le
3938
@@ -45,7 +44,7 @@ variable [OrderedAddCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α
4544 {a a₁ a₂ : α}
4645
4746theorem hasSum_le (h : ∀ i, f i ≤ g i) (hf : HasSum f a₁) (hg : HasSum g a₂) : a₁ ≤ a₂ :=
48- le_of_tendsto_of_tendsto' hf hg fun s => sum_le_sum fun i _ => h i
47+ le_of_tendsto_of_tendsto' hf hg fun _ => sum_le_sum fun i _ => h i
4948#align has_sum_le hasSum_le
5049
5150@[mono]
@@ -61,77 +60,54 @@ theorem le_hasSum_of_le_sum (hf : HasSum f a) (h : ∀ s, a₂ ≤ ∑ i in s, f
6160 ge_of_tendsto' hf h
6261#align le_has_sum_of_le_sum le_hasSum_of_le_sum
6362
64- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (c «expr ∉ » set.range[ set.range ] e) -/
6563theorem hasSum_le_inj {g : κ → α} (e : ι → κ) (he : Injective e)
66- (hs : ∀ (c) (_ : c ∉ Set.range e), 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : HasSum f a₁)
64+ (hs : ∀ c, c ∉ Set.range e → 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : HasSum f a₁)
6765 (hg : HasSum g a₂) : a₁ ≤ a₂ := by
68- have : HasSum (fun c => (partialInv e c).casesOn' 0 f) a₁ :=
69- by
70- refine'
71- (hasSum_iff_hasSum_of_ne_zero_bij (e ∘ coe) (fun c₁ c₂ hc => he hc) (fun c hc => _) _).2 hf
72- · rw [mem_support] at hc
73- cases' eq : partial_inv e c with i <;> rw [Eq] at hc
74- · contradiction
75- · rw [partial_inv_of_injective he] at eq
76- exact ⟨⟨i, hc⟩, Eq⟩
77- · rintro c
78- simp [partial_inv_left he, Option.casesOn']
79- refine' hasSum_le (fun c => _) this hg
66+ rw [← hasSum_extend_zero he] at hf
67+ refine hasSum_le (fun c => ?_) hf hg
8068 obtain ⟨i, rfl⟩ | h := em (c ∈ Set.range e)
81- · rw [partial_inv_left he, Option.casesOn' ]
69+ · rw [he.extend_apply ]
8270 exact h _
83- · have : partial_inv e c = none := dif_neg h
84- rw [this, Option.casesOn']
71+ · rw [extend_apply' _ _ _ h]
8572 exact hs _ h
8673#align has_sum_le_inj hasSum_le_inj
8774
88- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (c «expr ∉ » set.range[ set.range ] e) -/
8975theorem tsum_le_tsum_of_inj {g : κ → α} (e : ι → κ) (he : Injective e)
90- (hs : ∀ (c) (_ : c ∉ Set.range e), 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : Summable f)
76+ (hs : ∀ c, c ∉ Set.range e → 0 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : Summable f)
9177 (hg : Summable g) : tsum f ≤ tsum g :=
92- hasSum_le_inj _ he hs h hf.HasSum hg.HasSum
78+ hasSum_le_inj _ he hs h hf.hasSum hg.hasSum
9379#align tsum_le_tsum_of_inj tsum_le_tsum_of_inj
9480
95- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (i «expr ∉ » s) -/
96- theorem sum_le_hasSum (s : Finset ι) (hs : ∀ (i) (_ : i ∉ s), 0 ≤ f i) (hf : HasSum f a) :
81+ theorem sum_le_hasSum (s : Finset ι) (hs : ∀ i, i ∉ s → 0 ≤ f i) (hf : HasSum f a) :
9782 (∑ i in s, f i) ≤ a :=
98- ge_of_tendsto hf
99- (eventually_atTop.2
100- ⟨s, fun t hst => sum_le_sum_of_subset_of_nonneg hst fun i hbt hbs => hs i hbs⟩)
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⟩)
10185#align sum_le_has_sum sum_le_hasSum
10286
10387theorem isLUB_hasSum (h : ∀ i, 0 ≤ f i) (hf : HasSum f a) :
10488 IsLUB (Set.range fun s => ∑ i in s, f i) a :=
10589 isLUB_of_tendsto_atTop (Finset.sum_mono_set_of_nonneg h) hf
10690#align is_lub_has_sum isLUB_hasSum
10791
108- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (b' «expr ≠ » i) -/
109- theorem le_hasSum (hf : HasSum f a) (i : ι) (hb : ∀ (b') (_ : b' ≠ i), 0 ≤ f b') : f i ≤ a :=
92+ theorem le_hasSum (hf : HasSum f a) (i : ι) (hb : ∀ j, j ≠ i → 0 ≤ f j) : f i ≤ a :=
11093 calc
11194 f i = ∑ i in {i}, f i := Finset.sum_singleton.symm
112- _ ≤ a :=
113- sum_le_hasSum _
114- (by
115- convert hb
116- simp)
117- hf
95+ _ ≤ a := sum_le_hasSum _ (by simpa) hf
11896
11997#align le_has_sum le_hasSum
12098
121- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (i «expr ∉ » s) -/
122- theorem sum_le_tsum {f : ι → α} (s : Finset ι) (hs : ∀ (i) (_ : i ∉ s), 0 ≤ f i) (hf : Summable f) :
99+ theorem sum_le_tsum {f : ι → α} (s : Finset ι) (hs : ∀ i, i ∉ s → 0 ≤ f i) (hf : Summable f) :
123100 (∑ i in s, f i) ≤ ∑' i, f i :=
124- sum_le_hasSum s hs hf.HasSum
101+ sum_le_hasSum s hs hf.hasSum
125102#align sum_le_tsum sum_le_tsum
126103
127- /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (b' «expr ≠ » i) -/
128- theorem le_tsum (hf : Summable f) (i : ι) (hb : ∀ (b') (_ : b' ≠ i), 0 ≤ f b') : f i ≤ ∑' i, f i :=
129- le_hasSum (Summable.hasSum hf) i hb
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
130106#align le_tsum le_tsum
131107
132108theorem tsum_le_tsum (h : ∀ i, f i ≤ g i) (hf : Summable f) (hg : Summable g) :
133109 (∑' i, f i) ≤ ∑' i, g i :=
134- hasSum_le h hf.HasSum hg.HasSum
110+ hasSum_le h hf.hasSum hg.hasSum
135111#align tsum_le_tsum tsum_le_tsum
136112
137113@[mono]
@@ -140,7 +116,7 @@ theorem tsum_mono (hf : Summable f) (hg : Summable g) (h : f ≤ g) : (∑' n, f
140116#align tsum_mono tsum_mono
141117
142118theorem tsum_le_of_sum_le (hf : Summable f) (h : ∀ s, (∑ i in s, f i) ≤ a₂) : (∑' i, f i) ≤ a₂ :=
143- hasSum_le_of_sum_le hf.HasSum h
119+ hasSum_le_of_sum_le hf.hasSum h
144120#align tsum_le_of_sum_le tsum_le_of_sum_le
145121
146122theorem tsum_le_of_sum_le' (ha₂ : 0 ≤ a₂) (h : ∀ s, (∑ i in s, f i) ≤ a₂) : (∑' i, f i) ≤ a₂ := by
@@ -160,16 +136,25 @@ theorem HasSum.nonpos (h : ∀ i, g i ≤ 0) (ha : HasSum g a) : a ≤ 0 :=
160136
161137theorem tsum_nonneg (h : ∀ i, 0 ≤ g i) : 0 ≤ ∑' i, g i := by
162138 by_cases hg : Summable g
163- · exact hg.has_sum .nonneg h
164- · simp [tsum_eq_zero_of_not_summable hg]
139+ · exact hg.hasSum .nonneg h
140+ · rw [tsum_eq_zero_of_not_summable hg]
165141#align tsum_nonneg tsum_nonneg
166142
167143theorem tsum_nonpos (h : ∀ i, f i ≤ 0 ) : (∑' i, f i) ≤ 0 := by
168144 by_cases hf : Summable f
169- · exact hf.has_sum .nonpos h
170- · simp [tsum_eq_zero_of_not_summable hf]
145+ · exact hf.hasSum .nonpos h
146+ · rw [tsum_eq_zero_of_not_summable hf]
171147#align tsum_nonpos tsum_nonpos
172148
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+
173158end OrderedAddCommMonoid
174159
175160section OrderedAddCommGroup
@@ -185,37 +170,28 @@ theorem hasSum_lt (h : f ≤ g) (hi : f i < g i) (hf : HasSum f a₁) (hg : HasS
185170
186171@[mono]
187172theorem hasSum_strict_mono (hf : HasSum f a₁) (hg : HasSum g a₂) (h : f < g) : a₁ < a₂ :=
188- let ⟨hle, i , hi⟩ := Pi.lt_def.mp h
173+ let ⟨hle, _i , hi⟩ := Pi.lt_def.mp h
189174 hasSum_lt hle hi hf hg
190175#align has_sum_strict_mono hasSum_strict_mono
191176
192177theorem tsum_lt_tsum (h : f ≤ g) (hi : f i < g i) (hf : Summable f) (hg : Summable g) :
193178 (∑' n, f n) < ∑' n, g n :=
194- hasSum_lt h hi hf.HasSum hg.HasSum
179+ hasSum_lt h hi hf.hasSum hg.hasSum
195180#align tsum_lt_tsum tsum_lt_tsum
196181
197182@[mono]
198183theorem tsum_strict_mono (hf : Summable f) (hg : Summable g) (h : f < g) :
199184 (∑' n, f n) < ∑' n, g n :=
200- let ⟨hle, i , hi⟩ := Pi.lt_def.mp h
185+ let ⟨hle, _i , hi⟩ := Pi.lt_def.mp h
201186 tsum_lt_tsum hle hi hf hg
202187#align tsum_strict_mono tsum_strict_mono
203188
204- theorem tsum_pos (hsum : Summable g) (hg : ∀ i, 0 ≤ g i) (i : ι) (hi : 0 < g i) : 0 < ∑' i, g i :=
205- by
189+ theorem tsum_pos (hsum : Summable g) (hg : ∀ i, 0 ≤ g i) (i : ι) (hi : 0 < g i) :
190+ 0 < ∑' i, g i := by
206191 rw [← tsum_zero]
207192 exact tsum_lt_tsum hg hi summable_zero hsum
208193#align tsum_pos tsum_pos
209194
210- theorem hasSum_zero_iff_of_nonneg (hf : ∀ i, 0 ≤ f i) : HasSum f 0 ↔ f = 0 := by
211- refine' ⟨fun hf' => _, _⟩
212- · ext i
213- refine' (hf i).eq_of_not_gt fun hi => _
214- simpa using hasSum_lt hf hi hasSum_zero hf'
215- · rintro rfl
216- exact hasSum_zero
217- #align has_sum_zero_iff_of_nonneg hasSum_zero_iff_of_nonneg
218-
219195end OrderedAddCommGroup
220196
221197section CanonicallyOrderedAddMonoid
@@ -231,16 +207,12 @@ theorem le_tsum' (hf : Summable f) (i : ι) : f i ≤ ∑' i, f i :=
231207 le_tsum hf i fun _ _ => zero_le _
232208#align le_tsum' le_tsum'
233209
234- theorem hasSum_zero_iff : HasSum f 0 ↔ ∀ x, f x = 0 := by
235- refine' ⟨_, fun h => _⟩
236- · contrapose!
237- exact fun ⟨x, hx⟩ h => hx (nonpos_iff_eq_zero.1 <| le_has_sum' h x)
238- · convert hasSum_zero
239- exact funext h
210+ theorem hasSum_zero_iff : HasSum f 0 ↔ ∀ x, f x = 0 :=
211+ (hasSum_zero_iff_of_nonneg fun _ => zero_le _).trans funext_iff
240212#align has_sum_zero_iff hasSum_zero_iff
241213
242214theorem tsum_eq_zero_iff (hf : Summable f) : (∑' i, f i) = 0 ↔ ∀ x, f x = 0 := by
243- rw [← hasSum_zero_iff, hf.has_sum_iff ]
215+ rw [← hasSum_zero_iff, hf.hasSum_iff ]
244216#align tsum_eq_zero_iff tsum_eq_zero_iff
245217
246218theorem tsum_ne_zero_iff (hf : Summable f) : (∑' i, f i) ≠ 0 ↔ ∃ x, f x ≠ 0 := by
@@ -264,7 +236,6 @@ conditionally complete linear order, such as `ℝ`, `ℝ≥0`, `ℝ≥0∞`, bec
264236the existence of a least upper bound.
265237-/
266238
267-
268239theorem hasSum_of_isLUB_of_nonneg [LinearOrderedAddCommMonoid α] [TopologicalSpace α]
269240 [OrderTopology α] {f : ι → α} (i : α) (h : ∀ i, 0 ≤ f i)
270241 (hf : IsLUB (Set.range fun s => ∑ i in s, f i) i) : HasSum f i :=
@@ -279,47 +250,45 @@ theorem hasSum_of_isLUB [CanonicallyLinearOrderedAddMonoid α] [TopologicalSpace
279250theorem summable_abs_iff [LinearOrderedAddCommGroup α] [UniformSpace α] [UniformAddGroup α]
280251 [CompleteSpace α] {f : ι → α} : (Summable fun x => |f x|) ↔ Summable f :=
281252 have h1 : ∀ x : { x | 0 ≤ f x }, |f x| = f x := fun x => abs_of_nonneg x.2
282- have h2 : ∀ x : { x | 0 ≤ f x }ᶜ, |f x| = -f x := fun x => abs_of_neg (not_le.1 x.2 )
283- calc
284- (Summable fun x => |f x|) ↔
285- (Summable fun x : { x | 0 ≤ f x } => |f x|) ∧ Summable fun x : { x | 0 ≤ f x }ᶜ => |f x| :=
286- summable_subtype_and_compl.symm
287- _ ↔ (Summable fun x : { x | 0 ≤ f x } => f x) ∧ Summable fun x : { x | 0 ≤ f x }ᶜ => -f x := by
253+ have h2 : ∀ x : ↑({ x | 0 ≤ f x }ᶜ), |f x| = -f x := fun x => abs_of_neg (not_le.1 x.2 )
254+ calc (Summable fun x => |f x|) ↔
255+ (Summable fun x : { x | 0 ≤ f x } => |f x|) ∧ Summable fun x : ↑({ x | 0 ≤ f x }ᶜ) => |f x| :=
256+ summable_subtype_and_compl.symm
257+ _ ↔ (Summable fun x : { x | 0 ≤ f x } => f x) ∧ Summable fun x : ↑({ x | 0 ≤ f x }ᶜ) => -f x := by
288258 simp only [h1, h2]
289- _ ↔ _ := by simp only [summable_neg_iff, summable_subtype_and_compl]
290-
259+ _ ↔ _ := by simp only [summable_neg_iff, summable_subtype_and_compl]
291260#align summable_abs_iff summable_abs_iff
292261
293262alias summable_abs_iff ↔ Summable.of_abs Summable.abs
294263#align summable.of_abs Summable.of_abs
295264#align summable.abs Summable.abs
296265
297- --TODO: Change the conclusion to `finite ι`
298- theorem finite_of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
299- [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun i : ι => b) :
300- (Set.univ : Set ι).Finite := by
301- have H : ∀ s : Finset ι, s.card • b ≤ ∑' i : ι, b :=
302- by
303- intro s
304- simpa using sum_le_hasSum s (fun a ha => hb.le) hf.has_sum
305- obtain ⟨n, hn⟩ := Archimedean.arch (∑' i : ι, b) hb
306- have : ∀ s : Finset ι, s.card ≤ n := by
307- intro s
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
308273 simpa [nsmul_le_nsmul_iff hb] using (H s).trans hn
309- haveI : Fintype ι := fintypeOfFinsetCardLe n this
310- exact Set.finite_univ
311- #align finite_of_summable_const finite_of_summable_const
274+ have : Fintype ι := fintypeOfFinsetCardLe n this
275+ infer_instance
276+
277+ theorem Set.Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
278+ [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
312282
313283end LinearOrder
314284
315- theorem Summable.tendsto_top_of_pos [LinearOrderedField α] [TopologicalSpace α] [OrderTopology α]
285+ theorem Summable.tendsto_atTop_of_pos [LinearOrderedField α] [TopologicalSpace α] [OrderTopology α]
316286 {f : ℕ → α} (hf : Summable f⁻¹) (hf' : ∀ n, 0 < f n) : Tendsto f atTop atTop := by
317287 rw [← inv_inv f]
318288 apply Filter.Tendsto.inv_tendsto_zero
319289 apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (Summable.tendsto_atTop_zero hf)
320290 rw [eventually_iff_exists_mem]
321- refine' ⟨Set.Ioi 0 , Ioi_mem_at_top _, fun _ _ => _⟩
291+ refine' ⟨Set.Ioi 0 , Ioi_mem_atTop _, fun _ _ => _⟩
322292 rw [Set.mem_Ioi, inv_eq_one_div, one_div, Pi.inv_apply, _root_.inv_pos]
323293 exact hf' _
324- #align summable.tendsto_top_of_pos Summable.tendsto_top_of_pos
325-
294+ #align summable.tendsto_top_of_pos Summable.tendsto_atTop_of_pos
0 commit comments