1 Introduction

The Shor’s proposal of using quantum error correction for reducing decoherence in quantum computation [24] and his polynomial-time algorithms for prime factorization and discrete logarithms on quantum computers [25] clearly illustrate the feasibility and importance of quantum computation and quantum error correction.

Most of the quantum error-correcting codes (QECCs) come from classical codes. The first known stabilizer quantum codes were binary [5, 10]. Later, stabilizer codes over any finite field were introduced and studied and they are of particular interest because of their utility in fault-tolerant computation. Following [13], one can obtain QECCs of length n over a finite field \({\mathbb {F}}_q\) from additive codes included in \({\mathbb {F}}_q^{2n}\) which are self-orthogonal with respect to a trace-symplectic form. Working on this construction, QECCs of length n over \({\mathbb {F}}_q\) can be derived from classical self-orthogonal codes with respect to the Hermitian inner product included in \({\mathbb {F}}_{q^2}^{n}\) and also from codes in \({\mathbb {F}}_{q}^{n}\) which are self-orthogonal with respect to the Euclidean inner product.

The previously mentioned self-orthogonality conditions (or some similar requirements of inclusion of codes in the dual of others) prevent the usage of many common classical codes for providing quantum codes. Brun et al. [3] proposed to share entanglement between encoder and decoder to simplify the theory of quantum error correction and increase the communication capacity. With this new formalism, entanglement-assisted quantum stabilizer codes can be constructed from any classical linear code giving rise to entanglement-assisted quantum error-correcting codes (EAQECCs). A formula to obtain the optimal number of ebits required for a binary entanglement-assisted code of Calderbank–Shor–Steane (CSS) type was shown in [12], and formulae for more general constructions, including the consideration of duality with respect to symplectic forms, were given in [26]. In fact, [26] proves that the optimal number c of ebits required for a binary entanglement-assisted quantum error-correcting code with generator matrix \((H_X|H_Z)\) is \(\mathrm {rank}(H_X H_Z^T - H_Z H_X^T)/2\), where the superindex T means transpose. Remark 1 in that paper states, without a proof, that the same formula holds when considering codes over finite fields \({\mathbb {F}}_p\), p being a prime number; a proof can be found in [18].

Recently, one can find in the literature some papers where the above formula (or formulae derived from it) is used for determining the entanglement corresponding to EAQECCs over arbitrary finite fields (see, for instance, [6, 9, 17, 21]). Although it holds for any finite field, we have found no proof in the literature and, thus, this work fills this gap. Therefore, this paper is devoted to prove formulae for the minimum required number c of pairs of maximally entangled quantum states, corresponding to EAQECCs codes obtained from linear codes C over any finite field, by using symplectic forms, or Hermitian or Euclidean inner products. We also show (see Sect. 2.4) that in the Hermitian and Euclidean cases, c is easy to compute when one chooses, as a basis of the linear code C of length n, a subset of those vectors giving rise to a geometric decomposition of the coordinate space of dimension n that contains C [22].

In [15], a Gilbert–Varshamov-type formula for the existence of binary EAQECCs was presented. Still with the idea of extending the binary case to the general one and with the help of our study of entanglement-assisted codes, we give a Gilbert–Varshamov-type formula which is valid for any finite field. Furthermore, we will also provide conditions of existence and parameters of EAQECCs coming from classical self-orthogonal codes (say C) over any finite field. Since fewer qudits should be transmitted through a noisy channel, they perform better. Constructions of this type have been considered in the binary case for giving a coding scheme with imperfect ebits [15].

Theorems 13 and 4 contain our results about the entanglement required for EAQECCs over arbitrary finite fields. Section 2 also explains how, in the Hermitian and Euclidean cases, nice bases of the vector spaces that contain the supporting linear codes allow us to get the corresponding required number c. Section 3 is devoted to state the mentioned Gilbert–Varshamov-type bound, and Sect. 4 contains our results about EAQECCs coming from QECC by considering symplectic, Hermitian or Euclidean duality.

2 EAQECCs over \({\mathbb {F}}_q\)

The first three subsections of this section are devoted to prove formulae for computing the optimal entanglement corresponding to EAQECCs over arbitrary finite fields when considering symplectic forms, or Hermitian or Euclidean inner products.

2.1 The symplectic case

Let p be a prime number and q a positive power \(q=p^m\). Denote by \({\mathbb {F}}_q\) the finite field with q elements. We also write \({\mathbb {C}}\) the field of complex numbers and \({\mathbb {C}}^r\), r a positive integer, the r-coordinate space over \({\mathbb {C}}\).

Let n be a positive integer, it is known (see, for instance, [13, Theorem 13]) that an \(((n, K,d))_q\) stabilizer quantum code over \({\mathbb {F}}_q\) can be obtained from an additive code \(C \subseteq {\mathbb {F}}_q^{2n}\) of size \(q^n/K\) such that \(C \subseteq C^{\perp _{ts}}\), and \(\mathrm {swt} (C^{\perp _{ts}} {\setminus } C)= d\) when \(K \ge 1\) and \(d= \mathrm {swt} (C)\) otherwise. In the above result, we have considered the following notation which will be used in this paper as well. The symbol \(\perp _{ts}\) means dual with respect to the trace-symplectic form on \({\mathbb {F}}_q^{2n}\):

$$\begin{aligned} \left( \mathbf {a}|\mathbf {b}\right) \cdot _{ts} \left( \mathbf {a'}|\mathbf {b'}\right) = \mathrm {tr}_{q/p}\left( \mathbf {a} \cdot \mathbf {b'} - \mathbf {a'} \cdot \mathbf {b}\right) \in {\mathbb {F}}_p, \end{aligned}$$

where \(\left( \mathbf {a}|\mathbf {b}\right) , \left( \mathbf {a'}|\mathbf {b'}\right) \in {\mathbb {F}}_q^{2n}\), \(\mathbf {a} \cdot \mathbf {b'}\) and \(\mathbf {a'} \cdot \mathbf {b}\) are Euclidean products, and \(\mathrm {tr}_{q/p}: {\mathbb {F}}_q \rightarrow {\mathbb {F}}_p\),

$$\begin{aligned} \mathrm {tr}_{q/p}(x)= x + x^p + \cdots + x^{p^{m-1}}, \end{aligned}$$

is the standard trace map. Also the symplectic weight is defined as

$$\begin{aligned} \mathrm {swt} \left( \mathbf {a}|\mathbf {b}\right) = \mathrm{card}\left\{ i \;| \; (a_i,b_i) \ne (0,0), 1 \le i \le n \right\} , \end{aligned}$$

where \(\mathbf {a}=(a_1,a_2, \ldots , a_n)\) and \(\mathbf {b}=(b_1,b_2, \ldots , b_n)\).

We will also use the symplectic form on \({\mathbb {F}}_q^{2n}\) defined as

$$\begin{aligned} \left( \mathbf {a}|\mathbf {b}\right) \cdot _{s} \left( \mathbf {a'}|\mathbf {b'}\right) = \left( \mathbf {a} \cdot \mathbf {b'} - \mathbf {a'} \cdot \mathbf {b}\right) \in {\mathbb {F}}_q, \end{aligned}$$

and the corresponding dual space for an \({\mathbb {F}}_q\)-linear code \(C \subseteq {\mathbb {F}}_q^{2n}\) will be denoted by \(C^{\perp _s}\).

For the first part of this paper, we fix a trace orthogonal basis of \({\mathbb {F}}_q\) over \({\mathbb {F}}_p\), \(B=\{\gamma _1, \gamma _2, \ldots , \gamma _m\}\). Recall that B is a basis of \({\mathbb {F}}_q\) as a \({\mathbb {F}}_p\)-linear space satisfying that the matrix

$$\begin{aligned} M= \left( \mathrm {tr}_{q/p}(\gamma _i \gamma _j)\right) _{1\le i \le m;\;1\le j \le m} \end{aligned}$$

