In the Green-Tao method appear quite often expressions such as $\mathbb{E}\prod_{i}1_{d_i\mid\psi_i(n)}$ for some system of affine linear forms $\psi_i:\mathbb{Z}^d\rightarrow\mathbb{Z}$ where the $d_i$ are some positive integers. The most basic example would be $\mathbb{E}_{n\leq N}1_{d\mid n}=\frac{1}{N}\lfloor \frac{N}{d}\rfloor=\frac{1}{d}+O(1/N)=\mathbb{E}_{n\in\mathbb{Z}/d\mathbb{Z}}1_{n=0}+O(1/N)$ where the last equality is here only to insist heavily on the form a general statement will have to take. A bit more generally, one easily sees that if $f:\mathbb{Z}\rightarrow \mathbb{Z}$ is d-periodic, then its average until $N$ is basically its average until $d+O(d/N)$. Following the ideas from Green-Tao, in fact we can show that for our general problem, the asymptotic should be analogously $\mathbb{E}_{n\in (\mathbb{Z}/m\mathbb{Z})^d}1_{\forall i,d_i\mid\psi_i(n)}$ where $m$ is the gcd of the d’s.

Thus, applying this method, one has frequently to deal with such « local densities », the intersection of the zero sets of affine forms. More generally again, one may have to deal with things like $\alpha_P(p^2):=\mathbb{P}_{n\in(\mathbb{Z}/p^2\mathbb{Z})^d}(P(n)=0)$ for some polynomial $P\in\mathbb{Z}[X_1,\dots,X_d]$. Say $P=\prod_{i=1}^t\phi_i$ where the $\phi_i$ are affine linear forms, so that $P$ is of degree $t$. Suppose also that no two of them are affinely dependant, even when reduced modulo $p$. Then to compute $\alpha_P(p^2)$, notice that in order for $n$ to satisfy $P(n)\equiv 0[p^2]$, either two of the forms must be divisible by $p$ in n, or one must be divisible by $p^2$ there.

To analyse the first possibility, reduce the forms modulo p, so they are as seen affine forms on the field $\mathbb{F}_p$. They are non-zero form, so the image of each linear part is of dimension $1$ and the kernels of dimension $d-1$; so the zero locus of each of our affine forms is a hyperplane, and the hypothesis of no affine dependance ensures that the intersection of any two of these hyperplanes is of dimension $d-2$. So there are only $p^{d-2}$ common zero for each pair of forms. But each point of $\mathbb{F}_p^d$ gives rise to $p^d$ antecedents in $(\mathbb{Z}/p^2\mathbb{Z})^d$ under the map of reduction modulo p. Finally, this possibility provides a summand of at most $\binom{t}{2}p^{-2}$ to $\alpha_P(p^2)$.

To compute now $\mathbb{P}_{n\in (\mathbb{Z}/p^2\mathbb{Z})^d}(\phi_i(n)=0)$, notice that any such 0 must arise from a 0 mod p. Now there are $p^{d-1}$ 0 mod p, because the set of zeros is a hyperplane. Then we can use a form of Hensel’s lemma in several variables. To obtain such a statement, we rely on the following simple identy for any $Q\in\mathbb{Z}[X_1,\dots,X_d]$:

$Q(x+p\overrightarrow{k})\equiv Q(x)+p\,\overrightarrow{\mathrm{grad}}(Q)\cdot \overrightarrow{k}\text{ mod }p^2$

which shows that if $Q(x)=0\text{ mod }p$, so $Q(x)=mp\text{ mod }p^2 and$latex \text{grad}(Q)\neq 0\text{ mod }p\$ then the vector $\overrightarrow{k}$ is constrained to live in a hyperplane if $Q(x+p\overrightarrow{k})$ is to vanish. So there are only $p{d-1}$ elements $y\in\mathbb{Z}/p^2\mathbb{Z}$ with $x\equiv y [p]$ and $Q(y) \equiv 0[p^2]$. Of course if $Q$ is affine then the gradient is simply the linear part. Thus the number of roots modulo $p^2$ is $p^{2d-2}$. By the union bound, we see that:

$\mathbb{P}_{n\in (\mathbb{Z}/p^2\mathbb{Z})^d}(\exists i:\phi_i(n)=0)\leq tp^{-2}$. In the end, $\alpha_P(p^2)\ll_t p^{-2}$.