$|\Omega_{k-1}|$ and using the induction hypothesis that $\Omega_{k-1}$ is
$\delta^{\prime}$-irreducible for all $\delta^{\prime}>0$ if
$p\gg_{d,s}{\delta^{\prime}}^{-O_{d,s}(1)}$, we have that either
$\Omega_{k-1}\subseteq V(G_{k,I,i_{1},i_{2}})$ or $\Omega_{k-1}\subseteq
V(\Delta_{k,I})$.

Note that $\Delta_{k,I}(\mathbb{n}^{\prime})$ depends only on
$n_{i,\ell},1\leq i\leq k-1,\ell\in I$, and certainly $\Delta_{k,I}$ is not
constant 0. So we may pick some $n_{i,\ell}\in\mathbb{F}_{p},1\leq i\leq
k-1,\ell\in I$ such that $\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$. Let
$\Omega^{\prime}$ be the set of $(n_{i,\ell})_{1\leq i\leq k-1,\ell\in I^{c}}$
such that $(n_{i,\ell})_{1\leq i\leq k-1,1\leq\ell\leq d}$ belongs to
$\Omega_{k-1}$. Let
$M^{\prime}\colon\mathbb{F}_{p}^{d-r_{k}+1}\to\mathbb{F}_{p}$ be the quadratic
form given by

$M^{\prime}((m_{\ell})_{\ell\in I^{c}}):=M((m^{\prime}_{\ell})_{1\leq\ell\leq
d}),$

where $m^{\prime}_{\ell}=m_{\ell}$ for $\ell\in I^{c}$ and
$m^{\prime}_{\ell}=0$ for $\ell\in I$. Since $A$ is invertible and diagonal,
we have that $M^{\prime}$ is non-degenerate.

For $1\leq i\leq k-1,1\leq j\leq r_{i}$, let
$\tilde{F}_{i,j}\colon(\mathbb{F}_{p}^{d-r_{k}+1})^{k-1}\to\mathbb{F}_{p}$ be
the function obtained from $F_{i,j}$ (viewed as a function from
$(\mathbb{F}_{p}^{d})^{k-1}$ to $\mathbb{F}_{p}$ where we forget the
irrelevant variable $n_{k}$) by fixing the variables
$n_{i,\ell}\in\mathbb{F}_{p},1\leq i\leq k-1,\ell\in I$ chosen above. Let
$\Omega^{\prime}$ be the set of $(n_{i,\ell})_{1\leq i\leq k-1,\ell\in I^{c}}$
such that $(n_{i,\ell})_{1\leq i\leq k-1,1\leq\ell\leq d}$ belongs to
$\Omega_{k-1}$. Then
$\Omega^{\prime}=\cap_{i=1}^{k-1}\cap_{j=1}^{r_{i}}V(\tilde{F}_{i,j})$. By the
construction of $F_{i,j}$, $\\{F_{i,j}\colon 1\leq i\leq k-1,1\leq j\leq
r_{i}\\}$ is an independent $(M^{\prime},k)$-family. So
$\\{\tilde{F}_{i,j}\colon 1\leq i\leq k-1,1\leq j\leq r_{i}\\}$ is an
independent $(M^{\prime},k-1)$-family. Therefore
$\Omega^{\prime}\subseteq(\mathbb{F}_{p}^{d-r_{k}+1})^{k-1}$ is a consistent
$M^{\prime}$-set with total co-dimension $r_{1}+\dots+r_{k-1}$, which is the
same as $\Omega_{k-1}$. Since $d-r_{k}+1\geq 2(r_{1}+\dots+r_{k-1})+1$, by
Theorem C.3, $|\Omega^{\prime}|\geq
p^{(d-r_{k}+1)(k-1)-(r_{1}+\dots+r_{k-1})}(1+O_{k}(p^{-1/2}))$. In particular,
$\Omega^{\prime}$ is non-empty. Therefore, $\Omega_{k-1}$ is not a subset of
$V(\Delta_{k,I})$.

We may argue similarly for $G_{k,I,i_{1},i_{2}}$. Let
$J:=I\cup\\{i_{1},i_{2}\\}$. Recall that
$G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})$ depends only on $n_{i,\ell},1\leq
i\leq k-1,\ell\in J$. Since $G_{k,I,i_{1},i_{2}}$ is not constant zero, then
we may pick some $n_{i,\ell}\in\mathbb{F}_{p},1\leq i\leq k-1,\ell\in J$ such
that $G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\neq 0$. Let $\Omega^{\prime}$
be the set of $(n_{i,\ell})_{1\leq i\leq k-1,\ell\in J^{c}}$ such that
$(n_{i,\ell})_{1\leq i\leq k-1,1\leq\ell\leq d}$ belongs to $\Omega_{k-1}$.
Let $M^{\prime}\colon\mathbb{F}_{p}^{d-|J|}\to\mathbb{F}_{p}$ be the quadratic
form given by

$M^{\prime}((m_{\ell})_{\ell\in J^{c}}):=M((m^{\prime}_{\ell})_{1\leq\ell\leq
d}),$

where $m^{\prime}_{\ell}=m_{\ell}$ for $\ell\in J^{c}$ and
$m^{\prime}_{\ell}=0$ for $\ell\in J$.

Similar to the argument in the previous case, we have that $M^{\prime}$ is
non-degenerate and that
$\Omega^{\prime}\subseteq(\mathbb{F}_{p}^{d-|J|})^{k-1}$ is a consistent
$M^{\prime}$-set with total co-dimension $r_{1}+\dots+r_{k-1}$. Since
$d-|J|\geq d-(r_{k}+1)\geq 2(r_{1}+\dots+r_{k-1})+1$, by Theorem C.3,
$|\Omega^{\prime}|\geq
p^{(d-|J|)(k-1)-(r_{1}+\dots+r_{k-1})}(1+O_{k}(p^{-1/2}))$. In particular,
$\Omega^{\prime}$ is non-empty. Therefore, $\Omega_{k-1}$ is not a subset of
$V(G_{k,I,i_{1},i_{2}})$. We now arrive at a contradiction and we are done. ∎

Step 2: a factorization for the target polynomial. This step is carried out by
the following proposition:

######  Proposition D.5.

Let $s\in\mathbb{N}$, $1\leq k\leq K$, $I\subseteq\\{1,\dots,d\\}$ with
$|I|=r_{k}-1$, $i_{1},i_{2}\in\\{1,\dots,d\\}\backslash I,i_{1}\leq i_{2}$,
and $P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ be a
polynomial of degree at most $s$ with $|V(P)\cap\Omega_{k}|\geq\delta
p^{dk-r}$. Then

$(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{k,I}(\mathbb{n}^{\prime}))^{s+2}P(\mathbb{n}^{\prime},n_{k})=\sum_{j=1}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial $Q_{j}$ of degree at most $O_{k,s}(1)$ for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and $n_{k}\in\mathbb{F}_{p}^{d}$.

###### Proof.

If $G_{k,I,i_{1},i_{2}}$ is constant zero, then we may set all of $Q_{j}$ to
be constant zero. So we assume that $G_{k,I,i_{1},i_{2}}$ is not constant
zero.

By Lemma D.4, we have that $|V(P)\cap\Omega_{k}\cap
Z_{k,I,i_{1},i_{2}}|\geq\delta p^{dk-r}/2$. By the Pigeonhole Principle and
Theorem C.3 (ii), it is not hard to see that there exist a subset
$U\subseteq\Omega_{k-1}$ with $|U|\gg\delta p^{d(k-1)-(r-r_{k})}$ and a subset
$U(\mathbb{n}^{\prime})\subseteq\Omega_{k}(\mathbb{n}^{\prime})$ of
cardinality $\gg\delta p^{d-r_{k}}$ for each $\mathbb{n}^{\prime}\in U$ such
that for all $\mathbb{n}^{\prime}\in U$ and $n_{k}\in U(\mathbb{n}^{\prime})$,
we have that $P(\mathbb{n}^{\prime},n_{k})=0$,
$\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$ and
$G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\neq 0$.

For simplicity denote $n^{\prime}_{k}:=n_{k,I^{c}}=(n_{k,\ell})_{\ell\in
I^{c}}$ and set
$P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k}):=P(\mathbb{n}^{\prime},\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))$.
Then for all $n_{k}\in\mathbb{F}_{p}^{d}$, by (D.11), we have that
$(\mathbb{n}^{\prime},n_{k})\in
V(P_{I}(\mathbb{n}^{\prime},\cdot))\cap\Omega_{k}(\mathbb{n}^{\prime})$ if and
only if $n_{k}=\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})$ for some
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}+1}$ with
$P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k})=F_{I,k,1}(\mathbb{n}^{\prime},n^{\prime}_{k})=0$.
Since $U(\mathbb{n}^{\prime})$ is of cardinality $\gg\delta p^{d-r_{k}}$, we
have that $|V(P_{I}(\mathbb{n}^{\prime},\cdot))\cap
V(F_{I,k,1}(\mathbb{n}^{\prime},\cdot))|\gg\delta p^{d-r_{k}}$.

Recall that $F_{I,k,1}(\mathbb{n}^{\prime},\cdot)$ is a non-degenerate
quadratic form of rank at least 3. Since
$G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\neq 0$, by Proposition 6.3,
$F_{I,k,1}(\mathbb{n}^{\prime},\cdot)$ divides
$P_{I}(\mathbb{n}^{\prime},\cdot)$ with respect to the
$B_{i_{1},i_{2}}$-standard long division algorithm. Note that every
coefficient of $P_{I}(\mathbb{n}^{\prime},\cdot)$ can be written as
$R(\mathbb{n}^{\prime})/(\Delta_{I}(\mathbb{n}^{\prime}))^{s}$ for some
polynomial $R$ of degree at most $(r_{k}-1)s$, and every coefficient of
$f_{I,k,1}(\mathbb{n}^{\prime},\cdot)$ can be written as
$R(\mathbb{n}^{\prime})/(\Delta_{I}(\mathbb{n}^{\prime}))^{2}$ for some
polynomial $R$ of degree at most $2(r_{k}-1)$. So the
$B_{i_{1},i_{2}}$-standard long division algorithm gives us that

$P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k})=F_{I,k,1}(\mathbb{n}^{\prime},n^{\prime}_{k})R^{\prime}(\mathbb{n}^{\prime},n^{\prime}_{k})/(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{I}(\mathbb{n}^{\prime}))^{s}$

for some polynomial $R^{\prime}$ of degree at most $O_{k,s}(1)$. So

(D.13)
$(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{k,I}(\mathbb{n}^{\prime}))^{s}P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k})-F_{I,k,1}(\mathbb{n}^{\prime},n^{\prime}_{k})R^{\prime}(\mathbb{n}^{\prime},n^{\prime}_{k})=0$

for all $\mathbb{n}^{\prime}\in U$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}+1}$. We may write the left hand side
of (D.13) as

$\sum_{m\in\mathbb{N}^{d-r_{k}},|m|\leq
s}C_{m}(\mathbb{n}^{\prime}){n^{\prime}_{k}}^{m}$

for some polynomial $C_{m}(\mathbb{n}^{\prime})$ of degree at most
$O_{k,s}(1)$. Then we have that $C_{m}(\mathbb{n}^{\prime})=0$ for all
$\mathbb{n}^{\prime}\in U$ and thus $|V(C_{m})\cap\Omega_{k-1}|\gg\delta
p^{d(k-1)-(r-r_{k})}$. By induction hypothesis, we have that
$\Omega_{k-1}\subseteq V(C_{m})$. So (D.13) holds for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}+1}$.

Let $(\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}$ denote the
$\ell$-th entry of $\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})$. By (D.7)
and (D.8), for all $\ell\in I$,
$\Delta_{k,I}(\mathbb{n}^{\prime})((\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}-n_{k,\ell})$
equals to the determinant of the $(r_{k}-1)\times(r_{k}-1)$ matrix obtained by
replacing the column $(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{2\leq j\leq r_{k}}$
from $(S_{k,j,\ell^{\prime\prime}}(\mathbb{n}^{\prime}))_{2\leq j\leq
r_{k},\ell^{\prime\prime}\in I}$ by the column $(q_{j,\ell})_{2\leq j\leq
r_{k}}$, where

$q_{j,\ell}=R_{k,I,j,\ell}(\mathbb{n}^{\prime},n^{\prime}_{k})-n_{k,\ell}S_{k,j,\ell}(\mathbb{n}^{\prime})=-F_{k,j}(\mathbb{n}^{\prime},n_{k})+\sum_{\ell^{\prime}\in
I\backslash\\{\ell\\}}n_{k,\ell^{\prime}}S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime})$

for all $2\leq j\leq r_{k}$, which, by linearity, equals to the determinant of
the $(r_{k}-1)\times(r_{k}-1)$ matrix obtained by replacing the column
$(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{2\leq j\leq r_{k}}$ from
$(S_{k,j,\ell^{\prime\prime}}(\mathbb{n}^{\prime}))_{2\leq j\leq
r_{k},\ell^{\prime\prime}\in I}$ by the column
$(-F_{k,j}(\mathbb{n}^{\prime},n_{k}))_{2\leq j\leq r_{k}}$. This means that
$\Delta_{k,I}(\mathbb{n}^{\prime})((\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}-n_{k,\ell})$
can be written in the form

(D.14)
$\sum_{j=2}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial
$Q_{j}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at
most $r_{k}-1$. Therefore,

$\Delta_{k,I}(\mathbb{n}^{\prime})^{s}(P(\mathbb{n}^{\prime},n_{k})-P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k}))=\Delta_{k,I}(\mathbb{n}^{\prime})^{s}(P(\mathbb{n}^{\prime},n_{k})-P(\mathbb{n}^{\prime},(\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})))$

