Singular moduli of higher level and special cycles

We describe the complex multiplication (CM) values of modular functions for $\Gamma_0(N)$ whose divisor is given by a linear combination of Heegner divisors in terms of special cycles on the stack of CM elliptic curves. In particular, our results apply to Borcherds products of weight $0$ for $\Gamma_0(N)$. By working out explicit formulas for the special cycles, we obtain the prime ideal factorizations of such CM values.


Introduction
Let d < 0 be a negative fundamental discriminant and denote by Q d the set of (positive and negative definite) integral binary quadratic forms of discriminant d. For every Q ∈ Q d given by Q(x, y) = ax 2 + bxy + cy 2 the unique root of Q(τ, 1) = 0 in H, the complex upper halfplane, is denoted α Q . These points are called CM points because the associated elliptic curve has complex multiplication (CM). That is, its endomorphism ring is an order in an imaginary quadratic field (in our case the ring of integers). The values of j(τ ) of the j-invariant at CM points are classically called singular moduli [Web61;Zag02]. For Q ∈ Q d , the value j(α Q ) is an algebraic integer which generates the Hilbert class field H of k d = Q( √ d). In their seminal article, Gross and Zagier [GZ85] consider the modular function of level one Ψ(z, d) = Q∈SL 2 (Z)\Q d (j(z) − j(α Q )) 1/w d , for z ∈ H, and where w d is the number of roots of unity in k d . They proved that for a negative fundamental discriminant D coprime to d, we have (1.1) Q∈SL 2 (Z)\Q D Ψ(α Q , d) 2/w D = ± x∈Z, n,n >0 4nn =dD−x 2 n (n ) , where (n ) = ±1 is given explicitly in [GZ85].
Gross and Zagier give an analytic and an algebraic proof of (1.1). The latter is given for prime discriminants only, but does in fact provide the prime ideal valuations of the values Ψ(α Q , d). Dorman [Dor88] generalized this result to fundamental discriminants. Moreover, the contributions at the finite places to the height pairing studied in [GKZ87] essentially provide a generalization to higher level.
In this paper, we refine results of Bruinier and Yang [BY09] to relate the prime factorization of special values of certain modular functions to special cycles on the stack of CM elliptic curves. This has been used in [Ehl13;Ehl15b] to relate the coefficients of harmonic weak Maaß forms of weight one to these special cycles and to study the modularity of related arithmetic generating series. We use these results to determine the prime ideal factorization of such modular functions explicitly. In Section 7 we show that we can apply our results to Borcherds products of weight zero. We now define the higher level singular moduli we are considering. Let d be a negative integer congruent to a square modulo 4N and let Q d,N,r be the set of integral binary quadratic forms [a, b, c] = ax 2 + bxy + cy 2 of discriminant d = b 2 − 4ac such that a is congruent to 0 modulo N and b is congruent to r modulo 2N . For each form Q = [a, b, c] ∈ Q d,N,r there is an associated CM point α Q = −b+ √ d 2a in H. The group Γ 0 (N ) acts on Q d,N,r with finitely many orbits. We define the Heegner divisor Z(d, r) to be the Γ 0 (N )-invariant divisor (with rational coefficients) where w Q is the order of the stabilizer of Q in Γ 0 (N ). We also denote the image of Z(d, r) in Y 0 (N ) = Γ 0 (N )\H and its compactification X 0 (N ) in the same way. Now fix a square-free negative fundamental discriminant D and let H be the Hilbert class field of the imaginary quadratic field k = k D of discriminant D. We will write O ⊂ k for the ring of integers in k and N(·) = N k/Q (·) for the norm of k/Q. The ring of integers in H is denoted O H . We fix an embedding of H into C and for ρ ∈ Z with ρ 2 ≡ D mod 4N the integral ideal n = N, ρ + √ D 2 of norm N in k. Consider the Heegner point z D,ρ contained in Z(D, ρ) given by ∈ H.
Representatives for the remaining points in Z(D, ρ) can be obtained as follows. If a is an integral ideal of k, then an is an ideal of norm divisible by N . If we let α, β be generators of an, such that α = N(a)N , then the point β/α lies in H and as the class [a] runs through the ideal class group of k, these points run through half of a system of representatives of Z(D, ρ). The other half is obtained by also considering −z for each of these points.
We will now give a simpler version of our main result, Theorem 6.4, for prime level. Let N = p be a prime and consider a meromorphic modular function f on Y 0 (p). We assume in the introduction that f is invariant under the Fricke involution z → −1/pz and has a divisor on H of the form div(f ) = r mod 2p d ∈ Z <0 d ≡ r 2 mod 4p c(d, r)Z(d, r).
Moreover, we assume that div(f ) and Z(D, ρ) have no common points and that the Fourier coefficients of f are coprime integers. In particular, we have that f ∈ Q(j(τ ), j(pτ )). By the theory of complex multiplication, the value f (z D,ρ ) is contained in the Hilbert class field H. The following theorem gives the multiplicity of a prime of the Hilbert class field in the prime ideal factorization of f (z D,ρ ) in terms of certain special cycles Z(m, n, µ) on Spec O H that parametrize elliptic curves with special endomorphisms of norm mN(n) satisfying a congruence condition given by µ ∈ d −1 k n/n (see Sections 3 and 4 for definitions). Here, d −1 k denotes the inverse different of k. We write Z(m, n, µ) as a formal sum where the sum runs over all nonzero prime ideals of H and Z(m, n, µ) P ∈ Q. These cycles are generalizations of those first considered by Kudla, Rapoport and Yang [KRY99] in connection with the coefficients of the derivative of an incoherent Eisenstein series of weight one.
Theorem 1. We have for every prime ideal P of the Hilbert class field Remark.
(i) The set of CM values of f at points in Z(D, ρ) forms a single Galois orbit and the valuations of other points in Z(D, ρ) can be obtained using Shimura reciprocity and Proposition 2 below. (ii) Note that there exist modular functions whose divisor is given by a linear combination of Heegner divisors on Y 0 (N ) that are not obtained as Borcherds products. This has been remarked by Borcherds [Bor99, Example 5.2] and follows from Theorem 7.7 of [BY09]. We also remark that Bruinier [Bru12] proved a converse theorem for Borcherds products which shows that the case of modular curves is quite exceptional in this regard.
To obtain formulas for the quantities in Theorem 6.4 or Theorem 1 above, we use Gross' formula for the length of the local rings of Z(m, n, µ) as in [KRY04], where the arithmetic degrees of these cycles have been computed. In the case of a prime discriminant these formulas are completely explicit and rather simple, as we shall see below.
Fix a fractional ideal n ⊂ k and let µ ∈ d −1 k n/n and m ∈ Q >0 . We write [a] for the class of the fractional ideal a in the class group Cl k of k. We define a set of rational primes by and for n ∈ Z and [b] ∈ Cl k we let If m is a rational number and p is a rational prime which is non-split in k, we define if p is ramified in k.
We obtain the following result (see Proposition 4.10).
(ii) Assume that Diff(m) = {p} and that m + N(µ)/N(a) ∈ Z. There is a unique prime ideal P 0 | p fixed by complex conjugation,P 0 = P 0 . For P = P σ 0 , where σ = σ(b) corresponds to the ideal class of b under the Artin map (·, H/k), we have where o(m) = 1 if ord l (ml) > 0 and o(m) = 0, otherwise.
1.1. Acknowledgements. This article contains some results that were contained in my thesis [Ehl13]. First and foremost I would like to thank my advisor Jan Hendrik Bruinier for his constant support and encouragement. I also thank Claudia Alfes and Tonghai Yang for their help. I also thank Benjamin Howard for helpful discussions and in particular for helping me with the proof of Proposition 3.5. Moreover, the helpful comments of the anonymous referee are greatly appreciated.
1.2. Outline. The paper is organized as follows: In Section 2, we set up the notation and give basic definitions. The moduli stack of CM elliptic curves is introduced in Section 3 and in Section 4 we describe the special cycles and prove the explicit formulas for the multiplicities. The integral model for the modular curve X 0 (N ) will be recalled in Section 5 and in Section 6 we prove the main result of this paper (Theorem 6.4). The applications to Borcherds products are discussed in Section 7 and finally, Section 8 covers some numerical examples illustrating our results.

