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 ##########################

$Id: example10.g,v 1.7 2004/04/16 14:12:42 jwk Exp $

<#GAPDoc Label="Example10">
<Section Label="Example10"><Heading>A commutative example by Mora</Heading>
Here we present a commutative example from page 339 of
<Q>An introduction to commutative and non-commutative Gröbner Bases</Q>, by
Teo Mora <Cite Key="TCS::Mora1994:131"/>.
It involves the seven variables <M>a,b,c,d,e,f,g</M>.
In order to force commuting between each pair from <M>\{a,b,c,d,e,f,g\}</M>,
we let part of the input equations
be the homogeneous binomials of the form
<M>xy - yx</M>.
GBNP is built for non-commutative polynomial arithmetic, and should handle
the commutative case by means of this forced commutation. But it should not
be considered as a serious alternative to the well-known Gröbner bases
packages when it comes to efficiency.
<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>

The relations will be entered as GAP polynomials and converted to NP form
(see <Ref Sect="NP"/>) with <Ref Func="GP2NPList" Style="Text"/>.

<Listing><![CDATA[
gap> F:=GF(7);; ef:=One(F);;
gap> A:=FreeAssociativeAlgebraWithOne(F, "a", "b", "c", "d", "e", "f", "g");
<algebra-with-one over GF(7), with 7 generators>
gap> gens:=GeneratorsOfAlgebra(A);
[ (Z(7)^0)*<identity ...>, (Z(7)^0)*a, (Z(7)^0)*b, (Z(7)^0)*c, (Z(7)^0)*d, 
  (Z(7)^0)*e, (Z(7)^0)*f, (Z(7)^0)*g ]
gap> a:=gens[2];; b:=gens[3];; c:=gens[4];; d:=gens[5];; e:=gens[6];; f:=gens[7];;
gap> g:=gens[8];; ea:=gens[1];;

gap> rels := [ a^3 + f*a, 
> 	a^9 + c*a^3 + g*a,
> 	a^81 + c*a^9 + d*a^3,
> 	c*a^81 + d*a^9 + e*a^3,
> 	a^27 + d*a^81 + e*a^9 + f*a^3,
> 	b + c*a^27 + e*a^81 + f*a^9 + g*a^3,
> 	c*b + d*a^27 + f*a^81 + g*a^9,
> 	a + d*b + e*a^27 + g*a^81,
> 	c*a + e*b + f*a^27,
> 	d*a + f*b + g*a^27,
> 	e*a + g*b,
> 	b^3 - b ];;
]]></Listing>

Some relations added to enforce commutativity.

<Listing><![CDATA[
gap> for i in [1..6] do
>     for j in [i+1..7] do
>         Add(rels,gens[i+1]*gens[j+1]-gens[j+1]*gens[i+1]);
>     od;
> od;
]]></Listing>

Now the relations are converted to NP form (see <Ref Sect="NP"/>) with the
function <Ref Func="GP2NPList" Style="Text"/>.

<Listing><![CDATA[
gap> KI:=GP2NPList(rels);;
]]></Listing>

The Gröbner basis can be calculated with <Ref Func="SGrobner" Style="Text"/>
and printed with <Ref Func="PrintNPList" Style="Text"/>.

<Listing><![CDATA[
gap> GB := SGrobner(KI);;
#I  number of entered polynomials is 33
#I  number of polynomials after reduction is 33
#I  End of phase I
#I  End of phase II
#I  End of phase III
#I  End of phase IV
#I  The computation took 24820 msecs.
gap> PrintNPList(GB);
 a 
 b 
 dc + Z(7)^3cd 
 ec + Z(7)^3ce 
 ed + Z(7)^3de 
 fc + Z(7)^3cf 
 fd + Z(7)^3df 
 fe + Z(7)^3ef 
 gc + Z(7)^3cg 
 gd + Z(7)^3dg 
 ge + Z(7)^3eg 
 gf + Z(7)^3fg 
]]></Listing>


To determine whether the quotient algebra is finite dimensional
we invoke <Ref Func="FinCheckQA" Style="Text"/>, using as arguments
the leading monomials of <C>GB</C> and 7, the number of variables involved.
The leading monomials of <C>GB</C> are obtained by 
<Ref Func="LMonsNP" Style="Text"/>.

<Listing><![CDATA[
gap> F := LMonsNP(GB);;
gap> FinCheckQA(F,7);
false
]]></Listing>


Thus, the quotient algebra turns out to be infinite dimensional.
This is no surprise as the Gröbner basis shows it is actually
the free commutative algebra generated by <M>c,d,e,f,g</M>.
In particular, it has polynomial growth of degree 5. This is confirmed
by application of
<Ref Func="DetermineGrowthQA" Style="Text"/>, with the first two arguments
as for <C>FinCheckQA</C> above and third argument <C>false</C>, indicating
that an interval for the degree of the polynomial degree will suffice.
<Listing><![CDATA[
gap> DetermineGrowthQA(F,7,false);
5
]]></Listing>
It turns out that this quick version already gives an exact answer.
More time consuming would be the algorithm run with third argument
equal to <C>true</C>.
<Listing><![CDATA[
gap> DetermineGrowthQA(F,7,true);
5
]]></Listing>

</Section>
<#/GAPDoc>
