I would like to know whether there exists some continuous function $F$ satisfying the following conditions: Let $R$ be all real numbers and $Q$ be all rational numbers. Denote by $F(R)$ and $F(Q)$ the ranges of $F$ on $R$ and $Q$. Could $F$ satisfy the following conditions: 1. $F$ is a surjection ($F(R)=R$), but not an injection; 2. $F(Q)\subset Q$ 3. The restriction $F: Q\to Q$ is an injection, but not a surjection. If such $F$ exists, please give an example. If not exists, could someone give a proof? Thx a lot!