1 Introduction

Some intractable problems are tractable with a quantum computer. This was confirmed with the Shor algorithm [45] for prime factorization and discrete logarithms in polynomial time on quantum computers. Due to this fact, the interest of scientists and engineers in quantum computation has dramatically grown in the last decades.

Implementations proposed for quantum computers produce much more errors than classical ones, and reliability of classical computers cannot be expected for them. Together with correcting errors, decoherence is another challenge in quantum computation and quantum error correction is designed for meeting both challenges. Although quantum information cannot be cloned [12, 49], quantum error correction can be used [46, 47].

The literature concerning quantum error-correcting codes is huge, some recent papers, for the general case, are [5, 6, 15, 30, 37, 41]. The study of these codes was started with the binary case [3, 4, 7,8,9, 28, 31]. Stabilizer codes are a subclass of quantum codes which are well understood, both its structure and construction. Most of the codes in this paper will be of this type. A stabilizer code \({\mathcal {C}} \ne \{0\}\) is the common eigenspace of an abelian subgroup \(\Delta \) of the error group \(G_n\) generated by a nice error basis on the space \({\mathbb {C}}^{q^n}\), \({\mathbb {C}}\) being the complex numbers, q a prime power and n a positive integer. The code \({\mathcal {C}}\) has minimum distance d whenever all error in \(G_n\) with weight less than d can be detected or have no effect on \({\mathcal {C}}\) but some error of weight d cannot be detected. In addition, \({\mathcal {C}}\) is called pure if \(\Delta \) does not possess non-scalar matrices with weight less than d, and so, all errors acting on less than d qubits can be detected. Finally, a code as above is an \([[n,k,d]]_q\)-code when it is a \(q^k\)-dimensional subspace of \({\mathbb {C}}^{q^n}\) and has minimum distance d (see, for instance, [8, 36]). Stabilizer codes can be constructed from linear codes with the help of symplectic or Hermitian inner product [5, 6, 8, 36].

In this paper we will derive our codes from certain self-orthogonal classical codes, with respect to Hermitian or Euclidean inner product (see forthcoming Theorem 3.1). Let \({\mathbb {F}}_{q}\) be the finite field with q elements. Recall that the Hermitian inner product of two vectors \(\mathbf {x} =(x_1,x_2, \ldots , x_n)\) and \(\mathbf {y}=(y_1,y_2, \ldots , y_n)\) in the vector space \({\mathbb {F}}_{q^2}^n\) is defined as \(\mathbf {x} \cdot _h \mathbf {y}= \sum x_i y^q_i\) and the Euclidean product of \(\mathbf {x}\) and \(\mathbf {y}\) in \({\mathbb {F}}_{q}^n\) as \(\mathbf {x} \cdot \mathbf {y} = \sum x_i y_i\). Given a linear code C in \({\mathbb {F}}_{q^2}^n\) (respectively, \({\mathbb {F}}_{q}^n\)), the Hermitian (respectively, Euclidean) dual space is denoted by \(C^{\perp _h}\) (respectively, \(C^\perp \)). Occasionally, we enlarge our codes with Steane-type procedures [19, 32, 48]. Our supporting classical codes have been recently introduced in a series of papers [17,18,19] and, generically, named J-affine variety codes; they are evaluating codes and codes of this type have been recently considered in the literature [2, 20,21,22,23, 26]. Goodness of some quantum codes coming from J-affine variety codes has become clear from the above-mentioned series of papers, where we have established some records and found codes improving others in the literature. We devote Sect. 2 to recall them and to state two fundamental results, Propositions 2.2 and 2.3, which make it easy to decide about self-orthogonality for this class of codes, with respect to both Euclidean and Hermitian inner product.

In our previous papers we constructed quantum codes from J-affine variety ones and determined their dimension; however, in most cases, we were not able to provide formulae for their minimum distance and we needed to compute it, case by case, with a computer. Since it is computationally intense, we could only provide stabilizer codes with relatively small minimum distances. The main goal of this paper is to generate, using algebraic tools, stabilizer codes supported by self-orthogonal (with respect to Euclidean and Hermitian duality) J-affine variety codes with designed minimum distance. Thus, we are able to give good stabilizer codes with large minimum distance now.

We consider stabilizer codes over arbitrary finite fields. There is no table like [29] for non-binary quantum codes, and most efforts have been focused to the study of MDS quantum codes, quantum LDPC codes or quantum BCH codes [1, 10, 13, 33, 35, 37,38,39, 44, 50]. For comparing or for showing how good our codes are, we have essentially used La Guardia’s articles [37,38,39], which give tables and improve some previous codes in [1, 32], and we have used the codes in [13] and the Gilbert–Varshamov bounds [14, 16, 42].

For our purposes, we use univariate and multivariate J-affine variety codes. Our best examples come from the multivariate case, notwithstanding the univariate case helps to study and understand the multivariate one and gives a simple procedure to obtain codes, over the same field, with larger distances than (and the same length as) others in the literature (see Examples 3.15 and 3.16). We get a \([[80, 50, \ge 10]]_3\) code improving the \([[80, 48, \ge 10]]_3\) given in the literature, but, generally speaking and for known distances in the literature, our univariate codes reach the same parameters (Examples 3.15 and 3.16) and occasionally and for small distances are a bit worse (Example 3.14).

Using multivariate codes, we are able to improve several previous codes in Examples 4.6 B, 4.9 A and C, and 4.17 A. Moreover, the codes constructed with this technique, compared with, for instance, those derived from BCH codes, admit a wider variety of lengths and, as a consequence, we provide good stabilizer codes whose lengths are different from others previously given. Several of them have better relative parameters than similar codes (Examples 4.9 C and  4.11 A) and/or exceed the Gilbert–Varshamov bounds (Examples 4.6 A, 4.9 A, B and C, 4.11 A and 4.17 B).

Stabilizer codes coming from univariate J-affine variety codes are studied in Sect. 3 of the paper. For getting these codes we consider subfield-subcodes of the mentioned classical codes. Self-orthogonality of subfield-subcodes with respect to Euclidean inner product is considered in Sect. 3.1.2, and we devote Sect. 3.1.3 to the Hermitian case. Theorems 3.7 and 3.13 and Theorem 3.11 can be considered our most interesting results in this section because they are our main source of examples. The multivariate case is treated in Sect. 4. Proposition 4.1 is essential for the development of the paper because it supports our proofs for bounding the minimum distance of this family of codes. We also use subfield-subcodes in the last subsection, although many of our results in this section do not need this technique. Theorems 4.4 and 4.7 together with Corollaries 4.54.8 and 4.10, which only consider the bivariate case, are the main results.

2 Stabilizer J-affine variety codes

This section is devoted to review the concept of J-affine variety classical code introduced in [19] and to give some results concerning self-orthogonality with respect to the Euclidean and Hermitian inner product. As shown in [17,18,19], good examples of stabilizer codes can be obtained in this way, although, up to this paper, no general formula or bound for their distances was known.

Let \(q=p^r\) be a positive power of a prime number p. Define a value Q which will be \(Q=q\) when we use the Euclidean inner product and \(Q=q^2\) when we consider the Hermitian inner product. Fix integers \(N_j>1\), \(j=1,\ldots ,m\), such that \(N_j-1\) divides \(Q-1\) and set \(J \subseteq \{1,2, \ldots , m\}\). Let \({\mathcal {R}}:= {\mathbb {F}}_Q [X_1,X_2, \ldots ,X_m]\) be the ring of polynomials with m variables and with coefficients in the finite field \({\mathbb {F}}_Q \). Consider the ideal \(I_J\) in \({\mathcal {R}}\) generated by the binomials \(X_j^{N_j} - X_j\) when \(j \not \in J\) and by \(X_j^{N_j -1} - 1\) otherwise. Set \(Z_J = \{P_1, P_2, \ldots , P_{n_J}\}\) the zero-set of \(I_J\) over \({\mathbb {F}}_Q\). Notice that the jth coordinate, for \(j \in J\), of the points in \(Z_J\) is different from zero and \(n_J = \prod _{j \notin J} N_j \prod _{j \in J} (N_j -1)\). Also, denote \(T_j = N_j -2\) when \(j \in J\) and \(T_j = N_j -1\) otherwise, define

$$\begin{aligned} {\mathcal {H}}_J := \{0,1,\ldots ,T_1\}\times \{0,1,\ldots ,T_2\} \times \cdots \times \{0,1,\ldots ,T_m\} \end{aligned}$$

and for any \(\varvec{a}=(a_1,a_2, \ldots , a_m) \in {\mathcal {H}}_J\), set \(X^{\varvec{a}} := X_1^{a_1} X_2^{a_2}\cdots X_{m}^{a_m}\).

Consider the quotient ring \({\mathcal {R}}_J:= {\mathcal {R}}/I_J\) and the evaluation map \({\mathrm {ev}}_J: {\mathcal {R}}_J \rightarrow {\mathbb {F}}_{q}^{n_J}\) given by \({\mathrm {ev}}_J(f) = \left( f(P_1), f(P_2), \ldots , f(P_{n_J}) \right) \), where f denotes both the equivalence class and any polynomial representing it.

Definition 2.1

Let \(\Delta \) be a non-empty subset of \({\mathcal {H}}_J \). The J-affine variety classical code given by \(\Delta \) is the vector subspace \(E^J_\Delta \) (over \({\mathbb {F}}_Q\)) of \({\mathbb {F}}_Q^{n_J}\) generated by \({\mathrm {ev}}_J (X^{\varvec{a}})\), \(\varvec{a} \in \Delta \).

Next, the reader can find the announced results concerning self-orthogonality of the above-introduced codes. They can be found in Galindo et al. [19]. First we describe when the Euclidean inner product of the evaluation of two monomials does not vanish.

Proposition 2.2

Let \(J \subseteq \{ 1 , 2, \ldots , m\}\), consider \(\varvec{a}, \varvec{b} \in {\mathcal {H}}_J\) and let \(X^{\varvec{a}}\) and \(X^{\varvec{b}}\) be two monomials representing elements in \({\mathcal {R}}_J\). Then, the Euclidean inner product \({\mathrm {ev}}_J ( X^{\varvec{a}}) \cdot {\mathrm {ev}}_J (X^{\varvec{b}})\) is different from 0 if, and only if, the following two conditions are satisfied.

  • For every \(j \in J\), it holds that \(a_j + b_j \equiv 0 \mod (N_j -1)\), (i.e., \(a_j = N_j -1 - b_j\) when \(a_j + b_j > 0\) or \(a_j=b_j=0\)).

  • For every \(j \notin J\), it holds that

    • – either \(a_j + b_j > 0\) and \(a_j + b_j \equiv 0 \mod (N_j -1)\) (i.e., \(a_j = N_j -1 - b_j\) if \(0< a_j, b_j < N_j -1\) or \((a_j,b_j) \in \left\{ (0,N_j -1), (N_j {-}1,0), (N_j {-}1,N_j {-}1) \right\} \) otherwise),

    • – or \(a_j = b_j = 0\) and \(p \not | ~ N_j\).

The analogous result for Hermitian inner product is

Proposition 2.3

Let \(J \subseteq \{ 1 , 2, \ldots , m\}\), consider \(\varvec{a}, \varvec{b} \in {\mathcal {H}}_J\) and let \(X^{\varvec{a}}\) and \(X^{\varvec{b}}\) be two monomials representing elements in \({\mathcal {R}}_J\). Then, the Hermitian inner product \({\mathrm {ev}}_J ( X^{\varvec{a}}) \cdot _h {\mathrm {ev}}_J (X^{\varvec{b}})\) is different from 0 if, and only if, the following two conditions are satisfied.

  • For every \(j \in J\), it holds that \(q a_j + b_j \equiv 0 \mod (N_j -1)\), (i.e., \(b_j = - q a_j + \lambda (N_j -1)\), for some \(\lambda \ge 0\)).

  • For every \(j \notin J\), it holds that

    • – either \(a_j + b_j > 0\) and \(q a_j + b_j \equiv 0 \mod (N_j -1)\) (i.e., \(b_j = - q a_j + \lambda (N_j -1)\), for some \(\lambda > 0\), if \(0< a_j, b_j < N_j -1\), or \((a_j,b_j) \in \left\{ (0,N_j -1), (N_j -1,0), (N_j -1,N_j -1) \right\} \), otherwise);

    • – or \(a_j = b_j = 0\) and \(p \not | ~ N_j\).

