import Mathlib
import Optlib


open Set Real

open Set Real PNat

theorem extracted_formal_statement_135.{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_second_fix_stepsize f h f' x0} {xm : E}
  (minφ : IsMinOn (f + h) univ xm) (k : ℕ)
  (h1 :
    f (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) + h (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) - f xm -
        h xm =
      f (Nesterov_second.x f h f' x0 (k + 1)) + h (Nesterov_second.x f h f' x0 (k + 1)) - f xm - h xm)
  (h2 :
    Nesterov_second_fix_stepsize.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second_fix_stepsize.t f h f' x0 (k + 1)) *
        ‖x0 - xm‖ ^ 2 =
      Nesterov_second.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second.t f h f' x0 (k + 1)) * ‖x0 - xm‖ ^ 2)
  (h_original_goal :
    f (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) + h (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) - f xm -
        h xm ≤
      Nesterov_second_fix_stepsize.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second_fix_stepsize.t f h f' x0 (k + 1)) *
        ‖x0 - xm‖ ^ 2) :
  f (Nesterov_second.x f h f' x0 (k + 1)) + h (Nesterov_second.x f h f' x0 (k + 1)) - f xm - h xm ≤
    Nesterov_second.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second.t f h f' x0 (k + 1)) * ‖x0 - 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_second_fix_stepsize f h f' x0
xm : E
minφ : IsMinOn (f + h) univ xm
k : ℕ
h1 :
  f (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) + h (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) - f xm -
      h xm =
    f (Nesterov_second.x f h f' x0 (k + 1)) + h (Nesterov_second.x f h f' x0 (k + 1)) - f xm - h xm
h2 :
  Nesterov_second_fix_stepsize.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second_fix_stepsize.t f h f' x0 (k + 1)) *
      ‖x0 - xm‖ ^ 2 =
    Nesterov_second.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second.t f h f' x0 (k + 1)) * ‖x0 - xm‖ ^ 2
⊢ f (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) + h (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) - f xm -
      h xm ≤
    Nesterov_second_fix_stepsize.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second_fix_stepsize.t f h f' x0 (k + 1)) *
      ‖x0 - xm‖ ^ 2

Tactic:
rw [h1, h2]

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_second_fix_stepsize f h f' x0
 xm : E
 minφ : IsMinOn (f + h) univ xm
 k : ℕ
 h1 :
   f (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) + h (Nesterov_second_fix_stepsize.x f h f' x0 (k + 1)) - f xm -
       h xm =
     f (Nesterov_second.x f h f' x0 (k + 1)) + h (Nesterov_second.x f h f' x0 (k + 1)) - f xm - h xm
 h2 :
   Nesterov_second_fix_stepsize.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second_fix_stepsize.t f h f' x0 (k + 1)) *
       ‖x0 - xm‖ ^ 2 =
     Nesterov_second.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second.t f h f' x0 (k + 1)) * ‖x0 - xm‖ ^ 2
 ⊢ f (Nesterov_second.x f h f' x0 (k + 1)) + h (Nesterov_second.x f h f' x0 (k + 1)) - f xm - h xm ≤
     Nesterov_second.γ f h f' x0 (k + 1) ^ 2 / (2 * Nesterov_second.t f h f' x0 (k + 1)) * ‖x0 - xm‖ ^ 2]