Preliminaries and notation
We write Z for the integers, Q for the field of rational numbers, Z p for the ring of p-adic integers and Q p for the field of p-adic numbers. We also use the notationẐ = p Z p , where the product is over all primes. We write A for the adeles of Q and use the notation A f for the finite adeles of Q If k is a number field, we write O k for its ring of integers and A k (and A k,f ) for the adeles (and finite adeles) of k. Moreover, we writeÔ k for the tensor product O k ⊗ ZẐ .
2.1. Modular forms. We briefly recall the definition of modular forms for Γ 0 (N ). We refer to one of the standard references for details, for instance [Kob93;Miy06;Ono04;Ste07].
Let N be a positive integer and consider the congruence subgroup Γ 0 (N ) ⊂ SL 2 (Z) defined by For an integer k ∈ Z and a matrix γ ∈ GL + 2 (Q), the Petersson slash operator is defined on (ii) and f is meromorphic at the cusps of Γ 0 (N ).
The conditions at the cusps can be phrased in terms of Fourier expansions. A meromorphic modular form f has a Fourier expansion (at the cusp ∞) of the form where q = e 2πiτ = e(τ ). That is, if f is a meromorphic modular form, then there are only finitely many non-vanishing Fourier coefficients a f (n) with n < 0. The conditions at the other cusps are similar. By a modular function for Γ 0 (N ), we mean a meromorphic modular form of weight 0 for Γ 0 (N ). It is well known [Shi94] that the field of modular functions for Γ 0 (N ) is generated by j(τ ) and j N (τ ) = j(N τ ).
2.2. Elliptic curves. We recall the definition of an elliptic curve over an arbitrary base scheme. We refer to Chapter 2 of the book by Katz and Mazur [KM85] and the two books by Silverman [Sil09; Sil94] for details.
Definition 2.2. Let S be a scheme. A proper smooth curve E → S with geometrically connected fibers of genus one together with a section 0 : S → E, is called an elliptic curve.
It is an important fact that an elliptic curve admits a unique structure as a group scheme [KM85, Theorem 2.1.2]. It is well known (see [Sil09,Corollary 9.4] and [Deu41]) that the endomorphism ring of an elliptic curve over a field is either Z, an order in an imaginary quadratic field or an order in a quaternion algebra. We will use the notation to denote the quaternion algebra F ⊕F α ⊕F β ⊕F αβ with α 2 = a and β 2 = b and αβ = −βα.
We say that the quaternion algebra B is split over F if B is isomorphic to M 2 (F ). Here, M 2 (F ) is the algebra of 2 × 2-matrices over F . For a quaternion algebra B over Q, we say that B is split at a prime p (or ∞), if B ⊗ Q Q p is split over Q p . Otherwise, we say that B is ramified at p (or ∞). We use the same convention over other fields.
Let E/k be an elliptic curve over a field k. If the endomorphism ring End k (E) contains an order O ⊂ k of an imaginary quadratic field k, then we say that E has complex multiplication by O (or just that E has CM).
A CM elliptic curve over a scheme S is a pair (E, ι) consisting of an elliptic curve E/S and an action ι : O → End S (E) of an order O in an imaginary quadratic field on End S (E).
If End S (E) = O ⊂ B is an order in a quaternion algebra, then we say that E is supersingular. Supersingular elliptic curves only occur in positive characteristic (cf. VI., Theorem 6.1 of [Sil09]).
2.3. The Hilbert class field. We recall only very briefly some facts from class field theory that we need later, in particular the Artin map. We refer to [Sil94,Chapter II] or [Shi94] for details. Let k be a totally imaginary field and let L be a finite abelian extension of k. Write O L for the ring of integers in L. Let p be a prime ideal of k that does not ramify in L. There is a unique element σ p ∈ Gal(L/k), such that for all x ∈ O L and any prime ideal P | p. If c is an integral ideal of k which is divisible by all primes that ramify in L/k and I(c) is the group of fractional ideals that are relatively prime to c, then the Artin map is defined as (·, L/k) : I(c) → Gal(L/k), by extending the map σ p linearly.
We let k be an imaginary quadratic field and H be the Hilbert class field of k. This is the maximal unramified abelian extension of k. It corresponds to the ray class field for c = 1. By class field theory, we obtain in this case [Sil94, II, Example 3.3] an isomorphism via the Artin map (·, H/k) : Cl k → Gal(H/k). We will use the convention that we write σ(a) = σ([a]) for ([a], H/k), the image of the (class of the) fractional ideal a under this map.

