1 Introduction

The codes studied in this paper can be viewed as a bridge of generalization between two worlds, that of subspace codes and that of spherical codes. More specifically our codes consist of equivalence classes of modules over finite commutative chain rings, which can be interpreted at the same time as subsets of spheres in Bruhat–Tits buildings. In this introduction we will take a first glance at these connections and present the main questions that will be addressed in this document.

1.1 Spherical codes in the euclidean setting

Spherical codes in \(\mathbb {R}^d\), equipped with the usual distance, are finite subsets of the unit sphere

$$\begin{aligned} {{\,\textrm{B}\,}}_1=\{x=(x_1,\ldots ,x_d)\in \mathbb {R}^{d} \mid x_1^2+\cdots +x_d^2=1\}. \end{aligned}$$

In this context, spherical codes can be constructed from sphere packings [14, 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. Already for the small length value \(d=3\), however, the last problem turns out to be very hard and not all optimal codes are classified; cf. [21, Section 3.3]. For a broad overview of spherical codes in this setting we refer the interested reader to [21].

1.2 Chain rings in coding theory

Let R be a commutative ring, which we assume to be unital. The ring R is said to be a chain ring if all of its ideals form a chain, i.e. if I and J are ideals of R, then \(I\subseteq J\) or \(J\subseteq I\). In this paper, only the case of commutative chain rings will be considered, though their definition extends also to the non-commutative case; cf. [26, Section 2]. Examples of finite commutative chain rings include

  1. (1)

    \(\mathbb {Z}/p^r\mathbb {Z}\), where p is a prime number and r a positive integer, and

  2. (2)

    \((\mathbb {Z}/p^m\mathbb {Z})[x]/(f(x))\), where p is a prime number, m a positive integer, and f a monic polynomial that is irreducible modulo p.

For more on the classification of finite commutative chain rings we refer to [3, 12, 27]. In the present paper, we are mostly interested in viewing R as a quotient of a discrete valuation ring \(\mathcal {O}_K\) by a power \(\mathfrak {m}_K^r\) of its unique maximal ideal \(\mathfrak {m}_K\), e.g. \(\mathcal {O}_K\) equals the p-adic integers \(\mathbb {Z}_p\) or the ring \(\mathbb {F}_q[[t]]\) of formal power series with nonnegative integer exponents and coefficients in the field \(\mathbb {F}_q\). As can be found for instance in [26, Section 2], finite chain rings are local and their unique maximal ideal \(\mathfrak {m}\) is principal. Moreover, if \(\pi \) generates \(\mathfrak {m}\), then every ideal of R is generated by a nonnegative power of \(\pi \). Since R is finite, there exists a minimal positive integer r, called the nilpotency class of \(\mathfrak {m}\), with the property that \(\mathfrak {m}^r=0\), equivalently that \(\pi ^r=0\). In addition, an elementary divisor type theorem holds for finitely generated modules over chain rings. There are several applications of finite chain rings in coding theory including linear codes [8, 26, 33] and cyclic codes [11, 15, 24, 38], though to this author’s best knowledge the consideration of codes consisting of modules over finite chain rings does not appear anywhere in the literature.

1.3 Spherical codes of modules

Let R be a finite commutative chain ring and let \(r\ge 1\) be such that the unique maximal ideal \(\mathfrak {m}\) of R satisfies \(\mathfrak {m}^{r-1}\ne 0\) and \(\mathfrak {m}^r=0\). Let \(\pi \in R\) satisfy \(\mathfrak {m}=R\pi \) and let \(V_r\) be a free R-module of rank \(d\ge 2\), that is \(V_r\cong R^d\). Write \(\mathcal {L}(V_r)\) for the set of all R-submodules of \(V_r\) and \(\partial \mathcal {L}(V_r)\) for the boundary of \(\mathcal {L}(V_r)\):

$$\begin{aligned} \partial \mathcal {L}(V_r)=\{U\in \mathcal {L}(V_r) \mid \pi ^{r-1}V_r\not \subseteq U\not \subseteq \pi V_r\}. \end{aligned}$$

Defining the map \({{\,\textrm{dist}\,}}:\partial \mathcal {L}(V_r)\times \partial \mathcal {L}(V_r)\rightarrow \mathbb {Z}\) by

$$\begin{aligned} (U_1,U_2)\mapsto {{\,\textrm{dist}\,}}(U_1,U_2)=\min \{m\in \mathbb {Z}_{\ge 0} \mid \pi ^{m}U_1\subseteq U_2\}+\min \{n\in \mathbb {Z}_{\ge 0} \mid \pi ^{n}U_2\subseteq U_1\} \end{aligned}$$

gives \(\partial \mathcal {L}(V_r)\) the additional structure of a metric space. The last distance can be extended to the whole of \(\mathcal {L}(V_r)\) modulo homothety; cf. Sect. 2. Moreover, for \(r=1\), one can see that \({{\,\textrm{dist}\,}}\) does not coincide with the subspace metric or the injection metric on \(\mathcal {L}(V_1)\); cf. [30, Section 1]. A spherical code in \(V_r\) is then a subset \({{\,\mathrm{\mathcal {C}}\,}}\) of \(\partial \mathcal {L}(V_r)\) of cardinality at least 2 and its minimum distance is

$$\begin{aligned} {{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})=\min \{{{\,\textrm{dist}\,}}(U_1,U_2)\mid U_1,U_2\in {{\,\mathrm{\mathcal {C}}\,}},\, U_1\ne U_2\}. \end{aligned}$$

Spherical codes in \(V_r\) are natural generalizations of subspace codes, though the attribute “spherical” comes from interpreting \(\partial \mathcal {L}(V_r)\) as a sphere of modules, cf. Proposition 2.6. In this manuscript, we address and give answers to the following question:

$$\begin{aligned}{} & {} { For \; a \; given\; integer \; } \psi ,{ \; what\; are\; the\; largest \; spherical \; codes \; } \mathcal {C} { in } V_r \\{} & {} \quad {\; with\; the \; property\; that\; } {{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\ge \psi ? \end{aligned}$$

The largest codes associated to a given minimum distance are called optimal. If \(\psi =1\), then there is a unique optimal code of minimum distance 1, namely \(\partial \mathcal {L}(V_r)\): we compute its cardinality in Sect. 8. In general, good candidates for optimal codes are the Sperner codes that we define in Sect. 4 using Grassmannians of R-modules. Such codes are defined starting from the parameters \((d, R,\alpha )\) where \(\psi =2\alpha \) is taken to be even. In Theorem 4.5, we compute the cardinality and minimum distance of a Sperner code with parameters \((d,R,\alpha )\), yielding general bounds on the maximal size of codes of minimum distance \(2\alpha \); cf. Corollary 4.6. In Sect. 5, we use results from extremal combinatorics to prove that Sperner codes are optimal when \(\alpha =r\) or \(d=2\); cf. Theorems 5.4 and 5.6. We move on to the construction, in Sect. 6, of optimal codes in a subfamily of \(\partial \mathcal {L}(V_r)\) indexed by tuples of positive integers. More concretely, let \(\partial \mathcal {L}_\textbf{e}(V_r)\) denote the collection of boundary R-submodules of \(V_r\) that can be generated compatibly with a basis \(\textbf{e}=(e_1,\ldots ,e_d)\) of \(V_r\) over R, i.e. modules of the form

$$\begin{aligned} U=R\pi ^{\delta _1}e_1\oplus \cdots \oplus R\pi ^{\delta _d}e_d, where 0\le \delta _i\le r,\ \{0,r\}\subseteq \{\delta _1,\ldots ,\delta _d\}. \end{aligned}$$

Generalizing [21, Chapter 4], a permutation code is a spherical code in \(V_r\) that is contained in \(\partial \mathcal {L}_\textbf{e}(V_r)\) and whose elements form one orbit under the natural action of the symmetric group \({{\,\textrm{Sym}\,}}(d)\) on \(\partial \mathcal {L}_\textbf{e}(V_r)\). In Theorem 6.9 we give bounds on minimum distance and cardinality of a permutation code in terms of its defining parameters.

1.4 The connection to Bruhat–tits buildings

Write \(R=\mathcal {O}_K/\mathfrak {m}_K^r\) and consider the natural projection \(\mathcal {O}_K^d\rightarrow R^d\cong V_r\). Via the last map we identify every submodule of \(V_r\) with the unique maximal free \(\mathcal {O}_K\)-submodule of \(\mathcal {O}_K^d\) mapping to it. Such a module is called a lattice in \(K^d\). The collection of lattices in \(K^d\), considered up to homothety, forms the collection of 0-simplices of the Bruhat–Tits Building \(\mathcal {B}_d(K)\) of \({{\,\textrm{SL}\,}}_d(K)\). In this infinite simplicial complex, s-simplices are given by chains \(L_1\supset L_2\supset \cdots \supset L_s\supset \pi L_1\) of lattices and maximal simplices all have size d. Transporting \({{\,\textrm{dist}\,}}\) from the module setting to the buildings context (see Sect. 7.3) via the above projection, one can then interpret \(\partial \mathcal {L}(V_r)\) as a sphere \(\partial {{\,\textrm{B}\,}}_r\) in \(\mathcal {B}_d(K)\), cf. Theorem 7.6, and thus spherical codes in \(V_r\) as spherical codes in \({{\,\textrm{B}\,}}_r\). 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. Sect. 7. In our closing Sect. 8 we give formulas and asymptotics for the number of elements in a ball of radius r in \(\mathcal {B}_d(K)\); cf. Theorem 8.5. As a consequence, we derive densities of spherical codes in analogy to the ones found in [10] for linear codes over finite chain rings.

1.5 A note on the underlying geometry and combinatorics

Contrarily to what happens in the Euclidean context, a sphere in \(\mathcal {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. As we deal with a discrete set, it is interesting and important to understand how the number of elements of \(\partial {{\,\textrm{B}\,}}_r\) depends on the size q of the residue field of K. This count and its asymptotic behaviour has been included in Sect. 8 as it seemed not to be explicitly available in the literature already. The count is much easier and independent of q when one restricts to the analogue \(\partial {{\,\textrm{B}\,}}_r\cap \mathcal {A}\) of \(\mathcal {L}_\textbf{e}(V_r)\) in the building. Indeed, in such case we are considering a slice of \(\partial {{\,\textrm{B}\,}}_r\) by an affine d-dimensional space resulting in a polytope that is both convex in the usual and in the tropical sense; cf. Sect. 6.

1.6 Notation

Throughout the paper, let \(d\ge 2\) and \(r\ge 1\) denote two integers. Let R be a finite commutative chain ring with maximal ideal \(\mathfrak {m}\) generated by \(\pi \) and such that \(\pi ^r=0\), but \(\pi ^{r-1}\ne 0\). Write \(q=|R/\mathfrak {m}|\) for the cardinality of the residue field of R. Let \(V_r\) denote a free R-module of rank d and fix \(\textbf{e}=(e_1,\ldots ,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 \(\textbf{1}\) denote the vector \((1,\ldots ,1)\in \mathbb {Z}^d\), let \({{\,\textrm{Sym}\,}}(d)\) denote the symmetric group on d letters, and let \(J_d\) denote the integral \((d\times d)\)-matrix with 0’s on the diagonal and 1’s elsewhere. Set, additionally

$$\begin{aligned} \mathcal {E}_r^{(d)}&=\{\varepsilon =(\varepsilon _1,\ldots ,\varepsilon _{d-1},\varepsilon _d=0)\in \mathbb {Z}^d \mid r\ge \varepsilon _1\ge \cdots \ge \varepsilon _{d-1}\ge 0\}, \\ \partial \mathcal {E}_r^{(d)}&=\{\varepsilon =(\varepsilon _1=r,\varepsilon _2,\ldots ,\varepsilon _{d-1},\varepsilon _d=0)\in \mathbb {Z}^d \mid r\ge \varepsilon _2\ge \cdots \ge \varepsilon _{d-1}\ge 0\}. \end{aligned}$$

In conclusion, for an indeterminate X, integers \(a\ge b\ge 0\), and \(I=\{i_1,\ldots ,i_{\ell }\}\subseteq \mathbb {Z}_{\ge 0}\), put

$$\begin{aligned} \left( {\begin{array}{c}a\\ b\end{array}}\right) _X&= \prod _{i=0}^{b-1}\frac{1-X^{a-i}}{1-X^{b-i}} \ \ and \ \ \left( {\begin{array}{c}d\\ I\end{array}}\right) _X = \left( {\begin{array}{c}d\\ i_{\ell }\end{array}}\right) _X\left( {\begin{array}{c}d\\ i_{\ell -1}\end{array}}\right) _X\cdots \left( {\begin{array}{c}d\\ i_{1}\end{array}}\right) _X. \end{aligned}$$

2 The module distance

In this section we define an equivalence relation on the set \(\mathcal {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 \(\mathcal {L}(V_r)\). Then \(m_U\in \{0,\ldots ,r\}\) is defined as

$$\begin{aligned} m_U= \max \{0\le m\le r\mid U\subseteq \pi ^mV_r\}. \end{aligned}$$

Moreover, \({\tilde{U}}\in \mathcal {L}(V_r)\) is defined to be the kernel of the map

$$\begin{aligned}V_r\longrightarrow V_r/U, \quad x\longmapsto \pi ^{m_U}x+U.\end{aligned}$$

Note that \({\tilde{U}}\) is the unique maximal R-submodule of \(V_r\) with the property that \(\pi ^{m_U}{\tilde{U}}=U\). In particular, we have that \(U\subseteq {\tilde{U}}\) and, moreover, \(m_U=0\) if and only if \({\tilde{U}}=U\). As a consequence, we have that

$$\begin{aligned} \partial \mathcal {L}(V_r)&= \{U\in \mathcal {L}(V_r) \mid \pi ^{r-1}V_r\not \subseteq U\not \subseteq \pi V_r\} \end{aligned}$$
(2.1)
$$\begin{aligned}&\subseteq \{ U\in \mathcal {L}(V_r) \mid {\tilde{U}}=U\}. \end{aligned}$$
(2.2)

Definition 2.2

Modules U and \(U'\) in \(\mathcal {L}(V_r)\) are homothetic whenever \({\tilde{U}}=\tilde{U'}\).

Homothety defines an equivalence relation \(\sim \) on \(\mathcal {L}(V_r)\) and we write

$$\begin{aligned} \mathcal {L}^0(V_r)=\ {\mathcal {L}(V_r)}/{\sim }\ = \{\,[U]=\{U'\in \mathcal {L}(V_r) \mid {\tilde{U}}=\tilde{U'}\} \mid U\in \mathcal {L}(V_r)\} \end{aligned}$$

for the collection of homothety classes of elements of \(\mathcal {L}(V_r)\). Note that \([V_r]=[0]\) has cardinality \(r+1\) and the cardinality of each \([U]\in \mathcal {L}^0(V_r)\setminus \{[0]\}\) is at most r. Moreover, it is not difficult to see that \(\partial \mathcal {L}(V_r)\) can be identified with the collection of equivalence classes in \(\mathcal {L}^0(V_r)\) with exactly one element. With a slight abuse of notation, we thus write

$$\begin{aligned} \partial \mathcal {L}(V_r)=\{[U]\in \mathcal {L}^0(V_r) \mid [U]=\{U\}\}. \end{aligned}$$
(2.3)

We define a metric on \(\mathcal {L}^0(V_r)\), which does not generalize the subspace or the injection metric; cf. [30, Section 1].

Definition 2.3

Let \([U],[U_1],[U_2] \in {{\mathcal {L}}}^0(V_r)\) denote homothety classes of modules. Define

$$\begin{aligned} n_{12}&=\min \{m\in \mathbb {Z}_{\ge 0} \mid \pi ^{m}\tilde{U_1}\subseteq \tilde{U_2}\} and \\ n_{21}&=\min \{n\in \mathbb {Z}_{\ge 0} \mid \pi ^{n}\tilde{U_2}\subseteq \tilde{U_1}\}. \end{aligned}$$

Then the distance between \([U_1]\) and \([U_2]\) is

$$\begin{aligned} {{\,\textrm{dist}\,}}([U_1],[U_2])= n_{12}+n_{21} . \end{aligned}$$

For a subset \({{\mathcal {M}}} \subseteq {{\mathcal {L}}}^0(V_r)\), put \({{\,\textrm{dist}\,}}([U],{{\mathcal {M}}} ) = \min \{{{\,\textrm{dist}\,}}([U],[U']) \mid [U']\in \mathcal {M} \}\).

The next result gives that \(\mathcal {L}^0(V_r)\) equipped with \({{\,\textrm{dist}\,}}\) is a metric space.

Lemma 2.4

The map \({{\,\textrm{dist}\,}}:\mathcal {L}^0(V_r)\times \mathcal {L}^0(V_r)\rightarrow \mathbb {Z}\) is a distance.

Proof

We only show that the triangle inequality holds, as the other defining properties are clear. For this, let \([U_1],[U_2],[U_3]\in \mathcal {L}^0(V_r)\) and, for \(i,j=1,2,3\), let \(n_{ij}\) be as in Definition 2.3. It follows from their definitions that

$$\begin{aligned} \pi ^{n_{13}}\tilde{U_1}\subseteq \tilde{U_3}, \quad \pi ^{n_{32}}\tilde{U_3}\subseteq \tilde{U_2}, \quad \pi ^{n_{23}}\tilde{U_2}\subseteq \tilde{U_3}, \quad \pi ^{n_{31}}\tilde{U_3}\subseteq \tilde{U_1}, \end{aligned}$$

and so the minimalities of \(n_{12}\) and \(n_{21}\) yield

$$\begin{aligned} n_{12}\le n_{13}+n_{32} and n_{21}\le n_{23}+n_{31}. \end{aligned}$$

It follows from Definition 2.3 that \({{\,\textrm{dist}\,}}([U_1],[U_2])\le {{\,\textrm{dist}\,}}([U_1],[U_3])+{{\,\textrm{dist}\,}}([U_2],[U_3])\). \(\square \)

We remark that every element in \(\mathcal {L}^0(V_r)\) has distance at most r from \([V_r]\), equivalently the set \(\mathcal {L}^0(V_r)\) can be interpreted as the ball of radius r around \([V_r]\):

$$\begin{aligned} \mathcal {L}^0(V_r)={{\,\textrm{B}\,}}_r([V_r])=\{ [U]\in \mathcal {L}^0(V_r) \mid {{\,\textrm{dist}\,}}([U],[V_r])\le r \}. \end{aligned}$$
(2.4)

In general, for each \(\ell \in \{0,\ldots ,r\}\), we set

$$\begin{aligned} {{\,\textrm{B}\,}}_\ell ([V_r])&=\{[U]\in \mathcal {L}^0(V_r) \mid {{\,\textrm{dist}\,}}([U],[V_r])\le \ell \} and \\ \partial {{\,\textrm{B}\,}}_\ell ([V_r])&=\{[U]\in \mathcal {L}^0(V_r) \mid {{\,\textrm{dist}\,}}([U],[V_r])= \ell \}, \end{aligned}$$

which we call the ball of radius \(\ell \) and the sphere of radius \(\ell \) around \([V_r]\), respectively.

Example 2.5

Assume that \(R=\mathbb {Z}/32\mathbb {Z}\), in which case the maximal ideal of R is generated by \(\pi =2\) and \(r=5\). Figure 1 illustrates the elements of \(\mathcal {L}^0(V_5)\): in this picture two elements are joined by an edge if they have distance 1. We look concretely at some of the elements of \(\mathcal {L}^0(V_5)\) and at the distances between them.

If U is the R-submodule generated by \(4e_1\) and \(8e_2\), then \(m_U=2\) and \({\tilde{U}}\) is generated by \(e_1\) and \(2e_2\). Writing \(\langle X\rangle \) for the R-submodule of \(V_5\) generated by \(X\subseteq V_5\), the tilde representatives of the classes in \({{\,\textrm{B}\,}}_1(V_5)\) are

$$\begin{aligned} V_5, \quad U_1=\langle e_1,2e_2\rangle , \quad U_2=\langle 2e_1,e_2\rangle , \quad U_3=\langle e_1+e_2, 2e_1\rangle \end{aligned}$$

while \(\partial {{\,\textrm{B}\,}}_1(V_5)=\{[U_1],[U_2],[U_3]\}\). Note that \(\partial {{\,\textrm{B}\,}}_1(V_5)\) is in 1-to-1 correspondence with \(\mathbb {P}(V_5/2V_5)\), i.e. the elements of \(\partial {{\,\textrm{B}\,}}_1(V_5)\) can be interpreted as lines in the 2-dimensional vector space \(V_5/2V_5\). Setting now \(\ell =2\), we find the representatives of \(\partial {{\,\textrm{B}\,}}_2(V_5)\):

$$\begin{aligned} U_{11}=\langle e_1,4e_2\rangle , \quad U_{12}=\langle e_1+2e_2,4e_2\rangle , \quad U_{21}=\langle e_2,4e_1\rangle , \quad U_{22}=\langle 2e_1+e_2,4e_1\rangle , \\ U_{31}=\langle e_1+e_2,4e_1\rangle , \quad U_{32}=\langle e_1+3e_2,4e_1\rangle . \end{aligned}$$

In the following table we collect the distances within \({{\,\textrm{B}\,}}_2(V_5)\):

 

1

2

3

11

12

21

22

31

32

1

0

2

2

1

1

3

3

3

3

2

 

0

2

3

3

1

1

3

3

3

  

0

3

3

3

3

1

1

11

   

0

2

4

4

4

4

12

    

0

4

4

4

4

21

     

0

2

4

4

22

      

0

4

4

31

       

0

2

The red dots in Fig. 1 denote the elements of \(\partial {{\,\textrm{B}\,}}_3(V_5)\). Moreover, it turns out in this case that \({{\,\textrm{dist}\,}}\) on \(\mathcal {L}^0(V_5)\) coincides with the graph distance on Fig. 1.

Proposition 2.6

For each \(\ell \in \{0,\ldots ,r\}\), the following hold:

  1. (1)

    \(\partial {{\,\textrm{B}\,}}_{\ell }([V_r])=\{[U]\in \mathcal {L}^0(V_r) \mid |\,[U]\,|= r-\ell +1\}\),

  2. (2)

    \({{\,\textrm{B}\,}}_{\ell }([V_r])=\{[U]\in \mathcal {L}^0(V_r) \mid |\,[U]\,|\ge r-\ell +1\}\).

Moreover, one has \(\partial \mathcal {L}(V_r)=\partial {{\,\textrm{B}\,}}_r([V_r])\).

Proof

Let \(\ell \in \{0,\ldots ,r\}\). We start by showing (1). For this, let \(U\in \mathcal {L}(V_r)\) and assume without loss of generality that \(U={\tilde{U}}\). Then the following hold

$$\begin{aligned} {{\,\textrm{dist}\,}}([U],[V_r])=\ell&\ \Longleftrightarrow \ell =\min \{n\in \mathbb {Z}_{\ge 0} \mid \pi ^nV_r\subseteq U \} \\&\ \Longleftrightarrow [U]=\{\pi ^jU \mid j=0,\ldots ,r-\ell \} \\&\ \Longleftrightarrow |\,[U]\,|=r-\ell +1 \end{aligned}$$

and so (1) is proven. To show (2), we combine (1) to the observation that

$$\begin{aligned} {{\,\textrm{B}\,}}_{\ell }([V_r])=\bigcup _{0\le j\le \ell }\partial {{\,\textrm{B}\,}}_{j}([V_r])=\bigcup _{r-\ell +1\le h\le r+1}\{[U]\in \mathcal {L}^0(V_r)\mid |\,[U]\,|=h\}. \end{aligned}$$

The proof of (1) also shows that \(\partial \mathcal {L}(V_r)=\partial {{\,\textrm{B}\,}}_r([V_r])\). \(\square \)

3 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 [30] while for a comparison with spherical codes in the Euclidean case, we refer to [21].

Definition 3.1

Let \(\mathcal {C}\) be a subset of \(\mathcal {L}^0(V_r)\) with \(|\mathcal {C}|\ge 2\). Then the minimum distance of \(\mathcal {C}\) is

$$\begin{aligned} {{\,\textrm{dist}\,}}(\mathcal {C})=\min \{{{\,\textrm{dist}\,}}([U],[U']) \mid [U],[U']\in \mathcal {C},\ [U]\ne [U']\}. \end{aligned}$$

Recall that \(\partial \mathcal {L}(V_r)\) is a metric space equipped with the metric \({{\,\textrm{dist}\,}}\) from Sect. 2 via the identification in (2.3).

Definition 3.2

A spherical code in \(V_r\) is a subset \(\mathcal {C}\) of \(\partial \mathcal {L}(V_r)\) with at least 2 elements.

The terminology “spherical” is motivated by Proposition 2.6, from which it follows in particular that each element [U] of a spherical code \({{\,\mathrm{\mathcal {C}}\,}}\) satisfies \({{\,\textrm{dist}\,}}([U],[V_r])=r\). The proof of the next result is straightforward; compare also with the table in Example 2.5.

Lemma 3.3

For each spherical code \(\mathcal {C}\) in \(V_r\), one has \({{\,\textrm{dist}\,}}(\mathcal {C})\le 2r.\)

A spherical code in \(V_r\) could in principle equal \(\partial \mathcal {L}(V_r)\), so a universal yet weak bound on the cardinality of a spherical code is given by \(|\partial \mathcal {L}(V_r)|\). For a precise count of the elements of \(\partial \mathcal {L}(V_r)\) or \(\mathcal {L}^0(V_r)\) we refer to Sect. 8 via Theorem 7.6. The most interesting bounds for spherical codes come from relating \({{\,\textrm{dist}\,}}(\mathcal {C})\) and \(|\mathcal {C}|\).

Definition 3.4

Let \(\chi ,\psi \) denote integers satisfying \(\chi \ge 2\) and \(\psi \ge 1\). Define

  1. (1)

    \({{\,\textrm{dist}\,}}(d;R;\chi )=\max \{{{\,\textrm{dist}\,}}(\mathcal {C}) \mid \mathcal {C}\subseteq \partial \mathcal {L}(V_r),\ |\mathcal {C}|\ge \chi \}\),

  2. (2)

    \({{\,\textrm{card}\,}}(d;R;\psi )=\max \{|\mathcal {C}| \mid \mathcal {C}\subseteq \partial \mathcal {L}(V_r),\ {{\,\textrm{dist}\,}}(\mathcal {C})\ge \psi \}\).

Since (1) and (2) are somewhat dual to each other (see also the analogous definitions in the Euclidean case [21, Section 2.3]), we will mostly be focussing on (2).

Example 3.5

The blue dots in Fig. 1 form a spherical code in \(V_5\) with minimum distance 6; cf. also Example 2.5. In particular this shows that \({{\,\textrm{card}\,}}(2;\mathbb {Z}/32\mathbb {Z};6)\ge 12\) and \({{\,\textrm{dist}\,}}(2;\mathbb {Z}/32\mathbb {Z};12)\ge 6\).

Definition 3.6

Let \(\mathcal {C}=\{[U_1],\ldots , [U_s]\}\) denote an ordered spherical code in \(V_r\). The half-distance matrix of \(\mathcal {C}\) is \(N(\mathcal {C})=(n_{ij})\in \mathbb {Z}^{s\times s}\) where

$$\begin{aligned} n_{ij}= \min \{\beta \in \mathbb {Z}_{\ge 0} \mid \pi ^{\beta }\tilde{U_i}\subseteq \tilde{U_j}.\} \end{aligned}$$

Note that, as a consequence of Proposition 2.6, if \({{\,\textrm{dist}\,}}(\mathcal {C})=2r\), then \(N(\mathcal {C})=rJ_s\).

Remark 3.7

Let \(\mathcal {C}=\{[U_1],\ldots , [U_s]\}\) be an ordered spherical code in \(V_r\). The distance matrix of \(\mathcal {C}\) is

$$\begin{aligned} D(\mathcal {C})=N(\mathcal {C})+N(\mathcal {C})^{\textrm{t}}. \end{aligned}$$

Then \(D(\mathcal {C})=(\delta _{ij})\) is a symmetric matrix with the following properties:

  1. (1)

    for each pair (ij), one has \({{\,\textrm{dist}\,}}([U_i],[U_j])=\delta _{ij}=\delta _{ji}\),

  2. (2)

    \({{\,\textrm{dist}\,}}(\mathcal {C})=\min \{\delta _{ij} \mid \delta _{ij}\ne 0\}\).

The following proposition is easily seen to hold as a consequence of Proposition 2.6.

Proposition 3.8

Let \([U_1],[U_2]\) be in \(\mathcal {L}^0(V_r)\). Then the following are equivalent:

  1. (1)

    \({{\,\textrm{dist}\,}}([U_1],[U_2])=2r\).

  2. (2)

    \([U_1],[U_2]\in \partial \mathcal {L}(V_r)\) and \(\pi ^{r-1}U_1, \pi ^{r-1}U_2\not \subseteq U_1\cap U_2\).

4 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. [41, 42, 45]. We call a subset \(\mathcal {K}\) of a poset \(\mathcal {P}\) a chain if any two of its elements are comparable, i.e.

$$\begin{aligned} a,b \in \mathcal {K} \ \Longrightarrow a\preceq b or b\preceq a. \end{aligned}$$

On the contrary, an antichain is a subset \(\mathcal {A}\) of \(\mathcal {P}\) whose elements are pairwise incomparable, that is

$$\begin{aligned} a,b\in \mathcal {A} \ \Longrightarrow a\not \preceq b and b\not \preceq a. \end{aligned}$$

Antichains 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, \({{\,\mathrm{\mathcal {L}}\,}}(V_r)\) is considered as the poset of all R-submodules of \(V_r\), ordered by inclusion. Recall that, if U is a free R-submodule of \(V_r\), then its rank equals the minimum cardinality of a generating set.

Definition 4.1

Let n be an integer with \(1\le n \le d-1\). The Grassmannian \({{\,\textrm{Gr}\,}}(n,V_r)\) is the collection of all free R-submodules of \(V_r\) of rank n.

It is clear from its definition that, for each n, the Grassmannian \({{\,\textrm{Gr}\,}}(n,V_r)\) is an antichain in \({{\,\mathrm{\mathcal {L}}\,}}(V_r)\) and is contained in \(\partial \mathcal {L}(V_r)\). Moreover, when \(r=1\), the Grassmannian \({{\,\textrm{Gr}\,}}(n,V)\) consists of the n-dimensional subspaces of V. For more on Grassmannians, we refer to [36, Chapter 5] and references therein. Generalizing the proof of [43, Proposition 1.3.18] to \(V_r\), we have that

$$\begin{aligned} |{{\,\textrm{Gr}\,}}(n,V_r)| = \left( {\begin{array}{c}d\\ n\end{array}}\right) _{q^{-1}}q^{rn(d-n)}, \end{aligned}$$
(4.1)

from which it follows that \(|{{\,\textrm{Gr}\,}}(n,V_r)|=|{{\,\textrm{Gr}\,}}(d-n,V_r)|\). We remark that (4.1) also follows directly from the more general formulas from Sect. 8.

Example 4.2

Assume that \(d=2\) and \(R=\mathbb {Z}/32\mathbb {Z}\), which implies that \(q=2\). We have seen in Example 2.5 that \(\partial {{\,\textrm{B}\,}}_1(V_5)\) has the same number of elements as \({{\,\textrm{Gr}\,}}(1,V_5/2V_5)\), where \(V_5/2V_5\) is viewed as a free R/2R-module. Indeed (4.1) ensures

$$\begin{aligned} |{{\,\textrm{Gr}\,}}(1,V_5/2V_5)| = \left( {\begin{array}{c}2\\ 1\end{array}}\right) _{\frac{1}{2}}2^1=\frac{1-\left( \frac{1}{2}\right) ^2}{1-\frac{1}{2}}2^1=3=|\partial {{\,\textrm{B}\,}}_1(V_5)|. \end{aligned}$$

The following is the main result of [45], which is there phrased to hold for \(r\ge 3\). The case where \(r=1\) can be found in [39, 41], while the case \(r=2\) is given in [42, Theorem 2.7].

Proposition 4.3

[45, Main Theorem] Set \(e_-=(d-1)/2\) and \(e=d/2\) and \(e_+=(d+1)/2\). Let, moreover, \(n\in \{1,\ldots ,d-1\}\). Then \({{\,\textrm{Gr}\,}}(n,V_r)\) is a maximal-sized antichain in \({{\,\mathrm{\mathcal {L}}\,}}(V_r)\) if and only if exactly one of the following holds:

  1. (1)

    d is even and \(n=e\),

  2. (2)

    d is odd and \(n\in \{e_-,e_+\}\).

4.2 Sperner codes

In this section we define spherical codes in \(V_r\) that will yield lower bounds to \({{\,\textrm{card}\,}}(d;R;2\alpha )\) for any choice of the integer \(1\le \alpha \le r\). To this end, we fix such an \(\alpha \) and define

$$\begin{aligned} m=r+1-\alpha \ and \ e=\lceil d/2 \rceil ={\left\{ \begin{array}{ll} d/2 &{} if d even ,\\ (d+1)/2 &{} if d odd . \end{array}\right. } \end{aligned}$$
(4.2)

We will define a family of codes \(\mathcal {C}\) that satisfy

$$\begin{aligned} {{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\ge 2\alpha \ and \ |{{\,\mathrm{\mathcal {C}}\,}}|=|{{\,\textrm{Gr}\,}}(e,V_{m})|, \end{aligned}$$
(4.3)

cf. Definition 4.4. Write \({{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r)\) for the collection of free \(R/\mathfrak {m}^m\)-submodules of \(\pi ^{\alpha -1}V_r\) of rank e and note that the elements of \({{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r)\) are incomparable. Moreover, \({{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r)\) is in bijection with \({{\,\textrm{Gr}\,}}(e,V_m)\), equivalently

$$\begin{aligned} |{{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r)|=|{{\,\textrm{Gr}\,}}(e,V_m)|=\left( {\begin{array}{c}d\\ e\end{array}}\right) _{q^{-1}}q^{me(d-e)}. \end{aligned}$$

Definition 4.4

A Sperner code with parameters \((d;R;\alpha )\) is a subset \({{\,\mathrm{\mathcal {C}}\,}}\) of \({{\,\textrm{Gr}\,}}(e,V_r)\) such that the map

$$\begin{aligned} {{\,\mathrm{\mathcal {C}}\,}}\longrightarrow {{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r), \quad U \longmapsto \pi ^{\alpha -1}U, \end{aligned}$$

is a bijection.

We remark that a Sperner code with parameters \((d;R;\alpha )\) is nothing else than a collection \({{\,\mathrm{\mathcal {C}}\,}}\) of free R-submodules of \(V_r\) with the property that \({{\,\textrm{Gr}\,}}(e,V_r)=\{\pi ^{\alpha -1}U \mid U\in {{\,\mathrm{\mathcal {C}}\,}}\}\). An example of a Sperner code when \(d=2\) is given in Fig. 1 (see also Examples 2.5, and 3.5).

Theorem 4.5

Let \(1\le \alpha \le r\) be an integer and let \({{\,\mathrm{\mathcal {C}}\,}}\) be a Sperner code with parameters \((d;R;\alpha )\). Then the following are satisfied:

  1. (1)

    \({{\,\mathrm{\mathcal {C}}\,}}\) is a spherical code in \(V_r\),

  2. (2)

    \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\ge 2\alpha \),

  3. (3)

    \(|{{\,\mathrm{\mathcal {C}}\,}}|=|{{\,\textrm{Gr}\,}}(\lceil d/2 \rceil ,V_{r+1-\alpha })|\).

Proof

(1) and (3) are clear from the construction of Sperner codes, so we prove (2). For this, let \(U_1,U_2\in {{\,\mathrm{\mathcal {C}}\,}}\) be distinct: we claim that \(n_{12}\ge \alpha \). For a contradiction, assume that this is not the case. It follows that \( \pi ^{\alpha -1}U_1\subseteq \pi ^{n_{12}}U_1\subseteq U_2 \) and so

$$\begin{aligned} \pi ^{\alpha -1}U_1\subseteq U_2\cap \pi ^{\alpha -1}V_r=\pi ^{\alpha -1}U_2, \end{aligned}$$

which contradicts the bijectivity of the map \({{\,\mathrm{\mathcal {C}}\,}}\rightarrow {{\,\textrm{Gr}\,}}(e,\pi ^{\alpha -1}V_r)\) from Definition 4.4. We have proven that \(n_{12}\ge \alpha \) and, the choice of \(U_1\) and \(U_2\) being arbitrary, we have that \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\ge 2\alpha \). \(\square \)

The following is an immediate corollary of the last result.

Corollary 4.6

Let \(1\le \alpha \le r\) be an integer and define \(e=\lceil d/2\rceil \). Then

$$\begin{aligned} {{\,\textrm{card}\,}}(d;R;2\alpha )\ge \left( {\begin{array}{c}d\\ e\end{array}}\right) _{q^{-1}}q^{(r+1-\alpha )e(d-e)}. \end{aligned}$$

As we will see in the next section, the inequality from Corollary 4.6 is an equality in some cases. We leave the following general question open.

Question 4.7

Is the inequality from Corollary 4.6 always an equality?

5 Extremal cases

In this section we show that Question 4.7 has a positive answer when \(\alpha =r\) or \(d=2\) by showing that, in these cases, Sperner codes are optimal codes with respect to the bound given in Corollary 4.6.

5.1 Codes of maximal distance

This section is devoted to the case \(\alpha =r\).

Proposition 5.1

Let \(\mathcal {C}\) be a spherical code in \(V_r\) with \({{\,\textrm{dist}\,}}\mathcal {C}=2r\). Then there exists a spherical code \(\mathcal {C}'\) in \(V_r\) such that the following hold:

  1. (1)

    \(|\mathcal {C}|=|\mathcal {C}'|\) and \({{\,\textrm{dist}\,}}(\mathcal {C}')=2r\),

  2. (2)

    for each \(U\in \mathcal {C}'\), one has \(\pi U=U\cap \pi V_r\).

Proof

Define \({{\,\mathrm{\mathcal {C}}\,}}_F\) to be the collection of all \(U\in {{\,\mathrm{\mathcal {C}}\,}}\) such that \(\pi U=U\cap \pi V_r\). We prove, by induction on \(n=|\mathcal {C}\setminus \mathcal {C}_F|\), that there exists \(\mathcal {C}'\) satisfying (1) and (2). If \(n=0\), then \(\mathcal {C}\) already satisfies (2) and we set \(\mathcal {C}'=\mathcal {C}\). Assume now that \(n>0\) and that the claim is satisfied for \(n-1\). Let \(U\in \mathcal {C}\) be such that \(\pi U\ne U\cap \pi 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

$$\begin{aligned} U=X\oplus H, \quad \pi H=H\cap \pi V_{r}, \quad \pi ^{r-1}X=0. \end{aligned}$$

In particular, H is isomorphic to the free part (as R-submodule) of U and both H and X are non-trivial. Set now \(\mathcal {C}''=(\mathcal {C}\setminus \{U\})\cup \{H\}\). It follows from \(\pi ^{r-1}U=\pi ^{r-1}H\) and Proposition 3.8 that \(\mathcal {C}''\) is a spherical code of minimal distance 2r. Moreover, we have \(\mathcal {C}_F''={{\,\mathrm{\mathcal {C}}\,}}_F\cup \{H\}\) and \(\mathcal {C}\) and \(\mathcal {C}''\) have the same cardinality. We are now done thanks to the induction hypothesis. \(\square \)

Thanks to Propositionlem:any-to-free, 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 \({{\,\textrm{B}\,}}_r\) as a lattice polytope; cf. Definition 7.4and Sects. 6.1 and 7.

Definition 5.2

A spherical code \(\mathcal {C}\) in \(V_r\) is called free if it satisfies Proposition 5.1(2).

The next result follows in a straightforward way from Proposition 3.8.

Lemma 5.3

Let \(\mathcal {C}\) be a free spherical code in \(V_r\) and let \(U_1,U_2\in \mathcal {C}\). Then the following are equivalent:

  1. (1)

    \({{\,\textrm{dist}\,}}([U_1],[U_2])=2r\),

  2. (2)

    \(\pi ^{r-1}U_1\) and \(\pi ^{r-1}U_2\) are incomparable.

Theorem 5.4

Let \(e=\lceil d/2\rceil \) be as defined in (4.2). Then the following holds:

$$\begin{aligned} {{\,\textrm{card}\,}}(d;R;2r)= \left( {\begin{array}{c}d\\ e\end{array}}\right) _{q^{-1}}q^{e(d-e)}. \end{aligned}$$

Proof

Let \({{\,\mathrm{\mathcal {C}}\,}}\) be a spherical code in \(V_r\) of maximal cardinality satisfying \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})=2r\). Thanks to Proposition 5.1, we assume without loss of generality that \(\mathcal {C}\) is free. Then Lemma 5.3 yields that the elements of \(\mathcal {C}\) are in bijection with a collection of maximal size of incomparable subspaces of \(\pi ^{r-1}V_r\cong V\). We are now done thanks to Proposition 4.3 and (4.1). \(\square \)

5.2 Codes in small dimension

In this section we answer Question 4.7 when \(d=2\), which we assume throughout Sect. 5.2.

Remark 5.5

There is a number of properties that spherical codes satisfy when \(d=2\), which do not generally hold for every spherical code. For instance, each element of \(\partial \mathcal {L}(V_r)\) is a free R-submodule of \(V_r\) and, for every \(1\le \alpha \le r\), the family \({{\,\textrm{Gr}\,}}(1,\pi ^{\alpha -1}V_r)\) from Sect. 4.1 forms a set of representatives for the classes in \(\partial {{\,\textrm{B}\,}}_{r+1-\alpha }([V_r])\); cf. Fig. 1. Write now \({{\,\textrm{Gr}\,}}(1,\pi ^{\alpha -1}V_r)=\{S_1,\ldots ,S_t\}\) and, for each \(k\in \{1,\ldots ,t\}\), define

$$\begin{aligned} \partial ^{k}_{\alpha }\mathcal {L}(V_r)=\{U\in \partial \mathcal {L}(V_r) \mid {{\,\textrm{dist}\,}}([U],[S_k])=\alpha -1\}. \end{aligned}$$

Then \(\partial \mathcal {L}(V_r)\) equals the disjoint union of the \(\partial ^{k}_{\alpha }\mathcal {L}(V_r)\)’s and defining a Sperner code with parameters \((2;R;\alpha )\) is the same as choosing one element in each \(\partial ^{k}_{\alpha }\mathcal {L}(V_r)\); cf. Fig. 1.

Fig. 1
figure 1

The vertices of this graph denote the elements of \(\mathcal {L}^0(V_5)\) and \(([U],[U'])\) is an edge if \(\pi {\tilde{U}}\subset \tilde{U'}\subset {\tilde{U}}\) or \(\pi \tilde{U'}\subset {\tilde{U}}\subset \tilde{U'}\). The red points are the elements of \(\partial {{\,\textrm{B}\,}}_3([V_5])\), which are represented by the elements of \({{\,\textrm{Gr}\,}}(1,\pi ^2V_5)\) from Sect. 4.1. A Sperner code with parameters \((2;\mathbb {Z}/32\mathbb {Z};3)\) and thus minimum distance 6 is given in blue (Color figure online)

Theorem 5.6

Let \(1\le \alpha \le r\) be an integer. Then the following holds:

$$\begin{aligned} {{\,\textrm{card}\,}}(2;R;2\alpha )=(q+1)q^{r-\alpha }. \end{aligned}$$

Proof

Thanks to Corollary 4.6, we have that

$$\begin{aligned} {{\,\textrm{card}\,}}(2;R;2\alpha )\ge |{{\,\textrm{Gr}\,}}(1,V_{r+1-\alpha })|= \left( {\begin{array}{c}2\\ 1\end{array}}\right) _{q^{-1}}q^{r+1-\alpha }=(q+1)q^{r-\alpha }, \end{aligned}$$

so we prove the other inequality. With the notation from Remark 5.5, we have, for any \(k\in \{1,\ldots ,t\}\) and \(U,U'\in \partial ^k_{\alpha }\mathcal {L}(V_r)\), that

$$\begin{aligned} {{\,\textrm{dist}\,}}([U],[U'])\le {{\,\textrm{dist}\,}}([U],[S_k])+{{\,\textrm{dist}\,}}([U'],[S_k])=2(\alpha -1)<2\alpha . \end{aligned}$$

The choice of k being arbitrary, this shows that any spherical code in \(V_r\) with \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\ge 2\alpha \), can contain at most one representative from each \(\partial ^k_{\alpha }\mathcal {L}(V_r)\). This concludes the proof. \(\square \)

6 Permutation codes

In this section, we give a possible generalization of permutation codes, as defined in [21, Chapter 4], by means of \({{\,\textrm{Sym}\,}}(d)\)-orbits of R-modules with compatible generating sets. For the fixed R-basis \(\textbf{e}=(e_1,\ldots ,e_d)\) of \(V_r\), we define \(\mathcal {L}_\textbf{e}(V_r)\) to be the family of R-submodules of \(V_r\) that can be generated compatibly with \(\textbf{e}\), in other words modules of the form

$$\begin{aligned} U_{\delta }=R\pi ^{\delta _1}e_1\oplus \cdots \oplus R\pi ^{\delta _d}e_d, where 0\le \delta _i\le r. \end{aligned}$$

The homothety relation from Sect. 2 respects base compatibility and so we define \(\mathcal {L}_\textbf{e}^0(V_r)\) to be the subfamily of \(\mathcal {L}^0(V_r)\) with representatives in \(\mathcal {L}_\textbf{e}(V_r)\). In particular, we can model all elements of \(\mathcal {L}_\textbf{e}^0(V_r)\) in terms of the \({{\,\textrm{Sym}\,}}(d)\)-orbits of the set \(\mathcal {E}_r^{(d)}\) in \(\mathbb {Z}^d\) and \(\partial \mathcal {L}_\textbf{e}(V_r)=\partial \mathcal {L}(V_r)\cap \mathcal {L}_\textbf{e}(V_r)\) is defined by permutations of elements of \(\partial \mathcal {E}_r^{(d)}\).

Example 6.1

Assume that \(d=3\) and \(R=\mathbb {Z}/25\mathbb {Z}\), yielding \(r=2\) and \(q=5\). Then \(U_{(0,0,0)}\) is the same as \(V_2\) and the modules \(U_{(1,1,0)}\subset U_{(1,0,0)}\subset U_{(0,0,0)}\) are pairwise at distance 1 from each other. Moreover, \(U_{(2,1,0)}\) is an element of \(\partial \mathcal {L}_\textbf{e}(V_2)\). Note that, while \(|\partial \mathcal {L}_\textbf{e}(V_2)|=12\), the cardinality of \(\partial \mathcal {L}(V_2)\) is equal to 1860; cf. Sect. 8. If we compared the spheres of radius 1 around \([V_2]\), we would get 6 elements in the compatible case, against the 62 without basis restrictions (see Fig. 2).

Fig. 2
figure 2

A local picture of \(\mathcal {L}^0_\textbf{e}\) when \(d=3\) (Color figure online)

6.1 Tropical operations and polytropes

For the sake of conciseness and in adherence to the references cited below we introduce here some more notation, coming from tropical geometry. For real elements a and b we set

$$\begin{aligned} a \,\underline{\oplus }\,b = \textrm{min}\{a,b\}, \quad a \,\overline{\oplus }\,b = \textrm{max}\{a,b\}, \quad a \odot b = a + b \end{aligned}$$

and remark that the last operations can be extended to \(\mathbb {R}^d\) componentwise. For each matrix \(M\in \mathbb {R}^{d\times d}\) with 0’s on the diagonal, we define moreover

$$\begin{aligned} Q(M) \,\, = \,\, \bigl \{ u \,\in \mathbb {R}^d/\mathbb {R}\textbf{1} \,:\, u_i - u_j \,\, \le \, m_{ij} \,\,\, \hbox {for} \,\, 1 \le i,j \le d \,\bigr \}, \end{aligned}$$
(6.1)

which is a convex polytope in \(\mathbb {R}^{d}/\mathbb {R}\textbf{1}\) and is called a polytrope in tropical geometry. For more on polytropes, we refer the interested reader to [17, 28, 29, 34]. In this paper, we will only deal with polytropes like the ones in the next example. As we mention in [17, Example 13], such polytropes are called pyropes in [29] and can be seen as balls of radius r in the tropical metric [13, Section 3.3]. Recall that \(J_d\) denotes the matrix in \(\mathbb {Z}^{d\times d}\) with 0’s on the diagonal and off-diagonal entries all equal to 1.

Example 6.2

Let \([\delta ]\in Q(rJ_d)\) be such that \(\delta \) has integral coordinates. Then there exists \({\tilde{\delta }}\in [\delta ]\) all of whose coordinates \({\tilde{\delta }}_i\) are integral and satisfy \(0\le {\tilde{\delta }}_i\le r\). Then \(U_{{\tilde{\delta }}}\) belongs to \(\mathcal {L}_\textbf{e}(V_r)\) and, any other \({\tilde{\delta }}'\) such that

$$\begin{aligned} {\tilde{\delta }}'\in {\tilde{\delta }}+\mathbb {Z}\textbf{1}\ and \ 0\le {\tilde{\delta }}_i'\le r \end{aligned}$$

yields \([U_{{\tilde{\delta }}}]=[U_{{\tilde{\delta }}'}]\). More precisely, using the language of buildings, one can show that there is a one-to-one correspondence between the integral points of \(Q(rJ_d)\) and the elements of \(\mathcal {L}_\textbf{e}^0(V_r)\); cf. Theorem 7.6 and [19, Theorem 5.2].

Identifying \(\mathbb {R}^d/\mathbb {R}\textbf{1}\) with \(\{u\in \mathbb {R}^d \mid u_d=0\}\), it is not difficult to see from Equation 6.1 that the coordinates of vertices of the polytope \(Q(rJ_d)\) are in \(\{0,r\}^d\cup \{0,-r\}^d\). As mentioned in the Introduction, this has a nice interpretation in terms of free R-submodules of \(V_r\).

6.2 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.9 we give sharp bounds on the minimum distance and cardinality of permutation codes in terms of their defining parameters.

Definition 6.3

An \(\textbf{e}\)-permutation code in \(V_r\) is a code of the form

$$\begin{aligned} \mathcal {C}=\{[U_{\delta }] \mid \delta \in {{\,\textrm{Sym}\,}}(d)\cdot \varepsilon \}, where \varepsilon \in \partial \mathcal {E}_r^{(d)}. \end{aligned}$$
(6.2)

To lighten the notation, we will often write \(\mathcal {C}={{\,\textrm{Sym}\,}}(d)\cdot \varepsilon \) for a code as in (6.2).

Remark 6.4

Let \(\delta ,\varepsilon \in \{0,\ldots , r\}^d\). Then the distance between \([U_{\delta }]\) and \([U_{\varepsilon }]\) is given by

$$\begin{aligned} {{\,\textrm{dist}\,}}([U_{\delta }],[U_{\varepsilon }])=\max _{i=1,\ldots ,d}\{\delta _i-\varepsilon _i\}-\min _{i=1,\ldots ,d}\{\delta _i-\varepsilon _i\}. \end{aligned}$$

This can be proven by direct computation or relying on Theorem 7.6 and [19, Remark 3.3].

Remark 6.5

One could replace \({{\,\textrm{Sym}\,}}(d)\) with \({{\,\textrm{Aut}\,}}(V_r)\) and study codes of the form \({{\,\textrm{Aut}\,}}(V_r)\cdot \varepsilon \), 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 \(\partial \mathcal {L}(V_r)={{\,\textrm{Aut}\,}}(V_r)\cdot (r,0)=\mathcal {C}\) and so \({{\,\textrm{dist}\,}}(\mathcal {C})=2\) while \(|\mathcal {C}|=|{{\,\textrm{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.2. Such vertices are given by permutations of elements \(\varepsilon \) of \(\mathcal {E}_r^{(d)}\) whose entries satisfy \(\{0,r\}=\{\varepsilon _1,\ldots ,\varepsilon _d\}\), in other words they correspond to the free R-submodules of \(V_r\). For each \(n\in \{1,\ldots ,d-1\}\), we set

$$\begin{aligned} \mathcal {F}_r^n={{\,\textrm{Sym}\,}}(d)\cdot (\underbrace{r,\ldots ,r}_{d-n},0,\ldots ,0) \end{aligned}$$

describing the collection of all free R-submodules of \(V_r\) that belong to \(\mathcal {L}_\textbf{e}(V_r)\). Note that, by its definition, each \(\mathcal {F}_r^n\) is contained in \(\partial \mathcal {L}(V_r)\) and the cardinality of \(\mathcal {F}_r^n\) is equal to

$$\begin{aligned} |\mathcal {F}_r^n|=\left( {\begin{array}{c}d\\ n\end{array}}\right) =\frac{d!}{n!(d-n)!}. \end{aligned}$$

Example 6.6

In Fig. 3, the 14 regular vertices of the polytope \(Q(J_4)\) are so divided:

  • the red vertices describe \(\mathcal {F}_1^1\),

  • the blue vertices describe \(\mathcal {F}_1^3\),

  • all other vertices, i.e. the yellow ones, are the elements of \(\mathcal {F}_1^2\).

Moreover, in the language of tropical geometry, the red and blue vertices are the min- resp. max-vertices of the polytrope \(Q(J_4)\); cf. [17, Example 1,Theorem 16].

Fig. 3
figure 3

A representation in \(\mathbb {R}^4/\mathbb {R}\textbf{1}\) of \(Q(J_4)\). The yellow dots constitute an \(\textbf{e}\)-permutation code of maximal size having distance 2; cf. Theorem 6.9

In the following results we compute cardinality and minimal distance of permutation codes. For this, We fix \(\varepsilon \in \partial \mathcal {E}_r^{(d)}\) and write

  • \(\ell =-1+|\{\varepsilon _1,\ldots ,\varepsilon _{d}\} |\ge 0\),

  • \(\{\varepsilon _1,\ldots ,\varepsilon _{d}\}=\{{\tilde{\varepsilon }}_1>\cdots >{\tilde{\varepsilon }}_{\ell +1}=0\}\).

For each \(s\in \{1,\ldots , \ell +1\}\), we define moreover \( m_s=|\{i\in \{1,\ldots ,d\} \mid \varepsilon _i={\tilde{\varepsilon }}_s\} |\) and note that \(m_1+\cdots +m_{\ell +1}=d\).

Proposition 6.7

For \(\mathcal {C}={{\,\textrm{Sym}\,}}(d)\cdot \varepsilon \), the following hold:

$$\begin{aligned} |\mathcal {C}|=\frac{d!}{m_1!m_2!\cdots m_{\ell +1}!}\ and \ {{\,\textrm{dist}\,}}(\mathcal {C})=2\,\underline{\bigoplus }\,_{1\le j<i\le \ell +1}{\tilde{\varepsilon }}_i-{\tilde{\varepsilon }}_j. \end{aligned}$$

Proof

The first equality follows straightforward from the definition, so we prove the second. To this end, write \({{\,\mathrm{\mathcal {C}}\,}}={{\,\textrm{Sym}\,}}(d)\cdot \varepsilon \) and set Set \([U_1]=[U_{\varepsilon }]\). Let, moreover, \([U_2]\in \mathcal {C}\). In view of Remark 6.4, to minimize \({{\,\textrm{dist}\,}}([U_1],[U_2])\) we pick indices \(h,k\in \{1,\ldots ,d\}\) such that

$$\begin{aligned} \varepsilon _h-\varepsilon _k=\,\underline{\bigoplus }\,_{1\le j<i\le \ell +1}{\tilde{\varepsilon }}_i-{\tilde{\varepsilon }}_j \end{aligned}$$

and define \(\sigma \) to be the transposition in \({{\,\textrm{Sym}\,}}(d)\) interchanging h and k. Choosing \([U_2]\) to correspond to \(\sigma \cdot \varepsilon \), we get from Remark 6.4 that

$$\begin{aligned} {{\,\textrm{dist}\,}}(\mathcal {C})={{\,\textrm{dist}\,}}([U_1],[U_2])=2(\varepsilon _h-\varepsilon _k)=2\,\underline{\bigoplus }\,_{1\le j<i\le \ell +1}{\tilde{\varepsilon }}_i-{\tilde{\varepsilon }}_j. \end{aligned}$$

\(\square \)

Corollary 6.8

Let \(n\in \{1,\ldots ,d-1\}\). Then \(\mathcal {F}_r^n\) 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.9

Let \(1\le \alpha \le r\) be an integer and write \(\mathcal {C}={{\,\textrm{Sym}\,}}(d)\cdot \varepsilon \). Then the following are satisfied:

  1. (1)

    If \(r=\delta \ell +Z\) with \(\delta , Z\) non-negative integers satisfying \(Z<\ell \), then

    $$\begin{aligned}{{\,\textrm{dist}\,}}(\mathcal {C})\le 2\delta .\end{aligned}$$
  2. (2)

    Write \(r=\alpha X+Y\) and \(d=\beta X+\gamma \), for \(X,Y,\beta ,\gamma \) non-negative integers satisfying \(Y<\alpha \) and \(\gamma <X\). If \({{\,\textrm{dist}\,}}(\mathcal {C})=2\alpha \), then

    $$\begin{aligned} |\mathcal {C}|\le \frac{d!}{(\beta !)^{X+1}(\beta +1)^\gamma } . \end{aligned}$$

Proof

We start by proving (1). For this, write \(r=\delta \ell +Z\) and assume without loss of generality that \(\varepsilon \) is such that \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})\) is maximal. Thanks to Proposition 6.7, maximizing the minimum distance of \({{\,\mathrm{\mathcal {C}}\,}}\) is the same as maximizing the minimum \(\eta \) of the set \(\{{\tilde{\varepsilon }}_i-{\tilde{\varepsilon }}_j \mid i>j\}\). This is clearly achieved for \(\eta =\delta \). We now prove (2). To this end, assume that \({{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})=2\alpha \). Thanks to Proposition 6.7, we know that \(\min \{{\tilde{\varepsilon }}_i-{\tilde{\varepsilon }}_j \mid i>j\}=\alpha \) and we now need to determine \(\varepsilon \) for which

$$\begin{aligned} |\mathcal {C}|=\frac{d!}{m_1!m_2!\cdots m_{\ell +1}!} \end{aligned}$$

is maximal, i.e. for which \(m_1!m_2!\cdots m_{\ell +1}!\) is minimal. This happens when \(\ell \) 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, \(\ell =X\) and \(\{m_1,\ldots ,m_{X+1}\}\subseteq \{\beta ,\beta +1\}\). More precisely, the number of \(m_i\)’s that are equal to \(\beta +1\) is \(\gamma \) and so Proposition 6.7 yields

$$\begin{aligned} |{{\,\mathrm{\mathcal {C}}\,}}|\le \frac{d!}{(\beta !)^{X+1-\gamma }((\beta +1)!)^{\gamma }}=\frac{d!}{(\beta !)^{X+1}(\beta +1)^\gamma }. \end{aligned}$$

This concludes the proof. \(\square \)

It is not difficult to see, from the proof of Theorem 6.9, how one can build optimal codes in this context, i.e. permutation codes achieving the bounds from Theorem 6.9. As for the case of regular spherical codes, optimal permutation codes are not unique; cf. Sect. 4.2. Another thing that is worth mentioning is that optimal permutation codes are far from being optimal in the sense of Corollary 4.6. We remark that, similar bounds to those of Theorem 6.9 are proven for a different type of permutation codes in [37].

Question 6.10

Are there other interesting generalizations of permutation codes in the context of buildings? What about group codes; cf. [21, Chapter 8]?

In the following remark we stress how, in terms of storage and decoding, permutation codes stand out among spherical codes (in accordance with the Euclidean setting).

Remark 6.11

(A note on storage and decoding) Let \(\mathcal {C}\) be any spherical code in \(V_r\). Then the elements of \(\mathcal {C}\) can be encoded in a vector of \((d\times d)\)-matrices with coefficients in R where the row-span of each matrix identifies an element [U] of \({{\,\mathrm{\mathcal {C}}\,}}\) via returning its \({\tilde{U}}\) representative. A convenient choice would be to communicate these matrices in row echelon form. In the special case when \({{\,\mathrm{\mathcal {C}}\,}}\) is a permutation code, it however suffices to store an element of \(\partial \mathcal {E}_r^{(d)}\) to give full information on the code \({{\,\mathrm{\mathcal {C}}\,}}\).

For what concerns decoding, the lack of additional structure makes it difficult to give a straightforward algorithm for the decoding of general spherical codes of modules, even in the case where they are known to be Sperner codes. However, thanks to Remark 6.4 and in agreement with the Euclidean case, the decoding of \(\textbf{e}\)-permutation codes is relatively simple. To illustrate this, we fix a permutation code \({{\,\mathrm{\mathcal {C}}\,}}\) and a vector \(\eta =(\eta _1,\ldots ,\eta _d)\in \mathcal {E}_r^{(d)}\) (note that actually \(\eta \) can be taken in \(\mathbb {Z}^d\) as the following algorithm allows us also to work in balls of larger radius; cf. Sect. 7.3). We want to find \(\varepsilon ^*\in \partial \mathcal {E}_r^{(d)}\) such that \(U_{\varepsilon ^*}\in {{\,\mathrm{\mathcal {C}}\,}}\) and \({{\,\textrm{dist}\,}}([U_{\eta }],[U_{\varepsilon ^*}])={{\,\textrm{dist}\,}}([U_{\eta }],{{\,\mathrm{\mathcal {C}}\,}})\). We follow the steps below:

  1. (1)

    Let \(\eta '\in \mathbb {Z}^d\) and \(\sigma \in {{\,\textrm{Sym}\,}}(d)\) be such that \(\eta _1'\ge \cdots \ge \eta _d'\) and \(\eta '=\sigma \cdot \eta \).

  2. (2)

    Define \({\tilde{\eta }}=\eta '-\eta _d'{} \textbf{1}\).

  3. (3)

    Choose \(\varepsilon \in {{\,\mathrm{\mathcal {C}}\,}}\) and identify \(h,k\in \{1,\ldots , d\}\) such that \(\varepsilon _h=0\) and \(\varepsilon _k=r\).

  4. (4)

    Define \(\varepsilon '\) and \(\tau \in {{\,\textrm{Sym}\,}}(d)\) to satisfy \(\varepsilon '=\tau \cdot \varepsilon \) and \(\varepsilon _1'=0\) and \(\varepsilon _d'=r\).

  5. (5)

    Set \(\varepsilon ^*=\sigma ^{-1}\cdot \varepsilon '\).

We see from its construction that the element \(\varepsilon ^*\) might not be unique. It is, however, not difficult to design an algorithm avoiding choices, once \({{\,\mathrm{\mathcal {C}}\,}}\) is given.

7 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 Sect. 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, for instance in optimization [9, 25], statistics [16, 20], and coding theory [32]. Though the employment of buildings in the study and construction of codes is not new, this seems to be the first time spherical codes in buildings are considered. In the applications of flags to network coding, spherical buildings are used. Such strategy, first introduced in [32], has found further developments in [4,5,6, 31] and variations in [22]. Moreover, Bruhat–Tits buildings also make their appearance in the study of holographic codes [35] as well as in the study of valued rank-metric codes [18].

7.1 From chain rings to valued fields

We choose a discretely valued field \((K,{{\,\textrm{val}\,}})\), with valuation ring \(\mathcal {O}_K\), uniformizer \(\pi \), and unique maximal ideal \(\mathfrak {m}_K=\mathcal {O}_K\pi \ne 0\), in such a way that \(R\cong \mathcal {O}_K/\mathfrak {m}_K^r\); cf. [3, §1]. With a slight abuse of notation, we set \(\textbf{e}=(e_1,\ldots ,e_d)\) to be the standard basis of \(K^d\) and we write \(\mathcal {O}_K^d\) for the free \(\mathcal {O}_K\)-module \(\mathcal {O}_K^d=\mathcal {O}_Ke_1\oplus \cdots \oplus \mathcal {O}_Ke_d\). We will use the bar notation for the subobjects of \(V_r\): if \(L\subseteq \mathcal {O}_K^d\), then \({\overline{L}}\) denotes the image of L in \(V_r\) under the natural projection \(\mathcal {O}_K^d\rightarrow V_r\). Up to very small variations, our notation is compatible with the one from [19].

7.2 Lattices and buildings

An \(\mathcal {O}_K\)-lattice (or simply lattice) in \(K^d\) is a free \(\mathcal {O}_K\)-submodule of maximal rank d. The (homothety) class of a lattice L in \(K^d\) is

$$\begin{aligned}{}[L]=\{cL \mid c\in K\setminus \{0\}\}=\{\pi ^nL \mid n\in \mathbb {Z}\}, \end{aligned}$$

while \({{\,\mathrm{\textrm{End}}\,}}_{\mathcal {O}_K}(L)\) denotes the endomorphism ring of L as an \(\mathcal {O}_K\)-submodule of \(K^d\), i.e. the collection of \(\mathcal {O}_K\)-linear maps \(K^d\rightarrow K^d\) that stabilize L. Note that any two homothetic lattices have the same endomorphism ring. Moreover, lattices in \(K^d\) form one orbit under the natural action of \({{\,\textrm{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 \(\mathcal {O}_K^d\). Additionally, each element of \(\mathcal {L}(V_r)\) can be obtained from a lattice \(\pi ^r\mathcal {O}_K^d \subseteq L\subseteq \mathcal {O}_K^d\), via projecting L to \(V_r\):

$$\begin{aligned} \mathcal {O}_K^d \supseteq L \longmapsto {\overline{L}}=U_L \subseteq V_r. \end{aligned}$$
(7.1)

We stress that the notions of equivalence for lattices and modules are compatible by means of the last projection. In line with the content of this paper, we define the affine building of \({{\,\textrm{SL}\,}}_d(K)\) via its lattice class model [2, 23] and refer the interested reader to [1] for the more general description.

Definition 7.1

The affine building \(\mathcal {B}_d(K)\) is an infinite simplicial complex such that

  1. (1)

    the vertex set is \(\mathcal {B}_d^0=\{ [L] \mid L \text{ is } \text{ an } \mathcal {O}_K\text{-lattice } \text{ in } K^{d} \}. \)

  2. (2)

    \(\{ [L_1], \ldots , [L_s] \} \) is a simplex in \(\mathcal {B}_d(K)\) if and only if, up to permutation of the indices and choice of representatives, one has \(L_1 \supset L_2 \supset \cdots \supset L_s \supset \pi L_1\).

The standard apartment of \(\mathcal {B}_d(K)\) is the subset \(\mathcal {A}\) of \(\mathcal {B}^0_d(K)\) of all lattice classes with representatives of the form

$$\begin{aligned} L_u=\mathcal {O}_K\pi ^{u_1}e_1\oplus \cdots \oplus \mathcal {O}_K\pi ^{u_d}e_d, where u=(u_1,\ldots ,u_d)\in \mathbb {Z}^d. \end{aligned}$$

More generally, one could define an apartment for any frame choice in \(K^d\), cf. [19, Section 2]. Since (7.1) respects homothety classes, the new terminology allows us to consider the codes from Sect. 6 as one-apartment codes in buildings.

Example 7.2

The rings from Examples 2.5 and 6.1 can both be expressed as quotients of a p-adic ring: in the first case \(R\cong \mathcal {O}_K/\mathfrak {m}_K^r=\mathbb {Z}_2/(2\mathbb {Z}_2)^5\) while in the second case \(R\cong \mathcal {O}_K/\mathfrak {m}_K^r=\mathbb {Z}_5/(5\mathbb {Z}_5)^2\). When \(d=2\) or \(d=3\), local pictures of \({{\,\textrm{B}\,}}_d(\mathbb {Q}_2)\) can be found in [7, Figures 2-5].

7.3 Distance and balls

The following distance was introduced in [19, Definition 3.1]. In view of Theorem 7.6, we use the same notation as in Definition 2.3.

Definition 7.3

Let \([L_1], [L_2] \in {{\mathcal {B}}}_d^0(K)\) be two homothety classes of lattices. Then

$$\begin{aligned} {{\,\textrm{dist}\,}}([L_1],[L_2])= \min \{ s \mid \text{ there } \text{ are } L_1'\in [L_1], L_2' \in [L_2] \text{ with } \pi ^{s } L_1' \subseteq L_2' \subseteq L_1' \} . \end{aligned}$$

As proven in [19, Lemma 3.2], the map \({{\,\textrm{dist}\,}}:\mathcal {B}_d^0(K)\times \mathcal {B}_d^0(K)\rightarrow \mathbb {Z}\) defines a distance on \(\mathcal {B}_d^0(K)\). In view of this, it makes sense to define balls in \(\mathcal {B}_d^0(K)\).

Definition 7.4

Let [L] be a lattice class in \(\mathcal {B}_d^0(K)\). Then the (closed) ball of radius r and center [L] is

$$\begin{aligned}{{\,\textrm{B}\,}}_r([L])= \{ [L'] \in {{\mathcal {B}}}_d^0(K) \mid {{\,\textrm{dist}\,}}([L],[L'] ) \le r \} \end{aligned}$$

and its boundary is

$$\begin{aligned} \partial {{\,\textrm{B}\,}}_r([L])={{\,\textrm{B}\,}}_r([L])\setminus {{\,\textrm{B}\,}}_{r-1}([L])=\{[L']\in \mathcal {B}_d^0(K) \mid {{\,\textrm{dist}\,}}([L'],[L])=r\}. \end{aligned}$$

If \([L]=[\mathcal {O}_K^d]\), we write simply \({{\,\textrm{B}\,}}_r\) and \(\partial {{\,\textrm{B}\,}}_r\) for \({{\,\textrm{B}\,}}_r([\mathcal {O}_K^d])\) and \(\partial {{\,\textrm{B}\,}}_r([\mathcal {O}_K^d])\), respectively.

Example 7.5

Assume \(d=2\). Then \(\mathcal {B}_2(K)\) is a \((q+1)\)-regular tree and \({{\,\textrm{dist}\,}}\) equals the graph distance on \(\mathcal {B}_2(K)\). Figure 1 represents \({{\,\textrm{B}\,}}_5\) as a subset of \(\mathcal {B}_2(\mathbb {Q}_2)\). In the same figure, the red points constitute \(\partial {{\,\textrm{B}\,}}_3\). For more on buildings as trees, see for instance [40].

Balls in the affine building \(\mathcal {B}_d(K)\) naturally arise as the collections of stable lattice classes of ball orders [19, Section 5] and can be modeled by means of the submodules of \(V_r\).

Theorem 7.6

The following are isometric:

  1. (1)

    \(\mathcal {L}^0(V_r)\) and \({{\,\textrm{B}\,}}_r\),

  2. (2)

    \(\partial \mathcal {L}(V_r)\) and \(\partial {{\,\textrm{B}\,}}_r\),

  3. (3)

    \(\mathcal {L}^0_\textbf{e}(V_r)\) and \({{\,\textrm{B}\,}}_r\cap \mathcal {A}\),

  4. (4)

    \(\partial \mathcal {L}_\textbf{e}(V_r)\) and \(\partial {{\,\textrm{B}\,}}_r\cap \mathcal {A}\).

Proof

We show (1). To this end, we start by observing that \([L]\in {{\,\textrm{B}\,}}_r\) if and only if there exists a representative \(L'\in [L]\) such that \(\pi ^r\mathcal {O}_K\subseteq L'\subseteq \mathcal {O}_K^d\). Since Equation 7.1 respects homothety, it is clear that \({{\,\textrm{B}\,}}_r\) and \(\mathcal {L}^0(V_r)\) are in bijection via \(\mathcal {O}_K^d\rightarrow V_r\). We show that the distances are also compatible. For this, let \(\pi ^r\mathcal {O}_K\subseteq L_1,L_2\subseteq \mathcal {O}_K^d\) be lattices and write \(U_1=\overline{L_1}\) and \(U_2=\overline{L_2}\). Assume without loss of generality that \(U_1=\tilde{U_1}\) and \(U_2=\tilde{U_2}\). Set \(\alpha ={{\,\textrm{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\supseteq \pi ^{n_{21}}L_2\supseteq \pi ^{n_{21}}(\pi ^{n_{12}}L_1)=\pi ^{n_{21}+{n_{12}}}L_1\) and in particular \(\alpha \le n_{12}+n_{21}\). Without loss of generality, let now m be a non-negative integer such that \(L_1\supseteq \pi ^mL_2\supseteq \pi ^{\alpha } L_1\). Then it follows from the definitions of \(n_{21}\) and \(n_{21}\) that \(m\ge n_{21}\) and \(\alpha -m\ge n_{12}\). Moreover, we have

$$\begin{aligned} \pi ^{n_{12}+n_{21}}L_1\subseteq \pi ^{\alpha }L_1\subseteq \pi ^mL_2, \end{aligned}$$

which in turn yields that \(\pi ^{n_{12}+n_{21}-m}L_1\subseteq L_2\). It follows from the definition of \(n_{12}\) that \(m=n_{21}\) and thus we derive that \(\alpha \ge n_{12}+n_{21}\). This proves (1) and so, as a consequence, also (2),(3), and (4). \(\square \)

In view of the last theorem, we transport Definitions 3.1 and 3.2 to the framework of Bruhat–Tits buildings (see Fig. 4).

Definition 7.7

A spherical code in \({{\,\textrm{B}\,}}_r\) is a subset \({{\,\mathrm{\mathcal {C}}\,}}\) of \({{\,\textrm{B}\,}}_r\) with \(|{{\,\mathrm{\mathcal {C}}\,}}|\ge 2\). The minimum distance of \({{\,\mathrm{\mathcal {C}}\,}}\) is

$$\begin{aligned} {{\,\textrm{dist}\,}}({{\,\mathrm{\mathcal {C}}\,}})=\min \{{{\,\textrm{dist}\,}}([L_1],[L_2]) \mid [L_1],[L_2]\in {{\,\mathrm{\mathcal {C}}\,}},\ [L_1]\ne [L_2]\}. \end{aligned}$$

The results from Sects. 4, 5, and 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 [19, Definition 5.5].

Definition 7.8

A star configuration \(\star _r ([L]) \) with center [L] and radius r is a set

$$\begin{aligned} \star _r ([L]) = \{ [L_1],\ldots , [L_d], [L_{d+1}] \} \end{aligned}$$

such that the following hold:

  1. (1)

    \(\pi ^r L \subseteq L_1,\ldots , L_{d+1} \subseteq L\),

  2. (2)

    for each \(i\in \{1,\ldots ,d+1\}\), one has \(L_i / \pi ^r L \cong R\),

  3. (3)

    for each \(i\in \{1,\ldots ,d+1\}\), one has \(L= \sum _{j\ne i} L_j \).

Proposition 7.9

A star configuration \(\star ([\mathcal {O}_K^d])\) with center \([\mathcal {O}_K^d]\) and radius r is a spherical code with \({{\,\textrm{dist}\,}}(\star ([\mathcal {O}_K^d]))=2r\).

Proof

Write \(\star ([\mathcal {O}_K^d])=\{[L_1],\ldots ,[L_{d+1}]\}\). In view of conditions (1)-(2)-(3) above, up to a convenient base change, we assume without loss of generality that

$$\begin{aligned} L_i={\left\{ \begin{array}{ll} \mathcal {O}_Ke_i+\pi ^r\mathcal {O}_K^d &{} if 1\le i\le d, \\ \mathcal {O}_K(e_1+\cdots +e_d)+\pi ^r\mathcal {O}_K^d &{} if i=d+1. \end{array}\right. } \end{aligned}$$

It is clear that \(\star ([\mathcal {O}_K^d])\) is a spherical code in \({{\,\textrm{B}\,}}_r\). Fix now \(i\ne j\). Then Theorem 7.6 and Proposition 3.8 yield \({{\,\textrm{dist}\,}}([L_i],[L_j])=2r\) and, the choice of ij being arbitrary, it follows that \({{\,\textrm{dist}\,}}(\star ([L]))=2r\). \(\square \)

The next corollary follows in a straightforward way from Definition 3.4, with the combination of Lemma 3.3, Theorem 7.6, and Proposition 7.9.

Corollary 7.10

One has \({{\,\textrm{dist}\,}}(d;R;d+1)=2r\).

8 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 though they call for some new observations and questions; cf. Remarks 8.6 and 8.7.

We work here under the assumption of Sect. 7.1, though we do not necesarily assume that the residue field of K is finite. We leverage on results from [44], in particular its Sect. 3, to give a polynomial counting the lattice classes in the ball \({{\,\textrm{B}\,}}_r\). More precisely, we define \(b^{(d)}_r(X)\in \mathbb {Z}[X]\) such that, if \(q=|\mathcal {O}_K/\mathfrak {m}_K |\) is finite, then \(|{{\,\textrm{B}\,}}_r |=b^{(d)}_r(q)\). We do so by writing \(b^{(d)}_r(X)=\sum _{\varepsilon \in \mathcal {E}_r^{(d)}}b_{\varepsilon }(X)\) where, contrarily to what is done in Sect. 6, here \(\mathcal {E}_r^{(d)}\) parametrizes the elementary divisor types of lattices \(\pi ^r\mathcal {O}_K^d\subset L\subseteq \mathcal {O}_K^d\) up to homothety. The role of the polynomial \(b_{\varepsilon }\) will be to count all lattice classes with the same elementary divisors. We fix \(\varepsilon \in \mathcal {E}_r^{(d)}\) and proceed to define \(b_{\varepsilon }(X)\). For this, write \(\ell =-1+|\{\varepsilon _1,\ldots ,\varepsilon _{d}\} |\ge 0\) and \(\{\varepsilon _1,\ldots ,\varepsilon _{d}\}=\{{\tilde{\varepsilon }}_1>\cdots >{\tilde{\varepsilon }}_{\ell +1}=0\}\): for an example see Fig. 4. Now, for each \(s\in \{1,\ldots , \ell \}\), define

$$\begin{aligned} i_s=|\{i\in \{1,\ldots ,d\} \mid \varepsilon _i\ge {\tilde{\varepsilon }}_s\} |\ and \ r_{i_s}={\tilde{\varepsilon }}_s-{\tilde{\varepsilon }}_{s+1}. \end{aligned}$$

We set, moreover \(\Lambda _{\varepsilon }=\mathcal {O}_K^{d\times d}\cap {{\,\mathrm{\textrm{End}}\,}}_{\mathcal {O}_K}(L_{\varepsilon })\) and \(I=I(\varepsilon )=\{i_1<\cdots <i_{\ell }\}\). In terms of these parameters, the endomorphism ring \({{\,\mathrm{\textrm{End}}\,}}_{\mathcal {O}_K}(L_{\varepsilon })\) is denoted \(\Gamma _{I,\textbf{r}}\) in [44] and is explicitly described in [44, Section 3.1]. In accordance with [44, Section 3], we finally define

$$\begin{aligned} b_{\varepsilon }(X)=\left( {\begin{array}{c}d\\ I\end{array}}\right) _{X^{-1}}X^{\sum _{\iota \in I}r_{\iota }\iota (d-\iota )}. \end{aligned}$$
Fig. 4
figure 4

In this figure \(\varepsilon =(5,4,3,3,1,0)\). The different colors represent the different \({\tilde{\varepsilon }}_j\)’s. The horizontal shifts represent the \(i_j\)’s while the vertical dots represent the \(r_{i_j}\)’s. Concretely, \(\ell =4\) and \((i_1,i_2,i_3,i_4)=(1,2,4,5)\) and \((r_{i_1},r_{i_2},r_{i_3},r_{i_4})=(1,1,2,1)\)

The next result is a direct consequence of the work in [44, Section 3]; cf. in particular [44, Equation (26)].

Proposition 8.1

[44, Section 3] Let \([L]\in \mathcal {B}_d^0(K)\). Then the following hold:

  1. (1)

    for each \(\varepsilon \in \mathcal {E}_r^{(d)}\), one has that \(b_{\varepsilon }(X)\) is a monic integral polynomial of degree

    $$\begin{aligned}\deg b_{\varepsilon }(X)=\sum _{\iota \in I(\varepsilon )}r_\iota \iota (d-\iota )=|\mathcal {O}_K^{d\times d}:\Lambda _{\varepsilon }|.\end{aligned}$$
  2. (2)

    one has \(|{{\,\textrm{B}\,}}_r([L])|=b_r^{(d)}(q)=\sum _{\varepsilon \in \mathcal {E}_r^{(d)}}b_{\varepsilon }(q)\).

Example 8.2

For \([L]\in \mathcal {B}_3^0(K)\), we have

$$\begin{aligned} |{{\,\textrm{B}\,}}_2([L]) |&= b^{(3)}_2(q) \\&= b_{(0,0,0)}(q)+(b_{(1,0,0)}(q)+b_{(1,1,0)}(q)) + (b_{(2,0,0)}(q)+b_{(2,1,0)}(q)+b_{(2,2,0)}(q))\\&= 1+2(q^2+q+1)+(2(q^4+q^3+q^2)+(q^4+2q^3+2q^2+q))\\&= 3q^4+4q^3+6q^2+3q+3. \end{aligned}$$

Definition 8.3

Let \({{\,\textrm{rev}\,}}:\mathbb {Z}^d\rightarrow \mathbb {Z}^d\) be the involution defined by

$$\begin{aligned}\varepsilon =(\varepsilon _1,\ldots ,\varepsilon _d)\longmapsto {{\,\textrm{rev}\,}}(\varepsilon )=(\varepsilon _d,\ldots ,\varepsilon _1).\end{aligned}$$

Lemma 8.4

Let \(\lambda \) be a non-negative integer and let \(\varepsilon ,\varepsilon '\in \mathcal {E}_r^{(d)}\). The following hold:

  1. (1)

    If \(\varepsilon +{{\,\textrm{rev}\,}}{\varepsilon '}=\lambda \textbf{1}\), then \(\deg b_{\varepsilon }(X)=\deg b_{\varepsilon '}(X)\).

  2. (2)

    If \(k\in \{1,\ldots ,d\}\) is such that

    $$\begin{aligned} \varepsilon -\varepsilon '=(\delta _{ik}\lambda )_{i=1,\ldots ,d} \end{aligned}$$

    then \(\deg b_{\varepsilon }(X)=\deg b_{\varepsilon '}(X)+(d+1-2k)\lambda \).

Proof

(1) Assume that \(\varepsilon +{{\,\textrm{rev}\,}}{\varepsilon '}=\lambda \textbf{1}\), equivalently, for all \(i\in \{1,\ldots ,d\}\), one has \(\varepsilon _i=\lambda -\varepsilon _{d-i+1}\). It follows from Proposition 8.1 (1) that

$$\begin{aligned} \deg b_{\varepsilon }(X) = |\mathcal {O}_K^{d\times d}:\Lambda _{\varepsilon }|&=\sum _{1\le i<j\le d}\varepsilon _i-\varepsilon _j =\sum _{1\le i<j\le d}\varepsilon '_{d-j+1}-\varepsilon '_{d-i+1}\\&=\sum _{1\le s<t\le d}\varepsilon '_s-\varepsilon '_t=|\mathcal {O}_K^{d\times d}:\Lambda _{\varepsilon '}|=\deg b_{\varepsilon '}(X). \end{aligned}$$

(2) Let \(k\in \{1,\ldots ,k\}\) be such that

$$\begin{aligned} \varepsilon _s={\left\{ \begin{array}{ll} \varepsilon _s' &{} if s\ne k, \\ \varepsilon _s'+\lambda &{} if s=k. \end{array}\right. } \end{aligned}$$

It follows from Proposition 8.1(1) that

$$\begin{aligned} \deg b_{\varepsilon }(X) = |\mathcal {O}_K^{d\times d}:\Lambda _{\varepsilon }|&=\sum _{1\le i<j\le d}\varepsilon _i-\varepsilon _j\\&=\sum _{\begin{array}{c} 1\le i<j\le d\\ i,j\ne k \end{array}}\varepsilon '_i-\varepsilon '_j +\sum _{k<j\le d}(\varepsilon _k'+\lambda -\varepsilon _j')+\sum _{1\le i<k}(\varepsilon _i'-\varepsilon _j'-\lambda ) \\&=\sum _{1\le s<t\le d}\varepsilon '_s-\varepsilon '_t+(d+1-2k)\lambda \\&=|\mathcal {O}_K^{d\times d}:\Lambda _{\varepsilon '}|+(d+1-2k)\lambda =\deg b_{\varepsilon '}(X)+(d+1-2k)\lambda . \end{aligned}$$

\(\square \)

The proof of the next result shows that the asymptotics of \(|{{\,\textrm{B}\,}}_r([L])|\) is dominated by \(|\partial {{\,\textrm{B}\,}}_r([L])|\), i.e. the dominating summands in \(b_r^{(d)}(X)\) correspond to elements of \(\partial \mathcal {E}_r^{(d)}\).

Theorem 8.5

The following hold:

  1. (1)

    If d is even, then the leading term of \(b_r^{(d)}(X)\) is \(X^{d^2r/4}\).

  2. (2)

    If d is odd, then the leading term of \(b_r^{(d)}(X)\) is \((r+1)X^{(d^2-1)r/4}\).

Proof

We prove (2). To this end, write \(d=2k+1\) and define the subset \(\mathcal {S}\) of \(\mathcal {E}_r^{(d)}\) to consist of all elements \(\varepsilon \) satisfying

$$\begin{aligned} \varepsilon _i={\left\{ \begin{array}{ll} r &{} if i< k+1,\\ 0 &{} if i> k+1. \end{array}\right. } \end{aligned}$$

Then \(\mathcal {S}\) has cardinality \(r+1\). Let moreover, \(\mathcal {S}_{-}\) and \(\mathcal {S}_+\) denote the subsets of \(\mathcal {E}_r^{(d)}\) of those elements that are smaller resp. bigger than elements in \(\mathcal {S}\), with respect to the lexicographic order. Then \(\mathcal {E}_r^{(d)}\) equals the disjoint union \(\mathcal {S}_-\cup \mathcal {S}\cup \mathcal {S}_{+}\). Let now \(\varepsilon \in \mathcal {E}_r^{(d)}\) and \(\varepsilon ^*\in \mathcal {S}\). If \(\varepsilon \in \mathcal {S}_-\), then Lemma 8.4(2) yields that \(\deg b_{\varepsilon }(X)<\deg b_{\varepsilon ^*}(X)\). Moreover, Lemma 8.4(2) also ensures that, if \(\varepsilon \in \mathcal {S}\), then \(\deg b_{\varepsilon }(X)=\deg b_{\varepsilon ^*}(X)\). Assume now that \(\varepsilon \in \mathcal {S}_+\): we claim that \(\deg b_{\varepsilon }(X)>\deg b_{\varepsilon ^*}(X)\). To this end, define \(\varepsilon '={{\,\textrm{rev}\,}}(r\textbf{1}-\varepsilon )\) and note that \(\varepsilon '\in \mathcal {S}_-\). Now \(\deg b_{\varepsilon }(X)>\deg b_{\varepsilon ^*}(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 \(\mathcal {S}\) to be the singleton consisting of the vector whose first d/2 entries are equal to r and all others are 0. \(\square \)

Remark 8.6

(Asymptotic of balls against Sperner codes) We have seen in Sect. 4.2 that, if \(\mathcal {C}\) is a Sperner code with parameters \((d;R;\alpha )\) and \(e=\lceil d/2\rceil \), then the cardinality of \({{\,\mathrm{\mathcal {C}}\,}}\) is the same as that of \({{\,\textrm{Gr}\,}}(e,V_{r+\alpha -1})\). In particular, thanks to Proposition 8.1(1), we know that the leading term of the polynomial describing \(|{{\,\mathrm{\mathcal {C}}\,}}|\) is equal to \(q^{(r+1-\alpha )e(d-e)}\). Rewriting thus compactly the degree of the leading terms from Theorem 8.5 as \(re(d-e)\), we get that the density of a Sperner code on \(\partial {{\,\textrm{B}\,}}_r\) is asymptotically equivalent (as \(q\rightarrow \infty \)) to

$$\begin{aligned} q^{(1-\alpha )e(d-e)}\cdot {\left\{ \begin{array}{ll} 1 &{} if d is even , \\ (r+1)^{-1} &{} otherwise . \end{array}\right. } \end{aligned}$$

Remark 8.7

(Analogue of sphere packing bounds for odd distances) Let \({{\,\mathrm{\mathcal {C}}\,}}\) be a spherical code in \({{\,\textrm{B}\,}}_r\), as defined in Definition 7.7, of odd minimum distance \(2\alpha +1\). In this case, it is clear that any two elements [L] and \([L']\) of \({{\,\mathrm{\mathcal {C}}\,}}\) satisfy \({{\,\textrm{B}\,}}_{\alpha }([L])\cap {{\,\textrm{B}\,}}_\alpha ([L'])=\emptyset \). It follows therefore that a very loose sphere packing bound on the cardinality of \({{\,\mathrm{\mathcal {C}}\,}}\) is given by

$$\begin{aligned} |{{\,\mathrm{\mathcal {C}}\,}}|\le \frac{|{{\,\textrm{B}\,}}_{r+\alpha }|-|{{\,\textrm{B}\,}}_{r-\alpha }|}{|{{\,\textrm{B}\,}}_{\alpha }|-1}, \end{aligned}$$

which indeed, thanks to Theorem 8.5, is asymptotically no better that the known trivial bound given by \(|\partial {{\,\textrm{B}\,}}_r|\). For a better asymptotic bound one should compute, for \([L]\in \partial {{\,\textrm{B}\,}}_r\) the size of \({{\,\textrm{B}\,}}_\alpha ([L])\cap \partial {{\,\textrm{B}\,}}_r\) yielding the tighter

$$\begin{aligned} |{{\,\mathrm{\mathcal {C}}\,}}|\le \frac{|\partial {{\,\textrm{B}\,}}_r|}{|{{\,\textrm{B}\,}}_\alpha ([L])\cap \partial {{\,\textrm{B}\,}}_r|}; \end{aligned}$$

compare with [21, Theorem 1.6.1]. What is the asymptotic behaviour of the right term of the last inequality as \(q\rightarrow \infty \)?