Solution (source code)

= Solution

On a probability space carrying an infinite <IID random variables>[IID] sequence $(X_n)$ with law $m$, map $\omega$ to $(X_1(\omega),X_2(\omega),\ldots)$. Its pushforward measure $\mu$ satisfies
$$
\mu\!\left(\prod_{n\geq1}A_n\right)=\prod_{n\geq1}m(A_n)
$$
for every cylinder set. Cylinder sets form a <pi-system> generating $\sigma(\mathcal C)$, so the <sigma-finite uniqueness theorem for measures> proves uniqueness. This is the countable <product measure> $m^{\otimes\mathbb N}$.

For a cylinder $A=A_1\times\cdots\times A_N\times\mathbb R\times\cdots$,
$$
\mu(\theta^{-1}A)=m(\mathbb R)m(A_1)\cdots m(A_N)=\mu(A).
$$
The same generating-class argument extends this equality to every measurable set, so $\theta$ is a <measure-preserving transformation>.

If $A=\theta^{-1}A$, then $A=\theta^{-n}A$ for every $n$, so membership in $A$ is independent of the first $n$ coordinates. Thus $A$ belongs to the tail sigma-algebra. The zero-one law gives $\mu(A)\in\{0,1\}$, proving that the shift is <ergodic measure-preserving transformation>[ergodic].