Solution (source code)

= Solution

Here is an alternative route for the ergodicity step using the <Birkhoff ergodic theorem>. After invariance has been proved, the theorem identifies the almost-everywhere limit of $A_n\varphi$ with $\mathbb E_\mu[\varphi\mid\mathcal I]$. The hypothesis therefore gives
$$
\mathbb E_\mu[\varphi\mid\mathcal I]=\int\varphi\,d\mu
$$
for every <continuous function> $\varphi$. For an invariant <Borel set> $B$, approximate $h=\mathbf1_B$ in $L^1$ by such a $\varphi$. Since $h$ is measurable with respect to the <invariant sigma-algebra>, its <conditional expectation> is $h$ itself. The <L1 contraction of conditional expectation> gives
$$
\left\|h-\mu(B)\right\|_1
\leq\left\|\mathbb E_\mu[h-\varphi\mid\mathcal I]\right\|_1
 +\left|\int(\varphi-h)\,d\mu\right|
\leq2\|h-\varphi\|_1.
$$
Arbitrarily accurate continuous approximation forces $h=\mu(B)$ almost everywhere. Thus this use of the theorem reaches the same zero-or-one criterion as the direct averaging proof above, without assuming in advance that $\mu$ is <ergodic>.