1 Introduction

Let \(S=K[t_1,\ldots ,t_s]=\oplus _{d=0}^{\infty } S_d\) be a polynomial ring over a field K with the standard grading, and let \(I\ne (0)\) be a graded ideal of S. In this work, we extend the scope of [25] by considering generalized footprint and minimum distance functions. Given \(d,r\in {\mathbb {N}}_+\), let \({\mathcal {F}}_{d,r}\) be the set:

$$\begin{aligned} {\mathcal {F}}_{d,r}:= & {} \{\, \{f_1,\ldots ,f_r\}\subset S_d\, \vert \, \overline{f}_1,\ldots ,\overline{f}_r\, \text{ are } \text{ linearly } \text{ independent } \text{ over } \\&K, (I:(f_1,\ldots ,f_r))\ne I\}, \end{aligned}$$

where \(\overline{f}=f+I\) is the class of f modulo I and \((I:(f_1,\ldots ,f_r))=\{g\in S \vert gf_i \in I,\,\forall \, i\}\) is referred to as an ideal quotient or colon ideal.

We denote the degree of S / I by \(\deg (S/I)\). The function \(\delta _I:{\mathbb {N}}_+\times {\mathbb {N}}_+\rightarrow \mathbb {Z}\) given by

$$\begin{aligned} \delta _I(d,r):=\left\{ \begin{array}{ll}\deg (S/I)-\max \{\deg (S/(I,F))\vert \, F\in {\mathcal {F}}_{d,r}\}&{}\quad \text{ if } \,{\mathcal {F}}_{d,r}\ne \emptyset ,\\ \deg (S/I)&{}\quad \text{ if } \,{\mathcal {F}}_{d,r}=\emptyset , \end{array}\right. \end{aligned}$$

is called the generalized minimum distance function of I, or simply the gmd function of I. If \(r=1\), one obtains the minimum distance function of I [25]. To compute \(\delta _I(d,r)\) is a difficult problem. One of our aims is to introduce lower bounds for \(\delta _I(d,r)\) which are easier to compute.

Fix a monomial order \(\prec \) on S. Let \(\mathrm{in}_\prec (I)\) be the initial ideal of I, and let \(\Delta _\prec (I)\) be the footprint of S / I consisting of all the standard monomials of S / I with respect to \(\prec \). The footprint of S / I is also called the Gröbner éscalier of I. Given integers \(d,r\ge 1\), let \(\mathcal {M}_{\prec , d, r}\) be the set of all subsets M of \(\Delta _\prec (I)_d:=\Delta _\prec (I)\cap S_d\) with r distinct elements such that \((\mathrm{in}_\prec (I):(M))\ne \mathrm{in}_\prec (I)\). The generalized footprint function of I, denoted \(\mathrm{fp}_I\), is the function \(\mathrm{fp}_I:{\mathbb {N}}_+\times {\mathbb {N}}_+\rightarrow \mathbb {Z}\) given by

$$\begin{aligned} \mathrm{fp}_I(d,r):=\left\{ \begin{array}{ll}\deg (S/I)-\max \{\deg (S/(\mathrm{in}_\prec (I),M))\,\vert \, M\in \mathcal {M}_{\prec , d,r}\}&{}\quad \text{ if } \quad \mathcal {M}_{\prec , d,r}\ne \emptyset ,\\ \deg (S/I)&{}\quad \text{ if } \quad \mathcal {M}_{\prec , d,r}=\emptyset . \end{array}\right. \end{aligned}$$

If \(r=1\), one obtains the footprint function of I that was studied in [28] from a theoretical point of view (see [25, 26] for some applications). The footprint of vanishing ideals of finite sets of affine points was used in the works of Geil [9] and Carvalho [3] to study affine Reed–Muller-type codes. Long before these two papers appeared, the footprint was used by Geil in connection with all kinds of codes (including one-point algebraic geometric codes); see [10,11,12] and the references therein.

The definition of \(\delta _I(d,r)\) was motivated by the notion of generalized Hamming weight of a linear code [19, 21, 37]. For convenience we recall this notion. Let \(K={\mathbb {F}}_q\) be a finite field, and let C be a [mk] linear code of lengthm and dimensionk, that is, C is a linear subspace of \(K^m\) with \(k=\dim _K(C)\). Let \(1\le r\le k\) be an integer. Given a subcode D of C (that is, D is a linear subspace of C), the support\(\chi (D)\) of D is the set of nonzero positions of D, that is,

$$\begin{aligned} \chi (D):=\{i\,\vert \, \exists \, (a_1,\ldots ,a_m)\in D,\, a_i\ne 0\}. \end{aligned}$$

The rth generalized Hamming weight of C, denoted \(\delta _r(C)\), is the size of the smallest support of an r-dimensional subcode. Generalized Hamming weights have received a lot of attention; see [3, 6, 9, 15, 18, 20, 30, 32, 35, 37,38,39] and the references therein. The study of these weights is related to trellis coding, t–resilient functions, and was motivated by some applications from cryptography [37].

The minimum distance of projective Reed–Muller-type codes has been studied using Gröbner bases and commutative algebra techniques; see [3, 4, 9, 13, 25, 31] and the references therein. In this work, we extend these techniques to study the rth generalized Hamming weight of projective Reed–Muller-type codes. These linear codes are constructed as follows.

Let \(K={\mathbb {F}}_q\) be a finite field with q elements, let \(\mathbb {P}^{s-1}\) be a projective space over K, and let \({\mathbb {X}}\) be a subset of \(\mathbb {P}^{s-1}\). The vanishing ideal of \({\mathbb {X}}\), denoted \(I({\mathbb {X}})\), is the ideal of S generated by the homogeneous polynomials that vanish at all points of \({\mathbb {X}}\). The Hilbert function of \(S/I({\mathbb {X}})\) is denoted by \(H_{\mathbb {X}}(d)\). We can write \({\mathbb {X}}=\{[P_1],\ldots ,[P_m]\}\subset \mathbb {P}^{s-1}\) with \(m=|{\mathbb {X}}|\). Here, we assume that the first nonzero entry of each \([P_i]\) is 1. In the special case that \({\mathbb {X}}\) has the form \([X\times \{1\}]\) for some \(X\subset {\mathbb {F}}_q^{s-1}\), we assume that the sth entry of each \([P_i]\) is 1.

Fix a degree \(d\ge 1\). There is a K-linear map given by

$$\begin{aligned} \mathrm{ev}_d:S_d\rightarrow K^{m},\ \ \ \ \ f\mapsto \left( f(P_1),\ldots ,f(P_m)\right) . \end{aligned}$$

The image of \(S_d\) under \(\mathrm{ev}_d\), denoted by \(C_{\mathbb {X}}(d)\), is called a projective Reed–Muller-type code of degree d on \({\mathbb {X}}\) [7, 16]. The points in \({\mathbb {X}}\) are often called evaluation points in the algebraic coding context. The parameters of the linear code \(C_{\mathbb {X}}(d)\) are:

  1. (a)

    length: \(|{\mathbb {X}}|\),

  2. (b)

    dimension: \(\dim _K C_{\mathbb {X}}(d)\),

  3. (c)

    rth generalized Hamming weight: \(\delta _{\mathbb {X}}(d,r):=\delta _r(C_{\mathbb {X}}(d))\).

The contents of this paper are as follows. In Sect. 2, we present some of the results and terminology that will be needed throughout the paper. If F is a finite set of homogeneous polynomials of \(S\setminus \{0\}\) and \(V_{\mathbb {X}}(F)\) is the set of zeros or projective variety of F in \({\mathbb {X}}\), over a finite field, we show a degree formula for counting the number of points in \({\mathbb {X}}\) that are not in \(V_{{\mathbb {X}}}(F)\):

$$\begin{aligned} |{\mathbb {X}}\setminus V_{{\mathbb {X}}}(F)|=\left\{ \begin{array}{ll} \deg (S/(I({\mathbb {X}}):(F)))&{}\quad \text{ if } \,(I({\mathbb {X}}):(F))\ne I({\mathbb {X}}),\\ \deg (S/I({\mathbb {X}}))&{}\quad \text{ if } \,(I({\mathbb {X}}):(F))=I({\mathbb {X}}), \end{array} \right. \end{aligned}$$

and a degree formula for counting the zeros of F in \({\mathbb {X}}\) (Lemmas 3.2 and 3.4). These degree formulas turn out to be useful in order to prove one of our main results (Theorem 4.9).

If \({\mathbb {X}}\) is a finite set of projective points over a finite field and \(I({\mathbb {X}})\) is its vanishing ideal, we show that \(\delta _{I({\mathbb {X}})}(d,r)\) is the rth generalized Hamming weight \(\delta _{\mathbb {X}}(d,r)\) of the corresponding Reed–Muller-type code \(C_{\mathbb {X}}(d)\) (Theorem 4.5). We introduce the Vasconcelos function \(\vartheta _I(d,r)\) of a graded ideal I (Definition 4.4) and show that \(\vartheta _{I({\mathbb {X}})}(d,r)\) is also equal to \(\delta _{\mathbb {X}}(d,r)\) (Theorem 4.5). These two abstract algebraic formulations of \(\delta _{\mathbb {X}}(d,r)\) give us a new tool to study generalized Hamming weights. One of our main results shows that \(\mathrm{fp}_{I({\mathbb {X}})}(d,r)\) is a lower bound for \(\delta _{\mathbb {X}}(d,r)\) (Theorem 4.9). The footprint matrix\((\mathrm{fp}_{I({\mathbb {X}})}(d,r))\) and the weight matrix\((\delta _{{\mathbb {X}}}(d,r))\) of \(I({\mathbb {X}})\) are the matrices of size \(\mathrm{reg}(S/I({\mathbb {X}}))\times \deg (S/I({\mathbb {X}}))\) whose (dr)-entries are \(\mathrm{fp}_{I({\mathbb {X}})}(d,r)\) and \(\delta _{{\mathbb {X}}}(d,r)\), respectively (see Remark 4.6). In certain cases, the rth columns of these two matrices are equal (Example 6.3, Theorem 9.5). The entries of each row of the weight matrix \((\delta _{{\mathbb {X}}}(d,r))\) form an increasing sequence until they stabilize [37]. For parameterized codes, the entries of each column of the weight matrix \((\delta _{{\mathbb {X}}}(d,r))\) form a decreasing sequence until they stabilize [14, Theorem 12].

In Sect. 5, we introduce projective nested Cartesian codes [4], a type of evaluation codes that generalize the classical projective Reed–Muller codes [22, 27, 33]. It is an interesting open problem to find an explicit formula for the minimum distance of a projective nested Cartesian code. Using footprints and the integer inequality of Lemma 5.3, we show a uniform upper bound for the number of zeros in a projective nested Cartesian set \({\mathcal {X}}\) for a family of homogeneous polynomials of fixed degree d, where d is close to the regularity of the ideal \(I({\mathcal {X}})\) (Theorem 5.5). For projective spaces, this upper bound agrees with the classical upper bound of Sørensen and Serre [33, p. 1569].

As an application of our methods using generalized minimum distance functions, we were able to find a simple counterexample to a conjecture of Carvalho et al. [4, 25, Conjecture 6.2] (Example 6.1). In Sects. 6 and 7, we show some examples and implementations in Macaulay2 [17] that illustrate how some of our results can be used in practice. A finite set of generators for the vanishing ideal of a projective space, over a finite field, was found by Mercier and Rolland [27, Corollaire 2.1]. More generally, for the vanishing ideal of a projective nested Cartesian set a finite set of generators was determined in [4, Lemma 2.4]. These results are especially useful for computational purposes (Examples 6.1 and 6.4).

To show some other applications to algebraic coding theory, we prove the following interesting and non-trivial inequality.

Theorem 8.5 Let\(d\ge 1\) and \(1\le e_1\le \cdots \le e_m\) be integers. Suppose \(1\le a_i\le e_i\) and \(1\le b_i\le e_i\), for \(i=1,\ldots ,m\), are integers such that \(d=\sum _ia_i=\sum _i b_i\) and \(a\ne b\). Then,

$$\begin{aligned} \pi (a,b)\ge \left( \sum _{i=1}^m a_i-\sum _{i=k+1}^me_i-(k-2)\right) e_{k+1}\cdots e_m-e_{k+2}\cdots e_m \end{aligned}$$

for \(k=1,\ldots ,m-1\), where \(\pi (a,b)=\prod _{i=1}^ma_i+\prod _{i=1}^mb_i-\prod _{i=1}^m\min (a_i,b_i)\).

We give two more applications. The first is the following explicit formula for the second generalized Hamming weight of an affine Cartesian code.

Theorem 9.3 Let \(A_i\), \(i=1,\ldots ,s-1\), be subsets of \({\mathbb {F}}_q\), and let \({\mathbb {X}}\subset \mathbb {P}^{s-1}\) be the projective set \({\mathbb {X}}=[A_1\times \cdots \times A_{s-1}\times \{1\}]\). If \(d_i=|A_i|\) for \(i=1,\ldots ,s-1\) and \(2\le d_1\le \cdots \le d_{s-1}\), then

$$\begin{aligned} \delta _{\mathbb {X}}(d,2)=\left\{ \begin{array}{ll}\left( d_{k+1}-\ell +1\right) d_{k+2}\cdots d_{s-1}-d_{k+3}\cdots d_{s-1}&{}\quad \text{ if } \, k<s-3,\\ \left( d_{k+1}-\ell +1\right) d_{k+2}\cdots d_{s-1}-1&{}\quad \text{ if } \, k=s-3,\\ \quad d_{s-1}-\ell +1&{}\quad \text{ if } \, k=s-2, \end{array} \right. \end{aligned}$$

where \(0\le k\le s-2\) and \(\ell \) are integers, \(d=\sum _{i=1}^{k}\left( d_i-1\right) +\ell \), and \(1\le \ell \le d_{k+1}-1\).

Using this result, one recovers the case when \({\mathbb {X}}\) is a projective torus in \(\mathbb {P}^{s-1}\) [14, Theorem 18] (Corollary 9.4). The second application of this paper gives a combinatorial formula for the second generalized Hamming weight of an affine Cartesian code, which is quite different from the corresponding formula of [1, Theorem 5.4], and shows that in this case the second generalized Hamming weight is equal to the second generalized footprint.

Theorem 9.5Let\(\mathcal {P}_d\) be the set of all pairs (ab), ab in \({\mathbb {N}}^s\), \(a=(a_i)\), \(b=(b_i)\), such that \(a\ne b\), \(d=\sum _ia_i=\sum _ib_i\), \(1\le a_i,b_i\le d_i-1\) for \(i=1,\ldots ,n\), \(n:=s-1\), \(a_i\ne 0\) and \(b_j\ne 0\) for some \(1\le i,j\le n\). If \({\mathbb {X}}=[A_1\times \cdots \times A_{n}\times \{1\}]\), with \(A_i\subset {\mathbb {F}}_q\), \(d_i=|A_i|\), and \(2\le d_1\le \cdots \le d_{n}\), then

$$\begin{aligned} \mathrm{fp}_{I({\mathbb {X}})}(d,2)=\delta _{\mathbb {X}}(d,2)=\min \left\{ P(a,b)\vert \, (a,b)\in \mathcal {P}_d\right\} \ \text{ for } \ d\le \textstyle \sum _{i=1}^n (d_i-1), \end{aligned}$$

where \(P(a,b)=\prod _{i=1}^{n}(d_i-a_i)+ \prod _{i=1}^{n}(d_i-b_i)-\prod _{i=1}^{n}\min \{d_i-a_i,d_i-b_i\}\).

In case the set of evaluation points \({\mathbb {X}}\) lie on an affine algebraic variety over a finite field \({\mathbb {F}}_q\), the work done by Heijnen and Pellikaan [18], though formulated in a different language, relates footprints and generalized Hamming weights and introduces methods to study affine Cartesian codes (cf. [18, Section 7]). These methods were used in [1] to determine the generalized Hamming weights of these codes.

There is a nice combinatorial formula to compute the generalized Hamming weights of q-ary Reed–Muller codes [18, Theorem 3.14], and there is an easy-to-evaluate formula for the second generalized Hamming weight of a projective torus [14, Theorem 18]. There is also a recent expression for the rth generalized Hamming weight of an affine Cartesian code [1, Theorem 5.4], which depends on the rth monomial in ascending lexicographic order of a certain family of monomials. It is an interesting problem to find alternative, easy-to-evaluate formulas for the rth generalized Hamming weight of an affine Cartesian code.

For all unexplained terminology and additional information, we refer to [2, 5, 8] (for the theory of Gröbner bases, commutative algebra, and Hilbert functions) and [24, 35] (for the theory of error-correcting codes and linear codes).

2 Preliminaries

In this section, we present some of the results that will be needed throughout the paper and introduce some more notations. All results of this section are well known. To avoid repetitions, we continue to employ the notations and definitions used in Sect. 1.

Generalized Hamming weights Let \(K={\mathbb {F}}_q\) be a finite field, and let C be a [mk] linear code of lengthm and dimensionk.

The rth generalized Hamming weight of C, denoted \(\delta _r(C)\), is the size of the smallest support of an r-dimensional subcode, that is,

$$\begin{aligned} \delta _r(C):=\min \{|\chi (D)|\,:\, D \text{ is } \text{ a } \text{ linear } \text{ subcode } \text{ of } C \text{ with } \dim _K(D)=r\}. \end{aligned}$$

   The weight hierarchy of C is the sequence \((\delta _1(C),\ldots ,\delta _k(C))\). The integer \(\delta _1(C)\) is called the minimum distance of C and is denoted by \(\delta (C)\). According to [37, Theorem 1, Corollary 1], the weight hierarchy is an increasing sequence

$$\begin{aligned} 1\le \delta _1(C)<\cdots <\delta _k(C)\le m, \end{aligned}$$

and \(\delta _r(C)\le m-k+r\) for \(r=1,\ldots ,k\). For \(r=1\), this is the Singleton bound for the minimum distance. Notice that \(\delta _r(C)\ge r\).

Recall that the support\(\chi (\beta )\) of a vector \(\beta \in K^m\) is \(\chi (K\beta )\), that is, \(\chi (\beta )\) is the set of nonzero entries of \(\beta \).

Lemma 2.1

Let D be a subcode of C of dimension \(r\ge 1\). If \(\beta _1,\ldots ,\beta _r\) is a K-basis for D with \(\beta _i=(\beta _{i,1},\ldots ,\beta _{i,m})\) for \(i=1,\ldots ,r\), then \(\chi (D)=\cup _{i=1}^r\chi (\beta _i)\) and the number of elements of \(\chi (D)\) is the number of nonzero columns of the matrix:

$$\begin{aligned} \left[ \begin{matrix} \beta _{1,1}&{}\cdots &{}\beta _{1,i}&{}\cdots &{}\beta _{1,m}\\ \beta _{2,1}&{}\cdots &{}\beta _{2,i}&{}\cdots &{}\beta _{2,m}\\ \vdots &{}\cdots &{}\vdots &{}\cdots &{}\vdots \\ \beta _{r,1}&{}\cdots &{}\beta _{r,i}&{}\cdots &{}\beta _{r,m} \end{matrix}\right] . \end{aligned}$$

Commutative algebra Let \(I\ne (0)\) be a graded ideal of S of Krull dimension k. The Hilbert function of S / I is:

$$\begin{aligned} H_I(d):=\dim _K(S_d/I_d),\ \ \ d=0,1,2,\ldots , \end{aligned}$$

where \(I_d=I\cap S_d\). By a theorem of Hilbert [34, p. 58], there is a unique polynomial \(h_I(x)\in \mathbb {Q}[x]\) of degree \(k-1\) such that \(H_I(d)=h_I(d)\) for \(d\gg 0\). The degree of the zero polynomial is \(-1\).

The degree or multiplicity of S / I is the positive integer

$$\begin{aligned} \deg (S/I):=\left\{ \begin{array}{ll}(k-1)!\, \lim _{d\rightarrow \infty }{H_I(d)}/{d^{k-1}} &{}\quad \text{ if } \,k\ge 1,\\ \dim _K(S/I) &{}\quad \text{ if } \,k=0. \end{array}\right. \end{aligned}$$

We will use the following multi-index notation: for \(a=(a_1,\ldots ,a_s)\in {\mathbb {N}}^s\), set \(t^a:=t_1^{a_1}\cdots t_s^{a_s}\). The multiplicative group of the field K is denoted by \(K^*\). As usual, \(\mathrm{ht}(I)\) will denote the height of the ideal I. By the dimension of I (resp. S / I), we mean the Krull dimension of S / I. The Krull dimension of S / I is denoted by \(\dim (S/I)\).

One of the most useful and well-known facts about the degree is its additivity:

Proposition 2.2

(Additivity of the degree [29, Proposition 2.5]) If I is an ideal of S and \(I=\mathfrak {q}_1\cap \cdots \cap \mathfrak {q}_m\) is an irredundant primary decomposition, then

$$\begin{aligned} \deg (S/I)=\sum _{\mathrm{ht}(\mathfrak {q}_i)=\mathrm{ht}(I)}\deg (S/\mathfrak {q}_i). \end{aligned}$$

If \(F\subset S\), the ideal quotient of I with respect to (F) is given by \((I:(F))=\{h\in S\vert \, hF\subset I\}\). An element f is called a zero divisor of S / I if there is \(\overline{0}\ne \overline{a}\in S/I\) such that \(f\overline{a}=\overline{0}\), and f is called regular on S / I if f is not a zero divisor. Thus, f is a zero divisor if and only if \((I:f)\ne I\). An associated prime of I is a prime ideal \({\mathfrak {p}}\) of S of the form \({\mathfrak {p}}=(I:f)\) for some f in S.

Theorem 2.3

[36, Lemma 2.1.19,Corollary 2.1.30] If I is an ideal of S and \(I=\mathfrak {q}_1\cap \cdots \cap \mathfrak {q}_m\) is an irredundant primary decomposition with \(\mathrm{rad}(\mathfrak {q}_i)={\mathfrak {p}}_i\), then the set of zero divisors \(\mathcal {Z}(S/I)\) of S / I is equal to \(\bigcup _{i=1}^m{\mathfrak {p}}_i\), and \({\mathfrak {p}}_1,\ldots ,{\mathfrak {p}}_m\) are the associated primes of I.

Definition 2.4

The regularity of S / I, denoted \(\mathrm{reg}(S/I)\), is the least integer \(r_0\ge 0\) such that \(H_I(d)\) is equal to \(h_I(d)\) for \(d\ge r_0\).

The footprint of an ideal Let \(\prec \) be a monomial order on S, and let \((0)\ne I\subset S\) be an ideal. If f is a nonzero polynomial in S, the leading monomial of f is denoted by \(\mathrm{in}_\prec (f)\). The initial ideal of I, denoted by \(\mathrm{in}_\prec (I)\), is the monomial ideal given by

$$\begin{aligned} \mathrm{in}_\prec (I)=(\{\mathrm{in}_\prec (f)|\, f\in I\}). \end{aligned}$$

A monomial \(t^a\) is called a standard monomial of S / I, with respect to \(\prec \), if \(t^a\) is not in the ideal \(\mathrm{in}_\prec (I)\). A polynomial f is called standard if \(f\ne 0\) and f is a K-linear combination of standard monomials. The set of standard monomials, denoted \(\Delta _\prec (I)\), is called the footprint of S / I. The image of the standard polynomials of degree d, under the canonical map \(S\mapsto S/I\), \(x\mapsto \overline{x}\), is equal to \(S_d/I_d\), and the image of \(\Delta _\prec (I)\) is a basis of S / I as a K-vector space. This is a classical result of Macaulay (for a modern approach see [5, Chapter 5]). In particular, if I is graded, then \(H_I(d)\) is the number of standard monomials of degree d.

Lemma 2.5

[3, p. 2] Let \(I\subset S\) be an ideal generated by \(\mathcal {G}=\{g_1,\ldots ,g_r\}\), then

$$\begin{aligned} \Delta _\prec (I)\subset \Delta _\prec (\mathrm{in}_\prec (g_1),\ldots ,\mathrm{in}_\prec (g_r)). \end{aligned}$$

Vanishing ideal of a finite set The projective space of dimension \(s-1\) over the field K is denoted \(\mathbb {P}^{s-1}\). It is usual to denote the equivalence class of \(\alpha \) by \([\alpha ]\).

For a given a subset \({\mathbb {X}}\subset \mathbb {P}^{s-1}\) define \(I({\mathbb {X}})\), the vanishing ideal of \({\mathbb {X}}\), as the ideal generated by the homogeneous polynomials in S that vanish at all points of \({\mathbb {X}}\), and given a graded ideal \(I\subset S\) define its zero set relative to \({\mathbb {X}}\) as

$$\begin{aligned}V_{\mathbb {X}}(I)=\left\{ [\alpha ]\in {\mathbb {X}}\vert \, f(\alpha )=0\,\, \forall f\in I\, \text{ homogeneous } \right\} . \end{aligned}$$

In particular, if \(f\in S\) is homogeneous, the zero set \(V_{\mathbb {X}}(f)\) of f is the set of all \([\alpha ]\in {\mathbb {X}}\) such that \(f(\alpha )=0\), that is \(V_{\mathbb {X}}(f)\) is the set of zeros of f in \({\mathbb {X}}\).

Lemma 2.6

Let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\), let \([\alpha ]\) be a point in \({\mathbb {X}}\) with \(\alpha =(\alpha _1,\ldots ,\alpha _s)\) and \(\alpha _k\ne 0\) for some k, and let \(I_{[\alpha ]}\) be the vanishing ideal of \([\alpha ]\). Then, \(I_{[\alpha ]}\) is a prime ideal,

$$\begin{aligned} I_{[\alpha ]}=(\{\alpha _kt_i-\alpha _it_k\vert \, k\ne i\in \{1,\ldots ,s\}),\ \deg (S/I_{[\alpha ]})=1,\, \end{aligned}$$

\(\mathrm{ht}(I_{[\alpha ]})=s-1\), and \(I({\mathbb {X}})=\bigcap _{[\beta ]\in {{\mathbb {X}}}}I_{[\beta ]}\) is the primary decomposition of \(I({\mathbb {X}})\).

Definition 2.7

The set \(\mathbb {T}=\{[(x_1,\ldots ,x_s)]\in \mathbb {P}^{s-1}\vert \, x_i\in K^*,\, \forall \, i\}\) is called a projective torus.

3 Computing the number of points of a variety

In this section, we give a degree formula to compute the number of solutions of a system of homogeneous polynomials over any given finite set of points in a projective space over a field.

Lemma 3.1

Let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\) over a field K. If \(F=\{f_1,\ldots ,f_r\}\) is a set of homogeneous polynomials of \(S\setminus \{0\}\), then \(V_{\mathbb {X}}(F)=\emptyset \) if and only if \((I({\mathbb {X}}):(F))=I({\mathbb {X}})\).

Proof

\(\Rightarrow \)) We proceed by contradiction assuming that \(I({\mathbb {X}})\subsetneq (I({\mathbb {X}}):(F))\). Pick a homogeneous polynomial g such that \(gf_i\in I({\mathbb {X}})\) for all i and \(g\notin I({\mathbb {X}})\). Then, there is \([\alpha ]\) in \(\mathbb {{\mathbb {X}}}\) such that \(g(\alpha )\ne 0\). Thus, \(f_i(\alpha )=0\) for all i, that is, \([\alpha ]\in V_\mathbb {{\mathbb {X}}}(F)\), a contradiction.

\(\Leftarrow \)) We can write \({\mathbb {X}}=\{[P_1],\ldots ,[P_m]\}\) and \(I({\mathbb {X}})=\cap _{i=1}^m{\mathfrak {p}}_i\), where \({\mathfrak {p}}_i\) is equal to \(I_{[P_i]}\), the vanishing ideal of \([P_i]\). We proceed by contradiction assuming that \(V_{\mathbb {X}}(F)\ne \emptyset \). Pick \([P_i]\) in \(V_{\mathbb {X}}(F)\). For simplicity of notation assume that \(i=1\). Notice that \(({\mathfrak {p}}_1:(F))=(1)\). Therefore,

$$\begin{aligned} \bigcap _{i=1}^m{\mathfrak {p}}_i=I({\mathbb {X}})=(I({\mathbb {X}}):(F))= \bigcap _{i=1}^m({\mathfrak {p}}_i:(F)) =\bigcap _{i=2}^m({\mathfrak {p}}_i:(F))\subset {\mathfrak {p}}_1. \end{aligned}$$

Hence, \({\mathfrak {p}}_i\subset ({\mathfrak {p}}_i:(F))\subset {\mathfrak {p}}_1\) for some \(i\ge 2\), see [36, p. 74]. Thus, \({\mathfrak {p}}_i={\mathfrak {p}}_1\), a contradiction. \(\square \)

An ideal \(I\subset S\) is called unmixed if all its associated primes have the same height, and I is called radical if I is equal to its radical. The radical of I is denoted by \(\mathrm{rad}(I)\).

Lemma 3.2

Let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\) over a field K, and let \(I({\mathbb {X}})\subset S\) be its vanishing ideal. If \(F=\{f_1,\ldots ,f_r\}\) is a set of homogeneous polynomials of \(S\setminus \{0\}\), then

$$\begin{aligned} |{\mathbb {X}}\setminus V_{{\mathbb {X}}}(F)|=\left\{ \begin{array}{ll} \deg (S/(I({\mathbb {X}}):(F)))&{}\quad \text{ if } \, (I({\mathbb {X}}):(F))\ne I({\mathbb {X}}),\\ \deg (S/I({\mathbb {X}}))&{}\,\,\,\text{ if } \, (I({\mathbb {X}}):(F))=I({\mathbb {X}}). \end{array} \right. \end{aligned}$$

Proof

Let \([P_1],\ldots ,[P_m]\) be the points of \({\mathbb {X}}\) with \(m=|{\mathbb {X}}|\), and let [P] be a point in \({\mathbb {X}}\) with \(P=(\alpha _1,\ldots ,\alpha _s)\) and \(\alpha _k\ne 0\) for some k. Then, the vanishing ideal \(I_{[P]}\) of [P] is a prime ideal of height \(s-1\),

$$\begin{aligned} I_{[P]}=(\{\alpha _kt_i-\alpha _it_k\vert \, k\ne i\in \{1,\ldots ,s\}),\ \deg (S/I_{[P]})=1, \end{aligned}$$

and \(I({\mathbb {X}})=\bigcap _{i=1}^mI_{[P_i]}\) is a primary decomposition (see Lemma 2.6).

Assume that \((I({\mathbb {X}}):(F))\ne I({\mathbb {X}})\). We set \(I=I({\mathbb {X}})\) and \({\mathfrak {p}}_i=I_{[P_i]}\) for \(i=1,\ldots ,m\). Notice that \(({\mathfrak {p}}_j:f_i)=(1)\) if and only if \(f_i\in {\mathfrak {p}}_j\) if and only if \(f_i(P_j)=0\). Then,

$$\begin{aligned} (I:(F))=\bigcap _{i=1}^r(I:f_i)=\left( \bigcap _{f_1(P_j)\ne 0}{\mathfrak {p}}_j\right) \bigcap \cdots \bigcap \left( \bigcap _{f_r(P_j)\ne 0}{\mathfrak {p}}_j\right) =\bigcap _{[P_j]\notin V_{\mathbb {X}}(F)}{\mathfrak {p}}_j. \end{aligned}$$

Therefore, by the additivity of the degree of Proposition 2.2, we get that \(\deg (S/(I:(F)))\) is equal to \(|{\mathbb {X}}\setminus V_{\mathbb {X}}(F)|\). If \((I({\mathbb {X}}):(F))=I({\mathbb {X}})\), then \(V_{\mathbb {X}}(F)=\emptyset \) (see Lemma 3.1). Thus, \(|V_{\mathbb {X}}(F)|=0\) and the required formula follows because \(|{\mathbb {X}}|=\deg (S/I({\mathbb {X}}))\). \(\square \)

Lemma 3.3

Let \(I\subset S\) be a radical unmixed graded ideal. If \(F=\{f_1,\ldots ,f_r\}\) is a set of homogeneous polynomials of \(S\setminus \{0\}\), \((I:(F))\ne I\), and \({\mathcal {A}}\) is the set of all associated primes of S / I that contain F, then \(\mathrm{ht}(I)=\mathrm{ht}(I,F)\), \({\mathcal {A}}\ne \emptyset \) and

$$\begin{aligned} \deg (S/(I,F))=\sum _{{\mathfrak {p}}\in {\mathcal {A}}}\deg (S/{\mathfrak {p}}). \end{aligned}$$

Proof

As \(I\subsetneq (I:(F))\), there is \(g\in S\setminus {I}\) such that \(g(F)\subset I\). Hence, the ideal (F) is contained in the set of zero divisors of S / I. Thus, by Theorem 2.3 and since I is unmixed, (F) is contained in an associated prime ideal \({\mathfrak {p}}\) of S / I of height \(\mathrm{ht}(I)\). Thus, \(I\subset (I,F)\subset {\mathfrak {p}}\), and consequently \(\mathrm{ht}(I)=\mathrm{ht}(I,F)\). Therefore, the set of associated primes of (IF) of height equal to \(\mathrm{ht}(I)\) is not empty and is equal to \({\mathcal {A}}\). There is an irredundant primary decomposition

$$\begin{aligned} (I,F)={\mathfrak {q}}_1\cap \cdots \cap {\mathfrak {q}}_n\cap {\mathfrak {q}}_{n+1}'\cap \cdots \cap {\mathfrak {q}}_t', \end{aligned}$$
(3.1)

where \(\mathrm{rad}({\mathfrak {q}}_i)=\mathfrak {p_i}\), \({\mathcal {A}}=\{{\mathfrak {p}}_1,\ldots ,{\mathfrak {p}}_n\}\), and \(\mathrm{ht}({\mathfrak {q}}_i')>\mathrm{ht}(I)\) for \(i>n\). We may assume that the associated primes of S / I are \({\mathfrak {p}}_1,\ldots ,{\mathfrak {p}}_m\) with \(n\le m\). Since I is a radical ideal, we get that \(I=\cap _{i=1}^m{\mathfrak {p}}_i\). Next, we show the following equality:

$$\begin{aligned} {\mathfrak {p}}_1\cap \cdots \cap {\mathfrak {p}}_m= {\mathfrak {q}}_1\cap \cdots \cap {\mathfrak {q}}_n\cap {\mathfrak {q}} _{n+1}'\cap \cdots \cap {\mathfrak {q}}_t' \cap {\mathfrak {p}}_{n+1}\cap \cdots \cap {\mathfrak {p}}_m. \end{aligned}$$
(3.2)

The inclusion “\(\supset \)” is clear because \({\mathfrak {q}}_i\subset {\mathfrak {p}}_i\) for \(i=1,\ldots ,n\). The inclusion “\(\subset \)” follows by noticing that the right-hand side of Eq. (3.2) is equal to \((I,f)\cap {\mathfrak {p}}_{n+1}\cap \cdots \cap {\mathfrak {p}}_m\), and consequently it contains \(I=\cap _{i=1}^m{\mathfrak {p}}_i\). Notice that \({\mathrm{rad}}({\mathfrak {q}}_j')={\mathfrak {p}}_j'\not \subset {\mathfrak {p}}_i\) for all ij and \({\mathfrak {p}}_j\not \subset {\mathfrak {p}}_i\) for \(i\ne j\). Hence, localizing Eq. (3.2) at the prime ideal \({\mathfrak {p}}_i\) for \(i=1,\ldots ,n\), we get that \({\mathfrak {p}}_i=I_{{\mathfrak {p}}_i}\cap S=({\mathfrak {q}}_i)_{{\mathfrak {p}}_i}\cap S={\mathfrak {q}}_i\) for \(i=1,\ldots ,n\). Using Eq. (3.1), together with the additivity of the degree of Proposition 2.2, the required equality follows. \(\square \)

Lemma 3.4

Let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\) over a field K, and let \(I({\mathbb {X}})\subset S\) be its vanishing ideal. If \(F=\{f_1,\ldots ,f_r\}\) is a set of homogeneous polynomials of \(S\setminus \{0\}\), then the number of points of \(V_{\mathbb {X}}(F)\) is given by

$$\begin{aligned} |V_{{\mathbb {X}}}(F)|=\left\{ \begin{array}{ll} \deg (S/(I({\mathbb {X}}),F))&{}\quad \text{ if } \, (I({\mathbb {X}}):(F))\ne I({\mathbb {X}}),\\ 0&{}\quad \text{ if } \, (I({\mathbb {X}}):(F))=I({\mathbb {X}}). \end{array} \right. \end{aligned}$$

Proof

Let \([P_1],\ldots ,[P_m]\) be the points of \({\mathbb {X}}\) with \(m=|{\mathbb {X}}|\). The vanishing ideal \(I_{[P_i]}\) of \([P_i]\) is a prime ideal of height \(s-1\), \(\deg (S/I_{[P_i]})=1\), and \(I({\mathbb {X}})=\bigcap _{i=1}^mI_{[P_i]}\) (see Lemma 2.6).

Assume that \((I({\mathbb {X}}):(F))\ne I({\mathbb {X}})\). Let \({\mathcal {A}}\) be the set of all \(I_{[P_i]}\) that contain the set F. Notice that \(f_j\in I_{[P_i]}\) if and only if \(f_j(P_i)=0\). Then, \([P_i]\) is in \(V_{\mathbb {X}}(F)\) if and only if \(F\subset I_{[P_i]}\). Thus, \([P_i]\) is in \(V_{\mathbb {X}}(F)\) if and only if \(I_{[P_i]}\) is in \({\mathcal {A}}\). Hence, by Lemma 3.3, we get

$$\begin{aligned} |V_{\mathbb {X}}(F)|=\sum _{[P_i]\in V_{\mathbb {X}}(F)}\deg (S/I_{[P_i]})=\sum _{F\subset I_{[P_i]}}\deg ( S/I_{[P_i]})=\deg (S/(I({\mathbb {X}}),F)). \end{aligned}$$

Assume that \((I({\mathbb {X}}):F)=I({\mathbb {X}})\). Then, by Lemma 3.1, \(V_{\mathbb {X}}(f)=\emptyset \) and \(|V_{\mathbb {X}}(f)|=0\). \(\square \)

Proposition 3.5

If \({\mathbb {X}}\) is a finite subset of \(\mathbb {P}^{s-1}\), then

$$\begin{aligned} \deg (S/I({\mathbb {X}}))=\deg (S/(I({\mathbb {X}}),F)) +\deg (S/(I({\mathbb {X}}):(F))). \end{aligned}$$

Proof

It follows from Lemmas 3.2 and 3.4. \(\square \)

4 Generalized minimum distance function of a graded ideal

In this part, we study the generalized minimum distance function of a graded ideal. To avoid repetitions, we continue to employ the notations and definitions used in Sects. 1 and 2.

Lemma 4.1

Let \(I\subset S\) be an unmixed graded ideal, and let \(\prec \) be a monomial order. If F is a finite set of homogeneous polynomials of S and \((I:(F))\ne I\), then

$$\begin{aligned} \deg (S/(I,F))\le \deg (S/(\mathrm{in}_\prec (I),\mathrm{in}_\prec (F)))\le \deg (S/I), \end{aligned}$$

and \(\deg (S/(I,F))<\deg (S/I)\) if I is an unmixed radical ideal and \((F)\not \subset I\).

Proof

To simplify notation, we set \(J=(I,F)\), \(L=(\mathrm{in}_\prec (I),\mathrm{in}_\prec (F))\), and \(F=\{f_1,\ldots ,f_r\}\). We denote the Krull dimension of S / I by \(\dim (S/I)\). Recall that \(\dim (S/I)=\dim (S)-\mathrm{ht}(I)\). First, we show that S / J and S / L have Krull dimension equal to \(\dim (S/I)\). As \(I\subsetneq (I:F)\), all elements of F are zero divisors of S / I. Hence, as I is unmixed, there is an associated prime ideal \({\mathfrak {p}}\) of S / I such that \((F)\subset {\mathfrak {p}}\) and \(\dim (S/I)=\dim (S/{\mathfrak {p}})\). Since \(I\subset J\subset {\mathfrak {p}}\), we get that \(\dim (S/J)\) is \(\dim (S/I)\). Since S / I and \(S/\mathrm{in}_\prec (I)\) have the same Hilbert function, and so does \(S/{\mathfrak {p}}\) and \(S/\mathrm{in}_\prec ({\mathfrak {p}})\), we obtain

$$\begin{aligned} \dim (S/\mathrm{in}_\prec (I))=\dim (S/I)=\dim (S/{\mathfrak {p}})=\dim (S/\mathrm{in}_\prec ({\mathfrak {p}})). \end{aligned}$$

Hence, taking heights in the inclusions \(\mathrm{in}_\prec (I)\subset L\subset \mathrm{in}_\prec ({\mathfrak {p}})\), we obtain \(\mathrm{ht}(I)=\mathrm{ht}(L)\).

Pick a Gröbner basis \(\mathcal {G}=\{g_1,\ldots ,g_r\}\) of I. Then, J is generated by \(\mathcal {G}\cup F\) and by Lemma 2.5 one has the inclusions

$$\begin{aligned}&\Delta _\prec (J)=\Delta _\prec (I,F)\subset \Delta _\prec (\mathrm{in}_\prec (g_1),\ldots ,\mathrm{in}_\prec (g_r),\mathrm{in}_\prec (F))=\\&\ \ \ \ \ \Delta _\prec (\mathrm{in}_\prec (I),\mathrm{in}_\prec (F))=\Delta _\prec (L)\subset \Delta _\prec (\mathrm{in}_\prec (g_1),\ldots ,\mathrm{in}_\prec (g_r))=\Delta _\prec (I). \end{aligned}$$

Thus, \(\Delta _\prec (J)\subset \Delta _\prec (L)\subset \Delta _\prec (I)\). Recall that \(H_I(d)\), the Hilbert function of I at d, is the number of standard monomials of degree d. Hence, \(H_J(d)\le H_L(d)\le H_I(d)\) for \(d\ge 0\). If \(\dim (S/I)\) is equal to 0, then

$$\begin{aligned} \deg (S/J)=\sum _{d\ge 0}H_J(d)\le \deg (S/L)=\sum _{d\ge 0}H_L(d)\le \deg (S/I)=\sum _{d\ge 0}H_I(d). \end{aligned}$$

Assume now that \(\dim (S/I)\ge 1\). By a theorem of Hilbert [34, p. 58], \(H_J\), \(H_L\), \(H_I\) are polynomial functions of degree equal to \(k=\dim (S/I)-1\) (see [2, Theorem 4.1.3]). Thus,

$$\begin{aligned} k!\lim _{d\rightarrow \infty } H_J(d)/d^k\le k!\lim _{d\rightarrow \infty } H_L(d)/d^k\le k!\lim _{d\rightarrow \infty } H_I(d)/d^k, \end{aligned}$$

that is, \(\deg (S/J)\le \deg (S/L)\le \deg (S/I)\).

If I is an unmixed radical ideal and \((F)\not \subset I\), then there is at least one minimal prime that does not contains (F). Hence, by Lemma 3.3, it follows that \(\deg (S/(I,F))<\deg (S/I)\). \(\square \)

Corollary 4.2

Let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\), let \(I({\mathbb {X}})\subset S\) be its vanishing ideal, and let \(\prec \) be a monomial order. If F is a finite set of homogeneous polynomials of S and \((I({\mathbb {X}}):(F))\ne I({\mathbb {X}})\), then

$$\begin{aligned} |V_{{\mathbb {X}}}(F)|=\deg (S/(I({\mathbb {X}}),F))\le \deg (S/(\mathrm{in}_\prec (I({\mathbb {X}})),\mathrm{in}_\prec (F)))\le \deg (S/I({\mathbb {X}})), \end{aligned}$$

and \(\deg (S/(I({\mathbb {X}}),F))<\deg (S/I({\mathbb {X}}))\) if \((F)\not \subset I({\mathbb {X}})\).

Proof

It follows from Lemmas 3.4 and 4.1. \(\square \)

Lemma 4.3

Let \({\mathbb {X}}=\{[P_1],\ldots ,[P_m]\}\) be a finite subset of \(\mathbb {P}^{s-1}\), and let D be a linear subspace of \(C_{\mathbb {X}}(d)\) of dimension \(r\ge 1\). The following hold.

  1. (i)

    There are \(\overline{f}_1,\ldots ,\overline{f}_r\) linearly independent elements of \(S_d/I_d\) such that \(D=\oplus _{i=1}^rK\beta _i\), where \(\beta _i\) is \((f_i(P_1),\ldots ,f_i(P_m))\), and the support \(\chi (D)\) of D is equal to \(\cup _{i=1}^r\chi (\beta _i)\).

  2. (ii)

    \(|\chi (D)|=|{\mathbb {X}}\setminus V_{\mathbb {X}}(f_1,\ldots ,f_r)|\).

  3. (iii)

    \(\delta _r(C_{\mathbb {X}}(d))=\min \{|{\mathbb {X}}\setminus V_{\mathbb {X}}(F)|:\, F=\{f_i\}_{i=1}^r\subset S_d,\, \{\overline{f}_i\}_{i=1}^r \text{ linearly }\text{ independent } \text{ over } K\}\).

Proof

(i): This part follows from Lemma 2.1 and using that the evaluation map \(\mathrm{ev}_d\) induces an isomorphism between \(S_d/I_d\) and \(C_{\mathbb {X}}(d)\).

(ii): Consider the matrix A with rows \(\beta _1, \ldots ,\beta _r\). Notice that the ith column of A is not zero if and only if \([P_i]\) is in \({\mathbb {X}}\setminus V_{\mathbb {X}}(f_1,\ldots ,f_r)\). It suffices to observe that the number of nonzero columns of A is \(|\chi (D)|\) (see Lemma 2.1).

(iii): This follows from part (ii) and using the definition of the rth generalized Hamming weight of \(C_{\mathbb {X}}(d)\) (see Sect. 2). \(\square \)

Definition 4.4

If \(I\subset S\) is a graded ideal, the Vasconcelos function of I is the function \(\vartheta _I:{\mathbb {N}}_+\times {\mathbb {N}}_+\rightarrow {\mathbb {N}}\) given by

$$\begin{aligned} \vartheta _I(d,r):=\left\{ \begin{array}{ll}\min \{\deg (S/(I:(F)))\vert \, F\in {\mathcal {F}}_{d,r}\}&{}\text{ if } {\mathcal {F}}_{d,r}\ne \emptyset ,\\ \deg (S/I)&{}\text{ if } {\mathcal {F}}_{d,r}=\emptyset . \end{array}\right. \end{aligned}$$

Theorem 4.5

Let K be a field, and let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\). If \(|{\mathbb {X}}|\ge 2\) and \(\delta _{\mathbb {X}}(d,r)\) is the rth generalized Hamming weight of \(C_{\mathbb {X}}(d)\), then

$$\begin{aligned} \delta _{\mathbb {X}}(d,r)=\delta _{I({\mathbb {X}})}(d,r) =\vartheta _{I({\mathbb {X}})}(d,r)\ \text{ for } d\ge 1 \text{ and } 1\le r\le H_{I({\mathbb {X}})}(d), \end{aligned}$$

and \(\delta _{\mathbb {X}}(d,r)=r\) for \(d\ge \mathrm{reg}(S/I({\mathbb {X}}))\).

Proof

If \({\mathcal {F}}_{d,r}=\emptyset \), then using Lemmas 3.2, 3.4, and 4.3 we get that \(\delta _{\mathbb {X}}(d,r)\), \(\delta _{I({\mathbb {X}})}(d,r)\), and \(\vartheta _{I({\mathbb {X}})}(d,r)\) are equal to \(\deg (S/I({\mathbb {X}}))=|{\mathbb {X}}|\). Assume that \({\mathcal {F}}_{d,r}\ne \emptyset \) and set \(I=I({\mathbb {X}})\). Using Lemma 4.3 and the formula for \(V_{\mathbb {X}}(F)\) of Lemma 3.4, we obtain

$$\begin{aligned}&\delta _{\mathbb {X}}(d,r){\mathop {=}\limits ^{(4.3)}}\min \{|{\mathbb {X}}\setminus V_{\mathbb {X}}(F)|:F\in {\mathcal {F}}_{d,r}\}\\&\qquad \qquad \quad \! {\mathop {=}\limits ^{(3.4)}} |{\mathbb {X}}|-\max \{\deg (S/(I,F))\vert \, F\in {\mathcal {F}}_{d,r}\}\\&\qquad \qquad \quad =\deg (S/I)-\max \{\deg (S/(I,F))\vert \, F\in {\mathcal {F}}_{d,r}\}=\delta _{I}(d,r), \text{ and }\\&\delta _{\mathbb {X}}(d,r){\mathop {=}\limits ^{(4.3)}}\min \{|{\mathbb {X}}\setminus V_{\mathbb {X}}(F)|:F\in {\mathcal {F}}_{d,r}\}\\&\qquad \qquad \quad \! {\mathop {=}\limits ^{(3.2)}} \min \{\deg (S/(I:(F)))\vert \, F\in {\mathcal {F}}_{d,r}\}=\vartheta _{I}(d,r). \end{aligned}$$

In these equalities, we used the fact that \(\deg (S/I({\mathbb {X}}))=|{\mathbb {X}}|\). As \(H_{I}(d)=|{\mathbb {X}}|\) for \(d\ge \mathrm{reg}(S/I)\), using the generalized Singleton bound for the generalized Hamming weight and the fact that the weight hierarchy is an increasing sequence we obtain that \(\delta _{\mathbb {X}}(d,r)=r\) for \(d\ge \mathrm{reg}(S/I({\mathbb {X}}))\) (see [37, Theorem 1, Corollary 1]). \(\square \)

Remark 4.6

Let \({\mathbb {X}}\) be a finite set of projective points over a field K. The following hold.

  1. (a)

    \(r\le \delta _{\mathbb {X}}(d,r)\le |{\mathbb {X}}|\) for \(d\ge 1\) and \(1\le r\le H_{I({\mathbb {X}})}(d)\). This follows from the fact that the weight hierarchy is an increasing sequence (see [37, Theorem 1]).

  2. (b)

    If \(d\ge \mathrm{reg}(S/I({\mathbb {X}}))\), then \(C_{\mathbb {X}}(d)=K^{|{\mathbb {X}}|}\) and \(\delta _{\mathbb {X}}(d,r)=r\) for \(1\le r\le |{\mathbb {X}}|\).

  3. (c)

    If \(C_{\mathbb {X}}(d)\) is non-degenerate, i.e., for each \(1\le i\le |{\mathbb {X}}|\) there is \(\alpha \in C_{\mathbb {X}}(d)\) whose ith entry is nonzero, then \(\delta _{\mathbb {X}}(d,H_{\mathbb {X}}(d))=|{\mathbb {X}}|\).

  4. (d)

    If \(r>H_{I({\mathbb {X}})}(d)\), then \({\mathcal {F}}_{d,r}=\emptyset \) and \(\delta _{I({\mathbb {X}})}(d,r)=|{\mathbb {X}}|\).

Lemma 4.7

Let \(\prec \) be a monomial order, let \(I\subset S\) be an ideal, let \(F=\{f_1,\ldots ,f_r\}\) be a set of polynomial of S of positive degree, and let \(\mathrm{in}_\prec (F)=\{\mathrm{in}_\prec (f_1),\ldots ,\mathrm{in}_\prec (f_r)\}\) be the set of initial terms of F. If \((\mathrm{in}_\prec (I):(\mathrm{in}_\prec (F)))=\mathrm{in}_\prec (I)\), then \((I:(F))=I\).

Proof

Let g be a polynomial of \((I:(F))\), that is, \(gf_i\in I\) for \(i=1,\ldots ,r\). It suffices to show that \(g\in I\). Pick a Gröbner basis \(g_1,\ldots ,g_n\) of I. Then, by the division algorithm [5, Theorem 3, p. 63], we can write \(g=\sum _{i=1}^nh_ig_i+h\), where \(h=0\) or h is a finite sum of monomials not in \(\mathrm{in}_\prec (I)=(\mathrm{in}_\prec (g_1),\ldots ,\mathrm{in}_\prec (g_n))\). We need only show that \(h=0\). If \(h\ne 0\), then \(hf_i\) is in I and \(\mathrm{in}_\prec (h)\mathrm{in}_\prec (f_i)\) is in the ideal \(\mathrm{in}_\prec (I)\) for \(i=1,\ldots ,r\). Hence, \(\mathrm{in}_\prec (h)\) is in \((\mathrm{in}_\prec (I):(\mathrm{in}_\prec (F)))\). Therefore, by hypothesis, \(\mathrm{in}_\prec (h)\) is in the ideal \(\mathrm{in}_\prec (I)\), a contradiction. \(\square \)

Let \(\prec \) be a monomial order, and let \({\mathcal {F}}_{\prec ,d,r}\) be the set of all subsets \(F=\{f_1,\ldots ,f_r\}\) of \(S_d\) such that \((I:(F))\ne I\), \(f_i\) is a standard polynomial for all i, \(\overline{f}_1,\ldots ,\overline{f}_r\) are linearly independent over the field K, and \(\mathrm{in}_\prec (f_1),\ldots ,\mathrm{in}_\prec (f_r)\) are distinct monomials. Let \(F=\{f_1,\ldots ,f_r\}\) be a set of standard polynomials. It is not hard to see that \(\overline{f}_1,\ldots ,\overline{f}_r\) are linearly independent over the field K if \(\mathrm{in}_\prec (f_1),\ldots ,\mathrm{in}_\prec (f_r)\) are distinct monomials.

The next result is useful for computations with Macaulay2 [17] (see Procedure 7.1).

Proposition 4.8

The generalized minimum distance function of I is given by

$$\begin{aligned} \delta _I(d,r)=\left\{ \begin{array}{ll}\deg (S/I)-\max \{\deg (S/(I,F))\vert \, F\in {\mathcal {F}}_{\prec , d,r}\}&{}\text{ if } {\mathcal {F}}_{\prec ,d,r}\ne \emptyset ,\\ \deg (S/I)&{}\text{ if } {\mathcal {F}}_{\prec ,d,r}=\emptyset . \end{array}\right. \end{aligned}$$

Proof

Take \(F=\{f_1,\ldots ,f_r\}\) in \({\mathcal {F}}_{d,r}\). By the division algorithm, any \(f_i\) can be written as \(f_i=p_i+h_i\), where \(p_i\) is in \(I_d\) and \(h_i\) is a K-linear combination of standard monomials of degree d. Setting \(H=\{h_1,\ldots ,h_r\}\), notice that \((I:(F))=(I:(H))\), \((I,F)=(I,H)\), \(\overline{f}_i=\overline{h}_i\) for \(i=1,\ldots ,r\). Thus, \(H\in {\mathcal {F}}_{d,r}\), that is, we may assume that \(f_1,\ldots ,f_r\) are standard polynomials. Setting \(KF=Kf_1+\cdots +Kf_r\), we claim that there is a set \(G=\{g_1,\ldots ,g_r\}\) consisting of homogeneous standard polynomials of S / I of degree d such that \(KF=KG\), \(\mathrm{in}_\prec (g_1),\ldots ,\mathrm{in}_\prec (g_r)\) distinct monomials, and \(\mathrm{in}_\prec (f_i)\succeq \mathrm{in}_\prec (g_i)\) for all i. We proceed by induction on r. The case \(r=1\) is clear. Assume that \(r>1\). Permuting the \(f_i\)’s if necessary we may assume that \(\mathrm{in}_\prec (f_1)\succeq \cdots \succeq \mathrm{in}_\prec (f_r)\). If \(\mathrm{in}_\prec (f_1)\succ \mathrm{in}_\prec (f_2)\), the claim follows applying the induction hypothesis to \(f_2,\ldots ,f_r\). If \(\mathrm{in}_\prec (f_1)=\mathrm{in}_\prec (f_2)\), there is \(k\ge 2\) such that \(\mathrm{in}_\prec (f_1)=\mathrm{in}_\prec (f_i)\) for \(i\le k\) and \(\mathrm{in}_\prec (f_1)\succ \mathrm{in}_\prec (f_i)\) for \(i>k\). We set \(h_i=f_1-f_i\) for \(i=2,\ldots ,k\) and \(h_i=f_i\) for \(i=k+1,\ldots ,r\). Notice that \(\mathrm{in}_\prec (f_1)\succ h_i\) for \(i\ge 2\) and that \(h_2,\ldots ,h_r\) are standard monomials of degree d which are linearly independent over K. Hence, the claim follows applying the induction hypothesis to \(H=\{h_2,\ldots ,h_r\}\). The required expression for \(\delta _I(d,r)\) follows readily using Theorem 4.5. \(\square \)

Let I be a graded ideal, let \(\Delta _\prec ^p(I)_d\) be the set of standard polynomials of S / I of degree d, and let \({\mathcal {F}}^p_{\prec ,d,r}\) be the set of all subsets of \(\Delta _\prec ^p(I)_d\) with r elements. If \(K={\mathbb {F}}_q\) is a finite field, then

$$\begin{aligned} |\Delta _\prec ^p(I)_d|=q^{H_I(d)}-1\ \text{ and } \ |{\mathcal {F}}^p_{\prec ,d,r}|=\left( {\begin{array}{c}q^{H_I(d)}-1\\ r\end{array}}\right) . \end{aligned}$$

Thus, computing \(\delta _I(d,r)\) is very hard because one has to determine which of the polynomials in \({\mathcal {F}}^p_{\prec ,d,r}\) are in \({\mathcal {F}}_{\prec ,d,r}\), and then compute the corresponding degrees. To compute \(\mathrm{fp}_I(d,r)\) is much simpler because we only need to determine the set \(\Delta _\prec (I)_{d,r}\) of all subsets of \(\Delta _\prec (I)_d\) with r elements, and one has

$$\begin{aligned} |\Delta _\prec (I)_{d,r}|=\left( {\begin{array}{c}H_I(d)\\ r\end{array}}\right) , \end{aligned}$$

which is much smaller than the size of \({\mathcal {F}}^p_{\prec ,d,r}\).

We come to one of our main results.

Theorem 4.9

Let K be a field, let \({\mathbb {X}}\) be a finite subset of \(\mathbb {P}^{s-1}\), and let \(\prec \) be a monomial order. If \(|{\mathbb {X}}|\ge 2\) and \(\delta _{\mathbb {X}}(d,r)\) is the rth generalized Hamming weight of \(C_{\mathbb {X}}(d)\), then

$$\begin{aligned} \mathrm{fp}_{I({\mathbb {X}})}(d,r)\le \delta _{\mathbb {X}}(d,r)\ \text{ for } d\ge 1 \text{ and } 1\le r\le H_{I({\mathbb {X}})}(d). \end{aligned}$$

Proof

This follows from Theorem 4.5, Lemma 4.7, and Proposition 4.8. \(\square \)

5 Projective nested Cartesian codes

In this section, we introduce projective nested Cartesian codes, a type of evaluation codes that generalize the classical projective Reed–Muller codes [22, 27, 33], and give a lower bound for the minimum distance of some of these codes.

Let \(K={\mathbb {F}}_q\) be a finite field, let \(A_1,\ldots ,A_s\) be a collection of subsets of K, and let

$$\begin{aligned} {\mathcal {X}}=[A_1\times \cdots \times A_s] \end{aligned}$$

be the image of \(A_1\times \cdots \times A_s\setminus \{0\}\) under the map \(K^s\setminus \{0\}\rightarrow \mathbb {P}^{s-1}\), \(x\rightarrow [x]\).

Definition 5.1

[4] The set \({\mathcal {X}}\) is called a projective nested Cartesian set if

  1. (i)

    \(\{0,1\}\subset A_i\) for \(i=1,\ldots ,s\),

  2. (ii)

    \(a/b\in A_j\) for \(1\le i<j\le s\), \(a\in A_j\), \(0\ne b\in A_i\), and

  3. (iii)

    \(d_1\le \cdots \le d_s\), where \(d_i=|A_i|\) for \(i=1,\ldots ,s\).

   If \({\mathcal {X}}\) is a projective nested Cartesian set and \(C_{\mathcal {X}}(d)\) is its corresponding dth projective Reed–Muller-type code, we call \(C_{{\mathcal {X}}}(d)\) a projective nested Cartesian code.

The next conjecture is not true as will be shown in Example 6.1.

Conjecture 5.2

(Carvalho et al. [4, 25, Conjecture 6.2]) Let \(C_{\mathcal {X}}(d)\) be the dth projective nested Cartesian code on the set \({\mathcal {X}}=[A_1\times \cdots \times A_s]\) with \(d_i=|A_i|\) for \(i=1,\ldots ,s\). Then, its minimum distance is given by

$$\begin{aligned} \delta _{\mathcal {X}}(d,1)=\left\{ \begin{array}{ll}\left( d_{k+2}-\ell +1\right) d_{k+3}\cdots d_s&{} \text{ if } d\le \sum \limits _{i=2}^{s}\left( d_i-1\right) ,\\ \qquad \qquad 1&{} \text{ if } d\ge \sum \limits _{i=2}^{s}\left( d_i-1\right) +1, \end{array} \right. \end{aligned}$$

where \(0\le k\le s-2\) and \(\ell \) are the unique integers such that \(d=\sum _{i=2}^{k+1}\left( d_i-1\right) +\ell \) and \(1\le \ell \le d_{k+2}-1\).

This conjecture is true in some special cases [4, Theorem 3.8], which includes the classical projective Reed–Muller codes [33]. The minimum distance of \(C_{\mathcal {X}}(d)\) proposed in Conjecture 5.2 is in fact the minimum distance of a certain evaluation linear code [25, Corollary 6.9].

In what follows \({\mathcal {X}}=[A_1\times \cdots \times A_s]\) denotes a projective nested Cartesian set, with \(d_i=|A_i|\), and \(C_{\mathcal {X}}(d)\) is its corresponding projective nested Cartesian code. Throughout this section \(\prec \) is the lexicographical order on S, with \(t_1\prec \cdots \prec t_s\), and \(\mathrm{in}_\prec (I({\mathcal {X}}))\) is the initial ideal of \(I({\mathcal {X}})\).

Lemma 5.3

[25, Lemma 5.6] Let \(1\le e_1\le \cdots \le e_m\) and \(0\le b_i\le e_i-1\) for \(i=1,\ldots ,m\) be integers. Then,

$$\begin{aligned} \prod _{i=1}^m(e_i-b_i)\ge \left( \sum _{i=1}^k(e_i-b_i)-(k-1)- \sum _{i=k+1}^mb_i\right) e_{k+1}\cdots e_m \end{aligned}$$
(5.1)

for \(k=1,\ldots ,m\), where \(e_{k+1}\cdots e_m=1\) and \(\sum _{i=k+1}^mb_i=0\) if \(k=m\).

Lemma 5.4

Let g be a homogeneous polynomial of S of degree \(1\le d\le \sum _{i=1}^{s-1}(d_i-1)\), and let [P] be a point of \(\mathbb {P}^{s-1}\). If g vanishes at all points of \({\mathcal {X}}\setminus \{[P]\}\), then \(g(P)=0\).

Proof

Assume that \(g(P)\ne 0\) and set \({\mathcal {X}}^*=A_1\times \cdots \times A_s\). One can write the point [P] in standard form \([P]=(0,\ldots ,0,p_k,\ldots ,p_s)\) with \(p_k=1\). Notice that \(V_{{\mathcal {X}}^*}(g)\), the zero set of g in \({\mathcal {X}}^*\), has cardinality equal to \(|{\mathcal {X}}^*|-(d_k-1)\). Setting \(f_i=\prod _{\gamma \in A_i}(t_i-\gamma )\) for \(1\le i\le s\) and applying [23, Lemma 2.3], we get

$$\begin{aligned} I(X^*)=(f_1,\ldots ,f_s)\ \ \text{ and } \ \ \mathrm{in}_\prec (I({\mathcal {X}}^*))=(t_1^{d_1},\ldots ,t_s^{d_s}). \end{aligned}$$

Therefore, by the division algorithm, we can write

$$\begin{aligned} g=h_1f_1+\cdots +h_sf_s+f, \end{aligned}$$

where \(f(0)=0\), \(\deg (f)\le \deg (g)\), and \(\deg _{t_i}(f)\le d_i-1\) for all i. Thus,

$$\begin{aligned} |V_{{\mathcal {X}}^*}(f)|=|V_{{\mathcal {X}}^*}(g)|=d_1\cdots d_s-(d_k-1). \end{aligned}$$

The initial term of f has the form \(t^a=t_1^{a_1}\cdots t_s^{a_s}\), where \(a_i\le d_i-1\) for all i. Hence,

$$\begin{aligned} d_1\cdots d_s-(d_k-1)= & {} |V_{{\mathcal {X}}^*}(f)|=\deg (S/(I({\mathcal {X}}^*),f))\\\le & {} \deg (S/(\mathrm{in}_\prec (I({\mathcal {X}}^*),\mathrm{in}_\prec (f))= \deg (S/(t_1^{d_1},\ldots , t_s^{d_s},t^a)))\\= & {} d_1\cdots d_s-(d_1-a_1)\cdots (d_s-a_s). \end{aligned}$$

Thus, \(d_k-1\ge (d_1-a_1)\cdots (d_s-a_s)\). Applying Lemma 5.3 with \(m=k=s\), \(e_i=d_i\), and \(b_i=a_i\) for all i, we get

$$\begin{aligned} (d_1-a_1)\cdots (d_s-a_s)\ge & {} \sum _{i=1}^s(d_i-a_i)-(s-1)\\= & {} \sum _{i=1}^{s-1}(d_i-1)-\sum _{i=1}^sa_i+d_s\ge d_s\ge d_k. \end{aligned}$$

Thus, \((d_1-a_1)\cdots (d_s-a_s)\ge d_k\), a contradiction. \(\square \)

The next result gives a uniform upper bound for the number of zeros in a projective nested Cartesian set for a family of homogeneous polynomials of fixed degree d, where d is within a certain range, and a corresponding lower bound for \(\delta _{\mathcal {X}}(d,1)\).

Theorem 5.5

Let f be a polynomial of degree d that does not vanish at all points of \({\mathcal {X}}\). If \(d=\sum _{i=2}^{s-1}(d_i-1)+\ell \) and \(1\le \ell \le d_1-1 \), then

$$\begin{aligned} |V_{\mathcal {X}}(f)|\le \deg (S/I({\mathcal {X}}))-(d_1-\ell +1). \end{aligned}$$

In particular, \(\delta _{\mathcal {X}}(d,1)\ge d_1-\ell +1\ge 2\).

Proof

We proceed by contradiction assuming that \(|V_{\mathcal {X}}(f)|\ge |{\mathcal {X}}|-(d_1-\ell )\). If n is the number of elements of \({\mathcal {X}}\setminus V_{\mathcal {X}}(f)\), then \(n\le d_1-\ell \). Let \([P_1],\ldots ,[P_n]\) be the points of \({\mathcal {X}}\setminus V_{\mathcal {X}}(f)\). For each \(1\le i\le n-1\), pick \(h_i\in S_1\) such that \(h_i(P_i)=0\) and \(h_i(P_n)\ne 0\). Setting \(g=fh_1\cdots h_{n-1}\), one has

$$\begin{aligned} \deg (g)=(n-1)+d=(n-1)+\sum _{i=2}^{s-1}(d_i-1)+\ell < d_1+\sum _{i=2}^{s-1}(d_i-1), \end{aligned}$$

\(g(P_n)\ne 0\), and g vanishes at all points of \({\mathcal {X}}\setminus \{[P_n]\}\). This contradicts Lemma 5.4. \(\square \)

6 Examples

In this section, we show some examples that illustrate how some of our results can be used in practice. In particular, we give a counterexample to Conjecture 5.2.

Example 6.1

Let K be the field \({\mathbb {F}}_{4}\), let \({\mathcal {X}}\) be the projective nested Cartesian set

$$\begin{aligned} {\mathcal {X}}=[A_1\times A_2 \times A_3]\subset {\mathbb {P}}^2 \end{aligned}$$

where \(A_1=\{0,1\}, A_2=\{0,1\}, A_3={\mathbb {F}}_4\), and let \(I=I({\mathcal {X}})\) be the vanishing ideal of \({\mathcal {X}}\). The ideal I is generated by \(t_{1}t_2^2-t_1^{2}t_2,\, t_1t_3^4-t_1^4t_3,\, t_2t_3^4-t_2^4t_3\), \(\mathrm{reg}(S/I)=5\), and \(\deg (S/I)=13\). This follows from [4, Lemma 2.4]. Using Procedure 7.1, we obtain the following table with the basic parameters of \(C_{\mathcal {X}}(d)\):

d

1

2

3

4

5

\(\cdots \)

\(|{\mathcal {X}}|\)

13

13

13

13

13

\(\cdots \)

\(H_{\mathcal {X}}(d)\)

3

6

9

12

13

\(\cdots \)

\(\delta _{{\mathcal {X}}}(d,1)\)

8

4

3

1

1

\(\cdots \)

\(\mathrm{fp}_{I({\mathcal {X}})}(d,1)\)

8

4

3

1

1

\(\cdots \)

A direct way to see that \(\delta _{\mathcal {X}}(4,1)=1\) is to observe that the polynomial \(f=t_3(t_3^3-t_2^3-t_1^3+t_1^2t_2) \) vanishes at all points of \({\mathcal {X}}\setminus \{[e_3]\}\) and \(f(e_3)=1\), where \(e_3=(0,0,1)\). The ideal I is Geil–Carvalho [26], that is, \(\delta _{\mathcal {X}}(d,1)=\mathrm{fp}_{I({\mathcal {X}})}(d,1)\) for \(d\ge 1\). Using the notation of Conjecture 5.2, the values of \(\delta _{{\mathcal {X}}}(d,1)\) according to this conjecture are given by the following table:

d

1

2

3

4

5

\(\cdots \)

k

0

1

1

1

  

\(\ell \)

1

1

2

3

  

\(\delta _{{\mathcal {X}}}(d,1)\)

8

4

3

2

1

\(\cdots \)

Thus, the conjecture fails in degree \(d=4\).

Example 6.2

Let K be the field \({\mathbb {F}}_{4}\), let \({\mathcal {X}}\) be the projective nested Cartesian set

$$\begin{aligned} {\mathcal {X}}=[A_1\times A_2 \times A_3]\subset \mathbb {P}^2, \end{aligned}$$

where \(A_1=\{0,1\}, A_2=\{0,1\}, A_3={\mathbb {F}}_4\), and let \(I=I({\mathcal {X}})\) be the vanishing ideal of \({\mathcal {X}}\). Consider the following pairs of polynomials \(F=\{f_1,f_2\}\) of degree d:

$$\begin{aligned} \begin{array}{llll} \text{ Case } d=1:&{}\text{ Case } d=2:&{}\text{ Case } d=3:&{}\text{ Case } d=4:\\ f_1=t_1-t_2,&{}f_1=(t_1-t_2)(t_1-t_3),&{}f_1=(t_1-t_2)(t_1-t_3)t_2, &{}f_1=(t_1-t_2)(t_1-t_3)t_2^2,\\ f_2=t_1-t_3.&{}f_2=(t_1-t_2)t_2.&{}f_2=(t_1-t_2)t_2^2.&{}f_2=(t_1-t_2)(t_2-t_3)t_2t_3. \end{array} \end{aligned}$$

If \(V_{\mathcal {X}}(F)\) is the variety in \({\mathcal {X}}\) defined by \(F=\{f_1,f_2\}\), using Procedure 7.2 we obtain:

$$\begin{aligned} \begin{array}{ll} \text{ Case } d=1:\ |V_{\mathcal {X}}(F)|=\deg (S/(I,F))=1,&{}\text{ Case } d=2:\ |V_{\mathcal {X}}(F)|=\deg (S/(I,F))=6,\\ \text{ Case } d=3:\ |V_{\mathcal {X}}(F)|=\deg (S/(I,F))=9,&{}\text{ Case } d=4:\ |V_{\mathcal {X}}(F)|=\deg (S/(I,F))=10. \end{array} \end{aligned}$$

Example 6.3

Let \((\mathrm{fp}_{I({\mathcal {X}})}(d,r))\) and \((\delta _{{\mathcal {X}}}(d,r))\) be the footprint matrix and the weight matrix of the ideal \(I({\mathcal {X}})\) of Example 6.1. These matrices are of size \(5\times 13\) because the regularity and the degree of \(S/I({\mathcal {X}})\) are 5 and 13, respectively. Using Procedure 7.3 we obtain:

$$\begin{aligned} (\mathrm{fp}_{I({\mathcal {X}})}(d,r))=\left[ \begin{array}{c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c} 8&{} 12 &{} 13 &{} \infty &{} \infty &{} \infty &{} \infty &{} \infty &{} \infty &{} \infty &{}\infty &{} \infty &{}\infty \\ 4&{} 7 &{} 8 &{} 11 &{} 12 &{} 13 &{} \infty &{} \infty &{} \infty &{} \infty &{}\infty &{} \infty &{}\infty \\ 3&{} 4 &{} 6 &{} 7 &{} 8 &{} 10 &{} 11 &{} 12&{} 13&{} \infty &{}\infty &{} \infty &{}\infty \\ 1 &{} 3&{} 4 &{} 5 &{} 6 &{} 7 &{} 8 &{} 9&{} 10&{} 11&{}12&{} 13&{}\infty \\ 1&{} 2 &{} 3 &{}4 &{} 5 &{} 6 &{} 7 &{} 8&{} 9&{} 10&{}11&{} 12&{}13 \end{array}\right] . \end{aligned}$$

If \(r>H_{\mathcal {X}}(d)\), then \(\mathcal {M}_{\prec , d,r}=\emptyset \) and the (dr)-entry of this matrix is equal to \(|{\mathcal {X}}|\), but in this case we prefer to write \(\infty \) for computational reasons. Therefore, by Theorem 4.9, we obtain \((\mathrm{fp}_{I({\mathcal {X}})}(d,r))\le (\delta _{\mathcal {X}}(d,r))\). By Example 6.1, one has \(\mathrm{fp}_{I({\mathcal {X}})}(d,1)=\delta _{\mathcal {X}}(d,1)\) for \(d\ge 1\), and by Example 6.2 it follows readily that \(\mathrm{fp}_{I({\mathcal {X}})}(d,2)=\delta _{\mathcal {X}}(d,2)\) for \(d\ge 1\). Using that the generalized footprint is a lower bound for the generalized Hamming weight we have verified that \(\mathrm{fp}_{I({\mathcal {X}})}(d,r)\) is equal to \(\delta _{\mathcal {X}}(d,r)\) for all dr.

Example 6.4

Let \({\mathcal {X}}=\mathbb {P}^2\) be the projective space over the field \({\mathbb {F}}_2\). The vanishing ideal \(I=I({\mathcal {X}})\) is the ideal of \(S={\mathbb {F}}_2[t_1,t_2,t_3]\) generated by the binomials \(t_1t_2^2-t_1^2t_2,\, t_1t_3^2-t_1^2t_3,\, t_2^2t_3-t_2t_3^2\) [27, Corollaire 2.1]. If S has the GRevLex order \(\prec \), adapting Procedure 7.1 we get

d

1

2

3

\(\cdots \)

\({\deg }(S/I)\)

7

7

7

\(\cdots \)

\(H_I(d)\)

3

6

7

\(\cdots \)

\(\delta _{\mathcal {X}}(d,1)\)

4

2

1

\(\cdots \)

\(\mathrm{fp}_I(d,1)\)

4

1

1

\(\cdots \)

7 Procedures for Macaulay2

In this section, we present the procedures used to compute the examples of Sect. 6. Some of these procedures work for graded ideals and provide a tool to study generalized minimum distance functions.

Procedure 7.1

Computing the minimum distance and the footprint with Macaulay2 [17] using Theorem 4.5 and Proposition 4.8. The next procedure corresponds to Example 6.1.

figure a

Procedure 7.2

Computing the number of solutions of a system of homogeneous polynomials over any given set of projective points over a finite field with Macaulay2 [17] using the degree formula of Lemma 4.5. The next procedure corresponds to Example 6.2.

figure b

Procedure 7.3

Computing the footprint matrix with Macaulay2 [17]. This procedure corresponds to Example 6.3. It can be applied to any vanishing ideal I to obtain the entries of the matrix \((\mathrm{fp}_{I}(d,r))\) and is reasonably fast.

figure c

8 An integer inequality

For \(a:a_1,\ldots ,a_m\) and \(b:b_1,\ldots ,b_m\) sequences in \(\mathbb {Z}^+=\{1,2,\ldots \}\), we define

$$\begin{aligned} \pi (a,b):=\prod _{i=1}^ma_i+\prod _{i=1}^mb_i-\prod _{i=1}^m\min (a_i,b_i). \end{aligned}$$

Lemma 8.1

Let \(a_1,a_2,b_1,b_2\in \mathbb {Z}^+\). Set \(a_1'=\min (a_1,a_2)\) and \(a_2'=\max (a_1,a_2)\). Then,

$$\begin{aligned} \min (a_1,b_1)\min (a_2,b_2)\le \min (a_1',b_1')\,\min (a_2',b_2'). \end{aligned}$$

Proof

It is an easy case-by-case verification of 4! possible cases. \(\square \)

Lemma 8.2

Let \(a:a_1,\ldots ,a_m\) and \(b:b_1,\ldots ,b_m\) be sequences in \(\mathbb {Z}^+\). Suppose:

  1. (i)

    \(r<s\), \(a_r>a_s\). Set \(a_r'=a_s\), \(a_s'=a_r\), \(a_i'=a_i\) for \(i\ne r,s\); and \(b_r'=\min (b_r,b_s)\), \(b_s'=\max (b_r,b_s)\), \(b_i'=b_i\) for \(i\ne r,s\). Then, \(\pi (a,b)\ge \pi (a',b')\).

  2. (ii)

    \(r<s\), \(b_r=a_r\le a_s<b_s\). Set \(a_r'=a_r-1\), \(a_s'=a_s+1\), \(a_i'=a_i\) for \(i\ne r,s\). Then, \(\pi (a,b)\ge \pi (a',b)\).

  3. (iii)

    \(r<s\), \(b_r<a_r\le a_s\). Set \(a_r'=a_r-1\), \(a_s'=a_s+1\), \(a_i'=a_i\) for \(i\ne r,s\). Then, \(\pi (a,b)\ge \pi (a',b)\).

  4. (iv)

    \(r<s\), \(a_r<a_s\), \(b_r=a_s, b_s=a_r\), \(b_i=a_i\) for \(i\ne r,s\), \(h:=a_s-a_r\ge 2\). Set \(b_r'=a_r+1\), \(b_s'=a_s-1\), \(b_i'=a_i\) for \(i\ne r,s\). Then, \(\pi (a,b)\ge \pi (a,b')\).

Proof  We verify all cases by direct substitution of \(a'\) and \(b'\) into \(\pi (a,b)\).

$$\begin{aligned}&\mathrm{(i)}\ \ \pi (a,b)-\pi (a',b')=\prod a_i+\prod b_i-\prod a_i'-\prod b_i'\\&\qquad \quad +\prod \min (a_i',b_i') -\prod \min (a_i,b_i)\\&\qquad =(\min (a_r',b_r')\min (a_s',b_s')- \min (a_r,b_r)\min (a_s,b_s))\\&\qquad \prod _{i\ne r,s}\min (a_i,b_i)\ge 0.\ \ (8.1) \end{aligned}$$
$$\begin{aligned} \mathrm{(ii)}\ \ \pi (a,b)-\pi (a',b)= & {} \prod a_i-\prod a_i'+\prod \min (a_i',b_i) -\prod \min (a_i,b_i)\\= & {} (a_ra_s-(a_r-1)(a_s+1))\prod _{i\ne r,s}a_i\\&\quad +\,(\min (a_r',b_r)\min (a_{s}',b_{s})\\&\quad -\,\min (a_r,b_r)\min (a_{s},b_{s}))\prod _{i\ne r,s}\min (a_i,b_i)\\= & {} (a_s-a_r+1)\prod _{i\ne r,s}a_i+((a_r-1)(a_s+1)-a_ra_s)\\&\quad \prod _{i\ne r,s}\min (a_i,b_i)\\= & {} (a_s-a_r+1)\left( \prod _{i\ne r,s}a_i-\prod _{i\ne r,s}\min (a_i,b_i)\right) \ge 0. \end{aligned}$$
$$\begin{aligned}&\mathrm{(iii)}\ \ \pi (a,b)-\pi (a',b)=\prod a_i-\prod a_i'+\prod \min (a_i',b_i) -\prod \min (a_i,b_i)\\&\qquad =(a_ra_s-(a_r-1)(a_s+1))\prod _{i\ne r,s}a_i\\&+\,(\min (a_r',b_r)\min (a_{s}',b_{s})-\min (a_r,b_r)\min (a_{s},b_{s}))\prod _{i\ne r,s}\min (a_i,b_i)\\= & {} (a_s-a_r+1)\prod _{i\ne r,s}a_i+b_r(\min (a_s+1,b_s)-\min (a_s,b_s))\prod _{i\ne r,s}\min (a_i,b_i)\ge 0. \end{aligned}$$

For the last inequality, note that \(\min (a_s+1,b_s)-\min (a_s,b_s)=0\) or 1.

$$\begin{aligned} (iv)\ \ \pi (a,b)-\pi (a,b')= & {} \prod b_i-\prod b_i'+\prod \min (a_i,b_i')-\prod \min (a_i,b_i)\\= & {} (a_ra_s-(a_r+1)(a_s-1)+a_r(a_s-1)-a_r^2)\prod _{i\ne r,s}a_i\\= & {} (a_r-1)(h-1)\prod _{i\ne r,s}a_i\ge 0. \qquad \qquad \qquad \qquad \qquad \qquad \;\square \end{aligned}$$

Lemma 8.3

If \(a_1,\ldots ,a_r\) are positive integers, then \(a_1\cdots a_r\ge (a_1+\cdots +a_r)-(r-1)\).

Proof

It follows by induction on r. \(\square \)

Lemma 8.4

Let \(1\le e_1\le \cdots \le e_m\) and \(1\le a_i,b_i\le e_i\), for \(i=1,\ldots ,m\) be integers. Suppose \(a_i=b_i=1\) for \(i<r\), \(a_i=b_i=e_i\) for \(i>r+1:=s\), \(1\le a_i,b_i\le e_i\) for \(i=r,s\), with \(a_r+a_s=b_r+b_s\) and \((a_r,a_s)\ne (b_r,b_s)\). If \(b_r\le a_s\) and \(b_s=a_s-1\), then

$$\begin{aligned} \pi (a,b)\ge \left( \sum _{i=1}^m a_i-\sum _{i=k+1}^me_i-(k-2)\right) e_{k+1}\cdots e_m-e_{k+2}\cdots e_m \end{aligned}$$
(8.1)

for \(i=1,\ldots ,m-1\), where \(e_{k+2}\cdots e_m=1\) when \(k=m-1\).

Proof

Set \(\sigma =\sum _{i=1}^m a_i-\sum _{i=k+1}^me_i-(k-2)\). Since \(b_s(b_r-a_r)=a_s-1\), one has the equality

$$\begin{aligned} \pi (a,b)=(a_ra_s+b_rb_s-a_rb_s)\prod _{i=r+2}^me_i=(a_ra_s+a_s-1)\prod _{i=r+2}^me_i. \end{aligned}$$
(8.2)

Case \(k+1<r\): The integer \(\sigma \) can be rewritten as

$$\begin{aligned} \sigma =k+(1-e_{k+1})+\cdots +(1-e_{r-1})+(a_r-e_r)+(a_s-e_s)-(k-2). \end{aligned}$$

Since \(a_r<b_r\le e_r\), it holds that \(a_r-e_r\le -1\), and hence \(\sigma \le 1\). If \(\sigma \le 0\), Eq. (8.1) trivially follows (because the left-hand side is positive and the right-hand side would be negative). So we may assume \(\sigma =1\). This assumption implies that \(e_{k+1}=1\) because \(a_r<b_r\le e_r\). Then, the right-hand side of Eq. (8.1) is

$$\begin{aligned} (\sigma )e_{k+1}\cdots e_m-e_{k+2}\cdots e_m=(e_{k+1}-1)e_{k+2}\cdots e_r=0. \end{aligned}$$

Case \(k+1=r\): The integer \( \sigma \) can be rewritten as

$$\begin{aligned} \sigma =k+(a_r-e_r)+(a_s-e_s)-(k-2). \end{aligned}$$

By the same reason as above, we may assume \(\sigma =1\). This assumption implies \(a_r=e_r-1\) and \(a_s=e_s\). Then, by Eq. (8.2), we obtain that Eq. (8.1) is equivalent to

$$\begin{aligned} (e_re_s-1)\prod _{i=r+2}^m e_i\ge \left( \sigma \right) e_{r}\cdots e_m-e_{r+1}\cdots e_m, \end{aligned}$$

which reduces to \(e_re_s-1\ge \left( 1\right) e_re_s-e_s\), or equivalently, \(e_s\ge 1\).

Case \(k+1=r+1\): We can rewrite \(\sigma \) as

$$\begin{aligned} \sigma =(k-1)+a_r+(a_s-e_s)-(k-2)=a_r+(a_s-e_s)+1. \end{aligned}$$

Then, using Eq. (8.2), we obtain that Eq. (8.1) is equivalent to

$$\begin{aligned} (a_ra_s+a_s-1)\prod _{i=r+2}^m e_i\ge \left( \sigma \right) e_{r+1}\cdots e_m-e_{r+2}\cdots e_m, \end{aligned}$$

which reduces to \(a_ra_s+a_s\ge \left( a_r+a_s-e_s+1\right) e_{s}\), or equivalently,

$$\begin{aligned} (e_s-a_s)(e_s-a_r-1)\ge 0. \end{aligned}$$

Case \(k+1>r+1\): One can rewrite \(\sigma \) as

$$\begin{aligned} \sigma =(r-1)+a_r+\cdots +a_k-(k-2). \end{aligned}$$

Then, using Eq. (8.2), we obtain that Eq. (8.1) reduces to

$$\begin{aligned} (a_ra_s+a_s-1)e_{r+2}\cdots e_{k+1}\ge \left( \sigma \right) e_{k+1}-1. \end{aligned}$$

But, as \(a_s\ge 2\), using Lemma 8.3, we get

$$\begin{aligned}(a_ra_s+a_s-1)e_{r+2}\cdots e_{k}\ge & {} (a_ra_s+a_s-1)+e_{r+2}+\cdots +e_k-(k-r-1)\\\ge & {} (a_r+a_s)+a_{r+2}+\cdots +a_k+r-k+1=\sigma . \end{aligned}$$

So, multiplying by \(e_{k+1}\), the required inequality follows. \(\square \)

Theorem 8.5

Let \(d\ge 1\) and \(1\le e_1\le \cdots \le e_m\) be integers. Suppose \(1\le a_i\le e_i\) and \(1\le b_i\le e_i\), for \(i=1,\ldots ,m\), are integers such that \(d=\sum _{i=1}^m a_i=\sum _{i=1}^m b_i\) and \(a\ne b\). Then,

$$\begin{aligned} \pi (a,b)\ge \left( \sum _{i=1}^m a_i-\sum _{i=k+1}^me_i-(k-2)\right) e_{k+1}\cdots e_m-e_{k+2}\cdots e_m \end{aligned}$$

for \(k=1,\ldots ,m-1\), where \(e_{k+2}\cdots e_m=1\) when \(k=m-1\).

Proof

Apply to (ab) any of the four “operations” described in Lemma 8.2, and let \((a', b')\) be the new obtained pair. These operations should be applied in such a way that \(1\le a_i',b_i'\le e_i\) for \(i=1,\ldots ,m\) and \(a'\ne b'\); this is called a valid operation. One can order the set of all pairs (ab) that satisfy the hypothesis of the proposition using the GRevLex order defined by \((a,b)\succ (a',b')\) if and only if the last nonzero entry of \((a,b)-(a',b')\) is negative. Note that by construction \(d=\sum a_i'=\sum b_i'=\sum a_i\). Repeat this step as many times as possible (which is a finite number because the result \((a',b')\) of any valid operation applied to (ab) satisfies \((a,b)\succ (a',b')\)). Permitting an abuse of notation, let a and b be the resulting sequences at the end of that process. We will show that these a and b satisfy the hypothesis of Lemma 8.4.

Set \(r=\min (i:a_i\ne b_i)\). By symmetry we may assume \(a_r<b_r\). Pick the first \(s>r\) such that \(a_s>b_s\) (the case \(a_r>b_r\) and \(a_s<b_s\) can be shown similarly).

Claim (a): For \(p<r\), \(a_p=1\). Assume \(a_p>1\). If \(a_p>a_r\), we can apply Lemma 8.2(i)[pr], which is assumed not possible; (this last notation means that we are applying Lemma 8.2(i) with the indexes p and r). Otherwise, apply Lemma 8.2(ii)[pr]. So \(a_p=b_p=1\) for \(p<r\).

Claim (b): \(s=r+1\). Suppose \(r<p<s\). To obtain a contradiction, it suffices to show that we can apply a valid operation to ab. By the choice of s, \(a_p\le b_p\). If \(b_r > b_p\), we can apply Lemma 8.2(i)[rp]. If \(b_p > b_s\), we can apply Lemma 8.2(i)[ps]. Hence, \(b_r\le b_p \le b_s\). Notice that \(b_p\ge 2\) because \(a_r<b_r\le b_p\). If \(a_p = b_p\), we can apply Lemma 8.2(ii)[ps]. If \(a_p<b_p\), we can apply Lemma 8.2(iii)[ps] because \(a_p<b_p\le b_s<a_s\).

Claim (c): For \(p>s\), \(a_p=b_p=e_p\). If \(b_p<a_p\), applying Claim (b) to r and p we get a contradiction. Thus, we may assume \(b_p\ge a_p\). It suffices to show that \(a_p=e_p\). If \(a_s>a_p\), then by Lemma 8.2(i)[sp] one can apply a valid operation to ab, a contradiction. Thus, \(a_s\le a_p\). If \(a_p<e_p\), then \(b_s<a_s\le a_p<e_p\), and by Lemma 8.2(iii)[sp] we can apply a valid operation to ab, a contradiction. Hence, \(a_p=e_p\).

Claim (d): \(b_r\le a_s\) and \(b_s=a_s-1\). By the previous claims, one has the equalities \(s=r+1\) and \(a_r+a_s=b_r+b_s\). If \(a_s<b_r\), then \(b_s<a_s<b_r\), and by Lemma 8.2(i)[rs] we can apply a valid operation to ab, a contradiction. Hence, \(a_s\ge b_r\). Suppose \(a_s=b_r\), then \(a_r=b_s\). If \(a_s-a_r\ge 2\), by Lemma 8.2(iv)[rs] we can apply a valid operation to ab, a contradiction. Hence, in this case, \(a_s-b_s=a_s-a_r=1\). Suppose \(a_s>b_r\). If \(b_r>b_s\), then \(a_s>b_r>b_s\), and we can use Lemma 8.2(i)[rs] to apply a valid operation to ab, a contradiction. Hence, \(b_r\le b_s\). If \(a_s-b_s=b_r-a_r\ge 2\), then \(a_r<b_r\le b_s<a_s\), and by Lemma 8.2(iii)[rs] we can apply a valid operation to ab, a contradiction. So, in this other case, also \(a_s-b_s=1\). In conclusion, we have that \(b_r\le a_s\) and \(b_s=a_s-1\), as claimed.

From Claims (a)–(d), we obtain that ab satisfy the hypothesis of Lemma 8.4. Hence, the required inequality follows from Lemmas 8.2 and 8.4. \(\square \)

For \(\alpha :\alpha _1,\ldots ,\alpha _n\) and \(\beta :\beta _1,\ldots ,\beta _n\) sequences in \(\mathbb {Z}^+\), we define

$$\begin{aligned} P(\alpha ,\beta )=\prod _{i=1}^n(d_i-\alpha _i)+ \prod _{i=1}^n(d_i-\beta _i)-\prod _{i=1}^n\min \{d_i-\alpha _i,d_i-\beta _i\}. \end{aligned}$$

Lemma 8.6

Let \(1\le d_1\le \cdots \le d_n\), \(0\le \alpha _i,\beta _i\le d_i-1\) for \(i=1,\ldots ,n\), \(n\ge 2\), be integers such that \(\sum _{i=1}^n\alpha _i=\sum _{i=1}^n\beta _i\) and \((\alpha _1,\ldots ,\alpha _n)\ne (\beta _1,\ldots ,\beta _n)\). Then,

$$\begin{aligned} P(\alpha ,\beta )\ge \left( \sum _{i=1}^{k+1}(d_i-\alpha _i)-(k-1)- \sum _{i=k+2}^n\alpha _i\right) d_{k+2}\cdots d_n-d_{k+3}\cdots d_n\qquad \end{aligned}$$
(8.3)

for \(k=0,\ldots ,n-2\), where \(d_{k+3}\cdots d_n=1\) if \(k=n-2\).

Proof

Making the substitutions \(m=n\), \(k=k-1\), \(d_i-\alpha _i=a_i\), \(d_i-\beta _i=b_i\), and \(d_i=e_i\), the inequality follows at once from Theorem 8.5.

9 Second generalized Hamming weight

Let \(A_1,\ldots ,A_{s-1}\) be subsets of \({\mathbb {F}}_q\) and let \( {\mathbb {X}}:=[A_1 \times \cdots \times A_{s-1} \times \{1\}] \subset \mathbb {P}^{s-1} \) be a projective Cartesian set, where \(d_i=|A_i|\) for all \(i=1,\ldots ,s-1\) and \(2 \le d_1 \le \cdots \le d_{s-1}\). The Reed–Muller-type code \(C_{{\mathbb {X}}}(d)\) is called an affine Cartesian code [23]. If \({\mathbb {X}}^*=A_1 \times \cdots \times A_{s-1}\), then \(C_{{\mathbb {X}}}(d)=C_{{\mathbb {X}}^*}(d)\) [23]. Assume \(d=\sum _{i=1}^{k}\left( d_i-1\right) +\ell \), where \(k,\ell \) are integers such that \(0\le k\le s-2\) and \(1\le \ell \le d_{k+1}-1\).

Lemma 9.1

We can find two linearly independent polynomials F and G\(\in S_{\le d}\) such that

$$\begin{aligned}&|V_{{\mathbb {X}}^*} (F) \cap V_{{\mathbb {X}}^*} (G)|\\&\quad = \left\{ \begin{array}{lll} d_1 \cdots d_{s-1}-(d_{k+1}-\ell +1) d_{k+2} \cdots d_{s-1}+d_{k+3} \cdots d_{s-1} &{} {\text{ if }} &{} k<s-3, \\ d_1 \cdots d_{s-1}-(d_{k+1}-\ell +1) d_{k+2} \cdots d_{s-1}+1 &{} {\text{ if }} &{} k=s-3, \\ d_1 \cdots d_{s-1}-d_{s-1}+\ell -1 &{} {\text{ if }} &{} k=s-2. \end{array} \right. \end{aligned}$$

ProofCase (I)\(k \le s-3\). Similar to [23], we take \( A_i=\{\beta _{i,1}, \ldots ,\beta _{i,d_i}\}\), for \(i=1,\ldots ,s-1\). Also, for \(i=1,\ldots ,k\), let

$$\begin{aligned}&f_i:=(\beta _{i, 1}-t_i)(\beta _{i,2}-t_i) \cdots (\beta _{i, d_{i-1}}-t_i),\\&g:=(\beta _{k+1, 1}-t_{k+1})(\beta _{k+1,2}-t_{k+1}) \cdots (\beta _{k+1, \ell -1}-t_{k+1}). \end{aligned}$$

Setting \(h_1:=\beta _{k+1, \ell }-t_{k+1}\) and \(h_2:=\beta _{k+2, \ell }-t_{k+2}\). We define \(F:=f_1 \cdots f_k \cdot g \cdot h_1\) and \(G:=f_1 \cdots f_k \cdot g \cdot h_2\). Notice that \(\deg F=\deg G=\sum _{i=1}^k (d_i-1)+\ell =d\) and that they are linearly independent over \({\mathbb {F}}_q\). Let

$$\begin{aligned}&V_1:=(A_1 \times \cdots \times A_{s-1}) \setminus (V_{{\mathbb {X}}^*} (F) \cap V_{{\mathbb {X}}^*} (G)),\\&V_2:=\{\beta _{1,d_1}\} \times \cdots \times \{\beta _{k,d_k}\} \times \{\beta _{k+1,i}\}_{i=\ell }^{d_{k+1}} \times A_{k+2} \times \cdots \times A_{s-1}. \end{aligned}$$

It is easy to see that \(V_1 \subset V_2\) and \((V_2 \setminus V_1) \cap (V_{{\mathbb {X}}^*}(F) \cap V_{{\mathbb {X}}^*}(G))=V_3\), where

$$\begin{aligned} V_3=\left\{ \begin{array}{lll} \{\beta _{1,d_1}\} \times \cdots \times \{\beta _{k,d_k}\} \times \{\beta _{k+1,\ell }\} \times \{\beta _{k+2,\ell }\} \times A_{k+3} \times \cdots \times A_{s-1} &{} {\text{ if }} &{} k<s-3, \\ \{\beta _{1,d_1}\} \times \cdots \times \{\beta _{k,d_k}\} \times \{\beta _{k+1,\ell }\} \times \{\beta _{k+2,\ell }\} &{} {\text{ if }} &{} k=s-3. \end{array} \right. \end{aligned}$$

Therefore,

$$\begin{aligned} |V_1|=|V_2|-|V_3|=\left\{ \begin{array}{lll} (d_{k+1}-\ell +1)d_{k+2} \cdots d_{s-1}-d_{k+3} \cdots d_{s-1} &{} {\text{ if }} &{} k<s-3, \\ (d_{k+1}-\ell +1) d_{k+2} \cdots d_{s-1}-1 &{} {\text{ if }} &{} k=s-3, \end{array} \right. \end{aligned}$$

and the claim follows because \(|V_{{\mathbb {X}}^*}(F) \cap V_{{\mathbb {X}}^*}(G)|=d_1 \cdots d_{s-1}-|V_1|\).

Case (II): \(k=s-2\). As \(\ell \le d_{k+1}-1\), \(\ell +1 \le d_{k+1}\). Let \(h_3:=\beta _{k+1,\ell +1}-t_{k+1}\), and \(F, f_i, g, h_1\) as in Case (I). Let \(G':=f_1 \cdots f_k \cdot g \cdot h_3\). If

$$\begin{aligned}&V_1':=(A_1 \times \cdots \times A_{s-1}) \setminus (V_{{\mathbb {X}}^*} (F) \cap V_{{\mathbb {X}}^*} (G')), \\&V_2':=\{\beta _{1,d_1}\} \times \cdots \times \{\beta _{k,d_k}\} \times \{\beta _{k+1,i}\}_{i=\ell }^{d_{k+1}}, \end{aligned}$$

then (because \(h_1\) and \(h_3\) do not have common zeros) \(V_1'=V_2'\) and thus

$$\begin{aligned} |V_1'|=d_{k+1}-\ell +1=d_{s-1}-\ell +1. \end{aligned}$$

The result follows because \(|V_{{\mathbb {X}}^*} (F) \cap V_{{\mathbb {X}}^*} (G')|=d_1 \cdots d_{s-1}-|V_1'|\). \(\square \)

Lemma 9.2

[26, Lemma 3.3] Let \(L\subset S\) be the ideal \((t_1^{d_1},\ldots ,t_{s-1}^{d_{s-1}})\), where \(d_1,\ldots ,d_{s-1}\) are in \({\mathbb {N}}_+\). If \(t^a=t_1^{a_1}\cdots t_s^{a_s}\), \(a_j\ge 1\) for some \(1\le j\le s-1\), and \(a_i\le d_i-1\) for \(i\le s-1\), then

$$\begin{aligned} \deg (S/(L,t^a)) =\deg (S/(L,t_1^{a_1}\cdots t_{s-1}^{a_{s-1}}))= d_1\cdots d_{s-1}- \prod _{i=1}^{s-1}(d_i-a_i). \end{aligned}$$

We come to one of our applications to coding theory.

Theorem 9.3

Let \(A_i\), \(i=1,\ldots ,s-1\), be subsets of \({\mathbb {F}}_q\), and let \({\mathbb {X}}\subset \mathbb {P}^{s-1}\) be the projective Cartesian set given by \({\mathbb {X}}=[A_1\times \cdots \times A_{s-1}\times \{1\}]\). If \(d_i=|A_i|\) for \(i=1,\ldots ,s-1\) and \(2\le d_1\le \cdots \le d_{s-1}\), then

$$\begin{aligned} \delta _{\mathbb {X}}(d,2)=\left\{ \begin{array}{ll}\left( d_{k+1}-\ell +1\right) d_{k+2}\cdots d_{s-1}-d_{k+3}\cdots d_{s-1}&{} \text{ if } k<s-3,\\ \left( d_{k+1}-\ell +1\right) d_{k+2}\cdots d_{s-1}-1&{} \text{ if } k=s-3,\\ \qquad \qquad d_{s-1}-\ell +1&{} \text{ if } k=s-2,\\ \qquad \qquad \qquad 2&{} \text{ if } d\ge \sum \limits _{i=1}^{s-1}\left( d_i-1\right) , \end{array} \right. \end{aligned}$$

where \(0\le k\le s-2\) and \(\ell \) are integers such that \(d=\sum _{i=1}^{k}\left( d_i-1\right) +\ell \) and \(1\le \ell \le d_{k+1}-1\).

Proof

We set \(n=s-1\), \(I=I({\mathbb {X}})\), and \(L=(t_1^{d_1},\ldots ,t_n^{d_n})\). By [37, Theorem 1, Corollary 1], we get \(\delta _{\mathbb {X}}(d,2)=2\) for \(d\ge \sum _{i=1}^{s-1}(d_i-1)\). Thus, we may assume \(d<\sum _{i=1}^{s-1}(d_i-1)\). First, we show the inequality “\(\ge \)”. Let \(\prec \) be a graded monomial order with \(t_1\succ \cdots \succ t_s\). The initial ideal \(\mathrm{in}_\prec (I)\) of I is equal to \(L=(t_1^{d_1},\ldots ,t_n^{d_n})\); see [23]. Let \(F=\{t^a,t^b\}\) be an element of \(\mathcal {M}_{\prec ,d,2}\), that is, \(t^a=t_1^{a_1}\cdots t_s^{a_s}\), \(t^b=t_1^{b_1}\cdots t_s^{b_s}\), \(d=\sum _{i=1}^sa_i=\sum _{i=1}^sb_i\), \(a\ne b\), \(a_i\le d_i-1\) and \(b_i\le d_i-1\) for \(i=1,\ldots ,n\), and \((L:(F))\ne L\). In particular, from the last condition it follows readily that \(a_i\ne 0\) and \(b_j\ne 0\) for some \(1\le i,j\le n\). There are exact sequences of graded S-modules

$$\begin{aligned}&0\rightarrow (S/((L,t^a):t^b))[-|b|]{\mathop {\rightarrow }\limits ^{t^b}} S/(L,t^a)\rightarrow S/(L,t^a,t^b)\rightarrow 0,\ \ \ \ \ \ \ \ \ \ \ \\&0\rightarrow (S/((L,t^b):t^a))[-|a|]{\mathop {\rightarrow }\limits ^{t^a}} S/(L,t^b)\rightarrow S/(L,t^a,t^b)\rightarrow 0, \end{aligned}$$

where \(|a|=\sum _{i=1}^sa_i\). From the equalities,

$$\begin{aligned}&((L,t^a):t^b)=(L:t^b)+(t^a:t^b)=(t_1^{d_1-b_1},\ldots ,t_{n}^{d_n-b_n}, \prod _{i=1}^s t_i^{\max \{a_i,b_i\}-b_i}),&\\&((L,t^b):t^a)=(L:t^a)+(t^b:t^a)=(t_1^{d_1-a_1},\ldots ,t_{n}^{d_n-a_n}, \prod _{i=1}^s t_i^{\max \{a_i,b_i\}-a_i}),&\end{aligned}$$

it follows that either \(((L,t^a):t^b)\) or \(((L,t^b):t^a)\) is contained in \((t_1,\ldots ,t_n)\). Hence, at least one of these ideals has height n. Therefore, setting

$$\begin{aligned} P(a,b)=\prod _{i=1}^n(d_i-a_i)+ \prod _{i=1}^n(d_i-b_i)-\prod _{i=1}^n\min \{d_i-a_i,d_i-b_i\}, \end{aligned}$$

and using Lemma 9.2 it is not hard to see that the degree of \(S/(L,t^a,t^b)\) is

$$\begin{aligned} \deg (S/(L,t^a,t^b))=\prod _{i=1}^nd_i-P(a,b), \end{aligned}$$

and the second generalized footprint function of I is

$$\begin{aligned} \mathrm{fp}_I(d,2)=\min \left\{ P(a,b)\vert \, \{t^a,t^b\}\in \mathcal {M}_{\prec ,d,2} \right\} . \end{aligned}$$
(9.1)

Making the substitution \(-\ell =\sum _{i=1}^{k}\left( d_i-1\right) -\sum _{i=1}^sa_i\) and using the fact that \(\mathrm{fp}_{I({\mathbb {X}})}(d,r)\) is less than or equal to \(\delta _{\mathbb {X}}(d,r)\) (see Theorem 4.9) it suffices to show the inequalities

$$\begin{aligned} P(a,b)\ge \left( \sum _{i=1}^{k+1}(d_i-a_i)-(k-1)- a_s-\sum _{i=k+2}^na_i\right) d_{k+2}\cdots d_n-d_{k+3}\cdots d_n, \end{aligned}$$
(9.2)

for \(\{t^a,t^b\}\in \mathcal {M}_{\prec ,d,2}\) if \(0\le k\le s-3\), where \(d_{k+3}\cdots d_n=1\) if \(k=s-3\), and

$$\begin{aligned} P(a,b)\ge \sum _{i=1}^{s-1}(d_i-a_i)-(s-3)- a_s, \end{aligned}$$
(9.3)

for \(\{t^a,t^b\}\in \mathcal {M}_{\prec ,d,2}\) if \(k=s-2\). As \((a_1,\ldots ,a_n)\) is not equal to \((b_1,\ldots ,b_n)\), one has that either \(\prod _{i=1}^nd_i-\prod _{i=1}^n(d_i-a_i)\ge 1\) or \(\prod _{i=1}^nd_i-\prod _{i=1}^n(d_i-b_i)\ge 1\). If \(a_s\ge 1\) or \(b_s\ge 1\) (resp. \(a_s=b_s=0\)), the inequality of Eq. (9.2) follows at once from [25, Proposition 5.7] (resp. Lemma 8.6). If \(a_s\ge 1\) or \(b_s\ge 1\) (resp. \(a_s=b_s=0\)), the inequality of Eq. (9.3) follows at once from [25, Proposition 5.7] (resp. Lemma 8.3). This completes the proof of the inequality “\(\ge \)”.

The inequality “\(\le \)” follows directly from Lemma 9.1. \(\square \)

Using Theorem 9.3, one recovers the following main result of [14].

Corollary 9.4

[14, Theorem 18] Let \(K={\mathbb {F}}_q\) be a finite field and let \(\mathbb {T}\) be a projective torus in \(\mathbb {P}^{s-1}\). If \(d\ge 1\) and \(s\ge 3\), then

$$\begin{aligned} \delta _\mathbb {T}(d,2)= \left\{ \begin{array}{lll} (q-1)^{s-(k+3)}[(q-1)(q-\ell )-1] &{} {\text{ if }} &{} 1 \le d \le \eta , \\ q-\ell &{} {\text{ if }} &{} \eta< d < \gamma , \\ 2 &{} \text{ if } &{} d \ge \gamma , \end{array} \right. \end{aligned}$$

where k and \(\ell \) are the unique integers such that \(d=k(q-2)+\ell \), \(k \ge 0\), \(1 \le \ell \le q-2\), \(\eta =(q-2)(s-2)\) and \(\gamma =(q-2)(s-1)\).

Another of our applications to coding theory is the following purely combinatorial formula for the second generalized Hamming weight of an affine Cartesian code which is quite different from the corresponding formula of [1, Theorem 5.4].

Theorem 9.5

Let \(\mathcal {P}_d\) be the set of all pairs (ab), ab in \({\mathbb {N}}^s\), \(a=(a_1,\ldots ,a_s)\), \(b=(b_1,\ldots ,b_s)\), such that \(a\ne b\), \(d=\sum _{i=1}^sa_i=\sum _{i=1}^sb_i\), \(1\le a_i,b_i\le d_i-1\) for \(i=1,\ldots ,n\), \(n:=s-1\), \(a_i\ne 0\) and \(b_j\ne 0\) for some \(1\le i,j\le n\). If \({\mathbb {X}}=[A_1\times \cdots \times A_{n}\times \{1\}]\subset \mathbb {P}^n\), with \(A_i\subset {\mathbb {F}}_q\), \(d_i=|A_i|\), and \(2\le d_1\le \cdots \le d_{n}\), then

$$\begin{aligned} \mathrm{fp}_{I({\mathbb {X}})}(d,2)=\delta _{\mathbb {X}}(d,2) =\min \left\{ P(a,b)\vert \, (a,b)\in \mathcal {P}_d\right\} \ \text{ for } \ d\le \textstyle \sum _{i=1}^n (d_i-1), \end{aligned}$$

where \(P(a,b)=\prod _{i=1}^{n}(d_i-a_i)+ \prod _{i=1}^{n}(d_i-b_i)-\prod _{i=1}^{n}\min \{d_i-a_i,d_i-b_i\}\).

Proof

Let \(\psi (d)\) be the formula for \(\delta _{\mathbb {X}}(d,2)\) given in Theorem 9.3. Then, using Eqs. (9.2) and  (9.3) one has \(\psi (d)\le \mathrm{fp}_{I({\mathbb {X}})}(d,2)\). By Theorem 4.9, one has \(\mathrm{fp}_{I({\mathbb {X}})}(d,r)\le \delta _{\mathbb {X}}(d,r)\), and by Lemma 9.1 one has \(\delta _{\mathbb {X}}(d,r)\le \psi (d)\). Therefore,

$$\begin{aligned} \psi (d)\le \mathrm{fp}_{I({\mathbb {X}})}(d,2)\le \delta _{\mathbb {X}}(d,r)\le \psi (d). \end{aligned}$$

Thus, we have equality everywhere and the result follows from Eq. (9.1).

Remark 9.6

Let \(\psi (d)\) be the formula for \(\delta _{\mathbb {X}}(d,2)\) given in Theorem 9.3. Then,

$$\begin{aligned} \psi (d)=\min \left\{ P(a,b)\vert \, (a,b)\in \mathcal {P}_d\right\} \end{aligned}$$

for \(d\le \textstyle \sum _{i=1}^n (d_i-1)\). This equality is interesting in its own right.