Let
- $(\Omega,\mathcal A,\operatorname P)$ be a probability space;
- $(E,\mathcal E)$ be a measurable space;
- $(X_t)_{t\ge0}$ be an $(E,\mathcal E)$-valued right-continuous process on $(\Omega,\mathcal A)$;
- $c:E\to[0,\infty)$ e $\mathcal E$-measurable, $$A_t:=\int_0^tc(X_s)\:{\rm d}s\;\;\;\text{for }t\ge0$$ and $$M_t:=e^{-A_t}\;\;\;\text{for }t\ge0;$$
- $\xi$ be a real-valued exponentially distributed (with parameter $1$) random variable on $(\Omega,\mathcal A,\operatorname P)$ independent of $X$ and $$\tau:=\inf\{t\ge0:A_t\ge\xi\}.$$
I want to show that $$\operatorname E\left[\left|\int_0^\tau f(X_t)\:{\rm d}t\right|^2\right]=\int_0^\infty\operatorname E\left[M_tc(X_t)\left|\int_0^tf(X_s)\:{\rm d}s\right|^2\right]\:{\rm d}t\tag1$$ for all bounded $\mathcal E$-measurable $f:E\to\mathbb R$.
Remark: Maybe, we can even show the more general claim that $$\operatorname E\left[g(X,\tau)\right]=\int_0^\infty\operatorname E\left[M_tc(X_t)g(X,t)\right]\:{\rm d}t\tag2$$ for all bounded $\mathcal E^{\otimes[0,\:\infty)}\otimes\mathcal B([0,\infty])$-measurable $g:E^{[0,\:\infty)}\times[0,\infty]\to[0,\infty]$.
First of all, we easily see that $$\operatorname P\left[\tau\in I\right]=\operatorname E\left[\int_{I\cap[0,\:\infty)}M_tc(X_t)\:{\rm d}t\right]\tag3$$ for all $I\in\mathcal B([0,\infty])$. Now, maybe what we need to do is writing \begin{equation}\begin{split}\operatorname E\left[g(X,\tau)\right]&=\int\operatorname P\left[\tau\in{\rm d}t\right]\operatorname E\left[g(X,\tau)\mid\tau=t\right]\\&=\int_0^\infty\operatorname E\left[M_tc(X_t)\operatorname E\left[g(X,\tau)\mid\tau=t\right]\right]\;{\rm d}t.\end{split}\tag4\end{equation} But in order to conclude from this (assuming $(4)$ is correct at all), it seems like we would need to have that $$\operatorname E\left[g(X,\tau)\mid\tau\right]=g(X,\tau)\tag5.$$ $(5)$ would be correct, if $g(X,\tau)$ is $\sigma(\tau)$-measurable, but is this true? $(A_t)_{t\ge0}$ is clearly $\sigma(X)$-measurable and $\xi$ is independent from $X$. So ...