1 Introduction

Let X be a complete simplicial toric variety over a finite field \({\mathbb K}=\mathbb F_q\) with a split torus \(T_X\cong ({\mathbb K}^*)^{n}\). Our main goal in the present paper is to uncover some algebraic and geometric properties of subgroups \(Y_Q=\{[{\mathbf{t}}^{\mathbf{q}_{1}}:\cdots :{\mathbf{t}}^{\mathbf{q}_{r}}]|\mathbf{t}\in ({\mathbb K}^{*})^s\}\) of the algebraic group \(T_X\), and develop techniques applying to certain algebraic-geometric codes, for any matrix \(Q=[\mathbf{q}_1 \mathbf{q}_2\cdots \mathbf{q}_r]\in M_{s\times r}(\mathbb Z)\). It is known that all subgroups of \(T_X\) are of this form by Şahin [23, Theorem 3.2 and Corollary 3.7].

Denote by \(S={\mathbb K}[x_1,\dots ,x_r]\) the homogeneous coordinate ring of X, which is \(\mathbb Z^d\)-graded. If \(S_{\mathbf{\alpha }}\) is the finite dimensional vector space spanned by the monomials in S having degree \(\mathbf{\alpha }\), then evaluating polynomial functions from \(S_{\mathbf{\alpha }}\) at the points \([P_1],\dots ,[P_N]\) of \(Y_Q\) defines the following \({\mathbb K}\)-linear map

$$\begin{aligned} {\text {ev}}_{Y_Q}:S_\mathbf{\alpha }\rightarrow {\mathbb K}^N,\quad F\mapsto (F(P_1),\dots ,F(P_N)). \end{aligned}$$

The image \(\text {ev}_{Y_Q}(S_\mathbf{\alpha }) \subseteq \mathbb F_q^N\) is a linear code which is denoted by \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) and is called the parameterized toric code associated to Q. There are 3 main parameters \([N,K,\delta ]\) of a linear code. The length N of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is the order \(|Y_Q|\) of the subgroup in our case. The dimension of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), denoted \(K=\dim _{{\mathbb K}}({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})\), is the dimension as a subspace of \(\mathbb F_q^N\). The number of non-zero entries in any \(c\in {{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}}\) is called its weight and minimum distance \(\delta\) of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is the smallest weight among all code words \(c\in {{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}}{\setminus }\{0\}\).

Parameterized toric codes includes toric codes, constructed by Hansen in [9], as a special case where Q is the identity matrix \(I_r\) and \(Y_Q\) is the full torus \(T_X\). Toric codes are among evaluation codes on a toric variety showcasing champion examples, see [1, 2, 12]. The length in this special case is \(|T_X|=(q-1)^n\). When the evaluation map is injective, the dimension is the number of monomials of degree \(\alpha\). Computing the minimum distance is a very challenging task which have been completed in some special cases, in contrast to more general situations where some lower bounds and/or upper bounds on the minimum distance have been given via different methods, see [10, 11, 13,14,15, 22, 28].

There is an algebraic approach for studying these codes relying on the vanishing ideal \(I(Y_Q)\) of \(Y_Q\) which is the graded ideal generated by homogeneous polynomials in S vanishing at every point of \(Y_Q\). Since the kernel of the linear map \({\text {ev}}_{Y_Q}\) equals the homogeneous piece \(I(Y_Q)_\mathbf{\alpha }\) of degree \(\mathbf{\alpha }\), we have an isomorphism of \({\mathbb K}\)-vector spaces \(S_\mathbf{\alpha }/I(Y_Q)_\mathbf{\alpha }\cong {{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\). Thus, the dimension of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is the multigraded Hilbert function \(H_{Y_Q}(\mathbf{\alpha }):=\dim _{\mathbb F_q} S_{\mathbf{\alpha }}-\dim _{\mathbb F_q} I(Y_Q)_\mathbf{\alpha }\) of \(I(Y_Q)\). Initially, there are infinitely many codes corresponding to elements in the semigroup \(\mathbb N\beta :=\mathbb N\beta _1+\cdots +\mathbb N\beta _r\), where \(\beta _i=\deg (x_i)\) for \(i=1,\dots ,r\). Since these codes are subspaces of the space \(\mathbb F_q^N\), the upper bound for the dimension \(H_{Y_Q}(\mathbf{\alpha })\) of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is exactly \(N=|Y_Q|\). By Singleton’s bound \(\delta \le N+1-K\), the minimum distance attains its minimum value 1 when the dimension K reaches its upper bound N. An important algebraic invariant of \(Y_Q\) in detecting these trivial codes is the so-called multigraded regularity defined by

$$\begin{aligned} {\text {reg}}(Y_Q):=\{\mathbf{\alpha }\in \mathbb N\beta \quad :\quad H_{Y_Q}(\mathbf{\alpha })= |Y_Q|\}\subseteq \mathbb N^d. \end{aligned}$$

So, non-trivial codes come from the set \(\mathbb N\beta {\setminus } {\text {reg}}(Y_Q)\). There are also equivalent codes having the same parameters which can be detected using the values of the Hilbert function. More precisely, the codes \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) and \({{\mathcal {C}}}_{\mathbf{\alpha }',Y_Q}\) are equivalent if \(H_{Y_Q}(\mathbf{\alpha })=H_{Y_Q}(\mathbf{\alpha }')\) whenever \(\mathbf{\alpha }-\mathbf{\alpha }'\in \mathbb N\beta\), and hence, there are only finitely many interesting codes on each variety X, for a fixed matrix Q and prime power q by [25, Proposition 4.3]. The core of this approach is to use the ideal \(I(Y_Q)\) for determining these finitely many codes before constructing any code. In order to determine elements \(\mathbf{\alpha }\) corresponding to them, we need to determine \(|Y_Q|\) first, obtain a generating system of \(I(Y_Q)\) and then analyze the values of the Hilbert function of \(I(Y_Q)\), see Example 4.4. This yields a finite list of interesting codes together with their lengths and dimensions. The minimum distance can also be computed using the ideal \(I(Y_Q)\), see [17] if X is a projective space. When \(I(Y_Q)\) is a complete intersection, lower bounds for the minimum distance of \({{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}}\), can be computed using [27, Theorem 3.2 and Theorem 3.9]. These motivate developing methods and algorithms for computing a generating set of the vanishing ideal \(I(Y_Q)\) and checking if it is a complete intersection.

Parameterized codes were defined and studied for the first time by Villarreal et al. [21] when X is a projective space. Among other interesting results, they gave a method for computing a generating set of \(I(Y_Q)\) and showed that \(I(Y_Q)\) is a lattice ideal of dimension 1. Later, the lattice of the vanishing ideal is determined more explicitly, when Q is a diagonal matrix in [16]. When \(Y_Q\) is the torus \(T_X\) lying in the projective space \(X=\mathbb P^n\), that is \(Q=I_r\), the main parameters are determined in [26]. Dias and Neves generalized parametrized codes from standard projective space to weighted projective spaces \(\mathbb P(w_1,\dots ,w_r)\), and showed that the vanishing ideal of the torus \(T_X\) is a lattice ideal of dimension 1 in [5].

In the first part of the present paper, we use some of the ideas in these papers to extend them into the more general setting of a toric variety. Namely, Sect. 3 gives a very useful description of the unique lattice L whose ideal \(I_L\) is nothing but \(I(Y_Q)\), see Lemma 3.2. So, a generating set of \(I(Y_Q)\) can be obtained from a basis of L. Theorem 3.4 gives a practical description of the lattice L for which \(I(Y_Q)=I_L\), leading to Algorithm 1. We include Procedure 3.5 implementing this algorithm in \({\texttt {Macaulay2}}\) [8] for computing a basis for L. Thus, we can check if \(I(Y_Q)\) is a complete intersection easily from this basis, see Remark 3.8 and Example 3.11.

Section 4 gives a direct method for computing the size of \(Y_Q\) taking advantage of its parametric representation and giving the length of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\). Our second method is inspired from [21, Proposition 3.3] and gives a polytope whose lattice points determine the size of \(Y_Q\), extending the corresponding result from the projective space to a general toric variety. However, our polytope is simpler than the polytope given in the special case where \(X=\mathbb P^n\), see Remark 4.6 and Example 4.7.

The main contribution of the paper is Sect. 5 in which we give a lower bound for the minimum distance of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), taking advantage of the parametric description of the subgroup \(Y_Q\). As an application, we compute the main parameters of the toric codes on Hirzebruch surfaces in Theorem 5.3 generalizing the corresponding result in [10]. We also share an example in Sect. 6 to reveal the potential of the family of parameterised codes.

2 Preliminaries

Let \({\mathbb K}=\mathbb F_q\) be a fixed finite field and \(\Sigma \subset \mathbb R^n\) be a complete simplicial fan with rays \(\rho _1,\dots ,\rho _r\) generated by the primitive lattice vectors \(\mathbf{v}_1,\dots ,\mathbf{v}_r\in \mathbb Z^n\), respectively. We consider the corresponding toric variety X with a split torus \(T_X\cong {({\mathbb K}^*)^n}\). We assume that the class group \({\text {Cl}}(X)\) have no torsion. Smooth X with an n-dimensional cone in its fan will satisfy this condition by Cox et al. [4, Proposition 4.2.5]. For applications to coding theory smooth toric varieties are sufficient, although we may prefer to study singular varieties such as weighted projective spaces for their simplicity. Given an element \(\mathbf{a }=(a_{1},\dots ,a_{s})\in \mathbb Z^s\) we use \(\mathbf{t }^\mathbf{a }\) to denote \(t_1^{a_1}\cdots t_s^{a_s}\). Recall the construction of \(T_X\) as a geometric quotient (see [3, 4]) via the following two key dual exact sequences:

where \(\phi\) denotes the matrix \([\mathbf{v}_1\cdots \mathbf{v}_r]^T\) and \({\mathcal {A}}=\mathbb Z^d\cong {\text {Cl}}X\) for \(d=r-n\),

where \(\pi :(t_1,\dots , t_r)\mapsto ({\mathbf {t}}^{{\mathbf {u}}_1}, \dots , {\mathbf {t}}^{{\mathbf {u}}_n}),\) with \({\mathbf {u}}_1,\dots , {\mathbf {u}}_n\) being the columns of \(\phi\) and \({\mathcal {G}}=\ker (\pi )\). Thus, \({\mathbf {u}}_1,\dots , {\mathbf {u}}_n\) constitute a natural \(\mathbb Z\)-basis for the key lattice \(L_{\beta }=\ker \beta = \phi (\mathbb Z^n) \subset \mathbb Z^r\). The exact sequence \({\mathfrak {P}}^*\) gives \(T_X\) a quotient representation \(T_X \cong {({\mathbb K}^*)^n}\cong ({\mathbb K}^*)^r /{\mathcal {G}}\), meaning that every element in the torus \(T_X\) can be represented as \([p_1:\cdots :p_r]:={\mathcal {G}}\cdot (p_1,\dots ,p_r)\) for some \((p_1,\dots ,p_r)\in ({\mathbb K}^*)^r\).

Denote by \(S={\mathbb K}[x_1,\dots ,x_r]\) the homogeneous coordinate ring of X, which is \(\mathbb Z^d\)-graded by letting \(\deg _{{\mathcal {A}}}(x_j):=\beta _j:=\beta (e_j)\) using the exact sequence \({\mathfrak {P}}\). Thus, \(S=\bigoplus _{\mathbf{\alpha }\in {\mathcal {A}}} S_{\mathbf{\alpha }}\), where \(S_{\mathbf{\alpha }}\) is the finite dimensional vector space spanned by the monomials having degree \(\mathbf{\alpha }\). Moreover, by Miller and Sturmfels [18, Theorem 8.6 and Corollary 8.8], one can choose \(\beta _j\in \mathbb N^d\), where \(\mathbb N\) is the set of non-negative integers.

Example 2.1

