Effective computations for weakly optimal subvarieties

Ren and the second author established that the weakly optimal subvarieties (e.g. maximal weakly special subvarieties) of a subvariety $V$ of a Shimura variety arise in finitely many families. In this article, we refine this theorem by (1) constructing a finite collection of algebraic families whose fibers are precisely the weakly optimal subvarieties of $V$; (2) obtaining effective degree bounds on the weakly optimal locus and its individual members; (3) describing an effective procedure to determine the weakly optimal locus.

This article is concerned with effective results on the (geometric side of the) Zilber-Pink conjecture for (pure) Shimura varieties.The conjecture itself is as follows.
Conjecture 1 (Zilber-Pink).Let S be a Shimura variety and let V be a Hodge generic, irreducible, algebraic subvariety of S. Then the intersection of V with the union of the special subvarieties of S of codimension at least dim V + 1 is not Zariski dense in V .
By [2,Theorem 12.4], Conjecture 1 is equivalent to the seemingly stronger variations involving atypical intersections and optimal subvarieties, the latter of which states that V contains only finitely many optimal subvarieties.We state this version and the necessary definitions in Section 3.3.
In [9], Ren and the second author outline a Pila-Zannier strategy for proving Conjecture 1, applying the familiar combination of o-minimality, functional transcendence, and arithmetic (see, in particular, [15]).The unconditional aspect of that strategy is what might be considered the geometric Zilber-Pink conjecture for Shimura varieties.Gao [12] refers to its generalization to mixed Shimura varieties as a finiteness result à la Bogomolov.The statement is as follows.We refer to Section 3.4 for the relevant facts and definitions, recalling here only that an optimal subvariety is, in particular, a weakly optimal subvariety.Theorem 2 ([9], Proposition 6.3).Let S = Γ\X be a Shimura variety and let V be an irreducible algebraic subvariety of S.There exists a finite set Σ of pairs (X H , X 1 × X 2 ) with X H a pre-special subvariety of X and X H = X 1 × X 2 a Q-splitting of X H , such that, for any weakly optimal subvariety W of V , the weakly special closure of W in S is equal to the image in S of X 1 × {x 2 }, for some (X H , X 1 × X 2 ) ∈ Σ and some x 2 ∈ X 2 .
In this article, we give a refined version of this theorem (see Theorem 19).We summarize this refinement as follows.We denote by P the so-called standard principal bundle associated with S and, by Ω, a Chow variety parametrizing certain subvarieties of the compact dual X of X (see Sections 4.1, 5.1, and 6 for the details).Similarly, for a triple T = (X H , X 1 × X 2 ), as above, we denote by P T the standard principle bundle associated with a Shimura variety S T corresponding to X H and, by Ω T a Chow subvariety contained in Ω parametrizing certain subvarieties of XH .As such, we obtain algebraic morphisms where S 2 is a Shimura variety corresponding to X 2 , and, for a subset Π of P × Ω, we denote by Π T the union of the Zariski closures of the fibers of the map φ T restricted to π T (ι −1 P T (Π)).
Theorem 3. Let S be a Shimura variety and let V be an irreducible algebraic subvariety of S. For every d ∈ N, there exists a locally closed algebraic subset Π(d) of P × Ω and, for each of the irreducible components Π(d) • of Π(d), an associated triple T = (X H , X 1 × X 2 ) such that the following holds.T then the image in S of W is a weakly optimal subvariety of V of weakly special defect d.
In short, we show that the weakly optimal subvarieties of V are precisely the fibers of finitely many constructible families.
However, our construction allows us to go further, applying estimates from differential algebraic geometry to obtain effective upper bounds for the degrees of the families Π(d), as well as the individual weakly optimal subvarieties.Moreover, our construction also produces an effective description of this unlikely intersection locus, in the form of an explicit system of algebraic equations.
To formulate such a result explicitly, we fix a coordinate system on the set P ×Ω as follows.Let U ⊂ S denote an open dense subset such that P trivializes over U, i.e.P | U ≃ U × G(C).Fixing a faithful representation of G we may realize it as a subvariety of some affine space.We use (1) a very-ample power of the Baily-Borel line bundle for a set of projective coordinates on U, (2) the matrix entries as coordinates on G(C), and (3) the standard Chow coordinates on the Chow variety Ω.All degrees below on U × G(C) × Ω are taken with respect to the Segre product of these three coordinate systems.
If X is a locally-closed subset of U × G(C) × Ω then it is of the form Y \ Z where Y and Z are Zariski closed.We define the complexity of X to be deg(Y ) + deg(Z).We give a bound for the complexity of the sets Π(d), as well as a procedure for computing the equations and inequations defining Π(d), in terms of the equations defining V .The construction depends on certain data associated with S, namely, (1) the equations describing the projective embedding of U × G × Ω and (2) the equations describing the canonical connection ∇ on P (written in the chosen coordinate system on U × G(C)).Throughout the paper, with the exception of Section 9, our effective bounds are assumed to depend on this data (we simply say depending only on S).In the final Section 9, we address the issue of obtaining fully effective computations in the case S = A g using Gauss-Manin connections.
Theorem 4. The complexity of Π(d) is bounded by f S (deg(V )) for some polynomial f S depending only on S.Moreover, we produce an explicit system of equalities and inequations for Π(d) of degrees bounded by f S (deg(V )).
According to Theorem 3 the sets Π(d) provide a complete parametrization for all families of weakly optimal subvarieties of V of weakly special defect d.Theorem 4 therefore provides a method for explicitly computing these families and controlling their degrees.From this, we obtain degree bounds on individual weakly optimal subvarieties.Theorem 5. Let d ∈ N and let W be a weakly optimal subvariety of V of weakly special defect d.Then for some polynomial f S depending only on S.
1.1.Fully effective computation.Even though our main construction is effective, to carry out this procedure in practice one would need to obtain (1) an explicit system of equations for the projective embedding of S with respect to (some power of the) Baily-Borel line bundle; (2) an explicit description of the canonical connection ∇ with respect to a prescribed trivialization of the corresponding bundle P ; (3) an explicit system of equations for the subvariety V with respect to the projective embedding.
Computing the first two of these items for a given Shimura variety S appears to be a nontrivial task.Moreover, computing equations for some subvariety V of interest is by itself a non-trivial problem.For example, consider the case S = A g , the space of principally polarized abelian varieties, and V , the closure T g of the open Torelli locus T • g ⊂ A g .Computing the weakly special locus is a problem of significant interest due to its relation to the Coleman-Oort conjecture on the finiteness of the set of isomorphism classes of genus-g Jacobians with complex multiplication.We refer to [24] for an excellent survey and simply recall here that it is conjectured that for g ≫ 1 the set of positive-dimensional special subvarieties of T g intersecting T • g is empty.In combination with the André-Oort conjecture for A g (established by Tsimerman in [27]), this would imply the Coleman-Oort conjecture.Note, however, that computing a set of equations for V in this case is the famous Schottky problem, a subject of substantial independent study, still not fully resolved.
Fortunately, taking advantage of the functoriality of the canonical connections on Shimura varieties, we are able to alternatively carry out the computation for V ⊂ S described via a moduli interpretation instead of an explicit projective embedding.We focus our attention on the case S = A g .In light of the moduli interpretation of A g , it is natural to describe a subvariety V ⊂ A g as a family of genus-g principally polarized abelian varieties, or the Jacobians of a family of genus g curves.In this case, the computation of the canonical connection translates into the computation of the Gauss-Manin connection for the corresponding family.This is a classical problem and it is well known, going back to the work of Manin [19], that it can be carried our explicitly.
We will focus here on the case of families of Jacobians, which lends itself more readily to effective computation, as curves are relatively simple to describe using explicit equations.This is also the case required in principle to treat the Coleman-Oort conjecture and related problems on the Torelli locus.Our methods could in principle also be used to carry out explicit computations with more general constructions, such as Prym varieties, or even with general families of polarized abelian varieties presented by explicit equations.However, since it is far less common to present general abelian varieties in this way, we do not pursue this matter explicitly.
Let V denote an algebraic variety, which we assume for simplicity to be smooth.Let T → V denote a smooth curve over V , by which we mean that T is smooth and the map T → V is submersive.
To fit our general formalism, we should work with a neat subgroup Γ ⊂ GSp 2g (Z).We therefore denote by f : Ṽ → V an étale cover, T → Ṽ the base change of T by f , and choose f such that T is compatible with an N-level structure (say for N = 3).We denote by ι : Ṽ → A g,N the corresponding moduli map.Theorem 6.Given an explicit system of equations for (a projective embedding of ) the family T → V , one can explicitly construct an affine cover {V α ⊂ V }, such that for each V ′ = V α : ) for each d, one can explicitly construct a system of algebraic equations and inequations for sets Theorem 6 in principle provides an effective method for deciding the question of whether weakly special subvarieties exist within the open Torelli locus T • g for any given g.One first has to explicitly write down equations for a family T → V parametrizing all genus g curves.One then computes explicitly the equations for the defect-zero set ι * Π(0) corresponding to families of weakly special subvarieties contained in V .Finally, one may use effective commutative algebra methods (for instance, Gröbner basis algorithms) to determine whether the family is empty.
Remark 7. In the particular case of checking for the existence of weakly-special subvarieties, the smoothness assumption on V can be dropped.One can first effectively construct a smooth open dense subset V ′ ⊂ V and apply the preceding process to V ′ , and then proceed by induction on dimension with V \ V ′ .
One may apply a similar process to look for weakly special or weakly optimal subvarieties of other families of interest, for instance, the family of (Jacobians of) hyperelliptic curves of a given genus g.We stress that, to perform this computation using Theorem 4, one would need to obtain an explicit description of the hyperelliptic locus V ⊂ A g , which is a non-trivial problem.
1.2.Literature review.Effective results on the André-Oort and the Zilber-Pink conjectures are still relatively sparse.This work improves upon a previous work of the second author with Javanpeykar and Kühne [7] which, by entirely different methods, gave effective degree bounds for so-called non-facteur maximal special subvarieties.We refer to the introduction of the latter for references to several earlier works.More recently, the first author has obtained effective results on the André-Oort conjecture for products of modular curves [3] and, with Masser, for Hilbert modular varieties [4].Very recently, Pila and Scanlon have announced effective results for function field versions of the Zilber-Pink conjectures for varieties supporting a variation of Hodge structures, also using differential algebraic methods [25].

