Solution (source code)

= Solution

A process $(X_n)_{n\geq0}$ is a <martingale> with respect to a filtration $(\mathcal F_n)_{n\geq0}$ when:

* $X_n$ is $\mathcal F_n$-measurable for every $n$, so the process is adapted;
* $\mathbb E|X_n|<\infty$ for every $n$;
* for every $n\geq0$,
  $$
  \boxed{\mathbb E[X_{n+1}\mid\mathcal F_n]=X_n\quad\text{almost surely}.}
  $$

Equivalently, every increment has conditional mean zero given the past.