l3lab/ntp-mathlib huggingface dataset:
@[norm_cast]
protected theorem hasSum_coe {f : α → ℝ≥0} {r : ℝ≥0} :
    HasSum (fun a => (f a : ℝ≥0∞)) ↑r ↔ HasSum f r := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : α → ℝ≥0
r : ℝ≥0
⊢ HasSum (fun a => ↑(f a)) ↑r ↔ HasSum f r

Next tactic:
simp only [HasSum, ← coe_finset_sum, tendsto_coe]
protected theorem coe_tsum {f : α → ℝ≥0} : Summable f → ↑(tsum f) = ∑' a, (f a : ℝ≥0∞)
  | ⟨r, hr⟩ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : α → ℝ≥0
r : ℝ≥0
hr : HasSum f r
⊢ ↑(tsum f) = ∑' (a : α), ↑(f a)

Next tactic:
rw [hr.tsum_eq, ENNReal.tsum_coe_eq hr]
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : β → ℝ≥0
⊢ ∑' (b : β), ↑(f b) ≠ ⊤ ↔ Summable f

Next tactic:
refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : β → ℝ≥0
h : ∑' (b : β), ↑(f b) ≠ ⊤
⊢ Summable f

Next tactic:
lift ∑' b, (f b : ℝ≥0∞) to ℝ≥0 using h with a ha
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
  lift ∑' b, (f b : ℝ≥0∞) to ℝ≥0 using h with a ha
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : β → ℝ≥0
a : ℝ≥0
ha : ↑a = ∑' (b : β), ↑(f b)
⊢ Summable f

Next tactic:
refine' ⟨a, ENNReal.hasSum_coe.1 _⟩
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
  lift ∑' b, (f b : ℝ≥0∞) to ℝ≥0 using h with a ha
  refine' ⟨a, ENNReal.hasSum_coe.1 _⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : β → ℝ≥0
a : ℝ≥0
ha : ↑a = ∑' (b : β), ↑(f b)
⊢ HasSum (fun a => ↑(f a)) ↑a

