# Spherical higher order Fourier analysis over finite fields IV: an
application to the Geometric Ramsey Conjecture

Wenbo Sun  Department of Mathematics, Virginia Tech, 225 Stanger Street,
Blacksburg, VA, 24061, USA<EMAIL_ADDRESS>
###### Abstract.

This paper is the fourth and the last part of the series _Spherical higher
order Fourier analysis over finite fields_ , aiming to develop the higher
order Fourier analysis method along spheres over finite fields, and to solve
the Geometric Ramsey Conjecture in the finite field setting.

In this paper, we proof a conjecture of Graham on the Remsey properties for
spherical configurations in the finite field setting. To be more precise, we
show that for any spherical configuration $X$ of $\mathbb{F}_{p}^{d}$ of
complexity at most $C$ with $d$ being sufficiently large with respect to $C$
and $|X|$, and for some prime $p$ being sufficiently large with respect to
$C$, $|X|$ and $\epsilon>0$, any set $E\subseteq\mathbb{F}_{p}^{d}$ with
$|E|>\epsilon p^{d}$ contains at least
$\gg_{C,\epsilon,|X|}p^{(k+1)d-(k+1)k/2}$ congruent copies of $X$, where $k$
is the dimension of $\text{span}_{\mathbb{F}_{p}}(X-X)$. The novelty of our
approach is that we avoid the use of harmonic analysis, and replace it by the
theory of spherical higher order Fourier analysis developed in previous parts
of the series.

The author was partially supported by the NSF Grant DMS-2247331

###### Contents

  1. 1 Introduction
    1. 1.1 Geometric Ramsey Theorem over finite fields
    2. 1.2 Strategy of the proof
    3. 1.3 Definitions and notations
  2. 2 Algebraic structures for configurations
    1. 2.1 Generating sets
    2. 2.2 $M$-spherical sets
    3. 2.3 Different notions of congruency
  3. 3 Some preliminary reductions of the density Ramsey theorem
    1. 3.1 A variation of Theroem 1.1 over spheres
    2. 3.2 Definitions and conventions
  4. 4 Bounding spherical averages by spherical Gowers norms
  5. 5 The rationality of polynomial sequences
    1. 5.1 Type-III horizontal torus and character
    2. 5.2 The rationality version of the factorization theorem
    3. 5.3 Structure theorems for spherical Gowers norms
  6. 6 Equisitribution properties for polynomial sequences on product spaces
    1. 6.1 Parametrization for $\Omega$ and its relative self-products
    2. 6.2 The joint equidistribution theorem
  7. 7 Proof of Theorem 3.1
  8. A Background materials for polynomials and nilmanifolds
    1. A.1 Polynomials
    2. A.2 Nilmanifolds, filtrations and polynomial sequences
    3. A.3 The Baker-Campbell-Hausdorff formula
    4. A.4 Type-I horizontal torus and character
  9. B Results for $M$-sets from previous papers
    1. B.1 The rank of quadratic forms
    2. B.2 Some basic counting properties
    3. B.3 $M$-families and $M$-sets
    4. B.4 Fubini’s theorem for $M$-sets
    5. B.5 Intrinsic definitions for polynomials
    6. B.6 An irreducible property for $M$-sets
    7. B.7 Leibman dichotomy for $M$-sets

##  1\. Introduction

###  1.1. Geometric Ramsey Theorem over finite fields

This paper is the forth and last part of the series _Spherical higher order
Fourier analysis over finite fields_ [20, 21, 22]. The purpose of this paper
is to use the tools developed in [20, 21, 22] to solve the Geometric Ramsey
Conjecture in the finite field setting. Geometric Ramsey theory is a topic
first introduced in a series of papers by Erdös et al. [4, 5, 6], which
studies geometric patterns that can not be destroyed by partitioning Euclidean
space into finitely many parts. We say that a finite set $X$ is _geometrically
Ramsey_ if for every $r\in\mathbb{N}_{+}$, there exists a dimension $d=d(r,X)$
such that every $r$-coloring of $\mathbb{R}^{d}$ contains a monochromatic and
congruent copy of $\lambda X$ for sufficiently large $\lambda>0$. It was shown
in [4] that geometrically Ramsey sets must be _spherical_ , meaning that $E$
is contained in the surface of a sphere. This led to a longstanding problem in
combinatorics called the _Geometric Ramsey Conjecture_ made by Graham [8],
saying that a finite set $E\subseteq\mathbb{R}^{d}$ is geometrically Ramsey if
and only if it is spherical.

This conjecture is far from being settled and only partial results are known,
including vertices of $k$-dimensional cubes [4], non-degenerating simplices
[1, 7] (see also [16]), products of simplices [17], trapezoids [14], regular
polygons and polyhedra [13].

Since vector spaces over finite fields are useful models to study many
problems in combinatorics and number theory, it is natural to ask whether
Graham’s conjecture holds in this setting. We start with some definitions. For
$x=(x_{1},\dots,x_{d}),y=(y_{1},\dots,y_{d})\in\mathbb{F}_{p}^{d}$, define the
_dot product_ by $x\cdot y:=x_{1}y_{1}+\dots+x_{d}y_{d}\in\mathbb{F}_{p}$ and
let $|x|^{2}:=x\cdot x$. For convenience we call an ordered finite subset of
$\mathbb{F}_{p}^{d}$ to be a _configuration_ in $\mathbb{F}_{p}^{d}$. Let
$X=\\{x_{j}\colon j\in J\\}\subseteq\mathbb{F}_{p}^{d}$ and $Y=\\{y_{j}\colon
j\in J\\}\subseteq\mathbb{F}_{p}^{d}$ be two configurations in
$\mathbb{F}_{p}^{d}$. We say that $Y$ is _congruent_ to $X$ if there exist an
isometry $U$ on $\mathbb{F}_{p}^{d}$ (i.e.
$U\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}^{d}$ is a linear transformation
such that $|U(x)|^{2}=|x|^{2}$ for all $x\in\mathbb{F}_{p}^{d}$) and
$z\in\mathbb{F}_{p}^{d}$ such that $y_{j}=z+U(x_{j})$ for all $j\in J$. We say
that $X\subseteq\mathbb{F}_{p}^{d}$ is _spherical_ if there exist
$u_{0}\in\mathbb{F}_{p}^{d}$ and $r\in\mathbb{F}_{p}$ such that
$|u-u_{0}|^{2}=r$ for all $u\in X$.

Instead of studying the Geometric Ramsey Conjecture in the finite field
setting, we formulate a density version of it as follows: for any spherical
configuration $X\subseteq\mathbb{F}_{p}^{d}$ and any subset
$E\subseteq\mathbb{F}_{p}^{d}$ with $|E|>\epsilon p^{d}$, $E$ contains a
congruent copy of $X$ if $p$ is sufficiently large depending on $d$ and $X$.
We remark that the Geometric Ramsey Conjecture in the finite field setting
fails for non-spherical configurations by Lemma 17 of [18].

In this paper, we provide an affirmative answer to the density version of the
Geometric Ramsey Conjecture in the finite field setting for general spherical
configurations. For any $X\subseteq\mathbb{F}_{p}^{d}$, let
$k:=\dim(\text{span}_{\mathbb{F}_{p}}(X-X))$, $s:=|X|-k\geq 1$, and denote

(1.1)
$\begin{split}d_{0}(X):=\max\\{(2s+12)(15s+423),4k^{2}+12k+7\\}.\end{split}$

######  Theorem 1.1 (Density version of the Geometric Ramsey Theorem for
finite fields).

Let $d\in\mathbb{N}_{+}$, $C,\epsilon>0$, $p$ be a prime and
$X\subseteq\mathbb{F}_{p}^{d}$ be a spherical configuration of complexity at
most $C$ (see Definition 2.2). Denote
$k:=\dim(\text{span}_{\mathbb{F}_{p}}(X-X))$, $s:=|X|-k\geq 1$ and suppose
that $d\geq d_{0}(X)$. There exists $p_{0}=p_{0}(C,\epsilon,k,s)\in\mathbb{N}$
and $\delta=\delta(C,\epsilon,k,s)>0$ such that if $p>p_{0}$, then every set
$E\subseteq\mathbb{F}_{p}^{d}$ with $|E|>\epsilon p^{d}$ contains at least
$\delta p^{(k+1)d-(k+1)k/2}$ congruent copies of $X$.

We remark that the quantity $p^{(k+1)d-(k+1)k/2}$ arises from the observation
that a random subset $E$ of $\mathbb{F}_{p}^{d}$ contains approximately
$\epsilon^{|X|}p^{(k+1)d-(k+1)k/2}$ isometric copies of $X$ (see Section 2.2
for the definition), where $k$ is the dimension of
$\text{span}_{\mathbb{F}_{p}}(X-X)$. This is because there are $k(k+1)/2$
quadratic relations given by distances between the points in the generating
set of $X$, which determines the locations of all other points in $X$, and
each vertex is contained in $E$ with probability $\epsilon$ (see also page 2
of [18]).

The case $s=1$ of Theorem 1.1, where $X$ is a simplex was proved by Parshall
[19] (which can be viewed as an extension Bourgain’s work [1]). For the case
$s=2$, Theorem 1.1 was proved by Lyall, Magyar and Parshall [18] under the
additional assumption that $X$ is _non-degenerate_ (meaning that $X-X$ is a
non-isotropic subspace of $\mathbb{F}_{p}^{d}$).111The main result Theorem 1
in [18] was stated only for isometric copies, but its proof also applies to
the case of congruent copies. It is worth noting that the quantity $\delta$ in
the aforementioned results was independent of the complexity of $X$, whereas
in Theorem 1.1, unfortunately we were unable to drop the dependency on the
complexity of the configuration. So it is natural to ask:

######  Question 1.2.

Can we remove the dependence of $p_{0}$ and $\delta$ on $C$ in Theorem 1.1?

The lower bound of $d$ we obtain in Theorem 1.1 is rather coarse. So it is
also natural to ask:

######  Question 1.3.

What is the optimal lower bound for $d$ in Theorem 1.1?

###  1.2. Strategy of the proof

The study of the Geometric Ramsey Conjecture in literature uses methods from
classical harmonic analysis. Relying on meticulous estimates on Fourier
coefficients, such methods proved to be powerful when $s\leq 2$ or when the
configuration enjoys some extra symmetric properties. However, the harmonic
analysis methods no longer work when $s\geq 3$. This is because the Fourier
coefficient is insufficient to describe the spherical averages (see for
example (4.1)) pertaining to this problem.

In this paper, instead of using harmonic analysis, we use the approach of the
higher order Fourier analysis developed in the previous parts of the series
[20, 21, 22]. In Section 2, we provide some basic algebraic properties which
will be used in later sections. In Section 3, by reducing Theorem 1.1 to
Theorem 3.1, we show that it suffices to consider the Geometric Ramsey
Conjecture for subsets of a sphere.

The problem is then reduced to show the positivity of a spherical average of
the form (4.1). Motivated by the work of Lyall, Magyar and Parshall [18], we
show in Section 4 that (4.1) can be bounded by the spherical Gowers norms of
the functions $f_{i}$. Then in Section 5, based on the work in the previous
parts of the series [20, 22], we provide a structure theorem for spherical
Gowers norms. It turns out that the factorization result in [20] is not good
for our purposes, and so we provide a better version of it based on the idea
of Green and Tao [9].

The structure theorem essentially allows us to reduce the expression (4.1) to
the case where $f_{i}$ are sufficiently irrational nilsequences. In Section 6,
by developing the approach of Green and Tao [9], we prove a joint
equidistribution result (Theorem 6.5) which can be used to deal with this
case. Finally, in Section 7, we combine all the results in previous sections
to complete the proof of Theorem 3.1 and thus Theorem 1.1.

In Appendix A, we recall some notations on polynomials and nilmanifolds
defined in [20]. In Appendix B, we collect some results from previous parts of
the series [20, 22] which are used in this paper.

###  1.3. Definitions and notations

######  Convention 1.4.

Throughout this paper, we use $\tau\colon\mathbb{F}_{p}\to\\{0,\dots,p-1\\}$
to denote the natural bijective embedding, and use
$\iota\colon\mathbb{Z}\to\mathbb{F}_{p}$ to denote the map given by
$\iota(n):=\tau^{-1}(n\mod p\mathbb{Z})$. We also use $\tau$ to denote the map
from $\mathbb{F}_{p}^{k}$ to $\mathbb{Z}^{k}$ given by
$\tau(x_{1},\dots,x_{k}):=(\tau(x_{1}),\dots,\tau(x_{k}))$, and $\iota$ to
denote the map from $\mathbb{Z}^{k}$ to $\mathbb{F}_{p}^{k}$ given by
$\iota(x_{1},\dots,x_{k}):=(\iota(x_{1}),\dots,$ $\iota(x_{k}))$.

We may also extend the domain of $\iota$ to all the rational numbers of the
form $x/y$ with $(x,y)=1,x\in\mathbb{Z},y\in\mathbb{Z}\backslash p\mathbb{Z}$
by setting $\iota(x/y):=\iota(xy^{\ast})$, where $y^{\ast}$ is any integer
with $yy^{\ast}\equiv 1\mod p\mathbb{Z}$.

Below are the notations we use in this paper:

  * •

Let
$\mathbb{N},\mathbb{N}_{+},\mathbb{Z},\mathbb{Q},\mathbb{R},\mathbb{R}+,\mathbb{C}$
denote the set of non-negative integers, positive integers, integers, rational
numbers, real numbers, positive real numbers, and complex numbers,
respectively. Denote $\mathbb{T}:=\mathbb{R}/\mathbb{Z}$. Let $\mathbb{F}_{p}$
denote the finite field with $p$ elements.

  * •

Throughout this paper, $d$ is a fixed positive integer and $p$ is a prime
number.

  * •

Throughout this paper, unless otherwise stated, all vectors are assumed to be
horizontal vectors.

  * •

Let $\mathcal{C}$ be a collection of parameters and $A,B,c\in\mathbb{R}$. We
write $A\gg_{\mathcal{C}}B$ if $|A|\geq K|B|$ and $A=O_{\mathcal{C}}(B)$ if
$|A|\leq K|B|$ for some $K>0$ depending only on the parameters in
$\mathcal{C}$. In the above definitions, we allow the set $\mathcal{C}$ to be
empty. In this case $K$ will be a universal constant.

  * •

Denote $[p]:=\\{0,\dots,p-1\\}$,

  * •

For $i=(i_{1},\dots,i_{k})\in\mathbb{Z}^{k}$, denote
$|i|:=|i_{1}|+\dots+|i_{k}|$. For $n=(n_{1},\dots,n_{k})\in\mathbb{Z}^{k}$ and
$i=(i_{1},\dots,i_{k})\in\mathbb{N}^{k}$, denote $n^{i}:=n_{1}^{i_{1}}\dots
n_{k}^{i_{k}}$ and $i!:=i_{1}!\dots i_{k}!$. For
$n=(n_{1},\dots,n_{k})\in\mathbb{N}^{k}$ and
$i=(i_{1},\dots,i_{k})\in\mathbb{N}^{k}$, denote
$\binom{n}{i}:=\binom{n_{1}}{i_{1}}\dots\binom{n_{k}}{i_{k}}$.

  * •

We say that $\mathcal{F}\colon\mathbb{R}_{+}\to\mathbb{R}_{+}$ is a _growth
function_ if $\mathcal{F}$ is strictly increasing and $\mathcal{F}(n)\geq n$
for all $n\in\mathbb{R}_{+}$.

  * •

For $x\in\mathbb{R}$, let $\lfloor x\rfloor$ denote the largest integer which
is not larger than $x$, and $\lceil x\rceil$ denote the smallest integer which
is not smaller than $x$. Let $\\{x\\}:=x-\lfloor x\rfloor$.

  * •

Let $X$ be a finite set and $f\colon X\to\mathbb{C}$ be a function. Denote
$\mathbb{E}_{x\in X}f(x):=\frac{1}{|X|}\sum_{x\in X}f(x)$, the average of $f$
on $X$.

  * •

For $F=\mathbb{Z}^{k}$ or $\mathbb{F}_{p}^{k}$, and
$x=(x_{1},\dots,x_{k}),y=(y_{1},\dots,y_{k})\in F$, let $x\cdot
y\in\mathbb{Z}$ or $\mathbb{F}_{p}$ denote the dot product given by $x\cdot
y:=x_{1}y_{1}+\dots+x_{k}y_{k}.$

  * •

If $G$ is a connected, simply connected Lie group, then we use $\log G$ to
denote its Lie algebra. Let $\exp\colon\log G\to G$ be the exponential map,
and $\log\colon G\to\log G$ be the logarithm map. For $t\in\mathbb{R}$ and
$g\in G$, denote $g^{t}:=\exp(t\log g)$.

  * •

If $f\colon H\to G$ is a function from an abelian group $H=(H,+)$ to some
group $(G,\cdot)$, denote $\Delta_{h}f(n):=f(n+h)\cdot f(n)^{-1}$ for all
$n,h\in H$.

  * •

If $f\colon H\to\mathbb{C}$ is a function on an abelian group $H=(H,+)$,
denote $\Delta_{h}f(n):=f(n+h)\overline{f}(n)$ for all $n,h\in H$.

  * •

We write affine subspaces of $\mathbb{F}_{p}^{d}$ as $V+c$, where $V$ is a
subspace of $\mathbb{F}_{p}^{d}$ passing through $\mathbb{0}$, and
$c\in\mathbb{F}_{p}^{d}$.

  * •

There is a natural correspondence between polynomials taking values in
$\mathbb{F}_{p}$ and polynomials taking values in $\mathbb{Z}/p$. Let
$F\in\text{poly}(\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}^{d^{\prime}})$ and
$f\in\text{poly}(\mathbb{Z}^{d}\to(\mathbb{Z}/p)^{d^{\prime}})$ be polynomials
of degree at most $s$ for some $s<p$. If $F=\iota\circ pf\circ\tau$, then we
say that $F$ is _induced_ by $f$ and $f$ is a _lifting_ of $F$.222As is
explained in [20], $\iota\circ pf\circ\tau$ is well defined. We say that $f$
is a _regular lifting_ of $F$ if in addition $f$ has the same degree as $F$
and $f$ has $\\{0,\frac{1}{p},\dots,\frac{p-1}{p}\\}$-coefficients.

  * •

Let $(X,d_{X})$ be a metric space. The _Lipschitz norm_ of a function $F\colon
X\to\mathbb{C}$ is defined as

$\|F\|_{\text{Lip}(X)}:=\sup_{x\in X}|F(x)|+\sup_{x,y\in X,x\neq
y}\frac{|F(x)-F(y)|}{d_{X}(x,y)}.$

When there is no confusion, we write
$\|F\|_{\text{Lip}}=\|F\|_{\text{Lip}(X)}$ for short.

Let $D,D^{\prime}\in\mathbb{N}_{+}$ and $C>0$. Here are some basic notions of
complexities:

  * •

Real and complex numbers: a number $r\in\mathbb{R}$ is of _complexity_ at most
$C$ if $r=a/b$ for some $a,b\in\mathbb{Z}$ with $-C\leq a,b\leq C$. If
$r\notin\mathbb{Q}$, then we say that the complexity of $r$ is infinity. A
complex number is of _complexity_ at most $C$ if both its real and imaginary
parts are of complexity at most $C$.

  * •

Vectors and matrices: a vector or matrix is of _complexity_ at most $C$ if all
of its entries are of complexity at most $C$.

  * •

Subspaces: a subspace of $\mathbb{R}^{D}$ is of _complexity_ at most $C$ if it
is the null space of a matrix of complexity at most $C$.

  * •

Linear transformations: let $L\colon\mathbb{C}^{D}\to\mathbb{C}^{D^{\prime}}$
be a linear transformation. Then $L$ is associated with an $D\times
D^{\prime}$ matrix $A$ in $\mathbb{C}$. We say that $L$ is of _complexity_ at
most $C$ if $A$ is of complexity at most $C$.

  * •

Lipschitz function: the _complexity_ of a Lipschitz function is defined to be
its Lipschitz norm.

We also need to recall the notations regarding quadratic forms defined in
[20].

######  Definition 1.5.

We say that a function $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ is a
_quadratic form_ if

$M(n)=(nA)\cdot n+n\cdot u+v$

for some $d\times d$ symmetric matrix $A$ in $\mathbb{F}_{p}$, some
$u\in\mathbb{F}_{p}^{d}$ and $v\in\mathbb{F}_{p}$. We say that $A$ is the
matrix _associated to_ $M$. We say that $M$ is _pure_ if $u=\mathbb{0}$. We
say that $M$ is _homogeneous_ if $u=\mathbb{0}$ and $v=0$. We say that $M$ is
_non-degenerate_ if $M$ is of rank $d$, or equivalently, $\det(A)\neq 0$.

We use $\text{rank}(M):=\text{rank}(A)$ to denote the _rank_ of $M$. Let $V+c$
be an affine subspace of $\mathbb{F}_{p}^{d}$ of dimension $r$. There exists a
(not necessarily unique) bijective linear transformation
$\phi\colon\mathbb{F}_{p}^{r}\to V$. We define the _rank_
$\text{rank}(M|_{V+c})$ of $M$ restricted to $V+c$ as the rank of the
quadratic form $M(\phi(\cdot)+c)$. It was proved in [20] that
$\text{rank}(M|_{V+c})$ is independent of the choice of $\phi$.

We also need to use the following notions.

  * •

For a polynomial $P\in\text{poly}(\mathbb{F}_{p}^{k}\to\mathbb{F}_{p})$, let
$V(P)$ denote the set of $n\in\mathbb{F}_{p}^{k}$ such that $P(n)=0$.

  * •

Let $r\in\mathbb{N}_{+}$, $h_{1},\dots,h_{r}\in\mathbb{F}_{p}^{d}$ and
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a quadratic form. Denote

