import Mathlib /-! # Linear convergence of gradient descent under the Polyak–Łojasiewicz inequality **Setting.** `f : ℝⁿ → ℝ` (`ℝⁿ = EuclideanSpace ℝ (Fin n)`) is differentiable, bounded below, with `L`-Lipschitz gradient (`L > 0`; the gradient is Mathlib's `gradient f`, i.e. computed from `fderiv`, not a free function). Let `f* := ⨅ x, f x`. Assume the PL inequality with `μ > 0`: `μ (f x - f*) ≤ ½ ‖∇f x‖²` for all `x`. Gradient descent with step `1/L` is *defined* recursively: `x 0 = x₀`, `x (k+1) = x k - (1/L) ∇f (x k)` (`gdIter`). **Stated.** For every `k`: `f (x k) - f* ≤ (1 - μ/L)^k (f x₀ - f*)`. **Not stated.** Nothing about neural networks: whether the training loss of a network for an HJB problem satisfies a PL inequality (with constants polynomial in `d`) is an open research question and is not part of this problem. `μ ≤ L` is not assumed; it follows from the hypotheses unless `f` is constant (in which case both sides are `0`). -/ namespace NSHJB.PLGradientDescent /-- Gradient descent with step `1/L` on `ℝⁿ`. -/ noncomputable def gdIter {n : ℕ} (f : EuclideanSpace ℝ (Fin n) → ℝ) (L : ℝ) (x₀ : EuclideanSpace ℝ (Fin n)) : ℕ → EuclideanSpace ℝ (Fin n) | 0 => x₀ | k + 1 => gdIter f L x₀ k - (1 / L) • gradient f (gdIter f L x₀ k) /-- Linear convergence of gradient descent under PL and `L`-smoothness. -/ theorem pl_gradient_descent {n : ℕ} (f : EuclideanSpace ℝ (Fin n) → ℝ) (L μ : ℝ) (hL : 0 < L) (hμ : 0 < μ) (hf : Differentiable ℝ f) (hsmooth : ∀ x y, ‖gradient f x - gradient f y‖ ≤ L * ‖x - y‖) (hbdd : BddBelow (Set.range f)) (hPL : ∀ x, μ * (f x - ⨅ z, f z) ≤ (1 / 2) * ‖gradient f x‖ ^ 2) (x₀ : EuclideanSpace ℝ (Fin n)) : ∀ k : ℕ, f (gdIter f L x₀ k) - (⨅ z, f z) ≤ (1 - μ / L) ^ k * (f x₀ - ⨅ z, f z) := by sorry end NSHJB.PLGradientDescent