-- File: optlib/Optlib/Algorithm/Nesterov/NesterovSmooth.lean
Theorem statement:
theorem extracted_formal_statement_19.{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))
  (h2 :
    ∀ (k : ℕ+) (x' : E),
      f (Nesterov.x f f' γ x₀ ↑k) - f x' ≤
        ↑(Nesterov.l f f' γ x₀) *
            inner (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) (x' - Nesterov.x f f' γ x₀ ↑k) +
          ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2)
  (k : ℕ+)
  (this :
    f (Nesterov.x f f' γ x₀ ↑k) - f xm - (1 - γ k) * (f (Nesterov.x f f' γ x₀ (↑k - 1)) - f xm) =
      γ k * (f (Nesterov.x f f' γ x₀ ↑k) - f xm) +
        (1 - γ k) * (f (Nesterov.x f f' γ x₀ ↑k) - f (Nesterov.x f f' γ x₀ (↑k - 1))))
  (lzero : 0 < ↑↑k + 1) (hz : γ k ≥ 0) (hl : γ k ≤ 1) :
  γ k • xm + (1 - γ k) • Nesterov.x f f' γ x₀ (↑k - 1) - 1 • Nesterov.x f f' γ x₀ ↑k =
    (1 - γ k) • Nesterov.x f f' γ x₀ (↑k - 1) + γ k • xm - Nesterov.x f f' γ x₀ ↑k := 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)
h2 :
  ∀ (k : ℕ+) (x' : E),
    f (Nesterov.x f f' γ x₀ ↑k) - f x' ≤
      ↑(Nesterov.l f f' γ x₀) *
          inner (Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k) (x' - Nesterov.x f f' γ x₀ ↑k) +
        ↑(Nesterov.l f f' γ x₀) / 2 * ‖Nesterov.x f f' γ x₀ ↑k - Nesterov.y f f' γ x₀ k‖ ^ 2
k : ℕ+
this :
  f (Nesterov.x f f' γ x₀ ↑k) - f xm - (1 - γ k) * (f (Nesterov.x f f' γ x₀ (↑k - 1)) - f xm) =
    γ k * (f (Nesterov.x f f' γ x₀ ↑k) - f xm) +
      (1 - γ k) * (f (Nesterov.x f f' γ x₀ ↑k) - f (Nesterov.x f f' γ x₀ (↑k - 1)))
lzero : 0 < ↑↑k + 1
hz : γ k ≥ 0
hl : γ k ≤ 1
⊢ γ k • xm + (1 - γ k) • Nesterov.x f f' γ x₀ (↑k - 1) - 1 • Nesterov.x f f' γ x₀ ↑k =
    (1 - γ k) • Nesterov.x f f' γ x₀ (↑k - 1) + γ k • xm - Nesterov.x f f' γ x₀ ↑k

Tactic: rw [one_smul, add_comm]

Tactic state after:

Premises used:
one_smul : ∀ (M : Type u_1) {α : Type u_5} [inst : Monoid M] [inst_3 : MulAction M α] (b : α), 1 • b = b
add_comm : ∀ {G : Type u_1} [inst : AddCommMagma G] (a b : G), a + b = b + a