Moduli of CM elliptic curves
In this section we recall some facts about the moduli stack of CM elliptic curves and special 0-cycles on it. These cycles will play an important role in the description of the values of modular functions on Y 0 (N ).
Let S be a scheme. By a scheme over S or an S-scheme, we mean a scheme X together with a morphism π : X → S. We denote by (Sch /S) the category of schemes over S. The morphisms in this category are morphisms of S-schemes, that is, morphisms that are compatible with the given morphisms to S. Here and throughout, if X is a stack over a base scheme S and T is an S-scheme, we abbreviate If T = Spec R with R a ring, we simply write X /R for X / Spec R .
Here and for the rest of this section, let D be a negative fundamental discriminant and denote by k = k D the imaginary quadratic field of discriminant D < 0. We write O D for the ring of integers of k and let H = H D be the Hilbert class field of k.
We consider the moduli problem which assigns to a base scheme S over O D the category coincides with the structure map S → Spec(O D ). The morphisms in this category are isomorphisms respecting the actions. Moreover, we denote by C D = cRes O D /Z (C + D ) the restriction of coefficients of C + D to Z (in the sense of Grothendieck). That is, the structure map of C D is given by C + D → Spec(O D ) → Spec(Z). This describes the moduli problem without the normalization (3.1).
Proposition 3.1. The moduli problem C + D is represented by an algebraic stack, also denoted by C + D , which is smooth of relative dimension 0 and proper over Spec O D . If R is a discrete valuation ring with algebraically closed residue field F, the reduction map Consequently, C D is also represented by an algebraic stack of relative dimension 0 over Spec Z, which is finite (and thus proper).
Proof. This is a consequence of the canonical lifting theorem [How13;Lan08]. Properness follows from the fact that all points of C D in characteristic 0 have potentially good reduction and the valuative criterion of properness. See [KRY99, Section 5] or [BHY13] for details.
Lemma 3.2. The coarse moduli scheme C + D of C + D is isomorphic to Spec O H as a scheme over O D . Consequently, the coarse moduli scheme C D of C D is isomorphic to Spec O H as a scheme over Z.
Proof. This is [KRY99,Corollary 5.4]. There, the authors prove the corresponding isomorphism for C + D , whose coarse moduli scheme is Spec O H → Spec O D . We denote by pr : the canonical map to the coarse moduli scheme.
Proposition 3.3. Let ξ ∈ C + D be a geometric point and let pr(ξ) =ξ be the corresponding ξ denote the completions of theétale local rings at ξ andξ, respectively. Proof. This is Corollary 5.2 in [KRY99].
We now describe the geometric points of C D in every characteristic. The following construction is very important for us.
Recall that over C, we have a canonical bijection given by the theory of complex multiplication [Sil94]. Here and throughout, we write A × k,f for the finite ideles over k. To an idele h ∈ A × k,f that corresponds to the ideal class [(h)], the bijection assigns the (isomorphism class of the) elliptic curve with complex points , then multiplication with h ∈ A × k,f on the right hand side of (3.2) corresponds to This defines an action of the class group Cl k on the set of isomorphism classes of CM elliptic curves (with CM by O D ) over C.
Now let (E, ι) ∈ C + D (S) for a scheme S and let h ∈ A × k,f , corresponding to the ideal (h). Then we can define a functor from the category of S-schemes to the category of O D -modules by . This functor is in fact represented by an elliptic curve over S and the construction is called the Serre construction. We denote the elliptic curve representing this functor by h.
We follow the description given in [KRY99] to describe the geometric points of C + D in positive characteristic.
Proposition 3.4 (Corollary 5.5 of [KRY99]). Let p be a prime ideal of k and let κ(p) denote an algebraic closure of the residue field κ(p). We have a bijection The action by the Frobenius automorphism over κ(p) on the left hand side corresponds to the translation by an idele of the form (1, . . . , 1, π, 1, . . .), where π is a uniformizer at p.
The proposition establishes a simply transitive action of the class group Cl k on the points C + D (F) over any algebraically closed fieldF. We also have a bijection on geometric points On the points Spec O H (F), we have an action of the Galois group Gal(H/k).
Fix a morphism pr : C + D → Spec O H . Then pr induces an isomorphism on geometric points over any algebraically closed fieldF. ForF = k orF = κ(p), the group Gal(H/k) acts on both sides. It acts naturally on the right hand side and the action on the left hand side is given via the isomorphism given by the Artin map σ of class field theory and the action of the idele class group given above. The next proposition shows the compatibility of these bijections and group actions.
Proposition 3.5. With the notation as above, the coarse moduli space map pr is compatible with these actions. More precisely, we have Proof. The compatibility over C is contained in the main theorem of complex multiplication [Sil94, II, Theorem 8.2]. (Note that our normalization of the action of the class group is different from the one used by Silverman.) Precisely, we have for an elliptic curve E = . Therefore, if we assume without loss of generality that pr C (E, ι) = λ : O H → C is the embedding given by j → j(E), then We will use this to prove the statement over κ(p) for a fixed prime p of k. Fix an isomorphism C p ∼ = C, where C p is the completion of an algebraic closure of k p . Then we obtain isomorphisms ) by Proposition 3.1. All of these bijections are compatible with the Serre construction. Similarly, we have bijections The key part is now that the diagram is commutative and the bijection C + D (C) ∼ = Spec O H (C) is compatible with the actions, as stated above. The bijections in the lower row are compatible with the action of the Galois group. Consequently, the bijection C + D (F p ) → Spec O H (κ(p)) is compatible with the two actions, as well.

