theorem extracted_formal_statement_19.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] {f h : E → ℝ} {f' : E → E} {x0 : E} {alg : Nesterov_first f h f' x0} {xm : E}
  (minφ : IsMinOn (f + h) univ xm)
  (h1 :
    ∀ (k : ℕ),
      Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
          Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k) ∈
        SubderivAt (Nesterov_first.t f h f' x0 k • h) (Nesterov_first.x f h f' x0 (k + 1)))
  (hieq1 :
    ∀ (z : E) (k : ℕ),
      Nesterov_first.t f h f' x0 k * h (Nesterov_first.x f h f' x0 (k + 1)) +
          inner
            (Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
              Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k))
            (z - Nesterov_first.x f h f' x0 (k + 1)) ≤
        Nesterov_first.t f h f' x0 k * h z)
  (hieq2 :
    ∀ (z : E) (k : ℕ),
      h (Nesterov_first.x f h f' x0 (k + 1)) ≤
        h z +
          inner
            (f' (Nesterov_first.y f h f' x0 k) +
              (1 / Nesterov_first.t f h f' x0 k) • (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k))
            (z - Nesterov_first.x f h f' x0 (k + 1)))
  (fieq1 :
    ∀ (k : ℕ) (x y : E), f x ≤ f y + inner (f' y) (x - y) + 1 / (2 * Nesterov_first.t f h f' x0 k) * ‖x - y‖ ^ 2) :
  let φ := fun z => f z + h z;
  (∀ (z : E) (k : ℕ),
      φ (Nesterov_first.x f h f' x0 (k + 1)) ≤
        φ z +
            1 / Nesterov_first.t f h f' x0 k *
              inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                (z - Nesterov_first.x f h f' x0 (k + 1)) +
          1 / (2 * Nesterov_first.t f h f' x0 k) *
            ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2) →
    ∀ (k : ℕ),
      φ (Nesterov_first.x f h f' x0 (k + 1)) - φ (Nesterov_first.x f h f' x0 k) ≤
          (1 / Nesterov_first.t f h f' x0 k) •
              inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1)) +
            1 / (2 * Nesterov_first.t f h f' x0 k) *
              ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2 →
        φ (Nesterov_first.x f h f' x0 (k + 1)) - φ xm ≤
            (1 / Nesterov_first.t f h f' x0 k) •
                inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                  (xm - Nesterov_first.x f h f' x0 (k + 1)) +
              1 / (2 * Nesterov_first.t f h f' x0 k) *
                ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2 →
          Nesterov_first.γ f h f' x0 k * (1 / Nesterov_first.t f h f' x0 k) *
                    inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                      (xm - Nesterov_first.x f h f' x0 (k + 1)) +
                  (1 - Nesterov_first.γ f h f' x0 k) * (1 / Nesterov_first.t f h f' x0 k) *
                    inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                      (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1)) +
                1 / (2 * Nesterov_first.t f h f' x0 k) *
                  ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2 =
              1 / Nesterov_first.t f h f' x0 k *
                  inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                    ((1 - Nesterov_first.γ f h f' x0 k) • Nesterov_first.x f h f' x0 k +
                        Nesterov_first.γ f h f' x0 k • xm -
                      Nesterov_first.x f h f' x0 (k + 1)) +
                1 / (2 * Nesterov_first.t f h f' x0 k) *
                  ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2 →
            1 / Nesterov_first.t f h f' x0 k *
                inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                  (Nesterov_first.γ f h f' x0 k • (xm - Nesterov_first.x f h f' x0 (k + 1)) +
                    (1 - Nesterov_first.γ f h f' x0 k) •
                      (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1))) =
              1 / Nesterov_first.t f h f' x0 k *
                inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
                  ((1 - Nesterov_first.γ f h f' x0 k) • Nesterov_first.x f h f' x0 k +
                      Nesterov_first.γ f h f' x0 k • xm -
                    Nesterov_first.x f h f' x0 (k + 1)) := sorry

State before:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
inst✝ : CompleteSpace E
f h : E → ℝ
f' : E → E
x0 : E
alg : Nesterov_first f h f' x0
xm : E
minφ : IsMinOn (f + h) univ xm
h1 :
  ∀ (k : ℕ),
    Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
        Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k) ∈
      SubderivAt (Nesterov_first.t f h f' x0 k • h) (Nesterov_first.x f h f' x0 (k + 1))
hieq1 :
  ∀ (z : E) (k : ℕ),
    Nesterov_first.t f h f' x0 k * h (Nesterov_first.x f h f' x0 (k + 1)) +
        inner
          (Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
            Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k))
          (z - Nesterov_first.x f h f' x0 (k + 1)) ≤
      Nesterov_first.t f h f' x0 k * h z
hieq2 :
  ∀ (z : E) (k : ℕ),
    h (Nesterov_first.x f h f' x0 (k + 1)) ≤
      h z +
        inner
          (f' (Nesterov_first.y f h f' x0 k) +
            (1 / Nesterov_first.t f h f' x0 k) • (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k))
          (z - Nesterov_first.x f h f' x0 (k + 1))
fieq1 : ∀ (k : ℕ) (x y : E), f x ≤ f y + inner (f' y) (x - y) + 1 / (2 * Nesterov_first.t f h f' x0 k) * ‖x - y‖ ^ 2
φ : E → ℝ := fun z => f z + h z
φieq2 :
  ∀ (z : E) (k : ℕ),
    φ (Nesterov_first.x f h f' x0 (k + 1)) ≤
      φ z +
          1 / Nesterov_first.t f h f' x0 k *
            inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
              (z - Nesterov_first.x f h f' x0 (k + 1)) +
        1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
k : ℕ
ieq1 :
  φ (Nesterov_first.x f h f' x0 (k + 1)) - φ (Nesterov_first.x f h f' x0 k) ≤
    (1 / Nesterov_first.t f h f' x0 k) •
        inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
          (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1)) +
      1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
ieq2 :
  φ (Nesterov_first.x f h f' x0 (k + 1)) - φ xm ≤
    (1 / Nesterov_first.t f h f' x0 k) •
        inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
          (xm - Nesterov_first.x f h f' x0 (k + 1)) +
      1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
⊢ Nesterov_first.γ f h f' x0 k * (1 / Nesterov_first.t f h f' x0 k) *
          inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
            (xm - Nesterov_first.x f h f' x0 (k + 1)) +
        (1 - Nesterov_first.γ f h f' x0 k) * (1 / Nesterov_first.t f h f' x0 k) *
          inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
            (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1)) +
      1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2 =
    1 / Nesterov_first.t f h f' x0 k *
        inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
          ((1 - Nesterov_first.γ f h f' x0 k) • Nesterov_first.x f h f' x0 k + Nesterov_first.γ f h f' x0 k • xm -
            Nesterov_first.x f h f' x0 (k + 1)) +
      1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2

Tactic: rw [add_right_cancel_iff, mul_comm (alg.γ k), mul_comm (1 - alg.γ k)]
    rw [mul_assoc, mul_assoc, ← mul_add, ← inner_smul_right, ← inner_smul_right]
    rw [← inner_add_right]

State after:
[E : Type u_1
 inst✝² : NormedAddCommGroup E
 inst✝¹ : InnerProductSpace ℝ E
 inst✝ : CompleteSpace E
 f h : E → ℝ
 f' : E → E
 x0 : E
 alg : Nesterov_first f h f' x0
 xm : E
 minφ : IsMinOn (f + h) univ xm
 h1 :
   ∀ (k : ℕ),
     Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
         Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k) ∈
       SubderivAt (Nesterov_first.t f h f' x0 k • h) (Nesterov_first.x f h f' x0 (k + 1))
 hieq1 :
   ∀ (z : E) (k : ℕ),
     Nesterov_first.t f h f' x0 k * h (Nesterov_first.x f h f' x0 (k + 1)) +
         inner
           (Nesterov_first.y f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1) -
             Nesterov_first.t f h f' x0 k • f' (Nesterov_first.y f h f' x0 k))
           (z - Nesterov_first.x f h f' x0 (k + 1)) ≤
       Nesterov_first.t f h f' x0 k * h z
 hieq2 :
   ∀ (z : E) (k : ℕ),
     h (Nesterov_first.x f h f' x0 (k + 1)) ≤
       h z +
         inner
           (f' (Nesterov_first.y f h f' x0 k) +
             (1 / Nesterov_first.t f h f' x0 k) • (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k))
           (z - Nesterov_first.x f h f' x0 (k + 1))
 fieq1 : ∀ (k : ℕ) (x y : E), f x ≤ f y + inner (f' y) (x - y) + 1 / (2 * Nesterov_first.t f h f' x0 k) * ‖x - y‖ ^ 2
 φ : E → ℝ := fun z => f z + h z
 φieq2 :
   ∀ (z : E) (k : ℕ),
     φ (Nesterov_first.x f h f' x0 (k + 1)) ≤
       φ z +
           1 / Nesterov_first.t f h f' x0 k *
             inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
               (z - Nesterov_first.x f h f' x0 (k + 1)) +
         1 / (2 * Nesterov_first.t f h f' x0 k) *
           ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
 k : ℕ
 ieq1 :
   φ (Nesterov_first.x f h f' x0 (k + 1)) - φ (Nesterov_first.x f h f' x0 k) ≤
     (1 / Nesterov_first.t f h f' x0 k) •
         inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
           (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1)) +
       1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
 ieq2 :
   φ (Nesterov_first.x f h f' x0 (k + 1)) - φ xm ≤
     (1 / Nesterov_first.t f h f' x0 k) •
         inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
           (xm - Nesterov_first.x f h f' x0 (k + 1)) +
       1 / (2 * Nesterov_first.t f h f' x0 k) * ‖Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k‖ ^ 2
 ⊢ 1 / Nesterov_first.t f h f' x0 k *
       inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
         (Nesterov_first.γ f h f' x0 k • (xm - Nesterov_first.x f h f' x0 (k + 1)) +
           (1 - Nesterov_first.γ f h f' x0 k) • (Nesterov_first.x f h f' x0 k - Nesterov_first.x f h f' x0 (k + 1))) =
     1 / Nesterov_first.t f h f' x0 k *
       inner (Nesterov_first.x f h f' x0 (k + 1) - Nesterov_first.y f h f' x0 k)
         ((1 - Nesterov_first.γ f h f' x0 k) • Nesterov_first.x f h f' x0 k + Nesterov_first.γ f h f' x0 k • xm -
           Nesterov_first.x f h f' x0 (k + 1))]

Relevant lemmas:
add_right_cancel_iff : ∀ {G : Type u_1} [inst : Add G] [inst_3 : IsRightCancelAdd G] {a b c : G}, b + a = c + a ↔ b = c
mul_add : ∀ {R : Type v} [inst : Mul R] [inst_3 : Add R] [inst_4 : LeftDistribClass R] (a b c : R),
  a * (b + c) = a * b + a * c
mul_comm : ∀ {G : Type u_1} [inst : CommMagma G] (a b : G), a * b = b * a
mul_assoc : ∀ {G : Type u_1} [inst : Semigroup G] (a b c : G), a * b * c = a * (b * c)
inner_add_right : ∀ {𝕜 : Type u_1} {E : Type u_2} [inst : RCLike 𝕜] [inst_3 : SeminormedAddCommGroup E]
  [inst_4 : InnerProductSpace 𝕜 E] (x y z : E), inner x (y + z) = inner x y + inner x z
inner_smul_right : ∀ {𝕜 : Type u_1} {E : Type u_2} [inst : RCLike 𝕜] [inst_3 : SeminormedAddCommGroup E]
  [inst_4 : InnerProductSpace 𝕜 E] (x y : E) (r : 𝕜), inner x (r • y) = r * inner x y