24
On the next-to-minimal weight of affine cartesian codes ıcero Carvalho and V. G. Lopez Neumann 1 FaculdadedeMatem´atica Universidade Federal de Uberlˆandia Av. J. N. ´ Avila 2121, 38.408-902 - Uberlˆandia - MG, Brazil [email protected] [email protected] Abstract. In this paper we determine many values of the second least weight of codewords, also known as the next-to-minimal Hamming weight, for a type of affine variety codes, obtained by evaluating polynomials of degree up to d on the points of a cartesian product of n subsets of a finite field F q . Such codes are called affine cartesian codes, and were recently introduced by H. opez, C. Renter´ ıa-Marquez and R. Villarreal (see [17]). Our work extends, to affine cartesian codes, the results obtained by Rolland in [19] for generalized Reed-Muller codes. Keywords. Next-to-minimal Hamming weight, affine cartesian codes, Reed-Muller type codes, Gr¨ obner bases AMS Classification: 11T71, 14G50, 94B60, 13P10 1 Introduction Let K := F q be a field with q elements and let A 1 ,...,A n be a collection of non-empty subsets of K . Consider an affine cartesian set X := A 1 ×···× A n := {(a 1 : ··· : a n )| a i A i for all i}⊂ A n , where A n is the n-dimensional affine space defined over K . For a nonnegative integer d write K [X] d for the K -vector space formed by the poly- nomials in K [X 1 ,...,X n ] of degree up to d together with the zero polynomial. We de- note by d i the cardinality of A i , for i =1,...,n. Clearly |X | n i=1 d i =: e m and let P 1 ,...,P e m be the points of X . Define φ d : K [X] d K e m as the evaluation morphism φ d (g)=(g(P 1 ),...,g(P e m )). Definition 1.1 The image C X (d) of φ d is a vector subspace of K e m called the affine cartesian code (of order d) defined over the sets A 1 ,...,A n . 1 Both authors were partially supported by grants from FAPEMIG and CNPq (proc. 480477/2013-2). 1

Second Weight Affine Cartesian Codes Carvalho Neumann

Embed Size (px)

DESCRIPTION

In this paper the authors study the second Hamming weight of affine cartesian coes, determining it for almost all cases.

Citation preview

Page 1: Second Weight Affine Cartesian Codes Carvalho Neumann

On the next-to-minimal weight of affine cartesiancodes

Cıcero Carvalho and V. G. Lopez Neumann1

Faculdade de MatematicaUniversidade Federal de Uberlandia

Av. J. N. Avila 2121, 38.408-902 - Uberlandia - MG, Brazil

[email protected] [email protected]

Abstract. In this paper we determine many values of the second least weight of codewords,

also known as the next-to-minimal Hamming weight, for a type of affine variety codes, obtained

by evaluating polynomials of degree up to d on the points of a cartesian product of n subsets of

a finite field Fq. Such codes are called affine cartesian codes, and were recently introduced by H.

Lopez, C. Renterıa-Marquez and R. Villarreal (see [17]). Our work extends, to affine cartesian

codes, the results obtained by Rolland in [19] for generalized Reed-Muller codes.

Keywords. Next-to-minimal Hamming weight, affine cartesian codes, Reed-Muller type codes,

Grobner bases

AMS Classification: 11T71, 14G50, 94B60, 13P10

1 Introduction

Let K := Fq be a field with q elements and let A1, . . . , An be a collection of non-empty

subsets of K. Consider an affine cartesian set

X := A1 × · · · × An := {(a1 : · · · : an)| ai ∈ Ai for all i} ⊂ An,

where An is the n-dimensional affine space defined over K.

For a nonnegative integer d write K[X]≤d for the K-vector space formed by the poly-

nomials in K[X1, . . . , Xn] of degree up to d together with the zero polynomial. We de-

note by di the cardinality of Ai, for i = 1, . . . , n. Clearly |X | = Πni=1di =: m and let

P1, . . . , Pm be the points of X . Define φd : K[X]≤d → Km as the evaluation morphism

φd(g) = (g(P1), . . . , g(Pm)).

Definition 1.1 The image CX (d) of φd is a vector subspace of Km called the affine

cartesian code (of order d) defined over the sets A1, . . . , An.

1Both authors were partially supported by grants from FAPEMIG and CNPq (proc. 480477/2013-2).

1

Page 2: Second Weight Affine Cartesian Codes Carvalho Neumann

These codes were introduced in [17], and also appeared independently and in a gen-

eralized form in [12]. In the special case where A1 = · · · = An = K we have the

well-known generalized Reed-Muller code of order d. An affine cartesian code is a type

of affine variety code, as defined in [10]. In [17] the authors prove that we may ignore, in

the cartesian product, sets with just one element and moreover may always assume that

2 ≤ d1 ≤ · · · ≤ dn. They also completely determine the parameters of these codes, which

are as follows.

Theorem 1.2 [17, Thm. 3.1 and Thm. 3.8]

1) The dimension of CX (d) is m (i.e. φd is surjective) if d ≥∑n

i=1(d1 − 1), and for

0 ≤ d <∑n

i=1(d1 − 1) we have

dim(CX (d)) =

(n+ d

d

)−

n∑i=1

(n+ d− did− di

)+ · · ·+

(−1)j∑

1≤i1<···<ij≤n

(n+ d− di1 − · · · − dijd− di1 − · · · − dij

)+ · · ·+ (−1)n

(n+ d− d1 − · · · − dnd− d1 − · · · − dn

)

where we set(ab

)= 0 if b < 0.

2) The minimum distance δX (d) of CX (d) is 1, if d ≥∑n

i=1(di − 1), and for 0 ≤ d <∑ni=1(di − 1) we have

