I was reading some lecture notes, in which it is stated that, given a discrete time Markov process $X_t$, for its Markov semigroup $P_t$ it holds that: $$ P_tf(x) = E_x[f(X_t)]=E[f(X_t)|X_0=x] $$ For each $f:S \to \mathbf{R}$ measurable and bounded. After this statement it is said that a bounded measurable function $f:S\to \mathbf{R}$ (where S is a Polish space endowed with its Borel σ-field) is said to be harmonic on D⊂S iff $$ Lf(x)=0\ \forall x \in D$$ where $ L=P−1$ is the generator of the markov process. It is asked to prove that such a function $f $ is harmonic on $S$ if and only if the process $ f(X_t) $ is a martingale. I tried to prove it, and it is easy to see, using the fact that $$M_t:=f(X_t)−f(X_0)−\sum_{s=0}^{t-1}Lf(X_s)$$ is a martingale, that $f(X_t)$ is a martingale if and only if $Lf(X_s)=0 \forall s \ge 0$. Now, if f is harmonic it is clear that $Lf(X_s)=0$, for the converse it seems that one should derive the fact that $ f $ is harmonic from$ Lf(X_0)=0$, indeed one has $$0=Lf(X_0)=Pf(X_0)−f(X_0)$$ now, I was able to prove the following:
If $ g:S→\mathbf{R}$ is bounded and measurable, and such that $$g(X_0)=E[f(X_t)|F_0]$$ then$ g(x)=E[f(Xt)|X_0=x]$, $P_{X_0}$-a.e.
Since we know that $ E[f(X_1)|X_0=x]=Pf(x)$, one gets that $P_{X_0}$-a.e. $$f(x)=Pf(x)$$ and thus$ Lf(x)=0$, $P_{X_0}$-a.e. But I'm not able to prove that equality holds for every x. Do you have any idea?