Local to global principle for expected values

This paper constructs a new local to global principle for expected values over free $\mathbb{Z}$-modules of finite rank. In our strategy we use the same philosophy as Ekedhal's Sieve for densities, later extended and improved by Poonen and Stoll in their local to global principle for densities. We show that under some additional hypothesis on the system of $p$-adic subsets used in the principle, one can use $p$-adic measures also when one has to compute expected values (and not only densities). Moreover, we show that our additional hypotheses are sharp, in the sense that explicit counterexamples exist when any of them is missing. In particular, a system of $p$-adic subsets that works in the Poonen and Stoll principle is not guaranteed to work when one is interested in expected values instead of densities. Finally, we provide both new applications of the method, and immediate proofs for known results.


Introduction
Let Z be the set of integers and d be a positive integer. The problem of computing the "probability", that a randomly chosen element in Z d has a certain property, has a long history dating back to Cesáro [2,3].
Since no uniform probability distribution exists over Z, one introduces the notion of density. The density of a set T ⊂ Z d is defined to be if the limit exists. Density results over Z d have received a great deal of interest recently [4,5,6,7,8,9,10,12,13,14,16,17,18,19,22,24].
In [20,Lemma 20] Poonen and Stoll show that the computation of densities of many sets S ⊆ Z d defined by local conditions (in the p-adic sense) can be reduced to measuring the corresponding subsets of the p-adic integers. This technique is an extension of Ekedahl's Sieve [23]. An even more general result is [1,Proposition 3.2]. The general philosophy is that, under some reasonable assumptions, one should be able to treat the p-adic measures of infinitely many sets U p ⊆ Z d p independently when one looks at the density of the corresponding set p∈P U C p ∩ Z d over the integers. In [11] the authors computed the expected number of primes, for which an Eisenstein-polynomial satisfies the criterion of Eisenstein. In this paper we prove that this is a special case of a much more general principle that allows to compute expected values from p-adic measures of nicely chosen systems of p-adic sets. In fact, in this article we focus on extending the method by Poonen and Stoll to compute expected values of the "random variable" that counts how many times an element is expected to be in one of the U p 's. First, we show that the hypothesis of Poonen and Stoll is not sufficient to guarantee a local to global principle for expected values (see Example 12). This led us to add two additional hypotheses on the system (U p ) p∈P , that appears in the Poonen and Stoll principle, in order to prove Theorem 13, the main theorem of this article. The additional hypotheses we require are sharp and necessary, as examples 15 and 16 show.
With this extension to the local to global principle one can for example compute for non-coprime m-tuples of integers how many prime factors they have in common on average, or for rectangular non-unimodular matrices how many primes divide all the basic minors on average, and of course also the result of [11] follows directly.
The paper is organized as follows: in Section 2 we will recall the local to global principle by Poonen and Stoll. In Section 3 we will introduce the definition of expected value of a system of (U ν ) ν∈M Q and then state and prove Theorem 13, the main theorem of this paper.
In Section 4 we give some applications of our main theorem that allow very fast computations of expected values over Z d (see for example [11] compared with Corollary 18).

Preliminaries
if the limit exists. Then one defines the upper densityρ and the lower density ρ equivalently with the lim sup and the lim inf respectively.
For convenience, let us restate here the lemma of Poonen and Stoll in [20,Lemma 20]. If S is a set, then we denote by 2 S its powerset and by S C its complement. Let P be the set of primes and M Q = {∞} ∪ P be the set of all places of Q, where we denote by ∞ the unique archimedean place of Q. Let µ ∞ denote the Lebesgue measure on R d and µ p the normalized Haar measure on Z d p . For T a subset of a metric space, let us denote by ∂(T ) its boundary, by T its closure and by T • its interior. By R ≥0 we denote the non-negative reals. A minor of a matrix A is called basic, if it is the nonzero determinant of a square submatrix of A of maximal order.
For each prime p, let U p ⊂ Z d p , such that µ p (∂(U p )) = 0 and define s p = µ p (U p ). Define the following map If the following is satisfied: ii) For S ⊂ 2 M Q , ρ(P −1 (S)) exists, and defines a measure on 2 M Q .
iii) For each finite set S ∈ 2 M Q , we have that and if S consists of infinite subsets of 2 M Q , then ρ(P −1 (S)) = 0.
To show that (2.1) is satisfied, one can often apply the following useful lemma, that can be deduced from the result in [23].

