# Revision history [back]

If i've got the right message of the cited paper, than the following sage code computes the toric ideal I of the ($\mathbb{Z}$-lift of the) parity check matrix for the linear code C of G=G2 posted above, also associates the ideal J generated by the $X_j^3-1$, $X_j$ being a running variable through the ones of the polynomial ring of I, then takes the sum K = I + J . Its generator list is the sum of the two generator lists for I and J.

This K is the ideal $I_{\mathcal C}$ from (9) and (10) of loc. cit.

We finally compute the Groebner basis of K as in the Example of loc. cit., page 487.

(In order to get the right basis, it is important to have the lex order on the ring $R$, where $I, J, K$ live in. The default order leads to a mess. So the first line is the important one, then we pass this polynomial ring to the ToricIdeal constructor.)

R.<X01, X02, X03, X04, X05, X06, X07, X08, X09, X10, X11> \
= PolynomialRing( QQ, order='lex' )    # sine lex, nulla salus

G = matrix( GF(3),
[ [1,0,0,0,0,0, 1,1,1,1,1] ,
[0,1,0,0,0,0, 0,1,2,2,1] ,
[0,0,1,0,0,0, 1,0,1,2,2] ,
[0,0,0,1,0,0, 2,1,0,1,2] ,
[0,0,0,0,1,0, 2,2,1,0,1] ,
[0,0,0,0,0,1, 1,2,2,1,0] ] )
# This is [ I | M ] as in loc. cit., Example, page 487.
print G
C = LinearCode( G )
print C

H = C.parity_check_matrix()
# we do not print H

I = ToricIdeal( H, polynomial_ring = R )
J = ideal( z^3-1 for z in I.parent().ring().gens() )
K = I + J

print "\nI is generated by:"
for pol in I.gens():    print "    %s" % pol

print "\nJ is generated by:"
for pol in J.gens():    print "    %s" % pol

print "\nK is generated by:"
for pol in K.gens():    print "    %s" % pol

print "\nK has the Groebner basis:"
for pol in K.groebner_basis():    print "    %s" % pol


This delivers:

[1 0 0 0 0 0 1 1 1 1 1]
[0 1 0 0 0 0 0 1 2 2 1]
[0 0 1 0 0 0 1 0 1 2 2]
[0 0 0 1 0 0 2 1 0 1 2]
[0 0 0 0 1 0 2 2 1 0 1]
[0 0 0 0 0 1 1 2 2 1 0]
Linear code of length 11, dimension 6 over Finite Field of size 3

I is generated by:
-X01*X02*X03^2*X04^2*X05 + X11
-X01*X02*X03*X05^2 + X10
-X01*X03^2*X04*X05^2 + X09
-X01*X02^2*X03*X04^2 + X08
-X01*X02^2*X04*X05 + X07
-X02^2*X03^2*X04^2*X05^2 + X06

J is generated by:
X01^3 - 1
X02^3 - 1
X03^3 - 1
X04^3 - 1
X05^3 - 1
X06^3 - 1
X07^3 - 1
X08^3 - 1
X09^3 - 1
X10^3 - 1
X11^3 - 1

K is generated by:
-X01*X02*X03^2*X04^2*X05 + X11
-X01*X02*X03*X05^2 + X10
-X01*X03^2*X04*X05^2 + X09
-X01*X02^2*X03*X04^2 + X08
-X01*X02^2*X04*X05 + X07
-X02^2*X03^2*X04^2*X05^2 + X06
X01^3 - 1
X02^3 - 1
X03^3 - 1
X04^3 - 1
X05^3 - 1
X06^3 - 1
X07^3 - 1
X08^3 - 1
X09^3 - 1
X10^3 - 1
X11^3 - 1

K has the Groebner basis:
X01 - X07^2*X08^2*X09^2*X10^2*X11^2
X02 - X08^2*X09*X10*X11^2
X03 - X07^2*X09^2*X10*X11
X04 - X07*X08^2*X10^2*X11
X05 - X07*X08*X09^2*X11^2
X06 - X07^2*X08*X09*X10^2
X07^3 - 1
X08^3 - 1
X09^3 - 1
X10^3 - 1
X11^3 - 1


And matches.