In working with the classification of stable vector bundles on $\mathbb{P}^2$, I've found that I need to answer a fairly basic question from analysis/point set topology. Here it is.


Suppose $f:\mathbb{Q}\to \mathbb{Q}$ is 


1. strictly increasing,
2. not bounded above or below,
3. a local homeomorphism (with the topology induced from $\mathbb{R}$), and
4. extends to a continuous map (hence a bijection) $f':\mathbb{R}\to \mathbb{R}$.


Is $f$ a homeomorphism? (That is, is it surjective? Or, alternately, could there exist some irrational number $c$ such that $f(c)$ is rational?)


While I am dealing with a specific function, I state things in this generality because the function itself is fairly nasty and I'd rather not have to use its explicit definition more than I have to. My guess is that it is probably too much to hope for that this be true in this generality, so in case the general version is false here is a refined version of property (3) which incorporates a bit more about my present situation:


3'. there exists a partition $\mathbb{Q}=\bigcup\_{\alpha \in A} I\_\alpha$ of $\mathbb{Q}$ into countably many disjoint open intervals with irrational endpoints, such that $f$ is linear (with rational coefficients) on each interval.


The difficulty (at least for me) is that, viewing the intervals as intervals in the real numbers, their complement forms some kind of Cantor set. 


Thanks!


(EDIT: Several counterexamples have shown the first formulation, with properties 1-4 are false. I imagine the formulation with 3' instead of 3 is also false, but it seems slightly less trivial to get a counterexample due to the condition on the irrationality of the endpoints. In particular, no two intervals can "match up" at an irrational number unless $f$ has the same slope on both intervals.)



Homeomorphism of the rationals
First construct the Cantor set: An uncountable closed set whose complement is a dense open set containing all the rationals. There are a bunch of ways to do this.


Pull back the regular Cantor set along a homeomorphism $\mathbb R\to \mathbb R$ that sends all the rationals to the rationals not in the Cantor set, possible by the same logic as Joseph Van Name's answer.


Take a neighborhood of the rationals with arbitrarily small measure, say finite measure. The complement has positive, indeed infinite measure, and so is uncountable.


Start with an interval and keep subdividing it. Make sure that the open interval you remove in each subdivision is the one with the smallest $f(q)$ in that interval, where $f: \mathbb Q \to \mathbb N$ is a bijection.


The complement of this set is open, therefore a countable union of open intervals. Each interval has two boundary points. Choose some element of the Cantor set that is not a boundary point, and map it to some rational number. Note that it must be irrational since it is in the Cantor set. This will be our counterexample to surjectivity.


Order the open intervals. We build a function piece by piece by choosing its values on each open interval in order. For each interval, choose some linear function with rational coefficients on it that preserves monotonicity. To preserve continuity, choose the function to be very close to failing to preserve monotonicty. The highest $y$ value should be very close to the next $y$ value we have already defined, and similarly for the lowest. This is possible because we have two degrees of freedom and two constraints, so we can choose arbitrarily good rational approximations. The gaps between undefined $y$ values go to $0$, so we can extend continuously and monotonically as the last step, just like the standard Cantor function.


If our open intervals are all bounded, we can ensure the function is unbounded with the same trick.


It is clear our function satisfies all the properties required, except the inverse image of some rational number is an irrational number.


