martingale $X(t)=e^{-\lambda t}f(B(t))- \int_{0}^{t} e^{-\lambda s} (\tfrac{1}{2}\Delta f(B(s))- \lambda f(B(s)))ds$ 
Let $f: \mathbb{R}^d \longrightarrow \mathbb{R}^d$ be twice continuously differentiable and $\{B(t): t \ge 0 \}$ be a d-dimensional Brownian motion. Further suppose that, for all $t>0$ and $x \in \mathbb{R}^d$ we have $$\mathbb{E}_x \int_{0}^{t}e^{-\lambda s}|f(B(s))| \, ds< \infty $$ and $$\mathbb{E}_x \int_{0}^{t}e^{-\lambda s}|\Delta f(B(s))| \, ds < \infty.$$ Prove that $X(t)=e^{-\lambda t}f(B(t))- \int_{0}^{t} e^{-\lambda s} (\dfrac{1}{2}\Delta f(B(s))- \lambda f(B(s))) \, ds$ is a martingale.

I solved the easier case $\lambda=0$ in the following way but I got stuck to generalize it:
 For any $0 \le s \le t$,
$$\mathbb{E}[X(t)|\mathcal{F}(s)]=\mathbb{E}_{B(s)}[f(B(t-s))]-\dfrac{1}{2} \int_{0}^{s} \Delta f(B(u)) du - \int_{0}^{t-s} \mathbb{E}_{B(s)}[\dfrac{1}{2} \Delta f(B(u)) du.$$
Using integration by parts and the fact that the probability density of $B$ satisfies the heat equation , i.e. $\dfrac{1}{2} \Delta \mathfrak{p}(t,x,y)=\dfrac{\partial}{\partial t}p(t,x,y)$, we get
\begin{align*} \mathbb{E}_{B(s)}[\dfrac{1}{2} \Delta f(B(u))] &=\dfrac{1}{2} \int \mathfrak{p}(u, B(s), x) \Delta f(x)\, dx \\ &=\dfrac{1}{2} \int \Delta \mathfrak{p}(u, B(s), x) f(x) \, dx \\ &=\int \dfrac{\partial}{\partial u} \mathfrak{p}(u,B(s),x) f(x) \,  dx \end{align*}
and then
\begin{align*} \int_{0}^{t-s} \mathbb{E}_{B(s)}[\dfrac{1}{2} \Delta f(B(u)) \, du &= \lim_{\epsilon \downarrow 0} \int \left[\int_{\epsilon}^{t-s} \dfrac{\partial}{\partial u} \mathfrak{p}(u, B(s), x) \, du \right] f(x) \, dx \\ &= \int \mathfrak{p}(t-s, B(s), x) f(x) dx - \lim_{\epsilon \downarrow 0} \int \mathfrak{p}(\epsilon, B(s), x) f(x) dx \\ &= \mathbb{E}_{B(s)} [f(B(t-s))]-f(B(s)) \end{align*}
and hence we get $$\mathbb{E}[X(t) \mid \mathcal{F}(s)]=f(B(s))-\dfrac{1}{2}\int_{0}^{s} \Delta f(B(u)) \, du$$ which confirms the martingale property.
 A: You can use the fact that
$$M_t := f(B_t)- \frac{1}{2} \int_0^t \Delta f(B_s) \, ds$$
is a martingale to prove the martingale property for $\lambda>0$. The proof goes as follows:

Lemma 1: For any $\alpha \in C_b^1$ the process $$N_t := M_t \alpha_t - \int_0^t M_r \alpha'(r) \, dr$$ is a martingale.

Proof: Fix $0 \leq s \leq t$. Since $$M_t \alpha_t = (M_t-M_s) \alpha_t + M_s \alpha_t$$ we have $$\mathbb{E}(M_t \alpha_t \mid \mathcal{F}_s) = M_s \alpha_t.\tag{1}$$ On the other hand, it follows from the (conditional) Fubini theorem that \begin{align*} \mathbb{E} \left( \int_0^t M_r \alpha'(r) \, dr \mid \mathcal{F}_s \right) &= \int_0^t M_r \alpha'(r) \, dr + \int_s^t \mathbb{E}(M_r \mid \mathcal{F}_s) \alpha'(r) \, dr \\ &= \int_0^s M_r \alpha'(r) \, dr+ M_s (\alpha(t)-\alpha(s)). \tag{2} \end{align*} Subtracting $(2)$ from $(1)$ proves the assertion.

Lemma 2: Let $\alpha \in C_b^1$. Then $$X_t := \alpha_t f(B_t) - \int_0^t (\alpha'(s) f(B_s) + \alpha(s) \Delta f(B_s)) \, ds$$ is a martingale.

Proof: The integration by parts formula shows that
$$\int_0^t \alpha(s) \Delta f(B_s) \, ds = \alpha(t) \int_0^t \Delta f(B_s) \, ds - \int_0^t \alpha'(s)  \left(\int_0^s \Delta f(B_r) \, dr \right) \, ds,$$ and this implies $$X_t = M_t \alpha(t) - \int_0^t \alpha'(s) M_s \, ds.$$ Now the assertion follows from Lemma 1.
