zzhisthebest/LeanBenchmark huggingface dataset:
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_56 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  let g := fun x => (1 / 2) • 2 • Aᵀ *ᵥ A *ᵥ x;
  (∀ (x : EuclideanSpace ℝ (Fin ↑n)), f' x = g x) → HasGradientAt f (f' x) x → HasGradientAt f (g x) x := sorry

Tactic state before:
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
g : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => (1 / 2) • 2 • Aᵀ *ᵥ A *ᵥ x
f'eqg : ∀ (x : EuclideanSpace ℝ (Fin ↑n)), f' x = g x
⊢ HasGradientAt f (f' x) x

Tactic:
rw [f'eqg]

Tactic state after:
[n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 g : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => (1 / 2) • 2 • Aᵀ *ᵥ A *ᵥ x
 f'eqg : ∀ (x : EuclideanSpace ℝ (Fin ↑n)), f' x = g x
 ⊢ HasGradientAt f (g x) x]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_57 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  let g := fun x => (1 / 2) • 2 • Aᵀ *ᵥ A *ᵥ x;
  (∀ (x : EuclideanSpace ℝ (Fin ↑n)), f' x = g x) → HasGradientAt f (g x) x := sorry

Tactic state before:
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
g : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => (1 / 2) • 2 • Aᵀ *ᵥ A *ᵥ x
f'eqg : ∀ (x : EuclideanSpace ℝ (Fin ↑n)), f' x = g x
⊢ HasGradientAt f (g x) x

Tactic:
apply HasGradientAt.const_mul' (1 / 2) (quadratic_gradient x)

Tactic state after:
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_58 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x := sorry

Tactic state before:
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
⊢ HasGradientAt h (h' x) x

Tactic:
apply linear_gradient

Tactic state after:
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_59 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      let φ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2;
      ∀ (z : EuclideanSpace ℝ (Fin ↑n)),
        φ z = f z - h z + 1 / 2 * b ⬝ᵥ b → 2⁻¹ * ‖A *ᵥ z - b‖ ^ 2 = f z - h z + 2⁻¹ * b ⬝ᵥ b := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ φ z = f z - h z + 1 / 2 * b ⬝ᵥ b

Tactic:
simp [φ]

Tactic state after:
[case h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 z : EuclideanSpace ℝ (Fin ↑n)
 ⊢ 2⁻¹ * ‖A *ᵥ z - b‖ ^ 2 = f z - h z + 2⁻¹ * b ⬝ᵥ b]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_60 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      ∀ (z : EuclideanSpace ℝ (Fin ↑n)),
        2⁻¹ * ‖A *ᵥ z - b‖ ^ 2 = f z - h z + 2⁻¹ * b ⬝ᵥ b →
          2⁻¹ * (A *ᵥ z - b) ⬝ᵥ (A *ᵥ z - b) = f z - h z + 2⁻¹ * b ⬝ᵥ b := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ 2⁻¹ * ‖A *ᵥ z - b‖ ^ 2 = f z - h z + 2⁻¹ * b ⬝ᵥ b

Tactic:
rw [norm2eq_dot]

Tactic state after:
[case h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 z : EuclideanSpace ℝ (Fin ↑n)
 ⊢ 2⁻¹ * (A *ᵥ z - b) ⬝ᵥ (A *ᵥ z - b) = f z - h z + 2⁻¹ * b ⬝ᵥ b]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_61 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      ∀ (z : EuclideanSpace ℝ (Fin ↑n)),
        2⁻¹ * (A *ᵥ z - b) ⬝ᵥ (A *ᵥ z - b) = f z - h z + 2⁻¹ * b ⬝ᵥ b →
          2⁻¹ * (A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z - (A *ᵥ z ⬝ᵥ b - b ⬝ᵥ b)) =
            2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ 2⁻¹ * (A *ᵥ z - b) ⬝ᵥ (A *ᵥ z - b) = f z - h z + 2⁻¹ * b ⬝ᵥ b

Tactic:
simp [f, h]

Tactic state after:
[case h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 z : EuclideanSpace ℝ (Fin ↑n)
 ⊢ 2⁻¹ * (A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z - (A *ᵥ z ⬝ᵥ b - b ⬝ᵥ b)) =
     2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_62 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      ∀ (z : EuclideanSpace ℝ (Fin ↑n)),
        2⁻¹ * (A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z - (A *ᵥ z ⬝ᵥ b - b ⬝ᵥ b)) =
            2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b →
          2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - 2⁻¹ * 2 * b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b =
            2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ 2⁻¹ * (A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z - (A *ᵥ z ⬝ᵥ b - b ⬝ᵥ b)) = 2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b

Tactic:
rw [← sub_add, dotProduct_comm _ b, sub_sub, ← two_mul, mul_add, mul_sub, ← mul_assoc]

Tactic state after:
[case h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 z : EuclideanSpace ℝ (Fin ↑n)
 ⊢ 2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - 2⁻¹ * 2 * b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b = 2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_63 : 2 ≠ 0 := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ 2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - 2⁻¹ * 2 * b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b = 2⁻¹ * A *ᵥ z ⬝ᵥ A *ᵥ z - b ⬝ᵥ A *ᵥ z + 2⁻¹ * b ⬝ᵥ b

Tactic:
rw [inv_mul_cancel₀, one_mul]

Tactic state after:
[case h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 z : EuclideanSpace ℝ (Fin ↑n)
 ⊢ 2 ≠ 0]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_64 : 2 ≠ 0 := sorry

Tactic state before:
case h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
z : EuclideanSpace ℝ (Fin ↑n)
⊢ 2 ≠ 0

Tactic:
simp

Tactic state after:
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_65 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      let φ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2;
      let φ' := fun x => Aᵀ *ᵥ (A *ᵥ x - b);
      (φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) →
        ∀ (y : EuclideanSpace ℝ (Fin ↑n)) (z : Fin ↑n),
          φ' y z = (f' y - h' y) z → (Aᵀ *ᵥ (A *ᵥ y - b)) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z := sorry

Tactic state before:
case h.h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
y : EuclideanSpace ℝ (Fin ↑n)
z : Fin ↑n
⊢ φ' y z = (f' y - h' y) z

Tactic:
simp [φ', f', h']

Tactic state after:
[case h.h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
 y : EuclideanSpace ℝ (Fin ↑n)
 z : Fin ↑n
 ⊢ (Aᵀ *ᵥ (A *ᵥ y - b)) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_66 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      let φ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2;
      (φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) →
        ∀ (y : EuclideanSpace ℝ (Fin ↑n)) (z : Fin ↑n),
          (Aᵀ *ᵥ (A *ᵥ y - b)) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z →
            (Aᵀ *ᵥ A *ᵥ y - Aᵀ *ᵥ b) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z := sorry

Tactic state before:
case h.h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
y : EuclideanSpace ℝ (Fin ↑n)
z : Fin ↑n
⊢ (Aᵀ *ᵥ (A *ᵥ y - b)) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z

Tactic:
rw [Matrix.mulVec_sub Aᵀ]

Tactic state after:
[case h.h
 n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
 y : EuclideanSpace ℝ (Fin ↑n)
 z : Fin ↑n
 ⊢ (Aᵀ *ᵥ A *ᵥ y - Aᵀ *ᵥ b) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z]
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_67 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      let φ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2;
      (φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) →
        ∀ (y : EuclideanSpace ℝ (Fin ↑n)) (z : Fin ↑n),
          (Aᵀ *ᵥ A *ᵥ y - Aᵀ *ᵥ b) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z := sorry

Tactic state before:
case h.h
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
y : EuclideanSpace ℝ (Fin ↑n)
z : Fin ↑n
⊢ (Aᵀ *ᵥ A *ᵥ y - Aᵀ *ᵥ b) z = ((Aᵀ * A) *ᵥ y) z - (Aᵀ *ᵥ b) z

Tactic:
simp

Tactic state after:
import Mathlib
import Optlib


open Set Real Matrix Finset

open Set Real Matrix Finset NNReal

theorem extracted_formal_statement_68 {n m : ℕ+} {b : Fin ↑m → ℝ} {A : Matrix (Fin ↑m) (Fin ↑n) ℝ}
  (x : EuclideanSpace ℝ (Fin ↑n)) :
  let f := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x;
  let f' := fun x => Aᵀ *ᵥ A *ᵥ x;
  HasGradientAt f (f' x) x →
    let h := fun x => b ⬝ᵥ A *ᵥ x;
    let h' := fun x => Aᵀ *ᵥ b;
    HasGradientAt h (h' x) x →
      let φ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2;
      let φ' := fun x => Aᵀ *ᵥ (A *ᵥ x - b);
      (φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) →
        (φ' = fun x => f' x - h' x) →
          HasGradientAt φ (φ' x) x →
            HasGradientAt (fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) ((fun x => f' x - h' x) x) x := sorry

Tactic state before:
n m : ℕ+
b : Fin ↑m → ℝ
A : Matrix (Fin ↑m) (Fin ↑n) ℝ
x : EuclideanSpace ℝ (Fin ↑n)
f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
fgradient : HasGradientAt f (f' x) x
h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
hgradient : HasGradientAt h (h' x) x
φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
φ'eq : φ' = fun x => f' x - h' x
⊢ HasGradientAt φ (φ' x) x

Tactic:
rw [φeq, φ'eq]

Tactic state after:
[n m : ℕ+
 b : Fin ↑m → ℝ
 A : Matrix (Fin ↑m) (Fin ↑n) ℝ
 x : EuclideanSpace ℝ (Fin ↑n)
 f : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * A *ᵥ x ⬝ᵥ A *ᵥ x
 f' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ A *ᵥ x
 fgradient : HasGradientAt f (f' x) x
 h : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => b ⬝ᵥ A *ᵥ x
 h' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ b
 hgradient : HasGradientAt h (h' x) x
 φ : EuclideanSpace ℝ (Fin ↑n) → ℝ := fun x => 1 / 2 * ‖A *ᵥ x - b‖ ^ 2
 φ' : EuclideanSpace ℝ (Fin ↑n) → Fin ↑n → ℝ := fun x => Aᵀ *ᵥ (A *ᵥ x - b)
 φeq : φ = fun x => f x - h x + 1 / 2 * b ⬝ᵥ b
 φ'eq : φ' = fun x => f' x - h' x
 ⊢ HasGradientAt (fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) ((fun x => f' x - h' x) x) x]