Generalities
2.1.Analytic and algebraic sets.For a complex analytic set X and x ∈ X, we write dim x X for the dimension of X at x, as defined in [13].We write dim X for the supremum of dim x X for all x ∈ X.We recall that, if X is irreducible, dim x X is constant on X.If X is (explicitly) an algebraic variety, then dim X will refer to its dimension as an algebraic variety.All algebraic subvarieties are assumed to be (Zariski) closed, unless stated otherwise.

2.2.
Degrees.If X is a complex algebraic variety and k ∈ N, we denote by A k X the group of k-cycles modulo rational equivalence on X (see [10,Section 1.3]).We define the degree deg(α) of α ∈ A k X as in [10,Definition 1.4].In particular, deg(α and L is a line bundle on X, we obtain, for any positive integer d ≤ k, a class [10,Definition 2.5]).If V is an irreducible subvariety of X, we define the degree deg L (V ) of V with respect to L to be the degree of where [V ] ∈ A dim V X denotes the class of the dim V -cycle given by V .If V is a (not necessarily irreducible) subvariety of X, we define the deg L (V ) to be the sum of the deg L (V i ), as V i varies over the irreducible components of V .

Algebraic groups.
For an algebraic group G, we denote by G • the connected component (in the Zariski topology) of G containing the identity, and we denote by the corresponding mathfrak letter g its Lie algebra.
We include connected in our definitions of reductive and semisimple algebraic groups.For a reductive algebraic group G, we denote by G ad the quotient of G by its center Z(G), and we denote by G der the derived subgroup of G.If G is defined over (a field containing) R, we denote the connected component (in the archimedean topology) G(R) + of G(R) containing the identity by the Roman letter G, retaining any superscripts or subscripts, and we write G(R) + for the inverse image of G ad under the natural map G(R) → G ad (R).We write If G is a reductive algebraic group over a field of characteristic zero, and H is a reductive algebraic subgroup of G, then we write N G (H) (resp.Z G (H)) for the normalizer (resp.the centralizer) of H in G.We recall that N G (H) • and Z G (H) • are both reductive.We have an almost direct product decomposition N G (H) 2.4.Arithmetic groups.Let G denote a reductive algebraic group over Q and, via a faithful representation, consider G as a subgroup of GL n , for some n ∈ N. The definitions that follow are independent of this representation and, hence, we can and do make use of them without reference to such a representation.
An arithmetic subgroup of G(Q) is any subgroup commensurable with G(Q) ∩ GL n (Z).An element of G(Q) is neat if the subgroup of Q generated by its eigenvalues (considering it as an element of GL n ( Q)) is torsion free.A subgroup of G(Q) is neat if all of its elements are neat.In particular, a neat subgroup is torsion free.
3. Shimura varieties and the Zilber-Pink conjecture 3.1.Shimura data.Let S denote the Deligne torus, that is, the Weil restriction from C to R of G m .By a Shimura datum, we refer to a pair (G, X), where G is a reductive algebraic group defined over Q and X is a G(R)-conjugacy class of morphisms S → G R such that the conditions SV1, SV2, and SV3 of [22, p50] hold.Furthermore, we impose the condition (SV0) G is the generic Mumford-Tate group on X.
Condition SV0 means that G is the smallest algebraic subgroup H of G defined over Q such that x(S) is contained in H R for all x ∈ X.We recall that X is naturally a disjoint union of hermitian symmetric domains.We refer the reader to [22] for more details regarding the theory of Shimura varieties.
In this article, in order to simplify technical issues, we will assume that our ambient Shimura datum (G, X) satisfies the condition that Z(G)(R) is compact.
3.2.Shimura varieties.Let (G, X) be a Shimura datum such that Z(G)(R) is compact and let X be a connected component of X.As in [8], we refer to the pair (G, X) as a Shimura datum component.Let Γ be an arithmetic subgroup of G(Q) contained G(Q) + .Then Γ acts on X and, by the theorem of Baily-Borel [1], the quotient S = Γ\X naturally possesses the structure of an irreducible quasi-projective complex algebraic variety.Indeed, by [1, Lemma 10.8], the line bundle of holomorphic forms of maximal degree on X descends to an ample line bundle L Γ on S. Note that, if Γ is neat, then S is non-singular (see [26,Facts 2.3]).We let k Γ denote the smallest integer such that L ⊗k Γ Γ is very ample.We will refer to the irreducible variety S as the Shimura variety associated with (G, X) and Γ.We will denote by π the natural complex analytic map X → S.

3.3.
Special subvarieties and the Zilber-Pink conjecture.Recall the situation described in Section 3.2.Let (H, X H ) denote a Shimura subdatum of (G, X) (in particular, H is the generic Mumford-Tate group on X H ), and let X H denote a connected component of X H contained in X.For any arithmetic subgroup Γ H of H(Q) contained in H(Q) + , we obtain a Shimura variety S H = Γ H \X H and, when Γ H is contained in Γ, the natural complex analytic map Γ H \X H → Γ\X is a finite (hence, closed) morphism of algebraic varieties (see [26,Facts 2.6]).We refer to the image of any such map as a special subvariety of S.
It is straightforward to show that the intersection of two special subvarieties is a finite union of special subvarieties.In particular, for any subvariety W of S, there exists a smallest special subvariety W of S containing W .In light of this, we define the defect δ(W ) of W by Now fix a subvariety V of S. We define an irreducible subvariety W of V to be optimal in V if, whenever W Y for some other irreducible subvariety Y of V , we have δ(W ) < δ(Y ).(In particular, V is an optimal subvariety of V itself.) Note that an optimal subvariety W of V such that δ(W ) = 0 is a maximal special subvariety of V .Observe also that an optimal subvariety W of V is necessarily an irreducible component of W ∩ V .
We denote by Opt(V ) the set of optimal subvarieties of V .The central problem in the area of unlikely intersections in Shimura varieties is (equivalent to) the following (see [9]).
Conjecture 8 (Zilber-Pink).Let V be a subvariety of a Shimura variety S. Then the set Opt(V ) is finite.

