l3lab/ntp-mathlib huggingface dataset:
theorem summable_of_sum_range_le {f : ℕ → ℝ≥0} {c : ℝ≥0}
    (h : ∀ n, ∑ i in Finset.range n, f i ≤ c) : Summable f := by
  refine summable_iff_not_tendsto_nat_atTop.2 fun H => ?_
  rcases exists_lt_of_tendsto_atTop H 0 c with ⟨n, -, hn⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
c : ℝ≥0
h : ∀ (n : ℕ), ∑ i in Finset.range n, f i ≤ c
H : Tendsto (fun n => ∑ i in Finset.range n, f i) atTop atTop
n : ℕ
hn : c < ∑ i in Finset.range n, f i
⊢ False

Next tactic:
exact lt_irrefl _ (hn.trans_le (h n))
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : α → Type u_4
f : (x : α) × β x → ℝ≥0
⊢ Summable f ↔
    (∀ (x : α), Summable fun y => f { fst := x, snd := y }) ∧ Summable fun x => ∑' (y : β x), f { fst := x, snd := y }

Next tactic:
constructor
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : α → Type u_4
f : (x : α) × β x → ℝ≥0
⊢ Summable f →
    (∀ (x : α), Summable fun y => f { fst := x, snd := y }) ∧ Summable fun x => ∑' (y : β x), f { fst := x, snd := y }

Next tactic:
simp only [← NNReal.summable_coe, NNReal.coe_tsum]
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  constructor
  · simp only [← NNReal.summable_coe, NNReal.coe_tsum]
    

Proof state:
case mp
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : α → Type u_4
f : (x : α) × β x → ℝ≥0
⊢ (Summable fun a => ↑(f a)) →
    (∀ (x : α), Summable fun a => ↑(f { fst := x, snd := a })) ∧
      Summable fun a => ∑' (a_1 : β a), ↑(f { fst := a, snd := a_1 })

Next tactic:
exact fun h => ⟨h.sigma_factor, h.sigma⟩
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  constructor
  · simp only [← NNReal.summable_coe, NNReal.coe_tsum]
    exact fun h => ⟨h.sigma_factor, h.sigma⟩
  · 