Special endomorphisms
For (E, ι) ∈ C D (S) we write O E = End S (E) and consider the lattice L(E, ι) of special endomorphisms as in Definition 5.7 of [KRY99]. It is equipped with the positive definite quadratic form For a non-split prime p and S = Spec(F p )), L(E, ι) is a positive definite lattice of rank 2 in O E and (E, ι) is supersingular. In this case O E is a maximal order in the quaternion algebra B p over Q, which is ramified exactly at p and ∞.
Fix a fractional ideal a ⊂ k and let µ ∈ d −1 k a/a and m ∈ Q >0 . We write Q(µ) = N(µ)/N(a), which is well defined as an element of Q/Z.
The following moduli problem has been studied in [KRY99] and [BY09] and generalized in [KY13]. To a scheme S we assign the category Here, we also wrote N(x) for the reduced norm in Lemma 4.1 (Lemma 6.2 in [BY09]). The moduli problem Z is represented by an algebraic stack Z(m, a, µ) of dimension 0 and the forgetful map ψ : For m ∈ Q >0 , we define a set of rational primes by Proof. If there is an element (E, ι, x) ∈ Z(m, a, µ), then this shows that we have an isomorphism of quaternion algebras However, since B p is ramified exactly at p and ∞, this is equivalent to This condition is equivalent to Diff(m) = {p}.
In the notation of [Vis89, Section 3], the stack Z(m, a, µ) defines a 0-cycle ψ * [Z(m, a, µ)] on C D since the forgetful map is proper.
Moreover, note that the map pr : C D → Spec O H is also proper by Lemma 3.2. Therefore, we can consider the proper pushforward pr * [Z(m, a, µ)] to Spec O H . In our case because the automorphism group of a general geometric point of . By abuse of notation, we also denote by Z(m, a, µ) the corresponding divisor on the coarse moduli scheme and simply write If there is no confusion possible, we simply write Z(m) or Z(m) P . Note that the multiplicities above are the same for the pushforward from C + D and from C D . In what follows, we will find formulas for the multiplicities Z(m, a, µ) P . From now on, fix a prime p that is non-split in k and assume that m ≡ −Q(µ) mod Z. Let p 0 ∈ Z be a prime with p 0 2pD such that if p is inert in k, we have and if p is ramified in k, we have With this choice, put and let p 0 be a fixed prime ideal of O D lying above p 0 . Here, (·, ·) v denotes the v-adic Hilbert symbol. The existence of such a prime p 0 follows essentially from Dirichlet's theorem, see also [Ser73,III,Theorem 4]. Note that the genus of [p 0 ] is well defined since the symbols (D, ·) v form a basis for the genus characters. We can write B p = k ⊕ ky 0 , where y 2 0 = κ p , similar to the situation in the last section. Here, the decomposition is orthogonal with respect to the bilinear form corresponding to the reduced norm of B p . We write [γ, δ] for the element γ + δy 0 ∈ B p .
Proposition 4.4. Let p be a prime that is non-split in k and let (E, ι) ∈ C D (F p ). Then L(E, ι) is a projective O D -module of rank 1 and there is a fractional ideal b ⊂ k, such that Proof. The first statement is Proposition 5.13 in [KRY99]. The second follows from the action of the ideles on maximal orders in the quaternion algebra B p , as described in detail in Section 5 of [KRY99].
Recall that there are two actions of A × k,f on ideals of k. One is given by the multiplication by the ideal (h) corresponding to the idele h and the other one is given by the action of A × k,f ∼ = T (A f ), where T = GSpin U for the quadratic space U = k with quadratic form given by the norm on k. For details, we refer to Section 2.2 of [Ehl15a]. To avoid confusion, we will denote the action of h as an element of T (A f ) by h.a = (h)( h) −1 a for any fractional ideal a ⊂ k.
Proof. This follows from Propositions 3.5 and 4.4.
. Then the maximal order End(E 0 ) of B p can be described in the following way.
If p is inert in k, let c 0 = p 0 d k . If p is ramified and p ⊂ O D is the prime above p, let There exists a generator λ 0 of d −1 Proof. See Lemma 3.3 and Lemma 7.1 of [KY13]. The result has also been described by Dorman [Dor89;Dor88].
Remark 4.7. There are 2 t possible choices for generator of d −1 k c 0 /c 0 , with the required norm, where t is the number of prime divisors of D. However, there are only 2 t−1 inequivalent ones. Here, we consider the orders to be equivalent if they are conjugate by an element of k × . Indeed, λ and −λ yield such equivalent conjugate orders.
However, not knowing the specific λ that corresponds to the chosen point (E 0 , ι 0 ) results in an ambiguity in Proposition 4.8 below, cf. [Dor88]. We will resolve this issue later on by taking the relative norm to the fixed field of all elements of order dividing 2 in the Galois group Gal(H/k).
In the most general case that we consider, the multiplicities involve representation numbers with additional congruences that we will define now. For a fractional ideal a of k, we let c a = aā −1 c 0 . Moreover, we let λ a = a.λ 0 ∈ d −1 k c a /c a , where a ∈ A × k,f is an idele determining a and λ 0 is given in Lemma 4.6. Note that a is only unique up to an element ofÔ × D but λ a is a well defined element of d −1 k c a /c a sinceÔ × D acts trivially on d −1 k c a /c a . For n ∈ Q >0 and µ ∈ d −1 k a/a, we let (4.2) ρ 0 (n, a, µ) = #{x ∈ c −1 a a = c −1 0ā | N(x) = n, λ a x + µ ∈ a}.
We need to define one more quantity to describe the multiplicities Z(m, a, µ) P . Let p be a prime which is non-split in k and define Note that the prime ideals P | p of H correspond to the irreducible components of Spec O H (F p ). We let P 0 be the prime ideal such that pr Fp (E 0 , ι 0 ) with (E 0 , ι 0 ) as in Lemma 4.6 lies in the irreducible component corresponding to P 0 . (i) We have Z(m, a, µ) P = 0 unless m + Q(µ) ∈ Z.
(ii) For m + Q(µ) ∈ Z, we have Proof. First note that our cycles correspond to those studied in [KY13] which are generalizations of those in [KRY04]. The cycle Z(m, a, µ) corresponds to Z(m |D| ; d k a −1 , λ , λ µ) for a generator λ ∈ a −1 /a −1 d k .
The push-forward pr * [Z(m)] is given by a formal sum P⊂O H n P P.
We will now determine the multiplicities. Fix a rational prime p and a prime ideal P ⊂ O H over p. Moreover, fix any geometric point ξ = (E 0 , ι 0 ) ∈ C D (κ(P)). Using Propositon 4.1 in [KY13], we see that the length lgÔ Z(m),ξ of the completed local ring is given by (4.4) lgÔ Z(m),ξ = ν p (m). Note that in the notation of [KY13], we have ∂ = d k = ∂ λ and ∆ = D. Moreover, ord p (m) = ord p (m |D|) for p D. Therefore, Thus, what is left is to count the number of endomorphisms x, such that (E 0 , ι 0 , x) = (ξ, x) ∈ Z(m)(κ(P)). That is, we need to count the number of x ∈ L(E 0 , ι 0 )d −1 k a, such that The endomorphism ring O E 0 = End(E 0 ) is a maximal order contained in the quaternion algebra B p = k ⊕ ky 0 , where y 2 0 = κ p . By Lemma 4.6, we have k a is therefore of the form x = αy 0 for α ∈ c −1 0 a. By Proposition 7.1 of [KY13], we have that aO ca,λa,Bp = aO ca,λa,Bp = O c 0 ,λ 0 ,Bp a = O c 0 ,λ 0 ,Bp a, where a ∈ A × k,f is an idele determining a. Note that this does not depend on the choice of such an a because the order is invariant under the action ofÔ × D . Consequently, the condition µ + αy 0 ∈ O E 0 a is equivalent to µ ∈ d −1 k a and α ∈ c −1 0ā such that µ + λ a α ∈ a. The norm of α is required to be N(α) = (m/κ p )N(a). This yields the representation number ρ 0 ((m/κ p )N(a), a, µ) and ends the proof.
We can avoid the ambiguity in the formulas above by taking the quotient Cl k / Cl   Proof. First note that the class number of h k is odd [Zag81]. Since p is non-split in k, the unique prime p ⊂ O D above p splits completely in H. Therefore, the number of primes of O H above p is odd and there is at least one prime fixed by complex conjugation. Let P be such a prime. Let τ denote complex conjugation x →x. Since σ • τ = τ • σ −1 for all σ ∈ Gal(H/k), we have for every b. Suppose that Q is another prime above p with Q =Q and Q = P σ(b) . Then it is easy to see that P σ(b 2 ) = P. Thus, since Gal(H/k) acts transitively on the set of primes above p and p is totally split in H, we have that σ(b 2 ) is the identity and thus Since h k is odd, this implies that [b] = [O D ] and therefore P is the only prime fixed by complex conjugation. Let W be the completion of the maximal unramified extension of O H,P (here, O H,P is the completion of O H with respect to P). Fix an algebraic closure κ(p) of the residue field κ(p) = O D /p. The ring W is a complete discrete valuation ring with maximal ideal π and its residue field W/π is algebraically closed and therefore isomorphic to κ(P) ∼ = κ(p) (see Corollary 1 of Chapter II in [Ser79]). Recall the diagram in the proof of Proposition 3.5. We can consider a similar diagram with W in place of C p . The bijection C + D (C) → C + D (W ) is obtained by mapping a CM elliptic curve (E, ι) ∈ C + D (C) to an elliptic curve (Ẽ, ι) over W with j-invariant j(Ẽ) = j(E). Such an elliptic curve with good reduction exists by the theorem of Serre and Tate [ST68; GZ85] and is unique up to W -isomorphism. That all the maps involved are bijections is a consequence of the canonical lifting theorem [How13;Lan08]. Now let E be an elliptic curve over W with j-invariant j(E) = j(E O D ). Using the description above, we see that the reduction of E maps to the homomorphism O H → κ(p) such that the image of j(E O D ) is contained in F p , which corresponds to P.
We can now also give a formula for the Arakelov degree deg Z(m, a, µ).