can be written in the form (D.14) for some polynomial
$Q_{j}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at
most $ks$, and

$\Delta_{k,I}(\mathbb{n}^{\prime})^{2}(F_{k,1}(\mathbb{n}^{\prime},n_{k})-F_{I,k,1}(\mathbb{n}^{\prime},n^{\prime}_{k}))=\Delta_{k,I}(\mathbb{n}^{\prime})^{2}(F_{k,1}(\mathbb{n}^{\prime},n_{k})-F_{k,1}(\mathbb{n}^{\prime},\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})))$

can be writing in the form (D.14) for some polynomia
$Q_{j}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at
most $2s$. Since (D.13) holds for all $\mathbb{n}^{\prime}\in\Omega_{k-1}$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}+1}$, we have that

$(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{I}(\mathbb{n}^{\prime}))^{s+2}P(\mathbb{n}^{\prime},n_{k})=\sum_{j=1}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial $Q_{j}$ of degree at most $O_{k,s}(1)$ for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and $n_{k}\in\mathbb{F}_{p}^{d}$. ∎

Step 3: removing the
$(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{k,I}(\mathbb{n}^{\prime}))^{s+2}$
term using a parametrization trick. We are now ready to complete the proof of
Part (i) of Theorem D.1 for $\Omega_{k}$ for the case $c_{k}=1$. Let
$P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ be a polynomial
of degree at most $s$ with $|V(P)\cap\Omega_{k}|\geq\delta|\Omega_{k}|$. We
wish to show that for all
$\mathbb{n}=(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$, we have that
$P(\mathbb{n}^{\prime},n_{k})=0$.

We first consider the case when $n_{1},\dots,n_{k-1}$ are linearly
independent. Since $L_{k,j},2\leq j\leq r_{k}$ are linearly
independent,292929Meaning that no nontrivial linear combination of
$L_{k,j},2\leq j\leq r_{k}$ is zero. we have that
$L_{k,j}(\mathbb{n}^{\prime}),2\leq j\leq r_{k}$ are linearly independent.
Since $A$ is invertible, the vectors
$L_{k,j}(\mathbb{n}^{\prime})A=(S_{k,j,1}(\mathbb{n}^{\prime}),\dots,S_{k,j,d}(\mathbb{n}^{\prime})),2\leq
j\leq r_{k}$ are also linearly independent. By the knowledge of linear
algebra, there exists a subset $I$ of $\\{1,\dots,d\\}$ of cardinality
$r_{k}-1$ such that $\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$. By Lemma D.3,
there exist $i_{1},i_{2}\in I^{c},i_{1}\leq i_{2}$ such that
$G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\neq 0$. On the other hand, by
Theorem C.3, $|V(P)\cap\Omega_{k}|\geq\delta p^{dk-r}/2$ since $d\geq 2r+1$.
Since $(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$, we have that
$(G_{k,I,i_{1},i_{2}}(\mathbb{n}^{\prime})\Delta_{k,I}(\mathbb{n}^{\prime}))^{s+2}P(\mathbb{n}^{\prime},n_{k})=0$
by Proposition D.5. Therefore, $P(\mathbb{n}^{\prime},n_{k})=0$.

We now consider the general case. For $1\leq t\leq k-1$, we say that _Property
$t$_ holds if for all $\mathbb{n}=(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$
with $n_{1},\dots,n_{t}$ being linearly independent, we have that
$P(\mathbb{n},n_{k})=0$. By the above discussion, Property $k-1$ holds. Assume
now that we have proven Property $t+1$ holds for some $0\leq t\leq k-2$. We
show that Property $t$ holds. Pick any
$\mathbb{n}=(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$ such that
$n_{1},\dots,n_{t}$ are linearly independent. If $n_{1},\dots,n_{t+1}$ are
linearly independent, then $P(\mathbb{n}^{\prime},n_{k})=0$ by induction
hypothesis and we are done. So we assume that $n_{1},\dots,n_{t+1}$ are
linearly dependent.

######  Lemma D.6.

There exists a subspace $V$ of $\mathbb{F}_{p}^{d}$ dimension $3$ such that

  * •

for all $v\in V\backslash\\{\mathbb{0}\\}$, $n_{1},\dots,n_{t},v$ are linearly
independent;

  * •

for all $v\in V$ and $1\leq j\leq k$, we have that $(vA)\cdot n_{j}=0$;

  * •

we have that $V\cap V^{\perp_{M}}=\\{\mathbb{0}\\}$.

###### Proof.

Let $W_{1}$ denote the set of $v\in\mathbb{F}_{p}^{d}$ such that
$n_{1},\dots,n_{t},v$ are linearly dependent. Then $|W_{1}|=p^{t}$. Let
$W_{2}$ denote the set of $v\in\mathbb{F}_{p}^{d}$ such that $(vA)\cdot
n_{j}=0$ for all $1\leq j\leq k$. Then $W_{2}$ is a subspace of
$\mathbb{F}_{p}^{d}$ of dimension at least $d-k$. So there exists a subspace
$W_{3}$ of $W_{2}$ with $W_{1}\cap W_{3}=\\{\mathbb{0}\\}$ of dimension
$d^{\prime}\geq d-k-t.$

Let $\phi\colon\mathbb{F}_{p}^{d^{\prime}}\to W_{3}$ be any bijective linear
transformation and let
$M^{\prime}\colon\mathbb{F}_{p}^{d^{\prime}}\to\mathbb{F}_{p}$ be the
quadratic form given by $M^{\prime}=M\circ\phi$. By Proposition 4.8 (iii),
$\text{rank}(M^{\prime})=\text{rank}(M|_{W_{3}})\geq d-2(k+t)\geq
d-2(2k-2)\geq 3$. So by Lemma 4.7, there exists a subspace $U$ of
$\mathbb{F}_{p}^{d^{\prime}}$ of dimension 3 which is $M^{\prime}$-non-
isotropic. Then clearly $\phi(U)$ is $M$-non-isotropic. Moreover, $\phi(U)$ is
a subspace of $W_{3}$ of dimension 3. We are done by taking $V=\phi(U)$. ∎

Let $V$ be given by Lemma D.6, and $\phi\colon\mathbb{F}_{p}^{3}\to V$ be any
bijective linear transformation. Let $W$ be the set of
$m\in\mathbb{F}_{p}^{3}$ such that
$(n_{1},\dots,n_{t},n_{t+1}+\phi(m),n_{t+2},\dots,n_{k})\in\Omega_{k}$. Note
that $\mathbb{0}\in W$. Since $(\phi(m)A)\cdot n_{j}=0$ for all $1\leq j\leq
k$, by (D.4) and (D.5), for all $1\leq i^{\prime}\leq k$ and $1\leq j\leq
r_{i^{\prime}}$ with either $(i^{\prime},j)\neq(t+1,1)$ or
$(i^{\prime},j)=(t+1,1)$ and $c_{t+1}=0$, it is not hard to see that

$F_{i^{\prime},j}(n_{1},\dots,n_{t},n_{t+1}+\phi(m),n_{t+2},\dots,n_{k})=F_{i^{\prime},j}(n_{1},\dots,n_{t},n_{t+1},n_{t+2},\dots,n_{k}).$

Moreover, if $(i^{\prime},j)=(t+1,1)$ and $c_{t+1}=1$, then by (D.4), we have
that

$M^{\prime}(m):=F_{t+1,1}(n_{1},\dots,n_{t},n_{t+1}+\phi(m),n_{t+2},\dots,n_{k})$

is a quadratic form from $\mathbb{F}_{p}^{3}$ to $\mathbb{F}_{p}$. It is then
not hard to see that $W=V(M^{\prime})$ if $c_{t+1}=1$ and
$W=\mathbb{F}_{p}^{3}$ if $c_{t+1}=0$. Since $V\cap
V^{\perp_{M}}=\\{\mathbb{0}\\}$, by Proposition 4.8 (ii),
$\text{rank}(M^{\prime})=3$. So by Propositions 9.9 and 9.10, $W$ is
$1/2$-irreducible.

On the other hand, for all $m\in\mathbb{F}_{p}^{3}\backslash\\{\mathbb{0}\\}$,
since $n_{1},\dots,n_{t},\phi(m)$ are linearly independent and since
$n_{1},\dots,n_{t+1}$ are linearly dependent, we have that
$n_{1},\dots,n_{t},n_{t+1}+\phi(m)$ are linearly independent. By the induction
hypothesis that Property $t+1$ holds, we have that

$P^{\prime}(m):=P(n_{1},\dots,n_{t},n_{t+1}+\phi(m),n_{t+2},\dots,n_{k})=0$

for all $m\in W\backslash\\{\mathbb{0}\\}$. In other words,
$W\backslash\\{\mathbb{0}\\}\subseteq V(P^{\prime})$. So $|V(P^{\prime})\cap
W|\geq|W|-1\geq|W|/2$. Since $W$ is $1/2$-irreducible, we have that
$W\subseteq V(P^{\prime})$. In particular, since $\mathbb{0}\in W$, we have
that $P^{\prime}(\mathbb{0})=P(\mathbb{n}^{\prime},n_{k})=0.$

In conclusion, we have that Property $t$ holds. By induction, we deduce that
Property 0 holds, meaning that $\Omega_{k}\subseteq V(P)$. So $\Omega_{k}$ is
$\delta$-irreducible up to degree $s$.

###  D.4. Proof of Part (i) of Theorem D.1 for the degenerate case

We now consider the case when $c_{k}=0$. In this case $r_{k}\leq k-1$. Since
the proof is very similar to (actually slightly easier than) the case
$c_{k}=1$, we only provide an outline for the proof of this case and leave the
details to the interested readers.

Step 1: a parametrization for the last variable. Write

$L_{k,j}(\mathbb{n}^{\prime})A=(S_{k,j,1}(\mathbb{n}^{\prime}),\dots,S_{k,j,d}(\mathbb{n}^{\prime}))$

for some polynomials
$S_{k,j,1},\dots,S_{k,j,d}\colon(\mathbb{F}_{p}^{d})^{k-1}\to\mathbb{F}_{p}$
of degree at most 1. Since $A$ is diagonal, for all $1\leq\ell\leq d$,
$S_{k,j,\ell}(\mathbb{n}^{\prime})$ is dependent only on $n_{i,\ell},1\leq
i\leq k-1$. Then we may rewrite (D.5) as

(D.15)
$F_{k,j}(\mathbb{n}^{\prime},n_{k})=\sum_{\ell=1}^{d}n_{k,\ell}S_{k,j,\ell}(\mathbb{n}^{\prime})+u_{k,j},$

for all $1\leq j\leq r_{i}$.

For $I\subseteq\\{1,\dots,d\\}$ with $|I|=r_{k}>0$, let
$\Delta_{k,I}(\mathbb{n}^{\prime})$ denote the determinant of the $r_{k}\times
r_{k}$ matrix $(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{2\leq j\leq r_{k},\ell\in
I}$. Then $\Delta_{k,I}$ is a polynomial from $(\mathbb{F}_{p}^{d})^{k}$ to
$\mathbb{F}_{p}$ of degree at most $r_{k}$ depending only on $n_{i,\ell},1\leq
i\leq k-1,\ell\in I$. For convenience denote $I^{c}:=\\{1,\dots,d\\}\backslash
I$. Fix any $\mathbb{n}^{\prime}\in\Omega_{k-1}$ with
$\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$. Then
$L_{k,j}(\mathbb{n}^{\prime})A,2\leq j\leq r_{k}$ are linearly independent. By
(D.15) and the knowledge of linear algebra,
$F_{k,1}(\mathbb{n}^{\prime},n_{k})=\dots=F_{k,r_{k}}(\mathbb{n}^{\prime},n_{k})=0$
if and only if for all $\ell\in I$,

(D.16)
$n_{k,\ell}=\frac{R_{k,I,\ell}(\mathbb{n}^{\prime},n_{k,I^{c}})}{\Delta_{k,I}(\mathbb{n}^{\prime})},$

where $R_{k,I,\ell}(\mathbb{n}^{\prime},n_{k,I^{c}})$ is the determinant of
the $r_{k}\times r_{k}$ matrix obtained by replacing the column
$(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{1\leq j\leq r_{k}}$ from
$(S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime}))_{1\leq j\leq
r_{k},\ell^{\prime}\in I}$ by the column
$(R_{k,I,j,\ell}(\mathbb{n}^{\prime},n_{k,I^{c}}))_{1\leq j\leq r_{k}}$ where

(D.17)
$R_{k,I,j,\ell}(\mathbb{n}^{\prime},n_{k,I^{c}})=-u_{k,j}-\sum_{\ell^{\prime}\in
I^{c}}n_{k,\ell^{\prime}}S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime})=-F_{k,j}(\mathbb{n}^{\prime},n_{k})+\sum_{\ell^{\prime}\in
I}n_{k,\ell^{\prime}}S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime}).$

