You can also carry out this proof using the theorem that a function is continuous if and only if the inverse image of all closed sets are closed.
Continuity is usually defined by saying that the inverse image of open sets are open.
Let $I$ be an open interval in $\mathbb{R}$ and let $f$ be a function from $I$ to $\mathbb{R}$.
By monotonicity of $f$, we know that
$$a \le e \implies f(a) \le f(e) \;\; \text{for all $a$, $e$ in $\mathbb{R}$}$$
We also know the following, by the trichotomy of the reals and contrapositive
$$ f(a) > f(e) \implies a > e \;\; \text{for all $a$, $e$ in $\mathbb{R}$} $$
We also know that $f$ is surjective, i.e.
$$ f^\to(I) = \mathbb{R} $$
Fix a closed interval $\sigma$ in $\mathbb{R}$.
Let $\beta$ be $f^{\leftarrow}(\sigma)$.
By surjectivity, $\beta$ is nonempty.
By monotonicity, $\beta$ is an open, half-open, or closed interval. For every pair of points $a$ ane $e$ in $\beta$, all points $i$ between $a$ and $e$ are also in $\beta$.
Suppose $\beta$ does not contain its top limit point, then $f(\text{lub}(\beta))$ is outside $\sigma$. By monotonicity of $f$, $f(\text{lub}(\beta))$ is greater than $\text{lub}(\sigma)$. Therefore there is a gap between $f^\to(\beta)$ and $f(\text{lub}(\beta))$. By monotonicity, this would mean that $f$ is not surjective, which is a contradiction.
Suppose $\beta$ does not contain its bottom limit point, then there is a gap between $f(\text{glb}(\beta))$ and $f^\to(\beta)$. By monotonicity and surjectivity of $f$, this means that no value can be sent to the gap. This is a contradiction.
Therefore, $f^{\leftarrow}(\sigma)$ is an interval that contains both its limit points. Therefore $\beta$ is a closed interval.
Since the inverse image of all closed intervals are closed, this means that the inverse image of any closed subset of $\mathbb{R}$ is closed.
Thus $f$ is continuous.
Is right?
– Marinela Apr 07 '21 at 02:08