TITLE: $|f(x)-f(y)|\le(x-y)^2$ without gaplessness
QUESTION [10 upvotes]: If $|f(x)-f(y)|\le(x-y)^2$ for all $x,y\in\mathbb R$, then it's easy to show that $f'=0$ everywhere, and the mean value theorem implies that that means $f$ is constant.  If there were a gap in the real line and $f=3$ on one side of the gap and $f=4$ on the other side of the gap, then $f'=0$ everywhere but $f$ is not constant.  Gaplessness enters via the mean value theorem.
But I wonder if the proposition holds even in a line with gaps.  For example if $f:\mathbb Q\to\mathbb Q$ and for all $x,y\in\mathbb Q$ this inequality holds, does that imply $f$ is constant?  And what about other gap-filled lines than $\mathbb Q$?  Such as $\mathbb R\setminus A$ where $A$ is a finite set, or a countable set, or a set whose complement is dense, or whatever set it might be of interest to ask this question about?

REPLY [5 votes]: Let $x = x_0 < x_1 < \dots < x_n = y$ be a family of sequences such that $|x_i - x_{i+1}| \rightarrow 0$  Then use triangle inequality and you can make $|f(x) - f(y)|$ arbitrarily small.