$f(x+1)=f(x)+1$ and $f(x^2)=f(x)^2$ A function that satisfies both $f(x+1)=f(x)+1$ and $f(x^2)=f(x)^2$ for all real $x$ is known to be the identity over $\mathbb Q$, but is it also the identity over $\mathbb R$? If not, can you provide me an example of such a function? Thanks.
 A: if $f(x)<x$ for some $x$, you can suppose $x$ and $f(x)$ being greater than $1$. Then $f\left(x^{2^n}\right)< m < x^{2^n}$ for some integers $m,n$, then $f\left(x^{2^n} - m\right) < 0$ being $ x^{2^n} - m > 0$ and that's a contradiction. You can do a similar argument with the other inequality , the argument is very close to the one in the previous answer.
A: I was just about to supply a counter-example (e.g., set $f(\pi)=e$ and then assign the values at all of the points 'algebraically related' to $\pi$ according to the value of the same algebraic relation applied to $e$) when I realized that this has a clear flaw - for $f$ to be well-defined over $\mathbb{R}$, it must satisfy $f(x)\gt 0$ for all $x\gt 0$ (otherwise $f(\sqrt{x})$ is ill-defined).  I suspect this is enough to prove that $f$ must be the identity because you can use the maps $x\rightarrow x+1$, $x\rightarrow x^2$ and their inverses to map each $x$ down into some arbitrarily small neighborhood of $0$ and bound its values there (the positivity condition bounds the value from below and I suspect that clever manipulations will let you use it to bound the value from above), forcing f to be continuous in a neighborhood of $0$ and thus (by 'blowing up' the neighborhood to $[0,1)$ using $f(\sqrt{x}) = \sqrt{f(x)}$ and then translating up and down the line) to be the identity.
EDIT:  shurtados's version of this argument does the trick.  As noted there, if $f(x) \lt x$ for some $x\gt 0$, we can derive a contradiction because we can find integers $m$ and $n$ such that $f(x^{2^n}) \lt m \lt x^{2^n}$ and thus find a value $y\gt 0$ with $f(y)\lt 0$, giving us the contradiction above.
Now, we can finish with this argument: suppose $f(x)\gt x$ for some $x\gt 0$; choose an integer $m$ with $f(x)\lt m$.  We get $(x-m)\lt f(x-m) \lt 0$, so $0\lt f((x-m)^2) = (f(x-m))^2 \lt (x-m)^2$, and with $y = (x-m)^2$ we have $f(y) \lt y$, giving the needed contradiction; ergo, $f(x)=x$ for all $x\in\mathbb{R}$.
