% Section 2b. Background for the proofs: quaternionic Shimura varieties and their Goren--Oort strata; unitary Shimura % varieties and their supersingular loci; Satake parameters and the Ramanujan conjecture; definite quaternion algebras % and Brandt modules. Statements of the literature, with sources; nothing here is new. \section{Background and cited results}\label{sec:background} This section collects the definitions and the results of the literature on which the proofs of \cref{part:main} rest. Nothing in it is new. We give precise statements, with their sources, so that the reader can check exactly what is used; the proofs that follow refer back to the numbered statements of this section. \subsection{Quaternion algebras over totally real fields}\label{ss:bg-quaternion} Let $F$ be a totally real field of degree $g$, with real places $\Sigma_\infty=\{\tau_1,\dots,\tau_g\}$. A quaternion algebra $B$ over $F$ is determined up to isomorphism by the finite set $\mathrm{Ram}(B)$ of places at which $B_v=B\otimes_FF_v$ is a division algebra; this set has even cardinality, and every such set occurs \cite{Vigneras1980}. We write $B_S$ for the algebra with $\mathrm{Ram}(B_S)=S$. The reduced norm $\mathrm{nrd}\colon B^\times\to F^\times$ is surjective onto the elements positive at the real places in $S$ (Hasse--Schilling--Maass). For an order $\OO\subset B$, the \emph{right ideal classes} of $\OO$ are the classes of locally principal right $\OO$-ideals under left multiplication by $B^\times$; their set is in bijection with the double coset space $B^\times\backslash\widehat B^\times/\widehat\OO^\times$, which is finite. When $B$ is \emph{totally definite}, ramified at all real places, this double coset space is the \emph{Shimura set} $\Sh(B)$ of level $\widehat\OO^\times$, a finite set, and the stabiliser of a point $z=B^\times x\widehat\OO^\times$ in $B^\times$ modulo $F^\times$ is the finite group $\Gamma_z=(B^\times\cap x\widehat\OO^\times x^{-1})/\OO_F^\times$, the unit group of the left order of the corresponding ideal modulo the units of $F$. \begin{proposition}[Eichler's mass formula; \cite{Vigneras1980}]\label{prop:bg-mass} Let $B$ be a totally definite quaternion algebra over $F$ with finite ramification set $S_f$, and $\OO$ a maximal order. Then \[ \sum_{z\in\Sh(B)}\frac1{[\OO_l(I_z)^\times:\OO_F^\times]}=2^{1-g}\,\abs{\zeta_F(-1)}\,h_F\prod_{\qq\in S_f}(\Nm\qq-1), \] where $h_F$ is the class number of $F$ and $\OO_l(I_z)$ is the left order of an ideal in the class $z$. \end{proposition} When $h_F=1$ the left side is the sum of the inverses of the orders of the groups $\Gamma_z$, and the formula gives a check of the completeness of an enumeration of the classes: \cref{prop:brandt}(ii) uses it in this form. \subsection{Quaternionic Shimura varieties}\label{ss:bg-shimura} Let $S$ be a set of places of $F$ of even cardinality, $S_\infty=S\cap\Sigma_\infty$, $S^c_\infty=\Sigma_\infty\smallsetminus S_\infty$ and $d=\#S^c_\infty$. Let $G_S=\Res_{F/\Q}B_S^\times$. Following Tian and Xiao \cite[\S2.1]{TianXiao2019} (and Deligne's construction of connected Shimura varieties), the Deligne homomorphism $h_S\colon\mathbb S\to G_{S,\R}$ is trivial on the factors at $S_\infty$, where $B_S\otimes_{F,\tau}\R$ is Hamilton's quaternions, and is the standard homomorphism $x+yi\mapsto\left(\begin{smallmatrix}x&y\\-y&x\end{smallmatrix}\right)$ at the factors at $S^c_\infty$, where $B_S\otimes_{F,\tau}\R=M_2(\R)$. The symmetric domain is $\mathfrak H^{\pm,d}$, and for an open compact subgroup $K\subset G_S(\Af)$, \[ \Sh_K(G_S)(\C)=G_S(\Q)\backslash\bigl(\mathfrak H^{\pm}\bigr)^{S^c_\infty}\times G_S(\Af)/K, \] a variety of dimension $d$, projective as soon as $B_S$ is a division algebra. Its set of geometric connected components maps, through the reduced norm, onto $F^\times_+\backslash\mathbb A_{F,f}^\times/\mathrm{nrd}(K)$, isomorphically when $d>0$ \cite[(2.1.1)]{TianXiao2019}. For $d=0$, $\Sh_K(G_S)$ is the finite Shimura set of \cref{ss:bg-quaternion}. \begin{proposition}[Integral models; \cite{TianXiao2016}, \cite{TianXiao2019}, \S2]\label{prop:bg-models} Let $p>2$ be a prime inert in $F$, with $\pp=p\OO_F\notin S$, and $K=K^pK_p$ with $K_p=\GL_2(\OO_{F_\pp})$ and $K^p$ sufficiently small. Then $\Sh_K(G_S)$ has a smooth model over the ring of integers of the unramified extension $\Q_{p^g}$ of $\Qp$ of degree $g$, proper when $B_S$ is a division algebra. It is constructed from the integral model of an auxiliary unitary Shimura variety $\Sh(\widetilde G_{\widetilde S})$, attached to $B_S\otimes_FE$ for a CM extension $E/F$ in which every place of $S$ is inert and $\pp$ splits if $d$ is even, which is a moduli space of abelian schemes of dimension $4g$ with an action of $M_2(\OO_E)$ and additional structure; the two Shimura varieties have isomorphic geometric connected components. \end{proposition} The geometric points of the special fibre correspond, through the auxiliary unitary Shimura variety, to abelian varieties $A$ over $\Fpbar$ with an action of $M_2(\OO_E)$, and the reduced de Rham cohomology of $A$ decomposes over the $p$-adic embeddings $\tilde\tau$ of $E$ into pieces $H^{\mathrm{dR}}_1(A)^\circ_{\tilde\tau}$ of rank two, with Hodge filtrations $\omega^\circ_{\tilde\tau}$ of rank one for $\tau\in S^c_\infty$ (and of rank zero or two for $\tau\in S_\infty$). The Verschiebung maps $\omega^\circ_{\tilde\tau}\to\omega^\circ_{\sigma^{-1}\tilde\tau}$, where $\sigma$ is the Frobenius, define \emph{partial Hasse invariants} $h_\tau$, sections of line bundles on the special fibre. \begin{proposition}[Goren--Oort stratification; \cite{TianXiao2016}, Thm.~1.1]\label{prop:bg-go} For $\tau\in S^c_\infty$ let $Y_\tau$ be the vanishing locus of $h_\tau$, a smooth divisor of the special fibre $X=\Sh_K(G_S)_{\Fpbar}$. For a subset $I\subset S^c_\infty$, the stratum $X_{I}=\bigcap_{\tau\in I}Y_\tau$ is smooth of codimension $\#I$, and it is isomorphic to an iterated $\PP^1$-bundle, of relative dimension $\#I$, over the special fibre of a quaternionic Shimura variety $\Sh_K(G_{S'})$ with $\#S'_\infty=\#S_\infty+2\#I$, for an explicit set $S'$ determined by $I$ and the cyclic order of the places. \end{proposition} When $d=g$ is even and $I$ has $d/2$ elements, the base of the bundle is a zero-dimensional Shimura variety $\Sh(B_{S\cup\Sigma_\infty})$; the cycles of the present paper are built from such strata. \subsection{Periodic semi-meanders}\label{ss:bg-meanders} The combinatorial indexing of the strata, and of the more general cycles constructed by Tian and Xiao, is by \emph{periodic semi-meanders} \cite[\S3.1]{TianXiao2019}. Arrange the $d$ places of $S^c_\infty$ in the cyclic order given by the Frobenius as nodes on a circle on a cylinder. A periodic semi-meander with $r$ arcs is a collection of $r$ pairwise non-crossing arcs above the circle joining pairs of nodes, the remaining $d-2r$ nodes being joined to the top of the cylinder by pairwise non-crossing half-lines, which do not cross the arcs. Two such pictures are identified if they are isotopic. The number of periodic semi-meanders with $r$ arcs is $\binom dr$ for $r\le d/2$ \cite[\S1.4]{TianXiao2019}. For a semi-meander $a$, the \emph{span} of an arc is the number of nodes it passes, the \emph{total span} $\ell(a)$ is the sum of the spans, and $S_a$ is the set obtained by adding to $S$ the end-nodes of the arcs. \begin{proposition}[Goren--Oort cycles; \cite{TianXiao2019}, \S3.7, Thm.~4.4(1)]\label{prop:bg-cycles} For each periodic semi-meander $a$ with $r$ arcs there is a closed subvariety $X_a\subset X$ of codimension $r$, stable under the prime-to-$p$ Hecke action, with a proper smooth morphism $\pi_a\colon X_a\to\Sh_K(G_{S_a})_{\Fpbar}$ whose fibres are $r$-times iterated $\PP^1$-bundles. For $r=1$ these are the divisors $Y_\tau$. \end{proposition} The \emph{Gram product} of two semi-meanders with the same number of arcs is defined from the diagram $D(a,b)$ obtained by reflecting $b$ and gluing it to $a$ along the nodes: if two half-lines of $a$ or of $b$ are joined in $D(a,b)$ it is zero, and otherwise it is $(-2)^{m_0(a,b)}v^{m_v(a,b)}$ for $r