Let \(X={\mathcal {H}}_{\ell }\) be the Hirzebruch surface corresponding to a fan in \(\mathbb R^2\) with primitive ray generators \(\mathbf{v}_1=(1,0)\), \(\mathbf{v}_2=(0,1)\), \(\mathbf{v}_3=(-1,\ell )\), and \(\mathbf{v}_4=(0,-1)\), for any positive integer \(\ell\). If \({\mathbf {u}}_1=(1,0,-1,0)\), \({\mathbf {u}}_2=(0,1,\ell ,-1)\) and \(\beta =\begin{bmatrix} 1 &{} 0 &{} 1&{} \ell \\ 0 &{} 1 &{} 0&{} 1 \end{bmatrix}\), then we have the following exact sequences

where \(\phi =[{\mathbf {u}}_1 \, \, {\mathbf {u}}_2]\) and \(L_{\beta }=\langle {\mathbf {u}}_1, {\mathbf {u}}_2\rangle\),

where \(\pi :\mathbf{t}\mapsto (t_1t_3^{-1},t_2t_3^{\ell }t_4^{-1}).\) Then \({\text {Cl}}(X_\Sigma )\cong {\mathcal {A}}=\mathbb Z^2\) and

$$\begin{aligned} {\mathcal {G}}=\ker (\pi )=\{(t_1,t_2,t_1,t_1^{\ell }t_2)\;|\;t_1,t_2\in {\mathbb K}^*\}\cong ({\mathbb K}^*)^2. \end{aligned}$$

Hence, \(T_X \cong {({\mathbb K}^*)^2}\cong ({\mathbb K}^*)^{4} /{\mathcal {G}}\) is the torus of \(X=X_\Sigma\). The ring \(S={\mathbb K}[x_1,x_2,x_3,x_4]\) is \(\mathbb Z^2\)-graded via

$$\begin{aligned} \deg _{{\mathcal {A}}}(x_1)=\deg _{{\mathcal {A}}}(x_3)=(1,0),\quad \deg _{{\mathcal {A}}}(x_2)=(0,1), \quad \deg _{{\mathcal {A}}}(x_4)=(\ell ,1). \end{aligned}$$

Example 2.2

The homogeneous coordinate ring of the weighted projective space \(X=\mathbb P(1,w_1,\dots , w_n)\) is \({\mathbb K}[x_0,x_1,\dots ,x_n]\) which is \(\mathbb Z\)-graded where \(\deg _{{\mathcal {A}}} (x_0)=1\) and \(\deg _{{\mathcal {A}}}(x_i)=w_i>0\) for \(i=1,\dots ,n\).

If \(\beta =[1\; w_1\; \cdots \; w_n],\) and \(\mathbf{u }_1=(-w_1,1,0,\dots ,0),\mathbf{u }_2=(-w_2,0,1,0,\dots ,0),\dots ,\mathbf{u }_n=(-w_n,0,\dots ,0,1)\), then we have the following exact sequences:

where \(\phi =[{\mathbf {u}}_1\,{\mathbf {u}}_2\cdots {\mathbf {u}}_n]\) and \(L_\beta = \langle \mathbf{u }_1, \dots , {\mathbf {u}}_n \rangle\),

where \(\pi :\mathbf{t}\mapsto (t_0^{-w_1}t_1,t_0^{-w_2}t_2,\dots ,t_0^{-w_n}t_{n}).\) Then \({\text {Cl}}(X_\Sigma )\cong {\mathcal {A}}=\mathbb Z\) and

$$\begin{aligned} {\mathcal {G}}=\ker (\pi )=\{(t,t^{w_1},t^{w_2},\dots ,t^{w_n})\;|\;t\in {\mathbb K}^*\}\cong {\mathbb K}^*. \end{aligned}$$

Hence, \(T_X \cong {({\mathbb K}^*)^n}\cong ({\mathbb K}^*)^{n+1} /{\mathcal {G}}\) is the weighted projective torus of \(X=X_\Sigma\), where cones of \(\Sigma\) are spanned by all proper subsets of the set \(\{\mathbf{v}_1,\dots ,\mathbf{v}_{n+1}\}\), where \(\mathbf{v}_i\) is the i-th row of \(\phi\) above.

3 Vanishing ideals via saturation of lattice basis ideals

In this section, we describe the lattice whose ideal is the vanishing ideal \(I(Y_Q)\). For any parameterized toric set, we give an algorithm for computing a basis for the unique lattice defining \(I(Y_Q)\). This yields a generating set for \(I(Y_Q)\) via saturation.

Recall that \(\mathbf{m}=\mathbf{m}^+-\mathbf{m}^-\), where \(\mathbf{m}^+\in \mathbb N^r\) (respectively, \(\mathbf{m}^-\in \mathbb N^r\)) is the positive (respectively, negative) part of \(\mathbf{m}\), and \(\mathbf{x}^{\mathbf{m}}\) denotes the monomial \(x_1^{m_1}\cdots x_r^{m_r}\) for any \(\mathbf{m}=(m_1,\dots ,m_r)\in \mathbb N^r\). A binomial ideal is an ideal generated by binomials \({x^\mathbf{a }}-x^\mathbf{b }\), where \(\mathbf{a },\mathbf{b }\in \mathbb N^r\), see [6] for foundational properties they have. A subgroup \(L\subseteq \mathbb Z^r\) is called a lattice, and the following binomial ideal is called the associated lattice ideal:

$$\begin{aligned} I_L=\langle \mathbf{x}^\mathbf{a }-\mathbf{x}^\mathbf{b }|\mathbf{a }-\mathbf{b }\in L\rangle =\langle {\mathbf{x }}^{\mathbf{m }^+}-\mathbf{x }^{\mathbf{m }^-}|\mathbf{m }\in L\rangle . \end{aligned}$$

For any matrix Q, we denote by \(L_Q\) the lattice \(\ker _{\mathbb Z}Q\) of integer vectors in \(\ker Q\).

Lemma 3.1

A binomial \(f=\mathbf{x }^{\mathbf{a }}-\mathbf{x }^{\mathbf{b }}\) in S is homogeneous iff \(\mathbf{a }-\mathbf{b }\in L_\beta\).

Proof

By definition, \(\deg _{{\mathcal {A}}}(\mathbf{x }^{\mathbf{a }})={a_1}\deg _{{\mathcal {A}}}(x_1)+\cdots +{a_r}\deg _{{\mathcal {A}}}(x_r)=\beta _1{a_1}+\cdots +\beta _r{a_r}= \beta ({\mathbf{a }})\). So, f is homogeneous, that is, \(\deg _{{\mathcal {A}}}(\mathbf{x }^{\mathbf{a }})=\deg _{{\mathcal {A}}}(\mathbf{x }^\mathbf{b })\) iff \(\beta ({\mathbf{a }})=\beta ({\mathbf{b }})\). The latter is equivalent to \(\beta ({\mathbf{a }}-{\mathbf{b }})=0\), which holds true iff \(\mathbf{a }-\mathbf{b }\in L_\beta\). \(\square\)

The fact that \(I(Y_Q)\) is a lattice ideal has recently been observed in [23] without describing the corresponding lattice. It is now time to describe the missing lattice.

Lemma 3.2

The ideal \(I(Y_Q)\) is equal to the lattice ideal \(I_{L}\) for \(L=\{\mathbf{m}\in L_\beta : Q\mathbf{m}\equiv 0\;\text{ mod }\;(q-1)\}\).

Proof

Before we go further, let us note that \(x^\mathbf{a }(\mathbf{t}^{\mathbf{q}_1},\dots ,\mathbf{t}^{\mathbf{q}_r})=(\mathbf{t}^{\mathbf{q}_1})^{a_{1}}\cdots (\mathbf{t}^{\mathbf{q}_r})^{a_{r}}={\mathbf{t}}^{Q\mathbf{a }}\), for \(\mathbf{t}\in ({{\mathbb K}}^*)^s\). It follows that a binomial \(f=x^{\mathbf{a }}-x^{\mathbf{b }}\) vanishes at a point \((\mathbf{t}^{\mathbf{q}_1},\dots ,\mathbf{t}^{\mathbf{q}_r})\) if and only if \({\mathbf{t}}^{Q\mathbf{a }}={\mathbf{t}}^{Q\mathbf{b }}\). As \(\mathbf{t}\in ({{\mathbb K}}^*)^s\), this is equivalent to \(\mathbf{t}^{Q(\mathbf{a }-\mathbf{b })}=1\).

To prove \(I(Y_Q)\subseteq I_{L}\), take a generator \(f=x^{\mathbf{a }}-x^{\mathbf{b }}\) of \(I(Y_Q)\). As f vanishes on \(Y_Q\), we have that \(\mathbf{t}^{Q(\mathbf{a }-\mathbf{b })}=1\) for all \(\mathbf{t}\in ({{\mathbb K}}^*)^s\). Then, by substituting \(\mathbf{t}=(\eta ,1,\dots ,1)\) in this equality, we observe that \(q-1\) divides the first entry of the row matrix \(Q(\mathbf{a }-\mathbf{b })\), where \(\eta\) is a generator of the cyclic group \({\mathbb K}^*\) of order \(q-1\). Similarly, \(q-1\) divides the other entries, and so \(Q(\mathbf{a }-\mathbf{b })\equiv 0\;\text{ mod }\;(q-1)\). Since \(\mathbf{a }-\mathbf{b }\in L_\beta\) from Lemma 3.1, f being homogeneous, we have \(\mathbf{a }-\mathbf{b }\in {L}\).

Conversely, let \(f=x^{\mathbf{a }}-x^{\mathbf{b }}\in I_L\). Then \(\mathbf{a }-\mathbf{b }\in L_\beta\) and \(Q(\mathbf{a }-\mathbf{b })\equiv 0\;\text{ mod }\;(q-1)\). This implies that f is homogeneous by Lemma 3.1 and that \(\mathbf{t}^{Q(\mathbf{a }-\mathbf{b })}=1\) for all \(\mathbf{t}\in ({{\mathbb K}}^*)^s\). Hence, \(f(\mathbf{t}^{\mathbf{q}_1},\dots ,\mathbf{t}^{\mathbf{q}_r})=0\) for any \(\mathbf{t}\in ({{\mathbb K}}^*)^s\), by the first part. Thus, \(f\in I(Y_Q)\) and \(I_L\subseteq I(Y_Q)\). \(\square\)

For any lattice L, the lattice basis ideal of L is the ideal of S generated by the binomials \(\mathbf{x }^{\mathbf{m }^+}-\mathbf{x }^{\mathbf{m }^-}\) corresponding to the vectors \(\mathbf{m }\) which constitute a \(\mathbb Z\) - basis of L.

Let I and J be ideals in S. Then the ideal

$$\begin{aligned} I:J^{\infty }=\{F\in S \ : \ F \cdot J^k \subseteq I \quad \text{ for } \text{ some } \text{ integer } \;\; k\ge 0\} \end{aligned}$$

is called the saturation of I with respect to J.

Lemma 3.3

[18, Lemma 7.6] Let L be a lattice. The saturation of the lattice basis ideal of L with respect to the ideal \(\langle x_1\cdots x_r\rangle\) is equal to the lattice ideal \(I_L\).

Thus, we can obtain generators of \(I(Y_Q)=I_{L}\) from a \(\mathbb Z\)-basis of L. Although the lattice L in Lemma 3.2 is inevitable conceptually, finding its basis is a difficult task in general. The following result gives another description of L leading to an algorithm computing its basis.

Theorem 3.4

Let \(\pi _s:{\mathbb Z}^{n+s}\rightarrow {\mathbb Z}^{n}\) be the projection map sending \((c_1,\dots ,c_n,c_{n+1},\dots ,c_{n+s})\) to \((c_1,\dots ,c_n)\). Then \(I(Y_Q)=I_L\), for the lattice \(L=\{\phi \mathbf{c }: \mathbf{c }\in \pi _s\left( \text{ ker}_{\mathbb Z}[Q\phi |(q-1)I_s]\right) \}\). Furthermore, columns of the matrix \(\phi M\) constitute a basis for L, where M is a matrix whose columns are the first n coordinates of the generators of \(\text{ ker}_{\mathbb Z}[Q\phi |(q-1)I_s]\).

