Let
- $(E,\mathcal E,\lambda)$ be a $\sigma$-finite measure space;
- $(\kappa_t)_{t\ge0}$ be a Markov semigroup on $(E,\mathcal E)$ with generator$^1$ $A$;
- $\mu,\pi$ be probability measures on $(E,\mathcal E)$ with densities $u,p$ with respect to $\lambda$ with $p>0$ and $$c:=\frac{A^\ast p+c_0u}p$$ for some $c_0>0$;
- $\mathcal E_b:=\left\{f:E\to\mathbb R\mid f\text{ is bounded and }\mathcal E\text{-measurable}\right\}$ be equipped with the supremum norm;
- $(\Omega,\mathcal A)$ be a measurable space;
- $(X_t)_{t\ge0}$ be an $(E,\mathcal E)$-valued progressive process on $(\Omega,\mathcal A)$;
- $\operatorname P_x$ be a probability measure on $(\Omega,\mathcal A)$ with $$\operatorname E_x\left[f(X_{s+t})\mid\mathcal F^X_s\right]=(\kappa_tf)(X_s)\tag1$$ for all $f\in\mathcal E_b$ and $s,t\ge0$ for $x\in E$;
- $$A_t:=\int_0^tc(X_s)\:{\rm d}s$$ and $$M_t:=e^{-A_t}$$ for $t\ge0$;
- $\xi$ be a real-valued random variable on $(\Omega,\mathcal A)$ exponentially distributed with respect to $\operatorname P_x$ for all $x\in E$ and $$\tau:=\inf\left\{t\ge0:A_t\ge\xi\right\}.$$
Question 1: How can we compute $$\operatorname E_\mu[\tau^2]=\int\mu({\rm d}x)\operatorname E_x[\tau^2]?\tag2$$
Noting that $$\frac{\rm d}{{\rm d}t}\operatorname P_\pi\left[t<\tau\right]=-c_0\operatorname P_\mu\left[t<\tau\right]\tag3$$ for all $t\ge0$, we easily see that $$\operatorname E_\mu[\tau]=\frac1{c_0}\tag4.$$
In order to compute $(2)$, we should note that $$\operatorname E_\mu\left[\left|\int_0^\tau f(X_t)\:{\rm d}t\right|^2\right]=2\int_0^\infty\int_0^t\operatorname E_\mu\left[f(X_s)f(X_t);t<\tau\right]\:{\rm d}s\:{\rm d}t\tag5$$ for all $f\in\mathcal E_b$. Applying this to $f=1$ and using $(3)$ should yield \begin{equation}\begin{split}\operatorname E_\mu[\tau^2]&=2\int_0^\infty t\operatorname P_\mu\left[t<\tau\right]\:{\rm d}t\\&=2\left[\lim_{t\to\infty}t\operatorname P_\mu\left[t<\tau\right]-\int_0^\infty\operatorname P_\mu\left[t<\tau\right]\:{\rm d}t\right],\end{split}\tag6\end{equation} where $\lim_{t\to\infty}\operatorname P_\mu\left[t<\tau\right]=0$.
Question 2: Assuming this is correct so far, can we simplify $(6)$ further?
Question 3: In the same way as $(4)$ is derived from $(3)$, we can derive $$\operatorname E_\mu\left[\int_0^\tau f(X_t)\:{\rm d}t\right]=\frac{\pi f}{c_0}\tag7$$ from $$\frac{\rm d}{{\rm d}t}\operatorname E_\pi\left[f(X_t);t<\tau\right]=-c_0\operatorname E_\mu\left[f(X_t);t<\tau\right]\tag8.$$ But what, similar to $(6)$, can we do to derive an expression for $$\operatorname E_\mu\left[\left|\int_0^\tau f(X_t)\:{\rm d}t\right|^2\right]?\tag8$$
$^1$ $(\kappa_t)_{t\ge0}$ is considered as a contraction semigroup on $\mathcal E_b$.
$^2$ $A^\ast$ denotes the adjoint of $A$ with respect to $\lambda$; i.e. $$\int fA^\ast g\:{\rm d}\lambda=\int gAf\:{\rm d}\lambda\tag9$$ for all $f\in\mathcal D(A)$ and $g\in\mathcal D(A^\ast)$.