-- File: optlib/Optlib/Algorithm/Nesterov/NesterovSmooth.lean
Theorem statement:
theorem extracted_formal_statement_4.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] {f : E → ℝ} {f' : E → E} {xm x₀ : E} {γ : ℕ+ → ℝ} {alg : Nesterov f f' γ x₀}
  (hfun : ConvexOn ℝ univ f) (hg : ∀ (k : ℕ+), γ k = 2 / (↑↑k + 1)) (k : ℕ+) (x' : E)
  (this : f' (Nesterov.y f f' γ x₀ k) = ↑(Nesterov.l f f' γ x₀) • (Nesterov.y f f' γ x₀ k - Nesterov.x f f' γ x₀ ↑k))
  (t1 : f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (x' - Nesterov.y f f' γ x₀ k) ≤ f x')
  (h_original_goal :
    f (Nesterov.y f f' γ x₀ k) +
          inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
        ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2 =
      f (Nesterov.y f f' γ x₀ k) +
          inner (f' (Nesterov.y f f' γ x₀ k)) (x' - Nesterov.y f f' γ x₀ k + (Nesterov.x f f' γ x₀ ↑k - x')) +
        ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2) :
  f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
      ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2 =
    f (Nesterov.y f f' γ x₀ k) +
        inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
      ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2 := sorry

Tactic state before:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
inst✝ : CompleteSpace E
f : E → ℝ
f' : E → E
xm x₀ : E
γ : ℕ+ → ℝ
alg : Nesterov f f' γ x₀
hfun : ConvexOn ℝ univ f
hg : ∀ (k : ℕ+), γ k = 2 / (↑↑k + 1)
k : ℕ+
x' : E
this : f' (Nesterov.y f f' γ x₀ k) = ↑(Nesterov.l f f' γ x₀) • (Nesterov.y f f' γ x₀ k - Nesterov.x f f' γ x₀ ↑k)
t1 : f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (x' - Nesterov.y f f' γ x₀ k) ≤ f x'
⊢ f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
      ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2 =
    f (Nesterov.y f f' γ x₀ k) +
        inner (f' (Nesterov.y f f' γ x₀ k)) (x' - Nesterov.y f f' γ x₀ k + (Nesterov.x f f' γ x₀ ↑k - x')) +
      ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2

Tactic: rw [add_comm (x' - alg.y k), add_sub (alg.x k - x'), sub_add, sub_self, sub_zero]

Tactic state after:
[E : Type u_1
 inst✝² : NormedAddCommGroup E
 inst✝¹ : InnerProductSpace ℝ E
 inst✝ : CompleteSpace E
 f : E → ℝ
 f' : E → E
 xm x₀ : E
 γ : ℕ+ → ℝ
 alg : Nesterov f f' γ x₀
 hfun : ConvexOn ℝ univ f
 hg : ∀ (k : ℕ+), γ k = 2 / (↑↑k + 1)
 k : ℕ+
 x' : E
 this : f' (Nesterov.y f f' γ x₀ k) = ↑(Nesterov.l f f' γ x₀) • (Nesterov.y f f' γ x₀ k - Nesterov.x f f' γ x₀ ↑k)
 t1 : f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (x' - Nesterov.y f f' γ x₀ k) ≤ f x'
 ⊢ f (Nesterov.y f f' γ x₀ k) + inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
       ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2 =
     f (Nesterov.y f f' γ x₀ k) +
         inner (f' (Nesterov.y f f' γ x₀ k)) (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) +
       ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2]

Premises used:
add_sub : ∀ {G : Type u_3} [inst : SubNegMonoid G] (a b c : G), a + (b - c) = a + b - c
sub_self : ∀ {G : Type u_1} [inst : AddGroup G] (a : G), a - a = 0
sub_add : ∀ {α : Type u_1} [inst : SubtractionCommMonoid α] (a b c : α), a - b + c = a - (b - c)
sub_zero : ∀ {G : Type u_3} [inst : SubNegZeroMonoid G] (a : G), a - 0 = a
add_comm : ∀ {G : Type u_1} [inst : AddCommMagma G] (a b : G), a + b = b + a