The pointwise Lipschitz-ness of a function on a dense set, implies its pointwise Lipschitz-ness everywhere?

Some definitions: Let $(M,d)$, $(M',d')$ be metric spaces. For $f:M\to M'$, $x\in M$ and $r>0$, define $$D_r(f)(x):= \sup\{r^{-1}d'(f(x),f(y)): y\in M,\,d(x,y)\leq r\}.$$ Define the pointwise Lipschitz constant of $f$ at $x\in M$ as $\text{Lip}(f)(x):=\limsup_{r\to 0} D_r(f)(x)$, and say $f$ is pointwise Lipschitz at $x$, if $\text{Lip}(f)(x)<\infty$.

My question is the following:

Let $(M,d)$ be a compact length space (see ) and $X$ a Banach space. Let $f:M\to X$ be continuous, and let $S\subseteq M$ be dense in $M$. If there exists a constant $\alpha\geq 0$ such that $\text{Lip}(f)(s)\leq \alpha$ for all $s\in S$, is it then true that there exists a constant $\beta \geq 0$ for which $\text{Lip}(f)(x)\leq \beta$ for all $x\in M$?

If $S$ is quasi-convex (meaning there exists a bi-Lipschitz bijection from $S$ to some length space), then I'm fairly sure that the answer is `yes'.

I thought one could use uniform continuity of $f$ (since $M$ is assumed to be compact) to make the general case work, but one always seems to run into the same problem: For a given $\varepsilon >0$, it seems to be that one cannot necessarily find an $r_0>0$ so that, for all $0<r<r_0$ and all $s\in S$, we have $D_r(f)(s) <\alpha + \varepsilon$. So it feels like there should be a counterexample.

• What about taking the Cantor staircase function? – Nate Eldredge Apr 22 '16 at 15:17
• Ah, that's beautifully simple and very obviously does the trick. Thank you. – Miek Messerschmidt Apr 22 '16 at 18:43

Let $M = [0,1]$ with its usual metric (which is a length space), $X= \mathbb{R}$ and let $f : [0,1] \to \mathbb{R}$ be the Cantor function. Let $S$ be the complement of the Cantor set, which is dense in $[0,1]$. Then we have $\operatorname{Lip}(f)(s) = 0$ for all $s \in S$, yet for all $x$ in the Cantor set, we have $\operatorname{Lip}(f)(x) = \infty$.