New Criteria for MRD and Gabidulin Codes and some Rank-Metric Code Constructions

In this work we present a new criterion to check if a given rank-metric code is a maximum rank distance (MRD) code. Moreover, we derive a criterion to check if a given MRD code is a generalized Gabidulin code. We then use these results to come up with constructions of linear MRD codes of dimension 2 that are not generalized Gabidulin codes.


Introduction
Codes in the rank metric have been studied for the last four decades.For linear codes a Singleton-type bound can be derived for these codes.In analogy to MDS codes in the Hamming metric, we call rank-metric codes that achieve the Singleton-type bound MRD (maximum rank distance) codes.Since the works of Delsarte [4] and Gabidulin [5] we know that linear MRD codes exist for any set of parameters.The codes they describe are called Gabidulin codes.
Moreover, Berger in [1] and Morrison in [12] showed what the linear and semi-linear isometries of rank-metric codes are.It is an open question if there are other general constructions of MRD codes that are not equivalent (under the isometries) to Gabidulin codes.Recently several results have been established in this direction, e.g. in [2,3,13], where many of the derived codes are not linear over the underlying field but only linear over some subfield of it.Hence it is still an open question to find other constructions of non-Gabidulin MRD codes.
In this paper we want to derive criteria for MRD and Gabidulin codes and use these to come up with new non-Gabidulin MRD codes that are linear over the original field, not only a subfield.Moreover, we want to give a classification of these codes and investigate how many different equivalence classes of MRD codes we get for small parameters.
This paper is structured as follows.In Section 2 we give some preliminaries on finite fields, rank-metric codes and Gabidulin codes.In Section 3 we present a new criterion for MRD codes, in Section 4 we derive a criterion for Gabidulin codes.In Section 5 we use the results of Sections 3 and 4 to find new non-Gabidulin MRD codes for small parameters.We conclude in Section 6.

Preliminaries
Let q be a prime power and let F q denote the finite field with q elements.It is well-known that there always exists a primitive element α of the extension field F q m , such that F q m ∼ = F q [α].Moreover, F q m is isomorphic (as a vector space over F q ) to the vector space F m q .One then easily obtains the isomorphic description of matrices over the base field F q as vectors over the extension field, i.e.F m×n q ∼ = F n q m .Since we will work with matrices over different underlying fields, we denote the rank of a matrix X over F q by rank q (X).
Definition 2.1.The rank distance d R on F m×n q is defined by Analogously, we define the rank distance between two elements x, y ∈ F n q m as the rank of the difference of the respective matrix representations in F m×n q .
In this paper we will focus on F q m -linear rank-metric codes in F n q m , i.e. those codes that form a vector space over F q m .Whenever we talk about linear codes in this work, we will mean linearity over the extension field F q m .The well-known Singleton bound for codes in the Hamming metric implies also an upper bound for codes in the rank metric: q m be a linear matrix code with minimum rank distance d of dimension k (over F q m ).Then Definition 2.3.A code attaining the Singleton bound is called a maximum rank distance (MRD) code.
For some vector (v 1 , . . ., v n ) ∈ F n q m we denote the k × n Moore matrix by , where [i] := q i .Definition 2.4.Let g 1 , . . ., g n ∈ F q m be linearly independent over F q .We define a Gabidulin code C ⊆ F n q m of dimension k as the linear block code with generator matrix M k (g 1 , . . ., g n ).Using the isomorphic matrix representation we can interpret C as a matrix code in F m×n q .Theorem 2.5.[5, Section4] A Gabidulin code C ⊆ F n q m of dimension k over F q m has minimum rank distance n − k + 1.Thus Gabidulin codes are MRD codes.
The dual code of a code C ⊆ F n q m is defined in the usual way as In his seminal paper Gabidulin showed the following two results on dual codes of MRD codes: Proposition 2.6.[5, Sections 2 and 4] Note that the second result in Proposition 2.6 was not stated like this in [5]; Gabidulin showed however that the parity check matrix of a Gabidulin code is of the form described in Definition 2.4, which implies the statement.For more information on bounds and constructions of rank-metric codes the interested reader is referred to [5].
The results of Gabidulin (and Delsarte) were later on generalized by Kshevetskiy and Gabidulin in [9] as follows.
Definition 2.7.Let g 1 , . . ., g n ∈ F q m be linearly independent over F q and s ∈ N such that gcd(s, m) = 1.We define a generalized Gabidulin code C ⊆ F n q m as the linear block code with generator matrix of dimension k over F q m has minimum rank distance n − k + 1.Thus generalized Gabidulin codes are MRD codes.
Similarly to the non-generalized case, Kshevetskiy and Gabidulin also showed the following.Proposition 2.9.[9, Subsection IV.C] Let C ⊆ F n q m be a generalized Gabidulin code of dimension k.Then the dual code C ⊥ ⊆ F n q m is a generalized Gabidulin code of dimension n − k.
Denote by Gal(F q m /F q ) the Galois group of F q m , i.e. the automorphisms of F q m that fix the base field F q .It is well-known that Gal(F q m /F q ) is generated by the Frobenius map, which takes an element to its q-th power.Hence the automorphisms are of the form x → x [i] for some 0 ≤ i ≤ m.We will denote the respective inverse map, i.e. the [i]-th root, by x → x [−i] .
The (semi-)linear rank isometries on F n q m are induced by the isometries on F m×n q and are hence well-known, see e.g.[1,12,14]: Lemma 2.10.[12, Proposition 2] The semilinear F q -rank isometries on F n q m are of the form In particular, if C ⊆ F n q m is a linear code with minimum rank distance d, then C ′ = σ(λC)A is a linear code with minimum rank distance d.
We denote by GL n (q) := {A ∈ F n×n q | rank(A) = n} the general linear group of degree n over F q .One can easily check that F q -linearly independent elements in F q m remain F q -linearly independent under the actions of F * q m , GL n (q) and Gal(F q m /F q ).Moreover, the Moore matrix structure is preserved under these actions, which implies that the class of Gabidulin codes is closed under the semilinear isometries.
In this work we want to classify MRD codes and which of them are generalized Gabidulin codes.For this we will derive some criteria for both the MRD and the Gabidulin property.The following criterion for MRD codes was already given in [5]: be a parity check matrix of a rankmetric code C ⊆ F n q m .Then C is an MRD code if and only if This criterion is formulated with respect to the parity check matrix of a linear code.We can easily derive a criterion for the generator matrix of MRD codes from this: Corollary 2.12.Let G ∈ F k×n q m be a generator matrix of a rank-metric code C ⊆ F n q m .Then C is an MRD code if and only if Proof.The generator matrix G of C is a parity check matrix of the dual code Throughout the paper I k denotes the identity matrix of size k.Furthermore, v 1 , . . ., v n q denotes the F q -vector space generated by v 1 , . . ., v n .

New Criterion for MRD Codes
In this section we give a new criterion to check if a given generator matrix G generates an MRD code.The criterion is stated in Theorem 3.2.Before we can state the main theorem we need the following lemma.
. Then det(V G T ) is the maximal minor of G involving the first k columns.By Corollary 2.12 this minor is non-zero.Similarly we can create all other maximal minors of G by multiplication with some V ∈ F k×n q on the left, which implies, by Corollary 2.12, the statement.
We can now state the new MRD criterion: q m be a generator matrix of a rank-metric code C ⊆ F n q m .Then C is an MRD code if an only if for any A ∈ GL n (q), every maximal minor of GA is non-zero.
Proof.We first prove the only if direction.For this let C be MRD.Then we know from Lemma 2.10 that all elements on the orbit of C under GL n (q) are MRD.Since GL n (q) acts on the columns of any generator matrix of C, together with Lemma 3.1, we get that all maximal minors of any orbit element must be non-zero.
For the other direction, let C be non-MRD, i.e. there exists a non-zero codeword c ∈ C of rank at most n − k.Then there exists A ∈ GL n (q) s.t.
This in turn implies that there exists a generator matrix of CA with cA as a row.Thus the first maximal minor of this generator matrix will be zero.
We can slightly simplify this criterion as follows.For this denote by UT * n (q) the subgroup of GL n (q) of upper triangular matrices with an all-1 diagonal.
q m be a generator matrix of a rank-metric code C ⊆ F n q m .Then C is an MRD code if and only if for any A ∈ UT * n (q) every maximal minor of GA is non-zero.
Proof.Note that UT * n (q), together with the diagonal matrices and the permutation matrices in GL n (q) generate the whole general linear group GL n (q).The action of the diagonal matrices multiplies the maximal minors of the generator matrix by a non-zero scalar, the action of the permutation matrices at most changes the sign of the maximal minors.Hence, these two subgroups do not change the non-zero-ness of the maximal minors.

New Criterion for Gabidulin Codes
In this section we derive a new criterion to establish if a given MRD code is a generalized Gabidulin code or not.The main result is stated in Theorem 4.8.
Let C ⊆ F n q m be a linear MRD code of dimension k (i.e.rank distance d = n − k + 1) with generator matrix G. Recall the notation [i] := q i .We apply the Frobenius on vectors and matrices coordinate-wise, i.e., for G ∈ F k×n q m we have jk ) j,k and for C ⊆ F n q m we have C [i] = {c [i] | c ∈ C}.In this section we let s ∈ N, s < m be such that gcd(s, m) = 1.
Proof.We have that It is well-known that the roots of x q − x are exactly the elements of F q (see e.g.[10, Theorem 2.5]).For our main results we need a generalization of this result: Lemma 4.2.If gcd(s, m) = 1, then the roots in F q m of x [s] − x are exactly the elements of F q .
Proof.Consider the field F q ms , then both F q m and F q s are subfields of it [10,Theorem 2.6].Since m and s are coprime these two subfields only intersect in the base field F q .Moreover, the roots of x [s] − x in F q ms are exactly the elements of F q s , hence the roots of it in F q m are the elements of q m be of rank r over F q .Then v, v [s] , . . ., v [s(r−1)] are linearly independent over F q m .Proof.Assume that v, v [s] , . . ., v [s(r−1)] are not linearly independent over F q m , i.e. there exist λ 0 , . . ., λ r−1 ∈ F q m , at least one λ i = 0, such that is linearized, all elements of the vector space v 1 , . . ., v n q s are roots of it.Since v 1 , . . ., v n q has dimension r, by [9, Lemma 4.3], also v 1 , . . ., v n q s has dimension r.Hence, there are q rs roots of p(x) in F q ms .Hence p(x) must have degree at least q rs , which is a contradiction.
The following straight-forward lemma is needed to prove Lemma 4.5.
Lemma 4.4.Let w 1 , . . ., w k ∈ F n q m be linearly independent over F q m .Then w k ∈ F n q m are also linearly independent over F q m Proof.Assume that w k are not linearly independent, i.e. there exist λ 1 , . . ., λ k ∈ F q m with k i=1 Thus the vectors w 1 , . . ., w k are not linearly independent over F q m , which is a contradiction.
The following result is a generalization of [7, Theorem 1].
Then W has a generator matrix in F k×n q .In particular W contains elements of rank 1 over F q .
Proof.If {w 1 , . . ., w k } ⊂ F n q m is a basis for W, then by Lemma 4.4 {w .
Since the rightmost matrix has rank k, there exists a set of k linearly independent (over F q m ) columns.Without loss of generality, we can assume that the first k columns are linearly independent.Thus the submatrix W 1 := (w i,j ) k i,j=1 is invertible (and therefore W [s] 1 is also invertible by Lemma 4.4), and so we can solve If we apply the Frobenius map s times on both sides and use Lemma 4.1, we obtain Then, we have Since W [2s] 1 is invertible, we obtain and therefore we must have that W −1 1 W 2 has only entries in F q , by Lemma 4.2.Therefore, a generator matrix for W can be expressed as , whose rows have rank weight 1 over F q .
We can now state and prove the central ingredient for the main result in Theorem 4.8: Proposition 4.6.Suppose that C ⊂ F n q m is a linear code of dimension k ≥ 2 and minimum rank distance at least k.If dim(C ∩ C [s] ) = k − 1 (this automatically implies that k < n), then there exists a generator matrix for C of the form Proof.We prove this inductively on k.First assume that k = 2. Then dim(C ∩ C [s] ) = 1, i.e. there exists g ′ ∈ C such that C ∩ C [s] = g ′ q m .Since g ′ ∈ C [s] , we get that g ′ [−s] ∈ C. The minimum rank distance of C is at least k = 2, i.e. the rank of g ′ [−s] over F q is at least 2.Then, by Lemma 4.3, g ′ [−s] and g ′ are linearly independent.Hence they form a basis of C and we can rename g := g ′ [−s] to write a generator matrix G * = g g [s] .
We now explain the induction step , then we know from Lemma 4.5 that W [s] = W, because the minimum rank distance of C is at least k.Since W, W [s] ⊂ C [s] , both with codimension 1, we get W, W [s]  q m = C [s] .Then Furthermore, since W ⊂ C, the minimum rank distance of W is at least k.Therefore, W satisfies the conditions of the induction hypothesis, and so we can express W in terms of some basis of the form Hence, {w, w [s] , . . ., w [s(k−2)] } ∈ C and thus {w [s] , w [2s] , . . ., w [s(k−1)] } ∈ C [s] .On the other hand, w ∈ W ⊂ C [s] , i.e. {w, w [s] , . . ., w [s(k−1)] } ∈ C [s] .By Lemma 4.3 this set is linearly independent, i.e. it is a basis of C [s] .This in turn implies that {w [−s] , w, w [s] , . . ., w [s(k−2)] } is a basis of C. Define g = w [−s] , then {g, g [s] , . . ., g [s(k−1)] } is a basis of C.
Lemma 4.7.Let C be a linear MRD code of dimension k < n with generator matrix Then g 1 , . . ., g n are linearly independent over F q .

[j]
n q for any j ∈ N. Hence there exists A ∈ GL n (q) such that the first column of G * A is zero.It follows from Theorem 3.2 that C is not a MRD code, which is a contradiction.Proof.Let C be a generalized Gabidulin code of dimension k with generalization parameter s.Then it follows from the structure of the generator matrix of C that dim(C ∩ C [s] ) = k − 1, which proves the first direction.
For the other direction we distinguish two cases: If k ≤ (n + 1)/2, then the minimum distance of C is at least k.Then it follows from Proposition 4.6 that C has a generator matrix of the form It follows from Lemma 4.7 that the g i are linearly independent over F q .This is the definition of a generalized Gabidulin code.
If k > (n + 1)/2, then it follows from Proposition 2.6 that the dual code C ⊥ ⊆ F n q m has dimension n − k and minimum distance k + 1 > n − k, i.e. we can use Proposition 4.6 and Lemma 4.7 as before to show that C ⊥ is a generalized Gabidulin code.Since the dual of a generalized Gabidulin code is again a generalized Gabidulin code (see Proposition 2.9), the statement follows.

General results
In this subsection we want to state some general results on the non-existence of non-Gabidulin MRD codes, i.e. for which parameters all MRD codes actually are Gabidulin codes.Proof.Let C ⊆ F n q m be an MRD code of dimension 1.Then the minimum rank distance is n and it can be generated by one vector in F n q m .Clearly this vector needs to have only entries that are linearly independent over F q , thus it is a Gabidulin code.
Since the dual of a Gabidulin code is again a Gabidulin code (see Proposition 2.6), the statement for codes of dimension n − 1 follows.
Then the following statement easily follows.
The following observation is helpful for further investigations: Moreover, all entries of * are from F q m \F q .
Proof.The first statement is a direct consequence of Lemma 3.1 The second statement follows from the minimum rank distance n − k + 1 of the code, because every codeword needs to have at least n−k entries from F q m \F q .
In the first case not covered by Theorem 5.1, i.e. for length n = 4 and dimension k = 2, we can get the following statement.The same observation is mentioned as a computational result in [13, Section V].
needs to have only non-zero maximal minors for u 1 , . . ., u 6 ∈ F 2 .Thus we get the following inequations: Clearly the first inequation is always true; the same for the second, since If G does not generate a Gabidulin code then, by Theorem 4.8, rank Since a, b, c, d ∈ F 2 the rank of the above matrix is at least 3. Thus we need that the rank is equal to 4, which is equivalent to Thus, overall, we need to check that there is no solution to the system of inequations With the help of a computer program one can check that there exists no solution for a, b, c, d ∈ F 2 4 \F 2 for the above system of inequations, for any representation of the extension field.
The previous results show that the first set of parameters for which we can hope to construct non-Gabidulin MRD codes is n = 4, k = 2 and q ≥ 3.This is what we will do in the following subsection.

Constructions of length 4 and dimension 2
In this subsection we use the results of the previous sections to derive some linear MRD codes that are not generalized Gabidulin codes.The codes that we derive in this subsection have length 4 and dimension 2.
Theorem 5.5.Let m > 4, α ∈ F q m primitive such that F * q m = α and γ ∈ F q be a quadratic non-residue in F q such that γ = (α [s] + α) 2 for any 0 < s < m with gcd(s, m) = 1.Then is a generator matrix of an MRD code C ⊆ F 4 q m of dimension k = 2 that is not a generalized Gabidulin code.
Proof.First we prove that C is MRD.For this we use Corollary 3.3.Note that We need to show that all maximal minors of this matrix are non-zero for any values of u 1 , . . ., u 6 : One can easily see that the first four inequations are always true, since all u i are in F q .We can rewrite the fifth inequation as If the last term is zero then u 1 = u −1 6 .But then u 1 γ − u 6 = u −1 6 (γ − u 2 6 ) = 0 because γ is a quadratic non-residue.Thus, in this case, the middle term of the above sum does not vanish, i.e. the inequation is always true.Lastly we can rewrite the sixth inequation as This is always true, since the minimal polynomial of α has degree m > 4 and u 1 , . . ., u 6 , γ ∈ F q , i.e. nothing can cancel out the α 4 -term.
It remains to prove that C is not a generalized Gabidulin code.For this we use Theorem 4.8 and compute for any s with gcd(s, m) = 1.Since α ∈ F q this rank cannot be equal to 2, by Lemma 4.2.Hence, C is Gabidulin if and only if the determinant of the lower right submatrix from above is zero, i.e. if and only if This is a contradiction to the conditions on γ, which implies that C is non-Gabidulin.
Note that in the previous theorem γ ∈ F q can in particular be chosen as a quadratic non-residue in the extension field F q m .Example 5.6.Let q = 3, m = 5 and α a root of x 5 + 2x 2 + x + 1.Then γ = 2 is a non-quadratic residue in F 3 5 and the code with generator matrix is an MRD but not a generalized Gabidulin code.
Although we proved Theorem 5.5 for m > 4 we can find analog constructions for m = 4, as shown in the following examples.The proof that these examples are also non-Gabidulin MRD codes is analogous to the one of Theorem 5.5, but when checking if the maximal minor of GUT * n (q) involving the third and fourth column is non-zero we cannot use the argument that the minimal polynomial m(x) of α has degree at least 4. Instead we need to write α 4 modulo m(x) and show that the minor is non-zero.
Example 5.7.Let q = 3, m = 4 and α a root of x 4 −x 3 −1.Then γ = 2 is a quadratic non-residue in F 3 and it fulfills the conditions that γ = (α [s] + α) 2 for any 0 < s < m with gcd(s, m) = 1.Now the code with generator matrix is an MRD but not a generalized Gabidulin code.To show that it is an MRD code we need to prove that the before mentioned minor is non-zero, i.e. that Proof.First we prove that C is MRD.For this we use Corollary 3.3.Note that We need to show that all maximal minors of this matrix are non-zero for any values of u 1 , . . ., u 10 .Analogously to the proof of Theorem 5.5, one can easily see that the minors involving the first column are non-zero.The same holds for the minor involving the second and third column.The following equations remain: The α 2 -term only vanishes if u 1 u 8 = 1, but then the α-term (and the α 4term) do not vanish.Hence, this inequation is always true.Inequation (2) has an α 3 -term that never vanishes, thus it is also true.Similarly, Inequation (3) has an α 5 -term that never vanishes, and Inequation (7) has an α 7 -term, that never vanishes.These two inequations are therefore also true.We can rewrite Inequation (4) as (u 2 u 7 − u 4 u 5 ) + (u 2 γ + u 7 − u 5 u 9 )α + (u 2 u 9 + γ − u 5 u 10 − u 4 )α 2 − u 5 α 3

Conclusion
In this work we give a new criterion to check if a given matrix generates a linear MRD code.Moreover, we derive a criterion to check if a given generator matrix belongs to a linear generalized Gabidulin code or not.
Although the criterion itself is quite simple, the proof of it involves several, to our knowledge new, technical lemmas on the Frobenius map, as well as the F q -rank and linear independence of elements in F q m .We then use these results to construct linear MRD codes that are not generalized Gabidulin codes.Since the class of Gabidulin codes is closed under the semilinear isometries (also called equivalencies by some authors) this means that these codes are also not semilinearly isometric (or equivalent) to generalized Gabidulin codes.
In future work we want to use these criteria to find more general constructions for non-Gabidulin MRD codes.Moreover, we would like to classify all linear MRD codes and see how many different classes of codes there are, for given parameter sets.
We also believe that the results of this paper are interesting from a cryptographic point of view.Especially for the cryptanalysis of McEliecetype cryptosystems based on Gabidulin codes [6,11] our criteria for MRD and Gabidulin codes might lead to new and more efficient attacks.First results in this direction can be found in [8], and we would like to pursue this line of research further in the future.

Theorem 4 . 8 .
Let C ⊆ F n q m be a linear MRD code of dimension k < n.Then dim(C ∩ C [s] ) = k − 1 if and only if C is a generalized Gabidulin code.

Theorem 5 . 1 .
All linear MRD codes in F n q m of dimension k = 1 or k = n−1 are Gabidulin codes.

Proposition 5 . 4 .
All linear MRD codes in F 4 2 4 are Gabidulin codes.Proof.The case for codes of dimension k = 1 or k = 3 follows from Theorem 5.1.It remains to show the case k = 2. Then by Lemma 5.3 there exists a generator matrix of the form G = 1 0 a b 0 1 c d with a, b, c, d ∈ F 2 4 \F 2 .By Theorem 3.2 a generator matrix G of an MRD code satisfies