Solution (source code)

= Solution

The bounded <optional stopping theorem> gives $\mathbb EX_{T\wedge n}=\mathbb EX_0$. Decompose the difference from the terminal value:
$$
X_{T\wedge n}-X_T=(X_n-X_T)\mathbf1_{\{T>n\}}.
$$
Consequently
$$
\mathbb E|X_{T\wedge n}-X_T|
\leq\mathbb E\bigl[|X_n|\mathbf1_{\{T>n\}}\bigr]
+\mathbb E\bigl[|X_T|\mathbf1_{\{T>n\}}\bigr]\longrightarrow0.
$$
The first term tends to zero by hypothesis. The second tends to zero by the <dominated convergence theorem>, because $X_T$ is integrable and $T$ is finite with probability one. Thus the <stopped martingale> converges to $X_T$ with <convergence in L1>, which permits passage of expectations to the limit:
$$
\boxed{\mathbb EX_T=\mathbb EX_0.}
$$
The explicit tail condition supplies exactly the missing control for an unbounded <stopping time>.