Given a compact $S$ in $\mathbb R^m$ with the following property: For every pair of points $a, b \in S$ and for every  $\varepsilon > 0$ there exists a finite set of points $\{x_0, x_1,..., x_n\}$ in $S$ with $x_0 = a$ and $x_n = b$ such that $\|x_k - x_{k-1}\|<\varepsilon$  for $k = 1, 2, . . , n$. Prove or disprove: $S$ is connected.
Proof
Why in the proof they say that $A$ is closed in $S$, and $B$ is closed in $S$, also that $x=y$?

We have that $S=A\cup B$ where $A,B$ are non-empty open sets such that $A\cap B=\emptyset$. Then $A=B^c$ and $B=A^c$, and therefore, by definition, $A$ and $B$ are closed sets.
