Extension of Dynkin's formula, conclude that process is a martingale. Let $u: \mathbb{R}_+ \times \mathbb{R}^d$ be a bounded $C^2$ function whose first and second partial derivatives are uniformly bounded (or, more generally, have at most polynomial growth as $|x| \to \infty)$ on $[0, T] \times \mathbb{R}^d$, for any $0 \le T < \infty$. For any $t \ge 0$ and any $x \in \mathbb{R}^d$ it is not hard to see that,$$E^x u(t, W_t) = u(0, x) + E^x \int_0^t \left( {\partial\over{\partial s}} + {1\over2}\Delta_x\right) u(s, W_s)\,ds.$$$($$W_t$ is a Brownian motion process which takes the value $x$ at $t=0$ so the dependence of $x$ is implicit here, most of the references will consider $W_t$ a standard Brownian motion which means it takes the value $0$ at $t=0$ and in the above formula we will have $x+W_t$ instead. $\Delta_s$ here means the sum of all the mixed derivatives.$)$
My question is, how do we conclude that under $P^x$ the process$$u(t, W_t) - u(0, x) - \int_0^t\left({\partial\over{\partial t}} + {1\over2}\Delta_x\right)u(s, W_s)ds$$is a martingale?
 A: There are (at least) two possibilites to prove this. The first one, the quick one, uses Itô's formula. A straightforward application of Itô's formula shows that
$$M_t^u := u(t,W_t)-u(0,x) - \int_0^t \left( \frac{\partial}{\partial t} + \frac{1}{2} \Delta_x \right) u(s,W_s) \, ds$$
is a stochastic integral (with respect to Brownian motion) and, moreover, since $u \in C_b^2$, we know that the integrand is nicely integrable.  This implies in particular that $(M_t^u)_t$ is a martingale - and that's it.
The other proof is more involved but in my oppinion worth the effort; it gives some intuition why Itô's formula holds. The proof is essentially taken from
René L. Schilling & Lothar Partzsch: Brownian Motion - An Introduction to Stochastic Processes, Theorem 5.6.
To simplifiy notation, I'll only consider $d=1$, i.e. the one-dimensional case. The idea of the proof is to use that the density
$$p(t,x) := \frac{1}{\sqrt{2\pi t}} \exp \left(- \frac{x^2}{2t} \right)$$
satisfies the heat equation:
$$\frac{\partial}{\partial t} p(t,x) = \frac{1}{2} \frac{\partial^2}{\partial x^2} p(t,x).$$
For $f \in C_b^2$ it follows easily by the integration by parts formula that
$$\int p(t,x) \frac{1}{2} \frac{\partial^2}{\partial x^2} f(t,x) \, dx = \int f(t,x) \frac{\partial}{\partial t} p(t,x) \, dx. \tag{1}$$

