\section{Proofs of the technical results of Section~\ref{sec:exhaustion}}\label{app:sec5} \subsection{Separation and selectors} \begin{proof}[Proof of Lemma~\ref{lem:separation}] Pairs with $|x-y|\ge1$ satisfy \eqref{eq:crosssep} with $c_s=1$. For $K\ge0$ consider the pairs with $\ell\ne\ell'$, $2^K\le1+|x|<2^{K+1}$ and $|x-y|<1$, and write $x=t_\ell u$, $y=t_{\ell'}v$ with $u\in C_i$, $v\in C_{i'}$. Then $|u|,|v|\le2^{K+3}$, so $i,i'\le K+3$, and by Proposition~\ref{prop:block}(iv) the number of possible quadruples $(\ell,u,\ell',v)$ is at most $C K^216^K$. For each of them we bound the probability that $|t_\ell u-t_{\ell'}v|<\delta$. If $i\ne i'$, condition on all scales except $s_i$; the map $s_i\mapsto t_\ell u$ has derivative of modulus at least $|u|/4\ge\frac18$ on $[1,2]$, so the probability is at most $16\delta$. If $i=i'$, then $\ell'=\ell^*$ and $t_\ell u-t_{\ell'}v=\pm(s_iu'-v'/s_i)$ with $\{u',v'\}=\{u,v\}$; if $u'$ and $v'$ have opposite signs this has modulus at least $|u'|\ge\frac12$, and otherwise its derivative in $s_i$ has modulus at least $|u'|\ge\frac12$, so the probability is at most $4\delta$ for $\delta<\frac14$. With $\delta_K=2^{-6K}$ the probability that some pair in the $K$-th window violates $|x-y|\ge\delta_K$ is at most $CK^216^K2^{-6K}$, which is summable. By the Borel--Cantelli lemma, almost surely only finitely many windows contain a violation; in the remaining finitely many windows there are finitely many pairs, and each exact coincidence $t_\ell u=t_{\ell'}v$ has probability zero by the same derivative bounds. Since $2^{-6K}\ge(1+|x|)^{-6}$ in the $K$-th window, \eqref{eq:crosssep} follows. \end{proof} \begin{proof}[Proof of Lemma~\ref{lem:selectors}] Let $X=\bigcup_{\ell\in E}\Gamma_\ell$ and $Y=\Lambda\setminus X$. Let $(\psi_K)_{K\ge0}$ be a smooth partition of unity with $\psi_K$ supported in $\{2^{K-1}\le1+|x|\le2^{K+1}\}$ ($K\ge1$) and $|\psi_K^{(j)}|\le C_j2^{-jK}$. By \eqref{eq:crosssep}, points of $X$ and of $Y$ in $\{1+|x|\le2^{K+2}\}$ are at distance at least $c_s2^{-6(K+3)}=8r_K$, where $r_K=c_s2^{-6(K+3)}/8$. Let $\phi$ be a nonnegative mollifier supported in $[-1,1]$ with $\int\phi=1$, $\phi_r=r^{-1}\phi(\cdot/r)$, and let $f_K$ be the convolution of $\phi_{r_K}$ with the indicator function of the $2r_K$-neighbourhood of $X$. Then, in $\{1+|x|\le2^{K+1}\}$, $f_K=1$ near $X$ and $f_K=0$ near $Y$, and $|f_K^{(j)}|\le\norm{\phi_{r_K}^{(j)}}_{L^1}\le C_jr_K^{-j}$; this bound does not depend on the number of points. Put $\chi_E=\sum_K\psi_Kf_K$. Near a point of $X$ every term with $\psi_K\ne0$ has $f_K=1$, so $\chi_E=1$; similarly $\chi_E=0$ near $Y$. The Leibniz rule gives the derivative bounds. For \eqref{eq:selector}, by duality it suffices to show $\norm{\chi_E\varphi}_p\le C_{p,s}\norm\varphi_{6p}$. For $a+b\le2p$, $\norm{x^a\partial^b(\chi_E\varphi)}_{L^2}\le C\sum_{j\le b} \norm{(1+|x|)^{a+6j}\partial^{b-j}\varphi}_{L^2}$, and $a+6j+(b-j)\le a+b+5b\le12p$; by the norm equivalence of Section~\ref{sec:prelim} this is at most $C\norm\varphi_{6p}$. \end{proof} \subsection{Sublevel sets and nonresonance} \begin{lemma}\label{lem:sublevel} Let $q\ge1$ and let $f$ be a complex polynomial in $(\sigma_1,\dots,\sigma_q)$ of degree at most $2$ in each variable, one of whose coefficients has modulus at least $\delta>0$. Then, for $u>0$, \[ \bigl|\{\sigma\in[1,2]^q:\ |f(\sigma)|\le u\}\bigr|\le C_q\min\{1,(u/\delta)^{1/(2q)}\}, \] with $C_q$ depending only on $q$. \end{lemma} \begin{proof} Replacing $f$ by its real or imaginary part and $\delta$ by $\delta/\sqrt2$, we may assume $f$ real. Let $q=1$, and let $S$ be the sublevel set, of measure $\lambda>0$. Using the distribution function of $S$ one finds $\sigma_0<\sigma_1<\sigma_2$ in $S$ with $\sigma_{j+1}-\sigma_j\ge\lambda/4$. By Lagrange interpolation at these points, every coefficient of $f$ is at most $192u/\lambda^2$ in modulus, so $\lambda\le(192u/\delta)^{1/2}$. For $q\ge2$ write $f=\sum_{e=0}^2f_e(\sigma')\sigma_q^e$ with $\sigma'=(\sigma_1,\dots,\sigma_{q-1})$; some $f_{e_0}$ has a coefficient of modulus at least $\delta$. For $0<\tau\le\delta$, the set where $|f_{e_0}(\sigma')|\le\tau$ has measure at most $C_{q-1}(\tau/\delta)^{1/(2q-2)}$ by induction, and for the other $\sigma'$ the section of the sublevel set has measure at most $(192u/\tau)^{1/2}$. If $u<\delta$, the choice $\tau=\delta(u/\delta)^{(q-1)/q}$ and Fubini's theorem give the bound with $C_q=C_{q-1}+\sqrt{192}$; if $u\ge\delta$ there is nothing to prove. (Much sharper multidimensional sublevel estimates are known, see \cite{CCW99}; this crude bound suffices here.) \end{proof} \begin{proof}[Proof of Lemma~\ref{lem:nonres}] Write $z=t_\ell(n+\theta)$ with $\ell=(i,\sigma)$, and $y=t_{\ell'}u$ with $u\in C_{i'}$. Multiplying $y+\omega_k-z$ by $\prod_{j\le M}s_j$, and by $s_{i'}$ if $i'>M$, gives a polynomial $f$ in at most $M+1$ of the scales, of degree at most $2$ in each. We claim that, if $(y,k)$ is not expected, some coefficient of $f$ has modulus at least $\min\{d_M,1\}$. The term $-t_\ell(n+\theta)$ and the term $k_{i,\sigma}t_\ell$ of $\omega_k$ produce the same monomial, and no other term does: the terms of $\omega_k$ attached to other coordinates, and the term $y$ if $\ell'\ne\ell$, have a different degree in $s_i$ or in $s_{i'}$. Hence if $\ell'\ne\ell$ this coefficient is $k_{i,\sigma}-n-\theta$, of modulus at least the distance from $\theta$ to $\Z$, which is at least $d_M$. If $\ell'=\ell$ and some coordinate of $k$ other than $k_{i,\sigma}$ is nonzero, that integer is the coefficient of its own monomial. Otherwise $y+\omega_k-z=t_\ell(n'+k_{i,\sigma}-n+\theta'-\theta)$ with $u=n'+\theta'$; this is a nonzero integer multiple of $t_\ell$ if $\theta'=\theta$ (the pair being unexpected), and has coefficient of modulus at least $d_M$ if $\theta'\ne\theta$. This proves the claim. Since $\prod s_j\le2^{M+1}$, Lemma~\ref{lem:sublevel} gives, for each unexpected tuple, $\mathbb P(|y+\omega_k-z|<\varepsilon)\le C_{M+1} (2^{M+1}\varepsilon/\min\{d_M,1\})^{1/(2M+2)}$. Fix a dyadic $L$. Only base atoms $u$ with $|t_{\ell'}u|\le|z|+|\omega_k|+1$ can give $|y+\omega_k-z|<1$; there are $O_M((1+L)^2\log(2+L))$ of them, uniformly over all continuations with $R_i\ge2^i$, and there are $O_M((1+L)^{2M})$ vectors $k$ and $O_M(1)$ targets. With $\varepsilon=c_M(1+L)^{-\beta_M}$ we have $\varepsilon^{1/(2M+2)}=c_M^{1/(2M+2)}(1+L)^{-(2M+6)}$, so the probability of a violation at level $L$ is $O_M(c_M^{1/(2M+2)}(1+L)^{-4}\log(2+L))$. Summing over dyadic $L$ and choosing $c_M$ small enough gives the claim. \end{proof} For $L\ge1$ put $\varrho_M(L)=\min\{1,c_M(3+2L)^{-\beta_M}\}/10$. On $\mathsf A_M$, every unexpected distance with $\norm k_\infty\le L$ is at least $10\varrho_M(L)$, since a dyadic $L'$ with $L\le L'<2L+1$ may be used in \eqref{eq:nonres}. The event $\mathsf A_M$ depends on the whole set $\Lambda$, but its probability bound and $c_M$ do not depend on the radii chosen later. \subsection{Translation and phase errors} \begin{lemma}\label{lem:translation} Let $m,\Delta,N\ge1$ and $M'\ge1$. For $\nu\le N$ let $\varpi_\nu\in[\frac12,2]$ and let $v_{\nu,0},\dots,v_{\nu,\Delta}\in H_{-m}$ satisfy $\tau_{\varpi_\nu}v_{\nu,r}=-v_{\nu,r}$; put $\mathcal A=\max_{\nu,r}\norm{v_{\nu,r}}_{-m}$ and $V=\sum_\nu\sum_{r\le\Delta}x^rv_{\nu,r}$. Let $\varphi\in C_c^\infty$ with $\supp\varphi\subset[-M',M']$. For $h\ge1$ let $h_\nu\in[0,2\varpi_\nu)$ with $h-h_\nu\in2\varpi_\nu\Z$. Then \[ \Bigl|h^{-\Delta}V\bigl(\varphi(\cdot-h)\bigr)-\sum_\nu v_{\nu,\Delta}\bigl(\varphi(\cdot-h_\nu)\bigr)\Bigr| \le Ch^{-1}\mathcal A\norm\varphi_{C^{2m}}, \] and, for $v\in H_{-m}$ and $|a|,|a'|\le4$, $|v(\varphi(\cdot-a))-v(\varphi(\cdot-a'))|\le C|a-a'|\,\norm v_{-m}\norm\varphi_{C^{2m+1}}$, where $C$ depends only on $m,\Delta,N,M'$. \end{lemma} \begin{proof} We have $v(x^r\varphi(x-h))=(\tau_hv)((x+h)^r\varphi)=\sum_{i\le r}\binom ri h^{r-i}(\tau_hv)(x^i\varphi)$, and $\tau_hv_{\nu,r}=\tau_{h_\nu}v_{\nu,r}$ because $v_{\nu,r}$ is $2\varpi_\nu$-periodic. Multiplying by $h^{-\Delta}$, the terms with $r=\Delta$, $i=0$ give $\sum_\nu v_{\nu,\Delta}(\varphi(\cdot-h_\nu))$, and all other terms carry a factor $h^{r-i-\Delta}\le h^{-1}$. Each of them is bounded by $\binom ri\norm{v_{\nu,r}}_{-m}\norm{(x-h_\nu)^i\varphi(x-h_\nu)}_m\le C\mathcal A\norm\varphi_{C^{2m}}$, since the norm $\norm\cdot_m$ of a function supported in a fixed compact set is bounded by its $C^{2m}$ norm. The second estimate follows from $\norm{\varphi(\cdot-a)-\varphi(\cdot-a')}_m\le |a-a'|\sup_{|t|\le4}\norm{\varphi'(\cdot-t)}_m$. \end{proof} \subsection{Proof of Proposition~\ref{prop:parameters}} \begin{table}[!ht] \centering\small \begin{tabular}{lll} \hline Parameter & depends on & used in\\ \hline $R_{M+1}$ & all parameters of stage $M$ & (P4)\\ $c_s,\ C_{j,s},\ C_{p,s}$ & $s$ (fixed at the end) & Lemmas \ref{lem:separation}, \ref{lem:selectors}\\ $d_M,\ c_M,\ \beta_M$ & $R_1,\dots,R_M$ & Lemma \ref{lem:nonres}\\ $L_M,\ d_M^A$ & $c_M,\ \beta_M,\ g_1,\dots,g_M$ & (P1), Step 1\\ $\gamma_M,\ d_M^J$ & $R_1,\dots,R_M$ & (P2), Step 3\\ $\kappa_{M,j},\ J_M$ & $k_1,\dots,k_M$ & (P3), Step 2\\ $m_p,\ N_p$ & $p$ & Lemmas \ref{lem:lift}, \ref{lem:translation}\\ $\underline h_M,\ \eta_M$ & partition, $k_M$ & (P3), Step 2\\ $\overline h_M$ & $\underline h_M,\ \eta_M,\ R_1,\dots,R_M$ & (P3)\\ \hline \end{tabular} \caption{The parameters of the construction.}\label{tab:parameters} \end{table} The choices are made recursively in $M$; the choices at stage $M$ depend only on $R_1,\dots,R_M$, never on an element of $\M_\Lambda$ or on radii chosen later. \emph{Separation of the periodic sets.} For every pair of labels the sets $\widetilde K_\ell$ and $\widetilde K_{\ell'}$ are disjoint for almost every $s$: a coincidence $x/t_\ell=x'/t_{\ell'}$ with $x\in K_i+\Z$, $x'\in K_{i'}+\Z$ (both nonzero) is a nontrivial equation in one scale, and there are countably many of them. Let $\mathcal D_M(s)$ be the minimal distance between the sets $\widetilde K_\ell\cap[-M-3,M+3]$, $\ell$ of index $\le M$; it is a Borel function of $(s_1,\dots,s_M)$ and is almost surely positive. Choose $\gamma_M\in(0,1/M]$ with $\mathbb P(\mathcal D_M<\gamma_M)\le2^{-M-4}$, let $\mathsf B_M=\{\mathcal D_M\ge\gamma_M\}$, and put $d_M^J=\gamma_M/10$. \emph{Partition and translation budgets.} Choose a smooth partition of unity $(\kappa_{M,j})_{j\le J_M}$ of $[-M,M]$ by functions whose supports have diameter less than $\min\{1/M,\min_{i\le M}1/(100k_i)\}$. Then choose $\underline h_M\ge M+1$ and $\eta_M\in(0,1/(1000k_M)]$ so that, by Lemma~\ref{lem:translation} with $m=m_p$, $N=2M$ and $M'=M$, the left-hand side of \eqref{eq:translation} is at most $2^{-M}\mathcal A/(1+J_M)$ whenever $h\ge\underline h_M$ and $h-a_\ell\in2\varpi_\ell\Z+[-\eta_M,\eta_M]$, for every $p\le M$; this is possible because $\norm{\kappa_{M,j}\psi}_{C^{2m_p+1}}\le C_M\norm\psi_{C^{N_p}}$. \emph{Kronecker nets.} For almost every $s$ the $2M$ numbers $t_\ell/2$, $\ell$ of index $\le M$, are linearly independent over $\mathbb Q$, since an integer relation becomes a nontrivial polynomial equation after clearing denominators. Then, by Kronecker's theorem, the image of the half-line $[\underline h_M,\infty)$ under $h\mapsto(h\bmod2\varpi_\ell)_\ell$ is dense in the torus $\prod_\ell\R/2\varpi_\ell\Z$. Let $\mathcal H_M(s,\overline h)$ be the covering radius of the image of $[\underline h_M,\overline h]$; it is a Borel function, nonincreasing in $\overline h$, and tends to $0$ almost surely. Choose $\overline h_M$ with $\mathbb P(\mathcal H_M(\cdot,\overline h_M)>\eta_M/4)\le2^{-M-4}$, and let $\mathsf C_M$ be the complementary event. \emph{Nonresonance and the Fourier tail.} Let $c_M$, $\beta_M$ and $\mathsf A_M$ be as in Lemma~\ref{lem:nonres}. Choose $L_M\ge M$ so large that \eqref{eq:fouriertail} holds for every $p\le M$ and every bump $f$ of radius $\varrho_M(L_M)$ centred at a target, and put $d_M^A=\varrho_M(L_M)$. This is possible because the $H_p$ norm of such a bump grows at most like a fixed power of $L_M$, while the coefficients $A_M(k)$ decay faster than any power. \emph{The next radius.} Choose an integer $R_{M+1}\ge\max\{2^{M+1},2R_M,6(\overline h_M+M+2)\}$ so large that \eqref{eq:budgetA}--\eqref{eq:budgetJ} hold for every $p\le M$. The families of test functions in \eqref{eq:budgetA} and \eqref{eq:budgetJ} are bounded in $\Sc$ uniformly for $(s_1,\dots,s_M)\in[1,2]^M$; in \eqref{eq:budgetB}, integration by parts with the fixed number $N_p$ of derivatives gives uniform polynomial decay of the Fourier transforms, with enough margin for the $H_{6p}$ norm. Since all parameters of stage $M$ are already fixed, each left-hand side tends to zero uniformly as $R\to\infty$. Constants depending on $M$ are paid for by a larger radius, never by more regularity of a fixed test function. We start with $R_1=2$. \emph{The good set.} Let $\Omega_0$ be the event of full measure on which \eqref{eq:crosssep} holds and all the sets $\widetilde K_\ell$ are pairwise disjoint, and put $\Omega=\Omega_0\cap\bigcap_{M\ge1}(\mathsf A_M\cap\mathsf B_M\cap\mathsf C_M)$. Then $\mathbb P(\Omega)\ge1-3\sum_M2^{-M-4}=13/16$. The bound for $\mathsf A_M$ applies to the finally chosen sequence of radii because it holds for every continuation. On $\mathsf A_M$ the first part of (P1) holds with $d_M^A=\varrho_M(L_M)$; (P2) holds on $\mathsf B_M$; and (P3) holds on $\mathsf C_M$, since a covering radius at most $\eta_M/4$ provides the required $h$. The constants $c_s$, $C_{j,s}$ and $C_{p,s}$ of Lemmas~\ref{lem:separation} and~\ref{lem:selectors} depend on $s$; they enter only as fixed multiplicative factors in estimates that tend to zero as $M\to\infty$, and the deterministic choices above do not depend on them. \qed