Mysterious computation of a ring quotient in GAP

500 Views Asked by At

I want to do some calculations with finite rings in GAP. I have found a contradiction which I cannot explain.

How to create finite rings in GAP using structure constants is explained here on page 45; also here. So in order to construct the example ring $\mathbb{Z}/2^n [X]/\langle X^2,2X \rangle$, I have written the following function in GAP:

ExampleRing := function(n)
local T,O;
T := EmptySCTable(2,0);       # 2 generators e,x as Z-module
O := [2^n,2];                 # ord(e)=2^n and ord(x)=2
SetEntrySCTable(T,1,1,[1,1]); # e*e = 1*e
SetEntrySCTable(T,1,2,[1,2]); # e*x = 1*x
SetEntrySCTable(T,2,1,[1,2]); # x*e = 1*x
SetEntrySCTable(T,2,2,[]);    # x*x = 0
return RingByStructureConstants(O,T,["e","x"]);
end;

Inside $\mathrm{ExampleRing}(4) = \mathbb{Z}/2^4 [X]/\langle X^2,2X \rangle$ consider the ideal $\langle 2^2 - X \rangle$. The quotient ring is $\mathbb{Z}/2^3$, right? But when I compute the quotient with GAP, it produces $\mathbb{Z}/4 [X]/\langle X^2,2X \rangle$ instead!

gap> R := ExampleRing(4);
<ring with 2 generators>
gap> AssignGeneratorVariables(R);
#I  Assigned the global variables [ e, x ]
gap> Q := R / Ideal(R,[2^2 * e - x]);
<ring with 2 generators>
gap> Elements(Q);
[ 0*q1, q2, q1, q1+q2, 2*q1, 2*q1+q2, -q1, -q1+q2 ]
gap> One(Q);
q1
gap> 4*One(Q);
0*q1
gap> AssignGeneratorVariables(Q);
#I  Assigned the global variables [ q1, q2 ]
gap> 2*q2;
0*q1
gap> q2^2;
0*q1

So either a) my code is wrong, b) my calculation of the quotient is wrong, or c) GAP's implementation is wrong. Could someone clarify this?

Also are there other computer algebra systems which can compute with finite rings of the form $\mathbb{Z}/n [X] / \langle X^2,a+bX \rangle$?

Edit: Apparently GAP's implementation is wrong or I do not use it correctly. Here is a very simple example: I define $\mathbb{Z}/8$ with structure constants and quotient out the ideal generated by $2$. This should be $\mathbb{Z}/2$, but GAP computes $\mathbb{Z}/4$:

gap> T := EmptySCTable(1,0);;
gap> SetEntrySCTable(T,1,1,[1,1]);
gap> R := RingByStructureConstants([8],T,["e"]);
<ring with 1 generators>
gap> AssignGeneratorVariables(R);
#I  Assigned the global variables [ e ]
gap> Elements(R);
[ 0*e, e, 2*e, 3*e, 4*e, 5*e, 6*e, -e ]
gap> e*e;
e
gap> I := Ideal(R,[2*e]);
<two-sided ideal in <ring with 1 generators>, (1 generators)>
gap> Elements(I);
[ 0*e, 2*e, 4*e, 6*e ]
gap> Q := R/I;
<ring with 1 generators>
gap> Elements(Q);
[ 0*q1, q1, 2*q1, -q1 ]
1

There are 1 best solutions below

4
On BEST ANSWER

Yes, this is two (stupid) bugs I will fix in the next release. Thank you for reporting. I will put a temporary patch (just read in the file) at https://www.dropbox.com/s/aprqfottc4pb6ni/quotringfix.g?dl=0

Apologies for the problem -- I would not be surprised if you are the first person actually using the code.