3.4.
Weakly special and weakly optimal subvarieties.Recall the situation described in Section 3.2.Let (H, X H ) denote a Shimura subdatum of (G, X) and let X H denote a connected component of X H contained in X.Then the image S H of X H in S is a special subvariety.Decompose H ad as a product H 1 × H 2 of two (permissibly trivial) normal Qsubgroups.In this way, we obtain a decomposition X H = X 1 × X 2 , and we will refer to a decomposition of this form as a Q-splitting.For any x 2 ∈ X 2 , the image S H,x 2 of X 1 × {x 2 } in S is a closed irreducible algebraic subvariety and we refer to any subvariety of this form as a weakly special subvariety of S. We remark that any special subvariety is weakly special, whereas S H,x 2 is special if and only if the Mumford-Tate group of x 2 is a torus (or, equivalently, if x 2 is a pre-special point of X 2 , to use another terminology).
It is straightforward to show that the intersection of two weakly special subvarieties is a finite union of weakly special subvarieties.In particular, for any subvariety W of S, there exists a smallest weakly special subvariety W ws of S containing W .In light of this, we define the weakly special defect δ ws (W ) of W by Now fix a subvariety V of S. We define an irreducible subvariety W of V to be weakly optimal in V if, whenever W Y for some other irreducible subvariety Y of V , we have δ ws (W ) < δ ws (Y ).(In particular, V is a weakly optimal subvariety of V itself.)Note that a weakly optimal subvariety W of V such that δ(W ) = 0 is a maximal weakly special subvariety of V .Observe also that a weakly optimal subvariety W of V is necessarily an irreducible component of W ws ∩ V .By [9, Corollary 4.5], any optimal subvariety of V is weakly optimal.Remark 9. Note that any point z ∈ S is a weakly special subvariety (according to our convention, at least).In particular, δ ws (z) = 0. Hence, z ∈ V is a weakly optimal subvariety of V if and only if it is not contained in a positive dimensional weakly special subvariety contained in V .In this way, we obtain an embedding of X into a G(C)-conjugacy class X co of cocharacters of G C satisfying ( * ).For each µ ∈ X co and r ∈ {1, 0, −1}, we define V r µ to be the character subspace of Lie(G C ) on which G m acts (according to the action obtained from µ) via the character z r .Then Lie(G C ) = ⊕ r V r µ , and we obtain a filtration F µ of Lie(G C ) by setting In this way, we obtain a G(C)-invariant surjective map µ → F µ from X co to a G(C)-orbit of filtrations X.Note that X is a complex projective flag variety known as the compact dual of X.The composite map X → X is a complex analytic G(R) + -invariant embedding, known as the Borel embeddding of X, and we identify X with its image, which is an open subset of X.In particular, dim X = dim X.We define a subvariety of X to be any irreducible analytic component of X ∩ Y for any algebraic subvariety Y of X.As noted in the paragraph following Theorem 5.4 of [9], this definition agrees with the definition therein.

4.2.
Pre-special and pre-weakly special subvarieties.Recall the situation described in Section 3.1 and let X be an irreducible component of X.
and we identify all objects with their images in X.
Lemma 10.We have X ∩ XH = X H .
Proof.By [14, VI.B.11], the intersection is contained in X ∩ X H . Therefore, let x 1 , x 2 ∈ X ∩ X H and let X i denote the H-orbit of x i in X (in other words, the connected component of X H containing x i ).Let K i denote the maximal compact subgroup of G stabilizing x i and let G = P i K i denote the corresponding Cartan decomposition.We also have Cartan decompositions Writing x 2 = αx 1 for some α ∈ G, we have K 2 = αK 1 α −1 and P 2 = αP 1 α −1 .Since Cartan decompositions are conjugate, we also have We set γ = h −1 α and write γ = pk for some p ∈ P 1 and some k ∈ K 1 .We deduce that Lemme 3.11], as in the proof of [29,Lemma 3.7], we deduce that p 2 centralizes H. Since H is Zariski dense in H R , it follows that p 2 ∈ Z G (H)(R).Therefore, since p 2 ∈ G, we conclude that p 2 ∈ K 1 and so p 2 is trivial.It follows that p is fixed by the Cartan involution associated with K 1 and so p = 1.We conclude that x 2 = hx 1 and so x 2 ∈ X 1 , which finishes the proof.
In particular, X H is a subvariety of X, and we call such a subvariety a pre-special subvariety.A similar discussion shows that, for a Q-splitting X H = X 1 ×X 2 as above and a point x 2 ∈ X 2 , the set X H,x 2 = X 1 × {x 2 } is again a subvariety of X (we define XH,x 2 analogously), and we refer to such a subvariety as a pre-weakly special subvariety of X.
Remark 11.It is an easy consequence of [29, Lemma 3.7] and the fact that G R possesses only finitely many G(R)-conjugacy classes of semisimple subgroups that the pre-weakly special subvarieties of X belong to finitely many G(R)-orbits.It follows that, for a given embedding of X into projective space, there exists a D ∈ N such that, for any pre-weakly special subvariety X H,x 2 of X, the degree of XH,x 2 is at most D.

Intersection components.
Recall the situation described in Section 3.2 and let V be an irreducible subvariety of S. We define an intersection component of π −1 (V ) to be an irreducible analytic component of the intersection of π −1 (V ) with a subvariety of X.For any intersection component A of π −1 (V ), there exists a smallest subvariety A Zar of X containing A (from which it follows that A is automatically an irreducible analytic component of A Zar ∩ π −1 (V )).In light of this, we define the Zariski defect δ Zar (A) of A by We say that A is Zariski optimal in π −1 (V ) if, whenever A B for some other intersection component B of π −1 (V ), we have δ Zar (A) < δ Zar (B).The weak hyperbolic Ax-Schanuel conjecture, which follows (see [9,Lemma 5.16]) from the hyperbolic Ax-Schanuel , proven by Mok-Pila-Tsimerman [23], is the following.

Standard principal bundles and canonical foliations
5.1.Standard principal bundles.Recall the situation described in Section 3.2 and suppose that Γ is neat.Since Z(G)(R) is compact, the stabilizer in G(R) of any point in X is compact.Therefore, since Γ is torsion free, it acts without fixed points on X.It follows that Γ is (isomorphic to) the fundamental group π 1 (S) of S and that is a principal complex analytic G(C)-bundle over S. (The action of Γ on X × G(C) is diagonal and on the left, and the action of G(C) is given by h , where we use [x, g] to denote the class of (x, g) ∈ X × G(C) in P .)Furthermore, there is a canonical flat connection ∇ on P .
Following convention, we refer to P = (P, ∇) as the standard principal bundle associated with (G, X) and Γ.By [21, Proposition 3.2], P is complex algebraic as a bundle over the algebraic variety S. We let π P : P → S denote the natural (complex algebraic) morphism [x, g] → π(x).
Note that there is also a natural G(C)-equivariant algebraic map β : P → X defined by We observe that the composite of β with the natural embedding X → P given by x → [x, 1] yields the Borel embedding of X into X.