Proof

We have that \(I(Y_Q)=I_{L_1}\) where \(L_1=\{\mathbf{m}\in L_\beta : Q\mathbf{m}\equiv 0\; \text{ mod }\; (q-1)\}\) by Lemma 3.2. Therefore it is enough to prove that \(L=L_1\). Since \(\text{ Im }\phi =L_\beta\) by the exact sequence \({\mathfrak {P}}\), it follows that \(\mathbf{m}\in L_\beta\) iff \(\mathbf{m}=\phi \mathbf{c }\) for some \(\mathbf{c }\in \mathbb Z^n\). This means that

$$\begin{aligned} L_1=\{\phi \mathbf{c }:Q \phi \mathbf{c }\equiv 0\;\text{ mod }\; (q-1)\;\text{ and } ~~\mathbf{c }\in {\mathbb Z}^n\}. \end{aligned}$$

Take \(\phi \mathbf{c } \in L\) so that \(\mathbf{c }=(c_1,\dots ,c_n)\in \pi _s\left( \text{ ker}_{\mathbb Z}[Q\phi |(q-1)I_s]\right)\). Then there are \(c_{n+1},\dots ,c_{n+s} \in \mathbb Z\) such that \([Q\phi |(q-1)I_s](c_1,\dots ,c_n,c_{n+1},\dots ,c_{n+s})=0\). This is equivalent to

$$\begin{aligned}&Q\phi (c_1,\dots ,c_n)+(q-1)I_s(c_{n+1},\dots ,c_{n+s})=0, \quad \text{ or } \\&Q\phi \mathbf{c }=-(q-1)(c_{n+1},\dots ,c_{n+s}). \end{aligned}$$

This proves that \(Q \phi \mathbf{c }\equiv 0\;\text{ mod }\;(q-1)\). Thus \(\phi \mathbf{c }\in L_1.\)

For the converse, take \(\phi \mathbf{c }\in L_1\). Then \(Q\phi \mathbf{c } \equiv 0\;\text{ mod }\;(q-1)\). It follows that

$$\begin{aligned} Q\phi \mathbf{c }=(q-1)(c_{n+1},\dots ,c_{n+s}) \end{aligned}$$

for some \(c_{n+1},\dots ,c_{n+s}\in {\mathbb Z}\). Thus, we have \([Q\phi |(q-1)I_s](c_1,\dots ,c_n,-c_{n+1},\dots ,-c_{n+s})=0.\) Hence, we have \(\mathbf{c }=\pi _s(c_1,\dots ,c_n,-c_{n+1},\dots ,-c_{n+s})\in \pi _s\left( \text{ ker}_{\mathbb Z}[Q\phi |(q-1)I_s]\right) .\) Thus, \(\phi \mathbf{c }\in L\), completing the proof of the claim that \(I(Y_Q)=I_L\).

We next prove that the columns of \(\phi M\) form a basis for L, where M is a matrix whose columns are the first n coordinates of the generators of \(\text{ ker}_{\mathbb Z}[Q\phi |(q-1)I_s]\). As the matrix \(B=[Q\phi |(q-1)I_s]\) has rank s, its kernel \(\text{ ker}_{\mathbb Z}B\) has rank n. If A is the matrix whose columns \(A_1,\dots , A_n\) form a basis for \(\text{ ker}_{\mathbb Z}B\), then \(\text{ im } (A)=\text{ ker}_{\mathbb Z}B\) and that \(M=[I_n|0_{n\times s}]A\). Take any element \(\phi \mathbf{c }\in L\), where \(\mathbf{c }\in \pi _s\left( \text{ ker}_{\mathbb Z}B\right)\). Thus, we can write \(\mathbf{c }={A_1}k_1+\cdots +{A_n}k_n=A[k_1\cdots k_n]\) for some \(k_1,\dots , k_n\in \mathbb Z\) yielding \(\phi \mathbf{c }=\phi M [k_1\cdots k_n]\). Therefore L is spanned by \(n={\text {rank}}L\) columns of the \(r\times n\) matrix \(\phi M\). Hence, these columns constitute a basis for L. \(\square\)

Theorem 3.4 leads to the following algorithm for computing a \(\mathbb Z\)-basis of the lattice L for which we have \(I(Y_Q)=I_L\).

figure a

The algorithm can be implemented in \({\texttt {Macaulay2}}\) as follows.

Procedure 3.5

The command \({\texttt {ML}}\) gives the matrix whose columns are generators of the lattice L.

figure b

Procedure 3.6

A generating set for \(I(Y_Q)\) via saturation.

figure c

Example 3.7

Let \(X={\mathcal {H}}_{2}\) over \(\mathbb F_{11}\) and \(Q=[1\; 2\; 3\; 4 ]\). So, we have the following input:

figure d

Procedure 3.5 gives the following matrix whose columns constitute a basis of L:

$$\begin{aligned} {\texttt {ML}}={\begin{bmatrix}~~2 &{} ~~1 &{} ~~0&{}-1\\ {} -5 &{} ~~0 &{} ~~5 &{} ~0\\ \end{bmatrix}}^T. \end{aligned}$$

Finally, we determine \(I(Y_Q)=I_L\) using Procedure 3.6 and get \(I_L=\langle x_1^2x_2-x_4, x_1^5-x_3^5 \rangle\).

Remark 3.8

Another advantage of finding the matrix \({\texttt {ML}}\) giving a basis for the lattice is that one can confirm if the lattice ideal is a complete intersection immediately, by checking if \({\texttt {ML}}\) is mixed dominating.

Definition 3.9

Let A be matrix whose entries are all integers. A is called mixed if there is a positive and a negative entry in every column. If no square submatrix of A is mixed, it is called dominating.

Theorem 3.10

[19, Theorem 3.9] Let \(L\subseteq \mathbb Z^r\) be a lattice with the property that \(L\cap \mathbb N^r={0}\). Then, \(I_L\) is complete intersection \(\iff L\) has a basis \({\mathbf{m}_1,\dots ,\mathbf{m}_k}\) such that the matrix \([\mathbf{m}_1\cdots \mathbf{m}_k]\) is mixed dominating. In the affirmative case, we have

$$\begin{aligned} I_L=\langle \mathbf{x }^{\mathbf{m }_1^+}-\mathbf{x }^{\mathbf{m }_1^-},\dots , \mathbf{x }^{\mathbf{m }_k^+}-\mathbf{x }^{\mathbf{m }_k^-} \rangle . \end{aligned}$$

Using Theorem 3.10, one can confirm when \(I(Y_Q)=I_L\) is a complete intersection by looking at a basis of the lattice L.

Example 3.11

