Additive G-Codes over Fq and their Dualities S.T. Doughertya , C. Fernández-Córdobab a Department of Mathematics, University of Scranton b Department of Information and Communications Engineering, Universitat Autònoma de Barcelona Abstract We define additive G-codes over finite fields. We prove that if C is an additive G-code over Fq with duality M then its dual with respect to this duality C M is an additive G-code. We prove that if M and M 0 are two dualities, then C M and 0 C M are equivalent codes. Finally, we study the existence of self-dual codes for a variety of dualities and relate them to formally self-dual and linear self-dual codes. Keywords: additive codes, G-codes, self-dual codes 2000 MSC: 94B25, 94B60 1. Introduction In this paper, we shall consider additive G-codes over finite fields. In [9], linear G-codes over finite Frobenius rings were studied by examining ideals in the corresponding group ring RG. The rank, kernel and self-duality were studied for the particular case of codes in Z4 G in [6]. In [8], [9] and [12], group ring constructions were used to construct self-dual codes over rings and fields. Special attention was given to self-dual codes over the infinite family of rings Rk , with an eye to their image as binary self-dual codes. In [7], group rings with infinite rings were used to study finite codes that were ideals in group rings by examining the projection of ideals in the infinite group ring to finite codes. Here, we expand on these ideas by examining codes which are additive rather than linear and whose alphabet is a finite field. Additive codes have applica- tions in quantum coding and in cryptography and have received a great deal of attention lately. Additive codes were first defined by Delsarte in 1973 in terms of association schemes [3], [4], where the set of points X in the association scheme is endowed with the structure of an abelian group. In general, an additive code, in a translation association scheme, is defined as a subgroup of the underlying abelian group. In classical theory coding, the primary alphabet for codes has been finite fields. On one hand, additive codes over finite fields have become more important recently due to their application to the construction of quantum error-correcting codes given in [2]. On the other hand, in the last years, the used alphabet has been extended to finite Frobenius rings, and also the product Preprint submitted to Elsevier March 17, 2021 of finite Frobenius Rings. In this sense, additive codes over rings have become more rellevant [1],[15]. Additive codes also allow for a variety of dualities to be used (see [10], [11] for example). We shall examine these various dualities, focusing on codes which are equal to their dual under specific dualities. The family of cyclic codes is one of the most widely studied family of codes, firstly over finite fields and later over Frobenius rings. Cyclic codes of length n over R can be seen as ideals in the group ring RCn , where Cn is the cyclic group of order n. As a generalization of cyclic codes the so called additive G-codes are ideals in an arbitrary group ring RG [14], [7], [9]. We begin with the necessary definitions and notations. We denote the finite field of order q = pe , p a prime, by Fq . A code over a finite field Fq of length n is a subset of Fnq . If the code is a subspace then we say that it is a linear code. If it is an additive subgroup of Fnq , then we say that it is an additive code. Any additive code over a field of prime order is necessarily a linear code. However, additive codes need not be linear. For example, the field Fp is a non-trivial additive code of length 1 in Fpe , e > 1, but there are no non-trivial linear codes of length 1 over a field. For any two vectors v = (v; 1, . . . , vn ), w = (w1 , . . . , wn ) ∈ Fnq , define the Hamming distance to be dH (v, w) = |{i | vi 6= wi }|. The Hamming weight of a vector is the number of non-zero coordinates of the vector and corresponds to dH (v, 0), where 0 denotes the all-zero vector. The minimum Hamming weight of a code is the smallest weight of all non-zero vectors and the minimum Hamming distance is the minimum of {dH (v, w) | v, w ∈ C, v 6= w}. For any code C the Hamming weight enumerator is defined as X WC (x, y) = xn−wtH (c) y wtH (c) . c∈C Since the finite field Fq , q = pe , is a vector space over Fp of dimension e, each element of Fq can be written as a0 + a1 ζ + a2 ζ 2 + · · · + ae−1 ζ e−1 , (1) for some ζ. We let Ki be the i dimensional subspace of this vector space formed by letting aj = 0, for j > i − 1 in the representation given in Equation 1. Namely, Ki = {a0 + a1 ζ + a2 ζ 2 + · · · + ae−1 ζ e−1 | aj = 0 if j > i − 1}. (2) Lemma 1.1. Let q = pe , p a prime, and let Ki ⊂ Fq as defined in Equation 2. Then Ki is an additive subgroup of (Fq , +). Proof. Any two elements in Ki are of the form a = a0 +a1 ζ +a2 ζ 2 +· · ·+ai−1 ζ i−1 and b = b0 + b1 ζ + b2 ζ 2 + · · · + bi−1 ζ i−1 . Then a + b = (a0 + b0 ) + (aa + b1 )ζ + (a2 + b2 )ζ 2 + · · · + (ai−1 + bi−1 )ζ i−1 which is in Ki . We note that this does not imply that the corresponding finite field of the same size is a subfield, (in general it is not), but rather that this space is an additive subgroup of the finite field. 2 Let N be a matrix with elements from the finite field Fq . We denote by hN ipiPthe span of N with coefficients from Ki . Namely, if v ∈ hN ipi , then v = αk Nk , where Nk is the k-th row of N and αk ∈ Ki . Denote also by hN i = hN ipe . Let G = {g1 , g2 , . . . , gn } be a finite group of order n. The group algebra Fq G consists of elements of the form: n X αi gi , i=1 αi ∈ Fq , gi ∈ G. Addition in the group algebra is done by coordinate addition, namely n X n X n X αi gi + βi gi = (αi + βi )gi . i=1 i=1 i=1 The product of two elements in a group algebra is given by Xn n X X ( αi gi )( βj gj ) = αi βj gi gj . i=1 j=1 i,j We associate each element in the group algebra with an element in Fnq . Namely, let Θ : Fq G → Fnq be the canonical map that sends ag1 g1 + ag2 g2 + · · · + agn gn to (ag1 , ag2 , . . . , agn ). Note that an additive code in Fnq corresponds via the map Θ to an additive subgroup of Fq G. It is easy to see that a linear code in Fnq corresponds to an ideal in Fq G. We are mainly concerned with additive G-codes, which we define now. Definition 1.2. An additive G-code is a subgroup of Fq G that is invariant under the action of multiplication by elements of G. Note that unlike in the linear case, we are not asserting that the code corre- sponds to an ideal in the group algebra but simply that it is additive and held invariant by the action of the group. We note that given a vector in an additive G-code, multiplication by an element of the group G is necessarily in the code but multiplication by an element of the field may not be in the code. As such, additive G-codes need not be ideals in Fq G. In essence, these codes are a richer class of codes that are in Fnq . Let C be an additive G-code. It follows immediately that if Aut(C) is the group of automorphisms of the code C, where an automorphism is a permutation of the columns of C fixing C, then G is a subgroup of Aut(C). We expand the definition of equivalent codes beyond the definition of auto- morphisms to the following. Definition 1.3. Two additive codes C and C 0 in Fnq are equivalent if |C| = |C 0 | and there exists a permutation of coordinates π, and n permutations ψi on the set of elements of Fq satisfying ψi (0) = 0 for i ∈ {1, . . . , n} such that (ψ1 (cπ(1) ), . . . , ψn (cπ(n) )) ∈ C 0 for all (c1 , . . . , cn ) ∈ C. 3 Example 1.4. Consider the following codes in F34 , where F4 = {0, 1, ω, ω 2 }: C1 ={(0, 0, 0), (0, 1, 1)}, C2 ={(0, 0, 0), (ω, ω, 0)}, C3 ={(0, 0, 0), (1, 0, ω 2 )}. These three codes are equivalent additive codes. The code C2 is obtained from C1 by permuting the first and third coordinates, π = (1, 3) and applying the permutation of elements given by ψ1 = ψ2 = (1, ω) and ψ3 = Id. The code C3 is obtained from C2 by permuting the second and the third coordinate, π = (2, 3), and applying ψ1 = (1, ω), ψ2 = Id and ψ3 = (ω, ω 2 ). Notice that we are not only allowing for multiplication of a coordinate by a constant because these codes are not necessarily linear codes but rather additive codes. We note that each of the three equivalent codes given in Example 1.4 have the same Hamming weight enumerator, namely WC (x, y) = x3 + xy 2 . This fact is true for equivalent codes as it is shown in the following lemma. Lemma 1.5. Let C and C 0 be additive codes in Fnq that are equivalent, then: • The minimum Hamming distance of C and C 0 are the same. • The minimum Hamming weight of C and C 0 are the same. • WC (x, y) = WC 0 (x, y). Proof. It is immediate that permuting the coordinates does not change the Hamming weight of a vector. Then the statement follows from the fact that ψi (0) = 0 for all i ∈ {1, . . . , n}, which gives that applying ψi on a coordinate does not change the Hamming weight of any vector. We now discuss the definitions for codes over a group. The group that is used as an alphabet is not the same as the group G, so we shall denote the alphabet by H. This group will be used to define the duality which gives rise to the orthogonal of codes. In general, throughout this paper, H will refer to the additive group of the finite field of order q. A character of the finite group H is a homomorphism from H to the mul- tiplicative group of the Complex numbers, C∗ . Sometimes, characters are de- scribed as having images in Q/Z, however we shall use the complex version as was done in [10] and [11]. The set of all characters of the group H, denoted by Hb is defined by b = {χ : χ is a character of H}, H and it is a group. This group is isomorphic to H, but not in a canonical manner. The isomorphism that we chose between H and H b gives a character table M . Let {hi } denote the elements of the group and we let φ : H → H b be the isomorphism. We establish the following notation. Let the character χhi be the 4 image of hi under the isomorphism φ, namely χhi = φ(hi ). Index the rows by φ(hi ) and the columns by the elements of the group where the element of the table M corresponding to (χhi , hj ) is χhi (hj ). Example 1.6. Consider the additive group of F5 . Let ξ be a primitive com- plex fifth root of unity. Then the duality that corresponds to the Euclidean inner-product for linear codes is given by χa (b) = ξ ab . This gives the following character table:   1 1 1 1 1  1 ξ ξ2 ξ3 ξ4   2 4  M1 =  1 ξ3 ξ ξ ξ3  .  1 ξ ξ ξ4 ξ2  1 ξ4 ξ3 ξ2 ξ Alternatively, we can take χa (b) = ξ −ab which gives the following character table:   1 1 1 1 1  1 ξ4 ξ3 ξ2 ξ   3 4   1 ξ 2 ξ4 ξ M2 =  ξ2  .  1 ξ ξ ξ ξ3  1 ξ ξ2 ξ3 ξ4 We note that there are four primitive complex roots of unity. The matrix M2 can be thought of as taking a different primitive root. We can form two other dualities in a similar manner. Each character table gives a duality for F5 . Since any additive code over F5 is also linear, each of these dualities coincides with the standard Euclidean duality. We fix an isomorphism φ between H and H b and we consider the characters χhi , hi ∈ H, and the table M related to φ as described above. We shall refer to this isomorphism as a duality of H n , where n is the length of the code, with respect to M or, simply, as the duality M of H. Definition 1.7. Fix a duality M of H, that is, an isomorphism of H and H. b Let C be a code over H. Then, the orthogonal Qi=n of C with respect to this duality is defined as C M = {(h1 , h2 , . . . , hn ) | i=1 χhi (ci ) = 1 for all (c1 , . . . , cn ) ∈ C}. This duality of codes is specific to the fixed duality for the group H. We can get a different dual by changing the duality of the group. Given that (H)b n =H dn , each element of H b n is associated with an element n M n | of H in a canonical way. The code C is associated with the set {χ ∈ H d χ(c) = 1 for all c ∈ C}. The orthogonal code is necessarily additive. We mainly consider only symmetric dualities, namely we want χa (b) = χb (a). This gives that the character table M satisfies M = M T . If a code satisfies C ⊆ C M then the code is said to be self-orthogonal with respect to M . If the code satisfies C = C M , then we say that the code is self- dual with respect to M . If WC (x, y) = WC M (x, y) then the code is said to be formally self-dual with respect to M . Let C be a linear code over Fq with a fixed duality M . We have from [5] and [11] the following results. 5 Lemma 1.8. Le C be a G-code over Fq and let M be a duality of C. Then, • (C M )M = C for symmetric dualities; • |C||C M | = q n ; 1 • cweC M (X) = |C| cweC (M · X), X = (x0 , x1 , . . . , xqe −1 ). We define some dualities over finite fields. Let Fq be a finite field, q = pe , 2πi p a prime. Let ξ be a primitive complex p-th root of unity, ξ = e p . Every element in Fq can be written as a0 + a1 ζ + a2 ζ 2 + · · · + ae−1 ζ e−1 . Then associate to each element a ∈ Fq its vector a in Ke . First, we define the standard Euclidean duality, ME , as (ME )a,b = ξ [a,b] , ai bi , which is the standard inner-product in Fnq . This duality P where [a, b] = corresponds to the standard Euclidean duality for linear codes. By that we mean if C is a linear code then C ME = C ⊥ . 2 The trace function T r : Fpe → Fp is defined to be T r(a) = a + ap + ap + e−1 · · · + ap . It is well known that T r(αa + βb) = αT r(a) + βT r(b), where α and β are in Fp . We can define the duality MT by (MT )a,b = ξ T r(ab) . If e is an even integer and p = 2, then let e = 2k and define an involution k k k r on the finite field as a = a2 . This gives a = (a2 )2 = a2 = a. We can define the duality MT H by (MT H )a,b = ξ T r(ab) . 2πi Finally, let χ(a0 + a1 ζ + a2 ζ 2 + · · · + ae−1 ζ e−1 ) = ξ ae−1 for ξ = e p . Define (Mr )a,b = χ(a · b). Example 1.9. The following are some symmetric dualities obtained for F4 using the ordering 0, 1, ω, ω 2 for the indices in the matrix (see [10]).   1 1 1 1  1 −1 1 −1  ME =   1 1 −1 −1  ,  1 −1 −1 1     1 1 1 1 1 1 1 1  1 1 −1 −1   1 1 −1 −1  M T = Mr =   , MT H =  .  1 −1 −1 1   1 −1 1 −1  1 −1 1 −1 1 −1 −1 1 6 Example 1.10. Consider F9 = F3 [x]/hx2 + 1i. Consider the elements of F9 2πi in the following order {0, 1, 2, x, x + 1, x + 2, 2x, 2x + 1, 2x + 2}, and ξ = e 3 . Then the duality Mr in F9 is given by the following character table:   1 1 1 1 1 1 1 1 1  1 ξ ξ2 1 ξ ξ2 1 ξ ξ2     1 ξ2 ξ 1 ξ2 ξ 1 ξ2 ξ     1 1 1 ξ2 ξ2 ξ2 ξ ξ ξ   2 2 2  Mr =  1 ξ2 ξ ξ 2 1 ξ ξ ξ 1  . 2   1 ξ ξ ξ ξ 1 ξ 1 ξ    1 1 1 ξ ξ ξ ξ2 ξ2 ξ2     1 ξ ξ2 ξ ξ2 1 ξ2 1 ξ  1 ξ2 ξ ξ 1 ξ2 ξ2 ξ 1 We note that the MacWilliams relations for the Hamming weight enumerator are the same for all dualities (see [10] for details). Namely, 1 WC M (x, y) = WC (x + (q − 1)y, x − y) |C| for all dualities M . This follows from the fact that collapsing the first row and any other row gives the matrix   1 q−1 . 1 −1 2. Orthogonals In this section, we consider the properties of the orthogonal code C M for a given duality M . Theorem 2.1. Let C be an additive code in Fnq . Let M and M 0 be two dualities 0 of C. Then C M and C M are equivalent codes. Proof. Let C be an additive code in Fnq and let M and M 0 be two of its duali- ties. Consider the characters χh and χ0h related to M and M 0 , respectively, and take the ordering h0 = 0, h1 , · · · , hqn −1 for the indices in the matrices. Since the character group is isomorphic to the group, any two representations of the character group are isomorphic, see [5] for details. Then there is a group iso- morphism φ : ĜM → ĜM 0 given by φ(χi ) = χ0ψ(i) , with ψ a permutation in the set of elements {h0 = 0, h1 , · · · , hqn −1 } satisfying ψ(0) = 0. By definition, we have that (y1 , . . . , yn ) ∈ C M if and only if Πni=1 χyi (ci ) = 1 for all c = (c1 . . . , cn ) ∈ C M , that is, Πni=1 χ0ψ(yi ) (ci ) = 1 for all c = (c1 . . . , cn ) ∈ 0 C M that is equivalent to (ψ(y1 ), . . . , ψ(yn )) ∈ C M . Therefore, the codes C M 0 and C M are equivalent. 7 Example 2.2. Consider the additive code over F4 C = {(0, 0), (1, 1)}, and the matrices ME , MT and MT H for F4 given in Example 1.9. Then, we obtain the following additive codes: C E = {(0, 0), (1, 1), (ω, ω), (ω 2 , ω 2 ), (1, ω 2 ), (0, ω), (ω, 0), (ω 2 , 1)}, C T = C T H = {(0, 0), (1, 1), (ω, ω), (ω 2 , ω 2 ), (ω, ω 2 ), (ω 2 , ω), (1, 0), (0, 1)}. Each one of the 3 codes can be obtained from another one just applying a per- mutation ψ of the elements of Fq satisfying ψ(0) = 0. CE CT CT H E C Id (1, ω, ω ) (1, ω 2 ) 2 CT Id (ω 2 , ω) CT H Id The Hamming weight enumerator for all of these codes is x2 +2xy+5y 2 . Applying the MacWilliams relations to this weight enumerator we get x2 + y 2 which is the weight enumerator of C. Corollary 2.3. Let C be an additive code in Fnq . Let M and M 0 be two dualities 0 of C. Then dH (C M ) = dH (C M ) and WC M (x, y) = WC M 0 (x, y). Proof. Follows directly from Theorem 2.1 and Lemma 1.5. Classically, one of the most important results about cyclic codes is that the dual of a cyclic code is a cyclic code under the standard Euclidean duality. We now generalize this result, showing that the dual under any orthogonality of a code held invariant by the action of a finite group G is a an additive code held invariant by the action of the group G. Theorem 2.4. Let C be an additive G-code in Fnq , and let M be a symmetric duality on the additive group of Fq . Then C M is an additive G-code in Fnq . Proof. We know that C M is an additive code, so all that remains is to show that C M is held invariant by the action of the group G. Let w = (w1 , w2 , . . . , wn ) ∈ C M , and gj ∈ G. We want to show that z = wgj ∈ C M . By definition, we have that i=n Y χwi (ci ) = 1, ∀c = (c1 , . . . , cn ) ∈ C. i=1 Let d ∈ C and let c = dgj . We have c ∈ C since C is a G-code. Then, we have i=n Y Y χzi (di ) = χwi (ci ) = 1, i=1 which gives that z ∈ C M and so C M is held invariant by the action of the group G, giving that C M is a G-code. It is interesting to note then that if C is an additive G code and M and M 0 0 are two dualities on the additive group of Fq , then C M and C M are equivalent codes and both are G-codes. 8 3. Construction of G-Codes and Quasi-G-Codes Let G = {g1 , g2 , . . . , gn } be a group of order n. Let v = αg1 g1 + αg2 g2 + · · · + αgn gn ∈ Fq G. Define the matrix σ(v) ∈ Mn (Fq ), first given in [13], to be αg−1 g1 αg−1 g2 αg−1 g3 ... αg−1 gn   1 1 1 1  αg−1 g1 αg−1 g2 αg−1 g3 ... αg−1 gn  2 2 2 2 σ(v) =  . (3)   .. .. .. .. ..  . . . . .  αgn−1 g1 αgn−1 g2 αgn−1 g3 ... αgn−1 gn We note that this matrix consists simply of all elements that are formed by the action of an element of G on the element v. We shall use this matrix to generate codes. This matrix is not necessarily a minimal generating set in any sense. For example, if agi = 1 for all gi then the matrix has n repeated rows. But a code generated by this matrix is ensured to be invariant under the action of G. In general, the G-code obtained form the action of G over an element v is defined as C(v) = hσ(v)i. We note that this code is a linear code over Fq and in the notation of this paper C(v) = hσ(v)ipe . We are concerned with the span of this matrix using Ki as coefficients as well to generate additive codes. We shall show in Theorem 3.2, that the Ki span of this matrix is an additive G-code. Lemma 3.1. Let N be any matrix with rows that are elements from Fnq , q = pe , p prime. Then the hN ipi is a subgroup of Fnq . P P Proof. Let vi be the rows ofP N . Let w = αj vj and u = βj vi , where αj , βj ∈ Ki . Then w + u = (αj + βj )vj and αj + βj ∈ Ki . Therefore, the Ki span of N is a subgroup of Fnq . We note that in this theorem all that is required is that the set of coefficients is an additive subgroup of Fq . Namely, other additive subgroups can easily be used to construct codes as well. Let v ∈ Fq G and denote Ai (v) = hσ(v)ipi , the Ki span of σ(v). Theorem 3.2. Let G be a finite group of order n, v ∈ Fq G and M be a duality of Fq . Then Ai (v) is an additive G-code of length n and we have the following chains of additive codes: A1 (v) ⊆ A2 (v) ⊆ · · · ⊆ Ae (v). (4) Ae (v)M ⊆ Ae−1 (v)M ⊆ · · · ⊆ A1 (v)M . (5) Proof. By Lemma 3.1, we know that Ai (v) is an additive code. P Next, we show that it is a G-code. If wj is a row of the matrix σ(v) and z = P αj wj , αj ∈ Fpi then acting by an element g in G on z to get z0 , we have z0 = αj wj0 , where 0 0 wj is formed from wj by the action of g. We notice that wj is another row 9 of σ(v) and so this vector is in Ai (v) giving that Ai (v) is invariant under the action of G and so Ai (v) is a G-code. P The first chain follows from that fact that if z = αj wj , αj ∈ Ki , then since Ki ⊂ Ki+1 we have that z ∈ Ai+1 (v). The second chain follows from the first, noticing that taking the orthogonal reverses the inclusion. The following definition was first given in [9]. The version we give is a direct generalization of this earlier definition as applied to additive codes. It is a generalization of the notion of quasi-cyclic codes. Definition 3.3. Let G be a finite group of order n and A be an alphabet. Let D be a code in Asn where the coordinates can be partitioned into n sets of size s where each set is assigned an element of G. If the code D is held invariant by the action of multiplying the coordinate set marker by every element of G then the code D is called a quasi-group code of index s. Example 3.4. Let G be the dihedral group D4 (which is also the Klein-4 group). Then, using Equation 3, we generate a dihedral additive code by taking the F2 span of   1 0 ω 0  0 1 0 ω   ω 0 1 0 .   0 ω 0 1 This is an additive code with 16 elements. Taking the natural projection to binary elements, we have a binary code generated by   0 1 0 0 1 0 0 0  0 0 0 1 0 0 1 0   1 0 0 0 0 1 0 0 .   0 0 1 0 0 0 0 1 It is easy to see that this code is a quasi-dihedral code of index 2 with dimension 4. Let Π : Ki → Fip be the canonical projection. That is, if a0 + a1 ξ + · · · + 2πi ai−1 ξ i−1 ∈ Ki , for ξ = e p , then Π(a0 + a1 ξ + · · · + ai−1 ξ i−1 ) = (a0 , a1 , . . . , ai−1 ). Theorem 3.5. If C is an additive G-code over Fpe of length n then Π(C) is a linear quasi-G-code of length ne. Proof. The action of the group moves the set of e coordinates corresponding to the projection of an element in Fpe . Moreover it is easy to check that Π is a homomorphism of groups. Then the result follows from the definition of quasi-G-cyclic. 10 Corollary 3.6. Let G be a finite group, v ∈ Fq G and M be a duality of Fq . Then Π(Ai (v)) is a linear quasi-G-code over Fp and we have the following chains of linear codes: Π(A1 (v)) ⊆ Π(A2 (v)) ⊆ · · · ⊆ Π(Ae (v)). (6) Π(Ae (v)M ) ⊆ Π(Ae−1 (v)M ) ⊆ · · · ⊆ Π(A1 (v)M ). (7) Proof. The result follows from Theorem 3.2 and Theorem 3.5. Note that we do not know if the projection of the orthogonal with respect to M is related to the standard orthogonal of Π(Ai (v)) as a code over Fp . Example 3.7. Let G = {1, α, β, γ} be the Klein-4 group. Let v = 1 + 1α + ωβ + ωγ ∈ F4 G and   1 1 ω ω  1 1 ω ω  σ(v) =   ω . ω 1 1  ω ω 1 1 Then A1 (v) is the additive G-code {(0, 0, 0, 0), (1, 1, ω, ω), (ω, ω, 1, 1), (ω 2 , ω 2 , ω 2 , ω 2 )} and A2 (v) is the code with cardinality 16 generated by   1 1 ω ω . 0 0 1 1 The canonical projection over F4 is given by Π(0) = (0, 0), Π(1) = (1, 0), Π(ω) = (0, 1) and Π(ω 2 ) = (1, 1). The linear quasi-Klein-code Π(A1 ) is {(0, 0, 0, 0, 0, 0, 0, 0), (1, 0, 1, 0, 0, 1, 0, 1), (0, 1, 0, 1, 1, 0, 1, 0), (1, 1, 1, 1, 1, 1, 1, 1)}. The linear quasi-Klein-code Π(A2 ) is generated by   1 0 1 0 0 1 0 1  0 1 0 1 1 1 1 1   .  0 0 0 0 1 0 1 0  0 0 0 0 0 1 0 1 Under the duality ME we have A2 (v) = A2 (v)ME . The code A1 (v) has |A1 (v)Me | = 64 and consists of precisely half the vectors in E8 , the even code. 4. Self-Dual Codes Self-dual codes are a widely studied family of codes. The vast majority of this study has been about linear self-dual codes over both fields and rings. We shall study codes that may not be linear, but are still self-dual with respect to some duality. A code C is a self-dual code with respect to the duality M if n C = C M . This implies that |C| = q 2 where n is the length of the code and Fq is the alphabet since |C||C M | = |Fnq |. Additive self-dual codes over fields of even order were studied in [10], here we shall extend some of these ideas and expand on them for any q. 11 Theorem 4.1. Let q = pe . If e is odd then there is no self-dual code of length 1 corresponding to any duality. Proof. If C were a self-dual code of length 1, then |C|2 = q, which gives that e |C| = p 2 which is a contradiction if e is odd. The following lemma has the standard proof, see [5] for example. Lemma 4.2. If C is a self-dual code over Fq of length n with respect to duality M and D is a self-dual code of length m with respect to M then C × D is a self-dual code of length n + m with respect to M . This lemma leads naturally to the following theorem. Theorem 4.3. If C is a self-dual code of length 1 with respect to duality M . Then the n fold product of C is a self-dual code of length n that is a G-code for any group G of order n. Proof. The fact that the code is self-dual follows from Lemma 4.2. Given any permutation of the coordinates the code C remains the same. Therefore, the action of any group fixes C and so the code is a G-code for any group G of order n. Self-dual codes naturally give rise to formally self-dual codes in the next theorem. Theorem 4.4. If C is a self-dual code over a group H with respect to the duality M , then C is a formally self-dual code with respect to M 0 for all dualities M 0 of H. 0 Proof. Since C = C M and C M and C M are equivalent by Theorem 2.1, we have that WC (x, y) = WC M 0 (x, y) and the code is formally self-dual with respect to M 0 by Lemma 1.5. This theorem guarantees that if we have a self-dual code, then we can pro- duce numerous formally self-dual codes by changing the duality. 4.1. Self-dual codes with respect to ME , MT and Mr In [10], the existence of self-dual codes over F2 is proven for any self-duality. Theorem 4.5. [10] There exists a linear self-dual code with respect to a duality M of all even lengths. We want to generalize the previous theorem to Fq considering different du- alities. Theorem 4.6. There exists a linear self-dual code in terms of the usual inner- product of length se over Fp if and only if there exists an additive self-dual code with respect to ME of length s over Fq , q = pe . 12 Proof. We know that Fq = Fp (ζ), where q = pe . For any element a ∈ Fq , let a be its corresponding vector. Namely, if a = a0 +a1 ζ +a2 ζ 2 +· · ·+ae−1 ζ e−1 then a = (a0 , a1 , . . . , ae−1 ). Let C be an additive self-dual Q code of length s over Fq . Then if (c1 , c2 , . . . , cs ), (d1 , d2 , . . . , ds ) ∈ C, we have χci (di ) = 1 which implies [(c1 , c2 , . . . , cs ), (d1 , d2 , . . . , ds )] = 0 in Fp . Let D be the set of length se vectors formed from the elements of C, namely, D = {(c1 , c2 , . . . , cs ) | (c1 , c2 , . . . , cs ) ∈ C}. Then any two vectors (c1 , c2 , . . . , cs ), (d1 , d2 , . . . , ds ) ∈ D are orthogonal, so that D ⊆ D⊥ . We note that the sum of any two vectors in D must again be in D since C is additive and addition of the vectors corresponds to standard s addition in Fq . Since C is self-dual, |C| = q 2 . Moreover, |C| = |D| and this es es gives that |D| = p 2 . Hence, D is a self-orthogonal code with |D||D⊥ | = p 2 ⊥ which gives that D = D . If D is a linear self-dual code over Fp of length se, then let C be the code over Fq formed from D, namely C = {(c1 , c2 , . . . , cs ) | (c1 , c2 , . . . , cs ) ∈ D}. Then, since Q D is self-orthogonal, for any two (c1 , c2 , . . . , cs ), (d1 , d2 , . . . , ds ) ∈ C, we have χci (di ) = ξ 0 = 1. Hence, the code is self-orthogonal. Then by the identical cardinality argument given in the first half of the proof we have C = C ME . Corollary 4.7. Let q = pe , p a prime. • If p = 2 then additive self dual codes over Fq exist with respect to ME for all even lengths if e is odd and for all lengths if e is even. • If p ≡ 1 (mod 4) then additive self-dual codes over Fq exist with respect to ME for all lengths over Fq if e is even and for all even lengths if e is odd. • If p ≡ 3 (mod 4) then additive self-dual codes over Fq exist with respect to ME for all even lengths if e is even and for all lengths congruent to 0 (mod 4) if e is odd. Proof. Follows from Theorem 4.6, Theorem 4.5 and that fact that if p ≡ 1 (mod 4) then self-dual codes exist for all even lengths and if p ≡ 3 (mod 4) then self-dual codes exist for all lengths congruent to 0 (mod 4). Even more can be said about these self-dual codes. If p ≡ 1 (mod 4) and e is even, then there exists an additive self-dual code of length 1 over Fq , q = pe . We know that this code is not linear since there cannot be a linear code of length 1 that is neither the entire field nor just the zero element. Then using Lemma 4.2, we have that there exist additive self-dual codes of all lengths over Fq that are not linear. Example 4.8. Consider the binary self-dual [8, 4, 4] Hamming code with the standard duality. Consider the duality with respect to ME over F2e , e > 1. As an additive self-dual code over F4 as in Theorem 4.6, we get a (4, 16, 3) additive 13 self-dual code. It is generated by ω2   1 0 ω  0  1 ω2 ω .  ω 0 ω2 1  0 ω 1 ω2 As a code over F16 , we get a (2, 16, 2) additive self-dual code. As a code over F256 it is a (1, 16, 1) additive self-dual code. Example 4.9. There is no self-dual code of length 2 over F3 with the standard duality. As such, by Theorem 4.6, there is no self-dual code with respect to ME of length 1 over F9 . However, the code {0, x + 2, 2x + 1} is a self-dual code with respect to Mr of length 1 over F9 . This gives that C and C ME are formally self-dual codes. The corresponding F3 code is {(0, 0), (1, 2), (2, 1)}. Its dual is {(0, 0), (1, 1), (2, 2)}. These codes are formally self-dual as well. Proposition 4.10. Let C be an additive code over Fq . If C is a self-dual code with respect to ME , then C is self-dual with respect to MT . Proof. Let C be an additive code of length s over Fq and consider the character χ related to MT , that is, χa (b) = ξ T r(ab) for a, b ∈Q Fq . For (c1 , c2 , .Q . . , cs ), (d1 , d2 , . . . , ds ) ∈ s s CPwe have [(c1 , c2 , . . .P, cs ), (d1 , d2 , . . . , ds )] = i=1 χci (di ) = i=1 ξ T r(ci di ) = s T r(ci +di ) T r( si=1 ci di ) ξ i=1 =ξ because of the linearity of the trace function. If C is self-dual with respect to ME then, P for (c1 , c2 , . . . , cs ), (d1 , d2 , . . . , ds ) ∈ Ps s C we have i=1 ci di = 0 and, therefore ξ T r( i=1 ci di ) = 1 that implies that C is self-orthogonal with respect to MT . Self-duality follows from the fact that the cardinality condition in both cases is the same, namely that |C|2 = q s . We note however, that this theorem is not biconditional as shown in the next example. Example 4.11. Consider the field of order 9, F9 = F3 [x]/hx2 + 1i as in Ex- ample 1.10. Here we have T r(0) = T r(x) = T r(x2 ) = 0. Now (1 + x)2 = 2x 2 and (2 + 2x)2 = 2x which gives for any of these elements a, ξ T r(a ) = ξ 0 = 1. Namely, these three elements are self-orthogonal. Hence, the code {0, 1 + x, 2 + 2x} is an additive self-dual code of length 1 with respect to MT . Moreover, (2 + x)2 = (1 + 2x)2 = x and so by the same reasoning the code {0, 2 + x, 1 + 2x} is an additive self-dual code of length 1 with respect to MT . These two codes do not correspond to a Euclidean self-dual code given in Proposition 4.10 since there is no self-dual code of length 1 over F9 with respect to ME . Theorem 4.12. Let p be a prime. The additive code Fnp is a self-dual code of length n with respect to MT in Fnp2 . Moreover, it is a G-code for all groups G of order n. Proof. Since the code is the entire space Fnp , it is held invariant by the action of any group of order n. 14 P Given any two vectors v, w ∈ Fp , we have that T r(vi wi ) = 0 since the trace of any element in the ground field is 0. Therefore, this code is self- orthogonal with respect to MT . Then |Fnp | = pn and pn pn = p2n = (p2 )n which is the size of the ambient space. Therefore, the code is self-dual. Example 4.13. Let p be any prime. The code C = Fp is a self-dual code with respect to MT of length 1. Then C = Fp has weight enumerator WC (x, y) = x + (p − 1)y. Applying the MacWilliams relations, we have: 1 WC (x + (p2 − 1)y, x − y) = x + (p − 1)y. p In particular, Theorem 4.12 gives that the code C = Fnp is a cyclic self-dual code with respect to MT . In general, cyclic self-dual codes are found examining algebraic properties of the factors of xn − 1. However, this does not apply to the present situation since the cyclic codes here do not correspond to ideals in the polynomial ring. Theorem 4.14. Let q = pe , p a prime, with e = 2s for some integer s. Let C be the code of length 1 consisting of all elements of Fq with ai = 0 for i > s − 1. Then C is a self-dual code with respect to Mr . Proof. The code C is additive since the sum of any two elements in C which are polynomials in ζ of degree at most s − 1, is a polynomial in ζ of degree at most s − 1. The cardinality of the code C is ps , since there are p choices each for a0 , a1 , . . . , as−1 . This gives |C|2 = (ps )2 = |Fq |. Take the product of any two elements in C. Since both elements are at most of degree s − 1 in ζ, their product is of degree at most 2s − 2 and hence their product has a2s−1 = 0. Then, if a, b ∈ C, we have χa (b) = 1. Therefore, the code C is self-orthogonal and |C|2 = q and so the code is self-dual. Example 4.15. By Theorem 4.14, the code C = Fp is a self-dual code with respect to Mr in Fp2 . Theorem 4.12 gives that C = C MT in this case. This means that in this particular case C Mr = C MT . Corollary 4.16. There exist self-dual codes with respect to Mr for all lengths n that are G-codes for all groups G of order n. Proof. The self-dual codes with respect to duality Mr exist for length n = 1 by Theorem 4.14. Then self-dual codes with respect to Mr exist for any length n by Lemma 4.2 and they are G-codes by Theorem 4.3. For any linear code C over the field Fq , let C ⊥ denote the standard dual, namely C ⊥ = {v | [v, w] = 0, ∀w ∈ C}. We note that the code C ⊥ is a linear code, even when C is not. Theorem 4.17. Let M be either ME , MT or Mr . Then for any linear code C we have 1 cweC ⊥ (X) = cweC (M · X). |C| 15 Specifically, M works for the MacWilliams relations for linear codes over the field. Proof. We know that Fq is a Frobenius ring. Then we know that a generating character on the character module is any character that is non-trivial on the minimal ideal of the ring. Since the ring is a field, this is a trivial statement. Therefore, these dualities are given by a generating character and so either suffice for the MacWilliams relations for linear codes. (See [5] for background details.) This theorem indicates that the MacWilliams relations for linear codes are not unique and that these three different dualities give the MacWilliams rela- tions for linear codes. This means that two different matrices M will always give the complete weight enumerator of C ⊥ from the complete weight enumer- ator of C. This does not, however, mean that they give the same MacWilliams relations for additive codes. This is easily seen in the next example. Example 4.18. Let C = {0, 1} be an additive code over F4 . Considering the dualities ME and MT , we obtain the following dual codes C ME = {0, ω} and C MT = {0, 1}. Note that these two codes have different complete weight enumerators, cweC ME (x0 , x1 , x2 , x3 ) = x0 + x2 and cweC MT (x0 , x1 , x2 , x3 ) = x0 + x1 , but they give cweC = x0 + x1 when applying the MacWilliams relations to each one of the two matrices ME and MT . Of course, both of these dualities give the same MacWilliams relations for the Hamming weight enumerator which coincide in both cases, WC E (x, y) = WC M (x, y) = x + y. In Corollary 4.7, we have shown that there exist numerous additive self-dual codes that are not linear. This result is very important for the following reason. The MacWilliams relations for linear codes over Fq are given by cweC ⊥ (X) = 1 |C| cwe(ME · X) which is the same as the MacWilliams relations for additive codes using ME as the duality. If I is the set of polynomials in q variables that are held invariant by the action of √1q ME , then the possible weight enumerators for both sets of self-dual codes (additive and linear) are the same. Usually, we ask that the codes also have even length for linear codes. Let I 0 be the set of polynomials held invariant by √1q ME and the action of the matrix guaranteeing that the length must be even. Then there exist elements in I 0 that are weight enumerators of additive self-dual codes with respect to ME but not linear self-dual codes with respect to the usual inner-product. For example, consider the self-dual code C of length 1 over Fq , q = pe , e even. The code C ×C has length 2 but has vectors with Hamming weight 1. No vector with Hamming weight 1 can be self-orthogonal over Fq in the usual inner-product so this cannot be the weight enumerator of a self-dual code with respect to the usual inner-product. 4.2. Self-duality in chains of additive G-codes Let G be a finite group of order n, v ∈ Fq G and M be a duality of Fq . Recall the chains of additive G-codes of length n A1 (v) ⊆ A2 (v) ⊆ · · · ⊆ Ae (v) and 16 Ae (v)M ⊆ Ae−1 (v)M ⊆ · · · ⊆ A1 (v)M given in Equations (6) and (7). We begin the study of these chains with a lemma. Lemma 4.19. Let v ∈ Fq G. Then we have |Ai (v)| < |Ai+1 (v)| for 1 ≤ i ≤ e−1. Proof. The code Ai (v) has a minimal generating set of vectors, say {vi | 1 ≤ i ≤ t}. PtThen, given a codeword w ∈ Ai (v), there is a unique way of writing w = i=1 αi vi , for some t ≥ 1. Then, there are precisely pi multiples of w. Pt Namely, βw = β i=1 αi vi . However, there are pi+1 multiples of w in Ai+1 (v). Therefore, the two codes are not equal. Given the containment of Ai (v) in Ai+1 (v), we have that Ai (v) ⊂ Ai+1 (v) which gives the result. In general, we want to look in this chain to find additive self-dual codes. Theorem 4.20. Consider A1 (v) ⊆ A2 (v) ⊆ · · · ⊆ Ae (v) the chain of additive G-codes of length n defined in Equation (6). There is at most one j, 1 ≤ j ≤ e−1 such that Aj (v) is self-dual with respect to M , for any duality M . Proof. By Lemma 4.19, |Ai (v)| < |Ai+1 (v)| for 1 ≤ i ≤ e − 1. Therefore, at most only one code in the chain can satisfy |Aj (v)|2 = q s . Corollary 4.21. Consider Ae (v)M ⊆ Ae−1 (v)M ⊆ · · · ⊆ A1 (v)M the chain of additive G-codes of length n defined in Equation (7). There is at most one j, 1 ≤ j ≤ e − 1 such that Aj (v)M is self-dual with respect to M , for any duality M. Corollary 4.22. Consider A1 (v) ⊆ A2 (v) ⊆ · · · ⊆ Ae (v) the chain of additive G-codes of length n defined in Equation (6). Let j, 1 ≤ i ≤ e − 1, be the possible index for Aj (v) being self-dual code with respect to M . If Aj (v) is not formally self-dual with respect to M , then Aj (v) is not self-dual with respect to any duality M 0 . Proof. From Theorem 4.20, consider the index j, 1 ≤ j ≤ e − 1, such that Aj (v) may be self-dual with respect to M . Assume Aj (v) = AM j (v). Then, if Aj (v) is not formally self-dual with respect to any other M 0 , we get a contradiction by Theorem 4.4. Therefore, for the possible index j in the chain A1 (v) ⊆ A2 (v) ⊆ · · · ⊆ Ae (v) with the proper cardinality, if it is not formally self-dual to Aj (v), for a fixed M , then there is no self-dual code in the chain with respect to any duality. Example 4.23. We illustrate these results with the following three examples. Let K4 = {1, α, β, γ} be the Klein-4 group. Let v be an element in F4 K4 . Then we have A1 (v) ⊂ A2 (v) and A2 (v)M ⊂ A1 (v)M for any duality M . • If v = 1 + 0α + 1β + 0γ then   1 0 1 0  0 1 0 1  σ(v) =   1 . 0 1 0  0 1 0 1 17 Deleting identical rows we have the matrix:   1 0 1 0 . 0 1 0 1 Then the code A1 (v) has 4 elements and cannot be self-dual. The code A2 (v) has cardinality 16 and is self-orthogonal with-respect to ME and MT . Therefore, it is self-dual with respect to both dualities. • If v = 1 + 0α + 0β + 0γ then   1 0 0 0  0 1 0 0  σ(v) =   0 . 0 1 0  0 0 0 1 Then A1 (v) has 16 elements and is self-orthogonal with respect to MT and is therefore a self-dual code with respect to MT . The code A2 (v) is F44 , i.e. the entire space. The code A1 (v) is not self-orthogonal with respect to duality ME and, therefore, in the chain A1 (v) ⊂ A2 (v) there is no self-dual code with respect to ME . • If v = ω 2 + 0α + 0β + 0γ then ω2   0 0 0  0 ω2 0 0  σ(v) =  .  0 0 ω2 0  0 0 0 ω2 Then A1 (v) has 16 elements and is self-orthogonal with respect to ME and is therefore a self-dual code with respect to ME . The code A2 (v) is F44 , i.e. the entire space. The code A1 (v) is not self-orthogonal with respect to duality MT and, therefore, in the chain A1 (v) ⊂ A2 (v) there is no self- dual code with respect to MT . 4.3. Constructions We shall show how self-orthogonal and self-dual codes can be constructed in this setting. In [8], it was shown that if R is a finite commutative Frobenius ring and G is a group of order n, with v an element in RG, satisfying v = v T , n v 2 = 0 and |Cv | = |R| 2 then Cv is a self-dual code. In our setting, the situation is different. Consider the matrix given in Equa- tion 3. It is quite possible that the matrix σ(v) generates a self-orthogonal code over the additive group Ki , but this does not guarantee that the code over Ki+1 is also going to be self-orthogonal. As a trivial example, consider the code of length 1 over F4 generated by (1). Using the duality MT , this code is a self-dual code over the additive group K1 = F2 . However, over F4 , this code is the en- tire ambient space which is obviously not self-orthogonal. This simple example, however, leads to an important computational technique. 18 In the search for self-dual codes using the matrix σ(v). It happens quite often that the dimension of hσ(v)i is greater than n2 which prohibits the matrix from generating a self-dual code that is invariant under the action of G. However, it is possible that hσ(v)ipi may be a self-dual code for a given duality M as we describe in the next theorem. Theorem 4.24. Let v ∈ Fpe G for some finite group G. Assume that dimhσ(v)i = d > n2 . If s = en 2d is an integer and hσ(v)ip is self-orthogonal with respect to s duality M , then the code C generated by the d linearly independent vectors of σ(v) over the additive group Ks is a self-dual code with respect to M that is held invariant by the action of the group G. Proof. If the d vectors are linearly independent over Fpe then they are indepen- dent over the additive group Ks . The size of the code they generate over Ks en en is (ps )d = (p 2d )d = p 2 . Then since the code is self-orthogonal with respect to M , the code is self-dual. 5. Conclusion Previous work about G-codes considered only linear codes over the finite field Fq (see [8], [9] for example.) Additive self-dual codes are defined over the field F2 as in [10]. In this paper, we have expanded both notions to consider additive self- dual G-codes over any finite field. We have discussed several dualities attached to these codes and we have examined the properties of these duals. We have found examples of additive self-dual codes of length 1 and have used this to show that additive self-dual codes exist for all lengths in certain cases. Acknowledgements This work has been partially supported by the Spanish MINECO under Grant PID2019-104664GB-I00 (AEI/FEDER, UE). The first author is grateful to the Universitat Autònoma de Barcelona where he stayed while this paper was written. References [1] J. Bierbrauer, The theory of cyclic codes and a generalization to additive codes, Designs, Codes and Cryptography, vol. 25, pp. 189-206, 2002. [2] A.R. Calderbank, E.M. Rains, P.M.Shor, N.J.A. Sloane, Quantum error correction via codes over GF(4), IEEE Trans. Inform. Theory, vol. 44, pp. 1369-1387, 1998. [3] P. Delsarte, “An algebraic approach to the association schemes of coding theory”, Philips Research Rep. Suppl., vol. 10, vi+97, 1973. 19 [4] P. Delsarte, V. Levenshtein, “Asociation Schemes and Coding Theory”, IEEE Trans. Inform. Theory, vol. 44(6), pp. 2477-2504, 1998. [5] S.T. Dougherty, Algebraic Coding Theory over Finite Commutative Rings, Springer Briefs in Mathematics. Springer, 2017. [6] S.T. Dougherty, C. Fernandez-Cordoba, R. Ten and B. Yildiz, Quaternary Group Rings: Ranks, Kernels and Self-Dual Codes, Advances in Mathemat- ics of Communications, vol. 14(2), pp. 319-332, 2020. [7] S.T. Dougherty, J. Gildea, A. Korban, G-codes over Formal Power Series Rings and Finite Chain Rings, in submission. [8] S.T. Dougherty, J. Gildea, A. Korban, A. Kaya, A. Tylyshchak, B. Yildiz, Bordered constructions of self-dual codes from group rings and new extremal binary self-dual codes., Finite Fields Appl., vol. 57, pp. 108-127, 2019. [9] S.T. Dougherty, J. Gildea, R. Taylor and A. Tylshchak, Group Rings, G- Codes and Constructions Of Self-Dual and Formally Self-Dual Codes, De- signs, Codes and Cryptography, vol. 86(9), pp. 2115-2138, 2018. [10] S. T. Dougherty, J.-L. Kim, and N. Lee, Additive self-dual codes over fields of even order, Bulletin of the Korean Mathematical Society, vol. 55(2), pp. 341-357, 2018. [11] S.T. Dougherty, S. Meyers, Orthogonality from Group Characters, in sub- mission. [12] J. Gildea, A. Kaya, R. Taylor, B. Yildiz, Constructions for self-dual codes induced from group rings. Finite Fields Appl., vol. 51, pp. 71-92, 2018. [13] T. Hurley, Group Rings and Rings of Matrices, Int. Jour. Pure and Appl. Math, vol. 31(3), pp. 319-335, 2006. [14] F.J. MacWilliams, Binary codes which are ideals in the group algebra of an Abelian group Bell System Tech. J., vol. 49, pp. 987-1011, 1970. [15] S. Mahmoudi, K. Samei, Additive codes over Galois rings. Finite Fields Appl., vol. 56, pp. 332-350, 2019. 20