-- Mathlib/NumberTheory/EulerProduct/Basic.lean
theorem eulerProduct_hasProd (hsum : Summable (‖f ·‖)) (hf₀ : f 0 = 0) :
    HasProd (fun p : Primes ↦ ∑' e, f (p ^ e)) (∑' n, f n)

Proof state:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
⊢ dist (∏ b ∈ s, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Tactic:
have : ∏ p ∈ s, {p | Nat.Prime p}.mulIndicator F p = ∏ p ∈ s with p.Prime, F p :=
  prod_mulIndicator_eq_prod_filter s (fun _ ↦ F) _ id

Result:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
this : ∏ p ∈ s, {p | Nat.Prime p}.mulIndicator F p = ∏ p ∈ filter (fun p => Nat.Prime p) s, F p
⊢ dist (∏ b ∈ s, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Proof state:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
⊢ ∃ N, ∀ n ≥ N, dist (∏ b ∈ n, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Tactic:
obtain ⟨N₀, hN₀⟩ := norm_tsum_factoredNumbers_sub_tsum_lt hsum.of_norm hf₀ hε

Result:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
⊢ ∃ N, ∀ n ≥ N, dist (∏ b ∈ n, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Proof state:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
⊢ HasProd (fun p => ∑' (e : ℕ), f (↑p ^ e)) (∑' (n : ℕ), f n)

Tactic:
let F : ℕ → R := fun n ↦ ∑' e, f (n ^ e)

Result:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
⊢ HasProd (fun p => ∑' (e : ℕ), f (↑p ^ e)) (∑' (n : ℕ), f n)

Proof state:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
⊢ ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (∏ b ∈ n, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Tactic:
intro ε hε

Result:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
⊢ ∃ N, ∀ n ≥ N, dist (∏ b ∈ n, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Proof state:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
this : ∏ p ∈ s, {p | Nat.Prime p}.mulIndicator F p = ∏ p ∈ filter (fun p => Nat.Prime p) s, F p
⊢ ‖∑' (n : ℕ), f n - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε

Tactic:
exact hN₀ s fun p hp ↦ hs <| mem_range.mpr <| lt_of_mem_primesBelow hp

Result:
no goals

Proof state:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
this : ∏ p ∈ s, {p | Nat.Prime p}.mulIndicator F p = ∏ p ∈ filter (fun p => Nat.Prime p) s, F p
⊢ dist (∏ b ∈ s, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Tactic:
rw [this, dist_eq_norm, prod_filter_prime_tsum_eq_tsum_factoredNumbers hf₁ hmul hsum,
  norm_sub_rev]

Result:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
this : ∏ p ∈ s, {p | Nat.Prime p}.mulIndicator F p = ∏ p ∈ filter (fun p => Nat.Prime p) s, F p
⊢ ‖∑' (n : ℕ), f n - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε

Proof state:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
⊢ HasProd (fun p => ∑' (e : ℕ), f (↑p ^ e)) (∑' (n : ℕ), f n)

Tactic:
change HasProd (F ∘ Subtype.val) _

Result:
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
⊢ HasProd (F ∘ Subtype.val) (∑' (n : ℕ), f n)

Proof state:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
⊢ ∃ N, ∀ n ≥ N, dist (∏ b ∈ n, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε

Tactic:
refine ⟨range N₀, fun s hs ↦ ?_⟩

Result:
case intro
R : Type u_1
inst✝¹ : NormedCommRing R
f : ℕ → R
inst✝ : CompleteSpace R
hf₁ : f 1 = 1
hmul : ∀ {m n : ℕ}, m.Coprime n → f (m * n) = f m * f n
hsum : Summable fun x => ‖f x‖
hf₀ : f 0 = 0
F : ℕ → R := fun n => ∑' (e : ℕ), f (n ^ e)
ε : ℝ
hε : ε > 0
N₀ : ℕ
hN₀ : ∀ (s : Finset ℕ), N₀.primesBelow ≤ s → ‖∑' (m : ℕ), f m - ∑' (m : ↑(factoredNumbers s)), f ↑m‖ < ε
s : Finset ℕ
hs : s ≥ range N₀
⊢ dist (∏ b ∈ s, {p | Nat.Prime p}.mulIndicator F b) (∑' (n : ℕ), f n) < ε