-- File: optlib/Optlib/Algorithm/GD/GradientDescent.lean
Theorem statement:
theorem extracted_formal_statement_13.{u_1} {E : Type u_1} {xm : E} {f : E → ℝ} {g : ℕ → E}
  (mono : ∀ (k : ℕ), f (g (k + 1)) ≤ f (g k)) (j : ℕ)
  (a : f (g (j + 1)) - f xm ≤ (∑ k ∈ Finset.range (j + 1), (f (g (k + 1)) - f xm)) / (↑j + 1)) :
  (∑ k ∈ Finset.range (j + 1 + 1), f (g (k + 1))) / (↑j + 2) - f xm * ((↑j + 2) / (↑j + 2)) =
    (∑ k ∈ Finset.range (j + 1 + 1), f (g (k + 1)) - (↑j + 1 + 1) * f xm) / (↑j + 1 + 1) := sorry

Tactic state before:
E : Type u_1
xm : E
f : E → ℝ
g : ℕ → E
mono : ∀ (k : ℕ), f (g (k + 1)) ≤ f (g k)
j : ℕ
a✝ : f (g (j + 1)) - f xm ≤ (∑ k ∈ Finset.range (j + 1), (f (g (k + 1)) - f xm)) / (↑j + 1)
⊢ (∑ k ∈ Finset.range (j + 1 + 1), f (g (k + 1))) / (↑j + 2) - f xm * ((↑j + 2) / (↑j + 2)) =
    (∑ k ∈ Finset.range (j + 1 + 1), f (g (k + 1)) - (↑j + 1 + 1) * f xm) / (↑j + 1 + 1)

Tactic: rw [← one_add_one_eq_two, ← add_assoc, mul_div, mul_comm, ← sub_div]

Tactic state after:

Premises used:
sub_div : ∀ {K : Type u_1} [inst : DivisionRing K] (a b c : K), (a - b) / c = a / c - b / c
add_assoc : ∀ {G : Type u_1} [inst : AddSemigroup G] (a b c : G), a + b + c = a + (b + c)
mul_comm : ∀ {G : Type u_1} [inst : CommMagma G] (a b : G), a * b = b * a
mul_div : ∀ {G : Type u_3} [inst : DivInvMonoid G] (a b c : G), a * (b / c) = a * b / c
one_add_one_eq_two : ∀ {R : Type u_1} [inst : AddMonoidWithOne R], 1 + 1 = 2