$V(M)^{h_{1},\dots,h_{r}}:=\cap_{i=1}^{r}(V(M(\cdot+h_{i}))\cap V(M).$

  * •

Let $\Omega$ be a subset of $\mathbb{F}_{p}^{d}$ and $s\in\mathbb{N}$. Let
$\Box_{s}(\Omega)$ denote the set of
$(n,h_{1},\dots,h_{s})\in(\mathbb{F}_{p}^{d})^{s+1}$ such that
$n+\epsilon_{1}h_{1}+\dots+\epsilon_{s}h_{s}\in\Omega$ for all
$(\epsilon_{1},\dots,\epsilon_{s})\in\\{0,1\\}^{s}$. Here we allow $s$ to be
0, in which case $\Box_{0}(\Omega)=\Omega$. We say that $\Box_{s}(\Omega)$ is
the _$s$ -th Gowers set_ of $\Omega$.

Quadratic forms can also be defined in the $\mathbb{Z}/p$-setting.

######  Definition 1.6.

We say that a function $M\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$ is a _quadratic
form_ if

$M(n)=\frac{1}{p}((nA)\cdot n+n\cdot u+v)$

for some $d\times d$ symmetric matrix $A$ in $\mathbb{Z}$, some
$u\in\mathbb{Z}^{d}$ and $v\in\mathbb{Z}$. We say that $A$ is the matrix
_associated to_ $M$.

By Lemma A.1 of [20], any quadratic form
$\tilde{M}\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$ associated with the matrix
$\tilde{A}$ induces a quadratic form $M:=\iota\circ
p\tilde{M}\circ\tau\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ associated with
the matrix $\iota(\tilde{A})$. Conversely, any quadratic form
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ associated with the matrix $A$
admits a regular lifting $\tilde{M}\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$, which
is a quadratic form associated with the matrix $\tau(A)$.

For a quadratic form $\tilde{M}\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$, we say
that $\tilde{M}$ is _pure/homogeneous/ $p$-non-degenerate_ if the quadratic
form $M:=\iota\circ p\tilde{M}\circ\tau$ induced by $\tilde{M}$ is
pure/homogeneous/non-degenerate. The _$p$ -rank_ of $\tilde{M}$, denoted by
$\text{rank}_{p}(\tilde{M})$, is defined to be the rank of $M$.

We say that $h_{1},\dots,h_{k}\in\mathbb{Z}^{d}$ are _$p$ -linearly
independent_ if for all $c_{1},\dots,c_{k}\in\mathbb{Z}/p$,
$c_{1}h_{1}+\dots+c_{k}h_{k}\in\mathbb{Z}$ implies that
$c_{1},\dots,c_{k}\in\mathbb{Z}$, or equivalently, if
$\iota(h_{1}),\dots,\iota(h_{k})$ are linearly independent.

We also need to use the following notions.

  * •

For a polynomial $P\in\text{poly}(\mathbb{Z}^{k}\to\mathbb{R})$, let
$V_{p}(P)$ denote the set of $n\in\mathbb{Z}^{k}$ such that
$P(n+pm)\in\mathbb{Z}$ for all $m\in\mathbb{Z}^{k}$.

  * •

For $\Omega\subseteq\mathbb{Z}^{d}$ and $s\in\mathbb{N}$, let
$\Box_{p,s}(\Omega)$ denote the set of
$(n,h_{1},\dots,h_{s})\in(\mathbb{Z}^{d})^{s+1}$ such that
$n+\epsilon_{1}h_{1}+\dots+\epsilon_{s}h_{s}\in\Omega+p\mathbb{Z}^{d}$ for all
$\epsilon_{1},\dots,\epsilon_{s}\in\\{0,1\\}$. We say that
$\Box_{p,s}(\Omega)$ is the _$s$ -th $p$-Gowers set_ of $\Omega$.

For all other definitions and notations which are used but not mentioned in
this paper, we refer the readers to Appendices A and B for details.

##  2\. Algebraic structures for configurations

In this section, we provide some basic properties for various algebraic
structures pertaining to the Geometric Ramsey Conjecture.

###  2.1. Generating sets

Let $X=\\{x_{j}\in\mathbb{F}_{p}^{d}\colon j\in
J\\}\subseteq\mathbb{F}_{p}^{d}$ be a configuration in $\mathbb{F}_{p}^{d}$
with $J$ being a finite ordered index set. Let $I$ be a subset of $J$. We say
that $I$ is a _generating set_ of $X$ if the vectors $x_{i}-x_{i_{0}},i\in
I\backslash\\{i_{0}\\}$ is a basis of $\text{span}_{\mathbb{F}_{p}}(X-X)$ for
some $i_{0}\in I$. The following lemma is straightforward and we omit its
proof.

######  Lemma 2.1.

$X=\\{x_{j}\in\mathbb{F}_{p}^{d}\colon j\in J\\}\subseteq\mathbb{F}_{p}^{d}$
be a configuration in $\mathbb{F}_{p}^{d}$ with $J$ being a finite ordered
index set.

  1. (i)

A subset $I\subseteq J$ is a generating set of $X$ if and only if the vectors
$x_{i}-x_{i_{0}},i\in I\backslash\\{i_{0}\\}$ is a basis of
$\text{span}_{\mathbb{F}_{p}}(X-X)$ for every $i_{0}\in I$. In particular, the
cardinalities of generating sets of $X$ are the same.

  2. (ii)

For every $j\in J$, there exists a generating set $I\subseteq J$ of $X$
containing $j$.

If $I$ is a generating set of $X$, then it is clear that there exist unique
$b_{I,i,j}\in\mathbb{F}_{p},i\in I,j\in J$ such that $\sum_{i\in
I}b_{I,i,j}=1$ and $x_{j}=\sum_{i\in I}b_{I,i,j}x_{i}$ for all $j\in J$. We
remark that $b_{I,i,j},i\in I,j\in J$ satisfy the following _normalization
property:_

$b_{I,i,j}=\delta_{i,j}$ for all $i,j\in I$ and $\sum_{i\in I}b_{I,i,j}=1$ for
all $j\in J$.

Let $L_{I,j}\colon(\mathbb{F}_{p}^{d})^{|I|}\to\mathbb{F}_{p}^{d}$ denote the
linear transformation given by

$L_{I,j}(\mathbb{x}):=\sum_{i\in I}b_{I,i,j}x_{i},$

and let
$\mathbb{L}_{I}\colon(\mathbb{F}_{p}^{d})^{|I|}\to(\mathbb{F}_{p}^{d})^{|J|}$
denote the linear transformation given by

$\mathbb{L}_{I}(\mathbb{x}):=(L_{I,j}(\mathbb{x}))_{j\in J}.$

We say that $L_{I,j},j\in J$ (or simply $\mathbb{L}_{I}$) are the _generating
maps_ for $X$ with respect to $I$, and $b_{I,i,j},i\in I,j\in J$ (or
$b_{I,i},i\in I$) are the _generating constants_ for $X$ with respect to $I$.
We remark that the normalization property of $b_{I,i,j}$ implies the following
_normalization property_ for $L_{I,j}$:

$L_{I,j}((x_{i})_{i\in I})=x_{j}$ for all $j\in I$ and $L_{I,j}(x,\dots,x)=x$
for all $j\in I$.

We are now ready to define the complexity of a configuration.

######  Definition 2.2 (Complexity of configurations).

Let $C>0$. We say that a configuration $X\subseteq\mathbb{F}_{p}^{d}$ is of
_complexity_ at most $C$ if there exists a generating set $I$ of $X$ such that
all the generating constants for $X$ with respect to $I$ belong to
$\\{-C,\dots,C\\}$.

In particular, if $X\subseteq\\{-C,\dots,C\\}^{d}$, then $X$ is of complexity
at most $O_{C,k}(1)$, where $k=\dim(\text{span}_{\mathbb{F}_{p}}(X-X))$.

Next we provide a change of variable property for generating maps.

######  Proposition 2.3 (Change of variable).

Let $d\in\mathbb{N}_{+},$ $p$ be a prime, $X$ be a configuration in
$\mathbb{F}_{p}^{d}$ with $J$ being a finite ordered index set, and
$I,I^{\prime}\subseteq J$ be two generating sets of $X$ with generating maps
$\mathbb{L}_{I}\colon(\mathbb{F}_{p}^{d})^{|I|}\to(\mathbb{F}_{p}^{d})^{|J|}$
and
$\mathbb{L}_{I^{\prime}}\colon(\mathbb{F}_{p}^{d})^{|I^{\prime}|}\to(\mathbb{F}_{p}^{d})^{|J|}$
respectively. Let
$\pi_{I}\colon(\mathbb{F}_{p}^{d})^{|J|}\to(\mathbb{F}_{p}^{d})^{|I|}$ be the
projection onto the coordinates with $I$-indices. Then we have that
$\mathbb{L}_{I}\circ\pi_{I}\circ\mathbb{L}_{I^{\prime}}=\mathbb{L}_{I^{\prime}}$.
In particular, we have
$\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1})=\mathbb{L}_{I^{\prime}}((\mathbb{F}_{p}^{d})^{k+1})$.

###### Proof.

Assume that $X=\\{v_{j}\colon j\in J\\}$ and let $b_{I,i,j},i\in I,j\in J$ and
$b_{I^{\prime},i,j},i\in I^{\prime},j\in J$ be the generating constants for
$X$ with respect to $I$ and $I^{\prime}$ respectively. We need to show that
for all $j\in J$ and $\mathbb{x}=(x_{i})_{i\in
I^{\prime}}\in(\mathbb{F}_{p}^{d})^{|I^{\prime}|}$, we have that

$\begin{split}L_{I,j}\circ\pi_{I}\circ\mathbb{L}_{I^{\prime}}(\mathbb{x})=L_{I^{\prime},j}(\mathbb{x}).\end{split}$

For any $j\in J$, we have that

$\begin{split}\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},j}v_{i^{\prime}}=v_{j}=\sum_{i\in
I}b_{I,i,j}v_{i}=\sum_{i\in I}b_{I,i,j}\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},i}v_{i^{\prime}}=\sum_{i^{\prime}\in
I^{\prime}}\Bigl{(}\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\Bigr{)}v_{i^{\prime}},\end{split}$

or equivalently,

(2.1) $\begin{split}\sum_{i^{\prime}\in
I^{\prime}}\Bigl{(}b_{I^{\prime},i^{\prime},j}-\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\Bigr{)}v_{i^{\prime}}=\mathbb{0}.\end{split}$

On the other hand, by the normalization property of $b_{I,i,j}$,

(2.2) $\begin{split}\sum_{i^{\prime}\in
I^{\prime}}\Bigl{(}b_{I^{\prime},i^{\prime},j}-\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\Bigr{)}=\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},j}-\sum_{i\in
I}b_{I,i,j}\Bigl{(}\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},i}\Bigr{)}=1-\sum_{i\in
I}b_{I,i,j}=0.\end{split}$

Since $I^{\prime}$ is a generating set of $X$, the vectors
$v_{i^{\prime}}-v_{i_{0}},i^{\prime}\in I^{\prime}\backslash\\{i_{0}\\}$ are
linearly independent for some $i_{0}\in I^{\prime}$. It then follows from
(2.1) and (2.2) that

(2.3) $\begin{split}b_{I^{\prime},i^{\prime},j}=\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\end{split}$

for all $j\in J$. So

$\begin{split}&\quad
L_{I,j}\circ\pi_{I}\circ\mathbb{L}_{I^{\prime}}(\mathbb{x})=\sum_{i\in
I}b_{I,i,j}(L_{I^{\prime},i}(\mathbb{x}))=\sum_{i\in
I}b_{I,i,j}\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},i}x_{i^{\prime}}\\\ &=\sum_{i^{\prime}\in
I^{\prime}}\Bigl{(}\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\Bigr{)}x_{i^{\prime}}=\sum_{i^{\prime}\in
I^{\prime}}b_{I^{\prime},i^{\prime},j}x_{i^{\prime}}=L_{I^{\prime},j}(\mathbb{x}).\end{split}$

We now prove that
$\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1})=\mathbb{L}_{I^{\prime}}((\mathbb{F}_{p}^{d})^{k+1})$.
Note that

$\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1})=\mathbb{L}_{I^{\prime}}\circ\pi_{I^{\prime}}\circ\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1})\subseteq\mathbb{L}_{I^{\prime}}((\mathbb{F}_{p}^{d})^{k+1}).$

Similarly,
$\mathbb{L}_{I^{\prime}}((\mathbb{F}_{p}^{d})^{k+1})\subseteq\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1}).$
This implies that
$\mathbb{L}_{I^{\prime}}((\mathbb{F}_{p}^{d})^{k+1})=\mathbb{L}_{I}((\mathbb{F}_{p}^{d})^{k+1}).$
∎

###  2.2. $M$-spherical sets

In this paper, instead of working with the inner product $|\cdot|^{2}$, it is
convenient to consider more general quadratic forms. Let
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a homogeneous quadratic form.
We say that a set $X\subseteq\mathbb{F}_{p}^{d}$ is _$M$ -spherical_ if there
exist $z\in\mathbb{F}_{p}^{d}$ and $r\in\mathbb{F}_{p}$ such that $M(x-z)=r$
for all $x\in X$. It is not hard to see that every simplex is $M$-spherical:

######  Lemma 2.4 (Simplices are $M$-spherical).

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate
homogeneous quadratic form and $X=\\{x_{i}\colon i\in J\\}$ be a configuration
in $\mathbb{F}_{p}^{d}$. Suppose that for some $i_{0}\in J$, the vectors
$x_{i}-x_{i_{0}},i\in J\backslash\\{i_{0}\\}$ are linearly independent. Then
$X$ is $M$-spherical.

###### Proof.

It suffices to show that there exists $z\in\mathbb{F}_{p}^{d}$ such that
$M(x_{i}-z)=M(x_{i_{0}}-z)$ for all $i\in J\backslash\\{i_{0}\\}$. This is
equivalent of solving the linear equation system $((x_{j}-x_{j_{0}})A)\cdot
z=b_{j},j\in J\backslash\\{j_{0}\\}$, where $A$ is the matrix associated to
$M$ and $b_{j}$ is some constant depending on $M$ and $X$. Since
$x_{j}-x_{j_{0}},j\in J\backslash\\{j_{0}\\}$ are linearly independent, so are
$(x_{j}-x_{j_{0}})A,j\in J\backslash\\{j_{0}\\}$ since $A$ is invertible. So
such $z\in\mathbb{F}_{p}^{d}$ exists by the knowledge of linear algebra, which
implies that $X$ is $M$-spherical. ∎

The following is a convenient criterion for $M$-spherical sets.

######  Lemma 2.5.

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate
homogeneous quadratic form. A configuration $X=\\{x_{j}\colon j\in J\\}$ in
$\mathbb{F}_{p}^{d}$ is $M$-spherical if and only if for any quadratic form
$M^{\prime}\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ whose associated matrix
is the same as $M$, and any $c_{j}\in\mathbb{F}_{p},j\in J$, if $\sum_{j\in
J}c_{j}=0,$ $\sum_{j\in J}c_{j}x_{j}=\mathbb{0}$, then $\sum_{j\in
J}c_{j}M^{\prime}(x_{j})=0$.

###### Proof.

The proof is almost identical to Lemma 16 of [18] and we write it down for
completeness. Assume that $M(n)=(nA)\cdot n$ and that $M^{\prime}(n)=(nA)\cdot
n+u\cdot n+v$ for some $u\in\mathbb{F}_{p}^{d}$ and $v\in\mathbb{F}_{p}$,
where $A$ is the matrix associated to $M$ and $M^{\prime}$. If $X$ is
$M$-spherical, then $M(x_{j}-z)=r$ for some $z\in\mathbb{F}_{p}^{d}$ and
$r\in\mathbb{F}_{p}$ for all $j\in J$. So

$M(x_{j})=r-M(z)+x_{j}\cdot(2zA)\text{ and
}M^{\prime}(x_{j})=r-M(z)+v+x_{j}\cdot(2zA+2u).$

Therefore,

$\sum_{j\in J}c_{j}M^{\prime}(x_{j})=\sum_{j\in J}c_{j}(r-M(z)+v)+\sum_{j\in
J}(c_{j}x_{j})\cdot(2zA+2u)=0.$

Conversely, suppose that $X$ is not $M$-spherical. We wish to construct
$c_{j}\in\mathbb{F}_{p},j\in J$ such that $\sum_{j\in J}c_{j}=0$,
$\sum_{i=0}^{k}c_{i}x_{i}=\mathbb{0}$, but
$\sum_{i=0}^{k}c_{i}M^{\prime}(x_{i})\neq 0$. We may assume without loss of
generality that $X$ is minimal in the sense that any proper subset of $X$ is
$M$-spherical. Fix any $j_{0}\in J$. Since $X$ is not $M$-spherical, by Lemma
2.4, $x_{j}-x_{j_{0}},j\in J\backslash\\{j_{0}\\}$ are linearly dependent. So
we may assume that $\sum_{j\in
J\backslash\\{j_{0}\\}}a_{j}(x_{j}-x_{j_{0}})=\mathbb{0}$ for some
$a_{j}\in\mathbb{F}_{p}$ not all equal to 0. Assume that $a_{j_{1}}\neq 0$ for
some $j_{1}\in J\backslash\\{j_{0}\\}$.

Let $X^{\prime}$ denote the configuration $\\{x_{j}\colon j\in
J\backslash\\{j_{1}\\}\\}$. By the minimality of $X$, $X^{\prime}$ is
$M$-spherical. So $M(x_{j}-z)=r$ for some $z\in\mathbb{F}_{p}^{d}$ and
$r\in\mathbb{F}_{p}$ for all $j\in J\backslash\\{j_{1}\\}$. Since $X$ is not
$M$-spherical, $M(x_{j_{1}}-z)-r=t\neq 0$. It is not hard to see that

$M(x_{j})-M(x_{j_{0}})=(x_{j}-x_{j_{0}})\cdot(2zA)$

for all $j\in J\backslash\\{j_{0},j_{1}\\}$, and

$M(x_{j_{1}})-M(x_{j_{0}})=(x_{j_{1}}-x_{j_{0}})\cdot(2zA)+t.$

Since $\sum_{j\in J\backslash\\{j_{0}\\}}a_{j}(x_{j}-x_{j_{0}})=0$, we have
that

$\begin{split}&\quad\sum_{j\in
J\backslash\\{j_{0}\\}}a_{j}(M^{\prime}(x_{j})-M^{\prime}(x_{j_{0}}))=\sum_{j\in
J\backslash\\{j_{0}\\}}a_{j}(M(x_{j})-M(x_{j_{0}}))\\\ &=\sum_{j\in
J\backslash\\{j_{0}\\}}a_{j}(x_{j}-x_{j_{0}})\cdot(2zA)+a_{j_{1}}t=a_{j_{1}}t\neq
0.\end{split}$

We are done by taking $c_{j_{0}}=-\sum_{j\in J\backslash\\{j_{0}\\}}a_{j}$ and
$c_{j}=a_{j}$ for all $j\in J\backslash\\{j_{0}\\}$. ∎

As a corollary of Lemma 2.5, we have the following generalization of Lemma 5
of [18]:

######  Corollary 2.6.

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate
homogeneous quadratic form and $X=\\{x_{j}\colon j\in J\\}$ be an
$M$-spherical configuration in $\mathbb{F}_{p}^{d}$. Let $I$ be a generating
set of $X$ with $L_{I,j},j\in J$ be its generating maps. If $M(y_{i}-z)=r$ for
some $z,y_{i}\in\mathbb{F}_{p}^{d}$ and $r\in\mathbb{F}_{p}$ for all $i\in I$,
then $M(L_{I,j}((y_{i})_{i\in I})-z)=r$ for all $j\in J$.

In particular, if $M(x_{i}-z)=r$ for some $z\in\mathbb{F}_{p}^{d}$ and
$r\in\mathbb{F}_{p}$ for all $i\in I$, then $M(x_{j}-z)=r$ for all $j\in J$.

###### Proof.

For convenience denote $M^{\prime}(n):=M(n-z)-r$ and
$y_{j}:=L_{I,j}((y_{i})_{i\in I})$ for all $j\in J\backslash I$. Recall that
we also have $L_{I,j}((y_{i})_{i\in I})=y_{j}$ for all $j\in I$. Then
$M^{\prime}(y_{i})=0$ for all $i\in I$. Let $b_{I,i,j},i\in I,j\in J$ be the
generating constants for $X$ with respect to $I$. Then for all $j\in
J\backslash I$, $\sum_{i\in I}b_{I,i,j}-1=0$ and $\sum_{i\in
I}b_{I,i,j}y_{i}-y_{j}=0$. Since $X$ is $M$-spherical, By Lemma 2.5,
$\sum_{i\in I}b_{I,i,j}M^{\prime}(y_{i})-M^{\prime}(y_{j})=0$. So
$M^{\prime}(y_{j})=0$ for all $j\in J\backslash I$.

The “in particular” part follows from the fact that
$x_{j}:=L_{I,j}((x_{i})_{i\in I})$ for all $j\in J$. ∎

###  2.3. Different notions of congruency

In order to prove Theorem 1.1, instead of working directly on congruent copies
of a configuration, we study relavent patterns with less restrictions.

######  Definition 2.7 ($M$-isometry and $M$-congruency).

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a homogeneous quadratic
form and $X=\\{x_{j}\colon j\in J\\}$, $Y=\\{y_{j}\colon j\in J\\}$ be two
configurations in $\mathbb{F}_{p}^{d}$. We say that $X$ and $Y$ are _$M$
-isometric_ if $M(x_{i}-x_{j})=M(y_{i}-y_{j})$ for all $i,j\in J$. We say that
$Y$ is _$M$ -congruent_ to $X$ if there exist an _$M$ -isometry_ $U$ on
$\mathbb{F}_{p}^{d}$ (i.e. $U\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}^{d}$ is
a linear transformation such that $M(U(x))=M(x)$ for all
$x\in\mathbb{F}_{p}^{d}$) and $z\in\mathbb{F}_{p}^{d}$ such that
$y_{j}=z+U(x_{j})$ for all $j\in J$.

When $M=|\cdot|^{2}$, we simply call $M$-isometry/congruency as
_isometry/congruency_ for short.

It is not hard to see that congruency implies isometry. However, the next
example shows that the converse is false.

######  Example 2.8.

Let $d=5$, $X=\\{x_{1},\dots,x_{4}\\}$ and $Y=\\{y_{1},\dots,y_{4}\\}$ with
$x_{1}=y_{1}=(-1,-1,0,0,$ $0)$, $x_{2}=y_{2}=(-1,1,0,0,0)$,
$x_{3}=y_{3}=(1,-1,0,0,0)$, $x_{4}=(1,1,0,0,0)$, and $y_{4}=(1,1,a,b,c)$,
where $a^{2}+b^{2}+c^{2}=0$ and $(a,b,c)\neq(0,0,0)$. Such $a,b,c$ exist
because of Lemma B.5. Then $X$ and $Y$ are isometric. It is clear that $X$ and
$Y$ are spherical since $|x_{i}|^{2}=|y_{i}|^{2}=2$. 333Moreover, $X$ is non-
degenerate. On the other hand, if there exist an isometry $U$ on
$\mathbb{F}_{p}^{d}$ and $z\in\mathbb{F}_{p}^{d}$ such that $y_{i}=z+U(x_{i})$
for all $1\leq i\leq 4$, then

