1 Introduction

Locally recoverable (or repairable) codes (LRCs) were introduced in [16]. The aim was to consider error-correcting codes to treat the repair problem for large-scale distributed and cloud storage systems. Thus an error-correcting code C is named an LRC with locality r whenever any symbol in C can be recovered by accessing at most r other symbols of C (see, for instance, the introduction of [13] for details). The literature contains a good number of papers on this class of codes, some of them are [20, 23, 24, 26, 30, 36, 46]. A variation of Reed–Solomon codes was introduced in [39] for recovering purposes. In [3] these codes were extended to LRCs over algebraic curves. Among the different classes of codes considered as good candidates for local recovering, cyclic codes and subfield-subcodes of cyclic codes play an important role, this is because the cyclic shifts of a recovery set again provide recovery sets [8, 17, 19, 40]. In [31] the author introduced a model of locally recoverable code that also includes local error detection, increasing the security of the recovery system.

There is a Singleton-like bound for LRCs with locality r [16]. Codes attaining this bound are named optimal r-LRCs and interesting constructions of this class of codes can be found in [39, 41] (see also [2, 3, 32, 33, 36]). When considering codes over the finite field \({\mathbb {F}}_q\), q being a prime power, optimal r-LRCs can be obtained for all lengths \(n\le q\) [43] and a challenging question is to study how long these codes can be [18].

The fact that simultaneous multiple device failures may happen leads us to the concept of LRCs with locality \((r,\delta )\) (or \((r,\delta )\)-LRCs). This class of codes was introduced in [34], see Definition 2.2 in this paper, and they also admit a Singleton-like bound [34], which we reproduce in Proposition 2.3. Codes attaining this bound are named optimal \((r,\delta )\)-LRCs or, in this paper, simply optimal codes. Optimal codes have been studied in [6, 8, 10, 20, 22, 26, 35, 38], mainly coming from cyclic and constacyclic codes. A somewhat different way for obtaining LRCs with locality \((r,\delta )\) was started in [13], where the supporting codes were the so-called J-affine variety codes. These codes were introduced in [14] and they have good behaviour for constructing quantum error-correcting codes [11, 12, 14].

Monomial-Cartesian codes (MCCs) are a class of error-correcting codes, introduced in [27], that contains the set of J-affine variety codes. They are evaluation codes obtained as the image of maps

where m is a positive integer larger than 1, \(P=P_1\times \dots \times P_m=\{\varvec{\alpha }_1,\dots ,\varvec{\alpha }_n\}\) a suitable subset of \({\mathbb {F}}_q^m\), I the vanishing ideal at P of \({\mathbb {F}}_q[X_1,\dots ,X_m]\) and \(V_\Delta \) an \({\mathbb {F}}_q\)-linear space generated by classes of monomials (Definition 3.1). This evaluation map is also used in [5] to define codes with variable locality and availability. Evaluation maps of our codes are defined on subsets of coordinate rings of certain affine varieties, but these codes can also be introduced with algebraic tools, as in [27].

The goal of this paper is to obtain many new optimal LRCs coming from MCCs. Previously, an algebraic description of MCCs was given in [29] and these codes were considered for applications different of those in this paper, such as quantum codes, LRCs with availability and polar codes [4, 27].

MCCs come with a natural bound on their minimum distance which allows us to obtain many optimal \((r,\delta )\)-LRCs. In fact, we are able to get all MCCs providing optimal codes whose minimum distance coincides with the mentioned bound (see Remark 4.4).

MCCs are related with and include the family of codes introduced in [1] whose evaluation map is the same as MCCs but their evaluation sets \(V_\Delta \) are only a subset of ours. This makes that the sets \(\Delta \) in [1] have specific shapes while ours can have arbitrary shapes and therefore we obtain many more optimal \((r,\delta )\)-LRCs (see Remark 4.11 for details).

We are interested in optimal \((r,\delta )\)-LRCs and the recent literature presents a number of results giving parameters of codes of this type [6,7,8,9,10, 21, 25, 38, 42, 44, 45]. The length of most of these codes is a multiple of \(r+\delta -1\le q\) and, in this case, and for unbounded length and small size fields, their distances have restrictions being at most \(3\delta \). Larger distances can be obtained when \(q^2+q\) is a bound for the length. One must use different constructions to get these optimal codes, and a large size of the supporting field seems to make it easier to find optimal codes [37].

MCCs are generated by evaluating monomials in several variables and the set of exponents of their generators determines the dimension and a bound \(d_0\) for the minimum distance (see Proposition 3.4 and Corollary 3.7). Our recovery procedure based on interpolation also makes easy to obtain the values r and \(\delta \) of some MCCs regarded as LRCs (Proposition 3.10). Supported on these facts, we provide a large family of optimal MCCs. Subsection 4.1 is devoted to bivariate codes and Subsect. 4.2 to multivariate codes. In fact, codes given in Propositions 4.1, 4.2 and 4.3, 4.6 and 4.7 give the \(d_0\)-optimal LRCs one can get with this type of codes. Notice that \(d_0\)-optimal codes (Definition 3.13) are optimal codes by Remark 3.14 (2).

The above five propositions determine all the parameters of the \(d_0\)-optimal LRCs given by MCCs, see Remarks 4.4 and 4.8. These parameters are grouped in Corollary 4.5 for the bivariate case and in Corollary 4.9 for the multivariate case. Thus, one gets a large family of optimal LRCs that can be constructed by a unique and simple procedure.

This family provides, on the one hand, the parameters of those LRCs over \({\mathbb {F}}_q\) given in [7] whose lengths are of the form \(N(r+\delta -1)\) where N can be written as a product of integers less than or equal to q and, on the other hand, the parameters of those LRCs in [25] with length less than or equal to \(q^2+q\).

The above codes do not give new parameters but subfield-subcodes of many subfamilies of them do give. Thus, providing new families of optimal LRCs is our main goal. Indeed, in Sect. 5 we prove that, considering suitable subfield-subcodes over subfields \({\mathbb {F}}_{q'}\) of \({\mathbb {F}}_q\), we get LRCs over \({\mathbb {F}}_{q'}\) with the same parameters of certain MCCs over \({\mathbb {F}}_q\). Propositions 5.6 and 5.8 for the bivariate case, and Propositions 5.13 and 5.14 for the multivariate case explain how to construct new optimal \((r,\delta )\)-LRCs.

The main results of the paper are Theorems 5.11, 5.12, 5.16 and 5.17. Theorem 5.11 (respectively, 5.16) gives parameters of new optimal LRCs over any field coming from the bivariate (respectively, multivariate) case. Theorems 5.12 and 5.17 do their own but only for characteristic two fields. Remarks 5.9 and 5.15 justify the novelty of our codes. Finally, in Example 5.10 and Tables 1 and 2, one can find some numerical examples of new optimal LRCs over small fields.

Section 2 of the paper is a brief introduction to locally recoverable codes (LRCs) and monomial-Cartesian codes (MCCs) are introduced in Sect. 3 as well as how they can be considered as LRCs, being Proposition 3.10 the main result in this section. Section 4 is devoted to determine the set of optimal MCCs we can obtain. We divide our study in two cases: bivariate and multivariate performed in Subsects. 4.1 and 4.2. Finally our main results concerning new LRCs obtained from subfield-subocdes of some MCCs are given in Sect. 5. Subsection 5.1 recalls the results on subfield-subcodes we will use, while the new parameters are given in Subsect. 5.2 where the bivariate case is treated and in Subsect. 5.3 devoted to the multivariate case.

2 Locally recoverable codes

In this section we give a brief introduction to locally recoverable codes (LRCs) and present the concepts of locality and \((r,\delta )\)-locality, introduced in [16, 34], respectively. An LRC is an error-correcting code such that any erasure in a coordinate of a codeword can be recovered from a set of other few coordinates. Let q be a prime power and \({\mathbb {F}}_q\) the finite field with q elements. Let C be a linear code over \({\mathbb {F}}_q\) with parameters \([n,k,d]_q\). A coordinate \(i \in \{1,\dots ,n\}\) is locally recoverable if there is a recovery set \(R\subseteq \{1,\dots ,n\}\) with cardinality \(r>0\) and \(i\notin R\) such that for any codeword \({\textbf{c}}=(c_1,\dots ,c_n)\in C\), an erasure in the coordinate \(c_i\) of \({\textbf{c}}\) can be recovered from the coordinates of \({\textbf{c}}\) with indices in R. Set \(\pi _R :{\mathbb {F}}_q^n \rightarrow {\mathbb {F}}_q^r\) the projection map on the coordinates of R and write \(C[R]:=\{\pi _R({\textbf{c}}) \mid {\textbf{c}} \in C\}\). Then:

Proposition 2.1

A set \(R\subseteq \{1,\dots ,n\}\) is a recovery set for a coordinate \(i\notin R\) if and only if \({{\,\textrm{d}\,}}(C[{\overline{R}}])\ge 2\), where \({\overline{R}}=R\cup \{i\}\) and \({{\,\textrm{d}\,}}\) stands for the minimum distance.

The locality of a coordinate is the smallest cardinality of a recovery set for that coordinate. An LRC with locality r is an LRC such that every coordinate is locally recoverable and r is the largest locality of its coordinates. The parameters and locality of an LRC satisfy the following Singleton-like inequality.

$$\begin{aligned} k+d+{\bigg \lceil \frac{k}{r}\bigg \rceil }\le n+2. \end{aligned}$$

When the equality holds, the code is called optimal r-LRC.

By Proposition 2.1, if R is a recovery set for i, then \({{\,\textrm{d}\,}}(C[{\overline{R}}])\ge 2\) and thus only one erasure can be corrected (also only up to to one error can be detected). But erasures can also occur in \(\pi _R({\textbf{x}})\) and then we could not recover \(x_i\). To correct more than one erasure we introduce the concept of locality \((r,\delta )\), also named \((r,\delta )\)-locality.

Definition 2.2

