Strong Counterexample to MVT on Q

A well-known application of the MVT is to prove that any $f: \mathbb{R} \to \mathbb{R}$ with $f’= 0$ is constant. But of course, the MVT relies fundamentally on the properties of $\mathbb{R}$, and in particular does not hold in $\mathbb{Q}$. A standard counter-example is the function $f :\mathbb{Q} \to \mathbb{Q}$ defined by $ f(x)=0 $ if $ x <\sqrt{2}$, and
$f(x)=1$ if $ x > \sqrt{2}$, for this function is locally constant. There are several ways of thinking about the difference between $\mathbb{R}$ and $\mathbb{Q}$ : $\mathbb{R}$ is connected while $\mathbb{Q}$ is totally disconnected, closed bounded intervals are compact in $\mathbb{R}$, but not in $\mathbb{Q}$, $\mathbb{R}$ satisfies the least upper bound axiom, $\mathbb{Q}$ does not.

Now, I wanted to see how far one could push this counterexample – is there a function $f :\mathbb{Q} \to \mathbb{Q}$ such that $f’=0$ and $f$ is strictly increasing? Clearly, any slight modification of the usual counterexample where $f$ is locally constant will not do. Also, one can show that if $f$ is uniformly differentiable with derivative zero, it must be constant, even in $\mathbb{Q}$, so I knew I was looking for non-uniformly differentiable but still differentiable $f$.

Eventually, I came up with a construction, albeit not a very explicit one: the idea is that, since $\mathbb{Q}$ is countable, one can enumerate it $q_{1}, q_{2}, q_{3}, \cdots$, and then define $f: \mathbb{Q} \to \mathbb{Q}$ inductively and recursively. If one could define $f$ in such a way that $ \forall \ q_{n} \in \mathbb{Q} \ \exists \ c_{n} \in \mathbb{Q} : \forall \ x \in \mathbb{Q} \ |f(x)-f(q_{n})| \leq c_{n}|x-q_{n}|^2$, and $f$ is strictly increasing, we would be done. The recursive definition essentially defines $f(q_{n+1})$, after having defined $f(q_{1}),f(q_{2}),f(q_{3}), \cdots , f(q_{n})$, in such a way that these inequalities hold and $f$ is strictly increasing, and at each step the new $c_{n}$ is chosen large enough so that these inequalities do not become incompatible at subsequent steps ( I am willing to provide more details of this construction if asked).

Note that, as $n \to \infty$, we must have $c_{n} \to \infty$, so that $f$ is not uniformly differentiable. Interestingly, the only key fact about $\mathbb{Q}$ used in the construction is that it is countable, so in a sense the construction provides a proof that $\mathbb{R}$ is uncountable, given the MVT.

While the construction works, it is not very simple nor explicit, which is perhaps to be expected, and the function must be evaluated point by point in the order given by the enumeration of $\mathbb{Q}$. So I was wondering if anyone else knows or can come up with a simpler construction of a function
$ f : \mathbb{Q} \to \mathbb{Q}$ such that $f’=0$ and $f$ is strictly increasing. Any thoughts and ideas are welcome.

Edit: I’ve asked the same question on MO: https://mathoverflow.net/questions/248913/strong-counterexample-to-mvt-on-q

Solutions Collecting From Web of "Strong Counterexample to MVT on Q"