{'fraction_non_alphanumeric': 0.0671590206279332, 'fraction_numerical': 0.022919925783097463, 'mean_word_length': 3.3424960505529224, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Submodule codes as spherical codes in buildings

In this paper, we give a generalization of subspace codes by means of codes of modules over finite commutative chain rings. We define the new class of Sperner codes and use results from extremal combinatorics to prove the optimality of such codes in different cases. Moreover, we explain the connection with Bruhat-Tits buildings and show how our codes are the buildings' analogue of spherical codes in the Euclidean sense.


Introduction
Let R be a finite commutative chain ring and let r ≥ 1 be such that the unique maximal ideal m of R satisfies m r−1 = 0 and m r = 0. Let π be an element of R satisfying m = Rπ and let V r be a free R-module of rank d ≥ 2. Denote by L(V r ) the collection of all R-submodules of V r and by ∂L(V r ) the boundary of L(V r ): Defining the map dist : ∂L(V r ) × ∂L(V r ) → Z by gives ∂L(V r ) the additional structure of a metric space. The last distance can be extended to the whole of L(V r ) modulo homothety; cf. Section 2. Moreover, for r = 1, one can see that dist does not coincide with the subspace metric or the injection metric on L(V 1 ); cf. [21,Section 1]. A spherical code in V r is then a subset C of ∂L(V r ) of cardinality at least 2 and its minimum distance is dist(C) = min{dist(U 1 , U 2 ) | U 1 , U 2 ∈ C, U 1 = U 2 }.
Spherical codes in V r are natural generalizations of subspace codes, though the attribute "spherical" comes from interpreting ∂L(V r ) as a sphere of modules, cf. Proposition 2.5, or a sphere in a Bruhat-Tits building, cf. Theorem 7.5. To the best of our knowledge, this is the very first instance in which spherical codes in affine buildings are studied, adding yet another item to the already long list of applications of buildings; cf. Section 7.
In the Euclidean context, spherical codes can be constructed from sphere packings [9, Section 1.2.4] and find numerous applications in the field of telecommunication. In view of the applications, it is desirable to produce sizable codes of large internal distance and small length. Optimal codes are thus codes with the "best possible" coexistence constraints on the last requirements. More precisely, it is greatly interesting to determine which spherical codes present the most favourable relationship between their length, minimum distance, and cardinality. We address and give answers to the following question: For a given integer ψ, what are the largest spherical codes C in V r with the property that dist(C) ≥ ψ?
The largest codes associated to a given minimum distance are called optimal. If ψ = 1, then there is a unique optimal code of minimum distance 1, namely ∂L(V r ): we compute its cardinality in Section 8. In general, good candidates for optimal codes are the Sperner codes that we define in Section 4 using Grassmannians of R-modules. Such codes are defined starting from the parameters (d, R, α) where ψ = 2α is taken to be even. In Theorem 4.4, we compute the cardinality and minimum distance of a Sperner code with parameters (d, R, α), yielding general bounds on the maximal size of codes of minimum distance 2α; cf. Corollary 4.5. In Section 5, we use results from extremal combinatorics to prove that Sperner codes are optimal when α = r or d = 2; cf. Theorem 5.4 and Theorem 5.6. We move on to the construction, in Section 6, of optimal codes in a subfamily of ∂L(V r ) that we investigate by means of tropical geometry. More concretely, let ∂L e (V r ) denote the collection of boundary R-submodules of V r that can be generated compatibly with a basis e = (e 1 , . . . , e d ) of V r over R, i.e. modules of the form Generalizing [15,Chapter 4], a permutation code is a spherical code in V r that is contained in ∂L e (V r ) and whose elements form one orbit under the natural action of the symmetric group Sym(d) on ∂L e (V r ). In Theorem 6.8 we give bounds on minimum distance and cardinality of a permutation code in terms of its defining parameters. In Section 7, we characterize spherical codes in V r as codes on spheres of radius r in the Bruhat-Tits building B d (K), for some choice of a discretely valued field K. Contrarily to what happens in the Euclidean context, a sphere in B d (K) is not a homogeneous space, but is rather to be thought of as the collection of boundary points of a lattice polytope and Sperner codes arise as strategically chosen subsets of the polytope's vertices.
1.1. Notation. Throughout the paper, let d ≥ 2 and r ≥ 1 denote two integers. Let R be a finite commutative chain ring with maximal ideal m generated by π and such that π r = 0, but π r−1 = 0. Write q = |R/m| for the cardinality of the residue field of R. Let V r denote a free R-module of rank d and fix e = (e 1 , . . . , e d ) to be a basis of V r over R. If r = 1, then R is a field and we simply write V = V 1 . Let 1 denote the vector (1, . . . , 1) ∈ Z d , let Sym(d) denote the symmetric group on d letters, and let J d denote the integral (d × d)-matrix with 0's on the diagonal and 1's elsewhere. Set, additionally In conclusion, for an indeterminate X, integers a ≥ b ≥ 0, and I = {i 1 , . . . , i } ⊆ Z ≥0 , put

The module distance
In this section we define an equivalence relation on the set L(V r ) of all R-submodules of V r and a distance on the collection of its equivalence classes.
Definition 2.1. Let U be an element of L(V r ). Then m U ∈ {0, . . . , r} is defined as Moreover,Ũ ∈ L(V r ) is defined to be the kernel of the map Note thatŨ is the unique maximal R-submodule of V r with the property that π m UŨ = U .
In particular, we have that U ⊆Ũ and, moreover, m U = 0 if and only ifŨ = U . As a consequence, we have that Homothety defines an equivalence relation ∼ on L(V r ) and we write for the collection of homothety classes of elements of L(V r ). Note that [V r ] = [0] has cardinality r + 1 and the cardinality of each [U ] ∈ L 0 (V r ) \ {[0]} is at most r. Moreover, it is not difficult to see that ∂L(V r ) can be identified with the collection of equivalence classes in L 0 (V r ) with exactly one element. With a slight abuse of notation, we thus write We define a metric on L 0 (V r ), which does not generalize the subspace or the injection metric; cf. [21, Section 1].
The next result gives that L 0 (V r ) equipped with dist is a metric space.

It follows from Definition
We remark that every element in L 0 (V r ) has distance at most r from [V r ], equivalently the set L 0 (V r ) can be interpreted as the ball of radius r around [V r ]: In general, for each ∈ {0, . . . , r}, we set which we call the ball of radius and the sphere of radius around [V r ], respectively.

Spherical submodule codes
In this section we define spherical codes in V r as codes of submodules and prove some initial results. For a comparison with subspace codes see for instance [21] while for a comparison with spherical codes in the Euclidean case, we refer to [15].
Recall that ∂L(V r ) is a metric space equipped with the metric dist from Section 2 via the identification in (2.3).  Proof. Let C be a spherical code in V r and let [U 1 ], [U 2 ] ∈ C. Then Lemma 2.4 yields and thus also dist(C) ≤ 2r.
A spherical code in V r could in principle equal ∂L(V r ), so a universal yet weak bound on the cardinality of a spherical code is given by |∂L(V r )|. For a precise count of the elements of ∂L(V r ) or L 0 (V r ) we refer to Section 8 via Theorem 7.5. The most interesting bounds for spherical codes come from relating dist(C) and |C|.
Since (1) and (2) are somewhat dual to each other (see also the analogous definitions in the Euclidean case [15, Section 2.3]), we will mostly be focussing on (2).
Note that, as a consequence of Proposition 2.5, if dist(C) = 2r, then N (C) = rJ s .
is a symmetric matrix with the following properties: . Then the following are equivalent: Proof. The implication (2) ⇒ (1) follows from computing n 12 = n 21 = r as in Definition 2.3, so we prove the other direction. For this, assume that dist( Then n 12 ≤ r − 1 and so Proposition 2 which yields a contradiction. The case of U 2 is analogous, so the proof is complete.

Grassmannians and Sperner codes
In this section we build spherical codes in V r starting from modules highlighted by the investigation of the Sperner property in finite abelian p-groups; cf. [30,31,34]. We remind the reader that a poset (short for partially ordered set) is a set P equipped with a partial order , i.e. a relation that is is called a chain. On the contrary, an antichain is a subset A of P whose elements are pairwise incomparable, that is a, b ∈ A =⇒ a b and b a.
Antichains will play an important role in the construction of "big codes" in this paper.

4.1.
Grassmannians and Sperner bounds. The content of this section could be presented in terms of the Sperner property, though we choose not to do so for the sake of brevity. For the purposes of this section, L(V r ) is considered as the poset of all Rsubmodules of V r , ordered by inclusion. It is clear from its definition that, for each n, the Grassmannian Gr(n, V r ) is an antichain in L(V r ) and is contained in ∂L(V r ). Moreover, when r = 1, the Grassmannian Gr(n, V ) consists of the n-dimensional subspaces of V . For more on Grassmannians, we refer to [26,Chapter 5] and references therein. Generalizing the proof of [32, Proposition 1.3.18] to V r , we have that The following is the main result of [34], which is there phrased to hold for r ≥ 3. The case where r = 1 can be found in [28,30], while the case r = 2 is given in [31,Theorem 2.7]. (1) d is even and n = e, (2) d is odd and n ∈ {e − , e + }.

Sperner codes.
In this section we define spherical codes in V r that will yield lower bounds to card(d; R; 2α) for any choice of the integer 1 ≤ α ≤ r. To this end, we fix such an α and define We will define a family of codes C that satisfy cf. Definition 4.3. Write Gr(e, π α−1 V r ) for the collection of free R/m m -submodules of π α−1 V r of rank e and note that the elements of Gr(e, π α−1 V r ) are incomparable. Moreover, We remark that a Sperner code with parameters (d; R; α) is nothing else than a collection C of free R-submodules of V r with the property that Gr(e, V r ) = {π α−1 U | U ∈ C}. An example of a Sperner code in dimension 2 is given in Figure 1.
Theorem 4.4. Let 1 ≤ α ≤ r be an integer and let C be a Sperner code with parameters (d; R; α). Then the following are satisfied: (1) C is a spherical code in V r , Proof. (1) and (3) are clear from the construction of Sperner codes, so we prove (2). For this, let U 1 , U 2 ∈ C be distinct: we claim that n 12 ≥ α. For a contradiction, assume that this is not the case. It follows that π α−1 U 1 ⊆ π n 12 U 1 ⊆ U 2 and so which contradicts the bijectivity of the map C → Gr(e, π α−1 V r ) from Definition 4.3. We have proven that n 12 ≥ α and, the choice of U 1 and U 2 being arbitrary, we have that dist(C) ≥ 2α.
The following is an immediate corollary of the last result.
As we will see in the next section, the inequality from Corollary 4.5 is an equality in some cases. We leave the following general question open.
Question 4.6. Is the inequality from Corollary 4.5 always an equality?

Extremal cases
In this section we show that Question 4.6 has a positive answer when α = r or d = 2 by showing that, in these cases, Sperner codes are optimal codes with respect to the bound given in Corollary 4.5.
5.1. Codes of maximal distance. This section is devoted to the case α = r.
Then there exists a spherical code C in V r such that the following hold: (1) |C| = |C | and dist(C ) = 2r, (2) for each U ∈ C , one has πU = U ∩ πV r .
Proof. Define C F to be the collection of all U ∈ C such that πU = U ∩ πV r . We prove, by induction on n = |C \ C F |, that there exists C satisfying (1) and (2). If n = 0, then C already satisfies (2) and we set C = C. Assume now that n > 0 and that the claim is satisfied for n − 1. Let U ∈ C be such that πU = U ∩ πV r , that is U is not a free R-submodule of V r . In view of this, let X and H be submodules of U satisfying In particular, H is isomorphic to the free part (as R-submodule) of U and both H and X are non-trivial. Set now C = (C \ {U }) ∪ {H}. It follows from π r−1 U = π r−1 H and Proposition 3.7 that C is a spherical code of minimal distance 2r. Moreover, we have C F = C F ∪{H} and C and C have the same cardinality. We are now done thanks to the induction hypothesis.
Thanks to Proposition 5.1, to compute the maximal cardinality of spherical codes of maximal distance in V r it suffices to look at free R-submodules of V r , equivalently at subsets of the sets of vertices of the ball B r as a lattice polytope; cf. Definition 7.3 and Sections 6.1 and 7.
Definition 5.2. A spherical code C in V r is called free if it satisfies Proposition 5.1(2).
Lemma 5.3. Let C be a free spherical code in V r and let U 1 , U 2 ∈ C. Then the following are equivalent: π r−1 U 1 and π r−1 U 2 are incomparable.
Proof. It follows from Proposition 3.7 that (1) is equivalent to Thanks to the fact that C is free, this translates into in other words into (2). Proof. Let C be a spherical code in V r of maximal cardinality satisfying dist(C) = 2r. Thanks to Proposition 5.1, we assume without loss of generality that C is free. Then Lemma 5.3 yields that the elements of C are in bijection with a collection of maximal size of incomparable subspaces of π r−1 V r ∼ = V . We are now done thanks to Proposition 4.2 and (4.1).

5.2.
Codes in small dimension. In this section we answer Question 4.6 when d = 2, which we assume throughout Section 5.2.
Remark 5.5. There is a number of properties that spherical codes in dimension 2 satisfy, which do not hold in general for spherical codes in higher dimension. For instance, each element of ∂L(V r ) is a free R-submodule of V r and, for every 1 ≤ α ≤ r, the family Gr(1, π α−1 V r ) from Section 4.1 forms a set of representatives for the classes in ∂ B r+1−α ([V r ]); cf. Figure 1. Write now Gr(1, π α−1 V r ) = {S 1 , . . . , S t } and, for each k ∈ {1, . . . , t}, define Then ∂L(V r ) equals the disjoint union of the ∂ k α L(V r )'s and defining a Sperner code with parameters (2; R; α) is the same as choosing one element in each ∂ k α L(V r ); cf. Figure 1. and thus minimum distance 6 is given in blue.
Proof. Thanks to Corollary 4.5, we have that so we prove the other inequality. With the notation from Remark 5.5, we have, for any k ∈ {1, . . . , t} and U, The choice of k being arbitrary, this shows that any spherical code in V r with dist(C) ≥ 2α, can contain at most one representative from each ∂ k α L(V r ). This concludes the proof.

Permutation codes
In this section, we give a possible generalization of permutation codes, as defined in [15,Chapter 4], by means of Sym(d)-orbits of R-modules with compatible generating sets. For the fixed R-basis e = (e 1 , . . . , e d ) of V r , we define L e (V r ) to be the family of R-submodules of V r that can be generated compatibly with e, in other words modules of the form The homothety relation from Section 2 respects base compatibility and so we define L 0 e (V r ) to be the subfamily of L 0 (V r ) with representatives in L e (V r ). In particular, we can model all elements of L 0 e (V r ) in terms of the Sym(d)-orbits of the set E 6.1. Tropical operations and polytropes. For the sake of conciseness we introduce here some more notation, coming from tropical geometry, and which will be used in Sections 6 and 8. For real elements a and b we set a ⊕ b = min{a, b}, a ⊕ b = max{a, b}, a b = a + b and remark that the last operations can be extended to R d componentwise. For each matrix M ∈ R d×d with 0's on the diagonal, we define moreover which is a convex polytope in R d /R1 and is called a polytrope in tropical geometry. For more on polytropes, we refer the interested reader to [11,19,20,24]. In this paper, we will only deal with polytropes like the ones in the next example. As we mention in [11,Example 13], such polytropes are called pyropes in [20] and can be seen as balls of radius r in the tropical metric [8, Section 3.3]. Recall that J d denotes the matrix in Z d×d with 0's on the diagonal and off-diagonal entries all equal to 1.

Permutation codes.
In this section we define permutation codes and give examples of such codes in connection with the theory of polytropes. In Theorem 6.8 we give sharp bounds on the minimum distance and cardinality of permutation codes in terms of their defining parameters. Definition 6.2. An e-permutation code in V r is a code of the form r . To lighten the notation, we will often write C = Sym(d) · ε for a code as in (6.2). Remark 6.3. Let δ, ε ∈ {0, . . . , r} d . Then the distance between [U δ ] and [U ε ] is given by Remark 6.4. One could replace Sym(d) with Aut(V r ) and study codes of the form Aut(V r ) · ε, that is maximal codes consisting of pairwise isomorphic R-modules. However, one can already see for d = 2 that these codes are not particularly interesting in terms of general bounds. More precisely, if d = 2, one has ∂L(V r ) = Aut(V r ) · (r, 0) = C and so dist(C) = 2 while |C| = | Gr(1, V r )| = (q + 1)q r−1 .
Of particular interest are codes that are derived from vertices of the polytrope Q(rJ d ); cf. Example 6.1. Such vertices are given by permutations of elements ε of E  describing the collection of all free R-submodules of V r that belong to L e (V r ). Note that, by its definition, each F n r is contained in ∂L(V r ) and the cardinality of F n r is equal to Example 6.5. In Figure 2, the 14 regular vertices of the polytope Q(J 4 ) are so divided: • the red vertices describe F 1 1 , • the blue vertices describe F 3 1 , • all other vertices, i.e. the yellow ones, are the elements of F 2 1 . Moreover, the red and blue vertices are the min-resp. max-vertices of the polytrope Q(J 4 ); cf. [11,Example 1,Theorem 16].
In the following results we compute cardinality and minimal distance of permutation codes. For this, We fix ε ∈ ∂E Proposition 6.6. For C = Sym(d) · ε, the following hold: and dist(C) = 2 1≤j<i≤ +1εi −ε j . . , d} such that ε h − ε k = 1≤j<i≤ +1εi −ε j and define σ to be the transposition in Sym(d) interchanging h and k. Choosing [U 2 ] to correspond to σ · ε, we get from Remark 6.3 that Corollary 6.7. Let n ∈ {1, . . . , d − 1}. Then F n r is a spherical code in V r of minimal distance 2r.
In the following result, we provide sharp bounds for minimum distance and cardinality when cardinality and minimum distance are given, respectively. Theorem 6.8. Let 1 ≤ α ≤ r be an integer and write C = Sym(d) · ε. Then the following are satisfied: (1) If r = δ + Z with δ, Z non-negative integers satisfying Z < , then dist(C) ≤ 2δ.
(2) Write r = αX + Y and d = βX + γ, for X, Y, β, γ non-negative integers satisfying Y < α and γ < X. If dist(C) = 2α, then Proof. We start by proving (1). For this, write r = δ + Z. Thanks to Proposition 6.6, maximizing the minimum distance of C is the same as maximizing the minimum η of the set {ε i −ε j | i > j}. This is clearly achieved for η = δ. We now prove (2). To this end, assume that dist(C) = 2α. Thanks to Proposition 6.6, we know that min{ε i −ε j | i > j} = α and we now need to determine ε for which |C| = d! m 1 !m 2 ! · · · m +1 ! is maximal, i.e. for which m 1 !m 2 ! · · · m +1 ! is minimal. This happens when is as large as possible and the m i 's are all roughly the same (i.e. the same or differing by 1). In view of this, = X and {m 1 , . . . , m X+1 } ⊆ {β, β + 1}. More precisely, the number of m i 's that are equal to β + 1 is γ and so Proposition 6.6 yields This concludes the proof.
It is not difficult to see, from the proof of Theorem 6.8, how one can build optimal codes in this context, i.e. permutation codes achieving the bounds from Theorem 6.8. As for the case of regular spherical codes, optimal permutation codes are not unique; cf. Section 4.2. Another thing that is worth mentioning is that optimal permutation codes are far from being optimal in the sense of Corollary 4.5. We remark that, similar bounds to those of Theorem 6.8 are proven for a different type of permutation codes in [27].

Spherical codes in Bruhat-Tits buildings
In this section we rephrase the results of this paper in terms of buildings. As we will see, Bruhat-Tits buildings are a way of talking about lattices and via these objects we can consider balls (in the sense of Section 2) "of any radius" at the same time. Moreover, it is worth mentioning that, on top of their central role in the theory of reductive groups, buildings have many different applications, cf. [7,10,14,18,23]. It should be remarked that the employment of buildings in the study and construction of codes is not new, though this seems to be the first time spherical codes in buildings are considered. For example, in the applications of flags to network coding, spherical buildings are used. Such strategy, first introduced in [23], has found further developments in [4,5,6,22] and variations in [16]. Moreover, Bruhat-Tits buildings also make their appearance in the study of holographic codes [25] as well as in the study of valued rank-metric codes [12]. 7.1. From chain rings to valued fields. We choose a discretely valued field (K, val), with valuation ring O K , uniformizer π, and unique maximal ideal m K = O K π = 0, in such a way that R ∼ = O K /m r K ; cf. [3]. With a slight abuse of notation, we set e = (e 1 , . . . , e d ) to be the standard basis of K d and we write O d K for the free O K -module We will use the bar notation for the subobjects of V r : if L ⊆ O d K , then L denotes the image of L in V r under the natural projection O d K → V r . Up to very small variations, our notation is compatible with the one from [13].

Lattices and buildings. An
while End O K (L) denotes the endomorphism ring of L as an O K -module. Note that any two homothetic lattices have the same endomorphism ring. Lattices in K d form one orbit under the natural action of GL d (K) and so it will often not be restrictive to assume (up to base change) that a given lattice L is equal to O d K . Note moreover, that each element of L(V r ) can be gotten from taking a lattice π r O d K ⊆ L ⊆ O d K and projecting it to V r : In line with the content of this paper, we define the affine building of SL d (K) via its lattice class model [2,17] and refer the interested reader to [1] for the more general description.
More generally, one could define an apartment for any frame choice in K d , cf. [13,Section 2]. Since (7.1) respects homothety classes, the new terminology allows us to consider the codes from Section 6 as one-apartment codes in buildings. 7.3. Distance and balls. The following distance was introduced in [13, Definition 3.1]. In view of Theorem 7.5, we use the same notation as in Definition 2.3.  Figure 1 represents B 5 as a subset of B 2 (Q 2 ). In the same figure, the red points constitute ∂ B 3 . For more on buildings as trees, see for instance [29].
Balls in the affine building B d (K) naturally arise as the collections of stable lattice classes of ball orders [13,Section 5] and can be modeled by means of the submodules of V r .
Theorem 7.5. The following are isometric: (1) L 0 (V r ) and B r , L 0 e (V r ) and B r ∩A, (4) ∂L e (V r ) and ∂ B r ∩A.
Proof. We show (1). To this end, we start by observing that [L] ∈ B r if and only if there exists a representative L ∈ [L] such that π r O K ⊆ L ⊆ O d K . Since Equation (7.1) respects homothety, it is clear that B r and L 0 (V r ) are in bijection via O d K → V r . We show that the distances are also compatible. For this, let π r O K ⊆ L 1 , L 2 ⊆ O d K be lattices and write U 1 = L 1 and U 2 = L 2 . Assume without loss of generality that U 1 =Ũ 1 and U 2 =Ũ 2 . Set α = dist([L 1 ], [L 2 ]) and let n 12 and n 21 be as in Definition 2.3. It follows from the definitions of U 1 and U 2 that L 1 ⊇ π n 21 L 2 ⊇ π n 21 (π n 12 L 1 ) = π n 21 +n 12 L 1 and in particular α ≤ n 12 + n 21 . Without loss of generality, let now m be a non-negative integer such that L 1 ⊇ π m L 2 ⊇ π α L 1 . Then it follows from the definitions of n 21 and n 21 that m ≥ n 21 and α − m ≥ n 12 . Moreover, we have π n 12 +n 21 L 1 ⊆ π α L 1 ⊆ π m L 2 , which in turn yields that π n 12 +n 21 −m L 1 ⊆ L 2 . It follows from the definition of n 12 that m = n 21 and thus we derive that α ≥ n 12 + n 21 . This proves (1) and so, as a consequence, also (2), (3), and (4).
In view of the last theorem, we transport Definitions 3.1 and 3.2 to the framework of Bruhat-Tits buildings.
The results from Sections 4 to 6 can now be also stated in terms of spherical codes in buildings. We close this section with a connection to an earlier paper. The following is the same as [13,Definition 5.5]. (1) π r L ⊆ L 1 , . . . , L d+1 ⊆ L, (2) for each i ∈ {1, . . . , d + 1}, one has L i /π r L ∼ = R,  The next corollary follows in a straightforward way from Definition 3.4, with the combination of Lemma 3.3, Theorem 7.5, and Proposition 7.8. Corollary 7.9. One has dist(d; R; d + 1) = 2r.

Counting elements of balls
This section is meant to add to the understanding of balls of modules, resp. balls in buildings in terms of their elements' count. The results of this section are self contained and do not explicitly extend results from previous sections.
We work here under the assumption of Section 7.1, though we do not necesarily assume that the residue field of K is finite. We leverage on results from [33], in particular its Section 3, to give a polynomial counting the lattice classes in the ball B r . More precisely, we define b (d) r (q). We do so by writing b Thanks to [33, Section 3], we finally define . Then the following hold: r , one has that b ε (X) is a monic integral polynomial of degree Proof. Without loss of generality, we assume L = O d K . Moreover, we let ε ∈ E (d) r and set That b ε (X) is a monic integral polynomial follows from [33,Equation (26)], together with (2). To show that b ε (X) has degree Ψ, note that yielding that the total degree of b ε (X) is equal to We now show that Ψ = |O d×d K : Λ ε |. For this, note that Λ ε = {A ∈ K d×d | val(A) ≥ M ε } where M ε = (m ij ) = 0 ⊕ (ε t (−ε)); cf. [11,Section 3]. Set (i 0 , i +1 ) = (0, d). It follows that the index of Λ ε in O d×d K satisfies log q |O d×d K : Λ ε | = 1≤i,j≤d Let now m ∈ {1, . . . }. As a consequence of (8.1), the coefficient of r im in the expression of log q |O d×d K : Λ ε | is equal to 1≤s≤m<t≤ +1 The choice of m being arbitrary, we obtain log q |O d×d K : Λ ε | = Ψ.
It follows from Proposition 8.1(1) that Proof. We prove (2). To this end, write d = 2k + 1 and define the subset S of E (d) r to consist of all elements ε satisfying Then S has cardinality r + 1. Let moreover, S − and S + denote the subsets of E (d) r of those elements that are smaller resp. bigger than elements in S, with respect to the lexicographic order. Then E (d) r equals the disjoint union S − ∪ S ∪ S + . Let now ε ∈ E (d) r and ε * ∈ S. If ε ∈ S − , then Lemma 8.4(2) yields that deg b ε (X) < deg b ε * (X). Moreover, Lemma 8.4 (2) also ensures that, if ε ∈ S, then deg b ε (X) = deg b ε * (X). Assume now that ε ∈ S + : we claim that deg b ε (X) > deg b ε * (X). To this end, define ε = rev(r1 − ε) and note that ε ∈ S − . Now deg b ε (X) > deg b ε * (X) thanks to Lemma 8.4(1) and so we conclude thanks to Proposition 8.1 (1).
To prove (1), one can proceed in an analogous way by defining S to be the singleton consisting of the vector whose first d/2 entries are equal to r and all others are 0.