$\begin{split}&\quad(0,0,a,b,c)=y_{1}+y_{4}-y_{2}-y_{3}=(z+U(x_{1}))+(z+U(x_{4}))-(z+U(x_{2}))-(z+U(x_{3}))\\\
&=U(x_{1}+x_{4}-x_{2}-x_{3})=(0,0,0,0,0),\end{split}$

a contradiction. So $Y$ is not congruent to $X$.

Next we introduce a variation of the $M$-congruency concept.

######  Definition 2.9 (almost $M$-congruency).

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a homogeneous quadratic
form and $X=\\{x_{j}\colon j\in J\\}$ and $Y=\\{y_{j}\colon j\in J\\}$ be two
configurations in $\mathbb{F}_{p}^{d}$. Let $I\subseteq J$ be a generating set
of $X$ with generating constants $b_{I,i,j},i\in I,j\in J$. We say that $Y$ is
_almost $M$-congruent_ to $X$ with respect to $I$ if

  * •

for any $i,i^{\prime}\in I$, $M(x_{i}-x_{i^{\prime}})=M(y_{i}-y_{i^{\prime}})$
(i.e. $\\{x_{i}\colon i\in I\\}$ is $M$-isometric to $\\{y_{i}\colon i\in
I\\}$);

  * •

for any $i\in J\backslash I$, $y_{j}=\sum_{i\in I}b_{I,i,j}y_{i}$.444We also
have $y_{j}=\sum_{i\in I}b_{I,i,j}y_{i}$ for $i\in I$ for free, since
$b_{I,i,j}=\delta_{i,j}$ for all $i,j\in I$.

We say that $Y$ is _almost $M$-congruent_ to $X$ if $Y$ is almost
$M$-congruent to $X$ with respect to every generating set of $X$. When
$M=|\cdot|^{2}$, we simply call almost $M$-congrency as _almost congrency_ for
short.

Roughly speaking, almost congruency is a mixture of an isometry property for a
generating set of the configuration, and some linearity property for the
remaining points. The concept of almost congruency was used implicitly in the
work of Lyall, Magyar and Parshall [18], and it is very useful in converting
the Geometric Ramsey Conjecture to the study of linear patterns in spheres. We
provide some connections between different notions of congruency for later
uses.

######  Proposition 2.10.

Let $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate
homogeneous quadratic form, $X=\\{x_{j}\colon j\in J\\}$ and $Y=\\{y_{j}\colon
j\in J\\}$ be two configurations, and $I\subseteq J$ be a generating set $I$
of $X$.

  1. (i)

If $Y$ is $M$-congruent to $X$, then $Y$ is almost $M$-congruent and
$M$-isometric to $X$.

  2. (ii)

If $Y$ is almost $M$-congruent to $X$ with respect to $I$, and if the vectors
$y_{i}-y_{i_{0}},i\in I\backslash\\{i_{0}\\}$ are linearly independent for
some $i_{0}\in I$,555When $Y$ is almost $M$-congruent to $X$, this is
equivalent of saying that $\text{span}_{\mathbb{F}_{p}}(X-X)$ and
$\text{span}_{\mathbb{F}_{p}}(Y-Y)$ have the same dimension. then $Y$ is
$M$-congruent to $X$ (and thus is almost $M$-congruent to $X$ with respect to
every generating set of $X$ by Part (i)). If in addition $X$ is $M$-spherical,
then so is $Y$.

###### Proof.

Part (i) is straightforward. We now prove Part (ii). Let
$X^{\prime}=\\{x_{j}\colon j\in I\\}$ and $Y^{\prime}=\\{y_{j}\colon j\in
I\\}$. By linearity, it suffices to show that $X^{\prime}$ is $M$-congruent to
$Y^{\prime}$. For convenience assume without loss of generality that
$I=\\{0,\dots,k\\}$ for some $k\in\mathbb{N}_{+},$ that $i_{0}=0$ and that
$x_{0}=y_{0}=\mathbb{0}$. Then $(x_{1},\dots,x_{k})$ and $(y_{1},\dots,y_{k})$
are linearly independent tuples. Let
$U=\text{span}_{\mathbb{F}_{p}}\\{x_{1},\dots,x_{k}\\}$ and
$V=\text{span}_{\mathbb{F}_{p}}\\{y_{1},\dots,y_{k}\\}$. Then $x_{i}\mapsto
y_{i},1\leq i\leq k$ induces a bijective linear transformation $\phi\colon
U\to V$. Let $A$ be the matrix associated to $M$. Since $Y$ is almost
$M$-congruent to $X$, we have that $M(y_{i}-y_{j})=M(x_{i}-x_{j})$ for all
$1\leq i,j\leq k$ and that $M(y_{i})=M(x_{i})$ for all $1\leq i\leq k$ (since
$x_{0}=y_{0}=\mathbb{0}$). From this it is not hard to see that $(x_{i}A)\cdot
x_{j}=(y_{i}A)\cdot y_{j}$ for all $1\leq i,j\leq k$, which implies that

$M(a_{1}x_{1}+\dots+a_{k}x_{k})=M(a_{1}y_{1}+\dots+a_{k}y_{k})$

for all $a_{1},\dots,a_{k}\in\mathbb{F}_{p}$. In other words, $\phi$ is a
bijective $M$-isometry. Since $M$ is non-degenerate, by Witt’s Extension
Theorem (see for example [3] Corollary 24), $\phi$ extension to an
$M$-isometry from $\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}^{d}$. So $X^{\prime}$
is $M$-congruent to $Y^{\prime}$, and thus $X$ is $M$-congruent to $Y$.

We now assume further that $X$ is $M$-spherical and show that $Y$ is also
$M$-spherical. Since $Y$ is almost $M$-congruent to $X$, by Corollary 2.6, it
suffices to show that $Y^{\prime}$ is spherical, which follows from Lemma 2.4.
∎

######  Remark 2.11.

A result similar to Proposition 2.10 was proven in Lemma 14 [18] under the
additional assumption that $X$ is non-degenerate. In fact, the assumptions in
both results share the same purpose in ensuring
$\dim(\text{span}_{\mathbb{F}_{p}}(X-X))=\dim(\text{span}_{\mathbb{F}_{p}}(Y-Y))$,
from which one can apply Witt’s Extension Theorem to show the existence of the
$M$-isometry $\phi$.

##  3\. Some preliminary reductions of the density Ramsey theorem

###  3.1. A variation of Theroem 1.1 over spheres

In this section, we reduce Theorem 1.1 to the following result:

######  Theorem 3.1 (Density Ramsey Theorem on spheres).

Let $d\in\mathbb{N}_{+}$, $C,\epsilon>0$, $p$ be a prime,
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate homogeneous
quadratic form, and $X\subseteq\mathbb{F}_{p}^{d}$ be an $M$-spherical
configuration of complexity at most $C$. Let $k$ be the dimension of
$\text{span}_{\mathbb{F}_{p}}(X-X)$ and suppose that $d\geq d_{0}(X)$. There
exist $p_{0}=p_{0}(C,d,\epsilon)\in\mathbb{N}$ and
$\delta=\delta(C,d,\epsilon)>0$ such that if $p>p_{0}$, then for every
$x\in\mathbb{F}_{p}^{d}$, every $r\in\mathbb{F}_{p}$ and every set $E\subseteq
V(M(\cdot+x)-r)$ (recall Section 1.3 for the definition) with $|E|>\epsilon
p^{d-1}$, $E$ contains at least $\delta p^{(k+1)d-(k+1)(k+2)/2}$ almost
$M$-congruent copies of $X$.

######  Remark 3.2.

Note that Theorem 3.1 differs from Theorem 1.1 in the following aspects.
Firstly, the set $E$ in Theorem 3.1 is restricted to the “sphere”
$V(M(\cdot+x)-r)$. Secondly, the quantity $\delta$ in Theorem 3.1 is allowed
to be dependent on $d$ (and thus depends on $|X|$ implicitly since $d\geq
d_{0}(X)$). Finally, Theorem 3.1 deals with $M$-spherical sets and almost
$M$-congruent copies for a generate non-degenerate homogeneous quadratic form
$M$.

In order to see the connection between Theorems 1.1 and 3.1, it is convenient
to consider the following intermediate result:

######  Proposition 3.3 (Density Ramsey Theorem, a weaker form).

Let $d\in\mathbb{N}_{+}$, $C,\epsilon>0$, $p$ be a prime,
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate homogeneous
quadratic form, and $X\subseteq\mathbb{F}_{p}^{d}$ be an $M$-spherical
configuration of complexity at most $C$. Let $k$ be the dimension of
$\text{span}_{\mathbb{F}_{p}}(X-X)$ and suppose that $d\geq d_{0}(X)$. There
exist $p_{0}=p_{0}(C,d,\epsilon)\in\mathbb{N}$ and
$\delta=\delta(C,d,\epsilon)>0$ such that if $p>p_{0}$, then every set
$E\subseteq\mathbb{F}_{p}^{d}$ with $|E|>\epsilon p^{d}$ contains at least
$\delta p^{(k+1)d-(k+1)k/2}$ $M$-congruent copies of $X$.

###### Proof of Proposition 3.3 assuming Theorem 3.1.

For convenience denote

$M_{x,r}(n):=M(n+x)-r.$

Let $s:=|X|-k\geq 1$ and $E\subseteq\mathbb{F}_{p}^{d}$ with $|E|>\epsilon
p^{d}$. Assume without loss of generality that $X=\\{x_{0},\dots,x_{k+s-1}\\}$
and $\\{0,\dots,k\\}$ is a generating set of $X$. Note that for any
$n\in\mathbb{F}_{p}^{d}$, the number of tuples $(x,r)\in\mathbb{F}_{p}^{d+1}$
such that $M_{x,r}(n)=0$ is $p^{d}$ (since $r$ is uniquely determined by $x$
and $n$). So $\sum_{(x,r)\in\mathbb{F}_{p}^{d+1}}|E\cap
V(M_{x,r})|=p^{d}|E|>\epsilon p^{2d}.$ Since $|E\cap
V(M_{x,r})|\leq|V(M_{x,r})|\leq 2p^{d-1}$, by the Pigeonhole Principle, there
exists a subset $W$ of $\mathbb{F}_{p}^{d+1}$ of cardinality $\gg\epsilon
p^{d+1}$ such that $|E\cap V(M_{x,r})|\gg\epsilon p^{d-1}$ for all $(x,r)\in
W$. By Theorem 3.1, for all $(x,r)\in W$, the set $E\cap V(M_{x,r})$ contains
$\gg_{C,d,\epsilon}p^{(k+1)d-(k+1)(k+2)/2}$ almost $M$-congruent copies
$Y=\\{v_{0},\dots,v_{k+s-1}\\}$ of $X$.

By Lemma B.3, the number of choices of
$v_{0},\dots,v_{k}\in\mathbb{F}_{p}^{d}$ such that
$v_{1}-v_{0},\dots,v_{k}-v_{0}$ are linearly dependent is at most
$kp^{d+(d+1)(k-1)}=kp^{dk+(k-1)}$. Since $d\geq\frac{(k+1)(k+2)}{2}+k$, the
set $E\cap V(M_{x,r})$ contains $\gg_{C,d,\epsilon}p^{(k+1)d-(k+1)(k+2)/2}$
almost $M$-congruent copies $Y=\\{v_{0},\dots,v_{k+s-1}\\}$ of $X$ such that
$v_{1}-v_{0},\dots,v_{k}-v_{0}$ are linearly independent (because
$v_{k+1},\dots,v_{k+s-1}$ are uniquely determined by $v_{0},\dots,v_{k}$).

Fix any such $Y$. By Proposition 2.10 (ii), $Y$ is $M$-congruent to $X$. Since
$\\{0,\dots,k\\}$ is a generating set of $X$, by Corollary 2.6, $Y\subseteq
V(M_{x,r})$ if and only if $v_{0},\dots,v_{k}$ belong to $V(M_{x,r})$, or
equivalently, $x\in V(M_{v_{0},r})^{v_{1}-v_{0},\dots,v_{k}-v_{0}}$ (recall
Section 1.3 for the definition). Since $v_{1}-v_{0},\dots,v_{k}-v_{0}$ are
linearly independent, and $d\geq 2k+3$, by Lemma B.6,
$|V(M_{v_{0},r})^{v_{0}-v_{1},\dots,v_{0}-v_{k}}|=p^{d-k-1}(1+O(p^{-1/2}))$.
Since there are $p$ choices of $r$, the number of
$(x,r)\in\mathbb{F}_{p}^{d+1}$ such that $Y\subseteq V(M_{x,r})$ is at most
$2p^{(d+1)-(k+1)}$ if $p\gg_{d}1$.

So the total number of $M$-congruent copies of $X$ is no less than the
cardinality of the set $E=\cup_{(x,r)\in\mathbb{F}_{p}^{d+1}}(E\cap
V(M_{x,r}))$, which is at least

$\gg_{C,d,\epsilon}p^{(k+1)d-(k+1)(k+2)/2}\cdot|W|/2p^{(d+1)-(k+1)}\gg_{C,d,\epsilon}p^{(k+1)d-(k+1)k/2}.$

∎

###### Proof of Theorem 1.1 assuming Proposition 3.3.

Let $X=\\{x_{0},\dots,x_{k+s-1}\\}\subseteq\mathbb{F}_{p}^{d}$ be a spherical
configuration of complexity at most $C$, where
$\dim(\text{span}_{\mathbb{F}_{p}}(X-X))=k$ and $s=|X|-k\geq 1$. Assume
without loss of generality that $I:=\\{0,\dots,k\\}$ is a generating set of
$X$ and let $b_{I,i,j},i\in I,j\in\\{0,\dots,k+s-1\\}$ be its generating
constants. Let $r\in\mathbb{F}_{p}$, $x\in\mathbb{F}_{p}^{d}$, and
$E\subseteq\mathbb{F}_{p}^{d}$ with $|E|>\epsilon p^{d}$. Suppose that $d\geq
d_{0}:=d_{0}(X)$. Throughout the proof we assume that
$p\gg_{C,d_{0},\epsilon}1$.

Our goal is to show that the dependences of $p_{0}$ and $\delta$ on $d$ in
Proposition 3.3 can be replaced by the dependences on $k$ and $s$. Let
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be the quadratic form given by
$M(x):=x\cdot x$. We say that a basis $v_{1},\dots,v_{d}$ of
$\mathbb{F}_{p}^{d}$ is _good_ if
$\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$ is not $M$-isotropic
(see Appendix B.1 for the definition). Fix any good basis $v_{1},\dots,v_{d}$
of $\mathbb{F}_{p}^{d}$. Denote
$V:=\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$ and
$U:=\text{span}_{\mathbb{F}_{p}}\\{v_{d_{0}+1},\dots,v_{d}\\}$. Then
$M|_{V+c}$ is of full rank for all $c\in U$. By the Pigeonhole Principle,
there exists a subset $U^{\prime}(v_{1},\dots,v_{d})$ of $U$ of cardinality at
least $\epsilon p^{d-d_{0}}/2$ such that for all $c\in
U^{\prime}(v_{1},\dots,v_{d})$, we have that $|E\cap(V+c)|>\epsilon
p^{d_{0}}/2$.

Fix such an element $c$ and let $\phi\colon\mathbb{F}_{p}^{d_{0}}\to V$ be any
bijective linear transformation. Denote $M^{\prime}=M\circ\phi$. Then
$M^{\prime}\colon\mathbb{F}_{p}^{d_{0}}\to\mathbb{F}_{p}$ is a non-degenerate
homogeneous quadratic form. Let
$E^{\prime}:=\\{m\in\mathbb{F}_{p}^{d_{0}}\colon\phi(m)+c\in E\\}$. Then
$|E^{\prime}|>\epsilon p^{d_{0}}/2$.

Let $W$ be the set of $(y_{0},\dots,y_{k})\in(\mathbb{F}_{p}^{d_{0}})^{k+1}$
such that $M^{\prime}(y_{i}-y_{i^{\prime}})=M(x_{i}-x_{i^{\prime}})$ for all
$0\leq i,i^{\prime}\leq k$. Using Proposition B.11, it is not hard to check
that $W$ is a consistent $M^{\prime}$-set of total co-dimension $k(k+1)/2$
(see Appendix B.3 for definitions). By Theorem B.12, since
$\text{rank}(M^{\prime})=d_{0}\geq k^{2}+k+1$, we have that
$|W|=p^{d_{0}(k+1)-k(k+1)/2}(1+O_{k}(p^{-1/2}))$. On the other hand, by Lemma
B.3, the number of $(y_{0},\dots,y_{k})\in(\mathbb{F}_{p}^{d_{0}})^{k+1}$ such
that $y_{1}-y_{0},\dots,y_{k}-y_{0}$ are linearly dependent is at most
$kp^{d_{0}+(d_{0}+1)(k-1)}=kp^{d_{0}k+(k-1)}$. Since
$d_{0}\geq\frac{k(k+1)}{2}+k$ and $p\gg_{d_{0},k}1$, there exists some
configuration $Y=\\{y_{0},\dots,y_{k+s-1}\\}$ in $\mathbb{F}_{p}^{d^{\prime}}$
such that $M^{\prime}(y_{i}-y_{i^{\prime}})=M(x_{i}-x_{i^{\prime}})$ for all
$0\leq i,i^{\prime}\leq k$, that $y_{j}=\sum_{i=0}^{k}b_{I,i,j}y_{i}$ for all
$j\in\\{0,\dots,k+s-1\\}$, and that $y_{1}-y_{0},\dots,y_{k}-y_{0}$ are
linearly independent. Therefore, $I$ is a generating set of $Y$. Since $\phi$
is injective, $I$ is also a generating set of $\phi(Y)+c$.

Note that

$M((\phi(y_{i})+c)-(\phi(y_{i^{\prime}})+c))=M^{\prime}(y_{i}-y_{i^{\prime}})=M(x_{i}-x_{i^{\prime}})$

for all $i,i^{\prime}\in I$ and that

$\phi(y_{j})+c=\sum_{i=0}^{k}b_{I,i,j}(\phi(y_{i})+c)$

for all $j\in\\{0,\dots,k+s-1\\}$. We have that $\phi(Y)+c$ is an almost
$M$-congruent copy of $X$ with respect to $I$. By Proposition 2.10 (ii),
$\phi(Y)+c$ is $M$-spherical. By Lemma 2.4, $\\{y_{i}\colon i\in I\\}$ is
$M^{\prime}$-spherical. Assume that $M^{\prime}(y_{i}-z)=r$ for some
$z\in\mathbb{F}_{p}^{d_{0}}$ and $r\in\mathbb{F}_{p}$ for all $i\in I$. Then
$M((\phi(y_{i})+c)-(\phi(z)+c))=r$ for all $i\in I$. Since $I$ is a generating
set of the $M$-spherical configuration $\phi(Y)+c$, by Corollary 2.6,
$M((\phi(y_{i})+c)-(\phi(z)+c))=r$ and thus $M^{\prime}(y_{j}-z)=r$ for all
$j\in\\{0,\dots,k+s-1\\}$. So $Y$ is $M^{\prime}$-spherical.

Since $p\gg_{C,d_{0},\epsilon}1$,by Theorem 3.3, $E^{\prime}$ contains at
least $\delta p^{(k+1)d_{0}-(k+1)k/2}$ $M^{\prime}$-congruent copies of $Y$,
where $\delta:=\delta(C,d_{0},\epsilon)>0$. Composing with $\phi$, it is not
hard to see that $E\cap(V+c)$ contains at least $\delta
p^{(k+1)d_{0}-(k+1)k/2}$ $M$-congruent copies of $\phi(Y)+c$. Ranging over all
$c\in U^{\prime}(v_{1},\dots,v_{d})$, we have that $E$ contains at least
$\delta\epsilon p^{(d-d_{0})+(k+1)d_{0}-(k+1)k/2}/4$ $M$-congruent copies of
$X$ with respect to any good basis $v_{1},\dots,v_{d}$ of
$\mathbb{F}_{p}^{d}$.

Let $B$ be the $d\times d$ matrix with $v_{1},\dots,v_{d}$ being its row
vectors, and $B^{\prime}$ be the $d_{0}\times d$ matrix with
$v_{1},\dots,v_{d_{0}}$ being its row vectors. Then $v_{1},\dots,v_{d}$ is a
good basis of $\mathbb{F}_{p}^{d}$ if any only if
$\det(B),\det(B^{\prime}{B^{\prime}}^{T})\neq 0$. By Lemma B.4, the number of
good basis of $\mathbb{F}_{p}^{d}$ is $p^{d^{2}}(1+O_{d}(p^{-1}))$. Therefore,
letting $R$ denote the set of tuples $(X^{\prime},v_{1},\dots,v_{d},c)$ with
$X^{\prime}$ being $M$-congruent to $X$, $v_{1},\dots,v_{d}$ being a good
basis of $\mathbb{F}_{p}^{d}$, and $c\in U^{\prime}(v_{1},\dots,v_{d})$, we
have that

(3.1) $|R|\geq\delta\epsilon p^{d^{2}+(d-d_{0})+(k+1)d_{0}-(k+1)k/2}/8.$

Claim. For any $1\leq t\leq d_{0}$ and
$u_{0},\dots,u_{t}\in\mathbb{F}_{p}^{d}$ with $u_{1}-u_{0},\dots,u_{t}-u_{0}$
being linearly independent, the number of tuples
$(v_{1},\dots,v_{d_{0}})\in(\mathbb{F}_{p}^{d})^{d_{0}}$ such that
$u_{0},\dots,u_{t}\in\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$
is at most $p^{d_{0}t+d(d_{0}-t)}$.

Denote $u^{\prime}_{i}:=u_{i}-u_{0}$ for $1\leq i\leq t$. Note that
$u_{0},\dots,u_{t}\in\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$
only if
$u^{\prime}_{1},\dots,u^{\prime}_{t}\in\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$.
Assume that $u^{\prime}_{i}=\sum_{j=1}^{d_{0}}c_{i,j}v_{j}$ for all $1\leq
i\leq t$. There are at most $p^{td_{0}}$ choices of $c_{i,j}$. For any choice
of $c_{i,j}$, to achieve $u^{\prime}_{i}=\sum_{j=1}^{d_{0}}c_{i,j}v_{j},1\leq
i\leq t$, we must have that $(c_{i,1},\dots,c_{i,d_{0}}),1\leq i\leq t$ are
linearly independent. If this is the case, then there exists a subset $I$ of
$\\{1,\dots,d_{0}\\}$ with $|I|=t$ such that $v_{j},j\in I$ are uniquely
determined by $u_{i},v_{j^{\prime}},c_{i,j},1\leq i\leq t,1\leq j\leq
d_{0},j^{\prime}\notin I$. Since there are $p^{d(d_{0}-t)}$ choices of
$v_{j^{\prime}},j^{\prime}\notin I$, we conclude that the number of tuples
$(v_{1},\dots,v_{d_{0}})$ such that
$u^{\prime}_{1},\dots,u^{\prime}_{t}\in\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$
is at most $p^{d_{0}t+d(d_{0}-t)}$. This proves the claim.

