According to Vershik, an ergodic invertible measure-preserving transformation $T$ on a Lebesgue space $X$ has discrete spectrum if and only if for every bounded measurable function $f\colon X \to \mathbb{C}$ and almost all $x\_0 \in X$, the function from $\mathbb{Z}$ to $\mathbb{C}$ defined by $n \mapsto f(T^nx\_0)$ is Besicovitch almost periodic (for short, BAP). I am mainly interested in the *only if* part of this result: the proof of BAP under the discrete spectrum assumption. 


When $T$ has discrete spectrum, it is isomorphic to an ergodic isometry, and using this version of $T$, it is known that $n \mapsto f(T^nx\_0)$ is uniformly almost periodic when $f$ is continuous. This is proved in Petersen's book, but I have failed to adapt the proof to the Besicovitch almost periodicity (that does not mean the proof is hard, I am not an expert in spectral theory, or even in ergodic theory in general). 


Here is the definition of BAP. On the space of bounded functions $g\colon \mathbb{Z}\to\mathbb{C}$, define the Besicovitch semi-norm:
$$
{\Vert g \Vert} = \limsup\_{K \to \infty} \frac{1}{2K+1}\sum\_{|k|\leq K} \bigl|g(k)\bigr|.
$$
For a bounded function $g\colon \mathbb{Z}\to\mathbb{C}$ define its shift $g\_n(k)=g(n+k)$. Say that $g$ is BAP if the set $\{g\_n, n \in \mathbb{Z}\}$ is relatively compact for ${\Vert \cdot \Vert}$.


Note that ${\Vert \cdot \Vert} \leq {\Vert \cdot \Vert}\_\infty$ (the sup norm), therefore a function is BAP whenever it is uniformly almost periodic (the definition of uniform almost periodicty is obtained by replacing ${\Vert \cdot \Vert}$ with ${\Vert \cdot \Vert}\_\infty$).


The two following conditions are equivalent to BAP:


1. $g$ is the ${\Vert \cdot \Vert}$-limit of a sequence of trigonometric polynomials $p\_N$ having form $p\_N(k) = \sum\_{j=1}^N a^{(N)}\_je^{2i\pi\alpha\_j^{(N)}k}$ with $\bigl|\alpha\_j^{(N)}\bigr|=1$.
2. The continuation of $g$ on the Bohr compactification of $\mathbb{Z}$ exists and belongs to $L^1$ (when the Bohr compactification is endowed with the Haar probability measure).


I don't know whether there is a characterization of BAP looking like the syndeticness of $\epsilon$-periods, which is known to be equivalent to uniform almost periodicity (see [the child's garden of almost periodic functions](http://math.caltech.edu/Szego/Sec5-13App.pdf) where the uniform almost periodicity is called Bochner almost periodicity, and the syndeticness property is called the Bohr almost periodicity). 


One of my attempts was to prove that the set $\bigl\{f \text{ bounded} \mid k \mapsto f(T^kx\_0) \text{is BAP}\bigr\}$ is a vector space containing the uniformly continuous functions and stable by pointwise limit. Then one could conclude by a Stone-Weierstrass result. 


I would prefer a proof that deduces the result directly from the definition, not using a characterization such as 1. and 2., but this is secondary.


Another claim by Vershik is for the case when $T$ is given as a shift on $A^{\mathbb{Z}}$, where $A$ is a finite alphabet. For two sequences $x, y \in A^{\mathbb{Z}}$, define the Besicovitch-Hamming distance
$$
\rho(x,y) = \liminf\_{K \to \infty} \frac{1}{2K+1} \#\left\{k \;\big\vert\; |k| \leq K, x\_k \neq y\_k\right\}. 
$$


*Note:* I obtained my definition of ${\Vert g \Vert}$ by adapting the [Wikipedia page](https://en.wikipedia.org/wiki/Almost_periodic_function) to $\mathbb{Z}$. It is strange that it is defined with a limit superior whereas there is a limit inferior in Vershik's definition of the BH distance. 


Then say that $x$ is BH almost periodic if the set consisting of $x$ and all its shifted sequences is relatively compact for $\rho$. Then it is claimed that an ergodic $T$ has discrete spectrum if and only if almost every orbit of $T$ is BH almost periodic. I don't know whether this result is easier than the previous one, but I am interested in one or the other. 


Vershik gives an argument for this second claim: $T$ is isomorphic to an ergodic isometry by Von Neumann's theorem, and *"observe that the restriction of any bounded measurable function on a compact Abelian group to a countable $\mathbb{Z}$-subgroup, regarded as a function on $\mathbb{Z}$, is BH almost periodic"* (sic). 


UPDATE
------


Ten minutes after posting this question, I found [this document](https://people.math.osu.edu/nowland.159/note-ap-functions.pdf) which provides a proof of the result (the result is stated with "$\mathbb{N}$-orbits" but this should be equivalent). It makes use of the characterization 1. Instead of deleting this post, I ask for a proof that more directly deduces the result from the definition. 



Discrete spectrum and almost periodicity
It follows from ergodic theorem that for a.e. $x \in X$ and any $f \in L^1(X)$ the limit $\lim\limits\_{N\to \infty}\frac{1}{2N+1}\sum\limits\_{k =-N}^N |f(T^kx)|$ exists and coincides with $\|f\|\_{L^1(X)}$. For $k \in \mathbb{Z}$ we can use this for the function $f(T^k\cdot)-f(\cdot)$ and obtain that for a.e. $x \in X$ the following identity holds
$$\lim\limits\_{N\to \infty}\frac{1}{2N+1}\sum\limits\_{k =-N}^N |f(T^kx)-f(x)|=\|f(T^k\cdot)-f(\cdot)\|\_{L^1(X)}.$$
Therefore, for a.e. $x \in X$ BAP-property of the function $n\mapsto f(T^nx)$ is equivalent to the relative compactness of the set $\{f(T^k\cdot)\}\_{k \in \mathbb{Z}}$ in $L^1(X)$. But this relative compactness is equivalent to the discrete spectrum assumption.


