TITLE: Can we characterize a periodic function by the compactness of the set of its translates?
QUESTION [8 upvotes]: Given a function $f$, let us define the translates $f_t(x)=f(x-t)$. A (Bochner) almost-periodic function is a bounded continuous function on $\mathbb R^\nu$ such that the set of functions $\{f_t\vert t\in\mathbb R^\nu\}$ form a precompact set with respect to the supremum norm (a precompact set is a set whose closure is compact). 
This definition is taken from Appendix 1 of this paper.
I was wondering if we insisted that the set is compact rather than just precompact, is this equivalent to $f$ being periodic? That is,

Is it true that a bounded continuous function $f$ on $\mathbb R^\nu$
  is periodic if and only if the set of functions $\{f_t\vert
 t\in\mathbb R^\nu\}$ form a compact set with respect to the supremum
  norm?

REPLY [10 votes]: I would also like to focus on the case $\nu =1$ (to avoid some slightly annoying but probably trivial bookkeeping issues).
Suppose that $\{f_t\}$ is compact. This shows first of all that $f$ is uniformly continuous, or else we could shift problematic points to zero, say, to obtain a sequence with no convergent subsequence.
Now if $f$ wasn't periodic, then $d(s,t)=\|f_s-f_t\|$ defines a translation invariant metric on $\mathbb R$, and $(\mathbb R,d)$ is compact, by assumption. The identity map $(\mathbb R, |\cdot |)\to (\mathbb R, d)$ is continuous (since $f$ is uniformly continuous). This implies that $(\mathbb R,d)$ is still pathwise connected.
Moreover, $\mathbb R$ is a topological group also with the metric $d$: for example, if $d(s_n,s), d(t_n,t)\to 0$, then
\begin{align*}
\|f_{s_n+t_n}-f_{s+t}\| &= \|f_{s_n} - f_{s+t-t_n}\| \le \| f_{s_n}-f_s\| + \|f_s-f_{s+t-t_n}\| \\
& = \|f_s-f_{s_n}\| + \|f_{t_n}-f_t\| \to 0 .
\end{align*}
A pathwise connected compact abelian metric group is a torus (see Theorem 8.46(iii) of the tome of Hoffmann and Morris for this step), but clearly this is absurd here since a torus has torsion and $\mathbb R$ doesn't. So $f$ is periodic.
The other direction is of course trivial.