Solution (source code)

= Solution

The <martingale convergence theorem> says that if a discrete-time <martingale> $(M_n)$ satisfies $C=\sup_n\mathbb E|M_n|<\infty$, then there is an <integrable random variable> $M_\infty$ such that
$$
\boxed{M_n\longrightarrow M_\infty\quad\text{almost surely},\qquad \mathbb E|M_\infty|\leq C.}
$$
The hypothesis does not by itself ensure <convergence in L1>.

For each pair of <rational numbers> $a<b$, the <Doob upcrossing inequality> gives $\mathbb E U_N[a,b]\leq(C+|a|)/(b-a)$. The <monotone convergence theorem> therefore gives a finite <expected value> for $U_\infty[a,b]=\lim_NU_N[a,b]$, so this <upcrossing count> is finite <almost surely>. There are only countably many such pairs, hence all their <upcrossing counts> are simultaneously finite outside one event of probability zero.

If $\liminf_nM_n<\limsup_nM_n$, the <density of the rational numbers> supplies $a<b$ strictly between them, forcing infinitely many <upcrossings>. Consequently $M_n$ has a limit in the <extended real numbers> <almost surely>. By the <Fatou lemma>,
$$
\mathbb E\left[\liminf_n|M_n|\right]\leq\liminf_n\mathbb E|M_n|\leq C.
$$
A limit of either $+\infty$ or $-\infty$ would make this lower limit infinite, so the limit is finite <almost surely>, and the same inequality proves its <integrable random variable>[integrability].