Let $E$ and $F$ be a compact set on un metric space $(X,d)$. Show that dist$(E,F)>0$ if and only if $E \cap F = \emptyset $
($\Leftarrow$)
if $E \cap F = \emptyset \ \ \ \ \ \text{then} \ \ \ \ \forall x,y ,\ \ \ \ \ x \in E, \ \ \ \ y \in F $ then $$inf \{ d(x,y)|x \in E , y \in F \}>0 \implies \text{dist}(E,F)>0$$
($\Rightarrow$)
my idea is to suppose that $E \cap F \ne \emptyset.$ Let $z \in E\cap F$.
Suppose that $\{x_n\}$ and $\{y_n\}$ both converge to z because the set E and F are compact. Then arrive at a contradiction that dist$(E,F)=0$
Is my proof correct?
Actually, the second part is trivial, you don't need the compactness. The real place you need the compactness is in the first part. Prove d is continuous, since E and F are compact, d can attain its minimum on $E\times F$, then the inf is positive.