smooth functional to detect whether a function has a zero Does there exist a function $F : C^\infty(\mathbb{R}, [0, \infty)) \to \mathbb{R}$ with the following properties:


*

*$F(f) = 0$ if and only if there exists an $x \in [0,1]$ such that $f(x) = 0$.

*$F$ is smooth in the following sense:  if $f(x,t) \in C^\infty(\mathbb{R} \times \mathbb{R}, [0,\infty))$ and $F$ is applied to $f$ in the $x$ variable, the function of $t$ that results is smooth ($C^\infty$).


The second question is whether the following candidate satisfies the smoothness property.  For $f \in C^\infty(\mathbb{R}, [0, \infty))$, define $G(f)$ to be
$$
    \left( \int_0^1 \frac{1}{f(x)} \, dx \right)^{-2}
$$
if $f$ has no zeros in $[0,1]$, and $0$ otherwise.
Then $G$ satisfies the first condition by definition,
and one can show that when $f$ is a function of $x$ and $t$ as above, $G(f)$ is (continuous and) differentiable as a function of $t$.  Is it smooth?
Edit: Willie Wong answered the second question in the negative.  So let's instead define $G(f)$ to be
$$
    \exp \left( -\int_0^1 \frac{1}{f(x)} \, dx \right)
$$
if $f$ has no zeros in $[0,1]$, and $0$ otherwise.
Is this $G$ smooth?
 A: For the second question only:
For $f(x,t) = (x-t)^2$, you have that if $t > 1$ 
$$ \int_0^1 \frac{1}{f(x,t)} ~dx =  \frac{1}{t-x} \Big|^1_0 = \frac{1}{t - 1} - \frac{1}{t} = \frac{1}{t(t-1)} $$
So you functional 
$$ G(f)(t) = \begin{cases}
0 & t \leq 1 \\
t^2(t-1)^2 & t > 1\end{cases} $$
and is not a smooth function of $t$ (not even $C^2$). 

This example can of course be circumvented if you take instead of $(\int_0^1 \cdot dx)^{-2}$ something like $\exp - (\int_0^1 \cdot dx)$.  
A: A functional that works is
$$
  F(f)=\begin{cases} \exp(-\exp(\int_0^1 \frac{1}{f(x)}dx)), & \textrm{if $f(x)>0$ for all $x \in [0,1]$} \\
                     0,                                      & \textrm{otherwise}.
       \end{cases}
$$
The idea to use this formula and a sketch of the proof that it works are both due to Chengjie Yu.  The proof is in the appendix of a paper I wrote with Enxin Wu, Smooth classifying spaces, http://arxiv.org/abs/1709.10517
I don't know whether the functional described in the question, $G(f) = \exp(-\int_0^1 \frac{1}{f(x)} dx)$, works.
A: Here is the proof that either of the definitions of $G$ in the question satisfy a weaker version of the smoothness condition.  I hope that the same ideas can be used to prove that the second definition is in fact smooth.  So we'll discuss that case.
Define $G(f)$ to be $\exp(-\int_0^1 dx/f(x))$ if $f$ is non-zero on $[0,1]$, and let $G(f) = 0$ otherwise.  Let $f(x,t) \in C^\infty(\mathbb{R} \times \mathbb{R}, [0, \infty))$.  We'll show that the first derivative of $G(f)$ with respect to $t$ exists for all $t$.  Without loss of generality, we'll do this at $t=0$.  If $f(x,0)$ is nonzero on $[0,1]$, then this is also true for $t$ in a neighbourhood of $0$, and $G(f)$ is smooth in this neighbourhood by differentiating under the integral.
If $f(x,0)$ has a zero in $[0,1]$, then $G(f)$ is zero when $t=0$, and we'll show below that there exists $c > 0$ such that
$$
  \int_0^1 \frac{1}{f(x,t)} dx \geq \frac{c}{|t|} \tag{*}
$$
for all $t \in [-1,1]$ such that $f(x,t)$ is nonzero for all $x \in [0,1]$.  Therefore,
$$
  \exp \left( -\int_0^1 \frac{1}{f(x,t)} dx \right) \leq \exp \left( -\frac{c}{|t|} \right)
$$
for such $t$.
Therefore,
$$
  G(f) \leq \exp \left( -\frac{c}{|t|} \right)
$$
for all nonzero $t \in [-1,1]$, since either $G(f) = 0$, or $G(f)$ is as in the previous equation.
It follows that the first derivative of $G(f)$ exists and is zero at $t = 0$.
Can the argument be adapted to handle the higher derivatives?

Proof of the inequality (*):
Let $x_0 \in [0,1]$ be such that $f(x_0,0) = 0$. Then, by smoothness, there exists $C > 0$ such that 
$$
  f(x,t) \leq C (t^2 + (x - x_0)^2)
$$
for every $t \in [-1,1]$ and $x \in [0,1]$. The squares comes from the fact that $f$ is assumed to be a non-negative smooth function, so $\partial_x f(x_0,0) =  \partial_t f(x_0,0) = 0$.
In particular, if $|x - x_0| \leq |t| \leq 1$, then
$$
  f(x,t) \leq 2 C t^2 .
$$
Choose $t \in [-1,1]$ such that $f(x,t)$ has no zeros for $x \in [0,1]$.
Integrating, we get
$$
  \int_0^1 \frac{1}{f(x,t)} dx
  \geq \int_{\max(x_0 - |t|,0)}^{\min(x_0 + |t|,1)} \frac{1}{f(x,t)} dx
  \geq \int_{\max(x_0 - |t|,0)}^{\min(x_0 + |t|,1)} \frac{1}{2 C t^2} dx
  \geq \frac{|t|}{2 C t^2} = \frac{c}{|t|},
$$
as claimed.  The last inequality comes from the fact that the interval of integration has width at least $|t|$.
That $f$ is non-negative is crucial here: the argument given above does not work if $f$ can be real valued, and this can be seen explicitly for the example $f(x,t) = x-t$. However, in such a situation one could simply replace the integrand $1/f$ with $1 / f^2$. 