An integral model for the modular curve
We recall some of the properties of the integral model for the modular curve Y 0 (N ) and its compactification X 0 (N ). These models have been intensively studied by Deligne, Rapoport [DR73], Katz and Mazur [KM85]. We refer to these references and [GZ86] for details.
The stack Y 0 (N ) (X 0 (N )) over Z represents the moduli problem that assigns to any base scheme S the cyclic isogenies of degree N of (generalized) elliptic curves π : E → E over S such that ker π meets every irreducible component of each geometric fiber. On complex points, we have Y 0 (N )(C) = Y 0 (N )(C) and X 0 (N )(C) = X 0 (N )(C).
Here, the condition that A = ker π is cyclic of degree N means that locally on S there is a point P such that as a Cartier divisor on E. This becomes the usual condition that A is locally isomorphic to Z/N Z, when N is invertible in S. We will always assume that N is square-free. In this case the condition means that A is locally free of rank N .
The cusps correspond to certain degenerated elliptic curves [DR73]. We will not give a precise definition of these as we will mostly work on the substack Y 0 (N ).
Theorem 5.1 (Theorems 1.2.1 and 3.2.7 of [Con07]). Let N be square-free. Then the stack X 0 (N ) is a proper flat Deligne-Mumford stack over Z. It is regular and has geometrically connected fibers of pure dimension one. Moreover, the stack X 0 (N ) is smooth over Z[1/N ]. 5.1. Integral extensions of Heegner divisors. The following moduli problem describes a natural extension of the divisor Z(d, r) defined in the introduction to the stack X 0 (N ). We follow [BY09], Section 7.3.
Definition 5.2. Let d ∈ Z <0 and r ∈ Z such that d ≡ r 2 mod 4N . The integer d is a negative discriminant and we denote by O d the order of k = Q( √ d) of discriminant d. The ideal n = (N, r+ √ d 2 ) has norm N . We define Z(d, r) to be the Deligne-Mumford stack representing the moduli problem which assigns to a base scheme S over Z the set of pairs (π : E → E , ι), such that (i) π : E → E is a cyclic degree N isogeny of two elliptic curves E and E over S, There is a natural morphism given by the forgetful map (π : E → E , ι) → π : E → E . Note that Z(d, r) does not intersect the boundary X 0 (N )\Y 0 (N ) [Con04]. We recall the following two facts from [BY09].
Lemma 5.4. As divisors in the complex fiber, we have The divisor Z(d, r) is in fact the flat closure of Z(d, r).
We briefly mention the relation to the Heegner points as defined by Birch [Bir75], Gross [Gro84] and Gross-Zagier [GZ86]. A Heegner point on X 0 (N )(C) is described by the data (O, n, [a]), where O ⊂ k is an order, n ⊂ O is a proper O-ideal with quotient O/n cyclic of order N and [a] is the class of some invertible O-module a in Pic(O). The Heegner point corresponding to this data is given by the diagram C/a → C/an −1 . If we choose an oriented basis (ω 1 , ω 2 ) of a, such that an −1 = (ω 1 , ω 2 /N ), then the point in X 0 (N )(C) ∼ = Γ 0 (N )\H is given by the orbit of τ = ω 1 /ω 2 [Gro84].

