gap> ######################### BEGIN COPYRIGHT MESSAGE #########################
GBNP - computing Gröbner bases of noncommutative polynomials
Copyright 2001-2010 by Arjeh M. Cohen, Dié A.H. Gijsbers, Jan Willem
Knopper, Chris Krook. Address: Discrete Algebra and Geometry (DAM) group
at the Department of Mathematics and Computer Science of Eindhoven
University of Technology.

For acknowledgements see the manual. The manual can be found in several
formats in the doc subdirectory of the GBNP distribution. The
acknowledgements formatted as text can be found in the file chap0.txt.

GBNP is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by the
Free Software Foundation (FSF); either version 2.1 of the License, or
(at your option) any later version. For details, see the file 'LGPL' in
the doc subdirectory of the GBNP distribution or see the FSF's own site:
http://www.gnu.org/licenses/lgpl.html
gap> ########################## END COPYRIGHT MESSAGE ##########################

gap> ### filename = "example22.g" 
gap> ### author Knopper
gap> ### $Id: example22.g,v 1.7 2004/04/16 14:37:39 jwk Exp $

gap> ### THIS IS A GAP PACKAGE FOR COMPUTING NON-COMMUTATIVE GROBNER BASES 

<#GAPDoc Label="Example22">
<Section Label="Example22"><Heading>A module of the Hecke algebra of type
A<M>_3</M> over GF(3)</Heading>
This example is an extension of Example 5 from 
Linton, <Cite Key="MR94k:20022"/>. It concerns
the Hecke Algebra of type A<M>_3</M>. By reducing mod 3 but without
evaluating at <M>q=1</M> it is possible to obtain the following
representation of the Hecke algebra of type A<M>_3</M> over GF(3): <M>\langle
x, y, z\mid x^2+(1-q)*x-q,y^2+(1-q)*y-q,z^2+(1-q)*z-q,y*x*y-x*y*x, z*y*z-y*z*y,
z*x-x*z\rangle</M>. It has a natural representation of the same dimension as
the Lie algebra of type A<M>_3</M>, namely 4. This representation can be
obtained with the module relations <M>\{x+1,y+1\}</M>.
<P/>
First load the package and set the standard infolevel <Ref
InfoClass="InfoGBNP" Style="Text"/> to 1 and the time infolevel <Ref
Func="InfoGBNPTime" Style="Text"/> to 1 (for more information about the info
level, see Chapter <Ref Chap="Info"/>).

<Listing><![CDATA[
gap> LoadPackage("GBNP","0",false);;
gap> SetInfoLevel(InfoGBNP,1);
gap> SetInfoLevel(InfoGBNPTime,1);
]]></Listing>

Now enter the relations as GAP polynomials. The module is one dimensional so
it is possible to enter it with and without a module. Both are used in
Example <Ref Sect="Example18"/>. Here the relations will be entered
without using a module. First a free associative algebra with one is created
over the field (GF(3)) 
(see also <Ref BookName="Reference" Label="FreeAssociativeAlgebraWithOne"/>).
For convenience we use the
variables <C>a</C> and <C>b</C> for the generators of the algebra and
<C>e</C> for the one of the algebra.

<Listing><![CDATA[
gap> q:=Indeterminate(GF(3),"q");
q
gap> A:=FreeAssociativeAlgebraWithOne(Field(q), "x", "y", "z");;
gap> g:=GeneratorsOfAlgebra(A);;
gap> x:=g[2];;y:=g[3];;z:=g[4];;e:=g[1];;q:=q*e;;
]]></Listing>


In order to print the variables like they are printed in the algebra <C>A</C>
with the function <Ref Func="GBNP.ConfigPrint" Style="Text"/>:

<Listing><![CDATA[
gap> GBNP.ConfigPrint(A);
]]></Listing>

Now the relations are entered:

