Let
- $(E,\mathcal E)$ be a measurable space
- $\mathcal M_b(E,\mathcal E):=\left\{f:E\to\mathbb R\mid f\text{ is bounded and }\mathcal E\text{-measurable}\right\}$
- $(\kappa_t)_{t\ge0}$ be a Markov semigroup on $(E,\mathcal E)$ and $$\kappa_tf:=\int\kappa_t(\;\cdot\;,{\rm d}y)f(y)\tag1$$ for $f\in\mathcal M_b(E,\mathcal E)$ and $t\ge0$
- $\mu$ be a probability measure on $(E,\mathcal E)$ subinvariant with respect to $(\kappa_t)_{t\ge0}$
It's easy to see that $(\kappa_t)_{t\ge0}$ is a contraction semigroup on $\left(\mathcal M_b(E,\mathcal E),\left\|\;\cdot\;\right\|_{L^2(\mu)}\right)$ and hence has a unique extension to a contraction semigroup on $L^2(\mu)$. Let $(\mathcal D(A),A)$ denote the generator of that semigroup.
Let $f\in\mathcal D(A)$ such that $f^2\in\mathcal D(A)$. I want to show that $$Af^2\ge 2fAf.\tag2$$
The crucial point might be the following: If $g:E\to\mathbb R$ is $\mathcal E$-measurable and $(\kappa_t|g|)(x)<\infty$ for all $x\in E$, then $$\varphi\left(\left(\kappa_tg\right)(x)\right)\le\left(\kappa_t\left(\varphi(g)\right)\right)(x)\;\;\;\text{for all }x\in E\tag3$$ for all convex $\varphi:\mathbb R\to\mathbb R$ by Jensen's inequality (Clearly, for the question we would take $\varphi(x)=x^2$).
However, it's not clear to me how (and if at all) $(3)$ extends to $g\in L^2(\mu)$.$^1$
Clearly, we know that there is a $(g_n)_{n\in\mathbb N}\subseteq\mathcal M_b(E,\mathcal E)$ with $$|g_n|\le|g|\;\;\;\text{for all }n\in\mathbb N\tag4$$ and $$g_n\xrightarrow{n\to\infty}g\tag5.$$ By the dominated convergence theorem (and construction of $(\kappa_t)_{t\ge0}$), $$\left\|\kappa_tg_n-\kappa_tg\right\|_{L^2(\mu)}\le\left\|g_n-g\right\|_{L^2(\mu)}\xrightarrow{n\to\infty}0\tag6\;\;\;\text{for all }t\ge0.$$ $(3)$ holds for $g=g_n$. Moreover, we could extract a subsequence $\left(g_{n_k}\right)_{k\in\mathbb N}$ with $$g_{n_k}\xrightarrow{k\to\infty}g\;\;\;\mu\text{-almost surely}\tag7.$$ But that doesn't mean (does it?)$^2$ that $$\kappa_tg_{n_k}\xrightarrow{k\to\infty}\kappa_tg\;\;\;\mu\text{-almost surely for all }t\ge0\tag8.$$ So, I'm stuck at this point.
$^1$ One may note that, by subinvariance, $(\kappa_t|g|)(x)<\infty$ for $\mu$-almost all $x\in E$, but I hope that $(3)$ can be proved by a general extension argument.
$^2$ Maybe we can argue that $$\left|\kappa_tg_{n_k}-\kappa_tg_{n_l}\right|\le\kappa_t\left|g_{n_k}-g_{n_l}\right|\xrightarrow{k,\:l\to\infty}0\tag9$$ (pointwise) by the dominated convergence theorem and hence $\left(\left(\kappa_tg_{n_k}\right)(x)\right)_{k\in\mathbb N}$ is Cauchy for all $x\in E$.
First of all note that for any $g \in L^2(\mu)$ we have
$$(\kappa_t g)^2 \leq \kappa_t(g^2) \quad \text{$\mu$-almost everywhere}\tag{1}$$
where the exceptional null set may depend on $t \geq 0$ and $g$; this follows by a standard approximation procedure, see @MaoWao's answer for details.
Now let $f \in D(A)$ be such that $f^2 \in D(A)$. Set $t_n := 1/n$ for $n \in \mathbb{N}$. Because of $(1)$ there exists a $\mu$-null set $N_0$ such that
$$(\kappa_{t_n}f)^2(x)\leq \kappa_{t_n} (f^2)(x) \quad \text{for all $x \in E \backslash N_0$, $n \in \mathbb{N}$}$$
i.e.
$$\frac{1}{t_n} \big[ \kappa_{t_n} (f^2)(x)-f(x)^2 \big] -\frac{1}{t_n} \big[ (\kappa_{t_n} f)^2(x) -f(x)^2 \big] \geq 0 \quad \text{for all $x \in E \backslash N_0$, $n \in \mathbb{N}$.} \tag{2}$$
Since $f \in D(A)$ we have $Af = \lim_{t \to 0} t^{-1} (\kappa_tf-f)$ in $L^2(\mu)$; in particular, we can choose a subsequence $(t_n')$ of $(t_n)$ such that
$$Af(x) = \lim_{n \to \infty} \frac{\kappa_{t_n'}f(x)-f(x)}{t_n'}, \quad x \in E \backslash N_1 \tag{3}$$ for a $\mu$-null set $N_1$.Note that this implies in particular
$$\kappa_{t_n'} f(x) \xrightarrow[]{n \to \infty} f(x), \qquad x \in E \backslash N_1. \tag{4}$$ Similarly, $f^2 \in D(A)$ implies that there exists a $\mu$-null set $N_2$ and a further subsequence $(t_n'')$ of $(t_n')$ such that
$$A(f^2)(x) = \lim_{n \to \infty} \frac{\kappa_{t_n''}(f^2)(x)-f^2(x)}{t_n''}, \quad x \in E \backslash N_2. \tag{5}$$
Clearly, $(2)$-$(4)$ remain valid with $t_n$ (resp. $t_n'$) replaced by $t_n''$. Set $N := N_0 \cup N_1 \cup N_2$ and fix $x \in E \backslash N$. Writing
$$(\kappa_{t_n''} f)^2(x) -f(x)^2 = (\kappa_{t_n''} f(x)+f(x)) (\kappa_{t_n''}f(x)-f(x))$$
and dividing both sides by $t_n''$ it follows from $(3)$ and $(4)$ that
$$\frac{(\kappa_{t_n''} f)^2(x) -f(x)^2}{t_n''} \to 2f(x) Af(x). \tag{6}$$
Using $(2)$ (for $t_n''$) and letting $n \to \infty$ it now follows from $(5)$ and $(6)$ that
$$A(f^2)(x)-2f(x) Af(x) \geq 0.$$
We have shown this identity for any $x \in E \backslash N$ and since $N$ is a $\mu$-null set this proves the assertion.