is an invertible and diagonal matrix of size m with coefficients in \({\mathbb {F}}_p\). The existence of a basis as B is proved in [23]. We choose a basis as B by convenience, but our results also hold if one considers any other basis. Now consider the \({\mathbb {F}}_p\)-linear map

$$\begin{aligned} h: {\mathbb {F}}_p^m \rightarrow {\mathbb {F}}_q, \;\; h(x_1,x_2, \ldots ,x_m)= \sum _{i=1}^m x_i \gamma _i:= x. \end{aligned}$$

The map h is an isomorphism of \({\mathbb {F}}_p\)-linear spaces, and for \(x \in {\mathbb {F}}_q\), \(h^{-1}(x)\) gives the coordinates of x in the basis B.

Denote by \(\varOmega \) the inverse matrix of M, and \(\varOmega \) is a size m diagonal invertible matrix with entries in \({\mathbb {F}}_p\). Let \(\omega _1, \omega _2, \ldots , \omega _m\) be its diagonal, and define the map:

$$\begin{aligned} \phi : {\mathbb {F}}_p^{2m}={\mathbb {F}}_p^m \times {\mathbb {F}}_p^m \longrightarrow {\mathbb {F}}_q^2, \end{aligned}$$

given by

$$\begin{aligned} \phi \left( (x_1,x_2, \ldots ,x_m)|(y_1,y_2, \ldots ,y_m)\right)= & {} \left( \sum _{i=1}^m x_i \gamma _i, \sum _{i=1}^m y_i \omega _i \gamma _i\right) \\= & {} \left( h(x_1,x_2, \ldots ,x_m), h[(y_1,y_2, \ldots ,y_m)\varOmega ]\right) . \end{aligned}$$

Taking into account that \(\omega _i \in {\mathbb {F}}_p\), \(B'=\{\omega _i \gamma _i\}_{i=1}^m\) is also a trace orthogonal basis of \({\mathbb {F}}_q\) over \({\mathbb {F}}_p\) whose matrix \(\left( \mathrm {tr}_{q/p}(\omega _i \gamma _i \omega _j \gamma _j)\right) _{1\le i \le m;\;1\le j \le m}\) is \(\varOmega \).

In sum, \(\phi \) is an isomorphism of \({\mathbb {F}}_p\)-linear spaces and for \((x,y) \in {\mathbb {F}}_q^2\),

$$\begin{aligned} \phi ^{-1} (x,y) = \left( \phi ^{-1}_1 (x,y), \phi ^{-1}_2 (x,y)\right) \in {\mathbb {F}}_p^{2m}, \end{aligned}$$

where \(\phi ^{-1}_{1}\) (respectively, \(\phi ^{-1}_{2}\)) is the first (respectively, second) projection of \(\phi ^{-1}\) over the first (respectively, second) component of the Cartesian product \({\mathbb {F}}_p^m \times {\mathbb {F}}_p^m\). One has that \(\phi ^{-1}(x,y)\) simply gives a pair whose first components are the coordinates of x in the basis B and the second ones are those of y in the basis \(B'\).

The above map can be extended to products of n copies giving rise to the map

$$\begin{aligned} \phi ^E: {\mathbb {F}}_p^{2mn}=({\mathbb {F}}_p^m)^n \times ({\mathbb {F}}_p^m)^n \longrightarrow {\mathbb {F}}_q^{n} \times {\mathbb {F}}_q^{n} ={\mathbb {F}}_q^{2n}, \end{aligned}$$

defined by

$$\begin{aligned}&\phi ^E \left[ \left( (a_{11}, \ldots , a_{1m}), \ldots , (a_{n1}, \ldots , a_{nm})|(b_{11}, \ldots , b_{1m}), \ldots , (b_{n1}, \ldots , b_{nm}) \right) \right] \\&\quad =\left( h(a_{11}, \ldots ,a_{1m}), \ldots , h(a_{n1}, \ldots , a_{nm}) | h[(b_{11}, \ldots , b_{1m})\varOmega ], \ldots , h[(b_{n1}, \ldots , b_{nm})\varOmega ] \right) . \end{aligned}$$

Notice that \(\phi ^E\) is again an isomorphism of \({\mathbb {F}}_p\)-linear spaces and

$$\begin{aligned} \left( \phi ^E\right) ^{-1} \left( \mathbf {a}|\mathbf {b}\right) = \left( \left( \phi ^E\right) ^{-1}_1 \left( \mathbf {a}|\mathbf {b}\right) |\left( \phi ^E\right) ^{-1}_2 \left( \mathbf {a}|\mathbf {b}\right) \right) , \end{aligned}$$

where \(\left( \phi ^E\right) ^{-1}_1\) (respectively, \(\left( \phi ^E\right) ^{-1}_2\)) is the first (respectively, second) projection of \(\left( \phi ^E\right) ^{-1}_1\) over the first (respectively, second) component of the Cartesian product \(({\mathbb {F}}_p^m)^n \times ({\mathbb {F}}_p^m)^ n\). One has that \(\left( \phi ^E\right) ^{-1}\left( \mathbf {a}|\mathbf {b}\right) \) equals the vector of coordinates of the element \(\left( \mathbf {a}|\mathbf {b}\right) \in {\mathbb {F}}_q^{2n}\) in the basis of \({\mathbb {F}}_q^{2n}\) over \({\mathbb {F}}_p\) given by \(\oplus _{n\; \small {\text{ times }}} B \bigoplus \oplus _{n\; \small {\text{ times }}} B'\).

Keeping the above notation, it is easy to deduce the following result in [2].

Proposition 1

The following statements hold:

  1. a)

    Let \(x, y \in {\mathbb {F}}_q\), then

    $$\begin{aligned} \mathrm {tr}_{q/p}(xy) = \left( \phi ^{-1}_1 (x,y)\right) \cdot \left( \phi ^{-1}_2 (x,y)\right) , \end{aligned}$$

    where \(\cdot \) denotes the Euclidean product in \({\mathbb {F}}_p^m\).

  2. b)

    Let \(\left( \mathbf {a}|\mathbf {b}\right) , \left( \mathbf {a'}|\mathbf {b'}\right) \in {\mathbb {F}}_q^{2n}\), then

    $$\begin{aligned}&\left( \mathbf {a}|\mathbf {b}\right) \cdot _{st} \left( \mathbf {a'}|\mathbf {b'}\right) \\&\quad = \left[ \left( \phi ^E\right) ^{-1}_1 \left( \mathbf {a}|\mathbf {b}\right) | \left( \phi ^E\right) ^{-1}_2 \left( \mathbf {a}|\mathbf {b}\right) \right] \cdot _s \left[ \left( \phi ^E\right) ^{-1}_1 \left( \mathbf {a'}|\mathbf {b'}\right) | \left( \phi ^E\right) ^{-1}_2 \left( \mathbf {a'}|\mathbf {b'}\right) \right] , \end{aligned}$$

    where \(\cdot _s\) denotes the symplectic form in \({\mathbb {F}}_p^{2mn}\).

Our purpose in this section is to determine the optimal required number of pairs of maximally entangled states of the EAQECC over an arbitrary finite field \({\mathbb {F}}_q\) that can be constructed from an \({\mathbb {F}}_q\)-linear code \(C \subseteq {\mathbb {F}}_q^{2n}\) with dimension \(n-k\). Assume that \((H_X|H_Z)\) is an \((n-k)\times 2n\) generator matrix of C. The case when \(m=1\) (i.e., q is prime) is known (see [18, 26]), and the corresponding result is the following:

Theorem 1

Let \(C \subseteq {\mathbb {F}}_p^{2n}\) be an \((n-k)\)-dimensional \({\mathbb {F}}_p\)-linear space and \(H = (H_X|H_Z)\) an \((n-k) \times 2n\) matrix whose row space is C. Let \(C' \subseteq {\mathbb {F}}_p^{2(n+c)}\) be an \({\mathbb {F}}_p\)-linear space such that the projection of \(C'\) to the \(1, 2, \ldots , n, n+c+1, n+c+2, \ldots , 2n+c\)-th coordinates is equal to C and \(C' \subseteq (C')^{\perp _s}\), where c is the minimum required number of maximally entangled quantum states in \({\mathbb {C}}^p \otimes {\mathbb {C}}^p\). Then,