Proof state:
case mpr
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : α → Type u_4
f : (x : α) × β x → ℝ≥0
⊢ ((∀ (x : α), Summable fun y => f { fst := x, snd := y }) ∧ Summable fun x => ∑' (y : β x), f { fst := x, snd := y }) →
    Summable f

Next tactic:
rintro ⟨h₁, h₂⟩
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  constructor
  · simp only [← NNReal.summable_coe, NNReal.coe_tsum]
    exact fun h => ⟨h.sigma_factor, h.sigma⟩
  · rintro ⟨h₁, h₂⟩
    

Proof state:
case mpr.intro
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : α → Type u_4
f : (x : α) × β x → ℝ≥0
h₁ : ∀ (x : α), Summable fun y => f { fst := x, snd := y }
h₂ : Summable fun x => ∑' (y : β x), f { fst := x, snd := y }
⊢ Summable f

Next tactic:
simpa only [← ENNReal.tsum_coe_ne_top_iff_summable, ENNReal.tsum_sigma',
      ENNReal.coe_tsum (h₁ _)] using h₂
theorem indicator_summable {f : α → ℝ≥0} (hf : Summable f) (s : Set α) :
    Summable (s.indicator f) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
s : Set α
⊢ Summable (indicator s f)

Next tactic:
refine' NNReal.summable_of_le (fun a => le_trans (le_of_eq (s.indicator_apply f a)) _) hf
theorem indicator_summable {f : α → ℝ≥0} (hf : Summable f) (s : Set α) :
    Summable (s.indicator f) := by
  refine' NNReal.summable_of_le (fun a => le_trans (le_of_eq (s.indicator_apply f a)) _) hf
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
s : Set α
a : α
⊢ (if a ∈ s then f a else 0) ≤ f a

Next tactic:
split_ifs
theorem indicator_summable {f : α → ℝ≥0} (hf : Summable f) (s : Set α) :
    Summable (s.indicator f) := by
  refine' NNReal.summable_of_le (fun a => le_trans (le_of_eq (s.indicator_apply f a)) _) hf
  split_ifs
  

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
s : Set α
a : α
h✝ : a ∈ s
⊢ f a ≤ f a
case neg α : Type u_1 β : Type u_2 γ : Type u_3 f : α → ℝ≥0 hf : Summable f s : Set α a : α h✝ : a ∉ s ⊢ 0 ≤ f a

Next tactic:
exact le_refl (f a)
theorem indicator_summable {f : α → ℝ≥0} (hf : Summable f) (s : Set α) :
    Summable (s.indicator f) := by
  refine' NNReal.summable_of_le (fun a => le_trans (le_of_eq (s.indicator_apply f a)) _) hf
  split_ifs
  exact le_refl (f a)
  

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
s : Set α
a : α
h✝ : a ∉ s
⊢ 0 ≤ f a

Next tactic:
exact zero_le_coe
/-- For `f : ℕ → ℝ≥0`, then `∑' k, f (k + i)` tends to zero. This does not require a summability
assumption on `f`, as otherwise all sums are zero. -/
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
⊢ Tendsto (fun i => ∑' (k : ℕ), f (k + i)) atTop (𝓝 0)

Next tactic:
rw [← tendsto_coe]
/-- For `f : ℕ → ℝ≥0`, then `∑' k, f (k + i)` tends to zero. This does not require a summability
assumption on `f`, as otherwise all sums are zero. -/
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  rw [← tendsto_coe]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
⊢ Tendsto (fun a => ↑(∑' (k : ℕ), f (k + a))) atTop (𝓝 ↑0)

Next tactic:
convert _root_.tendsto_sum_nat_add fun i => (f i : ℝ)
/-- For `f : ℕ → ℝ≥0`, then `∑' k, f (k + i)` tends to zero. This does not require a summability
assumption on `f`, as otherwise all sums are zero. -/
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  rw [← tendsto_coe]
  convert _root_.tendsto_sum_nat_add fun i => (f i : ℝ)
  

Proof state:
case h.e'_3.h
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
x✝ : ℕ
⊢ ↑(∑' (k : ℕ), f (k + x✝)) = ∑' (k : ℕ), ↑(f (k + x✝))

Next tactic:
norm_cast
nonrec theorem hasSum_lt {f g : α → ℝ≥0} {sf sg : ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a)
    (hi : f i < g i) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0
sf sg : ℝ≥0
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hf : HasSum f sf
hg : HasSum g sg
⊢ sf < sg

Next tactic:
have A : ∀ a : α, (f a : ℝ) ≤ g a := fun a => NNReal.coe_le_coe.2 (h a)
nonrec theorem hasSum_lt {f g : α → ℝ≥0} {sf sg : ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a)
    (hi : f i < g i) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  have A : ∀ a : α, (f a : ℝ) ≤ g a := fun a => NNReal.coe_le_coe.2 (h a)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0
sf sg : ℝ≥0
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hf : HasSum f sf
hg : HasSum g sg
A : ∀ (a : α), ↑(f a) ≤ ↑(g a)
⊢ sf < sg

Next tactic:
have : (sf : ℝ) < sg := hasSum_lt A (NNReal.coe_lt_coe.2 hi) (hasSum_coe.2 hf) (hasSum_coe.2 hg)
nonrec theorem hasSum_lt {f g : α → ℝ≥0} {sf sg : ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a)
    (hi : f i < g i) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  have A : ∀ a : α, (f a : ℝ) ≤ g a := fun a => NNReal.coe_le_coe.2 (h a)
  have : (sf : ℝ) < sg := hasSum_lt A (NNReal.coe_lt_coe.2 hi) (hasSum_coe.2 hf) (hasSum_coe.2 hg)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0
sf sg : ℝ≥0
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hf : HasSum f sf
hg : HasSum g sg
A : ∀ (a : α), ↑(f a) ≤ ↑(g a)
this : ↑sf < ↑sg
⊢ sf < sg

Next tactic:
exact NNReal.coe_lt_coe.1 this
theorem tsum_pos {g : α → ℝ≥0} (hg : Summable g) (i : α) (hi : 0 < g i) : 0 < ∑' b, g b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
g : α → ℝ≥0
hg : Summable g
i : α
hi : 0 < g i
⊢ 0 < ∑' (b : α), g b

Next tactic:
rw [← tsum_zero]
theorem tsum_pos {g : α → ℝ≥0} (hg : Summable g) (i : α) (hi : 0 < g i) : 0 < ∑' b, g b := by
  rw [← tsum_zero]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
g : α → ℝ≥0
hg : Summable g
i : α
hi : 0 < g i
⊢ ∑' (x : ?m.342392), 0 < ∑' (b : α), g b
α : Type u_1 β : Type u_2 γ : Type u_3 g : α → ℝ≥0 hg : Summable g i : α hi : 0 < g i ⊢ Type ?u.342390

Next tactic:
exact tsum_lt_tsum (fun a => zero_le _) hi hg
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
i : α
⊢ ∑' (x : α), f x = f i + ∑' (x : α), if x = i then 0 else f x

Next tactic:
refine' tsum_eq_add_tsum_ite' i (NNReal.summable_of_le (fun i' => _) hf)
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  refine' tsum_eq_add_tsum_ite' i (NNReal.summable_of_le (fun i' => _) hf)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
i i' : α
⊢ update (fun x => f x) i 0 i' ≤ f i'

Next tactic:
rw [Function.update_apply]
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  refine' tsum_eq_add_tsum_ite' i (NNReal.summable_of_le (fun i' => _) hf)
  rw [Function.update_apply]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
i i' : α
⊢ (if i' = i then 0 else f i') ≤ f i'

Next tactic:
split_ifs
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  refine' tsum_eq_add_tsum_ite' i (NNReal.summable_of_le (fun i' => _) hf)
  rw [Function.update_apply]
  split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
i i' : α
h✝ : i' = i
⊢ 0 ≤ f i'

Next tactic:
simp only [zero_le', le_rfl]
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  refine' tsum_eq_add_tsum_ite' i (NNReal.summable_of_le (fun i' => _) hf)
  rw [Function.update_apply]
  split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
hf : Summable f
i i' : α
h✝ : ¬i' = i
⊢ f i' ≤ f i'

Next tactic:
simp only [zero_le', le_rfl]
theorem tsum_toReal_eq {f : α → ℝ≥0∞} (hf : ∀ a, f a ≠ ∞) :
    (∑' a, f a).toReal = ∑' a, (f a).toReal := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0∞
hf : ∀ (a : α), f a ≠ ⊤
⊢ ENNReal.toReal (∑' (a : α), f a) = ∑' (a : α), ENNReal.toReal (f a)

Next tactic:
simp only [ENNReal.toReal, tsum_toNNReal_eq hf, NNReal.coe_tsum]
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0∞
hf : ∑' (i : ℕ), f i ≠ ⊤
⊢ Tendsto (fun i => ∑' (k : ℕ), f (k + i)) atTop (𝓝 0)

Next tactic:
lift f to ℕ → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) 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
f : ℕ → ℝ≥0
hf : ∑' (i : ℕ), (fun i => ↑(f i)) i ≠ ⊤
⊢ Tendsto (fun i => ∑' (k : ℕ), (fun i => ↑(f i)) (k + i)) atTop (𝓝 0)

Next tactic:
replace hf : Summable f := tsum_coe_ne_top_iff_summable.1 hf
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  lift f to ℕ → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  replace hf : Summable f := tsum_coe_ne_top_iff_summable.1 hf
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
hf : Summable f
⊢ Tendsto (fun i => ∑' (k : ℕ), (fun i => ↑(f i)) (k + i)) atTop (𝓝 0)

Next tactic:
simp only [← ENNReal.coe_tsum, NNReal.summable_nat_add _ hf, ← ENNReal.coe_zero]
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  lift f to ℕ → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  replace hf : Summable f := tsum_coe_ne_top_iff_summable.1 hf
  simp only [← ENNReal.coe_tsum, NNReal.summable_nat_add _ hf, ← ENNReal.coe_zero]
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : ℕ → ℝ≥0
hf : Summable f
⊢ Tendsto (fun i => ↑(∑' (a : ℕ), f (a + i))) atTop (𝓝 ↑0)

Next tactic:
exact mod_cast NNReal.tendsto_sum_nat_add f
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0∞
sf sg : ℝ≥0∞
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hsf : sf ≠ ⊤
hf : HasSum f sf
hg : HasSum g sg
⊢ sf < sg

Next tactic:
by_cases hsg : sg = ⊤
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0∞
sf sg : ℝ≥0∞
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hsf : sf ≠ ⊤
hf : HasSum f sf
hg : HasSum g sg
hsg : sg = ⊤
⊢ sf < sg

Next tactic:
exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0∞
sf sg : ℝ≥0∞
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hsf : sf ≠ ⊤
hf : HasSum f sf
hg : HasSum g sg
hsg : ¬sg = ⊤
⊢ sf < sg

Next tactic:
have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
f g : α → ℝ≥0∞
sf sg : ℝ≥0∞
i : α
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
hsf : sf ≠ ⊤
hf : HasSum f sf
hg : HasSum g sg
hsg : ¬sg = ⊤
hg' : ∀ (x : α), g x ≠ ⊤
⊢ sf < sg

Next tactic:
lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    

Proof state:
case neg.intro
α : Type u_1
β : Type u_2
γ : Type u_3
g : α → ℝ≥0∞
sf sg : ℝ≥0∞
i : α
hsf : sf ≠ ⊤
hg : HasSum g sg
hsg : ¬sg = ⊤
hg' : ∀ (x : α), g x ≠ ⊤
f : α → ℝ≥0
h : ∀ (a : α), (fun i => ↑(f i)) a ≤ g a
hi : (fun i => ↑(f i)) i < g i
hf : HasSum (fun i => ↑(f i)) sf
⊢ sf < sg

Next tactic:
lift g to α → ℝ≥0 using hg'
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    lift g to α → ℝ≥0 using hg'
    

Proof state:
case neg.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
sf sg : ℝ≥0∞
i : α
hsf : sf ≠ ⊤
hsg : ¬sg = ⊤
f : α → ℝ≥0
hf : HasSum (fun i => ↑(f i)) sf
g : α → ℝ≥0
hg : HasSum (fun i => ↑(g i)) sg
h : ∀ (a : α), (fun i => ↑(f i)) a ≤ (fun i => ↑(g i)) a
hi : (fun i => ↑(f i)) i < (fun i => ↑(g i)) i
⊢ sf < sg

Next tactic:
lift sf to ℝ≥0 using hsf
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    lift g to α → ℝ≥0 using hg'
    lift sf to ℝ≥0 using hsf
    

Proof state:
case neg.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
sg : ℝ≥0∞
i : α
hsg : ¬sg = ⊤
f g : α → ℝ≥0
hg : HasSum (fun i => ↑(g i)) sg
h : ∀ (a : α), (fun i => ↑(f i)) a ≤ (fun i => ↑(g i)) a
hi : (fun i => ↑(f i)) i < (fun i => ↑(g i)) i
sf : ℝ≥0
hf : HasSum (fun i => ↑(f i)) ↑sf
⊢ ↑sf < sg

Next tactic:
lift sg to ℝ≥0 using hsg
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    lift g to α → ℝ≥0 using hg'
    lift sf to ℝ≥0 using hsf
    lift sg to ℝ≥0 using hsg
    

Proof state:
case neg.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
i : α
f g : α → ℝ≥0
h : ∀ (a : α), (fun i => ↑(f i)) a ≤ (fun i => ↑(g i)) a
hi : (fun i => ↑(f i)) i < (fun i => ↑(g i)) i
sf : ℝ≥0
hf : HasSum (fun i => ↑(f i)) ↑sf
sg : ℝ≥0
hg : HasSum (fun i => ↑(g i)) ↑sg
⊢ ↑sf < ↑sg

Next tactic:
simp only [coe_le_coe, coe_lt_coe] at h hi ⊢
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ⊤) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ⊤
  · exact hsg.symm ▸ lt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ⊤ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    lift g to α → ℝ≥0 using hg'
    lift sf to ℝ≥0 using hsf
    lift sg to ℝ≥0 using hsg
    simp only [coe_le_coe, coe_lt_coe] at h hi ⊢
    

Proof state:
case neg.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
i : α
f g : α → ℝ≥0
sf : ℝ≥0
hf : HasSum (fun i => ↑(f i)) ↑sf
sg : ℝ≥0
hg : HasSum (fun i => ↑(g i)) ↑sg
h : ∀ (a : α), f a ≤ g a
hi : f i < g i
⊢ sf < sg

Next tactic:
exact NNReal.hasSum_lt h hi (ENNReal.hasSum_coe.1 hf) (ENNReal.hasSum_coe.1 hg)
theorem tsum_comp_le_tsum_of_inj {β : Type*} {f : α → ℝ} (hf : Summable f) (hn : ∀ a, 0 ≤ f a)
    {i : β → α} (hi : Function.Injective i) : tsum (f ∘ i) ≤ tsum f := by
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : Type u_4
f : α → ℝ
hf : Summable f
hn : ∀ (a : α), 0 ≤ f a
i : β → α
hi : Injective i
⊢ tsum (f ∘ i) ≤ tsum f

Next tactic:
lift f to α → ℝ≥0 using hn
theorem tsum_comp_le_tsum_of_inj {β : Type*} {f : α → ℝ} (hf : Summable f) (hn : ∀ a, 0 ≤ f a)
    {i : β → α} (hi : Function.Injective i) : tsum (f ∘ i) ≤ tsum f := by
  lift f to α → ℝ≥0 using hn
  

Proof state:
case intro
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : Type u_4
i : β → α
hi : Injective i
f : α → ℝ≥0
hf : Summable fun i => ↑(f i)
⊢ tsum ((fun i => ↑(f i)) ∘ i) ≤ ∑' (i : α), ↑(f i)

Next tactic:
rw [NNReal.summable_coe] at hf
theorem tsum_comp_le_tsum_of_inj {β : Type*} {f : α → ℝ} (hf : Summable f) (hn : ∀ a, 0 ≤ f a)
    {i : β → α} (hi : Function.Injective i) : tsum (f ∘ i) ≤ tsum f := by
  lift f to α → ℝ≥0 using hn
  rw [NNReal.summable_coe] at hf
  

Proof state:
case intro
α : Type u_1
β✝ : Type u_2
γ : Type u_3
β : Type u_4
i : β → α
hi : Injective i
f : α → ℝ≥0
hf : Summable fun i => f i
⊢ tsum ((fun i => ↑(f i)) ∘ i) ≤ ∑' (i : α), ↑(f i)

Next tactic:
simpa only [(· ∘ ·), ← NNReal.coe_tsum] using NNReal.tsum_comp_le_tsum_of_inj hf hi
/-- Comparison test of convergence of series of non-negative real numbers. -/
theorem Summable.of_nonneg_of_le {f g : β → ℝ} (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b)
    (hf : Summable f) : Summable g := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : β → ℝ
hg : ∀ (b : β), 0 ≤ g b
hgf : ∀ (b : β), g b ≤ f b
hf : Summable f
⊢ Summable g

Next tactic:
lift f to β → ℝ≥0 using fun b => (hg b).trans (hgf b)
/-- Comparison test of convergence of series of non-negative real numbers. -/
theorem Summable.of_nonneg_of_le {f g : β → ℝ} (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b)
    (hf : Summable f) : Summable g := by
  lift f to β → ℝ≥0 using fun b => (hg b).trans (hgf b)
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
g : β → ℝ
hg : ∀ (b : β), 0 ≤ g b
f : β → ℝ≥0
hgf : ∀ (b : β), g b ≤ (fun i => ↑(f i)) b
hf : Summable fun i => ↑(f i)
⊢ Summable g

Next tactic:
lift g to β → ℝ≥0 using hg
/-- Comparison test of convergence of series of non-negative real numbers. -/
theorem Summable.of_nonneg_of_le {f g : β → ℝ} (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b)
    (hf : Summable f) : Summable g := by
  lift f to β → ℝ≥0 using fun b => (hg b).trans (hgf b)
  lift g to β → ℝ≥0 using hg
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : β → ℝ≥0
hf : Summable fun i => ↑(f i)
g : β → ℝ≥0
hgf : ∀ (b : β), (fun i => ↑(g i)) b ≤ (fun i => ↑(f i)) b
⊢ Summable fun i => ↑(g i)

Next tactic:
rw [NNReal.summable_coe] at hf ⊢
/-- Comparison test of convergence of series of non-negative real numbers. -/
theorem Summable.of_nonneg_of_le {f g : β → ℝ} (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b)
    (hf : Summable f) : Summable g := by
  lift f to β → ℝ≥0 using fun b => (hg b).trans (hgf b)
  lift g to β → ℝ≥0 using hg
  rw [NNReal.summable_coe] at hf ⊢
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : β → ℝ≥0
hf : Summable fun i => f i
g : β → ℝ≥0
hgf : ∀ (b : β), (fun i => ↑(g i)) b ≤ (fun i => ↑(f i)) b
⊢ Summable fun i => g i

Next tactic:
exact NNReal.summable_of_le (fun b => NNReal.coe_le_coe.1 (hgf b)) hf
theorem Summable.toNNReal {f : α → ℝ} (hf : Summable f) : Summable fun n => (f n).toNNReal := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ
hf : Summable f
⊢ Summable fun n => Real.toNNReal (f n)

Next tactic:
apply NNReal.summable_coe.1
theorem Summable.toNNReal {f : α → ℝ} (hf : Summable f) : Summable fun n => (f n).toNNReal := by
  apply NNReal.summable_coe.1
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ
hf : Summable f
⊢ Summable fun a => ↑(Real.toNNReal (f a))

Next tactic:
refine' .of_nonneg_of_le (fun n => NNReal.coe_nonneg _) (fun n => _) hf.abs
theorem Summable.toNNReal {f : α → ℝ} (hf : Summable f) : Summable fun n => (f n).toNNReal := by
  apply NNReal.summable_coe.1
  refine' .of_nonneg_of_le (fun n => NNReal.coe_nonneg _) (fun n => _) hf.abs
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ
hf : Summable f
n : α
⊢ ↑(Real.toNNReal (f n)) ≤ |f n|

Next tactic:
simp only [le_abs_self, Real.coe_toNNReal', max_le_iff, abs_nonneg, and_self_iff]
/-- Finitely summable non-negative functions have countable support -/
theorem _root_.Summable.countable_support_ennreal {f : α → ℝ≥0∞} (h : ∑' (i : α), f i ≠ ⊤) :
    f.support.Countable := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0∞
h : ∑' (i : α), f i ≠ ⊤
⊢ Set.Countable (support f)

Next tactic:
lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top h
/-- Finitely summable non-negative functions have countable support -/
theorem _root_.Summable.countable_support_ennreal {f : α → ℝ≥0∞} (h : ∑' (i : α), f i ≠ ⊤) :
    f.support.Countable := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top h
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → ℝ≥0
h : ∑' (i : α), (fun i => ↑(f i)) i ≠ ⊤
⊢ Set.Countable (support fun i => ↑(f i))

Next tactic:
simpa [support] using (ENNReal.tsum_coe_ne_top_iff_summable.1 h).countable_support_nnreal