Uniform continuity, uniform convergence, and translation

The given conditions do not imply uniform continuity.

Let us construct our counterexample by first creating a "weight" function on the rational numbers defined as follows: $$w(x)=\min\left\{n:x=a_0+\frac{1}{a_1}+\frac{1}{a_2}+\ldots+\frac{1}{a_n},\,a_i\in\mathbb Z\right\}$$ That is, $w(x)$ is the least number $n$ such that $x$ is an integer plus the reciprocal of $n$ integers. Note that $w$ is $0$ on the integers themselves. Now, define a family of functions $d_{\alpha,\beta}:\mathbb R\rightarrow\mathbb R$ for $\alpha,\beta>0$ as follows: $$d_{\alpha,\beta}(x)=\min\{\alpha|x-q|+\beta w(q):q\in \mathbb Q\}.$$ One can see that the given set actually has a minimum since the set $Q_n=\{q\in \mathbb Q:w(q)\leq n\}$ is closed, so there is a well-defined minimum distance from $x$ to an element of $Q_n$, and for large $n$ the $\beta w(q)$ term will be too large to be a minimum. We may also note that this function satisfies the triangle inequality: $$d_{\alpha,\beta}(x+y)\leq d_{\alpha,\beta}(x)+d_{\alpha,\beta}(y).$$ This may be proved by first noting that $w$ satisfies the triangle inequality, then doing some algebra.

We will critically rely on two consequences of the triangle inequality. Firstly, since $d_{\alpha,\beta}(x)\leq \alpha |x|$, we get that $d_{\alpha,\beta}$ is continuous. We can also use the fact that $d_{\alpha,\beta}(1/n)=\min(\beta,\alpha/n)$ as a bound for the difference $d_{\alpha,\beta}(x)-d_{\alpha,\beta}(x+1/n)$, which is important for our application.

Now, let us choose a sequence $s_i$ of irrational numbers converging to $0$ and try to set our parameters to make $d_{\alpha,\beta}(s_m)$ large, while decreasing $\beta$. Thus, we get that differences $d_{\alpha,\beta}(x)-d_{\alpha,\beta}(x+1/n)$ will be small, but the function will obtain large values near zero. The big picture is that we will stitch together lots of functions like this, causing a big problem for uniform continuity.

Specifically, let $\varepsilon_i$ be the distance from $s_i$ to any element of $Q_i$. That is, $\varepsilon_i=\min\{|s_i-q|:q\in Q_i\}$. Set $\alpha_i=\frac{1}{\varepsilon_i}$ and $\beta_i=\frac{1}i$. We may note that $d_{\alpha_i,\beta_i}(s_i)\geq 1$ by seeing that if $q\in Q_i$, then $\alpha_i|s_i-q|\geq 1$ by definition of $\alpha_i$, and if $q\not\in Q_i$ then $\beta_i w(q)\geq 1$, thus the expression $\alpha_i|s_i-q|+\beta_i w(q)$ is at least $1$ for all rational $q$.

Now, we need to come up with a way to get our function to be compactly supported, but still do what we want. Define a window map $g$ by the following relations: $$g(x)=\begin{cases}x & \text{if }0\leq x\leq 1 \\ 1 & \text{if } 1\leq x\leq 2 \\ 3-x & \text{if }2\leq x \leq 3 \\ 0 &\text{otherwise}\end{cases}.$$ This map is a sort of "table" with a flat middle section and two sloping sides. Now, we define $$f_i(x)=g(x)\cdot \min(d_{\alpha_i,\beta_i}(x),1).$$ Let us bound $|f_i(x)-f_i(x+1/n)|$. To do so, note that $\left| d_{\alpha_i,\beta_i}(x)-d_{\alpha_i,\beta_i}(x+1/n)\right|\leq \min(\beta_i,\alpha_i/n)$. Obviously, $\left|g(x)-g(x+1/n)\right|\leq 1/n$. Together, we can use these to get the bound: $$\left|f_i(x)-f_i(x+1/n)\right|\leq 1/n + \min(\beta_i,\alpha_i/n).$$ We also have that $|f_i(1)-f_i(1+s_i)|=1$, which we will use later to contradict uniform continuity.

Finally, we do the stitching. Define $f$ as follows: $$f(x)=\begin{cases}f_i(x-3i) & \text{if }3i \leq x \leq 3i+3,\,i\in \mathbb N \\ 0 &\text{if } x \leq 0 \end{cases}.$$ Since, in any interval of length at most one, $f$ may decomposed as a sum of translates of two functions $f_i$ and $f_{i+1}$, we immediately get an inequality $$\left|f(x)-f(x+1/n)\right| \leq 2/n + \min(\beta_i,\alpha_i/n) + \min(\beta_{i+1},\alpha_{i+1}/n).$$ $$\left|f(x)-f(x+1/n)\right| \leq \sup \{2/n + 2\min(\beta_i,\alpha_i/n):i\in\mathbb N\}$$ One has that $\lim_{n\rightarrow\infty}\sup\{2/n + 2\min(\beta_i,\alpha_i/n)\}=0$ since, for any $\varepsilon$, there is some $I$ such that for all $i>I$ we have $\beta_i<\varepsilon$. However, if we let $N=\max\{\alpha_i/\varepsilon:i\leq I\}$ then we have that $\alpha_i/n<\varepsilon$ for all $i\leq I$ and $n>N$. Thus, the given term is less than $2/n+2\varepsilon$ for all $n>N$, meaning it converges to $0$. This, of course, gives that $f(x+1/n)$ converges uniformly to $f(x)$.

However, $f$ is not uniformly continuous since $|f(3i+1)-f(3i+1+s_i)|=1$ for all $s_i$, even though $s_i$ goes to zero. Thus, there can be no $\delta$ such that $|x-y|<\delta$ implies $|f(x)-f(y)|<1$. We are therefore done.


I thought, to help guide intuition, a few pictures might help out. One should note that only the ratio $\alpha/\beta$ actually affects the shape of $d_{\alpha,\beta}$ due to the identity $d_{c\alpha,c\beta}(x)=cd_{\alpha,\beta}(x)$. Here's a couple plots where $\alpha/\beta=12$ in the first picture, $40$ in the second, and $600$ in the third. Each one shows an increase in the number of "tiers" in the function due to bands of rationals where $w(q)=d_{\alpha,\beta}(q)$. enter image description here enter image description here enter image description here The last picture nearly melted my computer to plot. The moral of the story there is that $\alpha_i$ might need to be really big to satisfy what is demanded of it.