1 Introduction

A codeword of a linear code is called minimal if its support (the set of nonzero coordinates) does not contain the support of any other linearly independent codeword. For a linear code \({\mathcal {C}}\), the supports of minimal codewords of the dual code \({\mathcal {C}}^\perp \) give the access structure of a secret sharing scheme, introduced by Massey [14, 15]. So, it is particularly interesting to determine all minimal codewords of a code. The problem of describing the set of minimal codewords of a linear code is quite difficult in general, even in the binary case: Actually, the knowledge of the minimal codewords is related to the complete decoding problem which is known to be NP-hard [2], even if preprocessing is allowed [4]. To simplify this task, one can try to find linear codes for which all codewords are minimal, called minimal linear codes. The problem of finding minimal linear codes has been first investigated in [10]. Besides their use in secret sharing schemes, minimal linear codes have shown to be suitable to other applications: For example, in [5], minimal linear codes are used to ensure privacy in a secure two-party computation. One of the central results in this context is due to Ashikhmin and Barg [1]: A linear code \({\mathcal {C}}\) over a finite field \({\mathbb {F}}_q\) of order q is minimal if

$$\begin{aligned} \frac{w_{\mathrm{max}}}{w_{\mathrm{min}}} < \frac{q}{q-1} \end{aligned}$$
(AB)

where \(w_{\mathrm{min}}\) and \(w_{\mathrm{max}}\), respectively, denote the minimum and maximum nonzero weights in \({\mathcal {C}}\). This sufficient condition (which we will call AB condition) provides an easy criterion to construct minimal linear codes, especially in the case of codes with few nonzero weights (see, for example, [8, 16]). The AB condition is not necessary. As remarked in [11], a linear code \({\mathcal {C}}\) over \({\mathbb {F}}_q\) is minimal if and only if for any linearly independent codewords \(c,c'\in {\mathcal {C}}\)

$$\begin{aligned} \sum _{a\in {\mathbb {F}}_q^*}\mathrm{wt}(c'-ac)\ne (q-1)\cdot \mathrm{wt}(c')-\mathrm{wt}(c). \end{aligned}$$

Minimal linear codes not satisfying the Ashkhmin–Barg condition (AB condition) are presented in [6, 9, 18] for the binary case, in [11] for the ternary case and in [3] for a general odd prime power. One of the main tools used in these papers is the investigation of the Walsh spectrum of generalized Boolean functions, which is used to characterize when linear codes from a general construction are minimal. The aim of the present paper is to describe in full generality the construction given in [3, 11], to have more precise conditions and other families of examples. More combinatorial and geometric methods are involved in our proofs. In particular, we present a family of codes arising from particular blocking sets, which are well-studied combinatorial objects. We believe that the up to now unexplored link between minimal linear codes and blocking sets may give rise to many families of new minimal linear codes and maybe to new perspectives in blocking sets’ theory. In the paper, we present, as an example, one particular family of blocking sets and related minimal linear codes and we prove that infinitely many members of this family do not satisfy the AB condition.

The paper is structured as follows: In Sect. 2 we recall the main notions necessary to understand the paper; in Sect. 3 we recall some results about blocking sets and we introduce new definitions and prove new results in this context; Sect. 4 is devoted to the general construction of minimal linear codes related to blocking sets, both in affine and in projective case; in Sect. 5, we present an explicit family of minimal linear codes and we show that infinitely many of its members do not satisfy AB condition; finally, in Sect. 6 we resume our results and we present some open problems.

2 Background

In the whole paper, \({\mathbb {F}}_q\) will be a finite field with q elements and \(e_1,\ldots ,e_n\) will denote the canonical basis of \({\mathbb {F}}_q^n\).

2.1 Linear codes

We recall here some basic definitions in coding theory. (For a complete exposition of the concepts, the reader is referred to [12]).

Definition 2.1

Let kn be two positive integers such that \(k \le n\). Let \({\mathcal {C}}\) be a k-dimensional vector subspace of \({\mathbb {F}}_q^n\): We say that \({\mathcal {C}}\) is a q-ary linear code of dimension k and length n or an [nk] code over \({\mathbb {F}}_q\). The elements of \({\mathcal {C}}\) are usually called codewords. A generator matrix of \({\mathcal {C}}\) is a matrix whose rows form a basis of \({\mathcal {C}}\) as a vector space over \({\mathbb {F}}_q\).

Classically, a linear code is endowed with the Hamming metric.

Definition 2.2

For \(x \in {\mathbb {F}}_q^n\), the Hamming weight of x is the number of nonzero coordinates of x (i.e., the cardinality of its support \(\mathrm{supp}(x)\)). We denote it by \(\mathrm{wt}(x)\).

For \(v=(v_1,\ldots ,v_n),w=(w_1,\ldots ,w_n)\in {\mathbb {F}}_q^n\), we denote

$$\begin{aligned} v\cdot w=\sum _{i=1}^nv_iw_i \end{aligned}$$

the Euclidean inner product between v and w. For a code \({\mathcal {C}}\), the dual code is defined as \({\mathcal {C}}^\perp :=\{v\in {\mathbb {F}}_q^n \mid v\cdot c=0, \ \forall c\in {\mathcal {C}}\}\).

The following is a central definition for this paper.

Definition 2.3

A codeword \(c\in {\mathcal {C}}\) is minimal if it covers only linearly dependent codewords, i.e., if for all \(c^{\prime }\in {\mathcal {C}}\),

$$\begin{aligned} \mathrm{supp}(c) \subset \mathrm{supp}(c^{\prime }) \Longrightarrow \exists \lambda \in {\mathbb {F}}_q^* {:} \ c^{\prime }=\lambda c. \end{aligned}$$

A linear code \({\mathcal {C}}\) is minimal if every nonzero codeword \(c \in {\mathcal {C}}\) is minimal.

The symmetric group of degree n acts naturally on \({\mathbb {F}}_q^n\) permuting the coordinates of vectors. This action induces an action on linear codes, which preserves length, dimension and weights. Codes in the same orbits are called equivalent. There are more general concepts of equivalence, but they are not necessary for this paper.

2.2 Affine and projective hypersurfaces

We recall here some basic definitions of affine and projective geometry over finite fields. For a more detailed introduction, we refer to [13].

Let \({\mathbb {A}}({\mathbb {F}}_{q}^{n})\) be the affine space of dimension n over the field \({\mathbb {F}}_q\) and \({\mathbb {P}}({\mathbb {F}}_q^n)\) the projective space of dimension \(n-1\) over \({\mathbb {F}}_q\).

Let \(f:{\mathbb {F}}_{q}^n\rightarrow {\mathbb {F}}_{q}\) be a function. It is well known that all the functions from \({\mathbb {F}}_{q}^n\) to \({\mathbb {F}}_{q}\) are polynomial functions (see, for example, [7]). Let us call

$$\begin{aligned} V(f)=\{x\in {\mathbb {F}}_{q}^n\,|\,f(x)=0\}\subset {\mathbb {A}}({\mathbb {F}}_{q}^{n}) \end{aligned}$$

the affine hypersurface defined by f. We denote \(V(f)^*=V(f){\setminus }\{0\}\). If f is homogeneous, V(f) can be seen also as an hypersurface in \({\mathbb {P}}({\mathbb {F}}_q^n)\) by identifying linearly dependent vectors. To avoid any risk of confusion, we will denote \(V_p(f)\) the hypersurface in \({\mathbb {P}}({\mathbb {F}}_q^n)\). When f is linear, then V(f) is called affine hyperplane. In this paper, we will mainly consider hyperplanes through the origin, that is hyperplanes for which f is linear and homogeneous. These can be described in terms of a orthogonal vector, as follows (we use the same notation as in [3]).

Definition 2.4

Let \(v\in {\mathbb {F}}_q^n\), we define the hyperplane H(v) as the set

$$\begin{aligned} H(v):=\left\{ x\in {\mathbb {F}}_q^n \mid v\cdot x=0\right\} =\langle v\rangle ^\perp , \end{aligned}$$

i.e., H(v) is the set of all the vectors of \({\mathbb {F}}_q^n\) that are orthogonal to the vector v. As done for V(f), we call \(H(v)^*:=H(v){\setminus }\{0\}\). Note that H(v) can be seen as a hyperplane in \({\mathbb {P}}({\mathbb {F}}_q^n)\) by identifying linearly dependent vectors. Moreover, in the projective case, these are all hyperplanes.

3 Cutting blocking sets

We recall some definitions about blocking sets (for a more detailed introduction see [17, Chapter 3]). We will need to introduce some new definitions (Definitions 3.23.4) and prove a new result which well adapts to our context.

Definition 3.1

An affine (respectively projective) k-blocking set is a subset of an n-dimensional affine (respectively projective) space intersecting all \((n-k)\)-dimensional affine (respectively projective) subspaces. An affine (respectively projective) 1-blocking set is also called affine (respectively projective) blocking set.

As we mentioned, it is well known that every function from \({\mathbb {F}}_q^n\) to \({\mathbb {F}}_q\) is polynomial. Every set in the affine space \({\mathbb {A}}({\mathbb {F}}_q^n)\) can be then seen as a hypersurface V(f) for some polynomial function. In particular, every k-blocking set can be seen as an hypersurface. With the above definitions, which are the classical ones, there is a substantial asymmetry in the case of f being homogeneous, because if \(V(f)^*\) is a k-blocking set in the affine space \({\mathbb {A}}({\mathbb {F}}_q^n)\), then \(V_p(f)\) is a k-blocking set in the projective space \({\mathbb {P}}({\mathbb {F}}_q^n)\), but the vice versa is not true. We think that a natural definition to avoid this asymmetry is the following, which is a weakened version of the affine definition.

Definition 3.2

A vectorial k-blocking set is a subset of an n-dimensional affine space not containing the origin intersecting all \((n-k)\)-dimensional affine subspaces through the origin. A vectorial 1-blocking set is also called vectorial blocking set.

A k-blocking set \({\mathcal {B}}\) is d-dimensional if the subspace generated by \({\mathcal {B}}\) has dimension d. A k-dimensional affine (respectively projective, respectively vectorial) subspace is a k-blocking set, and a k-blocking set containing one is called trivial.

Definition 3.3

An affine (respectively projective, respectively vectorial) (ks)-blocking set, where \(n>k\), is an affine (respectively projective, respectively vectorial) k-blocking set that does not contain an affine (respectively projective, respectively affine through the origin) subspace of dimension s.

As far as we know, the following property is not equivalent (or at least implied) by any known notion in blocking sets’ theory, but it will play a crucial role in our results.

Definition 3.4

An affine (respectively projective, respectively vectorial) k-blocking set is cutting if its intersection with every \((n-k)\)-dimensional affine (respectively projective, respectively affine through the origin) subspace is not contained in any other \((n-k)\)-dimensional affine (respectively projective, respectively affine through the origin) subspace.

The property of being cutting is quite strong, as one can see from the following result.

Theorem 3.5

A set \({\mathcal {B}}\) is a t-dimensional (with \(t>n-k\)) affine (respectively projective, respectively vectorial) cutting k-blocking set if and only if the intersection between \({\mathcal {B}}\) and every \((n-k)\)-dimensional affine (respectively projective, respectively affine through the origin) subspace is not contained in any other \((n-k)\)-dimensional affine (respectively projective, respectively affine through the origin) subspace.

Proof

\((\Rightarrow )\) :

by definition.

\((\Leftarrow )\) :

We will prove it only in the affine case to simplify the notations. (But in the other cases, the proof is exactly the same.) If the intersection between \({\mathcal {B}}\) and every \((n-k)\)-dimensional affine subspace is not contained in any other \((n-k)\)-dimensional affine subspace, then in particular the intersection is non-empty, so that \({\mathcal {B}}\) is an affine k-blocking set.

If it exists an \((n-k)\)-dimensional affine subspace \({\mathcal {S}}'\) such that \({\mathcal {B}}\subset {\mathcal {S}}'\), then \({\mathcal {B}}\cap {\mathcal {S}}\subset {\mathcal {B}}\subset {\mathcal {S}}',\) for any \((n-k)\)-dimensional affine subspace \({\mathcal {S}}\), a contradiction. So \({\mathcal {B}}\) is an t-dimensional blocking set, with \(t> n-k\).

The cutting property is by definition again.

\(\square \)

In Sect. 4, we will relate the cutting property to minimal linear codes and in Sect. 5, we will provide an example of both vectorial and projective cutting blocking sets.

4 A family of codes arising from cutting blocking sets

In this section, we take up the notion of the code investigated in [3, 11] and prove some new connections with blocking sets.

For every function \(f:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\), let \({\mathcal {C}}_f\) be the linear code defined as

$$\begin{aligned} {\mathcal {C}}_f :=\{(uf(x)+v\cdot x)_{x \in {\mathbb {F}}_q^n {\setminus } \{0\}} \ | \ u \in {\mathbb {F}}_q, v \in {\mathbb {F}}_q^n\}, \end{aligned}$$
(1)

where \(v\cdot x\) is the Euclidean inner product between v and x, as in Sect. 2. Here, we are supposing, as usual in coding theory, to have a fixed ordering of \({\mathbb {F}}_q^n {\setminus } \{0\}\). What follows will not depend on this ordering: If we change the ordering, we just obtain an equivalent code.

For any pair \((u,v) \in {\mathbb {F}}_q\times {\mathbb {F}}_{q}^n\), let us denote \(c(u,v):=(uf(x)+v\cdot x)_{x \in {\mathbb {F}}_q^n {\setminus } \{0\}}\). For an \(x\in {\mathbb {F}}_q^n {\setminus } \{0\}\), we denote by \(c(u,v)_x\) the entry in c(uv) corresponding to x. The support \(\mathrm{supp}(c(u,v))\) of a codeword c(uv) is defined as the set of \(\{x \in {\mathbb {F}}_q^n {\setminus } \{0\} {:} \ c(u,v)_x\ne 0\}\). The complement of the support \(\overline{\mathrm{supp}}(c(u,v))\) is then the set of \(\{x \in {\mathbb {F}}_q^n {\setminus } \{0\} {:} \ c(u,v)_x= 0\}\).

4.1 Parameters of \({\mathcal {C}}_f\)

Proposition 4.1

If f is not linear and \(V(f)^*\ne {\mathbb {F}}_q^n{\setminus }\{0\}\), the code \({\mathcal {C}}_f\) defined as in (1) has length \(q^n-1\) and dimension \(n+1\) over \({\mathbb {F}}_{q}\).

Proof

Clearly, the length of \({\mathcal {C}}_f\) is \(\#({\mathbb {F}}_q^n{\setminus } \{0\})=q^n-1\).

Each codeword in \({\mathcal {C}}_f\) can be written as a linear combination of c(1, 0), \(c(0,e_1), \ldots , c(0,e_n)\), where \(e_1,\ldots ,e_n\) is the standard basis of \({\mathbb {F}}_q^n\) over \({\mathbb {F}}_q\). Showing that these vectors are linearly independent is equivalent to prove that \(c(u,v)=0\) if and only if \(u=0\) and \(v=0\).

  • If \(u=0\), then \(c(u,v)_{e_i}=v_i=0\) for \(i\in \{1,\ldots ,n\}\), so that \(v=0\).

  • If \(u\ne 0\), \(uf(x)+v\cdot x=0\) for all \(x\in {\mathbb {F}}_q^n{\setminus } \{0\}\) implies that \(V(f)=H(v)\), if \(v\ne 0\), which is a contradiction.

This proves that c(1, 0), \(c(0,e_1), \ldots , c(0,e_n)\) is a basis of \({\mathcal {C}}\) of size \(n+1\). \(\square \)

If f is not linear and \(V(f)^*\ne {\mathbb {F}}_q^n{\setminus }\{0\}\), we have then that a generator matrix of \({\mathcal {C}}_f\) is

$$\begin{aligned} G=\left[ \begin{matrix} f(x_0)&{}\quad f(x_1)&{}\quad \ldots &{}\quad f(x_{q^n-1})\\ (x_0)^{\mathrm{T}}&{}\quad (x_1)^{\mathrm{T}}&{}\quad \ldots &{}\quad (x_{q^n-1})^{\mathrm{T}} \end{matrix}\right] , \end{aligned}$$

where \((x_i)^{\mathrm{T}}\), for \(i\in \{0,\ldots ,q^n-1\}\), are the column vectors of \({\mathbb {F}}_{q}^n{\setminus }\{0\}\) with respect to the fixed ordering.

Remark 4.2

The matrix G is formed by two blocks, one of them is the line obtained from the evaluations of the function f, and the other one is the matrix formed by all the ordered vectors of \({\mathbb {F}}_{q}^n{\setminus }\{0\}\). The second block is the generator matrix of the simplex code for \(q=2\) and, up to a reordering of the coordinates, the concatenation of \(q-1\) copies of the simplex code for \(q>2\) (see [12, Sect. 1.8]). Therefore, \(\mathrm{wt}(c(0,v))=q^{n}-q^{n-1}\) (see [12, Theorem 2.7.5]) and \(\mathrm{wt}(c(u,0))=q^n-1-\#V(f)^*\).

It seems to be quite difficult to prove the general results on the weight distribution of \({\mathcal {C}}_f\). On the other hand, we can easily observe a condition on \(\# V(f)^*\) for \({\mathcal {C}}_f\) to not satisfy the AB condition.

Lemma 4.3

If \(\# V(f)^*\ge 2q^{n-1}-q^{n-2}-1\), then

$$\begin{aligned} \frac{w_{\mathrm{max}}}{w_{\mathrm{min}}} \ge \frac{q}{q-1}. \end{aligned}$$

Proof

It is enough to use the trivial fact that if

$$\begin{aligned} w_{\min }\le w_1\le w_2\le w_{\max } \end{aligned}$$

then

$$\begin{aligned} \frac{w_{\mathrm{max}}}{w_{\mathrm{min}}}\ge \frac{w_2}{w_1}, \end{aligned}$$

with the known weights given in Remark 4.2. \(\square \)

4.2 Minimality of \({\mathcal {C}}_f\)

Let \(f:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\) a function. For reader’s convenience, we recall that, by Theorem 3.5, \(V(f)^*\) is an n-dimension cutting vectorial blocking set if and only if the intersection between \(V(f)^*\) and any hyperplane through the origin H(v) is not contained in any other hyperplane through the origin \(H(v')\).

Moreover, the blocking set is a \((1,n-1)\)-blocking set if and only if \(V(f)^*\) does not contain any hyperplane without the origin \(H(v)^*\).

Remark 4.4

If \(V(f)^*\) does not contain any hyperplane without the origin \(H(v)^*\), then clearly f is not linear and \(V(f)^*\ne {\mathbb {F}}_q^n{\setminus }\{0\}\).

Lemma 4.5

The intersection between \(V(f)^*\) and any hyperplane through the origin H(v) is not contained in any other hyperplane through the origin \(H(v')\) if and only if for any \(v,v'\in {\mathbb {F}}_q^n{\setminus }\{0\}\), with \(H(v)\ne H(v')\), it exists \(x\in {\mathbb {F}}_q^n{\setminus } \{0\}\) such that

$$\begin{aligned} uf(x)+v\cdot x=0 \quad \text {and} \quad u'f(x)+v'\cdot x\ne 0, \end{aligned}$$
(2)

for every \(u,u'\in {\mathbb {F}}_q\).

Proof

If the intersection between \(V(f)^*\) and any hyperplane is not contained in any other hyperplane, then for any \(v,v'\in {\mathbb {F}}_q^n{\setminus }\{0\}\), with \(H(v)\ne H(v')\), it exists \(x\in V(f)^*\cap H(v)\) but not in \(H(v')\), which satisfies (2). Conversely, if \(x\not \in H(v)\), then \(uf(x)+v\cdot x\) cannot be equal to 0 for all \(u\in {\mathbb {F}}_q\). So \(x\in H(v)\), which implies \(f(x)=0\), so that \(x\in V(f)^*\cap H(v)\), and, finally, \(x\not \in H(v')\). \(\square \)

Theorem 4.6

Let \(f:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\) be a function. If

  1. (a)

    \(V(f)^*\) is an n-dimensional cutting vectorial \((1,n-1)\)-blocking set in \({\mathbb {A}}({\mathbb {F}}_q^n)\);

  2. (b)

    for every nonzero vector v, it exists x such that \(f(x) + v\cdot x= 0\) and f(x) is different from 0

then \({\mathcal {C}}_f\) defined as in (1) is a \([q^n-1,n+1]\) minimal code over \({\mathbb {F}}_q\).

Proof

The parameters of the code are clear by Proposition 4.1 and Remark 4.4.

Let c(uv) and \(c(u^{\prime },v^{\prime })\) be two nonzero codewords, with \(c(u,v)\ne \lambda c(u^{\prime },v^{\prime })\) for any \(\lambda \in {\mathbb {F}}_q^*\). Suppose that \({\mathrm{supp}}(c(u^{\prime },v^{\prime }))\subset {\mathrm{supp}}(c(u,v))\), that is \(\overline{\mathrm{supp}}(c(u,v))\subset \overline{\mathrm{supp}}(c(u^{\prime },v^{\prime }))\).

  • Suppose \(v=0\). Then, \(\overline{\mathrm{supp}}(c(u,v))\) consists of all nonzero x such that \(f(x)=0\), i.e., \(\overline{\mathrm{supp}}(c(u,v))=V(f)^*\). Since \(\overline{\mathrm{supp}}(c(u,v))\subset \overline{\mathrm{supp}}(c(u^{\prime },v^{\prime }))\),

    $$\begin{aligned} u'f(x)+v'\cdot x=0 \end{aligned}$$

    for all \(x\in V(f)^*\), that is \(v'\cdot x=0\) for all \(x\in V(f)^*\). Therefore, if \(v'\ne 0\), then \(V(f)^*\subset H(v')\), which gives a contradiction to the fact that \(V(f)^*\) is n-dimensional. Hence, \(v'=0\) (and \(u^\prime =\lambda u\)).

  • Suppose \(v^{\prime }=0\). Then, \(\overline{\mathrm{supp}}(c(u',v'))\) consists of all nonzero x such that \(f(x)=0\), i.e., \(\overline{\mathrm{supp}}(c(u',v'))=V(f)^*\). If \(v\ne 0\), then \(\overline{\mathrm{supp}}(c(u,v))\subset \overline{\mathrm{supp}}(c(u^{\prime },v^{\prime }))\) and (b) implies that \(H(v)^*\subset V(f)^*\), which is in contradiction with (a). So \(v=0\) and \(u=\lambda u\).

  • Suppose \(v,v^{\prime }\ne 0\). In this case, \(\overline{\mathrm{supp}}(c(u,v))\subset \overline{\mathrm{supp}}(c(u^{\prime },v^{\prime }))\) reads as

    $$\begin{aligned} u f(x)+v\cdot x=0\,\Rightarrow \, u'f(x)+v'\cdot x=0 \end{aligned}$$

    for each \(x\in {\mathbb {F}}_{q}^n{\setminus }\{0\}\). If \(H(v)\ne H(v')\), we have a contradiction by Lemma 4.5. So \(v'= \lambda v\). Taking x such that \(f(x)\ne 0\) (it exists by Remark 4.4), we get easily that \(u'=\lambda u\).

Then, \({\mathrm{supp}}(c(u^{\prime },v^{\prime }))\not \subset {\mathrm{supp}}(c(u,v))\) and \({\mathcal {C}}_f\) is minimal. \(\square \)

Remark 4.7

A necessary condition for (b) to be true is the following:

  1. (c)

    for every nonzero vector v, \(H(v) \cup V(f)\) is different from the whole space.

If \(q=2\), clearly condition (c) implies (b). Otherwise, one possible easy-to-handle condition to have (b) (assuming (c)) consists in asking f to be constant on the lines with homogeneous equation. In this case, since there exists x such that \(v\cdot x\) and f(x) are different from zero, then there exists a nonzero scalar \(\lambda \) such that \(f(\lambda x)+\lambda v\cdot x= f(x)+\lambda v \cdot x=0\). (It is enough to take \(\lambda =-\,(v\cdot x)^{-1}f(x))\).) For example, one can choose an homogeneous polynomial P, consider the set of its zeros V(P) and then take f to be the characteristic function of V(P).

Remark 4.8

For q odd, let \(f:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\) be the function introduced in [3], that is

$$\begin{aligned} f(x) = {\left\{ \begin{array}{ll} \alpha _i, &{} \quad \mathrm{wt}(x)=i\le k,\\ 0,&{} \quad \mathrm{wt}(x)> k,\\ \end{array}\right. } \end{aligned}$$

where n and k are integers such that \(n>3\) and \(k\in \{2,\ldots ,n-2\}\), and \(\{\alpha _i\}_{i\in \{1,\ldots ,k\}}\) are (not necessarily distinct) elements of \({\mathbb {F}}_q^*\).

The set \(V(f)^*\) is an n-dimensional cutting vectorial \((1,n-1)\)-blocking set in \({\mathbb {A}}({\mathbb {F}}_q^n)\):

  • Firstly, \(V(f)^*\cap H(v)\) cannot be contained in any other \(H(v^\prime )\) (without loss of generality suppose that \(v_n\ne 0)\): Since \(v_n\ne 0\), \(x\in H(v)\) if and only if \(x_n=-\,v_n^{-1}\cdot \sum _{i=1}^{n-1} x_iv_i\). If \(x_i\ne 0\) for all \(i\in \{1,\ldots ,n-1\}\) and \(x_n=-\,v_n^{-1}\cdot \sum _{i=1}^{n-1} x_iv_i\), then \(x\in H(v)\cap V(f)^*\). If \(x\in H(v')\), then

    $$\begin{aligned} 0=\sum _{i=1}^n x_iv_i^\prime =v'_nx_n+\sum _{i=1}^{n-1} x_iv_i^\prime =-\,v'_nv_n^{-1}\cdot \sum _{i=1}^{n-1} x_iv_i+\sum _{i=1}^{n-1} x_iv_i^\prime \end{aligned}$$

    that is

    $$\begin{aligned} \sum _{i=1}^{n-1} (v'_nv_i-v_nv_i^\prime )x_i=0. \end{aligned}$$

    Since the last equality should hold for any x such that \(x_i\ne 0\) for all \(i\in \{1,\ldots ,n-1\}\), in particular it holds for x with \(x_1=\ldots =x_{n-1}=1\) and for \({\overline{x}}^{(j)}\) with \({\overline{x}}^{(j)}_1=\ldots ={\overline{x}}^{(j)}_{j-1}={\overline{x}}^{(j)}_{j+1}=\ldots ={\overline{x}}^{(j)}_{n-1}=1\) and \({\overline{x}}^{(j)}_j=-\,1\), for any \(j\in \{1,\ldots ,n-1\}\). We get, for every \(j\in \{1,\ldots ,n-1\}\),

    $$\begin{aligned} 2(v'_nv_j-v_nv_j^\prime )=0 \end{aligned}$$

    and, since q is odd, \(v_j^\prime =v_n^{-1}v'_nv_j\) for every \(j\in \{1,\ldots ,n\}\), so that \(H(v)=H(v')\).

  • Secondly, we show that \(V(f)^*\) does not contain any hyperplane without the origin \(H(v)^*\) (without loss of generality suppose again that \(v_n\ne 0\)): H(v) always contains a vector u such that \(\mathrm{wt}(u)\le 2\) (in this case \(f(u)\ne 0\), so \(u\not \in V(f)^*\)), in particular if \(\mathrm{wt}(v)=1\) then \(e_1\in H(v)\) and if there exists \(j\in \{1,\ldots ,n-1\}\) such that \(v_j\ne 0\), then \(u=v_ne_j-v_je_n\in H(v).\) In both cases, we found a vector in \(H(v){\setminus } V(f)^*\).

In this case, condition (b) of Theorem 4.6 is clearly verified.

4.3 Projective case

We may extend the general construction of the code done above to the projective space, since it can be easily adapted to the projective case without notable differences.

In this case, in the definition of the code, instead of considering all vectors in \({\mathbb {F}}_q^n{\setminus } \{0\}\), we will take a nonzero vector from each one-dimensional subspace of \({\mathbb {F}}_q^n\) (that is one representative of each projective point in \({\mathbb {P}}({\mathbb {F}}_q^n)\)). This is a quite standard choice in coding theory (the same that one usually does to define simplex and Hamming codes in the non-binary case [12]).

For every homogeneous (polynomial) function \(f:{\mathbb {F}}_q^{n}\rightarrow {\mathbb {F}}_q\), let \(\widetilde{{\mathcal {C}}}_F\) be the linear code defined as

$$\begin{aligned} \widetilde{{\mathcal {C}}}_f :=\{(uf(x)+v\cdot x)_{x \in {\mathbb {P}}({\mathbb {F}}_q^{n})} \ \mid u\in {\mathbb {F}}_q\,, v \in {\mathbb {F}}_q^{n}\}. \end{aligned}$$
(3)

Here, we are supposing, as explained above, to have a fixed ordering of the points in \({\mathbb {P}}({\mathbb {F}}_q^{n})\) and to choose one representative for each projective point. What follows will not depend on these choices: different choices yield equivalent codes. We keep the notations as in the affine case.

If f is nonlinear, then \(\widetilde{{\mathcal {C}}}_f\) is a \([(q^n-1)/(q-1),n+1]\) code. (The proof is exactly the same as for Proposition 4.1.) Moreover, analogously to the affine case, a generator matrix of \(\widetilde{{\mathcal {C}}}_f\) can be obtained by extending the generator matrix of a simplex code by a line from the evaluation of the homogeneous function f. Therefore, \(\mathrm{wt}(c(0,v))=(q^n-q^{n-1})/(q-1)\) and \(\mathrm{wt}(c(u,0))=(q^n-1)/(q-1)-\#V_p(f)\).

An analogue of Lemma 4.3 holds.

Lemma 4.9

If \(\displaystyle \# V_p(f)\ge \frac{2q^{n-1}-q^{n-2}-1}{q-1}\), then

$$\begin{aligned} \frac{w_{\mathrm{max}}}{w_{\mathrm{min}}} \ge \frac{q}{q-1}. \end{aligned}$$

Clearly, for a homogeneous function f, \(V(f)^*\) satisfies the condition of Lemma 4.3 if and only if \(V_p(f)\) satisfies the condition of Lemma 4.9.

Remark 4.10

The projective context seems to be a more natural scenario: There are no restrictions on hyperplanes and, as we mentioned already, in the projective case the simplex code is a subcode of codimension 1 in \(\widetilde{{\mathcal {C}}}_f\). On the other hand, we have less freedom in the choice of the function.

Finally, we state, without proving it, the projective analogue (note that the dimensions drop by 1) of Theorem 4.6. The proof works exactly in the same way as in the affine case.

Theorem 4.11

Let \(f:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\) be a homogeneous function. If

  1. (a)

    \(V_p(f)\) is an \((n-1)\)-dimensional cutting projective \((1,n-2)\)-blocking set in \({\mathbb {P}}({\mathbb {F}}_q^n)\);

  2. (b)

    for every nonzero vector v, it exists x such that \(f(x) + v\cdot x= 0\) and f(x) is different from 0,

then \(\widetilde{{\mathcal {C}}}_f\) defined as in (3) is a \([(q^n-1)/(q-1),n+1]\) minimal code over \({\mathbb {F}}_q\).

5 An example: a family of good functions

Let \(n=rk\) be a positive integer and consider the hypersurface \(V(f_{r,k})\) of \({\mathbb {A}}({\mathbb {F}}_{q}^{n})\) defined by the (polynomial) function \(f_{r,k}:{\mathbb {F}}_q^n\rightarrow {\mathbb {F}}_q\)

$$\begin{aligned} f_{r,k}(x_1,\ldots ,x_n):=\sum _{j=0}^{k-1} x_{jr+1}x_{jr+2}\cdots x_{jr+r}. \end{aligned}$$

Theorem 5.1

If \(k\ge 2\) and \(r\ge 2\), then \(V(f_{r,k})^*\) is an n-dimensional cutting vectorial \((1,n-1)\)-blocking set and for every nonzero vector v, it exists x such that \(f(x) + v\cdot x= 0\) and f(x) is different from 0.

Proof

Let H(v) be a hyperplane. It exists i such that \(v_i\ne 0\). To simplify the notation, suppose, without loss of generality, that \(i=n\), so that \(x_n=-\,(v_n)^{-1}(v_1x_1+\ldots +v_{n-1}x_{n-1})\).

For all \(i\in \{1,\ldots ,n-1\}\), let

$$\begin{aligned} p_i:=e_i-(v_n)^{-1}v_ie_n=(0,\ldots ,0,1,0,\ldots ,0,-(v_n)^{-1}v_i) \end{aligned}$$

and let

$$\begin{aligned} {\overline{p}}:=p_1+\ldots +p_r=\left( \underbrace{1,\ldots ,1}_{r \text { times}},0,\ldots ,0,-(v_n)^{-1}(v_1+\ldots +v_{r})\right) . \end{aligned}$$

We observe that \({\overline{p}}\in H(v)^*\) but not in \(V(f_{r,k})^*\). So \(H(v)^*\not \subset V(f_{r,k})^*\) (property (b)).

Let us prove that property (a) holds too.

Let \(r>2\). In this case, \(\{p_1,\ldots ,p_{n-1}\}\subset H(v)\cap V(f_{r,k})\). Suppose that \(H(v)\cap V(f_{r,k})\subset H(v')\). Then, \(v'\cdot p_i=v_i'-((v_n)^{-1}v'_n)v_i=0\) for all \(i\in \{1,\ldots ,n-1\}\). Clearly, \(v_n'-((v_n)^{-1}v'_n)v_n=0\). So \(v'=((v_n)^{-1}v'_n)v,\) which implies \(H(v')=H(v)\).

Let \(r=2\). In this case, \(\{p_1,\ldots ,p_{n-2}\}\subset H(v)\cap V(f_{2,k})\). Suppose that \(H(v)\cap V(f_{2,k})\subset H(v')\). Then, as above, \(v'_i=((v_n)^{-1}v'_n)v_i\) for \(i\in \{1,\ldots ,n-2,n\}\). If \(H(v)\ne H(v')\), this means that \(v'=v+ke_{n-1}\), with \(k\ne 0\). There are three cases to be considered: If \(v_{n-1}=0\), then \(e_{n-1}\in H(v)\cap V(f_{2,k})\) but not in \(H(v')\); if \(v_{n-1}\ne 0\) and it exists \(j\in \{1,\ldots ,n-2\}\) such that \(v_j\ne 0\), then \(v_{n-1}e_j-v_je_{n-1}\) in \(H(v)\cap V(f_{2,k})\) but not in \(H(v')\); if \(v_{n-1} \ne 0\) and \(v_j=0\) for all \(j\in \{1,\ldots ,n-2\}\), then \(v_ne_1+v_{n-1}e_2-v_ne_{n-1}+v_{n-1}e_n \in H(v)\cap V(f_{2,k})\) but not in \(H(v')\). In all three cases, we get then a contradiction.

In order to prove that for every nonzero vector v, it exists x such that \(f(x) + v\cdot x= 0\) and f(x) is different from 0, let \(\{i_1,\ldots ,i_r\}\) be the support of the vector v. We will have that \(v\cdot x=v_{i_1}x_{i_1}+\cdots + v_{i_r}x_{i_r}\). Without loss of generality, we can consider \(i_1=1\), \(v_1=1\) and x to be such that the following relation holds (since x does not annihilate \(v\cdot x\))

$$\begin{aligned} x_{1}+ v_{i_2}x_{i_2} +\cdots + v_{i_r}x_{i_r} =1 \end{aligned}$$

and so

$$\begin{aligned} x_{1} =1-(v_{i_2}x_{i_2} +\cdots + v_{i_r}x_{i_r}). \end{aligned}$$

If we take \({\hat{x}}\) having its components as follows

$$\begin{aligned} {\hat{x}}_i={\left\{ \begin{array}{ll} 1-(v_{i_2}x_{i_2} +\cdots + v_{i_r}x_{i_r})&{}\quad \text { for } i=1\\ 0&{}\quad \text { for } i\in \{2,\ldots ,r(k-1)\}\\ 1&{}\quad \text { for } i\in \{r(k-1)+1,\ldots ,rk-1\}\\ -\,1&{}\quad \text { for } i=rk\\ \end{array}\right. }, \end{aligned}$$

then \({\hat{x}}\) is such that \(f({\hat{x}})=-\,1\ne 0\), \(v\cdot {\hat{x}}=1\ne 0\) and \(f({\hat{x}})+v\cdot {\hat{x}}=0\). \(\square \)

Corollary 5.2

If \(r\ge 2\) and \(k\ge 2\), the code \({\mathcal {C}}_{f_{r,k}}\) is minimal.

Proof

This follows directly from Theorems 5.1 and 4.6. \(\square \)

Lemma 5.3

The cardinality of \(V(f_{r,k})\) is

$$\begin{aligned} \#V(f_{r,k})=(q-1)\cdot q^{k-1}\cdot (q^{r-1}-(q-1)^{r-1})^k+q^{rk-1}. \end{aligned}$$
(4)

Proof

Let us start considering the monomial \(x_1x_2\dots x_r\). It is clearly nonzero for \((q-1)^r\) choices of \((x_1,x_2,\ldots ,x_r)\), and then, it is zero for \(q^r-(q-1)^r\) choices. Moreover, it takes all nonzero values equally often, so for a \(t\in {\mathbb {F}}_q\) we have that it assumes the value t exactly \((q-1)^{r-1}\) times. Let us fix r and define \(Z(k):=\#V(f_{r,k})\). Note that

$$\begin{aligned} V(f_{r,k})= & {} V(f_{r,k-1})\times V(f_{r,1}) \\&+\,({\mathbb {F}}_q^{(k-1)r}{\setminus } V(f_{r,k-1}))\times \{(x_1,\ldots ,x_r)\ | \ f_{r,1}(x_1,\ldots ,x_r)=t\ne 0\}. \end{aligned}$$

So we get the following recursive formula to compute Z(k):

$$\begin{aligned} \begin{aligned} Z(k)&=Z(k-1)\cdot (q^r-(q-1)^r)+(q^{(k-1)r}-Z(k-1))\cdot (q-1)^{r-1}\\&=Z(k-1)\cdot q\cdot (q^{r-1}-(q-1)^{r-1})+q^{(k-1)r}\cdot (q-1)^{r-1}.\\ \end{aligned} \end{aligned}$$

Let us prove (4) by induction on k.

For \(k=1\), we have

$$\begin{aligned} Z(1)=(q-1)\cdot (q^{r-1}-(q-1)^{r-1})+q^{r-1}=q^r-(q-1)^r, \end{aligned}$$

which is the correct number, as observe above. So we focus on the inductive step:

$$\begin{aligned} \begin{array}{rl} Z(k)&{}=Z(k-1)\cdot q\cdot (q^{r-1}-(q-1)^{r-1})+q^{(k-1)r}\cdot (q-1)^{r-1}\\ &{}=((q-1)\cdot q^{k-2}\cdot (q^{r-1}-(q-1)^{r-1})^{k-1}+\\ &{}\quad +\,q^{r(k-1)-1})\cdot q\cdot (q^{r-1}-(q-1)^{r-1})+q^{(k-1)r}\cdot (q-1)^{r-1}\\ &{}=(q-1)\cdot q^{k-1}\cdot (q^{r-1}-(q-1)^{r-1})^{k}+\\ &{}\quad +\,q^{r(k-1)}\cdot (q^{r-1}-(q-1)^{r-1})+q^{r(k-1)}\cdot (q-1)^{r-1}\\ &{}=(q-1)\cdot q^{k-1}\cdot (q^{r-1}-(q-1)^{r-1})^{k}+q^{rk-1}. \end{array} \end{aligned}$$

\(\square \)

Lemma 5.4

If \(r\ge 2+\log _{\left( 1-\frac{1}{q}\right) }\left( \frac{q-\sqrt{q}}{q-1}\right) \), then

$$\begin{aligned} \#V(f_{r,2})^*\ge 2q^{2r-1}-q^{2r-2}-1. \end{aligned}$$

Proof

By Lemma 5.3,

$$\begin{aligned} \#V(f_{r,2})^*=(q-1)\cdot q\cdot (q^{r-1}-(q-1)^{r-1})^2+q^{2r-1}-1. \end{aligned}$$

We want to determine when

$$\begin{aligned} \#V(f_{r,2})^*\ge 2q^{2r-1}-q^{2r-2}-1. \end{aligned}$$

This is equivalent to solve

$$\begin{aligned} q^{2r-2}(q-1)^2+q(q-1)^{2r-1}-2q^r(q-1)^r\ge 0, \end{aligned}$$

and with some manipulations we obtain

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

The first two factors are positive. To study the third one, we can call \(t=\left( 1-\frac{1}{q}\right) ^{r-2}\) and solve

$$\begin{aligned} \left( 1-\frac{1}{q}\right) \cdot t^2-2\cdot t+1\ge 0. \end{aligned}$$

which gives

$$\begin{aligned} t\le \frac{q-\sqrt{q}}{q-1} \ \text { or } \ t\ge \frac{q+\sqrt{q}}{q-1} \end{aligned}$$

that is,

$$\begin{aligned} r\ge 2+\log _{\left( 1-\frac{1}{q}\right) }\left( \frac{q-\sqrt{q}}{q-1}\right) . \end{aligned}$$

\(\square \)

Theorem 5.5

There are infinitely many values of r such that \({\mathcal {C}}_{f_{r,2}}\) is minimal and does not satisfy the AB condition.

Proof

If \(r\ge 2+\log _{\left( 1-\frac{1}{q}\right) }\left( \frac{q-\sqrt{q}}{q-1}\right) \), then \(C_{f_{r,2}}\) is minimal, by Lemma 5.1 and Theorem 4.6, and does not satisfy the AB condition, by Lemmas 5.4 and 4.3. \(\square \)

Remark 5.6

Note that the function defined above is homogeneous, so that we can consider it in the projective case. Completely analogously to the affine case, we have that \(\widetilde{{\mathcal {C}}}_{f_{r,k}}\) is minimal for \(r\ge 2\) and \(k\ge 2\), and there are infinitely many values of r such that \(\widetilde{{\mathcal {C}}}_{f_{r,2}}\) does not satisfy the AB condition.

6 Conclusion and open problems

In this paper, we have linked a well-known construction of minimal linear codes to the geometry of its defining function, which was a quite unexplored topic and which may lead to new and interesting constructions in coding theory. A new notion in blocking sets’ theory is introduced, and related examples are provided. Moreover, we present an infinite family of minimal linear codes not satisfying the Ashikhmin–Barg’s condition.

To conclude, we list here some of the possible developments of our results.

Problem 1

Give a necessary and sufficient condition for \(C_f\) to be minimal, which relies only on the geometry of V(f).

Problem 2

Investigate the weight distribution of \(C_f\) for some cutting blocking sets.

Problem 3

In Sect. 5, we introduced the family of functions \(f_{r,k}\) and we proved that infinitely many codes are minimal when \(k=2\). From computations, it seems that the same holds for \(k>2\), but the inequalities become much harder to be solved.

We think that our geometrical approach gives a deeper insight into the problem and may lead to other future developments and constructions.