Infinitely times differentiable function

Let $f$ belong to $ C^{\infty}[0,1]$ and for each $x \in [0,1]$ there exists $n \in \mathbb{N}$ so that
$f^{(n)}(x)=0$. Prove that $f$ is a polynomial in $[0,1]$.

I am trying to use Baire Category Theorem , but cannot perfectly complete the proof .

Thanks for any help.

Solutions Collecting From Web of "Infinitely times differentiable function"

Look at Andrea Ferretti’s solution or Andrey Gogolev’s one at MathOverflow.

In the latest, we argue by contradiction. The set $X$ is the points $x$ such that for all $a<b$, the restriction of $f$ to $(a,b)$ is not an polynomial if $x\in (a,b)$. It doesn’t contain an isolated point (if $x_0$ were such a point, there would be $r>0$ such that if $|x-x_0|<r$, and $x\neq x_0$, then $x\notin X$). Let $x$ such a point, and $f$ restricted to $(a,b)$ is not a polynomial, $x\in (a,b)$. But there is an open interval $I$ containing $x_0$ and $(a,b)$, and since $x_0\in X$, $f$ restricted to this interval is a polynomial, a contradiction.

$X$ is closed, as if $x_n\to x$, $x_n\in X$ for all $n$, take $(a,b)$ containing $x$. Then it contains a $x_n$ for some $n$. So $x_n\in (a,b)$ and $f$ restricted to this interval is a polynomial.