Subset of Real Numbers is Interval iff Connected

Theorem
Let the real number line $\R$ be considered as a topological space.

Let $S$ be a subspace of $\R$.

Then $S$ is connected iff $S$ is an interval of $\R$.

That is, the only subspaces of $\R$ that are connected are intervals.

Proof
From Rule of Transposition, we may replace the only if statement by its contrapositive.

Therefore, the following suffices:

Implication
Suppose $S$ is an interval of $\R$.

Suppose further that $A \mid B$ partitions $S$.

Let $a \in A, b \in B$, and suppose WLOG that $a < b$.

Since $a, b \in S$, and $S$ is an interval, we have that $\left[{a \,.\,.\, b}\right] \subseteq S$.

Let $A' = A \cap \left[{a \,.\,.\, b}\right]$ and $B' = B \cap \left[{a \,.\,.\, b}\right]$.

We have that:

By the definition of a partition, both $A$ and $B$ are closed in $S$.

Hence by Closed Sets in Topological Subspace, $A'$ and $B'$ are also closed in $\left[{a \,.\,.\, b}\right]$.

From the corollary to above theorem, $A'$ and $B'$ are closed in $\R$.

Now, since $B' \ne \varnothing$, and $B$ is bounded below (by, for example, $a$), by the Continuum Property $b' := \inf \left({B'}\right)$ exists, and $b' \ge a$.

Since $B'$ is closed in $\R$, by Closure of Real Interval $b' \in B'$.

Since $a \in A'$ and $A \cap B = \varnothing$, it follows that $b' > a$.

Now let $A'' = A' \cap \left[{a \,.\,.\, b'}\right]$.

Using the same argument as for $B'$, we have that $a = \sup \left({A}\right)$ exists, that $a \in A$ and also $a'' < b'$.

Now $\left({a \,.\,.\, b'}\right) \cap A' = \varnothing$ or $a$ would not be an upper bound for $A''$.

Similarly, $\left({a \,.\,.\, b'}\right) \cap B' = \varnothing$ or $b'$ would not be a lower bound for $B$.

Thus $\left({a'' \,.\,.\, b'}\right) \cap \left({A' \cup B'}\right) = \varnothing$.

But since $a < a'' < b' < b$, we also have:
 * $\left({a'' \,.\,.\, b'}\right) \subseteq \left[{a \,.\,.\, b}\right]$, and
 * $\left({a'' \,.\,.\, b'}\right)$ is nonempty.

So, there is an element $z \in \left({a'' \,.\,.\, b'}\right)$, and hence in $\left[{a \,.\,.\, b}\right]$, which is not in $A' \cup B'$.

This contradicts $(1)$ above, which says that we have $A' \cup B' = \left[{a \,.\,.\, b}\right]$.

Thus we have deduced a contradiction, and hence there can be no such partition $A \mid B$ on the interval $S$.

We conclude that $S$ is connected.

Contrapositive Implication
Suppose $S$ is not an interval of $\R$.

Then by Interval Defined by Betweenness, $\exists x, y \in S$ and $z \in \R \setminus S$ such that $x < z < y$.

Consider the sets $S \cap \left({-\infty \,.\,.\, z}\right)$ and $S \cap \left({z \,.\,.\, +\infty}\right)$.

Then $S \cap \left({-\infty \,.\,.\, z}\right)$ and $S \cap \left({z \,.\,.\, +\infty}\right)$ are open by definition of the subspace topology on $S$.

Neither is empty because they contain $x$ and $y$ respectively.

They are disjoint, and their union is $S$, since $z \notin S$.

Therefore $S \cap \left({-\infty \,.\,.\, z}\right) \mid S \cap \left({z \,.\,.\, +\infty}\right)$ is a partition of $S$.

It follows by definition that $S$ is disconnected.