Let $Z_{k,I}$ denote the set of
$(\mathbb{n}^{\prime},n_{k})\in(\mathbb{F}_{p}^{d})^{k}$ such that
$\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$. Similar to the proof of Lemma D.4,
we have (we omit the details):

######  Lemma D.7.

We have that $|{Z}^{c}_{k,I}\cap\Omega_{k}|\leq\delta p^{dk-r}/2$.

Step 2: a factorization for the target polynomial. This step is carried out by
the following proposition:

######  Proposition D.8.

Let $s\in\mathbb{N}$, $1\leq k\leq K$, $I\subseteq\\{1,\dots,d\\}$ with
$|I|=r_{k}$ and $P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$
be a polynomial of degree at most $s$ with $|V(P)\cap\Omega_{k}|\geq\delta
p^{dk-r}$. Then

$\Delta_{k,I}(\mathbb{n}^{\prime})^{s+2}P(\mathbb{n}^{\prime},n_{k})=\sum_{j=1}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial $Q_{j}$ of degree at most $O_{k,s}(1)$ for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and $n_{k}\in\mathbb{F}_{p}^{d}$.

###### Proof.

The proof is a simpler version of that of Proposition D.5. By Lemma D.7, we
have that $|V(P)\cap\Omega_{k}\cap Z_{k,I}|\geq\delta p^{dk-r}/2$. By the
Pigeonhole Principle and Theorem C.3 (ii), it is not hard to see that there
exist a subset $U\subseteq\Omega_{k-1}$ with $|U|\gg\delta
p^{d(k-1)-(r-r_{k})}$ and a subset
$U(\mathbb{n}^{\prime})\subseteq\Omega_{k}(\mathbb{n}^{\prime})$ of
cardinality $\gg\delta p^{d-r_{k}}$ for each $\mathbb{n}^{\prime}\in U$ such
that for all $\mathbb{n}^{\prime}\in U$ and $n_{k}\in U(\mathbb{n}^{\prime})$,
we have that $P(\mathbb{n}^{\prime},n_{k})=0$ and
$\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$.

For simplicity denote $n^{\prime}_{k}:=n_{k,I^{c}}=(n_{k,\ell})_{\ell\in
I^{c}}$ and set
$P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k}):=P(\mathbb{n}^{\prime},\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))$.
Then for all $n_{k}\in\mathbb{F}_{p}^{d}$, we have that
$(\mathbb{n}^{\prime},n_{k})\in
V(P_{I}(\mathbb{n}^{\prime},\cdot))\cap\Omega_{k}(\mathbb{n}^{\prime})$ if and
only if $n_{k}=\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})$ for some
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}}$ with
$P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k})=0$. Since $U(\mathbb{n}^{\prime})$
is of cardinality $\gg\delta p^{d-r_{k}}$, we have that
$|V(P_{I}(\mathbb{n}^{\prime},\cdot))|\gg\delta p^{d-r_{k}}$. By Lemma 4.10,
we have that

(D.18) $P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k})=0$

for all $\mathbb{n}^{\prime}\in U$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}}$. We may write the left hand side
of (D.18) as

$\sum_{m\in\mathbb{N}^{d-r_{k}},|m|\leq
s}C_{m}(\mathbb{n}^{\prime}){n^{\prime}_{k}}^{m}$

for some polynomial $C_{m}(\mathbb{n}^{\prime})$ of degree at most
$O_{k,s}(1)$. Then we have that $C_{m}(\mathbb{n}^{\prime})=0$ for all
$\mathbb{n}^{\prime}\in U$ and thus $|V(C_{m})\cap\Omega_{k-1}|\gg\delta
p^{d(k-1)-(r-r_{k})}$. By induction hypothesis, we have that
$\Omega_{k-1}\subseteq V(C_{m})$. So (D.18) holds for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}}$.

Let $(\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}$ denote the
$\ell$-th entry of $\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})$. By (D.16)
and (D.17), for all $\ell\in I$,
$\Delta_{k,I}(\mathbb{n}^{\prime})((\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}-n_{k,\ell})$
equals to the determinant of the $r_{k}\times r_{k}$ matrix obtained by
replacing the column $(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{1\leq j\leq r_{k}}$
from $(S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime}))_{1\leq j\leq
r_{k},\ell^{\prime}\in I}$ by the column $(q_{j,\ell})_{1\leq j\leq r_{k}}$,
where

$q_{j,\ell}=R_{k,I,j,\ell}(\mathbb{n}^{\prime},n^{\prime}_{k})-n_{k,\ell}S_{k,j,\ell}(\mathbb{n}^{\prime})=-F_{k,j}(\mathbb{n}^{\prime},n_{k})+\sum_{\ell^{\prime}\in
I\backslash\\{\ell\\}}n_{k,\ell^{\prime}}S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime})$

for all $1\leq j\leq r_{k}$, which, by linearity, equals to the determinant of
the $r_{k}\times r_{k}$ matrix obtained by replacing the column
$(S_{k,j,\ell}(\mathbb{n}^{\prime}))_{1\leq j\leq r_{k}}$ from
$(S_{k,j,\ell^{\prime}}(\mathbb{n}^{\prime}))_{1\leq j\leq
r_{k},\ell^{\prime}\in I}$ by the column
$(-F_{k,j}(\mathbb{n}^{\prime},n_{k}))_{1\leq j\leq r_{k}}$ This means that
$\Delta_{k,I}(\mathbb{n}^{\prime})((\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k}))_{\ell}-n_{k,\ell})$
can be written in the form

(D.19)
$\sum_{j=1}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial
$Q_{j}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at
most $r_{k}$. Therefore,

$\Delta_{k,I}(\mathbb{n}^{\prime})^{s}(P(\mathbb{n}^{\prime},n_{k})-P_{I}(\mathbb{n}^{\prime},n^{\prime}_{k}))=\Delta_{k,I}(\mathbb{n}^{\prime})^{s}(P(\mathbb{n}^{\prime},n_{k})-P(\mathbb{n}^{\prime},(\phi_{k,I,\mathbb{n}^{\prime}}(n^{\prime}_{k})))$

can be written in the form (D.19) for some polynomial
$Q_{j}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at
most $ks$. Since (D.18) holds for all $\mathbb{n}^{\prime}\in\Omega_{k-1}$ and
$n^{\prime}_{k}\in\mathbb{F}_{p}^{d-r_{k}}$, we have that

$\Delta_{I}(\mathbb{n}^{\prime})^{s+2}P(\mathbb{n}^{\prime},n_{k})=\sum_{j=1}^{r_{k}}F_{k,j}(\mathbb{n}^{\prime},n_{k})Q_{j}(\mathbb{n}^{\prime},n_{k})$

for some polynomial $Q_{j}$ of degree at most $O_{k,s}(1)$ for all
$\mathbb{n}^{\prime}\in\Omega_{k-1}$ and $n_{k}\in\mathbb{F}_{p}^{d}$. ∎

Step 3: removing the $\Delta_{k,I}(\mathbb{n}^{\prime})^{s+2}$ term using a
parametrization trick. We are now ready to complete the proof of Part (i) of
Theorem D.1 for $\Omega_{k}$ for the case $c_{k}=1$. Let
$P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ be a polynomial
of degree at most $s$ with $|V(P)\cap\Omega_{k}|\geq\delta|\Omega_{k}|$. We
wish to show that for all
$\mathbb{n}=(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$, we have that
$P(\mathbb{n}^{\prime},n_{k})=0$.

We first consider the case when $n_{1},\dots,n_{k-1}$ are linearly
independent. Since $L_{k,j},1\leq j\leq r_{k}$ are linearly independent, we
have that $L_{k,j}(\mathbb{n}^{\prime}),1\leq j\leq r_{k}$ are linearly
independent. Since $A$ is invertible, the vectors
$L_{k,j}(\mathbb{n}^{\prime})A=(S_{k,j,1}(\mathbb{n}^{\prime}),\dots,S_{k,j,d}(\mathbb{n}^{\prime})),1\leq
j\leq r_{k}$ are also linearly independent. By the knowledge of linear
algebra, there exists a subset $I$ of $\\{1,\dots,d\\}$ of cardinality $r_{k}$
such that $\Delta_{k,I}(\mathbb{n}^{\prime})\neq 0$. On the other hand, by
Theorem C.3, $|V(P)\cap\Omega_{k}|\geq\delta p^{dk-r}/2$ since $d\geq 2r+1$.
Since $(\mathbb{n}^{\prime},n_{k})\in\Omega_{k}$, we have that
$\Delta_{k,I}(\mathbb{n}^{\prime})^{s+2}P(\mathbb{n}^{\prime},n_{k})=0$ by
Proposition D.8. Therefore, $P(\mathbb{n}^{\prime},n_{k})=0$.

If $n_{1},\dots,n_{k-1}$ are linearly dependent, the argument is similar to
the case $c_{k}=1$. We omit the details. This completes the proof of Part (i)
of Theorem D.1.

###  D.5. Hilbert Nullstellensatz properties for $M$-sets

Before proving Parts (ii) and (iii) of Theorem D.1, we take a detour to study
Hilbert Nullstellensatz properties for $M$-sets. It is natural to ask the
following question:

######  Conjecture D.9 (Hilbert Nullstellensatz for $M$-sets).

Let $d,k\in\mathbb{N}_{+}$, $s\in\mathbb{N}$, $p$ be a prime,
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$ be a non-degenerate quadratic
form, and $\Omega\subseteq(\mathbb{F}_{p}^{d})^{k}$ be a consistent $M$-set
given by $\Omega=V(\mathcal{J})$ for some consistent $(M,k)$-family
$\mathcal{J}=\\{f_{1},\dots,f_{r}\\}$ for some $r\in\mathbb{N}_{+}$. If
$d\gg_{k,r,s}1$ and $p\gg_{d}1$, then for any polynomial
$P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ of degree at most
$s$ with $\Omega\subseteq V(P)$, we have that

$P=\sum_{j=1}^{r}f_{j}Q_{j}$

for some polynomial $Q_{j}$ of degree $O_{k,r,s}(1)$.

Unfortunately we do not know the answer to Conjecture D.9. However, we have a
partial result which is sufficient for the purpose of this paper. We need to
introduce some notations before stating the result. Let the notations be the
same as Sections D.2, D.3 and D.4. Assume that $\Omega$ is of type
$(c_{1},\dots,c_{K})$. For all $1\leq k\leq K$, if $c_{k}=1$, pick some
$I_{k}\subseteq\\{1,\dots,d\\}$ with $|I_{k}|=r_{k}-1$ and some
$i_{k,1},i_{k,2}\in\\{1,\dots,d\\}\backslash I_{k},i_{k,1}\leq i_{k,2}$; if
$c_{k}=0$, pick some $I_{k}\subseteq\\{1,\dots,d\\}$ with $|I_{k}|=r_{k}$ and
set $i_{k,1}=i_{k,2}=0$. We say that
$\mathfrak{I}:=(I_{k},i_{k,1},i_{k,2})_{k=1}^{K}$ is an _admissible
parametrization_ of $\Omega$. Define

$D_{\mathfrak{I}}(n_{1},\dots,n_{K}):=\prod_{k=1}^{K}G_{k,I_{k},i_{k,1},i_{k,2}}(n_{1},\dots,n_{k-1})\Delta_{k,I_{k}}(n_{1},\dots,n_{k-1}),$

where we set $\Delta_{k,I_{k}}\equiv 1$ if $I_{k}=\emptyset$ and set
$G_{k,I_{k},i_{k,1},i_{k,2}}\equiv 1$ if either $I_{k}=\emptyset$ or
$i_{k,1}=i_{k,2}=0$. We have the following partial answer to Conjecture D.9:

######  Proposition D.10.

Let the notations be the same as Sections D.2, D.3 and D.4. Let
$s\in\mathbb{N}$ and $\mathfrak{I}$ be an admissible parametrization of
$\Omega$. Let $P\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ be
a polynomial of degree at most $s$ with $\Omega\subseteq V(P)$. Then

(D.20)
$\begin{split}D_{\mathfrak{I}}^{T}P=\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}F_{k,j}Q_{k,j}\end{split}$

for some $T=O_{K,s}(1)\in\mathbb{N}$ and some polynomial $Q_{k,j}$ of degree
at most $O_{K,s}(1)$.

###### Proof.

Assume that $\mathfrak{I}:=(I_{k},i_{k,1},i_{k,2})_{k=1}^{K}$. For $1\leq
t\leq K$, we say that _Property $t$_ holds if

$\begin{split}&\quad\Bigl{(}\prod_{k=t}^{K}G_{k,I_{k},i_{k,1},i_{k,2}}(n_{1},\dots,n_{k-1})\Delta_{k,I_{k}}(n_{1},\dots,n_{k-1})\Bigr{)}^{T}P(n_{1},\dots,n_{K})\\\
&=\sum_{k=t}^{K}\sum_{j=1}^{r_{k}}F_{k,j}(n_{1},\dots,n_{k})Q_{k,j}(n_{1},\dots,n_{K})\end{split}$

for some $T=O_{K,s}(1)\in\mathbb{N}$ and some polynomial $Q_{k,j}$ of degree
at most $O_{K,s}(1)$ for all $(n_{1},\dots,n_{t-1})\in\Omega_{t-1}$ and
$n_{t},\dots,n_{K}\in\mathbb{F}_{p}^{d}$.

By Theorem C.3, Propositions D.5 and D.8, we have that Property $K$ holds.
Suppose now that we have shown Property $(t+1)$ for some $1\leq t\leq K-1$, we
prove that Property $t$ holds. Suppose that

(D.21)
$\begin{split}&\quad\Bigl{(}\prod_{k=t+1}^{K}G_{k,I_{k},i_{k,1},i_{k,2}}(n_{1},\dots,n_{k-1})\Delta_{k,I_{k}}(n_{1},\dots,n_{k-1})\Bigr{)}^{T}P(n_{1},\dots,n_{K})\\\
&-\sum_{k=t+1}^{K}\sum_{j=1}^{r_{k}}F_{k,j}(n_{1},\dots,n_{k})Q_{k,j}(n_{1},\dots,n_{K})=0\end{split}$

for some $T=O_{K,s}(1)\in\mathbb{N}$ and some polynomial $Q_{k,j}$ of degree
at most $O_{k,s}(1)$ for all $(n_{1},\dots,n_{t})\in\Omega_{t}$ and
$n_{t+1},\dots,n_{K}\in\mathbb{F}_{p}^{d}$. Let $Q$ be the polynomial on the
left hand side of (D.21). Then $Q(n_{1},\dots,n_{K})=0$ for all
$(n_{1},\dots,n_{t})\in\Omega_{t}$ and
$n_{t+1},\dots,n_{K}\in\mathbb{F}_{p}^{d}$. Writing

(D.22)
$\begin{split}Q(n_{1},\dots,n_{K})=\sum_{i_{t+1},\dots,i_{K}\in\mathbb{N}^{d},|i_{t+1}+\dots+i_{K}|\leq
O_{K,s}(1)}C_{i_{t+1},\dots,i_{K}}(n_{1},\dots,n_{t})n_{t+1}^{i_{t+1}}\dots
n_{K}^{i_{K}}\end{split}$

for some polynomials $C_{i_{t+1},\dots,i_{K}}$ of degrees at most
$O_{k,s}(1)$, this implies that $C_{i_{t+1},\dots,i_{K}}(n_{1},\dots,$
$n_{t})=0$ for all
$i_{t+1},\dots,i_{K}\in\mathbb{N}^{d},|i_{t+1}+\dots+i_{K}|\leq O_{K,s}(1)$
and $(n_{1},\dots,n_{t})\in\Omega_{t}$. Applying Theorem C.3, Propositions D.5
and D.8 to the set $\Omega_{t}$, we have that

(D.23)
$\begin{split}&\quad(G_{t,I_{t},i_{t,1},i_{t,2}}(n_{1},\dots,n_{t-1})\Delta_{t,I_{t}}(n_{1},\dots,n_{t-1}))^{T^{\prime}}C_{i_{t+1},\dots,i_{K}}(n_{1},\dots,n_{t})\\\
&=\sum_{j=1}^{r_{t}}F_{t,j}(n_{1},\dots,n_{t})Q_{j;i_{t+1},\dots,i_{K}}(n_{1},\dots,n_{t})\end{split}$

for some $T^{\prime}=O_{K,s}(1)\in\mathbb{N}$ and some polynomial
$Q_{j;i_{t+1},\dots,i_{K}}$ of degree at most $O_{K,s}(1)$ for all
$(n_{1},\dots,n_{t-1})\in\Omega_{t-1}$ and $n_{t}\in\mathbb{F}_{p}^{d}$ for
all $i_{t+1},\dots,i_{K}\in\mathbb{N}^{d},|i_{t+1}+\dots+i_{K}|\leq
O_{K,s}(1)$. Property $t$ follows by combining (D.21), (D.22) and (D.23).

So by induction, we have that Property 1 holds and we are done. ∎

Let
$\tilde{D}_{\mathfrak{I}},\tilde{F}_{k,j}\colon\mathbb{Z}^{d}\to\mathbb{Z}/p$
be regular liftings of $D_{\mathfrak{I}}$ and $F_{k,j}$, respectively. By
Lemmas 2.8 and A.1, we may lift Proposition D.10 to the $\mathbb{Z}/p$
setting.

######  Corollary D.11.

Let the notations be the same as Sections D.2, D.3 and D.4. Let
$s\in\mathbb{N}$ and $\mathfrak{I}$ be an admissible parametrization of
$\Omega$. Let
$P\in\text{poly}_{p}((\mathbb{Z}^{d})^{k}\to\mathbb{Z}/p|\mathbb{Z})$ be a
polynomial of degree at most $s$ with $\tau(\Omega)\subseteq V_{p}(P)$. Then
there exist $T=O_{K,s}(1)\in\mathbb{N}$ and
$Q_{0},Q_{k,j}\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z}),1\leq k\leq
K,0\leq j\leq r_{k}$ of degree at most $O_{K,s}(1)$ with $Q_{k,j}$ having
integer coefficients such that

