"Occupation time" nonlinear functional measurable? My question is for which functions $f$ the following nonlinear functional
$f\rightarrow\int \mathbf{1}_B(f(x))dx$ is Borel measurable; $B\in\mathcal{B}(\mathbb{R})$ and $\mathbf{1}_B(.)$ is a characteristic function.
I know that for $f\in (C[0,1],\sup)$ it is the case. How about $f\in L_p[0,1]$?
I would be very grateful for help.
 A: Let $\left(\Omega,\mathcal{M},\mu\right)$ be a finite measure space.
Let $\left(X,\left\Vert \cdot\right\Vert \right)$ be a normed vector
space of measurable functions on $\Omega$ (where a.e. equal functions
are identified) with the property that $f_{n}\to f$ in $X$ implies
$f_{n}\to f$ in measure. This is the case for every $L^{p}$ space,
$p\in\left[1,\infty\right]$. We will show that the ,,occupation
time functional``
$$
\Phi_{B}:X\to\mathbb{R}_{+},f\mapsto\int_{\Omega}\chi_{B}\left(f\left(x\right)\right)\,{\rm d}\mu\left(x\right)
$$
is measurable for every Borel set $B\subset\mathbb{R}$, where $\chi_{B}$
denotes the indicator function of $B$. The generalization to $\sigma$-finite
measures is left as an exercise to the reader :)
Let us first talk about sets of continuity for a measure: We say that
$B\subset\mathbb{R}$ is a set of continuity for a Borel measure $\nu$
on $\mathbb{R}$ if $\nu\left(\partial B\right)=0$, where $\partial B$
denotes the topological boundary of $B$.
Now, let $A\subset\mathbb{R}$ be closed. For $\varepsilon>0$ let
$$
A_{\varepsilon}:=\left\{ x\in\mathbb{R}\,\mid\,{\rm dist}\left(x,A\right)<\varepsilon\right\} .
$$
Note that $A_{\varepsilon}$ is open (hence measurable) with $A\subset A_{\varepsilon}$
and $A_{\varepsilon}\subset A_{\delta}$ for $0<\varepsilon\leq\delta$.
Finally, we even have
$$
A=\bigcap_{\varepsilon>0}A_{\varepsilon},\qquad\left(\ast\right)
$$
since for $x\in\bigcap_{n\in\mathbb{N}}A_{1/n}$, there is a sequence
$\left(x_{n}\right)_{n\in\mathbb{N}}$ in $A$ with $\left|x-x_{n}\right|<\frac{1}{n}$,
which implies $x=\lim_{n\to\infty}x_{n}\in\overline{A}=A$, since
$A$ is closed.
Finally, we note $\overline{A_{\varepsilon}}\subset\left\{ x\in\mathbb{R}\,\mid\,{\rm dist}\left(x,A\right)\leq\varepsilon\right\} $,
so that we get (since $A_{\varepsilon}$ is open)
$$
\partial A_{\varepsilon}=\overline{A_{\varepsilon}}\setminus A_{\varepsilon}\subset\left\{ x\in\mathbb{R}\,\mid\,{\rm dist}\left(x,A\right)=\varepsilon\right\} .
$$
In particular, $\partial A_{\varepsilon}\cap\partial A_{\delta}=\emptyset$
for $\varepsilon\neq\delta$. Thus, if $\nu$ is a finite Borel measure
on $\mathbb{R}$, we can only have $\nu\left(\partial A_{\varepsilon}\right)>0$
for countably many $\varepsilon>0$ (why?).
Since $\mu$ is a finite measure and since equation $\left(\ast\right)$
above implies $\chi_{A_{\varepsilon}}\searrow_{\varepsilon\downarrow0}\chi_{A}$,
the dominated convergence theorem implies
$$
\Phi_{A_{\varepsilon}}\left(f\right)=\int_{\Omega}\chi_{A_{\varepsilon}}\left(f\left(x\right)\right)\,{\rm d}\mu\left(x\right)\;\searrow_{\varepsilon\downarrow0}\;\int_{\Omega}\chi_{A}\left(f\left(x\right)\right)\,{\rm d}\mu\left(x\right)=\Phi_{A}\left(f\right)\qquad\left(\dagger\right)
$$
for all $f\in X$ and each closed set $A\subset\mathbb{R}$.
Next, we show that for each $f\in X$, the function $\Phi_{A_{\varepsilon}}$
is continuous at $f$ for all but countably many $\varepsilon>0$.
Note though, that the set of "exceptional" $\varepsilon$ may
depend on $f$. To see this, let $\nu_{f}:=\mu\circ f^{-1}$ be the
pushforward measure of $\mu$ via $f$. Then $\nu_{f}$ is a finite
Borel measure, so that the above considerations show that $A_{\varepsilon}$
is a set of continuity for all but countably many $\varepsilon>0$.
Now, assume that $A_{\varepsilon}$ is a set of continuity for $\nu_{f}$
and let $f_{n}\xrightarrow[n\to\infty]{X}f$. We want to show $\Phi_{A_{\varepsilon}}\left(f_{n}\right)\to\Phi_{A_{\varepsilon}}\left(f\right)$.
If this is false, there is some $\delta>0$ and a subsequence $\left(f_{n_{k}}\right)_{k}$
with $\left|\Phi_{A_{\varepsilon}}\left(f_{n_{k}}\right)-\Phi_{A_{\varepsilon}}\left(f\right)\right|\geq\delta$
for all $k$. By assumption, we have $f_{n_{k}}\to f$ in measure,
so that there is a further subsequence $\left(f_{n_{k_{\ell}}}\right)_{\ell}$
with $f_{n_{k_{\ell}}}\to f$ $\mu$-almost everywhere. Let us write
$g_{\ell}:=f_{n_{k_{\ell}}}$ and let $N\subset\Omega$ be a null-set
with $g_{\ell}\left(x\right)\to f\left(x\right)$ for all $x\in\Omega\setminus N$.
For $x\in\Omega\setminus\left[N\cup f^{-1}\left(\partial A_{\varepsilon}\right)\right]$,
there are three cases:


