Solution (source code)

= Solution

The process is adapted because $X_0$ is $\mathcal F_0$-measurable, $A_k$ is $\mathcal F_{k-1}$-measurable, and $M_k-M_{k-1}$ is $\mathcal F_k$-measurable. Using the <predictable process>[predictability] of $A_n$ and the martingale increment property,
$$
\begin{aligned}
\mathbb E[X_n\mid\mathcal F_{n-1}]
&=X_{n-1}+A_n\mathbb E[M_n-M_{n-1}\mid\mathcal F_{n-1}]\\
&=X_{n-1}.
\end{aligned}
$$
The assumed integrability therefore proves that $X$ is the <martingale transform> of $M$ by $A$ and is a martingale.