l3lab/ntp-mathlib huggingface dataset:
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
i : α
hi : i ∉ s
this : ‖↑f i‖ ^ ENNReal.toReal p - ‖↑f i - if i ∈ s then ↑f i else 0‖ ^ ENNReal.toReal p = 0
⊢ F i = 0

Next tactic:
simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
i : α
hi : i ∉ s
⊢ ‖↑f i‖ ^ ENNReal.toReal p - ‖↑f i - if i ∈ s then ↑f i else 0‖ ^ ENNReal.toReal p = 0

Next tactic:
simp only [if_neg hi, sub_zero, sub_self]
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
⊢ HasSum (fun b => ‖↑f b‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) b‖ ^ ENNReal.toReal p)
    (∑ i in s, ‖↑f i‖ ^ ENNReal.toReal p)

Next tactic:
have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    intro i hi
    simp only [coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub,
      Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self]
    simp [Real.zero_rpow hp.ne']
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
⊢ ∀ i ∈ s, F i = ‖↑f i‖ ^ ENNReal.toReal p

Next tactic:
intro i hi
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    intro i hi
    

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
i : α
hi : i ∈ s
⊢ F i = ‖↑f i‖ ^ ENNReal.toReal p

Next tactic:
simp only [coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub,
      Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self]
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    intro i hi
    simp only [coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub,
      Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self]
    

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
i : α
hi : i ∈ s
⊢ ‖0‖ ^ ENNReal.toReal p = 0

Next tactic:
simp [Real.zero_rpow hp.ne']
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    intro i hi
    simp only [coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub,
      Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self]
    simp [Real.zero_rpow hp.ne']
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
hF' : ∀ i ∈ s, F i = ‖↑f i‖ ^ ENNReal.toReal p
⊢ HasSum (fun b => ‖↑f b‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) b‖ ^ ENNReal.toReal p)
    (∑ i in s, ‖↑f i‖ ^ ENNReal.toReal p)

Next tactic:
have : HasSum F (∑ i in s, F i) := hasSum_sum_of_ne_finset_zero hF
protected theorem norm_sub_norm_compl_sub_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f‖ ^ p.toReal - ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal =
      ∑ i in s, ‖f i‖ ^ p.toReal := by
  refine' ((hasSum_norm hp f).sub (hasSum_norm hp (f - ∑ i in s, lp.single p i (f i)))).unique _
  let F : α → ℝ := fun i => ‖f i‖ ^ p.toReal - ‖(f - ∑ i in s, lp.single p i (f i)) i‖ ^ p.toReal
  have hF : ∀ i ∉ s, F i = 0 := by
    intro i hi
    suffices ‖f i‖ ^ p.toReal - ‖f i - ite (i ∈ s) (f i) 0‖ ^ p.toReal = 0 by
      simpa only [coeFn_sum, lp.single_apply, coeFn_sub, Pi.sub_apply, Finset.sum_apply,
        Finset.sum_dite_eq] using this
    simp only [if_neg hi, sub_zero, sub_self]
  have hF' : ∀ i ∈ s, F i = ‖f i‖ ^ p.toReal := by
    intro i hi
    simp only [coeFn_sum, lp.single_apply, if_pos hi, sub_self, eq_self_iff_true, coeFn_sub,
      Pi.sub_apply, Finset.sum_apply, Finset.sum_dite_eq, sub_eq_self]
    simp [Real.zero_rpow hp.ne']
  have : HasSum F (∑ i in s, F i) := hasSum_sum_of_ne_finset_zero hF
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
F : α → ℝ := fun i => ‖↑f i‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) i‖ ^ ENNReal.toReal p
hF : ∀ i ∉ s, F i = 0
hF' : ∀ i ∈ s, F i = ‖↑f i‖ ^ ENNReal.toReal p
this : HasSum F (∑ i in s, F i)
⊢ HasSum (fun b => ‖↑f b‖ ^ ENNReal.toReal p - ‖↑(f - ∑ i in s, lp.single p i (↑f i)) b‖ ^ ENNReal.toReal p)
    (∑ i in s, ‖↑f i‖ ^ ENNReal.toReal p)

Next tactic:
rwa [Finset.sum_congr rfl hF'] at this
protected theorem norm_compl_sum_single (hp : 0 < p.toReal) (f : lp E p) (s : Finset α) :
    ‖f - ∑ i in s, lp.single p i (f i)‖ ^ p.toReal = ‖f‖ ^ p.toReal - ∑ i in s, ‖f i‖ ^ p.toReal :=
  by 

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁴ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝³ : NormedRing 𝕜
inst✝² : (i : α) → Module 𝕜 (E i)
inst✝¹ : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝ : DecidableEq α
hp : 0 < ENNReal.toReal p
f : ↥(lp E p)
s : Finset α
⊢ ‖f - ∑ i in s, lp.single p i (↑f i)‖ ^ ENNReal.toReal p = ‖f‖ ^ ENNReal.toReal p - ∑ i in s, ‖↑f i‖ ^ ENNReal.toReal p

Next tactic:
linarith [lp.norm_sub_norm_compl_sub_single hp f s]
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
⊢ HasSum (fun i => lp.single p i (↑f i)) f

Next tactic:
have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
⊢ HasSum (fun i => lp.single p i (↑f i)) f

Next tactic:
have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
⊢ HasSum (fun i => lp.single p i (↑f i)) f

Next tactic:
have := lp.hasSum_norm hp' f
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this : HasSum (fun i => ‖↑f i‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p)
⊢ HasSum (fun i => lp.single p i (↑f i)) f

Next tactic:
rw [HasSum, Metric.tendsto_nhds] at this ⊢
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
⊢ ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, lp.single p b (↑f b)) f < ε

Next tactic:
intro ε hε
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
⊢ ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, lp.single p b (↑f b)) f < ε

Next tactic:
refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
⊢ ∀ (x : Finset α),
    dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε ^ ENNReal.toReal p →
      dist (∑ b in x, lp.single p b (↑f b)) f < ε

Next tactic:
intro s hs
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
  intro s hs
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
s : Finset α
hs : dist (∑ b in s, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε ^ ENNReal.toReal p
⊢ dist (∑ b in s, lp.single p b (↑f b)) f < ε

Next tactic:
rw [← Real.rpow_lt_rpow_iff dist_nonneg (le_of_lt hε) hp']
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
  intro s hs
  rw [← Real.rpow_lt_rpow_iff dist_nonneg (le_of_lt hε) hp']
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
s : Finset α
hs : dist (∑ b in s, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε ^ ENNReal.toReal p
⊢ dist (∑ b in s, lp.single p b (↑f b)) f ^ ENNReal.toReal p < ε ^ ENNReal.toReal p

Next tactic:
rw [dist_comm] at hs
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
  intro s hs
  rw [← Real.rpow_lt_rpow_iff dist_nonneg (le_of_lt hε) hp']
  rw [dist_comm] at hs
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
s : Finset α
hs : dist (‖f‖ ^ ENNReal.toReal p) (∑ b in s, ‖↑f b‖ ^ ENNReal.toReal p) < ε ^ ENNReal.toReal p
⊢ dist (∑ b in s, lp.single p b (↑f b)) f ^ ENNReal.toReal p < ε ^ ENNReal.toReal p

Next tactic:
simp only [dist_eq_norm, Real.norm_eq_abs] at hs ⊢
/-- The canonical finitely-supported approximations to an element `f` of `lp` converge to it, in the
`lp` topology. -/
protected theorem hasSum_single [Fact (1 ≤ p)] (hp : p ≠ ⊤) (f : lp E p) :
    HasSum (fun i : α => lp.single p i (f i : E i)) f := by
  have hp₀ : 0 < p := zero_lt_one.trans_le Fact.out
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp₀.ne' hp
  have := lp.hasSum_norm hp' f
  rw [HasSum, Metric.tendsto_nhds] at this ⊢
  intro ε hε
  refine' (this _ (Real.rpow_pos_of_pos hε p.toReal)).mono _
  intro s hs
  rw [← Real.rpow_lt_rpow_iff dist_nonneg (le_of_lt hε) hp']
  rw [dist_comm] at hs
  simp only [dist_eq_norm, Real.norm_eq_abs] at hs ⊢
  

Proof state:
α : Type u_1
E : α → Type u_2
p q : ℝ≥0∞
inst✝⁵ : (i : α) → NormedAddCommGroup (E i)
𝕜 : Type u_3
inst✝⁴ : NormedRing 𝕜
inst✝³ : (i : α) → Module 𝕜 (E i)
inst✝² : ∀ (i : α), BoundedSMul 𝕜 (E i)
inst✝¹ : DecidableEq α
inst✝ : Fact (1 ≤ p)
hp : p ≠ ⊤
f : ↥(lp E p)
hp₀ : 0 < p
hp' : 0 < ENNReal.toReal p
this :
  ∀ ε > 0, ∀ᶠ (x : Finset α) in Filter.atTop, dist (∑ b in x, ‖↑f b‖ ^ ENNReal.toReal p) (‖f‖ ^ ENNReal.toReal p) < ε
ε : ℝ
hε : ε > 0
s : Finset α
hs : |‖f‖ ^ ENNReal.toReal p - ∑ x in s, ‖↑f x‖ ^ ENNReal.toReal p| < ε ^ ENNReal.toReal p
⊢ ‖∑ x in s, lp.single p x (↑f x) - f‖ ^ ENNReal.toReal p < ε ^ ENNReal.toReal p

Next tactic:
have H : ‖(∑ i in s, lp.single p i (f i : E i)) - f‖ ^ p.toReal =
      ‖f‖ ^ p.toReal - ∑ i in s, ‖f i‖ ^ p.toReal := by
    simpa only [coeFn_neg, Pi.neg_apply, lp.single_neg, Finset.sum_neg_distrib, neg_sub_neg,
      norm_neg, _root_.norm_neg] using lp.norm_compl_sum_single hp' (-f) s