COMPUTING GR¨OBNER BASES ASSOCIATED WITH LATTICES

. We specialize M¨oller’s algorithm to the computation of Gr¨obner bases related to lattices. We give the complexity analysis of our algorithm. Then we provide experiments showing that our algorithm is more eﬃcient than Buchberger’s algorithm for computing the associated Gr¨obner bases. Further- more we show that the binomial ideal associated to the lattice can be constructed from a set of binomials associated with a set of generators of the corresponding label code. This result is presented in a general way by means of three ideal constructions associated with group codes that constitute the same ideal. This generalizes earlier results for speciﬁc cases of group codes such as linear codes, codes over Z m and label codes of lattices.


Introduction
Ideals associated to label codes of lattices are introduced in [2]. They are a generalization of the ideals associated to binary codes constructed from a generator matrix of the code [7]. The ideal associated to any linear code is introduced in [6] as the binomial ideal associated with the congruence that determines the code translated to certain monoid. In that article, Möller's algorithm to compute Gröbner basis of these ideals is given; see also [5]. In this paper we focus on computing, efficiently, the Gröbner bases for these ideals. We provide a Möller type algorithm [16] for label codes of lattices. We implement our algorithm in GAP (version 4.7.2, [12]) and compared it with Buchberger's algorithm in GAP. Experimental results with several lattices are also given.
There are three constructions of ideals associated with group codes. We prove in Theorem 3.3 that these constructions constitute the same ideal. This generalizes results for linear codes [6,7], codes over Z m [14] and label codes of lattices [2]. In the latter case, our theorem entails that the binomial ideal associated to the lattice can be constructed from a set of binomials associated with a set of generators of the corresponding label code instead of using all the codewords as in [2]. On the other hand, a construction given in the theorem allows the application of Möller's algorithm to lattice coding. For this type of algorithms to compute Gröbner bases by means of linear algebra in a quotient algebra; some of the initial works on this topic are [10] and [11].
This paper is organized as follows. The general formulation of Möller's algorithm is given in Section 2. Section 3 provides the required background on lattice coding and the associated ideal. Proposition 1 plays a central role in our construction of Möller's algorithm for lattices. This algorithm is formulated, and its theoretical foundations explained, in Section 4. Computational results are described in Section 5. It is experimentally shown that, for ideals associated with label codes of lattices as defined in [2], our proposed solution for the computation of the reduced Gröbner bases is more efficient than Buchberger's algorithm.

