cheb_compare_outer
ProvedChebyshev comparison near the endpoints (the crux of Markov's last step). If p has degree < d and satisfies the Bernstein bound (1-x^2) p(x)^2 <= d^2 on [-1,1], then for c in [-1,1] with d^2(1-c^2) <= 1 (i.e., |c| >= sqrt(1-1/d^2) >= cos(pi/(2d))), we have |p(c)| <= |T'_d(c)|. Proof (root counting): At the d zeros t_j = cos((2j+1)pi/(2d)), j=0..d-1, of T_d, we have (1-t_j^2)T'_d(t_j)^2 = d^2 (by the Pythagorean identity), so |T'_d(t_j)| = d/sqrt(1-t_j^2), and the Bernstein bound gives |p(t_j)| <= d/sqrt(1-t_j^2) = |T'_d(t_j)|. T'd alternates sign at the t_j: sign(T'd(t_j)) = (-1)^j. So for mu in (0,1), R := T'd - mu p has d sign alternations at t_0 > t_1 > ... > t{d-1}, giving d-1 roots in (t{d-1}, t_0). Since deg R <= d-1, these are all the roots, and R(c) has the same sign as R(t_0) > 0 for c >= t_0 (and sign (-1)^{d-1} for c <= t{d-1}). Same for R' := T'_d + mu p. Taking mu -> 1 (or a direct no-limit argument: suppose |p(c)| > |T'_d(c)|, let mu := |T'd(c)|/|p(c)| < 1, get an extra root for R, contradicting deg R <= d-1). Then |c| >= sqrt(1-1/d^2) >= cos(pi/(2d)) (Jordan's inequality sin t >= 2t/pi) guarantees c is outside (t{d-1}, t_0). NOT in Mathlib.
import Mathlib.RingTheory.Polynomial.Chebyshev import Mathlib.Algebra.Polynomial.Basic import Mathlib.Algebra.Polynomial.Degree.Defs import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Algebra.Polynomial.Eval.Defs import Mathlib.Data.Real.Basic
theorem cheb_compare_outer (p : Polynomial ℝ) {d : ℕ} (hd1 : 1 ≤ d) (hd : p.natDegree < d)
(h : ∀ x : ℝ, -1 ≤ x → x ≤ 1 → (1 - x^2) * (p.eval x)^2 ≤ (d : ℝ)^2) :
∀ c : ℝ, -1 ≤ c → c ≤ 1 → (d : ℝ)^2 * (1 - c^2) ≤ 1 →
|p.eval c| ≤ |(Polynomial.derivative (Polynomial.Chebyshev.T ℝ (d : ℤ))).eval c| := by sorry