Solution (source code)

= Solution

Let $X$ be compact Hausdorff, let $x\in X$, and let $U$ be a neighbourhood of $x$. Choose an open $O$ with $x\in O\subseteq U$. Apply the separation result from part (a) to the disjoint closed sets $\{x\}$ and $X\setminus O$. There is an open $V\ni x$ whose closure lies in $O$. Then
$$
K=\overline V
$$
is compact, contains the neighbourhood $V$ of $x$, and lies in $U$. Thus $X$ is locally compact.

Conversely, suppose $X$ is locally compact Hausdorff and $A\cap K$ is closed in every compact $K\subseteq X$. For $x\notin A$, choose a compact neighbourhood $K$ of $x$ and an <open set> $U$ with
$$
x\in U\subseteq K.
$$
Since $A\cap K$ is closed in $K$, there is an <open set> $W\subseteq X$ such that
$$
K\setminus(A\cap K)=K\cap W.
$$
Then $U\cap W$ is an open neighbourhood of $x$ disjoint from $A$. Thus $X\setminus A$ is open and
$$
\boxed{A\text{ is closed}}.
$$
This is the <compactly detected closed-set theorem in a locally compact Hausdorff space>.