Fix any $M$-congruent copy $X^{\prime}$ of $X$ and any
$c\in\mathbb{F}_{p}^{d}$. Since $|X^{\prime}|=k+1$ and

$\dim(\text{span}_{\mathbb{F}_{p}}((X^{\prime}-c)-(X^{\prime}-c)))=\dim(\text{span}_{\mathbb{F}_{p}}(X^{\prime}-X^{\prime}))=\dim(\text{span}_{\mathbb{F}_{p}}(X-X))=k,$

by the claim, the number of tuples $(v_{1},\dots,v_{d_{0}})$ such that
$X^{\prime}-c\subseteq\text{span}_{\mathbb{F}_{p}}\\{v_{1},\dots,v_{d_{0}}\\}$
is at most $p^{d_{0}k+d(d_{0}-k)}$. So each $X^{\prime}$ appears at most
$p^{d(d-d_{0})+d_{0}k+d(d_{0}-k)}$ times in the set $R$. So it follows from
(3.1) that $E$ contains in total at least

$\delta\epsilon
p^{d^{2}+(d-d_{0})+(k+1)d_{0}-(k+1)k/2-(d(d-d_{0})+d_{0}k+d(d_{0}-k))}/8=\delta\epsilon
p^{(k+1)d-(k+1)k/2}/8$

$M$-congruent (and thus congruent) copies of $X$. This completes the proof. ∎

In conclusion, in order to prove Theorem 1.1, it suffices to prove Theorem
3.1.

###  3.2. Definitions and conventions

The rest of the paper is devoted to proving Theorem 3.1. We start with some
simplifications and definitions.

In the rest of the paper, we fix the non-degenerate homogeneous quadratic form
$M$, the matrix $A$ associated to it, and the radius $r\in\mathbb{F}_{p}$. We
fix an $M$-spherical configuration $X\subseteq\mathbb{F}_{p}^{d}$ and denote
$k:=\dim(\text{span}_{\mathbb{F}_{p}}(X-X)),s:=|X|-k\geq 1$.

In the rest of the paper, we label the coordinates of vectors in the sets
$(\mathbb{F}_{p}^{t})^{k+1}$ and $(\mathbb{Z}^{t})^{k+1}$ as $0\sim k$ instead
of $1\sim(k+1)$, and label the coordinates of vectors in the sets
$(\mathbb{F}_{p}^{t})^{k+s}$ and $(\mathbb{Z}^{t})^{k+s}$ as $0\sim(k+s-1)$
instead of $1\sim(k+s)$. Under this convention, from now on we assume that
$J=\\{0,\dots,k+s-1\\}$ is the index set for $X$ with respect to the canonical
ordering. For each generating set $I$ of $X$, let
$\mathbb{L}_{I}=(L_{I,0},\dots,L_{I,k+s-1})$ be the generating map of $X$ with
respect to $I$ with generating constants $b_{I,i,j},i\in I,j\in J$, and let
$\pi_{I}\colon(\mathbb{F}_{p}^{d})^{|J|}\to(\mathbb{F}_{p}^{d})^{|I|}$ be the
projection onto the coordinates with $I$-indices.

Replacing $X$ with $X-u_{0}$ if necessary, we may further assume that

$X=\\{v_{0},v_{1},\dots,v_{k+s-1}\\}$

with $M(v_{0})=\dots=M(v_{k+s-1})=\lambda$ for some
$\lambda\in\mathbb{F}_{p}$. Note that if $E\subseteq V(M(\cdot+x)-r)$, then
$E+x\subseteq V(M-r)$. Since the number of almost $M$-congruent copies of $X$
in $E$ is the same as that of $E+r$, we may assume without loss of generality
that $x=\mathbb{0}$ and $E\subseteq V(M-r)$.

In the rest of the paper, for any $I\subseteq L$, we use $\Omega_{I}$ to
denote the set of $(x_{i})_{i\in I}\in V(M-r)^{|I|}$ such that
$M(x_{i}-x_{i^{\prime}})=M(v_{i}-v_{i^{\prime}})$ for all $i,i^{\prime}\in I$.
Also denote $\Omega:=\mathbb{L}_{I}(\Omega_{I})$ for some generating $I$ of
$X$. We summarize some properties for the sets $\Omega_{I}$ and $\Omega$ (see
Appendix B for relevant definitions).

######  Lemma 3.4.

Let $I,I^{\prime}\subseteq\\{0,\dots,k+s-1\\}$ be generating sets of $X$ and
$\mathcal{E}$ be the set of $M$-congruent copies of $X$ lying in $V(M-r)$.

  1. (i)

We have that
$\mathbb{L}_{I}(\Omega_{I})=\mathbb{L}_{I^{\prime}}(\Omega_{I^{\prime}})$. In
particular, the set $\Omega$ is independent of the choice of the generating
set, and is equal to the set of all almost $M$-congruent copies of $X$ (with
respect to every generating set of $X$).

  2. (ii)

If $d\geq(k+1)(k+2)+1,$ then $\Omega_{I}$ is a nice and consistent $M$-set of
total co-dimension $(k+1)(k+2)/2$, and we have that
$|\Omega|=|\Omega_{I}|=p^{d(k+1)-(k+1)(k+2)/2}(1+O_{k}(p^{-1/2}))$.

  3. (iii)

If $d\geq\frac{(k+1)(k+2)}{2}+k,$ then have that $\mathcal{E}\subseteq\Omega$
with $|\Omega\backslash\mathcal{E}|=p^{d(k+1)-(k+1)(k+2)/2}O_{k}(p^{-1/2})$.

  4. (iv)

If $d\geq\max\\{2k^{2}+6k+5,2k+s+13\\}$, then for all $C^{\prime}>0$, there
exists $K=O_{C^{\prime},d}(1)$ such that $\Omega_{I}$ admits a
$(t,Kt^{-K})$-Leibman dichotomy up to step $s$ and complexity at most
$C^{\prime}$ for all $0<t<1/2$.

###### Proof.

We first prove Part (i). Pick any $\mathbb{x}=(x_{i})_{i\in
I^{\prime}}\in\Omega_{I^{\prime}}$. For all $i,i^{\prime}\in I^{\prime}$, we
have $M(x_{i}-x_{i^{\prime}})=M(v_{i}-v_{i^{\prime}})$ for all
$i,i^{\prime}\in I^{\prime}$. Using the identity

$2((x-y)A)\cdot(z-w)=M(x-w)+M(y-z)-M(x-z)-M(y-w),$

we have that

$((x_{i_{1}}-x_{i_{2}})A)\cdot(x_{i_{3}}-x_{i_{4}})=((v_{i_{1}}-v_{i_{2}})A)\cdot(v_{i_{3}}-v_{i_{4}})$

for all $i_{1},i_{2},i_{3},i_{4}\in I^{\prime}$. So for any
$a_{i}\in\mathbb{F}_{p},i\in I^{\prime}$ with $\sum_{i\in I^{\prime}}a_{i}=0$,
we have that

$M\Bigl{(}\sum_{i\in I^{\prime}}a_{i}x_{i}\Bigr{)}=M\Bigl{(}\sum_{i\in
I^{\prime}\backslash\\{i_{0}\\}}a_{i}(x_{i}-x_{i_{0}})\Bigr{)}=M\Bigl{(}\sum_{i\in
I^{\prime}\backslash\\{i_{0}\\}}a_{i}(v_{i}-v_{i_{0}})\Bigr{)}=M\Bigl{(}\sum_{i\in
I^{\prime}}a_{i}v_{i}\Bigr{)},$

where $i_{0}$ is any element in $I^{\prime}$. Therefore, for all
$i,i^{\prime}\in I$, we have that

$M(\mathbb{L}_{I^{\prime},i}(\mathbb{x})-\mathbb{L}_{I^{\prime},i^{\prime}}(\mathbb{x}))=M\Bigl{(}\sum_{i^{\prime\prime}\in
I^{\prime}}(b_{I^{\prime},i^{\prime\prime},i}-b_{I^{\prime},i^{\prime\prime},i^{\prime}})x_{i^{\prime\prime}}\Bigr{)}=M\Bigl{(}\sum_{i^{\prime\prime}\in
I^{\prime}}(b_{I^{\prime},i^{\prime\prime},i}-b_{I^{\prime},i^{\prime\prime},i^{\prime}})v_{i^{\prime\prime}}\Bigr{)}=M(v_{i}-v_{i^{\prime}}).$

On the other hand, since $M(x_{i})=r$ for all $i\in I^{\prime}$ and since $X$
is spherical, it follows from Corollary 2.6 that
$M(L_{I^{\prime},i}(\mathbb{x}))=r$ for all $i\in I$. In conclusion, we have
that $\pi_{I}(\mathbb{L}_{I^{\prime}}(\mathbb{x}))$ belongs to $\Omega_{I}$.
Therefore, by Proposition 2.3,
$\mathbb{L}_{I^{\prime}}(\mathbb{x})=\mathbb{L}_{I}(\pi_{I}(\mathbb{L}_{I^{\prime}}(\mathbb{x})))\subseteq\mathbb{L}_{I}(\Omega_{I})$
and so
$\mathbb{L}_{I^{\prime}}(\Omega_{I^{\prime}})\subseteq\mathbb{L}_{I}(\Omega_{I})$.
Similarly, we have that
$\mathbb{L}_{I}(\Omega_{I})\subseteq\mathbb{L}_{I^{\prime}}(\Omega_{I^{\prime}})$
and so
$\mathbb{L}_{I}(\Omega_{I})=\mathbb{L}_{I^{\prime}}(\Omega_{I^{\prime}})$.

We now prove Part (ii). Assume without loss of generality $I=\\{0,\dots,k\\}$.
By part (i), $\Omega=\mathbb{L}_{I}(\Omega_{I})$. Since the projection of
$\mathbb{L}_{I}$ onto the coordinates with $I$-indices is the identity map on
$(\mathbb{F}_{p}^{d})^{k+1}$, we have that $|\Omega|=|\Omega_{I}|$.

Note that $\Omega_{I}$ is the set $\Omega_{3}$ in Example B.4 of [20] (up to a
relabelling of the variables). So $\Omega_{I}$ is a nice and consistent
$M$-set of total co-dimension $(k+1)(k+2)/2$. Since $d\geq(k+1)(k+2)+1,$ by
Theorem B.12,
$|\Omega_{I}|=p^{d(k+1)-\frac{(k+1)(k+2)}{2}}(1+O_{k}(p^{-1/2}))$.

We then prove Part (iii). Since we have shown that $\Omega$ is the set of all
almost $M$-congruent copies of $X$ in Part (i), it follows from Proposition
2.10 (i) that $\mathcal{E}\subseteq\Omega$. Moreover, by Proposition 2.10
(ii), the set $\Omega\backslash\mathcal{E}$ is a subset of
$(x_{0},\dots,x_{k+s-1})\in(\mathbb{F}_{p}^{d})^{k+s}$ with
$x_{i}-x_{i_{0}},i\in I\backslash\\{i_{0}\\}$ being linearly independent for
any prefixed generating set $I$ and $i_{0}\in I$. So one can use Lemma B.3 to
see that $|\Omega\backslash\mathcal{E}|\leq kp^{dk+k-1}$. This completes the
proof since $d\geq\frac{(k+1)(k+2)}{2}+k$.

Part (iv) follows from Theorem B.15 and Part (ii). ∎

We conclude this section with a corollary of Proposition 3.4.

######  Corollary 3.5.

For any generating sets $I$ and $I^{\prime}$ of $X$, we have that
$(\pi_{I}\circ L_{I^{\prime}})^{-1}(\Omega_{I})=\Omega_{I^{\prime}}$.

###### Proof.

Since $b_{I^{\prime},i,j}=\delta_{i,j}$ for all $i,j\in I^{\prime}$, we have
that $\pi_{I^{\prime}}\circ L_{I^{\prime}}$ is the identity map on
$(\mathbb{F}_{p}^{d})^{k+1}$. Similarly $\pi_{I}\circ L_{I}$ is also the
identity map. So for any $\mathbb{x}^{\prime}\in(\mathbb{F}_{p}^{d})^{k+1}$
with $\pi_{I}\circ L_{I^{\prime}}(\mathbb{x}^{\prime})\in\Omega_{I}$, by
Proposition 2.3 and Proposition 3.4 (i), we have that

$\mathbb{x}^{\prime}=\pi_{I^{\prime}}\circ
L_{I^{\prime}}(\mathbb{x}^{\prime})=\pi_{I^{\prime}}\circ
L_{I}\circ\pi_{I}\circ
L_{I^{\prime}}(\mathbb{x}^{\prime})\in\pi_{I^{\prime}}\circ
L_{I}(\Omega_{I})=\pi_{I^{\prime}}\circ
L_{I^{\prime}}(\Omega_{I^{\prime}})=\Omega_{I^{\prime}}.$

Conversely, for any $\mathbb{x}^{\prime}\in\Omega_{I^{\prime}}$, by
Proposition 3.4 (i), we have that

$\pi_{I}\circ L_{I^{\prime}}(\mathbb{x})\in\pi_{I}\circ
L_{I^{\prime}}(\Omega_{I^{\prime}})=\pi_{I}\circ
L_{I}(\Omega_{I})=\Omega_{I}.$

In conclusion, we have that $(\pi_{I}\circ
L_{I^{\prime}})^{-1}(\Omega_{I})=\Omega_{I^{\prime}}$. ∎

##  4\. Bounding spherical averages by spherical Gowers norms

Theorem 3.1 is essentially equivalent to the positivity of the following
spherical multiple ergodic average:

(4.1)
$\begin{split}\mathbb{E}_{(x_{0},\dots,x_{k+s-1})\in\Omega}f_{0}(x_{0})f_{1}(x_{1})\dots
f_{k+s-1}(x_{k+s-1}),\end{split}$

with $f_{0}=\dots=f_{k+s-1}$ being the indicator function of $E$. This can be
viewed as a variation of the by now conventional multiple ergodic average,
where the set $\Omega$ is the set of solutions to a linear equation system
instead of a quadratic one. It turns out that (4.1) is connected to the
spherical Gowers norms of $f_{0},\dots,f_{k+s-1}$, which we recall below:

######  Definition 4.1 (Shperical Gowers norms).

Let $s\in\mathbb{N}_{+}$, and $f\colon\mathbb{F}_{p}^{d}\to\mathbb{C}$ be a
function. The _$s$ -th $V(M-r)$-Gowers norm_ of $f$ is defined by the quantity

$\|f\|_{U^{s}(V(M-r))}:=\Bigl{|}\mathbb{E}_{(n,h_{1},\dots,h_{s})\in\Box_{s}(V(M-r))}\prod_{\epsilon=(\epsilon_{1},\dots,\epsilon_{s})\in\\{0,1\\}^{s}}\mathcal{C}^{|\epsilon|}f(n+\epsilon_{1}h_{1}+\dots+\epsilon_{s}h_{s})\Bigr{|}^{\frac{1}{2^{s}}},$

where $\Box_{s}(V(M-r))$ is the $s$-th Gowers set of $V(M-r)$ defined in
Section 1.3.666One can show that $\|\cdot\|_{U^{s}(V(M-r))}$ is indeed a norm
when $s\geq 2$.

To prove Theorem 3.1, our first step is to show that (4.1) can be bounded by
the spherical Gowers norms of $f_{i}$.

######  Theorem 4.2 (Spherical generalized von-Neumann inequality).

If $d\geq(k+s+2)(k+s+1)+1$, then for any functions
$f_{0},\dots,f_{k+s-1}\colon V(M-r)\to\mathbb{C}$ bounded by 1, we have

(4.2)
$\begin{split}|\mathbb{E}_{(x_{0},\dots,x_{k+s-1})\in\Omega}f_{0}(x_{0})f_{1}(x_{1})\dots
f_{k+s-1}(x_{k+s-1})|\leq\|f_{0}\|_{U^{s}(V(M-r))}+O_{k,s}(p^{-O_{s}(1)^{-1}}).\end{split}$

The rest of this section is devoted to the proof of Theorem 4.2. A special
case of Theorem 4.2 for $s=2$ was proved in Proposition 6 of [18], which
inspires the proof of Theorem 4.2 in this paper.

Let $I_{0}\subseteq\\{0,\dots,k+s-1\\}$ be any generating set of $X$ which
contains $0$. By symmetry, we may assume without loss of generality that
$I_{0}=\\{0,1,\dots,k\\}$. By Lemma 3.4 (i), the left hand side of (4.2)
equals to

(4.3)
$\begin{split}\Bigl{|}\mathbb{E}_{\mathbb{x}=(x_{0},\dots,x_{k})\in\Omega_{I_{0}}}f_{0}(x_{0})\dots
f_{k}(x_{k})\prod_{i=1}^{s-1}f_{k+i}(L_{I_{0},k+i}(\mathbb{x}))\Bigr{|}.\end{split}$

By Lemma 3.4 (ii) and Theorem B.12, since $d\geq(k+2)(k+1)+1$, expression
(4.3) can be bounded by

(4.4)
$\begin{split}&\quad\Bigl{|}\mathbb{E}_{\mathbb{y}=(x_{1},\dots,x_{k})\in\Omega_{I_{0}\backslash\\{0\\}}}\prod_{i=1}^{k}f_{i}(x_{i})\mathbb{E}_{x_{0}\in
V(M-r)\cap
U_{\mathbb{y}}}f_{0}(x_{0})\prod_{i=1}^{s-1}f_{k+i}(L_{I_{0},k+i}(x_{0},\mathbb{y}))\Bigr{|}+O_{k}(p^{-1/2})\\\
&\leq\mathbb{E}_{\mathbb{y}\in\Omega_{I_{0}\backslash\\{0\\}}}\Bigl{|}\mathbb{E}_{x_{0}\in
V(M-r)\cap
U_{\mathbb{y}}}f_{0}(x_{0})\prod_{i=1}^{s-1}f_{k+i}(L_{I_{0},k+i}(x_{0},\mathbb{y}))\Bigr{|}+O_{k}(p^{-1/2}),\end{split}$

where $U_{\mathbb{y}}$ is the set of $x\in\mathbb{F}_{p}^{d}$ such that
$M(x-x_{i})=M(v_{0}-v_{i})$ for all $1\leq i\leq k$.

We need to introduce some notations. For any subset $I$ of
$\\{0,\dots,k+s-1\\}$ , $i_{0}\in I$ and $t\in\mathbb{N}_{+}$, let
$\Omega^{i_{0}}_{I,t}$ be the set of all $(\mathbb{x}=(x_{i})_{i\in
I},\mathbb{h}=(h_{1},\dots,h_{t}))\in(\mathbb{F}_{p}^{d})^{|I|+t}$ such that
for all $\epsilon_{1},\dots,\epsilon_{t}\in\\{0,1\\}$ we have that
$(\tilde{x}_{i})_{i\in I}\in\Omega_{I}$, where $\tilde{x}_{i}:=x_{i}$ for
$i\in I\backslash\\{i_{0}\\}$ and
$\tilde{x}_{i_{0}}:=x_{i_{0}}+\epsilon_{1}h_{1}+\dots+\epsilon_{t}h_{t}$. It
is not hard to see that $\Omega_{I}$ is a pure and consistent $M$-set. So by
Propositions B.10 and B.11 (vii),

(4.5) $\Omega^{i_{0}}_{I,t}$ is a pure and consistent $M$-set of total co-
dimension at most $\binom{|I|+t+1}{2}$.

Denote

$\Delta_{h}f(L(x_{0},\mathbb{y})):=f(L(x_{0}+h,\mathbb{y}))\overline{f}(L(x_{0},\mathbb{y})).$

Since $d\geq(k+3)(k+2)+1$, by the Cauchy-Schwartz inequality, (4.5) and
Theorem B.12, the square of the right hand side of (4.4) is bounded by

(4.6)
$\begin{split}&\quad\mathbb{E}_{\mathbb{y}\in\Omega_{I_{0}\backslash\\{0\\}}}\Bigl{|}\mathbb{E}_{x_{0}\in
V(M-r)\cap
U_{\mathbb{y}}}f_{0}(x_{0})\prod_{i=1}^{s-1}f_{k+i}(L_{I_{0},k+i}(x_{0},\mathbb{y}))\Bigr{|}^{2}+O_{k}(p^{-1})\\\
&=\mathbb{E}_{\mathbb{y}\in\Omega_{I_{0}\backslash\\{0\\}}}\mathbb{E}_{(x_{0},h)\in\Box_{1}(V(M-r)\cap
U_{\mathbb{y}})}\Delta_{h}f_{0}(x_{0})\prod_{i=1}^{s-1}\Delta_{h}f_{k+i}(L_{I_{0},k+i}(x_{0},\mathbb{y}))+O_{k}(p^{-1})\\\
&=\mathbb{E}_{(\mathbb{x}=(x_{i})_{i\in
I_{0}},h)\in\Omega^{0}_{I_{0},1}}\Delta_{h}f_{0}(x_{0})\prod_{i=1}^{s-1}\Delta_{h}f_{k+i}(L_{I_{0},k+i}(\mathbb{x}))+O_{k}(p^{-1}).\end{split}$

For any generating set $I$ of $X$ with $0\in I$, any $j\in\mathbb{N}$, any
$t\in\mathbb{N}_{+}$ and any
$\mathbb{h}=(h_{1},\dots,h_{t})\in(\mathbb{F}_{p}^{d})^{t}$, denote

$\Delta_{\mathbb{h}}f(L_{I,j}(x_{0},\mathbb{y}))=\Delta_{h_{t}}\dots\Delta_{h_{1}}f(L_{I,j}(x_{0},\mathbb{y}))=\prod_{\epsilon_{1},\dots,\epsilon_{t}\in\\{0,1\\}}\mathcal{C}^{\epsilon_{1}+\dots+\epsilon_{t}+t}f(L_{I,j}(x_{0}+\epsilon_{1}h_{1}+\dots+\epsilon_{t}h_{t},\mathbb{y})),$

i.e. the derivative $\Delta_{\mathbb{h}}$ is taken with respect to the $0$-th
variable of the function $f\circ L_{I,j}$. We need to prove the following
intermediate estimate:

######  Proposition 4.3.

Let $1\leq t\leq s-1$ and $I\subseteq\\{0,\dots,k\\}\cup\\{k+t,\dots,k+s-1\\}$
be a generating set of $X$ with $0\in I$. If $d\geq(k+s+2)(k+s+1)+1$, then
there exists a generating set
$I^{\prime}\subseteq\\{0,\dots,k\\}\cup\\{k+t-1,\dots,k+s-1\\}$ of $X$ with
$0\in I$ such that

(4.7) $\begin{split}&\quad\Bigl{|}\mathbb{E}_{(\mathbb{x}=(x_{i})_{i\in
I},\mathbb{h})\in\Omega^{0}_{I,s-t}}\Delta_{\mathbb{h}}f_{0}(x_{0})\prod_{i=1}^{t}\Delta_{\mathbb{h}}f_{k+i}(L_{I,k+i}(\mathbb{x}))\Bigr{|}^{2}\\\
&\leq\Bigl{|}\mathbb{E}_{(\mathbb{x}=(x_{i})_{i\in
I^{\prime}},\mathbb{h})\in\Omega^{0}_{I^{\prime},s-t+1}}\Delta_{\mathbb{h}}f_{0}(x_{0})\prod_{i=1}^{t-1}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(\mathbb{x}))\Bigr{|}+O_{k,s}(p^{-1/2}).\end{split}$

We first explain how Proposition 4.3 implies Theorem 4.2. Since (4.6) holds,
by repeatedly using Proposition 4.3 and the Cauchy-Schwartz inequality, we
have that there exists a generating set $I$ of $X$ with $0\in I$ such that the
left hand side of (4.2) is bounded by

$\begin{split}|\mathbb{E}_{((x_{i})_{i\in
I},\mathbb{h})\in\Omega^{0}_{I,s}}\Delta_{\mathbb{h}}f_{0}(x_{0})|^{\frac{1}{2^{s}}}+O_{k,s}(p^{-O_{s}(1)^{-1}})\end{split}$

Since $d\geq(k+s+2)(k+s+1)+1$, by Theorem B.12 and (4.5), this implies that

$\begin{split}&\quad|\mathbb{E}_{((x_{i})_{i\in
I},\mathbb{h})\in\Omega^{0}_{I,s}}\Delta_{\mathbb{h}}f_{0}(x_{0})|^{\frac{1}{2^{s}}}=|\mathbb{E}_{(x_{0},\mathbb{h})\in\Box_{s}(M-r)}\Delta_{\mathbb{h}}f_{0}(x_{0})|^{\frac{1}{2^{s}}}+O_{k,s}(p^{-O_{s}(1)^{-1}})\\\
&=\|f_{0}\|_{U^{s}(M-r)}+O_{k,s}(p^{-O_{s}(1)^{-1}}).\end{split}$

This completes the proof of Theorem 4.2. So it remains to prove Proposition
4.3.

###### Proof of Proposition 4.3.

By changing the order of the variables, we may assume without loss of
generality that $I=\\{0,\dots,k\\}$. Then

$x_{k+t}=\sum_{j=0}^{k}b_{I,k+t,j}x_{j}=x_{0}+\sum_{j=1}^{k}b_{I,k+t,j}(x_{j}-x_{0}).$

So changing again the order of the variables if necessary, we may further
assume that $b_{I,k+t,k}\neq 0$. Let
$I^{\prime}=\\{x_{0},\dots,x_{k-1},x_{k+t}\\}$. Since $b_{I,k+t,k}\neq 0$, it
is not hard to see that $I^{\prime}$ is also a generating set of $X$.

The key to the proof of Proposition 4.3 is a change of variable that allows
one to switch from the “$I$-basis” to the “$I^{\prime}$-basis”. Indeed,
unpacking the conclusion of Proposition 2.3 and using the fact that
$b_{I,i,j}=\delta_{i,j}$ for all $i,j\in I$, we deduce that

(4.8)
$\begin{split}L_{I^{\prime},i}(x_{0},\dots,x_{k-1},x_{k+t})=L_{I,i}(x_{0},\dots,x_{k-1},L_{I^{\prime},k}(x_{0},\dots,x_{k-1},x_{k+t}))\end{split}$

for all $i\in\\{k+1,\dots,k+s-1\\}\backslash\\{k+t\\}$. By the change of
variable $x_{k}\mapsto L_{I^{\prime},k}(x_{0},\dots,x_{k-1},x_{k+t})$ and
(4.8), the left hand side of (4.7) is equal to

(4.9)
$\begin{split}\Bigl{|}\mathbb{E}_{(\mathbb{x}=(x_{0},\dots,x_{k-1},x_{k+t}),\mathbb{h})\in
W}\Delta_{\mathbb{h}}f_{0}(x_{0})\Delta_{\mathbb{h}}f_{k+t}(x_{k+t})\prod_{i=0}^{t-1}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(\mathbb{x}))\Bigr{|}^{2},\end{split}$

where $W$ is the set of
$(\mathbb{x}=(x_{0},\dots,x_{k-1},x_{k+t}),\mathbb{h}=(h_{1},\dots,h_{s-t}))\in(\mathbb{F}_{p}^{d})^{k+s}$
such that

$\begin{split}(x_{0}+\epsilon_{1}h_{1}+\dots+\epsilon_{s-t}h_{s-t},x_{1},\dots,x_{k-1},L_{I^{\prime},k}(x_{0}+\epsilon_{1}h_{1}+\dots+\epsilon_{s-t}h_{s-t},\dots,x_{k-1},x_{k+t}))\in\Omega_{I}\end{split}$

for all $\epsilon_{1},\dots,\epsilon_{s-t}\in\\{0,1\\}$, or equivalently,

$\begin{split}(x_{0}+\epsilon_{1}h_{1}+\dots+\epsilon_{s-t}h_{s-t},x_{1},\dots,x_{k-1},x_{k+t})\in\pi_{I}\circ
L_{I^{\prime}}^{-1}(\Omega_{I})=\Omega_{I^{\prime}},\end{split}$

where we used (4.8) and Corollary 3.5. In other words, we have that
$W=\Omega^{0}_{I^{\prime},s-t}$. So (4.9) is equal to

(4.10)
$\begin{split}\Bigl{|}\mathbb{E}_{(\mathbb{x}=(x_{0},\dots,x_{k-1},x_{k+t}),\mathbb{h})\in\Omega^{0}_{I^{\prime},s-t}}\Delta_{\mathbb{h}}f_{0}(x_{0})\Delta_{\mathbb{h}}f_{k+t}(x_{k+t})\prod_{i=1}^{t-1}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(\mathbb{x}))\Bigr{|}^{2}.\end{split}$

We refer the readers to Appendices B.3 and B.4 for the terminologies to be
used in the discussion below. By (4.5), $\Omega^{0}_{I^{\prime},s-t}$ is a
pure and consistent $M$-set of total co-dimension at most
$\binom{k+s-t+2}{2}\leq\binom{k+s+1}{2}$. So we may write
$\Omega^{0}_{I^{\prime},s-t}=V(\mathcal{J})$ for some consistent
$(M,k+s-t+1)$-family
$\mathcal{J}\subseteq\mathbb{F}_{p}[x_{0},\dots,x_{k-1},x_{k+t},h_{1},\dots,h_{s-t}]$
of total dimension at most $\binom{k+s-t+2}{2}$. Let
$(\mathcal{J}^{\prime},\mathcal{J}^{\prime\prime})$ be an
$\\{x_{1},\dots,x_{k-1},x_{k+t},h_{1},\dots,h_{s-t}\\}$-decomposition of
$\mathcal{J}$. For convenience denote
$\mathbb{y}=(x_{1},\dots,x_{k-1},x_{k+t})$. Let $W^{\prime}$ be the set of
$(\mathbb{y},\mathbb{h})\in(\mathbb{F}_{p}^{d})^{k+s-t}$ such that
$(x_{0},\mathbb{y},\mathbb{h})\in V(\mathcal{J}^{\prime})$ for all
$x_{0}\in\mathbb{F}_{p}^{d}$. For
$(\mathbb{y},\mathbb{h})\in(\mathbb{F}_{p}^{d})^{k+s-t}$, let
$\Omega^{0}_{I^{\prime},s-t}(\mathbb{y},\mathbb{h})$ denote the set of
$x_{0}\in\mathbb{F}_{p}^{d}$ such that $(x_{0},\mathbb{y},\mathbb{h})\in
V(\mathcal{J}^{\prime\prime})$. Since $d\geq(k+s+1)(k+s)+1$, By Theorem B.12
and the Cauchy-Schwartz inequality, (4.10) is bounded by

(4.11) $\begin{split}&\quad\Bigl{|}\mathbb{E}_{(\mathbb{y},\mathbb{h})\in
W^{\prime}}\Delta_{\mathbb{h}}f_{k+t}(x_{k+t})\mathbb{E}_{x_{0}\in\Omega_{I^{\prime},s-t}^{0}(\mathbb{y},\mathbb{h})}\Delta_{\mathbb{h}}f_{0}(x_{0})\prod_{i=1}^{t-1}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(x_{0},\mathbb{y}))\Bigr{|}^{2}+O_{k,s}(p^{-1})\\\
&\leq\mathbb{E}_{(\mathbb{y},\mathbb{h})\in
W^{\prime}}\Bigl{|}\mathbb{E}_{x_{0}\in\Omega_{I^{\prime},s-t}^{0}(\mathbb{y},\mathbb{h})}\Delta_{\mathbb{h}}f_{0}(x_{0})\prod_{i=1}^{t-1}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(x_{0},\mathbb{y}))\Bigr{|}^{2}+O_{k,s}(p^{-1})\\\
&=\mathbb{E}_{(\mathbb{y},\mathbb{h})\in
W^{\prime}}\mathbb{E}_{x_{0},x_{0}+h^{\prime}\in\Omega_{I^{\prime},s-t}^{0}(\mathbb{y},\mathbb{h})}\Delta_{h^{\prime}}\Delta_{\mathbb{h}}f_{0}(x_{0})\prod_{i=1}^{t-1}\Delta_{h^{\prime}}\Delta_{\mathbb{h}}f_{k+i}(L_{I^{\prime},k+i}(x_{0},\mathbb{y}))+O_{k,s}(p^{-1}).\end{split}$

By (4.5), $\Omega^{0}_{I^{\prime},s-t+1}$ is a consistent $M$-set of total co-
dimension at most $\binom{k+s-t+3}{2}\leq\binom{k+s+2}{2}$. So we may write
$\Omega^{0}_{I^{\prime},s-t+1}=V(\mathcal{J})$ for some consistent
$(M,k+s-t+2)$-family
$\mathcal{J}\subseteq\mathbb{F}_{p}[x_{0},\dots,x_{k-1},x_{k+t},h_{1},\dots,h_{s-t},h^{\prime}]$
of total dimension at most $\binom{k+s-t+3}{2}$. Let
$(\mathcal{J}^{\prime},\mathcal{J}^{\prime\prime})$ be an
$\\{x_{1},\dots,x_{k-1},x_{k+t},h_{1},\dots,h_{s-t}\\}$-decomposition of
$\mathcal{J}$. It is not hard to compute that the set of
$(\mathbb{y},\mathbb{h})\in(\mathbb{F}_{p}^{d})^{k+s-t}$ such that
$(x_{0},\mathbb{y},\mathbb{h},h^{\prime})\in V(\mathcal{J}^{\prime})$ for all
$x_{0},h^{\prime}\in\mathbb{F}_{p}^{d}$ is equal to $W^{\prime}$. For
$(\mathbb{y},\mathbb{h})\in W^{\prime}$ and
$(x_{0},h^{\prime})\in(\mathbb{F}_{p}^{d})^{2}$, note that
$(x_{0},\mathbb{y},\mathbb{h},h^{\prime})\in V(\mathcal{J}^{\prime\prime})$ if
and only if
$x_{0},x_{0}+h\in\Omega_{I^{\prime},s-t}^{0}(\mathbb{y},\mathbb{h})$. Write
$\mathbb{h}^{\prime}:=(\mathbb{h},h^{\prime})$. By Theorem B.12, since
$d\geq(k+s+2)(k+s+1)+1$, the right hand side of (4.11) is bounded by

$\begin{split}\mathbb{E}_{(\mathbb{x}=(x_{i})_{i\in
I^{\prime}},\mathbb{h}^{\prime})\in\Omega^{0}_{I^{\prime},s-t+1}}\Delta_{\mathbb{h}^{\prime}}f_{0}(x_{0})\prod_{i=1}^{t-1}\Delta_{\mathbb{h}^{\prime}}f_{k+i}(L_{I^{\prime},k+i}(\mathbb{x}))+O_{k,s}(p^{-1/2}).\end{split}$

where $\mathbb{h}^{\prime}:=(\mathbb{h},h^{\prime})$. This completes the proof
of Proposition 4.3. ∎

##  5\. The rationality of polynomial sequences

###  5.1. Type-III horizontal torus and character

We refer the readers to Appendix A for the definitions and properties for
nilmanifolds defined in [20]. In this paper, in addition to the type-I and
type-II horizontal toruses and characters defined in [20] and [22]
respectively, we need to introduce a third type of horizontal torus and
character.

######  Definition 5.1 ($i$-th type-III horizontal torus and character).

Let $s\in\mathbb{N}_{+}$ and $G/\Gamma$ be an $\mathbb{N}$-filtered
nilmanifold of degree at most $s$ with a filtration $G_{\mathbb{N}}$ and a
Mal’cev basis $\mathcal{X}$. Let $G_{i}^{\nabla}$ denote the group generated
by $G_{i+1}$ and $[G_{j},G_{i-j}]$ for all $0\leq j\leq i$ for
$i\in\mathbb{N}$. Then $G_{i}^{\nabla}$ is a subgroup of $G_{i}$. It is not
hard to check that $(G_{i}^{\nabla})_{i\in\mathbb{N}}$ is an
$\mathbb{N}$-filtration. We say that $G_{i}/G_{i}^{\nabla}(\Gamma\cap G_{i})$
is the _$i$ -th type-III horizontal torus_ of $G/\Gamma$.

An _$i$ -th type-III horizontal character_ of $G/\Gamma$ is a continuous
homomorphism $\eta_{i}\colon G_{i}\to\mathbb{R}$ which vanishes on
$G_{i}^{\nabla}$, and maps $\Gamma\cap G_{i}$ to $\mathbb{Z}$. We say that
$\eta_{i}$ is _nontrivial_ if it is not constant zero. The Mal’cev basis
$\mathcal{X}$ induces a natural isomorphism $\psi\colon
G_{i}/G_{i+1}\to\mathbb{R}^{k}$, and thus we may write
$\eta_{i}(g_{i}):=(m_{1},\dots,m_{k})\cdot\psi(g_{i})$ for some
$m_{1},\dots,m_{k}\in\mathbb{Z}$, where $k=\dim(G_{i})-\dim(G_{i+1})$. We call
the quantity $\|\eta_{i}\|:=|m_{1}|+\dots+|m_{k}|$ the _complexity_ of
$\eta_{i}$ (with respect to $\mathcal{X}$).

Type-III horizontal torus and character are used to characterize the
rationality property of a nilsequence (see for example [2, 9]), which is a
property more delicate than the equidistribution property.

We provide a proposition for type-III horizontal characters for later uses.

######  Proposition 5.2.

Let $d,s\in\mathbb{N}_{+}$ and $G/\Gamma$ be an $\mathbb{N}$-filtered
nilmanifold of degree at most $s$ with a filtration $G_{\mathbb{N}}$. Let
$g,g^{\prime}\in\text{poly}(\mathbb{Z}^{d}\to G_{\mathbb{N}})$, $1\leq i\leq
s$, and $\eta_{i}\colon G_{i}\to\mathbb{R}$ be an $i$-th type-III horizontal
character of $G/\Gamma$.

(i) Let

$g(n)=\prod_{j\in\mathbb{N}^{d},0\leq|j|\leq s}g_{j}^{\binom{n}{j}}$

be the type-I Taylor expansion of $g$, where $g_{j}\in G_{|j|}$. Then for all
$h_{1},\dots,h_{i}\in\mathbb{Z}^{d}$,
$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n))$ is well defined and is equal
to
$\Delta_{h_{i}}\dots\Delta_{h_{1}}\Bigl{(}\sum_{j\in\mathbb{N}^{d},|j|=i}\eta_{i}(g_{j}){\binom{n}{j}}\Bigr{)}$.

(ii) For all $h_{1},\dots,h_{i}\in\mathbb{Z}^{d}$, we have that

$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n))+\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))=\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}gg^{\prime}(n)).$

###### Proof.

We first prove Part (i). $\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n))$ is
well defined since $\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n)\in G_{i}$. Since
$\eta_{i}$ vanishes on $G_{i}^{\nabla}$, by repeatedly using Corollary B.7 of
[12], it is not hard to see that

$\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n)\equiv\prod_{j\in\mathbb{N}^{d},|j|=i}g_{j}^{\Delta_{h_{i}}\dots\Delta_{h_{1}}\binom{n}{j}}\mod
G^{\nabla}_{|i|}.$

So

$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n))=\eta_{i}\Bigl{(}\prod_{j\in\mathbb{N}^{d},|j|=i}g_{j}^{\Delta_{h_{i}}\dots\Delta_{h_{1}}\binom{n}{j}}\Bigr{)}=\Delta_{h_{i}}\dots\Delta_{h_{1}}\Bigl{(}\sum_{j\in\mathbb{N}^{d},|j|=i}\eta_{i}(g_{j}){\binom{n}{j}}\Bigr{)}.$

We now prove Part (ii). By the Baker-Campbell-Hausdorff formula (see Appendix
A.3) and Corollary B.7 of [12], it is not hard to see that the $i$-th type-I
Taylor coefficient of $gg^{\prime}$ equals to that of $g$ multiplied by that
of $g^{\prime}$ modulo $G^{\nabla}_{|i|}$. The conclusion then follows from
Part (i) and the linearity of $\eta_{i}\mod G^{\nabla}_{|i|}$. ∎

###  5.2. The rationality version of the factorization theorem

As was explain the paper of Green and Tao [9], the type-I horizontal
characters and the factorization theorem pertaining to them are insufficient
for the study of the equidistribution property for Leibman groups (see Section
6 for the definition). For this reason, we need to upgrade the
equidistribution result obtained in the previous part of the series (i.e.
Theorems 11.2 of [20]) for type-III horizontal characters. We start with the
following concept.

######  Definition 5.3 (Irrationality).

Let $d,s\in\mathbb{N}_{+},N>0$, $p$ be a prime, $G/\Gamma$ be an
$\mathbb{N}$-filtered nilmanifold of degree at most $s$ with a filtration
$G_{\mathbb{N}}$ and a Mal’cev basis $\mathcal{X}$, $\Omega$ be a subset of
$\mathbb{Z}^{d}$, and $g\in\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$.
We say that $g$ is _$(N,\Omega,p)$ -rational_ there exist $1\leq i\leq s$ and
a nontrivial $i$-th type-III horizontal character $\eta_{i}\colon
G_{i}\to\mathbb{R}$ of complexity at most $N$ such that the map

$(n,h_{1},\dots,h_{i})\mapsto\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g(n))\mod\mathbb{Z}$

(which is well defined by Proposition 5.2) is a constant on
$\Box_{p,i}(\Omega)$ (recall Section 1.3 for the definition). We say that $g$
is _$(N,\Omega,p)$ -irrational_ if it is not $(N,\Omega,p)$-rational.

Let $\Omega$ be a subset of $\mathbb{F}_{p}^{d}$ and
$g\in\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$ (recall the definitions
of different notions of polynomial sequences in Appendices A.1 and A.2). We
say that $g$ is _$(N,\Omega)$ -rational/irrational_ if $g=g^{\prime}\circ\tau$
for some $g^{\prime}\in\text{poly}_{p}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$
which is $(N,\tau(\Omega),p)$-rational/irrational.

For convenience, we define every polynomial of degree $s=0$ (i.e. every
constant polynomial) to be $(N,\tau(\Omega),p)$-irrational or
$(N,\Omega)$-irrational for all $N>0$.

The next lemma says that the rationality of a polynomial in
$\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$ is independent of choice of
the representatives in $\text{poly}_{p}(\tau(\Omega)\to
G_{\mathbb{N}}|\Gamma)$.

######  Lemma 5.4.

Let $\Omega$ be a subset of $\mathbb{F}_{p}^{d}$ and
$g\in\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$. If for some
$g^{\prime}\in\text{poly}_{p}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$ with
$g=g^{\prime}\circ\tau$, $g^{\prime}$ is
$(N,\tau(\Omega),p)$-rational/irrational, then for every
$g^{\prime}\in\text{poly}_{p}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$ with
$g=g^{\prime}\circ\tau$, we have that $g^{\prime}$ is
$(N,\tau(\Omega),p)$-rational/irrational. In other words, the
$(N,\Omega)$-rational/irrational property of $g$ is independent of the choices
of $g^{\prime}$.

###### Proof.

Assume without loss of generality that $G/\Gamma$ is of degree at least 1. Let
$g^{\prime},g^{\prime\prime}\in\text{poly}_{p}(\tau(\Omega)\to
G_{\mathbb{N}}|\Gamma)$ with
$g=g^{\prime}\circ\tau=g^{\prime\prime}\circ\tau$. It suffices to show that
for any $i$-th type-III horizontal character $\eta_{i}\colon
G_{i}\to\mathbb{R}$ and any
$(n,h_{1},\dots,h_{i})\in\Box_{p,i}(\tau(\Omega))$, we have that

(5.1)
$\begin{split}\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime\prime}(n))\equiv\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))\mod\mathbb{Z}.\end{split}$

Write $\tilde{g}:={g^{\prime}}^{-1}g^{\prime\prime}$. Since
$g^{\prime}\circ\tau=g^{\prime\prime}\circ\tau$, we have that
$g^{\prime}(n)^{-1}g^{\prime\prime}(n)\in\Gamma$ for all $n\in\tau(\Omega)$.
Since $g^{\prime},g^{\prime\prime}\in\text{poly}_{p}(\tau(\Omega)\to
G_{I}|\Gamma)$, for all $n\in\tau(\Omega)$ and $m\in\mathbb{Z}^{k}$, we have
that

$g^{\prime}(n+pm)^{-1}g^{\prime\prime}(n+pm)=(g^{\prime}(n+pm)^{-1}g^{\prime}(n))(g^{\prime}(n)^{-1}g^{\prime\prime}(n))(g^{\prime\prime}(n)^{-1}g^{\prime\prime}(n+pm))\in\Gamma.$

So $\tilde{g}\in\text{poly}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$.