Now we give some notation. Set \({\mathcal {H}} := {\mathcal {H}}_\emptyset \), \( \mathcal {H'} := {\mathcal {H}}_{\{1,2, \ldots , m\}}\) and pick \(\Delta \subseteq {\mathcal {H}}\). For \(Q=q\), define \(\Delta ^\perp \) as

$$\begin{aligned} {\mathcal {H}}_J \setminus \{ (N_1 -1 -a_1, N_2 -1 - a_2, \ldots , N_m- 1 -a_m) \; | \; \varvec{a} \in \Delta \}, \end{aligned}$$

if \(\Delta \subseteq \mathcal {H'}\). When \(\Delta \not \subseteq \mathcal {H'}\) define \(\Delta ^\perp \) as

$$\begin{aligned}&{\mathcal {H}}_J\setminus \left\{ \{ (N_1 -1 -a_1, N_2 -1 -a_2, \ldots , N_m -1 -a_m ) | \varvec{a}\right. \\&\quad \left. \in \Delta \cap \mathcal {H'} \} \cup \{ \varvec{a}' | \varvec{a} \in \Delta , \varvec{a} \notin {\mathcal {H'}} \} \right\} , \end{aligned}$$

where we set \(a'_j = N_j -1 -a_j\) if \(a_j \ne N_j -1\) and \(a'_j\) equals either \(N_j -1\) or 0 otherwise.

For \(Q=q^2\), we write \(\Delta ^{\perp _h}\) as

$$\begin{aligned} {\mathcal {H}}_J \setminus \{ ([-qa_1]_{N_1 -1}, [-qa_2]_{N_2 -1}, \ldots , [-qa_m]_{N_m- 1})\; | \; \varvec{a} \in \Delta \}, \end{aligned}$$

when \(\Delta \subseteq \mathcal {H'}\) and where \([-qa_j]_{N_j -1}\), \(1\le j \le m\), is a suitable representative of the congruence class of \(-qa_j\) modulo \(N_j -1\). Otherwise, \(\Delta ^{\perp _h}\) is defined as

$$\begin{aligned}&{\mathcal {H}}_J \setminus \left\{ \{ ([-qa_1]_{N_1 -1}, [-qa_2]_{N_2 -1}, \ldots , [-qa_m]_{N_m- 1}) | \varvec{a} \right. \\&\quad \left. \in \Delta \cap \mathcal {H'} \} \cup \{ \varvec{a}' | \varvec{a} \in \Delta , \varvec{a} \notin \mathcal {H'} \} \right\} . \end{aligned}$$

Here \(\varvec{a}'\) is a multi-valued vector defined by \(a'_j = [-qa_j]_{N_j -1}\) if \(a_j \notin \{ 0, N_j -1\)}, \(a'_j\) is equal to \(N_j -1\) if \(a_j=0\) and \(a'_j\) admits two values which are \(N_j -1\) and 0 if \(a_j = N_j-1\).

Next, we state the mentioned result about self-orthogonality which is also true when \(\perp _h\) is used instead of \(\perp \) and \(Q=q^2\).

Proposition 2.4

With the above notations, let \(\Delta \) be a subset of \({\mathcal {H}}_J\). Then \(\left( E_\Delta ^J\right) ^\perp = E^J_{\Delta ^\perp }\) whenever \(\Delta \subseteq \mathcal {H'}\). Otherwise, it holds that \(\left( E_\Delta ^J\right) ^\perp \subseteq E^J_{\Delta ^\perp }\).

Subfield-subcodes of J-affine variety codes will be used in this paper. To deal with them, we will need the following notation. First of all, let r and s be positive integers such that s divides r. For simplicity, we will denote by R the value r when we use the Euclidean inner product and 2r when we use the Hermitian inner product. The same notation is considered for S for representing s and 2s. Set \(\mathbb {Z}/T_j \mathbb {Z}= \mathbb {Z}_{T_j}\), \(1 \le j \le m\). A subset \({\mathfrak {I}}\) of the Cartesian product \(\mathbb {Z}_{T_1}\times \mathbb {Z}_{T_2} \times \cdots \times \mathbb {Z}_{T_m}\) is called a cyclotomic set with respect to \(p^S\) if \(p^S \cdot \varvec{x} \in {\mathfrak {I}}\) for any \(\varvec{x} = (x_1, x_2, \ldots , x_m) \in {\mathfrak {I}}\), where \(p^S \cdot \varvec{x} = (p^S x_1, p^S x_2, \ldots , p^S x_m)\). \({\mathfrak {I}}\) is said to be minimal (with respect to \(p^S\)) whenever it contains all the elements that can be expressed as \(p^{S i } \cdot \varvec{x}\) for some fixed element \(\varvec{x} \in {\mathfrak {I}}\) and some nonnegative integer i. Within each minimal cyclotomic set \({\mathfrak {I}}\), we pick a representative \(\varvec{a} = (a_1, a_2, \ldots , a_m)\) given by nonnegative integers such that \(a_1\) is the minimum of the first coordinates of the nonnegative representatives of the elements in \({\mathfrak {I}}\), \(a_2\) is the minimum of the second coordinates of those elements in \({\mathfrak {I}}\) having \(a_1\) as a first coordinate and the remaining coordinates, \(a_3, \ldots , a_m\) are defined in the same way. We will denote by \({\mathfrak {I}}_{\varvec{a}}\) the cyclotomic set \({\mathfrak {I}}\) with representative \(\varvec{a}\) and by \(\mathcal {A}\) the set of representatives of the minimal cyclotomic sets. Thus, the set of minimal cyclotomic sets will be \(\{ {\mathfrak {I}}_{\varvec{a}}\}_{\varvec{a} \in \mathcal {A}}\). In addition, we will denote \(i_{\varvec{a}} : = {{\mathrm {card}}}({\mathfrak {I}}_{\varvec{a}})\).

3 Stabilizer univariate J-affine variety codes with designed minimum distance

In this section, our goal consists of giving parameters of stabilizer codes coming from univariate J-affine variety codes with designed minimum distance and relating them with the literature. For the sake of simplicity, we will consider \( \Delta \subseteq \mathcal {H'}\) and we will write \(N_1=N\) and \(T_1=T\). Results in this paper will use both Euclidean and Hermitian inner product and the following well-known fact to provide stabilizer codes from linear codes.

Theorem 3.1

[1, 36] Let C be an [nkd] linear error-correcting code over \({\mathbb {F}}_{Q}\) such that \(C^\perp \subseteq C\). Then, there exists an \([[n, 2k -n, \ge d]]_q\) stabilizer code which is pure to d. If the minimum distance of \(C^\perp \) exceeds d, then the stabilizer code is pure and has minimum distance d.

Notice that when \(Q=q^2\), we use the Hermitian inner product and the symbol \(\perp \) in the previous statement must be regarded as \(\perp _h\). By considering \(E^{\{1\}}_\Delta \), with \(\Delta =\{1,2, \ldots ,d-1\}\), one obtains MDS codes using this technique (with \(\perp \) or \(\perp _h\)); these codes were found in [30]. In order to obtain a richer family of codes, one should consider subfield-subcodes. We devote the next subsection to study these codes.

3.1 Stabilizer J-affine variety codes, with \(J=\{1\}\), coming from subfield-subcodes

The main goal in this subsection is to show parameters of some stabilizer codes obtained from subfield-subcodes of univariate J-affine variety codes with designed minimum distance. These codes can be understood as BCH codes, codes which have been used in the literature of quantum codes (see [1, 37,38,39, 48] and their references). We consider univariate polynomials for two reasons: We perform a different analysis which allows us to obtain slightly better codes in some cases and, above all, such analysis will be applied in Sect. 4 for the multivariate case, where we provide excellent new codes.

In Sects. 3.1.2 and 3.1.3, we will provide suitable self-orthogonal codes with respect to both metrics, Euclidean and Hermitian. In order to do this, we must introduce some lemmas concerning cyclotomic sets first.

3.1.1 Study of cyclotomic sets

In this section \(Q=q=p^r\) and let \(S=s\) a positive integer that divides r. We consider two cases: r is even and r is odd. When r is even, we will consider values of s that divide r / 2. Otherwise, we restrict ourselves to the case \(s=1\). As mentioned \(J=\{1\}\). Fix \(N=p^r\) and consider the above-described set of representatives \(\mathcal {A}\) of the corresponding minimal cyclotomic sets (which, in this section, are, in fact, cyclotomic cosets because \(m=1\)). Set \( \mathcal {A} = \{a_0 = 0< a_1< a_2< \cdots < a_z\}\). Recall that we are considering classes modulo \(p^r -1\) and the values \(a_i\), \(1 \le i \le z\), are the least positive integers representing their classes. Our first result is the following:

Lemma 3.2

With the above notation and in the case when r is even, it holds that \((p^{r/2}-1) \in \mathcal {A}\), that is \(p^{r/2}-1\) is the minimum positive integer within its minimal cyclotomic set. Otherwise, when r is odd, one has that \(( p^{\frac{r+1}{2}}-p-1) \in \mathcal {A}\).

Proof

We will reason assuming that \(s=1\). The case \(s \ne 1\) can be proved in a similar way.

Assume firstly that r is an even number, then the elements in the cyclotomic set containing \( p^{r/2}-1\) (its positive representatives which are less than \(p^{r}-1\)) can be written as a disjoint union of the following two sets: \({\mathfrak {I}}_1=\left\{ p^{r/2}-1, p^{\frac{r}{2}+1}-p, \ldots , p^r-p^{r/2}\right\} \) and

$$\begin{aligned} {\mathfrak {I}}_2=\left\{ p^r - p^{\frac{r}{2}+1}+p-1, p^r - p^{\frac{r}{2}+2}+p^2-1, \ldots , p^r - p^{r-1}+p^{\frac{r}{2}-1}-1\right\} . \end{aligned}$$

Note that the elements of \({\mathfrak {I}}_1\) are pairwise different modulo \(p^r -1\) and they are obtained after successive multiplication by p. Now, for \(i \le \frac{r}{2} -1\), it holds that \(p^i (p^r - p^{r/2})= p^{r+i} - p^{\frac{r}{2}+i}\) and \(p^{r+i}-(p^r +p^i -1) \equiv 0 \mod (p^r -1)\) which proves that \(p^r - p^{\frac{r}{2}+i} + p^i -1 \equiv p^i (p^r - p^{r/2}) \mod (p^r -1)\). In addition, the sequence of integers given in \({\mathfrak {I}}_1\) is strictly increasing and the fact that \(p^i \left( 1 - p^{\frac{r}{2}}\right) < p^{i+1} (1 - p^{\frac{r}{2}})\) proves that the sequence in \({\mathfrak {I}}_2\) is strictly decreasing. Furthermore, \(p^{\frac{r}{2}} \ge p^{\frac{r}{2}-1} +1\) and then \(p^{\frac{r}{2}+1} \ge p^{\frac{r}{2}} +p\) which allows us to deduce that the last element in \({\mathfrak {I}}_1\) is larger than the first one in \({\mathfrak {I}}_2\). Taking into account the inequality \(p^{\frac{r}{2}}-1 < p^r - p^{r-1} + p^{\frac{r}{2}-1} -1\), this concludes the proof for the case when r is even.

The case when r is odd can be proved in a similar way. The minimal cyclotomic set containing \(p^{\frac{r+1}{2}}-p-1\) (its positive representatives which are less than \(p^{r}-1\)) is a disjoint union of the following sets:

$$\begin{aligned} {\mathfrak {I}}_1= & {} \left\{ p^{\frac{r+1}{2}}-p-1, p^{\frac{r+3}{2}+1}-p^2-p, \ldots , p^r-p^{\frac{r+1}{2}}-p^{\frac{r-1}{2}}\right\} ,\\ {\mathfrak {I}}_2= & {} \left\{ p^r - p^{\frac{r+1}{2}+1}- p^{\frac{r-1}{2}+1}+p-1, \ldots , p^r - p^{r-1}-p^{r-2}+p^{\frac{r-3}{2}}-1\right\} , \end{aligned}$$

and \({\mathfrak {I}}_3=\left\{ p^r - p^{r-1}+p^{\frac{r-1}{2}}-2\right\} \), where the last set comes from the fact that \(p^{r+1}-p^r-p \equiv p^r -2 \mod (p^r-1)\). Then, the result follows from the facts that the elements in \({\mathfrak {I}}_1\) are an strictly increasing sequence, those in \({\mathfrak {I}}_2\) are strictly decreasing, and the last element in \({\mathfrak {I}}_2\) is smaller than that in \({\mathfrak {I}}_3\) but larger than the first one in \({\mathfrak {I}}_1\). This concludes the proof. \(\square \)

Our next result shows a property of the classes treated in Lemma 3.2, namely a property regarding the representative of the coset. We will use the notation \([x \mod (p^r -1) ]\) to denote the nonnegative integer less than \(p^r -1\) representing the coset of x.

Lemma 3.3

Assume that r is an even positive integer. Then, for any integer \(0\le b < p^{r/2}-1\) and for any index \(0 \le j < r\), the following inequality holds:

$$\begin{aligned} \left[ p^j b \mod (p^r -1)\right] < p^r - p^{r/2}. \end{aligned}$$
(1)

When r is odd, one gets

$$\begin{aligned} \left[ p^j b \mod (p^r -1)\right] < p^r - p^{\frac{r+1}{2}}+p, \end{aligned}$$

for any integer \(0\le b \le p^{\frac{r+1}{2}}-p-1\) and for any index \(0 \le j < r\).

Proof

We prove the case when r is even. A similar reasoning proves the odd case. Suppose that \(j \le r/2\). Then \(p^j b< p^r - p^{r/2} < p^r -1\). So, (1) follows because \(p^j b = [p^j b \mod (p^r -1)]\). Assume now that \(r/2< j < r\) and set \(j=(r/2) + j'\). Consider the p-adic expansion of b, \(b = \sum _{i=1}^{r/2} c_i p^{\frac{r}{2}-i}\), \(0 \le c_i < p\). Then

$$\begin{aligned} p^j b = p^{\frac{r}{2}+j'} \left( \sum _{i=1}^{r/2} c_i p^{\frac{r}{2}-i} \right) = \sum _{i=1}^{r/2} c_i p^{r+j'-i} \end{aligned}$$

and the inequality \([p^j b \mod (p^r -1)] < (p-1) \sum _{i=1}^{r/2} p^{r-i}\) holds after taking into account that \(b < p^{r/2} -1\) implies that not all the \(c_i\) can reach the value \(p-1\). Finally, the fact that \((p-1) \sum _{i=1}^{r/2} p^{r-i} = p^r - p^{r/2}\) concludes the proof. \(\square \)

The following remark is the key for obtaining self-dual codes which allow us to construct stabilizer codes.

Remark 3.4

Assume that r is an even number and let a be a nonnegative integer such that \(a<p^{r/2} -1\). This inequality is equivalent to \((p^r-1)-a > p^r - p^{r/2}\) which by Proposition 2.2 and Lemma 3.3 guarantees that \({\mathfrak {I}}_{a} \subseteq {\mathfrak {I}}_{a}^{\perp }\). When r is odd, the same result holds for \(a<p^{\frac{r+1}{2}} -p-1\).

Returning to the case when r is even, the equality

$$\begin{aligned} \left( p^r -1\right) - \left( p^{r/2} -1\right) = p^r - p^{r/2} = p^{r/2} \left( p^{r/2} -1\right) \end{aligned}$$

proves that \(\left( p^r -1\right) - \left( p^{r/2} -1\right) \in {\mathfrak {I}}_{p^{r/2} -1}\). Thus, the inclusion \({\mathfrak {I}}_{p^{r/2} -1} \subseteq \left( {\mathfrak {I}}_{p^{r/2} -1}\right) ^\perp \) does not hold and \(p^{r/2} -1\) is the smallest representative of a minimal cyclotomic field with that property.

To conclude this subsection, we state a result concerning the size of some cyclotomic sets.

Lemma 3.5

With the notations as at the beginning of this subsection, it holds that, when r is even, the cardinality of the cyclotomic sets \({\mathfrak {I}}_{a}\), \(0< a \le p^{r/2} -1\), is equal to r / s. Otherwise, when r is odd and \(s=1\), the cardinality of \({\mathfrak {I}}_{a}\) , \(0< a \le p^{\frac{r+1}{2}} -p-1\), equals r.

Proof

We will assume that r is even, the case when r is odd can be proved with a similar reasoning. Since s divides r / 2, it suffices to show our result for the case \(s=1\) and therefore we are going to prove that r is the cardinality of \({\mathfrak {I}}_{a}\) whenever \(0< a \le p^{r/2} -1\). Set

$$\begin{aligned} a= c_{i_1} p^{\frac{r}{2}-i_1} + c_{i_2} p^{\frac{r}{2}-i_2} + \cdots + c_{i_k} p^{\frac{r}{2}-i_k} \end{aligned}$$

the p-adic expansion of a, where \(0< c_{i_j} < p\), \(1 \le j \le k \le r/2\) and \(1< i_1< i_2< \cdots < i_k\). Clearly, the elements, \(a, p \; a, \ldots , p^{{r}{2}+i_1} \,a\) are different and belong to \({\mathfrak {I}}_{a}\), which means that \({\mathfrak {I}}_{a}\) contains more than r / 2 elements. This proves our result because the cyclotomic sets have r or a divisor of r elements. \(\square \)

We claim that Lemma 3.5 holds for r odd and \(s>1\) as well; however, for the sake of simplicity we do not consider it.

3.1.2 Codes obtained with Euclidean inner product

Stabilizer codes obtained as in Theorem 3.1 with \(Q=q\) can be improved with the Steane’s enlargement procedure [48] and their generalizations in [32] and [19, Theorem 3].

The following proposition uses the above-given results to give parameters of stabilizer codes.

Proposition 3.6

Assume that r is a positive even integer, \(q=p^r\) and s another positive integer that divides r / 2. Write \( \mathcal {A} = \{a_0 = 0< a_1< a_2< \cdots < a_z\}\) the set of representatives of cyclotomic sets modulo \(p^r -1\) with respect to \(p^s\). Let \(t_2 < t_1\) be indices such that \(a_{t_1} < p^{r/2} -1\) and

$$\begin{aligned} a_{t_1 +1} \le \left\lceil \frac{(p^s +1) a_{t_2+1}}{p^s} \right\rceil . \end{aligned}$$

Then, suitable J-affine variety codes with \(J=\{1\}\) and \(m=1\) provide stabilizer codes with parameters \(\left[ \left[ q-1,q-1- \frac{2r}{s}t_1, \ge a_{t_1+1}\right] \right] _{p^s}\) and \(\big [\big [q-1,q-1- \frac{r}{s}(t_1+t_2), \ge a_{t_1+1}\big ]\big ]_{p^s}\).

The same parameters can be obtained for r odd and \(s=1\) provided that \(a_{t_1} < p^{\frac{r+1}{2}} -p-1\).

Proof

Let us show the case when r is even. The odd case can be proved similarly by using the odd version of the above-stated lemmas. Note that indices \(t_1\) and \(t_2\) exist by Lemma 3.5. Set

$$\begin{aligned} \Delta = {\mathfrak {I}}_{a_1} \cup {\mathfrak {I}}_{a_2} \cup \cdots \cup {\mathfrak {I}}_{a_{t_1}}. \end{aligned}$$

Lemmas 3.2 and 3.3 (see also Remark 3.4) show that \(\Delta \subseteq \Delta ^\perp \). Consider the subfield-subcode \(E^{\{1\}, \sigma }_\Delta := E^{\{1\}}_\Delta \cap {\mathbb {F}}_{p^s}^{q-1}\). By [18, Theorem 8], it holds that

$$\begin{aligned} \left( E^{\{1\}, \sigma }_\Delta \right) ^\perp = \left( \left( E^{\{1\}}_\Delta \right) ^\perp \right) ^\sigma = \mathbf {tr}\left( \left( E^{\{1\}}_\Delta \right) ^\perp \right) , \end{aligned}$$

where \(\mathbf {tr}\) is a trace function defined componentwise by means of the map \({\mathrm {tr}}_r^s: {\mathbb {F}}_{p^r} \rightarrow {\mathbb {F}}_{p^s}\), \({\mathrm {tr}}_r^s (x)= x + x^{p^s} + \cdots + x^{p^{s(\frac{r}{s} -1)}}\).

The choice of \(\Delta \) guarantees that it contains every positive integer less than \(a_{t_1+1}\) and thus the minimum distance satisfies \(d\left( E^{\{1\}, \perp }_\Delta \right) \ge a_{t_1+1}\) because its corresponding parity-check matrix contains a Vandermonde matrix of rank \(a_{t_1+1}-1\) (without the all-ones row). So, the inclusion \(\left( E^{\{1\}, \perp }_\Delta \right) ^\sigma \subseteq \left( E^{\{1\}}_\Delta \right) ^\perp \) proves that \(d\left( E^{\{1\}, \sigma }_\Delta \right) ^\perp \ge a_{t_1+1}\). Finally, Lemma 3.5 and [19, Theorem 6(2)] give a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ q-1,q-1- \frac{2r}{s}t_1, \ge a_{t_1+1}\right] \right] _{p^s}. \end{aligned}$$

For obtaining stabilizer codes with the second family of parameters, it suffices to use the Hamada’s enlargement procedure [32] and dual codes of the subfield-subcodes given by \(\Delta _{t_1}\) and \(\Delta _{t_2}\), where, for \(i=1,2\), we set

$$\begin{aligned} \Delta _{t_i} = {\mathfrak {I}}_{a_1} \cup {\mathfrak {I}}_{a_2} \cup \cdots \cup {\mathfrak {I}}_{a_{t_i}}. \end{aligned}$$

\(\square \)

The length of the codes we have just described is \(p^r-1\) for \(r>0\) and p a prime number. Proposition 3.6 can be adapted for other lengths after changing our bound \(p^{r/2}-1\) with another condition involving the corresponding minimal cyclotomic sets. Next we state the corresponding result.

Keep the above notation, and let N be a positive integer such that \(N-1\) divides \(p^r -1\). Consider a positive integer s such that s divides r and cyclotomic sets on \( \mathbb {Z}/(N-1)\mathbb {Z}\) with respect to \(p^s\). Recall that each minimal cyclotomic set \({\mathfrak {I}}_{a}\) is represented by the minimum nonnegative integer \(a \in {\mathfrak {I}}_{a}\).

Theorem 3.7

With the previous notation, let \( \mathcal {A} = \{a_0 = 0< a_1< a_2< \cdots < a_z\}\) be the set of representatives of the minimal cyclotomic sets with respect to \(p^s\) modulo \(N-1\). Let \(a_{N(i)}\) be the representative of the minimal cyclotomic set containing \(N-1-a_i\), \(0 \le i \le z\), and consider two indices \(t_1\) and \(t_2\) such that:

  1. (i)

    \(t_2 < t_1\) and \(a_{t_1} < \min \{a_{N(i)} \;|\; 1 \le i \le t_1\}\),

  2. (ii)

    the following inequality holds:

    $$\begin{aligned} a_{t_1 +1} \le \left\lceil \frac{(p^s +1) a_{t_2+1}}{p^s} \right\rceil . \end{aligned}$$

Then, suitable J-affine variety codes, with \(J=\{1\}\) and \(m=1\), defined by

$$\begin{aligned} \Delta _{t_j} = {\mathfrak {I}}_{a_1} \cup {\mathfrak {I}}_{a_2} \cup \cdots \cup {\mathfrak {I}}_{a_{t_j}}, \end{aligned}$$

where \(j=1,2\) provide stabilizer codes with parameters

$$\begin{aligned}{}[[N-1,N-1- 2 \, {\mathrm {card}}(\Delta _{t_1}),\ge a_{t_1 +1}]]_{p^s} \end{aligned}$$

and \([[N-1,N-1- ({\mathrm {card}}(\Delta _{t_1})+ {\mathrm {card}}(\Delta _{t_2})),\ge a_{t_1 +1}]]_{p^s}.\)

Proof

The proof follows from the same reasoning we used for proving Proposition 3.6. Notice that our first condition implies \(\Delta _{t_1} \subseteq \Delta _{t_1}^\perp \). \(\square \)

Remark 3.8

The second item in Proposition 2.2 shows that the results concerning quantum codes in this subsection are true when using univariate J-affine variety codes, with \(J = \emptyset \), provided that p divides N. In this case, we are able to construct codes of length N.

Example 3.9

Set \(p=2\), \(s=2\), \(r=10\), \(N=94\) and apply Theorem 3.7 and Remark 3.8, which allows us to consider as the first cyclotomic set \({\mathfrak {I}}_{a_{0}}\). Here \({\mathfrak {I}}_{a_{1}}= \{1,4,16,64,70\}\), \({\mathfrak {I}}_{a_{2}}= \{2,8,32,35,47\}\) and \({\mathfrak {I}}_{a_{3}}= \{3,6,12,24,48\}\). Then, we get new stabilizer codes with parameters \([[94,87, \ge 3]]_4\), \([[94,77, \ge 4]]_4\) and \([[94,67, \ge 6]]_4\). They are new since by Remark 3.8 we can consider a J-affine variety code, with \(J = \emptyset \), with length \(N=94\) instead of \(93 =N-1\) as it is usually considered in the literature of BCH codes. Note that, for these last-mentioned codes, length and cardinality of the supporting field must be coprime.

The next subsection considers Hermitian instead of Euclidean inner product.

3.1.3 Codes obtained with Hermitian inner product

We devote this section to give parameters of stabilizer codes coming from self-orthogonal, with respect to Hermitian inner product, subfield-subcodes of J-affine variety codes with \(J=\{1\}\). We will show that some properties, which we proved for the Euclidean inner product, will be useful here as well. Note that our original codes are vector spaces over the field \({\mathbb {F}}_{p^{2r}}\) and the corresponding subfield-subcodes are over \({\mathbb {F}}_{p^{2s}}\), where r and s are positive integers such that s divides r. The corresponding stabilizer codes will be over \({\mathbb {F}}_{p^{s}}\) after applying Theorem 3.1 with \(Q= q^2\) and \(q=p^s\).

Our first result provides codes of length \(p^{2r} -1\). The remaining results consider codes defined by cyclotomic sets modulo \(N-1\), where \(N-1\) divides \(p^{2r}-1\). The forthcoming Theorem 3.11 is stated for \(r=2s\), and their conclusions on existence of stabilizer codes over the field \({\mathbb {F}}_{p^{s}}\) can be extended to any r under suitable bounds or conditions for the representatives of the minimal cyclotomic sets (see Proposition 3.12 and Theorem 3.13).

When considering vectors over the field \({\mathbb {F}}_{p^{2r}}\), one can use different inner products, apart from the Euclidean and the Hermitian products, we will also use that given by \(\mathbf {x} \cdot _s \mathbf {y} = \sum x_i y_i^{p^s}\), where \((x_i)\) [respectively, \((y_i)\)] are the coordinates of the vector \(\mathbf {x}\), respectively, \(\mathbf {y}\)). Notice that when \(s=r\), this is exactly the Hermitian inner product.

Proposition 3.10

Let r and s be positive integers such that s divides r. Let \(\mathcal {A}^{(l)} = \left\{ a_0^{(l)} = 0< a_1^{(l)}< a_2^{(l)}< \cdots < a_z^{(l)} \right\} \) be the set of representatives of minimal cyclotomic sets with respect to \(p^l\) modulo \(p^{2r}-1\), where l is either s or 2s. Let t be an index such that \(a_{t'}^{(s)} = a_t^{(2s)} < p^r -1\) for some index \(t'\).

Then, from subfield-subcodes and via Hermitian inner product, one can get a stabilizer code with parameters \(\left[ \left[ p^{2r}-1,p^{2r}-1-2 \frac{r}{s}t, \ge a_{t+1}^{(2s)}\right] \right] _{p^s}\).

Furthermore, if we assume that r / s is odd, then the result holds for \(a_t^{(2s)} \le p^r -1\).

Proof

Consider the set

$$\begin{aligned} \Delta = {\mathfrak {I}}_{a_1^{(2s)}} \cup {\mathfrak {I}}_{a_2^{(2s)}} \cup \cdots \cup {\mathfrak {I}}_{a_{t}^{(2s)}}. \end{aligned}$$

Our proof relies on obtaining a self-orthogonal, with respect to the Hermitian inner product, code over the field \({\mathbb {F}}_{p^{2s}}\). This code will be a subfield-subcode \(E^{\{1\},\sigma }_\Delta \) coming from a \(\{1\}\)-affine variety code \(E^{\{1\}}_\Delta \) over the field \({\mathbb {F}}_{p^{2r}}\). \(E^{\{1\},\sigma }_\Delta \) is well defined because \(\Delta \) is given as a union of minimal cyclotomic sets with respect to \(p^{2s}\).

To prove self-orthogonality, \(E^{\{1\},\sigma }_\Delta \subseteq \left( E^{\{1\},\sigma }_\Delta \right) ^{\perp _h}\), we first notice the following fact which can be deduced from reading [19, Theorem 7] and its proof. \(\left( E^{\{1\},\sigma }_\Delta \right) ^{\perp _h}\) is the trace via the map \({\mathrm {tr}}_{2r}^{2s}: {\mathbb {F}}_{p^{2r}} \rightarrow {\mathbb {F}}_{p^{2s}}\), \({\mathrm {tr}}_{2r}^{2s} (x)= x + x^{p^{2s}} + \cdots + x^{p^{2s(\frac{r}{s} -1)}}\), of the dual code of \(E^{\{1\},\sigma }_\Delta \) with respect to the inner product \(\cdot _s\). As a consequence, what one needs for checking self-orthogonality is to prove that \(\Delta \subseteq \Delta ^{\perp _s}\), where \(\Delta ^{\perp _s} := {\mathcal {H}}' \setminus \{N-1-p^s a \;|\; a \in \Delta \}\). The dimension of the code follows from Lemma 3.5.

To conclude the proof, we observe that if we consider the set

$$\begin{aligned} \overline{\Delta }= {\mathfrak {I}}_{a_1^{(s)}} \cup {\mathfrak {I}}_{a_2^{(s)}} \cup \cdots \cup {\mathfrak {I}}_{a_{t'}^{(s)}}, \end{aligned}$$

then Proposition 3.6 proves that, with our hypothesis, \(\overline{\Delta } \subset (\overline{\Delta })^\perp \). Taking into account that the cyclotomic sets in \(\overline{\Delta }\) are with respect to \(p^s\), \((\overline{\Delta })^\perp \) is obtained by eliminating those elements of the form \(N-1 - p^s a \mod (N-1)\) where \(a \in \Delta \). Notice that these elements are in the same minimal cyclotomic set modulo \(p^s\) corresponding to some element \(N-1- p^s a_i\) and that we have showed that minimal cyclotomic sets in \(\overline{\Delta }\) and \((\overline{\Delta })^\perp \) are disjoint. Finally, we conclude our result from the fact that \(\Delta \subseteq \overline{\Delta }\), which holds because each minimal cyclotomic set in \(\Delta \) contains half of the elements of another cyclotomic set in \(\overline{\Delta }\).

The following observation, proved in Lemma 3.2, gives a proof for our last statement. First notice that the fact that \((p^{2r}-1)-(p^r-1) = p^r (p^r-1)\) implies that the minimal cyclotomic set \({\mathfrak {I}}_{p^r-1}\) and the cyclotomic set which contains \(N-1-(p^r-1) \) are not disjoint, so one cannot include the minimal cyclotomic set \({\mathfrak {I}}_{p^r-1}\) for defining our set \(\Delta \). However, when r / s is odd, r cannot be a multiple of 2s and the minimal cyclotomic set given by \(N-1-(p^r-1) \) (recall that \(N-1 = p^{2r}-1\)) is different from \({\mathfrak {I}}_{p^r-1}\), which finishes our reasoning. \(\square \)

Next we are going to use the ideas of Proposition 3.10 to study some cases of codes which length divides \(p^{2r} -1\) and that will give some interesting examples.

Theorem 3.11

Fix a positive integer \(s>0\) and an integer N such that \(N-1\) divides \(p^{4s}-1\). Consider the set of representatives \(\mathcal {A} = \{a_0 = 0< a_1< a_2< \cdots < a_z\}\) of minimal cyclotomic sets with respect to \(p^{2s}\) modulo \(N-1\). Let t be an index such that \(a_t < \frac{N-1}{p^s + 1}\). Then, the J-affine variety code, with \(J=\{1\}\), via Hermitian inner product, given by

$$\begin{aligned} \Delta = {\mathfrak {I}}_{a_1} \cup {\mathfrak {I}}_{a_2} \cup \cdots \cup {\mathfrak {I}}_{a_{t}} \end{aligned}$$

allows us to construct a stabilizer code with parameters

$$\begin{aligned}{}[[N-1,N-1- 2 \; {\mathrm {card}} (\Delta ), \ge a_{t+1}]]_{p^s}. \end{aligned}$$

Moreover, the following inequality holds

$$\begin{aligned} N-1- 2 \,{\mathrm {card}} (\Delta ) \ge N-1-4t \end{aligned}$$

and the equality happens whenever \(\gcd (N-1,p^s -1) =1\).

Proof

We follow a similar line to that given in the proof of Proposition 3.10. We consider the J-affine variety code, with \(J=\{1\}\), \(E^{\{1\}}_\Delta \) over the field \({\mathbb {F}}_{p^{4s}}\), the corresponding subfield-subcode \(E^{\{1\}, \sigma }_\Delta \) over \({\mathbb {F}}_{p^{2s}}\), and we will prove that \(E^{\{1\}, \sigma }_\Delta \) satisfies the conditions in Theorem 3.1 for the case of Hermitian inner product, which will end the proof.

We desire to check self-orthogonality, and we notice that any minimal cyclotomic set \({\mathfrak {I}}_{a_i}\), \(1 \le i \le t\), contains at most two elements \(a_i\) and \(p^{2s} a_i \mod (N-1)\). According to the proof of Proposition 3.10, self-orthogonality holds whenever for \(i \le t\), there is no \(j \le t\) such that \(p^{2s} a_i \equiv N-1-p^s a_j \mod (N-1)\). Let us prove this fact by contradiction: Assume the existence of indices i and j such that \(a_i p^{2s} + p^s a_j = \alpha (N-1)\) for some positive integer \(\alpha \). This means that \(p^s (a_i p^s + a_{j})=\alpha (N-1)\) and, since \(p^s\) does not divide \(N-1\), one gets that the equality \( (a_i \, p^s + a_j) = \beta (N-1)\) holds for some positive integer \(\beta \). This gives the desired contradiction because the fact that \(a_i, a_j < (N-1)/(p^s + 1)\) proves that

$$\begin{aligned} a_i \, p^s + a_j< p^s \frac{N-1}{p^s+1} + \frac{N-1}{p^s + 1} < N-1. \end{aligned}$$

It only remains to notice that if \(\gcd (N-1,p^s -1)=1\), then any minimal cyclotomic set has two different elements, which concludes the proof. Indeed, the fact that \(a_i = p^{2s} \, a_i\) implies \(a_i \, (p^s+1)(p^s -1) = 0 \mod (N-1)\) and thus \(a_i \, (p^s+1) = 0 \mod (N-1)\), which is not possible because \(a_i < (N-1)/(p^s +1)\). \(\square \)

Now we state another result. It can be proved by using similar arguments to those in the former proof and noticing that the involved minimal cyclotomic sets have at most r / s different elements.

Proposition 3.12

Let r and s be positive elements such that s divides r and \(r>s\). Consider a positive integer N such that \(N-1\) divides \(p^{2r}-1\). Set \(\mathcal {A} = \{a_0 = 0< a_1< a_2< \cdots < a_z\}\) the set of representatives of minimal cyclotomic sets with respect to \(p^{2s}\) modulo \(N-1\). Let t be an index such that

$$\begin{aligned} a_t < \frac{N-1}{p^{\left[ 2\left( \frac{r}{s}-1\right) \right] s}+1 }. \end{aligned}$$

Then the J-affine variety code, with \(J=\{1\}\), given by

$$\begin{aligned} \Delta = {\mathfrak {I}}_{a_1} \cup {\mathfrak {I}}_{a_2} \cup \cdots \cup {\mathfrak {I}}_{a_{t}} \end{aligned}$$

allows us to construct a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ N-1, N-1 - 2 \, {\mathrm {card}}(\Delta ),\, \ge a_{t+1}\right] \right] _{p^s}. \end{aligned}$$

Finally, we state the claimed second theorem. Here N is a positive integer such that \(N-1\) divides \(p^{2r}-1\). We omit its proof because it follows a similar way to the proof given in Theorem 3.7 and Proposition 3.10.

Theorem 3.13

Write \(\mathcal {A} = \{a_0^{(2s)} = 0< a_1^{(2s)}< a_2^{(2s)}< \cdots < a_z^{(2s)}\}\) the set representatives of minimal cyclotomic sets with respect to \(p^{2s}\) modulo \(N-1\). Denote by \(a_{N(i)}^{(2s)}\) the representative of the minimal cyclotomic set containing \(N-1- p^s a_i^{(2s)}\), \(1 \le i \le z\). Consider an index t such that \(\min \{ a_{N(i)}^{(2s)} \;|\; 1 \le i \le t\}\) is larger than \(a_t^{(2s)}\). Then, setting \(\Delta = \bigcup _{i=1}^t {\mathfrak {I}}_{a_i^{(2s)}}\), the corresponding J-affine variety code, with \(m=1\) and \(J=\{1\}\), provides a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ N-1,N-1-2 \, {\mathrm {card}} \Delta , \, \ge a_{t+1}^{(2s)}\right] \right] _{p^s}. \end{aligned}$$

We conclude this section with some examples of good stabilizer codes obtained using the results in this section.

Example 3.14

Set \(p=3\), \(s=1\) and \(N-1=p^{4s}-1 = 80\). We desire to apply our Theorem 3.11, and therefore we shall compute the cyclotomic representants \(a_i\) with respect to \(p^{2s} = 3^2=9\), for i from 1 to \((N-1)/(p^s +1) = 80/4=20\). Some relevant cyclotomic sets are \({\mathfrak {I}}_{a_1 } =\{a_1=1,9\}\), \({\mathfrak {I}}_{a_2} =\{a_2=2,18\}\), ..., \({\mathfrak {I}}_{a_8} =\{a_8=8,72\}\), \({\mathfrak {I}}_{a_9} =\{a_9=10\}\), \({\mathfrak {I}}_{a_{10}} =\{a_{10}=11,19\}\), ..., \({\mathfrak {I}}_{a_{15}} =\{a_{15}=16,64\}\), \({\mathfrak {I}}_{a_{16}} =\{a_{16}=17,73\}\), \({\mathfrak {I}}_{a_{17}} =\{a_{17}=20\}\). Theorem 3.11 shows that we can get distances larger than 19 by considering the J-affine variety code, with \(J=\{1\}\), defined by \( \Delta = \bigcup _{i=1}^{16} {\mathfrak {I}}_{a_i}\). That is to say, we can construct a stabilizer code with parameters \([[80,18,\ge 20]]_3\). The parameters of the codes constructed using \(\bigcup _{i=1}^{j} {\mathfrak {I}}_{a_i}\), for \(j \le 16\), are given in Table 1.

Our procedure is very simple, only involving the computation of minimal cyclotomic sets, and allows us to get codes with distance \(\ge d\), where d takes values from 2 to 8, from 10 to 17 and 20. We have chosen this length since one can find similar codes in several sources. Comparing with [1, Theorem 21], our codes have the same distance but, there, the authors can only obtain codes with \(d <9\). For \(d<10\), better codes can be found in [37, Table I]; however, our codes are better than those with \(d\ge 10\) derived from [37, Section 3 A]. We will compare codes coming from Theorem 3.11 with BCH codes in Remark 3.17 below. The procedure in [13] gives codes with the same parameters when \(d> 10\); however, we get a \([[80, 50, \ge 10]]_3\) quantum code improving the code with parameters \([[80, 48, \ge 10]]_3\) in [13].

Table 1 Parameters of quantum codes of length 80 over \({\mathbb {F}}_3\)

Example 3.15

Let us give other examples of good stabilizer codes obtained from Theorem 3.11 and Remark 3.8. Consider \(p=5\), \(s=1\) and \(N= 105\). Since p divides N, we can consider J-affine variety codes, with \(J = \emptyset \), and use the cyclotomic set \({\mathfrak {I}}_{a_{0}}\). Table 2 shows the parameters of the corresponding codes. Notice that we provide codes with distances from 2 to 19, while codes with the same parameters but only with distances up to 9 are given in [13].

Table 2 Parameters of quantum codes of length 105 over \({\mathbb {F}}_5\)

Example 3.16

We can also derive codes with larger distances than those in [13] by using Theorem 3.13 and Remark 3.8. Set \(p=2\), \(s=2\), \(r=12\) and \(N=92\). It is not difficult to check that the hypotheses in Theorem 3.13 hold, and so we can construct stabilizer codes with parameters \([[92,84, \ge 3]]_4\), \([[92,78, \ge 4]]_4\), \([[92,72, \ge 5]]_4\), \([[92,66, \ge 6]]_4\) and \([[92,60, \ge 8]]_4\). Only codes with the same parameters as our first two codes are given in [13].

As mentioned, we consider subfield-subcodes of J-affine variety codes, with \(J=\{1\}\), and they can be understood as BCH codes. Let us compare the results in this section with the literature:

Remark 3.17

Some of our previous results are close to others in [1], where cyclotomic cosets are studied in a different way to construct stabilizer codes. Indeed, our Lemma 3.5 can be deduced from Lemma 8 in [1] and one can note that our Propositions 3.6 and 3.10 are equivalent to Theorem 18 and Theorem 21 in [1], except by the fact that we consider Hamada’s enlargement and not only CSS construction. We have included these results for the sake of completeness, and because the notation in [1] and our proofs are completely different and the other results in this section follow the same techniques. Notice also that some results in this section support others in Sect. 4 sharing the same terminology.

A series of articles by La Guardia et al. [37,38,39] improved the codes in [1]. Our analysis of cyclotomic cosets allows us to construct better codes in some particular cases. We have already mentioned that the codes given in Example 3.14 are better than the codes given in [37]. Codes in [37,38,39] are very good; however, by Theorem 3.11 we can construct codes with minimum distance up to \((p^{4s}-1)/(p^s +1) = (p^{2s} +1)(p^s-1)\), distance which cannot be reached in the above papers, because for the same length, most of the constructions in [37,38,39] cannot have greater minimum distance than \(2p^{2s}+2\). The only construction that may exceed such bound is quite restrictive since the length must be a prime number for having cyclotomic cosets of size one (see [38]).

4 Stabilizer multivariate J-affine variety codes with designed minimum distance

In this section, we extend our construction of stabilizer codes with designed minimum distance to the multivariate case. We will use the notation introduced in Sect. 2. We will consider the footprint bound approach, a bound based on Gröbner basis techniques that has been successfully used for estimating the minimum distance of affine variety codes [23,24,25, 27, 34]. For \(\varvec{a} \in {\mathcal {H}}_J\), we consider

$$\begin{aligned} \delta _{\varvec{a}} := \prod _{j=1}^m \left( N_j - \epsilon _j - a_j \right) , \end{aligned}$$

where \(\epsilon _j =1\) if \(j \in J\) and \(\epsilon _j = 0\) if \(j \not \in J\).

Proposition 4.1

Consider the ring \({\mathcal {R}}_J\) and fix a monomial ordering. Let \(f(X_1,\ldots , X_m)\) be a polynomial of minimum total degree representing a class in \({\mathcal {R}}_J\), and let \(X^{\varvec{a}} = X_1^{a_1} \cdots X_m^{a_m}\) be the leading monomial of f. Then

$$\begin{aligned} {\mathrm {card}} \left\{ P \in Z_J \; | \; f(P) \ne 0 \right\} \ge \delta _{\varvec{a}}. \end{aligned}$$

Proof

This is a well-known result, the proof follows by considering the ideal L in \({\mathcal {R}}\) generated by the polynomial \(f(X_1,X_2, \ldots , X_m)\) and the generators of \(I_J\). By [11, Proposition 7 in Section 5.3] the monomials in \({\mathcal {R}}\) that are not leading monomial of any polynomial in L (this set is sometimes called footprint) constitute a basis of the vector space \({\mathcal {R}}_J\) over \({\mathbb {F}}_Q\). Combining this fact with the observation that the evaluation map (the map that evaluates a polynomial in all the points of the variety) is surjective, the result holds. \(\square \)

Given a designed minimum distance, this bound suggests the construction of a code whose dimension is maximized. For instance, if \(N_j=Q^r\) for all j, \(1 \le j \le m\), and \(J= \emptyset \), then one obtains the so-called hyperbolic codes [25, 40, 43].

Definition 4.2

Consider a subset \(J \subseteq \{1,2, \ldots , m\}\) and a positive integer \(t \le n_J = \prod _{j \notin J} N_j \prod _{j \in J} (N_j -1)\). We define the classical code E(Jt), as the vector space of \({\mathbb {F}}_Q^{n_J}\) defined by the evaluation by \({\mathrm {ev}}_J\) of the elements in the vector space generated by the classes in \({\mathcal {R}}_J\) of the monomials in the following set

$$\begin{aligned} M(J,t) = \left\{ X^{\varvec{a}} \; | \; \varvec{a} \in {\mathcal {H}}_J \text{ and } \delta _{\varvec{a}} \ge t \right\} . \end{aligned}$$

As a consequence of Proposition 4.1, it is clear that the minimum distance of the code E(Jt) is larger than \(t-1\).

Duality is crucial for constructing quantum stabilizer codes. Hence, let us study the Euclidean dual code of E(Jt). For a start, consider the following set of monomials in R

$$\begin{aligned} N(J,t) = \left\{ X^{\varvec{b}} \; | \; \epsilon _j \le b_j \le N_j -1, \; 1 \le j \le m, \; {\mathrm {and}} \; \prod _{j=1}^m \left( b_j +1 - \epsilon _j \right) < t \right\} , \end{aligned}$$

where \(\epsilon _j =1\) if \(j \in J\) and it equals zero otherwise. Denote by F(Jt) the classical code given by the vector subspace of \({\mathbb {F}}_Q^{n_J}\) generated by the evaluation by \({\mathrm {ev}}_J\) of the classes in \({\mathcal {R}}_J\) of the monomials in N(Jt). By definition, the (Jt)-hyperbolic code, \({\mathrm {Hyp}}(J,t)\), is the Euclidean dual code \((F(J,t))^\perp \).

Notice that, for the sake of simplicity, to define N(Jt) we have considered a shift for the exponent of the monomials defining the code, such a set is

$$\begin{aligned} \overline{{\mathcal {H}}}_J= & {} \{\epsilon _1, \epsilon _1 +1, \ldots , T_1+ \epsilon _1\} \times \{\epsilon _2, \epsilon _2 +1, \ldots , T_2+ \epsilon _2\} \times \cdots \\&\times \{\epsilon _m, \epsilon _m +1, \ldots , T_m+ \epsilon _m\}. \end{aligned}$$

One may just identify \(T_j + \epsilon _j \) with 0, for \(j \in J\), to obtain an element in \({\mathcal {H}}_J\).

The following proposition is a generalization of [25, Theorem 3], which treated the case \(N_j=Q^r\) for all j, \(1 \le j \le m\), and \(J= \emptyset \). It shows that \(E(J,t)^\perp = F(J,t)\).

Proposition 4.3

With the above notation and assuming that \(p | N_j\) for all \(j \not \in J\), the following equality holds

$$\begin{aligned} E(J,t) = {\mathrm {Hyp}}(J,t). \end{aligned}$$

Proof

We start by proving that for the Euclidean inner product

$$\begin{aligned} {\mathrm {ev}}_J \left( X^{\varvec{a}}\right) \cdot {\mathrm {ev}}_J \left( X^{\mathbf {b}} \right) = 0 \end{aligned}$$
(2)

holds for all monomials \(X^{\varvec{a}} \in M(J,t)\) and \(X^{\varvec{b}} \in N(J,t)\). Reasoning by contradiction, we assume the existence of vectors \(\varvec{a}\) and \(\varvec{b}\) as above for which (2) does not hold. By Proposition 2.2 and its proof (see [19]), it must happen that, for any index j as above, either \(a_j + b_j =N_j -1\) or \(a_j = b_j = N_j -1\). Suppose for simplicity that the first equality holds for those indices j such that \(1 \le j \le n\) and the second happens for the remaining indices. Then,

$$\begin{aligned} t \le \prod _{j=1}^m \left( N_j - a_j - \epsilon _j \right) = \prod _{j=1}^n \left( b_j + 1 - \epsilon _j \right) \end{aligned}$$
(3)

because the case \(a_j = b_j = N_j -1\) only holds for \(j \not \in J\) and then, \(\epsilon _j=0\). Now

$$\begin{aligned} \prod _{j=1}^n \left( b_j + 1 - \epsilon _j \right) = \frac{\prod _{j=1}^m \left( b_j + 1 - \epsilon _j \right) }{\prod _{j=n+1}^m \left( b_j + 1 - \epsilon _j \right) } < t \end{aligned}$$
(4)

since \(\prod _{j=n+1}^m \left( b_j + 1 - \epsilon _j \right) = \prod _{j=n+1}^m N_j \ge 1\). Therefore, we have proved the inclusion \(E(J,t) \subseteq {\mathrm {Hyp}}(J,t)\).

To conclude the proof, it suffices to check that \(\dim \left( {\mathrm {Hyp}}(J,t) \right) = \dim (E(J,t) )\). Set \(M^l (J,t)\) and \(N^l (J,t)\) the set of m-tuples which are exponents of the monomials in M(Jt) and N(Jt), respectively. Notice that

$$\begin{aligned} \dim \left( {\mathrm {Hyp}}(J,t) \right)= & {} n_J - {\mathrm {card}} \left( N^l (J,t) \right) \\= & {} {\mathrm {card}} \left( \left\{ \varvec{b} \; | \; \epsilon _j \le b_j \le N_j -1, \; 1 \le j \le m, \; {\mathrm {and}} \; \prod _{j=1}^m \left( b_j +1 - \epsilon _j \right) \ge t \right\} \right) \\= & {} {\mathrm {card}} \left( M^l (J,t) \right) , \end{aligned}$$

where the last equality holds because of the bijectivity of the componentwise map given by \(x_j \rightarrow N_j - 1- x_j \). This finishes our reasoning. \(\square \)

Next, we are going to provide our main result concerning multivariate J-affine stabilizer codes obtained with Euclidean inner product. The proof follows from Propositions 2.24.1 and 4.3.

With notation as above and as in Sect. 2, for each index \(1 \le i \le m\), define

$$\begin{aligned} r(N_i) := {\left\{ \begin{array}{ll} \lfloor \frac{N_i -1}{2}\rfloor &{} \text{ if } N_i \text { is even},\\ \frac{N_i -1}{2} - 1 &{} \text { otherwise} \end{array}\right. } \end{aligned}$$

and consider the sets of monomials in \({\mathcal {R}}\),

$$\begin{aligned} {{\mathcal {R}}}_i(J) := \left\{ X^{\varvec{b}} \; | \; \varvec{b} \in \overline{{\mathcal {H}}}_J \text{ and } \epsilon _i \le b_i \le r(N_i) \right\} . \end{aligned}$$

Theorem 4.4

Assume \(Q=q\) and that p divides \(N_j\) for all \(j \not \in J\). Suppose also that there exists an index i, \(1 \le i \le m\), and a value \(t \le n_J\) such that \(N(J,t) \subseteq {\mathcal {R}}_i(J)\). Then, it holds that \({\mathrm {Hyp}}(J,t)^\perp \subseteq {\mathrm {Hyp}}(J,t)\) and, therefore, we are able to construct a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2 \, {\mathrm {card}} \left( N(J,t) \right) , \ge t \right] \right] _q. \end{aligned}$$

Proof

Propositions  4.3 and 4.1 show the bound for the distance of the stabilizer code. The self-orthogonality of the code defined by N(Jt) follows from the inclusion \(N(J,t) \subseteq {\mathcal {R}}_i(J)\) and Proposition 2.2 because \({\mathrm {ev}}_J (X^{\varvec{a}}) \cdot {\mathrm {ev}}_J (X^{\varvec{b}}) = 0\) for \(X^{\varvec{a}}, X^{\varvec{b}} \in {\mathcal {R}}_i(J)\), where we consider \(a_j=0\) instead of \(a_j = N_j -1\) when \(j \in J\). \(\square \)

Let us summarize our procedure. Proposition 2.2 shows the monomials which one must avoid to ensure that a code generated by evaluation of monomials be included in its Euclidean dual. This allows us to define sets \({\mathcal {R}}_i(J)\) satisfying this last condition. Taking into account that we have constructed the sets N(Jt) in such a way that the distance of the corresponding dual code is larger than \(t-1\), combining both conditions, we get a procedure for constructing stabilizer codes with designed minimum distance. Later in this section and with similar arguments, we will study the analogous case for Hermitian duality and, in addition, Proposition 4.12 will show stabilizer codes obtained without the help of hyperbolic codes. The following corollary shows some particular bivariate cases where Theorem 4.4 can be easily used in practice.

Corollary 4.5

Keep the above notations, setting \(Q=q=p^r\) and \(N_1\) and \(N_2\) positive integers such that \(N_j - 1\) divides \(q -1\) for \(j=1,2\). Consider a subset J of the set \(\{1,2\}\) and assume that p divides \(N_j\) for each \(j \not \in J\); consider also a positive integer \(t \le n_J\) and suppose that one of the following conditions is satisfied:

  1. (i)

    \(J= \emptyset \) and either \(t \le r(N_1)+2\) or \(t \le r(N_2)+2\).

  2. (ii)

    \(J=\{1\}\) and either \(t \le r(N_1)+1\) or \(t \le r(N_2)+2\).

  3. (iiii)

    \(J=\{1,2\}\) and either \(t \le r(N_1)+1\) or \(t \le r(N_2)+1\).

Then, a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2 \, {\mathrm {card}}\left( N(J,t) \right) , \ge t \right] \right] _q \end{aligned}$$

can be constructed.

Proof

We are going to show that the first (respectively, second) condition given in each item implies the inclusion

$$\begin{aligned} N(J,t) \subseteq R_1(J) \text{(respectively, } N(J,t) \subseteq R_2(J) ), \end{aligned}$$
(5)

which allows us to apply Theorem 4.4 and, as a consequence, to get the mentioned stabilizer codes.

We start by considering the conditions given in item (i). The set \(N(\emptyset , t)\) contains pairs of integers \((b_1,b_2)\) such that \(0 \le b_1 \le N_1 -1\), \(0 \le b_2 \le N_2 -1\) and \((b_1+1)(b_2+1) < t\). Taking into account that \((b_1+1)(b_2+1) = t\) gives the equation of a hyperbola, the first inclusion in (5) is satisfied if the hyperbola intersects the line \(b_2 =0\) at a point in the interval \([0, r(N_1)+1]\). Indeed, when \(b_2=0\), the defining inequality of \(N(\emptyset , t)\) shows \(b_1 +1 <t\) or equivalently \(b_1 \le t-2\). Thus, our hypothesis \(t \le r(N_1) +2\) implies \(b_1 \le r(N_1)\) and the proof is completed. With an analogous reasoning, when \(t \le r(N_2) +2\), one can deduce that the second inclusion in (5) holds.

A similar proof can be done by using conditions (ii) and (iii) in the statement. For instance, in the case of item (ii), \(N(\{1\}, t)\) is given by pairs of integers \((b_1,b_2)\) such that \(1 \le b_1 \le N_1 -1\), \(0 \le b_2 \le N_2 -1\) and \(b_1(b_2+1) < t\). Here the hyperbola is defined by \(b_1(b_2+1) = t\). Note that when \(b_2=0\), we get \(b_1 <t\) or equivalently \(b_1 \le t-1\). Therefore, \(t \le r(N_1) +1\) proves \(b_1 \le r(N_1) \) and, thus, we obtain the desired property \(N(\{1\},t) \subseteq R_1(J)\). \(\square \)

Example 4.6

Next, we give some examples which can be deduced from Theorem 4.4.

Example A Set \(Q=q=p=7\), \(J= \{1\}\), \(N_1=3\), \(N_2=7\) and \(N_3=7\). For applying Theorem 4.4, we are going to consider values t such that \(N(J,t) \subseteq R_2 (J)\). Thus, with notations as in the proof of Proposition 4.3, one can consider \(N^l(J,2) = \{ (1, 0, 0 )\}\) which gives a stabilizer code \(C_1={\mathrm {Hyp}}(J,2)\) with parameters \([[98,96, \ge 2]]_7\). We can also consider \(N^l(J,3) = \{ (1, 0, 0 ), (2, 0, 0), (1, 1, 0), (1, 0, 1 )\}\) giving a stabilizer code \(C_2\) with parameters \([[98,90, \ge 3]]_7\). Analogously

$$\begin{aligned} N^l(J,4) = \{ (1, 0, 0 ), (2, 0, 0), (1, 1, 0), (1, 0, 1 ), (1, 2, 0), (1, 0, 2)\}, \end{aligned}$$

provides a stabilizer code \(C_3\) with parameters \([[98,86, \ge 4]]_7\). Hamada’s enlargement procedure applied to \(C_1\) and \(C_2\) (respectively, \(C_2\) and \(C_3\)) gives stabilizer codes with parameters \([[98,93, \ge 3]]_7\) (respectively, \([[98,88, \ge 4]]_7\)). We have not found, in the literature, better codes with this length. In addition, both codes exceed the Gilbert–Varshamov bounds [14, 16, 42].

Example B Set \(Q=q =7\), \(N_1=N_2=7\), \(N_3=3\) and \(J=\{1,2,3\}\). Consider the stabilizer codes \(C_1={\mathrm {Hyp}}(J,2)\) (\(C_2={\mathrm {Hyp}}(J,3)\), respectively) given by \(N^l(J,2) = \{ (1, 1, 1 )\}\) (\(N^l(J,3) = N^l(J,2) \cup \{ (2,1,1), (2,2,1), (1,1,2)\}\), respectively) with parameters, by Theorem 4.4, \([[72,70, \ge 2]]_7\) (\([[72,64, \ge 3]]_7\), respectively). Consider also the J-affine stabilizer code given by \(N^l(J,4) = N^l(J,3) \cup \{(3,1,1), (2,3,1)\}\) with parameters \([[72, 62, \ge 4]]_7\). Applying the Hamada enlargement procedure, we get stabilizer codes with parameters \([[72,67, \ge 3]]_7\) and \([[72,62, \ge 4]]_7\), improving the \([[72,65, \ge 3]]_7\) and \([[72,59, \ge 4]]_7\) codes in [13].

Theorem 4.4 can be adapted to the case when Hermitian duality is used. Next we state this adaptation. Before it, we consider the above-defined sets M(Jt) and N(Jt) and the codes E(Jt) and F(Jt) over the field \({\mathbb {F}}_{q^2}\). In addition, for each index \(1 \le i \le m\), we define

$$\begin{aligned} {{\mathcal {R}}}^q_i(J) := \left\{ X^{\varvec{b}} \; | \; \varvec{b} \in \overline{{\mathcal {H}}}_J \text{ and } \epsilon _i \le b_i \le r_q(N_i) \right\} , \end{aligned}$$

where

$$\begin{aligned} r_q(N_i) := {\left\{ \begin{array}{ll} \lfloor \frac{N_i -1}{q+1}\rfloor &{} \text{ if } N_i -1 \text { is not a multiple of } q+1,\\ \frac{N_i -1}{q+1} - 1 &{} \text { otherwise.} \end{array}\right. } \end{aligned}$$

Theorem 4.7

Suppose that \(Q=q^2\) and that p divides \(N_j\) for all index \(j \not \in J\). Then, for each positive value \(t \le n_J\) such that

$$\begin{aligned} N(J,t) \subseteq {\mathcal {R}}^q_i (J), \end{aligned}$$
(6)

for some index i, \(1 \le i \le m\), it holds that

$$\begin{aligned} F(J,t) \subseteq \left( F(J,t) \right) ^{\perp _h} \end{aligned}$$

and, therefore, we are able to construct a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2 \, {\mathrm {card}} \left( N(J,t) \right) , \ge t \right] \right] _q. \end{aligned}$$

Proof

As in the proof of Theorem 4.4, the inclusion of sets in (6) proves, by Proposition 2.3, the self-orthogonality of the code F(Jt) with respect to Hermitian inner product.

To conclude the proof, we are going to show that the distance of the code \(F(J,t)^{\perp _h}\) is larger than or equal to t. In fact, it is clear that the code of q powers \(\left( F(J,t)^{\perp _h} \right) ^q\) of the coordinates of the elements in the Hermitian dual of the code F(Jt) is exactly the Euclidean dual \(F(J,t)^{\perp }\). As a consequence, the equality of codes

$$\begin{aligned} \left( F(J,t)^{\perp _h} \right) ^q = {\mathrm {Hyp}}(J,t) \end{aligned}$$

and the fact that the codes \(\left( F(J,t)^{\perp _h} \right) ^q\) and \(F(J,t)^{\perp _h} \) are isometric prove that the following distances satisfy the inequality

$$\begin{aligned} d \left( F(J,t)^{\perp _h} \right) = d \left( {\mathrm {Hyp}}(J,t) \right) \ge t, \end{aligned}$$

which finishes the proof. \(\square \)

Now, we state a consequence of the previous result which holds for some conditions in the bivariate case. It is analogous of Theorem 4.4 for the Hermitian case.

Corollary 4.8

We continue to keep the above notation, set \(Q=q^2\) and let \(N_1\) and \(N_2\) be positive integers such that \(N_j - 1\) divides \(q^2 -1\) for \(j=1,2\). Consider a subset J of the set \(\{1,2\}\). Assume that p divides \(N_j\) for each \(j \not \in J\) and that \(t \le n_J\) is a positive integer. Suppose also that one of the following conditions is satisfied:

  1. (i)

    \(J= \emptyset \) and either \(t \le r_q(N_1)+2\) or \(t \le r_q(N_2)+2\).

  2. (ii)

    \(J=\{1\}\) and either \(t \le r_q(N_1)+1\) or \(t \le r_q(N_2)+2\).

  3. (iii)

    \(J=\{1,2\}\) and either \(t \le r_q(N_1)+1\) or \(t \le r_q(N_2)+1\).

Then, a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2 \, {\mathrm {card}} \left( N(J,t) \right) , \ge t \right] \right] _q \end{aligned}$$

can be constructed.

Proof

The proof is similar to the one of Corollary 4.5, that is, our first (respectively, second) condition in each item implies the inclusion (6) for \(i=1\) (respectively, \(i=2\)) and thus, by Theorem 4.7, a stabilizer code with the stated parameters can be constructed.

Table 3 Parameters of quantum codes of length 144 over \({\mathbb {F}}_7\)

The reasoning in each case is analogous to the corresponding one in Corollary 4.5. For instance, when the first condition in item (i) happens, one can deduce that the hyperbola given by \((b_1 +1)(b_2+1)=t\) intersects the line \(b_2=0\) at one point of the real interval \([0, r_q(N_1)+1]\) which is the desired condition. The other cases can be proved in a similar way. \(\square \)

Example 4.9

We are going to provide three examples of good stabilizer codes. The first two can be deduced from Corollary 4.8.

Example A Set \(q=7\), consider \(N_1 =49\), \(N_2=4\) and \(J=\{1,2\}\). Note that \(n_J=144\) and \(r_q(N_1) = 5\). Then, by item (iii) of Corollary 4.8, one can use values of t such that \(t <7\). Set \(t=4\), then the set \(N^l (\{1,2\},4)\) of pairs which are exponents of the monomials generating \(F (\{1,2\},4)\) is equal to

$$\begin{aligned} N^l (\{1,2\},4) = \{(1,1), (1,2), (1,3), (2,1), (3,1) \}, \end{aligned}$$

and so, we get a \([[144,134, \ge 4]]_7\) stabilizer quantum code. A similar reasoning for \(t=5\) and \(t= 6\) provides stabilizer quantum codes with parameters \([[144,130, \ge 5]]_7\) and \([[144,128, \ge 6]]_7\). Here, \(N^l (\{1,2\},5) = N^l (\{1,2\},4) \cup \{(4,1), (2,2)\}\) and \(N^l (\{1,2\},6) = N^l (\{1,2\},5) \cup \{(5,1)\}\).

Corollary 4.8 assumes a generic situation for self-orthogonality of the code given by N(Jt). However, this situation can happen without occurring inclusion in sets as \({\mathcal {R}}_i(J)\), giving stabilizer codes with good parameters. Indeed, considering \(N(\{1,2\},7)\), it holds that \(N^l (\{1,2\},7) = N^l (\{1,2\},6) \cup \{(3,2),(2,3),(6,1)\}\) and, by applying Proposition 2.3, the corresponding code is self-orthogonal providing a \([[144,122, \ge 7]]_7\) stabilizer code. In an analogous manner, we can find stabilizer codes with distance up to 12. We show their parameters in Table 3.

Notice that all these codes produce a great improvement of those given in [38, Table IV]. We also improve those codes with the same length in [13], and our codes exceed the Gilbert–Varshamov bounds [14, 16, 42].

Example B Let us see a new example. Here \(q=4\), \(N_1= 16\). \(N_2 =6\) and \(J=\emptyset \). It is clear that \(p=2\) divides \(N_1\) and \(N_2\), \(n_J= 96\), and \(r_q(N_2) =2\). So, one can get codes for \(t < 5\). With the previous notation, we have that

$$\begin{aligned} N^l (\emptyset ,4) = \{(0,0), (0,1), (0,2), (1,0), (2,0) \}. \end{aligned}$$

This provides a stabilizer code with parameters, \([[96, 86, \ge 4]]_4\). With a similar reasoning to that we did for obtaining the last codes in Example A, we get \([[96, 80, \ge 5]]_4\) and \([[96, 76, \ge 6]]_4\) stabilizer codes. All these codes also exceed the Gilbert–Varshamov bounds.

Example C Consider \(q=5\), \(N_1= 25\), \(N_2 =4\) and \(J=\{1,2\}\). Although Corollary 4.8 cannot be used, it holds that \(N_1^l (\{1,2\},4) {=} \{(1,1), (1,2), (2,1), (1,3), (3,1) \}\) and, by Proposition 2.3, \(F (\{1,2\},4)\) is self-orthogonal giving rise to a \([[72,62,4]]_5\) stabilizer code with better parameters than the \([[72,60,4]]_5\) code given in [13] and with better relative parameters than the \([[71,56,4]]_5\) code given in [38, Table III]. In addition, our code also exceeds the Gilbert–Varshamov bounds.

Considering \(J= \emptyset \) and suitable values for \(N_1\) and \(N_2\), we obtain the following result.

Corollary 4.10

With the above notations, assume \(Q=q^2\), \(J=\emptyset \), \(N_1= q^2\) and \(N_2=q\). Consider a positive integer t such that

$$\begin{aligned} t < \min \left\{ \frac{q^2+q+1}{2}, 4q+1 \right\} . \end{aligned}$$

Then, a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2 \, {\mathrm {card}} \left( N(J,t) \right) , \ge t \right] \right] _q \end{aligned}$$

can be constructed.

Proof

Firstly, we are going to prove that under the condition

$$\begin{aligned} t < \min \left\{ \frac{q^2+q+1}{2}, 4q+1, q r(q) +2q+1 \right\} , \end{aligned}$$
(7)

where r(q) is defined as above, the inclusion \(F(J,t) \subseteq \left( F(J,t) \right) ^{\perp _h}\) holds. Afterward, we will see that we can reduce Inequality (7) to that given in the statement. As a consequence, a stabilizer code with the mentioned parameters can be constructed.

Consider the set \({\mathcal {H}}_J = \{0,1, \ldots , q^2-1\} \times \{0,1, \ldots , q-1\}\) embedded in the corresponding rectangle in \(\mathbb {R}^2\) and the six subsets in \({\mathcal {H}}_J\) delimited by the lines \(b_1=q-1\), \(b_1= 2q -2\) and \(b_2= r(q)+1\).

We will use Proposition 2.3 for obtaining sets of monomials in \({\mathcal {H}}_J\) whose evaluation gives self-orthogonal linear codes. We start by observing that an exponent pair of the form \((x,q-1)\) is not compatible with a pair \((q^2-1 -qx \mod (q^2-1),0)\), where we choose a nonnegative integer less than \(q^2\) as a representative of the mentioned congruence class. Then, taking into account that the hyperbola \((b_1+1)(b_2+1) =t\) meets the line \(b_2=q-1\) at the point \(((t/q)-1,q-1)\), the line \(b_2=0\) at the point \((t-1,0)\) and each point on \(b_2=q-1\) eliminates a point on \(b_2=0\) after moving back q units modulo \(q^2 -1\) its non-vanishing coordinate, we get that when t satisfies

$$\begin{aligned} q \left( \frac{t}{q} -1\right) < q^2 -t +1, \end{aligned}$$
(8)

the pairs in N(Jt) on \(b_2=q-1\) can be considered as exponents of monomials in the generating set of our supporting linear code. So, from (8), we can deduce the imposed condition which is \(t < (q^2+q+1)/2\).

To guarantee our result, we need to impose some more conditions. We say that two exponents are incompatible if the evaluation the corresponding monomials are not orthogonal. On the one hand, it holds that pairs \((q-1,a)\) on the line \(b_1=q-1\) are incompatible with pairs \((q^2-1 -q(q-1),q-1-q a)\), which after taking the corresponding congruence classes provides pairs \((q-1,q-1-a)\) at the same line. This imposes the condition that the intersection point between \((b_1 +1)(b_2+1) =t \) and \(b_1= q-1\) should be either \((q-1, r(q) +1)\) or another point on the line \(b_1=q-1\) with second coordinate less than \(r(q)+1\), note that it is crucial that \(t < qr(q)+2q+1\). We must also notice that \(r_q(q^2-1)=q-2\) and, by Theorem 4.7, those points in the rectangle \(0 \le b_1 \le q-2\), \(0 \le b_2 \le q-2\) are suitable for us.

Now consider the set of points B in \({\mathcal {H}}_J\) within the rectangle

$$\begin{aligned} \left\{ (b_1,b_2) \;|\; q \le b_1 \le 2q -3; \; \; 1 \le b_2 \le r(q) \right\} . \end{aligned}$$

The fact that, under the above restriction for \(b_1\), \((q^2-1)-qb_1 = q^2 -2 - q(b_1 -q)\) modulo \(q^2-1\) shows that points in B discard points in

$$\begin{aligned} \left\{ (b_1,b_2) \;|\; 2q-1 \le b_1 \le q^2-1; \; \; r(q)+1 \le b_2 \le q-1 \right\} . \end{aligned}$$

Furthermore, points in the line \(b_1=2q-2\) are incompatible with other points on the same line. As a consequence, we add another restriction to avoid most points on this line that can be expressed by saying that the hyperbola \((b_1+1)(b_2 +1)=t\) must intersect the line \(b_1=2q-1\) at the point \((2q-1,1)\) or below it, which forces us to consider \(t < 4q +1\). In fact, the unique point under the hyperbola that deserves special attention is \((2q-2,1)\), but it eliminates \((2q-2,q-2)\) and self-orthogonality is preserved. The remaining points on the line \(b_1=2q-2\) have the form \((2q-2,b)\), \(b \ge 2\) and are not below the hyperbola since \((2q-1)(b+1) \ge 6q-3\), \(6q -3 > 4q\) and \(t \le 4q\).

Finally, we are going to prove that

$$\begin{aligned} \frac{q^2+q+1}{2} < q r(q) +2q +1. \end{aligned}$$

And, as a consequence, we can eliminate \(q r(q) +2q+1\) from Inequality (7). Indeed, when q is even,

$$\begin{aligned} q r(q) +2q+1 = q \left( \frac{q-2}{2} + 2\right) +1 = \frac{q^2 +2q +2}{2}. \end{aligned}$$

Otherwise,

$$\begin{aligned} q r(q) +2q+1 = q \left( \frac{q-1}{2} + 1\right) +1 = \frac{q^2 +q +2}{2}, \end{aligned}$$

and the proof is completed. \(\square \)

Example 4.11

Next, we apply Corollary 4.10 to give some examples of good stabilizer codes.

Example A Set \(q=4\), \(N_1= 16\), \(N_2=4\) and \(J=\emptyset \), then \(n_J=64\). Since \((q^2+q+1)/2 = 21/2\) and \(4q+1=17\), we can use Corollary 4.10 and get quantum codes up to distance 10. In fact, it can be checked that self-orthogonality also happens for distances 11 and 12, and so we can derive codes with parameters as in Table 4. Comparing with [37, Table III] and [32], we get four codes with better relative parameters and two new codes, which we label with an asterisk. We also add a symbol GV for identifying those codes exceeding the Gilbert–Varshamov bounds.

Example B Assume \(q=9\), \(N_1=81\), \(N_2=9 \) and \(J=\emptyset \). Applying Corollary 4.10 \(n_J= 729\) and t should be less than 37 because \((q^2+q+1)/2 = 91/2\) and \(4q+1=37\). Table 5 shows the parameters of some of our codes.

Table 4 Parameters of quantum codes of length 64 over \({\mathbb {F}}_4\)
Table 5 Parameters of quantum codes of length 729 over \({\mathbb {F}}_9\)

Our previous results consider hyperbolic codes as the supporting linear codes and assume that p divides \(N_j\) for \(j \not \in J\). Both assumptions can be avoided; in fact, one only needs the fact that p divides \(N_j\) for at least one index j whenever \(J=\emptyset \). A general theorem in this direction would be dense. Therefore, we give the corresponding result in the bivariate case only, which will give good stabilizer codes and shows the underlying ideas. We state it for Euclidean inner product, but notice the important fact that the result also holds for Hermitian inner product.

Proposition 4.12

Suppose \(Q=q\), consider positive integers \(N_1\) and \(N_2\) such that \(N_j-1\) divides \(q-1\) for \(j=1,2\) and a subset \(J \subseteq \{1,2\}\). For \(J=\emptyset \), assume that p divides \(N_j\) for, at least, one index \(j=j_0\). Let \({\mathcal {N}}\) be a set of monomials in R such that:

  1. (i)

    \({\mathcal {N}} \subset {\mathcal {R}}_i(J)\) for either \(i=1\) or \(i=2\) when \(J=\{1,2\}\).

  2. (ii)

    \({\mathcal {N}} \subset {\mathcal {R}}_i(J)\) when \(J=\{i\}\) and, in case \(p \not | ~ N_j\), (\(j \ne i\)), \({\mathcal {N}}\) does not contain any pair of monomials of the form \(X_i^{b_i} X_j^{0}\) and \(X_i^{b'_i} X_j^{N_j -1}\), \(j \ne i\), except when \(b_i = b'_i\). That is, we only admit pairs of monomials \(X_i^{b_i} X_j^{0}\) and \(X_i^{b_i} X_j^{N_j -1}\) and monomials with exponent in j, either always 0 or always \(N_j -1\).

  3. (iii)

    \({\mathcal {N}} \subset R_{j_0}(J)\) when \(J=\emptyset \) and we do not consider \(X_i^{N_i -1} X_{j_0}^{b_{j_0}}\), \(i \ne j_0\), in \({\mathcal {N}}\) except when \(X_i^{0} X_{j_0}^{b_{j_0}}\) is also in \({\mathcal {N}}\). Moreover, we consider monomials with exponent in i, either always 0 or always \(N_j -1\).

Denote by \({\mathcal {N}}^l\) the set of exponent pairs of the monomials in \({\mathcal {N}}\) and write

$$\begin{aligned} {\mathcal {N}}^{D,l} = {\mathcal {H}}_J \setminus \{(N_1-1-b_1,N_2-1-b_2)\; | \; (b_1,b_2) \in {\mathcal {N}}^l\}. \end{aligned}$$

Then, the code \(E_{\mathcal {N}} : = E_{\mathcal {N}}^J\) (see Definition 2.1) is self-orthogonal and the distance of the dual code is larger than or equal to

$$\begin{aligned} \delta = \min \left\{ \prod _{j=1}^2 \left( N_j - \epsilon _j -a_j \right) \; | \; \varvec{a} \in {\mathcal {N}}^{D,l} \right\} . \end{aligned}$$

As a consequence, we are able to construct a stabilizer code with parameters

$$\begin{aligned} \left[ \left[ n_J, n_J - 2\; {\mathrm {card}}({\mathcal {N}}), \ge \delta \right] \right] _q. \end{aligned}$$

Proof

Proposition 2.2 shows that the inclusions imposed in the proposition imply the self-orthogonality of the code \(E_{\mathcal {N}}\). Indeed, by Proposition 2.2, when p divides \(N_j\) for all \(j \notin J\), it holds that every monomial \(X_1^{b_1} X_2^{b_2}\), \(b_1 < N_1 -1\), \(b_2 < N_2 -1\), admits a unique monomial with exponents in \({\mathcal {H}}_J\), \(X_1^{N_1 -1-b_1} X_2^{N_2-1-b_2}\), such that the inner product of their evaluations by \({\mathrm {ev}}_J\) does not vanish. However, when p does not divide \(N_j\) for some \(j \not \in J\), say \(J=\{2\}\) and p does not divide \(N_1\), it happens that \({\mathrm {ev}}_J(X_1^{0} X_2^{b_2}) \cdot {\mathrm {ev}}_J(X_1^{0} X_2^{N_2-1-b_2}) = \alpha \ne 0\) and \({\mathrm {ev}}_J(X_1^{0} X_2^{b_2}) \cdot {\mathrm {ev}}_J(X_1^{N_1-1} X_2^{N_2-1-b_2}) = \beta \ne 0\). In addition, when one admits \(N_j -1\) as an exponent, it also holds that \({\mathrm {ev}}_J(X_1^{N_1 -1} X_2^{b_2}) \cdot {\mathrm {ev}}_J(X_1^{0} X_2^{N_2-1-b_2}) \ne 0\) and \({\mathrm {ev}}_J(X_1^{N_1 -1} X_2^{b_2}) \cdot {\mathrm {ev}}_J(X_1^{N_1-1} X_2^{N_2-1-b_2}) \ne 0\) and the same result is true if we switch the roles of the indices 1 and 2. Notice that the monomial \(X_1^{N_1 -1} X_2^{N_2-1}\) is not eligible for our codes. As a consequence, we get that our definition of sets \({\mathcal {N}}\) avoid the existence of conflicting pairs in \({\mathcal {N}}^l\), and therefore, the evaluation of any monomial \(X^{\varvec{b}} \in {\mathcal {N}}\) is orthogonal to that of all monomials in \({\mathcal {N}}\), which proves the self-orthogonality of the code.

To conclude our proof, notice that the dual code \((E_{\mathcal {N}})^\perp \) could not be only generated by evaluating monomials. This can be checked by computing the dimension of the dual code \(n_J - \dim E_{\mathcal {N}}\) and the set of monomials whose evaluation is not orthogonal to the evaluation of the monomials generating our code. In fact, the existence of monomials of the form (say) \(X_i^{b_i}X_j^0\) (or \(X_i^{b'_i}X_j^{N_j -1}\)) forces to eliminate from the dual code the evaluation of \(X_i^{N_i -1-b_i}X_j^{N_j -1}\) and \(X_i^{N_i -1-b_i}X_j^{0}\) (or \(X_i^{N_i -1-b'_i}X_j^{N_j -1}\) and \(X_i^{N_i -1-b'_i}X_j^{0}\)) because both evaluations are not orthogonal to that of the previous given monomial. Notwithstanding, conditions in (ii) or (iii) allow us to consider pairs in \({\mathcal {N}}^l\) corresponding to monomials with exponents 0 and \(N_j -1\), when the other exponent is the same, since both monomials eliminate the same pair of monomials.

Furthermore, the same conditions show that we also admit monomials with exponents always all 0 or always \(N_j -1\). This is imposed because we can obtain their corresponding generating polynomials for the dual code and, as a consequence, we can decide about minimum distance. Let us see it, for instance, for the case \(J=\{2\}\) and p does not divide \(N_1\). The remaining cases can be reasoned analogously. Notice that, in this case, \((E_{\mathcal {N}})^\perp \) could not be generated only by evaluating monomials; however, taking the above-given values \(\alpha \) and \(\beta \), it is clear that

$$\begin{aligned} {\mathrm {ev}}_J \left( X_1^{0} X_2^{b_2}\right) \cdot {\mathrm {ev}}_J \left( \frac{1}{\alpha } X_1^{0} X_2^{N_2-1-b_2} - \frac{1}{\beta } X_1^{N_1 -1} X_2^{N_2-1-b_2} \right) = 0, \end{aligned}$$
(9)

which proves that \((E_{\mathcal {N}})^\perp \) is generated by evaluating monomials \(X_1^{a_1} X_2^{a_2}\) such that

$$\begin{aligned} (a_1,a_2) \in {\mathcal {H}}_J \Big \backslash \left\{ (N_1 -1-b_1,N_2 -1-b_2) \; | \; b_1 \ne 0; (b_1,b_2) \in {\mathcal {N}}^l \right\} \end{aligned}$$

and binomials as in (9) for each pair \((0,b_2) \in {\mathcal {N}}^l\). This concludes our proof by considering a suitable monomial ordering for which \(X_1^{0} X_2^{N_2-1-b_2}\) is the leading monomial of \( \frac{1}{\alpha } X_1^{0} X_2^{N_2-1-b_2} - \frac{1}{\beta } X_1^{N_1 -1} X_2^{N_2-1-b_2}\) and after applying Proposition 4.1. \(\square \)

Remark 4.13

Proposition 4.12 is stated for the case \(Q=q\) but, as mentioned, it also holds when \(Q=q^2\) and the Hermitian inner product is considered. The difference is that we should consider a set of monomials \({\mathcal {N}}_q\) such that

  1. (i)

    \({\mathcal {N}}_q \subset {\mathcal {R}}_i^q(J)\) for either \(i=1\) or \(i=2\) when \(J=\{1,2\}\).

  2. (ii)

    \({\mathcal {N}}_q \subset {\mathcal {R}}_i^q(J)\) when \(J=\{i\}\) and, in case \(p \not | ~ N_j\), (\(j \ne i\)), \({\mathcal {N}}_q\) does not contain any pair of monomials \(X_i^{b_i} X_j^{0}\) and \(X_i^{b'_{i}} X_j^{N_j-1}\) except when \(b_i = b'_i\); that is, we only admit pairs of monomials of the form \(X_i^{b_i} X_j^{0}\) and \(X_i^{b_i} X_j^{N_j -1}\) and monomials with exponent in j, either always 0 or always \(N_j -1\).

  3. (iii)

    \({\mathcal {N}}_q \subset R_{j_0}^q(J)\) when \(J=\emptyset \) and we do not allow \(X_i^{N_i -1} X_{j_0}^{b_{j_0}}\), \(i \ne j_0\), in \({\mathcal {N}}_q\) except when \(X_i^{0} X_{j_0}^{b_{j_0}}\) is also in \({\mathcal {N}}_q\). We also permit monomials with exponents in i, either always 0 or always \(N_j -1\).

And, for computing the distance, \({\mathcal {N}}^{D,l}\) should be replaced with

$$\begin{aligned} {\mathcal {N}}_q^{D,l} = {\mathcal {H}}_J \setminus \{(N_1-1-qb_1 \mod T_1,\;\; N_2-1-qb_2 \mod T_2\;\; | \; \; (b_1,b_2) \in {\mathcal {N}}_q^l\}. \end{aligned}$$

Proposition 2.3, some ideas in Theorem 4.7 and Proposition 4.1 establish the proof.

4.1 The subfield-subcode case

We conclude our paper with this subsection, where we show that some similar results can be stated by considering subfield-subcodes. Here we use the notation introduced after Proposition 2.4 and in the first paragraphs of Sect. 3.1.3. We extend, to the multivariate case, ideas and procedures we treated in Sect. 3. The sets \(\Delta \) defining the codes in this subsection will satisfy several conditions. On the one hand, they will be a union of minimal cyclotomic sets, which allows us to compute the dimension of the subfield-subcodes [17] and, on the other hand, those sets \(\Delta \) will contain suitable elements (in accordance with previous results in this section) for guarantying that the distance of the codes will be lower bounded. Finally, we will also impose conditions for the cyclotomic sets which, according to Propositions 2.2 and 2.3, will prove the self-orthogonality of the classical supporting codes of our stabilizer codes.

Next, keeping the above notations, we state our first two results for which we will give a joint proof. With respect to quantum stabilizer codes determined by Euclidean inner product we get the following theorem:

Theorem 4.14

Let r and s be positive integers such that s divides r. Set \(Q=q=p^r\) and consider values \(N_j\), \(1 \le j \le m\), as above. Consider a subset \(J \subseteq \{1,2, \ldots , m\}\) and assume that p divides \(N_j\) for all \(j \notin J\). Consider also the minimal cyclotomic sets \({\mathfrak {I}}_{\varvec{a}}\), \(\varvec{a} \in \mathcal {A} \) with respect to \(p^s\) and, for a positive integer \(t \le n_J\), set

$$\begin{aligned} \Delta \left( N(J,t)\right) = \bigcup _{\varvec{a} \in \mathcal {A} \cap N(J,t)} {\mathfrak {I}}_{\varvec{a}}. \end{aligned}$$

Denote also by \({\mathfrak {I}}_{-\varvec{a}}\) the cyclotomic set with respect to \(p^s\) containing the congruence classes of the tuple \(-\varvec{a}\), and assume that \({\mathfrak {I}}_{\varvec{a}} \ne {\mathfrak {I}}_{-\varvec{a'}}\) for all pair \(\varvec{a}\), \(\varvec{a'}\) of elements in \(\mathcal {A} \cap N(J,t)\). Then, the subfield-subcode over \({\mathbb {F}}_{p^s}^{n_J}\) of the J-affine variety code given by \(\Delta \left( N(J,t)\right) \), \(E^{J,\sigma }_{\Delta \left( N(J,t)\right) } = E_{\Delta \left( N(J,t)\right) }^J \cap {\mathbb {F}}_{p^s}^{n_J}\), satisfies

$$\begin{aligned} E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \subseteq \left( E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \right) ^\perp \end{aligned}$$

and gives rise to a stabilizer code with parameters \([[n_J, n_J - 2 \sum _{\varvec{a} \in \mathcal {A} \cap N(J,t)} i_{\varvec{a}}, \ge t ]]_{p^s}\).

Our result when one considers the Hermitian inner product is:

Theorem 4.15

Let r and s be positive integers such that s divides r. Set \(Q=q^2=p^{2r}\) and consider values \(N_j\), \(1 \le j \le m\), as above (i.e., \(N_j -1\) divides \(Q-1\)). Consider a subset \(J \subseteq \{1,2, \ldots , m\}\) and assume that p divides \(N_j\) for all \(j \notin J\). Consider also the minimal cyclotomic sets \({\mathfrak {I}}_{\varvec{a}}\) with respect to \(p^{2s}\), where \(\varvec{a} \in \mathcal {A}\) and for a positive integer \(t \le n_J\), define \( \Delta \left( N(J,t)\right) = \bigcup _{\varvec{a} \in \mathcal {A} \cap N(J,t)} {\mathfrak {I}}_{\varvec{a}}\). Denote also by \({\mathfrak {I}}_{-p^s \varvec{a}}\) the cyclotomic set with respect to \(p^{2s}\) containing the congruence classes of the tuple \(-p^s \varvec{a}\) and assume that \({\mathfrak {I}}_{\varvec{a}} \ne {\mathfrak {I}}_{-p^s \varvec{a'}}\) for all \(\varvec{a}\), \(\varvec{a'}\) in \(\mathcal {A} \cap N(J,t)\). Then the subfield-subcode of the J-affine variety code given by \(\Delta \left( N(J,t)\right) \) over \({\mathbb {F}}_{p^{2s}}^{n_J}\), \(E^{J,\sigma }_{\Delta \left( N(J,t)\right) } = E_{\Delta \left( N(J,t)\right) }^J \cap {\mathbb {F}}_{p^{2s}}^{n_J}\), satisfies

$$\begin{aligned} E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \subseteq \left( E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \right) ^{\perp _h} \end{aligned}$$

and it gives rise to a stabilizer code with parameters \([[n_J, n_J - 2 \sum _{\varvec{a} \in \mathcal {A} \cap N(J,t)} i_{\varvec{a}}, \ge t ]]_{p^s}\).

Proofs for Theorems 4.14 and  4.15 are analogous except that, for the first result, we have to consider Euclidean dual and subfield-subcodes over \({\mathbb {F}}_{p^{s}}^{n_J}\). So, let us show a proof for Theorem  4.15.

For a start, consider the code, over \({\mathbb {F}}_{p^{2s}}^{n_J}\), \(E^{J,\sigma }_{\Delta \left( N(J,t)\right) }\). By [17, Theorem 4], its dimension is \(\sum _{\varvec{a} \in \mathcal {A} \cap N(J,t)} i_{\varvec{a}}\). Now a similar reasoning as we did in the proof of Proposition 3.10 proves that the Hermitian dual of the code \(E^{J,\sigma }_{\Delta \left( N(J,t)\right) }\) coincides with the trace \(\mathbf {tr}_{2r}^{2s}: {\mathbb {F}}_{p^{2r}}^{n_J} \rightarrow {\mathbb {F}}_{p^{2s}}^{n_J}\) of the dual code of \(E^{J}_{\Delta \left( N(J,t)\right) }\) with respect to the above-defined inner product \(\cdot _{s}\). Notice that \(\mathbf {tr}_{2r}^{2s}\) is given componentwise by the map \(tr_{2r}^{2s}\) defined in the mentioned proof of Proposition 3.10. By the proof of [19, Theorem 7], this trace is the subfield-subcode over \({\mathbb {F}}_{p^{2s}}^{n_J}\) of the mentioned dual code with respect to \(\cdot _s\).

The above ideas allow us to prove the inclusion

$$\begin{aligned} E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \subseteq \left( E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \right) ^{\perp _h}. \end{aligned}$$

Indeed, by Proposition 2.3 and [17, Theorem 3], \(\left( E^{J,\sigma }_{\Delta \left( N(J,t)\right) }\right) ^{\perp _h}\) is obtained by evaluating polynomials defined by representatives of minimal cyclotomic sets in

$$\begin{aligned}&{\mathcal {H}}_J \setminus \left\{ \left( [-p^s a_1]_{N_1 -1}, [-p^s a_2]_{N_2 -1}, \ldots , [-p^s a_m]_{N_m -1}\right) \; | \; \varvec{a}\right. \\&\left. \quad =(a_1,a_2, \ldots , a_m) \in \Delta \left( N(J,t)\right) \right\} ; \end{aligned}$$

therefore, the condition \({\mathfrak {I}}_{\varvec{a}} \ne {\mathfrak {I}}_{-p^s \varvec{a'}}\) for all \(\varvec{a}\), \(\varvec{a'}\) in \(\mathcal {A} \cap N(J,t)\), given in the statement, allows us to conclude the mentioned self-orthogonality of the code \(E^{J,\sigma }_{\Delta \left( N(J,t)\right) }\).

It only remains to check that the distance is greater than or equal to t. In fact, for a linear code C and a positive integer k, if we write \(C^k\) for the set of words \(\mathbf {x}^k =(x_1^k, x_2^k, \ldots , x_m^k)\), then the following inequality of distances of codes holds: \(d \left( E^{J,\sigma }_{\Delta \left( N(J,t)\right) } \right) ^{\perp _h} \ge d \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp _{p^s}}\) and, moreover, it also holds that

$$\begin{aligned} \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp _{p^s}} = \left[ \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp } \right] ^{p^{2r-s}}, \end{aligned}$$

because \(\mathbf {y}^{p^{2r}} = (\mathbf {y}^{p^s})^{p^{2r-s}}\) and \(\mathbf {y} \in \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp _{p^s}}\) if and only if \(\mathbf {y}^{p^s} \in \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp }\) if and only if \(\mathbf {y} \in \left[ \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp } \right] ^{p^{2r-s}}\). This concludes the proof, because \(\left[ \left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp } \right] ^{p^{2r-s}}\) is isometric to \(\left( E^{J}_{\Delta \left( N(J,t)\right) } \right) ^{\perp }\), whose distance is larger than or equal to t since \(E_{N(J,t)}^J \subseteq E_{\Delta (N(J,t))}^J\).

To finish, we state the following result which follows straightforwardly because our hypotheses on cyclotomic sets in Theorems 4.14 and  4.15 can be guaranteed by imposing conditions to one variable, as we show in Propositions 3.6 and 3.10.

Corollary 4.16

Let pRSQ and J be as in Sect. 2. Set \(N_1=p^R\) and suppose that \(N_j -1\) divides \(p^R -1\) for \(j \in J\setminus \{1\}\). Denote by \(\mathcal {A}^1\) a set of univariate representatives as in Sect. 3 of minimal cyclotomic sets with respect to \(p^s\) modulo \(N_1 -1\). Set \( {{\mathfrak {a}}} := \max \{a\in \mathcal {A}^1\mid a<p^{R/2}-1\}\) when R is even; and \({{\mathfrak {a}}} := \max \{a\in \mathcal {A}^1 \mid a\le p^{(R+1)/2}-p-1 \}\), otherwise. Then:

  • In the Euclidean case, that is \(Q=q=p^r\), \(R=r\) and \(S=s\), it holds that \(E_{\Delta (N(J,t))}\subset E_{\Delta (N(J,t))}^{\perp }\) for any \(t\le {{\mathfrak {a}}} + 1\). Therefore, the above self-orthogonal code gives rise to a quantum code with parameters \([[n_J,n_J -2 \, {\mathrm {card}}(\Delta (N(J,t))),\ge t]]_{p^s}\).

  • In the Hermitian case, that is \(Q=p^{2r}\), \(R=2r\) and \(S=2s\), it holds that \(E_{\Delta (N(J,t))}\subset E_{\Delta (N(J,t))}^{\perp _h}\) for any \(t\le {{\mathfrak {a}}} +1\) and the above self-orthogonal code yields a code with parameters \([[n_J,n_J -2 \, {\mathrm {card}}(\Delta (N(J,t))),\ge t]]_{p^s}\).

In addition, when \(J \subseteq \{1,2\}\) we can reason as in corollaries 4.5 and 4.8 and, then, the above results are true for \(t\le {{\mathfrak {a}}} + 2\) whenever \(J=\emptyset \) or \(J=\{2\}\).

Example 4.17

Above results are the support of the following examples of quantum codes.

Example A With notation as in Theorem 4.15, set \(p=5\), \(r=2\), \(s=1\), \(Q= 5^4\), \(J=\emptyset \), \(N_1=15\) and \(N_2=6\). Consider \(t=3\) and then \( \Delta \left( N(J,t)\right) = \{ (0, 0), (1, 0), (12, 0), (0, 1)\}\) which satisfies the hypotheses in the mentioned theorem. Then, we get a \([[70,62, \ge 3]]_5\) quantum code which can be extended to a quantum code with parameters \([[71,62, \ge 3]]_5\), which improves the \([[71,61, \ge 3]]_5\) quantum code given in [38, Table 1] and [13].

Example B We conclude with an example obtained applying Corollary 4.16. Set \(p=2\), \(r=4\), \(s=2\), \(N_1=256\), \(N_2=2\) and \(J=\emptyset \). Here \({{\mathfrak {a}}}=14\) and we get codes of length 512 over \({\mathbb {F}}_4\). Table 6 displays the corresponding parameters. Note that the codes with distance less than 9, except that with distance 7, exceed the Gilbert–Varshamov bound.

Table 6 Parameters of quantum codes of length 512 over \({\mathbb {F}}_4\)