$\begin{split}(p\tilde{D}_{\mathfrak{I}})^{T}P=Q_{0}+\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}\tilde{F}_{k,j}Q_{k,j}.\end{split}$

###### Proof.

Let $P^{\prime}\in\text{poly}((\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p})$ be
the polynomials induced by $P$. Then $\Omega\subseteq V(P^{\prime})$. By
Proposition D.10, we have

(D.24)
$\begin{split}D_{\mathfrak{I}}^{T}P^{\prime}=\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}F_{k,j}Q^{\prime}_{k,j}\end{split}$

for some $T=O_{K,s}(1)\in\mathbb{N}$ and some $Q^{\prime}_{k,j}$ of degree at
most $O_{K,s}(1)$. Let $\tilde{Q}_{k,j}$ be a regular lifting of
$Q^{\prime}_{k,j}$. By Lemma A.1 (iv), we have that
$(p\tilde{D}_{\mathfrak{I}})^{T}P$ is a lifting of
$D_{\mathfrak{I}}^{T}P^{\prime},$ and that
$\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}\tilde{F}_{k,j}p\tilde{Q}_{k,j}$ is a lifting
of $\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}F_{k,j}Q^{\prime}_{k,j}.$ So by Lemma A.1
(iii) and (D.24), the difference between $(p\tilde{D}_{\mathfrak{I}})^{T}P$
and $\sum_{k=1}^{K}\sum_{j=1}^{r_{k}}\tilde{F}_{k,j}p\tilde{Q}_{k,j}$ equals
to an integer valued polynomial $Q_{0}$ of degree at most $O_{K,s}(1)$.
Finally, since $\tilde{Q}_{k,j}$ takes values in $\mathbb{Z}/p$,
$Q_{k,j}:=p\tilde{Q}_{k,j}$ takes values in $\mathbb{Z}$. Applying Lemma 2.8
to modify $Q_{k,j}$ and $Q_{0}$ accordingly, we may require that all of
$Q_{k,j}$ have integer coefficients, while $Q_{0}$ still takes integer values.
We are done. ∎

###  D.6. Proof of parts (ii) and (iii) of Theorem D.1

We use the same notations as in Sections D.2 and D.3, except that now
$\mathbb{n},\mathbb{n}^{\prime},n_{i},n_{i,j}$ denote elements in
$\mathbb{Z}^{t}$ instead of $\mathbb{F}_{p}^{t}$ for some appropriate
$t\in\mathbb{N}_{+}$, and that we use $r$ to denote $r_{M}(\Omega)$. Part (ii)
follows from Part (i) and Proposition 9.8. So it remains to prove Part (iii).
Our strategy is to use the $p$-expansion trick. Let
$g\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z}/p^{s})$ be a polynomial of
degree at most $s$ with $|V_{p}(g)\cap\tau(\Omega)|\geq\delta p^{dK-r}$. Our
goal is to show that $\tau(\Omega)+p(\mathbb{Z}^{d})^{K}\subseteq V_{p}(g)$.

Since $g$ takes values in $\mathbb{Z}/p^{s}$, by the multivariate polynomial
interpolation, it is not hard to see that there exists $Q\in\mathbb{N}$,
$p\nmid Q$ such that

$Qg=\sum_{i=0}^{s}\frac{g^{\prime}_{i}}{p^{i}}$

for some integer valued polynomials
$g^{\prime}_{i}\colon(\mathbb{Z}^{d})^{K}\to\mathbb{Z}$ of degree at most $s$.

It is convenient to reindex the polynomials $F_{k,j},1\leq k\leq K,1\leq j\leq
r_{k}$ as $f_{1},\dots,f_{r}$ in an arbitrary order. Let $\tilde{f}_{j}$ be a
regular lifting of $f_{j}$. We say that a polynomial
$F\colon(\mathbb{Z}^{d})^{K}\to\mathbb{R}$ is _$t$ -good_ if

$F=\sum_{i:=(i_{1},\dots,i_{r})\in\mathbb{N}^{r},|i|\leq
s/2}F_{i}\prod_{j=1}^{r}\tilde{f}_{j}^{i_{j}}$

for some integer valued polynomials
$F_{i}\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z})$ of degree at most
$t-2|i|,0\leq|i|\leq s/2$. For convenience denote $a_{s}=s$ and let
$a_{i}=O_{a_{i+1},K,s}(1)$ to be chosen later for all $0\leq i\leq s-1$. Then
$a_{0}=O_{K,s}(1)<p$.

Let $\mathfrak{I}=(I_{k},i_{k,1},i_{k,2})_{k=1}^{K}$ be an admissible
parametrization of $\Omega$. Then $p\tilde{D}_{\mathfrak{I}}$ is an integer
valued polynomial of degree at most $O_{K,s}(1)$. Let
$T=O_{K,s}(1)\in\mathbb{N}$ to be chosen later. Let $k^{\prime}\in\mathbb{N}$
be the smallest integer such that

(D.25)
$(p\tilde{D}_{\mathfrak{I}})^{T(s-k^{\prime})}Qg=\sum_{i=0}^{k^{\prime}}\frac{g_{i}}{p^{i}}$

for some $Q\in\mathbb{N}$, $p\nmid Q$ and $a_{k^{\prime}}$-good polynomials
$g_{i}$. Obviously such $k^{\prime}$ exists and is at most $s$. We first show
that $k^{\prime}=0$.

Suppose that $k^{\prime}>0$. Let $U:=V_{p}(g)\cap\tau(\Omega)$. For all
$\mathbb{n}\in U$ and $\mathbb{m}\in(\mathbb{Z}^{d})^{K}$, since
$g(\mathbb{n}+p\mathbb{m})\in\mathbb{Z}$, we have that
$g_{k^{\prime}}(\mathbb{n}+p\mathbb{m})\in p\mathbb{Z}.$ Suppose that

(D.26) $g_{k^{\prime}}=\sum_{i:=(i_{1},\dots,i_{r})\in\mathbb{N}^{r},|i|\leq
s/2}R_{i}\prod_{j=1}^{r}\tilde{f}_{j}^{i_{j}}$

for some integer valued polynomials
$R_{i}\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z})$ of degree at most
$a_{k^{\prime}}-2|i|$.

Claim. There exists a subset $U^{\prime}$ of $U$ of cardinality at least
$\delta p^{dK-r}/2$ such that for all $\mathbb{n}\in U^{\prime}$ and
$i\in\mathbb{N}^{r},|i|\leq s/2$, we have that
$\frac{1}{p}R_{i}(\mathbb{n})\in\mathbb{Z}$.

By (D.4) and (D.5), for all $1\leq j\leq r$, we may write

$f_{j}(n_{1},\dots,n_{K})=\sum_{1\leq i\leq
K}\frac{1}{2}c_{j,i,i}(n_{i}A)\cdot n_{i}+\sum_{1\leq i<i^{\prime}\leq
K}c_{j,i,i^{\prime}}(n_{i}A)\cdot n_{i^{\prime}}+c^{\prime}_{j}$

for some $c_{j,i,i^{\prime}},c^{\prime}_{j}\in\mathbb{F}_{p}$ such that the
vectors $v_{j}:=(c_{j,i,i^{\prime}})_{1\leq i\leq i^{\prime}\leq
K}\in\mathbb{F}_{p}^{\binom{K+1}{2}},1\leq j\leq r$ are linearly independent.
For convenience denote $c_{j,i,i^{\prime}}:=c_{j,i^{\prime},i}$ for
$i^{\prime}<i$. It is not hard to see that we may write

$\tilde{f}_{j}(\mathbb{n}+p\mathbb{m})\equiv\tilde{f}_{j}(\mathbb{n})+T_{j}(\mathbb{n},\mathbb{m})\mod
p\mathbb{Z}$

for all $\mathbb{m},\mathbb{n}\in(\mathbb{Z}^{d})^{K}$, where

$T_{j}(\mathbb{n},\mathbb{m})=\sum_{i=1}^{K}(m_{i}\tau(A))\cdot\Bigl{(}\sum_{i^{\prime}=1}^{K}\tau(c_{j,i,i^{\prime}})n_{i^{\prime}}\Bigr{)}.$

Fix any $\mathbb{n}\in U$. Then

(D.27) $0\equiv
g_{k^{\prime}}(\mathbb{n}+p\mathbb{m})\equiv\sum_{i:=(i_{1},\dots,i_{r})\in\mathbb{N}^{r},|i|\leq
s/2}R_{i}(\mathbb{n})\prod_{j=1}^{r}(\tilde{f}_{j}(\mathbb{n})+T_{j}(\mathbb{n},\mathbb{m}))^{i_{j}}\mod
p\mathbb{Z}$

