---
abstract: |
    We investigate generalised polynomials (i.e. polynomial-like expressions involving the use of the floor function) which take the value $0$ on all integers except for a set of density $0$.

    Our main result is that the set of integers where a sparse generalised polynomial takes non-zero value cannot contain a translate of an IP set.  We also study some explicit constructions, and show that the characteristic functions of the Fibonacci and Tribonacci numbers are given by generalised polynomails.  Finally, we show that any sufficiently sparse $\{0,1\}$-valued sequence is given by a generalised polynomial. 
address:
- |
    Department of Mathematics and Computer Science\
    Institute of Mathematics\
    Jagiellonian University\
    ul.  prof.  Stanisława Łojasiewicza 6\
    30-348 Kraków
- |
    Mathematical Institute\
    University of Oxford\
    Andrew Wiles Building\
    Radcliffe Observatory Quarter\
    Woodstock Road\
    Oxford\
    OX2 6GG
author:
- Jakub Byszewski
- Jakub Konieczny
bibliography:
- 'bibliography.bib'
title: Sparse generalised polynomials
---

Introduction {#introduction .unnumbered}
============

Generalised polynomials are functions given by polynomial-like expressions involving the (possibly iterated) use of the floor function such as $$f(n) = n \lfloor \sqrt{2} n^2 +3\lfloor\sqrt{3} n \rfloor^2 \rfloor .$$

Despite some superficial similarities, the class of generalised polynomials differs in fundamental ways from the class of polynomials.  For instance, the set of zeroes of a generalised polynomial may be infinite without the polynomial being $0$, which is the case for example for $ f(n) = n/2-\lfloor n/2\rfloor$. As a more striking example, the characteristic function of the Fibonacci numbers can also be expressed as a generalised polynomial (see Example \[ex:lin-rec-is-gp\]).  We refer to generalised polynomials that take non-zero values on a set of density $0$ as *sparse generalised polynomials*. 

In a series of papers [@Haland-1993], [@Haland-1994], [@HalandKnuth-1995], [Hland]{} and Knuth studied the equidistribution modulo $1$ of certain generalised polynomials of a specific form.  In a more general situation, Bergelson and Leibman [@BergelsonLeibman2007] studied the distribution of values of arbitrary generalised polynomials.  They proved, among other things, that any generalised polynomial $g \colon {\mathbb{Z}}\to {\mathbb{R}}^d$ is well-distributed inside a (parametrised) piecewise polynomial surface (for precise definitions, see [@BergelsonLeibman2007]).  A very general result on equidistibution modulo $1$ was obtained by Leibman [@Leibman-2012]. 

Much of the existing theory does not distinguish between two generalised polynomials which differ on a set of density $0$. In particular, most of the results mentioned above are vacuous for sparse generalised polynomials, which from this point of view are indistinguishable from the constant zero function. 

In the present note we propose to study some combinatorial structures which are related to sparse generalised polynomials.  Our focus is restricted mainly to $\{0,1\}$-valued sequences, which can be identified with subsets of ${\mathbb{Z}}$ in a natural way.  We will say that a set $E \subset {\mathbb{Z}}$ is generalised polynomial if its characteristic function is a generalised polynomial; the set $E$ is sparse if its characteristic function is sparse.  We ask which combinatorial structures can be found in sparse generalised polynomial sets. 

Recall that an [$\operatorname{IP}$]{} set is a set containing the set of finite sums of a sequence of positive integers, i.e. a set of the form ${\left\{ \sum_{i \in \alpha} n_i  \ \middle| \  \emptyset \neq \alpha \subset {\mathbb{N}},\ {\left|{\alpha}\right|} < \infty \right\} }$, where $(n_i)_{i \in {\mathbb{N}}} \subset {\mathbb{N}}$. We are now ready to state our main result. 

\[thm:main-A\] Suppose that $E$ is a sparse generalised polynomial set.  Then $E$ does not contain an [$\operatorname{IP}$]{} set. 

A slight generalisation of this result is a key component in the companion paper [@ByszewskiKonieczny], which proves a rigid structure theorem for all sequences which are simultaneously generalised polynomial and automatic (relevant definitions can be found therein). 

Our methods rely on the link between the generalised polynomials and orbits on nilmanifolds that was established by Bergelson and Leibman (Theorem \[BLnilgenpolythm\]).  Specifically, we show that the set of times at which a linear orbit on a nilmanifold visits a semialgebraic set cannot be an [$\mathrm{IPS}$]{} set, unless the set has nonempty interior (Theorem \[thm:S:main-1\]). ( The notion of an [$\mathrm{IPS}$]{} set generalises the notion of a shifted [$\operatorname{IP}$]{} set, see Definition \[def:IPS-set\].) 

We denote the fractional part of a real number $r$ by ${\left\{ r \right\}}=r-\lfloor r\rfloor $, and the nearest integer to $r$ by ${\langle\!\langle}r {\rangle\!\rangle}= \lfloor r+1/2\rfloor$.

We are interested in “natural” examples of sparse generalised polynomials.  One of the simplest examples is the set of integers $n$ such that ${\left\{ n \varphi \right\}} < 1/n$, where $\varphi = (1 + \sqrt{5})/2$ is the golden ratio.  This set is closely connected to the Fibonacci numbers.  It is not difficult to show that sets of the form ${\left\{ n \in {{\mathbb{N}}}\ \middle| \  0 < {\left\{ q(n) \right\}} < n^{-c}  \right\} }$ are sparse generalised polynomials if $q(n)$ is a generalised polynomial and $c$ is rational and positive.  For sequences of this form, a much simpler proof of Theorem \[thm:main-A\] is possible (Proposition \[prop:IP-auto-vs-special-gp\]). 

Because of the intimate connection between continued fractions and diophantine approximation, it is not particularly surprising that for a quadratic irrational $\beta > 1$ of norm $\pm 1$, the set ${\left\{  {{\langle\!\langle}\beta^i {\rangle\!\rangle}}  \ \middle| \ i \in {\mathbb{N}}_0 \right\} }$ is generalised polynomial (see Example \[ex:lin-rec-is-gp\] and Proposition \[thm:quadraticPisotisGP\]).  It is considerably more surprising that a similar result holds also for certain algebraic integers of degree three (see Theorem \[LAcrime\]). 

\[thm:main-B\] Assume that $\beta>1$ is either:

1.   a root of an equation $\beta^2=a\beta \pm 1$, where $a$ is an integer; or

2.   the unique real root of an equation ${\beta}^3 = a {\beta}^2 + b {\beta}+ 1$, where $a,b$ are integers and either $a \geq 0$ and $0 \leq b \leq a+1$ or $a \geq 2$ and $b = -1$.

Then the set ${\left\{  {{\langle\!\langle}{\beta}^i {\rangle\!\rangle}} \ \middle| \ i \in {\mathbb{N}}_0 \right\} }$ is generalised polynomial. 

In the companion paper [@ByszewskiKonieczny], we show that if there are non-ultimately periodic $k$-automatic sequences which are simultaneously generalised polynomials, then the set of powers of $k$ is generalised polynomial.  In light of these examples, we find it pertinent to ask for which ${\beta}> 1$ is the set ${\left\{  {{\langle\!\langle}{\beta}^i {\rangle\!\rangle}} \ \middle| \ i \in {\mathbb{N}}_0 \right\} }$ generalised polynomial (Question \[Q:Pisot\]).  The question is of particular interest if ${\beta}$ is an algebraic integer, or, more specifically, a Pisot number. 

The final main result of this paper says that any sufficiently sparse set is generalised polynomial.  For this reason, it seems unlikely that a comprehensive understanding of sparse generalised polynomials is possible.  This result is perhaps expected.  In [@BergelsonLeibman2007 Example 3.4.2], the set $S_a=\{n\in {{\mathbb{N}}}\mid 0 < {{\langle\!\langle}an {\rangle\!\rangle}} <1/n\}$ is considered for $a\in {{\mathbb{R}}}$. The authors note that for the choice of $a=\sum_{n=1}^{\infty} 2^{-(2^n-1)}$, we have $2^{2^n-1}\in S_a$ for $n\in {{\mathbb{N}}}$. However, in this construction it is not clear if $S_a$ contains any other elements.  We show that the construction can be modified in order to produce the following general result. 

\[thm:main-C\] There exists a constant $C > 0$ such that for any sequence $(n_i)_{i \geq 0}$ such that $n_0 \geq 2$ and $n_{i+1} \geq n_{i}^C$ for all $i \geq 0$, the set $E = {\left\{ n_i \ \middle| \ i \in {\mathbb{N}}_0 \right\} }$ is generalised polynomial. 

The paper is organised as follows.  In Section \[sec:DEF\] we review background material; in particular we discuss connections between dynamics on nilmanifolds and generalised polynomials.  In Section \[sec:IPS-GP\] we introduce [$\mathrm{IPS}$]{} sets and formulate a stronger version of Theorem \[thm:main-A\].  In Section \[sec:S-GENPOLY\] we prove Theorem \[thm:main-A\], and obtain some results on the distribution of fractional parts of polynomials on nilmanifolds which are possibly of independent interest.  In Section \[sec:Examples\] we discuss a specific class of sparse generalised polynomials related to small fractional parts, provide examples of such sequences, and prove Theorem \[thm:main-C\].  In Section \[sec:Exponential\] we discuss sets of values of certain sequences of exponential growth, and we prove Theorem \[thm:main-B\]. 

Acknowledgements. {# acknowledgements.  .unnumbered}
-----------------

The authors thank Ben Green for much useful advice during the work on this project, Vitaly Bergelson and Inger [Hland]{} Knutson for valuable comments on the distribution of generalised polynomials, and Jean-Paul Allouche for comments on related results on automatic sequences. 

Thanks also go to Jennifer Brown, Sean Eberhard, Dominik Kwietniak, Freddie Manners, Rudi Mrazović, Przemek Mazur, Sofia Lindqvist, and Aled Walker for many informal discussions. 

This research was supported by the National Science Centre, Poland (NCN) under grant no.  DEC-2012/07/E/ST1/00185.  JK also acknowledges the generous support from the Clarendon Fund and SJC Kendrew Fund for his doctoral studies. 

Finally, we would like to express our gratitude to the organizers of the conference *New developments around $\times 2\ \times 3$ conjecture and other classical problems in Ergodic Theory* in Cieplice, Poland in May 2016 where we began our project. 

Background and Definitions {#sec:DEF}
==========================

Notations and generalities {#notations-and-generalities .unnumbered}
--------------------------

We denote the sets of positive integers and of nonnegative integers by ${{\mathbb{N}}}=\{1,2,\ldots\}$ and ${{\mathbb{N}}}_0=\{0,1,\ldots\}$. We denote by $[N]$ the set $[N]=\{0,1,\ldots, N-1\}.$ We use the Iverson’s convention: whenever $p$ is any sentence, we denote by ${\left\llbracket p \right\rrbracket}$ its logical value ($1$ if $p$ is true and $0$ otherwise).  We denote the number of elements of a finite set $A$ by $|A|$.

For a real number $r$, we denote by $\lfloor r \rfloor$ its integer part, by $\{r\}=r-\lfloor r\rfloor$ its fractional part, by ${\langle\!\langle}r {\rangle\!\rangle}= \lfloor r+1/2\rfloor$ the nearest integer to $r$, and by ${\left\lVert r \right\rVert} = |r-{\langle\!\langle}r{\rangle\!\rangle}|$ the distance from $r$ to the nearest integer. 

We use some standard asymptotic notation.  Let $f$ and $g$ be two functions defined for sufficiently large integers.  We say that $f=O(g)$ or $f \ll g$ if there exists $c>0$ such that $|f(n)|\leq c {\left|g(n)\right|}$ for sufficiently large $n$. We say that $f=o(g)$ if for every $c >0$ we have $|f(n)|\leq c |g(n)|$ for sufficiently large $n$.

For a subset $E\subset {{\mathbb{N}}}_0$, we say that $E$ has natural *density* $d(A)$ if $$\lim_{N\to \infty} \frac{|E\cap [N]|}{N} = d(A).$$

We now formally define generalised polynomials. 

The family of *generalised polynomials* is the smallest set of functions $f \colon {\mathbb{Z}}\to {\mathbb{R}}$ containing the polynomial maps and closed under addition, multiplication, and the operation of taking the integer part.  A set $E\subset {{\mathbb{Z}}}$ is called *generalised polynomial* if its characteristic function given by $f(n)={\left\llbracket n\in E \right\rrbracket}$ is a generalised polynomial. 

It is sometimes convenient to consider instead generalised polynomials as functions defined on the set ${{\mathbb{N}}}_0$ (and similarly consider generalised polynomial sets $E\subset {{\mathbb{N}}}_0$).  The precise usage will always be clear from the context. 

The class of generalised polynomial sets is clearly closed under Boolean operations. 

Dynamical systems {#dynamical-systems .unnumbered}
-----------------

An (invertible, topological) dynamical system is given by a compact metrisable space $X$ and a continuous homeomorphism $T\colon X\to X$. We say that $X$ is transitive if there exists $x\in X$ whose orbit $\{T^n x \mid n\in {{\mathbb{Z}}}\}$ is dense in $X$. We say that $X$ is minimal if for every point $x\in X$ the orbit $\{T^n x \mid n\in {{\mathbb{Z}}}\}$ is dense in $X$. (Equivalently, the only closed subsets $Y\subset X$ such that $T(Y)\subset Y$ are $Y=X$ and $Y=\emptyset$.) We say that $X$ is totally minimal if the system $(X,T^n)$ is minimal for all $n\geq 1$.

Let $(X,T)$ be a dynamical system.  We say that a Borel measure $\mu$ on $X$ is invariant if for every Borel subset $A\subset X$ we have $\mu(T^{-1}(A))=\mu(A)$. By the Krylov-Bogoliubov Theorem, each dynamical system has at least one invariant measure.  We say that a dynamical system in *uniquely ergodic* if it has exactly one invariant measure.  We say that an invariant measure $\mu$ on $X$ is ergodic if for every $A\subset X$, $T^{-1}(A)=A$ implies $\mu(A)\in\{0,1\}$.

If $(X,T)$ is minimal, $x \in X$, and $U \subset X$ is open, then the set ${\left\{ n \in {\mathbb{Z}}\ \middle| \ T^n x \in U \right\} }$ is syndetic, i.e. has bounded gaps (cf. [ @Furstenberg1981 Thm.  1.15]). 

We will frequently use the fact that a minimal system $(X,T)$ with $X$ connected is totally minimal. ( Otherwise, there exists $d \in {\mathbb{N}}$ and a closed subset $\emptyset \neq Y \subsetneq X$ such that $T^d(Y) \subset Y$. By the Kuratowski-Zorn Lemma there exists a minimal $Y$ with this property.  The sets $Y,T(Y),T^{2}(Y),\dots,T^{d-1}(Y)$ are disjoint, closed, and their union is $X$. This contradicts $X$ being connected.) 

\[thm:ergo-thm-uniform\] Let $(X,T)$ be a uniquely ergodic dynamical system with an invariant measure $\mu$. Then, for any continuous function $f\colon X\to {\mathbb{C}}$, we have $$\frac{1}{N} \sum_{n = 0}^{N - 1} f(T^n x) \to \int_X f d\mu$$ as $N \to \infty$. Furthermore, the convergence is uniform in $x \in X$.

By a standard argument that bounds the characteristic function of a set from above and from below by continuous functions, we obtain the following result, frequently used in the sequel. 

\[cor:density-uniform\] Let $(X,T)$ be a uniquely ergodic dynamical system with an invariant measure $\mu$. Then for any $x \in X$ and any $S \subset X$ with $\mu(\partial S) = 0$, the set $E = {\left\{ n \in {\mathbb{N}}_0 \ \middle| \ T^n x \in S \right\} }$ has density $\mu(S)$.

Generalised polynomials and nilmanifolds {#sec:DEF-GP .unnumbered}
----------------------------------------

A nilmanifold is a homogenous space $X=G/\mathord \Gamma$, where $G$ is a nilpotent Lie group and $\Gamma$ is a discrete cocompact subgroup, together with the action of $G$ on $X$ via left translations.  We do not assume that $G$ is connected, however in all the cases that we will consider the connected component $G^{\circ}$ of $G$ will be *simply connected*.  We assume this henceforth, since it will substantially simplify the discussion. 

We begin by recalling a few basic facts concerning nilpotent Lie groups.  We follow the presentation in [@BergelsonLeibman2007] and [@Malcev1951] which the reader should consult for the proofs.  Let $G$ be a connected simply connected nilpotent Lie group.  For each $g\in G$, there is a unique one-parameter subgroup $\{g^t\}_{t\in{{\mathbb{R}}}}$ of $G$, i.e. a continuous homomorphism ${{\mathbb{R}}}\to G$, $t\mapsto g^t$ with $g^1=g$. Consider the lower central series $$G_0 = G_1 \supset G_2 \supset \ldots\supset G_d\supset G_{d+1}=1$$ given by $G = G_0 = G_1$ and $G_{i+1}=[G,G_i]$, $1\leq i \leq d$. The subgroups $G_i$ are closed and $G_i/\mathord G_{i+1}$ are finite dimensional ${{\mathbb{R}}}$-vector spaces with the action of ${{\mathbb{R}}}$ given by one-parameter subgroups. 

Let $l_i=\dim_{{{\mathbb{R}}}} G_i/\mathord G_{i+1}$, $k_i=\sum_{j=1}^i l_j$, $0\leq i \leq d$. Then $G$ has a *[Mal’cev]{} basis*, i.e. elements $e_1,\ldots,e_k\in G$, $k=k_d$, such that $e_{k_{i-1}+1},\ldots,e_{k_{i}}\in G_i$ and their images in $G_i/\mathord G_{i+1}$ constitute a basis of $G_i/\mathord G_{i+1}$ as a ${{\mathbb{R}}}$-vector space. 

It follows easily that any element $g\in G$ can be written uniquely in the form $$g=e_1^{t_1}\cdots e_k^{t_k}, \quad t_i\in {{\mathbb{R}}}.$$ Furthermore, it is possible to choose a [Mal’cev]{} basis to be compatible with $\Gamma$, i.e. so that $g=e_1^{t_1}\cdots e_k^{t_k}$ is in $\Gamma$ if and only if $t_1,\ldots,t_k \in{{\mathbb{Z}}}$. We will always assume that our [Mal’cev]{} bases are compatible with $\Gamma$. A choice of a [Mal’cev]{} basis determines a diffeomorphism $${\widetilde}\tau \colon  G \to {{\mathbb{R}}}^k, \quad  e_1^{t_1}\cdots e_k^{t_k} \mapsto (t_1,\ldots, t_k).$$ Under this identification, multiplication in $G$ is given by polynomial formulae in variables $t_i$ with rational coefficients.  These polynomials take integer values if all the variables are integers. 

Let $[0,1)^k=\{(t_1, \ldots,t_k)\in {{\mathbb{R}}}^k \mid 0\leq t_i < 1, 1\leq i\leq k\}$ be the unit cube.  The preimage $D = {\widetilde}{\tau}^{-1}([0,1)^k) \subset G$ is the *fundamental domain*.  For any $g\in G$, there is a unique choice of elements $ \{g \}\in D, [g]\in \Gamma$ (called the *fractional part* and the *integral part* of $g$) such that $g={\left\{ g \right\}} {\left[ g \right]}$. Note that the elements $\{g\}$ and $[g]$ depend on the choice of the [Mal’cev]{} basis.  Since the [Mal’cev]{} basis is compatible with $\Gamma$, the map $g\mapsto {\widetilde}{\tau}({\left\{ g \right\}})$ factors to a bijection $$\tau \colon  G/\Gamma \to [0,1)^k,$$ which will play a crucial rôle.  While $\tau$ is not continuous, its inverse $\tau^{-1}$ is. 

The choice of the [Mal’cev]{}  basis also induces a natural choice of a metric on $G$ and $G/\Gamma$ (cf.  [@GreenTao2012 Definition 2.2]). 

A *horizontal character* on $X=G/\mathord \Gamma$ is a non-trivial morphism of groups $\eta \colon G \to {\mathbb{R}}/{\mathbb{Z}}$ with $\Gamma \subset \eta^{-1}(0)$, and is necessarily of the form $\eta(g) = \sum_{i=1}^{l_1} a_i \tau_i(g\Gamma)$, where $\tau=(\tau_1,\ldots,\tau_k)$ and $a_i \in {\mathbb{Z}}$ are not all $0$. The *norm* of $\eta$, denoted ${\left\lVert \eta \right\rVert}$, is by definition the Euclidean norm ${\left\lVert  (a_i)  \right\rVert}_2$.

A set $A \subset {{\mathbb{R}}}^k$ is called semialgebraic if it is a finite union of subsets of ${{\mathbb{R}}}^k$ given by a system of finitely many polynomial equalities and inequalities; in particular, $A$ is Borel and either $A$ has nonempty interior or it is of Lebesgue measure zero.  A map $p\colon A \to {{\mathbb{R}}}^k$ defined on a semialgebraic set $A\subset {{\mathbb{R}}}^k$ is called *piecewise polynomial* if there is a decomposition $A=A_1\cup \ldots \cup A_s$ of $A$ into a finite union of semialgebraic sets such that $p|_{A_i} \colon A_i \to {{\mathbb{R}}}^l$ is a polynomial mapping restricted to $A_i$. We call a map $f\colon G \to {{\mathbb{R}}}^l$ a *polynomial map* if the composed map $f \circ {\widetilde}{\tau}^{-1} \colon{{\mathbb{R}}}^l \to {{\mathbb{R}}}^k$ is a polynomial map.  While the map ${\widetilde}\tau\colon G \to {{\mathbb{R}}}^k$ depends on the choice of a [Mal’cev]{} basis, the concept of a polynomial map on $G$ does not. 

A subset $A\subset X= G/\mathord \Gamma$ is called *semialgebraic* if its image $\tau(A)\subset [0,1)^k$ is semialgebraic.  We call a map $p\colon X \to {{\mathbb{R}}}^l$ *piecewise polynomial* if it takes the form $p=q \circ \tau$, where $q\colon [0,1)^k \to {{\mathbb{R}}}^l$ is a piecewise polynomial map.  As before, the concept of a piecewise polynomial map on $X$ does not depend on the choice of a [Mal’cev]{} basis.  Note that if $p\colon X \to {{\mathbb{R}}}^l$ is a piecewise polynomial map and $g\in G$, then so is $q\colon X \to {{\mathbb{R}}}^l$ given by $q(h\Gamma)=p(gh\Gamma)$.

We now extend the above definitions to not necessarily connected simply connected Lie groups $G$. A [Mal’cev]{} basis of $G$ is simply a [Mal’cev]{} basis of its connected component $G^{\circ}$. Similarly, we define piecewise polynomial maps $p\colon X \to {{\mathbb{R}}}^l$ in terms of their restrictions to the connected components of $X$ by demanding that for each $g\in G$ the map $G^{\circ}/\mathord (\Gamma \cap G^{\circ}) \to {{\mathbb{R}}}^l$, $h(\Gamma \cap G^{\circ})\mapsto p(gh\Gamma)$, is piecewise polynomial. ( It is enough to verify this condition for a single $g$ in each class $g G^{\circ} \in G/\mathord G^{\circ}$.) We extend the notion of the fractional and the integral part to the case of possibly disconnected $G$, but we define and use it only if the nilmanifold $G/\mathord \Gamma$ is nevertheless connected.  In this case the map $G^{\circ} \to G/\mathord \Gamma$ is surjective and induces a diffeomorphism $G^{\circ}/\mathord \Gamma' \to G/\mathord \Gamma,$ where $\Gamma'=\Gamma\cap G^{\circ}$. Thus, we may define the fractional part with respect to $G^{\circ}/\mathord \Gamma'$, and define the integral part of $g\in G$ so that $g={\left\{ g \right\}} {\left[ g \right]}$. (We can do this since these notions do not involve dynamics, and depend only on the nilmanifold; in dynamical considerations, we are still interested in the action of the (disconnected) group $G$ on the nilmanifold $X=G/\mathord \Gamma \simeq G^{\circ}/\mathord \Gamma'$.)

Dynamics on nilmanifolds plays an important rôle.  Any $g \in G$ acts on $X$ by left translation $T_g(h\Gamma) = gh\Gamma$. There is a unique Haar measure $\mu_{X}$ on $G/\mathord \Gamma$ invariant under the left translations.  For any $g\in G$, we obtain a dynamical system $(X,T_g)$. By a result of Parry [@Parry1969], the properties of minimality, unique ergodicity, and ergodicity with respect to the measure $\mu_X$ are equivalent. ( In fact, all this conditions can be verified on the maximal torus $G/G_2\Gamma \simeq {\mathbb{T}}^{l_1}$.) Furthermore, the action of $G$ on $X$ is distal, i.e. for $x,y\in X $, $x\neq y$, $\inf_{g\in G} \mathrm{dist}(gx,gy)$ is strictly positive. 

Generalised polynomials and orbits on nilmanifolds are intimately related.  This is explained in particular by the main result of [@BergelsonLeibman2007 Theorem A]. 

\[BLnilgenpolythm\]\[thm:BergelsonLeibman\]

1.   If $X=G/\mathord \Gamma$ is a nilmanifold, $g\in G$ acts on $X$ by left translations, $p\colon X \to {{\mathbb{R}}}$ is a piecewise polynomial map, and $x\in X$, then $u \colon {{\mathbb{Z}}}\to {{\mathbb{R}}}$ given by $u(n)=p(g^n x), n\in {{\mathbb{Z}}}$, is a bounded generalised polynomial. 

2.   If $u\colon {{\mathbb{Z}}}\to {{\mathbb{R}}}$ is a bounded generalised polynomial, then there exists a nilmanifold $X=G/\mathord \Gamma$, $g\in G$ acting on $X$ by left translations in such a way that the action is ergodic, a piecewise polynomial map $p\colon X \to {{\mathbb{R}}}$, and $x\in X$ such that $u(n)=p(g^n x)$, $n\in {{\mathbb{Z}}}$.

We finish by defining *polynomial sequences* with values in nilpotent groups.  Strictly speaking, polynomial sequences are defined relative to a filtration; we only work with polynomial sequences with respect to the lower central series. 

Let $G$ be a nilpotent group and let $G= G_0 = G_1 \supset G_2 \supset \ldots \supset G_d \supset G_{d+1}=1$ be its lower central series.  A sequence $g\colon {\mathbb{Z}}\to G$ is polynomial if it takes the form $$g(n) = g_0^{\binom{n}{0}} g_1^{\binom{n}{1}} g_2^{\binom{n}{2}} \dots g_d^{\binom{n}{d}}$$ for some $g_i \in G_i,\ 0 \leq i \leq d$.

It has been proven by Lazard and Leibman that polynomial sequences form a group with termwise multiplication.  For more details, see [@Lazard-1954], [@Leibman1998], [@Leibman2002].  This is one of the many reasons why it is often more convenient to work with polynomial sequences, even if one is ultimately interested in linear orbits. 

Distribution properties of polynomial sequences have been extensively studied.  In the quantitative setting we have the following result.  We will also later need a quantitative variant due to Green and Tao (cf.  Theorem \[thm:GreenTao\]). 

Let $G/\Gamma$ be a nilmanifold, and let $g \colon {\mathbb{Z}}\to G$ be a polynomial sequence.  Then either $(g(n)\Gamma)_{n \geq 0}$ is equidistributed in $X$ (with respect to $\mu_X$), or there exists a horizontal character $\eta$ such that $\eta \circ g$ is constant. 

[$\operatorname{IP}$]{} sets and [$\operatorname{IP}$]{} convergence {#operatornameipsets-and-operatornameipconvergence .unnumbered}
--------------------------------------------------------------------

We denote by ${\mathcal{F}}$ the set of all finite nonempty subsets ${\alpha}\subset {\mathbb{N}}$. For sets $\alpha,\beta \in {\mathcal{F}}$, we write $\alpha < \beta$ if $a<b$ for all $a\in \alpha, b\in \beta$. We will extensively use sequences $(n_{\alpha})_{\alpha \in {\mathcal{F}}}$ indexed by finite sets of natural numbers.  In fact, for a sequence $(n_i)_{i\in {{\mathbb{N}}}}$ of integers, we will frequently use the associated sequence $(n_{\alpha})_{\alpha \in {\mathcal{F}}}$ given by $n_{\alpha}=\sum_{j\in \alpha} n_j$ and denote its set of finite sums by ${\operatorname{FS}}(n_i) = {\left\{  n_{\alpha}\ \middle| \  {\alpha}\in {\mathcal{F}}\right\} }.$

The following notion is widely used and well-studied. 

\[def:IP-set\] A set $E\subset {{\mathbb{N}}}$ is called an *[$\operatorname{IP}$]{} set* if it contains a set of the form ${\operatorname{FS}}(n_i)$ for some sequence of natural numbers $(n_i)_{i\in {{\mathbb{N}}}}$. Similarly, $E \subset {\mathbb{N}}$ is an [$\mathrm{IP}_+$]{} set if it contains $E_0 + a$ for some $a \in {{\mathbb{N}}}_0$ and some [$\operatorname{IP}$]{} set $E_0$.

A set $E\subset {{\mathbb{N}}}$ is called an *[$\operatorname{IP}^*$]{} set* if it intersects nontrivially any [$\operatorname{IP}$]{} set. 

The class of [$\operatorname{IP}$]{} sets is partition regular, i.e. whenever an [$\operatorname{IP}$]{} set $E$ is written as a union of finitely many subsets $E=E_1\cup E_2 \cup \ldots \cup E_r$, at least one of the sets $E_i$ is an [$\operatorname{IP}$]{} set.  This is the statement of Hindman’s Theorem (see [@Hindman1974], [@Bergelson2010d], or [@Baumgartner-1974]).  It follows that an [$\operatorname{IP}^*$]{} set is an [$\operatorname{IP}$]{} set, an intersection of two [$\operatorname{IP}^*$]{} sets is an [$\operatorname{IP}^*$]{} set, and an intersection of an [$\operatorname{IP}^*$]{} set and an [$\operatorname{IP}$]{} set is an [$\operatorname{IP}$]{} set. ( For the first and the third statement, let $A$ be an [$\operatorname{IP}^*$]{} set and let $B$ be an [$\operatorname{IP}$]{} set.  Apply Hindman’s theorem to the partitions ${{\mathbb{N}}}=A \cup ({{\mathbb{N}}}\setminus A)$ and $B=(B\cap A) \cup (B\setminus A)$. The second statement then easily follows.) 

[$\operatorname{IP}$]{} sets occur naturally in dynamics.  The following statement is sometimes known as the [$\operatorname{IP}$]{} Recurrence Theorem.  Recall that a topological dynamical system $(X,T)$ is distal if for $x,y\in X$, $x \neq y$, $\inf_{n\in {{\mathbb{Z}}}} \mathrm{dist}(T^n x,T^n y) $ is strictly positive.  The action by left translation of $g\in G$ on a nilmanifold $X=G/\mathord \Gamma$ is distal. 

\[thm:IPrecurrence\] Let $(X,T)$ be a minimal distal topological dynamical system.  Then for every $x\in X$ and every neighbourhood $U$ of $x$, the set of return times $\{n\in {{\mathbb{N}}}\mid T^n(x)\in U\}$ is an [$\operatorname{IP}^*$]{} set. 

A related concept is that of an [$\operatorname{IP}$]{} ring.  A family $\mathcal{G}\subset {\mathcal{F}}$ of subsets of ${{\mathbb{N}}}$ is called an *[$\operatorname{IP}$]{} ring* if there exists a sequence $\beta=(\beta_i)_{i\in {{\mathbb{N}}}}\subset {\mathcal{F}}$ with $\beta_1<\beta_2<\ldots$ and such that $$\mathcal{G}={\left\{ \bigcup_{i \in \gamma} \beta_i  \ \middle| \  \gamma \in {\mathcal{F}}\right\} }.$$ An equivalent version of Hindman’s theorem says that whenever an [$\operatorname{IP}$]{} ring $\mathcal{G}$ is written as a union of finitely many subfamilies $\mathcal{G}=\mathcal{G}_1\cup \mathcal{G}_2 \cup \ldots \cup \mathcal{G}_r$, at least one of the subfamilies $\mathcal{G}_i$ contains an [$\operatorname{IP}$]{} ring (cf.  [@Bergelson2010d], [@Baumgartner-1974].) 

There is a natural notion of convergence for sequences indexed by ${\mathcal{F}}$, or more generally an [$\operatorname{IP}$]{} ring.  Let $X$ be a topological space and let $(x_\alpha)_{\alpha \in {\mathcal{F}}}$ be a sequence of points of $X$. We say that the sequence $(x_\alpha)_{\alpha \in {\mathcal{F}}}$ converges to a limit $x\in X$ along an [$\operatorname{IP}$]{} ring $\mathcal{G}$ and we write $${\mathrm{IP-}\!\lim}_{{\alpha}\in \mathcal{G}} x_{\alpha}  = x$$ if for any neighbourhood $U$ of $x$ there exists $\alpha_0\in {\mathcal{F}}$ such that for all $\alpha \in \mathcal{G}$ with $\alpha>\alpha_0$ we have $x_{\alpha}\in U$. Limits along [$\operatorname{IP}$]{} rings are closely related to limits along idempotent ultrafilters in ${{\mathbb{N}}}$.

Let $X$ be a compact topological space and let $(x_\alpha)_{\alpha \in \mathcal{F}}$ be a sequence of points of $X$. It is a corollary of Hindman’s theorem and a diagonal argument ([@Furstenberg1981 Theorem 8.14] or [@FurstenbergKatznelson-1985 Theorem 1.3]) that there exists an [$\operatorname{IP}$]{} ring $\mathcal{G}$ and a point $x\in X$ such that ${\mathrm{IP-}\!\lim}_{{\alpha}\in \mathcal{G}} x_{\alpha}  = x$.

[$\mathrm{IPS}$]{} sets and sparse generalised polynomials {#sec:IPS-GP}
==========================================================

In this section, we discuss a slight generalisation of Theorem \[thm:main-A\] which we will need in the upcoming paper [@ByszewskiKonieczny].  We also discuss how it can be derived from the results concerning nilsystems proved in Section \[sec:S-GENPOLY\]. 

\[def:IPS-set\] We say that $E \subset {\mathbb{N}}$ is an [$\mathrm{IPS}$]{} set if there exist sequences $(n_i)_{i \in {\mathbb{N}}} \subset {\mathbb{N}}$, $(N_t)_{t \geq 1} \subset {\mathbb{N}}_0$ and $(t_0({\alpha}))_{{\alpha}\in {\mathcal{F}}} \subset {\mathbb{N}}$ such that $n_{\alpha}+ N_t \in E$ for any ${\alpha}\in {\mathcal{F}}$ and $t \geq t_0({\alpha})$.

A translate of an [$\operatorname{IP}$]{} set is an [$\mathrm{IPS}$]{} set, but not conversely.  The interest in [$\mathrm{IPS}$]{} sets stems mainly from the fact that automatic sets which do not contain [$\mathrm{IPS}$]{} sets can be completely classified (see [@ByszewskiKonieczny]; a similar statement for [$\mathrm{IP}_+$]{} sets does not hold). 

[$\mathrm{IPS}$]{} sets are very natural to consider from the point of view of ultrafilters.  The Čech-Stone compactification $\beta {{\mathbb{N}}}$ of ${{\mathbb{N}}}$ (regarded as a discrete topological space) consists of ultrafilters on ${{\mathbb{N}}}$. There is a natural associative operation on $\beta {{\mathbb{N}}}$ which gives it a structure of a left semitopological semigroup.  It is not commutative, and the center consists of principal ultrafilters (identified with elements of ${{\mathbb{N}}}$). 

It is well known that a set $E\subset {{\mathbb{N}}}$ is an [$\operatorname{IP}$]{} set if and only if it is belongs to an ultrafilter $p$ that is idempotent (i.e. $p+p=p$).  One can immediately conclude that a set is an [$\mathrm{IP}_+$]{} set if and only if it belongs to an ultrafilter of the form $n+p=p+n$ for some $n\in {{\mathbb{N}}}$ and some idempotent $p\in \beta {{\mathbb{N}}}$. One can show that a set is an [$\mathrm{IPS}$]{} set if and only if it belongs to an ultrafilter of the form $r+p$ for some $r\in \beta {{\mathbb{N}}}$. The proofs are quite immediate. ( For the latter statement, note that $E \subset {{\mathbb{N}}}$ is an [$\mathrm{IPS}$]{} set if and only if there is a sequence $(n_i)_{i \in {\mathbb{N}}} \subset {\mathbb{N}}$ such that the family $\{ (E-n_{\alpha}) \cap {\mathbb{N}}\}_{\alpha \in {\mathcal{F}}}$ has the finite intersection property.  We choose $p, r \in \beta {{\mathbb{N}}}$ such that $p+p=p$, ${\operatorname{FS}}(n_i) \in p$, and $(E-n_{\alpha}) \cap {\mathbb{N}}\in r$.)

Thus a set is an [$\mathrm{IP}_+$]{} set if and only if it belongs to an ultrafilter lying in the right ideal generated by an idempotent ultrafilter and a set is an [$\mathrm{IPS}$]{} set if and only if it belongs to an ultrafilter lying in the left ideal (or equivalently the two-sided ideal) generated by an idempotent ultrafilter.  For more details about $\beta {{\mathbb{N}}}$, see [@Bergelson2010d] and references therein.  We will not use the ultrafilter interpretation of [$\mathrm{IPS}$]{} sets in what follows. 

The following theorem is a strengthening of Theorem \[thm:main-A\]. 

[A’]{}

\[thm:main-A1\] Suppose that $E$ is a sparse generalised polynomial set.  Then $E$ does not contain an [$\mathrm{IPS}$]{} set. 

Any [$\mathrm{IPS}$]{} set contains a translate of an $\mathrm{IP}_r$ set (i.e. the set of all finite sums of a finite sequence $n_1,\dots,n_r$) for any $r$. It is therefore natural to ask if Theorem \[thm:main-A1\] can be generalised to $\mathrm{IP}_r$ sets.  The answer is negative, as shown by the following example. 

Let $E = {\left\{  n \in {{\mathbb{N}}}\ \middle| \  {\left\lVert n\sqrt{2} \right\rVert} < 1/\sqrt{n} \right\} }$.  Then $E$ is a sparse generalised polynomial set and $E$ contains sets of the form $\{ km \mid 1\leq k \leq r\}$ for arbitrary $r$. In particular, $E$ contains an $\mathrm{IP}_r$ set. 

By standard diophantine approximation, there exist arbitrarily large $m$ such that ${\left\lVert m \sqrt{2}  \right\rVert} < 1/m$. Then $km \in E$ for $k \leq m^{1/3}$. Sparseness of $E$ follows from Proposition \[prop:special-gp-is-gp\]. 

\[BL-implies-weak-A\] A weaker version of Theorem \[thm:main-A\] follows immediately by an adaptation of the methods in [@BergelsonLeibman2007].  Indeed, adapting the proof of Theorem C therein, one concludes that if $E$ is a sparse generalised polynomials set, then for all $n$ except for a set of (upper Banach) density $0$ the set ${\mathbb{N}}\setminus (E-n)$ is [[$\operatorname{IP}^*$]{}]{}, whence $E - n$ contains no [$\operatorname{IP}$]{} set.  Unfortunately, this weaker statement is not as useful in applications; in particular is not sufficient for the purposes of [@ByszewskiKonieczny]. 

The main argument {#sec:S-GENPOLY}
=================

In this section, we prove Theorem \[thm:main-A\].  In the process, we obtain results concerning the distribution of fractional parts of polynomial sequences, such as Propositions \[lem:variable-separation\] and \[lem:fp-closure\], which are possibly of independent interest. 

It will be convenient to reformulate Theorem \[thm:main-A\].  By Theorem \[thm:BergelsonLeibman\], a sparse generalised polynomial set $E$ arises as $u(n)=p(g^n a)$ for a nilmanifold $X=G/\mathord \Gamma$, $g\in G$ acting on $X$ ergodically, a piecewise polynomial map $p\colon X \to {{\mathbb{R}}}$, and $a\in X$. Let $S=\{x\in X \mid p(x)= 1\}$. Since $E$ is sparse, Corollary \[cor:density-uniform\] shows that ${\operatorname{int}S} =\emptyset$. (As a side remark, we note that it is also easy to see that a sparse genereralised polynomial set has upper Banach density zero.)  Thus Theorem \[thm:main-A\] is equivalent to the following statement. 

\[thm:S:main-1\] Let $X=G/\Gamma$ be a nilmanifold, let $g \in G$ be such that the left translation by $g$ is ergodic, $a \in G$, and let $S \subset X$ be a semialgebraic subset with ${\operatorname{int}S} = \emptyset$. Then there does not exist an [$\mathrm{IPS}$]{} set $E$ such that $$\label{eq:S:main-1}
    g^{n } a \Gamma \in S, \qquad n \in E.$$

We proceed to the proof of Theorem \[thm:S:main-1\]. 

Preliminaries {#preliminaries .unnumbered}
-------------

In dealing with [$\mathrm{IPS}$]{} sets, the following lemma will be useful. 

\[lem:IPS-partition-regular\] Suppose that $E \subset {\mathbb{N}}$ is an [$\mathrm{IPS}$]{} set.  Then for any finite partition $E = E_1 \cup E_2 \cup \ldots \cup E_r$ one of the sets $E_j$ is an [$\mathrm{IPS}$]{} set. 

This is clear from the ultrafilter interpretation of [$\mathrm{IPS}$]{} sets.  We give a direct proof below.  Suppose that $(n_i)_{i \in {\mathbb{N}}}$, $(N_t)_{t \geq 1}$ and $(t_0({\alpha}))_{{\alpha}\in {\mathcal{F}}}$ are such that $n_{\alpha}+ N_t \in E$ for ${\alpha}\in {\mathcal{F}}$ and $t \geq t_0({\alpha})$. Restricting $N_t$ to subsequence by means of a familiar diagonal argument, we may ensure that for any ${\alpha}$ there is some $j = j({\alpha})$ such that $n_{\alpha}+ N_t \in E_j$ for all $t \geq t_0({\alpha})$. The claim now follows directly from Hindman’s theorem. 

The following lemmas are classical. 

\[lem:G2-not-complemented\] Let $G$ be a nilpotent group (not necessarily Lie), and let $H < G$ be a subgroup of $G$ such that $H G_2 = G$. Then $H = G$.

For the proof, see e.g. [@Leibman-2005b Lemma 2.5], [@Leibman2005 Lemma 3.4], or [@Zorin-Kranich2013 Lemma 1.11]. 

\[lem:poly-seq-in-G-o\] Let $G/\mathord\Gamma$ be a connected nilmanifold, and assume further that all the nilmanifolds $G_i/\mathord\Gamma_i$ are connected, where $\Gamma_i=\Gamma\cap G_i$. Let $g\colon {\mathbb{Z}}\to G$ be a polynomial sequence.  Then there exists a polynomial sequence $h \colon {\mathbb{Z}}\to G$ taking values in $G^{\circ}$ such that $g(n)\Gamma = h(n)\Gamma$.

This follows from [@Zorin-Kranich2013 Lemma 4.24]. 

We do not claim that $h$ is a polynomial sequence in $G^{\circ}$, since possibly $(G^{\circ})_i \subsetneq (G_i)^{\circ}$. In general, one often defines polynomial sequences with respect to a filtration of subgroups.  We will not need that, and our polynomial sequences will always be taken with respect to the lower central series filtration.  This explains a bit akward formulation of the preceding lemma. 

We will also need the following basic fact about invariant algebraic sets. 

\[lem:invariant=&gt;strongly-invariant\] Suppose that $A \subset {\mathbb{R}}^d$ is an algebraic set and ${P}\colon {\mathbb{R}}^d \to {\mathbb{R}}^d$ is a surjective polynomial map.  If ${P}^{-1}(A) \subset A$, then also ${P}(A) = A$. 

Consider the descending sequence of nonempty algebraic sets $$\begin{aligned}
    \label{eq:865-1}
        A \supset {P}^{-1}(A) \supset {P}^{-2}(A) \supset {P}^{-3}(A) \supset \dots
    \end{aligned}$$

By Hilbert’s Basis Theorem, there is $n$ such that ${P}^{-n}(A) = {P}^{-n-1}(A)$. Since $P$ is surjective, we get ${P}(A) = A$. 

Initial reductions {#initial-reductions .unnumbered}
------------------

Our proof of Theorem \[thm:S:main-1\] is indirect: we exploit the existence of an orbit satisfying to construct algebraically invariant objects whose existence is inreasingly difficult to sustain, up to the point when we obtain a blatant contradiction.  We begin with a relatively straightforward reduction. 

\[prop:S:main-2\] Assume Theorem \[thm:S:main-1\] is false.  Then there exists a nilmanifold $G/\mathord\Gamma$ such that every $G_i/\mathord\Gamma_i$ is connected, where $\Gamma_i=\Gamma\cap G_i$, an element $g \in G$ acting ergodically by left translations, a semialgebraic subset $S \subset G/\Gamma$ with empty interior, and an [$\operatorname{IP}$]{} set $E \subset {\mathbb{N}}$ such that $$\label{eq:S:main-2}
    g^{n } \Gamma \in S, \qquad n \in E.$$

Suppose that Theorem \[thm:S:main-1\] fails, so that holds.  By [@Zorin-Kranich2013 Lemma 4.5], there exists a discrete cocompact subgroup $\Gamma < {\widetilde}\Gamma < G$ such $[{\widetilde}\Gamma : \Gamma] < \infty$, and such that $G_i/\mathord{{\widetilde}{\Gamma}_i}$ is connected for every $i$. We replace $\Gamma$ by ${\widetilde}\Gamma$ and $S$ by its image under the map $G/\mathord\Gamma \to G/\mathord{{\widetilde}{\Gamma}}$ (this is still a semialgebraic set with empty interior). 

Let $(n_i)_{i \in {\mathbb{N}}}$, $(N_t)_{t \geq 1}$ and $(t_0({\alpha}))_{{\alpha}\in {\mathcal{F}}}$ be such that $n_{\alpha}+ N_t \in E$ for $t \geq t_0({\alpha})$, so that $$g^{n_{{\alpha}} + N_t} a \Gamma \in S.$$ Replacing $S$ by its closure, which is again a semialgebraic set with empty interior, we may assume that $S$ is closed.  Restricting $N_t$ to a subsequence if necessary, we may assume that $g^{N_t} a \Gamma \to b \Gamma$ as $t \to \infty$ for some $b \in G$. It follows that for any [$\operatorname{IP}$]{} set $E' \subset {\operatorname{FS}}(n_i)$ we have $$g^{n } b \Gamma = \lim_{t \to \infty} g^{n + N_t} a \Gamma  \in S, \qquad n \in E'.$$ Finally, note that the map $g\mapsto gb^{-1}$ induces an isomorphism $G/\mathord \Gamma \to G/\mathord{{\Gamma}'}$, where $\Gamma' = b \Gamma b^{-1}$. Let $S' \subset G/\mathord{{\Gamma}'}$ be the image of $S$ under this map.  We find that $g^n \Gamma' \in S'$ for $n \in E'$, as needed. 

Fractional parts and limits {#fractional-parts-and-limits .unnumbered}
---------------------------

Let $G/\Gamma$ be a nilmanifold with a specified [Mal’cev]{} basis.  A technical difficulty in dealing with fractional parts in $G$ stems from the fact that, for a sequence $g_n \in G$, the limit of $g_n \Gamma$ does not determine the limit of ${\left\{ g_n \right\}}$ if the limit lies on the boundary of the fundamental domain.  The following lemma partially overcomes this difficulty. 

\[lem:conv-of-fp-to-0\] Let $X=G/\mathord\Gamma$ be a connected nilmanifold.  Then for any sequence $(g_n)_{n \geq 0}$ in $G$ such that $\lim_{n \to \infty} g_n \Gamma = e \Gamma$, there exists a choice of a [Mal’cev]{} basis ${\mathscr{X}}$ of $X$ and a subsequence $(g'_{n})$ of $(g_n)$ such that $\lim_{n \to \infty} {\left\{ g'_n \right\}} = e$.

Likewise, for any $(g_{\alpha})_{{\alpha}\in {\mathcal{F}}}$ in $G$ such that ${\mathrm{IP-}\!\lim}_{a \in {\mathcal{F}}} g_{\alpha}\Gamma = e \Gamma$, there exists a choice of a [Mal’cev]{} basis ${\mathscr{X}}$ and an [$\operatorname{IP}$]{} ring ${\mathcal{G}}$ such that ${\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{G}}} {\left\{ g_{\alpha}\right\}} = e$.

Since $G/\mathord \Gamma$ is connected, we have an isomorphism $G/\mathord \Gamma \simeq G^{\circ}/\mathord{(\Gamma\cap G^{\circ})}$, and hence we may assume that $G$ is connected.  Recall that a choice of a [Mal’cev]{} basis ${\mathscr{X}}= (e_1,\ldots,e_k)$ determines the map ${\widetilde}\tau=({\widetilde}\tau_1,\ldots,{\widetilde}\tau_k)\colon G \to {\mathbb{R}}^k$. By induction, we will prove that for each $1\leq r\leq k+1$ there exists a [Mal’cev]{} basis ${\mathscr{X}}$ such that, after passing to a subsequence $(g'_n)$ of $(g_n)$, we have $$\lim_{n \to \infty} {\left\{ g'_n \right\}} = h$$ for $h\in {\operatorname{cl}D} = {\widetilde}\tau^{-1}([0,1]^k)$ such that ${\widetilde}\tau_i(h) = 0$ for $1\leq i < r$. For $r = 1$, the claim is trivially satisfied, and the claim for $r = k+1$ implies the claim in the statement of the lemma. 

If the claim holds for $r$, then we may write: $$g_n' = e_r^{t_r(n)} e_{r+1}^{t_{r+1}(n)} \dots e_k^{t_k(n)}  \gamma(n),$$ where $t_i(n) \in [0,1)$, $\gamma(n) \in \Gamma$, and $t_i(n) \to {\widetilde}\tau_i(h)$ as $i \to \infty$. Since $h \in \Gamma$, we have ${\widetilde}\tau_i(h) \in \{0,1\}$. If ${\widetilde}\tau_r(h) = 0$, we are done.  Otherwise, we may write $$\begin{aligned}
    g_n' 
    &= (e_r^{-1})^{1-t_r(n)}  e_{r+1}^{t_{r+1}(n)} \dots e_k^{t_k(n)}  \gamma(n) \\
    &= (e_r^{-1})^{1-t_r(n)}  e_{r+1}^{t_{r+1}'(n)} \dots e_k^{t'_k(n)} \gamma'(n),
    \end{aligned}$$ where $t_i'(n) \in [0,1)$ and $\gamma'(n) \in \Gamma$. Replacing ${\mathscr{X}}$ with ${\mathscr{X}}' =(e_1',\dots,e_k')$ with $e_r' = e_r^{-1}$ and $e_i' = e_i$ for $i \neq r$, we find the sought [Mal’cev]{} basis for $r+1$.

The proof of the claim concerning [$\operatorname{IP}$]{} limits is completely analogous. 

We are now ready to perform the first substantial step in the proof of Theorem \[thm:S:main-1\].  We construct an algebraic set inside $G$ with surprising invariance properties.  This is helpful largely because working in $G$ is easier than in $G/\Gamma$.

\[prop:S:main-3\] Suppose that Theorem \[thm:S:main-1\] is false.  Then there exists a nilmanifold $G/\mathord\Gamma$ with a [Mal’cev]{} basis ${\mathscr{X}}$ such that every $G_i/\mathord\Gamma_i$ is connected, where $\Gamma_i=\Gamma\cap G_i$, an element $g \in G$ acting ergodically by left translations, a nonempty algebraic subset $R \subset G^{\circ}$ with empty interior, and an [$\operatorname{IP}$]{} set $E = {\operatorname{FS}}(n_i)$ such that $R$ is preserved under the operations $${P}_{\alpha}\colon G^{\circ} \to G^{\circ}, \qquad x \mapsto g^{n_{\alpha}} x {\left[  g^{n_{\alpha}} \right]}^{-1}$$ for all ${\alpha}\in {\mathcal{F}}$.

Let the notation be as in Step \[prop:S:main-2\].  We will subsequently pass to [$\operatorname{IP}$]{} subsets of $E = {\operatorname{FS}}(n_i)$ to ensure better properties. 

After replacing $E$ with a smaller [$\operatorname{IP}$]{} set, we may assume that ${\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}} g^{n_{\alpha}} \Gamma = e \Gamma$. (Indeed, we pass to an [$\operatorname{IP}$]{} subring on which the sequence is convergent and apply the [$\operatorname{IP}$]{} Recurrence Theorem \[thm:IPrecurrence\]).  Hence, by Lemma \[lem:conv-of-fp-to-0\] there exists a choice of a [Mal’cev]{} basis such that, possibly after shrinking $E$ again, we have $$\label{eq:527-1}
    {\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}} {\left\{  g^{n_{\alpha}}  \right\}} = e.$$

For a fixed ${\beta}$ and sufficiently large ${\alpha}> {\beta}$, we aim to compute ${\left\{ g^{n_{{\alpha}\cup {\beta}}} \right\}}$ in terms of $g^{n_{\beta}}$ and ${\left\{ g^{n_{\alpha}} \right\}}$. We begin by noting that $$\label{eq:527-2}
    {\left\{ g^{n_{{\alpha}\cup {\beta}}} \right\}} 
    = {\left\{  g^{n_{\beta}} {\left\{ g^{n_{\alpha}} \right\}} \right\}} 
        = g^{n_{\beta}} {\left\{ g^{n_{\alpha}} \right\}} {\left[ g^{n_{\beta}} \right]}^{-1} \gamma({\alpha},{\beta}),$$ where $\gamma({\alpha},{\beta})={\left[ g^{n_{\beta}} \right]} {\left[ g^{n_{\beta}}{\left\{ g^{n_{\alpha}} \right\}} \right]}^{-1}\!\!\in \Gamma$ takes, for a fixed ${\beta}$, only finitely many possible values.  For a fixed $\beta$, we may use Hindman’s theorem to pass to an [$\operatorname{IP}$]{} subring so that $\gamma({\alpha},{\beta})$ does not depend on the choice of ${\alpha}> {\beta}$. Using a standard diagonal argument, we replace $E$ by an [$\operatorname{IP}$]{} subset so that $\gamma({\alpha},{\beta}) = \gamma({\beta})$ does not depend on ${\alpha}>{\beta}$ for all ${\beta}\in {\mathcal{F}}$. Letting ${\alpha}\to \infty$ in (\[eq:527-2\]), we get $${\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}} {\left\{ g^{n_{{\alpha}\cup {\beta}}} \right\}} 
=   {\left\{  g^{n_{\beta}}  \right\}} \gamma({\beta}).$$ If ${\beta}$ is sufficiently large, this implies that $\gamma({\beta}) = e$. Passing to an [$\operatorname{IP}$]{} subset of $E$, we may assume that $\gamma(\beta) = e$ for all ${\beta}\in {\mathcal{F}}$. Hence, applying (\[eq:527-2\]) again, we have $$\begin{aligned}
    \label{eq:527-3}
    {\left\{ g^{n_{{\alpha}\cup {\beta}}} \right\}} =  g^{n_{\beta}} {\left\{ g^{n_{\alpha}} \right\}} {\left[ g^{n_{\beta}} \right]}^{-1} = {P}_{\beta}({\left\{ g^{n_{\alpha}} \right\}})\end{aligned}$$ for any ${\alpha},{\beta}\in {\mathcal{F}}$ with ${\beta}< {\alpha}$.

We claim that ${P}_{\beta}\circ {P}_{\alpha}= {P}_{{\alpha}\cup {\beta}}$ for all ${\alpha}> {\beta}$. Indeed, both maps take the form $x\mapsto g^{n_{{\alpha}\cup{\beta}}}x \gamma$ for some $\gamma \in \Gamma$ and by (\[eq:527-3\]) agree on points ${\left\{ g^{n_{\lambda}} \right\}}$ for $\lambda > \alpha$. Therefore, the two maps are equal.  We will use this fact below. 

Denote by $\widetilde{S} \subset G^{\circ}$ the Zariski closure of the copy of $S$ contained in the fundamental domain for ${\mathscr{X}}$. Then ${\widetilde}S$ is a algebraic subset of $G^{\circ}$ with empty interior.  For any ${\beta}\in {\mathcal{F}}$, let $R_{\beta}$ denote the set of $x \in {\widetilde}{S}$ such that ${P}_{{\beta}}(x) \in {\widetilde}S$. Clearly, these sets are algebraic, and by we have ${\left\{  g^{n_{\alpha}}  \right\}} \in R_{\beta}$ for ${\alpha}> {\beta}$.

Let $R = \bigcap_{{\alpha}\in {\mathcal{F}}} R_{\alpha}$. By Hilbert’s Basis Theorem, there is a finite collection ${\mathcal{B}}\subset {\mathcal{F}}$ such that $R = \bigcap_{{\beta}\in {\mathcal{B}}} R_{\beta}$. Note that $R$ is nonempty as ${\left\{  g^{n_{\alpha}}  \right\}} \in R$ for ${\alpha}$ such that ${\alpha}> {\beta}$ for ${\beta}\in {\mathcal{B}}$. It remains to show that $R$ is preserved under the maps ${P}_{\alpha}$. Suppose that $x \in R$ and ${\alpha}> {\beta}$ for all ${\beta}\in {\mathcal{B}}$. We will show that ${P}_{\alpha}(x) \in R$. To this end, it suffices to check that ${P}_{\alpha}(x) \in R_{\beta}$ for ${\beta}\in {\mathcal{B}}$, which amounts to ${P}_{\alpha}(x) \in {\widetilde}{S}$ and ${P}_{\beta}( {P}_{\alpha}(x)) \in {\widetilde}S$. The first condition follows immediately from $x \in R_{\alpha}$. Since ${P}_{\beta}\circ {P}_{\alpha}= {P}_{{\alpha}\cup {\beta}}$, the latter follows from $x \in R_{{\alpha}\cup {\beta}}$. Thus $P_{\alpha}(R)\subset R$ for ${\alpha}$ large enough.  Passing yet again to an [$\operatorname{IP}$]{} subset, we ensure that the claim holds for all ${\alpha}$.

Fractional parts of polynomials {#fractional-parts-of-polynomials .unnumbered}
-------------------------------

Our next aim is to show that the set $R$ constructed in Step \[prop:S:main-3\] needs to be invariant under a wider range of operations.  For this purpose, we study the possible algebraic relations between polynomials and their fractional parts. 

\[lem:variable-separation\] Let $G/\Gamma$ be a nilmanifold equipped with a [Mal’cev]{} basis ${\mathscr{X}}$. Let $g,h\colon {\mathbb{Z}}\to G$ be polynomial sequences with values in $G^{\circ}$. Suppose that $E$ is an [$\operatorname{IP}$]{} set and ${P}\colon G^{\circ} \times G^{\circ} \to {\mathbb{R}}$ is a polynomial map such that $$\label{eq:782-1}
    {P}{ \left(  g(n), {\left\{ h(n) \right\}}  \right) } = 0, \qquad n \in E.$$ Then there exists an [$\operatorname{IP}$]{} set $E' \subset E$ such that $$\label{eq:782-1a}
    {P}{ \left( g(m),{\left\{ h(n) \right\}}  \right) } = 0, \qquad m \in {\mathbb{Z}},\ n \in E'.$$

If $g$ is extended to a polynomial sequence $g\colon {\mathbb{R}}\to G$ (defined in an obvious way) with values in $G^{\circ}$, then the same argument gives ${P}{ \left( g(m),{\left\{ h(n) \right\}}  \right) } = 0$ for $m \in {\mathbb{R}}$, $n \in E'$.

We may assume that $g$ is defined on ${\mathbb{R}}$. Consider the map ${Q}\colon {\mathbb{R}}\times G^{\circ} \to {\mathbb{R}}$ given by ${Q}(m,y) ={P}(g(m),y)$. This is a polynomial map.  Expand ${Q}$ as $ {Q}(x,y) = \sum_{k=0}^d x^k {Q}_k(y)$ for polynomials ${Q}_k \colon G^{\circ} \to {\mathbb{R}}$. By the assumption, $Q(n,{\left\{ h(n) \right\}})=0$ for $n\in E$.

Looking at the leading term in the equation $$\label{eq:782-2}
        \sum_{k = 0}^d n^k {Q}_k{ \left(  {\left\{ h(n) \right\}}   \right) } = 0, \quad n\in E$$ and using the fact that $Q_k$ are bounded functions on the fundamental domain $D$ of $G/\Gamma$, we conclude that $$\label{eq:782-25}
    \lim_{E \ni n \to \infty} {Q}_d{ \left(  {\left\{ h(n) \right\}}   \right) } = 0.$$ Take $(n_i)_{i\in {{\mathbb{N}}}}$ such that $n_{\alpha}\in E$ for ${\alpha}\in {\mathcal{F}}$. In particular, as a special case of , for any fixed ${\beta}\in {\mathcal{F}}$ we have $$\label{eq:782-3}
    {\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}} {Q}_d { \left(  {\left\{ h{ \left( n_{\alpha}+ n_{\beta}\right) } \right\}} \right) }  = 0.$$ By the [$\operatorname{IP}$]{} polynomial recurrence theorem for nilrotations (see [@Leibman-2005b Theorem D]), there exists an [$\operatorname{IP}$]{} ring ${\mathcal{F}}_{\beta}$ (which may be chosen to be contained in any previously specified [$\operatorname{IP}$]{} ring) such that $$\label{eq:782-4}{\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}_{\beta}} h(n_{\alpha}+ n_{\beta}) \Gamma = h(n_{\beta}) \Gamma.$$

We would like to take now the fractional parts in the preceding limit.  A slight technical difficulty stems from the fact that the map $g \mapsto {\left\{ g \right\}}$ is discontinuous.  To overcome this problem, let ${\varepsilon}> 0$ be sufficiently small so that if $x \in G$ lies in the fundamental domain, then $d(x, x \gamma) \geq {\varepsilon}$ for all $\gamma \in \Gamma\setminus\{e\}$. After replacing $E$ with an [$\operatorname{IP}$]{} subset $E'$ in the original statement, we may assume that all the points ${\left\{ h(n_{{\alpha}}) \right\}}$ for ${\alpha}\in {\mathcal{F}}$ lie within a ball of radius ${\varepsilon}/10$. This will be useful shortly. 

Applying , possibly after refining ${\mathcal{F}}_{\beta}$ further, we find that $$\label{eq:782-5}{\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}_{\beta}} {\left\{  h(n_{\alpha}+ n_{\beta}) \right\}} = 
    {\left\{  h(n_{\beta})  \right\}}\gamma({\beta}),$$ where $\gamma({\beta}) \in \Gamma$. Now, since two limit points of ${\left\{ h(n_{\alpha}) \right\}}$ cannot differ by a factor of $\gamma \in \Gamma \setminus \{e\}$, we conclude that $$\label{eq:782-6}{\mathrm{IP-}\!\lim}_{{\alpha}\in {\mathcal{F}}_{\beta}} {\left\{  h(n_{\alpha}+ n_{\beta}) \right\}} = {\left\{  h(n_{\beta}) \right\}}.$$

Because ${Q}_d$ is continuous, yields ${Q}_d { \left(  {\left\{  h(n_{\beta}) \right\}} \right) } = 0$, where we recall that ${\beta}$ was arbitrary.  Reasoning inductively, we obtain similarly ${Q}_k { \left(  {\left\{  h(n_{\beta}) \right\}}  \right) } = 0$ for all $k$ and ${\beta}\in {\mathcal{F}}$. Consequently, ${Q}{ \left( m, {\left\{  h(n) \right\}} \right) } = 0$ for all $m \in {\mathbb{Z}}$ and $n \in E'$, as desired. 

\[prop:S:main-4\] Suppose that Theorem \[thm:S:main-1\] is false.  Then there exists a nilmanifold $G/\mathord\Gamma$ with a [Mal’cev]{} basis ${\mathscr{X}}$ such that every $G_i/\mathord\Gamma_i$ is connected, where $\Gamma_i=\Gamma\cap G_i$, an element $g \in G$ acting ergodically by left translations, a nonempty algebraic subset $R \subset G^{\circ}$ with empty interior, and an [$\operatorname{IP}$]{} set $E$ such that $R$ is preserved under the operations $$\begin{aligned}
    x \mapsto x {\left\{ g^{n} \right\}}, \qquad n \in E.\end{aligned}$$

Assume the notation is as in Step \[prop:S:main-3\].  Let us consider for $x \in R$ the set $$M_x = {\left\{  (m, n) \in {\mathbb{Z}}\times {\mathbb{Z}}\ \middle| \  g^m x g^{-m} {\left\{  g^n  \right\}} \in R \right\} }.$$ Since multiplication in $G^{\circ}$ is given by polynomial formulae and $R$ is an algebraic set, the condition $(m,n) \in M_x$ is equivalent to a system of polynomial equations in $g^m x g^{-m}$ and ${\left\{  g^n  \right\}}$. By Step \[prop:S:main-3\], we have $(n,n) \in M_x$ for all $n \in E$. We first apply Lemma \[lem:poly-seq-in-G-o\] to replace the polynomial sequence $g^n$ by a polynomial sequence $h(n)$ with values in $G^{\circ}$ and ${\left\{ g^n \right\}}={\left\{ h(n) \right\}}$. Then Lemma \[lem:variable-separation\] shows that $M_x$ contains ${\mathbb{Z}}\times E'$ for an [$\operatorname{IP}$]{} set $E'$ (which may be chosen inside a given [$\operatorname{IP}$]{} subset of $E$). 

For $x \in R$ let us also consider the set $$P_{x} = {\left\{  h \in G^{\circ}  \ \middle| \  g^m x g^{-m} h \in R \text{ for all } m \in {\mathbb{Z}}\right\} }.$$ and let $P = \bigcap_{ x \in R } P_{x}$. These sets are algebraic, and ${\left\{ g^n \right\}} \in P_x$ precisely when ${\mathbb{Z}}\times \{n\} \subset M_x$. By Hilbert’s Basis Theorem, we have $P = \bigcap_{ x \in R_0 } P_{x}$ for a finite subset $R_0$ of $R$.

Iterating the argument above, we find an [$\operatorname{IP}$]{} set $E'$ such that ${\mathbb{Z}}\times E' \subset \bigcap_{x \in R_9} M_x$. Hence ${\left\{  g^{n}  \right\}} \in P$ for $n\in E'$. In particular, $ R {\left\{ g^n \right\}} \subset R$ for $n \in E'$, and so $R$ is preserved by the map $x \mapsto x {\left\{ g^{n} \right\}}$.

Group generated by fractional parts {#group-generated-by-fractional-parts .unnumbered}
-----------------------------------

We are now ready to take the last step in the proof of Theorem \[thm:S:main-1\].  Our strategy is to show that the set $R$ appearing in Step \[prop:S:main-4\] in invariant under multiplication by all of $G^{\circ}$, which is clearly absurd.  In order to facilitate this strategy, we need the following fact. 

\[lem:fp-closure\] Let $X=G/\Gamma$ be a connected nilmanifold with a fixed [Mal’cev]{} basis and such that every $G_i/\mathord\Gamma_i$ is connected, where $\Gamma_i=\Gamma\cap G_i$. Let $g \colon {{\mathbb{Z}}}\to G$ be a polynomial sequence such that the sequence $(g(n)\Gamma)_{n\geq 0}$ is dense in $X$. Suppose that $H \subset G^{\circ}$ is a Lie subgroup such that ${\left\{ g(n) \right\}} \in H$ for infinitely many $n$. Then $H= G^{\circ}$.

\[prop:S:main-5\] Theorem \[thm:S:main-1\] holds true. 

Suppose Theorem \[thm:S:main-1\] were false, and assume notation as in conclusion of Step \[prop:S:main-4\].  Denote $$H = {\left\{  h \in G^{\circ} \ \middle| \  R h \subset R \right\} } = \bigcap_{x \in R} {\left\{  h \in G^{\circ}  \ \middle| \  x h \in R \right\} }.$$

It is immediate from the definition that $H$ is algebraic and closed under multiplication and taking inverses (by Lemma \[lem:invariant=&gt;strongly-invariant\]).  Hence, $H$ is a Lie subgroup of $G^{\circ}$. Furthermore, ${\left\{ g^{n} \right\}} \in H$ for $n \in E$. Applying Proposition \[lem:fp-closure\], we conclude that $H = G^{\circ}$. In particular, $R = G^{\circ}$, which is in contradiction with ${\operatorname{int}R} = \emptyset$.

Let $E$ be an infinite set with ${\left\{ g(n) \right\}} \in H$ for $n \in E$.

By Lemma \[lem:poly-seq-in-G-o\], there exists a polynomial sequence $h\colon {{\mathbb{Z}}}\to G$ with values in $G^{\circ}$ such that ${\left\{ g(n) \right\}}={\left\{ h(n) \right\}}$. Write $$h(n)=   g_0^{\binom{n}{0}} g_1^{\binom{n}{1}} g_2^{\binom{n}{2}} \dots g_d^{\binom{n}{d}},$$ where $g_i\in G$. Since $h(n)$ takes values in $G^{\circ}$, we see that $g_i$ lie in $G^{\circ}$.

In order to prove the claim, it is sufficient by Lemma \[lem:G2-not-complemented\] to show that $H(G^{\circ})_2 = G^{\circ}$. The quotient $G^{\circ}/(G^{\circ})_2 $ can be identified with ${\mathbb{R}}^d$ in such a way that $\Gamma\cap G^{\circ}$ maps to ${\mathbb{Z}}^d$. Let $\pi \colon G^{\circ} \to {\mathbb{R}}^d$ be the corresponding projection.  Put $\theta(n) = \pi( h(n) )$, $\xi(n) = \pi( {\left\{ h(n) \right\}} ) = {\left\{  \theta(n)  \right\}}$ and $V = \pi(H) < {\mathbb{R}}^d$. From the form of $h(n)$, we see that $\theta(n)$ is a polynomial in $n$, $\xi(n)$ is bounded, and $\xi(n) \in V$ for $n\in E$. We need to show that $V = {\mathbb{R}}^d$.

Suppose for the sake of contradiction that $V \neq {\mathbb{R}}^d$. Write $\theta(n)=(\theta_1(n),\ldots,\theta_d(n))$. Then there exists a non-trivial linear relation $$\label{eq:324-1}    
        \sum_{i=1}^d \lambda_i {\left\{ \theta_i(n) \right\}}  = 0, \qquad n \in E,$$ where $\lambda_i \in {\mathbb{R}}$ are not all zero.  This can be rewritten as $$\label{eq:324-2}    
        \sum_{i=1}^d \lambda_i {\left[ \theta_i(n) \right]} = \sum_{i=1}^d \lambda_i \theta_i(n), \qquad n \in E.$$ The maps $\theta_i \colon {{\mathbb{Z}}}\to {{\mathbb{R}}}$ are polynomials, so writing $$- \sum_{i=1}^d \lambda_i \theta_i(n) = \sum_{j=0}^D \kappa_j n^j,$$ we obtain $$\label{eq:324-3}
        \sum_{i=1}^d \lambda_i {\left[ \theta_i(n) \right]} + \sum_{j=0}^D \kappa_j n^j = 0 , \qquad n \in E.$$ This amounts to saying that there is a non-trivial linear relation between the vectors $({\left[ \theta_i(n) \right]})_{n \in E}$ for $i = 1,\dots,d$ and $(n^j)_{n \in E}$ for $j = 0,1,\dots,D$. Because these vectors are integer-valued, if such a relation exists, there is also such a relation with integer coefficients.  Take one such relation $$\label{eq:324-7}
        \sum_{i=1}^d l_i {\left[ \theta_i(n) \right]} + \sum_{j=0}^D k_j n^j = 0 , \qquad n \in E,$$ where $l_i \in {\mathbb{Z}}$ and $k_j \in {\mathbb{Z}}$ for all $i,j$, and not all of $l_i,k_j$ are zero.  Dropping the integer parts in at the cost of introducing a bounded error, we get $$\label{eq:324-4}
        \sum_{i=1}^d l_i {\theta_i(n)} + \sum_{j=0}^D k_j n^j = O(1), \qquad n \in E.$$ This is only possible if the left hand side of is constant (as a polynomial, hence for all $n \in {\mathbb{Z}}$).  It follows that $\theta(n) \bmod{{\mathbb{Z}}^d}$ for $n \in {\mathbb{Z}}$ takes values in the proper subtorus ${\left\{ x \in {\mathbb{R}}^d/{\mathbb{Z}}^d \ \middle| \  \sum l_i x_i = c  \right\} }$, which contradicts the fact that the sequence $(g(n)\Gamma)_{n\geq 0}$ is dense in $G/\Gamma$.

Small fractional parts {#sec:Examples}
======================

In this section, we study the sequences of the form $$g(n) = 
    \begin{cases}
    1, & \text{ if }  0 < q(n) < {\varepsilon}(n), \\
    0, & \text{ otherwise,} 
    \end{cases} 
    \label{eq:def-standard-sparse}$$ where $q(n) \geq 0$ is a generalised polynomial and ${\varepsilon}(n) \to 0$, which include the most natural examples of sparse generalised polynomials.  The most frequent application is when $q(n) = {\left\lVert r(n) \right\rVert}$ or $q(n) = {\left\{ r(n) \right\}}$ for an (unbounded) generalised polynomial $r(n)$. In this section, it will be more convenient to regard generalised polynomials as functions on ${{\mathbb{N}}}_0$. This causes no problems since we can always extend them to ${{\mathbb{Z}}}$.

\[lem:gen-poly-set-of-zeros\] If $h$ is an (unbounded) generalised polynomial, then $$g(n) =
    \begin{cases}
    1, & \text{if } h(n) = 0, \\
    0, & \text{otherwise,}
    \end{cases}$$ is a generalised polynomial.  Likewise, for any $a < b$, $$g'(n) =
    \begin{cases}
    1, & \text{if }  a \leq h(n) < b, \\
    0, & \text{otherwise,}
    \end{cases}$$ is a generalised polynomial. 

Because $h(n)$ takes countably many values for $n \in {\mathbb{N}}_0$, there exists $\theta \in {\mathbb{R}}$ such that $\theta h(n) \in {\mathbb{R}}\setminus {\mathbb{Q}}$ unless $h(n) = 0$. Now, a short computation verifies that $$g(n) = \lfloor 1 - {\left\{ \theta h(n) \right\}}\rfloor.$$ For the latter claim, after rescaling we may assume that $a = 0$ and $b = 1$. Then $g'(n) = {\left\llbracket {\left\lfloor  h(n) \right\rfloor} = 0 \right\rrbracket}$, and we may apply the construction above to $h'(n) = {\left\lfloor  h(n) \right\rfloor}$.

\[ex:lin-rec-is-gp\] Take $a \in {\mathbb{N}}$ and let $(n_i)_{i \geq 0}$ be the sequence given by $n_0 = 0,\ n_1 = 1$ and $n_{i+2} = a n_{i+1} + n_i$. Then $E = {\left\{ n_i \ \middle| \ i \in {\mathbb{N}}_0 \right\} }$ is generalised polynomial.  For $a = 1$, this is the set of Fibonacci numbers. 

Let ${\alpha}\in {\mathbb{R}}$ be the real number with continued fraction expansion ${\alpha}= [a;a,a,\dots]$, i.e. $${\alpha}= a+\cfrac{1}{a+\cfrac{1}{a+\cdots}} = \frac{a + \sqrt{a^2+4}}{2}.$$ Let $E' = {\left\{ n \in {\mathbb{N}}\ \middle| \  {\left\lVert n{\alpha}\right\rVert} < 1/2n  \right\} }$.  Note that $E'$ is generalised polynomial by Lemma \[lem:gen-poly-set-of-zeros\], so it will suffice to show that the symmetric difference $E \triangle E'$ is finite. 

By a classical theorem of Legendre (see e.g. [@Khintchine-book Thm.  5.1]), we have $E' \subset E$. Conversely, using a well-known formula for the error term in the continued fraction approximations (see e.g. [@Khintchine-book Thm.  3.1]), we find that $$n_i {\left\lVert n_i {\alpha}\right\rVert} = n_i^2 \sum_{l=0}^\infty \frac{(-1)^{l}}{n_{i+l} n_{i+l+1}} \xrightarrow[i \to \infty]{} \sum_{l=0}^\infty \frac{(-1)^l}{{\alpha}^{2l+1}} = \frac{1}{{\alpha}+ 1/{\alpha}} = \frac{1}{\sqrt{a^2 + 4}},$$ because $n_{i+1}/n_i \to \alpha$ as $i \to \infty$. Since $1/\sqrt{a^2 + 4} < 1/2$, for sufficiently large $i$ we have ${\left\lVert n_i {\alpha}\right\rVert} <  1/2 n_i$, whence $n_i \in E'$.

\[lawnmower\] In fact, this result holds for any choice of $n_0, n_1\in{{\mathbb{Z}}}$. This follows from Proposition \[przepraszamzetakpozno\] below.  A similar argument works also for sequences $(n_i)_{i \geq 0}$ given by the recurrence $n_{i+2} = a_{i+2} n_{i+1} + n_i$, where $a_i \geq 2$ is a bounded sequence of integers.  Then $n_i$ is the sequence of denominators in the best rational approximations of a badly approximable real number $\alpha=[0;a_2,a_3,\ldots]$.

\[prop:special-gp-is-gp\] Suppose $q(n)\geq 0$ and $p(n)>0$ are generalised polynomials, $b<0$ is a rational number, $\lim_{n \to \infty} p(n) = \infty$, and ${\varepsilon}(n) = p(n)^b$. Then $f(n)$ given by is a sparse generalised polynomial. 

That $f(n)$ is a generalised polynomial follows from Lemma \[lem:gen-poly-set-of-zeros\]; that it is sparse follows by a standard argument from Theorem \[BLnilgenpolythm\] via Corollary \[cor:density-uniform\]. 

In dealing with polynomials, it is often useful to exploit the fact that sufficiently high discrete derivatives vanish.  More precisely, if $q$ is a polynomial of degree at most $d-1$, then for any $n_1,\dots,n_d$ we have $$\sum_{{\alpha}\subseteq \{1,\ldots,d\}} (-1)^{{\left|{\alpha}\right|}} q{ \left(  n_{\alpha}\right) } = 0,$$ with the usual convention $n_\alpha = \sum_{i \in \alpha} n_i$.

A similar relation holds also for generalised polynomials.  Such a relation is stated in [@BergelsonMcCutcheon-2010 Theorem 2.42] in terms of limits along ultrafilters.  Below, we give a statement purely in terms of [$\operatorname{IP}$]{} limits, which is easily deduced from [@BergelsonMcCutcheon-2010] or proven directly. 

\[thm:discrete-derivative-vanishes\] For any generalised polynomial $q$ and an [$\operatorname{IP}$]{} ring ${\mathcal{G}}_0$, there exist $\lambda \in {\mathbb{R}}$, $d \in {\mathbb{N}}_0$ (equal to the degree of $q$), and families of [$\operatorname{IP}$]{} subrings ${\mathcal{G}}_1$, ${\mathcal{G}}_2({\beta}_1), \ldots,  {\mathcal{G}}_d({\beta}_1,\dots,{\beta}_{d-1})$ of ${\mathcal{G}}_0$, ${\beta}_i \in {\mathcal{F}}$, such that $$\label{eq:763}
    \sum_{\emptyset \neq {\alpha}\subseteq \{1,\ldots,d\}} (-1)^{{\left|{\alpha}\right|}} q{ \left(  \sum_{i \in {\alpha}} n_{{\beta}_i}  \right) } = - \lambda$$ whenever ${\beta}_1 \in {\mathcal{G}}_1,\ {\beta}_2 \in {\mathcal{G}}_2({\beta}_1),\ \dots,\ {\beta}_d \in {\mathcal{G}}_d({\beta}_1,\dots, {\beta}_{d-1})$.

Using the above relation, we are able to prove a special case of Theorem \[thm:main-A\] with negligible effort. 

\[prop:IP-auto-vs-special-gp\] Let $q(n) \geq 0$ be a generalised polynomial, ${\varepsilon}(n) \geq 0$ with ${\varepsilon}(n) \to 0$ as $n \to \infty$, and let $g$ be given by .  Then there exists no [$\operatorname{IP}$]{} set $E$ such that $f(n) = 1$ for $n \in E$.

Suppose that $(n_{\alpha})_{{\alpha}\in {\mathcal{F}}} $ were an [$\operatorname{IP}$]{} set such that $ f(n_{\alpha}) = 1$ for ${\alpha}\in {\mathcal{F}}$. Apply Theorem \[thm:discrete-derivative-vanishes\] to find $\lambda \in {\mathbb{R}}$ and families of [$\operatorname{IP}$]{} rings ${\mathcal{G}}_j({\beta}_1,\dots,{\beta}_{j-1})$ such that $$\sum_{\emptyset \neq {\alpha}\subseteq \{1,\ldots,d\}} (-1)^{{\left|{\alpha}\right|}} q{ \left(  \sum_{i \in {\alpha}} n_{{\beta}_i}  \right) } = - \lambda$$ for ${\beta}_1 \in {\mathcal{G}}_1,\ {\beta}_2 \in {\mathcal{G}}_2({\beta}_1),\ \dots,\ {\beta}_d \in {\mathcal{G}}_d({\beta}_1,\dots, {\beta}_{d-1})$. Passing to the [$\operatorname{IP}$]{} limit with $\beta_d, \ldots, \beta_2$ (in this order), we obtain $-q(n_{\beta_1})=-\lambda$. This proves that $$0<\lambda<\varepsilon(n_{{\beta}_1}),$$ which gives a contradiction. 

If $p(x) \in {\mathbb{R}}[x]$ has least one irrational coefficient and ${\varepsilon}(n) \to 0$, then the set ${\left\{ n \in {\mathbb{Z}}\ \middle| \  {\left\lVert p(n) \right\rVert} < {\varepsilon}(n)  \right\} }$ does not contain an [$\operatorname{IP}$]{}-set. 

We move on to an example of a fairly explicit class of sparse generalised polynomial sequences.  We later discuss how the argument adapts to other sequences of the form . 

\[ex:Heisenberg\] For any sufficiently small $c > 0$ the following holds: Let $1,{\alpha},{\beta}\in {\mathbb{R}}$ be algebraic numbers linearly independent over ${\mathbb{Q}}$, and let ${\varepsilon}(n) \to 0$ be a rational power of a generalised polynomial with ${\varepsilon}(n) \gg n^{-c}$. Then the sequence given by $$f(n) = 
    \begin{cases}
    1, & \text{ if }  {\left\lVert  n{\alpha}{\left\lfloor n {\beta}\right\rfloor}  \right\rVert} < {\varepsilon}(n), \\
    0, & \text{ otherwise} 
    \end{cases}$$ is a sparse generalised polynomial with $\sum_{n = 0}^{N-1} f(n) \gg N^{1-c}$. (In particular, $f$ is not eventually $0$.) Moreover, for any $a \in {\mathbb{N}}, b \in {\mathbb{Z}}$, we also have $\sum_{n = 0}^{N-1} f(an + b) \gg N^{1-c}$ (where the implicit constant depends on $a$ and $b$). 

A key tool which we will use is the quantitative equidistribution theorem for nilrotations, whose special case cited below we use as a black box. 

\[thm:GreenTao\] Let $g(n)$ be a polynomial sequence on a nilmanifold $G/\Gamma$ where $G$ is connected.  Fix a [Mal’cev]{} basis ${\mathscr{X}}$ of $G$. Then there exists a constant $A > 0$ such that for any $0 < \delta < 1/2$ and any $N$, one of the following conditions holds:

1.   \[item:GT:1\] for each $x \in G/\Gamma$, there exist $\delta N$ values of $n \in [N]$ with $d_{{\mathscr{X}}}( g(n)\Gamma, x) \leq \delta$;

2.   \[item:GT:2\] there exists a horizontal character $\eta$ with ${\left\lVert \eta \right\rVert} \ll \delta^{-A}$ such that $$\max_{0 \leq n < N} {\left\lVert  \eta( g(n+1)) - \eta(g(n))  \right\rVert} \ll \delta^{-A} N^{-1}.$$

For linear orbits $g(n) = a^n$, $a \in G$, the condition in Theorem \[thm:GreenTao\] asserts that the projection of $a$ to the torus $G/G_2\Gamma$ satisfies an approximate linear relation over ${\mathbb{Z}}$. A convenient criterion which can be used to rule that out is provided by the following classical result of Schmidt.  As before, we only cite the special case which we shall use. 

\[thm:Schmidt\] Let $\alpha_1,\dots,\alpha_n$ be $n$ algebraic numbers linearly independent over ${\mathbb{Q}}$, and let ${\varepsilon}> 0$. Then for $k \in {\mathbb{Z}}^n$ we have $${\left\lVert  \sum_{i=1}^n k_i \alpha_i  \right\rVert} \gg {\left\lVert k \right\rVert}^{-n-{\varepsilon}}$$ where the implicit constant depends on $\alpha_1,\dots,\alpha_n$ and ${\varepsilon}$.

It is clear by Proposition \[prop:special-gp-is-gp\] that $f(n)$ is a sparse generalised polynomial, what remains to be proved is the bound on its growth.  We only deal with $\sum_{n=0}^{N-1} f(n)$, the estimation of $\sum_{n=0}^{N-1} f(an+b)$ is analogous.  To this end, we may drop the assumptions that ${\varepsilon}(n)$ is a rational power of a generalised polynomial and assume that ${\varepsilon}(N) \sim N^{-c}$.

We can explicitly describe a nilmanifold on which $f(n)$ can be realised in a way analogous to Theorem \[thm:BergelsonLeibman\].  Denote $$[x,y,z] \equiv \begin{bmatrix}
        1 & x & z \\ 
        0 & 1 & y \\
        0 & 0 & 1 
    \end{bmatrix},$$ and define $$G = {\left\{  [x,y,z]  \ \middle| \ x, y, z \in {\mathbb{R}}\right\} },\qquad 
        \Gamma {\left\{  [x,y,z]  \ \middle| \ x, y, z \in {\mathbb{Z}}\right\} }.$$ Then, $G/\Gamma$ is the Heisenberg nilmanifold with a natural choice of a [Mal’cev]{} basis $[1,0,0],\ [0,1,0],\ [0,0,1]$.

The horizontal characters on $G/\Gamma$ take the form $\eta_k([x,y,z]) = k_1 x + k_2 y $ with $k = (k_1,k_2) \in {\mathbb{Z}}^2$ and ${\left\lVert \eta_k \right\rVert} = {\left\lVert k \right\rVert}_2$. Let $g$ be the polynomial sequence $$g(n) = [- n {\alpha}, n {\beta}, 0] = [-{\alpha},{\beta},0]^n [0,0,{\alpha}{\beta}]^{\binom{n}{2}},$$ so that ${\left\{ g(n) \right\}} = [ {\left\{ -n{\alpha}\right\}}, {\left\{ n{\beta}\right\}}, {\left\{  n{\alpha}{\left\lfloor n{\beta}\right\rfloor}  \right\}}]$. Let $F \colon G/\Gamma \to [0,1)$ be the map $F([x,y,z]) = {\left\lVert z \right\rVert}$ for $x,y,z \in [0,1)^3$. It follows from the way the metric on $G/\Gamma$ is defined that $F$ is Lipschitz.  Then $f(n) = {\left\llbracket  F(g(n)) < {\varepsilon}(n)  \right\rrbracket}$.

Let $N$ be a sufficiently large integer, and put $z = [0,0,0]\Gamma$. There exists $\rho_N \gg {\varepsilon}(N)$ such that $F(B(z,\rho_N)) \subset [0,{\varepsilon}(N))$. Hence, if $d(g(n)\Gamma, z) < \rho_N$ for some $n \in [N]$, then $f(n) = 1$. If $f(n) = 1$ for at least $ N\rho_N \gg N^{1-c}$ values of $n \in [N]$, we are done.  Suppose this is not the case.  It now follows from Theorem \[thm:GreenTao\] that there exists a horizontal character $\eta$ with ${\left\lVert \eta \right\rVert} \ll \rho^{-A}_N \ll N^{Ac}$ such that $$\label{eq:255}      
        \max_{0 \leq n < N} {\left\lVert  \eta( g(n+1) ) - \eta(g(n))  \right\rVert} \ll N^{-1+Ac},$$ where $A$ is an absolute constant.  Picking $l \in {\mathbb{Z}}^2$ so that $\eta = \eta_l$, we conclude from and Theorem \[thm:Schmidt\] that $$\label{eq:256}    
        N^{-3Ac} \ll {\left\lVert l \right\rVert}^{-3} \ll {\left\lVert  - l_1 {\alpha}+ l_2 {\beta}\right\rVert} \ll N^{-1+Ac}.$$ As long as $c < 1/(4A)$, we get a contradiction. 

\[remark:Heisenberg\] The above argument is not specific to the sequence ${\left\llbracket  n{\alpha}{\left\lfloor n{\beta}\right\rfloor} < {\varepsilon}(n) \right\rrbracket}$; in fact, the term $n{\alpha}{\left\lfloor n{\beta}\right\rfloor}$ could be replaced by a fairly arbitrary generalised polynomial $q(n)$. The difficulty lies in the need to impose suitable “quantative irrationality” conditions of $q(n)$.

In the situation of Example \[ex:Heisenberg\], this was easily accomplished since we had a direct access to the representation of $q(n)$ in terms of an orbit on a nilmanifold.  For more general sequences, one needs to resort to the construction in [@BergelsonLeibman2007]. 

Very sparse sequences {#very-sparse-sequences .unnumbered}
---------------------

It is difficult to say anything substantial about generalised polynomial sequences which are extremely sparse.  Indeed, as we presently show, any sufficiently sparse set is generalised polynomial. 

We will need the following elementary lemma.  We thank Aled Walker for simplifying our argument. 

\[lem:coprimes-in-intervals\] For any $\delta > 0$, there exists $q_0 = q_0(\delta)$ such that for all $q \geq q_0$ and all $x\geq 0$, the interval $[x,x+q^\delta)$ contains an integer $n$ coprime to $q$.

Using an inclusion-exclusion argument, we find that $$\begin{aligned}
        \sum_{\substack{ x \leq n < x+q^\delta \\ (n,q) = 1} } 1
        = \sum_{d | q} \left(\mu(d) \frac{q^\delta}{d} + O(1)\right)
        = q^\delta \sum_{d|q} \frac{\mu(d)}{d} + O(\tau(q)) 
        = q^\delta \frac{\varphi(q)}{q} + O(\tau(q)), \label{eq:637}
    \end{aligned}$$ where $\mu$ is the Möbius function, $\varphi$ is the Euler totient function, and $\tau$ is the number of divisors function.  Using the standard estimates $\varphi(q) \gg q^{1-\delta/3}$ and $\tau(q) \ll q^{\delta/3}$, we conclude that the expression in is positive for $q$ large enough. 

\[prop:nicely-sparse=&gt;gen-poly\] Let $C$, $D$ be integers satisfying $5 \leq C < D \leq \frac{1}{2} (C-1)^2$. Suppose that the sequence $(n_i)_{i \geq 0}$ of integers satisfies $n_{0} \geq 2$ and $n_{i}^D < n_{i+1} < n_{i}^{2D}$ for $i \geq 0$. Then there exists ${\alpha}\in (0,1)$ such that the symmetric difference of the sets $E = {\left\{ n_i \ \middle| \  i \geq 0 \right\} }$ and $$E' = {\left\{ n \in {\mathbb{N}}_0 \ \middle| \  \frac{1}{4} n^{-C+1} \leq {\left\lVert n {\alpha}\right\rVert} \leq \frac{1}{2} n^{-C+1} \right\} }$$ is finite. 

We inductively construct a sequence of integers $(m_i)_{i \geq 0}$ such that the intervals $I_i = [\frac{m_i}{n_i} + \frac{1}{4} n_i^{-C}, \frac{m_i}{n_i} + \frac{1}{2} n_i^{-C}]$ are nested (i.e. $I_{i+1} \subset I_{i}$) and moreover $(m_i,n_i) = 1$ for sufficiently large $i$. Choose $m_0 = 0$. If $m_i$ has been constructed, then the possible choices of $m_{i+1}$ such that the nesting condition is satisfied form an interval of length $\gg n_{i+1}/n_{i}^C \gg n_{i+1}^{1-C/D}$. Because $C<D$, by Lemma \[lem:coprimes-in-intervals\], for sufficiently large $i$ there is a choice of $m_{i+1}$ with $(m_{i+1},n_{i+1}) = 1$.

Once the sequence $(m_i)_{i \geq 0}$ has been constructed, pick ${\alpha}$ so that $\{{\alpha}\} = \bigcap_{i \geq 0} I_{i}$. By construction, for this choice of ${\alpha}$ we have $E \subseteq E'$. Let ${\alpha}= [0;a_1,a_2,\dots]$ be the continued fraction expansion of ${\alpha}$, and let $\frac{p_j}{q_j} = [0;a_1,\dots,a_j]$ be the corresponding convergents.  We recall an estimate for the error term of the approximation: $\frac{1}{2} \frac{1}{q_j q_{j+1}} \leq | {\alpha}- \frac{p_j}{q_j}| \leq \frac{1}{q_j q_{j+1}}$. Since $C \geq 2$, the classical theorem of Legendre implies that any approximation $\frac{m}{n}$ with $(m,n) = 1$ and $| {\alpha}- \frac{m}{n} |\leq \frac{1}{2} n^{-C}$ is equal to $\frac{p_j}{q_j}$ for some $j$. Furthermore, in this case $q_{j+1} \geq q_j^{C-1}$. In particular, for each $i$, there is $j(i)$ such that $\frac{m_i}{n_i} = \frac{p_{j(i)}}{q_{j(i)}}$ and $q_{j(i)+1} \geq q_{j(i)}^{C-1}$.

Suppose now that $n \in E' \setminus E$. Then there exists $m$ (not necessarily coprime to $n$) with $\frac{1}{4} n^{-C} \leq | {\alpha}- \frac{m}{n} | \leq \frac{1}{2} n^{-C}$, whence $\frac{m}{n} = \frac{p_j}{q_j}$ for some $j$. If $\frac{m}{n}$ were equal to $\frac{m_i}{n_i}$ for some $i$ sufficiently large that $(n_i,m_i) = 1$, then contradiction would follow immediately: $n^{-C} \leq \frac{1}{4} n_i^{-C} \leq | {\alpha}- \frac{m_i}{n_i} | = | {\alpha}- \frac{m}{n} | \leq  \frac{1}{2} n^{-C}$. The cases when $q_j$ is bounded account for finitely many possible values of $n$. Hence, we may assume that $j$ lies strictly between $j(i)$ and $j(i+1)$ for some $i$ which is sufficiently large so that $(m_{k},n_{k}) = 1$ for $k \geq i$. We then have the inequalities $$q_{j} \geq q_{j(i)+1} \geq q_{j(i)}^{C-1}=n_i^{C-1}$$ and $$n_{i+1} = q_{j(i+1)} \geq q_{j+1} \geq q_{j}^{C-1} \geq n_i^{(C-1)^2},$$ which imply that $n_{i}^{2D} > n_{i+1} \geq n_{i}^{(C-1)^2}$, contradicting $2D \leq (C-1)^2$.

We are now ready to prove another one of our main results, whose formulation we reiterate. 

\[cor:very-sparse=&gt;gen-poly\] There exists a constant $c > 0$ such that for any sequence $(n_i)_{i \geq 0}$ with $n_0 \geq 2$ and $n_{i+1} \geq n_{i}^c$ for all $i \geq 0$, the set $E = {\left\{ n_i \ \middle| \ i \geq 0 \right\} }$ is generalised polynomial. 

We first construct a sequence $(n_j')_{j \geq 0}$ of integers with $n_j'^6 < n_{j+1}' < n_{j}'^{12}$ for sufficiently large $j$ and such that $(n_i)_{i \geq 0}$ is its subsequence.  We construct $n_j'$ inductively, keeping track of $j(i)$ such that $n_{j(i)}'=n_i$. For $i = 0$, pick $j(0) = 0$ and $n'_0 = n_0$. If $j(i)$ and $(n_j)_{0 \leq j \leq j(i)}$ have been constructed, we define $j(i+1) = j(i) + l$ and $n_{j(i)+k}' = {\left\lfloor  \exp( (\log n_{i+1})^{k/l} (\log n_{i})^{1-k/l}  )  \right\rfloor}$ for $0 \leq k \leq l$, where $l$ remains to be chosen.  This ensures that $\frac{\log n_{j(i)+k+1}'}{\log n_{j(i)+k}'} = { \left(  \frac{\log n_{i+1}}{\log n_i}  \right) }^{1/l} + o(1)$ as $i \to \infty$. Putting $A = \frac{\log n_{i+1}}{\log n_i} \geq c$, and letting $l$ be any integer in the interval $( \frac{\log A}{\log 11}, \frac{\log A}{\log 7} )$, we obtain (for sufficiently large $i$) the inequality $6 < \frac{\log n_{j(i)+k+1}'}{\log n_{j(i)+k}'} < 12$. This interval indeed contains at least one integer, provided that $c$ is large enough. 

Applying Proposition \[prop:nicely-sparse=&gt;gen-poly\] with $C = 5, D = 6$, we conclude that the set $E' = {\left\{ n_j' \ \middle| \ j \geq 0 \right\} }$ is generalised polynomial.  By the same argument, the set $E'' = {\left\{ n_j'' \ \middle| \ j \geq 0 \right\} }$ is also generalised polynomial, where $n''_{j(i)} = n_i$ and $n''_j = n'_j + 1$ if $j \neq j(i)$ for all $i$. It follows that the set $E' \cap E'' = E$ is generalised polynomial, as required. 

The constant $c$ in the previous proposition can be effectively computed.  A slight modification of the method above gives $c= 617$.

Exponential sequences {#sec:Exponential}
=====================

In order to construct a generalised polynomial that takes value zero exactly on the set of Fibonacci numbers, we used the theory of continued fractions.  In this section, we will do this more generally for certain linear recurrence sequences of degree $2$ and $3$. We need to begin, however, by the following basic result. 

\[przepraszamzetakpozno\] Let $\beta$ be a Pisot number (or a Pisot-Vijayaraghavan number), i.e. a real algebraic integer $\beta>1$ such that all its Galois conjugates have absolute value smaller than one.  Let $P(x)=x^d-c_1x^{d-1}-\ldots-c_d$ be the minimal polynomial of $\beta$. Let $(R_i)_{i\geq 0}$ be a sequence of integers satisfying the linear recurrence relation $$R_{i+d}=c_1R_{i+d-1}+\ldots+c_dR_i, \quad i\geq 0.$$ Assume that $(R_i)_{i\geq 0}$ is not identically zero.  Then the following conditions are equivalent:

1.   The set $\{R_i\mid i \in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

2.   The set $
     \{{\langle\!\langle}\beta^i {\rangle\!\rangle}\mid i \in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

In particular, the question whether the set $\{R_i\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial depends only on the recurrence relation and not on the initial values of $(R_i)_{i\geq 0}$.

From the form of the linear recurrence relation for $(R_i)_{i\geq 0},$ we see that $R_i=u\beta^i + o(1)$ for some $u\in {{\mathbb{R}}}$. Note that $u \neq 0$. In fact, otherwise $R_i=o(1)$ and since $R_i$ takes integer values we see that $R_i=0$ for large $i$. It follows that $R_i$ is identically zero (note that $c_d\neq 0$). 

Since $\beta$ is an algebraic integer, we know that $\sum_{\beta'} (\beta')^i$ is an integer, the sum being taken over all the Galois conjugates $\beta'$ of $\beta$. Since $|\beta'|<1$ for $\beta'\neq \beta$, we see that $\beta^i = {\langle\!\langle}\beta^i {\rangle\!\rangle}+ o(1).$ It follows that $$R_i = u {\langle\!\langle}\beta^i {\rangle\!\rangle}+ o(1)$$ and the claim follows immediately from the following lemma. 

Let $u\in {{\mathbb{R}}}$, $u\neq 0$, and let $(R_i)_{i\geq 0} $ and $(S_i)_{i\geq 0} $ be integer-valued sequences such that $$R_i=uS_i+o(1).$$ Then the set $\{R_i\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial if and only if the set $\{S_i\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

It follows from the relation $R_i=uS_i+o(1)$ that for sufficiently large $i$, an integer $m$ is of the form $m=S_i$ if and only if ${\langle\!\langle}u m {\rangle\!\rangle}= R_i$ and ${\left\lVert um \right\rVert}<|u|/2$. We immediately see from this that if the set $\{R_i\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial, then so is $\{S_i\mid i\in {{\mathbb{N}}}_0\}$. Since the argument is symmetric with respect to $(R_i)$ and $(S_i)$, we conclude the claim. 

Quadratic Pisot numbers {#quadratic-pisot-numbers .unnumbered}
-----------------------

In this subsection we will generalise Example \[ex:lin-rec-is-gp\], where we have shown that the set of Fibonacci numbers in generalised polynomial. 

\[thm:quadraticPisotisGP\] Let $\beta$ be a quadratic Pisot unit, i.e. a quadratic Pisot number of (field) norm $\pm 1$. Then the set $\{{\langle\!\langle}\beta^i {\rangle\!\rangle}\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

Let $\beta'$ be the Galois conjugate of $\beta$. Since $\beta$ is a quadratic Pisot unit, it satisfies the equation $\beta^2-a\beta-1=0$ for $a\geq 1$ (if the norm of $\beta$ is $-1$) or the equation $\beta^2-a\beta+1=0$ for $a\geq 3$ (if the norm of $\beta$ is $1$).  In Example \[ex:lin-rec-is-gp\], we have constructed a sequence $(n_i)$ satisfying the recurrence $n_{i+2}=a n_{i+1} - n_i$ for $ i\geq 0$ and such that its set of values is generalised polynomial.  Hence in this case the claim follows from Proposition \[przepraszamzetakpozno\]. 

If the norm of $\beta$ is $1$, we need to argue a bit more carefully.  The continued fractions exapansion of $\beta$ is $\beta = [a-1,\overline{1,a-2}]$. Let $(q_i)_{i\geq 0}$ be the sequence of denominators of convergents of this continued fraction.  We get the recurrence relations $q_0=q_1=1$ and $$\begin{aligned}
 q_{2i+2}&=(a-2)q_{2i+1}+q_{2i},  \\ q_{2i+3}&=q_{2i+2}+q_{2i+1}.\end{aligned}$$ By induction, we get from this the relations $$\begin{aligned}
 q_{2i+4}&=aq_{2i+2}+q_{2i},  \\ q_{2i+5}&=aq_{2i+3}+q_{2i+1}.\end{aligned}$$

We solve this linear recurrence equations to get that $$q_{2i}=u_1\beta^i+u_2 (\beta')^i, \quad q_{2i+1}=v_1\beta^i+v_2 (\beta')^i, \quad i\geq 0$$ for some $u_1,u_2,v_1,v_2\in {{\mathbb{R}}}$. Since $0<\beta'<1$, we get $$q_{2i+1}= {\langle\!\langle}w q_{2i} {\rangle\!\rangle}, \quad q_{2i+2}= {\langle\!\langle}(\beta/w) q_{2i+1} {\rangle\!\rangle}$$ with $w=v_1/u_1$ for large $i$. Computing the initial values, we check that $w\neq \sqrt{\beta}$ if $a \geq 4$.

Consider the set $E'={\left\{ n\in {{\mathbb{N}}}\ \middle| \ {\left\lVert n\beta \right\rVert}<1/(2n) \right\} }.$ As in Example \[ex:lin-rec-is-gp\], we argue that $E'$ is generalised polynomial and that by Legendre’s Theorem we have $E' \subset {\left\{ q_i \ \middle| \ i\in {{\mathbb{N}}}_0 \right\} }$.  On the other hand, by the well-known error formula, we get $${\left\lVert q_{2i+1} \beta \right\rVert} < \frac{1}{q_{2i+2}} \leq \frac{1}{(a-2)q_{2i+1}}.$$ Let us assume that $a\geq 4$. Then we see that ${\left\{ q_{2i+1} \ \middle| \ i\in {{\mathbb{N}}}_0 \right\} } \subset E'$. Since $q_{2i+1}= {\langle\!\langle}w q_{2i} {\rangle\!\rangle}$ and $q_{2i+2}= {\langle\!\langle}(\beta/w) q_{2i+1} {\rangle\!\rangle}$, $w\neq \beta/w$, we see that the set $$E={\left\{ n\in {{\mathbb{N}}}\ \middle| \ n\in E' \text{ and } {\langle\!\langle}w n {\rangle\!\rangle}\notin E' \right\} }$$ is equal to ${\left\{ q_{2i+1} \ \middle| \ i\in {{\mathbb{N}}}_0 \right\} }$ up to a finite set.  Thus the set ${\left\{ q_{2i+1} \ \middle| \ i\in {{\mathbb{N}}}_0 \right\} }$ is generalised polynomial and the claim again follows from Proposition \[przepraszamzetakpozno\]. 

It remains to treat the case $a=3$. In this case $\beta^2=3\beta+1$, and hence $(\beta^2)^2=7\beta^2 +1$. Applying the previous case to $\beta^2$, we see that the set $\{{\langle\!\langle}\beta^{2i} {\rangle\!\rangle}\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial.  By Proposition \[przepraszamzetakpozno\], so is the set $\{{\langle\!\langle}\beta^{2i+1} {\rangle\!\rangle}\mid i\in {{\mathbb{N}}}_0\}$ (since ${\langle\!\langle}\beta^{2i+1} {\rangle\!\rangle}$ and ${\langle\!\langle}\beta^{2i} {\rangle\!\rangle}$ satisfy for large $i$ the same linear recurrence).  Thus, our claim holds in this case as well. 

Cubic Pisot numbers {#cubic-pisot-numbers .unnumbered}
-------------------

In order to replace the Fibonacci numbers by a linear recurrence sequence of higher degree, we need to use higher dimensional diophantine approximation.  We briefly review the topic below.  Let $\theta$ be a point in ${{\mathbb{R}}}^d$, $d\geq 1$, and let $N$ denote a norm on ${{\mathbb{R}}}^d$. Let $$N_0(\theta)=\inf_{p\in {{\mathbb{Z}}}^d} N(\theta-p)$$ denote the distance from $\theta$ to a nearest lattice point.  We say that an integer $q\geq 1$ is a *best approximation* of $\theta$ with respect to the norm $N$ if $N_0(q\theta)<N_0(k\theta)$ for $1\leq k\leq q-1$. If $\theta \notin {{\mathbb{Q}}}^d$, there are infinitely many best approximations of $\theta$. We order them in an increasing sequence $(q_i)_{i\geq 0}$, $1=q_0<q_1<\ldots.$ We call this sequence the *sequence of best approximations*.  For $d=1$, the sequence is well known as the sequence of denominators of convergents of the continued fraction expansion of $\theta$ (in the latter sequence the first term possibly appears twice).  For $d\geq 2$ and general $\theta\in {{\mathbb{R}}}^d$ there is no satisfactory theory of best approximations.  However, the problem has been studied for specific choices of $\theta$, notably by Lagarias [@Lagarias-1982], Chekhova-Hubert-Messaoudi [@ChekhovaHubertMessaoudi-2001], Chevallier [@Chevallier-2013], and Hubert-Messaoudi [@HubertMessaudi-2006] in the case when the coordinates of $\theta$ lie in some cubic number fields.  We follow the presentation of [@HubertMessaudi-2006]. 

Consider the polynomial $P(x)=x^3-ax^2-bx-1$ with integer coefficients $a,b$ satysfying ($a\geq 0$ and $0\leq b \leq a+1$) or ($a\geq 2$ and $b=-1$).  Assume further that the polynomial $P$ has a unique real root $\beta>1$ and a pair of complex conjugate roots $\alpha, \bar{\alpha}$. (The condition on $a$ and $b$ arises from the work of Akiyama [@Akiyama-2000] who classified Pisot units of degree 3 satisfying the so-called Property (F) concerning finiteness of certain $\beta$-expansions.)  Then $\beta$ generates an imaginary cubic Pisot field.  We will show that the set $\{{\langle\!\langle}\beta^i {\rangle\!\rangle}\mid i \in {{\mathbb{N}}}_0\} $ is generalised polynomial.  To this end, we use the results of Hubert and Messaoudi who studied the best approximations of the point $\theta=(\beta^{-1}, \beta^{-2})$ [@HubertMessaudi-2006 Theorem 1]. 

\[bambambabam\] Let the polynomial $P(x)=x^3-ax^2-bx-1$ with roots $\beta, \alpha, \bar{\alpha}$ be as above.  Define the sequence $(R_i)_{i\geq 0}$ by the recurrence formula $R_0=1$, $R_1=a$, $R_2=a^2+b$, $$R_{i}=aR_{i-1}+bR_{i-2}+R_{i-3}, \quad i\geq 3.$$ Then there exists a norm $N$ on ${{\mathbb{R}}}^2$ (called *a Rauzy norm*) such that the sequence of best approximations of the point $\theta=(\beta^{-1}, \beta^{-2})$ with respect to the norm $N$ coincides except for finitely many elements with the sequence $(R_i)$. Furthermore, there exists a sequence of real numbers $(m_q)_{q\geq 1}$ satisfying the following properties:

1.   \[bambambabam.mapprox\] There exists a constant $c>0$ such that for all $q\geq 1$ and $p\in {{\mathbb{Z}}}^2$ if $N(q\theta-p)<c$, then $$N(q\theta-p)=N_0(q\theta)=m_q.$$

2.   \[bambambabam.mmin\] If $q<R_i$, then $m_{R_i}<m_q$.

3.   \[bambambabam.mwzor\] For $i\geq 0$ we have $m_{R_i}=m_1|\alpha|^n$.

4.   We have $\liminf_{q\to \infty} m_q =0.$

5.   \[bambambabam.beta\] We have $$\beta^i=R_i + \frac{b\beta+1}{\beta^2} R_{i-1} + \frac{1}{\beta} R_{i-2}, \quad i\geq 2.$$

6.   \[bambambabam.nwzor\] The norm $N$ is given by the formula $$N(x)=|(\alpha+b/\beta)x_1+x_2/\beta|, \quad x=(x_1,x_2)\in {{\mathbb{R}}}^2.$$

This is proven in [@HubertMessaudi-2006 Theorem 1, Theorem 3, Corollary 2, Proposition 7, Lemma 4, Lemma 2, and formula (3)].  The sequence $m_q$ is denoted $N(\delta(q))$ there. 

The choice of the initial values of $(R_i)$ might seem unnatural.  Note however that it corresponds to $R_0=1$, $R_{-1}=R_{-2}=0$.

We are now ready to prove the following theorem. 

\[LAcrime\] Let $P$ be a polynomial $P(x)=x^3-ax^2-bx-1$ with integer coefficients $a,b$ satisfying ($a\geq 0$ and $0\leq b \leq a+1$) or ($a\geq 2$ and $b=-1$).  Assume that $P$ has a unique real root $\beta$ and that $\beta>1$. Then the set $\{{\langle\!\langle}\beta^i {\rangle\!\rangle}\mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

By Proposition \[przepraszamzetakpozno\], instead of ${\langle\!\langle}\beta^i {\rangle\!\rangle}$, we may study the sequence $R_i$ of the previous theorem.  It is easy to verify that the sequence $(R_i)$ is strictly increasing for $i\geq 6$. We will start by constructing a generalised polynomial $g \colon {{\mathbb{Z}}}\to {{\mathbb{R}}}$ that is increasing and which takes the value $g(q)=m_q^{-2}$ at points $q=R_i$ with $i$ sufficiently large.  The sequence $R_i$ satisfies a third order linear recurrence with characteristic polynomial $P$ and hence $$R_i=u\beta^i+v\alpha^i+w\bar{\alpha}^i$$ for some $u,v,w\in {\mathbb{C}}$. Hence, $\lim_{i\to \infty} (R_i-u\beta^i)=0$, and thus for $i$ large enough we have $$R_{i-1}={\langle\!\langle}R_{i}/\beta{\rangle\!\rangle}, \quad R_{i-2}={\langle\!\langle}R_{i}/\beta^2{\rangle\!\rangle}.$$ Define a generalised polynomial $g$ by the formula $$g(q)= m_1^{-2}\left(q + \frac{b\beta+1}{\beta^2} {\langle\!\langle}q/\beta {\rangle\!\rangle}+ \frac{1}{\beta}{\langle\!\langle}q/\beta^2{\rangle\!\rangle}\right), \quad q\in{{\mathbb{Z}}}.$$ Then by Theorem \[bambambabam\].(\[bambambabam.mwzor\]) and \[bambambabam\].(\[bambambabam.beta\]), we have $g(R_i)=m_1^{-2}|\beta|^{i}=m_{R_i}^{-2}$ for large $i$. (Note that $|\alpha|=|\beta|^{-1/2}$.) Furthermore, $g$ is increasing. 

Consider the set $$S=\{q\geq 1 \mid N_0(q\theta)<g(q)^{-1/2}\}.$$ Since the sequence $\{R_i \mid i\in {{\mathbb{N}}}_0 \}$ is up to finitely many terms the sequence of best approximations of $\theta$, applying Theorem \[bambambabam\].(\[bambambabam.mapprox\]) and \[bambambabam\].(\[bambambabam.mmin\]) and the fact that $g$ is increasing and $g(R_i)=m_{R_i}^{-2}$ tends to $0$ as $i\to \infty$, we see that $S$ coincides with the set $\{R_i \mid i\in {{\mathbb{N}}}_0\}$ up to a finite set.  In order to show that $S$ is generalised polynomial, it is enough to write the expression $N_0(q\theta)$ in terms of a generalised polynomial in $q$. We will do that under the additional assumption that $N_0(q\theta)$ is small.  Assume that $N_0(q\theta)< {\mathrm{Im}}(\alpha)/2$ and let $p=(p_1,p_2)\in {{\mathbb{Z}}}^2$ be such that $N_0(q\theta)=N(q\theta-p)$. By Theorem \[bambambabam\].(\[bambambabam.nwzor\]), we have $$N(q\theta-p)=|(\alpha+b/\beta)(q\beta^{-1}-p_1)+(q\beta^{-2}-p_2)/\beta|< {\mathrm{Im}}(\alpha)/2.$$ By looking at the imaginary part of the expression, it follows that $|q\beta^{-1}-p_1|<1/2$, and hence $p_1$ is uniquely determined as $p_1={\langle\!\langle}q\beta^{-1}{\rangle\!\rangle}.$ Since $p$ minimises $N(q\theta-p)$, we also have $$p_2={\langle\!\langle}\beta(\alpha+b/\beta)(q\beta^{-1}-p_1)+q\beta^{-2}{\rangle\!\rangle}.$$

Therefore we have $$\begin{aligned}
N_0(q\theta)\leq &|(\alpha+b/\beta)(q\beta^{-1}-{\langle\!\langle}q\beta^{-1}{\rangle\!\rangle})+\\+&(q\beta^{-2}-{\langle\!\langle}\beta(\alpha+b/\beta)(q\beta^{-1}-{\langle\!\langle}q\beta^{-1}{\rangle\!\rangle})+q\beta^{-2}{\rangle\!\rangle})/\beta|\end{aligned}$$ and equality holds if furthermore $N_0(q\theta)< {\mathrm{Im}}(\alpha)/2$. Call the expression on the right hand side of this inequality $h(q)$. Rewriting the norm in ${\mathbb{C}}$ in terms of the coordinates, we see that $h(q)^2$ is given by a generalised polynomial.  Therefore the set $$T=\{q\geq 1 \mid h(q)^2<g(q)^{-1}\}$$ coincides with $S$ up to a finite set.  Hence, the set $\{R_i \mid i\in {{\mathbb{N}}}_0\}$ is generalised polynomial. 

Concluding remarks
==================

We conclude with some general remarks and questions which naturally appeared during the work on this project. 

To begin with, we note that the difficulty in understanding the behaviour of arbitrary (possibly sparse) generalised polynomials should not come as a surprise.  Indeed, many deep questions in number theory can be reduced to the task of deciding whether a certain generalised polynomial is identically $0$ or not.  We cite one example which we find particularly striking. 

Let ${\alpha},{\beta}\in {\mathbb{R}}$ and ${\varepsilon}> 0$. Then the generalised polynomial $f \colon {\mathbb{N}}\to \{0,1\}$ given by $$f(n) = {\left\llbracket  n {\left\lVert n{\alpha}\right\rVert} {\left\lVert n {\beta}\right\rVert} < {\varepsilon}\right\rrbracket}$$ is not identically $0$.

It is known by the work of Einsiedler, Katok and Lindenstrauss [@EinsiedlerKatokLindenstrauss-2006] that the set of $({\alpha},{\beta})$ for which the above fails is either empty or of Hausdorff dimension $0$, but the conjecture remains unresolved. 

In a companion paper, we study automatic sequences that are given by generalised polynomials.  We reduce the problem considered there to the question whether the set ${\left\{ k^t \ \middle| \ t \in {\mathbb{N}}\right\} }$ is generalised polynomial; we suspect it is not.  On the other hand, by Example \[ex:lin-rec-is-gp\], the set of Fibonacci numbers, which can be essentially written as ${\left\{  {\langle\!\langle}\varphi^t {\rangle\!\rangle}\ \middle| \  t \in {\mathbb{N}}\right\} }$, where $\varphi = (1+\sqrt{5})/2$, is generalised polynomial.  Similarly, in Proposition \[thm:quadraticPisotisGP\], Theorem \[LAcrime\] and Proposition \[przepraszamzetakpozno\] we show that the sets of values of certain classes of linear recurrence sequences of degree two and three are generalised polynomial, and the same is the case for the set ${\left\{  {\langle\!\langle}\beta^t {\rangle\!\rangle}\ \middle| \  t \in {\mathbb{N}}\right\} }$, where $\beta$ is either a quadratic Pisot unit or a certain non-totally real cubic Pisot unit.  This suggests the following questions. 

\[Q:Pisot\] For which $\lambda > 1$ is the set $$E_\lambda = {\left\{ {\langle\!\langle}\lambda^i {\rangle\!\rangle}\ \middle| \ i \in {\mathbb{N}}_0 \right\} }$$ generalised polynomial? 

We note that the set of such $\lambda$ includes at least all the Pisot units of degree $2$ and some Pisot units of degree $3$. We may state a more precise version of the previous question. 

\[Q:truePisot\] Let $\beta$ be a Pisot number.  Is it true that if the set $$E_\beta = {\left\{ {\langle\!\langle}\beta^i {\rangle\!\rangle}\ \middle| \ i \in {\mathbb{N}}_0 \right\} }$$ is generalised polynomial, then $\beta$ is a Pisot unit?  Does the converse hold? 

An intimately related question is the following one. 

\[Q:linearrecurrent\] For which linear recurrence sequences $n=(n_i)_{i\geq 0}$ with values in ${{\mathbb{Z}}}$ is the set $$E_n= {\left\{  n_i  \ \middle| \ i \in {{\mathbb{N}}}_0 \right\} }$$ generalised polynomial? 

By Proposition \[przepraszamzetakpozno\], Question \[Q:truePisot\] can be regarded as a special case of Question \[Q:linearrecurrent\]. 

Looking at these examples from the perspective of recursive relations with non-constant coefficients (as in Remark \[lawnmower\]), we may also ask the following question. 

\[Q:BApprox\] Let $(n_i)_{i\geq 0}$ be a sequence given by $n_0 = 0,\ n_1 = 1$ and the recursive relation $$n_{i} = a_i n_{i-1} + b_i n_{i-2},$$ with $a_i,b_i \in {\mathbb{Z}}$ bounded in absolute value.  For which $a = (a_i)_{i\geq 0},\ b = (b_i)_{i\geq 0}$ is the set $$E_{a,b} = {\left\{ n_i \ \middle| \ i \in {\mathbb{N}}\right\} }$$ generalised polynomial?