If distance between the two sets is zero then their intersection is empty? 
Let $(X,d)$ be a metric space and $A$ and $B$ two non-empty sets in 
  $X$. 
If $d(A,B)= 0$ then, is their intersection empty?

I attempted this problem writing:
$d(A, B)=\inf\left\{ d(x,y): x\in A, y\in B\right\}=0 \implies d(x,y)= 0 \implies x=y$
That is, if $d(A,B) = 0$ then there exists $x \in A \cap B$, so the intersection is not empty! 
My question is whether I am taking the infimum wrong or doing anything else wrongly? How can I show this with an example?
 A: Without any further assumption on $A$ and $B$, there is no conclusion about their intersection:


*

*In $X = \def\R{\mathbf R}\R$ with the euclidian metric, $A = [0,1]$ and $B = (1,2)$ have $d(A,B) = 0$ and empty intersection, but $A$ and $B' = [1,2]$ have also $d(A, B') = 0$.

*Even if we suppose $A$ and $B$ to be closed, we can have $d(A,B) = 0$ with empty intersection. Consider $A = \R \times \{0\}$ and $B= \{x \in \R^2 \mid x_1 x_2 = 1\}$. Here $d(A,B) = 0$ due to $d(a_n, b_n) = \frac 1n$ for $a_n = (n,0) \in A$ and $b_n = (n, \frac 1n) \in B$.

*If we suppose $A$ to be compact and $B$ to be closed, something can be said. It that case, we have that $d(A,B) = 0$ implies $A \cap B \ne \emptyset$. For choose $a_n \in A$ and $b_n \in B$ such that $d(a_n, b_n) \to d(A,B)=0$. As $A$ is compact $(a_n)$ has a convergent subsequence, we may suppose w. l. o. g. that $a_n \to a \in A$. As $d(a_n, b_n) \to 0$, we have that 
$$ d(b_n, a) \le d(a_n, b_n) + d(a_n,a) \to 0 $$
that is $b_n \to a$. As $B$ is closed, $a \in B$, that is $a\in A \cap B$.
