Solution (source code)

= Solution

Each interval $(a,b)$ is open in the usual metric: if $x\in(a,b)$, the ball with radius $\min(x-a,b-x)/2$ is contained in it. Conversely, if $U$ is open and $x\in U$, the metric definition supplies $r>0$ with $(x-r,x+r)\subseteq U$. Thus every <open set> is a <union> of open intervals, which proves \b[they form a basis].