Möller's algorithm
In this section we formulate Möller's algorithm in a general commutative setting. We also comment on the most important concepts related to this algorithm.
Let X = {x 1 , . . . , x n } be a set of n variables, [X] the set of monomials in these variables (commutative free monoid), ≺ a term order on [X], and T ≺ (g) the maximal term of the polynomial g. The set of maximal terms of a set of polynomials G with respect to ≺ is The set of maximal terms of an ideal I is denoted by T ≺ (I) and is the set of maximal terms of the polynomials that belong to the ideal. The K-vector space with basis N ≺ (I) = [X] \ T ≺ (I), Span K (N ≺ (I)), is the set of monomials in canonical form that determines I with respect to ≺. When the context is clear we simply write T {G}, T (I), N (I). Given a = (a 1 , . . . , a n ) ∈ Z n + , x a = n i=1 x ai i . For more details on these fundamental concepts see [1].
The next result characterizes the quotient algebra that determines an ideal. The Gröbner bases of an ideal I have the key property that computing the remainder of the polynomial f with respect to the set of polynomials that form the Gröbner basis is an algorithmic process with a unique result: Can(f, I). ii. the leading coefficient of g is 1; iii. g = T (g) − Can(T (g), I).
We assume that an ordering ≺ among the terms in [X] has been fixed, that I is an ideal that determines a finite dimensional quotient algebra (zero-dimensional ideal), and that the K-vectorial space Span K (N (I)) is represented by 1. a K-vectorial space E together with an effective function LinearDependency [v, {v 1 , v 2 , ..., v r }] that for each finite set {v 1 , v 2 , ..., v r } ⊂ E of linearly independent vectors and each vector v ∈ E, returns the value defined by The following functions are used in the algorithm: List] that inserts properly the products tx (for x ∈ X) in List, keeping the terms in increasing order with respect to the term order ≺. (We comment that InsertNexts does not keep duplications, instead this function counts the number of times that an element t has been inserted in List.) NextTerm [List] eliminates the first element of List and returns it as the result.
List:= InsertNexts[t r , List]; 10. Return[G]. We recommend [15] and [16] to read about Möller's algorithm, its theoretical foundations, and a description of several different contexts where it has been successfully used. Also, in [8] it is formulated a general pattern algorithm for a non commutative setting and for monoid and group algebras. Möller's algorithm is based on a fundamental property already present in [9] that indicates that a nonzero polynomial belongs to an ideal if and only if the monomials of the polynomial are linearly dependent in the quotient algebra that determines the ideal. This is precisely what is done in Step 6 where the v i s are the representation in E of the canonical forms t i s already constructed by the algorithm. Hence, if v is linearly dependent from the v i s we obtain a new polynomial for the Gröbner basis. If, on the contrary, v is linearly independent of the v i s we obtain a new canonical form with the monomial t. This new canonical form generates more elements to be included to the list List; the set that is inserted is {tx : x ∈ X}. We observe that all the elements w ∈ List are such that there exist x ∈ X and v ∈ N such that w = vx. Due to this property of the elements of List and to the condition in Step 4, we can guarantee that the Gröbner basis obtained is in reduced form. In fact, if the intention is to use this algorithm only to compute the structures known as "border basis" or only the Gröbner representation for the ideal, Step 4 should be eliminated.
Since the ideal I is zero-dimensional, once the algorithm constructs a basis of the quotient K[X]/I in N no more elements are included in List, and so List decreases through the Steps 3 to 7 until it is empty and the algorithm stops.
3. Group codes associated with lattices 3.1. Lattices. Let R m be the real m-dimensional vector space together with the usual scalar product ·, · and Euclidean norm x = x, x 1/2 .
Every lattice is generated by integer combinations of some linearly independent vectors (lattice elements) The set of vectors b 1 , . . . , b n is a basis of the lattice and n is the dimension (or range) of Λ.
Then, the generator matrix of Λ is defined by B = [b 1 , . . . , b n ] t , and the lattice can be described as The determinant (or volume) of Λ is defined as (BB t ) 1/2 . If m = n the lattice has complete range and the volume of Λ is |det(B)|.
The codewords are the elements of the code. If each G i of the sequence space has group structure, then the subgroup C of the sequence space group G is a group code. Without loss of generality, each G i can be taken such that G i ∼ = Z gi . For more details on these concepts see [2,4].
Consider the nested sequence of vector spaces {0} ⊂ V 0 ⊂ V 1 ⊂ · · · ⊂ V n = R n , where the dimension of V i as vector space is i. Let W i be the orthogonal complement Furthermore, let us assume that Λ ⊂ V n is an n-dimensional lattice. The ordered system of subspaces S = {W i } n i=1 corresponding to the sequence {V i } n i=1 is the coordinate system of Λ. For any subspace V of R n , the cross section Λ V of Λ is the set of lattice points that are in V , Λ V := Λ ∩ V . The cross sections Λ Vi and Λ Wi have lattice structure. We denote the projection of the lattice to the vector space W i as P Wi (Λ).
The label group G i (Λ) of Λ at level i, 1 ≤ i ≤ n, is defined as the quotient group P Wi (Λ)/Λ Wi . In this way a label code of a lattice L(Λ) is a subgroup of the sequence space group formed by the cartesian product of the G i (Λ)'s.
The following proposition, that we use in our algorithm, provides a way to decide if a vector of the sequence space is in the code. Proposition 1 ([4]). Let G = Z g1 × · · · × Z gn , and c ∈ G. Then c ∈ L(Λ) if and only if where V * is a generator matrix of Λ * (the dual lattice of Λ), r is the number of generators of V * (number of rows), P (Λ) = diag(det(P W1 (Λ)), . . . , det(P Wn (Λ))), where diag(·) is a diagonal matrix.
The matrix H = P (Λ)V * t in the above proposition is the check matrix of the code.