By Proposition 5.2,

(5.2)
$\begin{split}\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime\prime}(n))-\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))=\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}\tilde{g}(n)).\end{split}$

For any $(n,h_{1},\dots,h_{i})\in\Box_{p,i}(\tau(\Omega))$, since
$\tilde{g}\in\text{poly}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$,
$\Delta_{h_{i}}\dots\Delta_{h_{1}}\tilde{g}(n)$ belongs to $\Gamma$. So we
have that
$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}\tilde{g}(n))\in\mathbb{Z}$ and
thus (5.1) follows from (5.2). ∎

Let $\Omega$ be a non-empty finite set and $G/\Gamma$ be an
$\mathbb{N}$-filtered nilmanifold. Recall that a sequence
$\mathcal{O}\colon\Omega\to G/\Gamma$ is _$\delta$ -equidistributed_ on
$G/\Gamma$ if for all Lipschitz function $F\colon G/\Gamma\to\mathbb{C}$, we
have that

$\Bigl{|}\frac{1}{|\Omega|}\sum_{n\in\Omega}F(\mathcal{O}(n))-\int_{G/\Gamma}F\,dm_{G/\Gamma}\Bigr{|}\leq\delta\|F\|_{\text{Lip}},$

where $m_{G/\Gamma}$ is the Haar measure of $G/\Gamma$. The next lemma
explains the connection between irrationality and equidistribution of
polynomial sequences. We do not use it in this paper, but it is interesting on
its own.

######  Lemma 5.5 (Irrationality implies equidistribution).

Let $d\in\mathbb{N}_{+},s\in\mathbb{N},C,C^{\prime},K,N>0$, $p$ be a prime,
and $G/\Gamma$ be an $\mathbb{N}$-filtered nilmanifold of degree at most $s$
and complexity at most $C$. There exists
$C^{\prime\prime}=C^{\prime\prime}(C,C^{\prime},K,s)>0$ such that for any
$\Omega\subseteq\mathbb{F}_{p}^{d}$ which admits a
$(\delta,C^{\prime}\delta^{-K})$-Leibman dichotomy777See Appendix B.7 for the
definition. up to step $s$ and complexity $C$ and any $(N,\Omega)$-irrational
$g\in\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$, the sequence
$(g(n)\Gamma)_{n\in\Omega}$ is $C^{\prime\prime}N^{-1/K}$-equidistributed on
$G/\Gamma$.

###### Proof.

There is nothing to prove when $s=0$, and so we assume that $s\geq 1$. Let
$\delta>0$ to be chosen later. Assume that $g=g^{\prime}\circ\tau$ for some
$g^{\prime}\in\text{poly}_{p}(\tau(\Omega)\to G_{\mathbb{N}}|\Gamma)$. Suppose
that $(g(n)\Gamma)_{n\in\Omega}$ is not $\delta$-equidistributed on
$G/\Gamma$, then by assumption, there exists a nontrivial type-I horizontal
character $\eta\colon G\to\mathbb{R}$ of complexity at most
$C^{\prime}\delta^{-K}$ such that $\eta\circ g\mod\mathbb{Z}$ is a constant on
$\Omega$ and thus $\eta\circ g^{\prime}\mod\mathbb{Z}$ is a constant on
$\tau(\Omega)+p\mathbb{Z}^{d}$.

Let $i$ be the largest integer $1\leq i\leq s$ such that $\eta|_{G_{i}}$ is
nontrivial. Since $\eta\circ g^{\prime}\mod\mathbb{Z}$ is a constant on
$\tau(\Omega)+p\mathbb{Z}^{d}$, we have that

$\eta|_{G_{i}}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))=\eta(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))=\Delta_{h_{i}}\dots\Delta_{h_{1}}\eta\circ
g^{\prime}(n)$

is a constant mod $\mathbb{Z}$ for all
$(n,h_{1},\dots,h_{i})\in\Box_{p,i}(\tau(\Omega))$. Similar to the proof of
Lemma 3.7 of [9], $\eta|_{G_{i}}$ is an $i$-th type-III horizontal character
of complexity $O_{C,s}(C^{\prime}\delta^{-K})$. So $g^{\prime}$ is not
$(O_{C,s}(C^{\prime}\delta^{-K}),\Omega,p)$-irrational and thus $g$ is not
$(O_{C,s}(C^{\prime}\delta^{-K}),\Omega)$-irrational. We arrive at a
contradiction if $O_{C,s}(C^{\prime}\delta^{-K})\leq N$, i.e. if $\delta\geq
C^{\prime\prime}N^{-1/K}$ for some $C^{\prime\prime}>0$ depending only on
$C,C^{\prime},K$ and $s$. ∎

We now state and prove the factorization property regarding the irrationality
polynomials sequences.

######  Proposition 5.6 (Weak factorization property, the rationality
version).

Let $d\in\mathbb{N}_{+},s\in\mathbb{N}$ with $d\geq s^{2}+s+3$, $C,N>0$, $p$
be a prime, $M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate
quadratic form, $G/\Gamma$ be an $s$-step $\mathbb{N}$-filtered nilmanifold of
complexity at most $C$, equipped with a $C$-rational Mal’cev basis
$\mathcal{X}$, and $g\in\text{poly}_{p}(V(M)\to G_{\mathbb{N}}|\Gamma)$. If
$p\gg_{C,d,N}1$, then either $g$ is $(N,V(M))$-irrational or there exists a
factorization

$g(n)=\epsilon g^{\prime}(n)\gamma(n)\text{ for all }n\in\mathbb{F}_{p}^{d},$

where $\epsilon\in G$ is of complexity at most 1,
$g^{\prime}\in\text{poly}_{p}(V(M)\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$ for some sub-nilmanifold
$G^{\prime}/\Gamma^{\prime}$ of $G/\Gamma$ whose Mal’cev basis is
$O_{C,d,N}(1)$-rational relative to $\mathcal{X}$ and whose total dimension is
strictly smaller than that of $G/\Gamma$, and $\gamma\in\text{poly}(V(M)\to
G_{\mathbb{N}}|\Gamma)$.

###### Proof.

The proof uses ideas from Lemma 2.9 of [11] and the work [2]. However, in our
case, we need some extra effort to obtain the desired periodicity requirements
for the sequences $g^{\prime}$ and $\gamma$.

There is nothing to prove when $s=0$, and so we assume that $s\geq 1$. Let
$\tilde{M}\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$ be a regular lifting of $M$. We
may write $g=\tilde{g}\circ\tau$ for some
$\tilde{g}\in\text{poly}_{p}(\tau(V(M))\to
G_{\mathbb{N}}|\Gamma)=\text{poly}_{p}(V_{p}(\tilde{M})\to
G_{\mathbb{N}}|\Gamma)$ (recall the definition of $V_{p}(\tilde{M})$ in
Section 1.3). Suppose that $g$ is not $(N,V(M))$-irrational. Then there exist
$1\leq i\leq s$ and a nontrivial $i$-th type-II horizontal character
$\eta_{i}\colon G_{i}\to\mathbb{R}$ of complexity at most $N$ such that

$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}\tilde{g}(n))\mod\mathbb{Z}$

is a constant for all
$(n,h_{1},\dots,h_{i})\in\Box_{p,i}(\tau(V(M)))=\Box_{p,i}(V_{p}(\tilde{M}))$.
We may use the type-I Taylor expansion to write

$\tilde{g}(n)=\prod_{j\in\mathbb{N}^{d},|j|\leq s}g_{j}^{\binom{n}{j}}$

for some $g_{j}\in G_{|j|}$. Denote
$g_{-}(n):=\prod_{j\in\mathbb{N}^{d},|j|\leq i-1}g_{j}^{\binom{n}{j}}$,
$g_{+}(n):=\prod_{j\in\mathbb{N}^{d},i+1\leq|j|\leq s}g_{j}^{\binom{n}{j}}$
and $f(n):=\prod_{j\in\mathbb{N}^{d},|j|=i}g_{j}^{\binom{n}{j}}$. Then

(5.3) $\tilde{g}=g_{-}fg_{+}.$

By Proposition 5.2 (i), we have that

$\eta_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}\tilde{g}(n))\equiv\Delta_{h_{i}}\dots\Delta_{h_{1}}(\eta_{i}\circ
f(n))\mod\mathbb{Z}$

is a constant for all $(n,h_{1},\dots,h_{i})\in\Box_{p,i}(V_{p}(\tilde{M}))$.
Note that $\eta_{i}\circ f$ is a polynomial from $\mathbb{Z}^{d}$ to
$\mathbb{R}$ of degree $i$.

For any $j=(j_{1},\dots,j_{d})\in\mathbb{N}^{d}$ with $|j|=i$, pick $1\leq
d_{1},\dots,d_{i}\leq d$ so that $j_{\ell}$ of $d_{1},\dots,d_{i}$ equals to
$\ell$ for all $1\leq\ell\leq d$. Then for any $n\in V_{p}(\tilde{M})$, we
have that $(n,pe_{d_{1}},\dots,pe_{d_{i}})\in\Box_{p,i}(V_{p}(\tilde{M}))$.
Since $\tilde{g}\in\text{poly}_{p}(V_{p}(\tilde{M})\to
G_{\mathbb{N}}|\Gamma)$, we have
$\Delta_{pe_{d_{i}}}\dots\Delta_{pe_{d_{1}}}\tilde{g}(n)\in\Gamma$ and so

$\begin{split}0\equiv\eta_{i}(\Delta_{pe_{d_{i}}}\dots\Delta_{pe_{d_{1}}}\tilde{g}(n))\equiv\Delta_{pe_{d_{i}}}\dots\Delta_{pe_{d_{1}}}(\eta_{i}\circ
f(n))=p^{i}\eta_{i}(g_{j})\mod\mathbb{Z}.\end{split}$

Therefore, $\eta_{i}\circ f$ takes values in $\mathbb{Z}/p^{s}$. Since $d\geq
s^{2}+s+3$, by Proposition B.13, we may write

$\eta_{i}\circ f=\frac{1}{q}P_{1}+P_{2}$

for some $q\in\mathbb{N},p\nmid q$, some
$P_{1}\in\text{poly}(V_{p}(\tilde{M})\to\mathbb{R}|\mathbb{Z})$ and some
polynomial $P_{2}$ of degree at most $i-1$.

Let $\psi\colon G_{i}/G_{i+1}\to\mathbb{R}^{k}$ be the natural isomorphism
induced by the Mal’cev basis of $G/\Gamma$ for some $k\in\mathbb{N}$, and
write $\eta_{i}(g):=(m_{1},\dots,m_{k})\cdot\psi(g)$ for some
$m_{1},\dots,m_{k}\in\mathbb{Z}$ with $|m_{1}|+\dots+|m_{k}|\leq N$ for all
$g\in G_{i}$. Let $c$ be the greatest common divisor of $m_{1},\dots,m_{k}$.
Since $\eta_{i}$ is nontrivial and is of complexity at most $N$, we have that
$0<c\leq O_{C,N,s}(1)$. In particular, $c<p$. We may then pick
$u=(u_{1},\dots,u_{k})\in\mathbb{Z}^{k}$ such that
$(m_{1},\dots,m_{k})\cdot(u_{1},\dots,u_{k})=c$. Let $h_{1},\dots,h_{k}\in
G_{i}\cap\Gamma$ be such that $\psi(h_{t}\mod G_{i+1})=e_{t}$ for all $1\leq
t\leq k$. Denote

$\gamma_{0}(n):=\prod_{t=1}^{k}h_{t}^{c^{\ast}u_{t}P_{1}(n)},$

where $c^{\ast}$ is an integer such that $c^{\ast}cq\equiv 1\mod
p^{s}\mathbb{Z}$ (which exists since $0<c<p$). Since $P_{1}(n)\in\mathbb{Z}$
if $n\in V_{p}(\tilde{M})$, we have that
$\gamma_{0}\in\text{poly}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$.
Moreover, for all $n\in\mathbb{Z}^{d}$, we have

(5.4) $\eta_{i}\circ
f-\eta_{i}\circ\gamma_{0}=\frac{1-c^{\ast}cq}{q}P_{1}+P_{2}.$

Claim. For any $i$-th type-III horizontal character $\xi_{i}$, and
$j\in\mathbb{N}^{d}$ with $|j|=i$, we have that
$\xi_{i}(g_{j})\in\mathbb{Z}/p^{s}$.

Indeed, denote
$F_{\xi_{i}}(h_{1},\dots,h_{i}):=\xi_{i}(\Delta_{h_{i}}\dots\Delta_{h_{1}}g^{\prime}(n))$.
Note that $F_{\xi_{i}}(h_{1},\dots,h_{i})$ is independent of the choice of
$n$. It is not hard to compute that

(5.5)
$F_{\xi_{i}}(h_{1},\dots,h_{i}):=\sum_{j\in\mathbb{N}^{d},|j|=i}\xi_{i}(g_{j})\sum_{(t_{1},\dots,t_{i})\in
J(j)}h_{1,t_{1}}\dots h_{i,t_{i}},$

where we write $h_{i^{\prime}}=(h_{i^{\prime},1},\dots,h_{i^{\prime},d})$ for
$1\leq i^{\prime}\leq i$ and $J(j)$ is the set of tuples
$(t_{1},\dots,t_{i})\in\\{1,\dots,d\\}^{i}$ such that the number of $t_{k}$
which equals to $r$ is $j_{r}$ for $1\leq r\leq d$. Since
$g^{\prime}\in\text{poly}_{p}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$, for
all $n\in V_{p}(\tilde{M}),$ and $h_{1},\dots,h_{i}\in\mathbb{Z}^{d}$, we have
that $\Delta_{ph_{i}}\dots\Delta_{ph_{1}}g^{\prime}(n)\in\Gamma$, which
implies that $F_{\xi_{i}}(h_{1},\dots,h_{i})\in\mathbb{Z}/p^{s}$. By (5.5),
this implies that $\xi_{i}(g_{j})\in\mathbb{Z}/p^{s}$. This completes the
proof of the claim.

By the claim, $\psi(g_{j}^{p^{s}}\mod G_{i+1})\in\mathbb{Z}^{k}$ and so we
have that
$p^{s}\eta_{i}(g_{j})=\eta_{i}(g_{j}^{p^{s}})\in\eta_{i}(G_{i}\cap\Gamma)=c\mathbb{Z}$.
Since $1-c^{\ast}cq\in p\mathbb{Z}$, we have $(1-c^{\ast}cq)\eta_{i}(g_{j})\in
c\mathbb{Z}$. Then for all $j\in\mathbb{N}^{d}$ with $|j|=i$, there exists
$\gamma_{j}\in G_{i}\cap\Gamma$ such that
$\eta_{i}(\gamma_{j})=(1-c^{\ast}cq)\eta_{i}(g_{j})$.

Note that the leading terms of $\frac{1-c^{\ast}cq}{q}P_{1}$ is
$\sum_{j\in\mathbb{N}^{d},|j|=i}(1-c^{\ast}cq)\eta_{i}(g_{j})\frac{n^{j}}{j!}$.
Writing

$\gamma^{\prime}(n):=\prod_{j\in\mathbb{N}^{d},|j|=i}\gamma_{j}^{\binom{n}{j}},$

we have that $\gamma^{\prime}$ takes values in $\Gamma$ and that
$\eta_{i}\circ\gamma^{\prime}(n)$ has the same leading terms as
$\frac{1-c^{\ast}cq}{q}P_{1}(n)$. So it follows from (5.4) that

$\eta_{i}\circ f-\eta_{i}\circ\gamma_{0}-\eta_{i}\circ\gamma^{\prime}$

is a polynomial of degree at most $i-1$.

Since $\eta_{i}$ is nontrivial, there exists
$f^{\prime}\in\text{poly}(\mathbb{Z}^{d}\to G_{\mathbb{N}})$ of the form

$f^{\prime}(n)=\prod_{j\in\mathbb{N}^{d},|j|\leq i-1}u_{j}^{\binom{n}{j}}$

for some $u_{j}\in G_{i}$ such that

$\eta_{i}\circ
f-\eta_{i}\circ\gamma_{0}-\eta_{i}\circ\gamma^{\prime}=\eta_{i}\circ
f^{\prime}.$

Let $\gamma:=\gamma_{0}\gamma^{\prime}$, and
$g^{\prime\prime}:={f^{\prime}}^{-1}f\gamma^{-1}$. We have that
$\gamma\in\text{poly}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$, that
$g^{\prime\prime}$ takes values in $G_{i}$, and that $\eta_{i}\circ
g^{\prime\prime}=0$. By (5.3), we may write

$\tilde{g}=g_{-}fg_{+}=g_{-}f^{\prime}g^{\prime\prime}\gamma g_{+},$

where $g_{-}(n):=\prod_{j\in\mathbb{N}^{d},|j|\leq i-1}g_{j}^{\binom{n}{j}}$
and $g_{+}(n):=\prod_{j\in\mathbb{N}^{d},i+1\leq|j|\leq
s}g_{j}^{\binom{n}{j}}$. By the Baker-Campbell-Hausdorff formula, we may write

$\tilde{g}=g_{-}f^{\prime}g^{\prime\prime}g^{\prime}_{+}\gamma$

for some $g^{\prime}_{+}$ which can be written in the form
$g^{\prime}_{+}(n)=\prod_{j\in\mathbb{N}^{d},|j|\leq s}h_{j}^{\binom{n}{j}}$
for some $h_{j}\in G_{\max\\{|j|,i+1\\}}$.

Let $G^{\prime}/\Gamma^{\prime}$ be the sub-nilmanifold of $G/\Gamma$ given by
$\Gamma^{\prime}=\Gamma\cap G^{\prime}$, $G^{\prime}_{j}=G_{j}$ for all $j\neq
i$ and $G^{\prime}_{i}=\ker(\eta_{i})$. Similar to the proof of Lemma 2.9 of
[9], $G^{\prime}_{\mathbb{N}}$ is indeed an $\mathbb{N}$-filtration.888Unlike
in the proof Lemma 2.9 of [11], our $G^{\prime}_{\mathbb{N}}$ is an
$\mathbb{N}$-filtration even if $i=1$, since in this paper we allow
$G^{\prime}_{0}\neq G^{\prime}_{1}$ in the $\mathbb{N}$-filtration
$G^{\prime}_{\mathbb{N}}$. Moreover, the Mal’cev basis of
$G^{\prime}/\Gamma^{\prime}$ is $O_{C,d,N}(1)$-rational relative to
$\mathcal{X}$, and the total dimension of $G^{\prime}/\Gamma^{\prime}$ is
strictly smaller than that of $G/\Gamma$.

For any $h\in G$, we may write $h=\\{h\\}[h]$ such that
$\psi(\\{h\\})\in[0,1)^{m}$ and $[h]\in\Gamma$, where $\psi\colon
G\to\mathbb{R}^{m}$ is the Mal’cev coordinate map. Let
$\epsilon=\\{\tilde{g}(\mathbb{0})\\}$,
$\tilde{\gamma}=[\tilde{g}(\mathbb{0})]\gamma$ and

$g^{\prime}=\\{\tilde{g}(\mathbb{0})\\}^{-1}\tilde{g}\tilde{\gamma}^{-1}=\\{\tilde{g}(\mathbb{0})\\}^{-1}\tilde{g}\gamma^{-1}[\tilde{g}(\mathbb{0})]^{-1}=\\{\tilde{g}(\mathbb{0})\\}^{-1}g_{-}f^{\prime}g^{\prime\prime}g^{\prime}_{+}[\tilde{g}(\mathbb{0})]^{-1}.$

