zzhisthebest/LeanBenchmark huggingface dataset:
import Mathlib
import FoML


open MeasureTheory Filter Finset Real

open scoped MeasureTheory ProbabilityTheory ENNReal NNReal

theorem extracted_formal_statement_1.{u_1} {Ω : Type u_1} {m : MeasurableSpace Ω} {μ : Measure Ω}
  [inst : IsFiniteMeasure μ] (t a b : ℝ) {X : Ω → ℝ} (hX : AEMeasurable X μ) (h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b) :
  let e := fun t ω => rexp (t * X ω);
  let e' := fun t ω => rexp (t * X ω) * X ω;
  Integrable (e' t) μ ∧ HasDerivAt (fun t => ∫ (x : Ω), e t x ∂μ) (∫ (x : Ω), e' t x ∂μ) t →
    ∀ᵐ (a : Ω) ∂μ, ∀ x ∈ Metric.ball t (|t| + 1), HasDerivAt (fun x => e x a) (e' x a) x := sorry

Tactic state before:
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
t a b : ℝ
X : Ω → ℝ
hX : AEMeasurable X μ
h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
c : ℝ := ‖a‖ ⊔ ‖b‖
e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
⊢ Integrable (e' t) μ ∧ HasDerivAt (fun t => ∫ (x : Ω), e t x ∂μ) (∫ (x : Ω), e' t x ∂μ) t

Tactic:
apply hasDerivAt_integral_of_dominated_loc_of_deriv_le
    · exact LE.le.trans_lt (abs_nonneg t) (lt_add_one |t|)
    ·
  exact
    Filter.Eventually.of_forall (by intro t'; apply aemeasurable_expt _ hX : ∀ (x : ℝ), AEStronglyMeasurable (e x) μ)
    · simp only [e]; apply integrable_expt_bound hX h
    ·
  simp only [e']
  to_theorem
    apply
      AEMeasurable.aestronglyMeasurable;apply
      AEMeasurable.mul _ hX apply Measurable.comp_aemeasurable' _ _· exact measurable_exp· exact hX.const_mul t

Tactic state after:
[case h_bound
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝ : IsFiniteMeasure μ
 t a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 c : ℝ := ‖a‖ ⊔ ‖b‖
 e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
 e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
 ⊢ ∀ᵐ (a : Ω) ∂μ, ∀ x ∈ Metric.ball t (|t| + 1), ‖e' x a‖ ≤ ?bound a,
 case bound_integrable
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝ : IsFiniteMeasure μ
 t a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 c : ℝ := ‖a‖ ⊔ ‖b‖
 e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
 e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
 ⊢ Integrable ?bound μ,
 case h_diff
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝ : IsFiniteMeasure μ
 t a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 c : ℝ := ‖a‖ ⊔ ‖b‖
 e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
 e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
 ⊢ ∀ᵐ (a : Ω) ∂μ, ∀ x ∈ Metric.ball t (|t| + 1), HasDerivAt (fun x => e x a) (e' x a) x,
 case bound
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝ : IsFiniteMeasure μ
 t a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 c : ℝ := ‖a‖ ⊔ ‖b‖
 e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
 e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
 ⊢ Ω → ℝ]
import Mathlib
import FoML


open MeasureTheory Filter Finset Real

open scoped MeasureTheory ProbabilityTheory ENNReal NNReal

theorem extracted_formal_statement_2.{u_1} {Ω : Type u_1} {m : MeasurableSpace Ω} {μ : Measure Ω}
  [inst : IsFiniteMeasure μ] (t a b : ℝ) {X : Ω → ℝ} (hX : AEMeasurable X μ) (h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b) :
  AEStronglyMeasurable (fun ω => rexp (t * X ω) * X ω) μ := sorry

Tactic state before:
case hF'_meas
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
t a b : ℝ
X : Ω → ℝ
hX : AEMeasurable X μ
h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
c : ℝ := ‖a‖ ⊔ ‖b‖
e : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω)
e' : ℝ → Ω → ℝ := fun t ω => rexp (t * X ω) * X ω
⊢ AEStronglyMeasurable (fun ω => rexp (t * X ω) * X ω) μ

Tactic:
apply AEMeasurable.aestronglyMeasurable
    apply AEMeasurable.mul _ hX
    apply Measurable.comp_aemeasurable' _ _
    · exact measurable_exp
    · exact hX.const_mul t

Tactic state after:
import Mathlib
import FoML


open MeasureTheory Filter Finset Real

open scoped MeasureTheory ProbabilityTheory ENNReal NNReal

theorem extracted_formal_statement_4.{u_1} {Ω : Type u_1} {m : MeasurableSpace Ω} {μ : Measure Ω}
  [inst : IsFiniteMeasure μ] (t : ℝ) {X : Ω → ℝ} (hX : AEMeasurable X μ) (ω : Ω)
  (w : (∂μ.tilted fun x => t * X x/∂μ) ω = ENNReal.ofReal (rexp (t * X ω) / ∫ (x : Ω), rexp (t * X x) ∂μ)) :
  0 ≤ ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ := sorry

Tactic state before:
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
t : ℝ
f : ℝ → ℝ
X : Ω → ℝ
hX : AEMeasurable X μ
ω : Ω
w : (∂μ.tilted fun x => t * X x/∂μ) ω = ENNReal.ofReal (rexp (t * X ω) / ∫ (x : Ω), rexp (t * X x) ∂μ)
⊢ 0 ≤ ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ

Tactic:
apply integral_nonneg
    apply Pi.le_def.mpr _
    intro i
    simp only [Pi.zero_apply]
    exact exp_nonneg (t * X i)

Tactic state after:
import Mathlib
import Optlib


open Set

theorem extracted_formal_statement_0.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] [inst_3 : ProperSpace E] {x₀ : E} {f : E → ℝ} {f' : E → E} {h : E → ℝ}
  {alg : proximal_gradient_method f h f' x₀} (k : ℕ+)
  (h_original_goal :
    f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
          f (proximal_gradient_method.xm f h f' x₀) -
        h (proximal_gradient_method.xm f h f' x₀) ≤
      1 / (2 * ↑↑k * proximal_gradient_method.t f h f' x₀) * ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2) :
  2 * ↑↑k * proximal_gradient_method.t f h f' x₀ *
      (f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
          f (proximal_gradient_method.xm f h f' x₀) -
        h (proximal_gradient_method.xm f h f' x₀)) ≤
    ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2 := sorry

Tactic state before:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
inst✝¹ : CompleteSpace E
inst✝ : ProperSpace E
x₀ : E
f : E → ℝ
f' : E → E
h : E → ℝ
alg : proximal_gradient_method f h f' x₀
k : ℕ+
⊢ f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
        f (proximal_gradient_method.xm f h f' x₀) -
      h (proximal_gradient_method.xm f h f' x₀) ≤
    1 / (2 * ↑↑k * proximal_gradient_method.t f h f' x₀) * ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2

Tactic:
rw [mul_comm, mul_one_div, le_div_iff₀, mul_comm]
    have th : ContinuousOn (alg.t • h) univ := by apply ContinuousOn.const_smul alg.h₃ alg.t
    have th' : ConvexOn ℝ univ (alg.t • h) := by apply ConvexOn.smul; linarith [alg.tpos]; apply alg.hconv
    let Gt := fun x ↦ (1 / alg.t) • (x - prox_point_c' (alg.t • h) (x - alg.t • f' x) th th')
    let φ := fun x ↦ f x + h x

Tactic state after:
[E : Type u_1
 inst✝³ : NormedAddCommGroup E
 inst✝² : InnerProductSpace ℝ E
 inst✝¹ : CompleteSpace E
 inst✝ : ProperSpace E
 x₀ : E
 f : E → ℝ
 f' : E → E
 h : E → ℝ
 alg : proximal_gradient_method f h f' x₀
 k : ℕ+
 th : ContinuousOn (proximal_gradient_method.t f h f' x₀ • h) univ
 th' : ConvexOn ℝ univ (proximal_gradient_method.t f h f' x₀ • h)
 Gt : E → E :=
   fun x =>
     (1 / proximal_gradient_method.t f h f' x₀) •
       (x -
         prox_point_c' (proximal_gradient_method.t f h f' x₀ • h) (x - proximal_gradient_method.t f h f' x₀ • f' x) th
           th')
 φ : E → ℝ := fun x => f x + h x
 ⊢ 2 * ↑↑k * proximal_gradient_method.t f h f' x₀ *
       (f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
           f (proximal_gradient_method.xm f h f' x₀) -
         h (proximal_gradient_method.xm f h f' x₀)) ≤
     ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2,
 E : Type u_1
 inst✝³ : NormedAddCommGroup E
 inst✝² : InnerProductSpace ℝ E
 inst✝¹ : CompleteSpace E
 inst✝ : ProperSpace E
 x₀ : E
 f : E → ℝ
 f' : E → E
 h : E → ℝ
 alg : proximal_gradient_method f h f' x₀
 k : ℕ+
 ⊢ 0 < 2 * ↑↑k * proximal_gradient_method.t f h f' x₀]
import Mathlib
import Optlib


open Set

theorem extracted_formal_statement_1.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] [inst_3 : ProperSpace E] {x₀ : E} {f : E → ℝ} {f' : E → E} {h : E → ℝ}
  {alg : proximal_gradient_method f h f' x₀} (k : ℕ+)
  (h_original_goal :
    f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
          f (proximal_gradient_method.xm f h f' x₀) -
        h (proximal_gradient_method.xm f h f' x₀) ≤
      1 / (2 * ↑↑k * proximal_gradient_method.t f h f' x₀) * ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2) :
  0 < 2 * ↑↑k * proximal_gradient_method.t f h f' x₀ := sorry

Tactic state before:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
inst✝¹ : CompleteSpace E
inst✝ : ProperSpace E
x₀ : E
f : E → ℝ
f' : E → E
h : E → ℝ
alg : proximal_gradient_method f h f' x₀
k : ℕ+
⊢ f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
        f (proximal_gradient_method.xm f h f' x₀) -
      h (proximal_gradient_method.xm f h f' x₀) ≤
    1 / (2 * ↑↑k * proximal_gradient_method.t f h f' x₀) * ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2

Tactic:
rw [mul_comm, mul_one_div, le_div_iff₀, mul_comm]
    have th : ContinuousOn (alg.t • h) univ := by apply ContinuousOn.const_smul alg.h₃ alg.t
    have th' : ConvexOn ℝ univ (alg.t • h) := by apply ConvexOn.smul; linarith [alg.tpos]; apply alg.hconv
    let Gt := fun x ↦ (1 / alg.t) • (x - prox_point_c' (alg.t • h) (x - alg.t • f' x) th th')
    let φ := fun x ↦ f x + h x

Tactic state after:
[E : Type u_1
 inst✝³ : NormedAddCommGroup E
 inst✝² : InnerProductSpace ℝ E
 inst✝¹ : CompleteSpace E
 inst✝ : ProperSpace E
 x₀ : E
 f : E → ℝ
 f' : E → E
 h : E → ℝ
 alg : proximal_gradient_method f h f' x₀
 k : ℕ+
 th : ContinuousOn (proximal_gradient_method.t f h f' x₀ • h) univ
 th' : ConvexOn ℝ univ (proximal_gradient_method.t f h f' x₀ • h)
 Gt : E → E :=
   fun x =>
     (1 / proximal_gradient_method.t f h f' x₀) •
       (x -
         prox_point_c' (proximal_gradient_method.t f h f' x₀ • h) (x - proximal_gradient_method.t f h f' x₀ • f' x) th
           th')
 φ : E → ℝ := fun x => f x + h x
 ⊢ 2 * ↑↑k * proximal_gradient_method.t f h f' x₀ *
       (f (proximal_gradient_method.x f h f' x₀ ↑k) + h (proximal_gradient_method.x f h f' x₀ ↑k) -
           f (proximal_gradient_method.xm f h f' x₀) -
         h (proximal_gradient_method.xm f h f' x₀)) ≤
     ‖x₀ - proximal_gradient_method.xm f h f' x₀‖ ^ 2,
 E : Type u_1
 inst✝³ : NormedAddCommGroup E
 inst✝² : InnerProductSpace ℝ E
 inst✝¹ : CompleteSpace E
 inst✝ : ProperSpace E
 x₀ : E
 f : E → ℝ
 f' : E → E
 h : E → ℝ
 alg : proximal_gradient_method f h f' x₀
 k : ℕ+
 ⊢ 0 < 2 * ↑↑k * proximal_gradient_method.t f h f' x₀]
import Mathlib
import Optlib


open Set

theorem extracted_formal_statement_4.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] [inst_3 : ProperSpace E] {x₀ : E} {f : E → ℝ} {f' : E → E} {h : E → ℝ}
  {alg : proximal_gradient_method f h f' x₀} (th : ContinuousOn (proximal_gradient_method.t f h f' x₀ • h) univ)
  (th' : ConvexOn ℝ univ (proximal_gradient_method.t f h f' x₀ • h)) :
  let Gt := fun x =>
    (1 / proximal_gradient_method.t f h f' x₀) •
      (x -
        prox_point_c' (proximal_gradient_method.t f h f' x₀ • h) (x - proximal_gradient_method.t f h f' x₀ • f' x) th
          th');
  (∀ (z : E), Gt z - f' z ∈ SubderivAt h (z - proximal_gradient_method.t f h f' x₀ • Gt z)) →
    (∀ (x : E),
        f (x - proximal_gradient_method.t f h f' x₀ • Gt x) ≤
          f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
            proximal_gradient_method.t f h f' x₀ ^ 2 * ↑(proximal_gradient_method.L f h f' x₀) / 2 * ‖Gt x‖ ^ 2) →
      ∀ (x : E),
        f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
            proximal_gradient_method.t f h f' x₀ ^ 2 * ↑(proximal_gradient_method.L f h f' x₀) / 2 * ‖Gt x‖ ^ 2 ≤
          f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
            proximal_gradient_method.t f h f' x₀ / 2 * ‖Gt x‖ ^ 2 := sorry

Tactic state before:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
inst✝¹ : CompleteSpace E
inst✝ : ProperSpace E
x₀ : E
f : E → ℝ
f' : E → E
h : E → ℝ
alg : proximal_gradient_method f h f' x₀
k : ℕ+
th : ContinuousOn (proximal_gradient_method.t f h f' x₀ • h) univ
th' : ConvexOn ℝ univ (proximal_gradient_method.t f h f' x₀ • h)
Gt : E → E :=
  fun x =>
    (1 / proximal_gradient_method.t f h f' x₀) •
      (x -
        prox_point_c' (proximal_gradient_method.t f h f' x₀ • h) (x - proximal_gradient_method.t f h f' x₀ • f' x) th
          th')
φ : E → ℝ := fun x => f x + h x
hG : ∀ (z : E), Gt z - f' z ∈ SubderivAt h (z - proximal_gradient_method.t f h f' x₀ • Gt z)
fieq1 :
  ∀ (x : E),
    f (x - proximal_gradient_method.t f h f' x₀ • Gt x) ≤
      f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
        proximal_gradient_method.t f h f' x₀ ^ 2 * ↑(proximal_gradient_method.L f h f' x₀) / 2 * ‖Gt x‖ ^ 2
x : E
⊢ f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
      proximal_gradient_method.t f h f' x₀ ^ 2 * ↑(proximal_gradient_method.L f h f' x₀) / 2 * ‖Gt x‖ ^ 2 ≤
    f x - proximal_gradient_method.t f h f' x₀ * inner (f' x) (Gt x) +
      proximal_gradient_method.t f h f' x₀ / 2 * ‖Gt x‖ ^ 2

Tactic:
apply add_le_add_left
    apply mul_le_mul_of_nonneg_right
    apply div_le_div_of_nonneg_right _ (by norm_num)
    calc
  alg.t ^ 2 * alg.L ≤ alg.t * (1 / alg.L) * alg.L := by
    rw [pow_two]; apply mul_le_mul_of_nonneg_right
    rw [mul_le_mul_left alg.tpos]; exact alg.step; simp
  _ = alg.t := by field_simp; rw [← mul_div, div_self (by linarith [alg.hL]), mul_one]
    exact sq_nonneg _

Tactic state after:
import Mathlib
import Optlib


open Filter Topology Set InnerProductSpace Finset

open Finset

theorem extracted_formal_statement_0.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] {f : E → ℝ} {G : NNReal} (hf : ConvexOn ℝ Set.univ f) (hc : ContinuousOn f Set.univ)
  (h : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑G) (x y gx : E) (hx₁ : gx ∈ SubderivAt f x) (hx₃ : ‖gx‖ ≤ ↑G)
  (hx₂ : f y ≥ f x + ⟪gx, y - x⟫_ℝ) (hx₄ : f x - f y ≤ ⟪gx, x - y⟫_ℝ) (gy : E) (hy₁ : gy ∈ SubderivAt f y)
  (hy₃ : ‖gy‖ ≤ ↑G) (hy₂ : f x ≥ f y + ⟪gy, x - y⟫_ℝ) (hy₄ : f x - f y ≥ ⟪gy, x - y⟫_ℝ) (hG₁ : ↑G = ENNReal.ofReal ↑G)
  (h_original_goal : edist (f x) (f y) ≤ ↑G * edist x y) : dist (f x) (f y) ≤ ↑G * dist x y := sorry

Tactic state before:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
inst✝ : CompleteSpace E
f : E → ℝ
G : NNReal
hf : ConvexOn ℝ Set.univ f
hc : ContinuousOn f Set.univ
h : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑G
x y gx : E
hx₁ : gx ∈ SubderivAt f x
hx₃ : ‖gx‖ ≤ ↑G
hx₂ : f y ≥ f x + ⟪gx, y - x⟫_ℝ
hx₄ : f x - f y ≤ ⟪gx, x - y⟫_ℝ
gy : E
hy₁ : gy ∈ SubderivAt f y
hy₃ : ‖gy‖ ≤ ↑G
hy₂ : f x ≥ f y + ⟪gy, x - y⟫_ℝ
hy₄ : f x - f y ≥ ⟪gy, x - y⟫_ℝ
hG₁ : ↑G = ENNReal.ofReal ↑G
⊢ edist (f x) (f y) ≤ ↑G * edist x y

Tactic:
rw [edist_dist, edist_dist, hG₁]
    have hG₂ : ENNReal.ofReal (↑G * (dist x y)) = ENNReal.ofReal ↑G * ENNReal.ofReal (dist x y) := by
  apply ENNReal.ofReal_mul; simp
    rw [← hG₂]
    have hG₃ : 0 ≤ ↑G * dist x y := Right.mul_nonneg NNReal.zero_le_coe dist_nonneg
    apply (ENNReal.ofReal_le_ofReal_iff hG₃).mpr

Tactic state after:
[case intro.intro
 E : Type u_1
 inst✝² : NormedAddCommGroup E
 inst✝¹ : InnerProductSpace ℝ E
 inst✝ : CompleteSpace E
 f : E → ℝ
 G : NNReal
 hf : ConvexOn ℝ Set.univ f
 hc : ContinuousOn f Set.univ
 h : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑G
 x y gx : E
 hx₁ : gx ∈ SubderivAt f x
 hx₃ : ‖gx‖ ≤ ↑G
 hx₂ : f y ≥ f x + ⟪gx, y - x⟫_ℝ
 hx₄ : f x - f y ≤ ⟪gx, x - y⟫_ℝ
 gy : E
 hy₁ : gy ∈ SubderivAt f y
 hy₃ : ‖gy‖ ≤ ↑G
 hy₂ : f x ≥ f y + ⟪gy, x - y⟫_ℝ
 hy₄ : f x - f y ≥ ⟪gy, x - y⟫_ℝ
 hG₁ : ↑G = ENNReal.ofReal ↑G
 hG₂ : ENNReal.ofReal (↑G * dist x y) = ENNReal.ofReal ↑G * ENNReal.ofReal (dist x y)
 hG₃ : 0 ≤ ↑G * dist x y
 ⊢ dist (f x) (f y) ≤ ↑G * dist x y]
import Mathlib
import Optlib


open Filter Topology Set InnerProductSpace Finset

open Finset

theorem extracted_formal_statement_1.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  [inst_2 : CompleteSpace E] {f : E → ℝ} {G : NNReal} (hf : ConvexOn ℝ Set.univ f) (hc : ContinuousOn f Set.univ)
  (h : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑G) (x y gx : E) (hx₁ : gx ∈ SubderivAt f x) (hx₃ : ‖gx‖ ≤ ↑G)
  (hx₂ : f y ≥ f x + ⟪gx, y - x⟫_ℝ) (hx₄ : f x - f y ≤ ⟪gx, x - y⟫_ℝ) (gy : E) (hy₁ : gy ∈ SubderivAt f y)
  (hy₃ : ‖gy‖ ≤ ↑G) (hy₂ : f x ≥ f y + ⟪gy, x - y⟫_ℝ) (hy₄ : f x - f y ≥ ⟪gy, x - y⟫_ℝ) (hG₁ : ↑G = ENNReal.ofReal ↑G)
  (hG₂ : ENNReal.ofReal (↑G * dist x y) = ENNReal.ofReal ↑G * ENNReal.ofReal (dist x y)) (hG₃ : 0 ≤ ↑G * dist x y)
  (h₁ : dist (f x) (f y) = |f x - f y|) : dist (f x) (f y) ≤ ↑G * dist x y := sorry

Tactic state before:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
inst✝ : CompleteSpace E
f : E → ℝ
G : NNReal
hf : ConvexOn ℝ Set.univ f
hc : ContinuousOn f Set.univ
h : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑G
x y gx : E
hx₁ : gx ∈ SubderivAt f x
hx₃ : ‖gx‖ ≤ ↑G
hx₂ : f y ≥ f x + ⟪gx, y - x⟫_ℝ
hx₄ : f x - f y ≤ ⟪gx, x - y⟫_ℝ
gy : E
hy₁ : gy ∈ SubderivAt f y
hy₃ : ‖gy‖ ≤ ↑G
hy₂ : f x ≥ f y + ⟪gy, x - y⟫_ℝ
hy₄ : f x - f y ≥ ⟪gy, x - y⟫_ℝ
hG₁ : ↑G = ENNReal.ofReal ↑G
hG₂ : ENNReal.ofReal (↑G * dist x y) = ENNReal.ofReal ↑G * ENNReal.ofReal (dist x y)
hG₃ : 0 ≤ ↑G * dist x y
h₁ : dist (f x) (f y) = |f x - f y|
⊢ dist (f x) (f y) ≤ ↑G * dist x y

Tactic:
rw [h₁, dist_eq_norm x y]
    apply abs_le.mpr
    constructor
    ·
  calc
    f x - f y ≥ inner gy (x - y) := hy₄
    _ ≥ -(‖gy‖ * ‖x - y‖) := by
      apply neg_le_of_neg_le
      rw [← inner_neg_right, neg_sub, norm_sub_rev]
      apply real_inner_le_norm
    _ ≥ -(↑G * ‖x - y‖) := neg_le_neg (mul_le_mul_of_nonneg_right hy₃ (norm_nonneg _))
    ·
  calc
    f x - f y ≤ inner gx (x - y) := hx₄
    _ ≤ ‖gx‖ * ‖x - y‖ := (real_inner_le_norm _ _)
    _ ≤ ↑G * ‖x - y‖ := mul_le_mul_of_nonneg_right hx₃ (norm_nonneg _)

Tactic state after:
import Mathlib
import Optlib


open Filter Topology Set InnerProductSpace Finset

open Finset

theorem extracted_formal_statement_2.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  {f : E → ℝ} (xm x₀ : E) {alg : subgradient_method f x₀}
  (h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f x₀))
  (hk₀ : f xm ≥ f (subgradient_method.x f x₀ 0) + ⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ)
  (h₀' : ‖subgradient_method.g f x₀ 0‖ ≤ ↑(subgradient_method.G f x₀))
  (h_original_goal :
    2 * subgradient_method.a f x₀ 0 * (f (subgradient_method.x f x₀ 0) - f xm) ≤
      ‖x₀ - xm‖ ^ 2 + ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ 0 ^ 2) :
  (f (subgradient_method.x f x₀ 0) - f xm) * subgradient_method.a f x₀ 0 ≤
    ‖x₀ - xm‖ * ↑(subgradient_method.G f x₀) * subgradient_method.a f x₀ 0 := sorry

Tactic state before:
case pos
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
hk₀ : f xm ≥ f (subgradient_method.x f x₀ 0) + ⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ
h₀' : ‖subgradient_method.g f x₀ 0‖ ≤ ↑(subgradient_method.G f x₀)
⊢ 2 * subgradient_method.a f x₀ 0 * (f (subgradient_method.x f x₀ 0) - f xm) ≤
    ‖x₀ - xm‖ ^ 2 + ↑(subgradient_method.G f x₀) ^ 2 * subgradient_method.a f x₀ 0 ^ 2

Tactic:
rw [← mul_pow]
    apply le_trans _ (two_mul_le_add_sq _ _)
    rw [mul_assoc, mul_assoc]
    apply (mul_le_mul_left two_pos).mpr
    rw [mul_comm, ← mul_assoc]

Tactic state after:
[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
 hk₀ : f xm ≥ f (subgradient_method.x f x₀ 0) + ⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ
 h₀' : ‖subgradient_method.g f x₀ 0‖ ≤ ↑(subgradient_method.G f x₀)
 ⊢ (f (subgradient_method.x f x₀ 0) - f xm) * subgradient_method.a f x₀ 0 ≤
     ‖x₀ - xm‖ * ↑(subgradient_method.G f x₀) * subgradient_method.a f x₀ 0]
import Mathlib
import Optlib


open Filter Topology Set InnerProductSpace Finset

open Finset

theorem extracted_formal_statement_3.{u_1} {E : Type u_1} [inst : NormedAddCommGroup E] [inst_1 : InnerProductSpace ℝ E]
  {f : E → ℝ} (xm x₀ : E) {alg : subgradient_method f x₀}
  (h' : ∀ ⦃x g : E⦄, g ∈ SubderivAt f x → ‖g‖ ≤ ↑(subgradient_method.G f x₀))
  (hk₀ : f xm ≥ f (subgradient_method.x f x₀ 0) + ⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ)
  (h₀' : ‖subgradient_method.g f x₀ 0‖ ≤ ↑(subgradient_method.G f x₀))
  (this : f (subgradient_method.x f x₀ 0) - f xm ≤ -⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ) :
  f (subgradient_method.x f x₀ 0) - f xm ≤ ‖x₀ - xm‖ * ↑(subgradient_method.G f x₀) := sorry

Tactic state before:
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
hk₀ : f xm ≥ f (subgradient_method.x f x₀ 0) + ⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ
h₀' : ‖subgradient_method.g f x₀ 0‖ ≤ ↑(subgradient_method.G f x₀)
this : f (subgradient_method.x f x₀ 0) - f xm ≤ -⟪subgradient_method.g f x₀ 0, xm - subgradient_method.x f x₀ 0⟫_ℝ
⊢ f (subgradient_method.x f x₀ 0) - f xm ≤ ‖x₀ - xm‖ * ↑(subgradient_method.G f x₀)

Tactic:
apply le_trans this _
    rw [← inner_neg_right, neg_sub, alg.initial]
    apply le_trans (real_inner_le_norm _ _) _
    rw [mul_comm]
    apply mul_le_mul_of_nonneg_left h₀' (norm_nonneg _)

Tactic state after: