Separating a compact set from a closed set in $T_2$ and locally compact Let $(X,T)$ be a $T_2$ and locally compact topological space, let $C$ be a compact subspace of $X$ and $U$ an open subset of $X$ containing $C$. Prove that there exists a continuous function $f:(X,T)\to ([0,1],T_u|_{[0,1]})$ such that $f(C)=\{0\}$ and $f(X\smallsetminus U)=\{1\}$.
Here's what I've tried:

*

*I know the space is $T_{3a}$ because it's $T_2$ and locally compact, and I know the set $C$ is closed because all compact subsets of a $T_2$ space are closed. So I've tried using the functions from the definition of completely regular spaces with no success.

*If my space was $T_4$, I could use Uryshon's Lemma to find the function I'm looking for, but the only way I've been able to come up with to use this is to say that, because it is $T_2$ and locally compact, I can find a compactification by one point, lets call it $X'$. $X'$ will be compact and $T_2$, so it will be $T_4$, so I can find a continuous function $f:(X',T)\to ([0,1],T_u|_{[0,1]})$ such that $f(C)=\{0\}$ and $f(X\smallsetminus U)=\{1\}$. My problem is that I'm not sure that $f|_X$ is still continuous and, if it always is, doesn't that meen that if a space is $T_2$ and locally compact I can always find this function with any given pair of closed sets? Wouldn't that meen by Uryshon's Lemma that it is $T_4$? And I've only used the compactness of $C$ to say it's closed.

 A: Here is a more elementary approach, which clarifies the importance of compactness. Let $X$ be completely regular and $C,F\subseteq X$ be disjoint sets with $C$ compact and $F$ closed. We want to construct a continuous function $f\colon X\to[0,1]$ with $f(F)=0$ and $f(C)=1$.
Since our space is completely regular we can find, for every $c\in C$, a continuous function $f_c\colon X\to [0,1]$ with $f(c)=1$ and $f(F)=0$. Consider the open sets $U_c=f^{-1}((1/2,1])$, those are an open cover of $C$ so we can find, by compactness, finitely many $c_i\in C$ such that $\{U_{c_i}\}$ covers $C$.
Now the function $f'(x)=\sum_if_{c_i}(x)$ is still continuous, being the sum of finitely many continuous functions, has value $0$ on $F$ since every $f_{c_i}$ does, and has value $>1/2$ on $C$, so the function $f(x)=2\min\{f'(x),1/2\}$ is as required (it is continuous being the min of finitely many continuous functions).
To see why compactness is important in your argument (which is correct) note that you cannot just apply Urysohn's lemma to $C$ and $X\setminus U$ as subspaces of $X'$,because those won't necessarily be closed. In particular $X\setminus U$ won't be closed, and it's closure will be $X'\setminus U$ (I'm assuming that $X$ is not compact to begin with to avoid trivial cases), while $C$ will be already closed, because it is compact in $X$, so you can indeed apply Urysohn's lemma to their closures since those are disjoint. This argument won't work for arbitrary closed sets, any two unbounded disjoint closed sets in $\Bbb R^2$ will have the point at infinity in common in their closure in the one point compactification for example.
A: Your idea using the one-point compactification $\alpha X$ of $X$ can work fine:
Let $C \subseteq X$ be closed and $K \subseteq X$ be compact and disjoint, while  $X$ is a locally compact Hausdorff space.
Then $K$ is still closed in $\alpha X$, (compact subspaces are closed in Hausdorff spaces), while $C$ is a subset of the closed set $C’=C \cup \{\infty\}$ of $\alpha X$ (its complement in $\alpha X$ is the same as $C$’s complement in $X$, which was open, and so is still open) and $C’ \cap K = \emptyset$ still.
As $\alpha X$ is $T_4$ (compact and Hausdorff implies this), we have a Urysohn function $f: \alpha X \to [0,1]$ separating $K$ and $C’$ and then $f\restriction_X$ is still continuous (restrictions of continuous functions always are) and separates $C$ and $K$. QED.
You’re applying this to $K=C$ and $C=X\setminus U$ in your original notation.