δX (d) = (dk+1 − `)n∏

i=k+2

di

where k and ` are uniquely defined by d =∑k

i=1(di − 1) + ` with 0 ≤ ` < dk+1 − 1 (if

k + 1 = n we understand that∏n

i=k+2 di = 1, and if d < d1 − 1 then we set k = 0 and

` = d).

It recently came to our knowledge that the above formula for the minimum distance

can also be obtained from a paper by N. Alon and Z. Furedi (see [1]).

One is not only interested in the minimum distance, i.e. the minimal Hamming weight

of the nonzero words of CX (d), but also in the other Hamming weights of codewords. For

the generalized Reed-Muller codes, the study of the next-to-minimal weight (or second

lowest Hamming weight) started with Cherdieu and Rolland ([5]), and then proceeded

with results from Geil ([11]) and Rolland ([19]). It is now completely determined by

combining results from an unpublished thesis by D. Erickson ([9]) with [11] or [19].

As in the above Theorem, write d =∑k

i=1(di − 1) + `, with 0 ≤ ` < dk+1 − 1. In this

work we extend the results of Rolland in [19] to affine cartesian codes, determining the

2

Page 3: Second Weight Affine Cartesian Codes Carvalho Neumann

next-to-minimal weights of CX (d) for all values of d ≥ d1 − 1 except in some cases where

` = 1.

In [4] there are results on higher Hamming weights of affine cartesian codes, and in

that work the following function, which will play an important role in the present work,

was introduced. For n-tuples (α1, . . . , αn) with nonnegative integers as entries and such

that 0 ≤ αi < di for all i = 1, . . . , n, we define

m(α1, . . . , αn) :=n∏i=1

(di − αi).

We will need the following result.

Lemma 1.3 [4, Lemma 2.1] Let 0 < d1 ≤ · · · ≤ dn and 0 ≤ d ≤∑n

i=1(di−1) be integers.

Let 0 ≤ αi < di, where ai is an integer for all i = 1, . . . , n. Then

min{m(α1, . . . , αn) |α1 + · · ·+ αn ≤ d} = (dk+1 − `)n∏

i=k+2

di

where k and ` are uniquely defined by d =∑k

i=1(di − 1) + `, with 0 ≤ ` < dk+1 − 1 (if

d < d1−1 then take k = 0 and ` = d, if k+1 = n then we understand that∏n

i=k+2 di = 1).

Let µ1(d) := (dk+1 − `)∏n

i=k+2 di, and observe that µ1(d) = δX (d). Actually, one may

use the above Lemma to prove Theorem 1.2 (2) (see e.g. [4]).

This paper is organized as follows. In Section 2 we determine the next-to-minimal

value for the function m restricted to n-tuples whose entries sum at most d (see Theorem

2.4), and we show that this value actually appear as weight of codewords of CX (d), so it

serves as an upper bound for the next-to-minimal weight of CX (d). In Section 3, using

methods from Grobner basis theory (which have already appeared in [11], [19] and [4]),

we determine a lower bound for next-to-minimal weight of CX (d) (see Proposition 3.9),

whose value then may be determined precisely in some cases by comparing the upper and

lower bounds (see Theorem 3.10).

We denote by N0 the set of nonnegative integers, while n-tuples in Nn0 are denoted by

bold letters, as in α = (α1, . . . , αn) ∈ Nn0 and monomials Xα1

1 . · · · .Xα11 are denoted by

Xα.

We observe that in [4, Thm. 2.6] the next-to-minimal weight of affine cartesian codes

has been determined in the case where k = n−1 so we may concentrate on the case where

k < n− 1. To avoid a series of technicalities we will also assume that d ≥ d1 − 1, which

will guarantee that k ≥ 1, although the case d < d1 − 1 can be treated with the same

techniques used here (see e.g. Theorems 2.4 and 2.5 in [4]). Thus in this work we assume

that 1 ≤ k ≤ n− 2 (hence n ≥ 3), and we will also assume that 3 ≤ d1 ≤ · · · ≤ dn.

3

Page 4: Second Weight Affine Cartesian Codes Carvalho Neumann

2 Next-to-minimal value for m(α)

In this section we want to find the next-to-minimal value of m restricted to n-tuples whose

entries sum at most d, and we will need the following definition.

Definition 2.1 We say that α = (α1, . . . , αn) ∈ Nn0 is a normalized n-tuple if whenever

di−1 < di = · · · = di+s < di+s+1 we have αi ≥ αi+1 ≥ · · · ≥ αi+s.

In what follows we will use the following operations on the n-tuples in the domain

of the function m, i.e. n-tuples α such that 0 ≤ αi < di for all i ∈ {1, . . . , n}. Let

i, j ∈ {1, . . . , n} with i 6= j. To apply M1(i, j) to such an n-tuple α obtaining an n-

tuple α′ also in the domain of m means that α′i = αi + αj, α′j = 0 and α′` = α` for all

` ∈ {1, . . . , n} \ {i, j}, thus to apply M1(i, j) to α we must have αi + αj ≤ di− 1, and we

get

m(α)−m(α′) = (αiαj + (dj − di)αj)n∏

`=1` 6=i, j

(d` − α`). (2.1)

Also, to apply M2(i, j) to α obtaining an n-tuple α′′ in the domain of m means that

α′′i = di − 1, α′′j = αj − (di − 1 − αi) and α′′` = α` for all ` ∈ {1, . . . , n} \ {i, j}, thus to

apply M2(i, j) we must have αi + αj ≥ di − 1, and we get

m(α)−m(α′′) = (di − αi − 1)(dj − αj − 1)n∏

`=1`6=i, j

(d` − α`). (2.2)

Let d be a nonnegative integer and write d =∑k

i=1(di − 1) + `, with 0 ≤ ` < dk+1 − 1

as in Lemma 1.3.

Lemma 2.2 The normalized n-tuples α, with α1 + · · · + αn ≤ d and 0 ≤ αi < di for all

i = 1, . . . , n, such that m(α) is minimal, i.e. m(α) = (dk+1 − `)∏n

i=k+2 di, are of the

form

a = (d1 − 1, . . . , dk − 1, `, 0 . . . , 0) or

b(j) = (d1 − 1, . . . , dj−1 − 1, dj − (dk+1 − `), dj+1 − 1, . . . , dk − 1, dk+1 − 1, 0 . . . , 0)

for j ∈ {1, . . . , k}.

Before proving the lemma we note that b(j) exists only if dj ≥ dk+1 − ` and dj+1 > dj,

because b must have non-negatives entries and be normalized. In particular, if ` = 0 then

4

Page 5: Second Weight Affine Cartesian Codes Carvalho Neumann

b(j) doesn’t exist for all 1 ≤ j ≤ k, and if ` = 1 and b(j) exists then dj = dk+1 − 1 and

dj+1 = · · · = dk+1.

Proof: Suppose that α = (α1 . . . , αn) is a normalized n-tuple such that αi = di − 1 for

all i ∈ {1, . . . , k} and α 6= a. This means that αk+1 < ` and for some t > k + 1 we have

1 ≤ αt ≤ ` (observe that since α is normalized, if αk+1 = 0 we must have dt > dk+1).

Appling M1(k + 1, t) to α we obtain α′ such that m(α) > m(α′) (cf. (2.1)).

Suppose now that α = (α1 . . . , αn) is a normalized n-tuple such that 0 ≤ αi < di − 1

for some i ∈ {1, . . . , k} and α 6= b(j), for all 1 ≤ j ≤ k. Then for some t ≥ k + 1 we have

αt > 0 (observe that if αi = 0 then dt > di becauseα is normalized). If αi+αt ≤ di−1 then

applying M1(i, t) to α we obtain an n-tuple α′ such that m(α) > m(α′). If αi+αt > di−1

then applying M2(i, t) to α we obtain an n-tuple α′′ such that m(α) > m(α′′), provided

that αt < dt − 1 (cf. (2.2)). When αt = dt − 1 we have m(α) = m(α′′). Since α is

normalized we have di < dt, so from 0 < α′′t < dt − 1 and t ≥ k + 1 we have α′′ 6= b(j) for

all j = 1, . . . , k, we also have α′′ 6= a because α′′ = a would imply t = k+ 1 which would

then imply α = b(j) for some j, a contradiction. Thus for some s ∈ {1, . . . , k} we have

0 ≤ α′′s < ds − 1 and applying M1(s, t) to α′′, in case α′′s + α′′t ≤ ds − 1, or M2(s, t) to α′′,

in case α′′s + α′′t > ds − 1, we get an n-tuple α′′′ such that m(α′′) > m(α′′′). �

Now we look for the next-to-minimal value of the function m restricted to n-tuples

whose entries sum at most d. When we say that we apply N(i, t) to an n-tuple α and

obtain an n-tuple α′ we mean that α′i = αi − 1, α′t = αt + 1 and α′` = α` for all

` ∈ {1, . . . , n} \ {i, j}, and to apply L(i) to an n-tuple α obtaining an n-tuple α′′ means

that α′i = αi − 1, and α′` = α` for all ` ∈ {1, . . . , n} \ {i}. In what follows we want to

apply these operations to a or b(j) in the cases where we obtain an n-tuple with nonzero

entries and with the i-th entry less than di for all i = 1, . . . , n, because then we can apply

the function m and compare the result with m(a) and m(b(j)). We divide this analysis

in five cases.

Case I. Let i ∈ {1, . . . , k} and t ∈ {k + 2, . . . , n}, applying N(i, t) to a we obtain an

n-tuple a′, and m(a′) − m(a) = (dt − 2)(dk+1 − `)∏n

s=k+2 , s 6=t ds > 0. Let b(j) be such

that b(j)r > 0 for some r ∈ {1, . . . , k + 1}, r 6= j , applying N(r, t) to b(j) we obtain an

n-tuple b′(j), and

m(b′(j))−m(b(j)) = (dt − 2)(dk+1 − `)n∏

s=k+2 , s 6=t

ds = m(a′)−m(a) > 0

.

5

Page 6: Second Weight Affine Cartesian Codes Carvalho Neumann

Case II. Now let i ∈ {1, . . . , k} and let a′ be the n-tuple obtained by applying N(i, k+ 1)

to a. Let b′(j) be the n-tuple we obtain by applying N(r, j) to b(j), where r ∈ {1, . . . , k+1}and r 6= j. Then

m(a′)−m(a) = m(b′(j))−m(b(j)) = (dk+1 − `− 2)n∏

s=k+2

ds

so we get m(a′)−m(a) = m(b′(j))−m(b(j)) > 0 provided ` < dk+1 − 2.

Case III. Let t ∈ {k + 2, . . . , n}, assume that ` > 0 and let a′ be the n-tuple obtained

by applying N(k + 1, t) to a. Or assume that b(j) is such that b(j)j > 0 (i.e. assume that

` > dk+1 − dj) and apply N(k + 1, t) to b(j). In both situations we have

m(a′)−m(a) = m(b′(j))−m(b(j)) = (dt − dk+1 + `− 1)n∏

s=k+2,s 6=t

ds

hence m(a′)−m(a) = m(b′(j))−m(b(j)) > 0 provided that ` > 0 and either dt > dk+1 or

` > 1.

Case IV. Assume that ` > 0 and let a′′ be the n-tuple obtained by applying L(k + 1) to

a. Or assume that b(j) is such that b(j)j > 0 and apply L(j) to b(j) obtaining b′′(j). In

both situations we have

m(a′)−m(a) = m(b′(j))−m(b(j)) =n∏

s=k+2

ds > 0.

Case V. Let i ∈ {1, . . . , k} and apply L(i) to a, or let r ∈ {1, . . . , k + 1} \ {j} and apply

L(r) to b(j). We have

m(a′′)−m(a) = m(b′′(j))−m(b(j)) = (dk+1 − `)n∏

s=k+2

ds > 0.

We will show next that the next-to-minimal value of m is attained at one of the n-

tuples a′, b′(j), a′′ and b′′(j) which appear in the cases studied above. Actually, we may

concentrate on the n-tuples which appear in cases I-IV because in both cases I and V we

6

Page 7: Second Weight Affine Cartesian Codes Carvalho Neumann

do not have any conditions on ` or on the di’s and since t ∈ {k + 2, . . . , n} in case I we

have that

(dk+1 − `)n∏

s=k+2

ds > (dt − 2)(dk+1 − `)n∏

s=k+2 , s 6=t

ds

so the least difference appears in case I.

Lemma 2.3 The next-to-minimal value of m(α), where∑n

i=1 αi ≤ d and 0 ≤ αi < di for

all i = {1, . . . , n}, occurs when m(α) = m(α), where α is one of the n-tuples a′, b′(j), a′′

or b′′(j) obtained in cases I-IV above.

Proof: Let α be a normalized n-tuple with∑n

i=1 αi ≤ d, 0 ≤ αi < di for all i =

{1, . . . , n} and distinct from a, b(j), a′, b′(j), a′′ and b′′(j) obtained in cases I-IV above, for

all j ∈ {1, . . . , k}. If∑n

i=1 αi < d then adding 1 to an entry αi such that 0 ≤ αi < di − 1

we get an n-tuple α′ such that m(α) > m(α′), and since α is distinct from a′′ and b′′(j)

we get that α′ is distinct from a and b(j), so m(α) > m(α′) > m(a). So from now on we

assume that∑n

i=1 αi = d.

Suppose that there exist i1, i2 such that 0 < αi1 < di1 − 1, 0 < αi2 < di2 − 1 and

di1 − αi1 ≥ di2 − αi2 . Let α′ be obtained from α by taking α′i1 = αi1 − 1, α′i2 = αi2 + 1

and α′t = αt for all t ∈ {1, . . . , n} \ {i1, i2}. Since α is different from a′ and b′(j) we get

that α′ is different from a and b(j). We have

m(α)−m(α′) = ((di1 − αi1)(di2 − αi2)− (di1 − αi1 + 1)(di2 − αi2 − 1)) ·n∏

s=1 , s 6=i1,i2

(ds − αs)

= ((di1 − αi1)− (di2 − αi2) + 1)n∏

s=1 , s 6=i1,i2

(ds − αs) > 0

so that m(α) > m(α′) > m(a), hence m(α) can’t be the next-to-minimal value of the

function m.

Suppose now that for some index i1, we have 0 < αi1 < di1 − 1 and for all others we

have αt = 0 or αt = dt − 1. Assume that there exits t ≥ k + 2 such that αt = dt − 1.

Then for some s ∈ {1, . . . , k + 1} we must have αs = 0, and applying M2(s, t) to α we

obtain α′′ such that α′′s = ds− 1 and 0 < α′′t < dt− 1 (observe that since α is normalized

we must have ds < dt), and from (2.2) we get m(α) = m(α′′). Since t ≥ k + 2 we know

that α′′ is neither a nor b(j), if α′′ = a′ or α′′ = b′(j) then m(α′′) ≥ min{m(a′),m(b′(j))},

7

Page 8: Second Weight Affine Cartesian Codes Carvalho Neumann

otherwise we are in the case, solved above, where there are indexes i1 and i2 such that

0 < α′′i1 < di1 − 1 and 0 < α′′i2 < di2 − 1. Assume now that for all t ∈ {k+ 2, . . . , n} \ {i1}we have αt = 0. Since α is normalized and is distinct from a, b(j), a′ and b′(j) we

must have i1 ≥ k + 2 and αi1 > 1, furthermore αs = 0 for some s ≤ k + 1. Now we

consider two cases, the first one being when αi1 > di − 1 for all i = 1, . . . , k + 1 such

that αi = 0. Then we apply M2(s, i1) to α obtaining α′′ such that α′′s = ds − 1, α′′i1 > 0

and m(α) > m(α′′) > m(a). Now we assume that αi1 ≤ du − 1 for some u ≤ k + 1

where αu = 0, and let α be an n-tuple such that αu = αi1 − 1, αi1 = 1 and αi = αi for

i ∈ {1, . . . , n} \ {u, i1}. Since∑n

i=1 αi = d and αt = 0 for all t ∈ {k + 2, . . . , n} \ {i1}we must have that α is equal to a′ or b′(j). Observe also that since α is normalized and

i1 ≥ k + 2 we have du < di1 . Then

m(α)−m(α) = (du(di1 − αi1)− (du − (αi1 − 1))(di1 − 1))∏i 6=u,i1

(di − αi)

= (αi1 − 1))(di1 − du − 1)∏i 6=u,i1

(di − αi) ≥ 0,

so that m(α) ≥ min{m(a′),m(b′(j))}.Finally, suppose that we have either αi = 0 or αi = di − 1, for all i ∈ {1, . . . , n}.

Since α is neither a nor b(j) there exists t > k + 1 such that αt = dt − 1 and a fortiorithere exists s ≤ k + 1 such that αs = 0. Since α is normalized we get ds < dt. Applying

M2(s, t) to α we get α′′ with α′′s = ds − 1 and 0 < α′′t < dt − 1, and from (2.2) we have

m(α) = m(α′′). Clearly α′′ is distinct from a and b(j), if α′′ is either a′ or b′(j) then

m(α) ≥ min{m(a′),m(b′(j))}, otherwise we are in the case, already solved, where for

some index i1, we have 0 < αi1 < di1 − 1 and for all others we have αt = 0 or αt = dt− 1.

We will now determine the next-to-minimal value of m when restricted to n-tuples α,

where 0 ≤ αi < di for all i = {1, . . . , n} and∑n

i=1 αi ≤ d, and to do that we summarize

the results of the cases I-IV above in a way that will be useful in what follows. Recall,

from Lemma 1.3, that the minimal value µ1(d) for m when restricted to such n-tuples is

µ1(d) = (dk+1 − `)∏n

i=k+2 di.

In case I we found that for any t ∈ {k + 2, . . . , n} there are n-tuples α such that

m(α) = µ1(d) + (dt − 2)(dk+1 − `)n∏

s=k+2 , s 6=t

ds = µ1(d) ·(

1 +dt − 2

dt

)> µ1(d).

8

Page 9: Second Weight Affine Cartesian Codes Carvalho Neumann

In case II we found that there are n-tuples β such that

m(β) = µ1(d) ·(

1 +dk+1 − `− 2

dk+1 − `

)> µ1(d)

provided ` < dk+1 − 2.

In case III we found that for any t ∈ {k + 2, . . . , n} there are n-tuples γ such that

m(γ) = µ1(d) ·(

1 +dt − dk+1 + `− 1

(dk+1 − `)dt

)> µ1(d)

provided ` 6= 0 and either dt > dk+1 or ` > 1.

In case IV we found that there are n-tuples δ such that

m(δ) = µ1(d) ·(

1 +1

dk+1 − `

)> µ1(d)

provided ` 6= 0.

Let µ2(d) the next-to-minimal value of m when restricted to n-tuples α, where 0 ≤αi < di for all i = {1, . . . , n} and

∑ni=1 αi ≤ d.

Theorem 2.4 The value of µ2(d) is as follows.

a) If either ` ≥ 2, or ` = 1 and 3 ≤ dk+1 = ds−1 < ds for some s ∈ {k + 2, . . . , n}, we

have

µ2(d) = µ1(d) ·(

1 +dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

)if ` ≥ 2, and

µ2(d) = µ1(d) ·(

1 +ds − dk+1

(dk+1 − 1)ds

)if ` = 1,

except when ` = 1, 3 = dk+1 = dk+2 and ds > 9, and then

µ2(d) = µ1(d) ·(

1 +1

3

).

b) If ` = 1 and 3 ≤ dk+1 = dn then

µ2(d) = µ1(d) ·(

1 +1

3

)if dk+1 = 3, and

µ2(d) = µ1(d) ·(

1 +1

dk+1 − 1

)if dk+1 > 3.

9

Page 10: Second Weight Affine Cartesian Codes Carvalho Neumann

c) If ` = 0 then

µ2(d) = µ1(d) ·(

1 +dk+1 − 2

dk+1

).

Proof: Before we start we note that the values for m found on cases I and III above arean increasing function of dt.

a) If ` < dk+1− 2 then we must consider the values found in all cases I-IV and comparing

them we get

ds − dk+1 + `− 1

(dk+1 − `)ds=

1

dk+1 − `(1− dk+1 − `+ 1

ds) <

1

dk+1 − `≤

dk+1 − `− 2

dk+1 − `= 1− 2

dk+1 − `≤ 1− 2

dk+2

=dk+2 − 2

dk+2

.

Observe that if ` ≥ 2 the minimum of (ds − dk+1 + `− 1)/(dk+1 − `)ds is (dk+2 − dk+1 +

`− 1)/(dk+1 − `)dk+2.

If ` = dk+1 − 2 then we don’t have to consider case II. As above we have

ds − dk+1 + `− 1

(dk+1 − `)ds=ds − 3

2ds<

1

dk+1 − `=

1

2.

Alsods − 3

2ds≤ dk+2 − 2

dk+2

⇔ 1

2− 3

2ds≤ dk+2 − 2

dk+2

⇔ −dk+2 + 4

2dk+2

≤ 3

2ds

and the last inequality is true if dk+2 ≥ 4. If dk+2 = 3 the inequality holds if and only if

ds ≤ 9. Observe that if ` ≥ 2 then the minimum of (ds − 3)/2ds is (dk+2 − 3)/2dk+2.

b) If dk+1 = 3 we only have to consider cases I and IV and the minimal value is in case I.

If dk+1 > 3 we must also consider case II and from

1

dk+1 − 1≤ dk+1 − 3

dk+1 − 1<dk+1 − 2

dk+1

.

the claim follows.

c) If ` = 0 we must compare the values in cases I and II, and from

dk+1 − 2

dk+1

≤ dk+2 − 2

dk+2

the claim follows. �

10

Page 11: Second Weight Affine Cartesian Codes Carvalho Neumann

Remark 2.5 We observe that for any n-tuple α such that 0 ≤ αi < di for all i ∈{1, . . . , n} there is an element of CX (d) with weight m(α). Indeed, for all i ∈ {1, . . . , n}let Bi ⊂ Ai be a set with αi elements and let fα(X) =

∏ni=1

∏a∈Bi

(Xi − a). Then the

weight of φd(fα) is ω(φd(fα)) = |{P ∈ X | f(P ) 6= 0}| =∏n

i=1(di − αi) .

In what follows we will denote the second Hamming weight of the affine cartesian code

CX (d) by W2(d). By choosing α such that m(α) = µ2(d) we conclude from the above

remark that W2(d) ≤ µ2(d).

3 Lower bounds and true values for the next-to-minimal

weight

Let ≺ be a monomial order in the set M of monomials of K[X].

Definition 3.1 Given an ideal J ⊂ K[X] the footprint of J (with respect to ≺) is the

set of monomials in M which are not leading monomials of polynomials in J .

We will denote by ∆(J) the footprint of J . A well-known property of the footprint is

that the classes of the elements of ∆(J) are a basis for K[X]/J as a K-vector space (see

e.g. [2, Prop. 6.52]).

For a nonzero polynomial g ∈ K[X] we denote by lm(g) the leading monomial of

g. Let J = 〈g1, . . . , gr〉 and let ∆(lm(g1), . . . , lm(gr)) be the set of monomials of K[X]

which are not a multiple of the leading monomial of gi for all i ∈ {1, . . . , r}, then ∆(J) ⊂∆(lm(g1), . . . , lm(gr)). From the definition of Grobner basis (with respect to ≺) we get

that a monomial is in ∆(J) if and only if it is not a multiple of any of the leading

monomials of the polynomials in a Grobner basis for J (see e.g. [3, Prop. 2.12], so that

∆(J) = ∆(lm(g1), . . . , lm(gr)) if and only if {g1, . . . , gr} is a Grobner basis for J .

In what follows we will denote by V (J) the affine variety associated to J , i.e.

V (J) = {(a1, . . . , an) ∈ Kn | f(a1, . . . , an) = 0 for all f ∈ J}.

When the footprint is a finite set a relation between ∆(J) and V (J) is given by the

following result.

Lemma 3.2 ([2, Thm. 8.32]) Assume that ∆(J) is a finite set and let F be an alge-

braically closed extension of K. Then

|VF (J) := {(a1, . . . , an) ∈ F n | f(a1, . . . , an) = 0 for all f ∈ J} | ≤ |∆(J) |,

and if J is a radical ideal then equality holds.

11

Page 12: Second Weight Affine Cartesian Codes Carvalho Neumann

In what follows we will use the graded-lexicographic order with Xn ≺ · · · ≺ X1.

Let I = 〈f1, . . . , fn〉, where fi =∏

a∈Ai(Xi − a) so that deg fi = di, for i = 1, . . . , n.

Since any two of the leading monomials of f1, . . . , fn are coprime we get that {f1, . . . , fn}is a Grobner basis for I (see [6, Prop. 4, page 104]) so

|∆(I)| = |∆(Xd11 , . . . , X

dnn ) | =

n∏i=1

di.

Clearly V (I) = X , and one may show that I is the set of all polynomials which vanish on

X (see [3, Lemma 3.11]). Actually, from Seidenberg’s Lemma 92 (see [2, Lemma 8.13])

we get that I, and every ideal containing I, is a radical ideal. If F is an algebraically

closed extension of K then for any ideal J ⊃ I we have VF (J) = V (J) (because VF (J) ⊂VF (I) = V (I) = X ), and from Lemma 3.2 we get |VF (J)| = |∆(J)|, so for any J ⊃ I we

have |V (J)| = |∆(J)|.Let f ∈ K[X]≤d, we will denote the weight of the codeword φd(f) by ω(f), and we

observe that

ω(f) = m− |{P ∈ X | f(P ) = 0}| =n∏i=1

di − |V (I + 〈f〉)|.

Let Xα = Xα11 · · ·Xαn

n be the leading monomial of f , which we may consider, without

loss of generality, to be normalized. Let’s assume that {f1, . . . fn, f} is a Grobner basis

for I + 〈f〉. Then

|V (I + 〈f〉)| = |∆(I + 〈f〉)| = |∆(Xd11 , . . . , X

dnn ,X

α)| =n∏i=1

di −n∏i=1

(di − αi)

and in this case ω(f) =∏n

i=1(di − αi). Thus if α is equal to a or b(j) then ω(f) = δX (d),

and if α is distinct from a and b(j) then ω(f) ≥ µ2(d). On the other hand, if {f1, . . . fn, f}is not a Grobner basis for I + 〈f〉 then

|V (I + 〈f〉)| = |∆(I + 〈f〉)| < |∆(Xd11 , . . . , X

dnn ,X

α)| =n∏i=1

di −n∏i=1

(di − αi)

so that ω(f) >∏n

i=1(di − αi). Thus, in this case, if α is distinct from a and b(j) then

ω(f) > µ2(d).

The considerations above show that if f is a polynomial such that µ2(d) > ω(f) >

δX (d) then f must satisfy two conditions, namely, that {f1, . . . fn, f} is not a Grobner

12

Page 13: Second Weight Affine Cartesian Codes Carvalho Neumann

basis and that α equal to a or b(j), for some j ∈ {1, . . . , k}. We assume, from now on,

that f satisfies these conditions, and yet we will prove (see Proposition 3.9) that, except

is some cases where ` = 1, we have µ2(d) as a lower bound for ω(f). This fact will be the

chief ingredient in the proof of our main result (see Theorem 3.10).

Since {f1, . . . , fn} is a Grobner basis and {f1, . . . fn, f} is not, there must exist t ∈{1, . . . , n} such that the remainder in the division of the S-polynomial of f and ft by

{f1, . . . fn, f} is not zero. In particular we get that lm(f) = Xα and lm(ft) = Xdtt are

not coprime, so the entry αt in α is nonzero. The S-polynomial of f and ft is

St :=gcd(Xα, Xdt

t )

Xdtt

ft −gcd(Xα, Xdt

t )

Xα f =k+1∏

s=1,s 6=t

Xαss ft −Xdt−αt

t f ,

and since α is normalized and of the form a or b(j) we have 1 ≤ t ≤ k + 1 if ` 6= 0, or

1 ≤ t ≤ k if ` = 0.

Let R be the remainder on the division of the polynomial St by {f1, . . . fn, f} and let

Xβ = Xβ11 · · ·Xβn

n be the leading monomial of R, from the division algorithm we get that:

• Xβ ≺ Xdt−αtt Xα and

n∑i=1

βi ≤ d+ dt − αt;

• 0 ≤ βi ≤ di − 1 for all 1 ≤ i ≤ n;

• Xα -Xβ.

From R ∈ I + 〈f〉 we get I + 〈f〉 = 〈f1 . . . , fn, f, R〉 and as before

|V (I + 〈f〉)| ≤ |∆(lm(f1), . . . lm(fn),Xα,Xβ)|.

Let M1, . . . ,Ms be monomials in K[X] and set

∇(M1, . . . ,Ms) := {M ∈ ∆(I) | ∃i ∈ {1, . . . , s} such that Mi |M} .

We have

ω(f) = |X | − |V (I + 〈f〉)| ≥n∏i=1

di − |∆(lm(f1), . . . lm(fn),Xα,Xβ)| =

|∆(I)| − |∆(lm(f1), . . . lm(fn),Xα,Xβ)| = |∇(Xα,Xβ)|

and

|∇(Xα,Xβ)| = |∇(Xα)|+ |∇(Xβ)| − |∇(Xα) ∩∇(Xβ)| .

13

Page 14: Second Weight Affine Cartesian Codes Carvalho Neumann

Let Bt be the set of all n-tuples β such that Xα -Xβ, 0 ≤ βi ≤ di − 1 for all 1 ≤ i ≤ n,

and∑n

i=1 βi ≤ d + dt − αt. We want to find a lower bound for the right hand side when

β runs on the set B = ∪tBt, where 1 ≤ t ≤ k + 1 if ` 6= 0, or 1 ≤ t ≤ k if ` = 0.

We consider two cases, according to the value of the n-tuple α.

Case A: α = a

In this case for all β ∈ B we have |∇(Xα)| = (dk+1−`)∏n

i=k+2 di, |∇(Xβ)| =∏n

i=1(di−βi)and |∇(Xα) ∩ ∇(Xβ)| = (dk+1 − θ)

∏ni=k+2(di − βi) where θ = max{`, βk+1}. Thus

ω(f) ≥ µ1(d)+T (β) where T (β) = m(β)− (dk+1−θ)n(β) and n(β) =n∏

i=k+2

(di−βi). We

define a partial order 6 in the set B by stating that β 6 β if and only if βi ≤ βi for all

i = 1, . . . , n. Writing T (β) = (∏n

i=k+2(di − βi)) (∏k+1

i=1 (di − βi)− (dk+1 − θ)) it is easy to

check that T (β) ≥ T (β) if β 6 β, thus T (β) is minimal when β is maximal with respect

to 6.

Since α = a we get that for β ∈ Bi, with i ∈ {1, . . . , k}, we have∑n

i=1 βi ≤ d + 1,

and for β ∈ Bk+1 we have∑n

i=1 βi ≤ d + dk+1 − `, hence B1 = · · · = Bk ⊂ Bk+1 (the last

inclusion happening when ` > 0). We want to determine the actual maximum for∑n

i=1 βi

when β is a maximal element of B w.r.t. 6. Recall that as observed in the last paragraph

of Section 1 we are assuming that n ≥ k + 2.

Let β ∈ B, and assume that ` > 0 and 0 < βi < di − 1 for some i ∈ {1, . . . , k + 1},or that ` = 0 and 0 ≤ βi < di − 1, with i ∈ {1, . . . , k}. We determine a lower bound for

the sum of the first k + 2 entries of an n-tuple γ ∈ Nn0 such that γi = βi and γj = dj − 1

for j ∈ {1, . . . , k + 2} \ {i}. Since d1 ≤ · · · ≤ dn we have that βi +∑k+2

j=1,j 6=i(dj − 1) ≥

βi +∑k+1

j=1(dj − 1) = βi + d+ dk+1− 1− `. Note that βi + d+ dk+1− 1− ` ≥ d+ 1, in the

case ` = 0 and 0 ≤ βi < di − 1, and we also have βi + d + dk+1 − 1 − ` ≥ d + dk+1 − `,in the case ` > 0 and 0 < βi < di − 1. Thus there is a maximal element β ∈ B with

βi = βi such that β 6 β and∑n

j=1 βj = d + 1 or∑n

j=1 βj = d + dk+1 − `, according to

each case. Now assume that ` > 0, βi = 0 for some i ∈ {1, . . . , k + 1}, βj = dj − 1 for

j ∈ {1, . . . , k + 1} \ {i} and that either dk+1 < dk+2, or dk+1 = dk+2 and ` ≥ 2. From

`− 1 +∑k+2

j=1,j 6=i(dj − 1) ≥ `− 1 +∑k

j=1(dj − 1) + dk+2 − 1 = d+ dk+2 − 2 ≥ d+ dk+1 − `

we see that there is a maximal element β ∈ B such that β 6 β, 0 ≤ βi ≤ ` − 1, and∑nj=1 βj = d + dk+1 − `. Finally assume that ` = 1 and dk+1 = dk+2. If βi = 0 for

some i ∈ {1, . . . , k} and βj = dj − 1 for j ∈ {1, . . . , k + 1} \ {i} then we consider the

14

Page 15: Second Weight Affine Cartesian Codes Carvalho Neumann

sum of the first k + 2 entries of an n-tuple γ such that γi = di − 2 and γj = dj − 1

for j ∈ {1, . . . , k + 2} \ {i}. We have di − 2 +∑k+2

j=1,j 6=i(dj − 1) =∑k+2

j=1(dj − 1) − 1 =

d− 1 +dk+1− 1 +dk+2− 1− 1 = d+dk+1 +dk+2− 4 and again there is a maximal element

β ∈ B such that 0 ≤ βi ≤ di− 2 and∑n

j=1 βj = d+ dk+1− 1. If βk+1 = 0 and βj = dj − 1

for j ∈ {1, . . . , k+ 2}\{k+ 1} then∑k+2

j=1,j 6=k+1(dj− 1) =∑k+1

j=1(dj− 1) = d+dk+1− 1− 1

so there exists a maximal element β ∈ B such that βk+1 = 0 and∑n

j=1 βj = d+ dk+1 − 1

only if n ≥ k + 3. These results are collected in the following Lemma.

Lemma 3.3 When α = a and β is maximal element of B with respect to 6 then the

value for∑n

i=1 βi is:

d+ 1 if ` = 0;d+ dk+1 − 2 if ` = 1, βk+1 = 0, dk+1 = dk+2 and n = k + 2;d+ dk+1 − ` otherwise.

Let B be the set of n-tuples β of the form

β = (d1 − 1, . . . , dk−1 − 1, βk, βk+1, . . . , βn) (3.1)

such that Xα - Xβ (hence either βk < dk − 1 or βk+1 < `), 0 ≤ βj ≤ dj − 1 for all

j ∈ {k, . . . , n}, and

n∑i=1

βi =

d+ 1 =k∑i=1

(di − 1) + 1 if ` = 0;

d+ dk+1 − 2 =k+1∑i=1

(di − 1) if ` = 1, βk+1 = 0, dk+1 = dk+2 and n = k + 2;

d+ dk+1 − ` =k+1∑i=1

(di − 1) + 1 otherwise.

(3.2)

Observe that B ⊂ B.

Lemma 3.4 Let β ∈ B, then there exists β ∈ B such that T (β) ≥ T (β).

Proof: Let β ∈ B \ B, without loss of generality we may assume that β is a maximal

element with respect to 6 so that∑n

i=1 βi satisfies (3.2). In what follows we will use the

operations M1 and M2, defined before Lemma 2.2, in a way that, repeated if necessary,

produces an n-tuple β ∈ B such that T (β) ≥ T (β). Since β 6∈ B, for some 1 ≤ j ≤ k− 1

15

Page 16: Second Weight Affine Cartesian Codes Carvalho Neumann

we have βj < dj − 1. Suppose that βk > 0, if βj + βk ≤ dj − 1 then we apply M1(j, k)

to β to obtain β′, where β′j = βj + βk and β′k = 0. Clearly n(β) = n(β′), from (2.1)

we get m(β) ≥ m(β′), and we also have βk+1 = β′k+1 so that T (β) ≥ T (β′). If βk > 0

and βj + βk > dj − 1 then we apply M2(j, k) to β to obtain β′′, where β′′j = dj − 1 and

β′′k = βj + βk − (dj − 1). As above n(β) = n(β′′), m(β) ≥ m(β′′) and T (β) ≥ T (β′′).

Now assume that βk = 0, since β satisfies (3.2) we have βs > 0 for some s ≥ k + 1. If

0 < βs ≤ dk − 1 then we apply M1(k, s) to β to obtain β′, where β′k = βs and β′s = 0.

Observe that if s = k+ 1 then dk+1−max{`, βk+1} ≤ dk+1−max{`, 0}, and for any value

of s we get T (β) ≥ T (β′). Finally, if βk = 0 and βs > dk − 1 then we apply M2(k, s) to β

and obtain β′′ such that β′′k = dk − 1, β′′s = βs − (dk − 1) and T (β) ≥ T (β′′). Repeating

the above process a finite number of times we end up with an n-tuple β ∈ B such that

T (β) ≥ T (β). �

Thus now we want to calculate the minimum of T (β) for n-tuples β ∈ B, so that

T (β) = ((dk − βk)(dk+1 − βk+1)− (dk+1 − θ))n∏

i=k+2

(di − βi) . (3.3)

We consider two cases, depending on if βk+1 < ` or not.

a) Assume that βk+1 < ` (hence ` ≥ 1 and∑n

i=1 βi ≥∑k+1

i=1 (di − 1)). If βk < dk − 1,

from (3.2) we know that βs > 0 for some s ≥ k+ 1 so we may apply M1(k, s) or M2(k, s)

to β, repeatedly if needed, to find an n-tuple β in B (note that βk+1 < `) such that

T (β) ≥ T (β) and βk = dk − 1. For such n-tuples we have

T (β) =(`− βk+1

) n∏i=k+2

(di − βi).

Since ` < dk+2 ≤ · · · ≤ dn the right-hand side of the above equality is a product like

the function m, and from Lemma 1.3 we can determine its minimal value. In fact if

` ≥ 2, or ` = 1 and dk+1 < dk+2, then from (3.2) we get∑n

i=k+1 βi = dk+1 and writing

dk+1 = (`− 1) + (dk+1 − `+ 1) it follows from Lemma 1.3 that the minimum is

(dk+2 − dk+1 + `− 1)n∏

i=k+3

di = µ1(d) ·(dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

).

16

Page 17: Second Weight Affine Cartesian Codes Carvalho Neumann

If ` = 1 (and so βk+1 = 0), dk+1 = dk+2 and n ≥ k+ 3 from (3.2) we get∑n

i=k+2 βi = dk+2

and writing dk+2 = (dk+2 − 1) + 1 we see that the minimum of T (β) =∏n

i=k+2(di − βi) is

(dk+3 − 1)n∏

i=k+4

di = µ1(d) ·(

dk+3 − 1

(dk+1 − 1)dk+2dk+3

).

If ` = 1, dk+1 = dk+2 and n = k + 2 from (3.2) we get βk+2 = dk+2 − 1 so that T (β) =

dk+2 − βk+2 = 1 = µ1(d) ·(

1

(dk+1 − 1)dk+2

).

b) Assume now that βk+1 ≥ ` (and hence βk < dk − 1). Then θ = βk+1 and we may

rewrite (3.3) as

T (β) = (dk − 1− βk)(dk+1 − βk+1)n∏

i=k+2

(di − βi).

Again, since dk − 1 < dk+1 ≤ · · · ≤ dn we see that this is a product like the function

m and its minimum may be found using Lemma 1.3. If ` = 0 then from (3.2) we have∑ni=k βi = dk and writing dk = (dk − 2) + 2 we get that the minimum of T (β) is

(dk+1 − 2)n∏

i=k+2

di = µ1(d) ·(dk+1 − 2

dk+1

).

If ` ≥ 1 then βk+1 ≥ 1 and∑n

i=k βi = dk + dk+1 − 1. Writing dk + dk+1 − 1 = (dk − 2) +

(dk+1 − 1) + 2 we see that the minimum for T (β) is

(dk+2 − 2)n∏

i=k+2

di = µ1(d) ·(

dk+2 − 2

(dk+1 − `)dk+2

).

Lemma 3.5 Let f ∈ K[X]≤d be a polynomial with leading monomialXa. If {f1, f2, . . . , fn, f}is not a Grobner basis for I then

ω(f) ≥

µ1(d) ·(

1 +dk+1 − 2

dk+1

)for ` = 0;

µ1(d) ·(

1 +dk+3 − 1

(dk+1 − 1)dk+2dk+3

)for ` = 1 and dk+1 = dk+2 with n ≥ k + 3;

µ1(d) ·(

1 +1

(dk+1 − 1)dk+2

)for ` = 1 and dk+1 = dk+2 with n = k + 2;

µ1(d) ·(

1 +dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

)for ` ≥ 2 or (` = 1 and dk+1 < dk+2).

17

Page 18: Second Weight Affine Cartesian Codes Carvalho Neumann

Proof: We have to compare the minimum values obtained in cases (a) and (b) above.

The case ` = 0 occurs only in (b). For ` ≥ 1 all values found in case (a) are lesser or

equal than the value found in (b). �

Case B: α = b(j)

We recall that if there exists a normalized n-tuple of the form b(j), then ` > 0 and

dk+1−` ≤ dj ≤ dj+1−1. In this case we have |∇(Xα)| = (dk+1−`)∏n

i=k+2 di, |∇(Xβ)| =∏ni=1(di−βi) and |∇(Xα)∩∇(Xβ)| = (dj−θj)

∏ni=k+2(di−βi) where θj = max{dj−(dk+1−

`), βj}. Thus ω(f) ≥ µ1(d) + Tj(β) where Tj(β) = m(β)− (dj − θj)n(β) and, as before,

n(β) =n∏

i=k+2

(di−βi). Again, writing Tj(β) = (∏n

i=k+2(di−βi)) (∏k+1

i=1 (di−βi)−(dj−θj))

it is easy to check that Tj(β) ≥ Tj(β) if β 6 β, thus Tj(β) is minimal when β is maximal

with respect to 6.

Since α = b(j) we have Bt = Bk+1 for all t ∈ {1, . . . , k + 1} \ {j}, and if β ∈ Bk+1 then∑ni=1 βi ≤ d + 1. On the other hand if β ∈ Bj then

∑ni=1 βi ≤ d + dk+1 − ` and since

2 ≤ dk+1− ` we get that Bt ⊂ Bj for all t ∈ {1, . . . , k+ 1}, so in this case we have B = Bj.As in Case A we investigate what is the value of

∑ni=1 βi when β ∈ B is a maximal element

w.r.t. 6. Let β ∈ B such that 0 ≤ βi < di − 1 for some i ∈ {1, . . . , k + 1} \ {j}. We

consider the sum of the first k + 2 entries of an n-tuple γ ∈ Nn0 such that γi = di − 2

and γs = ds − 1 for all s ∈ {1, . . . , k + 2} \ {i}, and we get di − 2 +∑k+2

s=1, s 6=i(ds − 1) =∑k+2s=1(ds − 1) − 1 = d + (dk+1 − 1) − ` + (dk+2 − 1) − 1 ≥ d + dk+1 − `, so there exists

β ∈ Bj with βi ≤ βi ≤ di − 2 such that∑n

i=1 βi = d + dk+1 − `. Assume now that

0 ≤ βj < dj − (dk+1 − `) and βi = di − 1 for all i ∈ {1, . . . , k + 1} \ {j}. Then we have

dj > dk+1−` so that ` ≥ 2 (since from dj < dj+1 ≤ dk+1 we get dj ≤ dk+1−1). We consider

the sum of the first k+2 entries of an n-tuple γ ∈ Nn0 such that γj = dj−(dk+1−`)−1 and

γi = di− 1 for i ∈ {1, . . . , k+ 2} \ {j}, and we get dj − (dk+1− `)− 1 +∑k+2

i=1, i 6=j(di− 1) =∑k+2i=1 (di−1)−(dk+1−`) = d+(dk+1−`)+(dk+2−1)−(dk+1−`) = d+dk+2−2 ≥ d+dk+1−`.

Thus, there exists β ∈ B with βj ≤ βj ≤ dj−(dk+1−`)−1 such that∑n

i=1 βi = d+dk+1−`.This proves the following result.

Lemma 3.6 When α = b(j) and β is maximal element of B with respect to 6 we have∑ni=1 βi = d+ dk+1 − `.

18

Page 19: Second Weight Affine Cartesian Codes Carvalho Neumann

Let Bj be the set of n-tuples β such that

β = (d1 − 1, . . . , dj−1 − 1, βj, dj+1 − 1, . . . dk − 1, βk+1, . . . , βn) , (3.4)

Xα - Xβ (which means βj < dj−(dk+1−`) or βk+1 < dk+1−1) and∑n

i=1 βi = d+dk+1−`,or equivalently,

βj +n∑

i=k+1

βi = (dj − 1) + (dk+1 − 1) + 1 . (3.5)

Observe that Bj ⊂ B.

Lemma 3.7 For every β ∈ B there exists β ∈ Bj such that Tj(β) ≥ Tj(β).

Proof: Let β ∈ B, clearly we may assume that β is a maximal element w.r.t. 6. We

assume that β 6∈ Bj, so that for some 1 ≤ r ≤ k, r 6= j we have βr < dr − 1. Suppose

that βk+1 > 0, if βr + βk+1 ≤ dr − 1 (respectively, βr + βk+1 > dr − 1) then we may

apply M1(r, k + 1) (respectively, M2(r, k + 1)) to β obtaining an n-tuple β such that

βr = βr + βk+1 and βk+1 = 0 (respectively, βr = dr − 1 and βk+1 = βr + βk+1 − (dr − 1)),

and it is easy to check that Tj(β) ≥ Tj(β). If βk+1 = 0, from∑n

i=1 βi = d+dk+1−` we get

that there exists s ≥ k+2 such that βs > 0. In the case where βs ≤ dk+1−1 (respectively,

βs > dk+1−1) we apply M1(k+1, s) (respectively, M2(k+1, s)) to β obtaining an n-tuple

β, where βk+1 = βs and βs = 0 (respectively, βk+1 = dk+1 − 1 and βs = βs − (dk+1 − 1)).

Again, one may easily check that Tj(β) ≥ Tj(β). If β ∈ Bj we are done, if not we repeat

the above process until, after a finite number of steps we reach an n-tuple β ∈ Bj such

that Tj(β) ≥ Tj(β). �

For β ∈ Bj, we have

Tj(β) = ((dj − βj)(dk+1 − βk+1)− (dj − θj))n∏

i=k+2

(di − βi)

and, as in Case A, we want to find the minimum of Tj(β) when β ∈ Bj. We consider two

cases, depending on if βj < dj − (dk+1 − `) or not.

a) Assume that 0 ≤ βj < dj − (dk+1 − `). Hence dk+1 − ` < dj and, as observed before,

we must have ` ≥ 2. If βk+1 < dk+1 − 1 then there exists s ≥ k + 2 such that βs > 0 and

we may apply M1(k + 1, s) or M2(k + 1, s) to β to obtain β ∈ Bj with Tj(β) ≥ Tj(β).

19

Page 20: Second Weight Affine Cartesian Codes Carvalho Neumann

We continue this process until we reach an n-tuple β ∈ Bj such that βi = di − 1 for

i ∈ {1, . . . , k + 1} \ {j}, βj = βj and Tj(β) ≥ Tj(β). For such n-tuple we have

Tj(β) =(

(dj − βj)− (dk+1 − `))n(β) =

(dj − dk+1 + `− βj

) n∏i=k+2

(di − βi) ,

and from (3.5) we get

βj +n∑

i=k+2

βi = dj.

Thus, writing dj = (dj − dk+1 + `− 1) + (dk+1 − ` + 1) from Lemma 1.3 we get that the

minimum for Tj(β) is

Tj(β) = (dk+2 − dk+1 + `− 1)n∏

i=k+3

di = µ1(d) ·(dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

).

b) Assume now that βj ≥ dj − (dk+1− `). Then, from Xb(j) - Xβ, we get βk+1 < dk+1− 1.

We also have θj = βj so that

Tj(β) = (dj − βj)(dk+1 − 1− βk+1)n∏

i=k+2

(di − βi).

From (3.5) we get

βj +n∑

i=k+2

βi = dj + dk+1 − 1 = (dj − 1) + (dk+1 − 2) + 2

and from Lemma 1.3 we get that the minimum for Tj(β) is

Tj(β) = (dk+2 − 2)n∏

i=k+3

di = µ1(d) ·(

dk+2 − 2

(dk+1 − `)dk+2

).