Let \(X={\mathcal {H}}_{\ell }\) be the Hirzebruch surface over \(\mathbb F_{q}\), where q is odd. For any positive integers \(q_1\) and \(q_2\), consider \(Q=[q_1\; q_2\; q_1+2\; \ell q_1+q_2]\). We will compute generators of \(I(Y_Q)\) for all q at once using Lemma 3.2. The key observation is that \(Y_Q=Y_{Q'}\) for the matrix \(Q'=[0\; 0\; 2\; 0]\), because we have \([t^{q_1}:t^{q_2}:t^{q_1+2}:t^{\ell q_1+q_2}]=[1:1:t^2:1]\) in X for all \(t\in {\mathbb K}^*\) from Example 2.1. Recall that the ideal \(\mathrm {I}(Y_{Q'})=\mathrm {I}_{L}\) for the lattice described by \(L=\{\mathbf{m}\in L_{\beta } \quad | \quad Q'\cdot \mathbf{m}\equiv 0 \quad \text{ mod }(q-1)\}.\) Since \(L_{\beta }\) is spanned by the columns \({\mathbf {u}}_1\) and \({\mathbf {u}}_2\) of the matrix

$$\begin{aligned} \phi =\begin{bmatrix} 1 &{} 0 &{} -1&{} ~~0 \\ 0 &{} 1 &{} ~~~\ell &{} -1 \end{bmatrix}^T, \end{aligned}$$

it follows that \(\mathbf{m}\in L_{\beta }\) if and only if \(\mathbf{m}={\mathbf {u}}_1a_1+{\mathbf {u}}_2a_2=(a_1,a_2,-a_1+\ell a_2,-a_2),\) for some \(a_1,a_2\in \mathbb Z\). Thus, we obtain \(Q'\cdot \mathbf{m}=-2a_1+2\ell a_2\) for \(\mathbf{m}\in L_{\beta }\). Therefore, \(\mathbf{m}\in L \iff -2a_1+2\ell a_2=(q-1)k\), for some \(k\in \mathbb Z\). Since \(q-1\) is even, the last condition is equivalent to \(a_1=\ell a_2-k\frac{q-1}{2}\) in which case \(\mathbf{m}=a_2\mathbf{m}_1-k\mathbf{m}_2\) , where \(\mathbf{m}_1=\ell {\mathbf {u}}_1+{\mathbf {u}}_2\) and \(\mathbf{m}_2=\left( \frac{q-1}{2}\right) {\mathbf {u}}_1\). Therefore, the matrix \({\texttt {ML}}\) whose columns \(\mathbf{m}_1\) and \(\mathbf{m}_2\) constitute a basis of L, is given by:

$$\begin{aligned} {\texttt {ML}}=\begin{bmatrix}~\ell &{} 1 &{} ~~~0 &{} ~-1\\ ~(q-1)/2 &{} ~~~0 &{} -(q-1)/2&{}~~~0 \end{bmatrix}^T. \end{aligned}$$

Since \({\texttt {ML}}\) is mixed dominating, it follows that \(I(Y_Q)=\mathrm {I}(Y_{Q'})=I_L\) is a complete intersection. Therefore, without the saturation Procedure 3.6, we get \(I(Y_Q)=I_L=\langle x_1^{\ell }x_2-x_4,x_1^{(q-1)/2}-x_3^{(q-1)/2}\rangle\) immediately. Notice that by taking \(q=11\), \(q_1=1\), \(q_2=2\) and \(\ell =2\), we recover the Example 3.7.

4 The order of the subgroup \(Y_Q\)

In this section, we give an algorithm computing the size of \(Y_Q\), which is the length of the parameterized toric code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), directly using the parameterization of \(Y_Q\). The order of this subgroup can also be computed using the vanishing ideal of \(Y_Q\) only if an element of \({\text {reg}}(Y_Q)\) is known, which is a difficult task to achieve. When \(Y_Q\) is a complete intersection of hypersurfaces of degrees \(\mathbf{\alpha }_1,\dots ,\mathbf{\alpha }_n\), it is shown that \(\mathbf{\alpha }_1+\cdots +\mathbf{\alpha }_n \in {\text {reg}}(Y_Q)\), so that the order is \(H_{Y_Q}(\mathbf{\alpha }_1+\cdots +\mathbf{\alpha }_n)\), see [25, Theorem 3.6]. However, if \(Y_Q\) is not a complete intersection, no specific element of \({\text {reg}}(Y_Q)\) is known. In these cases, it is natural to use the size \(|Y_Q|\) in order to determine \({\text {reg}}(Y_Q)\), see Example 4.4.

It is clear that \(T_X\) and \(Y_Q\) are groups under the componentwise multiplication

$$\begin{aligned}{}[p_1:\cdots :p_r][p'_1:\cdots :p'_r]=[p_1p'_1:\cdots : p_rp'_r] \end{aligned}$$

and that the map

$$\begin{aligned} \varphi _Q : ({\mathbb K}^{*})^{s}\rightarrow Y_Q, \quad \mathbf{t}\rightarrow [\mathbf{t}^{\mathbf{q}_1}:\cdots :\mathbf{t}^{\mathbf{q}_r}] \end{aligned}$$

is a group epimorphism. It follows that \(Y_Q\cong ({\mathbb K}^{*})^{s}/ \text{ ker }(\varphi _Q)\) and so,

$$\begin{aligned} |Y_Q|=|({\mathbb K}^{*})^{s}|/|\text{ ker }(\varphi _Q)|=(q-1)^s/|\text{ ker }(\varphi _Q)|. \end{aligned}$$

Hence, the length of the code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) depends on \(|\text{ ker }(\varphi _Q)|\).

Let \(\square _q=[0,q-2]^s\) be the hypercube inside \(\mathbb R^s\) determined by the field \({\mathbb K}=\mathbb F_q\) and \(\eta\) be a generator of \({\mathbb K}^*\). Let \(\mathbf{H }=\{{\mathbf{h}}\in \square _q \cap \mathbb Z^s \quad |\quad {\mathbf{h}}Q\phi \equiv 0\;\text{ mod }\;q-1\}\). We first prove that there is a one to one correspondence between the kernel \(\text{ ker }(\varphi _Q)\) and the set \(\mathbf{H }\).

Proposition 4.1

We have \(\text{ ker }(\varphi _Q) =\{(\eta ^{h_1},\dots ,\eta ^{h_s})|{\mathbf{h}}=(h_1,\dots ,h_s)\in \mathbf{H }\}\) and thus \(|\text{ ker }(\varphi _Q)|=|\mathbf{H }|\).

Proof

Let \(\mathbf{t}\in \text{ ker }(\varphi _Q)\subseteq ({\mathbb K}^*)^s\) . Then \([{\mathbf{t}}^{\mathbf{q}_{1}}:\cdots :{\mathbf{t}}^{\mathbf{q}_{r}}]=[1:\cdots :1]\), that is,\(({\mathbf{t}}^{\mathbf{q}_{1}},\dots ,{\mathbf{t}}^{\mathbf{q}_{r}})\) is element of the orbit \({\mathcal {G}}(1,\dots ,1)={\mathcal {G}}=\{\mathbf{x}\in ({\mathbb K}^*)^r \,|\, \mathbf{x}^{\mathbf{m}}=1 \;\text{ for } \text{ all }\;\mathbf{m}\in L_\beta \}\). Since \(L_\beta =\phi (\mathbb Z^n)\), we have \(\mathbf{m}=\phi \mathbf{c }\in L_{\beta }\) for any \(\mathbf{c }\in \mathbb Z^n\) and thus

$$\begin{aligned} \mathbf{x}^{\mathbf{m}}(\mathbf{t}^{\mathbf{q}_1},\dots ,{\mathbf{t}}^{\mathbf{q}_r})=\mathbf{t}^{Q \mathbf{m}}=\mathbf{t}^{Q \phi \mathbf{c }}=1, \quad \text{ for } \text{ any }\quad \mathbf{c }\in \mathbb Z^n. \end{aligned}$$
(1)

Since every \(\mathbf{t}\) in \(({\mathbb K}^*)^s\) satisfies \(\mathbf{t}=(\eta ^{h_1},\dots ,\eta ^{h_s})\) for some \({\mathbf{h}}=(h_1,\dots ,h_s)\in \square _q \cap \mathbb Z^s\), the equality (1) implies that \(\eta ^{{\mathbf{h}}Q \phi \mathbf{c }}=1\), for all \(\mathbf{c }\in \mathbb Z^n\). Thus, \({\mathbf{h}}Q \phi \mathbf{c } \equiv 0\;\text{ mod }\;q-1\) for all \(\mathbf{c }\in \mathbb Z^n\). By choosing \(\mathbf{c }=\mathbf{e }_i\), for all \(i=1,\dots ,n\), where \(\mathbf{e }_i\) is a standard basis vector of \(\mathbb Z^n\), we observe that \({\mathbf{h}}Q \phi \equiv 0\;\text{ mod }\;q-1\). This implies that \(\text{ ker }(\varphi _Q)\subseteq \{(\eta ^{h_1},\dots ,\eta ^{h_s})|{\mathbf{h}}\in \mathbf{H }\}\). The other inclusion is straightforward, completing the first part of the proof. Since the order of \(\eta\) is \(q-1\) and the integers \(h_i\) lie in \([0,q-2]\), it is clear that the correspondence between \(\text{ ker }(\varphi _Q)\) and \(\mathbf{H }\) is one to one. \(\square\)

Procedure 4.2

Given matrices Q and \(\phi\), and the prime power q, the following \({\texttt {Macaulay2}}\) procedure allows one to compute the length of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\). The list \({\texttt {A}}\) in the fifth step consists of the elements in \(\square _q \cap \mathbb Z^s\). In the sixth step, we check whether the elements of \(\square _q \cap \mathbb Z^s\) is in the set \(\mathbf{H }\) or not and compute \(k=|\mathbf{H }|\).

figure e

Example 4.3

Let \(X={\mathcal {H}}_{2}\) over \(\mathbb F_{11}\) and \(Q=[1\; 2\; 3\; 4 ]\) as in Example 3.7. Let us calculate the length of the codes arising from Q using the Hilbert function of the vanishing ideal \(I_L=\langle x_1^2x_2-x_4, x_1^5-x_3^5 \rangle\) found there. As the degrees of the variables are

$$\begin{aligned}&\deg (x_1)=\deg (x_3)=\beta _1=\beta _3=(1,0), \\&\deg (x_2)=\beta _2=(0,1),\\&\deg (x_4)=\beta _4=(2,1), \end{aligned}$$

the degrees of the generators are \(\alpha _1=(2,1)\) and \(\alpha _2=(5,0)\). By [25, Theorem 3.1], we can assure that the element \(\mathbf{\alpha }_1+\mathbf{\alpha }_2=(7,1) \in {\text {reg}}(Y_Q)\), so that the size is the value of the Hilbert function at (7, 1). Thus, we compute \(|Y_Q|=5\) by the command below, right after computing \(I(Y_Q)\) using the Procedure 3.6:

figure f

The same length can be computed directly using the Procedure 4.2 with the following input:

figure g

The following example is to illustrate the advantage of computing length beforehand in order to determine \({\text {reg}}(Y_Q)\) and to obtain a finite list of interesting codes. Notice that the order of \(Y_Q\) cannot be computed as in the previous example using [25, Theorem 3.1] since the vanishing ideal is not a complete intersection.

Example 4.4

Fix \(q=5\) and consider the incidence matrix Q of the square shaped graph with vertices \(V=\{1,2,3,4\}\) and edges \(E=\{\{1,2\},\{2,3\},\{3,4\},\{1,4\}\}\). We first compute a minimal generating set for the vanishing ideal of the subgroup \(Y_Q \subseteq \mathbb P(2,2,3,5)\):

$$\begin{aligned} x_1^4-x_2^4, \quad x_1^2x_2^6-x_3^2x_4^2, \quad x_3^6-x_1^2x_2^2x_4^2, \quad x_2^4x_3^4-x_4^4. \end{aligned}$$

It follows that \(I(Y_Q)\) is not a complete intersection. So, we cannot compute the order \(|Y_Q|\) as before. We calculate \(|Y_Q|\) directly using the Procedure 4.2 with the following input:

figure h

This reveals that \(|Y_Q|=32\). Hence, \(Y_Q\) contains half of the points inside the torus \(T_X\).

Since \(|Y_Q|=32\), \({\text {reg}}(Y_Q)=\{i \in \mathbb N\beta \, : \, H_{Y_Q}(i)=32\}.\) Using the conditional non-decreasing behavior of the Hilbert function noted in [25], we see that \(H_{Y_Q}(i)\le H_{Y_Q}(i+w)\le 32\), for \(w\in \{2,3,5\}\) and for all \(i>0\). This means that if \(H_{Y_Q}(i)=32\) for some \(i=i_0\) then \(H_{Y_Q}(i_0+2)=H_{Y_Q}(i_0+3)=32\) and thus \(H_{Y_Q}(i_0+j)=32\) for all \(j>3\). Thus, we just need to determine \(i_0\) with this property and \(H_{Y_Q}(i_0+1)\). The following command finds these values:

figure i

The output is 1, 0, 2, 1, 3, 3, 5, 5, 7, 8, 10, 11, 14, 14, 18, 19, 21, 24, 24, 28, 27, 31, 29, [23, 32, 31]. Here, [23, 32, 31] means that \(i_0=23\), \(H_{Y_Q}(i_0)=32\) and \(H_{Y_Q}(i_0+1)=31\), and hence we determine the regularity as \({\text {reg}}(Y_Q)=\{23\}\cup \{25+\mathbb N\}\). So, it suffices to consider the codes corresponding to \(\mathbf{\alpha }\) in the set

$$\begin{aligned}&\mathbb N\beta {\setminus } {\text {reg}}(Y_Q)\\&\quad =\{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22\}\cup \{24\}. \end{aligned}$$

Therefore, we obtain a finite list of interesting codes along with two of their parameters; the length is 32 and the dimensions are found above as the values of the Hilbert function of \(I(Y_Q)\).

We conclude the section with a polyhedral method to compute the size of the set \(Y_Q\). We next prove that the elements of the kernel \(\text{ ker }(\varphi _Q)\) correspond bijectively to lattice points lying inside the polytope \({\mathcal {P}}=\{({\mathbf{h}},{\mathbf{k}})\in \mathbb R^s \times \mathbb R^n \quad |\quad {\mathbf{h}}Q\phi =(q-1){\mathbf{k}}\quad \text{ and } \quad {\mathbf{h}}\in \square _q \}\).

Proposition 4.5

We have \(|\text{ ker }(\varphi _Q)|=|{\mathcal {P}} \cap \mathbb Z^{s+n}|\).

Proof

By Proposition 4.1, there is a one to one correspondence between \(\text{ ker }(\varphi _Q)\) and \(\mathbf{H }\). Hence, it suffices to show that there is a bijection between \(\mathbf{H }\) and \({\mathcal {P}} \cap \mathbb Z^{s+n}\). If \({\mathbf{h}}\in \mathbf{H }\), then \({\mathbf{h}}Q \phi \equiv 0\;\text{ mod }\;q-1\). Thus, there is some \({\mathbf{k}}=({k_1},\dots ,{k_n})\in \mathbb Z^n\) such that \({\mathbf{h}}Q \phi =(q-1){\mathbf{k}}\). Therefore, \(({\mathbf{h}},{\mathbf{k}})\in {\mathcal {P}} \cap \mathbb Z^{s+n}\). Notice that there is exactly one such \({\mathbf{k}}\) for every \({\mathbf{h}}\), as \((q-1){\mathbf{k}}=(q-1){\mathbf{k}}'\) implies \({\mathbf{k}}={\mathbf{k}}'\). Conversely, if \(({\mathbf{h}},{\mathbf{k}})\in {\mathcal {P}} \cap \mathbb Z^{s+n}\), then \({\mathbf{h}}Q \phi =(q-1){\mathbf{k}}\) so that \({\mathbf{h}}Q \phi \equiv 0\;\text{ mod }\;q-1\), completing the proof. \(\square\)

Remark 4.6

When \(X=\mathbb P^{r-1}\) is the \(n=r-1\) dimensional projective space, [21, Proposition 3.3] gives a bijection between the set \(\text{ ker }(\varphi _Q)\) and the lattice points in the polytope \(\mathbf{P }\) so that \(|\text{ ker }(\varphi _Q)|=|\mathbf{P } \cap \mathbb Z^{s+r+1}|\), where

$$\begin{aligned}&\mathbf{P }=\{({\mathbf{h}},\lambda ,\mu ) \in \mathbb R^s \times \mathbb R^r \times \mathbb R\quad |\quad {\mathbf{h}}Q=(q-1)\lambda + \mu \mathbf{1 }, \quad {\mathbf{h}}\in \square _q \\&\text{ and } \quad 0\le \mu \le q-2\} \quad \text{ and } \quad \mathbf{1 }\in \mathbb Z^r. \end{aligned}$$

Even in this special case, toric point of view improves upon [21, Proposition 3.3] in the sense that our polytope \({\mathcal {P}}\) lies in \(\mathbb R^{s+n}=\mathbb R^{s+r-1}\) whereas \(\mathbf{P }\) lies in \(\mathbb R^{s+r+1}\), which increases the complexity of computing the lattice points.

Example 4.7

Let us revisit [21, Example 3.4]. So, \(X=\mathbb P^3\) over \(\mathbb F_5\), \(\phi\) is the matrix with columns \((-1,1,0,0)\), \((-1,0,1,0)\) and \((-1,0,0,1)\). Consider the incidence matrix Q of the square shaped graph with vertices \(V=\{1,2,3,4\}\) and edges \(E=\{\{1,2\},\{2,3\},\{3,4\},\{1,4\}\}\). So, Q is the matrix with columns (1, 1, 0, 0), (0, 1, 1, 0), (0, 0, 1, 1) and (1, 0, 0, 1). Using Sage [24] we compute in 0, 04 seconds the following 16 integral points \((h_1,h_2,h_3,h_4,k_1,k_2,k_3)\) of the 4 dimensional compact polytope \({\mathcal {P}}\subset \mathbb R^7\) which is the convex hull of 16 vertices.

figure j

Therefore, the 16 points in the subgroup \(Y_Q\) are found to be \((\eta ^{h_1},\eta ^{h_2},\eta ^{h_3},\eta ^{h_4})\) for \((h_1,h_2,h_3,h_4)\) that appeared above. We also compute in 1 second the 16 lattice points of the 5 dimensional polytope \(\mathbf{P }\subset \mathbb R^9\) which is the convex hull of 32 vertices.

5 Parameterized toric codes \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\)

In this section, we apply algebraico-geometric techniques developed in previous sections to evaluation codes on subgroups \(Y_Q\). Recall that these linear codes are images of the following evaluation map

$$\begin{aligned} {\text {ev}}_{Y_Q}:S_\mathbf{\alpha }\rightarrow {\mathbb K}^N,\quad F\mapsto (F(P_1),\dots ,F(P_N)). \end{aligned}$$

The code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}:=\text {ev}_{Y_Q}(S_\mathbf{\alpha }) \subseteq \mathbb F_q^N\) is called the parameterized toric code associated to Q. There are 3 main parameters \([N,K,\delta ]\) of a linear code. The length N of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is the order \(|Y_Q|\) of the subgroup in our case studied in Sect. 4. The dimension of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), denoted \(K=\dim _{{\mathbb K}}({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})\), is the dimension of the image as a subspace of \(\mathbb F_q^N\). The number of non-zero entries in any \(c\in {{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}}\) is called its weight and minimum distance \(\delta\) of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is the smallest weight among all codewords \(c\in {{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}}{\setminus }\{0\}\). These parameters are related by the Singleton’s bound given by \(\delta \le N+1-K\). A code is called MDS (maximum distance separable), if \(\delta\) attains its maximum value, i.e. \(\delta =N+1-K\).

