Rudin's mathematical analysis chapter 4 exercise 21:
Suppose $K$ and $F$ are disjoint sets in a metric space $X$, $K$ is compact, $F$ is closed. Prove that there exists $\delta>0$ such that $d(p,q)>\delta$ if $p \in K$, $q \in F$. Hint: $\rho_{F}$ is a continuous positive function on $K$.
Show that the conclusion may fail for two disjoint closed sets if neither is compact.
Proof 1: Define $\rho_{F}(x)=\inf_{z \in F}d(x,z)\geq0$. According to exercise 20, $\rho_{F}(x)=0$ if and only if $x\in F=\bar{F}$. Because $F$ is closed and $K\bigcap F=\emptyset$, $K\bigcap \bar{F}=\emptyset$. Therefore, $\rho_{F}(x)>0$ if $p\in K$. We can surely find a $\delta>0$ such that $d(p,q)>\delta$ if $p\in K$, $q \in F$.
Where am I wrong in this proof please?
Comment: the last statement in Proof 1 is wrong, we cannot find a minimum distance among an infinite set.
Proof 2: Because $K$ and $F$ are disjoint and $F$ is closed, for every point $p \in K$, we can find a neighbourhood such that $N_{\epsilon}(p) \bigcap F=\emptyset$. Because $K$ is compact, we can find finite such neighbourhoods $N_{\epsilon_1}(p1), N_{\epsilon_2}(p2), N_{\epsilon_3}(p3), \cdots, N_{\epsilon_N}(p_N)$ such that they form an open over of $K$. Obviously, for any $p \in K$, $q \in F$, we have $d(p, q)>min(\epsilon_1, \epsilon_2, \cdots, \epsilon_N)>0$.
But why
$\rho_{F}$ is a continuous positive function on $K$.
is necessary then?
Infimum of a set of positive numbers may be $0$. The facts that $\rho_F(p)$ is a continuous function of $p$ on $K$ and $K$ is compact implies that the infimum is positive because infimum is attained at some point of $K$. This argument fails if $K$ just a closed set. Example: $\{2,3,...\}$ and $\{2+\frac 1 2,3+\frac 1 3,...\}$ are disjoint closed sets at distance $0$.