5.2.
Trivializations.Recall the situation described in Section 5.1.Let p = [x, g] ∈ P and let U ⊂ X be an open neighbourhood of x such that Such a U exists by [20, Proposition 2.5] and the fact that Γ is torsion free.It follows immediately that π U : U → π(U) is biholomorphic and we obtain a (complex analytic) trivialization 5.3.Flat structures.Recall again the situation described in Section 5.1.Choose an open covering C of X, stable under translation by Γ and such that each point x ∈ X is contained in an arbitrarily small U ∈ C. We claim that we can choose C such that To see this, equip X with its usual metric d : X × X → R, and consider f : X × G(R) + → X × X defined by (x, g) → (x, gx).Recall that both d and f are proper maps.In particular, for a compact interval I ⊂ R, the preimage (d • f ) −1 (I) is a compact subset of X × G(R) + and, therefore, so too is the projection Θ to G(R) + .Since Γ is a discrete subgroup of G(R) + , we conclude that Γ ∩ Θ is finite.Therefore, since Γ acts freely on X, there exists C > 0 such that Therefore, in order to define C, choose around each point x ∈ X a system of arbitraily small relatively compact open neighbourhoods U such that and such that C is stable under translation by Γ.Now let U 1 , U 2 ∈ C and suppose that which is a contradiction, yielding the claim.
Note that condition (1) with U 2 = U 1 = U implies that we have trivializations We refer to a covering C of X satisfying the properties above as a flat structure for P .In particular, a flat structure C comes with an associated set {ϕ U } U ∈C of trivializations.Note that, if C and C ′ are both flat structures for P , then C ∩ C ′ (whose members are precisely those of the form U ∩ U ′ for U ∈ C and U ′ ∈ C ′ ) is also a flat structure for P .5.4.The canonical foliation.Recall again the situation described in Section 5.1.By [18, Section 1B], we obtain a canonical foliation F of P .For any p ∈ P , we can obtain the leaf L p of F through p as follows.Let C be a flat structure for P , write p = [x, g p ], and let U ∈ C be such that x ∈ U. Then In other words, L p is given locally by the images of the horizontal sections.
5.5.Intersection dimensions.Recall the situation described in Section 5.4 and, for a point p ∈ P , let L p denote the leaf of F through p.Let V denote an irreducible subvariety of S.
We will make repeated use of the following lemma.
Lemma 13.Let p ∈ P and let Y denote a subvariety of X such that p ∈ π −1 P (V ) ∩ β −1 (Y ).For any choice of representation p = [x, g p ], we have . Fix a flat structure C for P and consider U ∈ C such that x ∈ U. From Section 5.4, we have and, from the definitions, we have Finally, we claim that To see (4), first note that, In particular, Now, if π(gy) ∈ π(U), then gy ∈ γU, for some γ ∈ Γ.That is, γ −1 gy = π −1 U (π(gy)) and so which is an element belonging to the set on the right hand side of (4).On the other hand, if y ∈ Y , g ∈ G(C), and gy ∈ U, then [gy, g] ∈ β −1 (Y ) ∩ π −1 P (π(U)) maps to (π(gy), g).This establishes (4).
Combining (2), (3), and (4), we conclude that ) is equal to the set of tuples (π(g p y), g p ), where y ∈ Y is such that g p y ∈ U ∩ π −1 (V ).Therefore, applying π −1 U to the first factor, we obtain which proves the result.

