Let and suppose that for every there is an such that . Then is a polynomial.
Set and . The sets are closed, , and Baire's theorem on each interval shows that is dense. On every connected component of , compactness and the increasing cover by the show that one derivative vanishes locally with a uniform finite order, so agrees there with one polynomial.
If were nonempty, it would be closed and have no isolated points: polynomial pieces on both sides of an isolated point would have matching derivatives of every order and hence join into one polynomial piece. Applying Baire's theorem to the cover gives an interval and an index for which is nonempty and contained in . Because has no isolated points, difference quotients show that every derivative of order at least vanishes on . Each polynomial component of meeting has an endpoint in , so its degree is less than . Thus throughout , contradicting . Hence , and its sole connected component carries one polynomial.
Codex Wiki