Solution (source code)

= Solution

A convenient sufficient condition is that $f\in C^2(\mathbb R^d)$ has a bounded <gradient>. The <Itô formula> for standard $d$-dimensional <Brownian motion> gives
$$
f(B_t)-\frac12\int_0^t\Delta f(B_s)\,ds
=f(0)+\sum_{j=1}^d\int_0^t\partial_jf(B_s)\,dB_s^j.
$$
If $|\nabla f|\leq C$, the <Itô isometry> gives
$$
\mathbb E\left|\sum_j\int_0^t\partial_jf(B_s)\,dB_s^j\right|^2
=\mathbb E\int_0^t|\nabla f(B_s)|^2\,ds\leq C^2t.
$$
Thus the right side is a <square-integrable> <martingale>, rather than merely a <local martingale>. In particular,
$$
\boxed{f\in C^2(\mathbb R^d),\quad \sup_x|\nabla f(x)|<\infty
\quad\Longrightarrow\quad M^f\text{ is a martingale}.}
$$
There are many nonconstant examples, such as $f(x)=\sin x_1$ or $f(x)=x_1$. More generally it is enough that $\mathbb E\int_0^t|\nabla f(B_s)|^2ds<\infty$ for each finite $t$. Smooth <test functions> with <compact support> satisfy the bounded-gradient condition and will provide the domain in the next part.