A question about an increasing bijection and dense sets. Let $A, B$ be a dense subsets of intervals $[a,b], [c,d]$ respectively.
Consider an nondecreasing bijective function
$$f:A\rightarrow B$$

Is this a continous function? If so, then prove it. Otherwise give a counterexample.

I suspect that the answer is "yes" but i can't prove it.
I have thought that topological definition of continuity may be helpful, however i didn't achieve any result.
Thank you in advance for help
 A: Since $A$ is dense in $[a,b]$ and $B$ is dense in $[c,d]$, define the following function $g\colon[a,b]\to[c,d]$:
$$g(x) = \sup\{f(y)\mid y<x\},$$
Since $f$ is increasing and $A$ is dense, $g$ is well-defined. It is clear that $g$ is also increasing. Since $B$ is dense in $[c,d]$, and $f$ is a bijection, given any $y\in [c,d]$, $A_y=\{x\in A\mid f(x)<y\}$ is bounded in $[a,b]$. Take $x=\sup A_y$, then $$g(x)=\sup\{f(z)\mid z<x\}=\sup\{f(x)\mid x\in A_y\}=y.$$
Therefore $g\colon[a,b]\to[c,d]$ is an increasing bijection, and therefore it is continuous. By extension, $f$ must be continuous as well.
A: Let $U\subseteq B$ be a basic (relatively) open subset.
Then there exist real numbers $\alpha,\beta$ with $U=\{\,y\in B\mid \alpha<y<\beta\,\}$. Let $V=f^{-1}(U)\subseteq A$. We want to show that $V$ is (relatively) open. We need only consider the case $V\ne\emptyset$. Let $\gamma=\inf V\in\Bbb R$ and $\delta=\sup V\in \Bbb R$. Clearly, $V\subseteq [\gamma,\delta]\cap A$.
I claim that usually $V=(\gamma,\delta)\cap A$.
Indeed, assume $x\in (\gamma,\delta)\cap A$. Then there exist $x_1,x_2\in V$ with $\gamma < x_1<x<x_2<\delta$ and it follows that $f(x_1)<f(x)<f(x_2)$, i.e., $f(x)\in B$ and so $x\in V$. This shows $(\gamma,\delta)\cap A\subseteq V$.
Assume $\gamma\in V$ with $\gamma>a$. Then there exists $x_1\in A$ with $a<x_1<\gamma$, hence $c\le f(x_1)\le \alpha<f(\gamma)$. Then there exists $y_2\in U$ with $\alpha < y_2<f(\gamma)$ and so for $x_2:=f^{-1}(y_2)\in V$, we have $x_1<x_2<\gamma$, contradiction. This we can have $\gamma\in V$ only if $\gamma=a$. Similarly, $\delta\in V$ only if $\delta=b$.
We conclude that $V=A\cap(\gamma,\delta)$ or $V=A\cap(a-1,\delta)$  or $V=A\cap(\gamma,b+1)$ or $V=A\cap(a+1,b+1)$. At any rate, $V$ is (relatively) open.
This shows that $f$ is continuous.
A: The function would have to be continuous.
Let $p \in A$ be arbitrary. WLOG, assume that $p \neq b$. (The argument for the right end-point is similar.)
Since $A$ is dense, the limit $f(p^+) := \displaystyle\lim_{x \to p^+}f(x)$ makes sense. Since $f$ is increasing, the limit exists and we have $f(p) \le f(p^+)$.
Also note that $c \le f(p) \le f(p^+) \le d$.
Suppose that $f(p) < f(p^+)$. By density, there exists $q \in B$ such that $f(p) < q < f(p^+)$. Since $f$ is a bijection, there exists $x \in A$ such that $f(x) = q$. This is a contradiction. (Why?)
Thus, $f(p^+) = f(p)$. Similarly, if $p \neq a$, then $f(p) = f(p^-)$. This proves continuity at $p$.
