1 Introduction

Let \(\mathbb {F}_{q}\) be a finite field with q elements. An [n,k,d] linear code \(\mathcal {C}\) over \(\mathbb {F}_{q}\) is a k-dimensional subspace of \(\mathbb {F}_{q}^{n}\) with minimal (Hamming) distance d. Let c=(c 1,c 2,⋯ ,c n ) be a codeword of \(\mathcal {C}\). The support of c is defined as supp(c)={i: c i ≠0}. Then the (Hamming) weight w(c) of c is w(c)=|supp(c)|. Let A i denote the number of codewords with Hamming weight i in \(\mathcal {C}\). The weight enumerator of \(\mathcal {C}\) is defined by

$$A_{0}+A_{1}z+A_{2}z^{2}+{\cdots} +A_{n}z^{n}. $$

The definition of the complete weight enumerator of linear codes is given in [18, 19]. We recall the definition as that in [15]. Let the elements of \(\mathbb {F}_{q}\) be ω 0=0, ω 1, ω 2,⋯ ,ω q−1. The composition of a vector \(\textbf {v}=(v_{0}, v_{1},\cdots ,v_{n-1})\in \mathbb {F}_{q}^{n}\) is defined to be comp(v)=(t 0,t 1,⋯ ,t q−1), where each t i = t i (v) is the number of components v j (0≤jn−1) of v that are equal to ω i . Clearly, \(\sum \limits _{i=0}^{q-1}t_{i}=n\). Let A(t 0,t 1,⋯ ,t q−1) be the number of codewords \(\textbf {c}\in \mathcal {C}\) with comp(c)=(t 0,t 1,⋯ ,t q−1). Then the complete weight enumerator of \(\mathcal {C}\) is the polynomial

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}}(z_{0},z_{1},\cdots,z_{q-1})&=& \sum\limits_{\textbf{c}\in \mathcal{C}}z_{0}^{t_{0}(\textbf{c})}z_{1}^{t_{1}(\textbf{c})}{\cdots} z_{q-1}^{t_{q-1}(\textbf{c})}\\ &=& \sum\limits_{(t_{0},t_{1},\cdots,t_{q-1})\in B_{n}}A(t_{0}, t_{1},\cdots, t_{q-1})z_{0}^{t_{0}}z_{1}^{t_{1}}{\cdots} z_{q-1}^{t_{q-1}}, \end{array} $$

where \(B_{n}=\left \{(t_{0},t_{1},\cdots , t_{q-1}): 0\leq t_{i}\leq n, \sum \limits _{i=0}^{q-1}t_{i}=n \right \}\). If we let z 0=1, z 1 = z 2=⋯z q−1 = z, then the complete weight enumerator of \(\mathcal {C}\) is the weight enumerator of \(\mathcal {C}\). For binary linear codes, the complete weight enumerators are just the Hamming weight enumerators.

The complete weight enumerators are applied to study the monomial and quadratic bent functions [11]. It was pointed out that the complete weight enumerators can be used to calculate the deception probabilities of certain authentication codes in [8, 9]. Blake and Kith [3, 12] researched the complete weight enumerators of Reed-Solomon codes. The complete weight enumerators of the generalized Kerdock code and related linear codes over Galois rings are given by Kuzmin and Nechaev [13, 14]. Recently, the complete weight enumerators of linear codes or cyclic codes over finite fields were studied in [2, 10, 1517, 2428]. The weight enumerators of the torsion codes of MacDonald codes over the finite non-chain ring \(\mathbb {F}_{p}+v\mathbb {F}_{p}\), where p is a prime, have been given in [23], it was used to study the access structure of secret sharing. To the best of our knowledge, the complete weight enumerators of these torsion codes have not been studied.

In this paper, we will investigate the complete weight enumerators of the torsion codes of MacDonald codes over the finite non-chain ring \(\mathbb {F}_{p}+v\mathbb {F}_{p}\). We will recall the definitions of MacDonald codes and its torsion codes in Section 2. In Section 3, we will give the complete weight enumerators of these torsion codes. Some applications of these complete weight enumerators in authentication codes will be considered in Section 4.

2 MacDonald codes over \(\mathbb {F}_{p}+v\mathbb {F}_{p}\)

Let R be the ring \(\mathbb {F}_{p}+v\mathbb {F}_{p}\), where p is a prime and v 2 = v. Clearly, R is isomorphic to the quotient ring \(\mathbb {F}_{p}[v]/\langle v^{2}-v\rangle \). R is a commutative ring with identity and characteristic p. For any element rR, there are unique \(a, b\in \mathbb {F}_{p}\) such that r = a + b v. Further, R is principal and has two maximal ideals 〈v〉 and 〈1−v〉. It means that R is not a local ring, which implies that R is a finite non-chain ring.

In this section, we will recall the definitions of MacDonald codes over R and their torsion codes. The MacDonald code is a punctured code of the simplex code. The MacDonald code over \(\mathbb {F}_{2}\) was first introduced by MacDonald [20]. The formal definition of the MacDonald code and its torsion code will be given below. MacDonald codes from simplex codes of type α over the ring \(\mathbb {F}_{2}+v\mathbb {F}_{2}\) with v 2 = v could be found in [7]. In [5], MacDonald codes from simplex codes of type α over the ring \(\mathbb {F}_{3}+v\mathbb {F}_{3}\) with v 2=1 were given. Simplex codes of type β over the ring \(\mathbb {F}_{3}+v\mathbb {F}_{3}\) with v 2=1 were studied in [6]. Recently, the weight enumerators of the torsion codes of MacDonald codes from simplex codes of type α and type β over the ring R were given in [23].

In the following, we give the definition of the torsion code first. A linear code \(\mathcal {C}\) over R of length n is an R-submodule of R n. For any linear code \(\mathcal {C}\) over R , we have \(\mathcal {C}=(1-v)H^{+}\oplus vH^{-}\), where \(H^{+}=\{s: \exists t\in \mathbb {F}_{p}^{n}\ such\ that\ (1-v)s+vt\in \mathcal {C}\}\) and \(H^{-}=\{t: \exists s\in \mathbb {F}_{p}^{n}\ such\ that\ (1-v)s+vt\in \mathcal {C}\}\). Clearly, H + and H are both linear codes of length n over \(\mathbb {F}_{p}\). We define H + and H as the torsion codes of \(\mathcal {C}\).

2.1 MacDonald codes of type α

A type α simplex code \(S_{k}^{\alpha }\) is a linear code over R. Its generator matrix \(\textbf {G}_{k}^{\alpha }\) is constructed inductively. Let \(\textbf {G}_{k}^{\alpha }\) be a k×p 2k matrix over R, where

figure a

and

$$\textit{\textbf{G}}_{1}^{\alpha}=[0\ 1\ \cdots\ p-1\ v \ \cdots\ v(p-1)\ \cdots\ (p-1)+v\ \cdots\ (p-1)+v(p-1)].</p><p class="noindent">$$

Lemma 1

[23] The torsion codes H + and H of \(S_{k}^{\alpha }\) are permutation equivalent to each other.

The MacDonald code of type α over the ring R can be constructed from the generator matrix \(\textit {\textbf {G}}_{k}^{\alpha }\) of the simplex code \(S_{k}^{\alpha }\). For 1≤uk−1, let \(\textit {\textbf {G}}_{k,u}^{\alpha }\) be the matrix obtained from \(\textit {\textbf {G}}_{k}^{\alpha }\) by deleting columns corresponding to the columns of \(\textit {\textbf {G}}_{u}^{\alpha }\), i.e.

$$ \textit{\textbf{G}}_{k,u}^{\alpha}=\left[\textit{\textbf{G}}_{k}^{\alpha} \setminus \frac{\textit{\textbf{0}}}{\textit{\textbf{G}}_{u}^{\alpha}}\right] $$
(1)

where [AB] denotes the matrix obtained from the matrix A by deleting the matrix B, and the size of 0 is (kup 2u.

Definition 1

The code \(\mathcal {C}_{k,u}^{\alpha }\) generated by \(\textit {\textbf {G}}_{k,u}^{\alpha }\) is called a type α MacDonald code.

We can see that the code \(\mathcal {C}_{k,u}^{\alpha }\) is a linear code over the ring R of length p 2kp 2u. Let \(\mathcal {C}_{k,u,T}^{\alpha }\) be the torsion code of \(\mathcal {C}_{k,u}^{\alpha }\). That is the generator matrix of \(\mathcal {C}_{k,u,T}^{\alpha }\) is obtained by replacing (1−v) by 1 in the matrix \((1-v)\textit {\textbf {G}}_{k,u}^{\alpha }\). Similarly, we can get another torsion code of \(\mathcal {C}_{k,u}^{\alpha }\) by replacing v by 1 in \(v\textit {\textbf {G}}_{k,u}^{\alpha }\). But, by Lemma 1, we know that the two torsion codes are equivalent to each other. Therefore we only need to consider the former case, i.e. we only study \(\mathcal {C}_{k,u,T}^{\alpha }\), which is a [p 2kp 2u,k] code [23].

2.2 MacDonald codes of type β

The length of simplex codes of type α is large and increases fast. We can omit some columns from \(S_{k}^{\alpha }\). A type β simplex code \(S_{k}^{\beta }\) is a linear code over R constructed by omitting some columns from \(\textit {\textbf {G}}_{k}^{\alpha }\).

Let λ k be a matrix of size \(k\times \frac {p^{2k}-p^{k}}{p-1}\) over the ring R. Let λ 1=[1 2 ⋯ p−1 v] and

figure b

Then λ k is constructed inductively as follows

figure c

Let δ k be a matrix of size \(k\!\times \! \frac {p^{2k}-p^{k}}{p-1}\) over the ring R. Let δ 1=[1 2 ⋯ p − 1 p − 1 + v] and

figure d

Then δ k is constructed inductively as follows

figure e

Let \(\textit {\textbf {G}}_{k}^{\beta }\) be the generator matrix of \(S_{k}^{\beta }\). The size of \(\textit {\textbf {G}}_{k}^{\beta }\) is \(k\times \left (\frac {p^{k}-1}{p-1}\right )^{2}\). Let \(\textit {\textbf {G}}_{1}^{\beta }=[1]\) and

figure f

Then \(\textit {\textbf {G}}_{k}^{\beta }\) is constructed inductively as follows

figure g

Therefore we have the following result similar to Lemma 1.

Lemma 2

[23] The torsion codes H + , H of \(S_{k}^{\beta }\) are permutation equivalent to each other.

We can construct type β MacDonald codes similar to the construction of type α MacDonald codes in Definition 1. For 2≤uk−1, let \(\textit {\textbf {G}}_{k,u}^{\beta }\) be the matrix obtained from \(\textit {\textbf {G}}_{k}^{\beta }\) by deleting columns corresponding to the columns of \(\textit {\textbf {G}}_{u}^{\beta }\), i.e.

$$ \textit{\textbf{G}}_{k,u}^{\beta}=\left[\textit{\textbf{G}}_{k}^{\beta} \setminus \frac{\textit{\textbf{0}}}{\textit{\textbf{G}}_{u}^{\beta}}\right] $$
(2)

where [AB] denotes the matrix obtained from the matrix A by deleting the matrix B, and the size of 0 is \((k-u)\times \left (\frac {p^{u}-1}{p-1}\right )^{2}\).

Definition 2

The code \(\mathcal {C}_{k,u}^{\beta }\) generated by \(G_{k,u}^{\beta }\) is called a type β MacDonald code.

Let \(\mathcal {C}_{k,u,T}^{\beta }\) be the torsion code of \(\mathcal {C}_{k,u}^{\beta }\). That is the generator matrix of \(\mathcal {C}_{k,u,T}^{\beta }\) is obtained by replacing v by 1 in the matrix \(v\textit {\textbf {G}}_{k,u}^{\beta }\). Similarly, we can get another torsion code of \(\mathcal {C}_{k,u}^{\beta }\) by replacing 1−v by 1 in \((1-v)\textit {\textbf {G}}_{k,u}^{\beta }\). But, from Lemma 2, we know that the two torsion codes are equivalent to each other. So we only consider the former case, i.e., \(\mathcal {C}_{k,u,T}^{\beta }\), whose dimension is k [23].

3 The complete weight enumerators of torsion codes of MacDonald codes

For the convenience, we introduce some notations which will be used throughout the paper. For a matrix G, let N G be the number of columns of G. Specially, \(N_{\textit {\textbf {G}}_{0}^{\alpha }}=1,\ N_{\textit {\textbf {G}}_{0}^{\beta }}=N_{\lambda _{0}}=N_{\delta _{0}}=0\). Let (G) j denote the jth row of the matrix G, the composition of (G) j be denoted by comp((G) j ). Let η j and γ j (j≥1)be the integers \(\frac {p^{j-1}-1}{p-1}\) and \(\frac {p^{2j-2}-p^{j-1}}{p-1}\) respectively, where p is a prime. For any \( \omega _{i}\in \mathbb {F}_{p}^{*}\), define the permutation map \(\tau _{i}:\ \mathbb {F}_{p} \rightarrow \ \mathbb {F}_{p}\), with τ i (a) = ω i a (mod p). Similarly, for any \( \omega _{i}\in \mathbb {F}_{p}\), define the permutation map \(\tau _{i}^{\prime }:\ \mathbb {F}_{p}\ \rightarrow \ \mathbb {F}_{p}\), with \(\tau _{i}^{\prime }(a)=\omega _{i} + a\ (\text {mod}\ p)\). For a vector \(\textbf {v}=(v_{1},v_{2},\cdots ,v_{n})\in \mathbb {F}_{p}^{n} \), comp(v)=(t 0,t 1,⋯ ,t p−1), define \(\tau _{i}^{\prime }(\textbf {v})=(\tau _{i}^{\prime }(v_{1}),\tau _{i}^{\prime }(v_{2}),\cdots ,\tau _{i}^{\prime }(v_{n})), \tau _{i}(\textbf {v})=(\tau _{i}(v_{1}),\tau _{i}(v_{2}),\cdots ,\tau _{i}(v_{n})\). It is clear that \(\text {comp}(\textbf {v})=\text {comp}(\tau _{i}^{\prime }(\textbf {v}))\left (resp.\ \text {comp}(\textbf {v})=\text {comp}(\tau _{i}(\textbf {v}))\right )\) if t 0 = t 1=⋯ = t p−1 (r e s p. t 1 = t 2=⋯ = t p−1).

3.1 The complete weight enumerator of \(\mathcal {C}_{k,u,T}^{\alpha }\)

Let \(\textit {\textbf {G}}_{k,T}^{\alpha }\) be the matrix that is obtained by replacing (1−v) by 1 in the matrix \((1-v)\textit {\textbf {G}}_{k}^{\alpha }\). Similarly, let \(\textit {\textbf {G}}_{k,u,T}^{\alpha }\) be the generator matrix of \(\mathcal {C}_{k,u,T}^{\alpha }\), that is, \(\textit {\textbf {G}}_{k,u,T}^{\alpha }\) is obtained by replacing (1−v) by 1 in the matrix \((1-v)\textit {\textbf {G}}_{k,u}^{\alpha }\). Let \(\textbf {g}_{i}^{\alpha } (1\leq i\leq k)\) be the ith row of \(\textit {\textbf {G}}_{k,u,T}^{\alpha }\). We give the composition of each row of \(\textit {\textbf {G}}_{k,T}^{\alpha }\), \((\textit {\textbf {G}}_{k,T}^{\alpha })_{i}\), and \(\textbf {g}_{i}^{\alpha }\) in the following results.

Proposition 1

\(\text {comp}((\textit {\textbf {G}}_{k,T}^{\alpha })_{j})=z_{0}^{p^{2k-1}}z_{1}^{p^{2k-1}}{\cdots } z_{p-1}^{p^{2k-1}},\ 1\leq j\leq k\).

Proof

The composition of the first row of \(\textit {\textbf {G}}_{k,T}^{\alpha }\) is \(z_{0}^{pN_{G_{k-1}^{\alpha }}}z_{1}^{pN_{G_{k-1}^{\alpha }}}{\cdots } z_{p-1}^{pN_{G_{k-1}^{\alpha }}}\). The composition of the jth row of \(\textit {\textbf {G}}_{k,T}^{\alpha }\) equals to \((\text {comp}((G_{k-j+1,T}^{\alpha })_{1}))^{p^{2j-2}}\). Then, we have \(\text {comp}((\textit {\textbf {G}}_{k,T}^{\alpha })_{j})=z_{0}^{p^{2j-1}N_{\textit {\textbf {G}}_{k-j}^{\alpha }}}z_{1}^{p^{2j-1}N_{\textit {\textbf {G}}_{k-j}^{\alpha }}}\cdots z_{p-1}^{p^{2j-1}N_{\textit {\textbf {G}}_{k-j}^{\alpha }}},\ 1\leq j\leq k\). The result is obtained as \(N_{\textit {\textbf {G}}_{k-j}^{\alpha }}=p^{2k-2j}\). □

Proposition 2

For 1≤u≤k−1,

$$ \text{comp}(\mathbf{g}_{j}^{\alpha})= \left\{\begin{array}{ll} z_{0}^{p^{2k-1}-p^{2u}}z_{1}^{p^{2k-1}}\cdots z_{p-1}^{p^{2k-1}} & if \ 1\leq j\leq k-u,\\ z_{0}^{p^{2k-1}-p^{2u-1}}z_{1}^{p^{2k-1}-p^{2u-1}}\cdots z_{p-1}^{p^{2k-1}-p^{2u-1}} & if \ k-u+1\leq j\leq k. \end{array}\right. $$
(3)

Proof

For 1≤jku, \(\text {comp}(\textbf {g}_{j}^{\alpha })=\text {comp}((\textit {\textbf {G}}_{k,T}^{\alpha })_{j})\cdot z_{0}^{-N_{G_{u}^{\alpha }}}=\text {comp}((\textit {\textbf {G}}_{k,T}^{\alpha })_{j})\cdot z_{0}^{-p^{2u}}\). For ku+1≤jk, \(\text {comp}(\textbf {g}_{j}^{\alpha })=\text {comp}((\textit {\textbf {G}}_{k,T}^{\alpha })_{j})\cdot [\text {comp}((\textit {\textbf {G}}_{u,T}^{\alpha })_{j-k+u})]^{-1}\). Then, the Eq. (3) holds immediately from Proposition 1. □

Now, we consider the composition of the vector which is a linear combination of any two rows of \(\textit {\textbf {G}}_{k,u,T}^{\alpha }\).

Lemma 3

For any \( \omega _{1},\ \omega _{2}\in \mathbb {F}_{p}^{*}\) , and 1≤i<j≤k, we have \(\text {comp}(\omega _{1}\cdot \textbf {g}_{i}^{\alpha })=\text {comp}(\textbf {g}_{i}^{\alpha })\) and \(\text {comp}(\omega _{1}\cdot \textbf {{g}}_{i}^{\alpha }+\omega _{2}\cdot \textbf {{g}}_{j}^{\alpha })=\text {comp}(\textbf {{g}}_{j}^{\alpha })\).

Proof

By Proposition 2, we know that every element of \(\mathbb {F}_{p}^{*}\) appears the same time in \(\textbf {g}_{j}^{\alpha }\), where 1≤jk. Moreover, τ 1 is a permutation, so the frequency of every nonzero element in \(\tau _{1}(\textbf {g}_{i}^{\alpha })\) is the same as that in \(\textbf {g}_{i}^{\alpha }\), and hence \(\text {comp}(\omega _{1}\cdot \textbf {g}_{i}^{\alpha })=\text {comp}(\textbf {g}_{i}^{\alpha })\). The i-th row of \(\textit {\textbf {G}}_{k,T}^{\alpha }\) is

$$(\textit{\textbf{G}}_{k,T}^{\alpha})_{i}=[\underbrace{(\textit{\textbf{G}}_{k-i+1,T}^{\alpha})_{1},(\textit{\textbf{G}}_{k-i+1,T}^{\alpha})_{1},\cdots, (\textit{\textbf{G}}_{k-i+1,T}^{\alpha})_{1}}_{p^{2i-2}}]. $$

For 0≤lp−1, let

figure h

the number of the block \((\textit {\textbf {G}}_{k-j+1,T}^{\alpha })_{1}\) in M l is p 2j−2i−2. Let

$$\begin{array}{@{}rcl@{}} \textit{\textbf{M}}\,=\,\left[\textit{\textbf{M}}_{0}\ \textit{\textbf{M}}_{1}\ \cdots\ \textit{\textbf{M}}_{p-1}\ \underbrace{\textit{\textbf{M}}_{0}\ \textit{\textbf{M}}_{0}\ \cdots\ \textit{\textbf{M}}_{0}}_{p-1}\ \underbrace{\textit{\textbf{M}}_{1}\ \textit{\textbf{M}}_{1}\ \cdots\ \textit{\textbf{M}}_{1}}_{p-1}\ \cdots\ \underbrace{\textit{\textbf{M}}_{p-1}\ \textit{\textbf{M}}_{p-1}\ \cdots\ \textit{\textbf{M}}_{p-1}}_{p-1}\right]_{2\times p^{2k-2i+2}}. \end{array} $$

We need to consider the following three cases.

  1. Case 1:

    1≤iku and 2≤jku. Let

    figure i

    the size of the \(\hat {\textit {\textbf {M}}_{0}}\) is 2×(p 2k−2ip 2u) and the number of the block \((\textit {\textbf {G}}_{k-j+1,T}^{\alpha })_{1}\) in \(\hat {\textit {\textbf {M}}_{0}}\) is p 2j−2i−2−1. Let

    $$\begin{array}{@{}rcl@{}}</p><p class="noindent">\hat{\textit{\textbf{M}}}\,=\,\left[\hat{\textit{\textbf{M}}_{0}}\ \textit{\textbf{M}}_{1}\ \cdots\ \textit{\textbf{M}}_{p-1}\ \underbrace{\textit{\textbf{M}}_{0}\ \textit{\textbf{M}}_{0}\ \cdots\ \textit{\textbf{M}}_{0}}_{p-1}\ \underbrace{\textit{\textbf{M}}_{1}\ \textit{\textbf{M}}_{1}\ \cdots\ \textit{\textbf{M}}_{1}}_{p-1}\ \cdots\ \underbrace{\textit{\textbf{M}}_{p-1}\ \textit{\textbf{M}}_{p-1}\ \cdots\ \textit{\textbf{M}}_{p-1}}_{p-1}\right]. \end{array} $$

    the size of \(\hat {\textit {\textbf {M}}}\) is 2×(p 2k−2i+2p 2u). Then, we have

    $$\left[ \begin{array}{ll} \textbf{g}_{i}^{\alpha} \cr \textbf{g}_{j}^{\alpha} \end{array}\right]=\left[\hat{\textit{\textbf{M}}}\ \underbrace{\textit{\textbf{M}}\ \textit{\textbf{M}}\ \cdots\ \textit{\textbf{M}}}_{p^{2i-2}-1}\right]_{2\times (p^{2k}-p^{2u})}. $$
  2. Case 2:

    1≤iku and ku+1≤jk. We need to change the structure of \(\hat {\textit {\textbf {M}}}_{0}\). Let

    figure j

    the number of the block \((\textit {\textbf {G}}_{k-j+1,T}^{\alpha })_{1}\) in \(\hat {\textit {\textbf {M}}_{0}}\) is p 2j−2i−2p 2u−2k+2j−2. Then the structures of \(\hat {\textit {\textbf {M}}}\) and \( \left [ \begin {array}{ll} \textbf {g}_{i}^{\alpha } \cr \textbf {g}_{j}^{\alpha } \end {array}\right ] \) are the same as that in Case 1.

  3. Case 3:

    ku+1≤i<jk. In this case, we have

    $$\left[ \begin{array}{ll} \textbf{g}_{i}^{\alpha} \cr \textbf{g}_{j}^{\alpha} \end{array}\right]=\left[\textit{\textbf{M}}\ \textit{\textbf{M}}\ \textit{\textbf{M}}\ \cdots\ \textit{\textbf{M}}\right]_{2\times (p^{2k}-p^{2u})}, $$

    the number of the block M appears p 2i−2p 2u−2k+2i−2 times.

Every element in \(\mathbb {F}_{p}\) appears the same number of times in \((\textit {\textbf {G}}_{k-j+1,T}^{\alpha })_{1}\), and τ, \(\tau ^{\prime }\) are permutation maps. So, for any \(\omega _{1}, \omega _{2} \in \mathbb {F}_{p}^{*}\), we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\tau_{\tau_{\omega_{1}}(l)}^{\prime}(\tau_{\omega_{2}}((\textit{\textbf{G}}_{k-j+1,T}^{\alpha})_{1}))) &=&\text{comp}(\tau_{\omega}^{\prime}(\tau_{\omega_{2}}((\textit{\textbf{G}}_{k-j+1,T}^{\alpha})_{1})))\\ &=&\text{comp}(\tau_{\omega_{2}}((\textit{\textbf{G}}_{k-j+1,T}^{\alpha})_{1}))\\ &=&\text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\alpha})_{1}), \end{array} $$

where ω = ω 1l(mod p), 0≤lp−1. Hence, comp(ω 1⋅(M l )1 + ω 2⋅(M l )2)=comp((M l )2), for any 0≤lp−1. Moreover, for the \(\hat {\textit {\textbf {M}}_{0}}\) in the above Case 1 and Case 2, we have \(\text {comp}(\omega _{1}\cdot (\hat {\textit {\textbf {M}}_{0}})_{1}+\omega _{2} \cdot (\hat {\textit {\textbf {M}}_{0}})_{2})=\text {comp}(\omega _{2}\cdot (\hat {\textit {\textbf {M}}_{0}})_{2})=\text {comp}((\hat {\textit {\textbf {M}}_{0}})_{2})\). Until now, we have proved that comp(ω 1⋅(M)1 + ω 2⋅(M)2)=comp((M)2) and \(\text {comp}(\omega _{1}\cdot (\hat {\textit {\textbf {M}}})_{1}+\omega _{2} \cdot (\hat {\textit {\textbf {M}}})_{2})= \text {comp}((\hat {\textit {\textbf {M}}})_{2})\). Then, from the structure of \( \left [ \begin {array}{ll} \textbf {g}_{i}^{\alpha } \cr \textbf {g}_{j}^{\alpha } \end {array}\right ] \)in the aforementioned three cases, we have \(\text {comp}(\omega _{1}\cdot \textbf {{g}}_{i}^{\alpha }+\omega _{2}\cdot \textbf {{g}}_{j}^{\alpha })=\text {comp}(\textbf {{g}}_{j}^{\alpha })\). □

We give the complete weight enumerator of \(\mathcal {C}_{k,u,T}^{\alpha }\), 1≤uk−1, in the following result.

Theorem 1

Let 1≤u≤k−1. The complete weight enumerator of the torsion code \(\mathcal {C}_{k,u,T}^{\alpha }\) is given by

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}_{k,u,T}^{\alpha}}(z_{0},z_{1},\cdots,z_{p-1})&=&z_{0}^{p^{2k}-p^{2u}}+(p^{k-u}-1)z_{0}^{p^{2k-1}-p^{2u}}z_{1}^{p^{2k-1}}z_{2}^{p^{2k-1}}{\cdots} z_{p-1}^{p^{2k-1}}\\ &&+(p^{k}-p^{k-u})z_{0}^{p^{2k-1}-p^{2u-1}}z_{1}^{p^{2k-1}-p^{2u-1}}z_{2}^{p^{2k-1}-p^{2u-1}}\\ &&{\cdots} z_{p-1}^{p^{2k-1}-p^{2u-1}}. \end{array} $$

Proof

For any \(\textit {\textbf {u}}=(u_{1},u_{2},\cdots ,u_{k})\in \mathbb {F}_{p}^{k}\), let i u = m a x{i: u i ≠0, 1≤ik}. From Lemma 3, we have \(\text {comp}(\textit {\textbf {u}}\cdot \textit {\textbf {G}}_{k,u,T}^{\alpha })=\text {comp}(\textbf {g}_{i_{\textit {\textbf {u}}}}^{\alpha })\). So, the number of codewords whose composition equals to \(\text {comp}(\textbf {g}_{i}^{\alpha })\) is p i−1(p−1). Then, according to Proposition 2, we get the complete weight enumerator of \(\textit {\textbf {G}}_{k,u,T}^{\alpha }\) as follows

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}_{k,u,T}^{\alpha}}(z_{0},z_{1},\cdots,z_{p-1})&=&z_{0}^{p^{2k}-p^{2u}}+\sum\limits_{i=1}^{k-u}p^{i-1}(p-1)\text{comp}(\textbf{g}_{1}^{\alpha})\\ &&+\sum\limits_{i=k-u+1}^{k}p^{i-1}(p-1)\text{comp}(\textbf{g}_{k-u+1}^{\alpha})\\ &=&z_{0}^{p^{2k}-p^{2u}}+(p^{k-u}-1)z_{0}^{p^{2k-1}-p^{2u}}z_{1}^{p^{2k-1}}z_{2}^{p^{2k-1}}{\cdots} z_{p-1}^{p^{2k-1}}\\ &&+(p^{k}-p^{k-u})z_{0}^{t_{0}}z_{1}^{t_{0}}z_{2}^{t_{0}}{\cdots} z_{p-1}^{t_{0}}, \end{array} $$

where t 0 = p 2k−1p 2u−1. □

Let z 0=1,z 1 = z 2=⋯z p−1 = z. Then we get the Hamming weight distribution of \(\mathcal {C}_{k,u,T}^{\alpha }\), which is consistent with that in [23].

Example 1

Let p=3, k=3, u=1. Then from Theorem 1, we have the complete weight enumerator of \(\mathcal {C}_{3,1,T}^{\alpha }\) as follows

$$W_{\mathcal{C}_{3,1,T}^{\alpha}}=z_{0}^{720}+8z_{0}^{234}z_{1}^{243}z_{2}^{243}+18z_{0}^{240}z_{1}^{240}z_{2}^{240}. $$

For u=2, the complete weight enumerator of \(\mathcal {C}_{3,2,T}^{\alpha }\) is

$$W_{\mathcal{C}_{3,2,T}^{\alpha}}=z_{0}^{648}+2z_{0}^{162}z_{1}^{243}z_{2}^{243}+24z_{0}^{216}z_{1}^{216}z_{2}^{216}. $$

Both of the two results are consistent with numerical computation by the Magma Computational Algebra System [4].

3.2 The complete weight enumerators of \(\mathcal {C}_{k,u,T}^{\beta }\)

Let \(\hat {\textit {\textbf {G}}}_{k,T}^{\alpha }\) be the matrix that is obtained by replacing v by 1 in the matrix \(v\textit {\textbf {G}}_{k}^{\alpha }\). Similarly, let \(\textit {\textbf {G}}_{k,u,T}^{\beta }\) be the generator matrix of \(\mathcal {C}_{k,u,T}^{\beta }\), that is, \(\textit {\textbf {G}}_{k,u,T}^{\beta }\) is obtained by replacing v by 1 in the matrix \(v\textit {\textbf {G}}_{k,u}^{\beta }\). Let \(\textit {\textbf {G}}_{k,T}^{\beta }(resp.\ \lambda _{k,T},\delta _{k,T})\) denote the matrix which is obtained by replacing v by 1 in the matrix \(v\textit {\textbf {G}}_{k}^{\beta }(v\lambda _{k},v\delta _{k})\). Let \(\textbf {g}_{i}^{\beta } (1\leq i\leq k)\) be the ith row of \(\textit {\textbf {G}}_{k,u,T}^{\beta }\). For these matrices, we give the composition of their rows first.

Proposition 3

For k≥1, we have

$$\begin{array}{@{}rcl@{}} &&\text{comp}((\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{1})=z_{0}^{p^{2k-1}}z_{1}^{p^{2k-1}}{\cdots} z_{p-1}^{p^{2k-1}},\\ &&\text{comp}((\lambda_{k,T})_{1})=z_{0}^{\frac{p^{2k-1}-p^{k}}{p-1}}z_{1}^{2p^{2k-2}}z_{2}^{p^{2k-2}}{\cdots} z_{p-1}^{p^{2k-2}},\\ &&\text{comp}((\delta_{k,T})_{1})=z_{0}^{\frac{p^{2k-1}-p^{k-1}}{p-1}}{\cdots} z_{p-1}^{\frac{p^{2k-1}-p^{k-1}}{p-1}},\\ &&\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{1})=z_{0}^{N_{\textit{\textbf{G}}_{k-1}^{\beta}}+N_{\lambda_{k-1}}}z_{1}^{\frac{p^{2k-1}-p^{k-1}}{p-1}}. \end{array} $$

For 1≤j≤k, we have

$$\begin{array}{@{}rcl@{}} \text{comp}((\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{j})=&(\text{comp}(\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{p^{2j-2}},\\ \text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})=&\text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\alpha})_{1})^{N_{\textit{\textbf{G}}_{j-1}^{\beta}}} \cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\eta_{j}} \\ &\cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\eta_{j}}\cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1}),\\ \text{comp}((\lambda_{k,T})_{j})=&(\text{comp}(\lambda_{k-j+1,T})_{1})^{p^{j-1}}\cdot (\text{comp}(\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{N_{\lambda_{j-1}}},\\ \text{comp}((\delta_{k,T})_{j})=&(\text{comp}(\delta_{k-j+1,T})_{1})^{p^{j-1}}\cdot (\text{comp}(\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{N_{\delta_{j-1}}}. \end{array} $$

Proof

Here, we only give the calculation of the composition of \((\textit {\textbf {G}}_{k,T}^{\beta })_{j}\), as the others are easy to verify. Here, we only give the calculation of the composition of \((\textit {\textbf {G}}_{k,T}^{\beta })_{j}\), as the others are easy to verify.

$$\begin{array}{@{}rcl@{}} &&\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})=\text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1})\cdot \text{comp}((\delta_{k-1,T})_{j-1})\cdot \text{comp}((\lambda_{k-1,T})_{j-1})\cdot \text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{j-1})\\ &=&\text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1})\cdot \text{comp}((\delta_{k-1,T})_{j-1})\cdot \text{comp}((\lambda_{k-1,T})_{j-1})\\ &&\cdot \text{comp}((\hat{\textit{\textbf{G}}}_{k-2,T}^{\alpha})_{j-2})\cdot \text{comp}((\delta_{k-2,T})_{j-2})\cdot \text{comp}((\lambda_{k-2,T})_{j-2})\cdot \text{comp}((\textit{\textbf{G}}_{k-2,T}^{\beta})_{j-2})\\ && \vdots\\ &=&\prod\limits_{i=1}^{j-1}\text{comp}((\hat{\textit{\textbf{G}}}_{k-j+i,T}^{\alpha})_{i})\cdot \prod\limits_{i=1}^{j-1}\text{comp}((\delta_{k-j+i,T})_{i})\cdot{\prod}_{i=1}^{j-1}\text{comp}((\lambda_{k-j+i,T})_{i}) \cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1})\\ &=&\text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{\sum\limits_{t=0}^{j-2}p^{2t}}\cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\sum\limits_{t=0}^{j-2}p^{t}}\cdot \text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{\sum\limits_{l=2}^{j-1}\sum\limits_{t=l-1}^{2l-3}p^{t}}\\ && \cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\sum\limits_{t=0}^{j-2}p^{t}}\cdot \text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{\sum\limits_{l=2}^{j-1}\sum\limits_{t=l-1}^{2l-3}p^{t}} \cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1}).\\ &=&\text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{\sum\limits_{t=0}^{j-2}p^{2t}+2\sum\limits_{l=2}^{j-1}\sum\limits_{t=l-1}^{2l-3}p^{t}}\cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\eta_{j}}\\ && \cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\eta_{j}}\cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1}).\\ &=&\text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{N_{\textit{\textbf{G}}_{j-1}^{\beta}}}\cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\eta_{j}} \cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\eta_{j}}\cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1}). \end{array} $$

In the last equality we use the equation \(\sum \limits _{t=0}^{j-2}p^{2t}+2\sum \limits _{l=2}^{j-1}\sum \limits _{t=l-1}^{2l-3}p^{t}=N_{\textit {\textbf {G}}_{j-1}^{\beta }}\). □

We give the composition of \(\textbf {g}_{j}^{\beta }\), 1≤jk, in the following result.

Proposition 4

For k≥1, 1≤u≤k−1,

$$\text{comp}(\textbf{g}_{1}^{\beta})=z_{0}^{N_{G_{k-1}^{\beta}}-N_{G_{u}^{\beta}}+N_{\lambda_{k-1}}}z_{1}^{N_{G_{k-1}^{\alpha}}+N_{\delta_{k-1}}}.$$

If 2≤j≤k−u,

$$\begin{array}{@{}rcl@{}} \text{comp}(\textbf{g}_{j}^{\beta})&=& z_{0}^{\eta_{k+1}\eta_{k}-N_{\textit{\textbf{G}}_{u}^{\beta}}}z_{1}^{p^{k-j}(\eta_{k+j-1}+\eta_{j}\eta_{k}+p^{k-j}(\eta_{j}+1))}\\ && z_{2}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})+p^{2k-2j}\eta_{2j-1}}{\cdots} z_{p-1}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})+p^{2k-2j}\eta_{2j-1}}, \end{array} $$

and if k−u+1≤j≤k,

$$\begin{array}{@{}rcl@{}} \text{comp}(\textbf{g}_{j}^{\beta})&=& z_{0}^{\eta_{k+1}\eta_{k}-\eta_{u+1}\eta_{u}}z_{1}^{p^{k-j}(\eta_{k+j-1}+\eta_{j}\eta_{k}-\eta_{2u+j-k-1}-\eta_{j-k+u}\eta_{u}+p^{k-j}(\eta_{j}-\eta_{j-k+u}))}\\ && z_{2}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})-\eta_{u}(\eta_{u}-\eta_{k-j+1})+p^{2k-2j}(\eta_{2j-1}-\eta_{2j-2k+2u-1})}\cdots\\ && z_{p-1}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})-\eta_{u}(\eta_{u}-\eta_{k-j+1})+p^{2k-2j}(\eta_{2j-1}-\eta_{2j-2k+2u-1})}. \end{array} $$

Proof

The composition of \(\textbf {g}_{1}^{\beta }\) can be calculated directly from the structure of \(\textit {\textbf {G}}_{k,u,T}^{\beta }\). For 2≤jku,

$$\begin{array}{@{}rcl@{}} &&\text{comp}(\textbf{g}_{j}^{\beta})=\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\\ &=&\text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{N_{\textit{\textbf{G}}_{j-1}^{\beta}}}\cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\eta_{j}} \cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\eta_{j}} \cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1})\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\\ &=&\left( z_{0}^{pN_{\textit{\textbf{G}}_{k-j,T}^{\alpha}}}z_{1}^{pN_{\textit{\textbf{G}}_{k-j,T}^{\alpha}}}{\cdots} z_{p-1}^{pN_{\textit{\textbf{G}}_{k-j,T}^{\alpha}}}\right)^{N_{\textit{\textbf{G}}_{j-1}^{\beta}}}\cdot \left( z_{0}^{N_{\delta_{k-j}}+N_{\textit{\textbf{G}}_{k-j}^{\alpha}}} z_{1}^{N_{\delta_{k-j}}+N_{\textit{\textbf{G}}_{k-j}^{\alpha}}}{\cdots} z_{p-1}^{N_{\delta_{k-j}}+N_{\textit{\textbf{G}}_{k-j}^{\alpha}}} \right)^{\eta_{j}}\\ && \cdot \left( z_{0}^{pN_{\lambda_{k-j}}}z_{1}^{2N_{\textit{\textbf{G}}_{k-j}^{\alpha}}}z_{2}^{N_{\textit{\textbf{G}}_{k-j}^{\alpha}}}{\cdots} z_{p-1}^{N_{\textit{\textbf{G}}_{k-j}^{\alpha}}}\right)^{\eta_{j}}\cdot \left( z_{0}^{N_{\textit{\textbf{G}}_{k-j}^{\beta}}+N_{\lambda_{k-j}}}z_{1}^{N_{\textit{\textbf{G}}_{k-j}^{\alpha}}+N_{\delta_{k-j}}}\right)\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\\ &=& z_{0}^{\eta_{k+1}\eta_{k}-N_{\textit{\textbf{G}}_{u}^{\beta}}}z_{1}^{p^{k-j}(\eta_{k+j-1}+\eta_{j}\eta_{k}+p^{k-j}(\eta_{j}+1))} z_{2}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})+p^{2k-2j}\eta_{2j-1}}\\ && {\cdots} z_{p-1}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})+p^{2k-2j}\eta_{2j-1}}. \end{array} $$

If ku+1≤jk, we can calculate the composition of \(\textbf {g}_{j}^{\beta }\) in the same way, and we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\textbf{g}_{j}^{\beta})&=& \text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})\cdot \left( \text{comp}((G_{u,T}^{\beta})_{j-k+u})\right)^{-1}\\ &=& \text{comp}((\hat{\textit{\textbf{G}}}_{k-j+1,T}^{\alpha})_{1})^{N_{\textit{\textbf{G}}_{j-1}^{\beta}}}\cdot \text{comp}((\delta_{k-j+1,T})_{1})^{\eta_{j}} \cdot \text{comp}((\lambda_{k-j+1,T})_{1})^{\eta_{j}}\\ && \cdot \text{comp}((\textit{\textbf{G}}_{k-j+1,T}^{\beta})_{1})\cdot \left( \text{comp}((G_{u,T}^{\beta})_{j-k+u})\right)^{-1}\\ && \vdots\\ &=& z_{0}^{\eta_{k+1}\eta_{k}-\eta_{u+1}\eta_{u}}z_{1}^{p^{k-j}(\eta_{k+j-1}+\eta_{j}\eta_{k}-\eta_{2u+j-k-1}-\eta_{j-k+u}\eta_{u}+p^{k-j}(\eta_{j}-\eta_{j-k+u}))}\\ && z_{2}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})-\eta_{u}(\eta_{u}-\eta_{k-j+1})+p^{2k-2j}(\eta_{2j-1}-\eta_{2j-2k+2u-1})}\cdots\\ && z_{p-1}^{\eta_{k}(\eta_{k}-\eta_{k-j+1})-\eta_{u}(\eta_{u}-\eta_{k-j+1})+p^{2k-2j}(\eta_{2j-1}-\eta_{2j-2k+2u-1})}. \end{array} $$

For 0≤i,jp−1 and \(\textit {\textbf {v}}\in \mathbb {F}_{p}^{n}\), suppose that the composition of v is \(z_{0}^{t_{0}}z_{1}^{t_{1}}{\cdots } z_{p-1}^{t_{p-1}}\). We define the map \(f_{(i\leftrightarrow j)}\) by \(f_{(i\leftrightarrow j)}(\text {comp}(\textit {\textbf {v}}))=z_{0}^{t_{0}}z_{1}^{t_{1}}{\cdots } z_{i-1}^{t_{i-1}} z_{i}^{t_{j}}z_{i+1}^{t_{i+1}}{\cdots } z_{j-1}^{t_{j-1}}z_{j}^{t_{i}}z_{j+1}^{t_{j+1}}{\cdots } z_{p-1}^{t_{p-1}}\). The map \(f_{(i\leftrightarrow j)}\) exchanges the power of z i and the power of z j in the composition of v. Before we give the complete enumerator of \(\textit {\textbf {G}}_{k,u,T}^{\beta }\), we need the following results.

We first study the composition of ω 1v, where \(\omega _{1}\in \mathbb {F}_{p}^{*}\), v is a row vector of \(\hat {\textit {\textbf {G}}}_{k,T}^{\alpha }(resp.\ \lambda _{k,T}, \delta _{k,T}, \textit {\textbf {G}}_{k,T}^{\beta })\).

Lemma 4

For any 1≤i≤k and \(\omega _{1}\in \mathbb {F}_{p}^{*}\) , we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{i})&=&\text{comp}((\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{i}), \\ \text{comp}(\omega_{1}(\delta_{k,T})_{i}))&=&\text{comp}((\delta_{k,T})_{i}),\\ \text{comp}(\omega_{1}(\lambda_{k,T})_{i}))&=&f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\lambda_{k,T})_{i})),\\ \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i})&=&f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{i})). \end{array} $$

Proof

It is easy to verify that every element of \(\mathbb {F}_{p}\) appears the same number of times in \((\hat {\textit {\textbf {G}}}_{k,T}^{\alpha })_{i}\) and (δ k−1,T ) i . Since τ 1 is a permutation on \(\mathbb {F}_{p}^{*}\), then we have \(\text {comp}(\omega _{1}(\hat {\textit {\textbf {G}}}_{k,T}^{\alpha })_{i})=\text {comp}((\hat {\textit {\textbf {G}}}_{k,T}^{\alpha })_{i})\) and comp(ω 1(δ k−1,T ) i ))=comp((δ k−1,T ) i ).

We prove the other two equalities by induction. Clearly, for k=1 and i=1, \(\text {comp}(\omega _{1}(\lambda _{1,T})_{1})=f_{(1\leftrightarrow \omega _{1})}(\text {comp}((\lambda _{1,T})_{1}))\) holds. Suppose that \(\text {comp}(\omega _{1}(\lambda _{k-1,T})_{i})=f_{(1\leftrightarrow \omega _{1})}(\text {comp}((\lambda _{k-1,T})_{i}))\) for 1≤ik−1. Then, for 1≤ik, we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}(\lambda_{k,T})_{i})&=&\left( \text{comp}(\omega_{1}(\lambda_{k-1,T})_{i-1})\right)^{p}\cdot \left( \text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\right)^{p}\\ &=& \left( f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\lambda_{k-1,T})_{i-1}))\right)^{p}\cdot\left( \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\right)^{p}\\ &=& f_{(1\leftrightarrow \omega_{1})}\left( (\text{comp}((\lambda_{k-1,T})_{i-1}))^{p}\cdot \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})^{p} \right)\\ &=& f_{(1\leftrightarrow \omega_{1})}((\text{comp}((\lambda_{k,T})_{i}))). \end{array} $$

Similarly, we can also prove the last equality by induction. For k = i=1, the result is obvious. Suppose that \(\text {comp}(\omega _{1}(\textit {\textbf {G}}_{k-1,T}^{\beta })_{i}) =f_{(1\leftrightarrow \omega _{1})}(\text {comp}((\textit {\textbf {G}}_{k-1,T}^{\beta })_{i}))\) for 1≤ik−1. Then, for 1≤ik, we have

$$\begin{array}{@{}rcl@{}} &&\text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i})= \left( \text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\right)\cdot \left( \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1})\right)\cdot \left( \text{comp}(\omega_{1}(\delta_{k-1,T})_{i-1})\right)\\ && \cdot \left( \text{comp}(\omega_{1}(\lambda_{k-1,T})_{i-1}) \right)\\ &=& \left( \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\right)\cdot \left( f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1}))\right)\cdot \left( \text{comp}((\delta_{k-1,T})_{i-1})\right)\\ && \cdot \left( f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\lambda_{k-1,T})_{i-1})) \right)\\ &=&f_{(1\leftrightarrow \omega_{1})}\left( \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\cdot \text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1})\cdot \text{comp}((\delta_{k-1,T})_{i-1})\cdot \text{comp}((\lambda_{k-1,T})_{i-1})\right).\\ &=&f_{(1\leftrightarrow \omega_{1})}\left( \text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{i})\right). \end{array} $$

Now, we investigate the composition of the vector which is a linear combination of any two rows in \(\hat {\textit {\textbf {G}}}_{k,T}^{\alpha }(resp.\ \lambda _{k,T}, \delta _{k,T}, \textit {\textbf {G}}_{k,T}^{\beta })\).

Lemma 5

For any 1≤i<j≤k, and \(\omega _{1},\omega _{2}\in \mathbb {F}_{p}^{*}\) , we have

$$ \text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{i}+\omega_{2}(\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{j})=\text{comp}((\hat{\textit{\textbf{G}}}_{k,T}^{\alpha})_{j}), $$
(4)
$$ \text{comp}(\omega_{1}(\delta_{k,T})_{i}+\omega_{2}(\delta_{k,T})_{j})=\text{comp}((\delta_{k,T})_{j}), $$
(5)
$$ \text{comp}(\omega_{1}(\lambda_{k,T})_{i}+\omega_{2}(\lambda_{k,T})_{j})=f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\lambda_{k,T})_{j})), $$
(6)
$$ \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i}+\omega_{2}(\textit{\textbf{G}}_{k,T}^{\beta})_{j})=f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})). $$
(7)

Proof

The Eq. (4) can be proved by the method used in Lemma 3, since \(\hat {\textit {\textbf {G}}}_{k,T}^{\alpha }\) has the similar structure as \(\textit {\textbf {G}}_{k,T}^{\alpha }\). Actually, by Lemma 1, they are equivalent to each other. Hence, the Eq. 4) immediately follows from Lemma 3. Next, we will prove the rest three equations by induction. For k=2,i=1,j=2, it is easy to see that the Eq. (5), (6) and (7) are correct. Assuming that the Eq. (5) is suitable for 1≤i<jk−1. Then, if 1≤i<jk, the composition of ω 1(δ k,T ) i + ω 2(δ k,T ) j is

$$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}(\delta_{k,T})_{i}+\omega_{2}(\delta_{k,T})_{j})&=&(\text{comp}(\omega_{1}(\delta_{k-1,T})_{i-1}+\omega_{2}(\delta_{k-1,T})_{j-1}))^{p} \\ &&\cdot(\text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1}+\omega_{2}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1}))^{p}\\ &=& (\text{comp}(\delta_{k-1,T})_{j-1})^{p}\cdot (\text{comp}(\textit{\textbf{G}}_{k-1,T^{\alpha}})_{j-1})^{p}\\ &=& \text{comp}((\delta_{k,T})_{j}). \end{array} $$

Up to now, we have proved the Eq. (5). Similarly, assuming that the Eq. (6) is correct for 1≤i<jk−1. Then, for 1≤i<jk, we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}(\lambda_{k,T})_{i}+\omega_{2}(\lambda_{k,T})_{j})&=&(\text{comp}(\omega_{1}(\lambda_{k-1,T})_{i-1}+\omega_{2}(\lambda_{k-1,T})_{j-1}))^{p} \\ &&\cdot(\text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1}+\omega_{2}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1}))^{p}\\ &=& (f_{(1\leftrightarrow \omega_{2})}(\text{comp}(\lambda_{k-1,T})_{j-1}))^{p}\cdot (\text{comp}(\textit{\textbf{G}}_{k-1,T^{\alpha}})_{j-1})^{p}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\text{comp}(\lambda_{k-1,T})_{j-1})^{p}\cdot (\text{comp}(\textit{\textbf{G}}_{k-1,T^{\alpha}})_{j-1})^{p}\right)\\ &=& f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\lambda_{k,T})_{j})). \end{array} $$

So, the Eq. (6) is correct. Lastly, for Eq. (7), assuming that it is correct when 1≤i<jk−1, then, if 1≤i<jk, we have

$$\begin{array}{@{}rcl@{}} &&\text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i}+\omega_{2}(\textit{\textbf{G}}_{k,T}^{\beta})_{j})= \text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1}+\omega_{2}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1}) \cdot \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1}\\ &+&\omega_{2}(\textit{\textbf{G}}_{k-1,T}^{\beta})_{j-1}) \cdot \text{comp}(\omega_{1}(\delta_{k-1,T})_{i-1}+\omega_{2}(\delta_{k-1,T})_{j-1})\cdot \text{comp}(\omega_{1}(\lambda_{k-1,T})_{i-1}+\omega_{2}(\lambda_{k-1,T})_{j-1})\\ &=& \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1})\cdot \left( f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{j-1}))\right) \cdot \text{comp}((\delta_{k-1,T})_{j-1})\\ && \cdot \left( f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\lambda_{k-1,T})_{j-1}))\right)\\ &=& f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{j-1})\cdot \text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{j-1})\cdot \text{comp}((\delta_{k-1,T})_{j-1}) \cdot \text{comp}((\lambda_{k-1,T})_{j-1}))\\ &=& f_{(1\leftrightarrow \omega_{2})}(\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{j})). \end{array} $$

Based on the above results, we can give the composition of the linear combination of \(\textbf {g}_{i}^{\beta } \) and \(\textbf {g}_{j}^{\beta } \).

Lemma 6

For any 1≤i<j≤k and \(\omega _{1},\omega _{2}\in \mathbb {F}_{p}^{*}\) , we have \(\text {comp}(\omega _{1}\cdot \textbf {g}_{i}^{\beta })=f_{(1\leftrightarrow \omega _{1})}(\text {comp}(\textbf {g}_{i}^{\beta }))\) and \(\text {comp}(\omega _{1}\textbf {g}_{i}^{\beta }+\omega _{2}\textbf {g}_{j}^{\beta })=f_{(1\leftrightarrow \omega _{2})}(\text {comp}(\textbf {g}_{j}^{\beta }))\).

Proof

When i=1, it is straightforward to show that \(\text {comp}(\omega _{1}\cdot \textbf {g}_{1}^{\beta })=f_{(1\leftrightarrow \omega _{1})} (\text {comp}(\textbf {g}_{1}^{\beta }))\). If 2≤iku, by Lemma 4, then we have

$$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}\cdot \textbf{g}_{i}^{\beta})&=&\text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\cdot \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k-1,u,T}^{\beta})_{i-1})\\ && \cdot \text{comp}(\omega_{1}(\delta_{k-1,T})_{j-1})\cdot \text{comp}(\omega_{1}(\lambda_{k-1,T})_{j-1})\\ &=& \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1}\cdot f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1}))\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\\ &&\cdot \text{comp}((\delta_{k-1,T})_{j-1})\cdot f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\lambda_{k-1,T})_{j-1}))\\ &=& f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{i})\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}})\\ &=& f_{(1\leftrightarrow \omega_{1})}(\text{comp}(\textbf{g}_{i}^{\beta})). \end{array} $$

Similarly, if ku+1≤ik, then we have

$$\begin{array}{@{}rcl@{}} &&\text{comp}(\omega_{1}\cdot \textbf{g}_{i}^{\beta})=\text{comp}(\omega_{1}(\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1})\cdot \text{comp}(\omega_{1}(\textit{\textbf{G}}_{k-1,u,T}^{\beta})_{i-1})\\ && \cdot \text{comp}(\omega_{1}(\delta_{k-1,T})_{j-1})\cdot \text{comp}(\omega_{1}(\lambda_{k-1,T})_{j-1})\\ &=& \text{comp}((\hat{\textit{\textbf{G}}}_{k-1,T}^{\alpha})_{i-1}\cdot f_{(1\leftrightarrow \omega_{1})}\left( \text{comp}((\textit{\textbf{G}}_{k-1,T}^{\beta})_{i-1})\cdot \left( \text{comp}((\textit{\textbf{G}}_{u,T}^{\beta})_{i-k+u})\right)^{-1}\right)\\ &&\cdot \text{comp}((\delta_{k-1,T})_{j-1})\cdot f_{(1\leftrightarrow \omega_{1})}(\text{comp}((\lambda_{k-1,T})_{j-1}))\\ &=& f_{(1\leftrightarrow \omega_{1})}\left( \text{comp}((\textit{\textbf{G}}_{k,T}^{\beta})_{i})\cdot \left( \text{comp}((\textit{\textbf{G}}_{u,T}^{\beta})_{i-k+u})\right)^{-1}\right)\\ &=& f_{(1\leftrightarrow \omega_{1})}(\text{comp}(\textbf{g}_{i}^{\beta})). \end{array} $$

Until now, we have proved the first part of the Lemma. For the second part, there are three cases to be considered.

  1. Case 1:

    1≤iku,2≤jku. In this case, we have

    $$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}\textbf{g}_{i}^{\beta}+\omega_{2}\textbf{g}_{j}^{\beta})&=&\text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i}+\omega_{2}(\textit{\textbf{G}}_{k,T}^{\beta})_{j})\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}} \\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j}\right)\cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j} \cdot z_{0}^{-N_{\textit{\textbf{G}}_{u}^{\beta}}}\right)\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,u,T}^{\beta})_{j} \right)=f_{(1\leftrightarrow \omega_{2})}(\text{comp}(\textbf{g}_{j}^{\beta})). \end{array} $$
  2. Case 2:

    1≤iku, ku+1≤jk. In this case,

    $$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}\textbf{g}_{i}^{\beta}+\omega_{2}\textbf{g}_{j}^{\beta})&=&\text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i}+\omega_{2}(\textit{\textbf{G}}_{k,T}^{\beta})_{j})\cdot \left( \text{comp}(\omega_{2} (\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}) \right)^{-1}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j}\right)\cdot \left( f_{(1\leftrightarrow \omega_{2})}\left( \text{comp}(\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}\right)\right)^{-1}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j} \cdot \left( \text{comp}(\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}\right)^{-1}\right)\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,u,T}^{\beta})_{j} \right)=f_{(1\leftrightarrow \omega_{2})}(\text{comp}(\textbf{g}_{j}^{\beta})). \end{array} $$
  3. Case 3:

    ku+1≤i<jk. In this case,

    $$\begin{array}{@{}rcl@{}} \text{comp}(\omega_{1}\textbf{g}_{i}^{\beta}+\omega_{2}\textbf{g}_{j}^{\beta})&=&\text{comp}(\omega_{1}(\textit{\textbf{G}}_{k,T}^{\beta})_{i}+\omega_{2}(\textit{\textbf{G}}_{k,T}^{\beta})_{j})\\ && \cdot\left( \text{comp}\left( \omega_{1} (\textit{\textbf{G}}_{u,T}^{\beta})_{i-k+u}+\omega_{2} (\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}\right) \right)^{-1}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j}\right)\cdot \left( f_{(1\leftrightarrow \omega_{2})}\left( \text{comp}(\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}\right)\right)^{-1}\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,T}^{\beta})_{j} \cdot \left( \text{comp}(\textit{\textbf{G}}_{u,T}^{\beta})_{j-k+u}\right)^{-1}\right)\\ &=& f_{(1\leftrightarrow \omega_{2})}\left( (\textit{\textbf{G}}_{k,u,T}^{\beta})_{j} \right)=f_{(1\leftrightarrow \omega_{2})}(\text{comp}(\textbf{g}_{j}^{\beta})). \end{array} $$

    The proof is completed.

Now, we can give the complete weight enumerator of \(\mathcal {C}_{k,u,T}^{\beta }\).

Theorem 2

Let 1≤u≤k−1. The complete weight enumerator of the torsion code \(\mathcal {C}_{k,u,T}^{\beta }\) is given by

$$ W_{\mathcal{C}_{k,u,T}^{\beta}}(z_{0},z_{1},\cdots,z_{p-1})=z_{0}^{N_{\textit{\textbf{G}}_{k,u}^{\beta}}}+\sum\limits_{j=1}^{k} p^{j-1}{\Gamma}_{j}, $$
(8)

where \({\Gamma }_{j}=\sum \limits _{i=1}^{p-1}f_{(1\leftrightarrow i)}(\text {comp}(\textbf {g}_{j}^{\beta }))\) and \(\text {comp}(\textbf {g}_{j}^{\beta })\) is the composition in Proposition 4.

Proof

For any \(\textit {\textbf {u}}=(u_{1},u_{2},\cdots ,u_{k})\in \mathbb {F}_{p}^{k}\), let i u = m a x{i: u i ≠0, 1≤ik}. By Lemma 6, we have \(\text {comp}(\textit {\textbf {u}}\cdot \textit {\textbf {G}}_{k,u,T}^{\beta })=f_{(1\leftrightarrow u_{i_{\textit {\textbf {u}}}})}\text {comp}(\textbf {g}_{i_{\textit {\textbf {u}}}}^{\beta })\). So, the number of codewords whose composition equals to \(f_{(1\leftrightarrow \omega _{i})}(\text {comp}(\textbf {g}_{i}^{\beta }))\) is p i−1, where 1≤ω i p−1, 1≤ik. Hence, the complete weight enumerator of \(\mathcal {C}_{k,u,T}^{\beta }\) is

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}_{k,u,T}^{\beta}}(z_{0},z_{1},\cdots,z_{p-1})&=&z_{0}^{N_{\textit{\textbf{G}}_{k,u}^{\beta}}}+\text{comp}(\textbf{g}_{1}^{\beta})+f_{(1\leftrightarrow 2)}(\text{comp}(\textbf{g}_{1}^{\beta}))+ \cdots\\ &&+f_{(1\leftrightarrow p-1)}(\text{comp}(\textbf{g}_{1}^{\beta}))\\ &&+p\left( \text{comp}(\textbf{g}_{2}^{\beta})+f_{(1\leftrightarrow 2)}(\text{comp}(\textbf{g}_{2}^{\beta}))\right.\\ &&\hspace*{23pt}\left.+{\cdots} + f_{(1\leftrightarrow p-1)}(\text{comp}(\textbf{g}_{2}^{\beta}))\right)\\ &&+\cdots+p^{k-1}\left( \text{comp}(\textbf{g}_{k}^{\beta})+f_{(1\leftrightarrow 2)}(\text{comp}(\textbf{g}_{k}^{\beta}))\right.\\ &&\hspace*{23pt}\left.+{\cdots} + f_{(1\leftrightarrow p-1)}(\text{comp}(\textbf{g}_{k}^{\beta})) \right)\\ &=&z_{0}^{N_{\textit{\textbf{G}}_{k,u}^{\beta}}}+\sum\limits_{j=1}^{k} p^{j-1}{\Gamma}_{j} \end{array} $$

where \({\Gamma }_{j}=\sum \limits _{i=1}^{p-1}f_{(1\leftrightarrow i)}(\text {comp}(\textbf {g}_{j}^{\beta }))\). There are together pk compositions of all the p k codewords. We can only give the complete weight enumerator of the code like Eq. (8), since the exact expansion of the \(W_{\mathcal {C}_{k,u,T}^{\beta }}(z_{0},z_{1},\cdots ,z_{p-1})\) is complex. □

Let z 0=1,z 1=⋯ = z p−1 = z in Eq. (8). Then we have \(W_{\mathcal {C}_{k,u,T}^{\beta }}(z_{0},z_{1},\cdots ,z_{p-1}) =W_{\mathcal {C}_{k,u,T}^{\beta }}(z) =1+(p^{k-u}-1)z^{N_{\textit {\textbf {G}}_{k}^{\beta }}-\eta _{k+1}\eta _{k}}+(p^{k}-p^{k-u})z^{(N_{\textit {\textbf {G}}_{k}^{\beta }}-\eta _{k+1}\eta _{k})-(N_{\textit {\textbf {G}}_{u}^{\beta }}-\eta _{u+1}\eta _{u})}\), which is the Hamming weight distribution of \(\mathcal {C}_{k,u,T}^{\beta }\). The result is consistent with that in [23].

Example 2

Let p=3,k=3,u=1. By Theorem 2, we get the complete weight enumerator of \(\mathcal {C}_{3,1,T}^{\beta }\) as follows

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}_{3,1,T}^{\beta}}(z_{0},z_{1},z_{2})&=&z_{0}^{168}+z_{0}^{51}z_{1}^{117}+z_{0}^{51}z_{2}^{117}+3z_{0}^{51}z_{1}^{69}z_{2}^{48}+3z_{0}^{51}z_{1}^{48}z_{2}^{69}\\ &&+9z_{0}^{52}z_{1}^{60}z_{2}^{56}+9z_{0}^{52}z_{1}^{56}z_{2}^{60}. \end{array} $$

For u=2, by Theorem 2, we have the complete weight enumerator of \(\mathcal {C}_{3,2,T}^{\beta }\) as follows

$$\begin{array}{@{}rcl@{}} W_{\mathcal{C}_{3,2,T}^{\beta}}(z_{0},z_{1},z_{2})&=&z_{0}^{153}+z_{0}^{36}z_{1}^{117}+z_{0}^{36}z_{2}^{117}+3z_{0}^{48}z_{1}^{57}z_{2}^{48}+3z_{0}^{48}z_{1}^{48}z_{2}^{57}\\ &&+9z_{0}^{48}z_{1}^{54}z_{2}^{51}+9z_{0}^{48}z_{1}^{51}z_{2}^{54}. \end{array} $$

These results are consistent with numerical computation by the Magma Computational Algebra System [4].

4 Authentication codes from \(\mathcal {C}_{k,u,T}^{\alpha }\) and \(\mathcal {C}_{k,u,T}^{\beta }\)

A systematic authentication code is a four-tuple \((\mathcal {S},\mathcal {T},\mathcal {K},\{E_{k}:\ k\in \mathcal {K}\})\), where \(\mathcal {S}\) is the source state space, \(\mathcal {T}\) is the tag space, \(\mathcal {K}\) is the key space and \(E_{k}:\ \mathcal {S}\rightarrow \mathcal {T}\) is called an encoding rule. We assume that the key space and source state space have a uniform probability distribution. We use P I and P S to denote the maximum success probabilities with respect to the impersonation and substitution attacks. The reader is referred to [8,9,21,22] for more introductions to the authentication code. For the systematic authentication code, there are two lower bounds on P I and P S [21]: \(P_{I}\geq \frac {1}{|\mathcal {T}|}\), and \(P_{S}\geq \frac {1}{|\mathcal {T}|}\). In general, it is required that P I and P S are as small as possible. The systematic authentication code with \(P_{I}=P_{S}= \frac {1}{|\mathcal {T}|}\) is called optimal. It is also desired that \(|\mathcal {K}|\) must be as small as possible when the values P I and P S are fixed. In [9], a generic coding-theory construction of systematic authentication codes is presented as described below.

Let \(\mathcal {C}\) be an [n,k,d] linear code over \(\mathbb {F}_{p}\). We use c i =(c i,1,c i,2,⋯ ,c i,n ) to denote a codeword of \(\mathcal {C}\), 1≤ip k. Define a systematic authentication code as follows

$$ (\mathcal{S},\mathcal{T},\mathcal{K},\{E_{k}:\ k\in \mathcal{K}\})=(\mathbb{Z}_{p^{k}}, \mathbb{F}_{p}, \mathbb{Z}_{n}\times \mathbb{F}_{p}, \{E_{k}:\ k\in \mathcal{K}\}), $$
(9)

where for any \(k=(k_{1},k_{2})\in \mathcal {K}\) and \(s\in \mathcal {S}\), \(E_{k}(s)=c_{s,k_{1}}+k_{2}\).

Lemma 7

[9] For the systematic authentication code of (9), we have

$$P_{I}= \frac{1}{p}\ and\ \ P_{S}=\max\limits_{0\neq \textbf{c}\in\mathcal{C}}\max\limits_{u\in\mathbb{F}_{p}}\frac{N(\textbf{c},u)}{n} $$

where N(c,u) denotes the number of times u occurs in the codeword \(\textbf {c}\) . Futhermore, we have \(|\mathcal {S}|=p^{k}\) , \(|\mathcal {T}|=p\) and \(|\mathcal {K}|=np\).

We use \(\overline {\mathcal {C}}_{k,u,T}^{\beta }\) to denote the code with generator matix \([\textbf {g}_{2}^{\beta },\textbf {g}_{3}^{\beta },\cdots ,\textbf {g}_{k}^{\beta }]^{T}\). Clearly, \(\overline {\mathcal {C}}_{k,u,T}^{\beta }\) is a subcode of \(\mathcal {C}_{k,u,T}^{\beta }\). Now, we consider the parameters of the authentication code constructed by the code \(\mathcal {C}_{k,u,T}^{\alpha }\) and \(\overline {\mathcal {C}}_{k,u,T}^{\beta }\) respectively. By Theorems 1 and 2 and Lemma 7, we have the following results immediately.

Theorem 3

Let \(\mathcal {C}\) be the code \(\mathcal {C}_{k,u,T}^{\alpha }\) , where k≥2, 1≤u≤k−1. Then for the authentication code of (9), we have

$$P_{I}=\frac{1}{p}\ \ and\ \ P_{S}=\frac{1}{p}+\frac{1}{p^{2k-2u+1}-p}. $$

Furthermore, \(|\mathcal {S}|=p^{k}\) , \(|\mathcal {T}|=p\) and \(|\mathcal {K}|=p(p^{2k}-p^{2u})\).

Theorem 4

Let \(\mathcal {C}\) be the code \(\overline {\mathcal {C}}_{k,u,T}^{\beta }\), where k≥2, 1≤u≤k−1. Then for the authentication code of (9), we have

$$P_{I}=\frac{1}{p}\ \ and $$
$$P_{S}= \left\{\begin{array}{ll} \frac{p^{2k-1}+3p^{2k-2}-3p^{k-1}-6p^{2k-3}+3p^{k-2}+2p^{2k-4}}{p^{2k}-2p^{k}-p^{2u}+2p^{u}} & if\ 1\leq u\leq k-2,\\ \frac{1}{p}+\frac{p^{k-1}-2p^{k-2}+1}{p^{k+1}+p^{k}-2p} & if u=k-1. \end{array}\right. $$

Furthermore, \(|\mathcal {S}|=p^{k-1}\) , \(|\mathcal {T}|=p\) and \(|\mathcal {K}|=\frac {p(p^{k}-1)^{2}-p(p^{u}-1)^{2}}{(p-1)^{2}}\).

A systematic authentication code has five parameters. In many cases, it is impossible to compare two classes of authentication codes. It is difficult to say which is better when two authentication codes are not comparable. We will compare our codes in Theorems 3 and 4 with the code of Theorem 3 in [9]. Let p be an odd prime, k=2 and u=1. Then the code of Theorem 3 becomes

$$|\mathcal{S}|=p^{2},\ |\mathcal{T}|=p,\ |\mathcal{K}|=p^{5}-p^{3},\ P_{I}=\frac{1}{p},\ P_{S}=\frac{1}{p}+\frac{1}{p^{3}-p}. $$

If we take m=4, then the code of Theorem 3 in [9] with the following parameters

$$|\mathcal{S}|=p^{4},\ |\mathcal{T}|=p,\ |\mathcal{K}|=\frac{p(p^{5}-1)}{2},\ P_{I}=\frac{1}{p},\ P_{S}=\frac{1}{p}+\frac{p-1}{p(p^{2}+1)}. $$

Similarly, let k=2,u=1. Then the code of Theorem 4 becomes

$$|\mathcal{S}|=p,\ |\mathcal{T}|=p,\ |\mathcal{K}|=p^{3}+2p^{2},\ P_{I}=\frac{1}{p},\ P_{S}=\frac{1}{p}+\frac{1}{p^{2}+2p}. $$

If we take m=3, then the code of Theorem 3 in [9] with the following parameters

$$|\mathcal{S}|=p^{3},\ |\mathcal{T}|=p,\ |\mathcal{K}|=\frac{p(p^{3}-1)}{2},\ P_{I}=\frac{1}{p},\ P_{S}=\frac{1}{p}+\frac{1}{p^{3/2}-1}. $$

In these cases, we can see that both the key space and the P S of our codes are smaller than that in [9]. Unfortunately, our source state space are also smaller than theirs’. However, for the device with very limited storage and power, for example, the wireless sensor network and RFID tag, the source state space may be small. In this case, our authentication codes may be better than that in [9].

Note that the parameters of the authentication codes in Theorems 3 and 4 are new, and both of them are asymptotically optimal if p k is large enough.

5 Conclusions

In this paper, we investigate the complete weight enumerators of the torsion codes of MacDonald codes over the finite non-chain ring \(\mathbb {F}_{p}+v\mathbb {F}_{p}\). These torsion codes are linear codes over the finite field \(\mathbb {F}_{p}\). We calculate the composition of the rows in the generator matrix first. Then, we analysis the composition of the linear combination of these rows. We give the complete weight enumerators without using exponential sums, since these torsion codes have good structures. We believe our method can be used to study other linear codes which have the similar good structures as the torsion codes in this paper. As an application, we employed these linear codes to construct authentication codes with new parameters.