The main construction
Recall the situation described in Section 5.5: , where S is the Shimura variety associated with (G, X) and Γ; V is an irreducible subvariety of S; P is the standard principal bundle associated with (G, X) and Γ; π : X → S and π P : P → S denote the natural maps; β : P → X denotes the map defined in Section 5.1; F denotes the canonical foliation of P (see Section 5.4); L p denotes the leaf of F through p ∈ P .
Fix an embedding of X into projective space and let D ∈ N be as in Remark 11.Let Ω(k) = Ω( X, k, D k+1 ) denote the (quasi-projective) Chow variety of closed irreducible complex subvarieties of X of codimension at most k and degree at most Here we slightly abuse notation by using Y to denote the Chow coordinate representing an irreducible variety as well as the variety itself.However, the correspondence between the Chow coordinate of Y and the points of Y is of course algebraic, and Θ is indeed Zariski closed.Note that there is a natural morphism Θ → S given by the projection to P composed with π P .
We define a function We define Π = Π(V ) to be the set of tuples (p, Y ) ∈ Θ for which Proof.Consider the foliation F 0 on P × Ω given by the direct product of (1) the canonical foliation of P and (2) the trivial foliation by zero-dimensional leafs on Ω.
Applying Proposition 20 to the sets Σ(Θ, F 0 , k) we conclude that the sets ( 7) are Zariski closed with degrees bounded by a polynomial as claimed, and that it is possible to effectively compute equations for these sets.(This is our principal ingredient from differential algebra, and we will apply this below to deduce the same result for the sets Π(d).)Let d ∈ N. Since Ω is a disjoint union of Chow varieties of different dimensions and degrees, it will be enough to consider each of these components separately.We now restrict to Ω ′ given by one of these Chow varieties, and assume that dim Y and deg(Y ) are fixed.
The set ∆(d) ⊂ P ×Ω ′ defined by condition ( 6) is given by A(dim Y −d)\A(dim Y −d+1).It is therefore locally closed.We claim further that the condition δ 1 (p, Y ) is open in ∆(d).
To see this, let Ω denote the projective closure of Ω and consider Here we write Y 1 * Y 2 to mean that Y 1 is strictly contained in each component of the support of Y 2 .This is a Zariski closed condition, and ∆ 1 is therefore closed for the same reason that A(k) is closed (with similar degree bounds, etc.).Since Ω is projective, the projection π Θ (∆ 1 ) is closed as well and the standard resultant constructions from elimination theory produce effective systems of equations for this set as well.By definition, in ∆(d) the condition δ 1 (p, Y ) essentially agrees with the complement of π Θ (∆ 1 ), except for a minor technicality: in δ 1 (p, Y ) we quantify over Y 2 in the open Chow variety Ω, whereas, in the definition of ∆ 1 we used the closed Ω.It is, however, easy to see that quantifying over Ω gives an equivalent condition.Indeed, the points of the closed Chow variety Ω represent effective cycles.If there exists then the same must be true for one of the irreducible components of the support of Y 2 (note that here it is crucial that we used the refined relation * ).To conclude, in ∆(d) the condition δ 1 (p, Y ) is given by the complement of π Θ (∆ 1 ), and is therefore locally closed with the stated degree bounds and explicit equations.
In an entirely analogous way, one checks that δ 2 (p, Y ) is open in ∆, and this concludes the proof of the local-closedness, as well as the degree bounds for Π(d).
The fact that G(C) preserves the Π(d) is immediate from the definitions.Considering the action as a morphism G(C) × P × Ω → P × Ω yields the remaining claims.
A is a Zariski optimal intersection component of π −1 (V ); (iii) writing X A for the pre-weakly special subvariety A Zar of X (see Theorem 12), we have Proof.We will imitate the proof of [9, Lemma 6.14].The fact that x ∈ g p Y ∩ π −1 (V ) follows from the definition of Π.Note also that by (5).Therefore, let A be as in (ii).By definition, A is an intersection component and A Zar is contained in g p Y .Therefore, since (p, Y ) ∈ Π(d), we have Let B be an intersection component of π −1 (V ) containing A such that δ Zar (B) ≤ δ Zar (A).We can and do assume that B is Zariski optimal and, therefore, by Theorem 12, B Zar is equal to a pre-weakly special subvariety X B of X.
Let Z be an irreducible component of g p Y ∩ XB containing A. Observe that, either Z = g p Y , Z = XB , or codim Z > codim g p Y .In all cases, the degree of Z in X is at most D codim Z+1 and so Z ∈ Ω.However, β(p) ∈ g −1 p Z ⊆ Y , and Therefore, since δ 2 (p, Y ) holds, we conclude that Z = g p Y .In particular, g p Y is contained in XB .
On the other hand, and, since δ 1 (p, Y ) holds, it follows that g p Y = XB .Therefore, B = A and Lemma 16.Let A be a Zariski optimal intersection component of π −1 (V ) and let d = δ Zar (A).Let X A denote the pre-weakly special subvariety A Zar of X (see Theorem 12).Then, for any p = [x, 1] with x ∈ A satisfying The proof of Lemma 16 is very similar to the proof of [9, Lemma 6.13].However, note that there is a typographical error in the statement of [9, Lemma 6.13]: the term "pre-weakly special" should be replaced by "Zariski optimal".This also occurs in [9, Proposition 6.10] and its proof.
Since, X A is pre-weakly special, (p, XA ) ∈ Θ and we will now show that (p, XA ) ∈ Π.
To that end, suppose that δ 1 (p, XA ) does not hold.Therefore, there exists Y ∈ Ω such that XA Y and from which it follows that A is contained in Y XA .However, this contradicts the fact that Lemma 17.Let Π • denote an irreducible component of Π.There exists a pre-special subvariety X H of X and a Q-splitting X H = X 1 × X 2 such that, for any (p, Y ) ∈ Π • , if we write p = [x, g], then gY = γ XH,x 2 for some γ ∈ Γ and some x 2 ∈ X 2 .
Proof.Fix a flat structure C for P and let (p 0 , Y 0 ) ∈ Π • .Write p 0 = [x 0 , g 0 ] and let U 0 ∈ C be such that x 0 ∈ U 0 .We have a biholomorpic map Observe that, for any pre-special subvariety X H of X and any Q-splitting X 1 × X 2 of X H , the set R(X H , X 1 , X 2 ) of points (s, g, Y ) ∈ S × G(C) × Ω such that gY = XH,x 2 for some x 2 ∈ X2 is a closed algebraic subvariety.To see this, let S(X H , X 1 , X 2 ) denote the closed algebraic subvariety of tuples constitutes a closed algebraic subvariety (to simplify the exposition, one may assume that dim Y is constant on Ω).Now the observation follows from the fact that, because X2 is projective, the natural projection from G(C) × Ω × X2 to G(C) × Ω is closed.
By Lemma 15, f U 0 (Π • U 0 ) is contained in the union of the R(X H , X 1 , X 2 ) as X H varies over the pre-special subvarieties of X and X 1 ×X 2 varies over the Q-splittings of X H . Furthermore, after possibly replacing U 0 with a subset (also belonging to C), we may assume that By definition, P × Ω is covered by the union of the Ũ as U varies over the elements of C. Therefore, since Π • is path-connected and the transition functions associated with the trivializations of P are given by elements of Γ, we conclude that there exists a pre-special subvariety X H of X and a Q-splitting X H = X 1 × X 2 such that, for any (p, Y ) ∈ Π, if we write p = [x, g], then gY = γ XH,x 2 for some γ ∈ Γ and some x 2 ∈ X2 .To conclude the proof, we recall that x ∈ gY .Hence, x ∈ X ∩ γ XH,x 2 and so x 2 ∈ X 2 , by Lemma 10.
With each d ∈ N and each irreducible component Π(d) • of Π(d), we associate a triple T = (X H , X 1 , X 2 ), where X H is a pre-special subvariety X H of X and X H = X 1 × X 2 is a Q-splitting, such that Lemma 17 holds for all (p, Y ) ∈ Π(d) • .With the triple T we associate the standard principal bundle P T = Γ H \(X H × H(C)) associated with (H, X H ) and Γ H = Γ ∩ H(Q) + .(This is indeed a principal bundle since Γ H is neat and, by [29,Remark 2.3], Z(H)(R) is compact.)We let Ω T denote the subvariety of Ω comprising the subvarieties of X of the form XH,x 2 for some x 2 ∈ X2 .By [21, Section 3], the natural map is algebraic, and it is easy to check that it is injective.We let Π(d) T denote the locally closed subset and we let Π(d) S T denote its image in S T = Γ H \X H under the natural map.
If we let H 1 × H 2 denote the decomposition of H ad giving rise to the Q-splitting X H = X 1 × X 2 , and we let Γ 2 denote the image of Γ H in H 2 (Q), we obtain a diagram Proof.It is a general fact that for any constructible map f : X → Y , the union of the Zariski closures of the fibers is constructible.Since we did not find a suitable reference we give the details below.
Up to taking affine covers one may assume that X and Y are affine.The union of the Zariski closures can be defined by (10) {x ∈ X : This would be constructible if one could restrict to quantifying over P ∈ C[X] of degree bounded by some N ∈ N.That is, if one could show that the Zariski closures of f −1 (y) are set-theoretically cut out by some polynomials of uniformly bounded degree.Equivalently, it sufficies to show that the Zariski closures of these sets have uniformly bounded degrees, which is standard.
We have the following structure theorem for weakly optimal subvarieties.
denote the triple associated with Π(d) • .If W is an irreducible component of a fiber of φ T,d , then ι T (W ) is a weakly optimal subvariety of V such that δ ws (W ) = d and W ws = π(X H,x 2 ) for some x 2 ∈ X 2 .
Proof of (i).Let A be an irreducible analytic component of π −1 (W ).By [9, Proposition 6.9], A is a Zariski optimal intersection component of π −1 (V ) and so, by Theorem 12, A Zar is a pre-weakly special subvariety X A of X.A simple calculation shows that π(X A ) = W ws and so δ Zar (A) = δ ws (W ) = d.By Lemma 16, for any we have (p, XA ) ∈ Π(d).Since (11) defines an open subset of A, there exists an open subset U of A and an irreducible component Π(d Let T = (X H , X 1 , X 2 ) be the triple associated with Π(d) • .Then XA = γ XH,x 2 for some γ ∈ Γ and some x ∈ U.In fact, by Proposition 14, these points also belong to Π(d) • as they belong to the G(C)-orbits of the points above.
. Then W T is a weakly optimal subvariety of V T = ι −1 T (V ) and W T ws is equal to S H,x 2 = π T (X H,x 2 ).In particular, W T is an irreducible component of S H,x 2 ∩V T , which is the fiber of V T → φ T (V T ) over the point z 2 = π T,2 (x 2 ).However, since Π(d) S T contains π T (γ −1 U), we deduce that W T is contained in Π(d) S T and, therefore, is an irreducible component of the fiber of φ T,d over z 2 .
Proof of (ii).Let z ∈ Π(d) S T ∩ W (observe that Π(d) S T ∩ W is Zariski dense in W and, in particular, is non-empty).Write z = π T (x) for some x = (x 1 , x 2 ) ∈ X H = X 1 × X 2 (in particular, W is an irreducible component of the fiber of φ T,d over π T,2 (x 2 )) and choose (p, Y ) ∈ Π(d) T lying above z.Clearly, we can choose p = [x, h] for some h ∈ H(C), and so hY = XH,y 2 for some y 2 ∈ X 2 .In fact, since x ∈ hY , we conclude that By Lemma 15, B is a Zariski optimal intersection component of π −1 (V ) such that δ Zar (B) = d and, writing X B for the pre-weakly special subvariety B Zar of X, we have hY = XH,x 2 = XB .By [9, Proposition 6.9], W B = π(B) is a weakly optimal subvariety of V , and we see that δ ws (W B ) = d and W B ws = π(X H,x 2 ).Since Π(d) S T ∩ W is Zariski dense in W , we conclude that ι T (W ) is contained in the union of the W B as obtained above.This is a finite union since each W B is a weakly optimal subvariety of V with weakly special closure π(X H,x 2 ), and π(X H,x 2 ) does not depend on z.
Since ι T (W ) is irreducible, it is contained in one such subvariety, and we conclude that Observe that Theorem 19 implies [9, Proposition 6.3]), which establishes that the weakly optimal subvarieties of V come from finitely many triples (X H , X 1 , X 2 ).The novelty in Theorem 19 is that the fibers of the φ T,d are precisely the weakly optimal subvarieties of V of weakly special defect d.
We recall that [9, Theorem 7.2] established that the union V an of the positive dimensional weakly optimal subvarieties of V of weakly special defect at most d is a Zariski closed subset of V .As such, either V an = V , in which case the Zilber-Pink conjecture can be reduced to arithmetic (see [9,Theorem 14.3]), or its complement in V is a non-empty Zariski open subset.

7.
Ingredients from differential algebraic geometry 7.1.The main statement.Let X denote a proper smooth complex algebraic variety of dimension d, and let X ⊂ X denote an open dense subset.Let L denote a very ample line bundle on X.In this section, the degree deg(Y ) of a subvariety Y ⊂ X is taken to mean the degree of the Zariski closure Ȳ ⊂ X with respect to L.
Let F denote a non-singular n-dimensional foliation of X.We further assume for simplicity that X is affine and that F is generated by n commuting regular vector fields ξ = (ξ 1 , . . ., ξ n ).We thus may think of regular/rational functions P on X as restrictions of polynomials/rational functions on a suitable A N , and we use deg(P ) to denote the (minimal) degree of such a representative.Similarly we denote by deg(ξ) the maximum among the degrees of the coefficients of ξ 1 , . . ., ξ n thought of as fields ξ i : X → T A N .
The assumption above can always be achieved by passing to an affine cover of X.For instance, identifying X as an affine subvariety of A N and choosing generic linear coordinates x 1 , . . ., x N on A N , there are unique rational vector fields ξ 1 , . . ., ξ n tangent to F of the form ( 13) where c ij are rational functions.Moreover [ξ i , ξ j ] = 0 by the Frobenius theorem.The results below can be applied, after this affine covering process, to any foliation F as above.
For any algebraic subvariety V ⊂ X and k ∈ N let Our main tool is the following.
Proposition 20.Let V ⊂ X be an algebraic subvariety.Then for some explicit polynomial P d depending on d.Moreover the equations for Σ(V, F , k) can be effectively computed from the equations defining X, V and ξ.
Remark 21.The explicit choice of affine coordinates is not strictly necessary to state the degree bound in Proposition 20.However, it is convenient for establishing the effective nature of our construction (i.e. to clarify the sense in which equations for Σ(V, F , k) are to be effectively computed).
We prove Proposition 20 below after describing how it relates to our concrete context involving flat connections on a Shimura variety.7.2.Flat connections and foliations.Recall the situation described in Section 5.1.Let U be an affine Zariski open subset of S such that π −1 P (U) ∼ = U × G(C) and suppose that x 1 , . . ., x n is a system of étale co-ordinates on U. The connection ∇ ∈ Ω 1 (P, g C ) can be written, with respect to these co-ordinates, as where Ω i is an algebraic morphism U → g C .Choosing a faithful representation g → gl M , we may write the Ω i as matrices with entries given by polynomials in the x 1 , . . ., x n .
The vector fields ∂ ∂x i on U lift to vector fields ξ i on π −1 P (U), which in our choice of coordinates can be written The vector fields ξ i commute by the flatness of ∇.By definition, their integral manifolds L p at a point p ∈ P are given by (germs of) horizontal sections of ∇.

Multiplicity estimates.
In order to prove Proposition 20, we will require the following multiplicity estimate due to Gabrielov-Khovanskii [11].
Theorem 22 ([11, Theorem 1]).Let P = (P 1 , . . ., P n ) ∈ O(X) n and let p ∈ X. Suppose that the restriction of P to the leaf L p of F through p has an isolated zero at p. Then for some explicit polynomial f d .
We will use this result to characterize the locus of points where the intersection of L p with the vanishing locus of P is positive-dimensional.For this purpose, we are interested in expressing the condition that a tuple of functions admits a common zero of multiplicity at least k by means of differential algebraic conditions.
Let F = (F 1 , . . ., F n ) denote an n-tuple of holomorphic functions in some domain Ω ⊂ C n .The problem above is addressed in [5] by means of a collection {M α } of "multiplicity operators" of order k.These are polynomial partial differential operators of order k, i.e. polynomial combinations of F 1 , . . ., F n and their first k derivatives.We will usually denote a multiplicity operator of order k by M (k) and write Proposition 23 ([5, Proposition 5]).We have mult p F > k if and only if M (k) p F = 0 for all multiplicity operators of order k.
For every p ∈ X, we let φ p : B → L p denote germ of a holomorphic map, for some open ball B ⊂ C n centered at the origin, satisfying ∂φ p /∂x i = ξ i for i = 1, . . ., n.We refer to this map as the ξ i -chart on L p .When P = (P 1 , . . ., P n ) ∈ O(X) n we may apply the multiplicity operator M (k) to P by evaluating the derivatives along ξ 1 , . . ., ξ n , which amounts to computing, for each point p ∈ X, the multiplicity operator of P | L p in the ξ i -chart.
Lemma 24.For any multiplicity operator M (k) of order k we have for some explicit polynomial f .Proof.This follows easily since M (k) is defined by expanding a determinant, of size polynomial in k, with entries defined in terms of P and its ξ i -derivatives up to order k.

7.4.
Proof of Proposition 20.Recall the situation described in Section 7.1.It is classical that V ⊂ X is then cut out by polynomials of degree at most deg(V ).Denote the set of these polynomials by P. Then we have Indeed, the inclusion ⊂ is obvious.For the other inclusion, suppose p ∈ Σ(V, F , k) so that dim(V ∩ L p ) < k.In particular L p ⊂ V , so there exists an equation P 1 ∈ P not identically zero on L p .If n − k > 1 then, similarly, no component of the intersection of L p with the vanishing locus of P 1 is contained in V , so there exists P 2 not vanishing on any of these components.Reiterating n − k steps of this form, we obtain P ′ = {P 1 , . . ., P n−k+1 } with dim(V (P ′ ) ∩ L p ) = k − 1, so p ∈ Σ(V (P ′ ), F , k).
By Bezout's Theorem, deg(Σ(V, F , k)) is bounded by a polynomial in the maximum of the deg(Σ(V (P ′ ), F , k)) for P ′ as above.Hence, it is enough to prove Proposition 20 assuming that V is a complete intersection defined by equations P = (P 1 , . . ., P n−k+1 ).
We now make a similar reduction involving the foliation F .Namely, where the intersection is taken over foliations F ′ generated by linear combinations of n−k +1 of the vector fields comprising ξ.Again the inclusion ⊂ is obvious.For the other inclusion, suppose p ∈ Σ(V, F , k), so that dim(V ∩ L p ) < k.Intersecting with linear hyperplanes passing through the origin in the ξ-chart on L p , we find, similarly to the previous step, k − 1 such hyperplanes defining a subleaf L ′ p with dim(V ∩ L ′ p ) = 0. Noting that L ′ p is a leaf of a subfoliation F ′ as above finishes the proof.By Bezout's Theorem, as above, it suffices, replacing F by the F ′ , to prove Proposition 20 in the case k = 1.In this case we have where µ is the multiplicity bound of Theorem 22. Finally, according to Proposition 23, the right-hand side is the zero locus of all multiplicity operators M (µ)  p P taken with respect to the foliation F .The degrees of all of these polynomials are bounded by Lemma 24.Applying Bezout's Theorem concludes the proof of the degree bound.
Finally, we indicate how to effectively obtain a system of equations for Σ(V, F , k).The only step above which isn't effective a priori is (14), where one intersects an infinite collection of equations.To deal with this, we first note that it would suffice to consider F ′ in some open-dense subset of the Grassmannian of n − k + 1-dimensional subsets of the span of ξ.We can generate such F ′ (c) as the span of ξ ′ 1 (c), . . ., ξ ′ n−k+1 (c) with ( 15) 1) .Repeating the construction above with F ′ (c) and treating c ij as independent variables, we obtain a system of equations k) if and only if the equations vanish at (x, c) for every c.It is then clear that Σ(V, F , k) is cut out by the coefficients of E 1 , . . ., E Q viewed as polynomials in the c-variables.

Effective bounds for degrees of weakly optimal subvarieties
Recall the situation described in Section 6.For i = 1, . . ., n, let U i denote a Zariski open subvariety of S such that ∪ n i=1 U i = S and π −1 P (U i ) ∼ = U i × G(C) is trivial.Furthermore, we can and do assume that, under the embedding S → P N given by L ⊗k Γ Γ , each U i is contained in one of the standard affine charts.Similarly, let Ω i denote Zariski open subvarieties of Ω (already considered as a subvariety of some P M ), each contained in a standard affine chart, such that Ω = ∪ n i=1 Ω i .Fix an embedding of G into some affine space A L .For i, j = 1, . . ., n, let U ij denote the Zariski open subset U i ×G(C)×Ω j of P ×Ω.The following is an immediate corollary of Proposition 14.The main result of this section is the following.
Theorem 26.Let d ∈ N and let W be a weakly optimal subvariety of V such that δ ws (W ) = d.Then Proof of Theorem 26.Since k Γ depends only on S, we may replace L ⊗k Γ Γ with L Γ , after possibly replacing f S .
Recall the situation reached at the end of the proof of Theorem 19 (i).Let Π(d) S denote the image of Π(d) • in S and let V 0 denote its Zariski closure.Let V T,0 denote the Zariski closure of Π(d) S T in S T .Observe that φ T (V T,0 ) is closed as φ T extends to a (projective) morphism on the Baily-Borel compactifications.
We will prove the theorem in a succession of lemmas.The following lemma will be used in the proofs of Lemma 28 (ii) and (iii).
Proof.We appeal to the commutative diagram of natural morphisms where ι * T (P × Ω) is the pullback of P × Ω to S T .Recall that ι P T is injective.First observe that the G(C)-orbit of (the image of) Π(d) T in P × Ω is Π(d) • .Indeed, the left-right inclusion is clear from Proposition 14.Therefore, let (p, Y ) ∈ Π(d) • and write p = [x, g].Then gY = γ XH,x 2 for some γ ∈ Γ and some x 2 ∈ X 2 .We rewrite p = [γ −1 x, γ −1 g] and we see that γ −1 g(p, Y ) ∈ P T × Ω T , which proves the claim.
Let Z T denote the Zariski closure of (the image of) Π(d) T in ι * T (P × Ω).Then, by the preceding paragraph, (the image of) G It follows that the Zariski closure of Y S T is equal to V T,0 .Hence, V T,0 is irreducible.The fact that ι T (V T,0 ) = V 0 now follows easily from the facts that ι T is closed and V 0 is equal to the Zariski closure of f (Π(d) • ).
The following lemma will reduce the proof to Lemma 30.Lemma 28.
Proof.The following lemma will be used in the proof of Lemma 30.
is an irreducible component of the fiber of V T → φ T (V T ) over z 2 , the claim follows.(ii) First observe that the Zariski closures of Π(d) S T and Π(d) S T coincide.That is, they are both V T,0 .Also, φ T (V T,0 ) is contained in the Zariski closure of φ T (Π(d) S T ).However, φ T (V T,0 ) is closed and contains φ T (Π(d) S T ).Therefore, φ T (V T,0 ) is equal to the Zariski closure of φ T (Π(d) S T ).Since, by Theorem 19, the fibers of φ T,d are pure of dimension dim X 1 − d, the claim follows.
It remains to prove the following lemma.
Lemma 30.We have Proof.In order to simplify notation, we will, for the remainder of the proof, replace Γ H with Γ, S T with S, V T,0 with V , W T with W , and dim W with d (as opposed to dim X 1 − d).We will also reassign ι to be the (proper) closed embedding V → S. Finally, for i = 1, 2, we let Γ i denote the image of Γ in H i (Q), we let f denote the natural morphism S → S 1 ×S 2 , where S i = Γ i \X i is the Shimura variety associated with (H i , X i ) and Γ i , and we let φ i denote the projection S → S i (which factors as f composed with the natural projection f i from S 1 × S 2 to S i ).
By the projection formula, the degree of c In particular, its fibers are equidimensional, of dimension d (by Lemma 29 (ii)).Now consider the excision exact sequence where i * is the pushforward associated with the (proper) closed embedding i : V \ U → V , and j * is the pullback associated with the (flat) inclusion j : U → V .We see that the degree of c Next, as in [17, Proposition 5.3.2(1)], we have Therefore, and so where j * ι * φ * 2 is the flat pull-back A 0 (U 2 ) → A r (U).Therefore, since L Γ 2 is ample, these classes can be represented by non-negative sums of r-cycles (which are zero if r > d).Hence, since L Γ 1 is ample, each summand of the above sum can be represented by a non-negative sum of 0-cycles.In particular, c 1 can be represented by the cycle associated to finitely many fibers of (φ 2 • ι • j)| U .For such a fiber F , we have where the first equality can be deduced from a binomial expression as above.Therefore, since (φ 2 • ι • j)| U is flat, and all fibers of a flat family of subschemes of a projective space have the same Hilbert polynomial, we conclude that, if W is an irreducible component of (φ as claimed.Therefore, by Lemma 29 (i), it remains to deal with the case when W is an irreducible component of (φ 2 • ι) −1 (z) for some z ∈ V 2 \ U 2 .To that end, let C be an irreducible algebraic curve in V 2 passing through z such that C ∩ U 2 = ∅ (just choose a point in U 2 and use the fact that, for any two points x and y in an irreducible algebraic variety Z, there exists an irreducible algebraic curve Therefore, the morphism Y → C is dominant.Let C denote the normalization of C, and let Ỹ denote the fiber product Y × C C. Note that Ỹ is irreducible and Ỹ → C is dominant.Since C is regular, it follows from [16,Prop 9.7] that Ỹ → C is flat.As such, its fibers all have the same degree with respect to η * L Γ . Let η : Ỹ → Y denote the natural map.It is finite and surjective.Therefore, if we let W denote an irreducible component of η −1 (W ), we have and, since W is a fiber of Ỹ → C and C passes through U 2 , the claim follows.

Effective determination of the weakly optimal locus
Recall the setup described in Section 1.1.This section is devoted to the proof of Theorem 6.
Throughout the proof, we think of the family T as embedded in projective space with respect to the prescribed embedding.We begin by computing an affine cover {V α } of V , such that over each V α once can select an explicit set of sections ω 1 , . . ., ω g for the sheaf of relative differentials Ω 1 T /V and an additional set of meromorphic differentials of the second kind (i.e. with vanishing residues) ω g+1 , . . ., ω 2g for the sheaf Ω 1 T /V (N • D) where D is a hyperplane divisor and n ≫ 1, such that that ω 1 , . . ., ω 2g are pointwise linearly independent everywhere.Such a choice of differentials can be computed explicitly for (families of) algebraic curves by classical methods.For the holomorphic differentials, see e.g.[6,Theorem 9.3.1]where it is attributed to Abel and Riemann.For meromorphic differentials of the 2nd type see e.g.[6,Propositions 9.3.8,9.3.9].Below we continue with V replaced by one of the V α , and assume that the sections above are pointwise linearly independent over V .
Having computed a base for the de-Rham cohomology H 1 (T /V ) we may now compute the Gauss-Manin connection ∇ : H 1 (T /V ) → H 1 (T /V ) ⊗ Ω 1 V explicitly.The fact that the Gauss-Manin connection admits a purely algebraic construction is essentially due to Manin [19].The approach of Manin is fully explicit and there is no difficulty in principle carrying it out computationally.
In fact, the construction that follows could be expressed in terms of this GL 2g (C)-connection.However, to stress the relationship with the general formalism of Shimura varieties considered in the first part of the paper, we show that one can explicitly compute a GSp 2g (C)-bundle P ⊂ V × GL 2g (C) compatible with ∇.
The existence of such a bundle P follows from the fact that ∇ preserves the symplectic form on H 1 (T /V ) induced by duality from the intersection form on H 1 (T /V, Z).More explicitly, let δ 1 (v), . . ., δ 2g (v) denote an (eventually multivalued) choice of symplectic basis of H 1 (T /V, Z), i.e. with the intersection form (δ i , δ j ) given by (17) J = 0 I g −I g 0 .
is a section of ∇ and ΠJΠ T = Λ defines a regular mapping from V to GL 2g (C) (singlevaluedness follows from that fact that the monodromy of Π(v) respects the intersection form, and regularity then follows from GAGA).Thus the subset of V × GL 2g (C) defined by ΠJΠ T = Λ is a ∇-invariant principal Sp 2g (C)-bundle with respect to the action (19) g • (v, Π) = (v, Π • g −1 ) g ∈ Sp 2g (C).
However, as we will see below, this bundle is not defined over a number field, and we will show instead how to construct the corresponding GSp 2g (C)-bundle explicitly over a number field.By definition, Λ(v) ij = (ω i , ω j ) v is the matrix representing the symplectic form on H 1 (X v ).The explicit computation of this form reduces to the following bilinear relation for meromorphic differentials of the second kind.
Lemma 31.Let ω, η be two meromorphic differentials of the second kind.Then where P ranges over the poles of ω and η, and f is any primitive of ω.Note that since η has no residues, res P (f η) is independent of the choice of the primitive.
The left hand side of ( 20) is, by definition, the symplectic pairing (ω, η) up to the constant 2πi.The right hand side can be explicitly computed in local coordinates around P ∈ V , i.e. it depends only on finitely many Laurent coefficients of ω, η in local coordinates around the poles.Using this, one may explicitly compute each entry of 2πΛ(v) as a regular function on V .
Having computed 2πΛ(v), we further simplify the computation as follows.The Riemann bilinear relations imply that ω 1 , . . ., ω g span an isotropic space, and Λ(v) defines a nondegenerate pairing between this space and the span of ω g+1 , . . ., ω 2g .By elementary linear algebra, one may now replace each section ω g+j by a linear combination ω ′ g+j such that ω 1 , . . ., ω g and ω ′ g+1 , . . ., ω ′ 2g form a standard symplectic basis.Assume without loss of generality that we have made such a choice, so that Λ(v) ≡ 2πJ.With this choice, ∇ restricts to a connection on the trivial bundle P = V × GSp 2g (C) with the connection equation and the left GSp 2g (C)-action given as before by g(s, Π) = (s, Πg −1 ).Denote by X = H g the Siegel upper half-space, by X the compact dual, and by X ′ ⊂ X the set of symmetric g × g matrices.We have a GSp 2g (C)-equivariant rational map β : P → X ′ given by β(v, Π) = B −1 A where A and B are the blocks given in (18).One can verify that, since Π ∈ GSp 2g (C), the image of β, when defined, is an element of X ′ .The map β extends to a regular map β : P → X.
Recall that we denote by f : Ṽ → V an étale cover, T → Ṽ the base change of T by f , and choose f such that T is compatible with an N-level structure (say for N = 3).We denote by ι : Ṽ → A g,N the corresponding moduli map.

( i )
Let Π(d) • be an irreducible component of Π(d) and let T be its associated triple.Then Π(d) • T is constructible.(ii) Let W be a weakly optimal subvariety of V of weakly special defect d.Then there exists an irreducible component Π(d) • of Π(d) (with its associated triple T ) such that W is the image in S of some irreducible component of a fiber φ T | Π(d) • T .(iii) Let Π(d) • denote an irreducible component of Π(d) (with its associated triple T ).If W is an irreducible component of a fiber of φ T | Π(d) •

4 . 1 .
The (weak) hyperbolic Ax-Schanuel conjecture 4.Subvarieties of X. Recall the situation described in Section 3.1 and let X be an irreducible component of X. Recall that X is a G-conjugacy class of homomorphisms S → G R .By extending scalars to C and pre-composing with G m → G 2 m ∼ = S C , where the first map is given by z → (z, 1), we obtain from each point x ∈ X a cocharacter µ x : G m → G C such that ( * ) in the action of G m on Lie(G C ), obtained via restriction of the adjoint representation, only the characters z, 1, and z −1 occur.
δ 1 (p, Y ) and δ 2 (p, Y ) hold.For any d ∈ N, we let Π(d) denote the set of tuples (p, Y ) ∈ Π such that dim Y − d(p, Y ) = d.(6)Recall the notion of complexity of locally-closed sets introduced before Theorem 4. The proof of the following results relies on differential-algebraic tools developed in Section 7, and is presented below to avoid breaking the logical flow of the paper.However the reader may easily verify that the contents of Section 7 are self contained and do not rely on Proposition 14. Proposition 14.The sets Π(d) for d ∈ N are locally closed subsets of Θ.The complexity of Π(d) is bounded f S (deg(V )) for some polynomial f S depending only on S.Moreover, one can derive an explicit system of equalities and inequations for Π(d), as described in Theorem 4.The (algebraic, left) action of G(C) on P × Ω defined by g(p, Y ) = (g • p, gY ) preserves the Π(d) and their irreducible components.
denote the union of the Zariski closures of the fibers of the map φ T restricted to Π(d) S T and we let φ T,d denote the map Π(d) S T → φ T (Π(d) S T ) Lemma 18.The sets Π(d) S T are constructible.

Theorem 19 .
Let d ∈ N. (i) Let W be a weakly optimal subvariety of V such that δ ws (W ) = d.Then there exists an irreducible component Π(d) • of Π(d) such that, if T denotes the triple associated with Π(d) • , then W = ι T (W T ) for some irreducible component W T of a fiber of φ T,d .

)
On the other hand, since Π(d) is locally closed, Π(d) • contains a Zariski open subset U that is disjoint from the other irreducible components of Π(d).Then U T = ι −1 P T (U) is Zariski open in Π(d) T and so, since it is dense and constructible, the image U S T of U T in Π(d) S T contains an open subset of Π(d) S T .Suppose then that z ∈ U S T and (p, Y ) ∈ U T .By Lemma 16, for any y ∈ B such that dim B = dim y (hY ∩ π −1 (V )) and p = [y, 1], we have (p, hY ) ∈ Π(d).Since this condition defines an open subset of B containing x, we conclude that there exists an open subset U B of B containing x such that, for any y ∈ U B and p = [y, 1], we have (p, hY ) ∈ Π(d) T .It follows that π T (B) is contained in the fibre of φ T,d over π X 2 (x 2 ).Therefore, since U S T contains an open subset of Π(d) S T , the irreducible components of the fibers of φ T,d are of dimension at least dim B = dim X 1 − d.Hence, we conclude from (12) that they are pure of dimension dim X 1 − d and this concludes the proof.

Lemma 25 .
Let d ∈ N and let Π(d) • denote an irreducible component of Π(d).For any i, j ∈ {1, . . ., n}, the degree of the Zariski closure of the locally closed subset U ij ∩ Π(d) • of P × Ω, considered as a subvariety of A N +L+M , is bounded by f S (deg L ⊗k Γ Γ (V )) for some polynomial f S depending only on S.
1.3.Acknowledgements.G. Binyamini was supported by the ISRAEL SCIENCE FOUN-DATION (grant No. 1167/17) and by funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 802107).C. Daw would like to thank the EPSRC for its support via a New Investigator Award (EP/S029613/1).He would also like to thank the University of Oxford for having him as a Visiting Research Fellow.
Now suppose that δ 2 (p, XA ) does not hold.Therefore, there exists Y ∈ Ω such that Y XA and d(p, Y ) = d(p, XA ).However, this implies that