CM values of modular functions
The starting point for our study of CM values of modular functions with zeros and poles supported on Heegner divisors is the following Lemma. Here, we denote by E[n] the kernel of multiplication by elements in n. Combining the map j D with the forgetful map Z(D, r) → X 0 (N ) yields a map C D → X 0 (N ), still denoted j D . Note that this map also depends on the choice of r. For simplicity, we do not reflect this in the notation.
Fix D 0 , D 1 ∈ Z <0 and assume thatthey satisfy the properties of Definition 5.2. In particular, there are r 0 , r 1 ∈ Z, such that r 2 i ≡ D i mod 4N . We write n i for the corresponding ideals of norm N in O D i generated by N and r i + √ D i 2 . Moreover, assume that D 0 is a fundamental discriminant with D 0 ≡ 1 mod 4 and D 0 D 1 is not a perfect square so that Z(D 0 , r 0 ) and Z(D 1 , r 1 ) intersect properly.
Proof. This can be found in [BY09, Section 7.3]. It is clear that the described map is well defined and injective over any scheme S. In the other direction, suppose that (E, ι, φ) ∈ M(D 1 , r 1 , n 0 )(S). Then (E, ι) ∈ C D 0 (S) and (E → E/E[n 0 ], φ) ∈ Z(D 1 , r 1 )(S) by definition. Thus, we obtain maps M(D 1 , r 1 , n 0 ) → Z(D 1 , r 1 ) and M(D 1 , r 1 , n 0 ) → C D 0 . By the universal property of the fiber product, we obtain a unique mapφ that makes the following diagram commutative.
Lemma 6.3. We have the identity Proof. This is a direct consequence of Lemma 7.12 in [BY09] where the authors prove an identity on geometric points over algebraically closed fields in any characteristic. We also refer to [Ehl13] for details.
To ease the notation a bit, we continue to write D = D 0 and let ρ ∈ Z, such that ρ 2 ≡ D mod 4N (i.e. ρ = r 0 ). For a rational function f ∈ Q(X 0 (N )) we consider the pullback j * D (f | j D (C D ) ), which makes sense as long as j D (C D ) is not contained in the divisor of f . The element j * D f then defines an element of the function field Q(C D ) ∼ = Q(C D ) = H, the Hilbert class field of k D = Q( √ D). Now let f ∈ Q(X 0 (N )) be a modular function such that its divisor is a linear combination of the Heegner divisors Z(m, µ). That is, there are integers c(m, r), such that where C(f ) is supported at the boundary. We have by definition (cf. the proof of Proposition 3.7 in [Vis89]) that div(j * D f ) = j * D (div(f )). Finally, we normalize the map pr : C D → Spec O H in the following way (it is only unique up to an automorphism of O H ). We fix an embedding of H into C and the integral ideal Consider the Heegner point z D,ρ given by π : C/O D → C/n −1 . Then we require that pr is chosen such that pr * j * (f w k ) ∈ H is equal to f (z D,ρ ), where w k is the number of roots of unity in k = k D . As a point in H, we can take z D,ρ , such that its image under the Fricke involution is ∈ H, according to our remark at the end of the last section. Note that f (z D,ρ ) ∈ H defines a divisor on Spec O H given by Here, the sum is over all nonzero prime ideals of O H .
Theorem 6.4. Let D < 0 be an odd fundamental discriminant, ρ ∈ Z with ρ 2 ≡ D mod 4N and normalize pr as described above. Suppose that f ∈ Q(X 0 (N )) with where C(f ) is supported at the cusps and div(f ) and Z(D, ρ) intersect properly. Then we have for every prime P of the Hilbert class field H.
Proof. This follows directly from our considerations above and the fact that the pullback of div(f ) as a Cartier divisor (Equation (6.1)) agrees with the pullback as a Weil divisor, corrected by the multiplicity as explained above. The pullback as a Weil divisor is described in Lemma 6.3. Also note that the image of C D does not intersect the boundary.
Remark 6.5. The formulas in Proposition 4.8 and Proposition 4.9 provide explicit formulas for the quantities in Theorem 6.4.
We now recover the Theorem of Gross and Zagier on singular moduli [GZ85] and its generalization by Dorman [Dor88]. Let D be a negative fundamental discriminant and suppose that D is odd. Moreover, let d be a negative discriminant, coprime to D. As in the Introduction, consider the modular function Here, Q D is the set of quadratic forms of discriminant D and w k is the number of roots of unity in k = Q( √ D) Theorem 6.6 (Gross-Zagier, Dorman). Let H be the Hilbert class field of k = Q( √ D). Moreover, let L be the fixed field of Gal(H/k)[2], let p be a rational prime and f ⊂ O L be the prime ideal below P 0 | p (see Section 4). Then we have To conclude this section and justify the simpler version (Theorem 1) of Theorem 6.4 in the Introduction, we show that there is a rather simple criterion to decide if the divisor of a modular function on X 0 (N ) is horizontal if N is square-free. It is reflected in the classical Kronecker congruence modulo p of the modular equation of level N .
Recall that the fiber of X 0 (N ) above p N is smooth and irreducible. We write the valuation on the function field that is induced by such a fiber by ν p . For p | N , the fiber has two irreducible components that intersect at each supersingular point. The cuspidal sections ∞ and 0 always only intersect one of those two fibers. We denote by ν p,∞ the valuation on the function field of X 0 (N ) induced by the component above p that intersects the cusp ∞ and by ν p,0 the valuation corresponding to the other component.
For a modular function f ∈ Q(X 0 (N )) = Q(j, j N ), where j N (τ ) = j(N τ ), denote by the Fourier expansions of f at the cusps ∞ and 0, respectively.
Proposition 6.7. Let f ∈ Q(j, j N ) be a modular function for Γ 0 (N ) and assume that N is square-free. Let p be a prime and set a = inf{ord p c ∞ (n)} and b = inf{ord p c 0 (n)}.
(i) If p N , then a = ν p (f ).
Combining these maps with the geometric points given by q → 0 for τ ∞ and q 1/N → 0 for τ 0 , we obtain the cuspidal sections Spec(Z) → X 0 (N ) corresponding to the cusps ∞ and 0, respectively. The pullbacks τ * ∞ f and τ * 0 f of f ∈ Q(X 0 (N )) are given by the Fourier expansion of f at ∞ and 0, respectively. The valuation at p on Q((q)) and Q((q 1/N )) is given by the canonical extension of the p-adic valuation on Q. It agrees with the valuations given by a and b in the statement of the Proposition. If p N they coincide since the fiber of X 0 (N ) above p is irreducible in this case.
We refer to Theorem VI. 3.10 on page 163 and Corollary 3.12 in [DR73] for more details. Moreover, in Section 3.16, ibid., the case X 0 (p) for a prime p is discussed in more detail.