Set $$M_t^u := u(t,W_t) - u(0,W_0) - \int_0^t Lu(W_r) \, dr$$ where $$Lu:= \frac{\partial}{\partial t} u + \frac{1}{2} \partial_x^2 u.$$ We have to show that $$\mathbb{E}(M_t^u - M_s^u \mid \mathcal{F}_s) = 0 \qquad \text{for all $s \leq t$}.$$ Since $(W_t)_{t \geq 0}$ has independent and stationary increments, we know that $W_t-W_s$ and $\mathcal{F}_s$ are independent and $W_t-W_s \sim W_{t-s}$. Therefore,
$$\begin{align*} \mathbb{E}(M_t^u - M_s^u \mid \mathcal{F}_s) &= \mathbb{E}(u(t,(W_t-W_s)+W_s) \mid \mathcal{F}_s) - u(s,W_s) \\ &\quad - \int_s^t \mathbb{E}(Lu(r,(W_r-W_s)+W_s) \mid \mathcal{F}_s) \, dr \\ &= \mathbb{E} u(t,W_{t-s}+z) \bigg|_{z=W_s} - u(s,W_s) - \int_s^t\mathbb{E}[Lu(r,z+(W_r-W_s))] \big|_{z=W_s} \, dr \\ &= \mathbb{E} u(t,W_{t-s}+z) \bigg|_{z=W_s} - u(s,W_s) - \int_0^{t-s} \mathbb{E}[Lu(s+r,z+W_r)] \big|_{z=W_s} \, dr \\ &=  \mathbb{E} \left[ u(t,z+W_{t-s})-u(s,z) - \int_0^{t-s} Lu(s+r,W_r+z) \, dr \right] \bigg|_{z=W_s} \end{align*}$$
(In the last step, we have used that $(W_t)_{t \geq 0}$ has stationary increments, i.e. $W_r-W_s \sim W_{r-s}$, and a change of variables.) Setting $\varphi(r,x) := u(s+r,x+z)$ for fixed $z \in \mathbb{R}$, we therefore conclude that it suffices to show that
$$\mathbb{E}(M_{t-s}^{\varphi} - M_0^{\varphi}) = \mathbb{E} \left[ \varphi(t-s,W_{t-s}) - \varphi(0,0)-  \int_0^{t-s} L\varphi(r,W_r) \, dr \right] = 0. \tag{2}$$
Now fix $0 <\epsilon < v$. Then, by Fubini's theorem ("Fub", for short)
$$\begin{align*} &\quad \mathbb{E}(M_v^\varphi-M_\varepsilon^\varphi) \\ &= \mathbb{E}\left(\varphi(v,W_v) - \varphi(\varepsilon,W_{\varepsilon}) - \int_{\varepsilon}^v L\varphi(r,W_r) \, dr \right) \\ &\stackrel{\text{Fub}}{=} \int_{\mathbb{R}} \varphi(v,x) \cdot p(v,x) \, dx - \int_{\mathbb{R}} \varphi(\varepsilon,x) \cdot p(\varepsilon,x) \, dx - \int_{\varepsilon}^v \int_{\mathbb{R}} L\varphi(r,x) \cdot p(r,x) \, dx \, dr \\ &\stackrel{(\ast)}{=} \int_{\mathbb{R}} \varphi(v,x) \cdot p(v,x)-\varphi(\varepsilon,x) p(\varepsilon,x) \, dx - \int_{\varepsilon}^v \int_{\mathbb{R}}\frac{\partial}{\partial r} (p(r,x) \varphi(r,x)) \, dx \, dr  \\ & \overset{\text{Fub}}{\underset{\varepsilon>0}{=}}\int_{\mathbb{R}} \varphi(v,x) \cdot p(v,x)-\varphi(\varepsilon,x) p(\varepsilon,x) \, dx - \int_{\mathbb{R}} \int_{\varepsilon}^v \frac{\partial}{\partial r} (p(r,x) \varphi(r,x)) \, dr \, dx  \\ &= 0 \tag{3} \end{align*}$$
In $(\ast)$, we have used that, by $(1)$,
$$\begin{align*} \int L\varphi(r,x) p(r,x) \, dr &= \int p(r,x) \frac{\partial}{\partial r} \varphi(r,x) \, dx + \int \frac{1}{2} (\partial_x^2 \varphi(r,x)) p(r,x) \, dx \\ & = \int p(r,x) \frac{\partial}{\partial r} \varphi(r,x) \, dx  + \int \varphi(r,x) \frac{\partial}{\partial r} p(r,x) \, dx \\ &= \int \frac{\partial}{\partial r} (\varphi(r,x) \varphi(r,x)) \, dx. \end{align*}$$
Since $M_{\epsilon}^{\varphi} \to M_0^{\varphi}$ as $\epsilon \to 0$ (as $u$ is continuous) and $$\|M_{\epsilon}^u\|_{\infty} \leq C ( \|\partial_t u\|_{\infty} + \|u\|_{\infty} +  \|\partial_x^2 u\||_{\infty}), \qquad 0 < \epsilon <v$$ it follows from the dominated convergence theorem that we can let $\epsilon \to 0$ and obtain
$$0 \stackrel{(3)}{=} \lim_{\epsilon \to 0} \mathbb{E}(M_v^\varphi-M_\varepsilon^\varphi) = \mathbb{E}(M_v^\varphi-M_0^\varphi).$$
This proves $(2)$.
Remark: The statement holds in a more general framework. If $(X_t)_{t \geq 0}$ is a Markov process and $A$ its generator, then
$$u(t,X_t) - u(0,X_0) - \int_0^t \left( \partial_t + A \right)u(r,X_r) \, dr$$
is a martingale for "nice" functions $u$.