Then $\tilde{g}=\epsilon g^{\prime}\tilde{\gamma}$ and
$\tilde{\gamma}\in\text{poly}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$. By
the constructions, it is not hard to see that
$g^{\prime\prime},g^{\prime}_{+},g_{-},f^{\prime}\in\text{poly}(\mathbb{Z}^{d}\to
G^{\prime}_{\mathbb{N}})$. By Corollary B.4 of [12], we have that
$g^{\prime}\in\text{poly}(\mathbb{Z}^{d}\to G^{\prime}_{\mathbb{N}})$. Since
$\tilde{g}\in\text{poly}_{p}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$ and
$\tilde{\gamma}\in\text{poly}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$, by
Lemma A.14, it is not hard to see have that $g^{\prime}$ belongs
$\text{poly}_{p}(V_{p}(\tilde{M})\to G_{\mathbb{N}}|\Gamma)$ and thus belongs
$\text{poly}_{p}(V_{p}(\tilde{M})\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$. Since
$\tau(V(M))+p\mathbb{Z}^{d}=V_{p}(\tilde{M})$, we are done by composing $\tau$
on both sides. ∎

By repeatedly using Proposition 5.6, we get the strong factorization property:

######  Theorem 5.7 (Strong factorization property, the rationality version).

Let $d\in\mathbb{N}_{+},s\in\mathbb{N}$ with $d\geq s^{2}+s+3$, $C>0$,
$\mathcal{F}\colon\mathbb{R}_{+}\to\mathbb{R}_{+}$ be a growth function,
$p\gg_{C,d,\mathcal{F}}1$ be a prime,
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate quadratic
form, $G/\Gamma$ be an $s$-step $\mathbb{N}$-filtered nilmanifold of
complexity at most $C$, equipped with a $C$-rational Mal’cev basis
$\mathcal{X}$, and $g\in\text{poly}_{p}(V(M)\to G_{\mathbb{N}}|\Gamma)$. Then
there exists $C\leq C^{\prime}\leq O_{C,d,\mathcal{F}}(1)$ and a factorization

$g(n)=\epsilon g^{\prime}(n)\gamma(n)\text{ for all }n\in\mathbb{F}_{p}^{d}$

where $\epsilon\in G$ if of complexity $O_{C^{\prime}}(1)$,
$g^{\prime}\in\text{poly}_{p}(V(M)\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$ is
$(\mathcal{F}(C^{\prime}),V(M))$-irrational for some sub-nilmanifold
$G^{\prime}/\Gamma^{\prime}$ of $G/\Gamma$ whose Mal’cev basis is
$C^{\prime}$-rational relative to $\mathcal{X}$, and
$\gamma\in\text{poly}(V(M)\to G_{\mathbb{N}}|\Gamma)$.

Theorem 5.7 can be derived by repeatedly using Proposition 5.6. The method is
almost identical to the proof of Theorem 11.2 in [20]. So we omit the proof.

We conclude this section with a property stating that every partially periodic
nilsequence on $V(M)$ can be represent as a sufficiently irrational one.

######  Proposition 5.8 (Irrational representation property).

Let $d\in\mathbb{N}_{+},s\in\mathbb{N}$ with $d\geq s^{2}+s+3$, $C>0$,
$\mathcal{F}\colon\mathbb{R}_{+}\to\mathbb{R}_{+}$ be a growth function,
$p\gg_{C,d,\mathcal{F}}1$ be a prime, and
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate quadratic
form. Then there exists $C\leq C^{\prime}\leq O_{C,d,\mathcal{F}}(1)$ such
that for any function $f\colon V(M)\to\mathbb{C}$ of the form

$f(n)=F(g(n)\Gamma)\text{ for all }n\in V(M),$

where $G/\Gamma$ is an $\mathbb{N}$-filtered nilmanifold of degree at most $s$
and complexity at most $C$, $g\in\text{poly}_{p}(V(M)\to
G_{\mathbb{N}}|\Gamma)$, and $F\in\text{Lip}(G/\Gamma\to\mathbb{C})$ with
Lipschitz norm at most $C$, we may rewrite $f$ as

$f(n)=F^{\prime}(g^{\prime}(n)\Gamma^{\prime})\text{ for all }n\in V(M)$

for some $\mathbb{N}$-filtered nilmanifold $G^{\prime}/\Gamma^{\prime}$ of
degree at most $s$ and complexity at most $O_{C,C^{\prime}}(1)$, some
$(\mathcal{F}(C^{\prime}),V(M))$-irrational
$g^{\prime}\in\text{poly}_{p}(V(M)\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$, and some
$F^{\prime}\in\text{Lip}(G^{\prime}/\Gamma^{\prime}\to\mathbb{C})$ with
Lipschitz norm at most $O_{C,C^{\prime}}(1)$.

###### Proof.

By Theorem 5.7, there exists $C\leq C^{\prime}\leq O_{C,d,\mathcal{F}}(1)$ and
a factorization

$g(n)=\epsilon g^{\prime}(n)\gamma(n)\text{ for all }n\in\mathbb{F}_{p}^{d}$

where $\epsilon\in G$ is of complexity $O_{C^{\prime}}(1)$,
$g^{\prime}\in\text{poly}_{p}(V(M)\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$ is
$(\mathcal{F}(C^{\prime}),V(M))$-rational in some sub-nilmanifold
$G^{\prime}/\Gamma^{\prime}$ of $G/\Gamma$ whose Mal’cev basis is
$C^{\prime}$-rational relative to $\mathcal{X}$, and
$\gamma\in\text{poly}(V(M)\to G_{\mathbb{N}}|\Gamma)$. Then
$G^{\prime}/\Gamma^{\prime}$ is of complexity $O_{C,C^{\prime}}(1)$. Writing
$F^{\prime}=F(\epsilon\cdot)$, we have that $F^{\prime}\colon
G^{\prime}/\Gamma^{\prime}\to\mathbb{C}$ is a Lipschitz function with
Lipschitz norm at most $O_{C,C^{\prime}}(1)$. Moreover, for all $n\in V(M)$,
we have that $f(n)=F(\epsilon
g^{\prime}(n)\gamma(n)\Gamma)=F^{\prime}(g^{\prime}(n)\Gamma).$ ∎

######  Remark 5.9.

We caution the readers that were unable to extend Proposition 5.8 to
$p$-periodic nilsequences, i.e. even if $g$ belongs to
$\text{poly}_{p}(\mathbb{F}_{p}^{d}\to G_{\mathbb{N}}|\Gamma)$, we could not
ensure that $g^{\prime}$ belongs to $\text{poly}_{p}(\mathbb{F}_{p}^{d}\to
G^{\prime}_{\mathbb{N}}|\Gamma^{\prime})$ in the construction. This is because
our factorization theorem (Theorem 5.7) applies only for partially
$p$-periodic nilsequences (see also Remark 11.3 in [20]).

###  5.3. Structure theorems for spherical Gowers norms

For any $s\in\mathbb{N}$ and $C>0$, it is not hard to see that the sum and
product of two $p$-periodic nilsequences of degrees at most $s$ and
complexities at most $C$ is still a $p$-periodic nilsequence of degree at most
$s$ and complexity at most $O(C)$ (see [22] for definitions). So combining the
spherical Gowers inverse theorem (Theorem 1.2 of [22]) with an argument
similar to Section 2 of the work of Green and Tao [9] (see also the discussion
before Theorem 3.4 of [2]), we have the following structure theorem (whose
proof is omitted):

######  Theorem 5.10 (Structure theorem for spherical Gowers norms in
$\mathbb{F}_{p}^{d}$).

For every $s\in\mathbb{N}$, every $d\geq(2s+14)(15s+438)$, every $\epsilon>0$,
and every growth function $\mathcal{F}\colon\mathbb{R}_{+}\to\mathbb{R}_{+}$,
there exist $C:=C(d,\epsilon,\mathcal{F})>0$ and
$p_{0}:=p_{0}(d,\epsilon,\mathcal{F})\in\mathbb{N}$ such that for every prime
$p\geq p_{0}$, every non-degenerate quadratic form
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$, and every $f\colon
V(M)\to\mathbb{C}$ taking values in $[0,1]$, there exist a decomposition

$f=f_{\text{str}}+f_{\text{uni}}+f_{\text{err}}$

such that the followings hold:

  * •

$f_{\text{str}}$ and $f_{\text{str}}+f_{\text{err}}$ take values in $[0,1]$;

  * •

we may write $f_{\text{str}}$ as

$f_{\text{str}}(n)=F(g(n)\Gamma)\text{ for all }n\in V(M)$

for some $\mathbb{N}$-filtered nilmanifold $G/\Gamma$ of degree at most $s$
and complexity at most $C$, some $g\in\text{poly}_{p}(\mathbb{F}_{p}^{d}\to
G_{\mathbb{N}}|\Gamma)$, and some $F\in\text{Lip}(G/\Gamma\to\mathbb{C})$ of
Lipschitz norm at most $C$;

  * •

$\|f_{\text{uni}}\|_{U^{s+1}(V(M))}\leq 1/\mathcal{F}(C)$;

  * •

$\|f_{\text{err}}\|_{L^{2}(V(M))}\leq\epsilon$.

We may also impose additional irrationality restrictions to the
$f_{\text{str}}$ part in Theorem 5.10, and have the following variation of the
structure theorem:

######  Theorem 5.11 (Another structure theorem for spherical Gowers norms in
$\mathbb{F}_{p}^{d}$).

For every $s\in\mathbb{N}$, every $d\geq(2s+14)(15s+438)$, every $\epsilon>0$,
and every growth function $\mathcal{F}\colon\mathbb{R}_{+}\to\mathbb{R}_{+}$,
there exist $C:=C(d,\epsilon,\mathcal{F})>0$ and
$p_{0}:=p_{0}(d,\epsilon,\mathcal{F})\in\mathbb{N}$ such that for every prime
$p\geq p_{0}$, every non-degenerate quadratic form
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$, and every $f\colon
V(M)\to\mathbb{C}$ taking values in $[0,1]$, there exist a decomposition

$f=f_{\text{str}}+f_{\text{uni}}+f_{\text{err}}$

such that the followings hold:

  * •

$f_{\text{str}}$ and $f_{\text{str}}+f_{\text{err}}$ take values in $[0,1]$;

  * •

we may write $f_{\text{str}}$ as

$f_{\text{str}}(n)=F(g(n)\Gamma)\text{ for all }n\in V(M)$

for some $\mathbb{N}$-filtered nilmanifold $G/\Gamma$ of degree at most $s$
and complexity at most $C$, some $(\mathcal{F}(C),V(M))$-irrational
$g\in\text{poly}_{p}(V(M)\to G_{\mathbb{N}}|\Gamma)$, and some
$F\in\text{Lip}(G/\Gamma\to\mathbb{C})$ of Lipschitz norm at most $C$;

  * •

$\|f_{\text{uni}}\|_{U^{s+1}(V(M))}\leq 1/\mathcal{F}(C)$;

  * •

$\|f_{\text{err}}\|_{L^{2}(V(M))}\leq\epsilon$.

Since $\text{poly}_{p}(\mathbb{F}_{p}^{d}\to
G_{\mathbb{N}}|\Gamma)\subseteq\text{poly}_{p}(V(M)\to
G_{\mathbb{N}}|\Gamma)$, Theorem 5.11 can be proved by first applying Theorem
5.10 for some growth function $\mathcal{F}_{1}$, and then applying Proposition
5.8 for some growth function $\mathcal{F}_{2}$, with $\mathcal{F}_{1}$ growing
much faster than $\mathcal{F}_{2}$ and with $\mathcal{F}_{2}$ growing much
faster than $\mathcal{F}$. We omit the proof.

######  Remark 5.12.

Again we caution the readers that unlike in Theorem 5.10 where
$f_{\text{str}}$ is $p$-periodic, we can only require $f_{\text{str}}$ to be
partially $p$-periodic on $V(M)$ in Theorem 5.11. This is because we are only
able to obtain the factorization theorem (Theorem 5.7) for partially
$p$-periodic nilsequences, which in turn is insufficient to extend Proposition
5.8 to $p$-periodic nilsequences.

##  6\. Equisitribution properties for polynomial sequences on product spaces

With the help of Theorems 4.2 and 5.11, one can reduce the study of (4.1) to
the special case when all the $f_{i}$ are nilsequences. Therefore, in order to
obtain the positivity of (4.1), in this section we provide a joint
equisitribution property for polynomial sequences on the product space.

###  6.1. Parametrization for $\Omega$ and its relative self-products

From now on it is convenient to work in the $\mathbb{Z}^{d}$-setting instead
of the $\mathbb{F}_{p}^{d}$ one. Recall that for any generating set $I$ of
$X$, we have generating constants $b_{I,i,j}\in\mathbb{F}_{p},i\in I,0\leq
j\leq k+s-1$ and generating maps
$L_{I,j}\colon(\mathbb{F}_{p}^{d})^{k+1}\to\mathbb{F}_{p}^{d},0\leq j\leq
k+s-1$. For all $i\in I,0\leq j\leq k+s-1$, let
$\tilde{b}_{I,i,j}:=\tau(b_{I,i,j})\in\mathbb{Z}$, and denote
$\tilde{b}_{I,i}:=(\tilde{b}_{I,i,0},\dots,\tilde{b}_{I,i,k+s-1})\in\mathbb{Z}^{k+s}$.
Let $\tilde{L}_{I,j}\colon(\mathbb{R}^{d})^{k+1}\to\mathbb{R}^{d}$ be the
linear map given by

$\tilde{L}_{I,j}(\mathbb{x}):=\sum_{i\in I}\tilde{b}_{I,i,j}x_{i}\text{ for
all }\mathbb{x}=(x_{0},\dots,x_{k})\in(\mathbb{R}^{d})^{k+1},$

and
$\tilde{\mathbb{L}}_{I}\colon(\mathbb{R}^{d})^{k+1}\to(\mathbb{R}^{d})^{k+s}$
be the linear map given by

$\tilde{\mathbb{L}}_{I}(\mathbb{x}):=(\tilde{L}_{I,0}(\mathbb{x}),\dots,\tilde{L}_{I,k+s-1}(\mathbb{x}))\text{
for all }\mathbb{x}\in(\mathbb{R}^{d})^{k+1}.$

It is not hard to see that $L_{I,j}=\iota\circ\tilde{L}_{I,j}\circ\tau$. In
other words, $\frac{1}{p}\tilde{L}_{I,j}$ is the regular lifting of $L_{I,j}$.

Let $C_{0}$ be the complexity of $X$. If $p\gg_{C_{0},k,s}1$, then the
normalization properties of $b_{I,i,j}$ and $L_{I,j}$ imply the following
_normalization properties_ of $\tilde{b}_{I,i,j}$ and $\tilde{L}_{I,j}$:

$\tilde{b}_{I,i,j}=\delta_{i,j}\text{ for all $i,j\in I$ and}\sum_{i\in
I}\tilde{b}_{I,i,j}=1\text{ for all $j\in J$};$ $\tilde{L}_{I,j}((x_{i})_{i\in
I})=x_{j}\text{ for all $j\in I$ and }\tilde{L}_{I,j}(x,\dots,x)=x\text{ for
all $j\in J$}.$

For $t\in\mathbb{N}_{+}$, we say that $V\subseteq\mathbb{R}^{t}$ is a
_rational subspace_ of $\mathbb{R}^{t}$ if there exist $\mathbb{R}$-linearly
independent vectors $u_{1},\dots,u_{r}\in\mathbb{Z}^{t}$ for some
$r\in\mathbb{N}$ such that $V$ is the $\mathbb{R}$-span of
$u_{1},\dots,u_{r}$. For $i\in\mathbb{N}_{+}$, let $V^{[i]}$ denote the linear
subspace of $\mathbb{R}^{t}$ spanned by $u_{1}\ast\ldots\ast
u_{i},u_{1},\dots,u_{i}\in V$, where $\ast$ is the coordinate-wise product.

Let $V_{X}:=\tilde{\mathbb{L}}_{I}((\mathbb{R}^{d})^{k+1})$. We summarize some
basic properties for $V_{X}$.

######  Lemma 6.1.

Assume that the complexity of $X$ is at most $C_{0}$ and $p\gg_{C_{0},k,s}1$.

  1. (i)

The set $V_{X}$ is a well defined rational subspace of $\mathbb{R}^{k+s}$,
i.e. it is independent of the choice of the generating set $I$.

  2. (ii)

We have that $V_{X}=\text{span}_{\mathbb{R}}\\{\tilde{b}_{I,i},i\in I\\}$ for
any generating set $I$ of $X$.

  3. (iii)

The vectors $(1,\dots,1)$ belongs to $V_{X}$. Therefore, we have the _flag
property_ $V_{X}^{[1]}\leq V_{X}^{[2]}\leq\dots.$

  4. (iv)

The complexities of all of $V_{X}^{[i]},1\leq i\leq s-1$ (recall Section 1.3
for definitions) are at most $O_{C_{0},k,s}(1)$.

###### Proof.

We start with Part (i). It is clear that $V_{X}$ is a rational subspace of
$\mathbb{R}^{k+s}$. Let $I,I^{\prime}$ be generating sets of $X$ with
generating constants $b_{I,i,j}$ and $b_{I^{\prime},i^{\prime},j}$. Recall
from (2.3) that

$\begin{split}b_{I^{\prime},i^{\prime},j}=\sum_{i\in
I}b_{I,i,j}b_{I^{\prime},i^{\prime},i}\end{split}$

for all $j\in J$ and $i^{\prime}\in I$. Since $p\gg_{C_{0},k,s}1$ and all of
$b_{I,i,j}$ and $b_{I^{\prime},i,j}$ are of complexity at most $C_{0}$, we
have that

$\begin{split}\tilde{b}_{I^{\prime},i^{\prime},j}=\sum_{i\in
I}\tilde{b}_{I,i,j}\tilde{b}_{I^{\prime},i^{\prime},i}\end{split}$

for all $j\in J$ and $i^{\prime}\in I$. For all
$\mathbb{x}=(x_{i^{\prime}})_{i^{\prime}\in
I^{\prime}}\in(\mathbb{R}^{d})^{k+1}$. Let
$\mathbb{y}:=(\tilde{L}_{I^{\prime},i}(\mathbb{x}))_{i\in I}$. Then for all
$j\in J$,

$\begin{split}&\quad\tilde{L}_{I^{\prime},j}(\mathbb{x})=\sum_{i^{\prime}\in
I^{\prime}}\tilde{b}_{I^{\prime},i^{\prime},j}x_{i^{\prime}}=\sum_{i^{\prime}\in
I^{\prime}}\Bigl{(}\sum_{i\in
I}\tilde{b}_{I,i,j}\tilde{b}_{I^{\prime},i^{\prime},i}\Bigr{)}x_{i^{\prime}}\\\
&=\sum_{i\in I}\tilde{b}_{I,i,j}\Bigl{(}\sum_{i^{\prime}\in
I^{\prime}}\tilde{b}_{I^{\prime},i^{\prime},i}x_{i^{\prime}}\Bigr{)}=\sum_{i\in
I}\tilde{b}_{I,i,j}\tilde{L}_{I^{\prime},i}(\mathbb{x})=\tilde{L}_{I,j}(\mathbb{y}).\end{split}$

This means that
$\tilde{\mathbb{L}}_{I^{\prime}}((\mathbb{R}^{d})^{k+1})\subseteq\tilde{\mathbb{L}}_{I}((\mathbb{R}^{d})^{k+1})$.
Similarly,
$\tilde{\mathbb{L}}_{I}((\mathbb{R}^{d})^{k+1})\subseteq\tilde{\mathbb{L}}_{I^{\prime}}((\mathbb{R}^{d})^{k+1})$.
Thus
$\tilde{\mathbb{L}}_{I^{\prime}}((\mathbb{R}^{d})^{k+1})=\tilde{\mathbb{L}}_{I}((\mathbb{R}^{d})^{k+1})$.
This completes the proof of Part (i).

Part (ii) follows from the knowledge of linear algebra. Part (iii) follows
from the fact that $(1,\dots,1)=\tilde{b}_{I,0}+\dots+\tilde{b}_{I,k}\in
V_{X}$, which follows from the normalization property of $\tilde{b}_{I,i,j}$.
Part (iv) is straightforward. ∎

For technical reasons, in additional to (4.1), in later sections, we also need
to study recurrence results of the form

(6.1)
$\begin{split}\mathbb{E}_{(x_{0},\dots,x_{k+s-1})\in\Omega}f_{i}(x_{i})\Bigl{|}\prod_{0\leq
j\leq k+s-1,j\neq i}f_{j}(x_{j})\Bigr{|}^{2}.\end{split}$

This motivates us to study the relative self-products of the set $\Omega$.

Let $B$ be a set, $J$ be an (ordered) finite index set, $j\in J$, $x_{j}\in B$
and $\mathbb{x}^{\prime}=(x_{j^{\prime}})_{j^{\prime}\in
J\backslash\\{j\\}}\in B^{|J|-1}$, write
$(x_{j}\downharpoonleft_{j\curvearrowright
J}\mathbb{x}^{\prime}):=(x_{j^{\prime}})_{j^{\prime}\in J}\in B^{|J|}$. In
other words, $(x_{j}\downharpoonleft_{j\curvearrowright
J}\mathbb{x}^{\prime})$ is the completion of the $J\backslash\\{j\\}$-indexed
vector $\mathbb{x}^{\prime}$ to a $J$-indexed vector by inserting $x_{j}$ as
the $j$-th coordinate. When $J=\\{0,\dots,k+s-1\\}$, we write
$(x_{j}\downharpoonleft_{j}\mathbb{x}^{\prime}):=(x_{j}\downharpoonleft_{j\curvearrowright
J}\mathbb{x}^{\prime})$ for short.

For any $0\leq i\leq k+s-1$, denote

$\Omega\times_{i}\Omega:=\\{(x,\mathbb{x}^{+},\mathbb{x}^{-})\in(\mathbb{F}_{p}^{d})\times(\mathbb{F}_{p}^{d})^{k+s-1}\times(\mathbb{F}_{p}^{d})^{k+s-1}\colon(x\downharpoonleft_{j}\mathbb{x}^{+}),(x\downharpoonleft_{j}\mathbb{x}^{-})\in\Omega\\}.$

It is not hard to see that we may rewrite (6.1) as

$\begin{split}\mathbb{E}_{(x_{i},\mathbb{x}^{+},\mathbb{x}^{-})\in\Omega\times_{i}\Omega}f_{i}(x_{i})\prod_{0\leq
j\leq k+s-1,j\neq i}f_{j}(x^{+}_{j})\overline{f}_{j}(x^{-}_{j}),\end{split}$

where $\mathbb{x}^{+}=(x^{+}_{j})_{0\leq j\leq k+s-1,j\neq i}$ and
$\mathbb{x}^{-}=(x^{-}_{j})_{0\leq j\leq k+s-1,j\neq i}$.

Let $I$ be a generating set containing $i$. Define

$\Omega_{I}\times_{i}\Omega_{I}:=\\{(x,\mathbb{x}^{+},\mathbb{x}^{-})\in(\mathbb{F}_{p}^{d})\times(\mathbb{F}_{p}^{d})^{k}\times(\mathbb{F}_{p}^{d})^{k}\colon(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{+}),(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{-})\in\Omega_{I}\\}.$

######  Example 6.2.

Assume that $I=\\{0,\dots,k\\}$ is a generating set of $X$. Then
$\Omega\times_{0}\Omega$ is the set of
$(x_{0},\dots,x_{2k+2s-2})\in(\mathbb{F}_{p}^{d})^{2k+2s-1}$ such that
$(x_{0},x_{1},\dots,x_{k+s-1}),(x_{0},x_{k+s},\dots,x_{2k+2s-2})\in\Omega$,
and $\Omega_{I}\times_{0}\Omega_{I}$ is the set of
$(x_{0},\dots,x_{2k})\in(\mathbb{F}_{p}^{d})^{2k+1}$ such that
$(x_{0},x_{1},\dots,x_{k})$ and $(x_{0},x_{k+1},\dots,$ $x_{2k})$ belong to
$\Omega_{I}$. For more general sets $\Omega\times_{i}\Omega$ and
$\Omega_{I}\times_{i}\Omega_{I}$, we have a similar structure except that the
notations are more complicated.

Recall from Lemma 3.4 that $\Omega=\mathbb{L}_{I}(\Omega_{I})$ for any
generating set $I$ of $X$. We wish to write the set $\Omega\times_{i}\Omega$
in a similar way. For all $j\in\\{0,\dots,k+s-1\\}$, let
$L^{+}_{i\curvearrowright
I,j}\colon(\mathbb{F}_{p}^{d})^{2k+1}\to\mathbb{F}_{p}^{d}$ be the linear map
given by

$L^{+}_{i\curvearrowright
I,j}(x,\mathbb{x}^{+},\mathbb{x}^{-}):=L_{I,j}(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{+})\text{ for all
}(x,\mathbb{x}^{+},\mathbb{x}^{-})\in(\mathbb{F}_{p}^{d})\times(\mathbb{F}_{p}^{d})^{k}\times(\mathbb{F}_{p}^{d})^{k},$

and let $L^{-}_{i\curvearrowright
I,j}\colon(\mathbb{F}_{p}^{d})^{2k+1}\to\mathbb{F}_{p}^{d}$ be the linear map
given by

$L^{-}_{i\curvearrowright
I,j}(x,\mathbb{x}^{+},\mathbb{x}^{-}):=L_{I,j}(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{-})\text{ for all
}(x,\mathbb{x}^{+},\mathbb{x}^{-})\in(\mathbb{F}_{p}^{d})\times(\mathbb{F}_{p}^{d})^{k}\times(\mathbb{F}_{p}^{d})^{k}.$

Let $\mathbb{L}_{i\curvearrowright
I}^{\pm}\colon(\mathbb{F}_{p}^{d})^{2k+1}\to(\mathbb{F}_{p}^{d})^{2k+2s-1}$ be
the linear map given by

$\mathbb{L}^{\pm}_{i\curvearrowright I}(\mathbb{x}):=(L^{+}_{i\curvearrowright
I,i}(\mathbb{x}),(L^{+}_{i\curvearrowright
I,j}(\mathbb{x}))_{j\in\\{0,\dots,k+s-1\\}\backslash\\{i\\}},(L^{-}_{i\curvearrowright
I,j}(\mathbb{x}))_{j\in\\{0,\dots,k+s-1\\}\backslash\\{i\\}})$

for all $\mathbb{x}\in(\mathbb{F}_{p}^{d})^{2k+1}$ (note that
$L^{+}_{i\curvearrowright
I,i}(x,\mathbb{x}^{+},\mathbb{x}^{-})=L^{-}_{i\curvearrowright
I,i}(x,\mathbb{x}^{+},\mathbb{x}^{-})=x$ for all $i\in I$).

For all $i\in I$ and $i^{\prime}\in I\backslash\\{i\\}$, write

$b^{\pm}_{i\curvearrowright
I,i}:=(b_{I,i,i},\mathbb{b}^{\prime}_{I,i},\mathbb{b}^{\prime}_{I,i}),b^{+}_{i\curvearrowright
I,i^{\prime}}:=(b_{I,i^{\prime},i},\mathbb{b}^{\prime}_{I,i^{\prime}},0,\dots,0)\text{
and }b^{-}_{i\curvearrowright
I,i^{\prime}}:=(b_{I,i^{\prime},i},0,\dots,0,\mathbb{b}^{\prime}_{I,i^{\prime}}),$

where

$\mathbb{b}^{\prime}_{I,i^{\prime\prime}}:=(b_{I,i^{\prime\prime},0},\dots,b_{I,i^{\prime\prime},i-1},b_{I,i^{\prime\prime},i+1},\dots,b_{I,i^{\prime\prime},k+s-1})$

for all $i^{\prime\prime}\in I$ and 0 appears $k+s-1$ times in each
expression. It is not hard to see that

$L_{i\curvearrowright I,j}^{+}(x_{i},(x_{i^{\prime}}^{+})_{i^{\prime}\in
I\backslash\\{i\\}},(x_{i^{\prime}}^{-})_{i^{\prime}\in
I\backslash\\{i\\}}):=b^{\pm}_{i\curvearrowright
I,i,j}x_{i}+\sum_{i^{\prime}\in I\backslash\\{i\\}}b^{+}_{i\curvearrowright
I,i^{\prime},j}x_{i^{\prime}}^{+}$

and

$L_{i\curvearrowright I,j}^{-}(x_{i},(x_{i^{\prime}}^{+})_{i^{\prime}\in
I\backslash\\{i\\}},(x_{i^{\prime}}^{-})_{i^{\prime}\in
I\backslash\\{i\\}}):=b^{\pm}_{i\curvearrowright
I,i,j}x_{i}+\sum_{i^{\prime}\in I\backslash\\{i\\}}b^{-}_{i\curvearrowright
I,i^{\prime},j}x_{i^{\prime}}^{-}$

for all $i\in I$ and $0\leq j\leq k+s-1$, where $b^{\pm}_{i\curvearrowright
I,i,j}$ is the $j$-th coordinate of $b^{\pm}_{i\curvearrowright I,i}$. The
normalization properties of $b_{I,i,j}$ and $L_{I,j}$ imply the following
_normalization properties_ of $L^{\pm}_{i\curvearrowright I,j}$:

$\sum_{i^{\prime}\in I}b^{\pm}_{i\curvearrowright I,i^{\prime},j}=1\text{ for
all $i\in I,j\in J$ and }L^{\pm}_{i\curvearrowright I,j}(x,\dots,x)=x\text{
for all $i\in I,j\in J$}.$

We summarize some properties of the sets $\Omega\times_{i}\Omega$ and
$\Omega_{I}\times_{i}\Omega_{I}$ for later uses.

######  Lemma 6.3.

Let $I\subseteq\\{0,\dots,k+s-1\\}$ be a generating set of $X$ and $i\in I$.

  1. (i)

We have that $\Omega\times_{i}\Omega=\mathbb{L}_{i\curvearrowright
I}^{\pm}(\Omega_{I}\times_{i}\Omega_{I})$.

  2. (ii)

If $d\geq 2k^{2}+6k+3,$ then $\Omega_{I}\times_{i}\Omega_{I}$ is a nice and
consistent $M$-set of total co-dimension $k^{2}+3k+1$, and we have that
$|\Omega_{I}\times_{i}\Omega_{I}|=p^{d(2k+1)-(k^{2}+3k+1)}(1+O_{k}(p^{-1/2}))$.

  3. (iii)

If $d\geq\max\\{4k^{2}+12k+7,4k+s+13\\}$, then for all $C^{\prime}>0$, there
exists $K=O_{C^{\prime},d}(1)$ such that $\Omega_{I}\times_{i}\Omega_{I}$
admits a $(t,Kt^{-K})$-Leibman dichotomy up to step $s$ and complexity at most
$C^{\prime}$ for all $0<t<1/2$.

###### Proof.

We first prove Part (i). Let
$(x,\mathbb{x}^{+},\mathbb{x}^{-})\in\Omega\times_{i}\Omega$. Since
$\Omega=\mathbb{L}_{I}(\Omega_{I})$ by Lemma 3.4 (i), we have that
$(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{+})=\mathbb{L}_{I}(\mathbb{y}^{+}),(x\downharpoonleft_{i\curvearrowright
I}\mathbb{x}^{-})=\mathbb{L}_{I}(\mathbb{y}^{-})$ for some
$\mathbb{y}^{+}=(y_{j}^{+})_{j\in I},\mathbb{y}^{-}=(y_{j}^{-})_{j\in
I}\in\Omega_{I}$. Since $i\in I$, we have that
$y_{i}^{+}=L_{I,i}(\mathbb{y}^{+})=x=L_{I,i}(\mathbb{y}^{-})=y_{i}^{-}$.
Therefore, we have that $(y_{i}^{+},(y_{j}^{+})_{j\in
I\backslash\\{i\\}},(y_{j}^{-})_{j\in
I\backslash\\{i\\}})\in\Omega_{I}\times_{i}\Omega_{I}$. So

$(x,\mathbb{x}^{+},\mathbb{x}^{-})=\mathbb{L}_{i\curvearrowright
I}^{\pm}(y_{i}^{+},(y_{j}^{+})_{j\in I\backslash\\{i\\}},(y_{j}^{-})_{j\in
I\backslash\\{i\\}})\in\mathbb{L}_{i\curvearrowright
I}^{\pm}(\Omega_{I}\times_{i}\Omega_{I}).$

Conversely, let
$(x,\mathbb{x}^{+},\mathbb{x}^{-})=\mathbb{L}_{i\curvearrowright
I}^{\pm}(y_{i},\mathbb{y}^{+},\mathbb{y}^{-})$ for some

$(y_{i},\mathbb{y}^{+},\mathbb{y}^{-}):=(y_{i},(y_{j}^{+})_{j\in
I\backslash\\{i\\}},(y_{j}^{-})_{j\in
I\backslash\\{i\\}})\in\Omega_{I}\times_{i}\Omega_{I}.$

By definition, we have that $(y_{i}\downharpoonleft_{i\curvearrowright
I}\mathbb{y}^{+})$ and $(y_{i}\downharpoonleft_{i\curvearrowright
I}\mathbb{y}^{-})$ belong to $\Omega_{I}$, where we denote
$y_{i}^{+}:=y_{i}^{-}:=y_{i}$. Then

$\begin{split}&\quad(x\downharpoonleft_{i\curvearrowright
J}\mathbb{x}^{+})=(L^{+}_{i\curvearrowright
I,i}(y_{i},\mathbb{y}^{+},\mathbb{y}^{-})\downharpoonleft_{i\curvearrowright
J}(L^{+}_{i\curvearrowright I,j}(y_{i},\mathbb{y}^{+},\mathbb{y}^{-}))_{j\in
J\backslash\\{i\\}})\\\ &=(L^{+}_{i\curvearrowright
I,j}(y_{i},\mathbb{y}^{+},\mathbb{y}^{-}))_{j\in
J}=(L_{I,j}(y_{i}\downharpoonleft_{i\curvearrowright I}\mathbb{y}^{+}))_{j\in
J}=\mathbb{L}_{I}(y_{i}\downharpoonleft_{i\curvearrowright
I}\mathbb{y}^{+})\in\mathbb{L}_{I}(\Omega_{I})=\Omega,\end{split}$

where the last equality follows from Lemma 3.4 (i). Similarly,
$(x\downharpoonleft_{i\curvearrowright J}\mathbb{x}^{-})\in\Omega$. By
definition, this implies that
$(x,\mathbb{x}^{+},\mathbb{x}^{-})\in\Omega\times_{i}\Omega$. This complete
the proof of Part (i).

We now prove Part (ii). Note that $\Omega_{I}\times_{i}\Omega_{I}$ is the set
$\Omega_{4}$ in Example B.4 of [20] (up to a relabelling of the variables). So
$\Omega_{I}$ is a nice and consistent $M$-set of total co-dimension
$k^{2}+3k+1$. Since $d\geq 2k^{2}+6k+3,$ by Theorem B.12,
$|\Omega_{I}\times_{i}\Omega_{I}|=p^{d(2k+1)-(k^{2}+3k+1)}(1+O_{k}(p^{-1/2}))$.

Part (iii) follows from Theorem B.15 and Part (ii). ∎

We now lift the above mentioned notations to the $\mathbb{Z}$-setting. Recall
that $\tilde{b}_{I,i,j}:=\tau(b_{I,i,j})\in\mathbb{Z}$. For all
$i,i^{\prime}\in I$ and $j\in J$, write $\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime},j}:=\tau(b^{\pm}_{i\curvearrowright
I,i^{\prime},j})\in\mathbb{Z}$ and $\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}}:=\tau(b^{\pm}_{i\curvearrowright
I,i^{\prime}})\in\mathbb{Z}^{2k+2s-1}$. For $i\in I$ and $0\leq j\leq k+s-1$,
let $\tilde{L}^{\pm}_{i\curvearrowright
I,j}\colon(\mathbb{R}^{d})^{2k+1}\to\mathbb{R}^{d}$ be the linear linear
transformation given by