Recall from Sect. 4 that \(\varphi _Q : ({\mathbb K}^{*})^{s}\rightarrow Y_Q, \quad \mathbf{t}\rightarrow [\mathbf{t}^{\mathbf{q}_1}:\cdots :\mathbf{t}^{\mathbf{q}_r}]\) and \(|\mathbf{H }|=|\text{ ker }(\varphi _Q)|\) so that the length of the code is \(|Y_Q|=(q-1)^s/|\mathbf{H }|\). This map will also be used to give a lower bound on the minimum distance as we discuss now. A key observation is that the composition \(F\circ \varphi _Q\) defines a map \(({\mathbb K}^{*})^{s}\rightarrow {\mathbb K}\), for a polynomial \(F\in S_{\mathbf{\alpha }}\). Thus, \((F\circ \varphi _Q)(t_1,\dots ,t_s)=F(\mathbf{t}^{\mathbf{q}_1}:\cdots :\mathbf{t}^{\mathbf{q}_r})\), for any \((t_1,\dots ,t_s)\in ({\mathbb K}^{*})^{s}\).

As the weight of the codeword \(ev_{Y_Q}(F)\) is determined by the number of zeros of F inside \(Y_Q\), the idea is to compute this number by counting zeros of \(F\circ \varphi _Q\) inside \(({\mathbb K}^{*})^{s}\). The following result will be used for this purpose.

Lemma 5.1

[26, Lemma 3.2] Let \(G(y_1,y_2,\dots ,y_s)\) be a non-zero polynomial over \({\mathbb K}=\mathbb F_q\) of total degree d. Then, the number of zeros of G in \(({\mathbb K}^*)^s\) satisfies \(|V(G)\cap ({\mathbb K}^*)^s|\le d(q-1)^{s-1}\).

Let \(\mathbf{x }^{\mathbf{a }}=x_1^{a_1}\cdots x_r^{a_r}\in S_\alpha\). Substituting \(x_i=\mathbf{y }^{\mathbf{q}_{i}}\) in \(\mathbf{x }^{\mathbf{a }}\) yields the monomial \(\mathbf{y }^{Q\mathbf{a }}=y_1^{Q_1\mathbf{a }}\cdots y_s^{Q_s\mathbf{a }}\) and so \(\text{ deg}_{y_i}(\mathbf{y }^{Q\mathbf{a }})=Q_i \mathbf{a }\), where \(Q_i\) is the \(i-\)th row of Q. Let \(\overline{Q_i \mathbf{a }}\) be remainder of \(Q_i \mathbf{a }\) upon division by \(q-1\). Then the following number will be crucial in our lower bound:

$$\begin{aligned} d(\alpha ,Q)=\text{ max }\{\overline{Q_1\mathbf{a }}+\cdots +\overline{Q_s\mathbf{a }}\quad |\quad \mathbf{x }^{\mathbf{a }}\in S_{\mathbf{\alpha }}\}. \end{aligned}$$

Theorem 5.2

The minimum distance of the code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) satisfies

$$\begin{aligned} \delta ({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})\ge \frac{(q-1)^{s-1}}{|\mathbf{H }|}[q-1-d(\alpha ,Q)]. \end{aligned}$$

Proof

Let \(c=ev_{Y_Q}(F)\) be the codeword corresponding to the homogeneous polynomial \(F\in S_{\mathbf{\alpha }}\). Then, its weight is by definition the number of non-zero components, which is the difference between the number of total components and the number of zeros of F on \(Y_Q\): \(|Y_Q|-|V_X(F)\cap Y_Q|\). Therefore, the minimum of the weights corresponding to nonzero codewords is given by

$$\begin{aligned} \delta ({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})=|Y_Q|-\text{ max }\{|V_X(F)\cap Y_Q|\, : \,F\in S_\alpha {\setminus } I_\alpha (Y_Q)\}. \end{aligned}$$

For a homogeneous polynomial \(F\in S_\alpha\), we have \(F\in I(Y_Q) \iff F \circ \varphi _Q \in I(({\mathbb K}^*)^s)\). Since \(I(({\mathbb K}^*)^s)\) is generated by the binomials \(\{y_1^{q-1}-1,\dots ,y_s^{q-1}-1\}\), if \(F\notin I(Y_Q)\) and G is the remainder of \(F(\mathbf{y }^{\mathbf{q}_1},\dots ,\mathbf{y }^{\mathbf{q}_r})\) in \({\mathbb K}[y_1,\dots ,y_s]\) under division by the set \(\{y_1^{q-1}-1,\dots ,y_s^{q-1}-1\}\), then \(G\ne 0\). Recall from above that under this procedure every monomial \(\mathbf{x }^{\mathbf{a }}\) in F yields the monomial \(\mathbf{y }^{\overline{Q\mathbf{a }}}=y_1^{\overline{Q_1\mathbf{a }}}\cdots y_s^{\overline{Q_s\mathbf{a }}}\) whose total degree is \(\deg (\mathbf{y }^{\overline{Q_\mathbf{a }}})=\overline{Q_1\mathbf{a }}+\cdots +\overline{Q_s\mathbf{a }}\). Thus, the total degree of G is at most the mysterious number \(d(\mathbf{\alpha },Q)\) defined earlier. Therefore G has at most \(d(\alpha ,Q)(q-1)^{s-1}\) roots in \(({\mathbb K}^*)^s\) by Lemma 5.1.

For any point \([P]=[\mathbf{t}^{\mathbf{q}_1}:\cdots :\mathbf{t}^{\mathbf{q}_r}]\in Y_Q\), we observe the following substantial property

$$\begin{aligned}{}[P]\in V_X(F)\,\iff \,G(t_1\dots ,t_s)=0,\,\forall \,(t_1\dots ,t_s)\in \varphi _Q^{-1}([P]) \end{aligned}$$

which implies that \(|V_X(F)\cap Y_Q|=\frac{|V(G)\cap ({\mathbb K}^*)^s|}{|\mathbf{H }|}\). Then, it follows immediately that

$$\begin{aligned} |V_X(F)\cap Y_Q|\le \frac{d(\alpha ,Q)(q-1)^{s-1}}{|\mathbf{H }|}. \end{aligned}$$

Thus, the number \(\text{ max }\{|V_X(F)\cap Y_Q|\,|\,F\in S_\alpha {\setminus } I(Y_Q)\}\) being at most \(\frac{d(\alpha ,Q)(q-1)^{s-1}}{|\mathbf{H }|}\), we get our lower bound on \(\delta ({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})\) as we claim. \(\square\)

5.1 Toric codes on Hirzebruch surfaces

In this section, we compute main parameters of the toric code \({\mathcal {C}}_{\mathbf{\alpha },T_X}\) obtained from Hirzebruch surfaces, where \(\alpha =(c,d)\in \mathbb N\beta\). Hansen computed these parameters for the case \(c<q-1\) and \(d=b\), where b is to be defined below, see [10].

Theorem 5.3

Let \(T_X\) be the torus of the Hirzebruch surface \({\mathcal{H}}_\ell\) over \({\mathbb K}\) and \(\alpha =(c,d)\in \mathbb N\beta\) for any positive integer \(\ell\) . Then the dimension of toric code \({\mathcal {C}}_{\mathbf{\alpha },T_X}\) is given by

