-- File: optlib/Optlib/Algorithm/Nesterov/NesterovAccelerationFirst.lean
Theorem statement:
theorem extracted_formal_statement_134.{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) →
    let v := fun k =>
      Nesterov_first.x f h f' x0 (↑k - 1) +
        (1 / Nesterov_first.γ f h f' x0 (↑k - 1)) •
          (Nesterov_first.x f h f' x0 ↑k - Nesterov_first.x f h f' x0 (↑k - 1));
    (∀ (k : ℕ+),
        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 • v k) →
      (∀ (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)
                  ((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 / (2 * Nesterov_first.t f h f' x0 k) *
              (‖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‖ ^
                  2 -
                ‖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.γ f h f' x0 k • xm‖ ^
                  2)) →
        (∀ (k : ℕ+),
            φ (Nesterov_first.x f h f' x0 (↑k + 1)) - φ xm -
                (1 - Nesterov_first.γ f h f' x0 ↑k) * (φ (Nesterov_first.x f h f' x0 ↑k) - φ xm) ≤
              Nesterov_first.γ f h f' x0 ↑k ^ 2 / (2 * Nesterov_first.t f h f' x0 ↑k) *
                (‖v k - xm‖ ^ 2 - ‖v (k + 1) - xm‖ ^ 2)) →
          let α := fun k => 2 * Nesterov_first.t f h f' x0 k / Nesterov_first.γ f h f' x0 k ^ 2;
          (∀ (n : ℕ), 0 < α n) →
            (∀ (n : ℕ+), (1 - Nesterov_first.γ f h f' x0 ↑n) * α ↑n ≤ α (↑n - 1)) →
              (∀ (n : ℕ), α n * (Nesterov_first.γ f h f' x0 n ^ 2 / (2 * Nesterov_first.t f h f' x0 n)) = 1) →
                (∀ (n : ℕ+),
                    α ↑n * (φ (Nesterov_first.x f h f' x0 (↑n + 1)) - φ xm) + ‖v (n + 1) - xm‖ ^ 2 ≤
                      α (↑n - 1) * (φ (Nesterov_first.x f h f' x0 ↑n) - φ xm) + ‖v n - xm‖ ^ 2) →
                  φ (Nesterov_first.x f h f' x0 1) ≤
                      (Nesterov_first.t f h f' x0 0)⁻¹ *
                            inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0)
                              (xm - Nesterov_first.x f h f' x0 1) +
                          (Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ *
                            ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2 +
                        φ xm →
                    2 * Nesterov_first.t f h f' x0 0 *
                            ((Nesterov_first.t f h f' x0 0)⁻¹ *
                                    inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0)
                                      (xm - Nesterov_first.x f h f' x0 1) +
                                  (Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ *
                                    ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2 +
                                φ xm -
                              φ xm) +
                          ‖Nesterov_first.x f h f' x0 1 - xm‖ ^ 2 =
                        ‖Nesterov_first.x f h f' x0 0 - xm‖ ^ 2 →
                      2 * Nesterov_first.t f h f' x0 0 * (Nesterov_first.t f h f' x0 0)⁻¹ *
                              inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0)
                                (xm - Nesterov_first.x f h f' x0 1) +
                            2 * Nesterov_first.t f h f' x0 0 *
                              ((Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ *
                                ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2) +
                          ‖Nesterov_first.x f h f' x0 1 - xm‖ ^ 2 =
                        ‖Nesterov_first.x f h f' x0 0 - xm‖ ^ 2 := sorry

Tactic 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
v : ℕ+ → E :=
  fun k =>
    Nesterov_first.x f h f' x0 (↑k - 1) +
      (1 / Nesterov_first.γ f h f' x0 (↑k - 1)) • (Nesterov_first.x f h f' x0 ↑k - Nesterov_first.x f h f' x0 (↑k - 1))
eq :
  ∀ (k : ℕ+),
    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 • v k
eq2 :
  ∀ (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)
            ((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 / (2 * Nesterov_first.t f h f' x0 k) *
        (‖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‖ ^
            2 -
          ‖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.γ f h f' x0 k • xm‖ ^
            2)
φieq4 :
  ∀ (k : ℕ+),
    φ (Nesterov_first.x f h f' x0 (↑k + 1)) - φ xm -
        (1 - Nesterov_first.γ f h f' x0 ↑k) * (φ (Nesterov_first.x f h f' x0 ↑k) - φ xm) ≤
      Nesterov_first.γ f h f' x0 ↑k ^ 2 / (2 * Nesterov_first.t f h f' x0 ↑k) * (‖v k - xm‖ ^ 2 - ‖v (k + 1) - xm‖ ^ 2)
α : ℕ → ℝ := fun k => 2 * Nesterov_first.t f h f' x0 k / Nesterov_first.γ f h f' x0 k ^ 2
αpos : ∀ (n : ℕ), 0 < α n
cond' : ∀ (n : ℕ+), (1 - Nesterov_first.γ f h f' x0 ↑n) * α ↑n ≤ α (↑n - 1)
h10 : ∀ (n : ℕ), α n * (Nesterov_first.γ f h f' x0 n ^ 2 / (2 * Nesterov_first.t f h f' x0 n)) = 1
decrease :
  ∀ (n : ℕ+),
    α ↑n * (φ (Nesterov_first.x f h f' x0 (↑n + 1)) - φ xm) + ‖v (n + 1) - xm‖ ^ 2 ≤
      α (↑n - 1) * (φ (Nesterov_first.x f h f' x0 ↑n) - φ xm) + ‖v n - xm‖ ^ 2
nr : ℕ → ℝ := fun n => α n * (φ (Nesterov_first.x f h f' x0 (n + 1)) - φ xm) + ‖v (n + 1).toPNat' - xm‖ ^ 2
nrdiff : ∀ (n : ℕ+), nr ↑n - nr (↑n - 1) ≤ 0
k : ℕ
bound : nr k ≤ nr 0
φieq3 :
  φ (Nesterov_first.x f h f' x0 1) ≤
    (Nesterov_first.t f h f' x0 0)⁻¹ *
          inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0) (xm - Nesterov_first.x f h f' x0 1) +
        (Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ * ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2 +
      φ xm
⊢ 2 * Nesterov_first.t f h f' x0 0 *
        ((Nesterov_first.t f h f' x0 0)⁻¹ *
                inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0)
                  (xm - Nesterov_first.x f h f' x0 1) +
              (Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ *
                ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2 +
            φ xm -
          φ xm) +
      ‖Nesterov_first.x f h f' x0 1 - xm‖ ^ 2 =
    ‖Nesterov_first.x f h f' x0 0 - xm‖ ^ 2

Tactic: rw [← add_sub, sub_self, add_zero, mul_add, ← mul_assoc]

Tactic 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
 v : ℕ+ → E :=
   fun k =>
     Nesterov_first.x f h f' x0 (↑k - 1) +
       (1 / Nesterov_first.γ f h f' x0 (↑k - 1)) • (Nesterov_first.x f h f' x0 ↑k - Nesterov_first.x f h f' x0 (↑k - 1))
 eq :
   ∀ (k : ℕ+),
     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 • v k
 eq2 :
   ∀ (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)
             ((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 / (2 * Nesterov_first.t f h f' x0 k) *
         (‖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‖ ^
             2 -
           ‖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.γ f h f' x0 k • xm‖ ^
             2)
 φieq4 :
   ∀ (k : ℕ+),
     φ (Nesterov_first.x f h f' x0 (↑k + 1)) - φ xm -
         (1 - Nesterov_first.γ f h f' x0 ↑k) * (φ (Nesterov_first.x f h f' x0 ↑k) - φ xm) ≤
       Nesterov_first.γ f h f' x0 ↑k ^ 2 / (2 * Nesterov_first.t f h f' x0 ↑k) * (‖v k - xm‖ ^ 2 - ‖v (k + 1) - xm‖ ^ 2)
 α : ℕ → ℝ := fun k => 2 * Nesterov_first.t f h f' x0 k / Nesterov_first.γ f h f' x0 k ^ 2
 αpos : ∀ (n : ℕ), 0 < α n
 cond' : ∀ (n : ℕ+), (1 - Nesterov_first.γ f h f' x0 ↑n) * α ↑n ≤ α (↑n - 1)
 h10 : ∀ (n : ℕ), α n * (Nesterov_first.γ f h f' x0 n ^ 2 / (2 * Nesterov_first.t f h f' x0 n)) = 1
 decrease :
   ∀ (n : ℕ+),
     α ↑n * (φ (Nesterov_first.x f h f' x0 (↑n + 1)) - φ xm) + ‖v (n + 1) - xm‖ ^ 2 ≤
       α (↑n - 1) * (φ (Nesterov_first.x f h f' x0 ↑n) - φ xm) + ‖v n - xm‖ ^ 2
 nr : ℕ → ℝ := fun n => α n * (φ (Nesterov_first.x f h f' x0 (n + 1)) - φ xm) + ‖v (n + 1).toPNat' - xm‖ ^ 2
 nrdiff : ∀ (n : ℕ+), nr ↑n - nr (↑n - 1) ≤ 0
 k : ℕ
 bound : nr k ≤ nr 0
 φieq3 :
   φ (Nesterov_first.x f h f' x0 1) ≤
     (Nesterov_first.t f h f' x0 0)⁻¹ *
           inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0) (xm - Nesterov_first.x f h f' x0 1) +
         (Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ * ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2 +
       φ xm
 ⊢ 2 * Nesterov_first.t f h f' x0 0 * (Nesterov_first.t f h f' x0 0)⁻¹ *
           inner (Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0) (xm - Nesterov_first.x f h f' x0 1) +
         2 * Nesterov_first.t f h f' x0 0 *
           ((Nesterov_first.t f h f' x0 0)⁻¹ * 2⁻¹ *
             ‖Nesterov_first.x f h f' x0 1 - Nesterov_first.y f h f' x0 0‖ ^ 2) +
       ‖Nesterov_first.x f h f' x0 1 - xm‖ ^ 2 =
     ‖Nesterov_first.x f h f' x0 0 - xm‖ ^ 2]

Premises used:
sub_self : ∀ {G : Type u_1} [inst : AddGroup G] (a : G), a - a = 0
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_assoc : ∀ {G : Type u_1} [inst : Semigroup G] (a b c : G), a * b * c = a * (b * c)
add_zero : ∀ {M : Type u} [inst : AddZeroClass M] (a : M), a + 0 = a