Solution (source code)

= Solution

The <connected subsets> of the <real line> are exactly the <intervals>, including singletons, unbounded <intervals> and the empty set. Equivalently, whenever $x<y$ belong to the set, every $z$ with $x<z<y$ also belongs to it. Endpoints may or may not be included.