Next tactic:
rw [ha]
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
  lift ∑' b, (f b : ℝ≥0∞) to ℝ≥0 using h with a ha
  refine' ⟨a, ENNReal.hasSum_coe.1 _⟩
  rw [ha]
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : β → ℝ≥0
a : ℝ≥0
ha : ↑a = ∑' (b : β), ↑(f b)
⊢ HasSum (fun a => ↑(f a)) (∑' (b : β), ↑(f b))

Next tactic:
exact ENNReal.summable.hasSum
protected theorem tsum_eq_iSup_sum' {ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) :
    ∑' a, f a = ⨆ i, ∑ a in s i, f a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s✝ : Set ℝ≥0∞
f g : α → ℝ≥0∞
ι : Type u_4
s : ι → Finset α
hs : ∀ (t : Finset α), ∃ i, t ⊆ s i
⊢ ∑' (a : α), f a = ⨆ i, ∑ a in s i, f a

Next tactic:
rw [ENNReal.tsum_eq_iSup_sum]
protected theorem tsum_eq_iSup_sum' {ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) :
    ∑' a, f a = ⨆ i, ∑ a in s i, f a := by
  rw [ENNReal.tsum_eq_iSup_sum]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s✝ : Set ℝ≥0∞
f g : α → ℝ≥0∞
ι : Type u_4
s : ι → Finset α
hs : ∀ (t : Finset α), ∃ i, t ⊆ s i
⊢ ⨆ s, ∑ a in s, f a = ⨆ i, ∑ a in s i, f a

Next tactic:
symm
protected theorem tsum_eq_iSup_sum' {ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) :
    ∑' a, f a = ⨆ i, ∑ a in s i, f a := by
  rw [ENNReal.tsum_eq_iSup_sum]
  symm
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s✝ : Set ℝ≥0∞
f g : α → ℝ≥0∞
ι : Type u_4
s : ι → Finset α
hs : ∀ (t : Finset α), ∃ i, t ⊆ s i
⊢ ⨆ i, ∑ a in s i, f a = ⨆ s, ∑ a in s, f a

Next tactic:
change ⨆ i : ι, (fun t : Finset α => ∑ a in t, f a) (s i) = ⨆ s : Finset α, ∑ a in s, f a
protected theorem tsum_eq_iSup_sum' {ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) :
    ∑' a, f a = ⨆ i, ∑ a in s i, f a := by
  rw [ENNReal.tsum_eq_iSup_sum]
  symm
  change ⨆ i : ι, (fun t : Finset α => ∑ a in t, f a) (s i) = ⨆ s : Finset α, ∑ a in s, f a
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s✝ : Set ℝ≥0∞
f g : α → ℝ≥0∞
ι : Type u_4
s : ι → Finset α
hs : ∀ (t : Finset α), ∃ i, t ⊆ s i
⊢ ⨆ i, (fun t => ∑ a in t, f a) (s i) = ⨆ s, ∑ a in s, f a

Next tactic:
exact (Finset.sum_mono_set f).iSup_comp_eq hs
protected theorem lt_top_of_tsum_ne_top {a : α → ℝ≥0∞} (tsum_ne_top : ∑' i, a i ≠ ∞) (j : α) :
    a j < ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g a : α → ℝ≥0∞
tsum_ne_top : ∑' (i : α), a i ≠ ⊤
j : α
⊢ a j < ⊤

Next tactic:
contrapose! tsum_ne_top with h
protected theorem lt_top_of_tsum_ne_top {a : α → ℝ≥0∞} (tsum_ne_top : ∑' i, a i ≠ ∞) (j : α) :
    a j < ∞ := by
  contrapose! tsum_ne_top with h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g a : α → ℝ≥0∞
j : α
h : ⊤ ≤ a j
⊢ ∑' (i : α), a i = ⊤

Next tactic:
exact ENNReal.tsum_eq_top_of_eq_top ⟨j, top_unique h⟩
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
⊢ ∑' (x : α), c = ⊤

Next tactic:
have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
⊢ Tendsto (fun n => ↑n * c) atTop (𝓝 (⊤ * c))

Next tactic:
apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
⊢ ⊤ ≠ 0 ∨ c ≠ ⊤

Next tactic:
simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
A : Tendsto (fun n => ↑n * c) atTop (𝓝 (⊤ * c))
⊢ ∑' (x : α), c = ⊤

Next tactic:
have B : ∀ n : ℕ, (n : ℝ≥0∞) * c ≤ ∑' _ : α, c := fun n => by
    rcases Infinite.exists_subset_card_eq α n with ⟨s, hs⟩
    simpa [hs] using @ENNReal.sum_le_tsum α (fun _ => c) s
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
  have B : ∀ n : ℕ, (n : ℝ≥0∞) * c ≤ ∑' _ : α, c := fun n => by
    

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
A : Tendsto (fun n => ↑n * c) atTop (𝓝 (⊤ * c))
n : ℕ
⊢ ↑n * c ≤ ∑' (x : α), c

Next tactic:
rcases Infinite.exists_subset_card_eq α n with ⟨s, hs⟩
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
  have B : ∀ n : ℕ, (n : ℝ≥0∞) * c ≤ ∑' _ : α, c := fun n => by
    rcases Infinite.exists_subset_card_eq α n with ⟨s, hs⟩
    

Proof state:
case intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s✝ : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
A : Tendsto (fun n => ↑n * c) atTop (𝓝 (⊤ * c))
n : ℕ
s : Finset α
hs : Finset.card s = n
⊢ ↑n * c ≤ ∑' (x : α), c

Next tactic:
simpa [hs] using @ENNReal.sum_le_tsum α (fun _ => c) s
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c = ∞ := by
  have A : Tendsto (fun n : ℕ => (n : ℝ≥0∞) * c) atTop (𝓝 (∞ * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or_iff, top_ne_zero, Ne.def, not_false_iff]
  have B : ∀ n : ℕ, (n : ℝ≥0∞) * c ≤ ∑' _ : α, c := fun n => by
    rcases Infinite.exists_subset_card_eq α n with ⟨s, hs⟩
    simpa [hs] using @ENNReal.sum_le_tsum α (fun _ => c) s
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α✝ → ℝ≥0∞
α : Type u_4
inst✝ : Infinite α
c : ℝ≥0∞
hc : c ≠ 0
A : Tendsto (fun n => ↑n * c) atTop (𝓝 (⊤ * c))
B : ∀ (n : ℕ), ↑n * c ≤ ∑' (x : α), c
⊢ ∑' (x : α), c = ⊤

Next tactic:
simpa [hc] using le_of_tendsto' A B
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
⊢ ∑' (i : α), a * f i = a * ∑' (i : α), f i

Next tactic:
by_cases hf : ∀ i, f i = 0
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ∀ (i : α), f i = 0
⊢ ∑' (i : α), a * f i = a * ∑' (i : α), f i

Next tactic:
simp [hf]
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ¬∀ (i : α), f i = 0
⊢ ∑' (i : α), a * f i = a * ∑' (i : α), f i

Next tactic:
rw [← ENNReal.tsum_eq_zero] at hf
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · rw [← ENNReal.tsum_eq_zero] at hf
    

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ¬∑' (i : α), f i = 0
⊢ ∑' (i : α), a * f i = a * ∑' (i : α), f i

Next tactic:
have : Tendsto (fun s : Finset α => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' i, f i)) := by
      simp only [← Finset.mul_sum]
      exact ENNReal.Tendsto.const_mul ENNReal.summable.hasSum (Or.inl hf)
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · rw [← ENNReal.tsum_eq_zero] at hf
    have : Tendsto (fun s : Finset α => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' i, f i)) := by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ¬∑' (i : α), f i = 0
⊢ Tendsto (fun s => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' (i : α), f i))

Next tactic:
simp only [← Finset.mul_sum]
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · rw [← ENNReal.tsum_eq_zero] at hf
    have : Tendsto (fun s : Finset α => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' i, f i)) := by
      simp only [← Finset.mul_sum]
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ¬∑' (i : α), f i = 0
⊢ Tendsto (fun s => a * ∑ x in s, f x) atTop (𝓝 (a * ∑' (x : α), f x))

Next tactic:
exact ENNReal.Tendsto.const_mul ENNReal.summable.hasSum (Or.inl hf)
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · rw [← ENNReal.tsum_eq_zero] at hf
    have : Tendsto (fun s : Finset α => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' i, f i)) := by
      simp only [← Finset.mul_sum]
      exact ENNReal.Tendsto.const_mul ENNReal.summable.hasSum (Or.inl hf)
    

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
hf : ¬∑' (i : α), f i = 0
this : Tendsto (fun s => ∑ j in s, a * f j) atTop (𝓝 (a * ∑' (i : α), f i))
⊢ ∑' (i : α), a * f i = a * ∑' (i : α), f i

Next tactic:
exact HasSum.tsum_eq this
protected theorem tsum_mul_right : ∑' i, f i * a = (∑' i, f i) * a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
⊢ ∑' (i : α), f i * a = (∑' (i : α), f i) * a

Next tactic:
simp [mul_comm, ENNReal.tsum_mul_left]
protected theorem tsum_const_smul {R} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (a : R) :
    ∑' i, a • f i = a • ∑' i, f i := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f g : α → ℝ≥0∞
R : Type u_4
inst✝¹ : SMul R ℝ≥0∞
inst✝ : IsScalarTower R ℝ≥0∞ ℝ≥0∞
a : R
⊢ ∑' (i : α), a • f i = a • ∑' (i : α), f i

Next tactic:
simpa only [smul_one_mul] using @ENNReal.tsum_mul_left _ (a • (1 : ℝ≥0∞)) _
@[simp]
theorem tsum_iSup_eq {α : Type*} (a : α) {f : α → ℝ≥0∞} : (∑' b : α, ⨆ _ : a = b, f b) = f a :=
  (tsum_eq_single a fun _ h => by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
a : α
f : α → ℝ≥0∞
x✝ : α
h : x✝ ≠ a
⊢ ⨆ (_ : a = x✝), f x✝ = 0

Next tactic:
simp [h.symm]
@[simp]
theorem tsum_iSup_eq {α : Type*} (a : α) {f : α → ℝ≥0∞} : (∑' b : α, ⨆ _ : a = b, f b) = f a :=
  (tsum_eq_single a fun _ h => by simp [h.symm]).trans <| by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
a : α
f : α → ℝ≥0∞
⊢ ⨆ (_ : a = a), f a = f a

Next tactic:
simp
theorem hasSum_iff_tendsto_nat {f : ℕ → ℝ≥0∞} (r : ℝ≥0∞) :
    HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 r) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
r : ℝ≥0∞
⊢ HasSum f r ↔ Tendsto (fun n => ∑ i in Finset.range n, f i) atTop (𝓝 r)

Next tactic:
refine' ⟨HasSum.tendsto_sum_nat, fun h => _⟩
theorem hasSum_iff_tendsto_nat {f : ℕ → ℝ≥0∞} (r : ℝ≥0∞) :
    HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 r) := by
  refine' ⟨HasSum.tendsto_sum_nat, fun h => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
r : ℝ≥0∞
h : Tendsto (fun n => ∑ i in Finset.range n, f i) atTop (𝓝 r)
⊢ HasSum f r

Next tactic:
rw [← iSup_eq_of_tendsto _ h, ← ENNReal.tsum_eq_iSup_nat]
theorem hasSum_iff_tendsto_nat {f : ℕ → ℝ≥0∞} (r : ℝ≥0∞) :
    HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 r) := by
  refine' ⟨HasSum.tendsto_sum_nat, fun h => _⟩
  rw [← iSup_eq_of_tendsto _ h, ← ENNReal.tsum_eq_iSup_nat]
  · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
r : ℝ≥0∞
h : Tendsto (fun n => ∑ i in Finset.range n, f i) atTop (𝓝 r)
⊢ HasSum f (∑' (i : ℕ), f i)

Next tactic:
exact ENNReal.summable.hasSum
theorem hasSum_iff_tendsto_nat {f : ℕ → ℝ≥0∞} (r : ℝ≥0∞) :
    HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 r) := by
  refine' ⟨HasSum.tendsto_sum_nat, fun h => _⟩
  rw [← iSup_eq_of_tendsto _ h, ← ENNReal.tsum_eq_iSup_nat]
  · exact ENNReal.summable.hasSum
  · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
r : ℝ≥0∞
h : Tendsto (fun n => ∑ i in Finset.range n, f i) atTop (𝓝 r)
⊢ Monotone fun n => ∑ i in Finset.range n, f i

Next tactic:
exact fun s t hst => Finset.sum_le_sum_of_subset (Finset.range_subset.2 hst)
theorem tendsto_nat_tsum (f : ℕ → ℝ≥0∞) :
    Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 (∑' n, f n)) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
⊢ Tendsto (fun n => ∑ i in Finset.range n, f i) atTop (𝓝 (∑' (n : ℕ), f n))

Next tactic:
rw [← hasSum_iff_tendsto_nat]
theorem tendsto_nat_tsum (f : ℕ → ℝ≥0∞) :
    Tendsto (fun n : ℕ => ∑ i in Finset.range n, f i) atTop (𝓝 (∑' n, f n)) := by
  rw [← hasSum_iff_tendsto_nat]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
⊢ HasSum (fun i => f i) (∑' (n : ℕ), f n)

Next tactic:
exact ENNReal.summable.hasSum
theorem summable_toNNReal_of_tsum_ne_top {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' i, f i ≠ ∞) :
    Summable (ENNReal.toNNReal ∘ f) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (i : α), f i ≠ ⊤
⊢ Summable (ENNReal.toNNReal ∘ f)

Next tactic:
simpa only [← tsum_coe_ne_top_iff_summable, toNNReal_apply_of_tsum_ne_top hf] using hf
theorem tendsto_cofinite_zero_of_tsum_ne_top {α} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f cofinite (𝓝 0) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (x : α), f x ≠ ⊤
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
have f_ne_top : ∀ n, f n ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top hf
theorem tendsto_cofinite_zero_of_tsum_ne_top {α} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f cofinite (𝓝 0) := by
  have f_ne_top : ∀ n, f n ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top hf
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (x : α), f x ≠ ⊤
f_ne_top : ∀ (n : α), f n ≠ ⊤
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
have h_f_coe : f = fun n => ((f n).toNNReal : ENNReal) :=
    funext fun n => (coe_toNNReal (f_ne_top n)).symm
theorem tendsto_cofinite_zero_of_tsum_ne_top {α} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f cofinite (𝓝 0) := by
  have f_ne_top : ∀ n, f n ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top hf
  have h_f_coe : f = fun n => ((f n).toNNReal : ENNReal) :=
    funext fun n => (coe_toNNReal (f_ne_top n)).symm
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (x : α), f x ≠ ⊤
f_ne_top : ∀ (n : α), f n ≠ ⊤
h_f_coe : f = fun n => ↑(ENNReal.toNNReal (f n))
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
rw [h_f_coe, ← @coe_zero, tendsto_coe]
theorem tendsto_cofinite_zero_of_tsum_ne_top {α} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f cofinite (𝓝 0) := by
  have f_ne_top : ∀ n, f n ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top hf
  have h_f_coe : f = fun n => ((f n).toNNReal : ENNReal) :=
    funext fun n => (coe_toNNReal (f_ne_top n)).symm
  rw [h_f_coe, ← @coe_zero, tendsto_coe]
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (x : α), f x ≠ ⊤
f_ne_top : ∀ (n : α), f n ≠ ⊤
h_f_coe : f = fun n => ↑(ENNReal.toNNReal (f n))
⊢ Tendsto (fun n => ENNReal.toNNReal (f n)) cofinite (𝓝 0)

Next tactic:
exact NNReal.tendsto_cofinite_zero_of_summable (summable_toNNReal_of_tsum_ne_top hf)
theorem tendsto_atTop_zero_of_tsum_ne_top {f : ℕ → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f atTop (𝓝 0) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
hf : ∑' (x : ℕ), f x ≠ ⊤
⊢ Tendsto f atTop (𝓝 0)

Next tactic:
rw [← Nat.cofinite_eq_atTop]
theorem tendsto_atTop_zero_of_tsum_ne_top {f : ℕ → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto f atTop (𝓝 0) := by
  rw [← Nat.cofinite_eq_atTop]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α → ℝ≥0∞
f : ℕ → ℝ≥0∞
hf : ∑' (x : ℕ), f x ≠ ⊤
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
exact tendsto_cofinite_zero_of_tsum_ne_top hf
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
theorem tendsto_tsum_compl_atTop_zero {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0∞
hf : ∑' (x : α), f x ≠ ⊤
⊢ Tendsto (fun s => ∑' (b : { x // x ∉ s }), f ↑b) atTop (𝓝 0)

Next tactic:
lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
theorem tendsto_tsum_compl_atTop_zero {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  

Proof state:
case intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0
hf : ∑' (x : α), (fun i => ↑(f i)) x ≠ ⊤
⊢ Tendsto (fun s => ∑' (b : { x // x ∉ s }), (fun i => ↑(f i)) ↑b) atTop (𝓝 0)

Next tactic:
convert ENNReal.tendsto_coe.2 (NNReal.tendsto_tsum_compl_atTop_zero f)
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
theorem tendsto_tsum_compl_atTop_zero {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  convert ENNReal.tendsto_coe.2 (NNReal.tendsto_tsum_compl_atTop_zero f)
  

Proof state:
case h.e'_3.h
α✝ : Type u_1
β : Type u_2
γ : Type u_3
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y z ε ε₁ ε₂ : ℝ≥0∞
s : Set ℝ≥0∞
f✝ g : α✝ → ℝ≥0∞
α : Type u_4
f : α → ℝ≥0
hf : ∑' (x : α), (fun i => ↑(f i)) x ≠ ⊤
x✝ : Finset α
⊢ ∑' (b : { x // x ∉ x✝ }), (fun i => ↑(f i)) ↑b = ↑(∑' (b : { x // x ∉ x✝ }), f ↑b)

Next tactic:
rw [ENNReal.coe_tsum]