Monotone Real Function with Everywhere Dense Image is Continuous

Theorem
Let $I$ and $J$ be real intervals.

Let $f: I \to J$ be a monotone real function.

Let $f \sqbrk I$ be everywhere dense in $J$, where $f \sqbrk I$ denotes the image of $I$ under $f$.

Then $f$ is continuous on $I$.

Proof
Let $f$ be increasing.

$f$ is discontinuous at $c \in I$.

Let:
 * $L^-$ denote $\ds \lim_{x \mathop \to c^-} \map f x$
 * $L$ denote $\map f c$
 * $L^+$ denote $\ds \lim_{x \mathop \to c^+} \map f x$

From Discontinuity of Monotonic Function is Jump Discontinuity, $L^-$ and $L^+$ are (finite) real numbers.

Since $f$ is increasing:
 * $L^- \le L \le L^+$

Let $S = \openint {L^-} {L^+}$.

If $L^- = L = L^+$, then $c$ is not a discontinuity, a contradiction.

Thus $S$ is non-degenerate.

From Non-Degenerate Real Interval is Infinite, $S$ is infinite.

From Relative Difference between Infinite Set and Finite Set is Infinite, $S \setminus \set L$ is non-empty.

From Finite Subset of Metric Space is Closed, $\set L$ is closed.

From Open Set minus Closed Set is Open, $S \setminus \set L$ is open.

Lemma
Thus:

Thus there exists a non-empty open subset of $f \sqbrk I$ that is disjoint from $Y$.

From Open Set Characterization of Denseness, $f \sqbrk I$ is not everywhere dense in $J$.

This contradicts the hypothesis that $f \sqbrk I$ is everywhere dense in $J$.

Therefore $I$ contains no discontinuities, by Proof by Contradiction.

The same argument, mutatis mutandis, proves the case where $f$ is decreasing

Hence the result, by Proof by Cases.