Solution (source code)

= Solution

The <Baire category theorem> states that a complete <metric space> is a <Baire space>: the intersection of countably many open dense sets is dense. Equivalently, a nonempty open subset cannot be a countable union of nowhere dense sets.

Let $U_n$ be open dense and $O$ any nonempty open set. Choose a closed ball $B_1$ of positive radius at most $1/2$ inside $O\cap U_1$. Inductively choose $B_{n+1}$ inside the interior of $B_n$ intersected with $U_{n+1}$, with positive radius at most $2^{-(n+1)}$. Density makes this intersection nonempty, and openness supplies a sufficiently small closed ball. The centres form a <Cauchy sequence> because all later centres lie in $B_n$, whose diameter tends to zero. Completeness gives a limit $x$. Since each ball is closed and contains all later centres, $x\in B_n$ for every $n$. Thus $x\in O\cap\bigcap_n U_n$, proving density. Applying this to complements of the closures of nowhere dense sets gives the equivalent formulation.