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 $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:

Sufficient Condition
Suppose $S$ is an interval of $\R$.

Suppose further that $A \mid B$ is a separation of $S$.

Let $a \in A, b \in B$.

, suppose that $a < b$.

Since $a, b \in S$, and $S$ is an interval, $\closedint a b \subseteq S$.

Let $A' = A \cap \closedint a b$ and $B' = B \cap \closedint a b$.

Then:

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

Hence by Closed Set in Topological Subspace, $A'$ and $B'$ are also closed in $\closedint a b$.

From Closed Set in Topological Subspace: Corollary, $A'$ and $B'$ are closed in $\R$.

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

We have that $B'$ is closed in $\R$

Hence from Closure of Real Interval is Closed Real Interval:
 * $b' \in B'$

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

Now let $A'' = A' \cap \closedint a {b'}$.

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

Now $\openint {a} {b'} \cap A' = \O$ or $a$ would not be an upper bound for $A''$.

Similarly, $\openint {a} {b'} \cap B' = \O$ or $b'$ would not be a lower bound for $B$.

Thus:
 * $\openint {a''} {b'} \cap \paren {A' \cup B'} = \O$

But since $a < a'' < b' < b$, we also have:
 * $\openint {a''} {b'} \subseteq \closedint a b$, and
 * $\openint {a''} {b'}$ is non-empty.

So, there is an element $z \in \openint {a''} {b'}$, and hence in $\closedint a b$, which is not in $A' \cup B'$.

This contradicts $(1)$ above, which says that we have $A' \cup B' = \closedint a b$.

From this contradiction it follows that there can be no such separation $A \mid B$ on the interval $S$.

Therefore, by definition, $S$ is connected.

Necessary Condition
Suppose $S$ is not an interval of $\R$.

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

Consider the sets $S \cap \openint \gets z$ and $S \cap \openint z \to$.

Then $S \cap \openint \gets z$ and $S \cap \openint z \to$ 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 \openint \gets z \mid S \cap \openint z \to$ is a separation of $S$.

It follows by definition that $S$ is disconnected.