Prove that for a compact metric space $X,$ [$X$ cannot be written as $X=A\cup B$ for nonempty subsets $A$ and $B$ st $d(A,B)>0$] iff $X$ is connected
The question states that one direction doesn't need compactness. I'm fairly confident it's the ==> direction but I'm not sure how to proceed with the proof:
Attempt: ==> For sake of contradiction, assume $X$ is not connected,then $X=A\cup B$ where $A$, $B$ are non-empty, separated sets. Since $d(A,B)\ge0$ as the distance function is always non-negative, then $ \inf{d(A,B)}=0$. However, no $a\in A$ is limit point of $B$ and no $b\in B$ is limit point of $A$
And I'm stuck.
<== For sake of contradiction, assume $X=A\cup B$ such that $d(A,B)>0$. Then since $X$ is connected and $A$ and $B$ are not separated sets, wlog, there must exist $\alpha \in A$ that is limit point of B. However, $\inf{d(\alpha,B)}=0,$ giving us our contradiction.
Edit: Fixing formatting, hold on.
Edit 2: hopefully fixed