[guided]The core of the proof is this inductive construction. Unlike the complete metric space version, we do not have a metric, so we cannot build closed balls. Instead, we use local compactness to produce compact neighbourhoods.
**Base case.** The set $G_1$ is dense and $U$ is nonempty and open, so $U \cap G_1 \neq \varnothing$ and this intersection is open. Choose $x_1 \in U \cap G_1$. By local compactness, $x_1$ has a compact neighbourhood — that is, there exists an open $V'$ and compact $C$ with $x_1 \in V' \subset C$. We want a compact neighbourhood entirely inside $U \cap G_1$.
Here is where the Hausdorff hypothesis enters in an essential way. In a Hausdorff space, compact sets are closed ([Compact Subspaces and Hausdorff Spaces](/theorems/307), part 2). Consequently, the closure of any subset of a compact set is again compact (as a closed subset of a compact set, by part 1 of the same theorem). So we can refine: set $V_1 := V' \cap U \cap G_1$ (open, contains $x_1$), and $K_1 := \overline{V_1}$. Since $V_1 \subset V' \subset C$ and $C$ is compact and closed, $K_1 = \overline{V_1} \subset C$ is a closed subset of a compact set, hence compact. Since $U \cap G_1$ need not be closed, we cannot guarantee $K_1 \subset U \cap G_1$ from the closure alone. Instead, we use the stronger form of local compactness: in a locally compact Hausdorff space, every point has a local base of compact neighbourhoods. Concretely, by [Separation of Compact Sets in Hausdorff Spaces](/theorems/1026) (part 1), for the compact set $C$ and any point not in $U \cap G_1$, we can separate them by open sets, giving us a compact neighbourhood $K_1$ contained in $U \cap G_1$. Alternatively, we directly apply the fact that in a locally compact Hausdorff space, every neighbourhood of a point contains a compact neighbourhood: for $x_1 \in U \cap G_1$ (which is an open neighbourhood of $x_1$), there exist open $V_1$ and compact $K_1$ with $x_1 \in V_1 \subset K_1 \subset U \cap G_1$.
**Inductive step.** Suppose we have an open set $V_n$ (nonempty) and a compact set $K_n$ with $V_n \subset K_n \subset G_n$. Since $G_{n+1}$ is dense and $V_n$ is nonempty and open, $V_n \cap G_{n+1} \neq \varnothing$. This intersection is open. Pick $x_{n+1} \in V_n \cap G_{n+1}$. By local compactness, there exist open $V_{n+1}$ and compact $K_{n+1}$ with
\begin{align*}
x_{n+1} \in V_{n+1} \subset K_{n+1} \subset V_n \cap G_{n+1}.
\end{align*}
The inclusion $K_{n+1} \subset V_n \subset K_n$ gives the nesting $K_{n+1} \subset K_n$, and $K_{n+1} \subset G_{n+1}$ gives containment in the $n+1$-th dense open set.
Why does this require $X$ to be Hausdorff, not merely locally compact? Without the Hausdorff property, compact sets need not be closed, and a compact neighbourhood of a point need not be containable inside a given open set. The Hausdorff property ensures that we can always shrink a compact neighbourhood to fit inside any prescribed open neighbourhood.[/guided]