3.3.
Ideal associated with a group code. Let us assume that we have a sequence group G = Z g1 × · · · × Z gn and L a group code over G.
Next we show several ways of introducing the same ideal associated with this group code in a more general setting than the ones in [7,6] for binary codes and for linear codes in general, in [14] for codes over Z m , and in [2] for label codes of lattices.
Depending on the context, an element will be treated as an integer or as an element in G. For instance, in x a , a is a vector of positive integers, while in a ∈ G each component a i is the corresponding element in G i . For a ∈ G, x a is the monomial such that the exponent of each variable is the corresponding a i as an integer number, 0 ≤ a i ≤ g i − 1. This abuse of notation can be solved introducing two cross characteristic functions as in [14], however we decide not to do so in this paper since we need this only for this section.
Next we give three ways of associating an ideal with L. . . , n} . The first is a natural way of introducing a binomial ideal associated with L using the equivalence relation that determines L in G. The definition of an ideal associated with a linear code [6] is using I ≡ L 1 ; this was later seen in [14] for codes over Z m . On the other hand, I L2 is used in [7] and [14] where is shown that is the same ideal as I ≡ L . In [2] I L1 is used to define the ideal associated with a lattice by means of the label code of the lattice.
The following theorem shows that in the three cases previously studied the three ways of defining the ideal are equivalent. Moreover, the result is true for any ideal associated with a group code over G, where G = Z g1 × · · · × Z gn . Theorem 3.3. Let G = Z g1 × · · · × Z gn and L a subgroup of G. Then, the three ideals given in Definition 3.2 coincide.
Proof. We first show the equality between I L1 and I L2 . Clearly, I L2 ⊂ I L1 . Let a ∈ L, then there exist nonnegative integers β i , 1 ≤ i ≤ k, such that a = k i=1 β i a i . 1 To consider the non binary case in this definition, the linear code C has to be interpreted over F n q , with q = p m and p a prime number, as the isomorphic monoid structure of the corresponding code over F mn p .
Let l be such that 1 ≤ l ≤ k and β l = 0. Then We observe that the previous equality gives a recursion in the number of nonzero β i 's, hence to prove that x a − 1 ∈ I L2 is sufficient to show that x β l a l − 1 ∈ I L2 .
Obviously, x a l − 1 ∈ I L2 , thus applying a recursion similar to above we get We show now the equality between I L1 and I ≡ L . In this case it is clear that I L1 ⊂ I ≡ L ; we prove the other inclusion. Let x a − x b with a, b ∈ Z n + and a − b ∈ L. Let g = (g 1 , . . . , g n ), Then a + (g − 1)b ∈ L implies that there exists c ∈ L, 0 ≤ c ≤ g, such that We decompose α in a positive part and a negative part, α = α + − α − and substituting back in Equation (5), we get We note that x c − 1 ∈ I L1 and x α + g − 1 ∈ I L1 , then x c+α + g − 1 ∈ I L1 since Hence, using (6), x a+(g−1)b+α − g − 1 ∈ I L1 and from x α − g − 1 ∈ I L1 we obtain x a+(g−1)b − 1 ∈ I L1 . Furthermore, it is clear that x gb − 1 ∈ I L1 . Therefore, and so I ≡ L ⊂ I L1 .

Möller's algorithm for lattices
In order to specialize Möller's algorithm to lattices it is necessary to define the objects in this context, as well as to understand the linear dependency in which Proposition 1 plays a crucial role. In Section 2, we give Algorithm 1 that presents a general formulation of Möller's algorithm. Here we associate this algorithm with lattices using an additive monoid structure for the lattice and considering the application of Möller's algorithm to linear codes; see [5].
4.1. Main objects. The injective linear morphism ξ : [X] → R n associates to each monomial a vector in R n as follows: • let e i be the ith coordinate vector of G, that is, e ii = 1 Zg i and e ij = 0 if i = j; • ξ(x i ) = frac(e i P (Λ)V * T ), that is, ξ(x i ) = frac(e i H), where frac(·) represents the fractional part between 0 and 1 of the real number; Given Theorem 3.3, we have that the ideal I L1 associated to the lattice as in [2] is the ideal I ≡ L . This is the ideal associated to the application of Möller's algorithm. We denote this ideal by I L . Having in mind [5] for the application of Möller's algorithm to linear codes, the role of the ideal associated to the linear code is here played by I L .
We next show that Algorithm 2 correctly computes the reduced Gröbner basis. Proof. The correctness of this algorithm is a direct consequence of the application of Möller's algorithm to the lattice context. It is important in this specialization to define the objects of the algorithm correctly; see Section 4.1. Then, the algorithm finishes given the finite dimension of the quotient vector space and so the result is a reduced Gröbner basis of the ideal that constitutes the kernel of the morphism ξ that defines the equivalence relation. In the analysis in Section 4.1 this ideal is I L .
Complexity analysis. For a complete complexity analysis see [11], [13] and [15]. Here we analyze the number of steps that the algorithm executes. The operations are in G, Z n or computations of the fractional parts of the real numbers. The dimension of the quotient vector space is d = #(G)/#(L) = ( n i=1 g i )/#(L), where #(·) denotes the cardinality of the set and the number of variables is n. Hence, the number of steps that the algorithm makes is O(n 2 d 2 ). We observe that the number of steps that the while step is executed is the quantity of elements that the List can have and is bounded by nd, while the cost inside the cycle is dominated by the calls to Member and InsertNexts. The function Member performs an insertion in an ordered list of r ≤ d and InsertNexts is a merging procedure between ordered lists of length nd and n, and so the cost is dominated by nd.
We note that the parameter d gives an exponential growth to these algorithms. Nevertheless, the efficiency of them is based on the fact that the quantity of elements that the algorithm analyzes to obtain the results is quadratic in relation to the dimension of the quotient vector space.

Experimental results
In this section we present our experimental results that we summarize in Table 1. In this table we show the running times of Möller's algorithm to compute a reduced Gröbner basis with respect to the graded reverse lexicographical order as well as the time spent by Buchberger's algorithm. We used GAP [12] on a Pentium Dual-Core CPU, 2.00 GHz, 2.00 GHz, 3 Gb RAM computer; the time is given in milliseconds. We consider the lattices given in Table I of [2], using the bases and coordinate systems as in [3] to obtain the minimal trellis diagrams 2 . To compute the Gröbner basis in Buchberger's algorithm, we compute for each lattice code a generator set (see Section 3.2.1) and we construct the set of binomials that generate the ideal following (3) in Definition 3.2.
We remark that in all cases the running time of Möller's algorithm is inferior to the one of Buchberger's algorithm. This difference grows when the number of variables, the dimension of the ideal and the size of the reduced Gröbner bases grow.

Conclusions
In this work we show that there exist three equivalent ways of introducing an ideal associated with a group code for any finite Abelian group. One of these forms, the ideal associated with the equivalence relation that determines the finite Abelian Table 1. Reduced Gröbner bases for several lattices. group code that acts as the group of the sequence space, permits the application of Möller's algorithm to lattices. The same construction would be valid for any ideal associated with a group code of this type but in this case one has to develop the connexion with Gröbner bases as well as study the combinatorial properties of the codes, like for instance the decoding process. The theoretical foundations of the specialization of Möller 's algorithm to lattice codes is based on the properties of these structures. We provide a cost analysis of the algorithm for lattice codes. Finally, we give experiments, using several lattice codes, computing the reduced Gröbner bases of the ideals comparing Möller's and Buchberger's algorithm, showing as expected that the former presents better execution times.