<Listing><![CDATA[
gap> twosidrels:=[x^2+(e-q)*x-q,y^2+(e-q)*y-q,z^2+(e-q)*z-q,
>   y*x*y-x*y*x,z*y*z-y*z*y,z*x-x*z];
[ (-q)*<identity ...>+(-q+Z(3)^0)*x+(Z(3)^0)*x^2, 
  (-q)*<identity ...>+(-q+Z(3)^0)*y+(Z(3)^0)*y^2, 
  (-q)*<identity ...>+(-q+Z(3)^0)*z+(Z(3)^0)*z^2, 
  (-Z(3)^0)*x*y*x+(Z(3)^0)*y*x*y, (-Z(3)^0)*y*z*y+(Z(3)^0)*z*y*z, 
  (-Z(3)^0)*x*z+(Z(3)^0)*z*x ]
gap> prefixrels:=[x+e,y+e];
[ (Z(3)^0)*<identity ...>+(Z(3)^0)*x, (Z(3)^0)*<identity ...>+(Z(3)^0)*y ]
]]></Listing>

First the relations are converted into NP format (see <Ref Sect="NP"/>) after
which the function <Ref Func="SGrobnerModule" Style="Text"/> is called to
calculate a Gröbner basis record.

<Listing><![CDATA[
gap> GBR:=SGrobnerModule(GP2NPList(prefixrels),GP2NPList(twosidrels));;
#I  number of entered polynomials is 6
#I  number of polynomials after reduction is 6
#I  End of phase I
#I  End of phase II
#I  End of phase III
#I  End of phase IV
#I  The computation took 4 msecs.
#I  number of entered polynomials is 9
#I  number of polynomials after reduction is 9
#I  End of phase I
#I  End of phase II
#I  End of phase III
#I  End of phase IV
#I  The computation took 8 msecs.
]]></Listing>

The record GBR has three members: 
the two-sided relations <C>GBR.ts</C>, the
prefix relations <C>GBR.p</C>, and the number <C>GBR.pg</C> of generators 
of the free 
module. It is possible to print the first two using the
function <Ref Func="PrintNPList" Style="Text"/>:

<Listing><![CDATA[
gap> PrintNPList(GBR.ts);
 x^2 + -q+Z(3)^0x + -q 
 y^2 + -q+Z(3)^0y + -q 
 zx + -Z(3)^0xz 
 z^2 + -q+Z(3)^0z + -q 
 yxy + -Z(3)^0xyx 
 zyz + -Z(3)^0yzy 
 zyxz + -Z(3)^0yzyx 
gap> PrintNPList(GBR.p);
[ x + Z(3)^0 ]
[ y + Z(3)^0 ]
]]></Listing>

It is now possible to calculate the standard basis of the quotient module
with the function <Ref Func="BaseQM" Style="Text"/>. This function has as
arguments the Gröbner basis record <C>GBR</C>, the number of generators of
the algebra (here this is 3), the number of generators of
the module (here this is 1), and a variable <C>maxno</C> for returning
partial bases (0 means full basis).

<Listing><![CDATA[
gap> B:=BaseQM(GBR,3,1,0);;
gap> PrintNPList(B);
[ Z(3)^0 ]
[ z ]
[ zy ]
[ zyx ]
]]></Listing>

Next we write down the matrices for the right action of the generators
on the module, by means of the command
<Ref Func="MatricesQA" Style="Text"/>.

<Listing><![CDATA[
gap> MM := MatricesQA(3,B,GBR);;
gap> for i in [1..Length(MM)] do 
> Display(MM[i]); Print("\n"); 
> od;
[ [   -Z(3)^0,    0*Z(3),    0*Z(3),    0*Z(3) ],
  [    0*Z(3),   -Z(3)^0,    0*Z(3),    0*Z(3) ],
  [    0*Z(3),    0*Z(3),    0*Z(3),    Z(3)^0 ],
  [    0*Z(3),    0*Z(3),         q,  q-Z(3)^0 ] ]

[ [   -Z(3)^0,    0*Z(3),    0*Z(3),    0*Z(3) ],
  [    0*Z(3),    0*Z(3),    Z(3)^0,    0*Z(3) ],
  [    0*Z(3),         q,  q-Z(3)^0,    0*Z(3) ],
  [    0*Z(3),    0*Z(3),    0*Z(3),   -Z(3)^0 ] ]

[ [    0*Z(3),    Z(3)^0,    0*Z(3),    0*Z(3) ],
  [         q,  q-Z(3)^0,    0*Z(3),    0*Z(3) ],
  [    0*Z(3),    0*Z(3),   -Z(3)^0,    0*Z(3) ],
  [    0*Z(3),    0*Z(3),    0*Z(3),   -Z(3)^0 ] ]

]]></Listing>

</Section>
<#/GAPDoc>