for all $m\in\mathbb{Z}^{d}$. Let $U^{\prime\prime}$ denote the set of
$\mathbb{n}=(n_{1},\dots,n_{K})\in(\mathbb{F}_{p}^{d})^{K}$ such that there
exist $t_{1},\dots,t_{r}\in\mathbb{F}_{p}$ not all equal to 0 with

$\sum_{j=1}^{r}t_{j}\Bigl{(}\sum_{i^{\prime}=1}^{K}c_{j,i,i^{\prime}}n_{i^{\prime}}\Bigr{)}=\mathbb{0}\text{
for all $1\leq i\leq K$.}$

Then for all $\mathbb{n}\in U^{\prime\prime}$, there exist
$t_{1},\dots,t_{r}\in\mathbb{F}_{p}$ such that

(D.28) $\sum_{i^{\prime}=1}^{K}u_{i,i^{\prime}}n_{i^{\prime}}=\mathbb{0}\text{
for all $1\leq i\leq K$,}$

where $u_{i,i^{\prime}}:=\sum_{j=1}^{r}t_{j}c_{j,i,i^{\prime}}$. Since
$v_{1},\dots,v_{r}$ are linearly independent, at least one of
$u_{i,i^{\prime}},1\leq i,i^{\prime}\leq K$ is non-zero. So at least one of
the equations in (D.28) is nontrivial and thus one of $n_{1},\dots,n_{K}$ is
uniquely determined by the rest. So

$|U^{\prime\prime}|\leq Kp^{r}\cdot p^{d(K-1)}=Kp^{d(K-1)+r}.$

Let $U^{\prime}:=U\backslash\tau(U^{\prime\prime})$. Since $|U|\geq\delta
p^{dK-r}$, and $d\geq 2r+1$, if $p\gg_{d,s}\delta^{-O_{d,s}(1)}$, then
$|U^{\prime}|\geq\delta p^{dK-r}/2$.

On the other hand, for all $\mathbb{n}\in U^{\prime}$, the vectors
$(\sum_{i^{\prime}=1}^{K}c_{j,i,i^{\prime}}n_{i^{\prime}})_{i=1}^{K},1\leq
j\leq r$ (as elements in $\mathbb{F}_{p}^{dK}$) are linearly independent.
Since $A$ is invertible, we have that

$\mathbb{m}\mod
p(\mathbb{Z}^{d})^{K}\mapsto(\tilde{f}_{j}(\mathbb{n})+T_{j}(\mathbb{n},\mathbb{m})\mod
p\mathbb{Z})_{1\leq j\leq r}$

is a surjection from $(\mathbb{Z}/p\mathbb{Z})^{dK}$ to
$(\mathbb{Z}/p\mathbb{Z})^{r}$. So it follows from (D.27) that

$\sum_{i:=(i_{1},\dots,i_{r})\in\mathbb{N}^{r},|i|\leq
s/2}R_{i}(\mathbb{n})\prod_{j=1}^{r}x_{j}^{i_{j}}\equiv 0\mod p\mathbb{Z}$

for all $x_{1},\dots,x_{r}\in\mathbb{Z}$. By interpolation, this implies that
$QR_{i}(\mathbb{n})\in p\mathbb{Z}$ for all $i\in\mathbb{N}^{r},|i|\leq s/2$
for some $Q\in\mathbb{N},p\nmid Q$. So $R_{i}$ takes values in
$\mathbb{Z}\cap\frac{p}{Q}\mathbb{Z}=p\mathbb{Z}$. This completes the proof of
the claim.

Let $U^{\prime}$ be given by the claim. Since $\frac{1}{p}R_{i}$ belongs to
$\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z}/p)$ and $\tau(\Omega)$ is
weakly $(\delta,p)$-irreducible for all $\delta>0$ as long as
$p\gg_{d,s}\delta^{-O_{d,s}(1)}$ by Part (ii), it follows from Theorem C.3
that $\tau(\Omega)\subseteq V_{p}(R_{i})$. By Corollary D.11, if
$T=O_{a_{k^{\prime}},K,s}(1)=O_{K,s}(1)$ is sufficiently large, then there
exist $Q_{i,j}\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z}),0\leq j\leq r$
of degree at most $O_{K,s}(1)$ such that

(D.29)
$\begin{split}\frac{1}{p}(p\tilde{D}_{\mathfrak{I}})^{T}R_{i}=Q_{i,0}+\sum_{j=1}^{r}\tilde{f}_{j}Q_{i,j}.\end{split}$

By (D.25), (D.26) and (D.29), we have that

$(p\tilde{D}_{\mathfrak{I}})^{T(s-(k^{\prime}-1))}Qg=\sum_{i=0}^{k^{\prime}-2}\frac{(p\tilde{D}_{\mathfrak{I}})^{T}g_{i}}{p^{i}}+\frac{1}{p^{k^{\prime}-1}}(p\tilde{D}_{\mathfrak{I}})^{T}(g_{k^{\prime}-1}+\frac{g_{k^{\prime}}}{p})$

with
$(p\tilde{D}_{\mathfrak{I}})^{T}(g_{k^{\prime}-1}+\frac{g_{k^{\prime}}}{p})$
being an $O_{K,s}(1)$-good polynomial. We arrive at a contradiction to the
minimality of $k^{\prime}$ provided that
$a_{k^{\prime}-1}\gg_{a_{k^{\prime}},K,s}1$.

In conclusion, we have that $k^{\prime}=0$ and thus

$(p\tilde{D}_{\mathfrak{I}})^{Ts}Qg=g^{\prime}$

for some $Q\in\mathbb{N}$, $p\nmid Q$ and some $a_{0}$-good polynomial
$g^{\prime}$. Then for every $\mathfrak{I}$ and every
$\mathbb{n}\in\tau(\Omega)+p(\mathbb{Z}^{d})^{K},$ we have
$g^{\prime}(\mathbb{n})\in\mathbb{Z}$ and thus

(D.30)
$(p\tilde{D}_{\mathfrak{I}}(\mathbb{n}))^{Ts}Qg(\mathbb{n})\in\mathbb{Z}.$

Our final step is to use a parametrization trick to get rid of the
$(p\tilde{D}_{\mathfrak{I}}(\mathbb{n}))^{Ts}$ term in (D.30). The method is
very similar to step 3 of the proof of Part (i) of Theorem D.1.

We first pick
$\mathbb{n}=(\mathbb{n}^{\prime},n_{K})\in\tau(\Omega)+p(\mathbb{Z}^{d})^{K}$
such that $n_{1},\dots,n_{K-1}$ are $p$-linearly independent. Fix $1\leq k\leq
K$. If $c_{k}=1$, then recall that $r_{k}\leq k$ and $L_{k,j},2\leq j\leq
r_{k}$ are linearly independent. Since $A$ is invertible, by the knowledge of
linear algebra, there exists a subset $I_{k}$ of $\\{1,\dots,d\\}$ of
cardinality $r_{k}-1$ such that
$\Delta_{k,I_{k}}(\iota(\mathbb{n}^{\prime}))\neq 0$. By Lemma D.3, there
exist $i_{k,1},i_{k,2}\in I^{c},i_{k,1}\leq i_{k,2}$ such that
$G_{k,I_{k},i_{k,1},i_{k,2}}(\iota(\mathbb{n}^{\prime}))\neq 0$. If $c_{k}=0$,
then recall that $r_{k}\leq k-1$ and $L_{k,j},1\leq j\leq r_{k}$ are linearly
independent. Since $A$ is invertible, by the knowledge of linear algebra,
there exists a subset $I_{k}$ of $\\{1,\dots,d\\}$ of cardinality $r_{k}$ such
that $\Delta_{k,I_{k}}(\iota(\mathbb{n}^{\prime}))\neq 0$. Denote
$i_{k,1}=i_{k,2}=0$.

Then $\mathfrak{I}=(I_{k},i_{k,1},i_{k,2})_{k=1}^{K}$ is an admissible
parametrization of $\Omega$. Moreover, since $D_{\mathfrak{I}}(\iota(n))\neq
0$, we have that $p\tilde{D}_{\mathfrak{I}}(\mathbb{n})\in\mathbb{Z}\backslash
p\mathbb{Z}$. By (D.30), we have $g(\mathbb{n})\in\mathbb{Z}/Q^{\prime}$ for
some $Q^{\prime}\in\mathbb{N},p\nmid Q^{\prime}$. On the other hand, since $g$
takes values in $\mathbb{Z}/p^{s}$, we have that $g(\mathbb{n})\in\mathbb{Z}$.

We now consider the case when $n_{1},\dots,n_{K-1}$ are not necessarily
$p$-linearly independent. For $1\leq t\leq K-1$, we say that _Property $t$_
holds if for all
$\mathbb{n}=(\mathbb{n}^{\prime},n_{K})\in\tau(\Omega)+p(\mathbb{Z}^{d})^{K}$
with $n_{1},\dots,n_{t}$ being $p$-linearly independent, we have that
$g(\mathbb{n})\in\mathbb{Z}$. By the discussion above, Property $K-1$ holds.
Assume now that we have proven Property $t+1$ holds for some $0\leq t\leq
K-2$. We show that Property $t$ holds. Pick any
$\mathbb{n}=(\mathbb{n}^{\prime},n_{K})\in\tau(\Omega)+p(\mathbb{Z}^{d})^{K}$
such that $n_{1},\dots,n_{t}$ are $p$-linearly independent. If
$n_{1},\dots,n_{t+1}$ are $p$-linearly independent, then
$g(\mathbb{n})\in\mathbb{Z}$ by induction hypothesis and we are done. So we
assume that $n_{1},\dots,n_{t+1}$ are $p$-linearly dependent.

By Lemma D.6, there exists a subspace $V$ of $\mathbb{F}_{p}^{d}$ dimension
$3$ such that

  * •

for all $v\in V\backslash\\{\mathbb{0}\\}$,
$\iota(n_{1}),\dots,\iota(n_{t}),v$ are linearly independent;

  * •

for all $v\in V$ and $1\leq j\leq K$, we have that $(vA)\cdot\iota(n_{j})=0$;

  * •

we have that $V\cap V^{\perp_{M}}=\\{\mathbb{0}\\}$.

Let $\phi\colon\mathbb{F}_{p}^{3}\to V$ be any bijective linear
transformation. Let $W$ be the set of $m\in\mathbb{F}_{p}^{3}$ such that
$(\iota(n_{1}),\dots,\iota(n_{t}),\iota(n_{t+1})+\phi(m),\iota(n_{t+2}),\dots,\iota(n_{K}))\in\Omega$.
Note that $\mathbb{0}\in W$. Since $(\phi(m)A)\cdot\iota(n_{j})=0$ for all
$1\leq j\leq K$, by (D.4) and (D.5), for all $1\leq i^{\prime}\leq K$ and
$1\leq j\leq r_{i^{\prime}}$ with either $(i^{\prime},j)\neq(t+1,1)$ or
$(i^{\prime},j)=(t+1,1)$ and $c_{t+1}=0$, it is not hard to see that

$F_{i^{\prime},j}(\iota(n_{1}),\dots,\iota(n_{t}),\iota(n_{t+1})+\phi(m),\iota(n_{t+2}),\dots,\iota(n_{K}))=F_{i^{\prime},j}(\iota(n_{1}),\dots,\iota(n_{K})).$

Moreover, if $(i^{\prime},j)=(t+1,1)$ and $c_{t+1}=1$, then by (D.4), we have
that

$M^{\prime}(m):=F_{t+1,1}(\iota(n_{1}),\dots,\iota(n_{t}),\iota(n_{t+1})+\phi(m),\iota(n_{t+2}),\dots,\iota(n_{K}))$

is a quadratic form from $\mathbb{F}_{p}^{3}$ to $\mathbb{F}_{p}$. It is then
not hard to see that $W=V(M^{\prime})$ if $c_{t+1}=1$ and
$W=\mathbb{F}_{p}^{3}$ if $c_{t+1}=0$. Since $V\cap
V^{\perp_{M}}=\\{\mathbb{0}\\}$, by Proposition 4.8 (ii),
$\text{rank}(M^{\prime})=3$. So by Propositions 9.9 and 9.10, $\tau(W)$ is
strongly $(1/2,p)$-irreducible.

On the other hand, for all $m\in\mathbb{F}_{p}^{3}\backslash\\{\mathbb{0}\\}$,
since $A$ $\iota(n_{1}),\dots,\iota(n_{t}),\phi(m)$ are linearly independent
and since $\iota(n_{1}),\dots,\iota(n_{t+1})$ are linearly dependent, we have
that $\iota(n_{1}),\dots,$ $\iota(n_{t}),\iota(n_{t+1})+\phi(m)$ are linearly
independent. So $n_{1},\dots,n_{t},n_{t+1}+\tau\circ\phi(m)+pu$ are
$p$-linearly independent for all $u\in\mathbb{Z}^{d}$. By the induction
hypothesis that Property $t+1$ holds, we have that

(D.31)
$g(n_{1},\dots,n_{t},n_{t+1}+\tau\circ\phi(m)+pu,n_{t+2},\dots,n_{K})\in\mathbb{Z}$

for all $m\in W\backslash\\{\mathbb{0}\\}$ and $u\in\mathbb{Z}^{d}$.

Let $\phi^{\prime}\colon\mathbb{Z}^{3}\to\mathbb{Z}^{d}$ be the linear
transformation induced by the restrictions
$\phi^{\prime}(e_{j}):=\tau(\phi(e_{j}))$ for $j=1,2,3$, where we slightly
abuse the notation to let $e_{j}$ denote the $j$-th standard vector of both
$\mathbb{Z}^{3}$ and $\mathbb{F}_{p}^{3}$. it is not hard to see that
$\tau\circ\phi\equiv\phi^{\prime}\circ\tau\mod p\mathbb{Z}^{d}$ and
$\phi^{\prime}(x+py)-\phi^{\prime}(x)\in p\mathbb{Z}^{d}$ for all
$x,y\in\mathbb{Z}^{d}$. Let $g^{\prime}\colon\mathbb{Z}^{3}\to\mathbb{R}$ be
given by

$g^{\prime}(x):=g(n_{1},\dots,n_{t},n_{t+1}+\phi^{\prime}(x),n_{t+2},\dots,n_{K})$

for all $x_{1},\dots,x_{K-1}\in\mathbb{Z}^{3}$. Since
$g\in\text{poly}((\mathbb{Z}^{d})^{K}\to\mathbb{Z}/p^{s})$, we have that
$g^{\prime}\in\text{poly}(\mathbb{Z}^{3}\to\mathbb{Z}/p^{s})$.

On the other hand, for any $m\in W\backslash\\{\mathbb{0}\\}$ and
$z\in\mathbb{Z}^{3}$, by (D.31), there exist $u\in\mathbb{Z}^{d}$ such that

$\begin{split}&\quad
g^{\prime}(\tau(m)+pz)=g(n_{1},\dots,n_{t},n_{t+1}+\phi^{\prime}(\tau(m)+pz),n_{t+2},\dots,n_{K})\\\
&=g(n_{1},\dots,n_{t},n_{t+1}+\tau\circ\phi^{\prime}(m)+pu,n_{t+2},\dots,n_{K})\in\mathbb{Z}.\end{split}$

This implies that $\tau(W)\backslash\\{\mathbb{0}\\}\subseteq
V_{p}(g^{\prime})$. So $|V_{p}(g^{\prime})\cap\tau(W)|\geq|W|-1\geq|W|/2$.
Since $\tau(W)$ is strongly $(1/2,p)$-irreducible, we have that
$\tau(W)\subseteq V_{p}(g^{\prime})$. In particular, since
$\mathbb{0}\in\tau(W)$, we have that
$g(\mathbb{n})=g^{\prime}(\mathbb{0})\in\mathbb{Z}$.

In conclusion, we have that Property $t$ holds. By induction, we deduce that
Property 0 holds, meaning that $\tau(\Omega)+p(\mathbb{Z}^{d})^{K}\subseteq
V_{p}(g)$. So $\Omega$ is $\delta$-irreducible up to degree $s$. This
completes the proof of Part (iii) of Theorem D.1.

##  Appendix E Leibman dichotomies for nice and consistent $M$-sets

We present the proof of Theorem 10.5 in this appendix. We restate this theorem
below for convenience.

######  Theorem E.1 (Nice and consistent $M$-sets admit Leibman dichotomies).

Let $d,k\in\mathbb{N}_{+},s,$ $r\in\mathbb{N}$ with
$d\geq\max\\{4r+1,4k+3,2k+s+11\\}$, $C>0$ and $p$ be a prime. There exists
$K:=O_{C,d}(1)$ such that for any non-degenerate quadratic form
$M\colon\mathbb{F}_{p}^{d}\to\mathbb{F}_{p}$, any nice and consistent $M$-set
$\Omega\subseteq(\mathbb{F}_{p}^{d})^{k}$ of total co-dimension $r$, and any
$0<\delta<1/2$, if $p\gg_{C,d}\delta^{-O_{C,d}(1)}$, then $\Omega$ admits a
$(\delta,K\delta^{-K})$-Leibman dichotomy up to step $s$ and complexity $C$.

By Proposition B.3 (iii) and Lemma 10.4, we may assume without loss of
generality that $\Omega=V(\mathcal{J})$ for some nice and consistent
$(M,k)$-family $\mathcal{J}$. By Lemma B.1, $\mathcal{J}$ admits a nice and
standard $M$-representation $(F_{i,j}\colon 1\leq i\leq k,1\leq j\leq r_{i})$
such that

(E.1)
$F_{i,j}(n_{1},\dots,n_{k})=(n_{i}A)\cdot(a_{i,j,1}n_{1}+\dots+a_{i,j,i}n_{i})+u_{i,j}$

for some $a_{i,j,t},u_{i,j}\in\mathbb{F}_{p}$ for all $1\leq i\leq k,1\leq
j\leq r_{i}$, such that the matrix
$\begin{bmatrix}a_{i,1,i}&\dots&a_{i,1,1}\\\ \dots&\dots&\dots\\\
a_{i,r_{i},i}&\dots&a_{i,r_{i},1}\end{bmatrix}$ is of rank $r_{i}$ and is in
the reduced row echelon form, where $0\leq r_{i}\leq i$ and
$r_{1}+\dots+r_{k}=r$. In particular, $F_{i,j}$ is independent of
$n_{i+1},\dots,n_{k}$ and depends nontrivially on $n_{1},\dots,n_{i}$.

Fix any $\delta>0$. Throughout the proof, assume that
$p\gg_{C,d}\delta^{-O_{C,d}(1)}$. Let $G/\Gamma$ be an $s$-step
$\mathbb{N}$-filtered nilmanifold of complexity at most $C$ and
$g\in\text{poly}_{p}(\Omega\to G_{\mathbb{N}}|\Gamma)$ be such that
$(g(n)\Gamma)_{n\in\Omega}$ is not $\delta$-equidistributed on $G/\Gamma$.

The idea of the proof is inspired by Section 3 of [9] (see also page 37 of
[20] and Proposition 4.11 of [22] for similar methods), which we explain
briefly. For any bijective $d$-integral linear transformation
$\phi\colon(\mathbb{F}_{p}^{d})^{k}\to(\mathbb{F}_{p}^{d})^{k}$, one can show
that for many $\mathbb{x}\in(\mathbb{F}_{p}^{d})^{k-1}$, the sequence
$(g\circ\phi^{-1}(\mathbb{x},n)\Gamma)_{n\in\mathbb{F}_{p}^{d}\colon(\mathbb{x},n)\in\phi(\Omega)}$
is not $O(\delta)$-equidistributed on $G/\Gamma$. On the other hand, the set
$\\{n\in\mathbb{F}_{p}^{d}\colon(\mathbb{x},n)\in\phi(\Omega)\\}$ can be
viewed as the set of zeros of some quadratic form induced by $M$. We may use
Theorem 5.1 to conclude that $\eta\circ
g\circ\phi^{-1}(\mathbb{x},\cdot)\mod\mathbb{Z}$ is a constant when restricted
to $\Omega$ for some nontrivial type-I horizontal character $\eta$ for many
$\mathbb{x}$. If we take sufficiently many different $\phi$, then we will be
able to combine these informations to conclude that $\eta\circ
g\mod\mathbb{Z}$ is a constant on $\Omega$.

We now turn to the rigorous proof of Theorem E.1.

Step 1: decomposing $\Omega$ using different linear transformations. Let
$N:=\lceil p^{\alpha}\rceil$ for any fixed $\frac{k-2}{k-1}<\alpha<1$. Denote
$(a_{1},\dots,a_{k-1})\otimes
n:=(a_{1}n,\dots,a_{k-1}n)\in(\mathbb{F}_{p}^{d})^{k-1}$ for
$a_{1},\dots,a_{k-1}\in\mathbb{F}_{p}$ and $n\in\mathbb{F}_{p}^{d}$. For all
$v\in\\{0,\dots,N-1\\}^{k-1}\subseteq\mathbb{F}_{p}^{k-1}$, let
$\phi_{v}\colon(\mathbb{F}_{p}^{d})^{k}\to(\mathbb{F}_{p}^{d})^{k}$ denote the
bijective $d$-integral linear transformation given by

$\phi_{v}(\mathbb{x},n):=(\mathbb{x}+v\otimes n,n)\text{ for all
}\mathbb{x}\in(\mathbb{F}_{p}^{d})^{k-1},n\in\mathbb{F}_{p}^{d}.$

By Proposition B.3 (iii), $\mathcal{J}_{v}:=\\{F_{i,j}\circ\phi_{v}\colon
1\leq i\leq k^{\prime},1\leq j\leq r_{i}\\}$ is a nice and independent
$(M,k)$-family. So $\phi_{v}^{-1}(\Omega)$ is a nice and consistent $M$-set
with total co-dimension $r$. By Lemma B.1, $\phi_{v}^{-1}(\Omega)$ admits a
nice and standard $M$-representation with some dimension vector
$\mathbb{r}_{v}$ of dimension $r$. By the Pigeonhole Principle, there exist a
subset $T$ of $\\{0,\dots,N-1\\}^{k-1}$ of cardinality $\gg_{k,r}N^{k-1}$ such
that $\mathbb{r}_{v}$ equals to the same vector
$\mathbb{r}^{\prime}=(r^{\prime}_{1},\dots,r^{\prime}_{k})$ with
$r^{\prime}_{1}+\dots+r^{\prime}_{k}=r$ for all $v\in T$. Since
$\phi_{v}^{-1}(\Omega)$ is nice, we have $0\leq r^{\prime}_{i}\leq i$.

For convenience denote $D:=d(k-1)-r^{\prime}_{1}-\dots-r^{\prime}_{k-1}.$ Let
$(\mathcal{J}^{\prime}_{v},\mathcal{J}^{\prime\prime}_{v})$ be an
$\\{n_{1},\dots,n_{k-1}\\}$-decomposition of $\mathcal{J}_{v}$ (recall
Appendix C for the definition). Let $\Omega_{v}$ denote the set of
$(n_{1},\dots,n_{k-1})\in(\mathbb{F}_{p}^{d})^{k-1}$ such that
$(n_{1},\dots,n_{k})\in V(\mathcal{J}^{\prime}_{v})$ for all
$n_{k}\in\mathbb{F}_{p}^{d}$, and for each
$(n_{1},\dots,n_{k-1})\in(\mathbb{F}_{p}^{d})^{k-1}$, let
$\Omega_{v}(n_{1},\dots,n_{k-1})$ denote the set of
$n_{k}\in\mathbb{F}_{p}^{d}$ such that $(n_{1},\dots,n_{k})$ $\in
V(\mathcal{J}^{\prime\prime}_{v})$. Since $d\geq 2r+1$, by Theorem C.3 and the
Pigeonhole Principle, for any $v\in T$, there exist a subset $U_{v}$ of
$\Omega_{v}$ of cardinality $\gg_{d}\delta p^{D}$ such that for all
$\mathbb{x}\in U_{v}$, $\Omega_{v}(\mathbb{x})$ has a standard
$M$-representation with the one dimensional dimension vector
$(r^{\prime}_{k})$, and that $(g(n)\Gamma)_{n\in\Omega_{v}(\mathbb{x})}$ is
not $O_{d}(\delta)$-equidistributed. Let $J$ denote the set of
$(v,\mathbb{x})\in(\mathbb{F}_{p}^{d})^{k-1}\times T$ such that $\mathbb{x}\in
U_{v}$. Then $|J|\gg_{d}N^{k-1}\delta p^{D}$.

Since $\Omega_{v}(\mathbb{x})$ has a standard $M$-representation with the
dimension vector $(r^{\prime}_{k})$, we have that either
$\Omega_{v}(\mathbb{x})$ is the intersection of the zeros of an
$(M,1)$-integral quadratic function and an affine subspace of
$\mathbb{F}_{p}^{d}$ of co-dimension $r^{\prime}_{k}-1$, or
$\Omega_{v}(\mathbb{x})$ is an affine subspace of $\mathbb{F}_{p}^{d}$ of co-
dimension $r_{k}$. For the former case, since $d-2(r^{\prime}_{k}-1)\geq
d-2(k-1)\geq s+13$, by Proposition 4.8 and Theorem 10.3, for all $(v,x)\in J$,
there exists a nontrivial type-I horizontal character
$0<\|\eta_{v,\mathbb{x}}\|\leq O_{C,d}(1)\delta^{-O_{C,d}(1)}$ such that
$\eta_{v,\mathbb{x}}\circ g(\phi_{v}(\mathbb{x},\cdot))\mod\mathbb{Z}$ is a
constant on $\Omega_{v}(\mathbb{x})$. For the later case, we have the same
conclusion by Theorem 10.2.

By the Pigeonhole Principle, there exists a subset $J_{1}$ of $J$ of
cardinality at least $\gg_{C,d}N^{k-1}\delta^{O_{C,d}(1)}p^{D}$ such that
$\eta_{v,\mathbb{x}}$ equals to the same $\eta$ for all $(v,\mathbb{x})\in
J_{1}$. Again by the Pigeonhole Principle, there exists a subset $J^{\prime}$
of $T$ of cardinality $\gg_{C,d}\delta^{O_{C,d}(1)}N^{k-1}$ such that for all
$v\in J^{\prime}$, the set
$J^{\prime}(v):=\\{\mathbb{x}\colon(\mathbb{x},v)\in J_{1}\\}$ is of
cardinality $\gg_{C,d}\delta^{O_{C,d}(1)}p^{D}$. Since $N:=\lceil
p^{\alpha}\rceil$, we have that $|J^{\prime}|>p^{k-2}$. Similar to the proof
of Lemma 4.11, there exist $v_{1},\dots,v_{k}\in J^{\prime}$ such that
$(1,v_{1}),\dots,(1,v_{k})\in\mathbb{F}_{p}^{k}$ are linearly independent.

Denote $F:=\eta\circ g$. We wish to show that $F\mod\mathbb{Z}$ is a constant
on $\Omega$.

Step 2: deriving an invariance property for $F$. It is convenient to transform
$\Omega$ by the bijective $d$-integral linear transformation
$\psi\colon(\mathbb{F}_{p}^{d})^{k}\to(\mathbb{F}_{p}^{d})^{k}$ given by

$\psi(n_{1},\dots,n_{k}):=(v_{1}\otimes n_{1}+\dots+v_{k}\otimes
n_{k},n_{1}+\dots+n_{k}),$

and temporarily work with the function $F^{\prime}:=\eta\circ g\circ\psi$. Our
next step is to combine the information we get for $F$ from the linear
transformations $\phi_{v_{1}},\dots,\phi_{v_{k}}$. For all $1\leq i\leq k$,
Let $\psi_{i}\colon(\mathbb{F}_{p}^{d})^{k}\to(\mathbb{F}_{p}^{d})^{k}$ be the
bijective $d$-integral linear transformation given by

$\psi_{i}(n_{1},\dots,n_{k}):=\Bigl{(}\sum_{j=1}^{k}(v_{j}-v_{i})\otimes
n_{j},n_{1}+\dots+n_{k}\Bigr{)}.$

Let $U_{i}\subseteq\psi^{-1}_{i}(\Omega)$ be the set of
$y\in\psi^{-1}_{i}(\Omega)$ such that $\psi_{i}(y)=(\mathbb{x},n)$ for some
$\mathbb{x}\in J^{\prime}(v_{i})$ and $n\in\Omega_{v_{i}}(\mathbb{x})$. For
such $y=(y_{1},\dots,y_{k})\in\psi^{-1}_{i}(\Omega)$ , we have that
$n=y_{1}+\dots+y_{k}$ and $\mathbb{x}=\sum_{j=1}^{k}(v_{j}-v_{i})\otimes
y_{j}$. So

(E.2) $\begin{split}&\quad F^{\prime}(y_{1},\dots,y_{k})=\eta\circ
g(v_{1}\otimes y_{1}+\dots+v_{k}\otimes y_{k},y_{1}+\dots+y_{k})\\\
&=\eta\circ g(\mathbb{x}+v_{i}\otimes n,n)=\eta\circ
g\circ\phi_{v_{i}}(\mathbb{x},n).\end{split}$

For convenience denote
$\mathbb{y}:=(y_{1},\dots,y_{i-1},y_{i},y_{i+1},\dots,y_{k})$,
$\mathbb{y}^{\prime}:=(y_{1},\dots,y_{i-1},y^{\prime}_{i},y_{i+1},\dots,$
$y_{k})$ and
$\tilde{\mathbb{y}}:=(y_{1},\dots,y_{i-1},y_{i},y^{\prime}_{i},y_{i+1},\dots,y_{k})$,
where $y_{i}\in\mathbb{F}_{p}^{d}$. Let
$\Omega^{\prime}_{i}\subseteq(\mathbb{F}_{p}^{d})^{k+1}$ denote the set of
$\tilde{\mathbb{y}}\in(\mathbb{F}_{p}^{d})^{k+1}$ such that
$\mathbb{y},\mathbb{y}^{\prime}\in\psi^{-1}(\Omega),$ and
$U^{\prime}_{i}\subseteq(\mathbb{F}_{p}^{d})^{k+1}$ denote the set of
$\tilde{\mathbb{y}}\in(\mathbb{F}_{p}^{d})^{k+1}$ such that
$\mathbb{y},\mathbb{y}^{\prime}\in U_{i}.$ Pick any $\tilde{\mathbb{y}}\in
U^{\prime}_{i}$. Assume that $\mathbb{y}=(\mathbb{x},n)$ and
$\mathbb{y}^{\prime}=(\mathbb{x}^{\prime},n^{\prime})$ for some
$\mathbb{x},\mathbb{x}^{\prime}\in J^{\prime}(v_{i})$,
$n\in\Omega_{v_{i}}(\mathbb{x})$ and
$n^{\prime}\in\Omega_{v_{i}}(\mathbb{x}^{\prime})$. Then
$\mathbb{x}=\mathbb{x}^{\prime}=\sum_{1\leq j\leq k,j\neq
i}(v_{j}-v_{i})\otimes y_{j}$. Since $\eta\circ
g(\phi_{v_{i}}(\mathbb{x},\cdot))\mod\mathbb{Z}$ is a constant on
$\Omega_{v_{i}}(\mathbb{x})$, we have that

$\eta\circ g\circ\phi_{v_{i}}(\mathbb{x},n)\equiv\eta\circ
g\circ\phi_{v_{i}}(\mathbb{x},n^{\prime})\mod\mathbb{Z}.$

So it follows from (E.2) that

(E.3) $F^{\prime}(\mathbb{y})\equiv
F^{\prime}(\mathbb{y}^{\prime})\mod\mathbb{Z}$

for all $\tilde{\mathbb{y}}\in U^{\prime}_{i}$. Since
$\Omega=\cap_{t=1}^{k}\cap_{j=1}^{r_{t}}V(F_{t,j})$ and $F_{t,j}$ is
independent of $n_{t+1},\dots,n_{k}$, we have that

$\psi(\Omega^{\prime}_{i})=(\cap_{t=1}^{i-1}\cap_{j=1}^{r_{t}}V(F_{t,j,i}))\cap(\cap_{t=i}^{k}\cap_{j=1}^{r_{t}}(V(F_{t,j,i})\cap
V(F^{\prime}_{t,j,i}))),$

where
$F_{t,j,i},F^{\prime}_{t,j,i}\colon(\mathbb{F}_{p}^{d})^{k+1}\to\mathbb{F}_{p}^{d}$
are the $d$-integral linear transformations given by

$F_{t,j,i}(\tilde{\mathbb{y}}):=F_{t,j}(\mathbb{y})$ and
$F^{\prime}_{t,j,i}(\tilde{\mathbb{y}}):=F_{t,j}(\mathbb{y}^{\prime}).$

By Proposition C.8 (iv) and (v), $\Omega_{i}^{\prime}$ is a consistent $M$-set
of total co-dimension at most $2r$. On the other hand, since $F_{t,j}$ are
nice, so are $F_{t,j,i},F^{\prime}_{t,j,i}$. So $\psi(\Omega_{i}^{\prime})$
and thus $\Omega_{i}^{\prime}$ is nice and consistent. Let
$\kappa\gg_{C,d}\delta^{O_{C,d}(1)}$ to be chosen later. By Theorem D.1, if
$d\geq\max\\{4r+1,4k+3\\}$ and
$p\gg_{C,d}\delta^{-O_{d,C}(1)}\gg_{C,d}\kappa^{-O_{C,d}(1)}$, then
$\Omega^{\prime}_{i}$ is strongly $(\kappa,p)$-irreducible up to degree $s$.

Since $\Omega_{v_{i}}(\mathbb{x})$ has an $M$-representation with dimension
vector $(r^{\prime}_{k})$ for all $\mathbb{x}\in U_{v_{i}}$, by Theorem C.3,

$|U^{\prime}_{i}|=\sum_{\mathbb{x}\in
J^{\prime}(v_{i})}|\Omega_{v_{i}}(\mathbb{x})|^{2}\gg_{C,d}\delta^{-O_{C,d}(1)}p^{2(d-r^{\prime}_{k})+D}$

and

$|\Omega^{\prime}_{i}|=\sum_{\mathbb{x}\in\Omega_{v_{i}}}|\Omega_{v_{i}}(\mathbb{x})|^{2}\gg_{C,d}\delta^{-O_{C,d}(1)}p^{2(d-r^{\prime}_{k})+D}.$

By Proposition 3.19, there exists
$g^{\prime}\in\text{poly}_{p}(\psi^{-1}(\Omega)\to G_{\mathbb{N}}|\Gamma)$
such that $g^{\prime}(n)\Gamma=g\circ\psi(n)\Gamma$ for all
$n\in\psi^{-1}(\Omega)$. So by Lemma 3.24, $F$ takes values in
$\mathbb{Z}/p^{s}+C$ for some $C\in\mathbb{R}$. Since $\Omega^{\prime}_{i}$ is
strongly $(\kappa,p)$-irreducible up to degree $s$, if
$\kappa\gg_{C,d}\delta^{O_{C,d}(1)}$ is chosen to be sufficiently small, then
it follows from (E.3) that $F^{\prime}(\mathbb{y})\equiv
F^{\prime}(\mathbb{y}^{\prime})\mod\mathbb{Z}$ for all
$\tilde{\mathbb{y}}\in\Omega^{\prime}_{i}$. By the definition of
$\Omega^{\prime}_{i}$ and $F^{\prime}$, we have that

(E.4) $F(y_{1},\dots,y_{i-1},y_{i},y_{i+1},\dots,y_{k})\equiv
F(y_{1},\dots,y_{i-1},y^{\prime}_{i},y_{i+1},\dots,y_{k})\mod\mathbb{Z}$

for all $1\leq i\leq k$ and
$(y_{1},\dots,y_{k}),(y_{1},\dots,y_{i-1},y^{\prime}_{i},y_{i+1},\dots,y_{k})\in\Omega$.

Step 3: showing that $F$ is a constant on $\Omega$. If
$\Omega=(\mathbb{F}_{p}^{d})^{k}$, then (E.4) immediately implies that
$F\mod\mathbb{Z}$ is a constant and we are done. However, in general this
conclusion is not straightforward. In order to show that $F\mod\mathbb{Z}$ is
a constant on $\Omega$, we need to change one coordinate at each time
carefully.

Fix any $(m_{1},\dots,m_{k}),(n_{1},\dots,n_{k})\in\Omega$ with
$\text{span}_{\mathbb{F}_{p}}\\{m_{1},\dots,m_{k}\\}\cap\text{span}_{\mathbb{F}_{p}}\\{n_{1},\dots,n_{k}\\}=\\{\mathbb{0}\\}$.

Claim. There exists $(z_{1},\dots,z_{k})\in\Omega$ such that

$(z_{1},\dots,z_{i},m_{i+1},\dots,m_{k}),(z_{1},\dots,z_{i},n_{i+1},\dots,n_{k})\in\Omega$
for all $0\leq i\leq k$.

Suppose we have chosen $z_{1},\dots,z_{i-1}$ for some $1\leq i\leq k$ such
that for all $0\leq i^{\prime}\leq i-1$, we have that
$z_{1},\dots,z_{i^{\prime}},m_{i^{\prime}+2},\dots,m_{k},n_{i^{\prime}+2},\dots,n_{k}$
are linearly independent and that

(E.5)
$(z_{1},\dots,z_{i^{\prime}},m_{i^{\prime}+1},\dots,m_{k}),(z_{1},\dots,z_{i^{\prime}},n_{i^{\prime}+1},\dots,n_{k})\in\Omega$

(there is nothing to prove when $i=1$). We show that there exists
$z_{i}\in\mathbb{F}_{p}^{d}$ such that
$z_{1},\dots,z_{i},m_{i+2},\dots,m_{k},n_{i+2},\dots,n_{k}$ are linearly
independent and that

$(z_{1},\dots,z_{i},m_{i+1},\dots,m_{k}),(z_{1},\dots,z_{i},n_{i+1},\dots,n_{k})\in\Omega.$

Let $W$ denote the span of
$z_{1},\dots,z_{i-1},m_{i+2},\dots,m_{k},n_{i+2},\dots,n_{k}$ and $W^{\prime}$
denote the set of $z_{i}\in\mathbb{F}_{p}^{d}$ such that

$F_{t,j}(z_{1},\dots,z_{i},m_{i+1},\dots,m_{k})=F_{t,j}(z_{1},\dots,z_{i},n_{i+1},\dots,n_{k})=0$

for all $1\leq t\leq k,1\leq j\leq r_{t}$. It suffices to show that
$|W^{\prime}|>|W|$.

By (E.1), the knowledge of linear algebra, and the construction of $F_{t,j}$,
it is not hard to see that $\mathcal{J}$ admits another nice and independent
(but not necessarily standard) $M$-representation $(F^{\prime}_{t,j}\colon
1\leq t\leq k,1\leq j\leq r_{t})$ such that $F^{\prime}_{t,j}=F_{t,j}$ for all
$1\leq t\leq i-1,1\leq j\leq r_{t}$, and that

(E.6)
$F^{\prime}_{t,j}(n_{1},\dots,n_{k})=(n_{t}A)\cdot(a^{\prime}_{t,j,1}n_{1}+\dots+a^{\prime}_{t,j,t}n_{t})+u^{\prime}_{t,j}$