$$\begin{aligned} 2c = \mathrm {rank}\left( H_X H_Z^T - H_Z H_X^T\right) . \end{aligned}$$

The encoding quantum circuit is constructed from \(C'\), and it encodes \(k+c\) logical qudits in \({\mathbb {C}}^p \otimes \cdots (k+c\; \text{ times }) \cdots \otimes {\mathbb {C}}^p\) into n physical qudits using c maximally entangled pairs. The minimum distance is \(d:= d_s \left( C^{\perp _s}{\setminus } (C\cap C^{\perp _s}) \right) \), where

$$\begin{aligned} d_s\left( C^{\perp _s}{\setminus } (C\cap C^{\perp _s})\right) = \min \left\{ \mathrm {swt}\left( \mathbf {a}|\mathbf {b}\right) \mid \left( \mathbf {a}|\mathbf {b}\right) \in C^{\perp _s}{\setminus } (C\cap C^{\perp _s})\right\} . \end{aligned}$$

In sum, C provides an \([[n,k+c,d;c]]_p\) EAQECC over the field \({\mathbb {F}}_p\).

Theorem 1 states that the required number of maximally entangled quantum states is given by the rank of the matrix \(H_X H_Z^T - H_Z H_X^T\). Our next result shows that even in the case of codes over an arbitrary finite field \({\mathbb {F}}_q\), the above number depends only on the code C and its symplectic dual.

Proposition 2

Let \(C \subseteq {\mathbb {F}}_q^{2n}\) be a linear code over \({\mathbb {F}}_q\) and \((H_X|H_Z)\) its \((n-k)\times 2n\) generator matrix. Then,

$$\begin{aligned} \mathrm {rank}\left( H_X H_Z^T - H_Z H_X^T\right) = \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} (C \cap C^{\perp _s}). \end{aligned}$$

Proof

Consider the \({\mathbb {F}}_q\)-linear map \(f : {\mathbb {F}}_q^{2n} \rightarrow {\mathbb {F}}_q^{n-k}\) defined by \(f\left( \mathbf {a}|\mathbf {b}\right) = \mathbf {a} H_Z^T - \mathbf {b} H_X^T\). Set \(\mathrm {row}(H_X|H_Z)\) the row space of the matrix \((H_X|H_Z)\). Then, we have

$$\begin{aligned} \mathrm {rank}\left( H_X H_Z^T - H_Z H_X^T\right)= & {} \dim _{{\mathbb {F}}_q} f\left( \mathrm {row}(H_X|H_Z)\right) \\= & {} \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} C \cap \ker (f)\\= & {} \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} (C \cap C^{\perp _s}), \end{aligned}$$

which concludes the proof.\(\square \)

Next, with the help of the above proposition, we prove that Theorem 1 can be extended to codes over any finite field \({\mathbb {F}}_q\).

Theorem 2

