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

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]

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]

Relevant lemmas: