Solution (source code)

= Solution

For $A\in\mathcal F_n$, define the bounded <stopping time> $T=n+1$ on $A$ and $T=n$ on $A^c$. Before time $n$ its stopping events are empty, at time $n$ the event $\{T\leq n\}=A^c$ belongs to $\mathcal F_n$, and subsequently it has stopped everywhere. Subtract the assumed mean identity for this $T$ from that for the constant <stopping time> $n$ to obtain
$$
\mathbb E\bigl[\mathbf1_A(M_{n+1}-M_n)\bigr]=0\qquad(A\in\mathcal F_n).
$$
Since $M_n$ is integrable and $\mathcal F_n$-<measurable>, this is precisely the defining property of <conditional expectation> giving \b[$\mathbb E[M_{n+1}\mid\mathcal F_n]=M_n$]. Thus the <adapted process> is a <martingale>, completing the <bounded-stopping-time characterization of a martingale>.