-- File: optlib/Optlib/Algorithm/SubgradientMethod.lean
Theorem statement:
theorem extracted_formal_statement_106.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] {f : E → ℝ} (xm x₀ : E) {alg : subgradient_method f x₀} {s : ℝ}
  (hm : IsMinOn f Set.univ xm) (ha' : ∀ (n : ℕ), subgradient_method.a f x₀ n * ‖subgradient_method.g f x₀ n‖ = s)
  (hs : s > 0) (k : ℕ)
  (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})
  (hnek : Nonempty { x // x ∈ Finset.range (k + 1) })
  (h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2)
  (inq₂ :
    2 * subgradient_method.a f x₀ i *
        (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) ≤
      2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ)
  (h_original_goal :
    ‖subgradient_method.x f x₀ i - xm‖ ^ 2 +
        (-(2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ) +
          ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2)) :
  -(2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ) +
      ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2 := sorry

Tactic state before:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
inst✝ : CompleteSpace E
f : E → ℝ
xm x₀ : E
alg : subgradient_method f x₀
s : ℝ
hm : IsMinOn f Set.univ xm
ha' : ∀ (n : ℕ), subgradient_method.a f x₀ n * ‖subgradient_method.g f x₀ n‖ = s
hs : s > 0
k : ℕ
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}
hnek : Nonempty { x // x ∈ Finset.range (k + 1) }
h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2
inq₂ :
  2 * subgradient_method.a f x₀ i *
      (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) ≤
    2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ
⊢ ‖subgradient_method.x f x₀ i - xm‖ ^ 2 +
      (-(2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ) +
        ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2)

Tactic: apply add_le_add_left

Tactic state after:
[case bc
 E : Type u_1
 inst✝² : NormedAddCommGroup E
 inst✝¹ : InnerProductSpace ℝ E
 inst✝ : CompleteSpace E
 f : E → ℝ
 xm x₀ : E
 alg : subgradient_method f x₀
 s : ℝ
 hm : IsMinOn f Set.univ xm
 ha' : ∀ (n : ℕ), subgradient_method.a f x₀ n * ‖subgradient_method.g f x₀ n‖ = s
 hs : s > 0
 k : ℕ
 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}
 hnek : Nonempty { x // x ∈ Finset.range (k + 1) }
 h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2
 inq₂ :
   2 * subgradient_method.a f x₀ i *
       (sInf {x | ∃ i ∈ Finset.range (k + 1), f (subgradient_method.x f x₀ i) = x} - f xm) ≤
     2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ
 ⊢ -(2 * ⟪subgradient_method.x f x₀ i - xm, subgradient_method.a f x₀ i • subgradient_method.g f x₀ i⟫_ℝ) +
       ‖subgradient_method.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 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.a f x₀ i‖ ^ 2 * ‖subgradient_method.g f x₀ i‖ ^ 2]

Premises used:
add_le_add_left : ∀ {α : Type u_1} [inst : Add α] [inst_3 : LE α] [inst_4 : AddLeftMono α] {b c : α},
  b ≤ c → ∀ (a : α), a + b ≤ a + c