# Sufficient condition for a measure to be invariant

Given a Polish metric space $H$ and a Borel probability measure $\pi$. Let $\mathcal B_b(H)$ be the set of bounded measurable functions on $H$, and $L^2(H, \pi)$ be the set of square integrable real-functions w.r.t. $\pi$. We have a semigroup $P_t$ defined on $\mathcal B_b(H)$ determined by some Markov process.

Let the following hold for a dense subset $\mathcal C \subseteq L^2(H; \pi)$ (and of course $\mathcal C$ is a also subspace of $\mathcal B_b(H)$): $$\int_H f(h)\pi(dh) = \int_H P_tf(h)\pi(dh); \hspace{1em}\forall f \in \mathcal C.$$ My problem is like: would this be enough for $\pi$ to be a invariant measure for $P_t$? Or do I need to add something (such as $P_t \circ \pi$ is absolutely continuous w.p.t. $\pi$, which seems to be obviously sufficient)?

p.s. I am not sure if $P_t$ can be continuously extended to an operator on $L^2(\pi)$; this is actually the thing that confuses me.

By Cauchy-Schwarz, if $f\in \mathcal B_b(H)$ then $(P_tf)^2\le P_t1\cdot P_t(f^2)\le P_t(f^2)$. If also $f^2\in \mathcal C$, then $$\int_H (P_tf)^2\,d\pi\le\int_H P_t(f^2)\,d\pi=\int_H f^2\,d\pi<\infty.$$ If follows that if $\mathcal C$ is not only a vector space but also closed under multiplication (i.e., an algebra) then $f\mapsto P_tf$ is a densely defined linear contraction of $L^2(\pi)$, so the semigroup $(P_t)$ can be continuously extended to all of $L^2(\pi)$. From here it is a short step to conclude that $\pi$ is an invariant measure for $(P_t)$.