-- Mathlib/Analysis/Normed/Group/Continuity.lean
theorem controlled_prod_of_mem_closure {s : Subgroup E} (hg : a ∈ closure (s : Set E)) {b : ℕ → ℝ}
    (b_pos : ∀ n, 0 < b n) :
    ∃ v : ℕ → E,
      Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
        (∀ n, v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ n, 0 < n → ‖v n‖ < b n

Proof state:
case intro.intro.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Tactic:
have lim_z : Tendsto z atTop (𝓝 a) := lim_u.comp (tendsto_add_atTop_nat n₀)

Result:
case intro.intro.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Proof state:
case intro.intro.intro.intro.intro.refine_2
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
⊢ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Tactic:
intro l hl

Result:
case intro.intro.intro.intro.intro.refine_2
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
l : ℕ
hl : 0 < l
⊢ ‖v l‖ < b l

Proof state:
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Tactic:
obtain ⟨u : ℕ → E, u_in : ∀ n, u n ∈ s, lim_u : Tendsto u atTop (𝓝 a)⟩ :=
  mem_closure_iff_seq_limit.mp hg

Result:
case intro.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Proof state:
case intro.intro.intro.intro.intro.refine_1.zero
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
⊢ w 0 ∈ s

Tactic:
apply u_in

Result:
no goals

Proof state:
case intro.intro.intro.intro.intro.refine_2.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
k : ℕ
hl : 0 < k + 1
⊢ ‖v (k + 1)‖ < b (k + 1)

Tactic:
apply hφ

Result:
no goals

Proof state:
case intro.intro.intro.intro.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Tactic:
set w : ℕ → E := z ∘ φ

Result:
case intro.intro.intro.intro.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
⊢ ∃ v,
    Tendsto (fun n => ∏ i ∈ range (n + 1), v i) atTop (𝓝 a) ∧
      (∀ (n : ℕ), v n ∈ s) ∧ ‖v 0 / a‖ < b 0 ∧ ∀ (n : ℕ), 0 < n → ‖v n‖ < b n

Proof state:
case intro.intro.intro.intro.intro.refine_2
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
l : ℕ
hl : 0 < l
⊢ ‖v l‖ < b l

Tactic:
obtain ⟨k, rfl⟩ : ∃ k, l = k + 1 := Nat.exists_eq_succ_of_ne_zero hl.ne'

Result:
case intro.intro.intro.intro.intro.refine_2.intro
E : Type u_5
inst✝ : SeminormedCommGroup E
a : E
s : Subgroup E
hg : a ∈ closure ↑s
b : ℕ → ℝ
b_pos : ∀ (n : ℕ), 0 < b n
u : ℕ → E
u_in : ∀ (n : ℕ), u n ∈ s
lim_u : Tendsto u atTop (𝓝 a)
n₀ : ℕ
hn₀ : ∀ n ≥ n₀, ‖u n / a‖ < b 0
z : ℕ → E := fun n => u (n + n₀)
lim_z : Tendsto z atTop (𝓝 a)
mem_𝓤 : ∀ (n : ℕ), {p | ‖p.1 / p.2‖ < b (n + 1)} ∈ 𝓤 E
φ : ℕ → ℕ
φ_extr : StrictMono φ
hφ : ∀ (n : ℕ), ‖z (φ (n + 1)) / z (φ n)‖ < b (n + 1)
w : ℕ → E := z ∘ φ
hw : Tendsto w atTop (𝓝 a)
v : ℕ → E := fun i => if i = 0 then w 0 else w i / w (i - 1)
k : ℕ
hl : 0 < k + 1
⊢ ‖v (k + 1)‖ < b (k + 1)