Thus we have the following results for the case where α = b(j).

Lemma 3.8 Let f ∈ K[X]≤d be a polynomial with leading monomial Xb(j), for some

1 ≤ j ≤ k (hence ` ≥ 1). If {f1, f2, . . . , fn, f} is not a Grobner basis for I then

ω(f) ≥

µ1(d) ·

(1 +

dk+2 − 2

(dk+1 − 1)dk+2

)for ` = 1;

µ1(d) ·(

1 +dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

)for ` ≥ 2.

20

Page 21: Second Weight Affine Cartesian Codes Carvalho Neumann

Proof: For ` ≥ 2 we compare the bounds in items (a) and (b) above and find that the

bound in (a) is the lower one. �

Combining the results in Lemmas 3.5 and 3.8 we get the following.

Proposition 3.9 Let f ∈ K[X]≤d be a polynomial with leading monomial Xa or Xb(j),

for some 1 ≤ j ≤ k. If {f1, f2, . . . , fn, f} is not a Grobner basis for I then

ω(f) ≥

µ1(d) ·(

1 +dk+1 − 2

dk+1

)for ` = 0;

µ1(d) ·(

1 +dk+3 − 1

(dk+1 − 1)dk+2dk+3

)for ` = 1 and dk+1 = dk+2 with n ≥ k + 3;

µ1(d) ·(

1 +1

(dk+1 − 1)dk+2

)for ` = 1 and dk+1 = dk+2 with n = k + 2;

µ1(d) ·(

1 +dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

)for ` ≥ 2, or ` = 1 and dk+1 < dk+2.

We are now ready to prove our main result.

Theorem 3.10 Let Ai ⊂ K be such that |Ai| = di ≥ 3 for all i = 1, . . . , n, with n ≥ 1,

and d1 ≤ · · · ≤ dn, and let d be a positive integer. Define k and ` by writing d =∑ki=1(di − 1) + ` with 0 ≤ ` < dk+1 − 1. Suppose that n ≥ 3 and 1 ≤ k ≤ n− 2, and let

W2(d) be the next-to-minimal Hamming weight of the affine cartesian code CX (d).

a) If ` = 0 then

W2(d) = µ1(d) ·(

1 +dk+1 − 2

dk+1

)= 2(dk+1 − 1)

n∏i=k+2

di .

b) If ` = 1, dk+1 = dk+2 = a and n = k + 2, then

