\documentclass[11pt,reqno]{amsart} \usepackage{jaswal} \newcommand{\Q}{\mathbb{Q}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\C}{\mathbb{C}} \newcommand{\F}{\mathbb{F}} \newcommand{\Af}{\mathbb{A}_f} \newcommand{\Zhat}{\widehat{\mathbb{Z}}} \newcommand{\Qbar}{\overline{\mathbb{Q}}} \newcommand{\Gm}{\mathbb{G}_{\mathrm{m}}} \newcommand{\PP}{\mathbb{P}} \newcommand{\Lb}{\mathcal{L}} \newcommand{\ad}{\mathrm{ad}} \newcommand{\der}{\mathrm{der}} \newcommand{\ab}{\mathrm{ab}} \newcommand{\BB}{\mathrm{BB}} \newcommand{\QRH}{\mathrm{QRH}} \DeclareMathOperator{\Sh}{Sh} \DeclareMathOperator{\Gal}{Gal} \theoremstyle{definition} \newtheorem{algorithm}[theorem]{Algorithm} \crefname{algorithm}{Algorithm}{Algorithms} \AddToHook{env/algorithm/begin}{\crefalias{theorem}{algorithm}} \theoremstyle{plain} \DeclareMathOperator{\Irr}{Irr} \DeclareMathOperator{\MT}{MT} \DeclareMathOperator{\disc}{disc} \DeclareMathOperator{\Lie}{Lie} \DeclareMathOperator{\Ad}{Ad} \DeclareMathOperator{\Sel}{Sel} \begin{document} \title[Effective André--Oort for Shimura varieties]{An effective André--Oort theorem for Shimura varieties} \author{Manvir Jaswal} \address{Toronto, Canada} \email{manvirjaswal@icloud.com} \urladdr{https://manvirjaswal.github.io} \date{November 11, 2026} \subjclass[2020]{Primary 11G18; Secondary 14G35, 11R42, 11F46} \keywords{André--Oort conjecture, Shimura varieties, special subvarieties, Hecke correspondences, zero-free regions} \hypersetup{pdftitle={An effective André–Oort theorem for Shimura varieties},pdfauthor={Manvir Jaswal},pdfkeywords={André–Oort conjecture, Shimura varieties, special subvarieties, Hecke correspondences, zero-free regions}} \begin{abstract} We give effective bounds for the special subvarieties $V$ that are maximal in a subvariety $Z$ of a Shimura variety, in terms of the degree of $Z$: for the degree of $V$, with no hypothesis; and for the discriminant of a number field $L_V$ attached to $V$ and the Klingler--Yafaev invariant $\alpha_V$ of the level, if for some $\delta>0$ the Dedekind zeta function of $L_V$ has no zero with real part greater than $1-\delta$. Here $Z$ is geometrically irreducible and defined over a number field, the level is neat and of product form, and the bounds are explicit in the degree of $Z$ and, for $L_V$ and $\alpha_V$, also in the degree of the field and $\delta$, with constants that are effectively computable from the Shimura datum, the level and representatives of the connected components of the adjoint Shimura variety. A preprint of Cureton and Thorner, whose proof has been formalized in Lean, establishes such a half-plane with $\delta=1/32$ for every number field; granting it, all these bounds hold with no further hypothesis. For abelian type, an algorithm lists these subvarieties from the bounds, given a finite étale cover by a Shimura variety of Hodge type inside one of Mumford's moduli spaces and equations for the preimage of $Z$. \end{abstract} \maketitle \contents \section{Introduction}\label{sec:intro} Let $S$ be a Shimura variety and $Z\subset S$ a closed subvariety. A special subvariety $V\subset Z$ is \emph{maximal in $Z$} if no special subvariety $V'$ with $V\subsetneq V'\subset Z$ exists. The André--Oort conjecture says that $Z$ contains only finitely many maximal special subvarieties. By the o-minimal strategy of Pila and Zannier \cite{PilaZannier}, Tsimerman proved it for $\mathcal{A}_g$ \cite{Tsimerman}, and Pila, Shankar and Tsimerman for every Shimura variety, by bounding the heights of special points \cite[Thm.~1.2]{PST}, to which Binyamini, Schmidt and Yafaev had reduced it \cite[Thms.~1 and~2]{BSY}. Earlier, Klingler and Yafaev \cite{KY} and Ullmo and Yafaev \cite{UY} proved it under the generalized Riemann hypothesis (GRH) for CM fields, along a route through Hecke correspondences and Galois orbits that goes back to Edixhoven \cite{Edixhoven}, Edixhoven and Yafaev \cite{EY} and Yafaev \cite{Yafaev}. Neither proof bounds the maximal special subvarieties of $Z$ effectively in terms of $Z$. Given the theorem, Scanlon's automatic uniformity shows that their number and their degrees are bounded in terms of the degree of $Z$ \cite[Thms.~2.4 and~4.2]{Scanlon}, without a way to compute the bounds. In the o-minimal proofs the counting theorem of Pila and Wilkie \cite{PilaWilkie} for sets definable in $\R_{\mathrm{an},\exp}$ is not effective in general \cite[\S1.4]{BinyaminiCrelle}, and the lower bounds for Galois orbits of special points rest on the Brauer--Siegel theorem \cite[Prop.~6]{BSY}, \cite[Cor.~3.2]{Tsimerman}, whose constants are ineffective unless Siegel zeros are excluded \cite[p.~2]{Fowler26}. In the proof under GRH the hypothesis is used to find small primes that split completely in the splitting field of a torus; the last step is carried out for sets of special subvarieties up to modification \cite[Prop.~10.2.3]{KY}, and the other half of the proof is equidistribution, through Ratner's theorem \cite{ClozelUllmo}, \cite[Thm.~3.8]{UY}, so it gives no bound. We give such bounds along the route through Hecke correspondences: for the degrees with no hypothesis, and for the discriminants and level invariants that Klingler and Yafaev attach to a special subvariety, with GRH replaced by a zero-free half-plane for one Dedekind zeta function. \subsection{Results}\label{sec:results} Let $(G,X)$ be a Shimura datum and $K=\prod_pK_p\subset G(\Af)$ a neat compact open subgroup, and fix a faithful representation $\rho\colon G\to\mathrm{GL}_{n_\rho}$ with $\rho(K)\subset\mathrm{GL}_{n_\rho}(\Zhat)$. Degrees on $\Sh_K(G,X)$ are taken for the Baily--Borel bundle $\Lb_K$, the extension of the bundle of top-degree holomorphic forms to the Baily--Borel compactification (\cref{sec:setting}). A special subvariety $V$ has a generic Mumford--Tate group $H_V$; let $T_V$ be the connected centre of its image in the adjoint group $G^\ad$, let $L_V$ be the splitting field of $T_V$ and $d_{L_V}$ its absolute discriminant, and let $\alpha_V\ge1$ be the invariant of Klingler and Yafaev that measures how far the level is from maximal on $T_V$ (\cref{def:alpha}); in \cref{thm:main,thm:Ag} it is taken on the adjoint Shimura variety, with the constant $B$ of \cref{tab:constants} for $(\rho^\ad,\Lambda)$ of \cref{lem:Kad}(ii), also when $G$ is adjoint (\cref{thm:NA}). For $\delta\in(0,1/2]$ and a number field $L$ we write \[ \QRH(\delta;L)\colon\quad \zeta_L(s)\ne0\quad\text{for }\operatorname{Re}s>1-\delta . \] \begin{theorem}\label{thm:main} Let $(G,X)$, $K$ and $\rho$ be as above, and let $\delta\in(0,1/2]$. For all integers $D,d\ge1$ there are numbers $c_D(D)$ and $c(\delta,D,d)$, defined in \cref{sec:general} and effectively computable from $(G,X,K,\rho)$, $D$, $d$, $\delta$ and fixed representatives of the connected components of the adjoint Shimura variety (\cref{thm:NA} at $z=\dim\Sh_K(G,X)$), with the following property. Let $F\supset E(G,X)$ be a number field with $[F:\Q]=d$, let $Z\subset\Sh_K(G,X)$ be a closed subvariety that is geometrically irreducible, defined over $F$ and of degree at most $D$, and let $V$ be a special subvariety maximal in $Z$. Then \begin{enumerate}[(i)] \item $\deg V\le c_D(D)$; \item if $\QRH(\delta;L_V)$ holds, then $d_{L_V}\le c(\delta,D,d)$ and $\alpha_V\le c(\delta,D,d)$. \end{enumerate} \end{theorem} By the André--Oort theorem \cite{PST} the set of special subvarieties maximal in $Z$ is finite. Finiteness alone gives no procedure that finds its members; with bounds as in \cref{thm:main}, \cref{thm:list} gives an algorithm that lists them in Mumford's moduli spaces, and \cref{thm:listing}(c) for abelian type, given a finite étale cover by a Shimura variety of Hodge type. The only analytic hypothesis is the zero-free half-plane for the one Dedekind zeta function $\zeta_{L_V}$ of the subvariety in question. It is used to produce primes that split completely in $L_V$; no lower bound for class numbers and no zero-free region for any other $L$-function enters. Since $\zeta_{L_V}/\zeta_k$ is entire for every subfield $k\subset L_V$ (Aramata--Brauer), $\QRH(\delta;L_V)$ already excludes a Siegel zero of every quadratic subfield, so the Landau--Siegel problem does not arise as a separate question. In a preprint, Cureton and Thorner prove $\QRH(1/32;L)$ for every number field $L$ \cite[Theorem~1.1]{CuretonThorner}, building on OpenAI's zero-free half-planes \cite{OpenAIQRH,OpenAIRoots}; their proof has been formalized in Lean \cite{CTLean}. \begin{corollary}[with {\cite[Theorem~1.1]{CuretonThorner}}]\label{cor:unconditional} In the setting of \cref{thm:main}, $\deg V\le c_D(D)$, $d_{L_V}\le c(1/32,D,d)$ and $\alpha_V\le c(1/32,D,d)$ for every special subvariety $V$ maximal in $Z$. \end{corollary} Hu \cite{Hu} gives a formal proof, accepted by Lean's kernel with the standard axioms, that the $L$-functions of unitary Hecke characters of every number field have no zero with $\operatorname{Re}s>7/8$; for the trivial character this is $\QRH(1/8;L)$ for every $L$, and with it \cref{cor:unconditional} holds with $c(1/8,D,d)$ in place of $c(1/32,D,d)$. For $V=\{x\}$ a special point and $G$ adjoint, $d_{L_V}$ is the $d_L$ in the discriminant $\operatorname{disc}(x)=[K^m_T:K_T]\,d_L$ of Binyamini, Schmidt and Yafaev \cite[Def.~1]{BSY}, the quantity in \cite[Thm.~1.2]{PST}, and $\alpha_V\le[K^m_T:K_T]$, with the index bounded explicitly in terms of $\alpha_V$ and $d_L$ (each local index is at most a constant times its factor in \cref{def:alpha}, and the primes that occur are bounded, ramified in $L_V$, or counted in step~(2) of the proof of \cref{prop:B}); so for $x$ maximal in $Z$, \cref{thm:main}(ii) bounds $\operatorname{disc}(x)$. For the Siegel modular varieties the constants simplify. \begin{theorem}\label{thm:Ag} Let $g\ge1$, $N\ge3$, and let $\mathcal{A}_{g,K(N)}$ be the Shimura variety of $(\mathrm{GSp}_{2g},\mathcal{H}_g^\pm)$ at the principal congruence level $K(N)$. \begin{enumerate}[(i)] \item \Cref{thm:main} and \cref{cor:unconditional} hold for $\mathcal{A}_{g,K(N)}$, with $L_V$ the splitting field of the connected centre of $H_V$ itself, $\alpha_V$ computed at the image of $K(N)$ in $\mathrm{PGSp}_{2g}(\Af)$, and with constants given in \cref{thm:AgK}(a); there the factor $h_K$ of \cref{thm:NA} is at most $\varphi(N)/2$, no extension of $F$ is needed, and there is no level factor. \item The same holds for $\mathcal{A}_{g,1}=\mathrm{Sp}_{2g}(\Z)\backslash\mathcal{H}_g$, whose level is not neat, with degrees defined through the cover $\mathcal{A}_{g,K(3)}$ (\cref{lem:degAg1}), $\alpha_V$ computed at the image of $\mathrm{GSp}_{2g}(\Zhat)$ in $\mathrm{PGSp}_{2g}(\Af)$, and constants given in \cref{thm:AgK}(b). \end{enumerate} \end{theorem} The bounds are explicit functions of $D$, $d$ and $\delta$; the constants of $(G,X,K,\rho)$ in them are effectively computable (\cref{tab:constants}, \cref{sec:DJK}, \cref{cor:H}), given a fixed set of representatives of the connected components of the adjoint Shimura variety (\cref{sec:general}); for $\mathcal A_g$ none is needed (\cref{thm:AgK}). For adjoint $G$ the constants of \cref{thm:adjoint} are at most $\exp(O(d\log(d+1)))\,D^{O(1)}$, so for fixed $d$ polynomial in $D$. In general the constant $c$ of \cref{thm:main}, through the recursion of \cref{thm:NA}, is exponential in a power of $D$ (\cref{rem:size}). Call the smallest special subvariety containing $Z$ its \emph{special closure}. In the setting of \cref{thm:adjoint}, a special subvariety $V$ maximal in $Z$ that is not strongly special in the special closure of $Z$ (\cref{sec:adjoint}) satisfies, under $\QRH(\delta;L_V)$ and with $z:=\dim Z$, \[ \alpha_V\,d_{L_V}^\mu\ \le\ \frac{(c_BdD)^{2^z}}{C_*}\,\exp\Bigl(O\bigl(d\log(d+1)+d\log\log(D+2)\bigr)\Bigr), \] where $\alpha_V$ is taken with \cref{def:alpha} for $\rho$, and $c_B$, $C_*$, $\mu$ and the implied constants depend only on $(G,X,K,\rho)$ and $\delta$ (\cref{lem:bezout}, \cref{sec:galois}, \cref{tab:constants}). So, for fixed $d$, $\alpha_V\le D^{2^z+o(1)}$ and $d_{L_V}\le D^{2^z/\mu+o(1)}$ as $D\to\infty$. Turning these bounds into a list needs, in addition, an explicit model of the Shimura variety with a universal family of abelian varieties. No explicit model is known in general. Let $g\ge2$, let $d_\Upsilon$ be a positive multiple of $8$ and $\Upsilon:=(d_\Upsilon,\dots,d_\Upsilon)$, with $g$ entries. Mumford's moduli space $M_\Upsilon$ of principally polarized abelian varieties with an $\Upsilon$-marking is open in a closed subscheme of a projective space given by explicit equations over $\Q$, and $M_\Upsilon\otimes\C$ is a connected Shimura variety for $\mathrm{GSp}_{2g}$, at a level $K_\Upsilon$ (\cref{sec:mumford}). Let $\lambda\colon\mathrm{GSp}_{2g}\to\mathrm{PGSp}_{2g}$ be the map to the adjoint group. \needspace{4\baselineskip} \begin{theorem}\label{thm:list} Let $g\ge2$, $8\mid d_\Upsilon$, and $Z\subset M_\Upsilon\otimes\Qbar$ closed, geometrically irreducible and defined over a number field. Given numbers that bound, for every special subvariety $V$ maximal in $Z$, the degree of $V$ for the Baily--Borel bundle $\Lb_{K_\Upsilon}$ at the level $K_\Upsilon$ of $M_\Upsilon$, the discriminant $d_{L_V}$, and $\alpha_V$ at the level $\lambda(K_\Upsilon)$, and given a number in $(0,\bar B]$, where $\bar B$ is the constant $B$ of \cref{tab:constants} for $\mathrm{PGSp}_{2g}$ with which $\alpha_V$ is formed (\cref{sec:orders}), \cref{alg:listing} terminates, and its output is exactly the set of special subvarieties maximal in $Z$. \end{theorem} \Cref{alg:listing} is built on Urbanik's algorithm \cite[Cor.~6.3]{Urbanik} (\cref{sec:method}). The bounds that \cref{thm:list} needs are given by \cref{thm:Ag}(i) at the level $K(2d_\Upsilon)$, which lies in the level of $M_\Upsilon$ (\cref{lem:Kdelta,lem:TR}), and the positive number by the constant $B$ of the adjoint datum itself, which enters the constants of \cref{thm:Ag}(i) and is computable from $g$ as they are (\cref{sec:algorithm}); so with \cref{cor:unconditional} the listing uses no hypothesis beyond Cureton and Thorner's preprint \cite{CuretonThorner} and its formal proof \cite{CTLean}. For a Shimura variety of abelian type at a neat level, every connected component receives a finite étale map from a connected Shimura variety of Hodge type that is a closed subvariety of some $M_\Upsilon\otimes\C$ (\cref{prop:realize}); given this map, the algorithm, run on each component of the preimage and followed by its last step on the union of the outputs, lists the special subvarieties maximal in a closed irreducible subvariety from equations for its preimage (\cref{thm:listing}(c)). Most effective results concern products of modular curves. Kühne \cite{Kuhne} and Bilu, Masser and Zannier \cite{BMZ} treated curves in $\C^2$, and Fowler bounded the heights and discriminants of the special points on a non-special curve in $\C^2$ whose two coordinate functions have different degrees, linearly and almost quadratically in the height of the curve \cite[Thm.~1.1]{FowlerWBH}. Binyamini \cite{BinyaminiCrelle} bounded the degrees and discriminants of the maximal special subvarieties of any subvariety of $Y(1)^n$ defined over a number field effectively, except for coordinates whose CM field is a single possible exceptional imaginary quadratic field; as he notes \cite[\S1.2]{BinyaminiCrelle}, the exception disappears if no such field exists, and Cureton and Thorner's preprint removes it: the exceptional field comes only from the Siegel--Tatuzawa theorem \cite[\S2.2]{BinyaminiCrelle}, and the $L$-function of a quadratic character, a factor of the Dedekind zeta function of its quadratic field, has no zero with $\operatorname{Re}s>31/32$, so Landau--Siegel zeros are excluded effectively. In \cite[Thm.~7]{BinyaminiPi} he bounds, for fixed $n$, the degrees of all maximal special subvarieties of a subvariety $Z\subset\C^n$, and the discriminants of their special coordinates, by a polynomial in the degree and logarithmic height of $Z$ and the degree of its field of definition, with an algorithm that computes them in polynomially many steps; the one constant there that is not effective comes from Siegel's lower bound for class numbers of imaginary quadratic fields, which the same zero-free half-plane makes effective. For adjoint $G$ the constants of \cref{thm:adjoint} are at most a power of $D$ times a factor exponential in $d\log d$, and the height of $Z$ does not enter them. Binyamini and Masser treated non-compact curves in Hilbert modular varieties with G-functions \cite{BinyaminiMasser}, Binyamini, Jones, Schmidt and Thomas bounded effectively the complexity of the maximal special subvarieties of a subvariety of a fibre power of the Legendre family, through an effective Pila--Wilkie theorem for Pfaffian sets \cite[Thms.~1.1 and~1.3]{BJST}, Papas treated certain curves in $Y(1)^n$ \cite{Papas}, and Fowler gave uniform effective bounds for linear relations among powers of singular moduli \cite{Fowler24,Fowler26}. Daw \cite{Daw} bounded the degrees of strongly special subvarieties from below; Daw, Javanpeykar and Kühne extended this bound to all special subvarieties of positive dimension \cite[Thm.~6.1]{DJK} (its proof is completed by \cref{lem:DJK1,lem:DJK67}) and bounded, with no arithmetic hypothesis, the degrees of maximal special subvarieties that are not of facteur type \cite[Thm.~1.3]{DJK}, a class defined by Ullmo \cite{Ullmo07}. Binyamini and Daw bounded the degree of every weakly optimal subvariety of $Z$, hence of every special subvariety of positive dimension maximal in $Z$, by a polynomial in the degree of $Z$; the polynomial depends on equations for a Baily--Borel embedding and for the canonical connection \cite[Thm.~5 and p.~2157]{BinyaminiDaw}. \subsection{The method}\label{sec:method} We follow the route of Edixhoven, Klingler, Ullmo and Yafaev. For a special subvariety $V$ maximal in $Z$ that is not strongly special, their Hecke step says that $Z$ contains a larger special subvariety once a prime $l$ as in \cite[Thm.~9.2.1, (9.1)]{KY} exists. For a suitable prime $l$ that splits completely in $L_V$ and a Hecke correspondence $T_m$ at $l$, the Galois orbit of $V$ lies in $Z\cap T_mZ$; if $Z\not\subset T_mZ$, an upper bound for the degree of this intersection contradicts a lower bound for the Galois orbit, and if $Z\subset T_mZ$, then $Z$ contains a larger special subvariety \cite[Thm.~7.2.1]{KY}. Two inputs make this work: a lower bound for the Galois orbit of $V$ of the form $C(N)\alpha_V(\log d_{L_V})^N$ \cite[Thm.~2.19]{UY}, and the existence of a split prime $l$ smaller than a fixed power of $\alpha_V\log d_{L_V}$ \cite[Prop.~10.2.3]{KY}. GRH enters only here, both times to find primes that split completely in $L_V$ \cite[Prop.~10.1.2]{KY}, \cite[Prop.~2.13]{UY}. We make each step explicit and replace GRH by $\QRH(\delta;L_V)$. \emph{Split primes.} Under $\QRH(\delta;L)$ an explicit formula with a smoothing that removes the constants at $s=0$ and $s=-1$ gives primes that split completely in $L$ in every interval $(x/4,x]$ with $x$ a fixed power of $\log d_L$, the power being $1/\delta$ instead of the $2+o(1)$ of GRH (\cref{lem:SP,lem:Aprime}). Frei, Sofos and Widmer obtain, under the same hypothesis, primes of every Frobenius class in $(x/2,x]$ for $x\ge c(\delta)(\log d_L)^{1/\delta}(\log\log d_L)^{2/\delta}$, with a constant $c(\delta)$ that is not made explicit \cite[Cor.~1.2]{FSW}; we need only the completely split case, but with explicit constants. For the Galois bound we rerun the argument of Ullmo and Yafaev for the torus $T_V$ \cite[\S6]{UY15}, with the split primes taken up to a fixed power of the discriminant, as Tsimerman does under GRH for CM points of $\mathcal{A}_g$ \cite[\S7.3, Thm.~7.6]{Tsimerman12}; so any $\delta>0$ suffices and the exponent $\mu$ in the bound $\gg\alpha_Vd_{L_V}^{\mu}$ does not depend on $\delta$ (\cref{prop:C,cor:D}). Klingler and Yafaev use this bound in the weaker form $\gg\alpha_V(\log d_{L_V})^N$; we use the power of $d_{L_V}$ itself. Then the prime $l$ of the Hecke step, of size a power of $\log d_{L_V}$ and $\log\alpha_V$, is set against an orbit of size $\alpha_Vd_{L_V}^\mu$, so any $\delta>0$ works there too, and for adjoint $G$ and fixed $[F:\Q]$ the bounds for $\alpha_V$ and $d_{L_V}$ are at most a power of the degree of $Z$ (\cref{lem:solve,rem:size}). \emph{Uniformity in the level.} The Hecke step works at an Iwahori level $I_l$ that varies with the prime $l$. Every constant must therefore be uniform in the level, including the constant in Bézout's inequality. We show that the complete linear system of $\Lb_J^{\otimes e}$ is base-point free and separates points for every $e\ge e^*(n)$, at every neat level $J$ of every Shimura datum of dimension at most $n$ (\cref{thm:e0}). So Bézout's inequality holds at every neat level with the constant $e^*(n)^{2n}$ (\cref{lem:bezout}), and the Hecke step runs as in \cite{KY}, with intrinsic degrees and the exponent $2^r$. \begin{theorem}\label{thm:e0} Let $(G,X)$ be a Shimura datum, $K$ neat, and $n:=\dim\Sh_K(G,X)$. Put $e^*(n):=\lfloor\sum_{k=1}^n k\,2^{1/k}\rfloor+2$. For every integer $e\ge e^*(n)$ the complete linear system $|\Lb_K^{\otimes e}|$ on the Baily--Borel compactification is base-point free and separates points. Moreover $e^*(n)\le\lfloor n(n+3)/2\rfloor+2$. \end{theorem} The proof applies Fujino's Angehrn--Siu theorem for log canonical pairs \cite{Fujino} to the Baily--Borel compactification, which is log canonical with log canonical bundle $\Lb_K$ by Mumford's description of the canonical extension \cite[Prop.~3.4]{Mumford77}. For ball quotients, G.~Di~Cerbo and L.~F.~Di~Cerbo show that on a smooth toroidal compactification $\widetilde Y$ of dimension $n\ge2$ with boundary $\partial\widetilde Y$ the divisor $m(K_{\widetilde Y}+\partial\widetilde Y)$ is base-point free for $m\ge\binom n2+1$ and separates the points of $\widetilde Y\smallsetminus\partial\widetilde Y$ for $m\ge\binom n2+2$ \cite[Cor.~3.3 and~3.4]{DiCerbo}, by Kollár's effective results for pairs \cite[Thm.~5.8 and~5.9]{Kollar}. \emph{Degrees.} Daw, Javanpeykar and Kühne bound the degree of a maximal special subvariety that is not of facteur type by an iteration of Hecke correspondences \cite[\S10]{DJK}, which builds on the one Daw ran for strongly special subvarieties \cite[Thm.~9.3]{Daw} after \cite[Thm.~9.2.1]{KY}, and Binyamini and Daw bound every positive-dimensional one by a different method \cite[Thm.~5]{BinyaminiDaw}. For adjoint $G$, the iteration of \cite{DJK}, with the uniform Bézout step and a fibre-saturation lemma, also bounds every positive-dimensional one by an explicit function of $D$ that is $D^{2^{\dim Z}+o(1)}$ as $D\to\infty$ and whose constants depend only on $(G,X,K,\rho)$. \begin{theorem}\label{thm:degrees} Let $(G,X)$ be a Shimura datum with $G$ adjoint and $K$ a neat product level, let $Z\subset\Sh_K(G,X)$ be closed and irreducible, of degree $D$, and let $V$ be a special subvariety maximal in $Z$ with $\dim V\ge1$. Put $r:=\dim Z-\dim V$ and $n:=\dim\Sh_K(G,X)$. Then, for every prime $p\ge N_K$ outside the finite set $\Sigma_V$ of \cref{sec:DJK}, \[ \deg V\ \le\ d_G\bigl(d_G\,c_B\,p^{k_2+2f_2}\bigr)^{2^r-1}D^{2^r},\qquad c_B=e^*(n)^{2n}, \] where $d_G$, $k_2$, $f_2$ and $N_K$, which depend only on $(G,X,K,\rho)$, are the maxima over the connected components of the constants of \cref{sec:DJK} at the levels $g_iKg_i^{-1}$ with the lattices $\rho(g_i)\Zhat^{n_\rho}$, and $\Sigma_V$ is that of the translate of $V$ (\cref{sec:special}). Consequently $\deg V$ is at most the maximum over the connected components of $\Sh_K(G,X)_\C$ of the constants $c_D^\ad(\dim Z,D)$ of \cref{thm:D} (\cref{sec:special}), a function of $(G,X,K,\rho)$, $\dim Z$ and $D$ alone, effectively computable given the representatives $g_i$ of \cref{sec:special}, and at most $D^{2^{\dim Z}+o(1)}$ as $D\to\infty$. No arithmetic hypothesis is used. \end{theorem} \emph{Assembly.} Maximal special subvarieties fall into three classes: strongly special ones, which \cref{thm:degrees} bounds; those that are not strongly special in the special closure of $Z$, which the Hecke step bounds; and those whose torus is the centre of the generic Mumford--Tate group of $Z$, which are strongly special in the special closure but not in $S$. The last class needs a separate argument (\cref{lem:Za,lem:Zb}). For a general Shimura datum, the map to the adjoint Shimura variety need not be injective on connected components, and maximality can be lost under it; a recursion on dimension at the fixed level handles this (\cref{sec:general}). \emph{Listing.} For $\mathcal A_g$ in Mumford's model, the bounds determine finitely many PEL data, each with an explicit locus of abelian varieties with the given endomorphisms (\cref{lem:Oprime}). Every special subvariety $V$ is rigid in the normalization of one of these loci (\cref{lem:P}), so it lies in the finite set of weakly special subvarieties of bounded degree, containing the rigid ones, that Urbanik's algorithm computes on the normalization \cite[Cor.~6.3]{Urbanik}; a test on the algebraic monodromy at one point, computed on a certified curve (\cref{lem:Rprime,lem:G,prop:T3}), decides which outputs are rigid, and rigid ones are special. \subsection{Comparison with the proof of Klingler and Yafaev}\label{sec:KY} At a few points we argue differently from \cite{KY}. One concerns a constant: the proof of \cite[Thm.~9.2.1]{KY} bounds the degree of the intersection $\widetilde Z\cap T_m\widetilde Z$ at the Iwahori level \cite[(9.5), p.~47]{KY}, and of the intersection in the proof of \cite[Sublemma~9.2.5]{KY}, by Bézout's inequality with constant $1$ for the Baily--Borel bundle, which holds for very ample bundles but can fail for ample ones (\cref{ex:bezout}); with the constant of \cref{lem:bezout} in its place the argument of \cite{KY} goes through (proof of \cref{thm:hecke-uniform}). The others concern the choice of a prime, of an element, of a subgroup or of a component, and one reduction step, and are dealt with where they arise: the count of primes in \cite[Lemma~10.2.5]{KY} (proof of \cref{prop:B}); the torus condition of \cite[Thm.~8.1]{KY}, which \cite[p.~55]{KY} draws from the converse in the proof of \cite[Lemma~3.17]{UY} (\cref{rem:converse}); the element $q$ and the group $\Gamma$ in the proof of \cite[Lemma~7.2.8]{KY}, and the reduction to adjoint groups in \cite[Lemma~7.2.2]{KY} (Step~3 of the proof of \cref{thm:hecke-uniform}, and Steps~1--2 of the proof of \cref{lem:saturation}); the Iwahori subgroups of \cite[\S8.3.2]{KY}, where the proof of \cite[Lemma~8.1.6]{KY} takes the point fixed by a maximal compact subgroup to lie in a given apartment and the group to have hyperspecial subgroups (\cref{lem:KY816}); and the component $\widetilde Y_H$ of \cite[p.~49]{KY} in the descent (\cref{lem:descent}). None of this affects the main theorem of \cite{KY}: the constant $c_B$ of \cref{lem:bezout} enters the left side of \cite[(9.1)]{KY} to the power $2^r$, with $r$ as there, which the choice of $l$ in \cite[\S10.2]{KY} absorbs; the primes can be taken larger than the constants in question; the element, the subgroup, the Iwahori subgroups and the component can be chosen as here, and the reduction to adjoint groups argued as here. \subsection{Plan}\label{sec:plan} \Cref{sec:setting} fixes notation and the complexity. \Cref{sec:primes} proves the split-prime bounds and the Galois bound under $\QRH(\delta;L_V)$. \Cref{sec:e0} proves \cref{thm:e0}. \Cref{sec:bezout} proves Bézout's inequality at every neat level, and \cref{sec:hecke} the Hecke step built on it. \Cref{sec:degrees} proves \cref{thm:degrees}. \Cref{sec:adjoint} proves \cref{thm:adjoint}, the case of adjoint groups at levels with a neat factor (\cref{prop:Lvprime}), and \cref{sec:general} proves \cref{thm:main} for every Shimura datum, with $\mathcal{A}_g$ in \cref{sec:Ag}. \Cref{sec:listing} proves \cref{thm:list}. \Cref{sec:primes,sec:e0} are independent of each other; \cref{sec:hecke} uses both. \section{Setting, notation and the complexity}\label{sec:setting} \subsection{Shimura varieties and degrees}\label{sec:shimura} A Shimura datum $(G,X)$ satisfies Deligne's axioms; $E(G,X)$ is its reflex field and $X^+$ a connected component of $X$. For a compact open subgroup $K\subset G(\Af)$, \[ \Sh_K(G,X)_\C=G(\Q)\backslash X\times G(\Af)/K, \] with its canonical model over $E(G,X)$. We say that $K$ is a \emph{product level} if $K=\prod_pK_p$ with $K_p\subset G(\Q_p)$, and \emph{neat} in the sense of Pink \cite[0.6]{Pink}. We write $G(\Q)_+:=G(\Q)\cap\lambda^{-1}(G^\ad(\R)^+)$, where $\lambda\colon G\to G^\ad$ is the adjoint map and $G^\ad(\R)^+$ the identity component, and $G^\ad(\Q)_+:=G^\ad(\Q)\cap G^\ad(\R)^+$. For neat $K$ every connected component of $\Sh_K(G,X)_\C$ is a quotient $\Gamma\backslash X^+$, with $\Gamma\subset G^\ad(\Q)_+$ the image of $G(\Q)_+\cap gKg^{-1}$ for some $g\in G(\Af)$ \cite[\S4.1]{KY}, which is neat \cite[0.5]{Pink} and arithmetic (\cref{lem:arith}). We fix a faithful representation $\rho\colon G\to\mathrm{GL}_{n_\rho}$ with $\rho(K)\subset\mathrm{GL}_{n_\rho}(\Zhat)$, and write $n:=\dim\Sh_K(G,X)$. Arithmetic subgroups are those commensurable with a congruence subgroup \cite[0.5]{Pink}. We use the following form of the statement that images of arithmetic groups are arithmetic \cite[Prop.~3.2]{Milne}. \begin{lemma}\label{lem:arith} Let $G$ be a connected reductive $\Q$-group, $K\subset G(\Af)$ and $U\subset G^\ad(\Af)$ compact open subgroups with $\lambda(K)\subset U$, $h\in G(\Af)$, $\Gamma:=G(\Q)_+\cap hKh^{-1}$ and $\Gamma':=G^\ad(\Q)_+\cap\lambda(h)U\lambda(h)^{-1}$, with $G(\Q)_+$ and $G^\ad(\Q)_+$ as above. Then $\lambda(\Gamma)\subset\Gamma'$, the index $[\Gamma':\lambda(\Gamma)]$ is finite, and $\lambda(\Gamma)$ and $\Gamma'$ are arithmetic. \end{lemma} \begin{proof} The inclusion is clear. As $G^\ad(\R)^+$ has finite index in $G^\ad(\R)$ \cite[p.~54]{Milne}, $\Gamma'$ has finite index in the congruence subgroup $G^\ad(\Q)\cap\lambda(h)U\lambda(h)^{-1}$, so it is arithmetic. Likewise $\lambda^{-1}(G^\ad(\R)^+)$ is open, hence of finite index, in $G(\R)$, so $\Gamma$ has finite index in the congruence subgroup $G(\Q)\cap hKh^{-1}$ and is arithmetic. So $\lambda(\Gamma)$ is arithmetic \cite[Prop.~3.2]{Milne}. Two arithmetic subgroups are commensurable, so $\lambda(\Gamma)\subset\Gamma'$ gives $[\Gamma':\lambda(\Gamma)]<\infty$. \end{proof} Let $\overline{\Sh}_K(G,X)$ be the Baily--Borel compactification. For neat $K$ the line bundle of holomorphic forms of top degree on $\Sh_K(G,X)_\C$ extends to an ample line bundle $\Lb_K$ on $\overline{\Sh}_K(G,X)$, given at the generic points of the boundary divisors by forms with logarithmic poles and defined over $E(G,X)$; for neat $K_2\subset gK_1g^{-1}$ the morphism $\Sh_{K_2}\to\Sh_{K_1}$ induced by $g$ extends to the compactifications and pulls $\Lb_{K_1}$ back to $\Lb_{K_2}$ \cite[Prop.~5.3.2]{KY}. For a closed subvariety $Y\subset\Sh_K(G,X)_\C$ we put \[ \deg Y:=\sum_{Y'}\deg_{\Lb_K}\overline{Y'}, \] the sum over the irreducible components $Y'$ of $Y$ of the degrees of their closures \cite[\S5.1 and Def.~5.3.3]{KY}. We use the projection formula in the form $\deg_{f^*\Lb}Y=(\deg f)\deg_{\Lb}f(Y)$ for $f$ generically finite and proper \cite[\S5.1]{KY}. \subsection{Special subvarieties}\label{sec:special} A \emph{special subvariety} of $\Sh_K(G,X)_\C$ is an irreducible component of the image of $\Sh_{K_H}(H,X_H)_\C\to\Sh_K(G,X)_\C$, $[x,h]\mapsto[x,hg]$, for a Shimura subdatum $(H,X_H)\subset(G,X)$, an element $g\in G(\Af)$ and $K_H:=H(\Af)\cap gKg^{-1}$. We may and do take $H$ to be the generic Mumford--Tate group on $X_H$, and write $H_V$ for it. Irreducible components of preimages and images of special subvarieties under the morphisms of Shimura varieties used below are special \cite[p.~14]{KY}. An irreducible subvariety is \emph{Hodge generic} if it is not contained in a special subvariety of smaller dimension than the connected component containing it, and a subvariety defined and irreducible over a number field is Hodge generic if its geometric components are \cite[Def.~7.1.1, Lemma~7.1.2]{KY}. Reflex fields decrease under inclusion: $E(G,X)\subset E(H,X_H)$ \cite[Remark~12.3(c)]{Milne}, and a morphism of Shimura varieties induced by $(H,X_H)\to(G,X)$ is defined over $E(H,X_H)$ \cite[Remark~13.8]{Milne}. Let $V$ be special with generic Mumford--Tate group $H_V$. In \crefrange{sec:setting}{sec:adjoint} the group $G$ is adjoint wherever $T_V$ appears, and we write $T_V$ for the connected centre of $H_V$; in \cref{sec:general} we pass to the adjoint group first, so that $T_V$ is always the torus of the introduction. Let $L_V$ be the splitting field of $T_V$, $d_{L_V}:=|\disc L_V|$, and \[ \beta_V:=\log d_{L_V}. \] The subvariety $V$ is \emph{strongly special} if $T_V=1$ \cite[Def.~2.1.5]{KY}. More generally, a special subvariety of $\Sh_{K_P}(P,X_P)_\C$ for a Shimura datum $(P,X_P)$ is strongly special there if the connected centre of the image of its generic Mumford--Tate group in $P^\ad$ is trivial \cite[Def.~2.1.5]{KY}. If $T_V\ne1$, then $T_V(\R)$ is compact and $T_V$ is not split over $\Q$ \cite[Lemma~2.4.3]{KY}, so $L_V\ne\Q$ and $\beta_V\ge\log3$ by Minkowski's theorem. Let $K^m_{T_V}$ be the maximal compact open subgroup of $T_V(\Af)$ and, for $V$ given by $(H_V,X_{H_V})$ and $g$ as above, $K_{T_V}:=T_V(\Af)\cap gKg^{-1}$. Replacing $(H_V,X_{H_V},g)$ by $(qH_Vq^{-1},qX_{H_V},qgk)$ with $q\in G(\Q)$ and $k\in K$ conjugates $K^m_{T_V}$ and $K_{T_V}$ by $q$, and replacing $g$ by $hg$ with $h\in H_V(\Af)$ changes neither, as $T_V$ is central in $H_V$; so the indices $|K^m_{T_V,p}/K_{T_V,p}|$ depend only on $V$ (compare \cite[Remark~2.4.2]{KY}). \needspace{4\baselineskip} \begin{definition}[{\cite[Def.~2.5.1]{KY}}]\label{def:alpha} For $V$ special with $T_V\ne1$, \[ \alpha_V:=\prod_{p:\,K^m_{T_V,p}\ne K_{T_V,p}}\max\bigl(1,B\,|K^m_{T_V,p}/K_{T_V,p}|\bigr), \] with the constant $B$ of \cref{tab:constants}. If $T_V=1$, we put $\alpha_V:=1$ and $d_{L_V}:=1$. The \emph{complexity} of $V$ is \[ \Delta(V):=\max\bigl(\deg V,\ d_{L_V},\ \alpha_V\bigr). \] \end{definition} Right translation $[x,a]\mapsto[x,ag^{-1}]$ is an isomorphism $\Sh_K(G,X)\to\Sh_{gKg^{-1}}(G,X)$, defined over $E(G,X)$ \cite[Thm.~13.6]{Milne} and pulling $\Lb_{gKg^{-1}}$ back to $\Lb_K$ (\cref{sec:shimura}), so it preserves degrees and fields of definition containing $E(G,X)$; it maps special subvarieties to special subvarieties with the same $T_V$, $L_V$ and indices, and the image of $X^+\times\{g\}$ onto $\Sh_{gKg^{-1}}(G,X^+)_\C$, the image of $X^+\times\{1\}$. The level $gKg^{-1}$ is again a neat product level, and if $K$ satisfies (Lv) of \cref{sec:constants}, or (Lv$'$) of \cref{sec:Lvprime}, so does $gKg^{-1}$ for the lattice $\rho(g)\Zhat^{n_\rho}$. So in \crefrange{sec:hecke}{sec:adjoint} we assume, as \cite[p.~14]{KY} and \cite[\S9.1]{DJK} do, that $Z$ lies in $\Sh_K(G,X^+)_\C$. A special subvariety $V$ of $\Sh_K(G,X^+)_\C$ is then the image of $X_{H_V}^+\times\{1\}$ with $X_{H_V}^+\subset X^+$ \cite[Lemma~2.1]{UY}, so that $K_{T_V}=T_V(\Af)\cap K$; the same convention is used for a Shimura subdatum $(P,X_P)$ with $X_P^+\subset X^+$ in place of $(G,X)$, and for an $F$-irreducible $Z$ (\cref{sec:hecke}) it applies to a geometric component of $Z$ containing $V$; when a proof chooses a component of a preimage in $\Sh_J(P,X_P)_\C$, for $J\subset K\cap P(\Af)$ compact open, it is chosen in the image of $X_P^+\times\{1\}$. For $Z$ in the image of $X^+\times\{g_i\}$, with $g_i$ in a fixed finite set of representatives of $G(\Q)_+\backslash G(\Af)/K$, \cref{thm:D,thm:adjoint} hold with the constants of the level $g_iKg_i^{-1}$ and the lattice $\rho(g_i)\Zhat^{n_\rho}$ in place of those of $K$ and $\Zhat^{n_\rho}$. The symbols $c_D^\ad(z,D)$ and $c^\ad(\delta,z,D,d)$ below are the constants of the level $K$; \cref{sec:general} uses their maxima over the representatives. These maxima are effectively computable from $(G,X,K,\rho)$ and the chosen representatives; the finiteness of the double coset sets \cite[Lemma~5.12]{Milne} makes them well defined, a finite subset of $G(\Af)$ (resp. $G^\ad(\Af)$) meeting every double coset may be used in place of a set of representatives, and we do not discuss how to compute one in general (for $\mathcal A_g$ none is needed, proof of \cref{thm:AgK}). \subsection{The constants of the datum}\label{sec:constants} Klingler and Yafaev work under the following normalization of the level \cite[Situation~9.1]{KY}: \begin{enumerate}[label=(Lv)] \item $K$ is a neat product level, and $K_3$ lies in the principal congruence subgroup of level $3$ of $\mathrm{GL}_{n_\rho}(\Z_3)$. \end{enumerate} \Cref{lem:LV} removes it at an explicit cost. The constants in \cref{tab:constants} depend only on $(G,X,K,\rho)$ and, except $\mu$ and $f$, are the ones in \cite{KY,UY,EY}; each except $C_0$ is given by an explicit formula or a finite enumeration in its source or below, $C_0$ is any integer larger than every prime $l$ at which the schematic closure of $\rho(G)$ in $\mathrm{GL}_{n_\rho,\Z}$ is not reductive over $\Z_l$ or $K_l\ne G(\Z_l)$, and none involves an analytic input. $c_U=1/(2C_\Phi)$, where $C_\Phi$ bounds the orders of the component groups of the stabilizers in \cite[Lemma~4.4.1]{EY}, in this form: for every special $V$, with $T:=T_V$ and the field $F_T\supset L_T$ and surjection $r_T\colon\mathrm{Res}_{F_T/\Q}\Gm\to T$ of \cite[p.~42]{UY}, every $d\ge1$ and every vector of the $d$-th exterior power of $\Qbar^{n_\rho}$, the torsion of $X^*(\mathrm{Res}_{F_T/\Q}\Gm)/N$ has order at most $C_\Phi$, where $N$ is generated by the differences $x-x'$ of the weights $x,x'$ of $\mathrm{Res}_{F_T/\Q}\Gm$, acting through $\rho\circ r_T$, in the support of that vector. These come from the finitely many characters allowed by \cite[Lemmas~2.5--2.6]{UY}, so $C_\Phi$, and with it $c_U$, is computable from $(G,\rho)$. \begin{table}[ht] \caption{Constants attached to $(G,X,K,\rho)$, for $G$ adjoint.}\label{tab:constants} \begin{tabular}{@{}lp{7.4cm}l@{}} \toprule Constant & Meaning & Source\\ \midrule $n_T$ & a bound for $[L_V:\Q]$ over all special $V$ & \cite[proof of Lemma~2.5]{UY}\\ $R_G$ & a bound for the degree of the Galois closure of $E(H_V,X_{H_V})$ over all special $V$ & \cite[Lemma~2.5]{UY}, \cite[Def.~2.5.1]{KY}\\ $C_0$ & every prime $l>C_0$ has $K_l=G(\Z_l)$ hyperspecial & \cite[p.~53]{KY}\\ $a$, $A$, $r_U$ & $a$ a bound for the indices $[K^m_H:K^{m'}_H]$ and $[K_H:K'_H]$ of the auxiliary levels of \cite[pp.~21--22]{UY}, for instance $a=|\mathrm{GL}_{n_\rho}(\F_3)|$; $A$ the integer of \cite[Prop.~2.9]{UY}; $r_U$ a bound, over all special $V$ and primes $p$, for the number of cyclic factors of $K^m_{T_V,p}/K_{T_V,p}$ & \cite[pp.~20--22, 29]{UY}\\ $B$ & $B=1/(A^{r_U}(a!)^{r_U})$ & \cite[p.~31]{UY}\\ $c_U$ & $|K^m_{T_V,p}/K_{T_V,p}|\ge c_Up$ for $p>C_0$ unramified in $L_V$ with $K^m_{T_V,p}\ne K_{T_V,p}$ & \begin{tabular}[t]{@{}l@{}}\cite[Prop.~3.15]{UY}, \cite[\S4.4]{EY},\\ \cref{rem:converse}\end{tabular}\\ $k_1$, $f$ & $k_1=2An_\rho^3B_\rho$ with $B_\rho$ the bound $B$ of \cite[Prop.~7.4.3]{EY} for $\rho|_{T_V}$, uniform in $V$ by \cite[Lemma~2.6]{UY} as in \cite[\S8.3.1]{KY} (\cite[Prop.~2.6]{Yafaev} for special points); $f:=(\dim G+1)^2$, which bounds the Iwahori indices of \cite[(8.8)]{KY} as $1-\delta$. If $L/\Q$ is Galois and $k\subset L$, then $L/k$ is Galois and $\zeta_L/\zeta_k$ is entire by the Aramata--Brauer theorem, so $\QRH(\delta;L)$ implies $\QRH(\delta;k)$. We put \[ \kappa(\delta):=\frac{2-\delta}{\delta(1+\delta)},\qquad w(\delta):=(1+2^{-1-\delta})(1+2^{-\delta})<3 . \] \section{Split primes and Galois orbits under a zero-free half-plane}\label{sec:primes} This section proves the two analytic inputs of the Hecke step for one Galois field $L$ under $\QRH(\delta;L)$: a count of primes that split completely in $L$ from $x$ a power of $\log d_L$ on, and the lower bound of Ullmo and Yafaev for Galois orbits with an explicit constant. The first is an explicit formula; the second reruns \cite[\S6]{UY15} with it. \subsection{Split primes}\label{sec:SP} Let $L/\Q$ be Galois of degree $n_L$ and signature $(r_1,r_2)$, $d_L:=|\disc L|$, and put \[ A_L:=\tfrac32+\tfrac12\log d_L,\qquad \vartheta_L(x):=\sum_{\substack{x/40$ \cite[Thm.~13, (3.36)]{RosserSchoenfeld}. Dividing the two bounds for $G(x)$ by $xn_L/2$ gives the lemma. \end{proof} \begin{lemma}\label{lem:Aprime} Let $\delta\in(0,1/2]$ and assume $\QRH(\delta;L)$. Put \[ x_1(L,\delta):=\max\Bigl(\bigl(\tfrac{32}{3}w(\delta)\kappa(\delta)A_L\bigr)^{1/\delta},\ (48n_L)^2,\ (\log d_L+1)^2\Bigr). \] For every $x\ge x_1(L,\delta)$ we have $\vartheta_L(x)\ge x/(8n_L)$, so at least $x/(8n_L\log x)$ primes in $(x/4,x]$ split completely in $L$. If $\beta:=\log d_L\ge1$, the condition $x\ge x_1(L,\delta)$ holds as soon as \[ x^\delta\ge64\kappa(\delta)\beta,\qquad x\ge(48n_L)^2,\qquad \sqrt x\ge\beta+1 . \] \end{lemma} \begin{proof} As $x\ge8$, \cref{lem:SP} applies, and $x^\delta\ge\frac{32}3w\kappa A_L$ makes the bracket at least $1/2$, so the main term is at least $3x/(16n_L)$. Bound $\epsilon_L\log\operatorname{rad}(d_L)\le\log d_L$ and $0.694+1.922/x<1$. As $\sqrt x\ge48n_L$, $x/(16n_L)\ge3\sqrt x$, and as $\sqrt x\ge\log d_L+1$, $3\sqrt x\ge1.4262\sqrt x+\log d_L+1$. So $\vartheta_L(x)\ge3x/(16n_L)-x/(16n_L)=x/(8n_L)$, and each prime counted contributes at most $\log x$. For the last assertion, $w(\delta)<3$ and $A_L\le2\beta$ when $\beta\ge1$, so $\frac{32}3w(\delta)\kappa(\delta)A_L\le64\kappa(\delta)\beta$. \end{proof} \subsection{The Galois bound}\label{sec:galois} Let $(G,X)$ be a Shimura datum with $G$ adjoint, $(H,X_H)\subset(G,X)$ a Shimura subdatum with $H$ the generic Mumford--Tate group on $X_H$, and $H^\ab:=H/H^\der$, which is isogenous to the connected centre $T$ of $H$ \cite[Remark~2.20]{UY}; assume $T\ne1$. Fix $x\in X_H$, let $(H^\ab,\{\bar x\})$ be the induced Shimura datum of CM type, $E:=E(H^\ab,\{\bar x\})$, $L$ the splitting field of $H^\ab$ (that of $T$), and $r_L:=r\circ N_{L/E}\colon\mathrm{Res}_{L/\Q}\Gm\to H^\ab$, where $r$ is the reciprocity morphism, which is surjective \cite[proof of Prop.~2.14]{UY}. Let $K^m_{H^\ab}$ be the maximal compact open subgroup of $H^\ab(\Af)$ and \[ \mathrm{Im}_L:=\text{the image of }r_L\bigl((\Af\otimes L)^\times\bigr)\text{ in }H^\ab(\Q)\backslash H^\ab(\Af)/K^m_{H^\ab}. \] Let $\chi_1,\chi_2,\dots$ be the characters, at most $s_\rho$ in number, of the representation of $H^\ab$ induced by $t\mapsto\rho(t)^m$, with $m$ the degree of the isogeny $T\to H^\ab$ (which kills its kernel) \cite[proof of Lemma~2.6]{UY}; they span $X^*(H^\ab)\otimes\Q$, and their coordinates in the canonical basis $(\chi_\sigma)_{\sigma\in\Gal(L/\Q)}$ of $X^*(\mathrm{Res}_{L/\Q}\Gm)$ are Hodge weights, of absolute value at most $t_\rho$ \cite[proof of Lemma~2.6]{UY}. Put $\mathfrak d:=2t_\rho s_\rho n_T(n_T-1)$, $\theta:=1/(4\mathfrak d)=2\mu$, and \[ \beta_0(\delta):=\max\Bigl(\frac{128\kappa(\delta)}{\theta^2\delta^2},\ \Bigl(\frac{96}{\theta^3}\Bigr)^{1/2},\ 3n_T\log n_T+1,\ \frac{64n_T}{\theta}\Bigr),\qquad c_*(\delta):=\exp(-\mu\beta_0(\delta)). \] \needspace{4\baselineskip} \begin{proposition}\label{prop:C} If $\QRH(\delta;L)$ holds, then $|\mathrm{Im}_L|\ge c_*(\delta)\,d_L^{\mu}$. The exponent $\mu=1/(16t_\rho s_\rho n_T(n_T-1))$ does not depend on $\delta$. \end{proposition} This is the bound to which Ullmo and Yafaev reduce their theorem \cite[Thm.~6.1 and p.~33]{UY15}, which assumes GRH, with the split primes supplied by \cref{lem:Aprime}; their argument goes back to Amoroso and Dvornicich \cite{AmorosoDvornicich} and Yafaev \cite[Thm.~2.15]{Yafaev}. We write the proof out, with the primes taken up to a power of the discriminant, $x=d_L^\theta$, as in \cite[proof of Thm.~7.6]{Tsimerman12}, because that is why any $\delta>0$ is enough. \begin{proof} Let $p_1,\dots,p_\ell\le x$ be distinct primes that split completely in $L$. Fix places $v_j\mid p_j$ and let $P_j\in(\Af\otimes L)^\times$ be $p_j$ at $v_j$ and $1$ elsewhere. (1) Suppose $a\in\Z^\ell\smallsetminus\{0\}$ and $r_L(\prod_jP_j^{a_j})=\pi k$ with $\pi\in H^\ab(\Q)$ and $k\in K^m_{H^\ab}$. Write $\chi_i\circ r_L=\sum_\sigma c_{i,\sigma}\chi_\sigma$ with $|c_{i,\sigma}|\le t_\rho$. Since $\chi_\sigma$ acts on $(\Af\otimes L)^\times$ through $1\otimes\sigma$ and the decomposition group at $v_j$ is trivial, $\pi_i:=\chi_i(\pi)\in L^\times$ has valuation of absolute value at most $t_\rho|a_j|$ at the places above $p_j$ and valuation $0$ at every other finite place. (2) As $G$ is adjoint, $H^\ab(\R)$ is compact, complex conjugation acts by $-1$ on $X^*(H^\ab)$ and $L$ is CM, so $|\sigma(\pi_i)|=1$ for every embedding $\sigma$. With $Q:=\prod_jp_j^{|a_j|}$, the numbers $\pi_i':=Q^{t_\rho}\pi_i$ are algebraic integers with $|\sigma(\pi_i')|=Q^{t_\rho}$. (3) The $\pi_i$ generate $L$ \cite[Lemma~2.16]{Yafaev}: if $\sigma\in\Gal(L/\Q)$ fixes every $\pi_i$, comparing valuations at the places above some $p_j$ with $a_j\ne0$ shows that $\sigma$ fixes each $\chi_i\circ r_L$ in the regular module $X^*(\mathrm{Res}_{L/\Q}\Gm)$; as $r_L$ is surjective, $\sigma$ acts trivially on $X^*(H^\ab)\otimes\Q$, so $\sigma=1$. (4) The monomials $\prod_i\pi_i'^{e_i}$ with $0\le e_i\le n_T-1$ span $L$ over $\Q$; a basis $b_1,\dots,b_{n_L}$ among them satisfies $|\sigma(b_k)|\le Q^{t_\rho s_\rho(n_T-1)}$, and Hadamard's inequality gives $|\det(\operatorname{Tr}b_kb_{k'})|\le n_T^{3n_T/2}Q^{\mathfrak d}$. This is a multiple of $d_L$, so $\log d_L\le\frac32n_T\log n_T+\mathfrak d\sum_j|a_j|\log x$. (5) If $\ell\ge|\mathrm{Im}_L|$, two of the classes of the $r_L(P_j)$ coincide or one is trivial, which gives $a$ as in (1) with $0<\sum|a_j|\le2$. So if $\log d_L-\frac32n_T\log n_T>2\mathfrak d\log x$, then $\ell<|\mathrm{Im}_L|$ \cite[p.~33]{UY15}. (6) Let $\beta:=\log d_L\ge\beta_0(\delta)$ and $x:=d_L^\theta$. Then $x^\delta=e^{\theta\delta\beta}\ge(\theta\delta\beta)^2/2\ge64\kappa(\delta)\beta$; $\theta\beta\ge64n_T\ge2\log(48n_T)$; and $\sqrt x=e^{\theta\beta/2}\ge(\theta\beta/2)^3/6\ge2\beta\ge\beta+1$. By \cref{lem:Aprime} there are at least $x/(8n_T\log x)$ such primes in $(x/4,x]$. Also $\beta-\frac32n_T\log n_T>\beta/2=2\mathfrak d\log x$. By (5), $|\mathrm{Im}_L|>x/(8n_T\log x)=e^{2y}/(16n_Ty)$ with $y:=\theta\beta/2\ge32n_T$, and $e^y\ge y^2/2\ge16n_Ty$, so $|\mathrm{Im}_L|\ge e^{y}=d_L^\mu$. If $\beta<\beta_0(\delta)$, then $|\mathrm{Im}_L|\ge1\ge c_*(\delta)d_L^\mu$. \end{proof} For a special $V$ with $T_V\ne1$ let $F_V$ be the Galois closure of $E(H_V,X_{H_V})$; it contains $L_V$ \cite[proof of Prop.~2.14]{UY} and $[F_V:\Q]\le R_G$. Put \[ C_*:=\frac{c_*(\delta)}{R_G\,a\,(a!)^{r_U}},\qquad \Omega_V:=C_*\,\alpha_V\,d_{L_V}^{\mu}. \] \begin{corollary}\label{cor:D} Let $G$ be adjoint and $K$ satisfy \textup{(Lv)}. Let $(H,X_H)\subset(G,X)$ be a Shimura subdatum with $H$ the generic Mumford--Tate group on $X_H$ and $T:=Z(H)^\circ\ne1$, $K_H:=K\cap H(\Af)$, $V_H$ a geometric component of $\Sh_{K_H}(H,X_H)_\C$ and $V$ its image in $\Sh_K(G,X)_\C$, so that $T_V=T$. Let $F\supset E(H,X_H)$ be a number field whose Galois closure $F^c$ has degree at most $R_G$ (for instance $F=E(H',X_{H'})$ for a subdatum $(H',X_{H'})\subset(H,X_H)$, or its Galois closure); $F^c$ contains the Galois closure of $E(H,X_H)$, hence $L_V$ \cite[proof of Prop.~2.14]{UY}. Assume $\QRH(\delta;L_V)$. Then: \begin{enumerate}[(i)] \item $\deg_{\Lb_{K_H}}\bigl(\Gal(\Qbar/F)\cdot V_H\bigr)\ge\Omega_V$, and hence $\deg\bigl(\Gal(\Qbar/F)\cdot V\bigr)\ge\Omega_V$ in $\Sh_K(G,X)$; \item if $Y\subset V_H$ is closed, geometrically irreducible and defined over $\Qbar$, $K^m_H:=K^m_TK_H$, $\pi\colon\Sh_{K_H}(H,X_H)\to\Sh_{K^m_H}(H,X_H)$ is the natural map, $\Theta_A\subset K^m_T/K_T$ is the image of $x\mapsto x^A$, with $A$ the integer of \cite[Prop.~2.9]{UY} (\cref{tab:constants}), and $\Theta_A\cdot Y\subset\Gal(\Qbar/F)\cdot Y\cap\pi^{-1}\pi(Y)$, then $\deg_{\Lb_{K_H}}\bigl(\Gal(\Qbar/F)\cdot Y\bigr)\ge\Omega_V$. \end{enumerate} The same bounds hold for the orbits under any Galois group containing $\Gal(\Qbar/F)$. \end{corollary} \begin{proof} We first take $F=F_V$, the Galois closure of $E(H,X_H)$. The first bound of (i) is then \cite[Thm.~2.19, (6)]{UY} (which is \cite[Thm.~2.4.4]{KY}) with GRH replaced by $\QRH(\delta;L_V)$, and with $d_{L_V}^\mu$ in place of $(\log d_{L_V})^N$. In its proof GRH is used only in \cite[Prop.~2.13]{UY} (see \cite[pp.~30 and 33]{UY}), which bounds $|\mathrm{Im}_L|$ from below for $L=L_V$; this bound enters the proof of \cite[Thm.~2.19]{UY} only as a factor, the number of Galois conjugates in \cite[Prop.~2.14]{UY}. We replace it by \cref{prop:C}. The image of $r_{(H^\ab,\bar x)}((\Af\otimes F_V)^\times)=r_L(N_{F_V/L}((\Af\otimes F_V)^\times))$ has index at most $[F_V:L]\le R_G$ in $\mathrm{Im}_L$, because $r_L$ maps $L^\times$ into $H^\ab(\Q)$ and the unit ideles into $K^m_{H^\ab}$, so factors through an idele class group of $L$, where the norm from $F_V$ has image of index at most $[F_V:L]$ by class field theory. So the number of conjugates in \cite[Prop.~2.14]{UY} is at least $c_*(\delta)d_L^\mu/R_G$. By \cite[Remark~2.20]{UY} the constant of \cite[Thm.~2.19]{UY} is that of Prop.~2.14 divided by $a\,(a!)^{r_U}$, and the factor $\alpha_V$ comes from \cite[Lemmas~2.15--2.18]{UY}, which use no GRH. This gives (6) of \cite[Thm.~2.19]{UY}, which is the first bound of (i); the second follows from the first by \cite[Lemma~2.2]{UY} and \cite[Cor.~5.3.10]{KY}, as $Z(H)(\R)$ is compact. Form (7) of \cite[Thm.~2.19]{UY} is proved in the same way for $Y$ in place of $V_H$ \cite[pp.~29--31]{UY}, at the auxiliary levels $K'_H\subset K^{m'}_H$ of \cite[pp.~21--22]{UY}, for components $V'$ and $Y'$ over $V_H$ and $Y$ and the map $\pi'\colon\Sh_{K'_H}(H,X_H)\to\Sh_{K^{m'}_H}(H,X_H)$ \cite[Lemma~2.11]{UY}. By \cite[Lemma~2.12]{UY} the degree of the Galois orbit of $Y'$ is at least the degree of its part in the fibre $\pi'^{-1}\pi'(Y')$ times the number of Galois conjugates of $\pi'(Y')$. GRH enters only in this number, through \cite[Prop.~2.14]{UY}, whose assertion for $Y'$ follows from that for $V'$ because the Galois conjugates of $\pi'(V')$ are disjoint. For general $F$ we run this argument over $F$ itself: \cite[(5) and Lemmas~2.12, 2.16--2.18]{UY} use only that the map $\Sh_{K'_H}(H,X_H)\to\Sh_{K_H}(H,X_H)$, $\pi$ and $\pi'$ are defined over $F$, and the hypothesis on $\Theta_A$ is used with $F$; the remaining factor, the number of $\Gal(\Qbar/F)$-conjugates of $\pi'(Y')$, is at least the number of $\Gal(\Qbar/F^c)$-conjugates, which the argument above bounds with $F^c\supset L_V$ in place of $F_V$ and index at most $[F^c:L_V]\le R_G$. This is (ii). For (i), $\Gal(\Qbar/F)\cdot V_H\supset\Gal(\Qbar/F^c)\cdot V_H$, and the argument above applies verbatim to $F^c$. \end{proof} This is the form of \cite[Thm.~6.1]{UY15}. Klingler and Yafaev use the weaker form $C(N)\alpha_V(\log d_{L_V})^N$, which follows from it since $d_{L_V}^\mu\ge(\mu\log d_{L_V})^N/N!$; the Hecke step below uses $\Omega_V$ itself, which is what makes the bounds of \cref{thm:adjoint} at most a power of $D$ for fixed $d$ (\cref{rem:size}). \section{Point separation by the Baily--Borel bundle}\label{sec:e0} The Bézout inequality of \cref{lem:bezout} needs one exponent $e$ for which the complete linear system of $\Lb_K^{\otimes e}$ on the Baily--Borel compactification is base-point free and separates points; very ampleness is not needed. This section gives such an exponent for every Shimura variety, depending only on the dimension. \begin{proof}[Proof of \cref{thm:e0}] \emph{Reduction to one component.} $\overline{\Sh}_K(G,X)$ is the disjoint union of the Baily--Borel compactifications of its connected components $\Gamma_i\backslash X^+$, with $\Gamma_i$ neat arithmetic (\cref{sec:shimura}). Sections over a disjoint union are tuples of sections, so it suffices to prove base-point freeness and separation of points on one component $Y:=\overline{\Gamma\backslash X^+}$, with interior $Y^\circ=\Gamma\backslash X^+$: two points on different components are then separated by a section vanishing on one component and not at the given point of the other. \emph{$Y$ is a log canonical pair with log canonical bundle $\Lb_K|_Y$.} Let $\pi\colon\widetilde Y\to Y$ be a smooth toroidal compactification of $Y^\circ$ with reduced normal crossings boundary $\partial\widetilde Y$, which exists as $\Gamma$ is neat \cite{AMRT}; $\pi$ is an isomorphism over $Y^\circ$. That $Y$ with its boundary is log canonical is known \cite[Thm.~3.2 and Cor.~3.3]{Alexeev}; we recall the argument, which also identifies the bundle. By Mumford's description of the canonical extensions \cite[Prop.~3.4(a), (b)]{Mumford77}, the extension of the cotangent bundle is $\Omega^1_{\widetilde Y}(\log\partial\widetilde Y)$ and the extension of the canonical bundle is the pull-back of an ample bundle $\mathcal O_Y(1)$ on $Y$, whose high powers give the Baily--Borel embedding; taking top exterior powers, \[ K_{\widetilde Y}+\partial\widetilde Y\cong\pi^*\mathcal O_Y(1). \] The bundles $\mathcal O_Y(1)$ and $\Lb_K|_Y$ agree on $Y^\circ$ and at the generic point of each boundary divisor of $Y$ (both are given there by forms with logarithmic poles \cite[Prop.~5.3.2(1)]{KY}), so they are isomorphic on the normal variety $Y$. Let $\Delta:=\pi_*\partial\widetilde Y$, the reduced sum of the boundary divisors of $Y$ ($\Delta=0$ if the boundary has codimension at least $2$). Then $K_Y+\Delta=\pi_*(K_{\widetilde Y}+\partial\widetilde Y)$ is linearly equivalent to $\Lb_K|_Y$, hence Cartier, and $K_{\widetilde Y}+\partial\widetilde Y-\pi^*(K_Y+\Delta)$ is a principal divisor with zero push-forward, hence zero, since a rational function with trivial divisor on the normal $Y$ is a unit. So $K_{\widetilde Y}+\partial\widetilde Y=\pi^*(K_Y+\Delta)$. The pair $(\widetilde Y,\partial\widetilde Y)$ is log canonical \cite[Cor.~3.12]{Kollar}, and therefore so is $(Y,\Delta)$ \cite[Lemma~3.10]{Kollar}. \emph{Angehrn--Siu.} Let $e\ge e^*(n)$ and $\sigma(n):=\sum_{k=1}^nk\,2^{1/k}$. Then $\Lb_K^{\otimes e}|_Y\equiv K_Y+\Delta+N$ with $N:=(e-1)\Lb_K|_Y$ ample. For every irreducible $W\subset Y$ of dimension $k\ge1$, $(N^k\cdot W)=(e-1)^k\deg_{\Lb_K}W\ge(e-1)^k>\sigma(n)^k$, as $\deg_{\Lb_K}W$ is a positive integer and $e-1\ge\lfloor\sigma(n)\rfloor+1$. With the constant choice $c(k):=\sigma(n)$ we have $\sum_{k\le n}2^{1/k}k/c(k)=1$ and $\sum_{k\le n}k/c(k)\le1$. Fujino's theorems \cite[Thms.~1.1 and 1.2]{Fujino} now give, for every point of $Y$, a section of $\Lb_K^{\otimes e}|_Y$ not vanishing there, and, for every two points, sections separating them. Finally $k\,2^{1/k}\le k+1$ because $(1+1/k)^k\ge2$, so $\sigma(n)\le n(n+3)/2$. \end{proof} The values are $e^*(1)=4$, $e^*(2)=6$, $e^*(3)=10$. The bound depends only on $n$, and in particular not on the level, which is what the uniform Bézout step needs. In the compact case $\Delta=0$ and $\Lb_K$ is the canonical bundle, and \cref{thm:e0} is an Angehrn--Siu bound for it. Fujino's theorem gives separation of points, not of tangent vectors, and \cref{lem:bezout} shows that this is all we need. \section{Bézout's inequality uniformly in the level}\label{sec:bezout} In this section $(G,X)$ is a Shimura datum and $K\subset G(\Af)$ a neat compact open subgroup. The Hecke step works on Shimura varieties of subdata at levels that vary with a prime. \subsection{Why constant one fails} \begin{example}\label{ex:bezout} Let $C$ be a hyperelliptic curve of genus $g\ge2$ with hyperelliptic involution $\iota$, let $p\in C$, and let $\Lb:=\mathcal O(p)\boxtimes\mathcal O(p)$ on $C\times C$, an ample line bundle. The diagonal $\Delta_C$ and the graph $\Gamma_\iota$ of $\iota$ both have $\Lb$-degree $2$, but $\Delta_C\cap\Gamma_\iota$ consists of the $2g+2$ fixed points of $\iota$. So $\deg(V\cap W)\le\deg V\cdot\deg W$ fails for an ample bundle; \cite[Example~8.4.6]{Fulton}, cited for this inequality in \cite[(9.5)]{KY}, is a statement about subvarieties of projective space, that is, for a very ample bundle. \end{example} \subsection{The inequality at every neat level} \begin{lemma}\label{lem:bezout} \begin{enumerate}[(a)] \item Let $A,B\subset\PP^N_\C$ be closed; the degree of a closed set is the sum of the degrees of its irreducible components, and $\Irr$ denotes the set of irreducible components, of all dimensions. Then $\sum_{C\in\Irr(A\cap B)}\deg C\le\deg A\cdot\deg B$. \item Let $(H,X_H)$ be a Shimura datum, $J\subset H(\Af)$ a neat compact open subgroup, $n_J:=\dim\Sh_J(H,X_H)$ and $e\ge e^*(n_J)$ an integer. For closed $A,B\subset\overline{\Sh}_J(H,X_H)$, of dimensions $a$ and $b$ (maxima over components), \[ \sum_{C\in\Irr(A\cap B)}\deg_{\Lb_J}C\ \le\ e^{a+b}\deg_{\Lb_J}A\cdot\deg_{\Lb_J}B. \] The same holds for closed $A,B\subset\Sh_J(H,X_H)_\C$, with degrees of closures and $C$ running over $\Irr(A\cap B)$. \item In particular, if $(H,X_H)$ is a Shimura subdatum of $(G,X)$ and $n:=\dim\Sh_K(G,X)$, then (b) holds with $e:=e^*(n)$ at every neat $J\subset H(\Af)$, so with the constant $c_B:=e^*(n)^{2n}$, which does not depend on $(H,X_H)$ or $J$. \end{enumerate} \end{lemma} \begin{proof} (a) is \cite[Cor.~2, pp.~98--99]{FultonLazarsfeld} for irreducible $A$, $B$; in general each component of $A\cap B$ is a component of some $A_i\cap B_j$, and we sum over pairs of components. (b) By \cref{thm:e0} for $(H,X_H)$ and $J$, the complete linear system $|\Lb_J^{\otimes e}|$ is base-point free and separates points of $\overline{\Sh}_J$. It defines $\varphi\colon\overline{\Sh}_J\to\PP^N$ with $\varphi^*\mathcal O(1)\cong\Lb_J^{\otimes e}$; $\varphi$ is finite, since $\Lb_J$ is ample and so $\varphi$ contracts no curve, and injective. A finite injective morphism is a homeomorphism onto its closed image, so $\varphi$ maps $\Irr(A\cap B)$ bijectively onto $\Irr(\varphi(A)\cap\varphi(B))$, and $\varphi(A\cap B)=\varphi(A)\cap\varphi(B)$. In characteristic $0$, $\varphi$ restricted to an irreducible closed $Y$ is birational onto $\varphi(Y)$, so the projection formula gives $\deg\varphi(Y)=\deg_{\Lb_J^{\otimes e}}Y=e^{\dim Y}\deg_{\Lb_J}Y$. By (a), \begin{multline*} \sum_C\deg_{\Lb_J}C\le\sum_Ce^{\dim C}\deg_{\Lb_J}C=\sum_C\deg\varphi(C)\\ \le\deg\varphi(A)\cdot\deg\varphi(B)\le e^{a+b}\deg_{\Lb_J}A\cdot\deg_{\Lb_J}B, \end{multline*} using $e\ge1$ and, for reducible $A$, $B$, the sum over pairs of components. For $A$, $B$ in the open part, the components of $\overline A\cap\overline B$ that meet $\Sh_J$ are the closures of the components of $A\cap B$, and the others only add to the left side. (c) A neat $J\subset H(\Af)$ gives $n_J\le n$, so $e^*(n)\ge e^*(n_J)$, and $a,b\le n_J\le n$. \end{proof} \needspace{4\baselineskip} \begin{lemma}\label{lem:H} \begin{enumerate}[(a)] \item Let $(H,X_H)$ be a Shimura datum, $I\subset H(\Af)$ neat compact open, $m\in H(\Q_l)$, $I_m:=I\cap mIm^{-1}$, and $T_m:=\pi_2\circ\pi_1^{-1}$ on $\Sh_I(H,X_H)$, with $\pi_1$ natural and $\pi_2$ induced by $m$. Then $\overline\pi_1^{\,*}\Lb_I\cong\Lb_{I_m}\cong\overline\pi_2^{\,*}\Lb_I$, and $\deg_{\Lb_I}T_mY\le[I:I_m]\deg_{\Lb_I}Y$ for every closed $Y$. \item If $(H,X_H)\subset(G,X)$, $K_H:=K\cap H(\Af)$ and $t\in Z(H)(\Af)$, then $\theta_t\colon[x,h]\mapsto[x,ht]$ satisfies $\overline\theta_t^{\,*}\Lb_{K_H}\cong\Lb_{K_H}$. \end{enumerate} \end{lemma} \begin{proof} \cite[Prop.~5.3.2(1)]{KY} (\cref{sec:shimura}) for the morphisms induced by $1$, by $m$ and by $t$; then the projection formula, $\pi_1$ being finite étale of degree at most $[I:I_m]$. \end{proof} \section{The Hecke step with constants uniform in the level}\label{sec:hecke} Under $\QRH(\delta;L_V)$, a special subvariety $V\subset Z$ that is not strongly special lies in a larger special subvariety of $Z$ once $\Omega_V$ exceeds an explicit bound in terms of $\deg Z$, the degree of the field of definition of $Z$, $\log d_{L_V}$ and $\log\alpha_V$ (\cref{thm:H}); for maximal $V$ the inequality fails, which bounds $\alpha_Vd_{L_V}^\mu$ (\cref{lem:solve}). The argument is that of \cite[\S9]{KY}, with constants uniform in the level of the Hecke correspondence and with Galois groups over the field of definition of $Z$: a criterion (\cref{thm:hecke-uniform}), then a prime that meets it (\cref{prop:B}). In this section $G$ is adjoint and $K$ satisfies (Lv), and we put $n:=\dim\Sh_K(G,X)$ and $c_B:=e^*(n)^{2n}$ (\cref{lem:bezout}(c)). Let $(P,X_P)\subset(G,X)$ be a Shimura subdatum, $K_P:=K\cap P(\Af)$, $F\supset E(P,X_P)$ a number field and $\bar d\ge1$ an integer. For a special subvariety $V$ put $E_V:=E(H_V,X_{H_V})$; a special subvariety $V$ of $\Sh_{K_P}(P,X_P)_\C$ and its image in $\Sh_K(G,X)_\C$, which is special, have the same $\alpha_V$, $\beta_V$ and reflex field $E_V$ \cite[Remark~9.1.1]{KY}. All degrees on $\Sh_J(P,X_P)$ are taken for its own Baily--Borel bundle $\Lb_J$. Put $k_F:=k_1\bar d+f$ and, for $D'\ge1$ and a prime $l$, \[ \Psi(D'):=c_B\,D'^{\,2},\qquad \Psi_l(D'):=l^{k_F+2f}\,\Psi(D')=c_B\,l^{k_F+2f}D'^{\,2}. \] \subsection{The criterion} \begin{theorem}\label{thm:hecke-uniform} Let $G$ be adjoint and $K$ satisfy \textup{(Lv)}, and let $(P,X_P)$ and $F$ be as above. Let $Z\subset\Sh_{K_P}(P,X_P)_\C$ be Hodge generic and $F$-irreducible, $D_Z:=\deg_{\Lb_{K_P}}Z$, and $V\subset Z$ special with $r:=\dim Z-\dim V>0$. Let $\bar d\ge[FE_V:E_V]$ be an integer and assume $\QRH(\delta;L_V)$. Suppose that \begin{enumerate}[(1)] \item $V$ is not strongly special in $\Sh_{K_P}(P,X_P)_\C$, and \item there is a prime $l>C_0$ that splits completely in $L_V$, with $l>1/c_U$ and $K_{T_V,l}=K^m_{T_V,l}$ (then the Zariski closure of $T_V$ in $\mathrm{GL}_{n_\rho,\Z_l}$ is a torus, by \cite[Lemma~3.3.1 and \S4.4]{EY} applied to the split torus model of $T_{V,\Q_l}$ and the lattice $\Z_l^{n_\rho}$, so $(T_V)_{\F_l}$ is a torus, as \cite[Thm.~8.1]{KY} requires), such that \begin{equation}\label{eq:criterion} \bigl(c_B\,l^{k_F+2f}\,\bar d\,D_Z\bigr)^{2^r}\ <\ \Omega_V. \end{equation} \end{enumerate} Then $Z$ contains a special subvariety $V'$ with $V\subsetneq V'$, in a geometric component of $Z$ containing $V$. \end{theorem} \begin{remark}\label{rem:converse} The condition $l>1/c_U$ in (2) is needed for the torus: a split torus whose level is maximal need not have a torus as its closure. Let $\Gm$ act on $\Q^3$ by $t\mapsto\mathrm{diag}(1,t^2,t)$ with the lattice $\Lambda_0:=\Z(e_1+e_2)+3\Z e_2+\Z e_3$. In the basis $e_1+e_2,3e_2,e_3$ of $\Lambda_0$, $t$ sends $e_1+e_2$ to $(e_1+e_2)+\frac{t^2-1}3\,3e_2$, so $\Gm(\Q_3)\cap\mathrm{GL}(\Lambda_0\otimes\Z_3)=\Z_3^\times$ is maximal, while the closure is $\operatorname{Spec}\Z_3[t^{\pm1},(t^2-1)/3]$, whose special fibre is $\Z/2\times\mathbb G_{\mathrm a}$. So the converse stated in the proof of \cite[Lemma~3.17]{UY} (p.~43: if $K_{\Lambda,p}=K^m_{\Lambda,p}$ is hyperspecial, then $\Lambda_{\Z_p}$ is a torus) holds once $p-1>C_\Phi$, by the argument of \cite[\S4.4]{EY}, but not for all $p$: here the analogue of $C_\Phi$ is $2$ and $p=3$, and $1/c_U=4>3$. The statement of \cite[Lemma~3.17]{UY} holds, with $\alpha^{-1}\Z_p^{n_\rho}$ taken to be a lattice fixed by the torus over $\Z_p$ with generic fibre $T_{\Q_p}$ \cite[Lemma~3.3.1 and its proof]{EY}. The proofs of \cite[Lemma~3.17 and Prop.~3.15]{UY} assume $p$ unramified in the field $F_T\supset L_T$ of \cite[p.~42]{UY}, and that of \cite[Prop.~3.15]{UY} uses the torus $\mathrm{Res}_{F_T/\Q}\Gm$ over $\Z_p$, while \cite[Prop.~3.15]{UY} assumes only $p$ unramified in $L_T$; we use it at every $p>C_0$ unramified in $L_V$, and there it follows from \cite[\S4.4]{EY} directly, with our $c_U$. Indeed, with $T=T_V$, as $p$ is unramified in $L_T$, $T_{\Q_p}$ is the generic fibre of a torus $\mathcal T$ over $\Z_p$ \cite[\S3.3]{EY}, and $\mathcal T(\Z_p)=K^m_{T,p}$, as a compact subgroup of $T(\Q_p)$ lies in $\mathcal T(\mathcal O_{\mathsf k})\cap T(\Q_p)=\mathcal T(\Z_p)$ for an unramified splitting field $\mathsf k$, and if $K_p=G(\Q_p)\cap\mathrm{GL}_{n_\rho}(\Z_p)$ then $K_{T,p}$ is the stabilizer of $W:=\Z_p^{n_\rho}$ in $\mathcal T(\Z_p)$, so $|K^m_{T,p}/K_{T,p}|=|\mathcal T(\Z_p)\cdot W|$, and $\mathcal T$ does not fix $W$ if $K_{T,p}\ne K^m_{T,p}$. The argument of \cite[\S4.4]{EY} gives $|\mathcal T(\Z_p)\cdot W|\ge(p-1)/|\Phi|$, where $\Phi$ is the group of components of the stabilizer in $\mathcal T_{\overline{\F}_p}$ of a subspace; if the subspace has dimension $d$, the stabilizer is $\bigcap\ker(x-x')$ over the weights $x,x'$ in the support of one vector of its $d$-th exterior power, which are weights of $T$ under $X^*(\mathcal T_{\overline{\F}_p})=X^*(T_{\Qbar_p})$ \cite[proof of Lemma~4.4.1]{EY}; so $|\Phi|$ is at most the order of the torsion of $X^*(T)/N$, with $N$ the subgroup generated by these differences. As the map $r_T^*\colon X^*(T)\to X^*(\mathrm{Res}_{F_T/\Q}\Gm)$ dual to the surjection $r_T$ of \cite[p.~42]{UY} is injective, $X^*(T)/N$ embeds in $X^*(\mathrm{Res}_{F_T/\Q}\Gm)/r_T^*N$, whose torsion has order at most $C_\Phi$. So $|K^m_{T,p}/K_{T,p}|\ge(p-1)/C_\Phi\ge c_Up$. The CM elliptic curve with endomorphism ring $\Z[\sqrt{-7}]$ gives the same phenomenon at $l=2$ inside $(\mathrm{GL}_2,\mathcal H^\pm)$. \end{remark} Compared with \cite[(9.1)]{KY}, which reads $l^{(k+2f)2^r}(\deg Z)^{2^r}\ \Psi_l^{\circ r}(\bar dD_Z), \end{equation} the form the proof uses; also $\bar d\,\Psi_l(D')\le\Psi_l(\bar dD')$ and $\Psi_l(x)\ge x$ for $x\ge1$. The proof follows that of \cite[Thm.~9.2.1]{KY}, except that the Galois groups are those over $F$, which need not lie in $E_V$, at the cost of the factor $\bar d$ (Step~1, \cref{lem:LB}); the Galois lower bound is that of \cref{cor:D}; Bézout's inequality, at \cite[(9.5)]{KY} and in \cite[Sublemma~9.2.5]{KY}, has the constant of \cref{lem:bezout}; in Step~3, as $P$ need not be adjoint, the proof of \cite[Thm.~7.2.1]{KY} is run on the image of $\widetilde Z$ in $\Sh_{I^\ad}(P^\ad,X_P^\ad)$; and $\widetilde Y_H$ is chosen so as to be Hodge generic of dimension $\dim\widetilde Y$ (\cref{lem:descent}). Step~1 of the proof of \cref{thm:hecke-uniform} follows \cite[\S8.3.2]{KY}, which rests on \cite[Lemma~8.1.6]{KY}. The proof of (a) there takes the point fixed by a maximal compact subgroup to lie in the apartment of a maximal split torus chosen in advance; this can fail for small $l$ \cite[2.1 and 3.6.1]{TitsCorvallis} (for $\mathrm{SL}_2$ over $\Q_3$ and the diagonal torus $T$, $T(\Z_3)$ fixes every vertex adjacent to the apartment of $T$). The proof of (b) reduces to a hyperspecial subgroup \cite[3.8.2]{TitsCorvallis}, which $P(\Q_l)$ need not have, as (2) does not make $P$ unramified at $l$. The following lemma gives what Step~1 uses. For a connected reductive $\Q_l$-group $H$ we write $\mathcal B(H)$ for its extended Bruhat--Tits building \cite[1.2 and 2.1]{TitsCorvallis} and $H(\Q_l)^\Omega$ for the fixer of $\Omega\subset\mathcal B(H)$ in $H(\Q_l)$; as in \cite[\S8.1.1 and Remark~8.1.1]{KY}, the fixers of chambers are called Iwahori subgroups. \begin{lemma}\label{lem:KY816} Let $l$ be a prime and $H$ a connected reductive $\Q_l$-group, and put $d:=\dim H$. \begin{enumerate}[(a)] \item Let $T\subset H$ be a split torus such that no nonzero weight of $T$ on $\Lie H$ lies in $(l-1)X^*(T)$, and let $\Theta\subset T(\Q_l)$ be the subgroup of elements of order dividing $l-1$. Then every point of $\mathcal B(H)$ fixed by $\Theta$ lies in the apartment of a maximal split torus $S\supset T$ of $H$, and the maximal compact subgroup of $S(\Q_l)$ fixes that apartment pointwise. \item If a point $y\in\mathcal B(H)$ lies in the closure of a chamber $C$, then $[H(\Q_l)^y:H(\Q_l)^C]\le l^{d(d+1)/2}$. \item Let $(P,X_P)$, $V$ and $l$ be as in \cref{thm:hecke-uniform}, with \textup{(2)}, and $K_{P,l}:=K_l\cap P(\Q_l)$. Every maximal compact subgroup $K^1_l\supset K_{P,l}$ of $P(\Q_l)$ is $P(\Q_l)^y$ for a point $y$ of the apartment of a maximal split torus $S\supset T_{V,\Q_l}$ of $P_{\Q_l}$. Let $C^1$ be a chamber of this apartment with $y$ in its closure, $x_0$ a special vertex in the closure of $C^1$, and $C^2$ a chamber of the apartment with $x_0$ in its closure. Then $I^1_l:=P(\Q_l)^{C^1}\subset K^1_l$ and $I^2_l:=P(\Q_l)^{C^2}$ are in good position with respect to $S$, $I_l:=I^1_l\cap I^2_l\cap K_{P,l}$ is in good position with respect to $T_V$, and $[K_{P,l}:I_l]0$, and $\lambda(t)u\lambda(t)^{-1}\to1$ as $t\to0$ for $u\in U(\Q_l)$; and $Z_H(\lambda)=Z_H(T)=:L$, as $Z_H(T)\subset Z_H(\lambda)$ and both are connected with Lie algebra $(\Lie H)_0$, by the choice of $\lambda$. Let $D\subset X_*(S)\otimes\R$ be a vector chamber whose closure contains $\lambda$, and $U_D$ the group generated by the root groups $U_a(\Q_l)$ with $a$ positive on $D$ \cite[3.3]{TitsCorvallis}; $\lambda$ has weights $\ge0$ on their Lie algebras, so $U_D\subset P_H(\lambda)(\Q_l)=U(\Q_l)L(\Q_l)$. The Iwasawa decomposition $H(\Q_l)=U_D\,N_H(S)(\Q_l)\,P_{x}$, for $x\in\mathcal A(S)$ and $P_x$ its stabilizer \cite[Cor.~7.3.2(i)]{BT1}, which applies to $H(\Q_l)$ by \cite[Thm.~5.1.20]{BT2}, gives $\mathcal B(H)=U_D\cdot\mathcal A(S)$; so $y=uu_2\cdot x$ with $u\in U(\Q_l)$, $u_2\in L(\Q_l)$ and $x\in\mathcal A(S)$. The point $z:=u_2\cdot x$ lies in $\mathcal A(u_2Su_2^{-1})$ and $u_2Su_2^{-1}\supset T$, so $\Theta$ fixes $z$; it remains to show $u\cdot z=z$. The group $U_z:=U(\Q_l)\cap H(\Q_l)^z$ is compact open in $U(\Q_l)$ and normalized by $\Theta$. For $n$ large, $\lambda(l)^nu\lambda(l)^{-n}\in U_z$, so $u$ lies in the compact subgroup $\Gamma:=\lambda(l)^{-n}U_z\lambda(l)^n$, which $\Theta$ normalizes, as it commutes with $\lambda(l)$. Compact subgroups of $U(\Q_l)$ are pro-$l$, as $U$ has a composition series with quotients $\mathbb G_{\mathrm a}$. For $\theta\in\Theta$ put $c_\theta:=u^{-1}\theta u\theta^{-1}\in\Gamma$; as $\theta u\theta^{-1}\cdot z=\theta\cdot y=y=u\cdot z$, $c_\theta$ lies in the pro-$l$ group $\Delta:=\Gamma\cap U_z$, and $\theta\mapsto c_\theta$ is a $1$-cocycle of $\Theta$ in $\Delta$. As $|\Theta|$ is prime to $l$, it is a coboundary (by the Schur--Zassenhaus theorem on the finite quotients of $\Delta$ by its open normal $\Theta$-stable subgroups, and compactness): $c_\theta=u'^{-1}\theta u'\theta^{-1}$ for some $u'\in\Delta$ and all $\theta\in\Theta$. Then $v:=uu'^{-1}\in U(\Q_l)$ commutes with $\Theta$. The torus $T$ is split, so $\Theta=\mathrm{Hom}(X^*(T),\mu_{l-1})$, and $\Theta$ acts on each $(\Lie H)_\beta\subset\Lie U$ through $\beta|_\Theta\ne1$, as $\beta\notin(l-1)X^*(T)$; so $(\Lie U)^\Theta=0$, and since $\log\colon U\to\Lie U$ is a $T$-equivariant isomorphism, $v=1$. Hence $u=u'\in U_z$, and $y=u\cdot z=z\in\mathcal A(u_2Su_2^{-1})$. (b) Let $S$ be a maximal split torus whose apartment contains $C$, hence $y$; put $B:=H(\Q_l)^C\subset H(\Q_l)^y$, and let $\widetilde W$ be the group of affine transformations of $\mathcal A(S)$ induced by $N_H(S)(\Q_l)$ \cite[1.2]{TitsCorvallis}, and $q_w:=|BwB/B|$ for $w\in\widetilde W$ \cite[3.3.1]{TitsCorvallis}. By the Bruhat decomposition \cite[3.3.1]{TitsCorvallis}, $H(\Q_l)^y$ is the disjoint union of the $BwB$ with $w$ in the stabilizer $\widetilde W_y$ of $y$ in $\widetilde W$ (as $B\subset H(\Q_l)^y$, and $n\in N_H(S)(\Q_l)$ fixes $y$ if and only if its image in $\widetilde W$ does), so $[H(\Q_l)^y:B]=\sum_{w\in\widetilde W_y}q_w$. An element of $\widetilde W_y$ with trivial image in the finite Weyl group $W_0:=N_H(S)(\Q_l)/Z_H(S)(\Q_l)$ is a translation fixing $y$, hence trivial; so $|\widetilde W_y|\le|W_0|\le2^N$, where $N$ is the number of reflections of $W_0$ (a Weyl chamber is determined by its signs on the $N$ reflecting hyperplanes), and $2N\le d$, as $\Lie H$ contains the nonzero root spaces of $2N$ distinct roots $\pm a$, one pair for each reflecting hyperplane. For $w\in\widetilde W_y$ write $w=r_1\cdots r_j\omega$ with $\omega C=C$ and $r_1\cdots r_j$ reduced, as in \cite[3.3.1]{TitsCorvallis}, so that $q_w=l^{d(v_1)+\dots+d(v_j)}$ and $j$ is the number of walls separating $C$ from $wC$. Each of these walls contains $y$, which lies in the closures of $C$ and of $wC$, and distinct walls through $y$ have distinct directions, which are kernels of roots; so $j\le N$. Each $d(v_i)$ is the dimension of a homogeneous variety of the special fibre of a smooth model of $H$ \cite[3.5.4 and the paragraph after it]{TitsCorvallis}, so $d(v_i)\le d$. Hence $[H(\Q_l)^y:B]\le2^Nl^{Nd}\le l^{N(d+1)}\le l^{d(d+1)/2}$. (c) By \cite[3.2]{TitsCorvallis}, $K^1_l=P(\Q_l)^y$ for a point $y$. A nonzero weight of $T_V$ on $\Lie P\subset\mathfrak{gl}_{n_\rho}$ is $\chi-\chi'$ for weights $\chi,\chi'$ of $T_V$ in $\rho$, and does not lie in $(l-1)X^*(T_V)$: otherwise the group of components of $\ker(\chi-\chi')$, which is the stabilizer in $T_V$ of the line through $v_\chi+v_{\chi'}$ for weight vectors $v_\chi$, $v_{\chi'}$ \cite[proof of Lemma~4.4.1]{EY}, would have order divisible by $l-1$, over $\Qbar$ as over $\overline{\F}_l$, whereas these orders are at most $C_\Phi$ (\cref{sec:constants} and \cref{rem:converse}) and $l-1>2C_\Phi-1\ge C_\Phi$ by (2), as $c_U=1/(2C_\Phi)$ and $C_\Phi\ge1$. The torus $T_{V,\Q_l}$ is split, as $l$ splits completely in $L_V$, and its elements of order dividing $l-1$ lie in $K^m_{T_V,l}=K_{T_V,l}=T_V(\Q_l)\cap K_l\subset K_{P,l}\subset K^1_l$, by (2) and \cref{sec:special}; so they fix $y$, and (a), with $H=P_{\Q_l}$ and $T=T_{V,\Q_l}$, gives $S$. The maximal compact subgroup of $S(\Q_l)$ fixes the apartment of $S$, so it lies in $I^1_l$ and $I^2_l$; it contains that of $T_V(\Q_l)$, which also lies in $K_{P,l}$. As $y$ and $x_0$ lie in the closure of $C^1$, and $x_0$ in that of $C^2$, we have $I^1_l\subset K^1_l$ and $I^1_l,I^2_l\subset P(\Q_l)^{x_0}$; so (b), applied to $(y,C^1)$ and $(x_0,C^2)$ with $d=\dim P\le\dim G$, gives \[ [K_{P,l}:I_l]\le[K^1_l:I^1_l\cap I^2_l]\le[K^1_l:I^1_l]\,[P(\Q_l)^{x_0}:I^2_l]\le l^{d(d+1)}0$. Let $\widetilde Y^{(1)}$ be a geometric component of $\widetilde Y$ containing $\widetilde V$, and $S_Y$ the smallest special subvariety of $\Sh_J(P,X_P)_\C$ containing $\widetilde Y^{(1)}$. It is the image of $X_H^+\times\{1\}$ for a Shimura subdatum $(H,X_H)\subset(P,X_P)$ with $H$ the generic Mumford--Tate group on $X_H$ and $X_H^+\subset X_P^+$ \cite[Lemma~2.1]{UY}. Put $K_H:=K_P\cap H(\Af)$, $J_H:=J\cap H(\Af)$ and $F_H:=E(H,X_H)$; then $F_H\subset E_V$, because a Hodge generic point of $\widetilde V$ lifts to $X_H^+$, so that $(H,X_H)$ contains a $P(\Q)$-conjugate of $(H_V,X_{H_V})$. Let $q$ denote the natural maps $\Sh_{J_H}(H,X_H)\to\Sh_J(P,X_P)$ and $\Sh_{K_H}(H,X_H)\to\Sh_{K_P}(P,X_P)$, and $\tau$ also the map $\Sh_{J_H}(H,X_H)\to\Sh_{K_H}(H,X_H)$; these maps are finite and defined over $F_H$, and $q\tau=\tau q$. Let $S_H$ be the image of $X_H^+\times\{1\}$ in $\Sh_{J_H}(H,X_H)_\C$, so that $q(S_H)=S_Y$. As $q$ is finite, some component $C_1$ of $q^{-1}(\widetilde Y^{(1)})\cap S_H$ maps onto $\widetilde Y^{(1)}$, and some component $\widetilde V_H$ of $q^{-1}(\widetilde V)\cap C_1$ maps onto $\widetilde V$; so $\dim C_1=\dim\widetilde Y$ and $\dim\widetilde V_H=\dim\widetilde V$. Let $\widetilde Y_H$ be the union of the $\Gal(\Qbar/FF_H)$-conjugates of $C_1$, and put $V_H:=\tau(\widetilde V_H)$ and $Y_H:=\tau(\widetilde Y_H)\subset\Sh_{K_H}(H,X_H)_\C$. \needspace{4\baselineskip} \begin{lemma}\label{lem:descent} In this situation $Y_H$ is $FF_H$-irreducible and Hodge generic, $q(V_H)=V$ and $V_H$ has torus $T_V$, and $\dim Y_H-\dim V_H=r_Y$ \cite[pp.~48--49]{KY}. Moreover: \begin{enumerate}[(a)] \item $\deg_{\Lb_{K_H}}Y_H\le\deg_{\Lb_J}\widetilde Y$; \item if $\Psi^{\circ r_Y}(\bar d\deg_{\Lb_{K_H}}Y_H)<\Omega_V$, then $V_H$ is not strongly special in $\Sh_{K_H}(H,X_H)_\C$; \item if $Y_H$ contains a special $V_H'\supsetneq V_H$, then $Z$ contains a special $V'\supsetneq V$ in a geometric component of $Z$ containing $V$. \end{enumerate} \end{lemma} \begin{proof} A special subvariety $S'\subsetneq S_H$ containing $C_1$ would give the special subvariety $q(S')\supset\widetilde Y^{(1)}$, of dimension less than $\dim S_Y$; so $C_1$ is Hodge generic in $\Sh_{J_H}(H,X_H)_\C$. Galois conjugates of special subvarieties are special \cite[proof of Lemma~7.1.2]{KY}, so every component $\sigma(C_1)$ of $\widetilde Y_H$ is Hodge generic, of dimension $\dim\widetilde Y$, and $\widetilde Y_H$ is closed and $FF_H$-irreducible. Hence $Y_H$ is closed, $FF_H$-irreducible and Hodge generic. As $\tau$ and $q$ are finite, $\dim Y_H-\dim V_H=\dim\widetilde Y-\dim\widetilde V=r_Y$. The irreducible closed set $\widetilde V_H$ has the dimension of $q^{-1}(\widetilde V)$, so it is a component of it, hence special, and so is $V_H$; and $q(V_H)=\tau(q(\widetilde V_H))=\tau(\widetilde V)=V$. As $V_H$ lies in the image of $X_H^+\times\{1\}$, it is the image of $X_{H''}^+\times\{1\}$ for a subdatum $(H'',X_{H''})\subset(H,X_H)$ with $H''$ the generic Mumford--Tate group on $X_{H''}$ and $X_{H''}^+\subset X_H^+$ \cite[Lemma~2.1]{UY}, and then so is $V=q(V_H)$ in $\Sh_{K_P}(P,X_P)_\C$. So $X_{H''}^+=\gamma X_{H_V}^+$ for some $\gamma\in P(\Q)_+\cap K_P$, and we may take $(H'',X_{H''})$ for $(H_V,X_{H_V})$ (\cref{sec:special}): $V_H$ and $V$ have the same torus $T_V$ and the same $K_{T_V}=T_V(\Af)\cap K$, hence the same $L_V$, $E_V$, $\alpha_V$ and $\Omega_V$ (compare \cite[Remark~9.1.1]{KY}). (a) Each geometric component of $Y_H$ is $\tau(C)$ for a component $C$ of $\widetilde Y_H$, and $\deg_{\Lb_{J_H}}C=\deg(\tau|_C)\deg_{\Lb_{K_H}}\tau(C)$ by the projection formula, so $\deg_{\Lb_{K_H}}Y_H\le\deg_{\Lb_{J_H}}\widetilde Y_H$. For a component $C=\sigma(C_1)$ of $\widetilde Y_H$, $q(C)=\sigma(\widetilde Y^{(1)})$ is a geometric component of $\widetilde Y$, because $q$ is defined over $F_H$ and $\widetilde Y$ over $F$. Distinct $C$ give distinct components, as $q$ is injective on the Hodge generic locus \cite[Lemma~2.2]{UY}, and $\deg_{\Lb_{J_H}}C\le\deg_{\Lb_J}q(C)$ \cite[Cor.~5.3.10]{KY}, as $Z(H)(\R)$ is compact. So $\deg_{\Lb_{J_H}}\widetilde Y_H\le\deg_{\Lb_J}\widetilde Y$. (c) $V':=q(V'_H)$ is special; it lies in $q(Y_H)=\tau(q(\widetilde Y_H))\subset\tau(\widetilde Y)\subset Z$ and contains $q(V_H)=V$; and $\dim V'=\dim V'_H>\dim V_H=\dim V$, as $q$ is finite. Being irreducible, $V'$ lies in a geometric component of $Z$, which contains $V$. (b) Suppose $V_H$ is strongly special in $\Sh_{K_H}(H,X_H)_\C$, that is, $T_V\subset Z(H)$. Then $T_V=Z(H)^\circ$ \cite[Lemma~6.2]{KY}. Put $K^m_H:=K^m_{T_V}K_H$ and let $\pi\colon\Sh_{K_H}(H,X_H)\to\Sh_{K^m_H}(H,X_H)$ be the natural map. The group $K^m_{T_V}/K_{T_V}$ acts on $\Sh_{K_H}(H,X_H)$ by the maps $\theta_t$ of \cref{lem:H}(b), which are defined over $F_H$ and so commute with $\Gal(\Qbar/E_V)$, and its orbits are the fibres of $\pi$. Let $\Theta_A\subset K^m_{T_V}/K_{T_V}$ be the group of \cref{cor:D}(ii). Then $\Theta_A\cdot V_H\subset\Gal(\Qbar/E_V)\cdot V_H$ \cite[Sublemma~9.2.4]{KY}. Write $\deg$ for $\deg_{\Lb_{K_H}}$ and $\mathcal Y:=\Gal(\Qbar/E_V)\cdot Y$ for geometrically irreducible $Y$; $\deg\theta\mathcal Y=\deg\mathcal Y$ by \cref{lem:H}(b), and $\Gal(\Qbar/E_V)$-conjugate subvarieties have equal degrees, as $\Lb_{K_H}$ is defined over $F_H\subset E_V$. Let $Y_1$ be a geometric component of $Y_H$ containing $V_H$. As $Y_H$ is defined over $FF_H\subset FE_V$, it contains $\Gal(\Qbar/FE_V)\cdot Y_1$, and $\mathcal Y_1$ is the union of at most $\bar d$ conjugates of this set; so $\deg\mathcal Y_1\le D_1:=\bar d\deg Y_H$. Suppose $Y_j$ is geometrically irreducible, $V_H\subset Y_j$, $\dim Y_j>\dim V_H$ and $\deg\mathcal Y_j\le D_j:=\Psi^{\circ(j-1)}(D_1)$. If $\Theta_A\cdot Y_j\subset\mathcal Y_j$, stop. Otherwise choose $\theta\in\Theta_A$ with $\theta Y_j\not\subset\mathcal Y_j$. The sets $\mathcal Y_j$ and $\theta\mathcal Y_j$ are of pure dimension $\dim Y_j$, and they have no common component: the components of $\theta\mathcal Y_j$ are the $\sigma\theta Y_j$, and $\sigma\theta Y_j=\sigma'Y_j$ would give $\theta Y_j\subset\mathcal Y_j$. Also $V_H\subset\mathcal Y_j\cap\theta\mathcal Y_j$: as $\Theta_A$ is a group, $\theta^{-1}V_H=\sigma V_H\subset\sigma Y_j$ for some $\sigma\in\Gal(\Qbar/E_V)$. Let $Y_{j+1}$ be a geometric component of $\mathcal Y_j\cap\theta\mathcal Y_j$ containing $V_H$. This set is $\Gal(\Qbar/E_V)$-stable, so the conjugates of $Y_{j+1}$ are among its components; $\dim Y_{j+1}<\dim Y_j$; and \cref{lem:bezout}(c) at the neat level $K_H$ gives \[ \deg\mathcal Y_{j+1}\le c_BD_j^2=D_{j+1}. \] The dimension drops at each step, so $j\le r_Y$ throughout, and $D_j\le D_{j+1}\le\Psi^{\circ r_Y}(D_1)<\Omega_V$, as $\Psi(x)\ge x$. If $Y_{j+1}=V_H$, then $\deg(\Gal(\Qbar/E_V)\cdot V_H)\le D_{j+1}<\Omega_V$, contradicting \cref{lem:LB} for $V_H$ at the level $K_H$. Otherwise we continue. So the process stops at some $Y'$ with $\Theta_A\cdot Y'\subset\Gal(\Qbar/E_V)\cdot Y'$ and $\deg(\Gal(\Qbar/E_V)\cdot Y')<\Omega_V$. As the orbits of $\Theta_A$ lie in the fibres of $\pi$, also $\Theta_A\cdot Y'\subset\pi^{-1}\pi(Y')$, and $Y'$ lies in the geometric component of $\Sh_{K_H}(H,X_H)_\C$ containing $V_H$; so \cref{cor:D}(ii), applied to this component, whose image has torus $Z(H)^\circ=T_V$ and hence the same $L_V$, $\alpha_V$ and $\Omega_V$, with $F=E_V\supset E(H,X_H)$ and $Y=Y'$, gives $\deg(\Gal(\Qbar/E_V)\cdot Y')\ge\Omega_V$: a contradiction. \end{proof} \begin{proof}[Proof of \cref{thm:hecke-uniform}] We prove the theorem with \eqref{eq:criterion-iterate} in place of \eqref{eq:criterion}, by induction on $r$, for all subdata $(P,X_P)$, fields $F$, and $Z$, $V$, $\bar d$ and $l$ at once. Recall that $V$ is the image of $X_{H_V}^+\times\{1\}$ with $X_{H_V}^+\subset X_P^+$ (\cref{sec:special}). \emph{Step 1 (the level $I$, the element $m$ and $\sigma$).} Put $K_{P,l}:=K_l\cap P(\Q_l)$. As $l>C_0$, $K_l=G(\Z_l)$ is hyperspecial; $l$ splits $T_V$; and $(T_V)_{\F_l}$ is a torus by (2). So $(P,X_P)$, $V$ and $l$ are as in \cite[Thm.~8.1]{KY}, whose proof \cite[\S8.3]{KY} we follow. By (1) the image of $T_V$ in $P^\ad$ is not trivial, and \cite[Prop.~7.4.3]{EY} gives $m_0\in T_V(\Q_l)$ whose image in $P^\ad(\Q_l)$ lies in no compact subgroup, with $[K_{P,l}:K_{P,l}\cap m_0^{Aj}K_{P,l}m_0^{-Aj}]\dim V$; being irreducible, $V'$ lies in a geometric component of $Z$, which contains $V$. \emph{Step 4 (the case $\widetilde Z\not\subset T_m\widetilde Z$).} As $T_m\widetilde Z$ is defined over $F$ and $\Gal(\Qbar/F)$ permutes the geometric components of $\widetilde Z$ transitively, no geometric component of $\widetilde Z$ lies in $T_m\widetilde Z$; so every component of $\widetilde Z\cap T_m\widetilde Z$ has dimension less than $\dim Z$. Suppose $\widetilde V$ is one of them, as it must be if $r=1$. Then so are its $\Gal(\Qbar/FE_V)$-conjugates, by Step~2, and \cref{lem:LB} at $J=I$ and \eqref{eq:cut} give $\Omega_V/\bar d\le\deg_{\Lb_I}(\Gal(\Qbar/FE_V)\cdot\widetilde V)\le\Psi_l(D_Z)$, against $\bar d\,\Psi_l(D_Z)\le\Psi_l(\bar dD_Z)\le\Psi_l^{\circ r}(\bar dD_Z)<\Omega_V$. So this case does not occur for $r=1$, and for $r\ge2$ a geometric component $\widetilde Y^{(1)}$ of $\widetilde Z\cap T_m\widetilde Z$ contains $\widetilde V$ properly. Let $\widetilde Y$ be the union of the $\Gal(\Qbar/F)$-conjugates of $\widetilde Y^{(1)}$, which are components of $\widetilde Z\cap T_m\widetilde Z$. It is closed and $F$-irreducible, $\tau(\widetilde Y)\subset Z$, $\deg_{\Lb_I}\widetilde Y\le\Psi_l(D_Z)$ by \eqref{eq:cut}, and $0C_0$ that splits completely in $L_V$ and has $K_{T_V,l}=K^m_{T_V,l}$. Moreover $l>x_V/4>1/c_U$. \end{proposition} \begin{proof} (1) As $T_V\ne1$, $\beta_V\ge\log3>1$ (\cref{sec:special}), and $[L_V:\Q]\le n_T$; so the first three terms of $x_V$ give the three conditions of \cref{lem:Aprime} at $x=x_V$ for $L=L_V$. Hence at least $x_V/(8n_T\log x_V)\ge\sqrt{x_V}/(8n_T)$ primes in $(x_V/4,x_V]$ split completely in $L_V$, as $x/\log x\ge\sqrt x$ for $x>1$. By the last term of $x_V$ there are at least $\max(e^2/B',\log\alpha_V)+2$ of them, and by the fourth they exceed $C_0$. (2) Let $i_V$ be the number of primes $p>C_0$, unramified in $L_V$, with $K^m_{T_V,p}\ne K_{T_V,p}$. For these $K_p=G(\Z_p)=G(\Q_p)\cap\mathrm{GL}_{n_\rho}(\Z_p)$ by the choice of $C_0$, which is the hypothesis of \cite[Prop.~3.15]{UY}, so $|K^m_{T_V,p}/K_{T_V,p}|\ge c_Up$ (by \cite[\S4.4]{EY} as in \cref{rem:converse}, as the printed proof of \cite[Prop.~3.15]{UY} assumes $p$ unramified in its field $F_T$, which may be taken to be $F_V$ \cite[pp.~11--12]{UY}). As $i_V$ distinct primes have product at least $i_V!$, $\alpha_V\ge B'^{\,i_V}i_V!\ge(B'i_V/e)^{i_V}$, which exceeds $e^{i_V}$ if $i_V>e^2/B'$. Hence $i_V\le\max(e^2/B',\log\alpha_V)$. (In \cite[Lemma~10.2.5]{KY} the count runs over all primes unramified in $L_V$ with $K^m_{T_V,p}\ne K_{T_V,p}$, including those where $K_p\ne G(\Z_p)$, which are outside the hypothesis of \cite[Prop.~3.15]{UY}; we only need primes $l>C_0$.) (3) The primes of (1) are unramified in $L_V$ and exceed $C_0$, and there are more than $i_V$ of them; so one of them has $K_{T_V,l}=K^m_{T_V,l}$. (4) $l>x_V/4>1/c_U$, since $x_V/4\ge16n_T^2(e^2/B'+2)^2>16e^4/c_U^2>1/c_U$, as $B'=Bc_U\le c_U\le1/2$. \end{proof} Under GRH split primes exist from $x\approx(\log d_{L_V})^{2+o(1)}$, and \cite[Prop.~10.2.3]{KY} takes $l$ of size about $\alpha_V^\varepsilon\beta_V^m$ with $m\ge6$, balanced against the factor $\beta_V^N$ of the Galois bound. With the power form $\Omega_V$ no balancing is needed: the prime of \cref{prop:B} is at most a power of $\log d_{L_V}$ and of $\log\alpha_V$, while $\Omega_V$ grows like $\alpha_Vd_{L_V}^\mu$. So any $\delta>0$ works, and $\delta$ enters the choice of $l$ only through the first term of $x_V$. \subsection{The Hecke step} \begin{theorem}\label{thm:H} Let $G$ be adjoint and $K$ satisfy \textup{(Lv)}, let $(P,X_P)\subset(G,X)$ be a Shimura subdatum and $F\supset E(P,X_P)$ a number field. Let $Z\subset\Sh_{K_P}(P,X_P)_\C$ be Hodge generic and $F$-irreducible, of degree $D_Z$ as in \cref{thm:hecke-uniform}, and let $V\subset Z$ be special and not strongly special in $\Sh_{K_P}(P,X_P)_\C$, with $r:=\dim Z-\dim V>0$. Let $\bar d\ge[FE_V:E_V]$ be an integer and assume $\QRH(\delta;L_V)$. If \[ \Omega_V\ >\ \Delta_r(D_Z)\,x_V^{\,b_r}, \] then $Z$ contains a special subvariety $V'\supsetneq V$ in a geometric component of $Z$ containing $V$. \end{theorem} \begin{proof} The prime $l$ of \cref{prop:B} satisfies $l^{b_r}\Delta_r(D_Z)\le x_V^{b_r}\Delta_r(D_Z)<\Omega_V$, which is \eqref{eq:criterion}; so \cref{thm:hecke-uniform} gives $V'$. \end{proof} For maximal $V$ the inequality of \cref{thm:H} fails, and the following lemma turns that into bounds for $\alpha_V$ and $d_{L_V}$. Put \[ \varsigma:=\max\Bigl(\frac{64\kappa(\delta)+1}{\mu}+8n_T,\ 1+48n_T+4C_0+8n_T\bigl(e^2/B'+2\bigr)\Bigr), \] and for $\Lambda\ge1$ and $b\ge1$ \[ \mathcal W(\Lambda,b):=2\log\Lambda+1+\frac{2b}{\delta}\log\frac{2\varsigma b}{e\,\delta},\qquad \mathcal B(\Lambda,b):=\Lambda\,\bigl(\varsigma\,(\mathcal W(\Lambda,b)+1)\bigr)^{b/\delta}. \] \begin{lemma}\label{lem:solve} Let $\Lambda\ge1$ and $b\ge1$, and let $V$ be special with $T_V\ne1$. If $\alpha_Vd_{L_V}^\mu\le\Lambda\,x_V^{\,b}$, then $\alpha_Vd_{L_V}^\mu\le\mathcal B(\Lambda,b)$. The function $\mathcal B$ is non-decreasing in $\Lambda$ and in $b$. \end{lemma} \begin{proof} Put $\omega:=\log(\alpha_Vd_{L_V}^\mu)=\log\alpha_V+\mu\beta_V\ge0$ and $S:=(64\kappa(\delta)+1)\beta_V+8n_T\log\alpha_V+1+48n_T+4C_0+8n_T(e^2/B'+2)$. Since $S\ge1$ and $1/\delta\ge2$, each of the five terms of $x_V$ is at most $S^{1/\delta}$, as $64\kappa(\delta)\beta_V$, $\beta_V+1$, $48n_T$, $4C_0$ and $8n_T(\max(e^2/B',\log\alpha_V)+2)$ are at most $S$. As $\beta_V\le\omega/\mu$ and $\log\alpha_V\le\omega$, we have $S\le\varsigma(\omega+1)$. So the hypothesis gives \[ \omega\ \le\ \log\Lambda+\frac b\delta\log\bigl(\varsigma(\omega+1)\bigr). \] With $\log y\le y/s+\log s-1$ for $y=\omega+1$ and $s=2b/\delta$, this gives $\omega\le\mathcal W(\Lambda,b)$; putting this back into the right side gives $\omega\le\log\mathcal B(\Lambda,b)$. Both $\mathcal W$ and $\mathcal B$ are non-decreasing in $\Lambda$, and in $b$ because $2\varsigma b/(e\delta)>1$. \end{proof} \section{Degrees of maximal special subvarieties}\label{sec:degrees} In this section $G$ is adjoint, $K$ is a neat product level, $n:=\dim\Sh_K(G,X)$ and $c_B:=e^*(n)^{2n}$ (\cref{lem:bezout}(c)); (Lv) is not assumed and no analytic input is used. Daw, Javanpeykar and Kühne bound the degree of a maximal special subvariety that is not of facteur type \cite[Thm.~1.3]{DJK}. Their iteration cuts $Z$ by a Hecke translate at an Iwahori level and bounds the intersection by Bézout's inequality with constant $1$ at that level \cite[proof of Prop.~10.1, p.~24]{DJK}. Their Theorem 1.3 is unaffected, since it asserts that an effectively computable bound exists: with the constant $c_B$ of \cref{lem:bezout} in this one step, their Proposition 10.1 gives $\deg Y\le c_Bp^{2f_2+k_2}(\deg Z)^2$, with $k_2,f_2$ as in (DJK3) below, and the rest of their proof runs unchanged once their Theorem~7.1 is taken at primes $p\ge N_K$, with the proofs of their Theorems~6.1 and~7.1 completed by \cref{lem:DJK1,lem:DJK67} and the proof of (DJK3) below. We run the iteration with \cref{lem:bezout} at the level of the Hecke translate instead, and treat the facteur case, which they exclude \cite[p.~2]{DJK} and Binyamini and Daw treat by a different method \cite[Thm.~5]{BinyaminiDaw}, with a saturation lemma. \subsection{Inputs}\label{sec:DJK} Let $\mathcal G_{\Z_p}$ be the Zariski closure of $\rho(G)$ in $\mathrm{GL}_{n_\rho,\Z_p}$, and let $N_K>2D_{\mathrm{sp}}+1$ be an integer such that $K_p=\mathcal G_{\Z_p}(\Z_p)$ is hyperspecial for every prime $p\ge N_K$, where $D_{\mathrm{sp}}\ge1$ is an integer for which \cite[Lemma~7.5]{DJK} holds. For a reductive $\Q$-group $H$ and a product level $K_H\subset H(\Af)$, let $\Sigma(H,K_H)$ be the set of primes $p$ at which $H_{\Q_p}$ is not quasi-split, or does not split over an unramified extension, or $K_{H,p}$ is not hyperspecial, and $\Pi(H,K_H)$ the product of these primes ($1$ if there are none) \cite[\S2.5]{DJK}. For a Shimura subdatum $(P,X_P)\subset(G,X)$ write $K(P):=K\cap P(\Af)$ (the $K_P$ of \cref{sec:hecke,sec:adjoint}), and for a special subvariety $V$ of $\Sh_K(G,X^+)_\C$, the image of $X_H^+\times\{1\}$, put $\Sigma_V:=\Sigma(H^\der,K(H^\der))$ and $\Pi_V:=\Pi(H^\der,K(H^\der))$; these depend only on $V$ \cite[Def.~3.5]{DJK}, and are the same for $V$ in $\Sh_{K(P)}(P,X_P)$ and for its image in $\Sh_K(G,X)$, since $K(P)\cap H^\der(\Af)=K\cap H^\der(\Af)$. We use the following results of \cite{DJK}, all with effectively computable constants depending only on $(G,X,K,\rho)$. \begin{enumerate}[({DJK}1)] \item \cite[Thm.~6.1]{DJK} There are $c_1,\eta_1>0$ such that $\deg V>c_1\Pi_V^{\eta_1}$ for every special subvariety $V$ of $\Sh_K(G,X^+)_\C$ of positive dimension. \item \cite[Lemmas~4.1 and 4.2]{DJK} There is an integer $d_G\ge1$ such that for every Shimura subdatum $(P,X_P)$ with a component $X_P^+\subset X^+$, every closed irreducible $Y_P\subset\Sh_{K(P)}(P,X_P^+)_\C$ and its image $Y$ in $\Sh_K(G,X)_\C$, we have $\deg Y\le d_G\deg_{\Lb_{K(P)}}Y_P$ (in the display after ``By definition'' in the proof of \cite[Lemma~4.2]{DJK}, p.~9, the factor $d$ on the left should be $d^{\dim Y_P}$, for the integer $d$ of that proof; the proof then gives $\deg Y\le d^{\dim Y_P}\deg_{\Lb_{K(P)}}Y_P$, and we take $d_G:=d^{\dim\Sh_K(G,X)}$); and $\deg_{\Lb_{K(P)}}Y_P\le\deg Y$ for every Hodge generic closed irreducible $Y_P\subset\Sh_{K(P)}(P,X_P)_\C$. \item \cite[Thm.~7.1]{DJK}, for primes $p\ge N_K$. There are integers $k_2,f_2\ge1$ with the following property. Let $(P,X_P)$ be a Shimura subdatum with a component $X_P^+\subset X^+$, $P^\ad=P_1\times\dots\times P_s$ the decomposition into $\Q$-simple factors with projections $\pi_i$, $V\subset\Sh_{K(P)}(P,X_P^+)_\C$ a special subvariety of positive dimension, the image of $X_H^+\times\{1\}$ for $(H,X_H)\subset(P,X_P)$ and a component $X_H^+\subset X_P^+$, $\mathcal I$ the set of $i$ with $\pi_i(H^\der)\ne1$, and $p\ge N_K$ a prime with $p\notin\Sigma_V$. Then there are a compact open $J_p\subset K(P)_p:=K_p\cap P(\Q_p)$ and $\alpha\in P(\Q_p)$ such that, with $J:=K(P)^pJ_p$: (i) $[K(P)_p:J_p]\le p^{f_2}$; (ii) $[J_p:J_p\cap\alpha J_p\alpha^{-1}]\le p^{k_2}$; (iii) the image $\widetilde V$ of $X_H^+\times\{1\}$ in $\Sh_J(P,X_P)_\C$ satisfies $\widetilde V\subset T_\alpha\widetilde V$; (iv) $\pi_i(u_1\alpha u_2)$ generates an unbounded subgroup of $P_i(\Q_p)$ for all $i\in\mathcal I$ and $u_1,u_2\in J_p$. \end{enumerate} The proofs of \cite[Lemmas~6.10 and~6.11]{DJK}, on which that of (DJK1) rests, take from that of \cite[Lemma~6.6]{Daw}, besides the passage from the simply connected cover of $H^\der$ to $H^\der$, only the bound of \cref{lem:DJK1}; with it the proofs of \cite[Lemmas~6.10 and~6.11]{DJK} are unchanged, with $c_3:=\max\{4,B,p_0\}$ and $c_4:=(3cB^{2b+2})^{-1}$ in \cite[Lemma~6.10]{DJK}, where $B$ and $b$ are the constants of \cite[Lemmas~6.4 and~6.5]{DJK}, $c$ is that of \cite[p.~19]{DJK} (as in \cref{lem:DJK1}) and $p_0$ is the largest prime with $K_p\ne\mathcal G_{\Z_p}(\Z_p)$, as in the proof of \cite[Lemma~6.10]{DJK}. \Cref{lem:DJK67} (\cref{sec:DJK67}), in whose notation we now write, replaces \cite[Lemma~6.7]{DJK}; its proof does not use \cite[Lemma~6.8]{DJK}. Its bound carries $\prod_i\varpi_i^{1/2}$, where $\prod_i\varpi_i$ is the discriminant factor of Prasad's formula \cite[Thm.~3.7]{Prasad89}, from which \cite[p.~16]{DJK} draw the lower bound for the volume of $\Gamma(\widetilde H)^m\backslash\widetilde H(\R)$; in that bound the remaining factor $\prod_i\varpi_i^{1/2}$ suffices. Prasad's theorem applies to each $H'_i$, with $S$ the set of archimedean places of $K_i$, because $H'_i(K_i\otimes\R)$ is not compact: as $H$ is the generic Mumford--Tate group on $X_H$, the projection of $h\in X_H$ to each $\Q$-simple factor of $H^\ad$ is non-trivial, so that factor has non-compact real points \cite[Lemma~4.7]{Milne}. As $\dim H'_i\ge3$, and $s_i\ge5$ when $\ell_i\ne K_i$, we have $\varpi_i^{1/2}\ge(D_{K_i}N_i)^{1/2}$, which pays the primes of $\Sigma(\widetilde H,K(\widetilde H)^m)$ (in the notation of \cite[pp.~14 and~16]{DJK}) that divide some $D_{K_i}N_i$. At every other prime $p$ of that set, some $H'_i$ at some place $v\mid p$ of $K_i$ is not quasi-split, or splits over the maximal unramified extension of $K_{i,v}$ while $K(\widetilde H)^m$ is not hyperspecial at $v$ (otherwise, as $K_i$ and $\ell_i$ are unramified above $p$, $\widetilde H_{\Q_p}$ would be quasi-split and split over an unramified extension, and $K(\widetilde H)^m_p$ would be hyperspecial). Then the factor of Prasad's Euler product at $v$ is at least $q_v^{r_v+1}/(q_v+1)\ge q_v^2/(q_v+1)$, where $q_v$ is the order of the residue field and $r_v\ge1$ the rank of $H'_i$ over the maximal unramified extension of $K_{i,v}$ \cite[\S2.5 and Prop.~2.10(iv)]{Prasad89}; this is at least $\sqrt p$ for $p\ge3$ and $\tfrac{2\sqrt2}{3}\sqrt2$ for $p=2$, and all the factors are greater than $1$ \cite[Rem.~3.10]{Prasad89}. So $\prod_i\varpi_i^{1/2}$ times the Euler product is at least $\tfrac{2\sqrt2}{3}\,\Pi(\widetilde H,K(\widetilde H)^m)^{1/2}$; dividing by the bound of \cref{lem:DJK67} as on \cite[pp.~14--16]{DJK}, the factors $\prod_i\varpi_i^{1/2}$ cancel, and \cite[(7)]{DJK} holds with $C:=B^{3r_G}$ and $c_2:=3c_2^*/(2\sqrt2)$. The rest of the proof of \cite[Thm.~6.1]{DJK} is unchanged. \begin{lemma}\label{lem:DJK1} Let $V$ be a special subvariety of $\Sh_K(G,X^+)_\C$, the image of $X_H^+\times\{1\}$, let $p\ge5$ be a prime with $K_p=\mathcal G_{\Z_p}(\Z_p)$, let $\mathcal H$ be a reductive model over $\Z_p$ of $H^\der_{\Q_p}$, and let $K'$ be the stabilizer of $\Z_p^{n_\rho}$ in $\mathcal H(\Z_p)$. Then $K'=\mathcal H(\Z_p)$ or $[\mathcal H(\Z_p):K']\ge(p-1)/c$, with $c$ the constant of \cite[p.~19]{DJK}. \end{lemma} \begin{proof} The argument for this bound in the proof of \cite[Lemma~6.6]{Daw} (p.~93), which \cite[p.~18]{DJK} cite, seeks a maximal torus of $\mathcal H$ whose $\Z_p$-points are not in $K'$ through a density argument, which gives an element of $\mathcal H(\Z_p)\smallsetminus K'$ that is semisimple in the generic fibre but no maximal torus of $\mathcal H$ over $\Z_p$ containing it; it then takes the Zariski closure of a conjugate of the generic fibre of the torus to be a torus because its $\Z_p$-points form the maximal compact subgroup, which does not suffice (\cref{rem:converse}). We argue as follows. Suppose $K'\ne\mathcal H(\Z_p)$. The kernel $\mathcal H_1$ of $\mathcal H(\Z_p)\to\mathcal H(\F_p)$ is a pro-$p$ group; if $\mathcal H_1\not\subset K'$, the $\mathcal H_1$-orbit of $\Z_p^{n_\rho}$ has more than one element and a power of $p$ as size, so $[\mathcal H(\Z_p):K']\ge p$. Otherwise $K'$ is the preimage of a proper subgroup of $\mathcal H(\F_p)$. As $p\ge5$, $\mathcal H(\F_p)$ is generated by the groups $\bar T(\F_p)$ of its maximal tori $\bar T$ defined over $\F_p$: for $\mathcal H_{\F_p}$ simply connected because every semisimple element of $\mathcal H(\F_p)$ lies in such a group, so they generate a normal subgroup with quotient a $p$-group, and $\mathcal H(\F_p)$, a product of groups $\mathcal H_i(\F_{q_i})$ with $\mathcal H_i$ absolutely almost simple and simply connected, is perfect \cite[Thm.~24.17]{MalleTesterman}, and in general because $\mathcal H(\F_p)=\bar T(\F_p)\,\pi(\widetilde{\mathcal H}(\F_p))$ for the simply connected cover $\pi\colon\widetilde{\mathcal H}\to\mathcal H_{\F_p}$, by Lang's theorem. So some $\bar T(\F_p)$ is not in the image of $K'$, and $\bar T$ lifts to a maximal torus $\mathcal T$ of $\mathcal H$ \cite[Thm.~3.2.6]{Conrad}, by Hensel's lemma, which also makes $\mathcal T(\Z_p)\to\bar T(\F_p)$ onto; so $\mathcal T(\Z_p)\not\subset K'$. Then $\mathcal T$ does not fix $\Z_p^{n_\rho}$ in the sense of \cite[\S3.3]{EY}, and the proof of \cite[Prop.~4.3.9]{EY} in \cite[\S4.4]{EY}, applied to $\mathcal T$, to the largest sublattice $W'$ of $\Z_p^{n_\rho}$ that $\mathcal T$ fixes \cite[proof of Lemma~3.3.1]{EY}, and to $\Z_p^{n_\rho}$, gives $[\mathcal T(\Z_p):\mathcal T(\Z_p)\cap K']\ge(p-1)/|\pi_0(S)(\overline{\F}_p)|$, where $S\subset\mathcal T_{\F_p}$ is the stabilizer of the image $L'$ of $p\Z_p^{n_\rho}\cap W'$ in $W'/pW'$ \cite[p.~633]{EY}. Over $\overline{\F}_p$, $S$ is the common kernel of the differences $\chi-\chi'$ of the characters lying in one block of the finest partition of the weights of $W'\otimes\overline{\F}_p$ along which $L'\otimes\overline{\F}_p$ decomposes, and these characters are bounded by \cite[Lemma~6.9]{DJK}; so $|\pi_0(S)(\overline{\F}_p)|\le c$, and $[\mathcal H(\Z_p):K']\ge[\mathcal T(\Z_p):\mathcal T(\Z_p)\cap K']\ge(p-1)/c$. \end{proof} \begin{proof}[Proof of \textup{(DJK3)}] The proof of \cite[Thm.~7.1]{DJK} follows that of \cite[Thm.~7.1]{Daw}, which takes $J_p\subset P(\Q_p)$ from \cite[\S8.3.2]{KY} and bounds its index by \cite[Lemma~8.1.6(b)]{KY} applied in $P(\Q_p)$ \cite[p.~98]{Daw}; \cite[p.~22]{DJK} makes this bound explicit by the proof of \cite[Lemma~8.1.6(b)]{KY}, with the Weyl group of $H^\der_{\Q_p}$. That proof first reduces to a hyperspecial subgroup of the group containing the Iwahori subgroups, here $P(\Q_p)$, which need not have one, as $p\notin\Sigma_V$ constrains only $H^\der$; the proof goes through with \cref{lem:KY816} in place of \cite[Lemma~8.1.6]{KY}. Let $T$ be a maximal split torus of $H^\der_{\Q_p}$ whose apartment contains the point fixed by the hyperspecial subgroup $K_p\cap H^\der(\Q_p)$ \cite[3.8.1]{TitsCorvallis}; the maximal compact subgroup of $T(\Q_p)$ fixes that apartment pointwise (proof of \cref{lem:KY816}), so it lies in $K_p\cap H^\der(\Q_p)\subset K(P)_p$. Let $\Theta\subset T(\Q_p)$ be the subgroup of elements of order dividing $p-1$. Two distinct characters $\chi,\chi'$ of $T$ intervening in $\rho$ have coordinates of absolute value at most $D_{\mathrm{sp}}$ in the basis of \cite[Lemma~7.5]{DJK}, so $\chi-\chi'\notin(p-1)X^*(T)$, as $p-1>2D_{\mathrm{sp}}$, and $\chi\ne\chi'$ on $\Theta$. As $\Theta\subset\mathrm{GL}_{n_\rho}(\Z_p)$ has order prime to $p$ and its characters have values in $\Z_p^\times$, the projectors onto the weight spaces of $T$ preserve $\Z_p^{n_\rho}$; so the Zariski closure $T_{\Z_p}$ of $T$ in $\mathrm{GL}_{n_\rho,\Z_p}$ is a torus \cite[Lemma~3.3.1]{EY}, as \cite[Prop.~7.4.3]{EY} requires. (The proof of \cite[Lemma~7.4]{DJK}, which is that of \cite[Lemma~7.3]{Daw} (p.~96), infers this from the maximality of $T(\Q_p)\cap\mathrm{GL}_{n_\rho}(\Z_p)$, which does not suffice; see \cref{rem:converse}.) A nonzero weight of $T$ on $\Lie P\subset\mathfrak{gl}_{n_\rho}$ is such a difference $\chi-\chi'$, so it does not lie in $(p-1)X^*(T)$; and $\Theta\subset K(P)_p$. So \cref{lem:KY816}(a), with $H=P_{\Q_p}$, and \cref{lem:KY816}(b) give the torus, chambers and groups of \cref{lem:KY816}(c) with $p$, $T$ and $K(P)_p$ in place of $l$, $T_{V,\Q_l}$ and $K_{P,l}$, the chamber $C^2$ being chosen with respect to $\alpha$ as in \cite[\S8.3.2]{KY}; hence (i) with $f_2:=(\dim G+1)^2$; then (ii) holds with $k_2:=k'+f_2$, for the integer $k'$ of \cite[p.~21]{DJK}, and (iv) follows from \cite[Prop.~8.1.4]{KY} in each $P_{i,\Q_p}$, $i\in\mathcal I$. \end{proof} \subsection{Saturation}\label{sec:saturation} Let $(P,X_P)\subset(G,X)$ be a Shimura subdatum with $P$ the generic Mumford--Tate group on $X_P$, $P^\ad=P_1\times\dots\times P_s$ as in (DJK3), and $X_P^+=X_1^+\times\dots\times X_s^+$ the corresponding decomposition. For $\mathcal A\subset\{1,\dots,s\}$ write $P_{\mathcal A}:=\prod_{i\in\mathcal A}P_i$, $X^+_{\mathcal A}:=\prod_{i\in\mathcal A}X_i^+$ and $\mathcal A^c$ for the complement. A subset $\widehat Y\subset X_P^+$ is \emph{$X_{\mathcal A}^+$-saturated} if $\widehat Y=X^+_{\mathcal A}\times\mathrm{pr}_{\mathcal A^c}(\widehat Y)$. \begin{lemma}\label{lem:saturation} Let $Y\subset\Sh_{K(P)}(P,X_P^+)_\C$ be closed, irreducible and Hodge generic, containing a special point, and let $\widehat Y\subset X_P^+$ be its preimage. Let $p$ be a prime, $J_p\subset K(P)_p$ compact open, $J:=K(P)^pJ_p$, $\widetilde Y$ a component of the preimage of $Y$ in $\Sh_J(P,X_P)_\C$, $\alpha\in P(\Q_p)$ and $\mathcal I\subset\{1,\dots,s\}$. Suppose that $\widetilde Y\subset T_\alpha\widetilde Y$, and that $\pi_i(u_1\alpha u_2)$ generates an unbounded subgroup of $P_i(\Q_p)$ for all $i\in\mathcal I$ and $u_1,u_2\in J_p$. Then $\widehat Y$ is $X^+_{\mathcal I}$-saturated. \end{lemma} \begin{proof} This is the proof of \cite[Thm.~7.2.1]{KY}, applied to $\widetilde Y$ itself in place of the preimage of a special subvariety, with the monodromy step of \cite[p.~33]{KY} argued from a special point of $Y$ (Step~1) and the last step (Step~2) carried out on $X_P^+$ rather than at the adjoint product level of \cite[Lemma~7.2.8]{KY}. \emph{Step 0.} Let $\widetilde Y^\infty$ be a component of the preimage of $\widetilde Y$ in the pro-étale cover of $\Sh_J(P,X_P)$ with group $J_p$ \cite[\S4.1.3]{KY}. As $Y$ is geometrically irreducible, the argument of \cite[(7.2)]{KY} gives $u_1,u_2\in J_p$ with $\widetilde Y^\infty=\widetilde Y^\infty\cdot(u_1\alpha u_2)$; the Galois step of \cite[Lemma~7.2.4]{KY} is not needed. Let $\widehat Y'$ be an analytic component of $\widehat Y$. \emph{Step 1 (the monodromy).} Let $M_Y$ be the identity component of the Zariski closure of the monodromy of the variation of Hodge structure over the smooth locus $Y^{\mathrm{sm}}$ of $Y$. Let $r\colon Y'\to Y$ be a resolution of singularities that is an isomorphism over $Y^{\mathrm{sm}}$. The pull-back to $Y'$ of the variation on $\Sh_{K(P)}(P,X_P^+)_\C$ is polarizable; its Mumford--Tate group is $P$ at the points over the Hodge generic points of $Y$, and a torus at the points over a special point of $Y$. So its connected monodromy group is $P^\der$ \cite[Prop.~2]{Andre92}; this group is $M_Y$, as $\pi_1(Y^{\mathrm{sm}})\to\pi_1(Y')$ is onto. So $M_Y=P^\der$, and the closure $K'_p$ in $P(\Q_p)$ of the monodromy of $\widetilde Y$ at the lift $\widehat Y'$ contains an open subgroup of $M_Y(\Q_p)$ \cite[Prop.~4.2.1]{KY}. (Without a special point this fails: for $\sigma\in Y(1)$ algebraic and not CM, $Y(1)\times\{\sigma\}\subset Y(1)^2$ is Hodge generic with monodromy $\mathrm{SL}_2\times1$.) \emph{Step 2.} Steps 0 and 1 hold for every choice of $\widetilde Y^\infty$ and $\widehat Y'$; translating by some $k\in K(P)_p$, which replaces $J_p$ and $\alpha$ by $k^{-1}J_pk$ and $k^{-1}\alpha k$ and keeps the hypotheses, we may assume that $\widetilde Y$ is the image of $\widehat Y'\times\{1\}$, and we take for $\widetilde Y^\infty$ the component containing the image of $\widehat Y'\times\{1\}$; then $K'_p$ is the closure of the stabilizer of $\widehat Y'$ in $P(\Q)_+\cap J$. By Steps 0 and 1, $\widetilde Y^\infty$ is stabilized by $U_p:=\langle K'_p,u_1\alpha u_2\rangle$ \cite[Cor.~7.2.5]{KY}, and $M_Y=P^\der$, so $K'_p$ contains an open subgroup of $P^\der(\Q_p)$ and the image $\bar U_p$ of $U_p$ in $P^\ad(\Q_p)$ is open. Fix $i\in\mathcal I$. Let $P_i^\natural$ be the $\Q$-simple factor of $P^\der$ over $P_i$, $\varpi\colon\widetilde P_i\to P_i^\natural$ its simply connected cover, $\mathsf H$ a $\Q_p$-simple factor of $P_{i,\Q_p}$ in which the image of $u_1\alpha u_2$ is unbounded, and $\widetilde{\mathsf H}$ the factor of $\widetilde P_{i,\Q_p}$ over $\mathsf H$. By \cite[Lemma~7.2.6]{KY} for $\bar U_p$, $\varpi(\widetilde{\mathsf H}(\Q_p))\subset U_p\,Z(P)(\Q_p)$, so commutators of elements of $\varpi(\widetilde{\mathsf H}(\Q_p))$ lie in $U_p$; as $\widetilde{\mathsf H}(\Q_p)$ is perfect (it is $\widetilde{\mathsf H}'(\mathsf k)$ for a finite $\mathsf k/\Q_p$ and $\widetilde{\mathsf H}'$ simply connected and absolutely almost simple, isotropic because $\mathsf H(\Q_p)$ is not compact \cite{Prasad82}; so $\widetilde{\mathsf H}'(\mathsf k)=\widetilde{\mathsf H}'(\mathsf k)^+$ \cite{Platonov69,Platonov70}, which is perfect \cite[Main Theorem]{Tits64}, \cite[Fait~4.1]{Gille}), $\varpi(\widetilde{\mathsf H}(\Q_p))\subset U_p$. Let $\Gamma_i:=\{\gamma\in P_i^\natural(\Q)\cap P(\Q)_+\cap K(P)^p:\gamma_p\in K'_p\}$, an arithmetic subgroup of $P_i^\natural$ with closure $\overline\Gamma_i\subset K'_p$ in $P(\Q_p)$, and fix $g\in\widetilde{\mathsf H}(\Q_p)$ lying in no compact subgroup. By strong approximation for $\widetilde P_i$ with respect to the infinite place ($P_i(\R)$ is not compact), $\widetilde P_i(\Q)$ is dense in $\widetilde P_i(\Af)$ \cite[Thm.~4.16]{Milne}. So $\overline\Gamma_i$ contains $\varpi(\widetilde C_p)$, with $\widetilde C_p$ the preimage of $K'_p$ in $\widetilde P_i(\Q_p)$ (the elements of $\widetilde P_i(\Q)$ in $\widetilde C_p$ whose image lies in $K(P)^p$ are dense in $\widetilde C_p$, and their images lie in $\Gamma_i$), and is therefore open in $P_i^\natural(\Q_p)$; and there is $q'\in\varpi(\widetilde P_i(\Q))$ that lies in $K(P)_\ell$ for every prime $\ell\ne p$ and has $q'_p\in\varpi(g)\overline\Gamma_i$; so $q'\in P(\Q)_+$ and $q'_p\in U_p$. The closure of $\Gamma'_i:=\langle\Gamma_i,q'\rangle$ in $P(\Q_p)$ contains $\varpi(g)$, so $\Gamma_i$ has infinite index in $\Gamma'_i$. The image $\pi_i(\Gamma'_i)$ is dense in $P_i(\R)^+$. Indeed, let $\mathsf C$ be its closure in $P_i(\R)$ and $\mathfrak c$ the Lie algebra of $\mathsf C$. The group $\pi_i(\Gamma_i)$ is arithmetic in $P_i$ \cite[Prop.~3.2]{Milne}, hence a lattice in $P_i(\R)$ and Zariski dense in $P_i$ \cite[Thms.~3.3 and 3.19]{Milne}, and it normalizes $\mathsf C$; so $\mathfrak c$ is an ideal of $\mathrm{Lie}\,P_i(\R)$, and $P_i(\R)=\mathsf N\times\mathsf N'$ with $\mathsf N$, $\mathsf N'$ products of $\R$-simple factors and $\mathrm{Lie}\,\mathsf N=\mathfrak c$. Suppose $\mathsf N'\ne1$. As $\mathsf C$ is closed with the identity component of $\mathsf N$ as its identity component, and $\mathsf N$ has finitely many components, the projection of $\mathsf C$ to $\mathsf N'$ is discrete; and $P_i(\Q)\to\mathsf N'$ is injective, as $P_i$ is $\Q$-simple. So a sequence in $\pi_i(\Gamma'_i)$ that tends to $1$ is eventually $1$, and $\pi_i(\Gamma'_i)$ is discrete; it then contains the lattice $\pi_i(\Gamma_i)$ with finite index, and $[\Gamma'_i:\Gamma_i]$ is finite, as $P_i^\natural\to P_i$ has finite kernel. So $\mathsf N'=1$ and $\mathsf C\supset P_i(\R)^+$. Each $\gamma\in\Gamma'_i$ lies in $P(\Q)_+\cap K(P)^p$, has $\gamma_p\in U_p$ and moves only the $i$-th coordinate of $X_P^+$; for $x\in\widehat Y'$, $[\gamma x,1]=[x,\gamma_p^{-1}]\in\widetilde Y^\infty U_p=\widetilde Y^\infty$, so $\gamma x\in\widehat Y$. As $\widehat Y$ is closed, $X_i^+\times\{x_{\ne i}\}\subset\widehat Y$ for every $x\in\widehat Y'$, hence for every $x\in\widehat Y=(K(P)\cap P(\Q)_+)\cdot\widehat Y'$, since $P(\Q)_+$ acts factorwise. Applying this for each $i\in\mathcal I$ in turn gives the lemma. \end{proof} \needspace{4\baselineskip} \begin{lemma}\label{lem:saturated-degree} In \cref{lem:saturation}, let $V\subset Y$ be a special subvariety defined by $(H,X_H)$, and suppose that the image of $H^\der$ in $P^\ad$ is $P_{\mathcal I}$. Then $\deg_{\Lb_{K(P)}}V\le\deg_{\Lb_{K(P)}}Y$. \end{lemma} \begin{proof} Let $\Gamma\subset P^\ad(\Q)$ be the image of $K(P)\cap P(\Q)_+$, so that $\Sh_{K(P)}(P,X_P^+)_\C=\Gamma\backslash X_P^+$, and put $\Gamma_{\mathcal I}:=\pi_{\mathcal I}(\Gamma)$ and $\Gamma_c:=\pi_{\mathcal I^c}(\Gamma)$. These are arithmetic, as images of an arithmetic group under surjective homomorphisms \cite[Prop.~3.2]{Milne}, and neat \cite[0.5]{Pink}, \cite[\S4.1.4]{KY}, so $\Gamma$ has finite index $e$ in $\Gamma_{\mathcal I}\times\Gamma_c$, and $f\colon\Gamma\backslash X_P^+\to S':=\Gamma_{\mathcal I}\backslash X^+_{\mathcal I}\times\Gamma_c\backslash X^+_{\mathcal I^c}$ is finite étale of degree $e$. The Baily--Borel compactification of $S'$ is the product of those of the factors, and $f^*(\Lb_{\mathcal I}\boxtimes\Lb_c)=\Lb_{K(P)}$, where $\Lb_{\mathcal I}$, $\Lb_c$ are the extensions of the canonical bundles of the factors. Since $Z(H)(\R)$ fixes the points of $X_H$ and $H^\der$ maps onto $P_{\mathcal I}$, $X_H^+=X^+_{\mathcal I}\times\{x_2\}$, so $f(V)=S'_{\mathcal I}\times\{w_0\}$ with $S'_{\mathcal I}:=\Gamma_{\mathcal I}\backslash X^+_{\mathcal I}$. By \cref{lem:saturation}, $f(Y)=S'_{\mathcal I}\times W$ with $W$ closed and irreducible, of dimension $b$. Every fibre $f^{-1}(S'_{\mathcal I}\times\{w\})$ is irreducible: for $w=\Gamma_cy$ it is the image of $X^+_{\mathcal I}\times\Gamma_cy$, and $\Gamma$ permutes the slices $X^+_{\mathcal I}\times\{\gamma y\}$ transitively, as $\pi_{\mathcal I^c}(\Gamma)=\Gamma_c$. Every component of $f^{-1}(S'_{\mathcal I}\times W)$ maps onto $S'_{\mathcal I}\times W$, as $f$ is finite and flat, so it contains the fibre over a general point of $W$; hence $f^{-1}(S'_{\mathcal I}\times W)$ is irreducible, and $Y=f^{-1}(S'_{\mathcal I}\times W)$, $V=f^{-1}(S'_{\mathcal I}\times\{w_0\})$, each of degree $e$ over its image. With $a:=\dim X^+_{\mathcal I}$ the projection formula gives $\deg_{\Lb_{K(P)}}V=e\deg_{\Lb_{\mathcal I}}S'_{\mathcal I}$ and $\deg_{\Lb_{K(P)}}Y=e\binom{a+b}{a}\deg_{\Lb_{\mathcal I}}S'_{\mathcal I}\deg_{\Lb_c}W\ge\deg_{\Lb_{K(P)}}V$, since $\deg_{\Lb_c}W\ge1$. \end{proof} The choice of the groups $\Gamma_{\mathcal I}$, $\Gamma_c$ rather than the projections of $K(P)$ is what makes the fibres irreducible: with $\pi_{\mathcal I^c}(K(P))\cap P_{\mathcal I^c}(\Q)_+$ in place of $\Gamma_c$ the fibre would have as many components as the index of $\Gamma_c$ in that group. \subsection{The degree bound} For $\Pi\ge1$ put $y(\Pi):=\max(6,\,N_K+\log_2\Pi+1)$ and $p^*(\Pi):=2y(\Pi)\log y(\Pi)$. For integers $0\le z\le n$ and $D\ge1$ put \[ R_{z,D}(\Pi):=d_G\bigl(d_G\,c_B\,p^*(\Pi)^{k_2+2f_2}\bigr)^{2^z-1}D^{2^z}, \] let $\Pi_0(z,D):=\sup\{\Pi\ge1:c_1\Pi^{\eta_1}\le R_{z,D}(\Pi)\}$, which is finite because $R_{z,D}$ grows like a power of $\log\Pi$ ($\Pi_0:=1$ if the set is empty), and \[ c_D^\ad(z,D):=R_{z,D}\bigl(\Pi_0(z,D)\bigr). \] \needspace{4\baselineskip} \begin{theorem}\label{thm:D} Let $Z\subset\Sh_K(G,X)_\C$ be closed and irreducible, $D:=\deg Z$, and $V$ a special subvariety maximal in $Z$ with $\dim V\ge1$. Put $r:=\dim Z-\dim V$. For every prime $p\ge N_K$ with $p\notin\Sigma_V$, \begin{equation}\label{eq:thmD} \deg V\ \le\ d_G\bigl(d_G\,c_B\,p^{k_2+2f_2}\bigr)^{2^r-1}D^{2^r},\qquad c_B=e^*(n)^{2n}. \end{equation} Consequently $\deg V\le c_D^\ad(\dim Z,D)$. \end{theorem} \begin{proof} Fix $p$. We build closed irreducible $Y_0:=Z\supset Y_1\supset\dots$, all containing $V$, with $\dim Y_{j+1}<\dim Y_j$ and $\deg Y_j\le D_j$, where $D_0:=D$ and $D_{j+1}:=d_G\,c_B\,p^{k_2+2f_2}D_j^2$. Since $Y_j\subset Z$, $V$ is maximal in every $Y_j$. If $Y_j=V$, we stop. Otherwise $Y_j$ is not special. Let $(P,X_P)$ be the Shimura subdatum, with $P$ the generic Mumford--Tate group on $X_P$, of the smallest special subvariety containing $Y_j$, let $\psi\colon\Sh_{K(P)}(P,X_P)_\C\to\Sh_K(G,X)_\C$ be the natural map, $Y_P$ a component of $\psi^{-1}(Y_j)$ with $\psi(Y_P)=Y_j$, which is Hodge generic, and $V_P\subset Y_P$ a component of $\psi^{-1}(V)$ with $\psi(V_P)=V$ \cite[proof of Thm.~1.3]{DJK}. Then $V_P$ is special, of positive dimension and maximal in $Y_P$, since $\psi$ is finite and maps special subvarieties to special subvarieties, and $\Sigma_{V_P}=\Sigma_V$. By (DJK2), $\deg_{\Lb_{K(P)}}Y_P\le\deg Y_j\le D_j$. Let $J_p$, $\alpha$ and $\mathcal I$ be as in (DJK3) for $V_P$ and $p$, $J:=K(P)^pJ_p$, $\psi_J\colon\Sh_J(P,X_P)_\C\to\Sh_K(G,X)_\C$ the natural map, $\widetilde V$ the component of the preimage of $V_P$ given by (DJK3)(iii), and $\widetilde Y$ a component of the preimage of $Y_P$ containing $\widetilde V$. By the projection formula and \cref{lem:H}(a), \[ \deg_{\Lb_J}\widetilde Y\le p^{f_2}D_j,\qquad \deg_{\Lb_J}T_\alpha\widetilde Y\le p^{k_2+f_2}D_j . \] \emph{Cut case: $\widetilde Y\not\subset T_\alpha\widetilde Y$.} By (DJK3)(iii), $\widetilde V\subset T_\alpha\widetilde V\subset T_\alpha\widetilde Y$, so $\widetilde V\subset\widetilde Y\cap T_\alpha\widetilde Y$, a proper closed subset of the irreducible $\widetilde Y$. Let $C$ be a component of $\widetilde Y\cap T_\alpha\widetilde Y$ containing $\widetilde V$ and $Y_{j+1}:=\psi_J(C)$, closed and irreducible as $\psi_J$ is finite, containing $V$, with $\dim Y_{j+1}=\dim C<\dim Y_j$. The level $J\subset K(P)$ is neat, so \cref{lem:bezout}(c) gives $\deg_{\Lb_J}C\le c_B\,p^{k_2+2f_2}D_j^2$, and by (DJK2) and the projection formula for $\Sh_J\to\Sh_{K(P)}$, $\deg Y_{j+1}\le d_G\deg_{\Lb_J}C\le D_{j+1}$. \emph{Stable case: $\widetilde Y\subset T_\alpha\widetilde Y$.} The variety $Y_P$ contains a special point, as the special subvariety $V_P\subset Y_P$ does \cite[Lemma~13.3]{Milne}. By (DJK3)(iv) and \cref{lem:saturation}, the preimage of $Y_P$ in $X_P^+$ is $X^+_{\mathcal I}$-saturated. The rest of the proof of \cite[Thm.~8.1]{DJK}, which is that of \cite[Thm.~8.1]{Daw}, a near copy of the proof of \cite[Thm.~7.2.1]{KY} \cite[p.~99]{Daw}, restricted to the factors in $\mathcal I$ \cite[p.~22]{DJK}, shows that either $Y_P$ contains a special subvariety strictly containing $V_P$, or the image of $H^\der$ in $P^\ad$ is $P_{\mathcal I}$, where $(H,X_H)$ defines $V_P$. The first is excluded by the maximality of $V_P$. In the second case \cref{lem:saturated-degree} and (DJK2) give \[ \deg V\le d_G\deg_{\Lb_{K(P)}}V_P\le d_G\deg_{\Lb_{K(P)}}Y_P\le d_G\deg Y_j\le d_GD_j, \] and we stop. Each cut lowers the dimension, so there are at most $r$ cuts. The recursion gives \[ D_j=(d_G\,c_B\,p^{k_2+2f_2})^{2^j-1}D^{2^j}, \] which is increasing in $j$, so every $D_j$ that occurs is at most $D_r$. With the factor $d_G$ of the stable case this is \eqref{eq:thmD}. For the last assertion let $p$ be the least prime $p\ge N_K$ not dividing $\Pi_V$; then $p\notin\Sigma_V$. At most $\log_2\Pi_V$ primes divide $\Pi_V$. With $y:=y(\Pi_V)$ and $x:=p^*(\Pi_V)\ge17$ we have $x/\log x\ge y$, since $\log(2y\log y)\le2\log y$, and $\pi(x)\ge x/\log x$ \cite[(3.5)]{RosserSchoenfeld}; so $[N_K,x]$ contains at least $y-N_K+1>\log_2\Pi_V$ primes, and $p\le p^*(\Pi_V)$. As the bases in \eqref{eq:thmD} are at least $1$ and $r\le\dim Z$, (DJK1) and \eqref{eq:thmD} give $c_1\Pi_V^{\eta_1}<\deg V\le R_{\dim Z,D}(\Pi_V)$. Hence $\Pi_V\le\Pi_0(\dim Z,D)$, and $\deg V\le c_D^\ad(\dim Z,D)$, as $R_{z,D}$ is non-decreasing. \end{proof} \Cref{thm:degrees} is \cref{thm:D}, applied at the level $g_iKg_i^{-1}$, with the lattice $\rho(g_i)\Zhat^{n_\rho}$, of the component containing $Z$ (\cref{sec:special}), with $c_B=e^*(n)^{2n}$ (\cref{lem:bezout}(c)). The bound holds for facteur and non-facteur $V$ alike. Facteur special subvarieties of bounded degree come in infinite families \cite[p.~2]{DJK}, so a bound for the degree alone leaves infinitely many candidates; \cref{thm:adjoint} bounds the other two terms $d_{L_V}$ and $\alpha_V$ of $\Delta(V)$. \subsection{An index bound}\label{sec:DJK67} The following lemma replaces \cite[Lemma~6.7]{DJK} in the proof of (DJK1) (\cref{sec:DJK}). \begin{lemma}\label{lem:DJK67} Let $V$ be a special subvariety of $\Sh_K(G,X^+)_\C$ of positive dimension, the image of $X_H^+\times\{1\}$, and let $\pi\colon\widetilde H\to H^\der$, $\Gamma(H)^+$ and $\Gamma(\widetilde H)$ be as in \cite[pp.~13--14]{DJK}. Write $\widetilde H=\prod_i\mathrm{Res}_{K_i/\Q}H'_i$ with $K_i$ a number field and $H'_i$ absolutely almost simple and simply connected over $K_i$ \cite[\S5]{DJK}. For each $i$ let $\ell_i$ and $s_i$ be the field and the integer that \cite[\S\S0.2 and~0.4]{Prasad89} attach to the quasi-split inner form of $H'_i$, and put \[ N_i:=D_{\ell_i}/D_{K_i}^{[\ell_i:K_i]},\qquad \varpi_i:=D_{K_i}^{\dim H'_i/2}N_i^{s_i/2}, \] where $D_L:=|d_L|$ is the absolute value of the discriminant of a number field $L$ (Prasad's notation). Let $r_G$ be the absolute rank of $G$, and $B$ the constant of \cite[Lemma~6.4]{DJK}, which by its proof bounds $|Z(\widetilde H)(\C)|$. There is an effectively computable $c_2^*$, depending only on $r_G$ and $B$, such that \[ [\Gamma(H)^+:\pi(\Gamma(\widetilde H))]\le c_2^*\,(B^{3r_G})^{|\Sigma_V|}\prod_i\varpi_i^{1/2}. \] \end{lemma} \begin{proof} Let $Z_\pi:=\ker\pi$, and let $\Sigma$ be the union of $\Sigma_V$ and the set of primes dividing $|Z_\pi(\C)|$, so that $|\Sigma|\le|\Sigma_V|+\log_2B$. A class in the first Galois cohomology of a number field is \emph{unramified} at a finite place if its restriction to an inertia group there is $0$. Step (i) follows \cite[proof of Lemma~6.7, p.~14]{DJK}; steps (ii) and (iii) take the place of their restriction to a field that splits $Z_\pi$ and of their Lemma~6.8 \cite[p.~15]{DJK}. (i) As $Z_\pi$ is central, the connecting map $\partial\colon H^\der(\Q)\to H^1(\Q,Z_\pi)$ is a homomorphism: if $h,h'\in\widetilde H(\Qbar)$ and $\gamma:=\pi(h)$ and $\gamma':=\pi(h')$ lie in $H^\der(\Q)$, then $(hh')^{-1}\sigma(hh')=h^{-1}\sigma(h)\cdot h'^{-1}\sigma(h')$ for $\sigma\in\Gal(\Qbar/\Q)$, since $h^{-1}\sigma(h)\in Z_\pi(\Qbar)$ is central. Its kernel is $\pi(\widetilde H(\Q))$, and $\Gamma(\widetilde H)$ is the full preimage of $\Gamma(H)^+$ in $\widetilde H(\Q)$; so $\partial$ embeds $\Gamma(H)^+/\pi(\Gamma(\widetilde H))$ in $H^1(\Q,Z_\pi)$. Let $M$ be the image. For $p\notin\Sigma$ every class in $M$ is unramified at $p$, since $\Gamma(H)^+\subset K(H^\der)$ \cite[\S3.4]{DJK} and the image of $K(H^\der)_p$ in $H^1(\Q_p,Z_\pi)$ lies in $H^1(\Gal(\Q_p^{\mathrm{un}}/\Q_p),\mathcal Z(\Z_p^{\mathrm{un}}))$ for a smooth model $\mathcal Z$ of $Z_{\pi,\Q_p}$ over $\Z_p$ \cite[p.~14]{DJK}, \cite[p.~88]{Daw}. (ii) The centre of $\widetilde H$ is $\prod_i\mathrm{Res}_{K_i/\Q}A_i$ with $A_i:=Z(H'_i)$, and it contains $Z_\pi$. The kernel of $H^1(\Q,Z_\pi)\to H^1(\Q,Z(\widetilde H))$ is the image of $(Z(\widetilde H)/Z_\pi)(\Q)$, of order at most $B$. By Shapiro's lemma \cite[II.1.11]{MilneCFT}, $H^1(\Q,\mathrm{Res}_{K_i/\Q}A_i)\cong H^1(K_i,A_i)$, through restriction to $\Gal(\Qbar/K_i)$ and evaluation at $1$; as the inertia groups of $K_i$ are the intersections of those of $\Q$ with $\Gal(\Qbar/K_i)$, classes unramified at $p$ go to classes unramified at every place of $K_i$ above $p$. Let $M_i\subset H^1(K_i,A_i)$ be the image of $M$. Then $|M|\le B\prod_i|M_i|$, and the classes in $M_i$ are unramified at every place above a prime $p\notin\Sigma$. (iii) Inner twisting acts trivially on the centre, so $A_i$ is isomorphic over $K_i$ to the centre of the quasi-split inner form $\mathcal G_i$ of $H'_i$, and $\Gal(\overline{K_i}/K_i)$ acts on $X^*(A_i)$, the weight lattice modulo the root lattice, through its action on the Dynkin diagram of $\mathcal G_i$. If $H'_i$ is not a triality form, $\mathcal G_i$ splits over $\ell_i$ (and $\ell_i=K_i$ for inner forms), so $A_i\cong\prod_{k=1}^{q_i}\mu_{n_{i,k}}$ over $\ell_i$, with $\prod_kn_{i,k}=|A_i(\C)|$; inflation and restriction \cite[II.1.34]{MilneCFT} map $H^1(K_i,A_i)$ to $H^1(\ell_i,A_i)=\prod_k\ell_i^\times/\ell_i^{\times n_{i,k}}$ \cite[II.1.22]{MilneCFT} with kernel $H^1(\Gal(\ell_i/K_i),A_i(\ell_i))$, of order at most $|A_i(\C)|$ as $[\ell_i:K_i]\le2$. If $H'_i$ is a triality form, of type ${}^3\mathrm D_4$ or ${}^6\mathrm D_4$, then $X^*(A_i)\cong(\Z/2)^2$, and its three non-zero elements, the classes of the fundamental weights of the three outer vertices, are permuted as these vertices; as $\ell_i$ is the field fixed by the stabilizer in $\Gal(\overline{K_i}/K_i)$ of one outer vertex, $A_i\cong\ker(N\colon \mathrm{Res}_{\ell_i/K_i}\mu_2\to\mu_2)$, whose character group is $(\Z/2)^{\mathrm{Hom}_{K_i}(\ell_i,\overline{K_i})}$ modulo the diagonal. Since $N(-1)=-1$, the map $H^1(K_i,A_i)\to H^1(K_i,\mathrm{Res}_{\ell_i/K_i}\mu_2)=\ell_i^\times/\ell_i^{\times2}$ is injective; here put $q_i:=1$ and $n_{i,1}:=2$. In both cases these maps keep classes unramified, and a class in $\ell_i^\times/\ell_i^{\times m}$ that is unramified at a finite place $w$ is an $m$-th power over the maximal unramified extension of $\ell_{i,w}$, so its valuation at $w$ is divisible by $m$. For a number field $L$, a set $S$ of finite places of $L$ and $m\ge1$ put $L(S,m):=\{a\in L^\times/L^{\times m}:v_w(a)\equiv0\bmod m\text{ for every finite place }w\notin S\}$, and let $S_i$ be the set of places of $\ell_i$ above $\Sigma$. Then \[ |M_i|\le|A_i(\C)|\prod_{k=1}^{q_i}\bigl|\ell_i(S_i,n_{i,k})\bigr|. \] The valuations at the places in $S$ map $L(S,m)$ to $(\Z/m)^{S}$ with kernel $L(\emptyset,m)$, and $|L(\emptyset,m)|\le m^{r_1(L)+r_2(L)}h_L$ (proof of \cref{prop:selB}); as $|S_i|\le[\ell_i:\Q]\,|\Sigma|$, we get $|\ell_i(S_i,m)|\le m^{[\ell_i:\Q](|\Sigma|+1)}h_{\ell_i}$. (iv) By \cref{cor:H}, $h_L\le\max\bigl(1,B_L(1+\log B_L)^{n_L-1}\bigr)$ with $B_L\le(4/\pi)^{n_L/2}D_L^{1/2}$; so $h_L\le c_h(n_L)\,D_L^{3/4}$ with $c_h(n):=(4/\pi)^{n/2}\sup_{y\ge0}(n+y/2)^{n-1}e^{-y/4}$, which is non-decreasing in $n$ and at least $1$. As $D_{\ell_i}=D_{K_i}^{[\ell_i:K_i]}N_i$, with $N_i=|N_{K_i/\Q}(\mathfrak d(\ell_i/K_i))|$ \cite[\S0.2]{Prasad89}, \[ h_{\ell_i}^{q_i}\le c_h([\ell_i:\Q])^{q_i}\,D_{K_i}^{3q_i[\ell_i:K_i]/4}N_i^{3q_i/4}\le c_h([\ell_i:\Q])^{q_i}\,\varpi_i^{1/2}, \] because $3q_i[\ell_i:K_i]\le\dim H'_i$ for every form, and $3q_i\le s_i$ for outer and triality forms (for inner forms $N_i=1$). Indeed, $q_i\le1$ except for forms of type $\mathrm D_r$ with $r$ even that are not triality forms, where $q_i=2$, $\dim H'_i\ge28$ and, for outer forms, $s_i=2r-1\ge7$; $\dim H'_i\ge3$, $\dim H'_i\ge8$ if $[\ell_i:K_i]=2$, and $\dim H'_i=28$ if $[\ell_i:K_i]=3$; and $s_i\ge5$ for outer and triality forms \cite[\S0.4]{Prasad89}. (v) Each $H'_i$ has rank at least $1$, and $\sum_i[K_i:\Q]\operatorname{rank}H'_i=\operatorname{rank}H^\der\le r_G$; so there are at most $r_G$ indices $i$, and $[\ell_i:\Q]\le3[K_i:\Q]\le3r_G$. Also $\prod_{i,k}n_{i,k}\le\prod_i|A_i(\C)|\le|Z(\widetilde H)(\C)|\le B$. By (i)--(iv), \[ [\Gamma(H)^+:\pi(\Gamma(\widetilde H))]=|M|\le B^2\,B^{3r_G(|\Sigma|+1)}\,c_h(3r_G)^{2r_G}\prod_i\varpi_i^{1/2}, \] and $|\Sigma|\le|\Sigma_V|+\log_2B$ gives the lemma with $c_2^*:=B^{2+3r_G(1+\log_2B)}\,c_h(3r_G)^{2r_G}$. \end{proof} \section{The main theorem for adjoint groups}\label{sec:adjoint} In this section $G$ is adjoint, $K$ satisfies (Lv), $n:=\dim\Sh_K(G,X)$ and $e_0:=e^*(n)$. Let $F\supset E(G,X)$ be a number field, $d:=[F:\Q]$, and $Z\subset\Sh_K(G,X)$ a closed subvariety, geometrically irreducible and defined over $F$, with $D:=\deg Z$ and $z:=\dim Z$. Let $(P,X_P)\subset(G,X)$ be the Shimura subdatum, with $P$ the generic Mumford--Tate group on $X_P$, that defines the smallest special subvariety containing $Z$ \cite[p.~14]{KY}, the special closure of $Z$; put $K_P:=K\cap P(\Af)$, $E_P:=E(P,X_P)$, $T_Z:=Z(P)^\circ$, and let $\psi\colon\Sh_{K_P}(P,X_P)\to\Sh_K(G,X)$ be the natural morphism, defined over $E_P$ \cite[Remark~13.8]{Milne}. \subsection{Statement} A special subvariety $V$ maximal in $Z$ belongs to exactly one of three classes: \begin{enumerate} \item[(S)] $T_V=1$; \item[(N)] $T_V\ne1$ and $T_V\not\subset Z(P)$; \item[(C)] $T_V\ne1$ and $T_V\subset Z(P)$. \end{enumerate} Here $V$ is regarded inside the special subvariety defined by $(P,X_P)$ (\cref{lem:lift}). Class (N) says that $V$ is not strongly special in $\Sh_{K_P}(P,X_P)_\C$, since the image of $T_V$ in $P^\ad$ is the connected centre of the image of $H_V$; so the Hecke step applies to it. Class (C) consists of special subvarieties that are strongly special in $\Sh_{K_P}(P,X_P)_\C$ but not in $\Sh_K(G,X)_\C$, and the Hecke step says nothing about them; the bounds come instead from the Galois orbit of the component containing the lift $Z_P$ of $Z$ (\cref{lem:lift}), for $d_{L_V}$ (\cref{lem:Za}), and from the translates of $Z_P$ by the centre, for $\alpha_V$ (\cref{lem:Zb}). With $b_r$, $\Delta_r$ of \cref{sec:hecke} and $\mathcal B$ of \cref{lem:solve}, computed with $\bar d=d$, and $c_D^\ad$ of \cref{sec:degrees}, put \begin{gather*} c_{\mathrm N}(\delta,z,D,d):=\mathcal B\bigl(\Delta_z(D)/C_*,\ b_z\bigr),\\ c^\ad(\delta,z,D,d):=\max\Bigl(c_D^\ad(z,D),\ c_{\mathrm N}(\delta,z,D,d)^{1/\mu},\ e^{\beta_0(\delta)}(R_Gd)^{1/\mu},\ a^4(a!)^{r_U}\,d\,(e_0^{z}D)^{2(z+1)}\Bigr). \end{gather*} \needspace{4\baselineskip} \begin{theorem}\label{thm:adjoint} In this setting let $V$ be a special subvariety maximal in $Z$. \begin{enumerate}[(a)] \item $\deg V\le c_D^\ad(z,D)$. \item If $V$ is of class (S), then $\Delta(V)=\deg V\le c_D^\ad(z,D)$. \item If $V$ is of class (N) and $\QRH(\delta;L_V)$ holds, then $\alpha_V\,d_{L_V}^{\mu}\le c_{\mathrm N}(\delta,z,D,d)$; hence $\alpha_V\le c_{\mathrm N}(\delta,z,D,d)$ and $d_{L_V}\le c_{\mathrm N}(\delta,z,D,d)^{1/\mu}$. \item If $V$ is of class (C), then $T_V=T_Z$ and $\alpha_V\le a^4(a!)^{r_U}\,d\,(e_0^zD)^{2(z+1)}$; if moreover $\QRH(\delta;L_V)$ holds, then $d_{L_V}\le e^{\beta_0(\delta)}(R_Gd)^{1/\mu}$. \end{enumerate} In particular, if $\QRH(\delta;L_V)$ holds, then $\Delta(V)\le c^\ad(\delta,z,D,d)$. No hypothesis is used in (a), (b) and in the bound for $\alpha_V$ in (d). \end{theorem} The constants are non-decreasing in $z$, $D$ and $d$: so are $b_z$, $\Delta_z(D)$ and $\Delta_z(D)/C_*\ge1$, and $\mathcal B$ is non-decreasing in both arguments (\cref{lem:solve}); and $R_{z,D}$ is non-decreasing in $z$ and $D$. \needspace{4\baselineskip} \begin{remark}\label{rem:size} For adjoint $G$ the constant $c^\ad(\delta,z,D,d)$ is at most $\exp(O(d\log(d+1)))\,D^{O(1)}$, as $d\log\log(D+2)\le d\log d+\log(D+2)$. Indeed, with $\Lambda:=\Delta_z(D)/C_*=(c_BdD)^{2^z}/C_*$ and $b:=b_z=(k_1d+3f)2^z$ we have $\log c_{\mathrm N}=\log\Lambda+(b/\delta)\log(\varsigma(\mathcal W+1))$ and $\mathcal W=O(\log\Lambda+(b/\delta)\log(b/\delta))$, so for $V$ of class (N) \[ \alpha_V\,d_{L_V}^\mu\ \le\ \frac{(c_BdD)^{2^z}}{C_*}\,\exp\Bigl(O\bigl(d\log(d+1)+d\log\log(D+2)\bigr)\Bigr), \] the implied constants depending on $(G,X,K,\rho)$ and $\delta$. So, for fixed $d$, $\alpha_V\le D^{2^z+o(1)}$ and $d_{L_V}\le D^{2^z/\mu+o(1)}$ as $D\to\infty$, and $c_D^\ad(z,D)$ is at most $D^{2^z+o(1)}$ as well, as $\log\Pi_0(z,D)=O(\log D)$ (\cref{thm:D}). With the form $C(N)\alpha_V(\log d_{L_V})^N$ of the Galois bound used in \cite{KY} and a fixed $N>b/\delta$, the same argument bounds only $\alpha_V(\log d_{L_V})^{N-b/\delta}$, so $d_{L_V}$ would be exponential in a power of $D$, and for $N=\lfloor b/\delta\rfloor+2$, so that $N-b/\delta\ge1$, doubly exponential in $d$. For a general Shimura datum, \cref{thm:NA} evaluates these constants at $(D_n,d_n)$, where $D_n\le(e_0^{2n}D_0)^{2^n}$ and $d_n\le d_0(e_0^{2n}D_0)^{2^{n+1}}$: the recursion on dimension lets the field of definition grow, and the constant of \cref{thm:main} is exponential in a power of $D$. At $\delta=1/32$ the factor $1/C_*$ is large: $\log(1/c_*(\delta))=\mu\beta_0(\delta)=32\kappa(\delta)/(\mu\delta^2)$, about $2.0\cdot10^6/\mu$ (the first term of $\beta_0(\delta)$ is the largest, as $\kappa(\delta)/\delta^2\ge8$ and $1/\theta\ge8n_T\ge16$). \end{remark} \needspace{6\baselineskip} \subsection{The lift to the special closure} \begin{lemma}\label{lem:lift} \begin{enumerate}[(a)] \item Exactly one irreducible component $Z_P$ of $\psi^{-1}(Z)$ satisfies $\psi(Z_P)=Z$. It is Hodge generic, geometrically irreducible and defined over $FE_P$, and $\psi|_{Z_P}\colon Z_P\to Z$ is finite and birational; so $\deg_{\Lb_{K_P}}Z_P\le D$ by \cite[Cor.~5.3.10]{KY}. \item If $V\subset Z$ is special and maximal in $Z$, some component $V_P$ of $\psi^{-1}(V)\cap Z_P$ has $\psi(V_P)=V$. It is special in $\Sh_{K_P}(P,X_P)_\C$, maximal among the special subvarieties of $Z_P$, and has the same $T_V$, $\alpha_V$, $\beta_V$ and reflex field as $V$. \end{enumerate} \end{lemma} \begin{proof} (a) Let $z_0=[h_0,1]\in Z$, $h_0\in X_P^+$, have Mumford--Tate group $P$; such points form the complement in $Z$ of a countable union of proper closed subsets. If $[h,g]\in\psi^{-1}(z_0)$, then $h=qh_0$ for some $q\in G(\Q)$, so the Mumford--Tate group of $h$ is $qPq^{-1}$; it is contained in $P$, as $h\in X_P$, hence equal to $P$. So every point over $z_0$ is Hodge generic, and $\psi^{-1}(z_0)$ is one point by the injectivity of $\psi$ on the Hodge generic locus \cite[Lemma~2.2]{UY}. As $\psi$ is finite and $Z$ lies in its image, the smallest special subvariety containing $Z$ being the image of $X_P^+\times\{1\}$ (\cref{sec:setting}), some component of $\psi^{-1}(Z)$ maps onto $Z$. Two such components $C_1,C_2$ both contain the points over the Hodge generic points of $Z$, which are dense in each by Baire's theorem, as $\psi|_{C_i}$ is finite onto $Z$; so $C_1=C_2$. The group $\Gal(\Qbar/FE_P)$ permutes the components of $\psi^{-1}(Z)$ that map onto $Z$, so it fixes $Z_P$. Finally $\psi|_{Z_P}$ is finite and injective on a dense set, so of degree $1$, and $\deg_{\Lb_{K_P}}Z_P\le\deg Z=D$ by \cite[Cor.~5.3.10]{KY}, as $Z_P$ is Hodge generic and $Z(P)(\R)$ is compact. (b) Some component of $\psi^{-1}(V)\cap Z_P$ maps onto $V$, as $\psi|_{Z_P}$ is finite onto $Z$; it has dimension $\dim V$, so it is a component of $\psi^{-1}(V)$, hence special \cite[p.~14]{KY}. A special $V'$ with $V_P\subsetneq V'\subset Z_P$ would give the special subvariety $\psi(V')\subset Z$ of dimension larger than $\dim V$. Finally $V_P$ and $V$ are defined by the same Shimura datum $(H,X_H)\subset(P,X_P)$, $V_P$ being the image of $X_H^+\times\{1\}$ (\cref{sec:setting}), and $K_P\cap T(\Af)=K\cap T(\Af)$ for every torus $T\subset P$. \end{proof} \needspace{5\baselineskip} \begin{lemma}\label{lem:C0} If $V$ is special and maximal in $Z$, with $T_V\ne1$ and $T_V\subset Z(P)$, then $T_V=T_Z$. If moreover $V$ is a point, then $Z=V$. \end{lemma} \begin{proof} Let $\nu\colon P\to P^\ab:=P/P^\der$. All $h\in X_P$ have the same image $h^\ab:=\nu\circ h$, as $X_P$ is one $P(\R)$-conjugacy class and $P^\ab$ is commutative. The Mumford--Tate group of $h^\ab$ is the image of that of a Hodge generic $h$, so it is $P^\ab$. For $h\in X_{H_V}$ the Mumford--Tate group of $h$ lies in $H_V$ and maps onto that of $h^\ab$, so $\nu(H_V)=P^\ab$; as $H_V=T_V\cdot H_V^\der$ with $H_V^\der\subset P^\der$, $\nu(T_V)=P^\ab$. If $T_V\subset Z(P)$, then $T_V\subset Z(P)^\circ$, and $Z(P)^\circ\to P^\ab$ is an isogeny, so $\dim T_V\ge\dim Z(P)^\circ$ and $T_V=T_Z$. If $V$ is a point $h$, then $H_V=T_V$ is central in $P$, so $X_P=\{h\}$ and $Z=V$. \end{proof} \subsection{Class (C): the discriminant} \begin{lemma}\label{lem:Za} Suppose $T_Z\ne1$ and let $L$ be its splitting field. If $\QRH(\delta;L)$ holds, then $c_*(\delta)d_L^{\mu}\le R_Gd$, that is, $d_L\le e^{\beta_0(\delta)}(R_Gd)^{1/\mu}$. \end{lemma} \begin{proof} Let $S_P^+$ be the connected component of $\Sh_{K_P}(P,X_P)_\C$ containing $Z_P$. Every $\sigma\in\Gal(\Qbar/FE_P)$ fixes $Z_P$ (\cref{lem:lift}(a)), hence $S_P^+$; so the $\Gal(\Qbar/E_P)$-orbit of $S_P^+$ has at most $[FE_P:E_P]\le d$ members. Let $C:=P^\ab$, $\bar x:=h^\ab$, $E_C:=E(C,\bar x)\subset E_P$, $K^m_C$ the maximal compact open subgroup of $C(\Af)$ and $\mathrm{Cl}_C:=C(\Q)\backslash C(\Af)/K^m_C$. The map $\pi_0(\Sh_{K_P}(P,X_P)_\C)\to\mathrm{Cl}_C$, $[x,g]\mapsto[\nu(g)]$, is well defined, as $\nu(K_P)\subset K^m_C$, and it is $\Gal(\Qbar/E_P)$-equivariant when $\sigma$ acts on $\mathrm{Cl}_C$ by multiplication by $r_C(N_{E_P/E_C}(s_\sigma))$, where $s_\sigma$ is a finite idele of $E_P$ with Artin symbol $\sigma|_{E_P^\ab}$ and $r_C$ is the reciprocity morphism of $(C,\bar x)$. This follows from Shimura reciprocity at a special point $x$ of $X_P$ and $\nu\circ r_x=r_C\circ N_{E(x)/E_C}=r_C\circ N_{E_P/E_C}\circ N_{E(x)/E_P}$, as in \cite[\S13, (64) and footnote~73]{Milne}; that argument does not use that $P^\der$ is simply connected. Hence the orbit of $S_P^+$ has at least $|\mathrm{Im}_{E_P}|$ members, where $\mathrm{Im}_{E_P}$ is the image of $r_C\circ N_{E_P/E_C}$ in $\mathrm{Cl}_C$. The splitting field of $C$ is $L$, as $C$ and $T_Z$ are isogenous \cite[Remark~2.20]{UY}, and $E_C\subset L$ \cite[Remark~12.3(a)]{Milne}. Let $L':=LE_P$. Since $N_{E_P/E_C}\circ N_{L'/E_P}=N_{L/E_C}\circ N_{L'/L}$, $\mathrm{Im}_{E_P}$ contains the image of $N_{L'/L}((\Af\otimes L')^\times)$ under $r_L:=r_C\circ N_{L/E_C}$. As in the proof of \cref{cor:D}, this image has index at most $[L':L]\le[E_P:\Q]\le R_G$ in $\mathrm{Im}_L$. \Cref{prop:C}, applied to $(H,X_H)=(P,X_P)$, gives $|\mathrm{Im}_L|\ge c_*(\delta)d_L^\mu$. So $c_*(\delta)d_L^\mu/R_G\le d$. \end{proof} \subsection{Class (C): the level} \begin{lemma}\label{lem:S} Let $Y\subset\PP^N_\C$ be closed, reduced and of pure dimension, of degree $e$ (the sum of the degrees of its components). Then $Y$ is the common zero set of the forms of degree $e$ vanishing on $Y$. \end{lemma} \begin{proof} Let $Y=Y_1\cup\dots\cup Y_t$, with $\deg Y_i=a_i$ and $\dim Y=:m\Delta_r(D)x_V^{b_r}$, then $\Omega_V>\Delta_r(D_Z)x_V^{b_r}$, as $\Delta_r$ is increasing, and \cref{thm:H} gives a special $V'$ with $V_P\subsetneq V'\subset Z_P$, and $\psi(V')\subset Z$ is special of dimension larger than $\dim V$, against maximality. So $\alpha_Vd_{L_V}^\mu\le(\Delta_r(D)/C_*)\,x_V^{b_r}$, and \cref{lem:solve} gives $\alpha_Vd_{L_V}^\mu\le\mathcal B(\Delta_r(D)/C_*,b_r)\le c_{\mathrm N}(\delta,z,D,d)$, as $r\le z$, $\Delta_r(D)/C_*\ge1$ and $b_r$, $\Delta_r(D)$ are non-decreasing in $r$. As $\alpha_V\ge1$ and $d_{L_V}\ge1$, both bounds follow. (d) $T_V=T_Z$ by \cref{lem:C0}, so $L_V$ is the splitting field of $T_Z$; \cref{lem:Za,lem:Zb} give the bounds. The last assertion follows from (a)--(d), since the three classes exhaust the maximal $V$. \qed \subsection{One neat factor suffices}\label{sec:Lvprime} Klingler and Yafaev's normalization (Lv) asks for a neat factor at $3$; for $\mathcal A_g$ at the level $K(N)$ the adjoint level $\lambda(K(N))$ has one at a prime dividing $N$, which need not be $3$ (\cref{thm:AgK}(a)). Only a neat factor at some prime is used: \begin{enumerate}[label=(Lv$'$)] \item $K$ is a neat product level, $\rho(K)\subset\mathrm{GL}_{n_\rho}(\Zhat)$, and $K_{p_0}$ is neat for some prime $p_0$. \end{enumerate} \needspace{4\baselineskip} \begin{proposition}\label{prop:Lvprime} \Cref{thm:adjoint} holds with (Lv$'$) in place of (Lv), with the constants of \cref{sec:constants} at the level $K$ itself. \end{proposition} \begin{proof} We go through the uses of (Lv) in the proof of \cref{thm:adjoint}. (1) The Hecke step (\cref{thm:hecke-uniform}) uses the proof of \cite[Thm.~7.2.1]{KY} when $\widetilde Z\subset T_m\widetilde Z$, at a prime $l$ with $K_l$ hyperspecial. That theorem assumes only that $K_{p_0}$ is neat for some prime $p_0$, and its proof, like Step~3 of the proof of \cref{thm:hecke-uniform} run with $p_0$ in place of $3$, uses $p_0$ only through the neatness of $K_{p_0}\cap P(\Q_{p_0})$ for Shimura subdata $(P,X_P)$ \cite[p.~21]{KY} and of its images under $\lambda\colon P\to P^\ad$ (the factor $I^\ad_{p_0}$ of that Step~3) and under the projections to the $\Q$-simple factors of $P^\ad$ \cite[p.~32 and Lemma~7.2.8]{KY}, which are neat as images of a subgroup of the neat group $K_{p_0}$ \cite[0.6]{Pink}; and $l\ne p_0$, since a hyperspecial subgroup is not neat. (2) The other results of \cite{KY,UY,EY} that we use (the proofs of \cite[Thm.~2.4.4]{KY} and \cite[Thm.~2.19]{UY}, used through \cref{cor:D}; \cite[Prop.~2.9, Lemmas~2.11, 2.15 and 2.18]{UY}, used in \cref{lem:Zb}; \cite[Cor.~5.3.10, Lemma~6.2, Prop.~8.2.1, Thm.~8.1, Sublemma~9.2.4 and pp.~46--51]{KY} and \cite[Prop.~7.4.3]{EY}), \cref{lem:lift}, \cref{thm:e0}, \cref{lem:bezout}, \cref{thm:D} and \cref{cor:D} need only that $K$, or the arithmetic groups of its components, are neat \cite[p.~20]{UY}. (3) The constant $a$ and Step~3 of the proof of \cref{lem:Zb} use the auxiliary level of \cite[pp.~21--22]{UY}, which is neat because of its own factor at $3$, whatever $K_3$ is. (4) \Cref{lem:SP,lem:Aprime,prop:B,prop:C,lem:Za,lem:C0} use no condition on the level beyond neatness. \end{proof} \section{Every Shimura datum}\label{sec:general} Let $(G,X)$ be any Shimura datum, $K=\prod_pK_p$ a neat product level, $\rho\colon G\to\mathrm{GL}_{n_\rho}$ faithful with $\rho(K)\subset\mathrm{GL}_{n_\rho}(\Zhat)$, $\lambda\colon G\to G^\ad$ the adjoint map and $(G^\ad,X^\ad)$ the adjoint datum. The morphism $f\colon\Sh_K(G,X)\to\Sh_{K^\ad}(G^\ad,X^\ad)$, for a level $K^\ad\supset\lambda(K)$, maps special subvarieties to special subvarieties, and a subvariety is special if and only if its image is \cite[Prop.~2.2]{EY}. But $f$ need not be injective on connected components, and then a special subvariety maximal in $Z$ can have an image that is not maximal in $f(Z)$. On each component $f$ is the quotient by a finite group of automorphisms, and we recurse on the dimension at the fixed level. \subsection{The level} \begin{lemma}\label{lem:LV} Let $K'_p:=K_p$ for $p\ne3$, $K'_3:=K_3\cap\ker(\mathrm{GL}_{n_\rho}(\Z_3)\to\mathrm{GL}_{n_\rho}(\F_3))$, $K':=\prod_pK'_p$ and $g_3:=|\mathrm{GL}_{n_\rho}(\F_3)|$. Then $K'$ satisfies (Lv), $[K:K']\le g_3$, and $\pi\colon\Sh_{K'}(G,X)\to\Sh_K(G,X)$ is finite étale of degree at most $[K:K']$ with $\pi^*\Lb_K=\Lb_{K'}$. Let $Z\subset\Sh_K(G,X)$ be closed and geometrically irreducible, defined over $F\supset E(G,X)$, of degree $D$, and $V$ special and maximal in $Z$. Then there are a closed, geometrically irreducible $Z'\subset\Sh_{K'}(G,X)$, defined over a field of degree at most $\deg\pi\cdot[F:\Q]$, with $\deg_{\Lb_{K'}}Z'\le\deg\pi\cdot D$, and a special $V'$ maximal in $Z'$ with $\pi(V')=V$, $\deg V\le\deg_{\Lb_{K'}}V'$ and $T_{V'}=T_V$. \end{lemma} \begin{proof} $K/K'$ acts transitively on the fibres of $\pi$, and for neat $K$ the stabilizers are the image of $Z(G)(\Q)\cap K$, which acts trivially; so $\pi$ is finite étale of degree at most $[K:K']$, and $\pi^*\Lb_K=\Lb_{K'}$ \cite[Prop.~5.3.2(1)]{KY}. Choose a component $V'$ of $\pi^{-1}(V)$ and a component $Z'$ of $\pi^{-1}(Z)$ containing it. The set $\pi^{-1}(Z)$ is defined over $F$ and has at most $\deg\pi$ components, which gives the field of $Z'$; and $\deg_{\Lb_{K'}}Z'\le\deg_{\Lb_{K'}}\pi^{-1}(Z)=\deg\pi\cdot D$ by the projection formula. If $V'\subsetneq V''\subset Z'$ with $V''$ special, $\pi(V'')$ would be a special subvariety of $Z$ of dimension larger than $\dim V$. \end{proof} Since $gK'g^{-1}\cap T(\Af)\subset gKg^{-1}\cap T(\Af)$ for every torus $T$ and every $g\in G(\Af)$, each index $|K^m_{T,p}/K_{T,p}|$ can only grow when $K$ is replaced by $K'$, so $\alpha$ computed at $K'$ is at least $\alpha$ computed at $K$. For the rest of this section we replace $K$ by $K'$, so that $K_3$ lies in the level-$3$ congruence subgroup for $\rho$. \emph{An integral model.} Let $\mathcal G$ be the schematic closure of $\rho(G)$ in $\mathrm{GL}_{n_\rho,\Z}$. For some integer $M_0$ it is reductive over $\Z[1/M_0]$: its non-smooth locus lies over finitely many primes, as $\mathcal G\to\mathrm{Spec}\,\Z$ is of finite presentation with smooth generic fibre \cite[Tag~054K]{Stacks}, and then \cite[Props.~3.1.9 and 3.1.12]{Conrad} apply. Let $\mathcal S$ be the finite set of primes consisting of $3$, the primes dividing $M_0$, and the $p$ with $K_p\ne\mathcal G(\Z_p)$. For $p\notin\mathcal S$ put $\mathcal G_p:=\mathcal G\otimes\Z_p$, let $\mathcal Z_p$ be its centre, a group of multiplicative type with generic fibre $Z(G)$ \cite[Thm.~3.3.4]{Conrad}, and $\mathcal G_p^\ad:=\mathcal G_p/\mathcal Z_p$, an adjoint semisimple $\Z_p$-group with generic fibre $G^\ad$; the sequence $1\to\mathcal Z_p\to\mathcal G_p\to\mathcal G_p^\ad\to1$ is exact as fppf sheaves \cite[Lemma~3.3.1(2), Cor.~3.3.5]{Conrad}. \emph{The adjoint level.} Put \[ K^\ad:=\prod_{p\in\mathcal S}\lambda(K_p)\times\prod_{p\notin\mathcal S}\mathcal G_p^\ad(\Z_p)\ \subset G^\ad(\Af). \] When $Z(G)$ is not connected, $\lambda(K)$ itself need not be open: for $V=M_2(\Q)$ with the quadratic form $\det$, $\mathrm{SO}(V)=\{(A,B)\in\mathrm{GL}_2^2:\det A=\det B\}/\Gm$ has centre $\mu_2$ and adjoint group $\mathrm{PGL}_2^2$, and the image of $\mathrm{SO}(V)(\Z_p)$ has index $2$ in $\mathrm{PGL}_2(\Z_p)^2$ for odd $p$. \begin{lemma}\label{lem:Kad} \begin{enumerate}[(i)] \item $K^\ad$ is a compact open subgroup of $G^\ad(\Af)$ containing $\lambda(K)$, and it normalizes $K$ for the action of $G^\ad$ on $G$ by inner automorphisms. \item Let $\rho^\ad:=\mathrm{Ad}\colon G^\ad\to\mathrm{GL}(\mathrm{Lie}\,G^\der)$ and $\Lambda:=\mathrm{Lie}\,G^\der\cap\mathrm{End}(\Z^{n_\rho})$, via $d\rho$. Then $\rho^\ad(K^\ad)$ preserves $\Lambda\otimes\Zhat$, $K^\ad_3$ lies in the level-$3$ congruence subgroup for $(\rho^\ad,\Lambda)$, and $K^\ad$ is neat. So $K^\ad$ satisfies (Lv) for $(\rho^\ad,\Lambda)$. \item $\lambda^{-1}(K^\ad)=Z(G)(\Af)\cdot K$. \item If $Z(G)$ is connected, then $K^\ad=\lambda(K)$. \end{enumerate} \end{lemma} \begin{proof} (i) Each $\lambda(K_p)$ is compact open, as $\lambda$ is smooth, and for $p\notin\mathcal S$ the factor is $\mathcal G^\ad(\Z_p)$ for the model $\mathcal G/Z(\mathcal G)$ of $G^\ad$ over $\Z[1/M_0]$; so $K^\ad$ is compact open. At $p\notin\mathcal S$, $\lambda(\mathcal G_p(\Z_p))\subset\mathcal G_p^\ad(\Z_p)$. At $p\in\mathcal S$, $\mathrm{Int}(\lambda(k))=\mathrm{Int}(k)$ preserves $K_p$; at $p\notin\mathcal S$ the conjugation action of $\mathcal G_p$ on itself factors through $\mathcal G_p^\ad$ \cite[proof of Cor.~3.3.5]{Conrad}, so $\mathcal G_p^\ad(\Z_p)$ preserves $\mathcal G_p(\Z_p)=K_p$. (ii) At $p\in\mathcal S$, $\mathrm{Ad}(\lambda(k))$ is conjugation by $\rho(k)\in\mathrm{GL}_{n_\rho}(\Z_p)$, which preserves $\mathrm{End}(\Z_p^{n_\rho})$ and $\mathrm{Lie}\,G^\der\otimes\Q_p$. At $p\notin\mathcal S$, $\Lambda\otimes\Z_p$ is the Lie algebra of the derived group $\mathcal G_p^\der$ \cite[Thm.~5.3.1]{Conrad}, a smooth closed subgroup of $\mathrm{GL}_{n_\rho,\Z_p}$, whose Lie algebra is saturated in $\mathrm{End}(\Z_p^{n_\rho})$; and $\mathcal G_p^\ad$ acts on $\mathcal G_p^\der$ by (i). For $k\in K_3$ write $\rho(k)=1+3B$ and $\rho(k)^{-1}=1+3B'$ with $B,B'$ integral; then $\rho(k)Y\rho(k)^{-1}-Y=3(BY+YB'+3BYB')$ lies in $3\,\mathrm{End}(\Z_3^{n_\rho})\cap(\mathrm{Lie}\,G^\der\otimes\Q_3)=3(\Lambda\otimes\Z_3)$. For neatness: the eigenvalues of $\mathrm{Ad}(\lambda(k_3))$ are ratios of eigenvalues of $\rho(k_3)$, which are $\equiv1$ modulo $3$ in $\overline{\Z}_3$, so every element $\xi$ of the group they generate satisfies $\xi\equiv1\bmod3$, and a root of unity $\equiv1\bmod3$ is $1$ \cite[p.~5]{Pink}. So every element of $K^\ad$ is neat in the sense of \cite[0.6]{Pink}, and so is every conjugate of $K^\ad$ under $G^\ad(\Af)$. (iii) ``$\supset$'' is clear, and at $p\in\mathcal S$ the kernel of $\lambda$ on $G(\Q_p)$ is $Z(G)(\Q_p)$. Let $p\notin\mathcal S$, $x\in G(\Q_p)$ with $y:=\lambda(x)\in\mathcal G_p^\ad(\Z_p)$. By \cref{lem:delta} below, applied over $\Z_p$ and $\Q_p$, the class of $y$ in $H^1(\Z_p,\mathcal Z_p)$ maps to $0$ in $H^1(\Q_p,Z(G))$, as $y$ lifts to $x$. We show that $H^1(\Z_p,\mathcal Z_p)\to H^1(\Q_p,Z(G))$ is injective; then $y=\lambda(k)$ with $k\in\mathcal G_p(\Z_p)$, and $x\in Z(G)(\Q_p)K_p$. Let $\mathcal T\subset\mathcal G_p$ be a maximal torus over $\Z_p$; it exists by \cite[Thm.~3.2.6]{Conrad}, Lang's theorem and Hensel's lemma, and contains $\mathcal Z_p$ \cite[Cor.~3.3.5]{Conrad}. Let $\mathcal Z_p^\circ$ be the maximal subtorus of $\mathcal Z_p$ \cite[App.~B]{Conrad}, $\mathcal T_1:=\mathcal T/\mathcal Z_p^\circ$ and $\mathcal T^\ad:=\mathcal T/\mathcal Z_p$, so that $\lambda|_{\mathcal T}=\mu\circ\pi$ with $\mu\colon\mathcal T_1\to\mathcal T^\ad$ an isogeny. Torsors under a smooth affine $\Z_p$-group with connected special fibre are trivial (Lang's theorem and Hensel's lemma), so $H^1(\Z_p,\mathcal T)=H^1(\Z_p,\mathcal Z_p^\circ)=0$ and $H^1(\Z_p,\mathcal Z_p)=\mathcal T^\ad(\Z_p)/\lambda(\mathcal T(\Z_p))$, which maps to $T^\ad(\Q_p)/\lambda(T(\Q_p))\subset H^1(\Q_p,Z(G))$. Let $u\in\mathcal T^\ad(\Z_p)$ with $u=\lambda(t)$, $t\in T(\Q_p)$. For every character $\chi$ of $\mathcal T_1$ over an unramified splitting field, some multiple $m\chi$ is a character $\chi'$ of $\mathcal T^\ad$, so $|\chi(\pi(t))|^m=|\chi'(u)|=1$; hence $\pi(t)\in\mathcal T_1(\Z_p)$. As $H^1(\Z_p,\mathcal Z_p^\circ)=0$, $\pi(t)=\pi(t')$ with $t'\in\mathcal T(\Z_p)$, so $t'^{-1}t\in Z(G)(\Q_p)$ and $u=\lambda(t')\in\lambda(\mathcal T(\Z_p))$. Adelically, if $x=(z_pk_p)_p$, then $z_p\in Z(G)(\Q_p)\cap\mathcal G_p(\Z_p)$ for almost all $p$, so $(z_p)\in Z(G)(\Af)$. (iv) If $Z(G)$ is connected, $\mathcal Z_p$ is a torus for $p\notin\mathcal S$, $H^1(\Z_p,\mathcal Z_p)=0$, and $\lambda(\mathcal G_p(\Z_p))=\mathcal G_p^\ad(\Z_p)$ by \cref{lem:delta}. \end{proof} \needspace{4\baselineskip} \begin{lemma}\label{lem:delta} Let $R$ be a ring and $1\to\mathcal Z\to\mathcal G\to\mathcal G'\to1$ an exact sequence of fppf sheaves of groups over $R$ with $\mathcal Z$ central. Then $\mathcal G(R)\to\mathcal G'(R)\xrightarrow{\ \partial\ }H^1_{\mathrm{fppf}}(R,\mathcal Z)$ is exact, and $\partial$ is a homomorphism. \end{lemma} \begin{proof} For $y\in\mathcal G'(R)$ the sheaf $P_y$ of local lifts of $y$ is a $\mathcal Z$-torsor: $\mathcal Z$ acts simply transitively, and $P_y$ has sections locally, as $\mathcal G\to\mathcal G'$ is an epimorphism. Let $\partial(y)$ be its class \cite[Tag~03AJ]{Stacks}; it vanishes if and only if $P_y(R)\ne\emptyset$. The map $(a,b)\mapsto ab$ identifies $P_y\wedge^{\mathcal Z}P_{y'}$ with $P_{yy'}$, which is well defined because $\mathcal Z$ is central, and the class of a contracted product is the sum of the classes: the group law on $H^1$ is the contracted product, since on a cover trivializing both torsors the contracted product has the product Čech cocycle. \end{proof} \subsection{The adjoint map on one component} Let $S_i=[X^+\times g_i]$ be a connected component of $\Sh_K(G,X)_\C$, $\Gamma_i:=G(\Q)_+\cap g_iKg_i^{-1}$, so that $S_i=\lambda(\Gamma_i)\backslash X^+$, and $\Gamma'_i:=G^\ad(\Q)_+\cap\lambda(g_i)K^\ad\lambda(g_i)^{-1}$, so that the component of $\Sh_{K^\ad}(G^\ad,X^\ad)_\C$ containing $f(S_i)$ is $\Gamma'_i\backslash X^+$. Put $\mathfrak G_i:=\Gamma'_i/\lambda(\Gamma_i)$, \[ h_K:=\max_i|\mathfrak G_i|, \] and let $\mathrm{Cl}(K):=Z(G)(\Q)\backslash Z(G)(\Af)/(Z(G)(\Af)\cap K)$, which is finite. \needspace{4\baselineskip} \begin{proposition}\label{prop:adjmap} \begin{enumerate}[(a)] \item $\lambda(\Gamma_i)$ is a normal subgroup of finite index of $\Gamma'_i$, both are neat and arithmetic, and $f|_{S_i}\colon S_i\to\Gamma'_i\backslash X^+$ is the quotient by $\mathfrak G_i$, which acts freely. So $h_K$ is finite. \item Each element of $\mathfrak G_i$ is an automorphism of $S_i$ that extends to the Baily--Borel compactification and preserves $\Lb_K$. If $S_i$ is defined over $F\supset E(G,X)$, all these automorphisms are defined over one extension $F_{\mathfrak G}$ of $F$ of degree at most $h_K!$. Each $\bar\gamma\in\Gamma'_i\cap\lambda(G(\Q))$ acts as right translation by an element of $Z(G)(\Af)$, which is defined over $E(G,X)$; so $F_{\mathfrak G}=F$ if $\Gamma'_i\subset\lambda(G(\Q))$ for every $i$. \item $f^*\Lb_{K^\ad}=\Lb_K$ on the compactification of $S_i$. Hence, for every closed irreducible $Y\subset S_i$, we have $\deg_{\Lb_{K^\ad}}f(Y)\le\deg Y$ and $\deg Y\le h_K\deg_{\Lb_{K^\ad}}f(Y)$. \item Let $\mathrm{Sel}_{\mathcal S}(Z(G))$ be the set of $c\in H^1(\Q,Z(G))$ with $c_\infty=0$, $c_p=0$ for $p\in\mathcal S$, and $c_p$ in the image of $H^1(\Z_p,\mathcal Z_p)$ for $p\notin\mathcal S$. Then $|\mathfrak G_i|\le|\mathrm{Cl}(K)|\cdot|\mathrm{Sel}_{\mathcal S}(Z(G))|$. If $\mathrm{Sel}_{\mathcal S}(Z(G))=0$, which holds if $H^1(\Q,Z(G))=0$ or if $Z(G)$ is split, then $\Gamma'_i\subset\lambda(G(\Q))$ and $|\mathfrak G_i|\le|\mathrm{Cl}(K)|$. \end{enumerate} \end{proposition} \begin{proof} Here $G(\Q)_+=G(\Q)\cap\lambda^{-1}(G^\ad(\R)^+)$, as in \cref{sec:shimura}. (a) $\lambda(\Gamma_i)\subset\Gamma'_i$ by \cref{lem:Kad}(i). By \cref{lem:arith} with $U=K^\ad$, $\lambda(\Gamma_i)$ and $\Gamma'_i$ are arithmetic and $[\Gamma'_i:\lambda(\Gamma_i)]$ is finite. They are neat by \cref{lem:Kad}(ii) and \cite[0.5--0.6]{Pink}. Let $\bar\gamma\in\Gamma'_i$, $\bar\gamma=\lambda(g_i)\kappa\lambda(g_i)^{-1}$ with $\kappa\in K^\ad$. On $G(\Af)$, $\mathrm{Int}(\bar\gamma)$ preserves $g_iKg_i^{-1}$ by \cref{lem:Kad}(i); it preserves $G(\Q)$, and $G(\Q)_+$ because $\lambda(\mathrm{Int}(\bar\gamma)\gamma')=\bar\gamma\lambda(\gamma')\bar\gamma^{-1}$. So $\mathrm{Int}(\bar\gamma)\Gamma_i=\Gamma_i$, and $\lambda(\Gamma_i)$ is normal in $\Gamma'_i$. As $\Gamma'_i$ is neat, it acts freely on $X^+$, and $f|_{S_i}$ is the Galois covering with group $\mathfrak G_i$. (b) Each $\bar\gamma\in\Gamma'_i$ normalizes $\lambda(\Gamma_i)$, so it induces an automorphism of $S_i$, which extends to the compactification and preserves the extension of the canonical bundle. $\Gal(\Qbar/F)$ acts on the finite group $\mathfrak G_i=\mathrm{Aut}(S_i/f(S_i))$ by conjugation, and the kernel of this action has index at most $|\mathrm{Aut}\,\mathfrak G_i|\le h_K!$. If $\bar\gamma=\lambda(\gamma)$ with $\gamma\in G(\Q)$, then $\gamma\in G(\Q)_+$, and $\gamma\in g_i\lambda^{-1}(K^\ad)g_i^{-1}=Z(G)(\Af)g_iKg_i^{-1}$ by \cref{lem:Kad}(iii); writing $\gamma=zk$ we get $[\bar\gamma^{-1}x,g_i]=[x,\gamma g_i]=[x,g_izk']$ with $k'\in K$, as $z$ is central. So $\bar\gamma$ acts as right translation by $z^{-1}$, a Hecke translation, defined over $E(G,X)$. (c) $f|_{S_i}$ is étale between quotients of $X^+$ by neat groups, so it pulls top-degree forms back to top-degree forms; the two extensions agree in codimension one on the normal compactification, as logarithmic forms pull back to logarithmic forms, and so are isomorphic (compare \cite[Prop.~5.3.2]{KY}). The projection formula and $\deg(f|_Y)\le|\mathfrak G_i|$ give the inequalities. (d) Let $\partial\colon G^\ad(\Q)\to H^1(\Q,Z(G))$ be the connecting map of \cref{lem:delta}, a homomorphism with kernel $\lambda(G(\Q))$. For each place $v$, $\partial_v(\bar\gamma)=\partial_v(\kappa_v)$, since $\partial_v$ kills $\lambda(G(\Q_v))\ni\lambda(g_{i,v})$. So $\partial_p(\bar\gamma)=0$ for $p\in\mathcal S$, as $\kappa_p\in\lambda(K_p)$; $\partial_p(\bar\gamma)$ comes from $H^1(\Z_p,\mathcal Z_p)$ for $p\notin\mathcal S$, as $\kappa_p\in\mathcal G_p^\ad(\Z_p)$; and $\partial_\infty(\bar\gamma)=0$, as $G(\R)^+\to G^\ad(\R)^+$ is onto. Hence $\Gamma'_i/(\Gamma'_i\cap\lambda(G(\Q)))$ embeds in $\mathrm{Sel}_{\mathcal S}(Z(G))$. Next, $\bar\gamma=\lambda(zk)\mapsto[z]$, with $z,k$ as in (b), is a well-defined homomorphism $(\Gamma'_i\cap\lambda(G(\Q)))/\lambda(\Gamma_i)\to\mathrm{Cl}(K)$: $\gamma$ is determined up to $Z(G)(\Q)$, and then $z$ up to $Z(G)(\Af)\cap K$. It is injective: if $z=rw$ with $r\in Z(G)(\Q)$ and $w\in Z(G)(\Af)\cap K$, then $r^{-1}\gamma=wk\in\Gamma_i$. If $Z(G)$ is split, a product of copies of $\Gm$ and of groups $\mu_m$, then $H^1(\Q,\Gm)=0$ and $H^1(\Q,\mu_m)=\Q^\times/\Q^{\times m}$, and a class $a$ in $\mathrm{Sel}_{\mathcal S}$ has $v_p(a)\equiv0\bmod m$ for $p\notin\mathcal S$ and is an $m$-th power in $\Q_p$ for $p\in\mathcal S$, so $a\in\pm\Q^{\times m}$; for $m$ odd $-1$ is an $m$-th power, and for $m$ even $c_\infty=0$ excludes $-1$. So $\mathrm{Sel}_{\mathcal S}(Z(G))=0$. \end{proof} For example, for $\mathrm{SO}(V)$ with $V$ of signature $(2,m)$, $m\ge2$ even, $Z(G)=\mu_2$ is split, and $h_K\le2^{|\mathcal S|-1}$, since $-1\notin K_3$. \subsection{A closed bound for \texorpdfstring{$h_K$}{h\_K}}\label{sec:hK} The factor $h_K$ enters both bounds of \cref{thm:NA}; here we bound it in closed form (\cref{cor:H}). \Cref{prop:adjmap}(d) bounds $h_K$ by $|\mathrm{Cl}(K)|\cdot|\mathrm{Sel}_{\mathcal S}(Z(G))|$. We bound both factors in terms of the centre. Let $\Xi:=X^*(Z(G))$, a finitely generated abelian group with a continuous action of $\Gal(\Qbar/\Q)$, $r_Z$ its rank, $Z(G)^\circ$ the maximal subtorus of $Z(G)$, with character group $\Xi/\Xi_{\mathrm{tors}}$, and $\Pi_Z:=Z(G)/Z(G)^\circ$, finite of multiplicative type with character group $\Xi_{\mathrm{tors}}$. Write $\Xi_{\mathrm{tors}}\cong\bigoplus_{i=1}^{q}\Z/m_i\Z$ with all $m_i\ge2$, and $m_Z:=|\Xi_{\mathrm{tors}}|=\prod_im_i$. Let $L_0$ and $L_1$ be the fields fixed by the kernels of the Galois actions on $\Xi_{\mathrm{tors}}$ and on $\Xi/\Xi_{\mathrm{tors}}$, Galois over $\Q$, with $n_{L_0}:=[L_0:\Q]$ and $n_{L_1}:=[L_1:\Q]$. For a number field $L$ let $r_1(L)$, $r_2(L)$ be its numbers of real and complex places and $h_L$ its class number; for a finite group $\mathfrak H$ let $\mathrm{gen}(\mathfrak H)\le\log_2|\mathfrak H|$ be its least number of generators; and for $m\ge1$ put $L(\emptyset,m):=\{a\in L^\times/L^{\times m}:v_w(a)\equiv0\bmod m\text{ for every finite place }w\}$. For a torus $T$ over $\Q$ let $T(\Q_p)^c$ be the maximal compact subgroup of $T(\Q_p)$ and $\ker^1_f(\Q,T):=\ker\bigl(H^1(\Q,T)\to\prod_pH^1(\Q_p,T)\bigr)$. As in the rest of this section, $K$ satisfies (Lv), and $\mathcal S$, $\mathcal G_p$, $\mathcal Z_p$ are as in \cref{lem:Kad}; for $p\notin\mathcal S$ let $\mathcal Z_p^\circ$ be the maximal subtorus of $\mathcal Z_p$ and $\mathcal P_p:=\mathcal Z_p/\mathcal Z_p^\circ$. We use the following facts for $p\notin\mathcal S$. (M1) $\mathcal Z_p^\circ$ has generic fibre $Z(G)^\circ$, and $1\to\mathcal Z_p^\circ\to\mathcal Z_p\to\mathcal P_p\to1$ is exact as fppf sheaves, with $\mathcal P_p$ finite flat of multiplicative type with generic fibre $\Pi_Z$: after a finite unramified extension $\mathcal Z_p$ becomes diagonalizable \cite[Prop.~B.3.4]{Conrad}, where this is clear, and everything descends, the maximal subtorus being unique and compatible with base change \cite[App.~B]{Conrad}. (M2) The Galois modules $\Xi$, $\Xi_{\mathrm{tors}}$ and $\Xi/\Xi_{\mathrm{tors}}$ are unramified at $p$ \cite[Prop.~B.3.4]{Conrad}; so $p$ is unramified in $L_0$ and $L_1$, and $\mathcal P_p\otimes\mathcal O_w\cong\prod_i\mu_{m_i}$ for every place $w\mid p$ of $L_0$. (M3) $H^1_{\mathrm{fppf}}(\Z_p,\mathcal T)=0$ for every torus $\mathcal T$ over $\Z_p$, by Lang's theorem and Hensel's lemma. (M4) For a finite $\Z_p$-scheme $\mathcal Q$, $\mathcal Q(\Z_p)=\mathcal Q(\Q_p)$; hence $\Pi_Z(\Q_p)=\mathcal P_p(\Z_p)$, and $H^1_{\mathrm{fppf}}(\Z_p,\mathcal P_p)\to H^1(\Q_p,\Pi_Z)$ is injective, since a $\mathcal P_p$-torsor is affine \cite[Tag~0245]{Stacks} and finite over $\Z_p$, so a $\Q_p$-point of it is a $\Z_p$-point. (M5) For a discrete valuation ring $\mathcal O$ with fraction field $L$, $H^1_{\mathrm{fppf}}(\mathcal O,\mu_m)=\mathcal O^\times/\mathcal O^{\times m}$, with image $\mathcal O^\times L^{\times m}/L^{\times m}$ in $H^1(L,\mu_m)=L^\times/L^{\times m}$ (Kummer theory and $\mathrm{Pic}(\mathcal O)=0$). (M6) $Z(G)(\Q_p)\cap K_p=\mathcal Z_p(\Z_p)$ and $Z(G)^\circ(\Q_p)\cap K_p=\mathcal Z_p^\circ(\Z_p)=Z(G)^\circ(\Q_p)^c$: a point of $\mathcal G_p(\Z_p)$ whose generic fibre lies in $\mathcal Z_p$ factors through this schematic closure, and for a torus split over an unramified extension the $\Z_p$-points are the points on which all characters are units, as in the proof of \cref{lem:Kad}(iii). Let $\partial_v\colon\Pi_Z(\Q_v)\to H^1(\Q_v,Z(G)^\circ)$ be the connecting maps, and $\mathrm{Sel}_{\mathcal S}(\Pi_Z)$ the set of $a\in H^1(\Q,\Pi_Z)$ with $a_v=0$ for $v\in\mathcal S\cup\{\infty\}$ and $a_p$ in the image of $H^1_{\mathrm{fppf}}(\Z_p,\mathcal P_p)$ for $p\notin\mathcal S$. \begin{proposition}\label{prop:selA} $|\mathrm{Sel}_{\mathcal S}(Z(G))|\le|\mathrm{Sel}_{\mathcal S}(\Pi_Z)|\cdot|\ker^1_f(\Q,Z(G)^\circ)|\cdot\prod_{p\in\mathcal S}|\partial_p(\Pi_Z(\Q_p))|$, and the last factor is at most $m_Z^{|\mathcal S|}$. \end{proposition} \begin{proof} Let $\phi\colon H^1(\Q,Z(G))\to H^1(\Q,\Pi_Z)$ and $\iota\colon H^1(\Q,Z(G)^\circ)\to H^1(\Q,Z(G))$ be the maps of $1\to Z(G)^\circ\to Z(G)\to\Pi_Z\to1$. First, $\phi(\mathrm{Sel}_{\mathcal S}(Z(G)))\subset\mathrm{Sel}_{\mathcal S}(\Pi_Z)$: at $p\notin\mathcal S$, $c_p$ is the restriction of some $\gamma\in H^1(\Z_p,\mathcal Z_p)$, and $\phi_p(c_p)$ is the restriction of the image $\bar\gamma$ of $\gamma$ in $H^1(\Z_p,\mathcal P_p)$. Let $c\in\mathrm{Sel}_{\mathcal S}(Z(G))$ with $\phi(c)=0$. For $p\notin\mathcal S$, $\bar\gamma=0$ by (M4), so $\gamma=0$ by (M1) and (M3), and $c_p=0$; so $c_v=0$ at every place. Write $c=\iota(b)$. For every $v$, $\iota_v(b_v)=0$, so $b_v\in\partial_v(\Pi_Z(\Q_v))$; for $p\notin\mathcal S$ this is $0$, since by (M4) every $x\in\Pi_Z(\Q_p)$ lies in $\mathcal P_p(\Z_p)$ and $\partial_p(x)$ is the restriction of a class in $H^1(\Z_p,\mathcal Z_p^\circ)=0$ (\cref{lem:delta}). The map $b\mapsto(b_p)_{p\in\mathcal S}\in\prod_{p\in\mathcal S}\partial_p(\Pi_Z(\Q_p))$ has kernel in $\ker^1_f(\Q,Z(G)^\circ)$ on the set of such $b$. Counting gives the bound, and $|\Pi_Z(\Q_p)|\le m_Z$. \end{proof} \begin{proposition}\label{prop:selB} \[ |\mathrm{Sel}_{\mathcal S}(\Pi_Z)|\le|H^1(\Gal(L_0/\Q),\Pi_Z(L_0))|\cdot\prod_{i=1}^{q}|L_0(\emptyset,m_i)|\le m_Z^{\mathrm{gen}(\Gal(L_0/\Q))+r_1(L_0)+r_2(L_0)}\,h_{L_0}^{q}. \] \end{proposition} \begin{proof} Inflation and restriction \cite[II.1.34]{MilneCFT} give $0\to H^1(\Gal(L_0/\Q),\Pi_Z(L_0))\to H^1(\Q,\Pi_Z)\to H^1(L_0,\Pi_Z)$, and $H^1(L_0,\Pi_Z)=\prod_iL_0^\times/L_0^{\times m_i}$, as $\Pi_Z\cong\prod_i\mu_{m_i}$ over $L_0$ and $H^1(L_0,\Gm)=0$ \cite[II.1.22]{MilneCFT}. Let $a\in\mathrm{Sel}_{\mathcal S}(\Pi_Z)$ with restriction $(a_i)$. At a place $w$ of $L_0$ above $p\in\mathcal S$, $a_p=0$, so $v_w(a_i)\equiv0\bmod m_i$. Above $p\notin\mathcal S$, $a_p$ comes from $H^1(\Z_p,\mathcal P_p)$, and its restriction to $L_{0,w}$ factors through $\prod_iH^1(\mathcal O_w,\mu_{m_i})$ by (M2), whose image consists of classes of units by (M5); so again $v_w(a_i)\equiv0\bmod m_i$. This gives the first inequality. For the second, $1\to\mathcal O_L^\times/\mathcal O_L^{\times m}\to L(\emptyset,m)\to\mathrm{Cl}(L)[m]\to0$, where $a$ with $(a)=\mathfrak a^m$ maps to the class of $\mathfrak a$; by Dirichlet's unit theorem $|\mathcal O_L^\times/\mathcal O_L^{\times m}|\le m^{r_1(L)+r_2(L)}$; and $|H^1(\mathfrak H,A)|\le|A|^{\mathrm{gen}(\mathfrak H)}$ for a finite group $\mathfrak H$ and a finite module $A$, as a cocycle is determined by its values on generators, with $|\Pi_Z(L_0)|\le m_Z$. \end{proof} For a torus $T$ over $\Q$ split by a Galois field $L$, put $T(\mathcal O_L):=\mathrm{Hom}(X^*(T),\mathcal O_L^\times)$, $T(\Af)^c:=\prod_pT(\Q_p)^c$ and $h(T):=|T(\Q)\backslash T(\Af)/T(\Af)^c|$. \needspace{4\baselineskip} \begin{proposition}\label{prop:selC} Let $T$ be a torus over $\Q$ of dimension $r$, split by a Galois field $L$ with group $\mathfrak H$ of order $n_L$. Then $|\ker^1_f(\Q,T)|$ and $h(T)$ are both at most $|H^1(\mathfrak H,T(\mathcal O_L))|\cdot|(X_*(T)\otimes\mathrm{Cl}(L))^{\mathfrak H}|\le n_L^{r(\log_2n_L+r_1(L)+r_2(L))}h_L^r$. \end{proposition} \begin{proof} As $\mathfrak H$-modules $T(L)=X_*\otimes L^\times$ with $X_*:=X_*(T)\cong\Z^r$, and tensoring $1\to\mathcal O_L^\times\to L^\times\to\mathrm{Id}_L\to\mathrm{Cl}(L)\to0$ ($\mathrm{Id}_L$ the fractional ideals) with $X_*$ gives an exact sequence $0\to T(\mathcal O_L)\to T(L)\to I\to C\to0$ with $I:=X_*\otimes\mathrm{Id}_L$ and $C:=X_*\otimes\mathrm{Cl}(L)$; let $\Pi\subset I$ be the image of $T(L)$. $\ker^1_f$: by Hilbert's Theorem~90 and inflation--restriction, $H^1(\Q,T)=H^1(\mathfrak H,T(L))$ and $H^1(\Q_p,T)=H^1(\mathfrak H_w,T(L_w))$ for $w\mid p$, $\mathfrak H_w$ the decomposition group. As $\mathfrak H$-modules $I=\bigoplus_pI_p$ with $I_p\cong\mathrm{Ind}_{\mathfrak H_w}^{\mathfrak H}X_*$, and by Shapiro's lemma \cite[II.1.11]{MilneCFT} $H^1(\mathfrak H,I_p)\cong H^1(\mathfrak H_w,X_*)$, through restriction to $\mathfrak H_w$ and the $w$-coordinate, which on $T(L)$ is the valuation $T(L_w)\to X_*$. If $c\in\ker^1_f(\Q,T)$, its restriction to $\mathfrak H_w$ is a coboundary in $T(L_w)$, so the image of $c$ in $H^1(\mathfrak H,I)$ is $0$. So the image of $c$ in $H^1(\mathfrak H,\Pi)$ lies in $\ker(H^1(\mathfrak H,\Pi)\to H^1(\mathfrak H,I))$, the image of $C^{\mathfrak H}$; and the fibres of $H^1(\mathfrak H,T(L))\to H^1(\mathfrak H,\Pi)$ are cosets of the image of $H^1(\mathfrak H,T(\mathcal O_L))$. $h(T)$: for each $p$ the valuations embed $T(\Q_p)/T(\Q_p)^c$ in $\bigoplus_{w\mid p}X_*$, since an element whose image lies in the compact group $\prod_wX_*\otimes\mathcal O_w^\times$ generates a bounded subgroup. So $I_T:=T(\Af)/T(\Af)^c$ embeds in $I^{\mathfrak H}$, compatibly with $T(\Q)\subset T(L)$, and $h(T)=|I_T/T(\Q)|$. The induced map $I_T/T(\Q)\to C^{\mathfrak H}$ has kernel embedding in $H^1(\mathfrak H,T(\mathcal O_L))$: for $a$ in the kernel choose $\varrho\in T(L)$ with image $a$; $\sigma\mapsto\sigma(\varrho)/\varrho$ is a cocycle with values in $T(\mathcal O_L)$, well defined up to coboundaries, and if it is $\sigma(\varepsilon)/\varepsilon$, then $\varrho/\varepsilon\in T(\Q)$ has image $a$. Sizes: with $E:=T(\mathcal O_L)\cong(\mathcal O_L^\times)^r$, $n_L$ kills $H^1(\mathfrak H,E)$, so $|H^1(\mathfrak H,E)|\le|H^1(\mathfrak H,E[n_L])|\cdot|E/n_LE|\le n_L^{r\,\mathrm{gen}(\mathfrak H)}n_L^{r(r_1(L)+r_2(L))}$, and $|C^{\mathfrak H}|\le h_L^r$. \end{proof} \needspace{4\baselineskip} \begin{theorem}\label{thm:S} For every Shimura datum $(G,X)$ and neat product level, with $\mathcal S$ as in \cref{lem:Kad}, \[ |\mathrm{Sel}_{\mathcal S}(Z(G))|\le m_Z^{\log_2n_{L_0}+r_1(L_0)+r_2(L_0)+|\mathcal S|}\,h_{L_0}^{q}\,n_{L_1}^{r_Z(\log_2n_{L_1}+r_1(L_1)+r_2(L_1))}\,h_{L_1}^{r_Z}. \] \end{theorem} \begin{proof} \Cref{prop:selA,prop:selB}, and \cref{prop:selC} for $T=Z(G)^\circ$, split by $L_1$. \end{proof} \begin{lemma}\label{lem:Kclass} Let $\iota_K:=\prod_{p\in\mathcal S}[Z(G)^\circ(\Q_p)^c:Z(G)^\circ(\Q_p)\cap K_p]$; it is finite, since $Z(G)^\circ(\Q_p)\cap K_p$ is a compact open subgroup of $Z(G)^\circ(\Q_p)$, so it lies in the maximal compact subgroup $Z(G)^\circ(\Q_p)^c$ with finite index. Then \[ |\mathrm{Cl}(K)|\le m_Z^{|\mathcal S|}\,\iota_K\,h(Z(G)^\circ)\le m_Z^{|\mathcal S|}\,\iota_K\,n_{L_1}^{r_Z(\log_2n_{L_1}+r_1(L_1)+r_2(L_1))}\,h_{L_1}^{r_Z}. \] \end{lemma} \begin{proof} Let $U:=Z(G)(\Af)\cap K$ and $U^\circ:=Z(G)^\circ(\Af)\cap K$. The map $\mathrm{Cl}(K)\to\Pi_Z(\Af)/(\mathrm{im}\,Z(G)(\Q)\cdot\mathrm{im}\,U)$ has kernel the image of $Z(G)^\circ(\Af)$, which is a quotient of $Z(G)^\circ(\Q)\backslash Z(G)^\circ(\Af)/U^\circ$. Its image lies in $\mathrm{im}\,Z(G)(\Af)/\mathrm{im}\,U$, and $\mathrm{im}\,U\supset\prod_{p\notin\mathcal S}\Pi_Z(\Q_p)$: for $p\notin\mathcal S$, $U_p=\mathcal Z_p(\Z_p)$ by (M6), $\mathcal Z_p(\Z_p)\to\mathcal P_p(\Z_p)$ is onto as its cokernel lies in $H^1(\Z_p,\mathcal Z_p^\circ)=0$, and $\mathcal P_p(\Z_p)=\Pi_Z(\Q_p)$ by (M4). So the image has at most $\prod_{p\in\mathcal S}|\Pi_Z(\Q_p)|\le m_Z^{|\mathcal S|}$ elements. Next, $U^\circ\subset Z(G)^\circ(\Af)^c$ with index $\iota_K$, by (M6) at $p\notin\mathcal S$, so $|Z(G)^\circ(\Q)\backslash Z(G)^\circ(\Af)/U^\circ|\le\iota_K\,h(Z(G)^\circ)$, and \cref{prop:selC} bounds $h(Z(G)^\circ)$. \end{proof} \needspace{4\baselineskip} \begin{corollary}\label{cor:H} With $K$ as in this section, \[ h_K\le m_Z^{\log_2n_{L_0}+n_{L_0}+2|\mathcal S|}\,h_{L_0}^{q}\,\iota_K\,\bigl(n_{L_1}^{r_Z(\log_2n_{L_1}+n_{L_1})}h_{L_1}^{r_Z}\bigr)^2. \] If $K$ is the level made by \cref{lem:LV} from a neat product level $K_0$, then $\iota_K\le|\mathrm{GL}_{n_\rho}(\F_3)|\,\iota_{K_0}$, with $\iota_{K_0}$ defined with the same set $\mathcal S$, since $Z(G)^\circ(\Q_3)\cap K_3$ is the kernel of the reduction map from $Z(G)^\circ(\Q_3)\cap K_{0,3}$ to $\mathrm{GL}_{n_\rho}(\F_3)$ and $K_p=K_{0,p}$ for $p\ne3$. For a number field $L$ of degree $n_L$, $h_L\le\max\bigl(1,B_L(1+\log B_L)^{n_L-1}\bigr)$ with $B_L:=(n_L!/n_L^{n_L})(4/\pi)^{r_2(L)}|d_L|^{1/2}$. \end{corollary} \begin{proof} \Cref{prop:adjmap}(d), \cref{thm:S} and \cref{lem:Kclass}, with $r_1(L)+r_2(L)\le[L:\Q]$. Every ideal class contains an integral ideal of norm at most $B_L$ \cite[Thm.~4.3]{MilneANT}, and the number of integral ideals of norm at most $x$ is at most $\sum_{m\le x}\tau_{n_L}(m)\le x(1+\log x)^{n_L-1}$, with $\tau_{n_L}$ the $n_L$-fold divisor function. \end{proof} All the quantities in \cref{cor:H} are read off the character group of $Z(G)$, the representation $\rho$ and the level. If $Z(G)$ is connected, $m_Z=1$ and $q=0$; if $Z(G)$ is split, $\mathrm{Sel}_{\mathcal S}(Z(G))=0$ by \cref{prop:adjmap}(d); if $Z(G)$ is finite, the torus factors are $1$. \subsection{Where maximality is lost} \begin{lemma}\label{lem:NA} Let $Z\subset S_i$ be closed and irreducible and $V\subset Z$ special and maximal in $Z$. If $f(V)$ is not maximal in $f(Z)$, there is $\theta\in\mathfrak G_i$ with $\theta Z\ne Z$ and $V\subset Z\cap\theta Z$. \end{lemma} \begin{proof} Let $V^\sharp$ be special with $f(V)\subsetneq V^\sharp\subset f(Z)$, and $\widetilde V$ a component of $f^{-1}(V^\sharp)$ containing $V$. It is special \cite[p.~14]{KY}, of dimension $\dim V^\sharp>\dim V$ as $f$ is finite, and lies in $S_i$, being connected. By \cref{prop:adjmap}(a), $\widetilde V\subset f^{-1}(f(Z))\cap S_i=\bigcup_{\theta\in\mathfrak G_i}\theta Z$, so $\widetilde V\subset\theta Z$ for some $\theta$. If $\theta Z=Z$, $\widetilde V$ would contradict the maximality of $V$. \end{proof} \subsection{The theorem} For a special subvariety $V$ of $\Sh_K(G,X)_\C$, $f(V)$ is special with torus $T_V$, the connected centre of $\lambda(H_V)$, as in the introduction. We put \[ \alpha_V:=\alpha_{f(V)}\ \text{in}\ \Sh_{K^\ad}(G^\ad,X^\ad)\ \text{(\cref{def:alpha})},\qquad \Delta(V):=\max\bigl(\deg V,\ d_{L_V},\ \alpha_V\bigr), \] with $\deg V$ taken for $\Lb_K$ at the original level. For $V$ at the original level, where $\lambda(K)$ need not lie in $K^\ad$, $\alpha_V:=\alpha_{f(V')}$ for a component $V'$ of the preimage of $V$ in $\Sh_{K'}(G,X)$; as $K'$ is normal in $K$, these components are the $V'k$, $k\in K$, and $f(V'k)=f(V')\lambda(k)$ with $\lambda(k)$ normalizing $K^\ad$, so $\alpha_{f(V')}$ does not depend on $V'$. If $G$ is adjoint and $K$ satisfies (Lv), then $K^\ad=K$ and these are the invariants of \cref{sec:setting} for the representation $\rho^\ad$ and the lattice $\Lambda$; they are those for $\rho$ formed with the same constant $B$, as the groups $K_{T_V,p}$ and $K^m_{T_V,p}$ do not depend on the representation; this $B$ is admissible for $\rho$ as well if $a$ also bounds the indices of \cite[pp.~21--22]{UY} for $\rho$, as $a=|\mathrm{GL}_{\dim G}(\F_3)|$ does when $n_\rho\le\dim G$. At any compact open product level containing $K^\ad$, $\alpha_{f(V)}$ is at most this $\alpha_V$. Let $\bar g_1,\dots,\bar g_m$ represent $G^\ad(\Q)_+\backslash G^\ad(\Af)/K^\ad$, a finite set \cite[Lemma~5.12]{Milne}, and from here on let $c^\ad(\delta,z,D,d)$ and $c_D^\ad(z,D)$ be the maxima over $t$ of the constants of these names of \cref{sec:degrees,sec:adjoint} for $(G^\ad,X^\ad)$ at the level $\bar g_tK^\ad\bar g_t^{-1}$, with $\rho^\ad$ and the lattice $\mathrm{Ad}(\bar g_t)(\Lambda\otimes\Zhat)$ (\cref{sec:setting}), and with $n:=\dim\Sh_K(G,X)$; put $e_0:=e^*(n)$. The constant $B$ of \cref{tab:constants} is the same at all these levels (we take $a:=|\mathrm{GL}_{\dim G^\der}(\F_3)|$, which bounds the indices of \cite[pp.~21--22]{UY} for every lattice $\mathrm{Ad}(\bar g_t)(\Lambda\otimes\Zhat)$). Put $h_{\mathfrak G}:=1$ if $\Gamma'_i\subset\lambda(G(\Q))$ for every $i$, and $h_{\mathfrak G}:=h_K!$ otherwise, and define \[ D_0:=g_3D,\quad d_0:=g_3d\,h_{\mathfrak G},\qquad D_{j+1}:=e_0^{2n}D_j^2,\quad d_{j+1}:=e_0^{2n}D_j^2\,d_j . \] \needspace{4\baselineskip} \begin{theorem}\label{thm:NA} Let $(G,X)$ be a Shimura datum, $K$ a neat product level and $\rho$ as above, $F\supset E(G,X)$ a number field with $[F:\Q]=d$, $Z\subset\Sh_K(G,X)$ closed and geometrically irreducible, defined over $F$, of degree $D$ and dimension $z$, and $V$ a special subvariety maximal in $Z$. Let $K'$ be the level of \cref{lem:LV}, and $K^\ad$, $h_K$, $h_{\mathfrak G}$ as above, built from $K'$; \cref{cor:H} bounds $h_K$ in closed form, and $h_{\mathfrak G}\le h_K!$. \begin{enumerate}[(a)] \item $\deg V\le h_K\,c_D^\ad(z,D_z)$, and if $\QRH(\delta;L_V)$ holds, then $\Delta(V)\le h_K\,c^\ad(\delta,z,D_z,d_z)$. \item If $\lambda(K)$ is open in $G^\ad(\Af)$, for instance if $Z(G)$ is connected, the same holds with $K^\ad:=\lambda(K)$ and $h_K$, $h_{\mathfrak G}$ computed at the level $K$ itself, with $D_0:=D$, $d_0:=d\,h_{\mathfrak G}$, and with $c^\ad$, $c_D^\ad$ the constants for $(G^\ad,X^\ad)$ at the level that \cref{lem:LV} makes from $\lambda(K)$ for $(\rho^\ad,\Lambda)$, evaluated at $(g_3^\ad D_z,g_3^\ad d_z)$, where $g_3^\ad:=|\mathrm{GL}_{\dim G^\der}(\F_3)|$. If $\lambda(K)$ satisfies (Lv$'$) for $(\rho^\ad,\Lambda)$, the constants are those at the level $\lambda(K)$ itself, evaluated at $(D_z,d_z)$ (\cref{prop:Lvprime}). \end{enumerate} \end{theorem} If $Z(G)$ is connected, $K^\ad=\lambda(K')\subset\lambda(K)$ (\cref{lem:Kad}(iv)), so the bound for $\alpha_V$ holds with $\alpha_V$ computed at $\lambda(K)$; for $\mathcal A_g$ at $K(N)$, $N\ge3$, this is the level of \cref{thm:Ag}(i). If $G$ is adjoint, $K^\ad=K'\subset K$, so $\alpha_V$ may be computed at $K$. \begin{proof} (a) \Cref{lem:LV} gives $Z'\subset\Sh_{K'}(G,X)$, geometrically irreducible over a field $F'$ of degree at most $g_3d$, with $\deg_{\Lb_{K'}}Z'\le g_3D$, and $V'$ maximal in $Z'$ with $\pi(V')=V$, $\deg V\le\deg_{\Lb_{K'}}V'$ and $T_{V'}=T_V$. Let $S_i$ be the component containing $Z'$. Put $Z^{(0)}:=Z'$, defined over $F_0:=F'F_{\mathfrak G}$, of degree at most $d_0$ over $\Q$. Given $Z^{(j)}\supset V'$ closed and irreducible, defined over $F_j$ with $[F_j:\Q]\le d_j$, and of degree at most $D_j$: $V'$ is maximal in $Z^{(j)}\subset Z'$. If $f(V')$ is maximal in $f(Z^{(j)})$, stop. Otherwise \cref{lem:NA} gives $\theta\in\mathfrak G_i$ with $\theta Z^{(j)}\ne Z^{(j)}$ and $V'\subset Z^{(j)}\cap\theta Z^{(j)}$, and we let $Z^{(j+1)}$ be a component of this intersection containing $V'$; $\dim Z^{(j+1)}<\dim Z^{(j)}$. Put $\Lb:=\Lb_{K'}|_{\overline S_i}$. As $\theta$ preserves $\Lb$ (\cref{prop:adjmap}(b)), $\theta Z^{(j)}$ has $\Lb$-degree at most $D_j$, and by \cref{lem:bezout}(b) at the neat level $K'$, with $e=e_0$, the components of $Z^{(j)}\cap\theta Z^{(j)}$ have total $\Lb$-degree at most $e_0^{2n}D_j^2$. So $\deg_{\Lb}Z^{(j+1)}\le D_{j+1}$, and $Z^{(j)}\cap\theta Z^{(j)}$ has at most $e_0^{2n}D_j^2$ components. It is defined over $F_j$, since $\theta$ is defined over $F_{\mathfrak G}\subset F_j$, so $Z^{(j+1)}$ is defined over an extension $F_{j+1}$ of $F_j$ of degree at most $e_0^{2n}D_j^2$. The recursion stops after $j^*\le z-\dim V\le z$ steps, since $Z^{(j)}=V'$ once $\dim Z^{(j)}=\dim V$. Put $W:=f(Z^{(j^*)})$; then $f(V')$ is maximal in $W$. Let $\bar g_t$ be the representative for which $W$ lies in the image of $X^+\times\{\bar g_t\}$ in $\Sh_{K^\ad}(G^\ad,X^\ad)_\C$. The level $K^\ad$ satisfies (Lv) for $(\rho^\ad,\Lambda)$ (\cref{lem:Kad}(ii)), so $\bar g_tK^\ad\bar g_t^{-1}$ satisfies it for the lattice $\mathrm{Ad}(\bar g_t)(\Lambda\otimes\Zhat)$, and we apply \cref{thm:adjoint} at that level to the translates of $W$ and $f(V')$ by $\bar g_t^{-1}$ (\cref{sec:setting}); the translation changes no degree, field of definition, $T_V$, $L_V$ or $\alpha_V$. The variety $W$ is geometrically irreducible, defined over $F_{j^*}\supset E(G,X)\supset E(G^\ad,X^\ad)$ \cite[2.2.1]{Deligne79}, of dimension at most $z$ and degree at most $D_{j^*}$ by \cref{prop:adjmap}(c). This bounds $\deg f(V')$, $d_{L_V}$ and $\alpha_V$, and $\deg V\le\deg_{\Lb_{K'}}V'\le h_K\deg f(V')$ by \cref{prop:adjmap}(c). The constants are non-decreasing in $z$, $D$ and $d$, and $D_j$, $d_j$ increase with $j$, so the values at $j=z$ bound all cases. (b) When $\lambda(K)$ is open, the argument runs at the level $K$ with $K^\ad:=\lambda(K)$: \cref{prop:adjmap}(a)--(d) and \cref{lem:NA} hold with the same proofs, $\lambda(K)$ being neat \cite[0.6]{Pink} and normalizing $K$, and $\lambda^{-1}(\lambda(K))=Z(G)(\Af)K$. \Cref{thm:adjoint} is applied at the level $\lambda(K)$ through \cref{lem:LV} for $(G^\ad,X^\ad,\lambda(K),\rho^\ad)$, which costs the factor $g_3^\ad$ and can only increase $\alpha$. Here too the constants at a level $K''$ are the maxima over the levels $\bar g_tK''\bar g_t^{-1}$, with the lattices $\mathrm{Ad}(\bar g_t)(\Lambda\otimes\Zhat)$, for $\bar g_t$ representing $G^\ad(\Q)_+\backslash G^\ad(\Af)/K''$. \end{proof} \begin{proof}[Proof of \cref{thm:main}] If $G^\ad=1$, then $G$ is a torus, $\Sh_K(G,X)$ is finite and $V=Z$ is a point with $T_V=1$, so $\deg V=d_{L_V}=\alpha_V=1$, and we put $c_D(D)=c(\delta,D,d):=1$. Otherwise a special point $x$ has $\lambda(\mathrm{MT}(x))\ne1$, so $n_T\ge2$ (\cref{sec:special}) and $s_\rho,t_\rho\ge1$ for $(G^\ad,X^\ad,\rho^\ad)$, and \cref{thm:NA}(a) with $z\le n$ and the monotonicity of the constants give the bounds of \cref{thm:main} with $h_K\,c_D^\ad(n,D_n)$ and $h_K\,c^\ad(\delta,n,D_n,d_n)$. Let $H_K$ be the integer part of the right side of \cref{cor:H} for the level $K'$ of \cref{lem:LV}, and let $d_n^*$ be $d_n$ computed from $d_0:=g_3d\,H_K!$. As $h_K\le H_K$, $h_{\mathfrak G}\le h_K!\le H_K!$ and the constants are non-decreasing in $d$, \cref{thm:main} holds with \[ c_D(D):=H_K\,c_D^\ad(n,D_n),\qquad c(\delta,D,d):=H_K\,c^\ad(\delta,n,D_n,d_n^*), \] and these are effectively computable, $H_K$ being read off the character group of $Z(G)$, $\rho$ and the level. Smaller bounds for $h_K$ and $h_{\mathfrak G}$, such as those in \cref{thm:AgK}, may be used in place of $H_K$ and $H_K!$. \end{proof} \begin{proof}[Proof of \cref{cor:unconditional}] By \cite[Theorem~1.1]{CuretonThorner}, $\QRH(1/32;L)$ holds for every number field $L$; apply \cref{thm:main} with $\delta=1/32$. \end{proof} \subsection{Siegel modular varieties}\label{sec:Ag} \needspace{4\baselineskip} \begin{theorem}\label{thm:AgK} Let $g\ge1$, $(G,X)=(\mathrm{GSp}_{2g},\mathcal H_g^\pm)$ with its standard representation, $n=g(g+1)/2$, $e_0=e^*(n)$, and $s_g:=|\mathrm{Sp}_{2g}(\F_3)|=3^{g^2}\prod_{i=1}^g(3^{2i}-1)$ \cite[p.~70]{Taylor}. Let $c^\ad(\delta,z,D,d)$ and $c_D^\ad(z,D)$ be the constants of \cref{sec:adjoint} for $(\mathrm{PGSp}_{2g},X^\ad)$ with $(\mathrm{Ad},\mathfrak{sp}_{2g}(\Zhat))$ at the level named below. Let $F$, $d$, $Z$, $D$, $z$ and $V$ be as in \cref{thm:NA}, and define $D_j$, $d_j$ by $D_{j+1}:=e_0^{2n}D_j^2$, $d_{j+1}:=e_0^{2n}D_j^2d_j$ from the initial values given below. \begin{enumerate}[(a)] \item Let $N\ge3$, $K=K(N)$ the principal congruence subgroup of level $N$, $D_0:=D$ and $d_0:=d$. Then $h_K\le\#\{u\in(\Z/N)^\times:u^2=1\}/2$, $h_{\mathfrak G}=1$, and \[ \deg V\le h_K\,c_D^\ad(z,D_z),\qquad \Delta(V)\le h_K\,c^\ad(\delta,z,D_z,d_z)\ \text{ if }\QRH(\delta;L_V)\text{ holds}, \] with the constants, and $\alpha_V$, at the level $\lambda(K(N))$. \item Let $K(1):=\mathrm{GSp}_{2g}(\Zhat)$, so that $\Sh_{K(1)}(G,X)_\C=\mathcal A_{g,1}$, take degrees on $\mathcal A_{g,1}$ as in \cref{lem:degAg1}, and put $D_0:=(s_g/2)D$ and $d_0:=s_gd$. Then \[ \deg V\le c_D^\ad(z,D_z),\qquad \max\bigl(\deg V,d_{L_V},\alpha_V\bigr)\le c^\ad(\delta,z,D_z,d_z)\ \text{ if }\QRH(\delta;L_V)\text{ holds}, \] with the constants at the level $\lambda(K(3))$ and $\alpha_V$ computed at the level $\lambda(K(1))$. \end{enumerate} In both cases $d_{L_V}$ is also the discriminant of the splitting field of the connected centre of $H_V$. \end{theorem} For $\mathcal A_{g,1}$ we need a degree. Let $\pi\colon\Sh_{K(3)}(G,X)\to\Sh_{K(1)}(G,X)$ be the natural map. The group $K(1)/K(3)=\mathrm{GSp}_{2g}(\F_3)$ acts on $\Sh_{K(3)}(G,X)$ by right translations, which preserve $\Lb_{K(3)}$, through $\overline G:=\mathrm{GSp}_{2g}(\F_3)/\{\pm1\}$, the image of $Z(G)(\Q)\cap K(1)=\{\pm1\}$ acting trivially; $\pi$ is the quotient by $\overline G$, and $\deg\pi=|\overline G|=s_g$, since a general point of $\mathcal H_g$ has stabilizer $\{\pm1\}$ in $\mathrm{Sp}_{2g}(\Z)$. The two geometric components of $\Sh_{K(3)}(G,X)$ correspond to $\F_3^\times$, and $k$ moves them by $\nu(k)$, so the stabilizer of a component has order $s_g/2$. \begin{lemma}\label{lem:degAg1} For $Y\subset\Sh_{K(1)}(G,X)_\C$ closed and irreducible and $C$ an irreducible component of $\pi^{-1}(Y)\subset\Sh_{K(3)}(G,X)_\C$, both over $\C$, put $\deg Y:=\deg_{\Lb_{K(3)}}C/[\kappa(C):\kappa(Y)]$. \begin{enumerate}[(a)] \item This does not depend on $C$. \item Let $G_C\subset\overline G$ be the stabilizer of $C$ and $I_C\subset G_C$ the subgroup fixing $C$ pointwise. Then $[\kappa(C):\kappa(Y)]=|G_C/I_C|\le s_g/2$, and $\deg_{\Lb_{K(3)}}\pi^{-1}(Y)/\deg\pi=\deg Y/|I_C|$, with $1\le|I_C|\le s_g/2$. \item If $\mathcal M$ is a $\Q$-line bundle on the Baily--Borel compactification of $\mathcal A_{g,1}$ with $\pi^*\mathcal M\cong\Lb_{K(3)}$, then $\deg Y=\deg_{\mathcal M}\overline Y$. \item Replacing $K(3)$ by any neat $K''$ normal in $K(1)$ gives the same number. \end{enumerate} \end{lemma} \begin{proof} (a) $\overline G$ permutes the components of $\pi^{-1}(Y)$ transitively; each $\sigma\in\overline G$ preserves $\Lb_{K(3)}$, so $\deg\sigma C=\deg C$, and $\sigma\colon C\to\sigma C$ is an isomorphism over $Y$. (b) There are $|\overline G|/|G_C|$ components, all of degree $\deg_{\Lb_{K(3)}}C$. Take $x\in C$ off the proper closed subsets $C\cap\sigma C$ ($\sigma\notin G_C$) and $C^\sigma$ ($\sigma\in G_C\smallsetminus I_C$); the fibre of $C\to Y$ through $x$ is $G_C\cdot x$, with $|G_C/I_C|$ points, and a finite dominant morphism of complex varieties has $[\kappa(C):\kappa(Y)]$ points in its general fibre. So $\deg_{\Lb_{K(3)}}\pi^{-1}(Y)=(|\overline G|/|G_C|)\,|G_C/I_C|\deg Y$, and we divide by $\deg\pi=|\overline G|$. Finally $G_C$ stabilizes a geometric component, so $|G_C|\le s_g/2$. (c) The projection formula for the finite surjective map $\overline C\to\overline Y$, applied to a multiple of $\mathcal M$ that is a line bundle, gives $\deg_{\pi^*\mathcal M}\overline C=[\kappa(C):\kappa(Y)]\deg_{\mathcal M}\overline Y$. (d) For neat $K'''\subset K''$, both normal in $K(1)$, the map $\Sh_{K'''}\to\Sh_{K''}$ is finite étale and pulls $\Lb_{K''}$ back to $\Lb_{K'''}$ \cite[Prop.~5.3.2]{KY}; for a component $C'''$ over $C$, the projection formula gives $\deg C'''=[\kappa(C'''):\kappa(C)]\deg C$, and the field degrees multiply. Two such subgroups compare through their intersection. \end{proof} \begin{proof}[Proof of \cref{thm:AgK}] (a) $K(N)$ is a neat product level for $N\ge3$. The centre $Z(G)=\Gm$ is connected and $H^1(\Q,\Gm)=0$, so $\lambda(K)$ is open and \cref{thm:NA}(b) applies; $\Gamma'_i\subset\lambda(G(\Q))$, so $h_{\mathfrak G}=1$ and $d_0=d$; and \cref{prop:adjmap}(d) gives $h_K\le|\Q^\times\backslash\Af^\times/\ker(\Zhat^\times\to(\Z/N)^\times)|=|\Zhat^\times/\{\pm1\}\ker(\Zhat^\times\to(\Z/N)^\times)|=\varphi(N)/2$. More precisely, the class of $\bar\gamma=\lambda(zk)$ in $\mathrm{Cl}(K)$ is that of $z$, and $\nu(zk)=z^2\nu(k)\in\Q_{>0}$ with $\nu(k)\in\ker(\Zhat^\times\to(\Z/N)^\times)$, so writing $z=qu$ with $q\in\Q^\times$, $u\in\Zhat^\times$, we get $u^2\in\ker(\Zhat^\times\to(\Z/N)^\times)$. Hence $h_K\le\#\{u\in(\Z/N)^\times:u^2=1\}/2$. Let $p_0$ be an odd prime dividing $N$, or $p_0=2$ if $N$ is a power of $2$, and $v:=v_{p_0}(N)$, so $v\ge2$ if $p_0=2$. Every eigenvalue $\xi$ of an element of $K(N)_{p_0}\subset1+p_0^vM_{2g}(\Z_{p_0})$ has $v_{p_0}(\xi-1)\ge v$; the elements with this property form a group; and a root of unity $\zeta\ne1$ has $v_{p_0}(\zeta-1)\le1/(p_0-1)0}$ and $u\in\Zhat^\times$, and take $\gamma\in\mathrm{GSp}_{2g}(\Q)$ with $\nu(\gamma)=q$ and $k\in\mathrm{GSp}_{2g}(\Zhat)$ with $\nu(k)=u$; then $\gamma^{-1}xk^{-1}\in\mathrm{Sp}_{2g}(\Af)=\mathrm{Sp}_{2g}(\Q)\,\mathrm{Sp}_{2g}(\Zhat)$ by strong approximation for $\mathrm{Sp}_{2g}$, and $\nu>0$ on $\gamma\,\mathrm{Sp}_{2g}(\Q)$. The group $\lambda(\mathrm{GSp}_{2g}(\Zhat))$ normalizes $\lambda(K(M))$ for every $M$, and the level that \cref{lem:LV} makes from it, and preserves $\mathfrak{sp}_{2g}(\Zhat)$; so the maxima of \cref{thm:NA} are the constants at the level named. (b) Choose a component $V'$ of $\pi^{-1}(V)$ and a component $Z'$ of $\pi^{-1}(Z)$ containing it. As in \cref{lem:LV}, $V'$ is special and maximal in $Z'$, with $T_{V'}=T_V$, and $Z'$ is defined over a field of degree at most $s_gd$, since $\pi^{-1}(Z)$ has at most $|\overline G|=s_g$ components. By \cref{lem:degAg1}(b), $\deg_{\Lb_{K(3)}}Z'=[\kappa(Z'):\kappa(Z)]\,D\le(s_g/2)D$. Part (a) at $N=3$, where $h_{K(3)}=1$, bounds $\deg_{\Lb_{K(3)}}V'$ and the torus data at $\lambda(K(3))$. Finally $\deg V=\deg_{\Lb_{K(3)}}V'/[\kappa(V'):\kappa(V)]\le\deg_{\Lb_{K(3)}}V'$, and since $\lambda(K(3))\subset\lambda(K(1))$, each index $|K^m_{T_V,p}/K_{T_V,p}|$ of \cref{def:alpha}, and hence $\alpha_V$ (the constant $B$ does not depend on the level), is at least as large at $\lambda(K(3))$ as at $\lambda(K(1))$. In both cases the connected centre of $H_V$ contains the central $\Gm$ (the weight) and is isogenous to $\Gm\times T_V$, so the two splitting fields coincide. \end{proof} The bound for $h_K$ in \cref{thm:AgK}(a) is $1$ unless $(\Z/N)^\times$ has a square root of $1$ other than $\pm1$, for instance for $N=8$, $12$ or $15$; only then can $f$ fail to be injective on a component, and only then is \cref{lem:NA} needed. \section{Listing for abelian type}\label{sec:listing} The bounds of \cref{thm:AgK} leave a finite set of candidates for the maximal special subvarieties of $Z$, but the set has to be found. The bounds for $d_{L_V}$ and $\alpha_V$ bound the index of the order of endomorphisms attached to $V$ (\cref{sec:orders}), which leaves finitely many PEL data; in Mumford's model (\cref{sec:mumford}) the locus of each datum is computable (\cref{sec:PEL}), and $V$ is rigid in the normalization of one of its components (\cref{sec:containers}), with degree there bounded in terms of $\deg V$ (\cref{sec:theta-degree,sec:normalization}). Urbanik's algorithm \cite[Cor.~6.3]{Urbanik} then computes a finite set of weakly special subvarieties of bounded degree that contains the rigid ones, a test on the algebraic monodromy selects the rigid ones, which are special (\cref{sec:rigidity}), \cref{sec:hodgecovers} passes to Hodge and abelian type, and \cref{sec:algorithm} states the algorithm and proves \cref{thm:listing}. In this section $G=\mathrm{GSp}(W,\psi)$ with $W=\Q^{2g}$, $W_\Z=\Z^{2g}$ and $\psi$ perfect on $W_\Z$, $X=\mathcal H_g^\pm$, and $\lambda\colon G\to G^\ad$. For a special subvariety $V$ we write $T:=T_V^G$ for the connected centre of $H_V$ itself, which contains the scalars, and $\bar T:=\lambda(T)$ for the torus of \cref{sec:general}. \subsection{Bounded torus data give bounded orders}\label{sec:orders} Let $K=\prod_pK_p$ be compact open with $K(N)\subset K\subset G(\Zhat)$ for some $N\ge1$, and let $V\subset\Sh_K(G,X)_\C$ be special, defined by $(H,X_H)$, the image of $X_H^+\times\{\gamma\}$ with $\gamma\in G(\Af)$. Put $\mathcal E:=\Q[T]$, the $\Q$-span of $T(\Q)$ in $\mathrm{End}(W)$, $n_{\mathcal E}:=\dim_\Q\mathcal E$, $\Lambda_V\subset W$ the lattice with $\Lambda_{V,p}=\gamma_pW_{\Z_p}$, and $R:=\mathcal E\cap\mathrm{End}(\Lambda_V)$. For a prime $p$ let $\iota_p:=[K^m_{T,p}:T(\Q_p)\cap\gamma_pK_p\gamma_p^{-1}]$, and $\bar\iota_p$ the same index for $\bar T$ and $\lambda(\gamma_pK_p\gamma_p^{-1})$; so $\alpha_V=\prod_{\bar\iota_p>1}\max(1,\bar B\bar\iota_p)$ with $\bar B$ the constant $B$ of the adjoint datum. Let $m_V$ be the least common multiple of the dimensions of the irreducible summands of $W\otimes\Qbar$ under $H_V$; so $m_V=1$ if $V$ is a point, and $m_V\le\mathrm{lcm}(1,\dots,2g)$. \begin{lemma}\label{lem:Oprime} Suppose $d_{L_V}\le D_1$ and $\alpha_V\le A_1$ with $A_1\ge1$. Put $A_1':=A_1\max(1,1/\bar B)$ and $P_1:=1+m_VA_1'$. \begin{enumerate}[(a)] \item $\mathcal E=\prod_iF_i$ with each $F_i\subset L_V$ a totally real or CM field, $|d_{F_i}|\le D_1$ and $n_{\mathcal E}\le2g$. $R$ is an order of $\mathcal E$ and $R=\mathcal E\cap\mathrm{End}(A_x)$ for the abelian variety $A_x$ of the point $[x,\gamma]$, for every $x\in X_H^+$ (so $H_1(A_x,\Z)=\Lambda_V$); if $V$ is a point, $R$ is the centre of $\mathrm{End}(A_x)$. \item For every prime $p\ge m_V+2$ unramified in $L_V$, either $R_p=\mathcal O_{\mathcal E,p}$ or $\iota_p\ge(p-1)/m_V$. \item $R_p=\mathcal O_{\mathcal E,p}$ for every prime $p>P_1$ with $p\nmid Nd_{L_V}$. \item Both as written and with $n_{\mathcal E}$ replaced by $2g$, \[ [\mathcal O_{\mathcal E}:R]\le\Bigl(2\cdot4^{P_1}N^2D_1A_1'^{\,P_1+\log_2(ND_1)}\Bigr)^{n_{\mathcal E}(n_{\mathcal E}-1)/2}\Bigl(2m_Vn_{\mathcal E}(n_{\mathcal E}-1)(n_{\mathcal E}!)^2D_1^{1/2}\Bigr)^{n_{\mathcal E}(n_{\mathcal E}-1)/2}. \] \end{enumerate} \end{lemma} \begin{proof} For a special point, (d) is a form, with explicit constants, of \cite[Lemma~7.2]{Tsimerman12} for $\mathcal A_g$ and of \cite[Thm.~4.1]{DawOrr}; (b) is an explicit form of \cite[Prop.~4.11]{DawOrr} combined with \cite[Prop.~3.15]{UY}, and the proof of (d) follows \cite[Lemmas~7.4 and~7.5]{Tsimerman12}, \cite[Props.~4.8 and~4.12]{DawOrr}. \emph{Weights and a norm.} Let $\Phi$ be the set of weights of $T$ on $W\otimes\Qbar$. As $T(\Q)$ is Zariski dense in $T$, $\mathcal E\otimes\Qbar$ is the algebra of operators that are scalar on each weight space; so $\mathcal E$ is étale of dimension $|\Phi|$, with embeddings $\varphi_\chi$, $\chi\in\Phi$, taking values in $L_V$. The $\psi$-adjoint of $t\in T(\Q)$ is $\nu(t)t^{-1}\in T(\Q)$, so the adjoint preserves $\mathcal E$; on $\mathcal E\subset\mathrm{End}^0(A_x)$ it is the Rosati involution, which is positive, so it preserves each factor of $\mathcal E$ and is the identity or complex conjugation on it. As $|d_{F_i}|^{[L_V:F_i]}$ divides $d_{L_V}$, $|d_{F_i}|\le D_1$; and $n_{\mathcal E}\le\dim W$. For a point, $\mathrm{End}^0(A_x)=\mathrm{End}_{\mathcal E}(W)$ has centre $\mathcal E$. This gives (a). Let $\mu_c\in X_*(T)\otimes\Q$ be the preimage, under the isogeny $T\to H^\ab$, of the Hodge cocharacter of $H^\ab$, which is the same for all $x\in X_H$. If $T$ acts on an irreducible $H_{\Qbar}$-summand $W_j$ by $\chi$, then $\det_{W_j}$ is trivial on $H^\der$ and equals $\dim(W_j)\chi$ on $T$, so $\langle\chi,\mu_c\rangle=a_j/\dim W_j\in[0,1]\cap m_V^{-1}\Z$, with $a_j$ the multiplicity of the weight $1$ of a Hodge generic cocharacter on $W_j$. Let $Y$ be the Galois orbit of $m_V\mu_c$. Then $\langle\chi,y\rangle\in\{0,\dots,m_V\}$ for $y\in Y$ and $\chi\in\Phi$, so $Y\subset X_*(T)$; and $Y$ spans $X_*(T)\otimes\Q$, since otherwise the Hodge cocharacter would factor through a proper subtorus and $h_x$ through a proper $\Q$-subgroup of $H$. For $\chi\ne\chi'$ in $\Phi$ some $y\in Y$ has $\langle\chi-\chi',y\rangle\ne0$, and $|\langle\chi-\chi',y\rangle|\le m_V$ for all $y\in Y$. (b) Let $p\ge m_V+2$ be unramified in $L:=L_V$, $\mathfrak P\mid p$, $f$ the degree and $\sigma$ the Frobenius of $L_{\mathfrak P}/\Q_p$, $q:=p^f$, and $\zeta$ a generator of the roots of unity of order $q-1$ in $L_{\mathfrak P}$. For $y\in Y$ the element $t:=\sum_{kP_1$, $p\nmid Nd_{L_V}$ and $R_p\ne\mathcal O_{\mathcal E,p}$, then $p\ge m_V+2$ and (b) gives $\bar\iota_p\ge\iota_p\ge(p-1)/m_V>A_1'\ge1$, so $\alpha_V\ge\bar B\bar\iota_p>A_1$, a contradiction. (d) Let $\mathfrak t:=\mathrm{Lie}\,T\subset\mathcal E$, $k_p:=1$ for odd $p$ and $k_p:=2$ for $p=2$. For $y_0\in\mathfrak t\cap\mathcal O_{\mathcal E}$ with $\Delta_0:=\disc(y_0)\ne0$, the element $u:=\exp(p^{k_p}y_0)^{\iota_p}$ lies in $(K^m_{T,p})^{\iota_p}\subset R_p^\times$, since $\exp$ converges on $p^{k_p}\mathcal O_{\mathcal E,p}$ and maps $p^{k_p}\mathcal O_{\mathcal E,p}\cap(\mathfrak t\otimes\Q_p)$ into $T(\Q_p)\cap\mathcal O_{\mathcal E,p}^\times=K^m_{T,p}$. As $v_p(e^z-1)=v_p(z)$ for $v_p(z)>1/(p-1)$, $v_p(\disc u)=n_{\mathcal E}(n_{\mathcal E}-1)(v_p(\iota_p)+k_p)+v_p(\Delta_0)$, so $\Z_p[u]\subset R_p$ gives $[\mathcal O_{\mathcal E,p}:R_p]\le p^{(n_{\mathcal E}(n_{\mathcal E}-1)(v_p(\iota_p)+k_p)+v_p(\Delta_0))/2}$. To choose $y_0$, identify $\mathcal E\otimes L=L^\Phi$, let $w:=(\langle\chi,m_V\mu_c\rangle)_\chi$ and $y_\ell:=(\mathrm{id}\otimes\mathrm{Tr}_{L/\Q})(w\ell)\in\mathfrak t\cap\mathcal O_{\mathcal E}$ for $\ell\in\mathcal O_L$. The $\Q$-linear map $L\to\mathfrak t$, $\ell\mapsto y_\ell$, is onto: in $\mathfrak t\otimes L=X_*(T)\otimes L$ we have $y_\ell=\sum_\sigma\sigma(\ell)\,\sigma(m_V\mu_c)$, so by the independence of the embeddings of $L$ the $L$-span of its image is that of $Y$, which is $\mathfrak t\otimes L$; so the image, a $\Q$-subspace, is $\mathfrak t$, and $\disc$ is a nonzero polynomial on $\mathfrak t$, of degree $n_{\mathcal E}(n_{\mathcal E}-1)$. With $v_1,\dots,v_{[L:\Q]}\in\mathcal O_L$ attaining the successive minima of the house, which are at most $D_1^{1/2}$ by Minkowski's second theorem, some $\ell=\sum c_kv_k$ with $0\le c_k\le n_{\mathcal E}(n_{\mathcal E}-1)$ has $\Delta_0:=\disc(y_\ell)\ne0$, and $|\Delta_0|\le(2m_Vn_{\mathcal E}(n_{\mathcal E}-1)[L:\Q]^2D_1^{1/2})^{n_{\mathcal E}(n_{\mathcal E}-1)}$, with $[L:\Q]\le n_{\mathcal E}!$ since $\Gal(L/\Q)$ acts faithfully on $\Phi$. By (c) the bad primes number at most $P_1+\log_2(ND_1)$, and for them $p^{v_p(\iota_p)}\le p^{v_p(N)}A_1'$ and $\prod p^{k_p}\le2\cdot4^{P_1}ND_1$. Multiplying gives (d); the bound increases with $n_{\mathcal E}$. Parts (c) and (d) hold, with the same proofs, when $\bar B$ is replaced in $A_1'$ by any $\bar B_0\in(0,\bar B]$: $\bar B$ enters only through $A_1'\ge A_1/\bar B$. \end{proof} Take $\mathcal E=\Q(i)\times\Q$ and $T=\{(t,s):N(t)=s^2\}$, the torus of $\{x_0\}\times Y(1)\subset\mathcal A_2$ for the point $x_0$ of $Y(1)$ with complex multiplication by $\Q(i)$, with $m_V=2$. At $p=5$, $13$ and $17$, the index that bounds $\iota_p$ from below in the proof of \cref{lem:Oprime}(b) equals $(p-1)/m_V$. \subsection{Mumford's model and its level}\label{sec:mumford} To list special subvarieties we need $\mathcal A_g$ and its universal family by explicit equations. Let $d_\Upsilon$ be a positive multiple of $8$, $\Upsilon:=(d_\Upsilon,\dots,d_\Upsilon)$ with $g$ entries, $K(\Upsilon):=(\Z/d_\Upsilon\Z)^g$, and $V_\Upsilon$ the $\Q$-vector space of functions on $K(\Upsilon)$, so that $\PP(V_\Upsilon)$ has coordinates $Q(a)$, $a\in K(\Upsilon)$. Mumford considers the functor $\mathcal M_\Upsilon$ of abelian schemes with an $\Upsilon$-marking: an abelian scheme $\mathcal X$ over $S$, a relatively ample, totally symmetric, normalized invertible sheaf $L$ on $\mathcal X$ of type $\Upsilon$, and a symmetric $\vartheta$-structure for $L$ \cite[pp.~78--79]{MumfordII}. An $\Upsilon$-marking embeds $\mathcal X$ in $\PP(V_\Upsilon)\times S$, and the theta-null map $t\colon\mathcal M_\Upsilon\to\PP(V_\Upsilon)$ takes the image of the zero section \cite[pp.~82--83]{MumfordII}. Mumford writes down a closed subscheme $\overline M_\Upsilon\subset\PP(V_\Upsilon)$, cut out by Riemann's quartic theta relations and the relations $Q(a)=Q(-a)$, and a closed subscheme $\overline{\mathcal A}_\Upsilon\subset\PP(V_\Upsilon)\times\overline M_\Upsilon$, cut out by relations of bidegree $(2,2)$ in the coordinates of the two factors \cite[p.~83]{MumfordII}, and he proves the following \cite[Theorem, p.~83, and Further Theorem, p.~84]{MumfordII}: there is an open subscheme $M_\Upsilon\subset\overline M_\Upsilon$ such that $t$ is an isomorphism of $\mathcal M_\Upsilon$ with the functor of points of $M_\Upsilon$, and $\mathcal A_\Upsilon:=\overline{\mathcal A}_\Upsilon\times_{\overline M_\Upsilon}M_\Upsilon$ is the universal abelian scheme over $M_\Upsilon$, with its zero section, embedded in $\PP(V_\Upsilon)\times M_\Upsilon$; in particular the origin of the fibre over $s\in M_\Upsilon$ is the point $s$ itself. We use these schemes over $\Q$. The open set $M_\Upsilon$ is not described explicitly, and the algorithm below does not use equations for it (\cref{lem:N0}). Over $\C$, $M_\Upsilon\otimes\C$ is a Shimura variety $\Sh_{K_\Upsilon}(G,X)$: a point is a principally polarized abelian variety $A$ with a similitude $\eta\colon W_{\Zhat}\to H_1(A,\Zhat)$, and $\eta$, $\eta'$ give the same point if and only if $\eta'=\alpha\eta k$ with $\alpha\in\mathrm{Aut}(A,\varphi_0)$ and $k$ in the subgroup $K_\Upsilon\subset G(\Zhat)$ of elements for which $\eta$ and $\eta k$ induce the same $\Upsilon$-marking on $A$. Here $\varphi_0$ is the principal polarization, $L$ is the totally symmetric sheaf with $\varphi_L=d_\Upsilon\varphi_0$, which has type $\Upsilon$ and is unique \cite[p.~307]{MumfordI}, and the marking induced by $\eta$ is the symmetric $\vartheta$-structure for $L$ that \cite[\S2, Remark~3, p.~319]{MumfordI} attaches to the symplectic isomorphism $H(L^{\otimes2})=A[2d_\Upsilon]\cong H(2\Upsilon)$ defined by $\eta$ as in the proof of \cref{lem:Kdelta}(i); every $\Upsilon$-marking on $A$ arises in this way \cite[\S2, Remark~4]{MumfordI}. Let $e_1,\dots,e_g,f_1,\dots,f_g$ be a symplectic basis of $W_\Z$, with $\psi(e_i,e_j)=\psi(f_i,f_j)=0$, $\psi(e_i,f_i)=1$ and $\psi(e_i,f_j)=0$ for $i\ne j$, let $\nu$ be the similitude character, and for $m\ge1$ put \[ K'(m):=\{k\in G(\Zhat):k\equiv\mathrm{diag}(1_g,\nu(k)1_g)\bmod m\}\supset K(m), \] and $\Gamma(m):=\mathrm{Sp}_{2g}(\Z)\cap K(m)$. \begin{lemma}\label{lem:Kdelta} \begin{enumerate}[(i)] \item $K'(2d_\Upsilon)\subset K_\Upsilon\subset K'(d_\Upsilon)$. In particular $K(2d_\Upsilon)\subset K_\Upsilon$ and $K_\Upsilon\cap\mathrm{Sp}(W)(\Af)\subset K(d_\Upsilon)$. \item $\nu(K_\Upsilon)=\Zhat^\times$. Hence $S:=M_\Upsilon\otimes\C$ is connected, $S=\Gamma_\Upsilon\backslash\mathcal H_g$ with $\Gamma_\Upsilon:=\mathrm{Sp}_{2g}(\Z)\cap K_\Upsilon$, and $\Gamma(2d_\Upsilon)\subset\Gamma_\Upsilon\subset\Gamma(d_\Upsilon)$. \item $K_\Upsilon$ is not neat. But if $(H',X_{H'})$ is a Shimura subdatum of $(G,X)$, $X_{H'}^+$ a connected component of $X_{H'}$ and $h\in G(\Af)$, then every subgroup of $H'(\Q)\cap hK_\Upsilon h^{-1}$ that preserves $X_{H'}^+$ is neat. In particular $G(\Q)_+\cap hK_\Upsilon h^{-1}$ is neat for every $h$. \end{enumerate} \end{lemma} \begin{proof} (i) Mumford defines $H(\Upsilon):=K(\Upsilon)\oplus\widehat K(\Upsilon)$ with $\widehat K(\Upsilon):=\mathrm{Hom}(K(\Upsilon),\C^*)$ \cite[p.~294]{MumfordI}, so the commutator pairing of the Heisenberg group $\mathcal G(\Upsilon)$ takes values in $\mu_{d_\Upsilon}$ with no choice of a root of unity. For $L$ of type $\Upsilon$ the group $H(L)$ is $A[d_\Upsilon]$, and an $\Upsilon$-marking induces a symplectic isomorphism $H(L)\cong H(\Upsilon)$. On $A[d_\Upsilon]$ the Weil pairing $\langle\ ,\ \rangle$ satisfies $\langle\eta v,\eta w\rangle=\zeta^{\nu(\eta)\psi(v,w)}$ with $\zeta:=\exp(2\pi i/d_\Upsilon)$; the other sign convention replaces $\zeta$ by $\zeta^{-1}$ and changes nothing below. The isomorphism attached to $\eta$ matches $a\in K(\Upsilon)$ with $\sum_ia_i\eta e_i$, and the character $a\mapsto\zeta^{\sum_ia_ib_i}$ of $K(\Upsilon)$ with the unique $P\in\sum_i(\Z/d_\Upsilon\Z)\,\eta f_i$ such that $\langle\eta e_i,P\rangle=\zeta^{b_i}$ for all $i$, namely $P=\nu(\eta)^{-1}\sum_ib_i\eta f_i$. So $\eta$ and $\eta k$ give the same isomorphism if and only if $ke_i\equiv e_i$ and $\nu(k)^{-1}kf_i\equiv f_i$ modulo $d_\Upsilon$ for all $i$, that is, $k\in K'(d_\Upsilon)$. Since the $\Upsilon$-marking determines this isomorphism, $K_\Upsilon\subset K'(d_\Upsilon)$. The same computation for $L^{\otimes2}$, which has type $2\Upsilon$ and $H(L^{\otimes2})=A[2d_\Upsilon]$, shows that $\eta$ and $\eta k$ induce the same symplectic isomorphism $H(L^{\otimes2})\cong H(2\Upsilon)$ if and only if $k\in K'(2d_\Upsilon)$; and by \cite[\S2, Remark~3, p.~319]{MumfordI} such an isomorphism determines the symmetric $\vartheta$-structure for $L$. So $K'(2d_\Upsilon)\subset K_\Upsilon$. For $k\in K'(d_\Upsilon)$ write $k=(1+d_\Upsilon M)\,\mathrm{diag}(1_g,\nu(k)1_g)$. By the formula for $P$ at level $2d_\Upsilon$, the isomorphisms $H(L^{\otimes2})\cong H(2\Upsilon)$ attached to $\eta k$ and $\eta$ differ by $\mathrm{diag}(1_g,\nu(\eta)1_g)(1+d_\Upsilon M)\,\mathrm{diag}(1_g,\nu(\eta)^{-1}1_g)$, which is $1+N$ with $N:=d_\Upsilon M$ modulo $2d_\Upsilon$, as $\nu(\eta)$ is odd and the entries of $N$ are $0$ or $d_\Upsilon$; so it depends only on $k$, and $N(H(2\Upsilon))\subset H(2\Upsilon)[2]$. In blocks for $K(2\Upsilon)\oplus\widehat K(2\Upsilon)$, $1+N=(1+N_{\mathrm d})(1+N_{\mathrm o})$ with $N_{\mathrm d}$ block-diagonal and $N_{\mathrm o}$ off-diagonal, both factors symplectic. For $1+N_{\mathrm o}$, the computation after \cite[\S2, Remark~3, p.~319]{MumfordI} shows that the marking is replaced by its composite with the automorphism $F_\sigma\colon(t,y,m)\mapsto(\sigma(y,m)t,y,m)$ of $\mathcal G(\Upsilon)=\C^*\times K(\Upsilon)\times\widehat K(\Upsilon)$ \cite[pp.~294 and 318]{MumfordI}, where $\Delta_1\colon K(2\Upsilon)\to\widehat K(2\Upsilon)$ and $\Delta_2\colon\widehat K(2\Upsilon)\to K(2\Upsilon)$ are the two blocks of $N_{\mathrm o}$, $\bar l$ is the image of $l$ in $\widehat K(\Upsilon)$, and $\sigma((2x,\bar l))=\Delta_1x(x)\cdot l(\Delta_2l)$ for $x\in K(2\Upsilon)$ and $l\in\widehat K(2\Upsilon)$; this depends only on $N_{\mathrm o}$. For $1+N_{\mathrm d}$, $x\mapsto\alpha x$, $l\mapsto l\circ\alpha^{-1}$, the automorphism $U\colon(t,x,l)\mapsto(t,\alpha x,l\circ\alpha^{-1})$ of $\mathcal G(2\Upsilon)$ commutes with $D_{-1}$ and satisfies $H_2\circ U=H_2$ and $U\circ E_2=E_2$ \cite[p.~316]{MumfordI}, as $\alpha-1$ has values of order $2$; so $U$ carries a symmetric lift of the first isomorphism to one of the second with the same composite with $H_2$, and by \cite[\S2, Remarks~1 and~3]{MumfordI} the marking does not change. Hence the markings induced by $\eta k$ and $\eta$ differ by an automorphism of $\mathcal G(\Upsilon)$ that depends only on $k$, so $K_\Upsilon$ does not depend on $(A,\eta)$; and it is a group, since for $k,k'\in K_\Upsilon$ the pair $(A,\eta k)$ gives that $\eta kk'$ induces the marking of $\eta k$, which is that of $\eta$, and likewise $\eta k^{-1}$ that of $\eta k^{-1}k=\eta$. Elements of $K'(d_\Upsilon)$ with $\nu=1$ are $\equiv1$ modulo $d_\Upsilon$. Both $K'(d_\Upsilon)$ and $K'(2d_\Upsilon)$ are product levels with the same factor at every odd $p$, so $K_\Upsilon$ is a product level. (ii) $\mathrm{diag}(1_g,u1_g)\in K'(2d_\Upsilon)$ for every $u\in\Zhat^\times$, so $\nu(K_\Upsilon)=\Zhat^\times$. As $\mathrm{Sp}_{2g}$ is simply connected, $\pi_0(\Sh_K(G,X)_\C)=\Q_{>0}\backslash\Af^\times/\nu(K)=\Zhat^\times/\nu(K)$ for every compact open $K\subset G(\Zhat)$ \cite[2.1.3]{Deligne79}, which is trivial for $K=K_\Upsilon$. An element of $G(\Q)_+\cap K_\Upsilon$ has similitude in $\Q_{>0}\cap\Zhat^\times=\{1\}$, so it lies in $\mathrm{Sp}_{2g}(\Z)\cap K_\Upsilon=\Gamma_\Upsilon$, and the inclusions follow from (i). (iii) The element $\mathrm{diag}(1_g,-1_g)$ of $G(\Z)$ has similitude $-1$ and lies in $K'(2d_\Upsilon)\subset K_\Upsilon$; its eigenvalues at every $p$ are $\pm1$, so it is not neat \cite[0.6]{Pink}. Let $\Gamma'$ be a subgroup of $H'(\Q)\cap hK_\Upsilon h^{-1}$ that preserves $X_{H'}^+$. Then $\Gamma'$ preserves the component of $\mathcal H_g^\pm$ that contains $X_{H'}^+$, so $\nu(\Gamma')\subset\Q_{>0}\cap\nu(K_\Upsilon)=\{1\}$, and $\Gamma'\subset G(\Q)\cap h(K_\Upsilon\cap\mathrm{Sp}(W)(\Af))h^{-1}\subset G(\Q)\cap hK(d_\Upsilon)h^{-1}$ by (i). As $d_\Upsilon\ge3$, $K(d_\Upsilon)$ is neat, and neatness passes to conjugates and to subgroups \cite[0.6]{Pink}. \end{proof} So $K_\Upsilon$ is not a neat level in the sense of \cref{sec:shimura}, but $S$ is the quotient of $\mathcal H_g$ by the neat group $\Gamma_\Upsilon$, and everything below uses only the neatness of the arithmetic groups in (iii). In particular the bundle of top-degree forms on $S$ extends to the Baily--Borel compactification as a line bundle $\Lb_{K_\Upsilon}$ \cite[Prop.~3.4(b)]{Mumford77}, whose sections are the modular forms of weight $g+1$ for $\Gamma_\Upsilon$, and degrees on $S$ are taken for it. The bounds of \cref{sec:Ag} are proved at neat product levels, and reach $K_\Upsilon$ through $K(2d_\Upsilon)$. \needspace{4\baselineskip} \begin{lemma}\label{lem:TR} Let $K':=K(2d_\Upsilon)$, $\pi\colon\Sh_{K'}(G,X)\to S$ the natural map, and $c_\Upsilon:=[K_\Upsilon:K']\le|\mathrm{GSp}_{2g}(\Z/2d_\Upsilon\Z)|$. Let $Z\subset S$ be closed and geometrically irreducible, defined over a number field $F$ with $[F:\Q]=d$, with $D:=\deg_{\Lb_{K_\Upsilon}}Z$, and let $V$ be special and maximal in $Z$. Then there are a geometrically irreducible component $Z'$ of $\pi^{-1}(Z)$, defined over a field of degree at most $c_\Upsilon d$, with $\deg_{\Lb_{K'}}Z'\le c_\Upsilon D$, and a special subvariety $V'$ maximal in $Z'$ with $\pi(V')=V$, $T_{V'}=T_V$, $\deg_{\Lb_{K_\Upsilon}}V\le\deg_{\Lb_{K'}}V'$ and $\alpha_V\le\alpha_{V'}$, where $\alpha_V$ is computed at the level $\lambda(K_\Upsilon)$ and $\alpha_{V'}$ at $\lambda(K')$. Since the constants of \cref{thm:AgK}(a) are non-decreasing in $(D,d)$, \cref{thm:AgK}(a) with $N=2d_\Upsilon$, evaluated at $(c_\Upsilon D,c_\Upsilon d)$, bounds $\deg_{\Lb_{K_\Upsilon}}V$, and, if $\QRH(\delta;L_V)$ holds, $d_{L_V}$ and $\alpha_V$. \end{lemma} \begin{proof} This is the proof of \cref{lem:LV} with $K_\Upsilon\supset K'$ in place of $K\supset K'$; that proof uses the neatness of $K$ only through the arithmetic groups, which are neat here by \cref{lem:Kdelta}(iii). Each component of $\Sh_{K'}(G,X)_\C$ is $\Gamma(2d_\Upsilon)\backslash\mathcal H_g$, and $\pi$ restricted to it is the covering $\Gamma(2d_\Upsilon)\backslash\mathcal H_g\to\Gamma_\Upsilon\backslash\mathcal H_g$ of quotients by neat groups, so $\pi$ is finite étale of degree at most $c_\Upsilon$; top-degree forms pull back to top-degree forms, and the two extensions are given by modular forms of weight $g+1$, so $\pi^*\Lb_{K_\Upsilon}=\Lb_{K'}$. If $V$ is the image of $X_H^+\times\{\gamma\}$, let $V'$ be the image of $X_H^+\times\{\gamma\}$ in $\Sh_{K'}(G,X)$: a component of $\pi^{-1}(V)$ with the same datum $(H,X_H)$, so $T_{V'}=T_V$. Let $Z'$ be a component of $\pi^{-1}(Z)$ containing $V'$. As $\pi$ is defined over $\Q$ (it sends $(A,\varphi_0,\eta K')$ to the $\Upsilon$-marking induced by $\eta$, which involves no choice of a root of unity and so commutes with $\mathrm{Aut}(\C/\Q)$), $\pi^{-1}(Z)$ is defined over $F$ and has at most $c_\Upsilon$ geometric components, $Z'$ is defined over an extension of degree at most $c_\Upsilon$; by the projection formula $\deg_{\Lb_{K'}}\pi^{-1}(Z)=\deg\pi\cdot D\le c_\Upsilon D$ and $\deg V\le\deg(\pi|_{V'})\deg V=\deg_{\Lb_{K'}}V'$. If $V'\subsetneq V''\subset Z'$ with $V''$ special, then $\pi(V'')\subset Z$ is special of dimension larger than $\dim V$, against maximality. Finally, with the same $\gamma$, $\bar T(\Q_p)\cap\lambda(\gamma_pK'_p\gamma_p^{-1})\subset\bar T(\Q_p)\cap\lambda(\gamma_pK_{\Upsilon,p}\gamma_p^{-1})$, so each index $\bar\iota_p$ can only grow when $K_\Upsilon$ is replaced by $K'$; each factor $\max(1,\bar B\bar\iota_p)$ is at least $1$ and non-decreasing in $\bar\iota_p$, the set of $p$ with $\bar\iota_p>1$ can only grow, and $\bar B$ does not change. The constants of \cref{thm:AgK}(a) are non-decreasing in $D$ and $d$ because $D_z$ and $d_z$ are, and the constants of \cref{sec:adjoint} are non-decreasing in $D$ and $d$ (proof of \cref{thm:NA}). \end{proof} \needspace{4\baselineskip} \begin{lemma}\label{lem:N0} Let $Z\subset M_\Upsilon\otimes\Qbar$ be closed and irreducible. Put $n':=g(g+1)/2$ and $P_\Upsilon(t):=d_\Upsilon^gt^g$. Let $Y:=(\overline M_\Upsilon\otimes\Qbar)_{\mathrm{red}}$, let $Y^\circ\subset Y$ be the open set of points at which $Y$ is smooth over $\Qbar$ of local dimension $n'$, $\mathcal X^\circ:=\overline{\mathcal A}_\Upsilon\times_{\overline M_\Upsilon}Y^\circ$, $H_\Upsilon\subset Y^\circ$ the set of points $y$ whose fibre $\mathcal X^\circ_y\subset\PP(V_\Upsilon)_{\kappa(y)}$ is smooth of pure dimension $g$ with Hilbert polynomial $P_\Upsilon$, $U$ the interior of $H_\Upsilon$ in $Y^\circ$, $C_Z$ the irreducible component of $Y$ containing $Z$, and $N_0:=U\cap C_Z$. \begin{enumerate}[(i)] \item $\mathcal X^\circ\times_{Y^\circ}U\to U$ is smooth. \item $M_\Upsilon\otimes\Qbar\subset U$. In particular $Z\subset Y^\circ$, and $C_Z$ is well defined. \item $N_0=M_\Upsilon\otimes\Qbar$. \item $N_0$ can be computed from Mumford's equations and equations for $Z$, as a quasi-projective variety given by explicit equations and inequations. \end{enumerate} \end{lemma} \begin{proof} (i) Each $y\in U$ has an open neighbourhood $W\subset H_\Upsilon$. As $Y^\circ$ is smooth over $\Qbar$, each connected component of $W$ is integral, and over it the fibres of $\mathcal X^\circ$ have the same Hilbert polynomial $P_\Upsilon$, so $\mathcal X^\circ_W$ is flat over $W$ \cite[III.9.9]{Hartshorne}. A flat morphism of finite presentation with smooth fibres is smooth \cite[17.5.1]{EGAIV4}. (ii) $M_\Upsilon\otimes\Qbar$ is open in $\overline M_\Upsilon\otimes\Qbar$ and smooth of dimension $n'$ (it is a fine moduli space, and $S=\Gamma_\Upsilon\backslash\mathcal H_g$ with $\Gamma_\Upsilon$ neat by \cref{lem:Kdelta}), so it is an open subscheme of $Y$ contained in $Y^\circ$. Its fibres are abelian varieties embedded by a sheaf $L$ of type $\Upsilon$, which are smooth of pure dimension $g$ with Hilbert polynomial $\chi(L^{\otimes t})=t^g\chi(L)=d_\Upsilon^gt^g$, because $\chi(L)^2=\deg\varphi_L=|K(L)|=d_\Upsilon^{2g}$ and $\chi(L)>0$ for ample $L$ \cite[Thm.~11.1]{MilneAV}. So $M_\Upsilon\otimes\Qbar$ is an open subset of $Y^\circ$ contained in $H_\Upsilon$, hence in $U$. A point of $Y^\circ$ lies on exactly one irreducible component of $Y$. (iii) Two distinct components of $Y$ of dimension $n'$ meet only at points where $Y$ is not smooth, so the connected components of $Y^\circ$ are the non-empty $C_j\cap Y^\circ$, for the components $C_j$ of $Y$ of dimension $n'$; as each $U\cap C_j$ is open in the irreducible $C_j$, the connected components of $U$ are the non-empty $U\cap C_j$. By (ii), $Z\subset U\cap C_Z=N_0$, and $N_0$ is connected. The family $\overline{\mathcal A}_\Upsilon\times_{\overline M_\Upsilon}N_0$ is smooth over $N_0$ by (i), and every geometric point of $Z$ is in the image of $\mathcal M_\Upsilon$ under $t$. Mumford's Step~IV \cite[p.~94]{MumfordII} says, with $\Upsilon$ for his $\delta$: ``Suppose that $N$ is a connected subscheme of $\overline M_\Upsilon$ such that if $\overline{\mathcal A}_\Upsilon$ induces a subscheme $B$ over $N$, then $B$ is smooth over $N$. Suppose that some geometric point $x$ of $N$ is in the image of $\mathcal M_\Upsilon$ under $t$. Then the $N$-valued point $1_N$ of $N$ is in the image of $\mathcal M_\Upsilon$.'' Its proof \cite[pp.~94--95]{MumfordII} uses $N$ only as a connected scheme with a morphism to $\overline M_\Upsilon$, so it applies to $N_0\to\overline M_\Upsilon$. Hence $N_0\subset M_\Upsilon\otimes\Qbar$. Now $N_0$ is open in $U$, hence open in $M_\Upsilon\otimes\Qbar$, and closed in $U\supset M_\Upsilon\otimes\Qbar$, hence closed in $M_\Upsilon\otimes\Qbar$. By \cref{lem:Kdelta}(ii), $M_\Upsilon\otimes\Qbar$ is connected, so $N_0=M_\Upsilon\otimes\Qbar$. (iv) The components of $Y$ are computed by absolute primary decomposition, $Y^\circ$ by the Jacobian criterion, and $C_Z$ by ideal membership. Urbanik's flattening stratification \cite[Prop.~5.1(i)]{Urbanik}, applied to $\mathcal X^\circ\to Y^\circ$, gives locally closed $T_1,\dots,T_k$ covering $Y^\circ$ over which $\mathcal X^\circ$ is flat. Over each irreducible component $T'$ of each $T_i$ the fibres have one Hilbert polynomial \cite[III.9.9]{Hartshorne}, computed at the generic point by a Gröbner basis. Let $H'_\Upsilon$ be the set of $y\in Y^\circ$ whose fibre has Hilbert polynomial $P_\Upsilon$ and whose Jacobian matrix has rank $\dim\PP(V_\Upsilon)-g$ at every point of the fibre. The points of $\mathcal X^\circ_{T'}$ at which the Jacobian matrix of the fibre has rank different from $\dim\PP(V_\Upsilon)-g$ form a constructible set, and its image in $T'$ is constructible and computable \cite[Thm.~1.0]{BLH}. So $H'_\Upsilon$ is constructible and computable, and so is its interior $U'$ in $Y^\circ$, the complement of the closure of $Y^\circ\smallsetminus H'_\Upsilon$. Clearly $H_\Upsilon\subset H'_\Upsilon$, so $U\subset U'$. Conversely, let $y\in U'\cap C_Z$ and let $W\subset U'\cap C_Z$ be an irreducible open neighbourhood of $y$ in $Y^\circ$. The open set $M_\Upsilon\otimes\Qbar$ meets $C_Z$ (it contains $Z$), so $W$ contains the generic point of $C_Z$, over which the fibre is an abelian variety. As $\mathcal X^\circ_W$ is flat over the integral $W$, its associated points lie over the generic point of $W$; so $\mathcal X^\circ_W$ is integral of dimension $n'+g$, and every fibre over $W$ is of pure dimension $g$ \cite[III.9.6]{Hartshorne}. On a fibre of pure dimension $g$, rank $\dim\PP(V_\Upsilon)-g$ of the Jacobian matrix at every point is smoothness. So $W\subset H_\Upsilon$, and $U'\cap C_Z=U\cap C_Z=N_0$. \end{proof} \subsection{PEL loci}\label{sec:PEL} \emph{PEL data.} A PEL datum $\mathfrak d=(\mathcal E,R,\tau)$ consists of a product $\mathcal E=\prod_iF_i$ of totally real and CM fields with its positive involution $*$ (the identity on each totally real factor and complex conjugation on each CM factor), an order $R\subset\mathcal O_{\mathcal E}$ stable under $*$, given by generators $e_1,\dots,e_m$ of $R$ as a $\Z$-module, and a type $\tau$: multiplicities $m_i\ge1$ with $\sum_im_i[F_i:\Q]=2g$, together with, for each CM factor $F_i$ and each place $v$ of its maximal totally real subfield $F_i^+$, an integer $0\le a_v\le m_i$, the multiplicity on the tangent space of a fixed embedding $\varphi_v$ of $F_i$ above $v$ (its conjugate then has multiplicity $m_i-a_v$); a totally real $F_i$ carries $m_i/2$ copies of each of its embeddings, $m_i$ even. Then $\tau$ gives, for each $r\in R$, a characteristic polynomial $\tau(r)$ of degree $g$, and we let $W'$ be the $\mathcal E$-module whose character is $\tau\bar\tau$. The \emph{PEL locus} $\mathfrak E(\mathfrak d)\subset S$ is the set of points $s$ for which there is a ring homomorphism $\iota\colon R\to\mathrm{End}(A_s)$ with $\iota(r)^\dagger=\iota(r^*)$ for the Rosati involution $\dagger$ of the polarization, and $\det(T-\iota(r)\mid\mathrm{Lie}\,A_s)=\tau(r)$ for all $r\in R$; then $H_1(A_s,\Q)\cong W'$ as $\mathcal E$-modules, as $H_1(A_s,\C)=\mathrm{Lie}\,A_s\oplus\overline{\mathrm{Lie}\,A_s}$. For a special $V$ with torus algebra $\mathcal E=\Q[T]$ as in \cref{sec:orders} we put $\mathfrak d_V:=(\mathcal E,R,\tau_V)$, with $R=\mathcal E\cap\mathrm{End}(\Lambda_V)$ and $\tau_V(r)$ the characteristic polynomial of $r$ on $\mathrm{Lie}\,A_x=W_\C/F^0_x$ for $x\in X_H^+$, which does not depend on $x$, being continuous with values in a countable set. \emph{Endomorphisms by their graphs.} Let $s\in N_0$, with abelian variety $A_s\subset\PP(V_\Upsilon)$ embedded by $L$ of type $\Upsilon$. A closed subscheme $\Gamma\subset A_s\times A_s$ such that $\mathrm{pr}_1|_\Gamma$ is an isomorphism and $(0,0)\in\Gamma$ is the graph of the homomorphism $f:=\mathrm{pr}_2\circ(\mathrm{pr}_1|_\Gamma)^{-1}$, since a regular map of abelian varieties is a homomorphism followed by a translation \cite[Cor.~1.2]{MilneAV}. On $\Gamma_f\cong A_s$ the bundle $\mathcal O(1)\boxtimes\mathcal O(1)$ restricts to $L\otimes f^*L$, and $\varphi_{L\otimes f^*L}=\varphi_L\circ(1+f^\dagger f)$, so \begin{equation}\label{eq:graphHilbert} \chi\bigl((L\otimes f^*L)^{\otimes t}\bigr)=t^g\,d_\Upsilon^g\,\det\nolimits_{H_1(A_s,\Q)}(1+f^\dagger f)^{1/2}, \end{equation} because $\chi(M)^2=\deg\varphi_M$ and $\chi(M)>0$ for ample $M$, $\chi(M^{\otimes t})=t^g\chi(M)$, and the degree of an endomorphism is its determinant on $H_1(A_s,\Q)$ \cite[Thm.~11.1 and Prop.~10.20]{MilneAV}. If $f=\iota(e)$ with $\iota(e)^\dagger=\iota(e^*)$, this is the polynomial $P_e(t):=t^gd_\Upsilon^g\det_{W'}(1+e^*e)^{1/2}$, computed from $\mathfrak d$. \begin{lemma}\label{lem:Hilb} Let $B$ be a quasi-projective variety over a number field, $\mathcal X\subset\PP^M\times B$ a closed subscheme whose ideal sheaf is generated by explicitly given bihomogeneous $F_1,\dots,F_k$ of degrees at most $m$ in the coordinates $x$ of $\PP^M$, and $p(t)$ a Hilbert polynomial with Gotzmann number $r_0$. Put $r:=\max(r_0,m)$, $N(t):=\binom{M+t}{M}$ and $q(t):=N(t)-p(t)$. Then the relative Hilbert scheme $\mathrm{Hilb}^p(\mathcal X/B)$ is the closed subscheme of $\mathrm{Hilb}^p(\PP^M)\times B\subset\mathrm{Gr}(q(r),N(r))\times B$ defined by $x^\alpha F_j(\cdot\,;b)\in \Omega$ for all $j$ and all monomials $x^\alpha$ of degree $r-\deg_xF_j$, where $\Omega\subset\Qbar[x]_r$ is the point of the Grassmannian; and its universal family is cut out in $\PP^M\times\mathrm{Hilb}^p(\mathcal X/B)$ by $\Omega$. \end{lemma} \begin{proof} For the absolute case, by Gotzmann's regularity theorem the ideal sheaf of a subscheme $\mathcal Z\subset\PP^M_A$ with Hilbert polynomial $p$ is $r$-regular, $I(\mathcal Z)_{\ge r}$ is generated by $I(\mathcal Z)_r$, and $\mathcal Z\mapsto I(\mathcal Z)_r$ embeds $\mathrm{Hilb}^p(\PP^M)$ in $\mathrm{Gr}(q(r),N(r))$ as a closed subscheme with explicit equations \cite[Thms.~1.21, 1.24 and 1.25, (1.22), (1.23)]{Lella}; Lella states these for $r=r_0$, and they hold for every $r\ge r_0$ with the same proofs, since an $r_0$-regular sheaf is $r$-regular. For a $T$-point $T\to B$ and $\mathcal Z\subset\PP^M_T$ flat with Hilbert polynomial $p$, let $\Omega$ be the module of sections of $I_{\mathcal Z}(r)$, locally a direct summand of rank $q(r)$. If $F_j$ vanishes on $\mathcal Z$, then $x^\alpha F_j\in \Omega$. Conversely, if $x^\alpha F_j\in \Omega$ for all $|\alpha|=r-\deg F_j$, then on $D_+(x_i)$ the function $F_j/x_i^{\deg F_j}=x_i^{r-\deg F_j}F_j/x_i^r$ is a section of $I_{\mathcal Z}$, so $F_j$ vanishes on $\mathcal Z$. Membership of a given vector in a subbundle of rank $q(r)$ is the vanishing of exterior products, a closed condition compatible with base change. \end{proof} Let $\mathcal H$ be a scheme of finite type over a number field $k$, $\mathcal A\to\mathcal H$ an abelian scheme of relative dimension $g$ embedded in $\PP(V_\Upsilon)\times\mathcal H$, and $\Gamma\subset\mathcal A\times_{\mathcal H}\mathcal A$ closed, flat and proper over $\mathcal H$ with fibres $\Gamma_t$ of dimension $g$; in our application $\mathcal H$ is one of the relative Hilbert schemes $\mathcal H_{i,n}$ in the proof of \cref{lem:PELcomp}, $\mathcal A$ the pull-back of the universal abelian scheme over $N_0$, and $\Gamma$ the universal subscheme. Let $\pi_t:=\mathrm{pr}_1|_{\Gamma_t}\colon\Gamma_t\to\mathcal A_t$ and $U_{\mathrm{iso}}:=\{t\in\mathcal H:\pi_t\text{ is an isomorphism}\}$. \needspace{4\baselineskip} \begin{lemma}\label{lem:iso} \begin{enumerate}[(a)] \item For $t\in\mathcal H$ the following are equivalent: $\pi_t$ is an isomorphism; $\pi_t$ is a monomorphism; for every $y\in\mathcal A_t$ the fibre $\pi_t^{-1}(y)$ is empty or $\kappa(y)$-isomorphic to $\mathrm{Spec}\,\kappa(y)$. \item $U_{\mathrm{iso}}$ is open in $\mathcal H$. \item Let $t\in\mathcal H$, $\kappa:=\kappa(t)$, and $J\subset\kappa[x,y]$ a bihomogeneous ideal whose sheaf is the ideal sheaf of $\Gamma_t$ in $\PP_x\times\PP_y$, two copies of $\PP(V_\Upsilon)$ with coordinates $x_0,\dots,x_M$ and $y_0,\dots,y_M$; let $J'$ be the same ideal in variables $(x,y')$. Then $\pi_t$ is an isomorphism if and only if for every $(i,j,l)$ each minor $y_ay'_b-y_by'_a$, dehomogenized by $x_i=y_j=y'_l=1$, lies in the dehomogenization of $J+J'\subset\kappa[x,y,y']$. \end{enumerate} \end{lemma} \begin{proof} (a) Let $\pi_t$ be a monomorphism. It is proper, so it is a closed immersion \cite[18.12.6]{EGAIV4}; its image is closed of dimension $g$ in the integral $g$-dimensional $\mathcal A_t$, hence all of $\mathcal A_t$, and as $\mathcal A_t$ is reduced, $\pi_t$ is an isomorphism. The third condition holds for all $y$ if and only if $\pi_t$ is a closed immersion \cite[18.12.6]{EGAIV4}, hence by the same argument if and only if it is an isomorphism. (b) $\mathrm{pr}_1\colon\Gamma\to\mathcal A$ is proper. Let $V_0$ be the set of $y\in\mathcal A$ over which the fibre is empty or $\kappa(y)$-isomorphic to $\mathrm{Spec}\,\kappa(y)$. By \cite[18.12.7]{EGAIV4}, $y\in V_0$ if and only if $\mathrm{pr}_1$ is a closed immersion over a neighbourhood of $y$, so $V_0$ is open; the structure map $\mathcal A\to\mathcal H$ is proper, so $U_{\mathrm{iso}}$, the complement of the image of $\mathcal A\smallsetminus V_0$, is open by (a). (c) As $\mathcal A_t\to\PP_x$ is a closed immersion, $\Gamma_t\times_{\mathcal A_t}\Gamma_t=\Gamma_t\times_{\PP_x}\Gamma_t$ is the closed subscheme of $\PP_x\times\PP_y\times\PP_{y'}$ with ideal $J+J'$, and the diagonal is cut out in it by the $2\times2$ minors of the matrix with rows $y$ and $y'$. So the diagonal is an isomorphism if and only if these minors vanish on $\Gamma_t\times_{\mathcal A_t}\Gamma_t$, which on the charts $D_+(x_iy_jy'_l)$ is the stated membership. A morphism is a monomorphism if and only if its diagonal is an isomorphism \cite[Tag~01L3]{Stacks}; conclude by (a). \end{proof} On an affine chart $C=V(I_C)\cap D(h_C)$ of $\mathrm{Gr}(q(r),N(r))\times N_0$ with coordinates $u$, the point $\Omega(t)$ of \cref{lem:Hilb} has a basis $w_1(u),\dots,w_{q(r)}(u)$ with coefficients polynomial in $u$, and pulling back along the Segre map gives generators $w_s(t)(x\otimes y)$ of the ideal sheaf of $\Gamma_t$ in $\PP_x\times\PP_y$, admissible in \cref{lem:iso}(c) at every $t\in C$, including generic points of closed subsets. \begin{algorithm}[$U_{\mathrm{iso}}$]\label{alg:iso} (1) For each chart $C$, compute the minimal primes $\mathfrak p$ of $I_C$ not containing $h_C$, and put each pair $(C,\mathfrak p)$ on a list. (2) Take a pair $(C,\mathfrak p)$ off the list, let $\kappa:=\mathrm{Frac}(k[u]/\mathfrak p)$, and run the test of \cref{lem:iso}(c) at the generic point of $V(\mathfrak p)$ over $\kappa$, by Buchberger's algorithm with cofactors on each of the $(M+1)^3$ charts. (3) If the answer is yes, choose $h\in k[u]\smallsetminus\mathfrak p$ that is a common denominator of all coefficients of all cofactors; record $V(\mathfrak p)\cap D(h)\cap D(h_C)$, and put on the list the pairs $(C,\mathfrak p')$ for the minimal primes $\mathfrak p'$ of $\mathfrak p+(h)$ not containing $h_C$. (4) If the answer is no, record nothing. (5) Repeat until the list is empty, and output the union of the recorded sets. \end{algorithm} \begin{lemma}\label{lem:algiso} \Cref{alg:iso} terminates, and its output is $U_{\mathrm{iso}}$. \end{lemma} \begin{proof} A recorded set lies in $U_{\mathrm{iso}}$: after multiplying by a power of $h$ the cofactor identities hold in $(k[u]/\mathfrak p)_h[x,y,y']$, hence at every $t\in V(\mathfrak p)\cap D(h)$, and \cref{lem:iso}(c) applies. A ``no'' loses nothing: $U_{\mathrm{iso}}\cap V(\mathfrak p)$ is open in the irreducible $V(\mathfrak p)\cap C$ by \cref{lem:iso}(b) and misses its generic point, so it is empty. Every $t\in U_{\mathrm{iso}}$ is recorded: it lies on a component $V(\mathfrak p_0)$ from step (1), which answered yes; either $t$ is in the recorded set, or $t$ lies on a component of $V(\mathfrak p_0+(h_0))$, of smaller dimension, which again answered yes; and a $0$-dimensional component $\{t\}$ that answers yes is recorded. Each pair put on the list has smaller dimension than its parent, so the algorithm terminates. This is the induction of the proof of \cite[Prop.~5.1(iii)]{Urbanik}, with ``reduced fibre'' replaced by ``$\pi_t$ is an isomorphism''. \end{proof} \needspace{4\baselineskip} \begin{lemma}\label{lem:PELcomp} For every PEL datum $\mathfrak d$, the set $\mathfrak E(\mathfrak d)\cap N_0$ is constructible, and it can be computed from Mumford's equations, $N_0$ and $\mathfrak d$ as a finite union of explicit locally closed subsets of $N_0$. \end{lemma} \begin{proof} Let $\mathcal A:=\overline{\mathcal A}_\Upsilon\times_{\overline M_\Upsilon}N_0$, the universal abelian scheme over $N_0$ (\cref{lem:N0}), and embed $\mathcal A\times_{N_0}\mathcal A$ in $\PP(V_\Upsilon\otimes V_\Upsilon)\times N_0$ by the Segre map, so that $\mathcal O(1)$ restricts to $\mathcal O(1)\boxtimes\mathcal O(1)$; its ideal sheaf is generated by the Segre quadrics and by $F(x;b)y^\beta$, $F(y;b)x^\beta$ ($|\beta|=\deg F$) for Mumford's equations $F$ of $\mathcal A$. For each generator $e_i$ and each $n=1,\dots,2g+1$, let $\mathcal H_{i,n}$ be the relative Hilbert scheme of \cref{lem:Hilb} for the polynomial $P_{ne_i}$, with universal subscheme $\Gamma_{i,n}$, and let $\mathcal H$ be their fibre product over $N_0$. Impose: (1) $\mathrm{pr}_1$ is an isomorphism on each $\Gamma_{i,n}$ (the open set $U_{\mathrm{iso}}$, computed by \cref{alg:iso}), and $(0,0)\in\Gamma_{i,n}$, i.e.\ every element of $\Omega$ vanishes at $s\otimes s$, as the origin of $A_s$ is the point $s$; so $\Gamma_{i,n}$ is the graph of a homomorphism $f_{i,n}$. (2) $df_{i,n}=n\,df_{i,1}$, the $\Z$-linear relations among the $e_i$, and the expressions of $1$ and of each product $e_ie_j$ as $\Z$-linear combinations of the $e_k$, hold for the differentials $df_{i,1}$ at the origin, and $\det(T-df_{i,1}\mid\mathrm{Lie})=\tau(e_i)$; these are closed conditions on the tangent spaces of the graphs at $(0,0)$. In characteristic $0$, $f\mapsto df$ is injective on $\mathrm{End}(A_s)$, by complex uniformization; so (2) gives $f_{i,n}=nf_{i,1}$, a ring homomorphism $\iota\colon R\to\mathrm{End}(A_s)$ with $\iota(e_i)=f_{i,1}$, and the type $\tau$, as the traces on $\mathrm{Lie}\,A_s$, additive in $r$, agree on the $e_i$, hence on $\mathcal E$, and fix the multiplicity of each embedding. (3) By \cref{eq:graphHilbert}, the Hilbert polynomials give $\det(1+n^2f^\dagger f)=\det_{W'}(1+n^2e^*e)$ for $f=f_{i,1}$, $e=e_i$ and $2g+1$ values of $n^2$, so $f^\dagger f$ and $e^*e$ have the same characteristic polynomial. Hence $\mathrm{Tr}(f^\dagger f)=\sum|\xi|^2$ over the eigenvalues $\xi$ of $f$, which is the case of equality in Schur's inequality for the positive definite Rosati form; so $f$ is normal, and $f^\dagger=\iota(e_i^*)$, as both act by $\bar\xi$ on the $\xi$-eigenspace of $f$. Conversely every $s\in\mathfrak E(\mathfrak d)\cap N_0$ with its $\iota$ gives such graphs. So $\mathfrak E(\mathfrak d)\cap N_0$ is the image in $N_0$ of an explicit finite union of locally closed subsets of $\mathcal H$, and the image is constructible and computable \cite[Thm.~1.0]{BLH}, on finitely many affine charts. \end{proof} \subsection{Containers}\label{sec:containers} We use Urbanik's algorithm \cite{Urbanik}, with his definitions. Let $\widetilde S$ be a smooth quasi-projective variety carrying a polarizable integral variation of Hodge structure $\mathbb V$. The algebraic monodromy group $H_Y$ of an irreducible subvariety $Y$ (not the Mumford--Tate group of \cref{sec:special}) is the identity component of the Zariski closure of the monodromy of $\mathbb V$ on the normalization of $Y$; $Y$ is \emph{weakly special} if it is maximal among irreducible subvarieties with its algebraic monodromy group \cite[Defs.~1.3--1.4]{Urbanik}; and $Y$ is \emph{rigid} if there is no weakly special $Y'$ with $Y\subsetneq Y'\subset\widetilde S$ such that $H_Y$ is normal in $H_{Y'}$ \cite[Def.~4.28]{Urbanik}. Special subvarieties are weakly special. For a projective compactification of $\widetilde S$, a very ample line bundle on it and an integer $d'$, \cite[Thm.~6.1(ii) and Cor.~6.3]{Urbanik} give an algorithm that computes a finite set of weakly special subvarieties of degree at most $d'$ containing the rigid ones, from equations for $\widetilde S$ and the data $(\mathcal H,F^\bullet,\nabla)$ of the variation \cite[Thm.~2.4]{Urbanik}. A maximal special subvariety of $Z$ need not be rigid in $S$: a special curve $\{x\}\times Y(1)$ in $\mathcal A_2$, with $x$ a CM point, moves in the family $\{x'\}\times Y(1)$. We make it rigid by passing to the normalization of a component of the PEL locus defined by the connected centre of its generic Mumford--Tate group (\cref{lem:P}). \begin{lemma}\label{lem:P} Let $V\subset S$ be special, the image of $X_H^+\times\{\gamma\}$ for a Shimura subdatum $(H,X_H)$ with $H$ the generic Mumford--Tate group, let $T$ be the connected centre of $H$, $\mathcal E:=\Q[T]$, and $M:=Z_G(T)=Z_G(\mathcal E)$. \begin{enumerate}[(a)] \item For $x\in X_H$, $h_x(\mathbb S)\subset M_\R$ and $T\subset Z(M)$. Let $X_M^+$ be the component of $M(\R)h_x$ containing $X_H^+$, and $S_V$ the image of $X_M^+\times\{\gamma\}$. Then $S_V$ is special and $V\subset S_V$. If $H'$ is the generic Mumford--Tate group on $X_M^+$, then $T\subset Z(H')$, $X_{H'}^+=X_M^+$, and $S_V$ is the image of $X_{H'}^+\times\{\gamma\}$. \item For every PEL datum $\mathfrak d$, $\mathfrak E(\mathfrak d)$ is closed in $S$, and each of its irreducible components is a special subvariety of a dimension $\dim\mathfrak d$ determined by $\mathfrak d$. $S_V$ is an irreducible component of $\mathfrak E(\mathfrak d_V)$. \item Let $K_{H'}:=\gamma K_\Upsilon\gamma^{-1}\cap H'(\Af)$, $\widetilde S_V$ the image of $X_{H'}^+\times\{1\}$ in $\Sh_{K_{H'}}(H',X_{H'})_\C$, and $\nu\colon\widetilde S_V\to S_V$ the map induced by $[x,h]\mapsto[x,h\gamma]$. Then $\widetilde S_V$ is smooth and $\nu$ is the normalization. The image $W_V$ of $X_H^+\times\{1\}$ in $\widetilde S_V$ is special, $\nu(W_V)=V$, and $\nu|_{W_V}$ is birational onto $V$. The first two sentences hold, with the same proof, for every special $S'\subset S$ in place of $S_V$, with its generic Mumford--Tate group and its $\gamma'$ in place of $H'$ and $\gamma$; by (b), this covers every irreducible component of every $\mathfrak E(\mathfrak d)$. \item $W_V$ is rigid in $\widetilde S_V$, for the variation of Hodge structure $\nu^*\mathbb V$ given by $W$. \item For every very ample line bundle $\mathcal L'$ on a projective compactification of $\widetilde S_V$ and every integer $d'\ge\deg_{\mathcal L'}\overline W_V$, the point $[W_V]$ lies in the finite set that \cite[Cor.~6.3]{Urbanik} computes for $(\widetilde S_V,\nu^*\mathbb V,d')$. If $\mathcal L'=\nu^*\mathcal O(1)$ for a projective embedding of $\overline S_V$, then $\deg_{\mathcal L'}\overline W_V=\deg_{\mathcal O(1)}\overline V$. \end{enumerate} \end{lemma} We call $S_V$ the \emph{container} of $V$. \begin{proof} (a) $h_x(\mathbb S)\subset H_\R$ and $T$ is central in $H$, so $h_x(\mathbb S)\subset M_\R$; $M$ is reductive, being the centralizer of a torus, and $T\subset Z(M)$. $X_H^+\subset M(\R)h_x$ is connected, so it lies in one component $X_M^+$, and $V\subset S_V$. For $y\in X_H$, $(M,M(\R)h_y)$ satisfies (2.1.1.1) and (2.1.1.2) of \cite{Deligne79}, as $\mathrm{Lie}\,M$ is a sub-Hodge structure of $\mathrm{Lie}\,G$ and $\psi(\cdot,h_y(i)\cdot)$ is definite, but (2.1.1.3) can fail (for $A_y\cong A_0^2$ with $A_0$ a CM elliptic curve, $M^\ad$ is compact); so $h_y$ projects trivially to the $\Q$-simple factors of $M^\ad$ with compact real points \cite[2.1.1]{Deligne79} and factors through $M_1:=Z(M)^\circ M_{\mathrm{nc}}$, with $M_{\mathrm{nc}}$ the product of the other $\Q$-simple factors of $M^\der$. As $Z(M)^\circ$ and the compact factors centralize $h_y$, $X_M^+=M_1(\R)^+h_y$ for $y\in X_H^+$, a component of the Shimura subdatum $(M_1,M_1(\R)h_y)$, which satisfies (2.1.1.3) because a $\Q$-factor of $M_1^\ad$ on which $h_y$ projects trivially has compact real points by (2.1.1.2); so $S_V$ is special. By \cite[Lemma~2.1]{UY}, $S_V$ is the image of $X_{H'}^+\times\{\gamma\}$, and $X_{H'}^+=X_M^+$, both being connected complex submanifolds of the same dimension, the first closed in the second. As $\mathrm{MT}(y)\subset H'$ for $y\in X_H$, $H\subset H'$ and $T\subset Z(M)\cap H'\subset Z(H')$. (b) Let $s=[x',\gamma']\in\mathfrak E(\mathfrak d)$ with $\iota$ as in the definition. Then $\iota\otimes\Q$ embeds $\mathcal E$ in $\mathrm{End}(W)$, compatibly with $\psi$-adjoints, and commutes with $h_{x'}$. Let $M_\iota:=Z_G(\iota(\mathcal E))$, the group of $\iota(\mathcal E)$-linear symplectic similitudes, which is connected and reductive (\cite[Prop.~8.7]{Milne}, on each factor of $\mathcal E$) and contains $h_{x'}(\mathbb S)$. The image $S_{\iota,s}$ of the component of $M_\iota(\R)h_{x'}$ through $x'$, times $\{\gamma'\}$, is special as in (a), contains $s$, and lies in $\mathfrak E(\mathfrak d)$, since the lattice and $\iota(R)$ do not change along it and $\tau$ is locally constant. Its dimension is that of the symmetric space of $M_{\iota,\R}$, which is determined by $\mathfrak d$: the $\psi$-orthogonal decomposition $W_\R=\bigoplus_vW_v$ over the places of the factors of $\mathcal E$ gives a Siegel space of dimension $r(r+1)/2$ for a real place of a totally real factor, with $2r=\dim_\R W_v$, and a unitary symmetric space of dimension $a_v(m_v-a_v)$ for a place $v$ of $F_i^+$ with $F_i$ CM, with $m_v:=\dim_\C W_v$; call the sum $\dim\mathfrak d$. Now $\mathfrak E(\mathfrak d)$ is constructible (\cref{lem:PELcomp}; here $N_0=M_\Upsilon\otimes\Qbar$ by \cref{lem:Kdelta}(ii) and \cref{lem:N0}(iii)) and is the union of the countably many $S_{\iota,s}$. Let $C$ be an irreducible component of its Zariski closure. Then $\mathfrak E(\mathfrak d)\cap C$ contains a dense open subset of $C$, which is a countable union of the closed sets $S_{\iota,s}\cap C$; by Baire's theorem one of them has interior, so $C\subset S_{\iota,s}\subset\mathfrak E(\mathfrak d)$ and $C=S_{\iota,s}$. So $\mathfrak E(\mathfrak d)$ is closed and its components have dimension $\dim\mathfrak d$. Finally $S_V=S_{\iota_V,x}$ for the inclusion $\iota_V$ of $R_V$, so $S_V$ is irreducible of dimension $\dim\mathfrak d_V$ in $\mathfrak E(\mathfrak d_V)$, and the component containing it is $S_V$. (c) $\widetilde S_V=\Gamma_{H'}\backslash X_{H'}^+$ with $\Gamma_{H'}:=\{q\in H'(\Q):qX_{H'}^+=X_{H'}^+\}\cap\gamma K_\Upsilon\gamma^{-1}$, which is neat by \cref{lem:Kdelta}(iii); so $\widetilde S_V$ is smooth. The map $\nu$ is finite, and it is injective on the Hodge generic locus by \cite[Lemma~2.2]{UY}. That lemma assumes $Z(G)(\R)$ compact; its proof uses this only to show that $N_G(H')/H'$ has compact real points, from the compactness of the stabilizer of a point of $X$ in $G(\R)$. For $G=\mathrm{GSp}$ this stabilizer is compact modulo $Z(G)(\R)=\R^\times$, and $Z(G)\subset H'$, so $N_G(H')/H'$ still has compact real points. Ullmo and Yafaev assume $K$ neat; here we use instead that two Hodge generic points of $X_{H'}^+$ with the same image in $S$ differ by some $q\in N_G(H')(\Q)\cap G(\Q)_+\cap\gamma K_\Upsilon\gamma^{-1}$; as $\nu(q)\in\Q_{>0}\cap\Zhat^\times=\{1\}$, $q$ lies in $N_G(H')(\Af)\cap\gamma K(d_\Upsilon)\gamma^{-1}$ (\cref{lem:Kdelta}(i)), a compact neat group, whose image $K''$ in $Q(\Af)$, $Q:=N_G(H')/H'$, is compact and neat \cite[0.6]{Pink}; so the image of $q$ lies in $Q(\Q)\cap K''$, which is neat \cite[0.6]{Pink} and discrete in the compact $Q(\R)$, hence finite and trivial, so $q\in H'(\Q)\cap\gamma K_\Upsilon\gamma^{-1}$ preserves $X_{H'}^+$ and the two points agree in $\widetilde S_V$. A finite morphism from a normal variety that has degree $1$ onto its image is the normalization. The same argument for $(H,X_H)\subset(G,X)$ shows that the image of $X_H^+\times\{\gamma\}$ in $S$ is reached generically injectively; as that map factors through $W_V\to V$, $\nu|_{W_V}$ is birational. $W_V$ is special in $\widetilde S_V$, defined by $(H,X_H)\subset(H',X_{H'})$. (d) Suppose that $Y$ is weakly special in $\widetilde S_V$ with $W_V\subsetneq Y$ and $H_{W_V}$ normal in $H_Y$. For a special subvariety defined by $(H,X_H)$ of a quotient $\Gamma\backslash X$ with $\Gamma$ neat and the variation of a faithful representation, the algebraic monodromy group is $H^\der$ (proof of \cite[Cor.~6.2]{Urbanik}); so $H_{W_V}=H^\der$. Algebraic monodromy groups are semisimple (proof of \cite[Lemma~4.29]{Urbanik}), so $H_Y=H^\der H''$ with $H''$ the product of the other $\Q$-simple factors, which commutes with $H^\der$. As $H_Y$ is normal in $\mathrm{MT}(Y)\subset H'$, $H''\subset Z_{H'}(H^\der)$, which also centralizes $T\subset Z(H')$, hence centralizes $H=T\cdot H^\der$ and $h_x(\mathbb S)$ for $x\in X_H$. Being semisimple, $H''\subset\mathrm{Sp}(W,\psi)$; it fixes $h_x(i)$, so $H''(\R)$ preserves the positive definite form $\psi(\cdot,h_x(i)\cdot)$ and is compact. By \cite[Lemma~4.11]{Urbanik} an algebraic monodromy group has no $\Q$-simple factor with compact real points, so $H''=1$ and $H_Y=H_{W_V}$. Then $Y\supsetneq W_V$ has the algebraic monodromy group of the weakly special $W_V$, which contradicts the maximality in the definition. So $W_V$ is rigid. (e) $\widetilde S_V$ is smooth and $\nu^*\mathbb V$ is a polarizable integral variation, so \cite[Thm.~6.1(ii), Cor.~6.3]{Urbanik} apply, and $[W_V]$ is in the output by (d). The projection formula and (c) give $\deg_{\nu^*\mathcal O(1)}\overline W_V=\deg_{\mathcal O(1)}\overline V$. \end{proof} A special point $Q$ has $S_Q=\{Q\}$: $h_x$ factors through $T\subset Z(M)$, so $M(\R)h_x=\{h_x\}$. For the curve $\{x\}\times Y(1)\subset\mathcal A_2$ above, with $x$ a CM point with CM by $k$, $\mathcal E=k\times\Q$ and $M=H$, so $S_V=V$; the curve is its own container and is rigid there. \subsection{Degrees in Mumford's coordinates}\label{sec:theta-degree} Urbanik's degrees are taken for $\mathcal O(1)$ on the closure in $\PP(V_\Upsilon)$, ours for the Baily--Borel bundle. Theta constants have weight $1/2$, so the first is the smaller. \begin{lemma}\label{lem:Theta} Let $g\ge2$, $\varphi\colon S\to\PP(V_\Upsilon)$ the theta-null immersion and $\Lb:=\Lb_{K_\Upsilon}$. For every closed irreducible $Y\subset S$ of dimension $r$, with closure $\overline Y$ in $\PP(V_\Upsilon)$, \[ \deg_{\mathcal O(1)}\overline Y\le\deg_{\Lb}Y/(2(g+1))^r\le\deg_{\Lb}Y. \] \end{lemma} \begin{proof} Let $\omega$ be the determinant of the Hodge bundle on $S$ and $N_\Upsilon:=d_\Upsilon^g$, the rank of the push-forward $p_*L$ of the marking sheaf along the universal family $p$. Mumford shows that $p_*L\cong V_\Upsilon\otimes\mathcal K$ for the invertible sheaf $\mathcal K:=\varphi^*\mathcal O(-1)$ \cite[pp.~80--82]{MumfordII}, so $\det p_*L\cong\mathcal K^{\otimes N_\Upsilon}$. For a relatively ample symmetric line bundle trivialized along the zero section, with $p_*$ of rank $N_\Upsilon$, Faltings and Chai prove $8N_\Upsilon^3\det(p_*L)=-4N_\Upsilon^4\,\omega$ in $\mathrm{Pic}(S)$ \cite[Thm.~I.5.1]{FaltingsChai}, as stated in \cite[Introduction]{Polishchuk}; Mumford's $L$ is totally symmetric, relatively ample and normalized. Hence $\varphi^*\mathcal O(1)^{\otimes8N_\Upsilon^4}\cong\omega^{\otimes4N_\Upsilon^4}$. Also $\Lb|_S=\omega^{\otimes(g+1)}$ \cite[\S II.1]{HulekSankaran}, and as $g\ge2$ the boundary of the Baily--Borel compactification $S^\BB$ has codimension at least $2$, $S^\BB$ is normal and $\Lb$ is a line bundle on it (\cref{lem:Kdelta}(iii), \cite[Prop.~3.4(b)]{Mumford77}), so sections of its powers over $S$ extend to $S^\BB$. Put $e:=4N_\Upsilon^4$. Monomials of degree $2e(g+1)$ in the coordinates of $\PP(V_\Upsilon)$ are therefore sections of $\Lb^{\otimes e}$ over $S^\BB$, and $v\circ\varphi$, with $v$ the Veronese map of degree $2e(g+1)$, is the rational map of $S^\BB$ given by a linear subsystem of $|\Lb^{\otimes e}|$. Let $\overline Y{}^\BB$ be the closure of $Y$ in $S^\BB$ and $\varpi\colon\widetilde Y\to\overline Y{}^\BB$ a resolution of the base locus, with $\varpi^*\Lb^{\otimes e}=\mathcal M'+F'$, $\mathcal M'$ base-point free and $F'$ effective. As $\varpi^*\Lb^{\otimes e}$ is nef, $(\varpi^*\Lb^{\otimes e})^r-\mathcal M'^r=\sum_{j4c_s$, then every $\sigma\in\Gamma(N)$ with $\sigma X'\cap X'\ne\emptyset$ lies in $G'(\Q)$. In particular, for every subgroup $\Gamma\subset\Gamma(N)$ and every connected component $X'^+$ of $X'$, the map $(\Gamma\cap G'(\Q)_+)\backslash X'^+\to\Gamma\backslash X$ is injective. \end{lemma} Such tensors exist: by Chevalley's theorem, as in the proof of \cite[Prop.~2.1]{Milne}, $G'$ is the stabilizer in $\mathrm{GL}(W)$ of finitely many tensors in spaces $W^{\otimes a}\otimes(W^\vee)^{\otimes b}$; as $G'$ contains the scalars, which act there by $\lambda^{a-b}$, only $a=b$ occurs, and we scale the tensors to be integral. \begin{proof} Let $\mathrm{GL}(W)$ act on $W^\vee$ by $\phi\mapsto\phi\circ g^{-1}$. As $\psi$ is perfect on $W_\Z$, so is $\psi^\vee$ on $W_\Z^\vee$, and $\psi_m$ is integral on $T_m(\Z)$; it is symmetric, as a product of $2m$ alternating forms. If $\psi(gv,gw)=\nu(g)\psi(v,w)$, then $g\cdot\psi(v,\cdot)=\nu(g)^{-1}\psi(gv,\cdot)$, so $\psi^\vee(g\phi,g\chi)=\nu(g)^{-1}\psi^\vee(\phi,\chi)$ and $\psi_m$ is $G$-invariant. For $h\in X$ let $J:=h(i)$. The form $b_J(v,w):=\psi(v,Jw)$ is symmetric and definite on $W_\R$, and since $J\cdot\psi(w,\cdot)=\psi(Jw,\cdot)$, the form $(\phi,\chi)\mapsto\psi^\vee(\phi,J\chi)$ is $b_J$ transported to $W^\vee_\R$, with the same sign. So $B_J(a,b):=\psi_m(a,Jb)$ is a tensor product of $2m$ definite forms of one sign, hence positive definite on $T_m\otimes\R$. If $s\in T_m$ is fixed by $h(\mathbb S)$, then $Js=s$ and $B_J(s,s)=\psi_m(s,s)$. Let $\sigma\in\Gamma(N)$ and $x,y\in X'$ with $h_y=\sigma h_x\sigma^{-1}$. Each $s_i$ is fixed by $h_x(\mathbb S)$ and by $h_y(\mathbb S)$, which lie in $G'_\R$, so $\sigma^{-1}s_i$ is fixed by $h_x(\mathbb S)$. As $\sigma^{\pm1}\equiv1$ modulo $N$ on $W_\Z$ and on $W^\vee_\Z$, $t:=\sigma^{-1}s_i-s_i=Nu$ with $u\in T_{m_i}(\Z)$, and $u$ is fixed by $J:=h_x(i)$. So $\psi_{m_i}(u,u)=B_J(u,u)$ is a non-negative integer, zero only if $u=0$, and by the triangle inequality for $B_J$ and the invariance of $\psi_{m_i}$, \[ N^2\psi_{m_i}(u,u)=B_J(t,t)\le\bigl(B_J(\sigma^{-1}s_i,\sigma^{-1}s_i)^{1/2}+B_J(s_i,s_i)^{1/2}\bigr)^2=4\psi_{m_i}(s_i,s_i)4c_s$ (so $N_I\ge3$), and put $d_0:=N_Id_1$. Let $8d_0\mid d_\Upsilon$. An element of $\Gamma'_+$ preserves $X'^+\subset\mathcal H_g$, so its multiplier lies in $\Q_{>0}\cap\Zhat^\times=\{1\}$, and by \cref{lem:Kdelta}(i),(ii) it lies in $\mathrm{Sp}_{2g}(\Z)\cap K_\Upsilon=\Gamma_\Upsilon\subset\Gamma(d_\Upsilon)$. So $\Gamma'_+=\Gamma_\Upsilon\cap G'(\Q)_+\subset K(d_1)$, and the image of $\Gamma'_+$ lies in $\Gamma''$; both groups are arithmetic \cite[Prop.~3.2]{Milne}, so the index is finite. \emph{(i).} As $\Gamma_\Upsilon\subset\Gamma(d_\Upsilon)$ and $d_\Upsilon\ge N_I$, \cref{lem:injtensor} shows that $\iota$ is injective on $\C$-points, and by \cref{lem:hodgeimage}(i) it is finite and unramified. Write $Y_1:=\Gamma'_+\backslash X'^+$. The diagonal $Y_1\to Y_1\times_SY_1$ is an open immersion \cite[17.4.2]{EGAIV4}, and a closed one, as $\iota$ is separated; so the complement of its image is open and closed in $Y_1\times_SY_1$, a scheme of finite type over $\C$. A $\C$-point of that complement would be a pair $(x_1,x_2)$ of $\C$-points of $Y_1$ with $x_1\ne x_2$ and $\iota(x_1)=\iota(x_2)$; there is none, and a non-empty scheme of finite type over $\C$ has a $\C$-point, so the complement is empty and the diagonal is an isomorphism. Hence $\iota$ is a monomorphism \cite[Tag~01L3]{Stacks}, and, being proper, a closed immersion \cite[18.12.6]{EGAIV4}. Its image is the image of $X'^+\times\{1\}$, an irreducible component of the image of $\Sh_{K_\Upsilon\cap G'(\Af)}(G',X')$ by \cref{lem:hodgeimage}(ii). \emph{(ii).} The image of $\Gamma'_+$ has finite index in $\Gamma''$, and both groups are neat (\cref{lem:Kdelta}(iii) and \cite[0.6]{Pink}), so $\Gamma'_+\backslash X''^+\to\Gamma''\backslash X''^+$ is a finite étale covering, algebraic as in \cite[2.1.2]{Deligne79}; composed with the inverse of the isomorphism in (i), it is $\pi$. \end{proof} \subsection{The algorithm}\label{sec:algorithm} Let $g\ge2$ and let $Z\subset M_\Upsilon\otimes\Qbar$ be closed and geometrically irreducible, given by equations over a number field. Let $c_{\deg}$, $D_1$, $A_1$ be numbers, with $A_1\ge1$, such that every special subvariety $V$ maximal in $Z$ has $\deg_{\Lb_{K_\Upsilon}}V\le c_{\deg}$, $d_{L_V}\le D_1$ and $\alpha_V\le A_1$, with $\alpha_V$ at the level $\lambda(K_\Upsilon)$, and let $\bar B_0\in(0,\bar B]$, where $\bar B$ is the constant $B$ of \cref{tab:constants} for the adjoint datum with which $\alpha_V$ is formed (\cref{sec:orders}). By \cref{lem:TR}, \cref{thm:AgK}(a) at $N=2d_\Upsilon$ supplies such numbers: $c_{\deg}$ with no hypothesis, and $D_1$, $A_1$ under the zero-free half-plane that it assumes for the fields $L_V$, which holds for every number field by Cureton and Thorner's preprint \cite{CuretonThorner} and its formal proof \cite{CTLean} (\cref{cor:unconditional}). The same computation gives $\bar B_0$: those constants depend on $\bar B$ through $B'=\bar Bc_U$, and one may take $\bar B_0:=\bar B=(A\,a!)^{-r_U}$, with $a=|\mathrm{GL}_{g(2g+1)}(\F_3)|$ (\cref{sec:general}), $r_U=2g$ (for a torus $T$ of dimension $t\le g$, every finite quotient of the maximal compact subgroup of $T(\Q_p)$ has at most $2t$ generators) and $A$ the integer of \cite[Prop.~2.9]{UY}, which its proof bounds effectively in terms of $g$ \cite[Lemmas~2.4--2.8]{UY}; upper bounds for $A$, $r_U$ and $a$ give a valid $\bar B_0$. \needspace{8\baselineskip} \begin{algorithm}[Listing]\label{alg:listing} Input: Mumford's equations for $\overline M_\Upsilon$ and $\overline{\mathcal A}_\Upsilon$, equations for $Z$, and $(c_{\deg},D_1,A_1,\bar B_0)$. \begin{enumerate}[label=\textup{(\arabic*)},start=0] \item \emph{Base.} Compute $N_0$ (\cref{lem:N0}(iv)). \item \emph{Data.} Enumerate the PEL data $\mathfrak d=(\mathcal E,R,\tau)$ with $\mathcal E=\prod_iF_i$, $\sum_i[F_i:\Q]\le2g$, $|d_{F_i}|\le D_1$, and $[\mathcal O_{\mathcal E}:R]\le B_{\mathcal O}$, where $B_{\mathcal O}$ is the bound of \cref{lem:Oprime}(d) with $n_{\mathcal E}=2g$, $N=2d_\Upsilon$, $m_V=\mathrm{lcm}(1,\dots,2g)$, $D_1$ and $A_1$, with $\bar B_0$ in place of $\bar B$ in $A_1'$. (Fields: by Minkowski's second theorem a field $F$ of degree at most $2g$ has $\Q$-independent integers $v_k$ of house at most $|d_F|^{1/2}$; as $F$ has at most $s(2g)$ proper subfields, with $s(2g)$ the number of subgroups of the symmetric group $\mathfrak S_{2g}$, some $\theta=\sum_kc_kv_k$ with $0\le c_k\le s(2g)$ generates $F$, and the coefficients of its minimal polynomial are at most $\binom{2g}{j}(2g\,s(2g)D_1^{1/2})^j$. Orders: an order of index $b$ contains $\Z+b\mathcal O_{\mathcal E}$, as $\mathcal O_{\mathcal E}/R$ has exponent dividing $b$, so the orders of index at most $B_{\mathcal O}$ are among the finitely many subgroups between $\Z+b\mathcal O_{\mathcal E}$ and $\mathcal O_{\mathcal E}$, $b\le B_{\mathcal O}$; keep those that are rings stable under $*$. Types: finitely many for each $\mathcal E$.) \item \emph{Containers.} For each $\mathfrak d$, compute $\mathfrak E(\mathfrak d)\cap N_0$ (\cref{lem:PELcomp}), which is closed in $N_0$ (\cref{lem:P}(b)), and its irreducible components $S'$ (primary decomposition). \item \emph{Rigid members.} For each $S'$ with $S'\cap Z\ne\emptyset$: compute the normalization $\nu\colon\widetilde S'\to\overline S{}'$ of the closure of $S'$ in $\PP(V_\Upsilon)$ and its embedding by $\nu^*\mathcal O(h)$ (\cref{lem:V}), and restrict to $\nu^{-1}(S')$; pull back the universal family and compute the data of the variation $H^1$ \cite[Thm.~2.4]{Urbanik}; run \cite[Cor.~6.3]{Urbanik} on $\nu^{-1}(S')$ with degree bound $d':=h^{\dim S'}c_{\deg}$; for each output $Y$, keep it if $\nu(Y)\subset Z$ (ideal membership) and $Y$ is rigid (\cref{lem:Rprime}, with $\mathfrak h_Y$ from \cref{prop:T3}, and $\mathfrak h_Y=0$ if $\dim Y=0$, with $\mathfrak h_{\widetilde S}$ and $F^\bullet$ at the point $Y$ computed as in the proof of \cref{prop:T3}, which does not use $\dim Y\ge1$ there), and put $\nu(Y)$ on the list. \item \emph{Maximality.} Delete every member of the list that is strictly contained in another member. \end{enumerate} \end{algorithm} \begin{theorem}\label{thm:listing} \begin{enumerate}[(a)] \item \Cref{alg:listing} terminates, and its output is exactly the set of special subvarieties of $S$ maximal among the special subvarieties contained in $Z$. \item Let $(G',X')\hookrightarrow(\mathrm{GSp}_{2g},\mathcal H_g^\pm)$ be a Shimura datum of Hodge type, $K_{G'}:=K_\Upsilon\cap G'(\Af)$, and suppose $Z$ lies in the image of $\Sh_{K_{G'}}(G',X')$ in $S$. Then the output of \cref{alg:listing} is exactly the set of special subvarieties of $\Sh_{K_{G'}}(G',X')$ (through their images) maximal in $Z$. \item Let $(G'',X'')$ be a Shimura datum of abelian type, in the sense of \cref{prop:realize}, and $S^0$ a connected component of a Shimura variety attached to it. Suppose that $G'^\ad=G''^\ad$ and $X'^+=X''^+$ for a connected component $X'^+$ of $X'$, and that the quotient map $X''^+\to S^0$ factors as $X'^+\to S_1^0\xrightarrow{\pi}S^0$ with $\pi$ finite, where $S_1^0\subset S$ is the image of $X'^+\times\{\gamma\}$ for some $\gamma\in G'(\Af)$ and the first map is $x\mapsto[x,\gamma]$. Let $Z\subset S^0$ be closed and irreducible, given by equations for $\widetilde Z:=\pi^{-1}(Z)\subset S$, and suppose that every special subvariety $V$ maximal in a component of $\widetilde Z$ has $\deg_{\Lb_{K_\Upsilon}}V\le c_{\deg}$, $d_{L_V}\le D_1$ and $\alpha_V\le A_1$, with $\alpha_V$ at the level $\lambda(K_\Upsilon)$. Then running \cref{alg:listing} with $(c_{\deg},D_1,A_1,\bar B_0)$ on each component of $\widetilde Z$, and step~(4) on the union of the outputs, gives a finite list in $S_1^0$ whose images in $S^0$ are exactly the special subvarieties maximal in $Z$. \end{enumerate} \end{theorem} \Cref{thm:list} is part~(a). By \cref{prop:realize}, the data of (c) exist for every connected component $S^0$ of a Shimura variety of abelian type at a neat level, with $\pi$ finite étale. The map $\pi$ need not be a Galois covering, and (c) does not need it to be. We do not show that $(G',X')$, $S_1^0$, $\pi$ or $\pi^{-1}(Z)$ can be computed from the data defining $S^0$: unless $(G',X')$ is of PEL type, $S_1^0$ is not cut out by the moduli problems that \cref{alg:listing} uses, and we have no model of $S^0$ itself. This is why (c) takes $Z$ through equations for its preimage. A model of $S^0$ would need the action on Mumford's model of the elements of $G''^\ad(\Q)^+$ that do not lift to the Hodge-type group; these are not Hecke operators of the Hodge-type datum, and the moduli interpretation does not give them. \begin{proof} (a) \emph{Every member put on the list is special and lies in $Z$.} An output $Y$ of step~(3) is weakly special and rigid, hence special by \cref{lem:Rprime}, which applies to $\nu^{-1}(S')$ by \cref{lem:P}(c); $\nu$ is induced by a morphism of Shimura data, so $\nu(Y)$ is special; and $\nu(Y)\subset Z$ is tested exactly. \emph{Every maximal $V$ is put on the list.} By \cref{lem:Oprime}(a),(d), applied with $N=2d_\Upsilon$ (as $K(2d_\Upsilon)\subset K_\Upsilon$, \cref{lem:Kdelta}) and $m_V\le\mathrm{lcm}(1,\dots,2g)$, with $\bar B_0$ in place of $\bar B$ in $A_1'$ (as at the end of the proof of \cref{lem:Oprime}), the bound being increasing in $n_{\mathcal E}$ and $m_V$, the datum $\mathfrak d_V$ is enumerated in step~(1). By \cref{lem:P}(b), $S_V$ is a component of $\mathfrak E(\mathfrak d_V)$; it meets $Z$, and it lies in $N_0$, which is all of $M_\Upsilon\otimes\Qbar$ by \cref{lem:N0}(iii) and \cref{lem:Kdelta}(ii), so it is found in step~(2). By \cref{lem:P}(c), the part of the normalization of $\overline S_V$ over $S_V$ is $\widetilde S_V$, and by \cref{lem:P}(d) $W_V$ is rigid in it. By \cref{lem:P}(e), \cref{lem:V}(f) and \cref{lem:Theta}, \[ \deg_{\nu^*\mathcal O(h)}\overline W_V=h^{\dim V}\deg_{\mathcal O(1)}\overline V\le h^{\dim S_V}\deg_{\Lb_{K_\Upsilon}}V\le h^{\dim S_V}c_{\deg}, \] so $[W_V]$ is among the outputs of \cite[Cor.~6.3]{Urbanik}. Then $\nu(W_V)=V\subset Z$, and $W_V$ passes the rigidity test, because \cref{prop:T3} returns the true $\mathfrak h_{W_V}$ (\cref{lem:G}(c)). So $V$ is put on the list. \emph{Termination.} Step~(0) is \cref{lem:N0}(iv); step~(1) is finite by \cref{lem:Oprime}(d); step~(2) is \cref{lem:PELcomp} with primary decomposition; step~(3) uses \cite[Algorithm~3]{GLS}, \cref{lem:V}, \cite[Thm.~2.4 and Cor.~6.3]{Urbanik}, whose output is finite, ideal membership, and \cref{lem:Rprime} with \cref{prop:T3}, which terminates; step~(4) is finite. \emph{Step~(4).} A listed $V$ that is maximal in $Z$ is not strictly contained in another member, since members are special and lie in $Z$. A member that is not maximal lies in a maximal $V'\subset Z$, which is listed, so it is deleted. (b) Images of special subvarieties of $\Sh_{K_{G'}}(G',X')$ are special in $S$. Conversely, if $V\subset S$ is special and lies in the image, its generic Mumford--Tate group is conjugate into $G'$, since the Mumford--Tate groups of the points of $X'$ lie in $G'$, so $V$ is the image of a special subvariety of $\Sh_{K_{G'}}(G',X')$ \cite[Lemma~2.1]{UY}. So the two notions of maximal special subvariety of $Z$ agree, and (a) applies. (c) By \cref{lem:hodgeimage}, $S_1^0$ is closed in $S$ and is an irreducible component of the image in (b). The special subvarieties of $S_1^0$ and of $S^0$ are the images of the subsets $X_H^+\subset X''^+$ attached to Shimura subdata, and these subsets depend only on the adjoint datum. So $\pi$ maps special subvarieties onto special subvarieties. Write $S^0=\Gamma\backslash X''^+$ with $\Gamma\subset G''^\ad(\Q)^+$. If $V_1\subset S_1^0$ is special, the image of $X_H^+$, then, as $X''^+\to S_1^0$ is onto and its composite with $\pi$ is the quotient map, $\pi^{-1}(\pi(V_1))$ is the union of the images in $S_1^0$ of the $\epsilon X_H^+$, $\epsilon\in\Gamma$. Each $\epsilon\in\Gamma$ acts on $G'$ by an automorphism $\mathrm{Int}(\epsilon)$ defined over $\Q$, through $G'^\ad=G''^\ad$, and is the image of an element of $G'(\R)_+$ \cite[Prop.~5.1]{Milne}; so $(\mathrm{Int}(\epsilon)H,\mathrm{Int}(\epsilon)\circ X_H)$ is a Shimura subdatum of $(G',X')$, $\epsilon X_H^+\subset X'^+$ is a connected component of $\mathrm{Int}(\epsilon)\circ X_H$, and its image in $S_1^0$ is special, irreducible, of dimension $\dim V_1$, and closed (\cref{lem:hodgeimage}(ii)). As $\pi$ is finite, $\pi^{-1}(\pi(V_1))$ is closed of dimension $\dim V_1$, so each of its finitely many irreducible components is one of these images. So every component of the preimage of a special subvariety of $S^0$ is special. By \cref{lem:specialin}, a special subvariety of $S$ contained in $S_1^0$ is a special subvariety of $S_1^0$, the image of $X_M^+\times\{\gamma\}$ for a Shimura subdatum $(M,X_M)$ of $(G',X')$ with $X_M^+\subset X'^+$, and the converse is clear; so the special subvarieties of $\widetilde Z$ are the same in $S$ and in $S_1^0$, and (a) may be applied to the components of $\widetilde Z$. Every special subvariety of $\widetilde Z$ is irreducible, so lies in a component, and the maximal special subvarieties of $\widetilde Z$ are the maximal members of the union of the lists given by (a) for the components; step~(4) on the union uses only containment in $S$. If $V_1$ is maximal in $\widetilde Z$ and $\pi(V_1)\subsetneq V'\subset Z$ with $V'$ special, a component of $\pi^{-1}(V')$ through $V_1$ is special, lies in $\widetilde Z$ and is larger than $V_1$; so $\pi(V_1)$ is maximal in $Z$. Conversely, if $V$ is maximal in $Z$, a component $V_1$ of $\pi^{-1}(V)$ is special and lies in $\widetilde Z$, and it is maximal there, since the image of a larger special subvariety of $\widetilde Z$ would be a special subvariety of $Z$ of larger dimension. So the images of the maximal special subvarieties of $\widetilde Z$ are exactly the maximal special subvarieties of $Z$. \end{proof} For a special point $Q$, $S_Q=\{Q\}$, and step~(3) reduces to testing $Q\in Z$. \section*{Declarations}\phantomsection\label{sec:declarations} \subsection*{Use of AI} This paper and its results were produced by an AI research system that the author designed, built and directs, running on Anthropic's Claude Fable~5.2 in Claude Code. The author chooses the problems and prioritizes the work. Separate AI agents checked each result, and a second program confirmed the computations the proofs use, with any exceptions listed in the public deposit. The system also searched the literature and checked the citations against reliable sources. The author read the paper, reran the computations from the deposit and takes full responsibility for all of the paper's contents. \subsection*{Data availability} The programs and data used in this paper, with instructions for rerunning them, are deposited at Zenodo~\cite{Record}. \bibliographystyle{amsplain} \bibliography{refs} \end{document}