-- File: optlib/Optlib/Algorithm/SubgradientMethod.lean
Theorem statement:
theorem extracted_formal_statement_60.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  {f : E → ℝ} (xm x₀ : E) {alg : subgradient_method f x₀} (k : ℕ)
  (h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f x₀)) (k₀ : ¬k = 0)
  (heq :
    (Set.range fun x => f (subgradient_method.x f x₀ ↑x)) =
      {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x})
  ⦃i : ℕ⦄ (left : i ≥ 0) (hi₂ : i ≤ k)
  (this :
    ‖subgradient_method.x f x₀ i - xm‖ ^ 2 -
          2 * subgradient_method.a f x₀ i *
            (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) +
        ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2 =
      ‖subgradient_method.x f x₀ i - xm‖ ^ 2 +
          -(2 * subgradient_method.a f x₀ i *
              (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm)) +
        ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2)
  (inq₁ :
    ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2 ≤
      ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2)
  (hxm : f xm ≥ f (subgradient_method.x f x₀ i) + ⟪subgradient_method.g f x₀ i, xm - subgradient_method.x f x₀ i⟫_ℝ)
  (h_original_goal :
    f (subgradient_method.x f x₀ i) - ⟪subgradient_method.x f x₀ i - xm, subgradient_method.g f x₀ i⟫_ℝ ≤ f xm) :
  f (subgradient_method.x f x₀ i) + ⟪subgradient_method.g f x₀ i, xm - subgradient_method.x f x₀ i⟫_ℝ ≤ f xm := sorry

Tactic state before:
case a
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
f : E → ℝ
xm x₀ : E
alg : subgradient_method f x₀
k : ℕ
h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f x₀)
k₀ : ¬k = 0
heq :
  (Set.range fun x => f (subgradient_method.x f x₀ ↑x)) =
    {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x}
i : ℕ
left✝ : i ≥ 0
hi₂ : i ≤ k
this :
  ‖subgradient_method.x f x₀ i - xm‖ ^ 2 -
        2 * subgradient_method.a f x₀ i *
          (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) +
      ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2 =
    ‖subgradient_method.x f x₀ i - xm‖ ^ 2 +
        -(2 * subgradient_method.a f x₀ i *
            (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm)) +
      ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2
inq₁ :
  ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2 ≤
    ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2
hxm : f xm ≥ f (subgradient_method.x f x₀ i) + ⟪subgradient_method.g f x₀ i, xm - subgradient_method.x f x₀ i⟫_ℝ
⊢ f (subgradient_method.x f x₀ i) - ⟪subgradient_method.x f x₀ i - xm, subgradient_method.g f x₀ i⟫_ℝ ≤ f xm

Tactic: rw [sub_eq_add_neg, ← inner_neg_left, neg_sub, real_inner_comm]

Tactic state after:
[case a
 E : Type u_1
 inst✝¹ : NormedAddCommGroup E
 inst✝ : InnerProductSpace ℝ E
 f : E → ℝ
 xm x₀ : E
 alg : subgradient_method f x₀
 k : ℕ
 h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f x₀)
 k₀ : ¬k = 0
 heq :
   (Set.range fun x => f (subgradient_method.x f x₀ ↑x)) =
     {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x}
 i : ℕ
 left✝ : i ≥ 0
 hi₂ : i ≤ k
 this :
   ‖subgradient_method.x f x₀ i - xm‖ ^ 2 -
         2 * subgradient_method.a f x₀ i *
           (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) +
       ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2 =
     ‖subgradient_method.x f x₀ i - xm‖ ^ 2 +
         -(2 * subgradient_method.a f x₀ i *
             (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm)) +
       ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2
 inq₁ :
   ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2 ≤
     ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ i ^ 2
 hxm : f xm ≥ f (subgradient_method.x f x₀ i) + ⟪subgradient_method.g f x₀ i, xm - subgradient_method.x f x₀ i⟫_ℝ
 ⊢ f (subgradient_method.x f x₀ i) + ⟪subgradient_method.g f x₀ i, xm - subgradient_method.x f x₀ i⟫_ℝ ≤ f xm]

Premises used:
sub_eq_add_neg : ∀ {G : Type u_1} [inst : SubNegMonoid G] (a b : G), a - b = a + -b
real_inner_comm : ∀ {F : Type u_3} [inst : SeminormedAddCommGroup F] [inst_2 : InnerProductSpace ℝ F] (x y : F),
  ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ
neg_sub : ∀ {α : Type u_1} [inst : SubtractionMonoid α] (a b : α), -(a - b) = b - a
inner_neg_left : ∀ {𝕜 : Type u_1} {E : Type u_2} [inst : RCLike 𝕜] [inst_2 : SeminormedAddCommGroup E]
  [inst_3 : InnerProductSpace 𝕜 E] (x y : E), ⟪-x, y⟫_𝕜 = -⟪x, y⟫_𝕜