The local to global principle for expected values
Observe, that in Theorem 2 one could always choose the finite set S to be the empty set, which for our purpose will be convenient.
Corollary 4. For all ν ∈ M Q let U ν be chosen as in Theorem 2, corresponding to a finite set S ∈ 2 M Q . Let us define and hence and define where P is the map as in The proof is straightforward and thus we omit the details. For a fixed ν ∈ M Q and U ν as in Theorem 2, the density of U ν ∩ Z d can be computed as follows.
Corollary 5. Let ν ∈ M Q and U ν be chosen as in Theorem 2, then and let We observe, that the elements A ∈ Z d , which are in U ν for infinitely many ν ∈ M Q have density zero.
Over Z d one can give a definition of mean or expected value (see for example [11]), as we will now explain. Observe, that an event with "probability" zero should not have any influence on the expected value, this legitimates that over Z d we will exclude the elements A ∈ Z d , which are in infinitely many U ν , namely Let H and d be positive integers and assume that (U ν ) ν∈M Q satisfy the assumptions of Theorem 2, then we define the expected value of the system This limit essentially gives the expected value of the number of places ν, such that a "random" element in Z d is in U ν .
Remark 8. The reader should notice that the mean of the system (U ν ) ν∈M Q should be thought as the "expected value" of the function a → |P (a)|, where P is the map of Theorem 2.
. Definition 9. For a set T , for which we can compute its density via the local to global principle as in Theorem 2, we say that a system ( Observe that we can restrict Definition 7 to subsets of [−H, H[ d I , i.e., we define the expected value of the system if it exists. Note, that this is analogous to the conditional expected value. Remark 10. If (U ν ) ν∈M Q corresponds to T , then the expected value of the system (U ν ) ν∈M Q restricted to T should be thought as the "expected value" of the function a → |P (a)|, where P is the map of Theorem 2, when restricted to the elements a of Z d such that |P (a)| ≥ 1.
One can easily pass from µ to µ T and viceversa: Lemma 11. If the density of T exists and is nonzero and T is such that T C ⊆ P −1 ({∅}), then µ exists iff µ T exists. Furthermore, in that case it holds that µ = µ T ρ(T ).
Proof. We observe that Let us define Since T C ⊆ P −1 ({∅}), it holds that τ (A, ν) = 0 for all A ∈ T C and hence we are left with µ.
In the applications of this paper one usually chooses T C = P −1 ({∅}), and computes the expected value restricted to T . This is a natural choice, since by the definition of T C it holds that none of its elements lie in any of the U ν , thus we are only considering the subset T , where nonzero values are added to the expected value.
One would now expect that, if the p-adic measures of the U p 's of Theorem 2 were essentially behaving like probabilities, one would have that the mean of the system (U p ) p∈P (as as defined in Definition 7) would be equal to p∈P s p , since the density of U p ∩ Z d is equal to s p (for example, this always happens when one has U p = ∅ for all but finitely many U p 's). Note that this would also be the result if we could simply move the limit inside the series. This is not the case: in fact, Condition (2.1) of Theorem 2, is not enough to ensure the existence of the mean as in the natural Definition 7. The next example shows a case where Condition (2.1) is verified, but the mean does not exist.
Example 12. We set U ∞ = ∅ and for all j ∈ N with 2 n ≤ j < 2 n+1 we define U p j = {2 n }, where p j denotes the jth prime number. As Z p with the p-adic metric is a metric space, we get that U p j is a closed set and thus Borel-measurable, of measure zero. Furthermore, every ball in the p-adic metric contains infinitely many elements, which implies ∂( As the p-adic Haar measure is invariant under translation and normalized, we get that all finite sets are null sets. In particular, we get µ p j (∂(U p j )) = 0. Furthermore, we have Hence, Condition (2.1) is satisfied, even without taking the limit in M . Let n ∈ N, then for 2 n ≤ H < 2 n+1 we have Hence, the expected value of the system (U ν ) ν∈M Q does not exist, even though it satisfies all conditions of Theorem 2. Now we state the main theorem, which is a local to global principle for expected values, extending the results in [20,Lemma 20].
For each prime p, let U p ⊂ Z d p , such that µ p (∂(U p )) = 0 and define s p = µ p (U p ). Define the following map P : If ( then it follows that the mean of the system (U ν ) ν∈M Q , exists and is given by: We are going to show that for j ∈ {1, 2} we have First we consider the case α = 0. Let us define for H > 0 and A ∈ Z d Notice that thanks to condition (3.1) there exists a constant c > 0 independent of A and H such that Therefore, we get where the last equality follows from Condition (2.1). Using A natural question is whether some of the conditions in Theorem 13 are redundant. This is not the case as the next two examples show.
Example 15. In this example, we construct (U ν ) ν∈M Q such that Conditions (3.1) and (2.1) are verified but the conclusion of Theorem 13 does not hold. As in Example 12, we denote by p j the jth prime. We choose The same argument as in Example 12 shows that µ p j (∂(U p j )) = 0. By the prime number theorem we have that P has density zero and thus our choice satisfies Condition (2.1) even without taking the limit in M .
Note that for p j > H > 0 we have U p j ∩ [−H, H[= ∅ and thus Condition (3.1) is satisfied with c = 1 = m. Now we will show that the conclusion of the theorem does not hold. First we show that µ = ∞, if the limit exists. Note that for this example Hence, for L sufficiently large we get Thus, using the prime number theorem, we obtain lim sup As noted above, all finite sets are null sets for the p-adic Haar measure. Thus, we have s p = 0 for all p ∈ P and s ∞ = 1 2 µ ∞ (∅) = 0 and hence This means the conclusion of the theorem does not hold, if we only assume Conditions (2.1) and (3.1).
Example 16. Next we construct an example that satisfies Conditions (2.1), (3.2), (3.3), and we show that the conclusion of the theorem does not hold. We set U ∞ = ∅ and for p ∈ P \{p 2 n | n ∈ N} we define U p = ∅. Inductively, we define the remaining U p 2 n . We start with U p 1 = {1}. If U p 2 n = {m 2 } for m ∈ N, then we define The same argument as for Example 12 applies here and gives µ p j (∂(U p j )) = 0. We compute if n = 2 k for some k ∈ N, 0 otherwise.
By the prime number theorem, there exists some constant D > 0, such that Thus, conditions (3.2) and (3.3) are satisfied. By construction, we have Therefore, we get Hence, lim sup On the other hand, by the same argument as in the previous example we obtain ν∈M Q s ν = 0.

Applications
We can apply Theorem 13 to sets, whose densities were computed via the local to global principle of Theorem 2 and fulfill Conditions (3.1), (3.2) and (3.3).
For example we can compute the expected number of common prime divisors of all basic minors of a rectangular non-unimodular matrix. The rigorous statement reads as follows.
Corollary 17. Let n < m be positive integers, and let us denote by R the set of rectangular unimodular matrices in Z n×m . Then the corresponding system (U ν ) ν∈M Q is given as in [18], i.e., U ∞ = ∅ and for p ∈ P denote by U p the set of all matrices in Z n×m p whose n-minors are all divisible by p. Then the expected value of the system (U ν ) ν∈M Q exists and is given by And the average number of primes that divide all n-minors of a rectangular nonunimodular matrix is given by Proof. Recall from [18], that all conditions of Theorem 2 are satisfied for the corresponding system (U ν ) ν∈M Q , that for p ∈ P we have that Thanks to Lemma 11 we are left with proving that the additional assumptions on the system (U ν ) ν∈M Q of Theorem 13 are satisfied.
For this, let us choose α = 1 and denote by f i the function associating to A ∈ Z n×m some fixed n-minor.