Borcherds products
We will finally sketch how to apply our results to Borcherds products on modular curves. Let N be a positive integer and consider the congruence subgroup Γ 0 (N ) ⊂ SL 2 (Z). The modular curve Y 0 (N ) := Γ 0 (N )\H can be obtained as an orthogonal modular variety as follows.
The symmetric domain D of SO V (R) ∼ = SO(2, 1) can be identified with the Grassmannian of two-dimensional positive definite subspaces of V (R). It is isomorphic to the complex upper half-plane H via The action of γ ∈ SL 2 is explicitly given by where γz is the action via linear fractional transformations on H.
In V we have the even lattice The dual lattice of L is given by Note that the discriminant group L /L is cyclic of order 2N and we can identify the corresponding finite quadratic module with the group Z/2N Z together with the quadratic form x 2 /4N , valued in 1 4N Z/Z ⊂ Q/Z. We denote by M ! k,L the space of vector valued weakly holomorphic modular forms of weight k and representation ρ L , the Weil representation associated with L.
Let f ∈ M ! 1/2,L with Fourier expansion and c f (m, µ) ∈ Z for all m ≤ 0 and all µ ∈ Z/2N Z. Borcherds [Bor98] showed that there is a meromorphic modular form on Y 0 (N ). Moreover, Ψ L (z, f ) has an infinite product expansion of the form  Proof. Since the Fourier coefficients of f have bounded denominators, replacing f by an integral multiple f = M · f we obtain only integral coefficients. We view Ψ L (z, h, f ) as a meromorphic function on X 0 (N ). The multiplier system of Ψ(z, f ) has finite order, which can be shown using the embedding trick ([Bor98, Lemma 8.1], [Bor00]). Together with the integrality of the c f (m, µ) this implies that the Fourier expansions of Ψ(z, f ) have rational coefficients at all cusps (for square-free N ). Thus, Ψ(z, M f ) for some M ∈ Z is contained in the field Q(X 0 (N )) = Q(j, j N ) by the q-expansion principle.
Theorem 7.2. Let f ∈ M ! 1/2,L (Z) be a weakly holomorphic modular form with only integral Fourier coefficients and assume that N is square-free. Suppose that the multiplier system of Ψ L (z, h, f ) is trivial. Then the divisor of the rational function defined by Ψ L (z, h, f ) on Y 0 (N ) is equal to Z(f ), the flat closure of Z(f ).
Proof. The triviality of the multiplier system implies that Ψ(z) := Ψ L (z, f ) ∈ Q(j, j N ), as we have seen. The product expansion implies that the Fourier expansion of Ψ(z) at the cusp ∞ has coprime integral coefficients under our assumption on f . Therefore, the fibers for p N cannot occur in the divisor. The Fricke involution W N is contained in GSpin V (Q) and its image belongs to SO + (L) (cf. [BO10]). We denote by σ N the image of W N in O(L /L). It acts on L /L as µ → −µ and therefore, We have that c f (m, µ) = c f (m, −µ) by the action of the center of Mp 2 (Z). Therefore, f N = f and Ψ | W N (z) = ±Ψ(z) because W 2 N = 1. This implies that the Fourier expansion of Ψ(z) at the cusp 0 has also coprime integral Fourier coefficients and the result follows by Proposition 6.7. Now let z D,ρ be the Heegner point of level N given by where we assume as usual that D < 0 is an odd fundamental discriminant. We conclude that if z D,ρ is not contained in the divisor of Ψ L (z, f ), then the prime valuations of Ψ L (z D,ρ , f ) can be obtained using Theorem 6.4.

