I am trying to prove the following statement :
$$\exists f \in C(\mathbb{R}_+, \mathbb{R}), f \neq 0 \land \forall P \in \mathbb{R}[X], \int_0^\infty f(x)P(x)dx = 0$$
Here is my attempt at it. I can't say for sure that I didn't miss anything, so if I did, please let me know. Also, if there are other approaches to it I'm interested as well.
Let $\alpha(x) = e^{-x^2}$ over $\mathbb{R}_+$. It is known that $\alpha \in S(\mathbb{R}_+, \mathbb{R})$, ie $\alpha$ is a Schwartz function.
Let $E = S(\mathbb{R}_+, \mathbb{R}) \oplus \mathbb{R}[X]$. It is a vector space, so we can define an inner product $(f | g) = \int_0^\infty f(x)g(x)\alpha(x)dx$. This inner product is well-defined on all $E \times E$ since the product of two Schwartz function is a Schwartz function and the product of a Schwartz function and a polynomial is integrable. Moreover, since $\alpha$ is strictly positive on all $\mathbb{R}_+$, we have $(f | f) \geq 0$ and is 0 iff $f$ is 0. We also define the common norm from this inner product as $||f|| = \sqrt{(f | f)}$.
Thus, we can use the Graham-Schmidt algorithm to build $(P_n)_{n \in \mathbb{N}}$ a basis of orthonormal polynomials of $(\mathbb{R}[X], ||.||)$. Lastly, let $p(f) = \sum_{n=0}^\infty (f | Pn)Pn$ the orthogonal projector on $\mathbb{R}[X]$, which is well-defined by the Plancherel theorem.
Now, let's consider $f$ the bump function on $\mathbb{R}_+$ ; it is a Schwartz function and does not have a power series expansion. As such, it cannot be expressed over $\mathbb{R}_+$ as an infinite sum of polynomials ; thus, $p(f) \neq f$. When considering $g = f - p(f)$, we see that $g \in ker(p)$, ie $g \in \mathbb{R}[X]^\perp$.
As such, it comes that $\forall P \in \mathbb{R}[X], (g | P) = \int_0^\infty g(x)P(x)\alpha(x)dx = 0$. Considering $h = g \times \alpha$, we see that $h$ proves the initial proposition.