theorem extracted_formal_statement_69 {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 (fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) ((fun x => f' x - h' x) x) x →
            HasGradientAt (fun x => f x - h x) ((fun x => f' x - h' x) x) x := sorry

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 (fun x => f x - h x + 1 / 2 * b ⬝ᵥ b) ((fun x => f' x - h' x) x) x

Tactic: apply HasGradientAt.add_const

State after:
[case hf
 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) ((fun x => f' x - h' x) x) x]

Relevant lemmas:
HasGradientAt.add_const : ∀ {𝕜 : Type u_1} {F : Type u_2} [inst : RCLike 𝕜] [inst_1 : NormedAddCommGroup F]
  [inst_2 : InnerProductSpace 𝕜 F] [inst_3 : CompleteSpace F] {f' x : F} {f : F → 𝕜},
  HasGradientAt f f' x → ∀ (c : 𝕜), HasGradientAt (fun x => f x + c) f' x