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 = "example01.g" 
gap> ### authors Cohen & Gijsbers
gap> ### $Id: example01.g,v 1.7 2006/12/18 15:43:18 jwk Exp $

gap> ### THIS IS A GAP PACKAGE FOR COMPUTING NON-COMMUTATIVE GROBNER BASES 
gap>  
gap> ### Last change: August 22 2001. 
gap> ### amc

<#GAPDoc Label="Example01">
<Section Label="Example01">
<Heading>A simple commutative Gröbner basis computation</Heading>
In this commutative example the relations are <M>x^2y-1</M>
and <M>xy^2-1</M>; 
we add <M>xy-yx</M> to enforce that
<M>x</M> and <M>y</M> commute.
The answer should be <M>\{x^3-1, x-y, xy-yx\}</M>,
as the reduction ordering is total degree first
and then lexicographic with <M> x </M> smaller than
<M>y</M>.
<P/>
First load the package and set the standard infolevel <Ref
InfoClass="InfoGBNP" Style="Text"/> to 2 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,2);
gap> SetInfoLevel(InfoGBNPTime,1);
]]></Listing>

Then input the relations in NP format (see Section <Ref Sect="NP"/>). 
They will be put in the list <C>Lnp</C>.

<Listing><![CDATA[
gap> Lnp := [ [[[1,2],[2,1]],[1,-1]]   ];
[ [ [ [ 1, 2 ], [ 2, 1 ] ], [ 1, -1 ] ] ]
gap> x2y := [[[1,1,2],[]],[1,-1]];
[ [ [ 1, 1, 2 ], [  ] ], [ 1, -1 ] ]
gap>     AddSet(Lnp,x2y);   
gap> xy2 := [[[1,2,2],[]],[1,-1]];
[ [ [ 1, 2, 2 ], [  ] ], [ 1, -1 ] ]
gap>     AddSet(Lnp,xy2);
]]></Listing>

The relations can be exhibited with <Ref Func="PrintNPList" Style="Text"/>:

<Listing><![CDATA[
gap> PrintNPList(Lnp);
 a^2b - 1 
 ab - ba 
 ab^2 - 1 
]]></Listing>

Let the variables be printed as <M>x</M> and <M>y</M> instead of <M>a</M> and <M>b</M> by means of
<Ref Func="GBNP.ConfigPrint" Style="Text"/>
<Listing><![CDATA[
gap> GBNP.ConfigPrint("x","y");
]]></Listing>




The Gröbner basis can now be calculated with 
<Ref Func="SGrobner" Style="Text"/>:

<Listing><![CDATA[
gap> GB := SGrobner(Lnp);
#I  number of entered polynomials is 3
#I  number of polynomials after reduction is 3
#I  End of phase I
#I  End of phase II
#I  length of G =1
#I  length of todo is 1
#I  length of G =2
#I  length of todo is 0
#I  List of todo lengths is [ 1, 1, 0 ]
#I  End of phase III
#I  G: Cleaning finished, 0 polynomials reduced
#I  End of phase IV
#I  The computation took 4 msecs.
[ [ [ [ 2 ], [ 1 ] ], [ 1, -1 ] ], [ [ [ 1, 1, 1 ], [  ] ], [ 1, -1 ] ] ]
]]></Listing>

When printed, it looks like:

<Listing><![CDATA[
gap> PrintNPList(GB);
 y - x 
 x^3 - 1 
]]></Listing>

The dimension of the quotient algebra can be calculated with 
<Ref Func="DimQA" Style="Text"/>. The arguments are the Gröbner basis 
<C>GB</C> and the number of variables is <C>2</C>:

<Listing><![CDATA[
gap> DimQA(GB,2);
3
]]></Listing>

A basis of this quotient algebra can be calculated with <Ref Func="BaseQA"
Style="Text"/>. The arguments are a Gröbner basis <C>GB</C>, the
number of variables <A>t</A> (<M>=2</M>) and a variable <A>maxno</A> for
returning partial quotient algebras (0 means full basis). The calculated
basis will be printed as well.

<Listing><![CDATA[
gap> B:=BaseQA(GB,2,0);;
gap> PrintNPList(B);
 1 
 x 
 x^2 
]]></Listing>

The strong normal form of the element <M>xyxyxyx</M> can be found by use of 
<Ref Func="StrongNormalFormNP" Style="Text"/>. 
The arguments are this element and the Gröbner basis <C>GB</C>.

<Listing><![CDATA[
gap> f:=[[[1,2,1,2,1,2,1]],[1]];;
gap> PrintNP(f);
 xyxyxyx 
gap> p:=StrongNormalFormNP(f,GB);;
gap> PrintNP(p);
 x 
]]></Listing>




</Section>
<#/GAPDoc>

