Solution (source code)

= Solution

A process $M_n$ is a $\mathbb P$-<martingale> relative to the <filtration> $(\mathcal F_n)$ when it is adapted, each $M_n$ is integrable, and
$$
\boxed{\mathbb E_{\mathbb P}[M_n\mid\mathcal F_{n-1}]=M_{n-1},\qquad 1\leq n\leq N.}
$$
Here adapted means $M_n$ is $\mathcal F_n$-measurable, and integrable means $\mathbb E_{\mathbb P}|M_n|<\infty$. Thus its present value is the conditional mean of its next value given all present information.