Some numerical examples
We give some examples to illustrate and test our formula numerically. The Borcherds products discussed in Section 7 provide an easy way to generate examples if the space of obstructions S 3/2,L − is known. Here, S 3/2,L − is the space of cusp forms transforming with the Weil representation ρ L − of the lattice given by L with the negative −Q of the associated quadratic form. According to [BEF14], if N = p is prime, then S 3/2,L − = {0} if and only if the modular curve X + 0 (p) = Γ + 0 (p)\H has genus zero. Here, Γ + 0 (p) is the extension of Γ 0 (p) by the Fricke involution.
As an explicit and non-trivial example of this kind let us take N = 47. Since S 3/2,L − vanishes, there exists a weakly holomorphic modular form f of weight 1/2 with representation ρ L and principal part 1 2 q −11/188 (φ 41 + φ −41 ).
As a first example, take the CM points of discriminant −23. Theorem 6.4 easily reveals that Ψ(z, f ) is a unit in the Hilbert class field for any such point (note that it cannot be equal to 0). In fact, it is easily confirmed numerically that Ψ(z −23,27 , f ) is a root of the polynomial x 3 − x 2 + 2x − 1 with discriminant −23. Using sage, we confirmed that these roots are indeed contained in the Hilbert class field of Q( √ −23) and any of these generates the Hilbert class field over Q( √ −23) (the polynomial is irreducible and since the constant coefficient is equal to 1, the values are indeed units). To compare with the j-invariant, note that the Hilbert class polynomial for j is equal to x 3 + 3491750 x 2 − 5151296875 x + 12771880859375 and has discriminant −1 · 5 18 · 7 12 · 11 4 · 17 2 · 19 2 · 23.
To see a non-unit, we can take for instance D = −107. In this case, we evaluate at the point z −107,9 . Numerically, we obtain Ψ(z −107,9 , f ) ≈ 2.796321 . . .. This turns out to be the unique real root of x 3 − 3x 2 + 2x − 4. We consult Theorem 6.4 together with Proposition 4.10 to obtain that all prime ideals that contribute to its prime ideal factorization lie above 2. Indeed, the only non-zero contribution in the Theorem comes from n = ±7 and Diff(6/107) = {2}.
We fix the embedding of the Hilbert class field H of k = Q( √ −107) into C, such that H = k(j) and j is mapped to j(O k ) ≈ −1.297832 . . . ∈ R. Let P 0 , P 1 and P 2 be the prime ideals of H above 2 where P 0 is fixed by complex conjugation and P 1 = P 2 . Since the two primes of Q( √ −107) above 3 are both not principal, the valuation at P 0 is equal to zero by Proposition 4.10. The valuation at the other two primes turn both out to be equal to 2 · (1/4 + 1/4) = 1, which we can also confirm using sage.