Let \(C \subseteq {\mathbb {F}}_q^{2n}\) be an \((n-k)\)-dimensional \({\mathbb {F}}_q\)-linear space and \(H = (H_X|H_Z)\) a matrix whose row space is C. Let \(C' \subseteq {\mathbb {F}}_q^{2(n+c)}\) be an \({\mathbb {F}}_q\)-linear space such that its projection to the coordinates \(1, 2, \ldots , n, n+c+1, n+c+2, \ldots , 2n+c\) equals C and \(C' \subseteq (C')^{\perp _s}\), where c is the minimum required number of maximally entangled quantum states in \({\mathbb {C}}^q \otimes {\mathbb {C}}^q\). Then,

$$\begin{aligned} 2c = \mathrm {rank}\left( H_X H_Z^T - H_Z H_X^T\right) = \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} \left( C \cap C^{\perp _s}\right) . \end{aligned}$$

The encoding quantum circuit is constructed from \(C'\), and it encodes \(k+c\) logical qudits in \({\mathbb {C}}^q \otimes \cdots (k+c\; \text{ times }) \cdots \otimes {\mathbb {C}}^q\) into n physical qudits using c maximally entangled pairs. The minimum distance is \(d:= d_s \left( C^{\perp _s}{\setminus } (C\cap C^{\perp _s}) \right) \), where \(d_s\) is defined as in Theorem 1. In sum, C provides an \([[n,k+c,d;c]]_q\) EAQECC over the field \({\mathbb {F}}_q\).

Proof

One has that the inclusion \(C^{\perp _s}\subseteq C^{\perp _{ts}}\) holds since \(\mathrm {tr}_{q/p}(0)=0\). In addition, \(C^{\perp _{ts}}\subseteq C^{\perp _s}\). Indeed, following [2], if \(\left( \mathbf {a}|\mathbf {b}\right) \in C^{\perp _{ts}}\), then \(\left( \mathbf {a}|\mathbf {b}\right) \cdot _{ts} \left( \mathbf {x}|\mathbf {y}\right) =0\) for all \(\left( \mathbf {x}|\mathbf {y}\right) \in C\). Taking into account that \(\alpha \left( \mathbf {x}|\mathbf {y}\right) \in C\) for any \(\alpha \in {\mathbb {F}}_q\), then \(\mathrm {tr}_{q/p}\left( (\mathbf {a}|\mathbf {b}) \cdot _{s} \alpha (\mathbf {x}|\mathbf {y})\right) =0\) for all \(\alpha \). This means that \(\mathrm {tr}_{q/p}\left( \alpha \left( (\mathbf {a}|\mathbf {b}) \cdot _{s} (\mathbf {x}|\mathbf {y})\right) \right) =0\) for all \(\alpha \), which proves \(\left( \mathbf {a}|\mathbf {b}\right) \cdot _{s} \left( \mathbf {x}|\mathbf {y}\right) =0\) and, therefore \(\left( \mathbf {a}|\mathbf {b}\right) \in C^{\perp _s}\).

Now, using the same notation as at the beginning of this section, consider the code over the field \({\mathbb {F}}_p\), \(C_0:= (\phi ^E)^{-1} (C)\). It is clear that \(\dim _{{\mathbb {F}}_p} (C_0) = m(n-k)\), and by Proposition 1 and the equality \(C^{\perp _s}= C^{\perp _{ts}}\), we have

$$\begin{aligned} \dim _{{\mathbb {F}}_p} C_0 = m(n-k) = m \dim _{{\mathbb {F}}_q} C. \end{aligned}$$

Thus,

$$\begin{aligned} \dim _{{\mathbb {F}}_p} C_0 - \dim _{{\mathbb {F}}_p} C_0 \cap C_0^{\perp _s}= m \left( \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} (C \cap C^{\perp _s}) \right) . \end{aligned}$$

This shows that by Theorem 1, we have an entanglement-assisted quantum code encoding \(m(k+c)\) qudits in \({\mathbb {C}}^p\) and consuming mc maximally entangled states in \({\mathbb {C}}^p \otimes {\mathbb {C}}^p\). Using the map \(\phi ^E\) and the fact that \(C^{\perp _s} = C^{\perp _{ts}}\), we have an entanglement-assisted quantum code encoding \((k+c)\) qudits in \({\mathbb {C}}^q\) and consuming c maximally entangled states in \({\mathbb {C}}^q \otimes {\mathbb {C}}^q\). In fact, one can construct \(C'_0 \subseteq {\mathbb {F}}_p^{2m(n+c)}\) in the same way as constructed \(C'\) from C in Theorem 1. Applying \(\phi ^E\) to the code \(C'_0\), we get the code \(C'\) in the statement with the claimed properties. The minimum distance follows from [13, Section III].\(\square \)

2.2 The Hermitian case

In this subsection, we specialize the results in Sect. 2.1 by considering the Hermitian inner product instead of a symplectic form. With the above notation, consider the finite field \({\mathbb {F}}_{q^2}\) and a normal basis \(\{w, w^q\}\) of \({\mathbb {F}}_{q^2}\) over \({\mathbb {F}}_{q}\). Fix a positive integer n and, following [13], define a trace-alternating form over \({\mathbb {F}}_{q^2}^n\) as

$$\begin{aligned} \mathbf {x} \cdot _a \mathbf {y} = \mathrm {tr}_{q/p}\left( \frac{\mathbf {x} \cdot \mathbf {y}^q - \mathbf {x}^q \cdot \mathbf {y}}{w^{2q}-w^2} \right) , \end{aligned}$$

where \(\mathbf {z}^q\), \(\mathbf {z} \in {\mathbb {F}}_{q^2}^n\), means the componentwise q-power of \(\mathbf {z}\). The map \(\varphi : {\mathbb {F}}_{q}^{2n} \rightarrow {\mathbb {F}}_{q^2}^{n}\) given by \(\varphi \left( \mathbf {a}|\mathbf {b}\right) = w \mathbf {a} + w^q \mathbf {b}\) is bijective and isometric because the symplectic and the Hamming weights of \(\left( \mathbf {a}|\mathbf {b}\right) \) and \(\varphi \left( \mathbf {a}|\mathbf {b}\right) \) coincide. In addition, for \(\left( \mathbf {a}|\mathbf {b}\right) , \left( \mathbf {a'}|\mathbf {b'}\right) \in {\mathbb {F}}_{q}^{2n}\), it holds that

$$\begin{aligned} \left( \mathbf {a}|\mathbf {b}\right) \cdot _{ts} \left( \mathbf {a'}|\mathbf {b'}\right) = \varphi \left( \mathbf {a}|\mathbf {b}\right) \cdot _{a} \varphi \left( \mathbf {a'}|\mathbf {b'}\right) . \end{aligned}$$

Recall that the Hermitian inner product of two vectors \(\mathbf {x}, \mathbf {y} \in {\mathbb {F}}_{q^2}^{n}\) is defined to be \(\mathbf {x} \cdot _h \mathbf {y} = \mathbf {x}^q \cdot \mathbf {y}\), where \(\cdot \) means Euclidean product, and that, in [13], it is proved that for a \({\mathbb {F}}_{q^2}\)-linear code D, the dual codes with respect to the products \(\cdot _a\) and \(\cdot _h\) coincide. With the above ingredients, we are ready to prove the next proposition which will allow us to state and prove our theorem on EAQECCs over arbitrary finite fields by considering Hermitian inner product.

Proposition 3

Let \(C \subseteq {\mathbb {F}}_{q^2}^n\) be a code over \({\mathbb {F}}_{q^2}\) of dimension \((n-k)/2\) for some positive integer k. Let H be its generator matrix. Then,

$$\begin{aligned} \mathrm {rank}(HH^*) = \dim _{{\mathbb {F}}_{q^2}} C - \dim _{{\mathbb {F}}_{q^2}} (C \cap C^{\perp _h}), \end{aligned}$$

where \(H^*\) is the qth power of the transpose matrix of H.

Proof

Define the \({\mathbb {F}}_{q^2}\)-linear map \(f : {\mathbb {F}}_{q^2}^{n} \rightarrow {\mathbb {F}}_{q^2}^{(n-k)/2}\), given by \(f(\mathbf {a}) = \mathbf {a} H^*\). Then,

$$\begin{aligned} \mathrm {rank}(H H^*)= & {} \dim _{{\mathbb {F}}_{q^2}} f(\mathrm {row}(H))\\= & {} \dim _{{\mathbb {F}}_{q^2}} C - \dim _{{\mathbb {F}}_{q^2}} (C \cap \ker (f))\\= & {} \dim _{{\mathbb {F}}_{q^2}} C - \dim _{{\mathbb {F}}_{q^2}} (C \cap C^{\perp _h}). \end{aligned}$$

\(\square \)

Theorem 3

Let \(C \subseteq {\mathbb {F}}_{q^2}^{n}\) be an \((n-k)/2\)-dimensional code over \({\mathbb {F}}_{q^2}\), for suitable integers n and k. Denote by H its generator matrix. Let \(C' \subseteq {\mathbb {F}}_{q^2}^{(n+c)}\) be an \({\mathbb {F}}_{q^2}\)-linear space whose projection to the coordinates \(1, 2, \ldots , n\) equals C and satisfies \(C' \subseteq (C')^{\perp _h}\), where c is the minimum required number of maximally entangled quantum states in \({\mathbb {C}}^q \otimes {\mathbb {C}}^q\). Then,

$$\begin{aligned} c = \mathrm {rank} \left( H H^* \right) = \dim _{{\mathbb {F}}_{q^2}} C - \dim _{{\mathbb {F}}_{q^2}} \left( C \cap C^{\perp _h}\right) . \end{aligned}$$

The encoding quantum circuit is constructed from \(C'\), and it encodes \(k+c\) logical qudits in \({\mathbb {C}}^q \otimes \cdots (k+c\; \text{ times }) \cdots \otimes {\mathbb {C}}^q\) into n physical qudits using c maximally entangled pairs. The minimum distance is \(d:= d_H \left( C^{\perp _h} {\setminus } (C\cap C^{\perp _h}) \right) \), where \(d_H\) is defined as the minimum Hamming weight of the vectors in the set \(C^{\perp _h} {\setminus } \left( C\cap C^{\perp _h} \right) \). In sum, C provides an \([[n,k+c,d;c]]_q\) EAQECC over the field \({\mathbb {F}}_q\).

Proof

With the above notation, consider the code \(C'\) in \({\mathbb {F}}_{q^2}^n\) of dimension \(n-k\) whose generator matrix is

$$\begin{aligned} {\mathcal {H}} = \left( \begin{array}{c} \omega H \\ \omega ^q H \\ \end{array} \right) \end{aligned}$$

and set \(C_0 = \varphi ^{-1} (C')\) the corresponding code in \({\mathbb {F}}_{q}^{2n}\). Since \(\varphi \) is an isometry, to obtain the value 2c corresponding to \(C_0\), it suffices to compute the rank of the matrix given by the form \(\cdot _a\) which is \({\mathcal {J}}= \mathrm {tr}_{q^2/q} \left( (H H^* - H^q H^T)/ \lambda \right) \), where \(\lambda = \omega ^{2q} - \omega ^2\) and \(\mathrm {tr}_{q^2/q}\) the trace map from \({\mathbb {F}}_{q^2}\) to \({\mathbb {F}}_{q}\). Now, setting

$$\begin{aligned} {\mathcal {Z}}= \left( \begin{array}{c@{\quad }c} \omega ^{q+1} &{} \omega ^2 \\ \omega ^{2q} &{} \omega ^{q+1} \\ \end{array} \right) , \end{aligned}$$

it holds that \({\mathcal {J}}= (2/\lambda ) \left( ZH H^*- Z^T H^q H^T \right) \). Performing elementary operations, we get that \( \mathrm {rank} ({\mathcal {J}}) = 2 \, \mathrm {rank} \left( H H^*\right) \). Finally, by our previous considerations, \(\dim _{{\mathbb {F}}_q} C_0 = n-k\), \(\dim _{{\mathbb {F}}_q} (C_0 \cap C_0^{\perp _s}) = 2c\), and

$$\begin{aligned} d_H \left( C^{\perp _h}{\setminus } C^{\perp _h}\cap C\right) = d_s \left( C_0^{\perp _s}{\setminus } (C^{\perp _s}\cap C_0) \right) , \end{aligned}$$

which proves our statement by Theorem 2.\(\square \)

The following corollary is an immediate consequence of the above result.

Corollary 1

Let C be an \([n,k,d]_{q^2}\) linear code over \({\mathbb {F}}_{q^2}\), and set H a parity check matrix of C. Then, there exists an \([[n,2k-n+c,d;c]]_q\) EAQECC where \(c= \mathrm {rank}(H H^*)\), \(H^*\) is the qth power of the transpose matrix \(H^T\).

2.3 The Euclidean case

In this section, we will show that EAQECCs over any finite field \({\mathbb {F}}_{q}\) can be obtained through a CSS construction, where the Euclidean inner product is considered, and carried out with two \({\mathbb {F}}_{q}\)-linear codes \(C_1\) and \(C_2\) of length n. Assume that \(C_1\) (respectively, \(C_2\)) has dimension \(k_1\) and generator matrix \(H_1\) (respectively, \(k_2\) and \(H_2\)). Before stating our result, we give the following proposition which will be used in its proof.

Proposition 4

With the above notations, it holds that

$$\begin{aligned} \mathrm {rank}(H_1H_2^T) = \dim _{{\mathbb {F}}_{q}} C_1 - \dim _{{\mathbb {F}}_{q}} (C_1 \cap C_2^\perp ), \end{aligned}$$
(1)

and

$$\begin{aligned} \mathrm {rank}(H_2H_1^T) = \dim _{{\mathbb {F}}_{q}} C_2 - \dim _{{\mathbb {F}}_{q}} (C_2 \cap C_1^\perp ), \end{aligned}$$
(2)

where \(\perp \) means Euclidean dual.

Proof

To prove Equality (1), consider the \({\mathbb {F}}_q\)-linear map \(f : {\mathbb {F}}_{q}^{n} \rightarrow {\mathbb {F}}_{q}^{k_2}\) defined by the matrix \(H_2^T\), that is \(f(\mathbf {a}) = \mathbf {a}H_2^T\). Then,

$$\begin{aligned} \mathrm {rank}(H_1 H_2^T)= & {} \dim _{{\mathbb {F}}_{q}} f(\mathrm {row}(H_1))\\= & {} \dim _{{\mathbb {F}}_{q}} C_1 - \dim _{{\mathbb {F}}_{q}} (C_1 \cap \ker (f))\\= & {} \dim _{{\mathbb {F}}_{q}} C_1 - \dim _{{\mathbb {F}}_{q}} (C_1 \cap C_2^\perp ). \end{aligned}$$

Equality (2) follows analogously from the map given by \(H_1^T\).\(\square \)

Next, we state the main result in this section.

Theorem 4

Let \(C_1\) and \(C_2\) be two linear codes over \({\mathbb {F}}_{q}\) included in \({\mathbb {F}}_q^{n}\) with respective dimensions \(k_1\) and \(k_2\) and generator matrices \(H_1\) and \(H_2\). Then, the code \(C_0 = C_1 \times C_2 \subseteq {\mathbb {F}}_q^{2n}\) gives rise to an EAQECC which encodes \(n-k_1-k_2 + c\) logical qudits into n physical qudits using the minimum required of maximally entangled pairs c, which is

$$\begin{aligned} c = \mathrm {rank}(H_1H_2^T) = \dim _{{\mathbb {F}}_{q}} C_1 - \dim _{{\mathbb {F}}_{q}} (C_1 \cap C_2^\perp ). \end{aligned}$$

The minimum distance of the entanglement-assisted quantum code is larger than or equal to

$$\begin{aligned} d:= \min \left\{ d_H\left( C_1^\perp {\setminus } (C_2 \cap C_1^\perp )\right) , d_H\left( C_2^\perp {\setminus } (C_1 \cap C_2^\perp )\right) \right\} . \end{aligned}$$

In sum, one gets an \([[n, n-k_1-k_2+c,d;c]]_q\) EAQECC.

Proof

It suffices to notice that \(\dim _{{\mathbb {F}}_{q}} C_0 = k_1 + k_2\), \(C_0^{\perp _s}= C_2^\perp \times C_1^\perp \), and

$$\begin{aligned}&\dim _{{\mathbb {F}}_{q}} C_0 - \dim _{{\mathbb {F}}_{q}} (C_0^{\perp _s}\cap C_0) \\&\quad = \dim _{{\mathbb {F}}_{q}} \left( C_1 \times C_2\right) -\dim _{{\mathbb {F}}_{q}} \left( (C_2^\perp \cap C_1) \times (C_1^\perp \cap C_2)\right) \\&\quad = \left( \dim _{{\mathbb {F}}_{q}} C_1 - \dim _{{\mathbb {F}}_{q}} (C_2^\perp \cap C_1) \right) + \left( \dim _{{\mathbb {F}}_{q}} C_2 - \dim _{{\mathbb {F}}_{q}} (C_1^\perp \cap C_2) \right) \\&\quad = 2c. \end{aligned}$$

By construction, we have that

$$\begin{aligned} d_s(C_0 {\setminus } C_0^{\perp _s}) \ge \min \left\{ d_H\left( C_1^\perp {\setminus } (C_2 \cap C_1^\perp )\right) , d_H\left( C_2^\perp {\setminus } (C_1 \cap C_2^\perp )\right) \right\} , \end{aligned}$$

and then our statement follows from Theorem 2.\(\square \)

2.4 Geometric decomposition of the coordinate space

In this subsection, we consider only the Hermitian and Euclidean cases, and we will explain that the required number of maximally entangled pairs is easy to compute when the generators of the supporting \({\mathbb {F}}_q\)-linear code C in \({\mathbb {F}}_q^{n}\) are a subset of a basis of \({\mathbb {F}}_q^{n}\) with a special metric structure which is said to be compatible with a geometric decomposition of \({\mathbb {F}}_q^{n}\) (see [22]). Notice that in the Hermitian case, q should be \(q^2\); however, for simplicity’s sake and only in this subsection, we will use q as a generic symbol which means a power of a prime in the Euclidean case or an even power of a prime in the Hermitian case. For avoiding to repeat notation, again only in this subsection, \(\langle \mathbf {a} , \mathbf {b} \rangle \) will mean either the Hermitian inner product \(\mathbf {a} \cdot _h \mathbf {b}\) or the Euclidean one \(\mathbf {a} \cdot \mathbf {b}\).

Let us introduce some notation, we say that \(\{\mathbf {v}_1, \mathbf {v}_2\}\) are geometric generators of a hyperbolic plane if \(\langle \mathbf {v}_1 , \mathbf {v}_1 \rangle = \langle \mathbf {v}_2 , \mathbf {v}_2 \rangle =0\) and \(\langle \mathbf {v}_1 , \mathbf {v}_2 \rangle =1\). We say that \(\{\mathbf {v}_1, \mathbf {v}_2 \}\) are geometric generators of an elliptic plane if \(\langle \mathbf {v}_1 , \mathbf {v}_1 \rangle =0\) and \(\langle \mathbf {v}_2 , \mathbf {v}_2 \rangle = \langle \mathbf {v}_1 , \mathbf {v}_2 \rangle =1\). Finally, we say that \(\mathbf {v}\) generates a non-singular space if \(\langle \mathbf {v}, \mathbf {v} \rangle \ne 0\).

Let \(C \subseteq {\mathbb {F}}_q^n\) and set \(\left\{ \mathbf {v}_1, \mathbf {v}_2, \ldots , \mathbf {v}_n \right\} \) a basis of \({\mathbb {F}}_q^n\) such that C is generated by \(\left\{ \mathbf {v}_i\right\} _{i \in I}\) for \(I \subseteq \{1, 2, \ldots , n\}\). We say that C is compatible with a geometric decomposition of \({\mathbb {F}}_q^n\) if

$$\begin{aligned} {\mathbb {F}}_q^n = H_1 \oplus \cdots \oplus H_r \oplus L_1 \oplus \cdots \oplus L_s, \end{aligned}$$

where the linear spaces from \(H_1\), generated by \(\left\{ \mathbf {v}_1, \mathbf {v}_2 \right\} \), to \(H_r \), generated by \(\left\{ \mathbf {v}_{2r-1} , \mathbf {v}_{r} \right\} \), are hyperbolic planes, being the \(\mathbf {v}_{i} \) geometric generators, and from \(L_1\), generated by \(\mathbf {v}_{2r+1}\), to \(L_s\), generated by \(\mathbf {v}_{2r+s} = \mathbf {v}_n \), are non-singular spaces. Then, we say that the vectors \(\mathbf {v}_1, \mathbf {v}_2, \ldots , \mathbf {v}_{r} \) (and the indexes \(1, 2, \ldots r\)) are asymmetric and the vectors \(\mathbf {v}_{r+1}, \mathbf {v}_{r+2}, \ldots , \mathbf {v}_{n}\) (and the indexes \(r+1, r+2, \ldots , n\)) are symmetric. Moreover, we also say that (1, 2), \(\ldots \), \((r-1,r)\) are symmetric pairs.

In [22], for the Euclidean inner product, it was proved that for characteristic different from 2, we can always obtain a basis \(\left\{ \mathbf {v}_1, \mathbf {v}_2, \ldots , \mathbf {v}_{n} \right\} \) of \({\mathbb {F}}_q^n\) such that

$$\begin{aligned} {\mathbb {F}}_q^n = H_1 \oplus \cdots \oplus H_r \oplus L_1 \oplus \cdots \oplus L_s, \end{aligned}$$

with \(s \le 4\). For characteristic equal to 2, we may have a decomposition as in the case with characteristic different from 2, excepting when the vector \((1, 1, \ldots ,1 )\) belongs to the radical (or hull) of C, \(C\cap C^\bot \) . In that particular case, it was given in [22] the following decomposition

$$\begin{aligned} {\mathbb {F}}_q^n = H_1 \oplus \cdots \oplus H_r \oplus L_1 \oplus \cdots \oplus L_s \oplus E, \end{aligned}$$

with \(s \le 2\) and where E is an elliptic plane.

Let \(M = (\langle \mathbf {v}_{i} , \mathbf {v}_{j} \rangle )_{1\le i,j \le n}\), one has that M has the form

$$\begin{aligned} M= \left( \begin{array}{l@{}l@{}l@{}l@{}l@{}l@{}l@{}l} 0 &{} 1 &{} &{} &{} &{} &{} &{} \\ 1 &{} 0 &{} &{} &{} &{} &{} &{} \\ &{} &{} \ddots &{} &{} &{} &{} &{} \\ &{} &{} &{} 0 &{} 1 &{} &{} &{} \\ &{} &{} &{} 1 &{} 0 &{} &{} &{} \\ &{} &{} &{} &{} &{} g_1 &{} &{} \\ &{} &{} &{} &{} &{} &{} \ddots &{} \\ &{} &{} &{} &{} &{} &{} &{} g_s \\ \end{array} \right) , \end{aligned}$$

where \(g_1, \ldots , g_s\) are nonzero, except for the case when the characteristic is 2 and \((1, 1, \ldots , 1)\) belongs to the radical of C; then, we have that M is equal to

$$\begin{aligned} M= \left( \begin{array}{l@{}l@{}l@{}l@{}l@{}l@{}l@{}l@{}l} 0 &{} 1 &{} &{} &{} &{} &{} &{} &{} \\ 1 &{} 0 &{} &{} &{} &{} &{} &{} &{} \\ &{} &{} \ddots &{} &{} &{} &{} &{} &{} \\ &{} &{} &{} 0 &{} 1 &{} &{} &{} &{} \\ &{} &{} &{} 1 &{} 0 &{} &{} &{} &{} \\ &{} &{} &{} &{} &{} g_1 &{} &{} &{} \\ &{} &{} &{} &{} &{} &{} g_s &{} &{} \\ &{} &{} &{} &{} &{} &{} &{} 0 &{} 1 \\ &{} &{} &{} &{} &{} &{} &{} 1 &{} 1 \\ \end{array} \right) . \end{aligned}$$

Now, let \(i \in \{ 1 , 2, \ldots , n \}\). We define \(i'\) as

  • \(i+1\) if \(\mathbf {v}_{i}\) is the first generator of a hyperbolic plane H,

  • \(i-1\) if \(\mathbf {v}_{i}\) is the second generator of a hyperbolic plane H,

  • i if \(\mathbf {v}_{i}\) generates a one-dimensional linear space L,

  • \(i+1\) if \(\mathbf {v}_{i}\) is the first generator of an elliptic plane E.

Notice that we do not define \(i'\) when \(\mathbf {v}_{i}\) is the second geometric generator of an elliptic plane, because in this case, \((1, 1, \ldots , 1)\) is not in the radical of C [22]. For \(I \subseteq \{1, 2, \ldots , n \}\), we set \(I'=\{ i' : i \in I \}\) and \(I^\bot = \{1, 2, \ldots , n \} {\setminus } I'\). In this way, we can compute the dual code \(C^\bot \) of a linear code C generated by \(\left\{ \mathbf {v}_{i}\right\} _{i\in I}\) easily since it is generated by \(\left\{ \mathbf {v}_{i}\right\} _{i \in I^\bot }\). Moreover, it can also be used to construct QECCs using the CSS construction since \(C \subseteq C^\bot \) if and only if \(I \subseteq I^\bot \). These kinds of decomposition arise naturally (i.e., for the usual generators) in some families of evaluation codes as BCH codes, toric codes, J-affine variety codes, negacyclic codes, constacylic codes, etc., and the previous approach has been exploited for constructing stabilizer quantum codes, EAQECCs and LCD codes (see [7,8,9, 14, 17] for instance).

The above paragraphs allow us to give a practical procedure for computing the value c given in Theorem 3, for the Hermitian product, and in Theorem 4, for the Euclidean product (\(C_1=C_2=C)\). Assume that C is a code generated by \(\left\{ \mathbf {v}_{i}\right\} _{i\in I}\) compatible with a geometric decomposition of the corresponding coordinate space and write \(I = I_R \sqcup I_L\) (i.e., \(I = I_R \cup I_L\) and \(I_R \cap I_L = \emptyset \)), where the radical of C, \(C \cap C^\bot \), \(\bot \) meaning dual with respect to the inner product \(\langle ~ , ~ \rangle \), is generated by \(\left\{ \mathbf {v}_{i}\right\} _{i\in I_R}\). The radical of C can be easily computed in this case: Indeed, given \(i \in I\), one has that \(i \in I_R\) if it holds that \(\mathbf {v}_{i}\) is the first generator of a hyperbolic plane H and \(i+1 \not \in I\), \(\mathbf {v}_{i}\) is the second generator of a hyperbolic plane H and \(i-1 \not \in I\), or \(\mathbf {v}_{i}\) is the first generator of an elliptic plane E. Otherwise, \(i \in I_L\). An equivalent way to characterize \(I_R\) is the following: \(I_R\) consists of asymmetric indexes whose pair does not belong to I and \(I_L\) consists of symmetric indexes and pairs of asymmetric indexes that belong to I. Summarizing, one has that when one considers a suitable basis as above, then

$$\begin{aligned} c= & {} \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} \left( C \cap C^\bot \right) = \mathrm {card} (I) - \mathrm {card} (I \cap I^\bot )\\= & {} \mathrm {card} (I) - \mathrm {card} (I_R) = \mathrm {card} (I_L). \end{aligned}$$

Note that we have an EAQECC with maximal entanglement when \(I=I_L\), i.e., when \(I_R = \emptyset \). This fact was used, for instance, in [9].

3 Gilbert–Varshamov-type sufficient condition of existence of entanglement-assisted codes

In this section, we give a Gilbert–Varshamov-type bound which is valid for EAQECCs over arbitrary finite fields. A similar bound was stated in [16] for the binary case.

Theorem 5

Assume the existence of positive integers n, \(k\le n\), \(\delta \), \(c\le (n-k)/2\) such that

$$\begin{aligned} \frac{q^{n+k}-q^{n-k-2c}}{q^{2n}-1}\sum _{i=1}^{\delta - 1} {n \atopwithdelims ()i}(q^2-1)^i < 1. \end{aligned}$$
(3)

Then, there exists an \({\mathbb {F}}_q\)-linear code \(C \subseteq {\mathbb {F}}_q^{2n}\) such that \(\dim _{{\mathbb {F}}_q} C = n-k\), \(d_s(C^{\perp _s}{\setminus } (C^{\perp _s}\cap C)) \ge \delta \) and \(\dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} (C^{\perp _s}\cap C)= 2c\).

Proof

We will use a close argument to the proof of the Gilbert–Varshamov bound for stabilizer codes [4, 13]. Let \(\mathrm {Sp}(q,n)\) be the symplectic group over \({\mathbb {F}}_q^{2n}\) [11, Section 3] and A(kc) the set of \({\mathbb {F}}_q\)-linear spaces \(V \subseteq {\mathbb {F}}_q^{2n}\) such that \(\dim _{{\mathbb {F}}_q} V = n-k\) and

$$\begin{aligned} \dim _{{\mathbb {F}}_q} V - \dim _{{\mathbb {F}}_q} \left( V^{\perp _s}\cap V \right) = 2c. \end{aligned}$$

For \(\mathbf {0} \ne \mathbf {e} \in {\mathbb {F}}_q^{2n}\), define

$$\begin{aligned} B(k,c,\mathbf {e}) = \left\{ V\in A(k,c) \mid \mathbf {e} \in V^{\perp _s}{\setminus } (V^{\perp _s}\cap V) \right\} . \end{aligned}$$

Taking into account that the symplectic group acts transitively on \({\mathbb {F}}_q^{2n} {\setminus } \{\mathbf {0}\}\) [1, 11], it holds that for nonzero \(\mathbf {e}_1\), \(\mathbf {e}_2 \in {\mathbb {F}}_q^{2n}\), there exists \(M \in \mathrm {Sp}(q,n)\) such that \(\mathbf {e}_1 M= \mathbf {e}_2\), and, for \(V_1, V_2 \in A(k,c)\), there exists \(M \in \mathrm {Sp}(q,n)\) such that \(V_1 M= V_2\).

Therefore, for nonzero elements \(\mathbf {e}_1, \mathbf {e}_2 \in {\mathbb {F}}_q^{2n}\) with \(\mathbf {e}_1 M_1 = \mathbf {e}_2 \; \left( M_1 \in \mathrm {Sp}(q,n)\right) \) and some fixed linear space \(V_1 \in A(k,c)\), we have the following chain of equalities:

$$\begin{aligned}&\mathrm {card} \left( B(k, c, \mathbf {e}_1)\right) \\&\quad = \mathrm {card}\left( \{ V \in A(k,c) \mid \mathbf {e}_1 \in V^{\perp _s}{\setminus } (V^{\perp _s}\cap V) \}\right) \\&\quad = \mathrm {card}\left( \{ V_1 M \mid \mathbf {e}_1 \in V^{\perp _s}M {\setminus } (V^{\perp _s}M \cap V M), M \in \mathrm {Sp}(q,n) \}\right) \\&\quad = \mathrm {card} \left( \{V_1 M M_1^{-1} \mid \mathbf {e}_1 \in V^{\perp _s}M M_1^{-1} {\setminus } (V^{\perp _s}M M_1^{-1}\cap V M M_1^{-1}), M \in \mathrm {Sp}(q,n) \}\right) \\&\quad = \mathrm {card}\left( \{ V_1 M \mid \mathbf {e}_1 M_1 \in V^{\perp _s}M {\setminus } (V^{\perp _s}M \cap V M), M \in \mathrm {Sp}(q,n) \} \right) \\&\quad = \mathrm {card}\left( \{ V_1 M \mid \mathbf {e}_2 \in V^{\perp _s}M {\setminus } (V^{\perp _s}M\cap V M), M \in \mathrm {Sp}(q,n) \} \right) \\&\quad = \mathrm {card}\left( \{ V \in A(k,c) \mid \mathbf {e}_2 \in V^{\perp _s}{\setminus } (V^{\perp _s}\cap V) \} \right) \\&\quad = \mathrm {card}\left( B(k, c, \mathbf {e}_2)\right) . \end{aligned}$$

For each \(V \in A(k,c)\), the number of vectors \(\mathbf {e}\) in \({\mathbb {F}}_q^{2n}\) such that \(\mathbf {e} \in V^{\perp _s}{\setminus } (V^{\perp _s}\cap V)\) is

$$\begin{aligned} \mathrm {card}(V^{\perp _s})-\mathrm {card}\left( V^{\perp _s}\cap V\right) =q^{n+k}-q^{n-k-2c}. \end{aligned}$$

The number of pairs \((\mathbf {e}\), V) such that \(\mathbf {0} \ne \mathbf {e} \in V^{\perp _s}{\setminus } (V^{\perp _s}\cap V)\) is

$$\begin{aligned} \sum _{\mathbf {0} \ne \mathbf {e}\in {\mathbb {F}}_q^{2n}} \mathrm {card}\left( B(k,c,\mathbf {e})\right) = \mathrm {card}\left( A(k,c)\right) \left( q^{n+k}-q^{n-k-2c}\right) , \end{aligned}$$

which implies

$$\begin{aligned} \frac{\mathrm {card}\left( B(k,c,\mathbf {e})\right) }{\mathrm {card}\left( A(k,c)\right) } = \frac{q^{n+k}-q^{n-k-2c}}{q^{2n}-1}. \end{aligned}$$
(4)

If there exists \(V \in A(k,c)\) such that \(V \notin B(k,c,\mathbf {e})\) for all \(1 \le \mathrm {swt}(\mathbf {e}) \le \delta -1\), then there will exist V with the desired properties. The number of vectors \(\mathbf {e}\) such that \(1 \le \mathrm {swt}(\mathbf {e}) \le \delta -1\) is given by

$$\begin{aligned} \sum _{i=1}^{\delta - 1} {n \atopwithdelims ()i}(q^2-1)^i. \end{aligned}$$
(5)

By combining Equalities (4) and (5), we see that Inequality (3) is a sufficient condition for ensuring the existence of a code C as in our statement. This ends the proof.\(\square \)

To finish this section, we derive an asymptotic form of Theorem 5.

Theorem 6

Let R, \(\epsilon \) and \(\lambda \) be nonnegative real numbers such that \(R \le 1\), \(\epsilon < 1/2\) and \(\lambda \le (1-R)/2\). Let \(h(x) := -x \log _q x -(1- x) \log _q (x-1)\) be the q-ary entropy function. For n sufficiently large, the inequality

$$\begin{aligned} h(\epsilon ) + \epsilon \log _q (q^2-1) < 1-R, \end{aligned}$$
(6)

implies the existence of a code \(C \subseteq {\mathbb {F}}_q^{2n}\) over \({\mathbb {F}}_q\) such that

$$\begin{aligned} \dim _{{\mathbb {F}}_q} C = \lceil n(1-R) \rceil , \;\; d_s(C^{\perp _s}{\setminus } (C^{\perp _s}\cap C)) \ge \lfloor n\epsilon \rfloor \end{aligned}$$

and

$$\begin{aligned} \dim _{{\mathbb {F}}_q} C - \dim _{{\mathbb {F}}_q} (C^{\perp _s}\cap C) = \lfloor 2n\lambda \rfloor . \end{aligned}$$

Proof

It follows from Theorem 5 using a similar reasoning to that in [19, Section III.C].\(\square \)

4 EAQECCs coming from punctured QECCs

Our final section gives parameters of EAQECCs obtained from punctured codes coming from self-orthogonal codes with respect to symplectic forms, or Hermitian or Euclidean inner products. Since fewer qudits should be transmitted through a noisy channel, they perform better. Let us start with the symplectic case.

4.1 Symplectic form

Let \(C \subseteq {\mathbb {F}}_q^{2n}\) be an \({\mathbb {F}}_q\)-linear code. The puncturing of C to the coordinate set \(\{1, \ldots , n-c\}\) is defined as the code of length \(2(n-c)\) given by

$$\begin{aligned} P(C)= & {} \big \{ (a_1, \ldots , a_{n-c}| b_1, \ldots , b_{n-c}) \mid (a_1, \ldots , a_n| b_1, \ldots , b_n) \in C \\&\text{ for } \text{ some } \;\; a_{n-c+1}, \ldots , a_n, b_{n-c+1}, \ldots , b_n\in {\mathbb {F}}_q \big \}. \end{aligned}$$

In addition, the shortening of C to the coordinate set \(\{1\), ..., \(n-c\}\) is defined as the code

$$\begin{aligned} S(C)= & {} \{ (a_1, \ldots , a_{n-c}| b_1, \ldots , b_{n-c}) \mid \\&(a_1, \ldots , a_{n-c}, 0, \ldots , 0| b_1, \ldots , b_{n-c}, 0, \ldots , 0)\in C \}. \end{aligned}$$

When we have a stabilizer code given by an \({\mathbb {F}}_q\)-linear code C such that \(C \subseteq C^{\perp _s}\subseteq {\mathbb {F}}_q^{2n}\), we can construct an entanglement-assisted code from \(P(C) \subseteq {\mathbb {F}}_q^{2(n-c)}\). By [20], \(P(C)^{\perp _s}= S(C^{\perp _s})\) and we deduce

$$\begin{aligned} P(C) \cap P(C)^{\perp _s}= P(C)\cap S(C^{\perp _s}) = S(C \cap C^{\perp _s}) = S(C). \end{aligned}$$

The minimum distance of the constructed entanglement-assisted code is \(d_s(S(C^{\perp _s}) {\setminus }\)S(C)) which is larger than or equal to \(d_s(C^{\perp _s}{\setminus } C)\). Following [20], one can prove the following result.

Proposition 5

Assume that a positive integer c satisfies \(2c \le d_H(C {\setminus } \{\mathbf {0}\})-1\), then

$$\begin{aligned} \begin{array}{l} \dim _{{\mathbb {F}}_q} P(C) = \dim _{{\mathbb {F}}_q} C, \;\;\text{ and }\\ \\ \dim _{{\mathbb {F}}_q} P(C)\cap P(C)^{\perp _s}= \dim _{{\mathbb {F}}_q} S(C) = \dim _{{\mathbb {F}}_q} C - 2c. \end{array} \end{aligned}$$

Summarizing these observations, we have the following theorem. Notice that a close result has been given in [15] for binary codes.

Theorem 7

Let \(C \subseteq {\mathbb {F}}_q^{2n}\) be an \({\mathbb {F}}_q\)-linear code with \(\dim _{{\mathbb {F}}_q} C = n-k\) and \(C \subseteq C^{\perp _s}\). Assume that a positive integer c satisfies \(2c \le d_H(C {\setminus } \{\mathbf {0}\})-1\); then, the punctured code P(C) provides an

$$\begin{aligned}{}[[n-c, k+c, \ge d_s(C^{\perp _s}{\setminus } C); c]]_q \end{aligned}$$

entanglement-assisted code.

Our next two sections are devoted to give similar results but considering Hermitian or Euclidean inner product.

4.2 Hermitian inner product

Let \(C \subseteq {\mathbb {F}}_{q^2}^n\) be an \({\mathbb {F}}_q\)-linear code. The h-puncturing of C to the coordinate set \(\{1, 2, \ldots , n-c\}\) is the code of length \(n-c\) defined as

$$\begin{aligned}&P_h(C) \\&\quad =\left\{ (a_1, a_2, \ldots , a_{n-c}) \mid (a_1, a_2, \ldots , a_n) \in C \; \text{ for } \text{ some } \; a_{n-c+1}, \ldots , a_n \in {\mathbb {F}}_{q^2} \right\} . \end{aligned}$$

The h-shortening of C to the coordinate set \(\{1, 2, \ldots , n-c\}\) is the code of length \(n-c\) defined as

$$\begin{aligned} S_h(C) = \left\{ (a_1, a_2, \ldots , a_{n-c}) \mid (a_1, a_2, \ldots , a_{n-c}, 0, \ldots , 0) \in C \right\} . \end{aligned}$$

The above concepts allow us to state the following theorem.

Theorem 8

Let \(C \subseteq {\mathbb {F}}_{q^2}^n\) be an \({\mathbb {F}}_{q^2}\)-linear code with \(\dim _{{\mathbb {F}}_{q^2}} C = (n-k)/2\) and suppose that \(C \subseteq C^{\perp _h}\). Let c be a positive integer such that \(c \le d_H(C {\setminus } \{\mathbf {0}\})-1\), then the punctured code \(P_h(C)\) provides an

$$\begin{aligned}{}[[n-c, k+c, \ge d_H(C^{\perp _h}{\setminus } C); c]]_q \end{aligned}$$

entanglement-assisted code.

Proof

By the assumption, \(\dim _{{\mathbb {F}}_{q^2}} P_h(C) = \dim _{{\mathbb {F}}_{q^2}} C\). By a similar argument to that used in Sect. 4.1, we also see that \(P_h(C) \cap P_h(C)^{\perp _h}= S_h(C)\). Now we have that \(c \le d_H(C {\setminus } \{\mathbf {0}\})-1\), so \(\dim _{{\mathbb {F}}_{q^2}} P_h(C) = \dim _{{\mathbb {F}}_{q^2}} C\) and \(\dim _{{\mathbb {F}}_{q^2}} S_h(C) = \dim _{{\mathbb {F}}_{q^2}} C - c\) [20]. It also holds that \(d_H(P_h(C)^{\perp _h}{\setminus } S_h(C)) \ge d_H(C^{\perp _h}{\setminus } C)\), and this concludes the proof by Theorem 3.\(\square \)

4.3 Euclidean inner product

Our result concerning Euclidean duality is the following:

Theorem 9

Let \(C_2 \subseteq C_1 \subseteq {\mathbb {F}}_{q}^n\) be two \({\mathbb {F}}_{q}\)-linear codes such that \(\dim C_i = k_i\), \(1 \le i \le 2\). The standard construction of CSS codes uses \(C_2 \times C_1^\perp \) as the stabilizer. Assume that c is a positive integer such that

$$\begin{aligned} c \le \min \left\{ d_H(C_2 {\setminus } \{\mathbf {0}\}), d_H(C_1^\perp {\setminus } \{0\})\right\} -1, \end{aligned}$$

then the punctured code \(P_h(C_2)\times P_h(C_1^\perp )\) provides an

$$\begin{aligned}{}[[n-c, k_1-k_2+c, \ge \min \left\{ d_H(C_1{\setminus } C_2), d_H(C_2^\perp {\setminus } C_1^\perp ) \right\} ; c]]_q \end{aligned}$$

entanglement-assisted code.

Proof

The assumption \(c \le \min \{d_H(C_2 {\setminus } \{\mathbf {0}\})\), \(d_H(C_1^\perp {\setminus } \{0\})\}-1\) implies the following two equalities: \(\dim _{{\mathbb {F}}_{q}} P_h(C_2) = \dim _{{\mathbb {F}}_{q}} C_2\) and \(\dim _{{\mathbb {F}}_{q}} P_h(C_1^\perp ) = \dim _{{\mathbb {F}}_{q}} C_1^\perp \). Therefore,

$$\begin{aligned} \dim _{{\mathbb {F}}_{q}} P(C_2 \times C_1^\perp ) = \dim _{{\mathbb {F}}_{q}} P_h(C_2) + \dim _{{\mathbb {F}}_{q}} P_h(C_1^\perp ) = n-(k_1-k_2). \end{aligned}$$

Furthermore, it holds that

$$\begin{aligned}&\dim _{{\mathbb {F}}_{q}} P (C_2 \times C_1^\perp ) \cap P(C_2 \times C_1^\perp )^{\perp _s}= \dim _{{\mathbb {F}}_{q}} S(C_2 \times C_1^\perp )\\&\quad = \dim _{{\mathbb {F}}_{q}} [S_h(C_2) \times S_h(C_1^\perp )] = \dim _{{\mathbb {F}}_{q}} S_h(C_2) + \dim _{{\mathbb {F}}_{q}} S_h(C_1^\perp )\\&\quad = \left( \dim _{{\mathbb {F}}_{q}} S_h(C_2)-c \right) + \left( \dim _{{\mathbb {F}}_{q}} S_h(C_1^\perp ) \right) = n-(k_1-k_2)-2c. \end{aligned}$$

Applying Theorem 7 to the code \(C_2 \times C_1^\perp \), the proof is completed.\(\square \)