a2 − a+ 1 ≤ W2(d) ≤{

8 if a = 3a2 if a > 3.

c) If ` = 1, dk+1 = dn = a and n ≥ k + 3 then

(a− 1)(a2 + 1)an−k−3 ≤ W2(d) ≤{

8 · 3n−k−2 if a = 3an−k if a > 3 .

21

Page 22: Second Weight Affine Cartesian Codes Carvalho Neumann

d) If ` = 1 and a = dk+1 = dk+2 = ds−1 < ds for some s ∈ {k + 3, . . . , n} then

((a2 − a+ 1)dk+3 − 1)n∏

i=k+4

di ≤ W2(d) ≤ µ2(d)

where

µ2(d) =

a2(ds − 1)

n∏i=k+3 , i 6=s

di for dk+1 > 3 or ds ≤ 9 ,

8n∏

i=k+3

di for dk+1 = 3 and ds > 9 ,

.

If s = k + 3 and dk+3 = dk+1 + 1 = a+ 1 then W2(d) = a3∏n

i=k+4 di.

e) If ` ≥ 2, or ` = 1 and dk+1 < dk+2, then

W2(d) = µ1(d) ·(

1 +dk+2 − dk+1 + `− 1

(dk+1 − `)dk+2

)= (dk+1 − `+ 1)(dk+2 − 1)

n∏i=k+3

di .

Proof: In Theorem 2.4 we determined the next-to-minimal value of the function m andfrom Remark 2.5 we know that there are codewords in CX (d) with these weights, so those

values are upper bounds for W2(d). We compare the values in Theorem 2.4 with the lower

bounds for W2(d) obtained in Proposition 3.9. In case ` = 0, or ` = 1 and dk+1 < dk+2, or

` ≥ 2 the numbers in the Theorem coincide with those in the Proposition, hence W2(d)

is determined in cases (a) and (e).

In case (b) for the lower bound we get

µ1(d) ·(

1 +1

(dk+1 − 1)dk+2

)= (dk+1 − 1)dk+2

(1 +

1

(dk+1 − 1)dk+2

)= a2 − a+ 1

and the upper bounds come from Theorem 2.4 (b), being 8 if a = 3 and a2 if a > 3.

The proof of case (c) is similar to case (b), the upper bounds coming from Theorem 2.4

(b) while the lower bound is

µ1(d)·(

1 +dk+3 − 1

(dk+1 − 1)dk+2dk+3

)= (a−1)an−k−1

(1 +

a− 1

(a− 1)a2

)= (a−1)(a2+1)an−k−3.

In case (d) we observe that n ≥ k + 3 so we have for lower bound

µ1(d) ·(

1 +dk+3 − 1

(dk+1 − 1)dk+2dk+3

)=(a− 1)a

(n∏

i=k+3

di

)(1 +

dk+3 − 1

(a− 1)adk+3

)=

((a2 − a+ 1)dk+3 − 1)n∏

i=k+4

di,

22

Page 23: Second Weight Affine Cartesian Codes Carvalho Neumann

while the upper bounds come from the cases where ` = 1 described in Theorem 2.4 (a).

If s = k + 3 and dk+3 = dk+1 + 1 = a + 1 then µ2(d) = a2(dk+3 − 1)n∏

i=k+4

di = a3n∏

i=k+4

di

which is the value of the lower bound when we have dk+3 = a+ 1. �

From Remark 2.5 we get that the number µ1(d) can be interpreted as the minimal

number of points in X ⊂ An(Fq) missed by a set of d hyperplanes. The result from

Theorem 1.2 (where we see that δX (d) = µ1(d)) shows that the minimum number of

points in X missed by a hypersurface of degree (up to) d in An(Fq) is also µ1(d). Likewise,

our result in Theorem 2.4 shows that µ2(d) is the second minimal number of points in Xmissed by a set of d hyperplanes, and Theorem 3.10 shows that, except in some cases where

` = 1, this is also the second minimal number of points in X missed by a hypersurface

of degree (up to) d. For the case where Ai = Fq for i = 1, . . . , n, when CX (d) is the

so-called generalized Reed-Muller code, it was proved long ago (see [8] and also [15]) that

the number µ1(d) can only be missed by a hypersurface of degree d when it is a union

of d hyperplanes. In [16] it was proved that the same holds also for the second minimal

number µ2(d). As far as we know, for the general set X , these problems are open.

References

[1] N. Alon and Z. Furedi, Covering the cube by affine hyperplanes, European J. Combin.

14 (1993) 79–83.

[2] T. Becker and V. Weispfenning, Grobner Bases - A computational approach to com-

mutative algebra, Berlin, Germany: Springer Verlag, 1998, 2nd. pr.

[3] C. Carvalho, Grobner bases methods in Coding Theory, Contemp.Math. 642 (2015)

73–86.

[4] C. Carvalho, On the second Hamming weight of some Reed-Muller type codes, Finite

Fields Appl. 24 (2013) 88–94.

[5] J.-P. Cherdieu and R. Rolland, On the number of points of some hypersurfaces in

Fnq , Finite Fields Appl. 2 (1996) 214-224.

[6] D. Cox, J. Little,D. O’Shea Ideals, varieties and algorithms, Springer-Verlag, 3rd. ed.

2007.

[7] S. Ballet, R. Rolland, On low weight codewords of generalized affine and projective

Reed-Muller codes. Des. Codes Cryptogr. 73(2) (2014) 271–297.

23

Page 24: Second Weight Affine Cartesian Codes Carvalho Neumann

[8] P. Delsarte, J.M. Goethals, F.J. Mac Williams, On generalized ReedMuller codes

and their relatives, Inform. Control 16 (1970) 403-442.

[9] D. Erickson, Counting zeros of polynomials over finite fields. PhD Thesis, California

Institute of Technology, Pasadena (1974).

[10] J. Fitzgerald, R.F. Lax, Decoding affine variety codes using Gobner bases, Des. Codes

and Cryptogr. 13(2) (1998) 147–158.

[11] O. Geil, On the second weight of generalized Reed-Muller codes. Des. Codes Cryp-

togr. 48(3) (2008) 323–330.

[12] O. Geil, C. Thomsen, Weighted Reed-Muller codes revisited. Des. Codes Cryptogr.

66(1–3) (2013) 195–220.

[13] J. Harris, Algebraic Geometry. A first course, Graduate Texts in Mathematics 133,

Springer-Verlag, New York, 1992.

[14] G. Lachaud, The parameters of projective Reed-Muller codes, Discrete Math. 81(2)

(1990) 217–221.

[15] E. Leduc, A new proof of Delsarte, Goethals and Mac Williams theorem on minimal

weight codewords of generalized ReedMuller codes, Finite Fields Appl. 18 (2012)

581–586.

[16] E. Leduc, Second weight codewords of generalized Reed-Muller codes, Cryptogr.

Commun. 5 (2013) 241–276.

[17] H. H. Lopez, C. Renterıa-Marquez, R. H. Villarreal, Affine cartesian codes, Des.

Codes Cryptogr. 71(1) (2014) 5–19.

[18] C. Renterıa, Tapia-Recillas H., Reed-Muller codes: an ideal theory approach,

Commu. Algebra 25(2) (1997) 401–413.

[19] R. Rolland, The second weight of generalized Reed-Muller codes in most cases. Cryp-

togr. Commun. 2 (2010) 19–40.

[20] A. Sørensen, Projective Reed-Muller codes, IEEE Trans. Inform. Theory 37(6) (1991)

1567–1576.

24