Only countably many points outside a set end an interval inside it

See it in Lean

Axioms
ZFC only
Concerns
Separable, Linearly orderable

Statement

Let \(X\) carry the order topology of a linear order \(<\) that is dense (between any two points there is a third), and suppose that \(X\) is separable. Let \(O \subseteq X\). Then the set of points \(x \notin O\) for which some \(a < x\) has \((a, x) \subseteq O\) is countable.

Proof

Let \(E\) be this set, and \(D\) a countable dense subset of \(X\). For each \(x \in E\) choose \(a_x < x\) with \((a_x, x) \subseteq O\). The interval \((a_x, x)\) is open and nonempty, since the order is dense, so we may choose \(d_x \in D \cap (a_x, x)\). We show that \(x \mapsto d_x\) is injective on \(E\), so that \(E\) is countable. Let \(x < y\) in \(E\). If \(d_x = d_y\), then \(a_y < d_y = d_x < x < y\), so \(x \in (a_y, y) \subseteq O\), contradicting \(x \notin O\). Exchanging the roles of \(x\) and \(y\) gives the same when \(y < x\). \(\blacksquare\)

Reversing the order gives the same for points \(x \notin O\) with some \(b > x\) such that \((x, b) \subseteq O\).

Where it is used

Cited on space pages