*

*We have $f\left(x\right)\in A_{\varepsilon}$. Since $A_{\varepsilon}$
is open, this yields $g_{\ell}\left(x\right)\in A_{\varepsilon}$
for all $\ell$ large enough. In particular,
$$
\chi_{A_{\varepsilon}}\left(g_{\ell}\left(x\right)\right)\xrightarrow[\ell\to\infty]{}1=\chi_{A_{\varepsilon}}\left(f\left(x\right)\right).
$$

*We have $f\left(x\right)\in\overline{A_{\varepsilon}}^{c}$. Since
$\overline{A_{\varepsilon}}^{c}$ is open, we get as above that $g_{\ell}\left(x\right)\in\overline{A_{\varepsilon}}^{c}$
for all $\ell$ large enough. Using $\overline{A_{\varepsilon}}^{c}\subset A_{\varepsilon}^{c}$,
this implies
$$
\chi_{A_{\varepsilon}}\left(g_{\ell}\left(x\right)\right)\xrightarrow[\ell\to\infty]{}0=\chi_{A_{\varepsilon}}\left(f\left(x\right)\right).
$$

*We have $f\left(x\right)\in\overline{A_{\varepsilon}}\setminus A_{\varepsilon}=\partial A_{\varepsilon}$.
Because of $x\notin f^{-1}\left(\partial A_{\varepsilon}\right)$,
this is impossible.
All in all, we have shown $\chi_{A_{\varepsilon}}\left(g_{\ell}\left(x\right)\right)\xrightarrow[\ell\to\infty]{}\chi_{A_{\varepsilon}}\left(f\left(x\right)\right)$
for all $x\in\Omega\setminus\left[N\cup f^{-1}\left(\partial A_{\varepsilon}\right)\right]$.
Because of $0=\nu\left(\partial A_{\varepsilon}\right)=\mu\left(f^{-1}\left(\partial A_{\varepsilon}\right)\right)$,
we see that this convergence holds $\mu$-almost everywhere, so that
dominated convergence yields
$$
\Phi_{A_{\varepsilon}}\left(f_{n_{k_{\ell}}}\right)=\Phi_{A_{\varepsilon}}\left(g_{\ell}\right)=\int_{\Omega}\chi_{A_{\varepsilon}}\left(g_{\ell}\left(x\right)\right)\,{\rm d}\mu\left(x\right)\xrightarrow[\ell\to\infty]{}\int_{\Omega}\chi_{A_{\varepsilon}}\left(f\left(x\right)\right)\,{\rm d}\mu\left(x\right)=\Phi_{A_{\varepsilon}}\left(f\left(x\right)\right),
$$
in contradiction to $\left|\Phi_{A_{\varepsilon}}\left(f_{n_{k}}\right)-\Phi_{A_{\varepsilon}}\left(f\right)\right|\geq\delta$
for all $k$. This contradiction shows $\Phi_{A_{\varepsilon}}\left(f_{n}\right)\to\Phi_{A_{\varepsilon}}\left(f\right)$
as desired.
We now want to show that $\Phi_{A}$ is upper semicontinuous (and
hence measurable) for all closed $A\subset\mathbb{R}$. To this end,
let us denote the "exceptional" set of $\varepsilon>0$ by
$$
M_{f}:=\left\{ \varepsilon>0\,\mid\,\Phi_{A_{\varepsilon}}\text{ not continuous at }f\right\} .
$$
We just showed that $M_{f}$ is countable. Let $\alpha\in\mathbb{R}$
be arbitrary. We want to show that $\Phi_{A}^{-1}\left(\left(-\infty,\alpha\right)\right)\subset X$
is open. Thus, let $f\in X$ with $\Phi_{A}\left(f\right)<\alpha$.
By $\left(\dagger\right)$, this implies $\Phi_{A_{\varepsilon}}\left(f\right)<\alpha$
for all sufficiently small $\varepsilon>0$. In particular, there
is $\varepsilon\in\left(0,\infty\right)\setminus M_{f}$ with $\Phi_{A_{\varepsilon}}\left(f\right)<\alpha$.
Since $\Phi_{A_{\varepsilon}}$ is continuous at $f$, there is $\delta>0$
with $\Phi_{A_{\varepsilon}}\left(g\right)<\alpha$ for all $g\in B_{\delta}^{X}\left(f\right)$.
Hence,
$$
\Phi_{A}\left(g\right)\leq\Phi_{A_{\varepsilon}}\left(g\right)<\alpha
$$
for all $g\in B_{\delta}^{X}\left(f\right)$, which proves $B_{\delta}^{X}\left(f\right)\subset\Phi_{A}^{-1}\left(\left(-\infty,A\right)\right)$.
We are almost done. What we have shown is that
$$
G:=\left\{ B\subset\mathbb{R}\,\mid\, B\text{ Borel and }\Phi_{B}\text{ is measurable}\right\} 
$$
includes all closed sets. Since the family of closed sets is a $\pi$-system
which generates the Borel $\sigma$-Algebra, Dynkin's $\pi$-$\lambda$-Theorem
(https://en.wikipedia.org/wiki/Dynkin_system#Dynkin.27s_.CF.80-.CE.BB_theorem)
implies that it suffices to show that $G$ is a $\lambda$-system,
i.e. closed under complements and countable disjoint unions.
But we have
\begin{eqnarray*}
\Phi_{\biguplus_{n\in\mathbb{N}}B_{n}} & = & \sum_{n\in\mathbb{N}}\Phi_{B_{n}},\\
\Phi_{B^{c}} & = & \mu\left(X\right)-\Phi_{B},
\end{eqnarray*}
so that this is immediate.
