Theorem (exists_sub_eval_interpolate_eq_iteratedDeriv_mul). The Lagrange interpolation remainder: for a < \mathbf{b}, a nonempty finite set s of nodes in [a, \mathbf{b}], f continuous on [a, \mathbf{b}] and C^{\lvert s\rvert} on (a, \mathbf{b}), and every \mathbf{x} \in [a, \mathbf{b}], there is \xi \in (a, \mathbf{b}) with f(\mathbf{x}) - p_s(\mathbf{x}) = \frac{f^{(\lvert s\rvert)}(\xi)}{\lvert s\rvert!}\prod_{y\in s}(\mathbf{x} - y)\,, p_s the Lagrange interpolant of f at s (Mathlib's Lagrange.interpolate s id f). [Davis1975, Theorem 3.1.1]; [Trefethen2019, Ch. 11] (locators to check); there with \xi in the hull of s and \mathbf{x}.
Headline
Lean statement and details
NLAlib.exists_sub_eval_interpolate_eq_iteratedDeriv_mul {a b : ℝ} (hab : a < b) {s : Finset ℝ}
(hs : s.Nonempty) (hsab : ↑s ⊆ Set.Icc a b) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b))
(hf' : ContDiffOn ℝ (↑s.card) f (Set.Ioo a b)) {x : ℝ} (hx : x ∈ Set.Icc a b) :
∃ ξ ∈ Set.Ioo a b,
f x - Polynomial.eval x ((Lagrange.interpolate s id) f) =
iteratedDeriv s.card f ξ / ↑s.card.factorial * Polynomial.eval x (Lagrange.nodal s id)