$\tilde{L}_{i\curvearrowright
I,j}^{+}(x_{i},(x_{i^{\prime}}^{+})_{i^{\prime}\in
I\backslash\\{i\\}},(x_{i^{\prime}}^{-})_{i^{\prime}\in
I\backslash\\{i\\}}):=\tilde{b}^{\pm}_{i\curvearrowright
I,i,j}x_{i}+\sum_{i^{\prime}\in
I\backslash\\{i\\}}\tilde{b}^{+}_{i\curvearrowright
I,i^{\prime},j}x_{i^{\prime}}^{+}$

and

$\tilde{L}_{i\curvearrowright
I,j}^{-}(x_{i},(x_{i^{\prime}}^{+})_{i^{\prime}\in
I\backslash\\{i\\}},(x_{i^{\prime}}^{-})_{i^{\prime}\in
I\backslash\\{i\\}}):=\tilde{b}^{\pm}_{i\curvearrowright
I,i,j}x_{i}+\sum_{i^{\prime}\in
I\backslash\\{i\\}}\tilde{b}^{-}_{i\curvearrowright
I,i^{\prime},j}x_{i^{\prime}}^{-}.$

Let $\tilde{\mathbb{L}}^{\pm}_{i\curvearrowright
I}\colon(\mathbb{R}^{d})^{2k+1}\to(\mathbb{R}^{d})^{2k+2s-1}$ be the linear
map given by

$\tilde{\mathbb{L}}^{\pm}_{i\curvearrowright
I}(\mathbb{x}):=(\tilde{L}^{+}_{i\curvearrowright
I,i}(\mathbb{x}),(\tilde{L}^{+}_{i\curvearrowright
I,j}(\mathbb{x}))_{j\in\\{0,\dots,k+s-1\\}\backslash\\{i\\}},(\tilde{L}^{-}_{i\curvearrowright
I,j}(\mathbb{x}))_{j\in\\{0,\dots,k+s-1\\}\backslash\\{i\\}})$

for all $\mathbb{x}\in(\mathbb{R}^{d})^{2k+1}$. It is not hard to see that
$L^{\pm}_{i\curvearrowright I,j}=\iota\circ\tilde{L}^{\pm}_{i\curvearrowright
I,j}\circ\tau$. In other words, $\frac{1}{p}\tilde{L}^{\pm}_{i\curvearrowright
I,j}$ is the regular lifting of $L^{\pm}_{i\curvearrowright I,j}$. Let $C_{0}$
be the complexity of $X$. Note that if $p\gg_{C_{0},k,s}1$, then the
normalization property of $L^{\pm}_{i\curvearrowright I,j}$ imply the
following _normalization property_ of $\tilde{L}^{\pm}_{i\curvearrowright
I,j}$:

$\sum_{i^{\prime}\in I}\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime},j}=1\text{ for all $i\in I,j\in J$ and
}\tilde{L}^{\pm}_{i\curvearrowright I,j}(x,\dots,x)=x\text{ for all $i\in
I,j\in J$}.$

Recall that $V_{X}$ is a rational subspace of $\mathbb{R}^{k+s}$ defined in
Section 6.1. For any $0\leq i\leq k+s-1$, denote

$V_{X}\times_{i}V_{X}:=\\{(x,\mathbb{x}^{+},\mathbb{x}^{-})\in\mathbb{R}\times\mathbb{R}^{k+s-1}\times\mathbb{R}^{k+s-1}\colon(x\downharpoonleft_{i}\mathbb{x}^{+}),(x\downharpoonleft_{i}\mathbb{x}^{-})\in
V_{X}\\}.$

######  Lemma 6.4.

Assume that the complexity of $X$ is at most $C_{0}$ and $p\gg_{C_{0},k,s}1$.
Let $0\leq i\leq k+s-1$.

  1. (i)

The set $V_{X}\times_{i}V_{X}$ is a rational subspace of
$\mathbb{R}^{2k+2s-1}$.

  2. (ii)

We have that $V_{X}\times_{i}V_{X}=\tilde{\mathbb{L}}^{\pm}_{i\curvearrowright
I}((\mathbb{R}^{d})^{2k+1})=\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}$ for any generating set $I$ of $X$ containing
$i$.

  3. (iii)

For all $j\in\mathbb{N}_{+}$, we have that
$(V_{X}\times_{i}V_{X})^{[j]}=V_{X}^{[j]}\times_{i}V_{X}^{[j]}$.

  4. (iv)

The vectors $(1,\dots,1)$ belongs to $V_{X}\times_{i}V_{X}$. Therefore, we
have the _flag property_
$(V_{X}\times_{i}V_{X})^{[1]}\leq(V_{X}\times_{i}V_{X})^{[2]}\leq\dots.$

  5. (v)

The complexities of all of $(V_{X}\times_{i}V_{X})^{[j]},1\leq j\leq s-1$ are
at most $O_{C_{0},k,s}(1)$.

###### Proof.

Parts (i), (iii) and (v) are straightforward. Part (iv) follows from the
normalization property $\sum_{i^{\prime}\in
I}\tilde{b}^{\pm}_{i\curvearrowright I,i^{\prime},j}=1$ for all $i\in I,j\in
J$. So it remains to prove Part (ii). The fact that
$\tilde{\mathbb{L}}^{\pm}_{i\curvearrowright
I}((\mathbb{R}^{d})^{2k+1})=\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}$ follows from the the knowledge of linear
algebra and the definition of $\tilde{L}_{i\curvearrowright I,j}^{\pm}$. So it
remains to show that
$V_{X}\times_{i}V_{X}=\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}$.

By definition, for all $i^{\prime}\in I\backslash\\{i\\}$, we have that

$\tilde{b}^{\pm}_{i\curvearrowright
I,i}:=(\tilde{b}_{I,i,i},\tilde{\mathbb{b}}^{\prime}_{I,i},\tilde{\mathbb{b}}^{\prime}_{I,i}),\tilde{b}^{+}_{i\curvearrowright
I,i^{\prime}}:=(\tilde{b}_{I,i^{\prime},i},\tilde{\mathbb{b}}^{\prime}_{I,i^{\prime}},0,\dots,0)\text{
and }\tilde{b}^{-}_{i\curvearrowright
I,i^{\prime}}:=(\tilde{b}_{I,i^{\prime},i},0,\dots,0,\tilde{\mathbb{b}}^{\prime}_{I,i^{\prime}}),$

where

$\tilde{\mathbb{b}}^{\prime}_{I,i^{\prime\prime}}:=(\tilde{b}_{I,i^{\prime\prime},0},\dots,\tilde{b}_{I,i^{\prime\prime},i-1},\tilde{b}_{I,i^{\prime\prime},i+1},\dots,\tilde{b}_{I,i^{\prime\prime},k+s-1})$

for all $i^{\prime\prime}\in I$ and 0 appears $k+s-1$ times in each
expression. By Lemma 6.1 (ii), we have that
$(\tilde{b}_{I,i^{\prime\prime},i}\downharpoonleft_{i}\tilde{\mathbb{b}}^{\prime}_{I,i^{\prime\prime}})=\tilde{b}_{I,i^{\prime\prime}}\in
V_{X}$ for all $i^{\prime\prime}\in I$. For all $i^{\prime}\in
I\backslash\\{i\\}$, since $\tilde{b}_{I,i^{\prime},i}=0$, we have that
$(\tilde{b}_{I,i^{\prime},i}\downharpoonleft_{i}0,\dots,0)=\mathbb{0}\in
V_{X}$. From this we can conclude that $\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}}\in V_{X}\times_{i}V_{X}$ for all $i^{\prime}\in I$. So
$\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}\subseteq V_{X}\times_{i}V_{X}$.

Conversely for any $(x,\mathbb{x}^{+},\mathbb{x}^{-})\in
V_{X}\times_{i}V_{X}$, since
$(x\downharpoonleft_{j}\mathbb{x}^{+}),(x\downharpoonleft_{j}\mathbb{x}^{-})\in
V_{x}$, by Lemma 6.1 (ii), we may write

$(x\downharpoonleft_{j}\mathbb{x}^{+})=\sum_{i^{\prime}\in
I}c^{+}_{i^{\prime}}\tilde{b}_{I,i^{\prime}}\text{ and
}(x\downharpoonleft_{j}\mathbb{x}^{-})=\sum_{i^{\prime}\in
I}c^{-}_{i^{\prime}}\tilde{b}_{I,i^{\prime}}$

for some $c^{\pm}_{i^{\prime}}\in\mathbb{R}$. Since
$\tilde{b}_{I,i^{\prime},i}=\delta_{i,i^{\prime}}$ for all $i^{\prime}\in I$,
projecting to the $i$-th coordinate, we have that $x=c_{i}^{+}=c_{i}^{-}$.
Therefore, it is not hard to see that

$(x,\mathbb{x}^{+},\mathbb{x}^{-})=x\tilde{b}^{\pm}_{i\curvearrowright
I,i}+\sum_{i^{\prime}\in
I\backslash\\{i\\}}\Bigl{(}c_{i^{\prime}}^{+}\tilde{b}^{+}_{i\curvearrowright
I,i^{\prime}}+c_{i^{\prime}}^{-}\tilde{b}^{-}_{i\curvearrowright
I,i^{\prime}}\Bigr{)}\in\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}.$

So
$V_{X}\times_{i}V_{X}\subseteq\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}$ and thus
$V_{X}\times_{i}V_{X}=\text{span}_{\mathbb{R}}\\{\tilde{b}^{\pm}_{i\curvearrowright
I,i^{\prime}},i^{\prime}\in I\\}$. ∎

###  6.2. The joint equidistribution theorem

We now provide an equidistribution property pertaining to both (4.1) and
(6.1). We begin with recalling the concept of Leibman group (first studied in
[15]) which plays an important role in [9].

Let $t\in\mathbb{N}_{+}$ and $G$ be a nilpotent group with filtration
$(G_{i})_{i\in\mathbb{N}}$ and $V$ be a rational subspace of $\mathbb{R}^{t}$
containing $(1,\dots,1)$. For $g\in G$ and
$w=(w_{0},\dots,w_{t-1})\in\mathbb{R}^{t}$, denote

$g^{w}:=(\exp(w_{0}\log(g)),\dots,\exp(w_{t-1}\log(g)))\in G^{t}.$

Let $G^{V}$ be the subgroup of $G^{t}$ generated by the elements of the form
$g^{w}$, where $g$ is an iterated commutator of $g_{1},\dots,g_{t}$ for some
$t\in\mathbb{N}_{+}$, $g_{j}\in G_{i_{j}}$ for some $i_{j}\in\mathbb{N}_{+}$
for all $1\leq j\leq t$, and $w=w_{1}\ast\ldots\ast w_{t}$ for some $w_{j}\in
V^{[i_{j}]}$ for all $1\leq j\leq t$, where $\ast$ is the coordinate-wise
product. Similar to the argument in [9], one can show that $G^{V}$ is a normal
and rational subgroup of $G^{t}$, and thus $\Gamma^{V}:=\Gamma^{t}\cap G^{V}$
is a discrete cocompact subgroup of $G^{V}$.

For $i\in\mathbb{N}_{+}$, let $G^{V}_{(i)}$ be the subgroup of $G^{V}$
generated by the elements of the form $g^{w}$, where $g$ is an iterated
commutator of $g_{1},\dots,g_{t}$ for some $t\in\mathbb{N}_{+}$,
$i_{1}+\dots+i_{t}\geq i$, $g_{j}\in G_{i_{j}}$ for some $i_{j}\geq i$ for all
$1\leq j\leq t$, and $w=w_{1}\ast\ldots\ast w_{t}$ for some $w_{j}\in
V^{[i_{j}]}$ for all $1\leq j\leq t$. Set $G_{(0)}^{V}:=G^{V}$. Since
$(1,\dots,1)\in V$, similar to the proof of Lemma 3.5 of [9], one may use the
formula (A.2) to show that $(G_{(i)}^{V})_{i\in\mathbb{N}}$ is a filtration of
$G^{V}$.

We are now ready to state our main equidistribution result.

######  Theorem 6.5 (Joint equidistribution theorem).

Let $C_{0},C,\delta>0$. Assume that $X$ has complexity at most $C_{0}$ and