for some $a^{\prime}_{t,j,t^{\prime}},u^{\prime}_{t,j}\in\mathbb{F}_{p}$ for
all $i\leq t\leq k,1\leq j\leq r_{t}$, such that the matrix
$\begin{bmatrix}a^{\prime}_{t,1,t}&\dots&a^{\prime}_{t,1,1}\\\
\dots&\dots&\dots\\\
a^{\prime}_{t,r_{t},t}&\dots&a^{\prime}_{t,r_{t},1}\end{bmatrix}$ is of rank
$r_{t}$ (but is not necessarily in the row echelon form) and that
$a^{\prime}_{t,j,i}=0$ for all $j\geq 2$. Then $W^{\prime}$ can be described
as the set of $z_{i}\in\mathbb{F}_{p}^{d}$ such that

(E.7)
$F^{\prime}_{t,j}(z_{1},\dots,z_{i},m_{i+1},\dots,m_{k})=F^{\prime}_{t,j}(z_{1},\dots,z_{i},n_{i+1},\dots,n_{k})=0$

for all $1\leq t\leq k,1\leq j\leq r_{t}$. We remark that $r_{t}\leq t$.

For convenience denote
$\mathbb{w}:=(z_{1},\dots,z_{i-1},m_{i+1},\dots,m_{k},n_{i+1},\dots,n_{k}).$
For $1\leq t\leq i-1,1\leq j\leq r_{t}$, since $F^{\prime}_{t,j}=F_{t,j}$ is
independent of $n_{t+1},\dots,n_{k}$, we have (E.7) for free because of (E.5).
For $i+1\leq t\leq k,1\leq j\leq r_{t}$, suppose that either
$j=1,a^{\prime}_{t,1,i}=0$ or $j\geq 2$ (in which case we still have
$a^{\prime}_{t,j,i}=0$). Then $F^{\prime}_{t,j}(x_{1},\dots,x_{k})$ is
independent of $x_{i}$. By (E.5), we have that

$F^{\prime}_{t,j}(z_{1},\dots,z_{i},y_{i+1},\dots,y_{k})=F^{\prime}_{t,j}(z_{1},\dots,z_{i-1},y_{i},\dots,y_{k})=0$

for $y=m$ or $n$. So we have (E.7) for free. For $i+1\leq t\leq k,j=1$ with
$a^{\prime}_{t,1,i}\neq 0$, by (E.6), we have that (E.7) holds if and only if

(E.8) $a^{\prime}_{t,1,i}(z_{i}A)\cdot
m_{t}+P_{t}(\mathbb{w})=a^{\prime}_{t,1,i}(z_{i}A)\cdot
n_{t}+P^{\prime}_{t}(\mathbb{w})=0$

for some functions $P_{t},P^{\prime}_{t}$. For $t=i,2\leq j\leq r_{t}$, since
$a^{\prime}_{i,j,i}=0$, by (E.6), we have that (E.7) holds if and only if

(E.9)
$(z_{i}A)\cdot(a^{\prime}_{i,j,1}z_{1}+\dots+a^{\prime}_{i,j,i-1}z_{i-1})+u^{\prime}_{i,j}=0.$

Finally, for $t=i,j=1$, by (E.6), we have that (E.7) holds if and only if

(E.10)
$Q(z_{i}):=(z_{i}A)\cdot(a^{\prime}_{i,1,1}z_{1}+\dots+a^{\prime}_{i,1,i}z_{i})+u^{\prime}_{i,1}=0.$

Since $z_{1},\dots,z_{i-1},m_{i+1},\dots,m_{k},n_{i+1},\dots,n_{k}$ are
linearly independent and the matrix

$\begin{bmatrix}a^{\prime}_{i,1,i}&\dots&a^{\prime}_{i,1,1}\\\
\dots&\dots&\dots\\\
a^{\prime}_{i,r_{i},i}&\dots&a^{\prime}_{i,r_{i},1}\end{bmatrix}$

is of rank $r_{i}$, it is not hard to see that the following vectors are
linearly independent:

$\\{a^{\prime}_{i,j,1}z_{1}+\dots+a^{\prime}_{i,j,i-1}z_{i-1}\colon 1\leq
j\leq r_{i}\\}\cup\\{m_{t},n_{t}\colon i+1\leq t\leq k\\}.$

Since $A$ is invertible, by (E.8), (E.9) and (E.10), if
$a^{\prime}_{i,1,i}=0$, then $W^{\prime}$ is an affine subspace of
$\mathbb{F}_{p}^{d}$ of co-dimension at most $r_{i}+2(k-i)$; if
$a^{\prime}_{i,1,i}\neq 0$, then $Q$ is a non-degenerate quadratic form and
$W^{\prime}$ is the intersection $V(M)$ and an affine subspace of
$\mathbb{F}_{p}^{d}$ of co-dimension at most $r_{i}+2(k-i)-1\leq 2k-i-1$.
Since $d-2(2k-i-1)\geq 3$, by Corollary 4.14 (ii), in both cases we have that
$|W^{\prime}|=p^{d-(r_{i}+2(k-i))}(1+O(p^{-1/2}))$. On the other hand,
$|W|\leq p^{2k-i-3}$. Since $d-(r_{i}+2(k-i))>2k-i-3$, there exists $z_{i}\in
W^{\prime}\backslash W$. By induction, we complete the proof of the claim.

Let $(z_{1},\dots,z_{k})$ be given by the claim. By (E.4),

$\begin{split}&\quad F(m_{1},\dots,m_{k})\equiv
F(z_{1},m_{2},\dots,m_{k})\equiv\dots\equiv F(z_{1},\dots,z_{k})\\\ &\equiv
F(z_{1},\dots,z_{k-1},n_{k})\equiv\dots\equiv
F(n_{1},\dots,n_{k})\mod\mathbb{Z}.\end{split}$

For general $(m_{1},\dots,m_{k}),(n_{1},\dots,n_{k})\in\Omega$, similar to the
proof of Proposition 4.8, the number of
$(z_{1},\dots,z_{k})\in(\mathbb{F}_{p}^{d})^{k}$ such that either
$\text{span}_{\mathbb{F}_{p}}\\{m_{1},\dots,m_{k}\\}\cap\text{span}_{\mathbb{F}_{p}}\\{z_{1},\dots,z_{k}\\}$
or
$\text{span}_{\mathbb{F}_{p}}\\{n_{1},\dots,n_{k}\\}\cap\text{span}_{\mathbb{F}_{p}}\\{z_{1},\dots,z_{k}\\}$
is nontrivial is at most $O_{k}(p^{d(k-1)+2k-1})$. On the other hand
$|\Omega|=p^{dk-r}(1+O_{k}(p^{-1/2}))$ by Theorem C.3. Since
$dk-r>d(k-1)+2k-1$, there exists $(z_{1},\dots,z_{k})\in\Omega$ such that
$\text{span}_{\mathbb{F}_{p}}\\{m_{1},\dots,m_{k}\\}\cap\text{span}_{\mathbb{F}_{p}}\\{z_{1},\dots,z_{k}\\}=\text{span}_{\mathbb{F}_{p}}\\{n_{1},\dots,n_{k}\\}\cap\text{span}_{\mathbb{F}_{p}}\\{z_{1},\dots,z_{k}\\}=\\{\mathbb{0}\\}$.
So by the previous case,

$F(m_{1},\dots,m_{k})\equiv F(z_{1},\dots,z_{k})\equiv
F(n_{1},\dots,n_{k})\mod\mathbb{Z}.$

Therefore $\eta\circ g\mod\mathbb{Z}$ is a constant on $\Omega$. So $\Omega$
admits a $(\delta,K\delta^{-K})$-Leibman dichotomy up to step $s$ and
complexity $C$ for some function $K$ depending only on $C,d$. This completes
the proof of Theorem E.1.

######  Remark E.2.

Motivated by Theorem E.1, it is natural to ask if any consistent $M$-set
admits a Leibman dichotomy. Unfortunately the approach used in Theorem E.1 can
not be applied directly to general consistent $M$-sets. This is because the
equation (E.4) is insufficient to conclude that $F\mod\mathbb{Z}$ is a
constant if $\Omega$ is not nice. For example, let $\Omega$ be the set of
$(m_{1},\dots,m_{d},n_{1},\dots,n_{d})\in(\mathbb{F}_{p}^{d})^{2}$ such that
$m_{1}=n_{1}$, and let
$F(m_{1},\dots,m_{d},n_{1},\dots,n_{d}):=\frac{1}{p}\tau(m_{1})$. Then (E.4)
holds since
$F(m_{1},\dots,m_{d},n_{1},\dots,n_{d})=F(m_{1},\dots,m_{d},n^{\prime}_{1},\dots,n^{\prime}_{d})$
for all
$(m_{1},\dots,m_{d},n_{1},\dots,n_{d}),(m_{1},\dots,m_{d},n^{\prime}_{1},\dots,n^{\prime}_{d})\in\mathbb{F}_{p}^{d}$.
However, $F\mod\mathbb{Z}$ is not a constant on $\Omega$.

One possible way to avoid this issue is the do a change of variable under a
linear transformation $L\colon(\mathbb{F}_{p}^{d})^{k}\to\mathbb{F}_{p}^{t}$
for some $t\in\mathbb{N}$ to eliminate all the polynomials of degree 1 in the
standard $M$-representation of $\Omega$ in the initial step. However, $L$ in
general is not $d$-integral, and thus $L(\Omega)$ is no longer an $M$-set.
Therefore, one needs to generalize the definition of $M$-sets (as well as all
the results relevant to $M$-sets) to a larger class of sets in order to
overcome this difficulty. Since Theorem E.1 is good enough for our purposes,
we do not pursuit this improvement.

## References

  * [1] P. Candela and O. Sisask.  Convergence results for systems of linear forms on cyclic groups, and periodic nilsequences.  SIAM J. Discrete Math., 28(2):786–810, 2014.
  * [2] H. Furstenberg.  Ergodic behavior of diagonal measures and a theorem of Szemerédi on arithmetic progressions.  J. Analyse Math., 31:204–256, 1977.
  * [3] S. R. Ghorpade.  A note on nullstellensatz over finite fields.  Contemporary Mathematics, 738, 2019.
  * [4] T. Gowers.  A new proof of Szemerédi theorem.  Geom. Funct. Anal., 11:465–588, 2001.
  * [5] B. Green and T. Tao.  The primes contain arbitrarily long arithmetic progressions.  Ann. of Math., 167:481–547, 2008.
  * [6] B. Green and T. Tao.  An arithmetic regularity lemma, an associated counting lemma, and applications, in “an irregular mind: Szemerédi is 70”.  Bolyai Society Math. Studies, 21, 2010.
  * [7] B. Green and T. Tao.  Linear equations in the primes.  Ann. of Math., 171:1753–1850, 2010.
  * [8] B. Green and T. Tao.  The quantitative behaviour of polynomial orbits on nilmanifolds.  Ann. of Math., 175(2):465–540, 2012.
  * [9] B. Green and T. Tao.  On the quantitative distribution of polynomial nilsequences - erratum.  Ann. of Math., 179(3):1175–1183, 2014.
  * [10] B. Green, T. Tao, and T. Ziegler.  An inverse theorem for the Gowers $\text{U}^{4}$-norm.  Glasg. Math. J., 53:1–50, 2011.
  * [11] B. Green, T. Tao, and T. Ziegler.  An inverse theorem for the Gowers $\text{U}^{s+1}$-norm.  Ann. of Math., 176(2):1231–1372, 2012.
  * [12] B. Host and B. Kra.  Nonconventional ergodic averages and nilmanifolds.  Ann. of Math., 161(1):397–488, 2005.
  * [13] A. Iosevich and M. Rudnev.  Erdös distance problem in vector spaces over finite fields.  Trans. Amer. Math. Soc., 359(12):6127–6142, 2007.
  * [14] B. Kra, N. Shah, and W. Sun.  Equidistribution of dilated curves on nilmanifolds.  Journal of the London Mathematical Society, 98(3):708–732, 2018.
  * [15] A. Leibman.  Pointwise convergence of ergodic averages for polynomial sequences of translations on a nilmanifolds.  Ergodic Theory Dynam. Systems, 25(1):201–213, 2005.
  * [16] W. Schmidt.  Equations over finite fields, an elementary approach (Lecture Notes in Mathematics), volume 536.  Springer-Verlag, Berlin. Heidelberg. New York, N.J., 1976.
  * [17] W. Sun.  Spherical higher order Fourier analysis over finite fields II: additive combinatorics for shifted ideals.  arXiv: 2312.06650.
  * [18] W. Sun.  Spherical higher order Fourier analysis over finite fields III: a spherical Gowers inverse theorem.  arXiv: 2312.06636.
  * [19] W. Sun.  Spherical higher order Fourier analysis over finite fields IV: an application to the geometric Ramsey conjecture.  arXiv: 2312.06649.
  * [20] W. Sun.  A structure theorem for multiplicative functions over the Gaussian integers and applications.  Journal d’Analyse Mathematique, 134(1):55–105, 2018.
  * [21] W. Sun.  Weak ergodic averages over dilated measures.  Ergodic Theory and Dynamical System, 41(2):606–621, 2021.
  * [22] W. Sun.  Sarnak’s conjecture for nilsequences on arbitrary number fields and applications.  Advances in Mathematics, 415:p.108883, 2023.