For every pair of sets $K, L \subseteq \mathbb R$ we define the distance between them as $d(K,L) = \inf \{|x-y|, x \in K, y \in L\}$
We are asked to prove that if $K$ is closed and $L$ is compact and $K \cap L = \emptyset$ then $d(K,L) > 0$.
What I tried:
define $f: L \to \mathbb R$ by $f(x) = \inf \{|x-y|, y \in K\}$
It follows from the definition that $d(K,L) = \min _{x \in L} f(x)$. Furthermore, since $L$ is compact and $f$ is continuous, we know that $f$ actually attains the value.
Now suppose $d(K,L) = 0$. Since $f$ actually attains that value somewhere, there is $x_0 \in L$ such that $f(x_0) = 0$.
So either $\exists y_0 \in K$ such that $|x_0-y_0| = 0$, which makes no sense since the intersection is empty, or there is a sequence $\{y_k\} \in K$ whos limit is $x_0$.
But since $K$ is closed, this means that $x_0 \in K$, since a closed set contains all of its limit points, so again we arrive at a contradiction.
Is this correct and clear enough?