$$\begin{aligned}&\mathrm{dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },T_X} \\&\quad = {\left\{ \begin{array}{ll} (b+1)(c+1-\ell b/2), &{} \mathrm{if }\,c<q-1 \\ (q-1)(b'+1)+(b-b')(c+1-\ell (b+b'+1)/2, &{} \mathrm{if }\,c\ge q-1\,\mathrm{and }\,b\le q-2\\ (q-1)(b'+1)+(q-2-b')(c+1-\ell (q-2+b'+1)/2, &{} \mathrm{if }\,c\ge q-1 \,\mathrm{and }\,b'<q-2<b\\ (q-1)^2, &{} \,\mathrm{if }\,c\ge q-1 \,\mathrm{and }\, b' \ge q-2\\ \end{array}\right. } \end{aligned}$$

and its minimum distance equals

$$\begin{aligned}&\delta ({{\mathcal {C}}}_{\mathbf{\alpha },T_X}) \\&\quad = {\left\{ \begin{array}{ll} (q-1)(q-1-c), &{} \mathrm{if }\,c<q-1 \\ (q-1)-b', &{} \mathrm{if }\,c\ge q-1\, \mathrm{and }\,b\le q-2\\ (q-1)-b', &{} \mathrm{if }\,c\ge q-1,b >q-2\,\mathrm{and }\,b'<q-2\\ 1, &{} \mathrm{if }\,c\ge q-1 \,\mathrm{and }\, b' \ge q-2\\ \end{array}\right. } \end{aligned}$$

where b (respectively \(b'\) ) is the greatest non-negative integer with the property that \(c-b\ell \ge 0\;\text{ and }\;d-b\ge 0\) (respectively \(c-b'\ell \ge q-2\;\text{ and }\;d-b'\ge 0\) ).

Proof

We first show that \(Q=\begin{bmatrix}~~0 &{} ~~0 &{} ~~1&{}~~0\\ ~~0 &{} ~~0 &{} ~~0 &{} ~1 \end{bmatrix}\) parameterizes the torus, that is, \(Y_Q=T_X.\)

$$\begin{aligned}&\begin{bmatrix}h_1&h_2\end{bmatrix}\begin{bmatrix}~~0 &{} ~~0 &{} ~~1&{}~~0\\ ~~0 &{} ~~0 &{} ~~0 &{} ~1 \end{bmatrix}\begin{bmatrix}~~1 &{} ~~0 &{} ~-1&{}~~0\\ ~~0 &{} ~~1 &{} ~~\ell &{} ~-1 \end{bmatrix}^T=\begin{bmatrix}~~h_1\\ ~~h_1\ell -h_2 \end{bmatrix}\\&\quad \equiv 0\;\text{ mod }\;q-1,\,\text{ for }\;0\le h_1,h_2\le q-2 \end{aligned}$$

implies that \(h_1=0=h_2\). So, \(\mathbf{H }=\{{\mathbf{h}}\in \square _q \cap \mathbb Z^s \quad |\quad {\mathbf{h}}Q\phi \equiv 0\;\text{ mod }\;q-1\}=\{(0,0)\}\) and \(|Y_Q|=(q-1)^2/|\mathbf{H }|=(q-1)^2\). As \(Y_Q\subset T_X\) and \(|T_X|=(q-1)^2\), we have \(Y_Q=T_X\), for \(X={\mathcal{H}}_\ell\).

Let us find a \({\mathbb K}-\)basis for \(S_\alpha\) for any \(\alpha =(c,d)\in \mathbb N\beta\) where \(\beta =\begin{bmatrix}~~1 &{} ~~0 &{} ~~1&{}~~\ell \\ ~~0 &{} ~~1 &{} ~~0 &{} ~1 \end{bmatrix}\). Since b is the greatest non-negative integer with the property that \(\alpha =(c,d)=b(\ell ,1)+(a,a')\) for some non-negative integers \(a=c-b\ell \ge 0\) and \(a'=d-b\ge 0\), the set \(B_\alpha :=\{\mathbf{x }^\mathbf{a }\,|\,\text{ deg }(\mathbf{x }^\mathbf{a })=\beta \mathbf{a }=\alpha ,\,0\le a_4\le b\}\) is a \({\mathbb K}-\)basis for \(S_\alpha\). For a fixed \(a_4\), the power \(a_2=d-a_4\) is fixed too and \(a_1+a_3=c-\ell a_4\). So,

$$\begin{aligned}&B_\alpha =\{\mathbf{x }^\mathbf{a }\,|\,(a_1+a_3+\ell a_4,a_2+a_4)=\alpha ,\,0\le a_4\\&\quad \le b,\,a_2=d-a_4,\,a_1+a_3=c-\ell a_4\}. \end{aligned}$$

This means that for every choice of \(a_4\) there are \(c-\ell a_4+1\) possibilities for the tuple \((a_1,a_3)\), hence

$$\begin{aligned} |B_\alpha |=\sum \limits _{a_4=0}^{b}(c+1-\ell a_4)=(c+1)(b+1)-\ell \frac{b(b+1)}{2}=(b+1)(c+1-\ell b/2). \end{aligned}$$

We know that columns of \(\phi\) form a basis for \(L_\beta\) from Example 2.1. Since \(I(T_X)=I_{(q-1)L_\beta }\), columns of \({\texttt {ML}}\) constitute a basis of \((q-1)L_\beta\), where

$$\begin{aligned} {\texttt {ML}}=(q-1)\phi =\begin{bmatrix}~q-1 &{} ~~~0 &{} -(q-1)&{}~~~0\\ ~~~0 &{} -(q-1) &{} -\ell (q-1) &{} ~(q-1) \end{bmatrix}^T. \end{aligned}$$

Since \({\texttt {ML}}\) is mixed dominating, it follows from Theorem 3.10 that

$$\begin{aligned} I(T_X)=\langle x_1^{q-1}-x_3^{q-1},x_4^{q-1}-x_2^{q-1}x_3^{\ell (q-1)}\rangle . \end{aligned}$$

Therefore \(x_1^{q-1}= x_3^{q-1},x_4^{q-1}=x_2^{q-1}x_3^{\ell (q-1)}\) in the ring \(S/I(T_X)\) and a basis for \(S_{\mathbf{\alpha }}/I_{\mathbf{\alpha }}(T_X)\) is

$$\begin{aligned}&{\bar{B}}_\alpha =\{\mathbf{x }^\mathbf{a }\,|\,\, a_1=c-a_3-\ell a_4, a_2=d-a_4, 0\le a_3\le \min \{c-\ell a_4,q-2\} \text { , } 0\\&\quad \le a_4\le \min \{b,q-2\}\}. \end{aligned}$$

By the definition of \(b'\), we have \(\min \{c-\ell a_4,q-2\}=c-\ell a_4\) for \(b'<a_4\) and \(\min \{c-\ell a_4,q-2\}=q-2\) for \(0\le a_4 \le b'\). The length of the code \({{\mathcal {C}}}_{\mathbf{\alpha },T_X}\) is \(N=|T_X|=(q-1)^2.\) Next, we compute its dimension and minimum distance.

Case I: Let \(c=a+b\ell <q-1\). It is easy to see that \(B_\alpha ={\bar{B}}_\alpha\) , so \(\text{ dim}_{\mathbb K}({\mathcal {C}}_{\mathbf{\alpha },T_X})=|B_\alpha |\). Since

$$\begin{aligned} d(\alpha ,Q)= & {} \text{ max }\{\overline{Q_1\mathbf{a }}+\overline{Q_2\mathbf{a }}\,|\,\mathbf{x }^\mathbf{a }\in B_\alpha \}\\= & {} \text{ max }\{a_3+a_4\,|\,0\le a_4\le b,\,a_3+a_1=c-\ell a_4\}=c, \end{aligned}$$

\(\delta ({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q})\ge (q-1)^2-(q-1)c\) using Theorem 5.2. On the other hand, for \({\mathbb K}^*=\langle \eta \rangle\), we have

$$\begin{aligned} F=x_2^ d\prod \limits _{i=1}^{c}(x_3-\eta ^ix_1)\in S_\alpha \end{aligned}$$

vanishing exactly at the \(c(q-1)\) points \(P_{i,j}=[1:1:\eta ^i:\eta ^j]\in T_X\), where \(1\le i \le c\) and \(1\le j\le q-1\). Thus, there is a codeword \(\text{ ev}_{\alpha ,T_X}(F)\) with weight \((q-1)^2-(q-1)c\). Hence,

$$\begin{aligned} \delta ({{\mathcal {C}}}_{\mathbf{\alpha },T_X})=(q-1)^2-(q-1)c=(q-1)(q-1-c). \end{aligned}$$

Case II: Let \(c\ge q-1\) and \(b\le q-2\). Then \(\min \{b,q-2\}=b\). So, if \(0\le a_4\le b'\) then \(0\le a_3 \le q-2\) but if \(a_4 > b'\) then \(0\le a_3 \le c-\ell a_4\), yielding the formula

$$\begin{aligned} \text{ dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}=|{\bar{B}}_\alpha |=(q-1)(b'+1)+\sum \limits _{a_4=b'+1}^{b}(c-\ell a_4+1) . \end{aligned}$$

Take \(F\in {\bar{S}}_\alpha\). Then we can write

$$\begin{aligned} F(x_1,x_2,x_3,x_4)= & {} \sum \limits _{a_4=0}^{b'}\left[ \sum \limits _{a_3=0}^{q-2}k_{a_{3}a_4}x_3^{a_3}x_1^{c-\ell a_4-a_3}\right] x_4^{a_4}x_2^{d-a_4}\\&+\,\sum \limits _{a_4=b'+1}^{b}\left[ \sum \limits _{a_3=0}^{c-\ell a_4}k'_{a_{3}a_4}x_3^{a_3}x_1^{c-\ell a_4-a_3}\right] x_4^{a_4}x_2^{d-a_4}. \end{aligned}$$

For any \(G=G(y_3,y_4)=F(1,1,y_3,y_4),\) we set

$$\begin{aligned} A=\{s_0\in {\mathbb K}^*\,|\,y_4-s_0\,\text{ divides } \, G(y_3,y_4)\} \end{aligned}$$

and \(V^*(G)=V(G)\cap ({\mathbb K}^*)^2.\) The sets \(V(G)\cap ({\mathbb K}^*\times A)\) and \(V(G)\cap ({\mathbb K}^*\times ({\mathbb K}^*{\setminus } A))\) form a partition of \(V^*(G)\). Since \(V(G)\cap ({\mathbb K}^*\times A)=a(q-1)\) and \(V(G)\cap ({\mathbb K}^*\times ({\mathbb K}^*{\setminus } A))\le d_3(q-1-a)\), we get

$$\begin{aligned} |V^*(G)|\le |A|(q-1)+ d_3(q-1-|A|) \end{aligned}$$
(2)

where \(d_3=\text{ deg}_{y_3}(G)\) and \(a=|A|.\) We claim that \(|V^*(G)|\le (q-1)(q-2)+b'\). a is at most b, because

$$\begin{aligned} \text{ max }\{\text{ deg}_{y_4}G\,|\,G(y_3,y_4)=F(1,1,y_3,y_4),F\in {\bar{S}}_\alpha \}=b. \end{aligned}$$

Then there are three cases, depending upon the value of a: \(a\le b',\,b'<a<b,\,a=b.\)

Case II.a: We begin with the case \(a\le b'.\) This implies \(d_3\le q-2,\) because \(d_3\le c-b'\ell\) and \(c-b'\ell \ge q-2\). Then by (2), we conclude that

$$\begin{aligned}&|V^*(G)|\le a(q-1)+d_3(q-1-a)=a(q-1)+(q-2)(q-1-a)\\&\quad =(q-2)(q-1)+a\le (q-2)(q-1)+b'. \end{aligned}$$

Case II.b: Suppose that \(a=b'+k<b\) where \(k\ge 1\) and \(b'\ne b\) implies \(d_3\le c-(b'+k)\ell .\) From here, the inequality (2) gives the following upper bound:

$$\begin{aligned}&| V^*(G)| \le a(q-1)+(q-1-a)(c-\ell (b'+k))\nonumber \\&\quad = a(q-1)+(q-1)(c-\ell (b'+k))-a(c-\ell (b'+k)\nonumber \\&\quad = a(q-1)+(q-1)\left( c-\ell (b'+k)-(q-2)+(q-2)\right) -a(c-\ell (b'+k))\nonumber \\&\quad =(q-1)(q-2)+(q-1)\left( c-\ell (b'+k)-(q-2)\right) \nonumber \\&\qquad +a\left( q-2-(c-\ell (b'+k))+1\right) \nonumber \\&\quad =(q-1)(q-2)+\left( q-2-(c-\ell (b'+k))\right) \left( a-(q-1)\right) +a{} \end{aligned}$$
(3)

On the other hand, we claim that \(c-(b'+1)\ell \le q-3.\) To prove this, assume that \(c-(b'+1)\ell \ge q-2\). Then \(b'\ne b\) implies that \(d-(b'+1)\ge 0\). So this contradicts that \(b'\) is the greatest non-negative integer with the property that \(c-b'\ell \ge q-2\;\text{ and }\;d-b'\ge 0\).

It follows that \(c-\ell (b'+k)=c-\ell (b'+1)-\ell (k-1)\le q-3-\ell (k-1),\) which easily gives that \(q-2-\left( c-\ell (b'+k)\right) \ge 1+ \ell (k-1)\). From \(a<b\le q-2\), we obtain that \(a-(q-1)\le -2\). If we combine the last two inequalities and (3), then we have

$$\begin{aligned} |V^*(G)|\le (q-1)(q-2)-2\left( \ell (k-1)+1\right) +b'+k. \end{aligned}$$
(4)

Furthermore, \(\ell \ge 2\) and \(k-1\ge 0\), hence we get that \(-2\left( (k-1)\ell +1\right) \le -4k-2\). Then (4) becomes

$$\begin{aligned} |V^*(G)|\le (q-1)(q-2)-3k-2+b'< (q-1)(q-2)+b', \end{aligned}$$

as required.

Case II.c: Consider the case \(a=b\ne b'.\) Similar to (3), \(d_3\) is bounded by \(d_3\le c-b\ell\) which together with (2) gives

$$\begin{aligned} | V^*(G)|\le (q-1)(q-2)+\left( q-2-(c-\ell (b))\right) \left( b-(q-1)\right) +b. \end{aligned}$$
(5)

Note that \(c-\ell b=c-\ell \left( b'+1+b-(b'+1)\right) \le q-3-\ell (b-b'-1)\), since \(c-(b'+1)\ell \le q-3\) proved in Case II.b. Moreover, \(b-(q-1)\le -1\), thus we have

$$\begin{aligned} | V^*(G)|\le (q-1)(q-2)+(\ell -1)(b'-b)+\ell -1+b'. \end{aligned}$$

From \(b'<b\), we have \((\ell -1)(b'-b)\le (\ell -1)(-1)=1-\ell\), therefore

$$\begin{aligned} | V^*(G)|\le (q-1)(q-2)+(\ell -1)(b'-b)+\ell -1+b'\le (q-1)(q-2)+b' \end{aligned}$$

completing the proof of the claim.

Thus, the minimum distance is at least \((q-1)^2-(q-1)(q-2)-b'=(q-1)-b'\), since

$$|V_{{\mathcal{H}}_\ell} (F)\cap T_X|=|V(F(1,1,y_3,y_4))\cap ({\mathbb{K}}^*)^4|=|V^*(G)|$$

for any \(F\in {\bar{S}}_\alpha\). On the other hand, since \(|V^*(G_0)|=(q-1)(q-2)+b'\) for the polynomial

$$\begin{aligned} G_0(y_3,y_4)=\prod \limits _{i=1}^{q-2}(y_3-\eta ^i)\prod \limits _{j=1}^{b'}(y_4-\eta ^j), \end{aligned}$$

there is a codeword with weight \((q-1)-b'\). This shows that \(\delta ({{\mathcal {C}}}_{\mathbf{\alpha },T_X})=(q-1)-b'\). Note that \(G_0=F_0(1,1,y_3,y_4)\) for

$$\begin{aligned} F_0(x_1,\dots ,x_4)=x_1^{c-\ell b'-(q-2)}x_2^{d-b'}\prod \limits _{i=1}^{q-2}(x_3-\eta ^ix_1)\prod \limits _{j=1}^{b'}(x_4-\eta ^j x_1^{\ell }x_2). \end{aligned}$$

Case III: Suppose \(c\ge q-1\), \(b\ge q-2\) and \(b'< q-2\). Since \(0\le a_4\le \min \{b,q-2\}= q-2\), we get

$$\begin{aligned} \text{ dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}=|{\bar{B}}_\alpha |=(q-1)(b'+1)+\sum \limits _{a_4=b'+1}^{q-2}(c-\ell a_4+1) . \end{aligned}$$

Pick \(F\in {\bar{S}}_\alpha\). Then we can write

$$\begin{aligned} F(x_1,x_2,x_3,x_4)= & {} \sum \limits _{a_4=0}^{b'}\left[ \sum \limits _{a_3=0}^{q-2}k_{a_{3}a_4}x_3^{a_3}x_1^{c-\ell a_4-a_3}\right] x_4^{a_4}x_2^{d-a_4}\\&+\,\sum \limits _{a_4=b'+1}^{q-2}\left[ \sum \limits _{a_3=0}^{c-\ell a_4}k'_{a_{3}a_4}x_3^{a_3}x_1^{c-\ell a_4-a_3}\right] x_4^{a_4}x_2^{d-a_4}. \end{aligned}$$

The idea is the same as in Case II. To prove that \(\delta ({{\mathcal {C}}}_{\mathbf{\alpha },T_X})=(q-1)-b'\), we show that the maximum value of |V(G)| is \((q-1)(q-2)+b'\). In this case, \(a\le q-2\) and we split the proof of the claim into three cases: \(a\le b',\,b'<a<q-2,\,a=q-2.\) The proof is quite similar to that of the claim in Case II, so the proof is omitted here.

Case IV: Let \(c\ge q-1\) and \(b'\ge q-2\). From \(b'\le b,\) \(0\le a_4\le \min \{b,q-2\}= q-2\), We have

$$\begin{aligned} {\bar{B}}_\alpha =\{\mathbf{x }^\mathbf{a }\,|\,\, a_1=c-a_3-\ell a_4, a_2=d-a_4, 0\le a_3\le q-2 \text { , } 0\le a_4\le q-2\} \end{aligned}$$

giving \(\text{ dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}=|{\bar{B}}_\alpha |=(q-1)^2 .\) The code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is trivial, that is, \(\delta ({{\mathcal {C}}}_{\mathbf{\alpha },T_X})=1.\) \(\square\)

Remark 5.4

As the referee pointed out, it is noteworthy that the same polynomials are used independently to give some codewords having the minimum weight in Theorem 5.3 and in [20, Proposition 4.2.4].

Example 5.5

Here, we give another family of codes whose minimum distance attains our bound. These are actually Reed-Solomon codes obtained from cyclic subgroups of the torus \(T_X\), for the Hirzebruch surface \(X={\mathcal {H}}_{\ell }\) over \({\mathbb K}=\mathbb F_{q}\), where q is an odd prime power and \(\ell\) is positive.

Take \(Q=[q_1\quad q_2\quad q_1+2\quad q_1\ell +q_2]\) with \(q_1,q_2\in \mathbb Z\) and \(\alpha =(c,d)\in \mathbb N\beta\). Then, we show below that the parameterized code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is a non trivial MDS code with parameters \([\frac{q-1}{2},c+1,\frac{q-1}{2}-c]\) if \(c<\frac{q-1}{2}\) and is a trivial code otherwise.

First recall from Example 3.11 that \(Y_Q=Y_Q'\) where \(Q'=[0\; 0\; 2\; 0]\). It follows that \(Y_Q\) is generated by the point \([1:1:\eta ^2:1]\) with \(\eta\) being a generator for \({\mathbb K}^*\). Hence the order of \(Y_Q\) equals \(|\eta ^2|=\frac{q-1}{(q-1,2)}=\frac{q-1}{2}\) proving that \(|\mathbf{H }|=2\) and that the length of \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is \(N=\frac{q-1}{2}\).

Example 3.11 gives also that \(I(Y_Q)=I_L\) is generated by \(\ x_1^2x_2-x_4\) and \(x_1^{(q-1)/2}-x_3^{(q-1)/2}\). Thus, \(x_4\equiv x_1^{\ell }x_2\) and \(x_3^{\frac{q-1}{2}}\equiv x_1^{\frac{q-1}{2}}\) in \(S/\mathrm {I}_{L}\). Hence, a basis for the vector space \(S_{\mathbf{\alpha }}/I_{\mathbf{\alpha }}(Y_Q)\) is given by

$$\begin{aligned} {\bar{B}}_\alpha ={\left\{ \begin{array}{ll} \{x_1^{c-a_3}x_2^{d} x_3^{a_3} \,|\, 0\le a_3 \le c\} &{} \text{ if } c<\frac{q-1}{2} \\ \{x_1^{c-a_3}x_2^{d} x_3^{a_3} \,|\, 0\le a_3 < (q-1)/2\} &{} \text{ if } c \ge \frac{q-1}{2} \end{array}\right. } \end{aligned}$$

leading to

$$\begin{aligned} \text{ dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}=|{\bar{B}}_\alpha |= {\left\{ \begin{array}{ll} c+1 &{} \text{ if } c<\frac{q-1}{2} \\ \frac{q-1}{2} &{} \text{ if } c \ge \frac{q-1}{2}. \end{array}\right. } \end{aligned}$$

The elements of \({\bar{B}}_\alpha\) will be evaluated at the points \(P_j=[1:1:\eta ^{2j}:1]\) of \(Y_Q\) to get the generator matrix for \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), which shows that \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is a Reed–Solomon (MDS) code.

Example 5.6

We give yet another instance where our bound on minimum distance is attained by codes obtained from cyclic subgroups of the torus of a weighted projective space introduced in Example 2.2. Recall that the homogeneous coordinate ring of the weighted projective space \(X=\mathbb P(1,w_1,\dots , w_n)\) over \({\mathbb K}=\mathbb F_q\) is \({\mathbb K}[x_0,x_1,\dots ,x_n]\) which is \(\mathbb Z\)-graded where \(\deg _{{\mathcal {A}}} (x_0)=1\) and \(\deg _{{\mathcal {A}}}(x_i)=w_i>0\) for \(i=1,\dots ,n\).

We also recall that a \(\mathbb Z\)-basis for the key lattice \(L_\beta\) for the row matrix \(\beta =[1\; w_1\; \cdots \; w_n],\) is given by \(\{\mathbf{u }_1, \dots , {\mathbf {u}}_n \}\subset \mathbb Z^{n+1}\) where \(\mathbf{u }_i=(-w_i,\mathbf{e }_i)\) and \(\mathbf{e }_i\) is the standard basis vector of \(\mathbb Z^n\), for each \(i=1,\dots ,n\). Let \(Q=[0\;|\;a\mathbf{e }_i]\) be the row matrix with a unique nonzero positive integer a at the i-th column for \(i\in \{1,\dots n\}\) together with n zero columns elsewhere. Assume that a divides \(q-1\).

At first glance it is not clear that the code \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is a Reed–Solomon code. This will be clear from the set \({\bar{B}}_\alpha\) obtained below using our results.

Let \(\alpha (i)\) be the greatest non-negative integer to satisfy \(\alpha =\alpha (i)w_i+\alpha '(i)\) for some \(0\le \alpha '(i)<w_i\).

It is easy to see that the point \([1:\cdots :\eta ^a:\cdots :1]\) with \(\eta ^a\) at the i-th component generates \(Y_Q\), and that \(|Y_Q|=|\eta ^a|=\frac{q-1}{a}\) and hence \(|\mathbf{H }|=a\).

Let us find generators for the vanishing ideal of \(Y_Q\subset {\mathbb K}[x_0,x_1,\dots ,x_n]\). By Lemma 3.2, \(I(Y_Q)=I_L\) for the lattice \(L=\{\mathbf{m}\in L_\beta : Q\mathbf{m}\equiv 0\;\text{ mod }\;(q-1)\}\). Using Example 2.1,we find a basis for L. Take \(\mathbf{m}\in L_\beta\), then \(\mathbf{m}=\phi \mathbf{c }\) for some \(\mathbf{c }\in \mathbb Z^n\). \(\mathbf{m}\in L\) if and only if \(Q\phi \mathbf{c }=a\mathbf{e }_i\mathbf{c }=ac_i\equiv 0\;\text{ mod }\;q-1\) which is equivalent to \(c_i=\frac{q-1}{a}k\) for some \(k\in \mathbb Z\). Thus, \(\mathbf{m}\in L\) if and only if

$$\begin{aligned} \mathbf{m}=c_1 {\mathbf {u}}_1+\cdots +c_i {\mathbf {u}}_i+\cdots +c_n {\mathbf {u}}_n=c_1 {\mathbf {u}}_1+\cdots +k\left( \frac{q-1}{a} {\mathbf {u}}_i\right) +\cdots +c_n {\mathbf {u}}_n. \end{aligned}$$

Hence, a \(\mathbb Z\)-basis for L is given by the set \(\{\mathbf{u }_1, \dots ,{\mathbf {u}}_{i-1},\frac{q-1}{a} {\mathbf {u}}_i,{\mathbf {u}}_{i+1},\dots , {\mathbf {u}}_n \}\). Since the matrix \({\texttt {ML}}=[\mathbf{u }_1 \cdots {\mathbf {u}}_{i-1} \quad \frac{q-1}{a} {\mathbf {u}}_i \quad {\mathbf {u}}_{i+1} \cdots {\mathbf {u}}_n]\) is mixed dominating, \(I(Y_Q)\) is a complete intersection generated by

$$\begin{aligned}&\{ F_1,\dots ,F_i,\dots ,F_n\} \text { where } F_i=x_0^{(q-1)w_i/a}-x_i^{(q-1)/a}\\&\quad \text {and } F_j=x_0^{w_j}-x_j \text { for } j\in \{1,\dots ,n\}{\setminus }\{i\}. \end{aligned}$$

Therefore, \(x_0^{(q-1)w_i/a}=x_i^{(q-1)/a}\) and \(x_0^{w_j}=x_j\) for \(j\in \{1,\dots ,n\}{\setminus }\{i\}\) in the quotient ring \(S/I(Y_Q)\). For a positive integer \(\alpha \in \mathbb N\beta =\mathbb N\), a basis \({\bar{B}}_\alpha\) for the vector space \(S_{\mathbf{\alpha }}/I_{\mathbf{\alpha }}(Y_Q)\) is given by

$$\begin{aligned} {\bar{B}}_\alpha = {\left\{ \begin{array}{ll} \{x_0^{\mathbf{\alpha }-a_iw_i}x_i^{a_i}\,|\,0\le a_i\le \alpha (i)\} &{} \text{ if } \alpha (i)<\frac{q-1}{a} \\ \{x_0^{\mathbf{\alpha }-a_iw_i}x_i^{a_i}\,|\,0\le a_i < \frac{q-1}{a}\} &{} \text{ if } \alpha (i) \ge \frac{q-1}{a}. \end{array}\right. } \end{aligned}$$

So, we get

$$\begin{aligned} \text{ dim}_{{\mathbb K}}{{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}=H_{Y_Q}(\alpha )=|{\bar{B}}_\alpha |= {\left\{ \begin{array}{ll} \alpha (i)+1 &{} \text{ if } \alpha (i)<\frac{q-1}{a} \\ \frac{q-1}{a} &{} \text{ if } \alpha (i) \ge \frac{q-1}{a}. \end{array}\right. } \end{aligned}$$

The elements of \({\bar{B}}_\alpha\) will be evaluated at the points \(P_j=[1:\cdots :\eta ^{aj}:\cdots :1]\) of \(Y_Q\) to get the generator matrix for \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\), which shows that \({{\mathcal {C}}}_{\mathbf{\alpha },Y_Q}\) is a Reed–Solomon (MDS) code.

6 A parameterised toric code

In this section, we give an example to reveal that some toric varieties other than \(\mathbb P^n\) can have more and better codes, and to demonstrate that certain subgroups \(Y_Q\) of \(T_X\) can produce better codes than \(T_X\) produces.

Let us start by explaining what we mean from “better” in this context. A classical approach to compare two codes having the same length and dimension is to compare the remaining parameter: the minimum distance. The code with a bigger minimum distance is regarded better as it will have a bigger error-correction capacity. A code is called BP (best possible) if its minimum distance attains the maximum possible value among all codes with the same length and dimension, which can be checked online using the database [7] recording lower and upper bounds for the minimum distance. For a given length and dimension, this database lists a BK (best known) code over a finite field with at most 9 elements, whose minimum distance determines the lower bound. Although the upper bound is theoretical, it does not come from the same source for all the codes. A unique but mostly weaker bound also known as the Singleton’s bound is given by \(\delta \le N+1-K\) for a given code with parameters \([N,K,\delta ]\). A code is called MDS (maximum distance separable), if \(\delta\) attains its maximum value, i.e. \(\delta =N+1-K\). A primary goal of the coding theory is to improve the lower bound by exhibiting new codes with a higher minimum distance beating the BK code as well as to demonstrate the existence codes whose minimum distance reaches the upper bound in [7]. Toric codes have been used to produce such champion codes. The techniques of this paper can be used for a systematic search for obtaining new champion codes.

As we evaluate homogeneous polynomials of degree \(\mathbf{\alpha }\) on a subgroup \(Y_Q\) of the torus \(T_X\), the code \({\mathcal {C}}_{\mathbf{\alpha },Y_Q}\) is a puncturing of the toric code \({\mathcal {C}}_{\mathbf{\alpha },T_X}\). In order to compare two such codes whose lengths or dimensions are different, we use the following approach. The Singleton’s bound implies the inequality \(N+1-\delta -K\ge 0\) for a code \({\mathcal {C}}\) with parameters \([N,K,\delta ]\). This inequality is clearly equivalent to \(S({\mathcal {C}}) \ge 0\), where

$$\begin{aligned} S({\mathcal {C}})=(1-K/N)-(\delta -1)/N. \end{aligned}$$

Thus, a non-trivial code \(C'\) will be regarded better than another code C if \(S(\mathcal {C'})<S({\mathcal {C}})\). Notice that the code \({\mathcal {C}}\) is MDS if and only if \(S({\mathcal {C}})=0\).

In the following we give a parameterised toric code and compare its parameters with two codes to illustrate the potential of these type of codes.

Example 6.1

Fix \(q=5\) and consider the incidence matrix Q of the square shaped graph with vertices \(V=\{1,2,3,4\}\) and edges \(E=\{\{1,2\},\{2,3\},\{3,4\},\{1,4\}\}\). Thus, we have

$$\begin{aligned} Y_Q=\{[t_1t_2:t_2t_3:t_3t_4:t_1t_4]~:~t_1,t_2,t_3,t_4\in \mathbb F_5^*\}. \end{aligned}$$

In what follows, we obtain non-trivial and non-equivalent codes from \(Y_Q\) on the Hirzebruch surface \({\mathcal {H}}_2\) and compare them with codes obtained from two different situations, where Q is the same and \(X=\mathbb P^3\) in the former, and \(Y_Q=T_X\) and \(X={\mathcal {H}}_2\) in the latter.

The comparison of the first two parts of Table 1 indicates that considering different toric varieties X as ambient spaces could be a good alternative for the projective space \(\mathbb P^n\).

The comparison of the last two parts of Table 1 reveals that puncturing the code \({\mathcal {C}}_{\mathbf{\alpha },T_X}\) by considering a proper subgroup \(Y_Q\) of \(T_X\) may produce better codes.

  1. i.

    [Codes on \(Y_Q \subseteq \mathbb P^3\)] The parameterized subgroup \(Y_Q\) of the torus \(T_{\mathbb P^3}\) is the image of the torus \(T_{{\mathcal {H}}_0}\) of the biprojective space \({\mathcal {H}}_0=\mathbb P^1\times \mathbb P^1\) under the Segre embedding. Using the Theorem 1.4 in [10], we form the first part of Table 1.

  2. ii.

    [Codes on \(Y_Q \subseteq {\mathcal {H}}_2\)] The second part of Table 1 is explained below in detail.

  3. iii.

    [Codes on \(T_X \subseteq {\mathcal {H}}_2\)] The last part of the Table 1 is obtained via Theorem 5.3.

Let us explain the second part of Table 1 where \(Y_Q \subseteq {\mathcal {H}}_2\). In this case, the size becomes \(N=|Y_Q|=8\). By using the algorithms we develop in previous sections, we compute the following minimal generating set for \(I(Y_Q)\):

$$\begin{aligned} I(Y_Q)=\langle x_1^4-x_3^4, \quad x_1^2x_2^2x_3^2-x_4^2\rangle . \end{aligned}$$

So, \(Y_Q\) becomes a complete intersection on \({\mathcal {H}}_2\). Since \(x_1^4-x_3^4, x_1^2x_2^2x_3^2-x_4^2\in I(Y_Q)\), it follows that \(x_3^{4}+I(Y_Q)=x_1^{4}+I(Y_Q)\) and \(x_4^{2}+I(Y_Q)=x_1^{2}x_2^{2}x_3^2+I(Y_Q)\) in the quotient ring \(S/I(Y_Q)\). So, we have the following bases \({\bar{B}}_{\mathbf{\alpha }}\) for the vector space \(S_{\mathbf{\alpha }}/I(Y_Q)_{\mathbf{\alpha }}\).

$$\begin{aligned}&{\bar{B}}_{(1,0)}=\{x_1,x_3\};\\&{\bar{B}}_{(2,0)}=\{x_1^2,x_1x_3,x_3^2\};\\&{\bar{B}}_{(c,0)}=\{x_1^c,x_1^{c-1}x_3,x_1^{c-2}x_3^2,x_1^{c-3}x_3^3\}, \quad \text{ for } ~~c>2,\\&{\bar{B}}_{(0,d)}=\{x_2^d\}\text { and }\\&{\bar{B}}_{(1,d)}=\{x_1x_2^d,x_3x_2^d\}, \text { for } d\in \mathbb N;\\&{\bar{B}}_{(2,d)}=\{x_1^2x_2^d,x_1x_3x_2^d,x_3^2x_2^d,x_2^{d-1}x_4\}\text { for }d>0,\\&{\bar{B}}_{(3,d)}=\{x_1^3x_2^d,x_1^2x_3x_2^d,x_1x_3^2x_2^d,x_3^3x_2^d,x_1x_2^{d-1}x_4,x_3x_2^{d-1}x_4\} ~~\text{ for } ~~d>0,\\&{\bar{B}}_{(4,d)}=\{x_1^4x_2^d,x_1^3x_3x_2^d,x_1^2x_3^2x_2^d,x_1x_3^3x_2^d,x_1^2x_2^{d-1}x_4,x_1x_3x_2^{d-1}x_4,x_3^2x_2^{d-1}x_4\} ~~\text{ for } ~~d>0,\\&{\bar{B}}_{(5,d)}=\{x_1^5x_2^d,x_1^4x_3x_2^d,x_1^3x_3^2x_2^d,x_1^2x_3^3x_2^d,x_1^3x_2^{d-1}x_4,x_1^2x_3x_2^{d-1}x_4,x_1x_3^2x_2^{d-1}x_4\\&\qquad \qquad ,x_3^3x_2^{d-1}x_4\} ~~\text{ for } ~~b>0. \end{aligned}$$

Thus, the values of \(H_{Y_Q}(c,0)\) starting from \(c=0\) are \(1, 2, 3, 4, 4, 4, 4, \dots\), and the values of \(H_{Y_Q}(c,1)\) are 1, 2, 4, 6, 7, 8 for \(c=0,1,2,3,4,5\). By Şahin and Soprunov [25, Corollary 3.18], if \(\mathbf{\alpha }'-\mathbf{\alpha }\in \mathbb N\beta\) then \(H_{Y_Q}(\mathbf{\alpha })\le H_{Y_Q}(\mathbf{\alpha }')\). Thus, we have \(8=H_{Y_Q}(5,1)\le H_{Y_Q}(a,1)\le 8\), for all \(c>5\), as \((c-5,0)\in \mathbb N\beta\). Similarly, we have \(H_Y(c,d)=8\) for all \(c>5\) and \(d>0\), as \((c-5,d-1)\in \mathbb N\beta\). Hence, the values of \(H_{Y_Q}(c,1)\) starting from \(c=0\) are \(1, 2, 4, 6, 7, 8, \dots\) and this sequence of \(H_{Y_Q}(c,d)\) is always the same, for any \(d>1\) as \((0,d-1)\in \mathbb N\beta\). By Şahin and Soprunov [25, Proposition 4.3], if \(\mathbf{\alpha }'-\mathbf{\alpha }\in \mathbb N\beta\) and \(H_{Y_Q}(\mathbf{\alpha })=H_{Y_Q}(\mathbf{\alpha }')\) then the codes \({\mathcal {C}}_{\mathbf{\alpha },Y_Q}\) and \({\mathcal {C}}_{\mathbf{\alpha }',Y_Q}\) are equivalent, i.e. have the same parameters. Hence, the only non-equivalent and non-trivial codes are the generalized toric codes \({\mathcal {C}}_{\mathbf{\alpha },Y_Q}\) for the degrees \(\mathbf{\alpha }\in \{(1,0),(2,0),(3,0),(2,1),(3,1)\}\). Notice that although \(H_{Y_Q}(3,0)= H_{Y_Q}(2,1)=4\), the corresponding codes are not equivalent, which is not surprising as \(\pm [(3,0)-(2,1)]\notin \mathbb N\beta\). For the parameters of the corresponding codes forming the second part of Table 1, we use Sage [24].

Table 1 Code comparison