A code C is locally recoverable with locality \((r,\delta )\) if, for any coordinate i, there exists a set of coordinates \({\overline{R}}={\overline{R}}(i) \subseteq \{1,\dots ,n\}\) such that:

  1. 1.

    \(i\in {\overline{R}}\) and \(\#{\overline{R}} \le r+\delta -1\); and

  2. 2.

    \({{\,\textrm{d}\,}}(C[{\overline{R}}])\ge \delta \).

Such a set \({\overline{R}}\) is called an \((r,\delta )\)-recovery set for i and C an \((r,\delta )\)-LRC.

In this paper, we will always refer to this type of locality and sometimes, abusing the notation, we will talk about locality r understanding locality \((r,\delta )\) for some \(\delta \) inferred from the context. The second condition in Definition 2.2 allows us to correct an erasure at coordinate i plus any other \(\delta -2\) erasures in \({\overline{R}} \backslash \{i\}\) by using the remaining r coordinates (also it allows us to detect an error at coordinate i plus any other \(\delta -2\) errors in \({\overline{R}} \backslash \{i\}\)). Notice that, when \(\delta \ge 2\) and C is an LRC with locality \((r,\delta )\), the (original definition of) locality of C is \(\le r\). In fact, any subset \(R\subseteq {\overline{R}}\) such that \(\#R=r\) and \(i\notin R\) fulfills \({{\,\textrm{d}\,}}(C([R]\cup \{i\}))\ge 2\), so by Proposition 2.1R is a recovery set for the coordinate i. There is also a Singleton-like inequality for \((r,\delta )\)-LRCs:

Proposition 2.3

[34] The parameters \([n,k,d]_q\) of an \((r,\delta )\)-LRC, C, satisfy

$$\begin{aligned} k+d+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\le n+1. \end{aligned}$$
(2.1)

In this paper, C is called an optimal \((r,\delta )\)-LRC (or simply, an optimal LRC) whenever equality holds in (2.1).

In the next section we define the linear codes we will use for local recovery.

3 Monomial-Cartesian codes

Let \(m>1\) be a positive integer and consider a family \(\left\{ P_j\right\} _{j=1}^m\) of subsets of \({\mathbb {F}}_q\) with cardinality larger than one. Set

$$\begin{aligned} P=P_1 \times \dots \times P_m=\{\varvec{\alpha }_1,\dots ,\varvec{\alpha }_n\} \subseteq {\mathbb {F}}_q^m. \end{aligned}$$

We usually write \(\varvec{\alpha }_i=({\alpha _i}_1,\dots ,{\alpha _i}_m)\). Consider the quotient ring

where I is the ideal of the polynomial ring in m variables \({\mathbb {F}}_q[X_1,\dots ,X_m]\) vanishing at P. Then, \(I=\langle f_1(X_1),\dots ,f_m(X_m)\rangle \), where \(f_j(X_j)=\prod _{\beta \in P_j}(X_j-\beta )\) and \(\deg (f_j)=\# P_j=:n_j\ge 2\) [28]. Let

$$\begin{aligned} E=\{0,1,\dots ,n_1-1\}\times \dots \times \{0,1,\dots ,n_m-1\}. \end{aligned}$$

Given \(f\in {\mathscr {R}}\), f denotes both the equivalence class in \({\mathscr {R}}\) and the unique polynomial in \({\mathbb {F}}_q[X_1,\dots ,X_m]\) with degree in \(X_j\) less than \(n_j\), \(1\le j \le m\), representing f. Thus

$$\begin{aligned} f(X_1,\dots ,X_m)=\sum _{(e_1,\dots ,e_m)\in E} f_{e_1,\dots ,e_m}X_1^{e_1}\cdots X_m^{e_m}, \end{aligned}$$

with \(f_{e_1,\dots ,e_m}\in {\mathbb {F}}_q\). Set \({{\,\textrm{supp}\,}}(f)=\{(e_1,\dots ,e_m)\in E \mid f_{e_1,\dots ,e_m}\ne 0\}\). For each subset \(\emptyset \ne \Delta \subseteq E\), define \(V_\Delta :=\{f\in {\mathscr {R}} \mid {{\,\textrm{supp}\,}}(f)\subseteq \Delta \}\cup \{0\}\) and for each element \({\textbf{e}}=(e_1,\dots ,e_m)\in E\), denote \(X^{{\textbf{e}}}=X_1^{e_1}\cdots X_m^{e_m}\). Then, \(V_\Delta \) is the \({\mathbb {F}}_q\)-vector space \(\langle X^{{\textbf{e}}} \mid {\textbf{e}}\in \Delta \rangle \). The linear evaluation map

$$\begin{aligned} {{\,\textrm{ev}\,}}_P:{\mathscr {R}} \rightarrow {\mathbb {F}}_q^{n} \text {, } \quad {{\,\textrm{ev}\,}}_P(f)=\left( f(\varvec{\alpha }_1),\dots ,f(\varvec{\alpha }_n)\right) , \end{aligned}$$

gives rise to the following class of evaluation codes.

Definition 3.1

The monomial-Cartesian code (MCC) \(C_\Delta ^P\) is the following vector subspace of \({\mathbb {F}}_q^n\) over the finite field \({\mathbb {F}}_q\):

$$\begin{aligned} C_\Delta ^P:={{\,\textrm{ev}\,}}_P(V_\Delta )=\langle {{\,\textrm{ev}\,}}_P(X^{{\textbf{e}}}) \mid {\textbf{e}}\in \Delta \rangle \subseteq {\mathbb {F}}_q^n. \end{aligned}$$

We say that the MCC \(C_\Delta ^P\) is bivariate (respectively, multivariate) when \(m=2\) (respectively, \(m>2\)).

MCCs were introduced in [27] in a different way (using only algebraic tools), and are a family of codes that extend J-affine variety codes introduced in [14]. Denoting by \(U_t\subseteq {\mathbb {F}}_q\) the set of t-th roots of unity for some \(t\mid q-1\), a J-affine variety code is an MCC where each \(P_j\) is of the form \(U_t\) or \(U_t\cup \{0\}\).

We also introduce the following definition which will be useful in the next sections.

Definition 3.2

Two subsets \(\Delta _1\) and \(\Delta _2\) of E are pseudoisometric if there exists \({\textbf{v}}=(v_1,\dots ,v_m)\in {\mathbb {Z}}^m\) such that

$$\begin{aligned} \Delta _2={\textbf{v}}+\Delta _1:=\{(e_1+v_1,\dots ,e_m+v_m) \mid (e_1,\dots ,e_m)\in \Delta _1\}. \end{aligned}$$

In that case, we say that the codes \(C^P_{\Delta _1}\) and \(C^P_{\Delta _2}\) are pseudoisometric.

Remark 3.3

In this paper, we say that two codes are isometric if there exists a bijective mapping between them that preserves Hamming weights. The * product of two vectors \((v_1,\dots ,v_n)\) and \((w_1,\dots ,w_n)\) in \({\mathbb {F}}_q^n\) is defined as:

$$\begin{aligned} (v_1,\dots ,v_n)*(w_1,\dots ,w_n)=(v_1\cdot w_1,\dots ,v_n\cdot w_n). \end{aligned}$$

Then \({{\,\textrm{ev}\,}}_P(fg)={{\,\textrm{ev}\,}}_P(f)*{{\,\textrm{ev}\,}}_P(g)\) for all \(f,g\in {\mathscr {R}}\).

Assume that \(\Delta _1\), \(\Delta _2\subseteq E\) are pseudoisometric sets such that \(\Delta _2={\textbf{v}}+\Delta _1\). For simplicity, suppose \(v_j\le 0\), \(1\le j \le m_1\), and \(v_j\ge 0\), \(m_1+1\le j \le m\) for some index \(m_1\). Consider

$$\begin{aligned} \Delta _2^{'}=(-v_1,-v_2,\dots ,-v_{m_1},0,\dots ,0)+\Delta _2 \end{aligned}$$

and

$$\begin{aligned} \Delta _1^{'}=(0,\dots ,0,v_{m_1+1},\dots ,v_m)+\Delta _1, \end{aligned}$$

and then \(\Delta _2^{'}=\Delta _1^{'}\). Thus

$$\begin{aligned} V_{\Delta _2^{'}}=\left\{ X_1^{-v_1}\cdots X_{m_1}^{-v_{m_1}}g \mid g\in V_{\Delta _2}\right\} , \end{aligned}$$

and the codewords in \(C^P_{\Delta _2^{'}}\) are of the form

$$\begin{aligned} {{\,\textrm{ev}\,}}_P\big (X_1^{-v_1}\cdots X_{m_1}^{-v_{m_1}}g\big )={{\,\textrm{ev}\,}}_P\big (X_1^{-v_1}\cdots X_{m_1}^{-v_{m_1}}\big )*{{\,\textrm{ev}\,}}_P(g), \end{aligned}$$

where \(g\in V_{\Delta _2}\). When \(0\notin P_j\) for all \(1\le j \le m\) such that \(v_j\ne 0\), we have just proved that \(C^P_{\Delta _2^{'}}\) and \(C^P_{\Delta _2}\) are isometric codes. The same reasoning proves that \(C^P_{\Delta _1^{'}}\) and \(C^P_{\Delta _1}\) are isometric. Thus \(C^P_{\Delta _1}\) and \(C^P_{\Delta _2}\) are isometric and this also happens when the \(v_j\) are always negative or positive. The proof is the same but we need no auxiliary code.

When \(0\in P_j\) for some index \(1\le j\le m\), \(C^P_{\Delta _1}\) and \(C^P_{\Delta _2}\) need not be isometric which explains why we speak of pseudoisometric codes.

Length, dimension and a bound for the minimum distance of an MCC, \(C^P_\Delta \), are provided in the forthcoming Proposition 3.4 and Corollary 3.7. Let us state Proposition 3.4.

Proposition 3.4

Keep the above notation. The length n and dimension k of an MCC, \(C^P_\Delta \), are \(n=\prod _{j=1}^m n_j\) and \(k=\#\Delta \).

Proof

The claim on the length is immediate because it is equal to the number of points to evaluate, \(n=\# P=\prod _{j=1}^m n_j\). As for the dimension, notice that the restriction map of \({{\,\textrm{ev}\,}}_P\) to the vector space \(V_\Delta \), \({\left. \hspace{0.0pt}{{\,\textrm{ev}\,}}_P \right| _{V_\Delta }} :V_\Delta \rightarrow C_\Delta ^P\), is an isomorphism of vector spaces. Indeed, the kernel of this map vanishes because I is the ideal of polynomials vanishing at P. Then, setting \({{\,\textrm{Im}\,}}\left( {\left. \hspace{0.0pt}{{\,\textrm{ev}\,}}_P \right| _{V_\Delta }}\right) \) the image of the map \({\left. \hspace{0.0pt}{{\,\textrm{ev}\,}}_P \right| _{V_\Delta }}\), it holds

$$\begin{aligned} k=\dim \left( C_\Delta ^P\right) =\dim \left( {{\,\textrm{Im}\,}}\left( {\left. \hspace{0.0pt}{{\,\textrm{ev}\,}}_P \right| _{V_\Delta }}\right) \right) =\dim (V_\Delta )=\#\Delta , \end{aligned}$$

which finishes the proof. \(\square \)

Definition 3.5

The distance of an exponent \({\textbf{e}}\in E\) is defined to be \({{\,\textrm{d}\,}}({\textbf{e}}):=\prod _{j=1}^m (n_j-e_j)\).

The codes \(C^P_\Delta \) admit the following bound on the minimum distance, known as footprint bound [11, 15].

Proposition 3.6

Let \(C_\Delta ^P\) be an MCC and let \({\textbf{c}}={{\,\textrm{ev}\,}}_P(f)\in C_\Delta ^P\) be a codeword, \(f\in {\mathscr {R}}\). Denote by \({{\,\textrm{w}\,}}({\textbf{c}})\) the Hamming weight of \({\textbf{c}}\), fix a monomial ordering on \(({\mathbb {Z}}_{\ge 0})^m\) and let \(X^{\textbf{e}}\) be the leading monomial of f. Then, \({{\,\textrm{w}\,}}({\textbf{c}})\ge {{\,\textrm{d}\,}}({\textbf{e}})\).

Corollary 3.7

Let \(C_\Delta ^P\) be an MCC and let d be its minimum distance. Define \(d_0=d_0\left( C_\Delta ^P\right) :=\min \{{{\,\textrm{d}\,}}({\textbf{e}}) \mid {\textbf{e}}\in \Delta \}\). Then, \(d\ge d_0\).

Remark 3.8

With the above notation, given \(\emptyset \ne \Delta \subseteq E\), define \(M_\Delta :=\{X^{\textbf{e}} \mid {\textbf{e}}\in \Delta \}\). According to [4, Definition 3.1], a code \(C_\Delta ^P\) is named decreasing monomial-Cartesian whenever

$$\begin{aligned} X^{\textbf{e}} \in M_\Delta \text { implies } X^\mathbf {e'}\in M_\Delta \text { for all } \mathbf {e'}\in E \text { such that } X^\mathbf {e'} \text { divides } X^{\textbf{e}}. \end{aligned}$$
(3.1)

Moreover, by [4, Theorem 3.9], the values d and \(d_0\) of decreasing MCCs coincide.

Definition 3.9

A set \(\Delta \subseteq E\) that satisfies (3.1) is called decreasing.

MCCs were previously used to provide LRCs with availability [27]. Next proposition and its proof show how to regard MCCs as LRCs with locality \((r,\delta )\). To do it, we need to introduce some definitions. For each \(1\le j \le m\), define the support of \(V_\Delta \) at \(X_j\) as

$$\begin{aligned}{} & {} {{\,\textrm{supp}\,}}_{X_j}(V_\Delta )\\{} & {} \quad :=\left\{ e_j\in \{0,1,\dots ,n_j-1\} \mid \text {there exists a monomial } X_1^{e_1}\cdots X_j^{e_j}\cdots X_m^{e_m} \text { in } V_\Delta \right\} , \end{aligned}$$

and set \({\mathscr {K}}_j:=\#{{\,\textrm{supp}\,}}_{X_j}(V_\Delta )\) and \(k_j:=\max \left( {{\,\textrm{supp}\,}}_{X_j}(V_\Delta )\right) \). Now, and as the beginning of this section, consider the set \(P_j=\left\{ \alpha _1^j,\dots ,\alpha _{n_j}^j\right\} \subseteq {\mathbb {F}}_q\), the ideal \(I_j\) of \({\mathbb {F}}_q[X_j]\) generated by \(f_j=\prod _{i=1}^{n_j}\left( X_j-\alpha _i^j\right) \) and the map

given by

$$\begin{aligned} {{\,\textrm{ev}\,}}_{P_j}(f)=\left( f\left( \alpha _1^j\right) ,\dots ,f\left( \alpha _{n_j}^j\right) \right) . \end{aligned}$$

Finally define \(V^j_\Delta :=\langle X_j^e \mid e\in {{\,\textrm{supp}\,}}_{X_j}(V_\Delta ) \rangle _{{\mathbb {F}}_q} \subseteq {\mathscr {R}}_j\).

Proposition 3.10

Let \(C_\Delta ^P\) be an MCC. Then, for each \(1\le l \le m\) such that \(k_l+1<n_l\), \(C_\Delta ^P\) is an LRC with locality \((\ge \mathscr {K}_l,\le n_l-\mathscr {K}_l+1)\). In addition, if \({{\,\textrm{ev}\,}}_{P_l}\left( V^l_\Delta \right) \) is an MDS code, then the locality is \((\mathscr {K}_l, n_l-\mathscr {K}_l+1)\).

Proof

Let \(\textbf{c}=(c_1,\dots ,c_n)={{\,\textrm{ev}\,}}_P(f)\in C_\Delta ^P\) be a codeword whose i-th coordinate \(c_i\) we desire to recover. We know that \({{\,\textrm{supp}\,}}(f)\subseteq \Delta \) and thus \(\deg _{X_j}(f)\le k_j\) for all \(j=1,\dots ,m\). Choose a variable \(X_l\) (we will interpolate with respect to it), write \(c_i=f(\varvec{\alpha }_i)=f({\alpha _i}_1,\dots ,{\alpha _i}_m)\) and consider the following subset of P:

$$\begin{aligned} \overline{R}_P=\left\{ \varvec{\alpha }_t\in P \mid {\alpha _t}_j={\alpha _i}_j \text { for all } j\in \{1,\dots ,m\}\backslash \{l\}\right\} \\ =\left\{ ({\alpha _i}_1,\dots ,{\alpha _i}_{l-1},x,{\alpha _i}_{l+1},\dots ,{\alpha _i}_m) \mid x\in P_l\right\} , \end{aligned}$$

whose cardinality is \(\#\overline{R}_P=n_l\). A polynomial in \(V_\Delta \) can be expressed as

$$\begin{aligned}{} & {} f(X_1,\dots ,X_m)=\sum _{(e_1,\dots ,e_m)\in \Delta }f_{e_1,\dots ,e_m}X_1^{e_1}\cdots X_m^{e_m}\\{} & {} \quad =\sum _{h=0}^{k_l}f_h(X_1,\dots ,X_{l-1},X_{l+1},\dots ,X_m)X_l^h \in \mathbb {F}_q[X_1,\dots ,X_{l-1},X_{l+1},\dots ,X_m][X_l]. \end{aligned}$$

Replacing each \(X_j\), \(j\ne l\), by \({\alpha _i}_j\), we get a polynomial in \(X_l\), \(g(X_l)\), with constant coefficients, of degree at most \(k_l\):

$$g(X_l)=f({\alpha _i}_1,\dots ,{\alpha _i}_{l-1},X_l,{\alpha _i}_{l+1},\dots ,{\alpha _i}_m)=\sum _{h=0}^{k_l}g_hX_l^h,$$

where \(g_h=f_h({\alpha _i}_1,\dots ,{\alpha _i}_{l-1},{\alpha _i}_{l+1},\dots ,{\alpha _i}_m)\). So we can interpolate g by using \(k_l+1\) points in \(\overline{R}_P\) (since \(k_l+1< n_l\)) to obtain the coefficients \(g_h\). Let us denote those \(k_l+1\) points by \(\varvec{\beta }_t=({\alpha _i}_1,\dots ,{\alpha _i}_{l-1},\beta _t,{\alpha _i}_{l+1},\dots ,{\alpha _i}_m)\in \overline{R}_P\), \(\varvec{\beta }_t\ne \varvec{\alpha }_i\), where \(\beta _t\in P_l\), \(t=0,\dots ,k_l\), and let \(v_t:=f(\varvec{\beta }_t)=g(\beta _t)\). Thus, the interpolation consists of solving the following linear system of \(k_l+1\) equations with indeterminates \(g_0,\dots ,g_{k_l}\).

$$\begin{aligned} \begin{pmatrix} 1 &{} \beta _0 &{} \beta _0^2 &{} \cdots &{} \beta _0^{k_l}\\ 1 &{} \beta _1 &{} \beta _1^2 &{} \cdots &{} \beta _1^{k_l}\\ \vdots &{} \vdots &{} \vdots &{} \ddots &{} \vdots \\ 1 &{} \beta _{k_l} &{} \beta _{k_l}^2 &{} \cdots &{} \beta _{k_l}^{k_l} \end{pmatrix} \begin{pmatrix} g_0 \\ g_1 \\ \vdots \\ g_{k_l} \end{pmatrix} = \begin{pmatrix} v_0 \\ v_1 \\ \vdots \\ v_{k_l} \end{pmatrix} . \end{aligned}$$
(3.2)

The coefficient matrix of this system is a Vandermonde matrix, which is nonsingular, and therefore the system has a unique solution. Consequently, we can recover \(c_i\) by evaluating g. Let

$$\overline{R}=\{t\in \{1,\dots ,n\} \mid \varvec{\alpha }_t \in \overline{R}_P\}.$$

The set \(\overline{R}\) is an \((r,\delta )\)-recovery set for i with \(r:=k_l+1\) and \(\delta :=n_l-k_l\) since \(i\in \overline{R}\), \(\#\overline{R}=n_l=r+\delta -1\) and

$${{\,\textrm{d}\,}}(C[\overline{R}])={{\,\textrm{d}\,}}\left( {{\,\textrm{ev}\,}}_{P_l}\left( V^l_\Delta \right) \right) \ge {{\,\textrm{d}\,}}\left( {{\,\textrm{ev}\,}}_{P_l}\left( V'^l\right) \right) =\delta ,$$

where \(V'^l:=\langle X_l^e \mid e\in \{0,1,\dots ,k_l\} \rangle _{\mathbb {F}_q} \subseteq \mathcal {R}_l\). The above inequality holds because \(C[\overline{R}]={{\,\textrm{ev}\,}}_{P_l}\left( V^l_\Delta \right) \) is a subcode of the Reed-Solomon (and thus MDS) code \({{\,\textrm{ev}\,}}_{P_l}\left( V'^l\right) \). The fact that \(r\ge \mathscr {K}_l\) and \(\delta \le n_l-\mathscr {K}_l+1\) proves the first part of our statement.

To prove the last one, notice that we have \(k_l+1-\mathscr {K}_l\) conditions

$$\begin{aligned} g_h=f_h({\alpha _i}_1,\dots ,{\alpha _i}_{l-1},{\alpha _i}_{l+1},\dots ,{\alpha _i}_m)=0 \end{aligned}$$
(3.3)

\(h\notin {{\,\textrm{supp}\,}}_{X_l}(V_\Delta )\), and then we actually need \(\mathscr {K}_l\) points in \(\overline{R}_P\) to obtain the coefficients of g. The system of equations (3.2) can be reduced to a linear system where, for those indices h involved in (3.3), we remove, for example, the equations whose independent terms are \(v_h\) and, also, the variables \(g_h\) (together with their coefficients) of the remaining equations. Indeed, \(C[\overline{R}]\) is now an MDS code with parameters \([n_l,\mathscr {K}_l,n_l-\mathscr {K}_l+1]\), the coefficient matrix of this reduced system is a \(\mathscr {K}_l\times \mathscr {K}_l\) submatrix of the transpose of a parity-check matrix of the code \(C[\overline{R}]^\perp \) whose minimum distance is \(\mathscr {K}_l+1\), so it is nonsingular, and therefore the system has a unique solution. Finally, the locality is \((r,\delta ):=(\mathscr {K}_l,{{\,\textrm{d}\,}}(C[\overline{R}]))=(\mathscr {K}_l,n_l-\mathscr {K}_l+1)\).

Remark 3.11

With the above notation and when \({{\,\textrm{supp}\,}}_{X_l}(V_\Delta )=\{0,1,\dots ,k_l\}\), it holds that \({{\,\textrm{ev}\,}}_{P_l}\left( V^l_\Delta \right) \) is a Reed–Solomon code (and thus an MDS code), and then the locality of \(C_\Delta ^P\) is \(({\mathscr {K}}_l, n_l-{\mathscr {K}}_l+1)\).

Remark 3.12

Let \(C_\Delta ^P\) be an MCC with parameters \([n,k,d]_q\) and locality \((r,\delta )\). Then by Proposition 2.3 and Corollary 3.7, the following inequalities

$$\begin{aligned} k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\le k+d+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\le n+1 \end{aligned}$$
(3.4)

hold.

Let \(C_\Delta ^P\) be an MCC with parameters \([n,k,d]_q\) and locality \((r,\delta )\). We define its defect (with respect to \(d_0\)) as the value D:

$$\begin{aligned} D=D\left( C_\Delta ^P\right) :=n+1-k-d_0-\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\ge 0. \end{aligned}$$

Definition 3.13

The code \(C_\Delta ^P\) is called \(d_0\)-optimal whenever D vanishes. That is, \(C_\Delta ^P\) is optimal and \(d=d_0\).

Remark 3.14

The next facts will be useful:

  1. 1.

    The locality \((r,\delta )\) provided in Proposition 3.10 depends on the variable \(X_l\) we choose to interpolate, which allows us to make the best choice of \(X_l\).

  2. 2.

    A \(d_0\)-optimal code is always optimal but a code that is not \(d_0\)-optimal may be optimal.

4 Optimal monomial-Cartesian codes

In this section we give optimal \((r,\delta )\)-LRCs which are decreasing MCCs. MCCs are well suited to provide good LRCs. Fixed a supporting field \({\mathbb {F}}_q\), MCCs are error-correcting codes with unbounded lengths that are constructed by a very simple procedure. This procedure determines in a very easy way their length, dimension and a bound for the minimum distance (Proposition 3.4 and Corollary 3.7). The recovery procedure based on interpolation (described in the proof of Proposition 3.10) allows us to regard MCCs as LRCs which are very versatile and capable of giving good parameters.

As mentioned, in this section we provide optimal LRCs, but their parameters are not new. Nonetheless we get a large family of optimal LRCs, constructed by a unique and simple procedure, that includes the family of codes introduced in [1] (see Remark 4.11 for details) and provides, on the one hand, the parameters of those LRCs over \({\mathbb {F}}_q\) given in [7] whose lengths are of the form \(N(r+\delta -1)\) where N can be written as a product of integers less than or equal to q and, on the other hand, the parameters of those LRCs in [25] with length less than or equal to \(q^2+q\).

Our results will allow us to provide, in the next section, new optimal \((r,\delta )\)-LRCs coming from subfield-subcodes of MCCs.

We start with the bivariate case.

4.1 The case \(m=2\)

For simplicity let us denote \(X_1\) by X and \(X_2\) by Y. We represent E as a grid where the coordinates (ij) correspond to an exponent \({\textbf{e}}\) labelled with their distance (Definition 3.5). Figure 1 shows the grid representation of E in the case when \(n_1=10\) and \(n_2=9\).

Fig. 1
figure 1

Grid representation of E, where \(n_1=10\) and \(n_2=9\)

We look for decreasing sets \(\Delta \subseteq E\) such that the code \(C_\Delta ^P\) is optimal, that is, its parameters satisfy

$$\begin{aligned} k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)=n+1. \end{aligned}$$

Note that, by Remark 3.8, \(d=d_0\).

From now on, we use shaded regions to represent sets formed by the points in E inside that region. By rectangle we will always refer to a subset of E whose representation as shaded set is a rectangle. The first result in this subsection shows when codes \(C_\Delta ^P\), where \(\Delta \) is decreasing and has the shape of a rectangle, are optimal.

Fig. 2
figure 2

Sets \(\Delta _{i,j}\) in Proposition 4.1

Proposition 4.1

Keep the above notation, where q is a prime power, \(m=2\) and \(n_1\), \(n_2\ge 2\) are the cardinalities of \(P_1\) and \(P_2\). Consider the sets

$$\begin{aligned} \Delta =\Delta _{i,j}:=\left\{ (e_1,e_2) \mid 0\le e_1 \le i \text {, } 0\le e_2\le j\right\} \subseteq E=\{0,\dots ,n_1-1\}\times \{0,\dots ,n_2-1\} \end{aligned}$$

(see Fig. 2). Then, the MCC, \(C_\Delta ^P\), defined by a set \(\Delta \) as above is an optimal \((r,\delta )\)-LRC if and only if one of the following conditions hold:

  • \(i=0\) and \(0\le j\le n_2-1\), in which case \((r,\delta )=(1,n_1)\).

  • \(1\le i\le n_1-2\) and \(j=n_2-1\), in which case \((r,\delta )=(i+1,n_1-i)\).

  • \(0\le i\le n_1-1\) and \(j=0\), in which case \((r,\delta )=(1,n_2)\).

  • \(i=n_1-1\) and \(1\le j\le n_2-2\), in which case \((r,\delta )=(j+1,n_2-j)\).

Sets \(\Delta \) as above are denoted by \(\Delta _{i,j}^1\).

Proof

Clearly, \(k=(i+1)(j+1)\) and \(d_0=(n_1-i)(n_2-j)\). By interpolating with respect to X, \(r=i+1\) and \(\delta -1=n_1-i-1\). Then,

$$\begin{aligned} \begin{aligned} k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)&=(i+1)(j+1)+(n_1-i)(n_2-j)\\&\quad +\left( {\bigg \lceil \frac{(i+1)(j+1)}{i+1}\bigg \rceil }-1\right) (n_1-i-1)\\&=n_1n_2+1+i(j+1-n_2), \end{aligned} \end{aligned}$$

and the code is optimal if and only if \(i=0\) or \(j=n_2-1\). Note that when \(j=n_2-1\) and \(i=n_1-1\) one does not get an LRC.

The remaining LRCs are obtained by interpolating with respect to Y, so that \(r=j+1\) and \(\delta -1=n_2-j-1\). \(\square \)

In the sequel, we will perform the procedure of considering a subset \(\Delta \subseteq E\) and adding or removing elements to obtain a new subset \(\Delta ^*\subseteq E\). The expression gaining (or losing) x units in a parameter refers to the fact that the resulting code \(C_{\Delta ^*}^P\) has a larger (or smaller) value for that parameter in a quantity of x units.

The sets \(\Delta ^*\) obtained by removing the least distance point on the \(n_2-1\)-th row (or \(n_1-1\)-th column) of a rectangle \(\Delta _{i,j}^1\) with \(j=n_2-1\) and \(i\ge 1\) (or \(i=n_1-1\) and \(j\ge 1\)) also provide optimal codes since the left-hand side (LHS) of (3.4) remains the same. Indeed, when removing that point we lose one unit in dimension but we gain one unit in the bound for the minimum distance and r, \(\delta \) and \({\bigg \lceil \frac{k}{r}\bigg \rceil }\) do not change. The following result generalizes this situation.

Fig. 3
figure 3

Sets \(\Delta _{i,s}^2\) and \(\Delta _{j,s}^{2,\sigma }\) in Proposition 4.2

Proposition 4.2

With notation as in Proposition 4.1, consider the subsets of E

$$\begin{aligned} \Delta =\Delta _{i,s}^2:=\left\{ (e_1,e_2) \mid 0\le e_1 \le i \text {, } 0\le e_2 \le n_2-2\right\} \cup \left\{ (e_1,n_2-1) \mid 0\le e_1\le s\right\} , \end{aligned}$$

where \(\max \left\{ 0,2i-n_1\right\} \le s<i\le n_1-2\) (see Fig. 3 (1)).

Then, the MCCs, \(C_\Delta ^P\), are optimal \((r,\delta )=(i+1,n_1-i)\)-LRCs.

Analogously, the MCCs, \(C_\Delta ^P\), where

$$\begin{aligned} \Delta =\Delta _{j,s}^{2,\sigma }:=\left\{ (e_1,e_2) \mid 0\le e_1 \le n_1-2 \text {, } 0\le e_2 \le j\right\} \cup \left\{ (n_1-1,e_2) \mid 0\le e_2\le s\right\} \subseteq E, \end{aligned}$$

\(\max \left\{ 0,2j-n_2\right\} \le s<j\le n_2-2\) (see Fig. 3 (2)) are optimal \((r,\delta )=(j+1,n_2-j)\)-LRCs.

Proof

Let us see a proof for the case \(\Delta =\Delta _{i,s}^2\). \(\Delta \) is obtained by removing the (\(i-s\)) least distance points of \(\Delta _{i,n_2-1}^1\) on the \(n_2-1\)-th row with \(0\le s<i\) as long as the distance

$$\begin{aligned} {{\,\textrm{d}\,}}(s,n_2-1)\le {{\,\textrm{d}\,}}(i,n_2-2). \end{aligned}$$

In fact, this last inequality is equivalent to \(n_1-s\le 2(n_1-i)\) and to \(s\ge 2i-n_1\). Interpolating with respect to X, the parameters of the code \(C_\Delta ^P\) are \(k=(i+1)(n_2-1)+s+1\), \(d_0=n_1-s\), \(r=i+1\) and \(\delta -1=n_1-i-1\), and therefore

$$\begin{aligned} \begin{aligned} k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)&=(i+1)(n_2-1)+s+1+n_1-s\\&\quad +\left( {\bigg \lceil \frac{(i+1)(n_2-1)+s+1}{i+1}\bigg \rceil }-1\right) (n_1-i-1)\\&=n_1n_2+1. \end{aligned} \end{aligned}$$

The case \(\Delta =\Delta _{j,s}^{2,\sigma }\) can be proved analogously. It suffices to consider the symmetric situation, interpolate with respect to Y and replace i by j and \(n_1\) by \(n_2\). \(\square \)

The following result completes our family of decreasing sets \(\Delta \), that correspond to MCCs, where \(m=2\), giving rise to optimal \((r,\delta )\)-LRCs.

Fig. 4
figure 4

Sets \(\Delta _{i,j}^3\) and \(\Delta _{i,j}^{3,\sigma }\) in Proposition 4.3

Proposition 4.3

With notation as in Proposition 4.1, consider the family of subsets of E

$$\begin{aligned} \Delta =\Delta _{i,j}^3:=\left\{ (e_1,e_2) \mid 0\le e_1 \le i \text {, } 0\le e_2 \le j-1\right\} \cup \{(0,j)\}, \end{aligned}$$

where \(1\le i\le n_1-2\) and \(\max \left\{ 1,\frac{i(n_2+1)-n_1}{i}\right\} \le j \le n_2-2\) (see Fig. 4 (1)).

Then, the MCCs, \(C_\Delta ^P\), are optimal \((r,\delta )=(i+1,n_1-i)\)-LRCs.

Analogously, the MCCs, \(C_\Delta ^P\), where

$$\begin{aligned} \Delta =\Delta _{i,j}^{3,\sigma }:=\{(e_1,e_2) \mid 0\le e_1 \le i-1 \text {, } 0\le e_2 \le j\}\cup \{(i,0)\}\subseteq E, \end{aligned}$$

\(1\le j\le n_2-2\), and \(\max \left\{ 1,\frac{j(n_1+1)-n_2}{j}\right\} \le i \le n_1-2\) (see Fig. 4 (2)) are optimal \((r,\delta )=(j+1,n_2-j)\)-LRCs.

Proof

As before, we only give the proof for the case \(\Delta =\Delta _{i,j}^3\) since a proof for \(\Delta _{i,j}^{3,\sigma }\) follows as described in the symmetric situation of the proof of Propositon 4.2.

\(\Delta \) is obtained by removing the points \((e_1,j)\), \(1\le e_1 \le i\), of a rectangle

$$\begin{aligned} \Delta _{i,j}=\left\{ (e_1,e_2) \mid 0\le e_1 \le i \text {, } 0\le e_2\le j\right\} \end{aligned}$$

with \(1\le i\le n_1-2\) and \(1\le j\le n_2-2\) such that \({{\,\textrm{d}\,}}(0,j)\le {{\,\textrm{d}\,}}(i,j-1)\). As a consequence, \(n_1(n_2-j)\le (n_1-i)(n_2-j+1)\), which is equivalent to \(i\le \frac{n_1}{n_2-j+1}\), or \(j\ge \frac{i(n_2+1)-n_1}{i}\). In this case, we interpolate with respect to X and the parameters of the code \(C_\Delta ^P\) are \(k=(i+1)j+1\), \(d_0=n_1(n_2-j)\), \(r=i+1\) and \(\delta -1=n_1-i-1\). Thus,

$$\begin{aligned} \begin{aligned} k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)&=(i+1)j+1+n_1(n_2-j)\\&\quad +\left( {\bigg \lceil \frac{(i+1)j+1}{i+1}\bigg \rceil }-1\right) (n_1-i-1)\\&=n_1n_2+1. \end{aligned} \end{aligned}$$

\(\square \)

Remark 4.4

The families of (decreasing) MCCs given in Propositions 4.1, 4.2 and 4.3 determine the parameters of all \(d_0\)-optimal bivariate (\(m=2\)) \((r,\delta )\)-LRCs \(C_\Delta ^P\) (with any set \(\Delta \subseteq E\)). That is to say, if \(C_\Delta ^P\) is a \(d_0\)-optimal LRC, then there exists an MCC, \(C_{\Delta ^*}^P\), as in Propositions 4.1, 4.2 and 4.3 having the same parameters n, k, d, r and \(\delta \) as \(C_\Delta ^P\). Therefore, by Remark 3.8, we have characterized the optimal bivariate decreasing MCCs. An explicit proof of the first mentioned fact is long and, since our aim is to find optimal LRCs, to shorten this article, we omit it. Nonetheless, a sketch is given in the next paragraphs.

Without loss of generality, we can suppose that our recovery method interpolates with respect to the variable X. Recall two key facts: (i) the locality \((r,\delta )\) of an MCC is bounded by Proposition 3.10, and this bound is sharp for decreasing MCCs \(C_{\Delta '}^P\) by Remark 3.11, being \(r=\#{{\,\textrm{supp}\,}}_{X}(V_{\Delta '})\); and (ii) the distances of the exponents in the grid E increase when going to the left and to the down.

Now, fixed P and therefore n, and \(\#{{\,\textrm{supp}\,}}_{X}(V_\Delta )\) of an arbitrary MCC \(C_\Delta ^P\), the first inequality in (3.4) shows that to reach \(d_0\)-optimality it is desirable r to be small and k and \(d_0\) (also, \(\delta =n_1-r+1\)) to be large. We can optimize in this sense the parameters of \(C_\Delta ^P\) by “compacting” \(\Delta \) to get a decreasing set \(\Delta ^*\), so that the defect of the above codes satisfies \(D\left( C_{\Delta ^*}^P\right) \le D\left( C_{\Delta }^P\right) \). By “compacting” we roughly mean: (1) to translate \(\Delta \) to touch both axis X and Y, (2) to remove empty columns and, (3) for each exponent in the resulting set, to add every element which is inside the rectangle that the exponent “forms” with (0, 0). Notice that this way \(\#{{\,\textrm{supp}\,}}_{X}(V_\Delta )=\#{{\,\textrm{supp}\,}}_{X}(V_{\Delta ^*})\), and performing (1) and (2) (respectively, (3)) we optimize \(d_0\), r- and \(\delta \)-(respectively, k). Thus, if \(C_{\Delta }^P\) were \(d_0\)-optimal, then \(C_{\Delta ^*}^P\) would be too. This reasoning allows us to restrict our study to decreasing MCCs.

It remains to show that, fixed P and r, the only decreasing sets \(\Delta \subseteq E\) giving rise to \(d_0\)-optimal MCCs \(C_\Delta ^P\) are those in Propositions 4.1, 4.2 and 4.3. Those sets \(\Delta \) we are looking for must satisfy \(\Delta \subseteq \Delta ^1_{r-1,n_2-1}\), and since \(C_{\Delta ^1_{r-1,n_2-1}}^P\) is \(d_0\)-optimal by Proposition 4.1, successively removing the least distance points in \(\Delta ^1_{r-1,n_2-1}\) is the optimal way to get the mentioned sets \(\Delta \). Assume that \(r-1\le \frac{n_1}{2}\), the opposite case follows similarly. Before reaching the smallest (with respect to inclusion) set \(S\subseteq E\) among those considered in the above mentioned propositions (that will be \(S=\Delta ^3_{r-1,j^*}\) for some \(j^*\) or \(S=\Delta ^2_{r-1,0}\)), the removed exponents go from right to left coming from upper to lower rows. The first \(r-1\) removed exponents provide every set of Proposition 4.2.

If \(S=\Delta ^3_{r-1,j^*}\), the following removed exponents before reaching S provide sets \(\Delta \) such that \(\Delta '\subseteq \Delta \subseteq \Delta ''\), where \(\left( \Delta ',\Delta ''\right) \in \left\{ \left( \Delta ^3_{r-1,n_2-2},\Delta ^2_{r-1,0}\right) ,\,\left( \Delta ^3_{r-1,j-1},\Delta ^3_{r-1,j}\right) \right\} \) for some j. A set \(\Delta \ne \Delta ',\,\Delta ''\), does not provide a \(d_0\)-optimal code since in (3.4) the term \(\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\) is the same for both \(\Delta \) and \(\Delta '\), but the term \(k+d_0\) is less for \(\Delta \) than for \(\Delta '\).

Finally, once reached the set S, we are forced to remove points from lower rows, causing the difference between the distances of the exponents removed becomes smaller, and, then, the resulting sets \(\Delta \) do not give either \(d_0\)-optimal codes.

Notice that when one removes exponents from right to left inside a row, the bound on the minimum distance increases the same quantity (a multiple of one unit more than its second coordinate), but when we remove exponents from lower rows, the gain on the bound of the minimum distance is smaller, worsening the defect of the code. See Fig. 5 for an example, where \(\Delta ^3_{2,5}\) gives a \(d_0\)-optimal code (defect 0) but, by removing its four exponents from lowest to higher distance, we do not get \(d_0\)-optimality as the obtained sequence of defects is \(8,\,4,\,2,\,8\).

Fig. 5
figure 5

On the right, the set obtained by removing four exponents of \(\Delta ^3_{2,5}\) (on the left) as described in Remark 4.4

As a consequence of Remark 4.4, the next Corollary 4.5 determines the parameters and \((r,\delta )\)-localities of the optimal \((r,\delta )\)-LRCs we can obtain with the bound \(d_0\) on the minimum distance. Notice that, in order not to repeat cases and since the variables X and Y play the same role, the parameters are written only with the notation we have used to interpolate with respect to X.

Corollary 4.5

Let \(\; {\mathbb {F}}_q\) be a finite field. For each pair \((n_1,n_2)\) of integers such that \(\; 2\le n_1,n_2\le q\), there exists an optimal \((r,\delta )\)-LRC with length \(n=n_1n_2\), parameters \([n,k,d]_q\) and locality \((r,\delta )\) as follows:

  1. (1)

    \(k=(i+1)(j+1)\), \(d=(n_1-i)(n_2-j)\), where

    • \(i=0\) and \(0\le j\le n_2-1\), being the locality \((r,\delta )=(1,n_1)\); or

    • \(1\le i\le n_1-2\) and \(j=n_2-1\), being the locality \((r,\delta )=(i+1,n_1-i)\).

  2. (2)

    \(k=(i+1)(n_2-1)+s+1\), \(d=n_1-s\) and \((r,\delta )=(i+1,n_1-i)\), where

    $$\begin{aligned} \max \left\{ 0,2i-n_1\right\} \le s<i\le n_1-2. \end{aligned}$$
  3. (3)

    \(k=(i+1)j+1\), \(d=n_1(n_2-j)\) and \((r,\delta )=(i+1,n_1-i)\), where \(1\le i\le n_1-2\) and \(\max \left\{ 1,\frac{i(n_2+1)-n_1}{i}\right\} \le j \le n_2-2\).

4.2 The case \(m\ge 3\)

In Subsect. 4.1 we have studied bivariate codes \(C_\Delta ^P\), obtained from decreasing sets \(\Delta \subseteq \{0,1,\dots ,n_1-1\}\times \{0,1,\dots ,n_2-1\}\), which give rise to optimal LRCs. Moreover we have determined all the parameters of the \(d_0\)-optimal bivariate MCCs. We devote this subsection to the same purpose in the multivariate case. Thus , where \(m\ge 3\) and \(\Delta \subseteq \{0,1,\dots ,n_1-1\}\times \cdots \times \{0,1,\dots ,n_m-1\}\). The forthcoming Propositions 4.6 and 4.7 are the analogs to Propositions 4.1 and 4.2 for multivariate MCCs and allow us to determine the parameters of the \(d_0\)-optimal LRCs of the type \(C_\Delta ^P\), \(m\ge 3\).

Proposition 4.6

Keep the notation as given at the beginning of Sect. 3. For each index \(j_0\in \{1,\dots ,m\}\), set \(i_j=n_j-1\) for all \(j\in \{1,\dots ,m\}\backslash \{j_0\}\) and \(i_{j_0}\in \left\{ 0,1,\dots ,n_{j_0}-2\right\} \), and consider

$$\begin{aligned} \Delta =\Delta ^1_{i_1,\dots ,i_m}:=\left\{ (e_1,\dots ,e_m) \mid 0\le e_j \le i_j \text {, for all } j=1,\dots ,m\right\} . \end{aligned}$$

Then, the MCC, \(C_\Delta ^P\), is an optimal LRC with locality \((r,\delta )=\left( i_{j_0}+1,n_{j_0}-i_{j_0}\right) \). Furthermore, \(\Delta ^1_{i_1,\dots ,i_m}\) are the unique sets of the form \(\Delta '=\{(e_1,\dots ,e_m) \mid 0\le e_j\le l_j \text { for all } j=1,\dots ,m\}\), where \(0\le l_j\le n_j-1\), providing optimal LRCs.

Proof

We interpolate with respect to \(X_1\) (the proof is analogous if we interpolate with respect to any other variable). Consider a set \(\Delta '\) as in the statement.

We start by assuming that \(l_j=n_j-1\) for \(m-2\) indices j. Without loss of generality suppose that \(l_j=n_j-1\) for all \(j=3,\dots ,m\). Then, the point that defines the bound on the minimum distance is \((l_1,l_2,n_3-1,\dots ,n_m-1)\) and the parameters of this code give the following value for the LHS of (3.4):

$$\begin{aligned} \begin{aligned} d_0+k+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)&=(n_1-l_1)(n_2-l_2)+(l_1+1)(l_2+1)n_3n_4\cdots n_m\\&\quad +[(l_2+1)n_3n_4\cdots n_m-1](n_1-l_1-1)\\&=(n_1-l_1)(n_2-l_2)+n_1(l_2+1)n_3n_4\cdots n_m\\&\quad -(n_1-l_1-1)\\&=n_1(l_2+1)n_3n_4\cdots n_m+(n_1-l_1)(n_2-l_2-1)+1. \end{aligned} \end{aligned}$$

Thus, the code is optimal if and only if \(l_2=n_2-1\) (and \(l_1\in \{0,1,\dots ,n_1-2\}\) for being an LRC).

We conclude the proof after noticing that the same reasoning allows us to prove the proposition when the number of indices j in \(\Delta '\) such that \(l_j=n_j-1\) is less than \(m-2\). \(\square \)

Our next result shows that deleting, from a set \(\Delta ^1_{i_1,\dots ,i_m}\), a suitable number of successive minimum distance points on the line \(e_j=n_j-1\), \(j\ne j_0\), an optimal LRC is also obtained. This is because for each removed point we lose one unit in dimension but we gain one unit in the bound for the minimum distance and r, \(\delta \) and \({\bigg \lceil \frac{k}{r}\bigg \rceil }\) do not change. As a consequence the LHS in (3.4) remains constant.

Proposition 4.7

Keep the notation as in Proposition 4.6. Define

$$\begin{aligned}{} & {} \Delta =\Delta _{i_{j_0},s}^2:=\Delta ^1_{i_1,\dots ,i_m}\\{} & {} \big \backslash \left\{ \left( n_1-1,\dots ,n_{j_0-1}-1,e_{j_0},n_{j_0+1}-1,\dots ,n_m-1\right) \mid s\le e_{j_0}\le i_{j_0}\right\} , \end{aligned}$$

where s satisfies \(\max \left\{ 1,2i_{j_0}-n_{j_0}+1\right\} \le s \le i_{j_0}\le n_{j_0}-2\) or \(i_{j_0}=s=0\).

Then the MCC, \(C_\Delta ^P\), is an optimal LRC with locality \((r,\delta )=\left( i_{j_0}+1,n_{j_0}-i_{j_0}\right) \).

Proof

The distance \({{\,\textrm{d}\,}}({\textbf{p}})\) (see Definition 3.5) of the point

$$\begin{aligned} {\textbf{p}}=(n_1-1,n_2-1,\dots ,n_{j_0-1}-1,i_{j_0},n_{j_0+1}-1,\dots ,n_{m-1}-1,n_m-1) \end{aligned}$$

determines the bound \(d_0\) for the minimum distance of the code \(C_{\Delta _{i_1,\dots ,i_m}^1}^P\). We look for an index \(0 \le s\le i_{j_0}\) such that \(i_{j_0}-s+1\) is the number of points in \(\Delta _{i_1,\dots ,i_m}^1\) that meet the line \(e_j=n_j-1\), \(j\ne j_0\), and have distance less than \(2\left( n_{j_0}-i_{j_0}\right) \). The candidate set \(\Delta \) for \(C_\Delta ^P\) to be optimal is obtained by deleting from \(\Delta _{i_1,\dots ,i_m}^1\) those points because \(2\left( n_{j_0}-i_{j_0}\right) \) is the distance of any point in the set

$$\begin{aligned} V=\left\{ {\textbf{p}}-\varvec{\epsilon }_j \text { for all } j\in \{1,\dots ,m\}\backslash \{j_0\}\right\} , \end{aligned}$$

where \(\varvec{\epsilon }_j=(\delta _{j1},\dots ,\delta _{jm})\), \(\delta _{ij}\) being the Kronecker delta, and \(V\subseteq \Delta ^1_{i_1,\dots ,i_m} \big \backslash \{{\textbf{p}}\}\). Thus, \(n_{j_0}-s< 2(n_{j_0}-i_{j_0})\), what is equivalent to \(s\ge 2i_{j_0}-n_{j_0}+1\).

Therefore, in order to \(\Delta \) be a candidate for \(C_\Delta ^P\) to be optimal, \(s\ge \max \{0,2i_{j_0}-n_{j_0}+1\}\). The dimension of the code \(C_\Delta ^P\) is

$$\begin{aligned} k=n_1n_2\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_{m-1}n_m-(i_{j_0}-s+1), \end{aligned}$$

and the bound on the minimum distance of \(C_\Delta ^P\) is given by the point with coordinates \(e_j=n_j-1\), \(j\ne j_0\), \(e_{j_0}=s-1\) when \(s\ge 1\) or by any point of V when \(s=0\). Then \(d_0=n_{j_0}-s+1\) for \(s\ge 1\) and \(d_0=2(n_{j_0}-i_{j_0})\) when \(s=0\). Moreover we interpolate with respect to \(X_{j_0}\) (it is the only way to obtain an LRC), so \(r=i_{j_0}+1\) and \(\delta -1=n_{j_0}-i_{j_0}-1\). Thus, the value for \(k+d_0+\left( {\bigg \lceil \frac{k}{r}\bigg \rceil }-1\right) (\delta -1)\) (the LHS of (3.4)) is

$$\begin{aligned} \begin{array}{ll} &{} n_1n_2\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_{m-1}n_m-(i_{j_0}-s+1)+n_{j_0}-s+1\\ &{} +\left( {\bigg \lceil \frac{n_1n_2\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_{m-1}n_m-(i_{j_0}-s+1)}{i_{j_0}+1}\bigg \rceil }-1\right) \cdot (n_{j_0}-i_{j_0}-1)\\ =&{}n_1n_2\cdots n_m -i_{j_0}+n_{j_0}-(n_{j_0}-i_{j_0}-1)=n_1n_2\cdots n_m +1, \text { if } s\ge 1 \text { and}\\ \\ &{} n_1n_2\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_{m-1}n_m-(i_{j_0}-s+1)+2(n_{j_0}-i_{j_0})\\ &{} +\left( {\bigg \lceil \frac{n_1n_2\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_{m-1}n_m-(i_{j_0}-s+1)}{i_{j_0}+1}\bigg \rceil }-1\right) \cdot (n_{j_0}-i_{j_0}-1)\\ =&{} n_1n_2\cdots n_m -i_{j_0}-1+2(n_{j_0}-i_{j_0})-2(n_{j_0}-i_{j_0}-1)\\ &{}=n_1n_2\cdots n_m +1-i_{j_0}, \text { otherwise,} \end{array} \end{aligned}$$

which proves that \(C_\Delta ^P\) is optimal and concludes the proof. \(\square \)

Remark 4.8

As in the bivariate case, the families of (decreasing) MCCs given in Propositions 4.6 and 4.7 determine the parameters of all \(d_0\)-optimal multivariate (\(m\ge 3\)) \((r,\delta )\)-LRCs \(C_\Delta ^P\) (with any set \(\Delta \subseteq E\)). Again we omit the proof, which follows from a close reasoning to that of the bivariate case. Therefore, by Remark 3.8, we have characterized the optimal multivariate decreasing MCCs.

Corollary 4.9 determines parameters and \((r,\delta )\)-localities of the multivariate \(d_0\)-optimal \((r,\delta )\)-LRCs.

Corollary 4.9

Let \({\mathbb {F}}_q\) be a finite field and consider an integer \(m\ge 3\). For every m-tuple \((n_1,\dots ,n_m)\) of integers such that \(2 \le n_j \le q\), \(j\in \{1,\dots ,m\}\), there exists an optimal \((r,\delta )\)-LRC with length \(n=n_1\cdots n_m\), parameters \([n,k,d]_q\) and locality \((r,\delta )\) as follows:

  1. (1)

    \(k=n_1\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_m\), \(d=n_{j_0}-i_{j_0}\) and \((r,\delta )=(i_{j_0}+1,n_{j_0}-i_{j_0})\), where \(i_{j_0}\in \{0,1,\dots ,n_{j_0}-2\}\).

  2. (2)

    \(k=n_1\cdots n_{j_0-1}(i_{j_0}+1)n_{j_0+1}\cdots n_m-(i_{j_0}-s+1)\), \(d=n_{j_0}-s+1\) and \((r,\delta )=(i_{j_0}+1,n_{j_0}-i_{j_0})\), where

    $$\begin{aligned} \max \left\{ 1,2i_{j_0}-n_{j_0}+1\right\} \le s\le i_{j_0}\le n_{j_0}-2. \end{aligned}$$
  3. (3)

    \(k=n_1\cdots n_{j_0-1}n_{j_0+1}\cdots n_m-1\), \(d=2n_{j_0}\) and \((r,\delta )=(1,n_{j_0})\).

Remark 4.10

Keep the notation as in Sect. 3, so let \(m\ge 2\). Let \({\mathbb {N}}\) be the set of nonnegative integers and \(\Delta \) be a subset of E satisfying some of the conditions in Propositions 4.1, 4.2, 4.3, 4.6 or 4.7. Define \(\Delta ^*:={\varvec{v}}+\Delta \) for any \({\varvec{v}}\in {\mathbb {N}}^m\) such that \(\Delta ^*\subseteq E\). If \(0\notin P_j\) for all \(1\le j \le m\), then the MCC \(C^P_{\Delta ^*}\) is optimal with the same parameters and locality as \(C^P_\Delta \). This result follows straightforwardly from Remark 3.3.

Remark 4.11

MCCs include the family of codes introduced in [1], codes whose evaluation map is the same as MCCs but their evaluation sets \(V_\Delta \) are only a subset of those used for MCCs. Specifically, the codes in [1] are subcodes of affine Cartesian codes (of order d), where the corresponding set \(V_\Delta \) is the set of polynomials f in \({\mathbb {F}}_q[X_1,\dots ,X_m]\) with total degree bounded by d and such that a fixed variable \(X_{j_0}\) has degree \(\deg _{X_{j_0}}(f)\le i_{j_0}<n_{j_0}-1\) for some fixed integer \(i_{j_0}\) (see [1, Definitions 2.2 and 2.3]). Therefore, while MCCs allow arbitrary sets \(\Delta \subset E\), the sets \(\Delta \) of those codes considered in [1] are of the form

$$\begin{aligned} \Delta =\Delta _{j_0}=\{(e_1,\dots ,e_m)\in E \mid e_1+\cdots +e_m\le d, e_{j_0}\le i_{j_0}\}. \end{aligned}$$

As a consequence we obtain many more \((r,\delta )\)-optimal LRCs than those given in [1, Corollaries 4.2 and 4.3]. Thus, if we fix the locality \(r=i_{j_0}+1\) for some \(1\le j_0 \le m\), then we obtain optimal codes which are not considered in [1]. These are those of Proposition 4.1 for \(i_{j_0}=i=0\), \(j<n_2-2\), and \(i<n_1-2\), \(i_{j_0}=j=0\); those of Proposition 4.2 for \(s\le i_{j_0}-2\); those of Proposition 4.3 for \(i_{j_0}>1\) and for \(i_{j_0}=1\) and \(n_{j_0}<n_{j'}\), where \(j'\in \{1,2\}\backslash \{j_0\}\); and those of Proposition 4.7 for \(i_{j_0}\ge 2\) and \(\max \{1,2i_{j_0}-n_{j_0}\}\le s \le i_{j_0}-1\). Moreover, in this paper, we also give many more optimal LRCs, regarded as subfield-subcodes of MCCs, as we will explain in the next section.

5 Optimal subfield-subcodes

We devote this section to obtain new optimal \((r,\delta )\)-LRCs. These are subfield-subcodes of J-affine variety codes. J-affine variety codes are a subclass of MCCs introduced in [14] which makes studying their subfield-subcodes easier. We prove that subfield-subcodes of some J-affine variety codes keep the parameters and \((r,\delta )\)-locality of certain decreasing MCCs considered in Sect. 4, being then optimal. Thus, we get optimal \((r,\delta )\)-LRCs over smaller supporting fields, which are new and behave as MCCs.

To show the novelty of our codes, we compare them with those in the references [6,7,8,9,10, 20,21,22, 25, 26, 35, 38, 42, 44, 45]. They group the known codes whose parameters [nkd] and locality \((r,\delta )\) satisfy (2.1) with equality and their lenghts n are divisible by \(r+\delta -1\).

LRCs we provide in this section are \(p^h\)-ary, p a prime, such that \(r+\delta -1\) equals either \(p^h+1\) or \(p^h+2\), their length n is a multiple of some of these values, \(r>1\) and \(\delta >2\). In some cases, when \(r+\delta -1=p^h+1\), we also impose gcd-type conditions to obtain novelty.

Our codes are new because they are optimal and there is no code in the literature with the same parameters and locality. The following paragraph shows some requeriments that the codes in the above given list of references must satisfy showing that, taking into account the above paragraph, our codes give optimal codes over the same field with a wider range for the pairs \((r,\delta )\).

Parameters and locality of the previously mentioned literature codes, assumed also \(p^h\)-ary, satisfy the following conditions, which differ from ours:

  • \(r+\delta -1\le p^h\) [7, 9, 10, 21, 44, 45];

  • \(r+\delta -1\le p^h+1\) with either minimum distances other than ours [25, 38] or opposite gcd-type conditions [38], see Remarks 5.9 and 5.15;

  • either \(n\mid p^h-1\) or \(n\mid p^h+1\) [6, 8, 35], but our codes have \(n\ge 2(p^h+1)\) since \(n=(r+\delta -1)n_2\cdots n_m\) with \(n_j\ge 2\) for all \(j\in \{1,\dots ,m\}\);

  • \(r=1\) [42];

  • \(\delta =2\) [20,21,22, 26]; and

  • \(2\delta +1\le d\le r+\delta \) [21] but, in case our codes have \(d\le r+\delta \), then \(d\le 2\delta \), see Remarks 5.9 and 5.15.

Subfield-subcodes of J-affine variety codes were also used in [13] to provide \((r,\delta )\)-LRCs but unlike this paper, most of them are non-optimal. The recovery procedure proposed in [13] is different from the one in this paper; it was designed to be applied on subfield-subcodes and it mainly uses the structure of cyclotomic sets, defined next. As a consequence, LRCs in [13] have different parameters than those in this section. In particular, the values r and \(\delta \) in [13] of \(p^h\)-ary subfield-subcodes (of a q-ary code) satisfy \(r+\delta -1=p^h-1\), while those in this section are such that \(r+\delta -1\) is either \(p^h+1\) or \(p^h+2\). Finally, setting \(q=p^h\) and \(n\le (p^h)^m\), we also notice that our codes in Sect. 4 extend those in [13] because, here, our restriction is \(r+\delta -1\le p^h\).

5.1 Subfield-subcodes of J-affine variety codes

In this subsection we recall some facts about subfield-subcodes of J-affine variety codes which will be useful in the forthcoming subsections. We keep the notation as in Sect. 3. Assume that \(q=p^l\), where p is a prime number and \(l\ge 2\). Pick a positive integer h such that \(h\mid l\) and regard \({\mathbb {F}}_{p^h}\) as a subfield of \({\mathbb {F}}_q={\mathbb {F}}_{p^l}\). J-affine variety codes are MCCs where the evaluation points belong to a Cartesian product of some multiplicative subgroups of \({\mathbb {F}}_q\) to which we could also add the element \(0\in {\mathbb {F}}_q\). The multiplicative structure eases the control of these codes, and the possibility of introducing 0 increases the range of lengths. Consider a subset \(J\subseteq \{1,\dots ,m\}\), that is used to detect the variables where 0 is not evaluated, and assume that the polynomials \(f_j(X_j)\) generating the ideal I are of the form

$$\begin{aligned} f_j(X_j)=X_j^{n_j}-1, \end{aligned}$$

for some \(n_j\mid q-1\) if \(j\in J\), and

$$\begin{aligned} f_j(X_j)=X_j^{n_j}-X_j, \end{aligned}$$

where \(n_j-1 \mid q-1\), otherwise. Then, each set \(P_j\subseteq {\mathbb {F}}_q\) introduced in Sect. 3 is the set of \(n_j\)-th roots of unity if \(j\in J\) or the set of \(n_j-1\)-th roots of unity together with 0 otherwise. The corresponding MCC is denoted by \(C_\Delta ^{P,J}\). As introduced in [14], \(C_\Delta ^{P,J}\) is a J-affine variety code. These codes can be thought as a generalization of cyclic codes to multiple variables.

Definition 5.1

The linear code \(S_\Delta ^{P,J}:=C_\Delta ^{P,J}\cap {\mathbb {F}}_{p^h}^n\) is the subfield-subcode over the field \({\mathbb {F}}_{p^h}\) of \(C_\Delta ^{P,J}\).

In our situation, subfield-subcodes are a powerful tool because they allow us to obtain longer codes for a fixed supporting field; that is \(p^h\)-ary MCCs have lengths \(2^m \le n \le \left( p^h\right) ^m\), while lengths of \(p^h\)-ary subfield-subcodes of q-ary MCCs satisfy \(2^m \le n \le q^m\). Moreover, as subcodes, subfield-subcodes inherit the same bound on the minimum distance of the codes they come from. In the case of J-affine variety codes, good choices give rise to subfield-subcodes keeping the same dimension. Let us return to this last class of codes.

When \(j\notin J\), the evaluation of monomials containing \(X_j^0\) or containing \(X_j^{n_j-1}\) may be different, since when evaluating at zero \({\left. \hspace{0.0pt}X_j^0 \right| _{0}}=1\) but \({\left. \hspace{0.0pt}X_j^{n_j-1} \right| _{0}}=0\). This explains the difference on the powers on the variables when equipping \(E=\{0,1,\dots ,n_1-1\}\times \dots \times \{0,1,\dots ,n_m-1\}\) with the following structure which we will assume in the sequel. When \(j\in J\), we identify the set \(\{0,1,\dots ,n_j-1\}\) of possible exponents of the variable \(X_j\) with the ring \({\mathbb {Z}}/n_j{\mathbb {Z}}\), because the identification \(X_j^{n_j}-1=0\) gives the identification on the exponents \(n_j=0\). Otherwise, if \(j\notin J\), we have the identification \(X_j^{n_j}-X_j=0\), then we can identify the set \(\{1,\dots ,n_j-1\}\) with \({\mathbb {Z}}/(n_j-1){\mathbb {Z}}\), and extend the addition and multiplication in this ring to \(\{0,1,\dots ,n_j-1\}\), by setting \(0+e=e\), \(0\cdot e=0\) for all \(e=0,1,\dots ,n_j-1\). Therefore, \(\{0,1,\dots ,n_j-1\}=\{0\}\cup {\mathbb {Z}}/(n_j-1){\mathbb {Z}}\). Notice that \(X_j^0\) and \(X_j^{n_j-1}\) have the same evaluation at all the elements of \(P_j\) with the exception of zero.

We call a set \(\Omega \subseteq E\) a cyclotomic set with respect to \(p^h\) if \(p^h\varvec{\omega } \in \Omega \) for all \(\varvec{\omega }=(\omega _1,\dots ,\omega _m)\in \Omega \). Minimal cyclotomic sets are those of the form \(\Lambda =\{p^{hi}{\textbf{e}} \mid i\ge 0\}\), for some element \({\textbf{e}}\in E\). In this paper we will refer to cyclotomic sets as closed sets since they are unions of minimal cyclotomic sets. For each minimal closed set \(\Lambda \), denote by \({\textbf{x}}\) the minimum element in \(\Lambda \) with respect to the lexicographic order and set \(\Lambda =\Lambda _{\textbf{x}}\). Hence, \(\Lambda _{\textbf{x}}=\{{\textbf{x}},p^h{\textbf{x}},\dots ,p^{h(\#\Lambda _{\textbf{x}}-1)}{\textbf{x}}\}\). Fixed an index \(j\in \{1,\dots ,m\}\), if we replace E by \(\{0,1,\dots ,n_j-1\}\), the same definition gives rise to sets \(\Omega ^j\subseteq \{0,1,\dots ,n_j-1\}\) (respectively, \(\Lambda ^j\subseteq \{0,1,\dots ,n_j-1\}\)) called closed (respectively, minimal closed) sets in a single variable with respect to \(p^h\). Again, denoting by x the minimum element in \(\Lambda ^j\), we set \(\Lambda ^j=\Lambda ^j_x\).

For example, assume that: (1) the number of variables is \(m=3\), (2) the field is \({\mathbb {F}}_8\) and we consider its subfield \({\mathbb {F}}_2\), so \(p=2\), \(h=1\), \(l=3\), (3) in each variable, the polynomials are evaluated at all the elements in \({\mathbb {F}}_8\), thus \(J=\emptyset \), \(n_1=n_2=n_3=8\) and (4) pick the exponent \({\textbf{x}}=(1,4,5)\). Then, the set of possible exponents \(E=\{0,1, \dots ,7\}^3\) has the same structure as \(\left( \{0\}\cup {\mathbb {Z}}/7{\mathbb {Z}}\right) ^3\). The minimal closed set of \({\textbf{x}}\) with respect to 2 is obtained from \({\textbf{x}}\) by succesive multiplications by 2 in each variable taking into account the identification \(8=1\), and it equals \(\Lambda _{\textbf{x}}=\{(1,4,5),(2,1,3),(4,2,6)\}\subseteq E\). The corresponding minimal closed set in a single variable for \(j=3\) is the set \(\Lambda ^j_{3}=\{3,5,6\}\subseteq \{0,1,\dots ,7\}\). It is constructed like \(\Lambda _{\textbf{x}}\) but considering only the third coordinate of the exponents, where \(\{0,1,\dots ,7\}\) is identified with \(\{0\}\cup {\mathbb {Z}}/7{\mathbb {Z}}\).

Closed sets are a tool to obtain subfield-subcodes of J-affine variety codes with the same dimension as the code they come from. Indeed, by [13, Theorem 2.3], if \(\Delta \) is a closed set, then \(\dim (S_\Delta ^{P,J})=\dim (C_\Delta ^{P,J})=\#\Delta \).

Now, we define three trace type maps which will be useful: \({{\,\textrm{tr}\,}}_l^h :{\mathbb {F}}_{p^l} \rightarrow {\mathbb {F}}_{p^h}\), \({{\,\textrm{tr}\,}}_l^h(x)=x+x^{p^h}+\cdots +x^{p^{h\left( \frac{l}{h}-1\right) }}\); \({{\,\mathrm{{\textbf {tr}}}\,}}:{\mathbb {F}}_{p^l}^n \rightarrow {\mathbb {F}}_{p^h}^n\), determined by \({{\,\textrm{tr}\,}}_l^h\) componentwise and \({\mathscr {T}} :{\mathscr {R}} \rightarrow {\mathscr {R}}\), \({\mathscr {T}}(f)=f+f^{p^h}+\cdots +f^{p^{h \left( \frac{l}{h}-1\right) }}\), \({\mathscr {R}}\) being the quotient ring defined at the beginning of Sect. 3. Recall from Sect. 2, that the projection map \({\mathbb {F}}_q^n \rightarrow {\mathbb {F}}_q^r\) on the coordinates of a subset \(R\subseteq \{1,\dots ,n\}\) of cardinality r is denoted by \(\pi _R\).

Next result shows that when \(\Delta \) is closed, then the operators on a code “taking its projection” and “taking its subfield-subcode” commute.

Proposition 5.2

With notation as in Sect. 2, let \(R\subseteq \{1,\dots ,n\}\). If \(\Delta \) is closed, then \(\pi _R(S_\Delta ^{P,J})=\pi _R(C_\Delta ^{P,J}) \cap {\mathbb {F}}_{p^h}^{\#R}\).

Proof

First we prove that \(S_\Delta ^{P,J}= {{{\,\mathrm{{\textbf {tr}}}\,}}}(C_\Delta ^{P,J})\). By reasoning as in Propositions 4 and 5 of [12], it holds the following chain of equalities:

$$\begin{aligned} \begin{aligned}&{{\,\mathrm{{\textbf {tr}}}\,}}(C_\Delta ^{P,J})=\left\{ {{\,\mathrm{{\textbf {tr}}}\,}}({\textbf{c}}) \mid {\textbf{c}}\in C_\Delta ^{P,J}\right\} =\left\{ {{\,\mathrm{{\textbf {tr}}}\,}}({{\,\textrm{ev}\,}}_P(f)) \mid f\in {\mathscr {R}} \text {, } {{\,\textrm{supp}\,}}(f)\subseteq \Delta \right\} =\\&\left\{ {{\,\textrm{ev}\,}}_P({\mathscr {T}}(f)) \mid f\in {\mathscr {R}} \text {, } {{\,\textrm{supp}\,}}(f)\subseteq \Delta \right\} =\left\{ {{\,\textrm{ev}\,}}_P({\mathscr {T}}(f)) \mid f\in {\mathscr {R}} \text {, } {{\,\textrm{supp}\,}}({\mathscr {T}}(f))\subseteq \Delta \right\} =S_\Delta ^{P,J}. \end{aligned} \end{aligned}$$

Notice that the last but one equality is true because \(\Delta \) is closed. Now, define \({{\,\mathrm{{\textbf {tr}}}\,}}' :{\mathbb {F}}_{p^l}^{\#R} \rightarrow {\mathbb {F}}_{p^h}^{\#R}\), determined by \({{\,\textrm{tr}\,}}_l^h\) componentwise. Then, \(\pi _R(C_\Delta ^{P,J}) \cap {\mathbb {F}}_{p^h}^{\#R}={{\,\mathrm{{\textbf {tr}}}\,}}'(\pi _R(C_\Delta ^{P,J}))\). Finally, for any element in \(S_\Delta ^{P,J}\), \({{\,\mathrm{{\textbf {tr}}}\,}}({\textbf{c}})\), \({\textbf{c}}\in C_\Delta ^{P,J}\), the fact that the maps \({{\,\mathrm{{\textbf {tr}}}\,}}\) and \({{\,\mathrm{{\textbf {tr}}}\,}}'\) are defined componentwise implies \(\pi _R({{\,\mathrm{{\textbf {tr}}}\,}}({\textbf{c}}))={{\,\mathrm{{\textbf {tr}}}\,}}'(\pi _R({\textbf{c}}))\), which proves the result. \(\square \)

Closed sets will be the key for obtaining optimal \((r,\delta )\)-LRCs coming from subfield-subcodes. To explain it, we recall, on the one hand, that if \(\Delta \) is a closed set, then \(\dim (S_\Delta ^{P,J})=\dim (C_\Delta ^{P,J})=\#\Delta \). On the other hand, the minimum distance of a subfield-subcode \(S_\Delta ^{P,J}\) admits the bound on the MCC \(C_\Delta ^{P,J}\) it comes from. Since \(\Delta \) is closed, it is not decreasing (see Definition 3.9) because the construction of closed sets produces non-consecutive elements in some coordinate. Then \(\Delta \) contains gaps, see for example Fig. 8. Therefore, the bound given in Corollary 3.7 is not sharp, which forces us to use an improved bound for each particular case that depends on the shape of \(\Delta \). This new bound coincides with that of Corollary 3.7 on a certain decreasing MCC \(C_{\Delta '}^{P,J}\) obtained, roughly speaking, after “compacting” \(\Delta \) to a decreasing set \(\Delta '\) such that \(\#\Delta =\#\Delta '\). Roughly speaking, “to compact” a set \(\Delta \subseteq E\) (represented as a shaded region in the grid E) means to move \(\Delta \) by a translation vector vanishing out of the variable used to interpolate in such a way that the first segments of exponents in that variable are as full as possible, and to remove empty segments (see Fig. 6 d), where we use the identification \(9=0\) and points where \(X=2\) go to points with \(X=8\)). This procedure is very close to that described in the third paragraph of Remark 4.4, but adapted to the current shapes of the sets \(\Delta \). Thus, if we choose \(\Delta \) to be closed, the code over \({\mathbb {F}}_{p^h}\), \(S_\Delta ^{P,J}\), has the same parameters n and k and the same bound for the minimum distance as \(C_{\Delta '}^{P,J}\). Moreover, the recovery method presented in Proposition 3.10 can also be applied to \(S_\Delta ^{P,J}\) obtaining the same locality \((r,\delta )\) as \(C_{\Delta '}^{P,J}\). Therefore, we deduce optimality of subfield-subcodes \(S_\Delta ^{P,J}\) from the optimality of the codes \(C_{\Delta '}^{P,J}\) studied in Sect. 4.

5.2 Optimal \((r,\delta )\)-LRCs coming from subfield-subcodes of bivariate MCCs

In this subsection, we use some results in Sect. 4 and the ideas described in the above paragraph to provide some families of new optimal \((r,\delta )\)-LRCs coming from subfield-subcodes of q-ary bivariate J-affine variety codes. We will give \(p^h\)-ary optimal \((r,\delta )\)-LRCs whose length is a multiple of \(r+\delta -1\), where \(r+\delta -1\) equals \(p^h+1\) or \(p^h+2\), \(r>1\), \(\delta >2\), and for some codes we impose certain gcd-type conditions so that all the codes provided are new (see the introduction of Sect. 5 and the future Remark 5.9). The forthcoming Propositions 5.6 and 5.8 (in characteristic two) prove the optimality while Theorems 5.11 and 5.12 show the parameters of our codes.

Let \(U_t\subseteq {\mathbb {F}}_q\) denote the multiplicative subgroup of \({\mathbb {F}}_q\) of t-th roots of unity, \(t\mid q-1\). Keep the notation as in Sect. 3 and Subsect. 5.1. Fix \(i\in \{1,2\}\) (it refers to the variable \(X_i\) with respect to which we will interpolate when applying our recovery method) and denote \(i'\) the unique element \(i'\in \{1,2\}\backslash \{i\}\).

Pick \(p^h\ge 4\) if p equals 2 (\(p^h\ge 5\), otherwise) such that \(p^h+1\mid q-1\). Here, the set of points to evaluate in the variable \(X_i\) is \(P_i=U_{p^h+1}\subseteq {\mathbb {F}}_q\), and thus its cardinality equals \(n_i=p^h+1\). Our (two-dimensional) set P of evaluation points is \(P=P_1\times P_2\), where \(P_{i'}\) is either some multiplicative subgroup \(U_{n_{i'}}\subseteq {\mathbb {F}}_q\), with \(n_{i'}\mid q-1\) and \(J=\{1,2\}\), or, allowing also the element 0 to be evaluated, \(U_{n_{i'}-1}\cup \{0\}\subseteq {\mathbb {F}}_q\), with \(n_{i'}-1\mid q-1\) and \(J=\{i\}\).

The following two families of sets will be used to define the sets \(\Delta \) of our codes \(S_\Delta ^{P,J}\) since they will constitute the sets \({{\,\textrm{supp}\,}}_{X_i}(V_\Delta )\) defined under Definition 3.9. For each nonnegative integer \(a\le \lfloor \frac{p^h}{2} \rfloor -1\) (and, if \(p=2\), \(b\le \frac{p^h}{2}-2\)), we consider the sets \(\Lambda ^i\) introduced in Subsect. 5.1, and define

$$\begin{aligned} \Omega _a:=\left\{ 0,1,\dots ,a,p^h+1-a,p^h+2-a,\dots ,p^h\right\} =\Lambda ^i_0\cup \Lambda ^i_1\cup \cdots \cup \Lambda ^i_a \end{aligned}$$

when \(a>0\), \(\Omega _0:=\{0\}\) and

$$\begin{aligned} \Omega ^*_b:=\left\{ \frac{p^h}{2}-b,\frac{p^h}{2}-b+1,\dots ,\frac{p^h}{2}+b+1\right\} =\Lambda ^i_{\frac{p^h}{2}-b}\cup \Lambda ^i_{\frac{p^h}{2}-b+1}\cup \cdots \cup \Lambda ^i_{\frac{p^h}{2}}. \end{aligned}$$

These are closed sets (in the fixed variable i with respect to \(p^h\)) of the set \(\{0,1,\dots ,n_i-1\}=\{0,1,\dots ,p^h\}\) (identified with \({\mathbb {Z}}/(p^h+1){\mathbb {Z}}\)) of possible exponents, in the variable \(X_i\), of evaluation polynomials. Indeed, with the above mentioned identification, \(p^h+1=0\) and then \(\Lambda ^i_0=\{0\}\) and \(\Lambda ^i_t=\{t,p^h-(t-1)\}\).

Example 5.3

Set \((i,p^h,q,a,b)=(1,8,64,3,2)\), that is we fix the first variable to interpolate and we take the field \({\mathbb {F}}_{64}\) and its subfield \({\mathbb {F}}_8\). Then the above defined sets are \(\Omega _a=\{0,1,2,3,6,7,8\}=\Lambda ^i_0 \cup \Lambda ^i_1\cup \Lambda ^i_2 \cup \Lambda ^i_3=\{0\}\cup \{1,8\}\cup \{2,7\}\cup \{3,6\}\), where, for example, \(\Lambda ^i_2=\{2,2\cdot 8=16=7\}\) because the exponents in the variable i fulfill the identification \(9=0\) and \(\Omega ^*_b=\{2,\dots ,7\}=\Lambda ^i_2\cup \Lambda ^i_3\cup \Lambda ^i_4=\{2,7\}\cup \{3,6\}\cup \{4,5\}\), and they coincide, respectively, with the set \({{\,\textrm{supp}\,}}_{X_i}(V_\Delta )\) in Fig. 6 a) (i) and b) (i).

Now, let \(0\le t<z\le \lfloor \frac{p^h}{2} \rfloor -1\) be nonnegative integers such that \(2t\ge \max \{0,4z-p^h-1\}\). In addition, when \(p=2\), consider a nonnegative integer \(0\le u\le \frac{p^h}{2}-2\) and if \(u\ge 1\), let \(0\le v<u\) be a nonnegative integer such that \(2v+1\ge \max \{0,4u+1-p^h\}\). Let us define the following four types of sets \(\Delta \) (named \(\Delta _1,\,\Delta _2,\,\Delta ^*_1\) and \(\Delta ^*_2\)) which will allow us to give our first family of optimal codes \(S_\Delta ^{P,J}\). Sets \(\Delta _1\) and \(\Delta _2\) provide codes defined over finite fields of arbitrary characteristic, while sets \(\Delta ^*_1\) and \(\Delta ^*_2\) work only in characteristic two.

$$\begin{aligned} \Delta _1(z)=\Delta _1:={\left\{ \begin{array}{ll} \Omega _z\times \{0,1,\dots ,n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-1\}\times \Omega _z, &{} \text {otherwise;} \end{array}\right. } \\ \Delta _2(z,t)=\Delta _2:={\left\{ \begin{array}{ll} \Omega _z\times \{0,1,\dots ,n_2-2\} \cup \Omega _t\times \{n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-2\}\times \Omega _z \cup \{n_1-1\} \times \Omega _t, &{} \text {otherwise;} \end{array}\right. } \\ \Delta ^*_1(u)=\Delta ^*_1:={\left\{ \begin{array}{ll} \Omega ^*_u\times \{0,1,\dots ,n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-1\}\times \Omega ^*_u, &{} \text {otherwise;} \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} \Delta ^*_2(u,v)=\Delta ^*_2:={\left\{ \begin{array}{ll} \Omega ^*_u\times \{0,1,\dots ,n_2-2\} \cup \Omega ^*_v\times \{n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-2\}\times \Omega ^*_u \cup \{n_1-1\} \times \Omega ^*_v, &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$

Our choice of sets \(\Delta \) is supported on the ideas exposed before Subsect. 5.2. We will prove that they are closed in the forthcoming Proposition 5.6. It must hold in each variable and happens in the variable \(i'\) by picking all the possible exponents or all but \(n_{i'}-1\) (notice that \(\Lambda _{n_{i'}-1}^{i'}=\{n_{i'}-1\}\) when \(i'\notin J\)). A key fact is that we force the projected code in the variable i, \({{\,\textrm{ev}\,}}_{P_i}\left( V^i_\Delta \right) \), to be MDS in order to have the explicit values of r and \(\delta \) from Proposition 3.10. Finally, the above sets \(\Delta \) are those that, as described before Subsect. 5.2, can be “compacted” to some of the sets provided in Propositions 4.1, 4.2 or 4.3 and admit their same (improved) bounds on the minimum distance.

Example 5.4

This is a continuation of Example 5.3. With the same notation, set \(z=a\) and \(t=b\), consider also \((u,v)=(2,1)\). Then, \(\Omega _t=\{0,1,2,7,8\}\) and \(\Omega ^*_v=\{3,\dots ,6\}\). Figure 6 c) (i) and d) (i) show, respectively, the sets \(\Delta _2\) and \(\Delta ^*_2\) in this case.

Lemma 5.5

Keep the above notation. Let \(a\le \lfloor \frac{p^h}{2} \rfloor -1\) and, if \(p=2\), \(b\le \frac{p^h}{2}-2\) be nonnegative integers. Consider the \({\mathbb {F}}_q\)-vector spaces \(V_1=\langle (X_i)^e \mid e \in \Omega _a \rangle \) and \(V_2=\langle (X_i)^e \mid e \in \Omega ^*_b \rangle \) contained in the quotient ring \({\mathscr {R}}_i\) defined before Proposition 3.10. Then, \({{\,\textrm{ev}\,}}_{P_i}(V_1)\) and \({{\,\textrm{ev}\,}}_{P_i}(V_2)\) are MDS codes.

Proof

Let \(\Omega :=\{0,1,\dots ,2a\}=\Omega _a+a\) regarded as representatives of elements in \({\mathbb {Z}}/(p^h+1){\mathbb {Z}}\). Define \(V=\langle (X_i)^e \mid e \in \Omega \rangle \). Codewords in \({{\,\textrm{ev}\,}}_{P_i}(V)\) are of the form

$$\begin{aligned} {{\,\textrm{ev}\,}}_{P_i}((X_i)^af)={{\,\textrm{ev}\,}}_{P_i}((X_i)^a)*{{\,\textrm{ev}\,}}_{P_i}(f), \end{aligned}$$

where \(f\in V_1\). Since \(0\notin P_i\), \({{\,\textrm{ev}\,}}_{P_i}(V_1)\) and \({{\,\textrm{ev}\,}}_{P_i}(V)\) are isometric codes. The code \(\left( {{\,\textrm{ev}\,}}_{P_i}(V)\right) ^\perp \) is a \([p^h+1,p^h-2a,\le 2a+2]_q\) code and, since \(\Omega \) contains \(2a+1\) consecutive elements, \({{\,\textrm{d}\,}}\left( \left( {{\,\textrm{ev}\,}}_{P_i}(V)\right) ^\perp \right) \ge 2a+2\) because its corresponding parity-check matrix contains a Vandermonde matrix of rank \(2a+1\). Thus, \(\left( {{\,\textrm{ev}\,}}_{P_i}(V)\right) ^\perp \) is an MDS code and therefore \({{\,\textrm{ev}\,}}_{P_i}(V)\) and \({{\,\textrm{ev}\,}}_{P_i}(V_1)\) are MDS codes. The fact that \(\Omega ^*_b\) contains \(2b+2\) consecutive elements proves that \(\left( {{\,\textrm{ev}\,}}_{P_i}(V_2)\right) ^\perp \) is an MDS code and therefore so is \({{\,\textrm{ev}\,}}_{P_i}(V_2)\). \(\square \)

The following result shows sets \(P,\,J\) and \(\Delta \) giving rise to our first family of new optimal LRCs \(S_\Delta ^{P,J}\) in the bivariate case. Sets in Items (1), (2) and (3) provide codes over fields of any characteristic, while the remaining items only give characteristic two codes. We note that the proof is based on the ideas exposed in the paragraphs before Subsect. 5.2 and Example 5.4. The specific parameters of the LRCs corresponding to this result are given in the next Theorem 5.11.

Proposition 5.6

Keep the the notation as above where \({\mathbb {F}}_{p^h}\) is regarded as a subfield of \(\;{\mathbb {F}}_{q=p^l}\) and \(p^h+1 \mid q-1\). Fixed i and \(P_i=U_{p^h+1}\), the set of \(p^h+1\)-th roots of unity, the following statements determine sets \(P_{i'}\), J and \(\Delta \) such that the subfield-subcodes \(S_\Delta ^{P,J}\) over the field \({\mathbb {F}}_{p^h}\) are optimal \((r,\delta )\)-LRCs.

  1. (1)

    \(P_{i'}=U_{n_{i'}}\) for some \(n_{i'}\) such that \(n_{i'}\mid q-1\); \(J=\{1,2\}\) and \(\Delta =\Delta _1\), in which case

    $$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1). \end{aligned}$$
  2. (2)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\{i\}\) and \(\Delta =\Delta _1\), in which case

    $$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1). \end{aligned}$$
  3. (3)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\) and, if p is odd, either \(\gcd (n_{i'},p^h)\ne 1\) or \(\gcd (n_{i'},p^h+1)\ne 1\); \(J=\{i\}\) and \(\Delta =\Delta _2\), in which case

    $$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1). \end{aligned}$$
  4. (4)

    \(P_{i'}=U_{n_{i'}}\) for some \(n_{i'}\) such that \(n_{i'}\mid q-1\); \(J=\{1,2\}\) and \(\Delta =\Delta ^*_1\), in which case

    $$\begin{aligned} (r,\delta )=(2u+2,p^h-2u). \end{aligned}$$
  5. (5)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\{i\}\) and \(\Delta =\Delta ^*_1\), in which case

    $$\begin{aligned} (r,\delta )=(2u+2,p^h-2u). \end{aligned}$$
  6. (6)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\{i\}\) and \(\Delta =\Delta ^*_2\), in which case \((r,\delta )=(2u+2,p^h-2u)\).

Proof

We start by proving that the sets \(\Delta \) in the statements (1)–(6) are closed with respect to \(p^h\). As we said, in the single variable i, the subsets of \(\{0,1,\dots ,n_i-1\}=\{0,1,\dots ,p^h\}\) (identified with \({\mathbb {Z}}/(p^h+1){\mathbb {Z}}\)),

$$\begin{aligned} \Omega _a=\Lambda _0^i\cup \Lambda _1^i\cup \dots \cup \Lambda _a^i \end{aligned}$$

and

$$\begin{aligned} \Omega ^*_b=\Lambda _{\frac{p^h}{2}-b}^i\cup \Lambda _{\frac{p^h}{2}-b+1}^i\cup \dots \cup \Lambda _{\frac{p^h}{2}}^i, \end{aligned}$$

for \(a\in \{z,t\}\) and \(b\in \{u,v\}\) are clearly closed. In the single variable \(i'\), \(\{0,1,\dots ,n_{i'}-1\}\) is closed. In addition, when \(0\in P_{i'}\), the minimal closed set in a single variable \(\Lambda ^{i'}_{n_{i'}-1}\subseteq \{0,1,\dots ,n_{i'}-1\}\) is the set \(\Lambda ^{i'}_{n_{i'}-1}=\{n_{i'}-1\}\). Indeed, with the identification \(n_{i'}=1\) described in Subsect. 5.1, it holds the following chain of equalities:

$$\begin{aligned} p^h(n_{i'}-1)= & {} (p^h-1)(n_{i'}-1)+n_{i'}-1\\{} & {} =(p^h-1)n_{i'}+n_{i'}-p^h\\{} & {} =p^h-1+n_{i'}-p^h=n_{i'}-1. \end{aligned}$$

Therefore, \(\{0,1,\dots ,n_{i'}-2\}=\{0,1,\dots ,n_{i'}-1\}\backslash \{n_{i'}-1\}\) is also closed. The Cartesian product and the union of closed sets are closed, so the sets \(\Delta \) in (1)–(6) are closed and \(\dim (S_\Delta ^{P,J})=\dim (C_\Delta ^{P,J})\).

Now we are going to prove that the subfield-subcodes \(S_\Delta ^{P,J}\) are LRCs. Let \(i=1\) and \(V_1\) as in Lemma 5.5 with \(a=z\). Since \(\Omega _z\) is closed, \(\dim ({{\,\textrm{ev}\,}}_{P_i}(V_1)\cap {\mathbb {F}}_{p^h}^{p^h+1})=\dim ({{\,\textrm{ev}\,}}_{P_i}(V_1))\) and the fact that \({{\,\textrm{d}\,}}({{\,\textrm{ev}\,}}_{P_i}(V_1)\cap {\mathbb {F}}_{p^h}^{p^h+1})\ge {{\,\textrm{d}\,}}({{\,\textrm{ev}\,}}_{P_i}(V_1))\) and Lemma 5.5 imply that \({{\,\textrm{ev}\,}}_{P_i}(V_1)\cap {\mathbb {F}}_{p^h}^{p^h+1}\) is an MDS code with minimum distance \(p^h-2z+1\). Taking \({\overline{R}}\) such that \(\pi _{{\overline{R}}}(C_\Delta ^{P,J})={{\,\textrm{ev}\,}}_{P_i}(V_1)\), Proposition 5.2 shows that \(\pi _{{\overline{R}}}(S_\Delta ^{P,J})={{\,\textrm{ev}\,}}_{P_i}(V_1)\cap {\mathbb {F}}_{p^h}^{p^h+1}\) is also MDS. Then, Proposition 3.10 applied to \(S_\Delta ^{P,J}\), \(\Delta \) being either \(\Delta _1\) or \(\Delta _2\), proves that \(S_\Delta ^{P,J}\) is an LRC with locality \((2z+1,p^h-2z+1)\). Replacing \((V_1,a,z,\Omega _z)\) by \((V_2,b,u,\Omega ^*_u)\) one deduces that \(S_\Delta ^{P,J}\) is an LRC with locality \((2u+2,p^h-2u)\), whenever \(\Delta \) is either \(\Delta _1^*\) or \(\Delta _2^*\). Notice that r and \(\delta \) do not depend neither on t nor on v, unlike dimension and minimum distance.

The case \(i=2\) can be proved analogously noticing that we are in the symmetric situation. It suffices to interpolate with respect to Y and change i by \(i'\) and \(n_2\) by \(n_1\).

With notation as in Sect. 4 and \(i=1\), we assert that the minimum distance of the code \(S_\Delta ^{P,J}\) admits the bound on the minimum distance of \(C_{\Delta '}^{P,J}\), \(d_0\left( C_{\Delta '}^{P,J}\right) \), whenever

$$\begin{aligned} \left( \Delta ,\Delta '\right) \in \Big \{\left( \Delta _1,\Delta ^1_{2z,n_2-1}\right) ,\left( \Delta _2,\Delta ^2_{2z,2t}\right) , \left( \Delta _1^*,\Delta ^1_{2u+1,n_2-1}\right) ,\left( \Delta _2^*,\Delta ^2_{2u+1,2v+1}\right) \Big \}. \end{aligned}$$

Let us prove the statement. Figure 6 considers the case \((p,h,l,z,t,u,v)=(2,3,6,3,2,2,1)\) to illustrate our reasoning. Let \({\textbf{c}}={{\,\textrm{ev}\,}}_P(f)\), \(f(X,Y)\in V_\Delta \) be a codeword in \(S_\Delta ^{P,J}\).

Fig. 6
figure 6

Sets \(\Delta \), \(\Delta '\) (and \(\Delta ''\)) considered in the proof of Proposition 5.6 for values \((i,p^h,q,P_1,z,t,u,v)=(1,8,64,U_9,3,2,2,1)\)

(a) Assume firstly that \(\Delta =\Delta _1\). A no-root \((\alpha ,\beta )\) in P of f(XY) must satisfy that \(\alpha \) is a no-root of \(f(X,\beta )\) as a polynomial in X and \(\beta \) is a no-root of \(f(\alpha ,Y)\) as a polynomial in Y. Denote \(n_{\beta }\) (respectively, \(n_{\alpha }\)) the cardinality of the set of no-roots of \(f(X,\beta )\) (respectively, \(f(\alpha ,Y)\)). Set \(n_X\) (respectively, \(n_Y\)) the minimum of \(n_{\beta }\) (respectively, \(n_{\alpha }\)) when \(\beta \) (respectively, \(\alpha \)) runs over \(P_2\) (respectively, \(P_1\)). Then, the number of no-roots of f in P is at least \(n_Xn_Y\). Since \({{\,\textrm{d}\,}}\left( {{\,\textrm{ev}\,}}_{P_1}(V_1)\cap {\mathbb {F}}_{p^h}^{p^h+1}\right) =p^h+1-2z\) and \({{\,\textrm{d}\,}}\left( {{\,\textrm{ev}\,}}_{P_2}\left( \langle Y^e \mid e\in \{0,1,\dots ,n_2-1\}\rangle \right) \cap {\mathbb {F}}_{p^h}^{n_2}\right) =1\) (they are MDS codes), then \({{\,\textrm{w}\,}}({\textbf{c}})\ge p^h+1-2z\) and \({{\,\textrm{d}\,}}\left( S_\Delta ^{P,J}\right) \ge p^h+1-2z=d_0\left( C_{\Delta '}^{P,J}\right) \). See (a) in Fig. 6.

(b) Consider now the case \(\Delta =\Delta _1^*\). Since \({{\,\textrm{d}\,}}\left( {{\,\textrm{ev}\,}}_{P_1}(V_2)\cap {\mathbb {F}}_{p^h}^{n_2}\right) =p^h-2u\), the same argument as in a) proves \({{\,\textrm{d}\,}}\left( S_\Delta ^{P,J}\right) \ge p^h-2u=d_0\left( C_{\Delta '}^{P,J}\right) \). See (b) in Fig. 6.

(c) For proving the case \(\Delta =\Delta _2\), we use the following (lexicographical) ordering in E:

$$\begin{aligned} (e_1,e_2)\le (e'_1,e'_2) \iff e_2 < e'_2 \text { or (} e_2=e'_2 \text { and } e_1 \le e'_1 \text {),} \end{aligned}$$

and we distinguish two cases:

  • The leading monomial of f is in \(\Omega _z\times \{0,1,\dots ,n_2-2\}\), then an analogous argument as in (a) proves \({{\,\textrm{w}\,}}({\textbf{c}})\ge 2(p^h+1-2z)\).

  • The leading monomial of f is in \(\Omega _t\times \{n_2-1\}\), then consider \(\Delta '':=\Delta +(t,0) \subseteq E\) because of the relation \(p^h+1=0\) in \(\{0,1,\dots ,p^h\}\). Consider the codeword in \(C_{\Delta ''}^P\)

    $$\begin{aligned} {{\,\textrm{ev}\,}}_P(X^tf)={{\,\textrm{ev}\,}}_P(X^t)*{{\,\textrm{ev}\,}}_P(f)={{\,\textrm{ev}\,}}_P(X^t)*{\textbf{c}}. \end{aligned}$$

    Since \(0\notin P_1\), \({{\,\textrm{w}\,}}({\textbf{c}})={{\,\textrm{w}\,}}({{\,\textrm{ev}\,}}_P(X^tf))\ge {{\,\textrm{d}\,}}(2t,n_2-1)=p^h+1-2t\) by Proposition 3.6 (the leading monomial of \(X^tf\) is \(\mu X^\gamma Y^{n_2-1}\) with \(\gamma \le 2t\)).

Then, \({{\,\textrm{w}\,}}({\textbf{c}})\ge \min \{2(p^h+1-2z),p^h+1-2t\}=p^h+1-2t\) and therefore

$$\begin{aligned} {{\,\textrm{d}\,}}\left( S_\Delta ^{P,J}\right) \ge p^h+1-2t=d_0\left( C_{\Delta '}^{P,J}\right) . \end{aligned}$$

See (c) in Fig. 6.

(d) Finally, when \(\Delta =\Delta _2^*\), reasoning as in (c) with \(\Delta '':=\Delta +(\frac{p^h}{2}+v+1,0)\), one gets the desired bound:

$$\begin{aligned} {{\,\textrm{d}\,}}\left( S_\Delta ^{P,J}\right) \ge p^h-2v=d_0\left( C_{\Delta '}^{P,J}\right) . \end{aligned}$$

See (d) in Fig. 6.

The case \(i=2\) follows by symmetry. It suffices to replace \(P_1\) by \(P_2\), \(n_2\) by \(n_1\) and consider

$$\begin{aligned} \left( \Delta ,\Delta '\right) \in \Bigg \{\left( \Delta _1,\Delta ^1_{n_1-1,2z}\right) ,\left( \Delta _2,\Delta ^{2,\sigma }_{2z,2t}\right) , \left( \Delta _1^*,\Delta ^1_{n_1-1,2u+1}\right) ,\left( \Delta _2^*,\Delta ^{2,\sigma }_{2u+1,2v+1}\right) \Bigg \}. \end{aligned}$$

Notice that \(\#\Delta =\#\Delta '\) and \(\dim (S_\Delta ^{P,J})=\dim (C_\Delta ^{P,J})=\dim (C_{\Delta '}^{P,J})\). Moreover, \({{\,\textrm{d}\,}}(S_\Delta ^{P,J})\ge {{\,\textrm{d}\,}}(C_\Delta ^{P,J})\ge d_0(C_{\Delta '}^{P,J})\) and the locality of \(C_{\Delta '}^{P,J}\) is the same as the locality of \(S_\Delta ^{P,J}\). Then, the fact that \(C_{\Delta '}^{P,J}\) is optimal (Corollary 4.5(1) when \(\Delta \) is \(\Delta _1\) or \(\Delta _1^*\), and Corollary 4.5(2) when \(\Delta \) is \(\Delta _2\) or \(\Delta _2^*\)) implies that the subfield-subcode \(S_\Delta ^{P,J}\) over the field \({\mathbb {F}}_{p^h}\) is optimal, which concludes the proof. \(\square \)

At the beginning of this subsection we announced the introduction of two families of new optimal codes. One of them contains codes over fields of any characteristic and it has already been described. Next we introduce the second one that only works in characteristic two. We start by giving some sets that will be useful for it. In this case, \(p=2\), \(l\ge 4\) is an even positive integer, \(h=\frac{l}{2}\) (recall that the field and subfield we are considering are denoted, respectively, \({\mathbb {F}}_{q=p^l}\) and \({\mathbb {F}}_{p^h}\)) and in this case the set of points to evaluate in the variable \(X_i\) is the set of \(2^h+1\)-th roots of unity together with the element 0, \(P_i=U_{2^h+1}\cup \{0\}\subseteq {\mathbb {F}}_q\). Recall that \(\{i,i'\}=\{1,2\}\) means that \(X_i\) is the variable we use to interpolate. Then, the cardinality of \(P_i\) is \(n_i = 2^h + 2\) and \(P = P_1 \times P_2\), where \(P_{i'}\) is either \(U_{n_{i'}}\subseteq {\mathbb {F}}_q\), with \(n_{i'}\mid q-1\) and \(J = \{i'\}\), or \(U_{n_{i'}-1}\cup \{0\}\subseteq {\mathbb {F}}_q\), with \(n_{i'}- 1 \mid q- 1\) and \(J = \emptyset \).

Now we introduce some sets which will be the sets \({{\,\textrm{supp}\,}}_{X_i}(V_\Delta )\) corresponding to the sets \(\Delta \) that we are going to consider. Let \(1\le j\le n_{i'}-1\) and \(2\le z\le 3\), \(2^h-2z+1\ge \max \left\{ 0,2^h-6\right\} \) be positive integers and denote

$$\begin{aligned}{} & {} \Omega :=\left\{ 0,1,2^h\right\} =\Lambda ^i_0\cup \Lambda ^i_1, \\{} & {} \Omega ^\perp :=\left\{ 0,2,3,\dots ,2^h-1\right\} =\left\{ 0,1,\dots ,2^h+1\right\} \big \backslash \left( \Lambda ^i_1\cup \Lambda ^i_{2^h+1}\right) \end{aligned}$$

and

$$\begin{aligned} \Omega ^*(z)=\Omega ^*:=\left\{ z,z+1,\dots ,2^h-z+1\right\} =\Lambda ^i_z\cup \Lambda ^i_{z+1}\cup \cdots \cup \Lambda ^i_{2^h-1}. \end{aligned}$$

These are closed sets (in the fixed variable i with respect to \(2^h\)) of the set \(\{0,1,\dots ,n_i-1\}=\{0,1,\dots ,2^h+1\}\) (identified with \(\{0\}\cup {\mathbb {Z}}/(2^h+1){\mathbb {Z}}\)) of possible exponents, in the variable \(X_i\), of evaluation polynomials. Define the following four types of sets \(\Delta \) (named \(\Delta _1,\,\Delta ^\perp _1,\,\Delta _2\) and \(\Delta ^\perp _2\)) to be used in our second family of codes \(S_\Delta ^{P,J}\):

$$\begin{aligned} \Delta _1:={\left\{ \begin{array}{ll} \Omega \times \{0,1,\dots ,n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-1\}\times \Omega , &{} \text {otherwise;} \end{array}\right. } \\ \Delta ^\perp _1:={\left\{ \begin{array}{ll} \Omega ^\perp \times \{0,1,\dots ,n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-1\}\times \Omega ^\perp , &{} \text {otherwise;} \end{array}\right. } \\ \Delta _2(j)=\Delta _2:={\left\{ \begin{array}{ll} \Omega \times \{0,1,\dots ,j-1\} \cup (0,j), &{} \text {when } i=1,\\ \{0,1,\dots ,j-1\}\times \Omega \cup (j,0), &{} \text {otherwise;} \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} \Delta ^\perp _2(z)=\Delta ^\perp _2:={\left\{ \begin{array}{ll} \Omega ^\perp \times \{0,1,\dots ,n_2-2\} \cup \Omega ^*\times \{n_2-1\}, &{} \text {when } i=1,\\ \{0,1,\dots ,n_1-2\}\times \Omega ^\perp \cup \{n_1-1\} \times \Omega ^*, &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$

The reasons for our choices of the above sets \(\Delta \) are essentially the same ones we explained for our first family, however there are some minor difference. Here, in some cases, a smaller set of exponents is considered for the variable \(i'\) but we keep the closeness property because, in such cases, the minimal closed sets in the variable \(i'\) contain a single element. We also have MDS projected codes but our proof for this property is different.

Our next result plays the role of Lemma 5.5 for studying our second family of optimal codes.

Lemma 5.7

Keep the above notation. Let \(V_1=\langle X^e \mid e \in \Omega \rangle _{{\mathbb {F}}_q}\), \(V_2=\langle X^e \mid e \in \Omega ^\perp \rangle _{{\mathbb {F}}_q} \subseteq {\mathscr {R}}_i\) and define \(C_1:={{\,\textrm{ev}\,}}_{P_i}(V_1) \cap {\mathbb {F}}_{2^h}^{\#P_i=2^h+2}\) and \(C_2:={{\,\textrm{ev}\,}}_{P_i}(V_2) \cap {\mathbb {F}}_{2^h}^{2^h+2}\). Then, \(C_1\) and \(C_2\) are MDS codes.

Proof

Notice that \({{\,\textrm{ev}\,}}_{P_i}(V_2)\) is the dual code of \({{\,\textrm{ev}\,}}_{P_i}(V_1)\) since

$$\begin{aligned} \Omega ^\perp =\left\{ 0,1,\dots ,2^h+1\right\} \big \backslash \left\{ 2^h+1-x \mid x\in \Omega \right\} \end{aligned}$$

[14, Proposition 1] and, by Delsarte Theorem, \((C_2)^\perp =\left( {{\,\textrm{ev}\,}}_{P_i}(V_2)\right) ^\perp \cap {\mathbb {F}}_{2^h}^{2^h+2}=C_1\). Thus, it suffices to prove that \(C_1\) is an MDS code. Notice that its dimension coincides with the dimension of \({{\,\textrm{ev}\,}}_{P_i}(V_1)\) because \(\Omega =\Lambda _0^i\cup \Lambda _1^i\) is closed [13, Theorem 2.3], so the parameters of \(C_1\) are \([2^h+2,3,\le 2^h]_{2^h}\). Moreover, any codeword \({\textbf{c}}\in C_1\) is of the form \({\textbf{c}}={{\,\textrm{ev}\,}}_{P_i}(f)\), where \(f={\mathscr {T}}(\lambda +\mu X)\), \(\lambda \), \(\mu \in {\mathbb {F}}_{q}={\mathbb {F}}_{2^{2\,h}}\) and \({\mathscr {T}}:{\mathscr {R}}_i \rightarrow {\mathscr {R}}_i\) is the map given by \({\mathscr {T}}(g)=g+g^{2^h}\) [12, Proposition 5]. We have to prove that \({{\,\textrm{d}\,}}(C_1)=2^h\), which is equivalent to prove that the number of roots of \(f=\lambda +\lambda ^{2^h}+\mu X+\mu ^{2^h}X^{2^h}\) in \(P_i=U_{2^h+1}\cup \{0\}\) is at most 2, or that the equation

$$\begin{aligned} \lambda +\mu X=\lambda ^{2^h}+\mu ^{2^h}X^{2^h} \end{aligned}$$
(5.1)

has at most 2 solutions in \(P_i\). Indeed, if \(\lambda \notin {\mathbb {F}}_{2^h}\), \(X=0\) is not a solution since \(\lambda \ne \lambda ^{2^h}\). Thus, the above equation is equivalent to

$$\begin{aligned} \lambda X+\mu X^2=\lambda ^{2^h}X+\mu ^{2^h}X^{2^h+1} \end{aligned}$$

and to

$$\begin{aligned} \mu X^2+\left( \lambda +\lambda ^{2^h}\right) X+\mu ^{2^h}=0, \end{aligned}$$

which has at most 2 solutions in \(P_i\). Otherwise, if \(\lambda \in {\mathbb {F}}_{2^h}\), then \(\lambda = \lambda ^{2^h}\) and (5.1) is equivalent to

$$\begin{aligned} \mu X\left( \left( \mu X\right) ^{2^h-1}-1\right) =0. \end{aligned}$$

We may suppose \(\mu \ne 0\) since the case \(\mu =0\) is not relevant to compute the minimum distance. Then, the solutions are \(X=0\) and \(X=\frac{\beta }{\mu }\) with \(\beta \in {\mathbb {F}}_{2^h}\) such that \(\beta ^{2^h+1}=\mu ^{2^h+1}\) (since \(X^{2^h+1}=1\)), that is, \(\beta ^2=\mu ^{2^h+1}\). The solution \(X=\frac{\beta }{\mu }\) exists if \(\mu ^{2^h+1}\) (\(\in {\mathbb {F}}_{2^h}\)) is a square in \(\in {\mathbb {F}}_{2^h}\) and therefore \(\beta =\sqrt{\mu ^{2^h+1}}\). Hence, we obtain at most 2 solutions in \(P_i\), as desired. \(\square \)

As before, we give sets \(P,\,J\) and \(\Delta \) providing our second family of new optimal LRCs \(S_\Delta ^{P,J}\) in the bivariate case. Parameters for these codes are given in the forthcoming Theorem 5.12.

Proposition 5.8

Keep the notation as before Lemma 5.7 where \(\;{\mathbb {F}}_{2^h}\) is regarded as a subfield of \(\;{\mathbb {F}}_{q=2^{2h}}\). Fixed \(i\in \{1,2\}\) and \(P_i=U_{2^h+1}\cup \{0\}\), the set of \(2^h+1\)-th roots of unity together with 0, the following statements determine sets \(P_{i'}\), J and \(\Delta \) such that the subfield-subcodes \(S_\Delta ^{P,J}\) over the field \(\;{\mathbb {F}}_{2^h}\) are optimal \((r,\delta )\)-LRCs. Recall that \(P=P_1\times P_2\) and \(\{i,i'\}=\{1,2\}\).

  1. (1)

    \(P_{i'}=U_{n_{i'}}\) for some \(n_{i'}\) such that \(n_{i'}\mid q-1\); \(J=\{i'\}\) and \(\Delta =\Delta _1\), in which case \((r,\delta )=(3,2^h)\).

  2. (2)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta _1\), in which case \((r,\delta )=(3,2^h)\).

  3. (3)

    \(P_{i'}=U_{n_{i'}}\) for some \(n_{i'}\) such that \(n_{i'}\mid q-1\); \(J=\{i'\}\) and \(\Delta =\Delta _1^\perp \), in which case \((r,\delta )=(2^h-1,4)\).

  4. (4)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta _1^\perp \), in which case \((r,\delta )=(2^h-1,4)\).

  5. (5)

    \(P_{i'}=U_{n_{i'}}\) for some \(n_{i'}\) such that \(n_{i'}\mid 2^h-1\); \(J=\{i'\}\) and \(\Delta =\Delta _2\), where \(j\ge \max \{1,n_{i'}-2^{h-1}\}\). In this case \((r,\delta )=(3,2^h)\).

  6. (6)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid 2^h-1\); \(J=\emptyset \) and \(\Delta =\Delta _2\), where \(\max \{1,n_{i'}-2^{h-1}\}\le j<n_{i'}-1\). In this case \((r,\delta )=(3,2^h)\).

  7. (7)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta _2\), where \(j=n_{i'}-1\). In this case \((r,\delta )=(3,2^h)\).

  8. (8)

    \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\) for some \(n_{i'}\) such that \(n_{i'}-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta _2^\perp \), in which case \((r,\delta )=(2^h-1,4)\).

Proof

The proof follows from a close reasoning to that given in the proof of Proposition 5.6. There are some minor differences which we next explain.

- Recall that \(\{0,1,\dots ,2^h+1\}\) is a set of representatives of \(\{0\}\cup {\mathbb {Z}}/(2^h+1){\mathbb {Z}}\) and \(\Lambda ^i_l\) is the minimal closed set in the variable i of the element \(l\in \{0,1,\dots ,2^h+1\}\). Then, as we said before

$$\begin{aligned}{} & {} \Omega =\Lambda ^i_0\cup \Lambda ^i_1,\\{} & {} \Omega ^\perp =\left\{ 0,1,\dots ,2^h+1\right\} \big \backslash \left( \Lambda ^i_1\cup \Lambda ^i_{2^h+1}\right) , \end{aligned}$$

and

$$\begin{aligned} \Omega ^*=\Lambda ^i_z\cup \Lambda ^i_{z+1}\cup \cdots \cup \Lambda ^i_{2^h-1}, \end{aligned}$$

are clearly closed sets, which proves that the sets \(\Delta _1\), \(\Delta _1^\perp \) and \(\Delta _2^\perp \), as well as \(\Delta _2\) in item (7) are closed. The fact that the sets \(\Delta _2\) in items (5) and (6) are closed follows by noticing that when \(P_{i'}=U_{n_{i'}}\), \(n_{i'}\mid 2^h-1\) or \(P_{i'}=U_{n_{i'}-1}\cup \{0\}\), \(n_{i'}-1\mid 2^h-1\), one can identify \(2^h\) with 1 when computing minimal closed sets in the variable \(i'\). Therefore, the sets \(\{0,1,\dots ,j-1\}\) and \(\{j\}\) are closed because they are a union of single point minimal closed sets. This proves that \(\Delta _2\) is closed.

- Lemma 5.7 implies that \({{\,\textrm{ev}\,}}_{P_i}(V_1) \cap {\mathbb {F}}_{2^h}^{2^h+2}\) and \({{\,\textrm{ev}\,}}_{P_i}(V_2) \cap {\mathbb {F}}_{2^h}^{2^h+2}\) are MDS codes with respective minimum distances \(2^h\) and 4. Proposition 3.10 applied to \(S_\Delta ^{P,J}\) proves that it is an LRC with locality \((3,2^h)\) when \(\Delta \) equals \(\Delta _1\) or \(\Delta _2\) and \((2^h-1,4)\) in case \(\Delta \) be \(\Delta _1^\perp \) or \(\Delta _2^\perp \).

- When \(i=1\), the minimum distance of \(S_\Delta ^{P,J}\) admits the bound on the minimum distance of \(C_{\Delta '}^{P,J}\), \(d_0\left( C_{\Delta '}^{P,J}\right) \), whenever the pair \(\left( \Delta ,\Delta '\right) \) belongs to the following set:

$$\begin{aligned} \left\{ \left( \Delta _1,\Delta ^1_{2,n_2-1}\right) ,\left( \Delta _1^\perp ,\Delta ^1_{2^h-2,n_2-1}\right) ,\left( \Delta _2,{\left\{ \begin{array}{ll} \Delta ^2_{2,0}, &{} \text {when } j=n_2-1,\\ \Delta ^3_{2,j}, &{} \text {otherwise.} \end{array}\right. }\right) ,\left( \Delta _2^\perp ,\Delta ^2_{2^h-2,2^h-2z+1}\right) \right\} . \end{aligned}$$

Recall that the sets \(\Delta ^l_{i,j}\), \(1\le l\le 3\) were introduced in Sect. 4. The cases where \(\Delta \) equals \(\Delta _1\) or \(\Delta _1^\perp \) (respectively, \(\Delta _2\) or \(\Delta _2^\perp \)) can be proved as in item a) (respectively c)) in the proof of Proposition 5.6. However, when \(\Delta =\Delta _2\) and the exponent of the leading monomial of f is (0, j), we do not consider any set \(\Delta ''\) but we immediately notice that \({{\,\textrm{w}\,}}({\textbf{c}})\ge n_1(n_2-j)\). When \(\Delta =\Delta _2^\perp \) and the exponent of the leading monomial of f is in \(\Omega ^*\times \{n_2-1\}\), following the idea of the proof of Proposition 5.6, we consider the sets:

$$\begin{aligned} \Delta ''_0:=\Delta +(2^h+2-z,0) \subseteq E \quad \text {and} \quad \Delta '':=\Delta ''_0+(-1,0)\subseteq E, \end{aligned}$$

because of the relation \(2^h+2=1\) in \(\{0,1,\dots ,2^h+1\}\). We illustrate this part of the proof with the example in Fig. 7. Since \(0\in P_1\), now we have \({{\,\textrm{w}\,}}({\textbf{c}})\ge {{\,\textrm{w}\,}}({{\,\textrm{ev}\,}}_P(X^{-1}(X^{2^h+2-z}f))) \ge {{\,\textrm{d}\,}}(2^h+1-2z,n_2-1)=2z+1\). Then, wherever the exponent of the leading monomial of f is, \({{\,\textrm{w}\,}}({\textbf{c}})\ge \min \{8,2z+1\}=2z+1\) and therefore the minimum distance of \(S_\Delta ^{P,J}\) admits the bound on the minimum distance of \(C_{\Delta '}^{P,J}\), that is, \({{\,\textrm{d}\,}}(S_\Delta ^{P,J})\ge 2z+1=d_0(C_{\Delta '}^{P,J})\).

Fig. 7
figure 7

Sets \(\Delta _2^\perp \), \(\Delta ''_0\), \(\Delta ''\) and \(\Delta '\) considered in the proof of Proposition 5.8 for values \((i,2^h,q,P_1,P_2,J,z)=(1,4,16,U_5\cup \{0\},U_{n_2-1}\cup \{0\},\emptyset ,2)\)

The case \(i=2\) can also be proved following the same arguments as above. It suffices to consider the symmetric situation, replace \(P_1\) by \(P_2\), \(n_2\) by \(n_1\) and use pairs \(\left( \Delta ,\Delta '\right) \) such that

$$\begin{aligned} \left( \Delta ,\Delta '\right) \in \left\{ \left( \Delta _1,\Delta ^1_{n_1-1,2}\right) ,\left( \Delta _1^\perp ,\Delta ^1_{n_1-1,2^h-2}\right) ,\left( \Delta _2,{\left\{ \begin{array}{ll} \Delta ^{2,\sigma }_{2,0}, &{} \text {when } j=2^h+1,\\ \Delta ^{3,\sigma }_{j,2}, &{} \text {otherwise.} \end{array}\right. }\right) ,\left( \Delta _2^\perp ,\Delta ^{2,\sigma }_{2^h-2,2^h-2z+1}\right) \right\} . \end{aligned}$$

We conclude with a last difference with respect to the proof of Proposition 5.6.

- The fact that \(C_{\Delta '}^{P,J}\) is optimal follows from Corollary 4.5 (1) when \(\Delta \) is \(\Delta _1\) or \(\Delta _1^\perp \), Corollary 4.5 (3) when \(\Delta =\Delta _2\) and \(j<n_{i'}-1\) and Corollary 4.5 (2) when \(\Delta \) equals \(\Delta _2^\perp \) or \(\Delta _2\) and \(j=n_{i'}-1\). \(\square \)

Remark 5.9

Propositions 5.6 and 5.8 do not give an exhaustive list of the optimal \((r,\delta )\)-codes one can find from subfield-subcodes of MCCs. These results are designed for providing \(p^h\)-ary optimal \((r,\delta )\)-LRCs such that \(r+\delta -1\) is either \(p^h+1\) or \(p^h+2\) and their lengths are a multiple of \(r+\delta -1\), \(r>1\) and \(\delta >2\). Notice that these codes are new with respect to those given in the literature, see the beginning of this section. The gcd-type condition given in Proposition 5.6 item (3) is stated to provide new parameters with respect to those obtained in [38]. Moreover, excepting Proposition 5.8, items (5), with \(j\ne n_{i'}-1\), and (7) (where \(d\ge r+\delta )\), codes in both propositions have minimum distances \(d\le \min \{r+\delta ,2\delta \}\), being new with respect to [21].

Example 5.10

In these examples, we give some new optimal LRCs obtained by applying Propositions 5.6 and 5.8.

  1. (1)

    Our first example corresponds to Proposition 5.6 (3). To help the reader, in this first example we are more explicit. Consider \((q,p^h,i,z,t,n_1,n_2)=(5^2,5,2,1,0,9,6)\) and the set \(\Delta _2(z,t)\) in our first family. This means that we consider the field \({\mathbb {F}}_{25}\), its subfield \({\mathbb {F}}_5\) and we fix the second variable to interpolate. Moreover, the set of points to evaluate in that variable (respectively, first variable) is the set of 6-th roots of unity (respectively, 8-th roots of unity together with the element 0), which has cardinality \(n_2\) (respectively, \(n_1\)). Then, one gets a \([54,25,6]_5\) optimal (3, 4)-LRC.

  2. (2)

    Consider \((q,p^h,i,z,n_1,n_2)=(7^2,7,2,2,17,8)\), then by Proposition 5.6 (2) one gets a \([136,85,4]_7\) optimal (5, 4)-LRC.

  3. (3)

    Consider \((q,p^h,i,z,t,n_1,n_2)=(9^2,9,1,3,1,10,21)\), then by Proposition 5.6 (3) one gets a \([210,143,8]_9\) optimal (7, 4)-LRC.

  4. (4)

    Consider \((q,p^h,i,n_1,n_2)=(2^4,4,1,6,15)\), then by Proposition 5.8 (1) one gets a \([90,45,4]_4\) optimal (3, 4)-LRC.

  5. (5)

    Consider \((q,p^h,i,j,n_1,n_2)=(2^6,8,2,6,8,10)\), then by Proposition 5.8 (6) one gets a \([80,19,20]_8\) optimal (3, 8)-LRC.

  6. (6)

    Consider \((q,p^h,i,z,n_1,n_2)=(2^6,8,1,3,10,10)\), then by Proposition 5.8 (8) one gets a \([100,58,7]_8\) optimal (7, 4)-LRC.

Figure 8 shows the sets \(\Delta \) introduced in Propositions 5.6 and 5.8 and used in the above examples. We make explicit the descomposition of the set \(\Delta =\Delta _2=\{0,1,\dots ,5\}\times \{0,1,8\}\cup \{(6,0)\}\) in Example 5.10 (5) as a union of minimal closed sets. Indeed, \((i,P_1,P_2,J)=(2,U_7\cup \{0\},U_9\cup \{0\},\emptyset )\) and \(\Delta \) is the union of the following minimal closed sets:

$$\begin{aligned} \begin{gathered} \Lambda _{(0,0)}=\{(0,0)\}, \Lambda _{(1,0)}=\{(1,0)\}, \Lambda _{(2,0)}=\{(2,0)\}, \Lambda _{(3,0)}=\{(3,0)\}, \Lambda _{(4,0)}=\{(4,0)\},\\ \Lambda _{(5,0)}=\{(5,0)\}, \Lambda _{(6,0)}=\{(6,0)\}, \Lambda _{(0,1)}=\{(0,1),(0,8)\}, \Lambda _{(1,1)}=\{(1,1),(1,8)\},\\ \Lambda _{(2,1)}=\{(2,1),(2,8)\}, \\ \Lambda _{(3,1)}=\{(3,1),(3,8)\}, \Lambda _{(4,1)}=\{(4,1),(4,8)\}, \Lambda _{(5,1)}=\{(5,1),(5,8)\}. \end{gathered} \end{aligned}$$
Fig. 8
figure 8

Sets \(\Delta \) considered in Example 5.10

Now, we state our main results in this subsection which are Theorems 5.11 and 5.12. These results follow directly from Propositions 5.6 and 5.8 and provide explicitly the parameters and \((r,\delta )\)-localities of the new optimal LRCs we have obtained.

Theorem 5.11

Let \(\;{\mathbb {F}}_q\) be a finite field with \(q=p^l\), p being a prime number and l a positive integer. Consider another positive integer h such that h divides l, \(p^h\ge 4\) if \(p=2\) (\(p^h\ge 5\), otherwise) and assume \(p^h+1\mid q-1\). Consider also nonnegative integers z and t satisfying \(0\le t<z \le \lfloor \frac{p^h}{2} \rfloor -1\), \(2t\ge \max \{0,4z-p^h-1\}\). Regard \(\; {\mathbb {F}}_{p^h}\) as a subfield of \(\;{\mathbb {F}}_q\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{p^h}\) with the following parameters depending on two integer variables \(n'\) and a:

$$\begin{aligned} \left[ n,k,d\right] _{p^h}=\left[ (p^h+1)n',(n'-1)(2z+1)+2a+1, p^h+1-2a\right] _{p^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n'\mid q-1\) and \(a=z\).

  2. (2)

    \(n'-1\mid q-1\) and \(a=z\).

  3. (3)

    \(n'-1\mid q-1\), \(a=t\) and, if p is odd, either \(\gcd (n',p^h)\ne 1\) or \(\gcd (n',p^h+1)\ne 1\).

Assume now that \(p=2\) and consider a nonnegative integer u and, if \(u\ge 1\), a nonnegative integer v, satisfying \(0\le u\le \frac{p^h}{2}-2\), \(0\le v<u\) and \(2v+1\ge \max \{0,4u+1-p^h\}\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{p^h}\) with the following parameters depending on two integer variables \(n'\) and a:

$$\begin{aligned} \left[ n,k,d\right] _{p^h}=\left[ (p^h+1)n',(n'-1)(2u+2)+2a+2, p^h-2a\right] _{p^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(2u+2,p^h-2u), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n'\mid q-1\) and \(a=u\).

  2. (2)

    \(n'-1\mid q-1\) and \(a=u\).

  3. (3)

    \(n'-1\mid q-1\) and \(a=v\).

Theorem 5.12

Let \(\;{\mathbb {F}}_q\) be a finite field with \(q=2^l\), \(l\ge 4\) being an even positive integer and \(h=\frac{l}{2}\). Consider also a positive integer z satisfying \(\; 2\le z\le 3\), \(2^h-2z+1\ge \max \{0,2^h-6\}\). Regard \(\; {\mathbb {F}}_{2^h}\) as a subfield of \(\;{\mathbb {F}}_q\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{2^h}\) with the following parameters depending on the integer variables \(n'\), a, b and c:

$$\begin{aligned} \left[ n,k,d\right] _{2^h}=\left[ (2^h+2)n',a(n'-1)+b, 2h+3-b\right] _{2^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(a,c), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n'\mid q-1\) and \((a,b,c)=(3,3,2^h)\).

  2. (2)

    \(n'-1\mid q-1\) and \((a,b,c)=(3,3,2^h)\).

  3. (3)

    \(n'\mid q-1\) and \((a,b,c)=(2^h-1,2^h-1,4)\).

  4. (4)

    \(n'-1\mid q-1\) and \((a,b,c)=(2^h-1,2^h-1,4)\).

  5. (5)

    \(n'-1\mid q-1\) and \((a,b,c)=(2^h-1,2^h-2z+2,4)\).

Finally, consider \(n'\) and j positive integers such that \(j\le n'-1\) and they satisfy some of the following conditions:

  1. (1)

    \(n'\mid 2^h-1\) and \(j\ge \max \{1, n'-2^{h-1}\}\).

  2. (2)

    \(n'-1\mid 2^h-1\) and \(\max \{1,n'-2^{h-1}\}\le j < n'-1\).

  3. (3)

    \(n'-1\mid q-1\) and \(j=n'-1\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{2^h}\) with parameters

$$\begin{aligned} \left[ n,k,d\right] _{2^h}=\left[ (2^h+2)n',3j+1, (2^h+2)(n'-j)\right] _{2^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(3,2^h). \end{aligned}$$

Table 1 shows parameters of some new optimal \((r,\delta )\)-LRCs coming from subfield-subcodes deduced from Theorems 5.11 and 5.12.

Table 1 Optimal subfield-subcodes over \({\mathbb {F}}_{p^h}\)

5.3 Optimal \((r,\delta )\)-LRCs coming from subfield-subcodes of multivariate MCCs

This section is devoted to extend Propositions 5.6 and 5.8 and Theorems 5.11 and 5.12 to the multivariate case. The corresponding versions are stated in the below Propositions 5.13 and 5.14, and Theorems 5.16 and 5.17. Their proofs run parallel to those given in the bivariate case and we omit them. The sets \(\Delta \) extend the ones used for the bivariate case, but our multivariate case requires to write them in a different way.

Keep the notation as in Sect. 3 and Subsect. 5.1. Fix \(j_0\in \{1,\dots ,m\}\) (it refers to the variable \(X_{j_0}\) we use to interpolate when applying our recovery method) and \(S_1\), \(S_2\subseteq \{1,\dots ,m\}\backslash \{j_0\}\) such that \(S_1\cup S_2=\{1,\dots ,m\}\backslash \{j_0\}\) and \(S_1\cap S_2=\emptyset \). These sets give a partition of \(\{1,\dots ,m\}\backslash \{j_0\}\) to decide which variables are (or not) evaluated at zero. As before, Propositions 5.13 and 5.14 determine two constructions of sets \(P,\,J\) and \(\Delta \) to get optimal families of LRCs, and Theorems 5.16 and 5.17 give the parameters of the corresponding codes. Notice that Proposition 5.14 and Theorem 5.17 give rise to codes over fields of characteristic two.

For our first construction, keep the notation as in the paragraphs before Lemma 5.5 but changing i by \(j_0\). In particular consider nonnegative integers z and t (and when \(p=2\)) u and v as in those paragraphs. Denote

$$\begin{aligned} O_{z,t}:=\left\{ t+1,t+2,\dots ,z,p^h+1-z, p^h+2-z,\dots ,p^h-t\right\} \end{aligned}$$

and

$$\begin{aligned} O_{u,v}:=\left\{ \frac{p^h}{2}-u,\frac{p^h}{2}-u+1,\dots , \frac{p^h}{2}-v-1, \frac{p^h}{2}+v+2,\frac{p^h}{2}+v+3,\dots , \frac{p^h}{2}+u+1\right\} . \end{aligned}$$

Define

$$\begin{aligned}{} & {} \Delta _1:=\{0,1,\dots ,n_1-1\}\times \cdots \\{} & {} \times \{0,1,\dots ,n_{j_0-1}-1\} \times \Omega _z\times \{0,1,\dots ,n_{j_0+1}-1\} \times \cdots \times \{0,1,\dots ,n_m-1\}, \\{} & {} \Delta _2:=\Delta _1\big \backslash \left\{ (n_1-1,\dots ,n_{j_0-1}-1,e_{j_0},n_{j_0+1}-1,\dots ,n_m-1) \mid e_{j_0} \in O_{z,t}\right\} , \\{} & {} \Delta ^*_1:=\{0,1,\dots ,n_1-1\}\times \cdots \\{} & {} \times \{0,1,\dots ,n_{j_0-1}-1\} \times \Omega _u^*\times \{0,1,\dots ,n_{j_0+1}-1\} \times \cdots \times \{0,1,\dots ,n_m-1\} \end{aligned}$$

and

$$\begin{aligned} \Delta ^*_2:=\Delta ^*_1\big \backslash \left\{ (n_1-1,\dots ,n_{j_0-1}-1,e_{j_0},n_{j_0+1}-1,\dots ,n_m-1) \mid e_{j_0} \in O_{u,v}\right\} . \end{aligned}$$

Proposition 5.13

Keep the notation as above where \(\;{\mathbb {F}}_{p^h}\) is regarded as a subfield of \(\;{\mathbb {F}}_{q=p^l}\) and \(p^h+1\mid q-1\). Fixed \(j_0\) and \(P_{j_0}=U_{p^h+1}\), the set of \(p^h+1\)-th roots of unity, the following statements determine sets \(P=P_1\times \cdots \times P_m\), J and \(\Delta \) such that the subfield-subcodes \(S_\Delta ^{P,J}\) over the field \({\mathbb {F}}_{p^h}\) are optimal \((r,\delta )\)-LRCs:

  1. (1)

    \(P_j=U_{n_j}\) for some \(n_j\) such that \(n_j\mid q-1\) whenever \(j\in S_1\) and when \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=S_1\cup \{j_0\}\) and \(\Delta =\Delta _1\), in which case

    $$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1). \end{aligned}$$
  2. (2)

    \(S_1=\emptyset \), for all \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\) and, if p is odd, either \(\gcd \left( \prod _{j\in \{1,\dots ,m\}\backslash \{j_0\}}n_j,p^h\right) \ne 1\) or \(\gcd \left( \prod _{j\in \{1,\dots ,m\}\backslash \{j_0\}}n_j,p^h+1\right) \ne 1\); \(J=\{j_0\}\) and \(\Delta =\Delta _2\), in which case

    $$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1). \end{aligned}$$
  3. (3)

    \(P_j=U_{n_j}\) for some \(n_j\) such that \(n_j\mid q-1\) when \(j\in S_1\) and when \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=S_1\cup \{j_0\}\) and \(\Delta =\Delta ^*_1\), in which case

    $$\begin{aligned} (r,\delta )=(2u+2,p^h-2u). \end{aligned}$$
  4. (4)

    \(S_1=\emptyset \) and for all \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=\{j_0\}\) and \(\Delta =\Delta ^*_2\), in which case

    $$\begin{aligned} (r,\delta )=(2u+2,p^h-2u). \end{aligned}$$

For the second construction, we use the notation as in the paragraph before Lemma 5.7 but changing i by \(j_0\). Define

$$\begin{aligned}{} & {} \Delta _1:=\{0,1,\dots ,n_1-1\}\times \cdots \times \{0,1,\dots ,n_{j_0-1}-1\} \\{} & {} \qquad \qquad \times \Omega \times \{0,1,\dots ,n_{j_0+1}-1\} \times \cdots \times \{0,1,\dots ,n_m-1\}, \\{} & {} \Delta _2:=\Delta _1\big \backslash \left\{ (n_1-1,\dots ,n_{j_0-1}-1,e_{j_0},n_{j_0+1}-1,\dots ,n_m-1) \mid e_{j_0} \in \left\{ 1,2^h\right\} \right\} , \\{} & {} \Delta ^\perp _1:=\{0,1,\dots ,n_1-1\}\times \cdots \times \{0,1,\dots ,n_{j_0-1}-1\}\\{} & {} \qquad \qquad \times \Omega ^\perp \times \{0,1,\dots ,n_{j_0+1}-1\} \times \cdots \times \{0,1,\dots ,n_m-1\} \end{aligned}$$

and

$$\begin{aligned} \Delta ^\perp _2:=\Delta ^\perp _1\big \backslash \left\{ (n_1-1,\dots ,n_{j_0-1}-1,e_{j_0},n_{j_0+1}-1,\dots ,n_m-1) \mid e_{j_0} \in \left. {\left\{ \begin{array}{ll} \{0\}, &{} \text {when } z=2,\\ \{0,2,2^h-1\}, &{} \text {otherwise.} \end{array}\right. }\right\} \right\} . \end{aligned}$$

Proposition 5.14

Keep the notation as above where \(\;{\mathbb {F}}_{2^h}\) is regarded as a subfield of \(\;{\mathbb {F}}_{q=2^{2\,h}}\). Fixed \(j_0\) and \(P_{j_0}=U_{2^h+1}\cup \{0\}\), the set of \(\; 2^h+1\)-th roots of unity together with 0, the following statements determine sets \(P=P_1\times \cdots \times P_m\), J and \(\Delta \) such that the subfield-subcodes \(S_\Delta ^{P,J}\) over the field \({\mathbb {F}}_{2^h}\) are optimal \((r,\delta )\)-LRCs:

  1. (1)

    \(P_j=U_{n_j}\) for some \(n_j\) such that \(n_j\mid q-1\) whenever \(j\in S_1\) and when \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=S_1\) and \(\Delta =\Delta _1\), in which case

    $$\begin{aligned} (r,\delta )=(3,2^h). \end{aligned}$$
  2. (2)

    \(P_j=U_{n_j}\) for some \(n_j\) such that \(n_j\mid q-1\) whenever \(j\in S_1\) and when \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=S_1\) and \(\Delta =\Delta _1^\perp \), in which case

    $$\begin{aligned} (r,\delta )=(2^h-1,4). \end{aligned}$$
  3. (3)

    \(S_1=\emptyset \) and for all \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta _2\), in which case

    $$\begin{aligned} (r,\delta )=(3,2^h). \end{aligned}$$
  4. (4)

    \(S_1=\emptyset \) and for all \(j\in S_2\) \(P_j=U_{n_j-1}\cup \{0\}\) for some \(n_j\) such that \(n_j-1\mid q-1\); \(J=\emptyset \) and \(\Delta =\Delta ^\perp _2\), in which case

    $$\begin{aligned} (r,\delta )=(2^h-1,4). \end{aligned}$$

Remark 5.15

As in the case of bivariate codes (see Remark 5.9), Propositions 5.13 and 5.14 do not give an exhaustive list of the optimal \((r,\delta )\)-LRCs one can get from subfield-subcodes of MCCs, in fact they impose conditions in order to obtain new families of optimal \((r,\delta )\)-LRCs. See the beginning of this section.

Finally, we state our main results for the multivariate case. They are Theorem 5.16 (respectively, 5.17) which give parameters and \((r,\delta )\)-localities of the optimal \((r,\delta )\)-LRCs we have obtained in Proposition 5.13 (respectively, 5.14).

Theorem 5.16

Let \(\;{\mathbb {F}}_q\) be a finite field with \(q=p^l\), p being a prime number and l a positive integer. Consider another positive integer h such that h divides l, \(p^h\ge 4\) if \(p=2\) (\(p^h\ge 5\) otherwise) and assume \(p^h+1\mid q-1\). Consider also nonnegative integers z and t satisfying \(0\le t<z \le \lfloor \frac{p^h}{2} \rfloor -1\), \(2t\ge \max \{0,4z-p^h-1\}\) and subsets \(S_1\), \(S_2\subseteq \{1,\dots ,m-1\}\) such that \(S_1\cup S_2=\{1,\dots ,m-1\}\) and \(S_1\cap S_2=\emptyset \). Regard \(\; {\mathbb {F}}_{p^h}\) as a subfield of \(\;{\mathbb {F}}_q\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{p^h}\) with the following parameters depending on the integer variables \(n_1,\dots ,n_{m-1}\) and a:

$$\begin{aligned}{}[n,k,d]_{p^h}=\left[ (p^h+1)n_1\cdots n_{m-1},(2z+1)n_1\cdots n_{m-1}-a,p^h+1-2z+a\right] _{p^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(2z+1,p^h-2z+1), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n_j\mid q-1\) for all \(j\in S_1\), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \(a=0\).

  2. (2)

    \(S_1=\emptyset \), \(n_j-1\mid q-1\) for all \(j\in S_2\), \(a=2(z-t)\) and, if p is odd, either \(\gcd \left( n_1 \cdots n_{m-1},p^h\right) \ne 1\) or \(\gcd \left( n_1 \cdots n_{m-1},p^h+1\right) \ne 1\).

Assume now that \(p=2\) and consider a nonnegative integer u and, if \(u\ge 1\), a nonnegative integer v, satisfying \(0\le u\le \frac{p^h}{2}-2\), \(0\le v<u\) and \(2v+1\ge \max \{0,4u+1-p^h\}\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{p^h}\) with parameters

$$\begin{aligned}{}[n,k,d]_{p^h}=\left[ (p^h+1)n_1\cdots n_{m-1},(2u+2)n_1\cdots n_{m-1}-a,p^h-2u+a\right] _{p^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(2u+2,p^h-2u), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n_j\mid q-1\) for all \(j\in S_1\), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \(a=0\).

  2. (2)

    \(S_1=\emptyset \), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \(a=2(u-v)\).

Theorem 5.17

Let \(\;{\mathbb {F}}_q\) be a finite field with \(q=2^l\), \(l\ge 4\) being an even positive integer and \(h=\frac{l}{2}\). Consider also a positive integer z satisfying \(2\le z\le 3\), \(2^h-2z+1\ge \max \left\{ 0,2^h-6\right\} \) and subsets \(S_1\), \(S_2\subseteq \{1,\dots ,m-1\}\) such that \(S_1\cup S_2=\{1,\dots ,m-1\}\) and \(S_1\cap S_2=\emptyset \). Regard \(\; {\mathbb {F}}_{2^h}\) as a subfield of \(\;{\mathbb {F}}_q\).

Then, there exists an optimal \((r,\delta )\)-LRC over \(\;{\mathbb {F}}_{2^h}\) with the following parameters depending on the integer variables \(n_1,\dots ,n_{m-1}\), a, b and c:

$$\begin{aligned}{}[n,k,d]_{2^h}=\left[ (2^h+2)n_1\cdots n_{m-1},an_1\cdots n_{m-1}-b,c+b\right] _{2^h} \end{aligned}$$

and

$$\begin{aligned} (r,\delta )=(a,c), \end{aligned}$$

whenever some of the following conditions hold:

  1. (1)

    \(n_j\mid q-1\) for all \(j\in S_1\), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \((a,b,c)=(3,0,2^h)\).

  2. (2)

    \(n_j\mid q-1\) for all \(j\in S_1\), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \((a,b,c)=(2^h-1,0,4)\).

  3. (3)

    \(S_1=\emptyset \), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \((a,b,c)=(3,2,2^h)\).

  4. (4)

    \(S_1=\emptyset \), \(n_j-1\mid q-1\) for all \(j\in S_2\) and \((a,b,c)=(2^h-1,2z-3,4)\).

We finish this paper by giving, in Table 2, the parameters of some new optimal \((r,\delta )\)-LRCs coming from subfield-subcodes deduced from Theorems 5.16 and 5.17.

Table 2 Optimal \((r,\delta )\)-subfield-subcodes over \({\mathbb {F}}_{p^h}\)