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

First load the gap package (before the example)

gap> LoadPackage("GBNP","0",false); true

<#GAPDoc Label="example-GP2NP">

Example:
Let A be the free associative algebra with one over the rationals on the generators a and b. Let e be the one of the algebra.

gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");; gap> a:=A.a;; gap> b:=A.b;; gap> e:=One(A);; gap> z:=Zero(A);;

Now let gp be the polynomial ba-ab-e.

gap> gp:=b*a-a*b-e; (-1)*<identity ...>+(-1)*a*b+(1)*b*a

The polynomial in NP format, corresponding to gp can now be obtained with GP2NP:

gap> GP2NP(gp); [ [ [ 2, 1 ], [ 1, 2 ], [ ] ], [ 1, -1, -1 ] ]

Let D be the free associative algebra over A of rank 2.

gap> D := A^2;;

Take the following list R of two elements of D.

gap> R := [ [b-e, z], [e+a*(e+a+b), -e-a*(e+a+b)] ];;

Convert the list R to a list of vectors in NPM format.

gap> List(R,GP2NP); [ [ [ [ -1, 2 ], [ -1 ] ], [ 1, -1 ] ], [ [ [ -1, 1, 2 ], [ -1, 1, 1 ], [ -2, 1, 2 ], [ -2, 1, 1 ], [ -1, 1 ], [ -2, 1 ], [ -1 ], [ -2 ] ], [ 1, 1, -1, -1, 1, -1, 1, -1 ] ] ]
<#/GAPDoc>

<#GAPDoc Label="example-GP2NPList">

Example:
Let A be the free associative algebra with one over the rationals on the generators a and b. Let e be the one of the algebra.

gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");; gap> a:=A.a;; gap> b:=A.b;; gap> e:=One(A);;

Let Lgp be the list of polynomials [a^2-e,b^2-e,ba-ab-e].

gap> Lgp:=[a^2-e,b^2-e,b*a-a*b-e]; [ (-1)*<identity ...>+(1)*a^2, (-1)*<identity ...>+(1)*b^2, (-1)*<identity ...>+(-1)*a*b+(1)*b*a ]

The polynomial in NP format corresponding to gp can be obtained with GP2NP:

gap> GP2NPList(Lgp); [ [ [ [ 1, 1 ], [ ] ], [ 1, -1 ] ], [ [ [ 2, 2 ], [ ] ], [ 1, -1 ] ], [ [ [ 2, 1 ], [ 1, 2 ], [ ] ], [ 1, -1, -1 ] ] ]

The same result is obtained by a simple application of the standard List function in GAP:

gap> List(Lgp,GP2NP) = GP2NPList(Lgp); true
<#/GAPDoc>

<#GAPDoc Label="example-NP2GP">

Example:
Let A be the free associative algebra with one over the rationals on the generators a and b.

gap> A:=FreeAssociativeAlgebraWithOne(GF(3),"a","b");;

Let np be a polynomial in NP format.

gap> np:=[ [ [ 2, 1 ], [ 1, 2 ], [ ] ], [ Z(3)^0, Z(3), Z(3) ] ];;

The polynomial can be converted to the corresponding element of A with NP2GP:

gap> NP2GP(np,A); (Z(3)^0)*b*a+(Z(3))*a*b+(Z(3))*<identity ...>

Note that some information of the coefficient field of a polynomial np in NP format can be obtained from the second list of np.

gap> One(np[2][1]); Z(3)^0

Now let M be the module A^2 and let npm be a polynomial over that module in NPM form.

gap> M:=A^2;; gap> npm:=[ [ [ -1, 1 ], [ -2, 2 ] ], [ Z(3)^0, Z(3)^0 ] ];;

The element of M corresponding to npm is

gap> NP2GP(npm,M); [ (Z(3)^0)*a, (Z(3)^0)*b ]

If M is a module of dimension 2 over A and Lnp a list of polynomials in NPM format, then the polynomials can be converted to the corresponding polynomials of M as follows:

gap> M:=A^2;; gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ], > [ [ [ -1, 2, 2], [-2, 1 ] ], [ 1, -1 ]*Z(3)^0 ] ];; gap> List(Lnp, m -> NP2GP(m,M)); [ [ <zero> of ..., (Z(3))*a+(Z(3)^0)*a^2 ], [ (Z(3)^0)*b^2, (Z(3))*a ] ]
<#/GAPDoc>

<#GAPDoc Label="example-NP2GPList">

Example:
Let A be the free associative algebra with one over the rationals on the generators a and b.

gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;

Let Lnp be a list of polynomials in NP format. Then Lnp can be converted to a list of polynomials of A with NP2GPList:

gap> Lnp:=[ [ [ [ 1, 1, 1 ], [ 1 ] ], [ 1, -1 ] ], > [ [ [ 2, 2 ], [ ] ], [ 1, -1 ] ] ];; gap> NP2GPList(Lnp,A); [ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]

It has the same effect as the function List applied as follows.

gap> List(Lnp, p -> NP2GP(p,A)); [ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]

Now let M be a module of dimension 2 over A and Lnp a list of vectors in NPM format. Then polynomials Lnp can be converted to the corresponding vectors of M with NP2GPList:

gap> M:=A^2;; gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ], > [ [ [ -1, 1 ], [ -2 ] ], [ 1, -1 ] ] ];; gap> NP2GPList(Lnp,M); [ [ <zero> of ..., (-1)*a+(1)*a^2 ], [ (1)*a, (-1)*<identity ...> ] ]

The same result can be obtained by application of the standard List function:

gap> List(Lnp, m -> NP2GP(m,M)) = NP2GPList(Lnp,M) ; true
<#/GAPDoc>

<#GAPDoc Label="example-PrintNP"> Example: Consider the following polynomial in NP format. gap> p := [[[1,1,2],[1,2,2],[]],[1,-2,3]];;

It can be printed in the guise of a polynomial in a and b by the function PrintNP: gap> PrintNP(p); a^2b - 2ab^2 + 3

<#/GAPDoc>

<#GAPDoc Label="example-ConfigPrint"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];;

They can be printed by the function PrintNP. gap> PrintNP(p1); a^2b - 1 gap> PrintNP(p2); ab^2 - 1

We can let the variables be printed as x and y instead of a and b by means of . gap> GBNP.ConfigPrint("x","y"); gap> PrintNP(p1); x^2y - 1 gap> PrintNP(p2); xy^2 - 1

We can also let the variables be printed as x.1 and x.2 instead of a and b by means of . gap> GBNP.ConfigPrint(2,"x"); gap> PrintNP(p1); x.1^2x.2 - 1 gap> PrintNP(p2); x.1x.2^2 - 1

We can even assign strings to the variables to be printed like alice and bob instead of a and b by means of . gap> GBNP.ConfigPrint("alice","bob"); gap> PrintNP(p1); alice^2bob - 1 gap> PrintNP(p2); alicebob^2 - 1

Alternatively, we can introduce the free algebra A with two generators, and print the polynomials as members of A:

gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");; gap> GBNP.ConfigPrint(A); gap> PrintNP(p1); a^2b - 1 gap> PrintNP(p2); ab^2 - 1
<#/GAPDoc>

<#GAPDoc Label="example-PrintNPList"> Example: We put two polynomials in NP format into the list Lnp. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> Lnp := [p1,p2];;

We can print the list with . gap> PrintNPList(Lnp); a^2b - 1 ab^2 - 1

Alternatively, using the function , we can introduce the free algebra A with two generators, and print the polynomials of the list as members of A:

gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");; gap> GBNP.ConfigPrint(A); gap> PrintNPList(Lnp); a^2b - 1 ab^2 - 1
<#/GAPDoc>

<#GAPDoc Label="example-AddNP"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-3]];; gap> p2 := [[[1,2,2],[]],[1,-4]];;

The second can be subtracted from the first by the function AddNP. gap> PrintNP(AddNP(p1,p2,1,-1)); - ab^2 + a^2b + 1

<#/GAPDoc>

<#GAPDoc Label="example-BimulNP"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-3]];; gap> p2 := [[[1,2,2],[]],[1,-4]];;

Multiplying p1 from the right by b and multiplying p2 from the left by a is possible with the function BimulNP: gap> PrintNP(BimulNP([],p1,[2])); a^2b^2 - 3b gap> PrintNP(BimulNP([1],p2,[])); a^2b^2 - 4a

<#/GAPDoc>

<#GAPDoc Label="example-CleanNP"> Example: Consider the following polynomial in NP format. gap> p := [[[1,1,2],[],[1,1,2],[]],[1,-3,-2,3]];; gap> PrintNP(p); a^2b - 3 - 2a^2b + 3

The monomials [1,1,2] and [] occur twice each. For many functions this representation of a polynomial in NP format is not allowed. It needs to be cleaned, as by : gap> PrintNP(CleanNP(p)); - a^2b

In order to define a polynomial over GF(2), the coefficients need to be defined over this field. Such a list of coefficients can be obtained in GAP from a list of integers by multiplying with the identity element of the field. The resulting polynomial need not be clean, and so should be made clean again with CleanNP. gap> p := [[[1,1,2],[]],One(GF(2))*[1,-2]];; gap> CleanNP(p); [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ]

<#/GAPDoc>

<#GAPDoc Label="example-GtNP"> Example: Consider the following two monomials. gap> u := [1,1,2]; [ 1, 1, 2 ] gap> v := [2,2,1]; [ 2, 2, 1 ]

We test whether u is greater than v.

gap> GtNP(u,v); false
<#/GAPDoc>

<#GAPDoc Label="example-LtNP"> Example: Consider the following two monomials. gap> u := [1,1,2]; [ 1, 1, 2 ] gap> v := [2,2,1]; [ 2, 2, 1 ]

We test whether u is less than v.

gap> LtNP(u,v); true
<#/GAPDoc>

<#GAPDoc Label="example-LMonsNP"> Example: We put two polynomials in NP format into the list Lnp. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> Lnp := [p1,p2];;

The list of leading monomials is computed by LMonsNP:

gap> LMonsNP(Lnp); [ [ 1, 1, 2 ], [ 1, 2, 2 ] ]

For a nicer printing, the monomials can be converted into polynomials in NP format, and then submitted to PrintNPList:

gap> PrintNPList(List(LMonsNP(Lnp), q -> [[q],[1]])); a^2b ab^2
<#/GAPDoc>

<#GAPDoc Label="example-MkMonicNP"> Example: Consider the following polynomial in NP format. gap> p := [[[1,1,2],[]],[2,-1]];; gap> PrintNP(p); 2a^2b - 1

The coefficient of the leading term is 2. The function MkMonicNP finds this coefficient and divides all terms by it:

gap> PrintNP(MkMonicNP(p)); a^2b - 1/2
<#/GAPDoc>

<#GAPDoc Label="example-MulNP"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];;

The function MulNP multiplies the two polynomials. gap> PrintNP(MulNP(p1,p2)); a^2bab^2 - ab^2 - a^2b + 1

The fact that this multiplication is not commutative is illustrated by the following comparison, using MulNP twice and AddNP once. gap> PrintNP(AddNP(MulNP(p1,p2),MulNP(p2,p1),1,-1)); - ab^2a^2b + a^2bab^2

<#/GAPDoc>

<#GAPDoc Label="example-StrongNormalFormNP"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; The strong normal form of the polynomial gap> p := [[[1,1,1,2],[2,1],[]],[1,-1,3]];; with respect to the list [p1,p2] is computed by use of the function StrongNormalFormNP: gap> PrintNP(StrongNormalFormNP(p,[p1,p2])); - ba + a + 3 <#/GAPDoc>

<#GAPDoc Label="example-Grobner"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> PrintNPList([p1,p2]); a^2b - 1 ab^2 - 1

Their Gröbner basis can be computed by the function Grobner. gap> G := Grobner([p1,p2]);; gap> PrintNPList(G); b - a a^3 - 1

One iteration of the Gröbner computations is invoked by use of the parameter max: gap> R := Grobner([p1,p2],1);; gap> PrintNPList(R.G); b - a gap> PrintNPList(R.todo); a^3 - 1 gap> R.iterations; 1 gap> R.completed; false

The above list R.todo can be used to resume the computation of the Gröbner basis computation with the Gröbner pair R.G, R.todo: gap> PrintNPList(Grobner(R.G,R.todo)); b - a a^3 - 1

In order to perform the Gröbner basis computation with polynomials in a free algebra over the field GF(2), the coefficients of the polynomials need to be defined over that field.

gap> PrintNPList(Grobner([[p1[1],One(GF(2))*p1[2]],[p2[1],One(GF(2))*p1[2]]])); b + a a^3 + Z(2)^0
<#/GAPDoc>

<#GAPDoc Label="example-SGrobner"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> PrintNPList([p1,p2]); a^2b - 1 ab^2 - 1

Their Gröbner basis can be computed by the function Grobner. gap> G := SGrobner([p1,p2]);; gap> PrintNPList(G); b - a a^3 - 1

One iteration of the Gröbner computations is invoked by use of the parameter max: gap> R := SGrobner([p1,p2],1);; gap> PrintNPList(R.G); b - a gap> PrintNPList(R.todo); a^3 - 1 gap> R.iterations; 1 gap> R.completed; false

The above list R.todo can be used to resume the computation of the Gröbner basis computation with the Gröbner pair R.G, R.todo: gap> PrintNPList(SGrobner(R.G,R.todo)); b - a a^3 - 1 <#/GAPDoc>

<#GAPDoc Label="example-BaseQA"> Example: Consider the following Gröbner basis. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> G := Grobner([p1,p2]);; gap> PrintNPList(G); b - a a^3 - 1 The function BaseQA computes a basis for the quotient algebra of the free algebra over the rationals with generators a and b by the two-sided ideal generated by G. gap> PrintNPList(G); b - a a^3 - 1 gap> BaseQA(G,2,0); [ [ [ [ ] ], [ 1 ] ], [ [ [ 1 ] ], [ 1 ] ], [ [ [ 1, 1 ] ], [ 1 ] ] ] gap> PrintNPList(BaseQA(G,2,0)); 1 a a^2

It is necessary for a correct result that the first argument be a Gröbner basis, as will be clear from the following invocation of BaseQA. gap> PrintNPList(BaseQA([p1,p2],2,10)); 1 a b a^2 ab ba b^2 a^3 aba ba^2 bab b^2a b^3

<#/GAPDoc>

<#GAPDoc Label="example-DimQA"> Example: Consider the following Gröbner basis. gap> p1 := [[[1,1,2],[]],[1,-2]];; gap> p2 := [[[1,2,2],[]],[1,-2]];; gap> G := Grobner([p1,p2]);; gap> PrintNPList(G); b - a a^3 - 2 The function DimQA computes the dimension of the quotient algebra of the free algebra over the rationals with generators a and b by the two-sided ideal generated by G. gap> DimQA(G,2); 3 <#/GAPDoc>

<#GAPDoc Label="example-MulQA"> Example: Consider the following Gröbner basis. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> G := Grobner([p1,p2]);; gap> PrintNPList(G); b - a a^3 - 1

Print the product in the quotient algebra of the polynomials a-2 and b-3 by use of MulQA: gap> s1 := [[[1],[]],[1,-2]];; gap> s2 := [[[2],[]],[1,-3]];; gap> PrintNP(MulQA(s1,s2,G)); a^2 - 5a + 6

The result should be equal to the strong normal form of the product of a-2 and b-3 with respect to G: gap> MulQA(s1,s2,G) = StrongNormalFormNP(MulNP(s1,s2),G); true

<#/GAPDoc>

<#GAPDoc Label="example-IsStrongGrobnerBasis"> Example: Consider the following list of two polynomials in NP format. gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];; gap> PrintNPList(Lnp); a^2b - 1 ab^2 - 1 The function IsStrongGrobner checks whether the list is a strong Gröbner basis. gap> IsStrongGrobnerBasis(Lnp); false

But the answer should be true for the result of a strong Gröbner computation: gap> IsStrongGrobnerBasis(SGrobner(Lnp)); true

A Gröbner basis that is not a strong Gröbner basis: gap> B := SGrobner(Lnp);; gap> Add(B,AddNP(Lnp[1],B[1],1,-1));; gap> PrintNPList(B); b - a a^3 - 1 a^2b - b + a - 1 gap> IsGrobnerBasis(B); true gap> IsStrongGrobnerBasis(B); false <#/GAPDoc>

<#GAPDoc Label="example-IsGrobnerBasis"> Example: Consider the following list of two polynomials in NP format. gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];; gap> PrintNPList(Lnp); a^2b - 1 ab^2 - 1 The function IsGrobner checks whether the list is a Gröbner basis. gap> IsGrobnerBasis(Lnp); false

So the answer should be true for the result of a Gröbner computation: gap> IsGrobnerBasis(Grobner(Lnp)); true

<#/GAPDoc>

<#GAPDoc Label="example-IsGrobnerPair"> Example: Consider the following four polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> q1 := [[[2],[1]],[1,-1]];; gap> q2 := [[[1,1,1],[]],[1,-1]];; The function IsGrobnerPair is used to check whether some combinations of these polynomials in two lists provide Gröbner pairs. gap> IsGrobnerPair([p1,p2,q1],[q2]); true gap> IsGrobnerPair([q1,q2],[p1,p2]); false

The function IsGrobnerPair applied with an empty list as second argument is a check whether the first argument is a Gröbner basis. gap> IsGrobnerPair([p1,p2],[]) = IsGrobnerBasis([p1,p2]); true

<#/GAPDoc>

<#GAPDoc Label="example-MakeGrobnerPair"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];;

The function MakeGrobnerPair turns the list with these two polynomials into a Gröbner pair, once the empty list is added as a second argument. The result is a record whose fields G and todo gap> GP := MakeGrobnerPair([p1,p2],[]);; gap> PrintNPList(GP.G); a^2b - 1 ab^2 - 1 gap> PrintNPList(GP.todo); b - a

These fields are ready for use in Grobner gap> GB := Grobner(GP.G,GP.todo);; gap> PrintNPList(GB); b - a a^3 - 1

<#/GAPDoc>

<#GAPDoc Label="example-StrongNormalFormNPM"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> PrintNPList([p1,p2]); a^2b - 1 ab^2 - 1

Consider also the following two vectors in NPM format. gap> v1 := [[[-1,1,2],[-1]],[1,-1]];; gap> v2 := [[[-2,2,2],[-2]],[1,-2]];; gap> PrintNPList([v1,v2]); [ ab - 1 , 0] [ 0, b^2 - 2 ]

The Gröbner basis record for this data is found by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);; gap> PrintNPList(GBR.ts); b - a a^3 - 1 gap> PrintNPList(GBR.p); [ 0, 1 ] [ a - 1 , 0]

The vector w is brought into strong normal form with respect to GBR: gap> w := [[[-1,2],[-2,1]],[1,-4]];; gap> PrintNP(w); [ b , - 4a ] gap> v := StrongNormalFormNPM(w,GBR);; gap> PrintNP(v); [ 1 , 0]

<#/GAPDoc>

<#GAPDoc Label="example-SGrobnerModule"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-2]];; gap> p2 := [[[1,2,2],[]],[1,-3]];;

Consider also the following two vectors in NPM format. gap> v1 := [[[-1,1,2],[-1]],[1,-1]];; gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;

The Gröbner basis record for this data is found by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;

The record GBR has two fields, p for prefix relations (vectors in the module) and ts for two-sided relations (polynomials in the algebra): gap> PrintNPList(GBR.p); [ 0, 1 ] [ 1 , 0] gap> PrintNPList(GBR.ts); b - 3/2a a^3 - 4/3

<#/GAPDoc>

<#GAPDoc Label="example-MulQM"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[1,2,2],[]],[1,-1]];; gap> PrintNPList([p1,p2]); a^2b - 1 ab^2 - 1

Consider also the following two vectors in NPM format. gap> v1 := [[[-1,1,2],[-1]],[1,-1]];; gap> v2 := [[[-2,2,2],[-2]],[1,-2]];; gap> PrintNPList([v1,v2]); [ ab - 1 , 0] [ 0, b^2 - 2 ]

The Gröbner basis record for this data is found by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);; gap> PrintNPList(GBR.ts); b - a a^3 - 1 gap> PrintNPList(GBR.p); [ 0, 1 ] [ a - 1 , 0]

The function MulQM computes the product of the vector w with the polynomial q. gap> w := [[[-1,2],[-2,1]],[1,-4]];; gap> PrintNP(w); [ b , - 4a ] gap> q := [[[2,2,1],[1]],[2,3]];; gap> PrintNP(q); 2b^2a + 3a gap> wq := MulQM(w,q,GBR);; gap> PrintNP(wq); [ 5 , 0]

<#/GAPDoc>

<#GAPDoc Label="example-BaseQM"> Example: Consider the following two polynomials in NP format. gap> p1 := [[[1,1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,2,1],[]],[1,-1]];;

Consider also the following two vectors in NPM format. gap> v1 := [[[-1,1,2],[-1]],[1,-1]];; gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;

The Gröbner basis record for this data is found by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);; gap> PrintNPList(GBR.ts); ba - ab b^2 - a^2 a^3b - 1 a^5 - b gap> PrintNPList(GBR.p); [ 0, 1 ] [ b - a , 0] [ a^2 - 1 , 0] [ ab - 1 , 0]

The function BaseQM computes a basis. gap> B := BaseQM(GBR,2,2,0);; gap> PrintNPList(B); [ 1 , 0] [ a , 0]

The function BaseQM with arguments so as to let the number of dimensions of the module and the number of variables be chosen minimal. gap> B := BaseQM(GBR,0,0,0);; gap> PrintNPList(B); [ 1 , 0] [ a , 0]

The function BaseQM can also be used to ompute the first three elements of a basis. gap> B := BaseQM(GBR,2,2,3);; gap> PrintNPList(B); [ 1 , 0] [ a , 0]

<#/GAPDoc>

<#GAPDoc Label="example-DimQM"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,2,1],[]],[1,-1]];;

Consider also the following two vectors in NPM format. gap> v1 := [[[-1,1,2],[-2]],[1,-1]];; gap> v2 := [[[-2,2,2],[-1]],[1,-2]];;

The Gröbner basis record for this data is found by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;

The function DimQM computes the dimension over the rationals of the quotient of the free module over the free algebra on two generators by the submodule generated by the vectors v1, v2, [p,q], where p and q run over all elements of the two-sided ideal in the free algebra generated by p1 and p2. gap> SetInfoLevel(InfoGBNP,2); gap> DimQM(GBR,2,2); 0

The answer should be equal to the size of BaseQM(GBR,t,mt,0).

gap> DimQM(GBR,2,2) = Length(BaseQM(GBR,2,2,0)); true gap> SetInfoLevel(InfoGBNP,0);
<#/GAPDoc>

<#GAPDoc Label="example-MatrixQA"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,2,1],[]],[1,-1]];;

The matrix of right multiplication by the first indeterminate a on the quotient algebra with respect to the ideal generated by p1 and p2 is obtained by applying MatrixQA to the Gröbner basis of these generators and a basis of the quotient algebra as found in : gap> GB := Grobner([p1,p2]);; gap> B := BaseQA(GB,2,0);; gap> PrintNPList(B); 1 a b a^2 ab a^3 a^2b a^4 gap> Display(MatrixQA(1, B,GB)); [ [ 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 1, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1 ], [ 1, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 1, 0, 0, 0, 0, 0 ] ]

The function is also applicable to Gröbner basis records for modules. Consider the following two vectors. gap> v1 := [[[-1,1,2],[-1]],[1,-1]];; gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;

The Gröbner basis record for this data is found by and a quotient module basis by : gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);; gap> B := BaseQM(GBR,2,2,0);;

The matrix of right multiplication by a, the first generator of the free algebra, is gap> Display(MatrixQA(1,B,GBR)); [ [ 0, 1 ], [ 1, 0 ] ]

<#/GAPDoc>

<#GAPDoc Label="example-MatricesQA"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,2,1],[]],[1,-1]];;

The function MatricesQA gives the list of matrices found by when the first argument takes the integer values between 1 and the number of all algebra generators.

gap> GB := Grobner([p1,p2]);; gap> B := BaseQA(GB,2,0);; gap> mats := MatricesQA(2,B,GB);; gap> for mat in mats do Display(mat); Print("\n"); od; [ [ 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 1, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1 ], [ 1, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 1, 0, 0, 0, 0, 0 ] ]

[ [ 0, 0, 1, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 1, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0 ], [ 1, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1 ], [ 0, 1, 0, 0, 0, 0, 0, 0 ] ]

The result is also obtainable by use of the List function: gap> MatricesQA(2,B,GB) = List([1,2], q -> MatrixQA(q,B,GB)); true

<#/GAPDoc>

<#GAPDoc Label="example-MatrixQAC"> Example:

Consider the following two polynomials in NP format. gap> F := GF(256); GF(2^8) gap> z := GeneratorsOfField(F)[1]; Z(2^8) gap> p1 := [[[1,1,1,2],[]],[z,1]];; gap> p2 := [[[2,2,2,1],[]],[1,z]];;

The polynomials p1 and p2 have coefficients in the field F of order 256. The matrix of right multiplication by the first indeterminate a on the quotient algebra is obtained by applying MatrixQAC just like . The difference is that the result is in another format. gap> GB := Grobner([p1,p2]); [ [ [ [ 1, 1, 1, 2 ], [ ] ], [ Z(2)^0, Z(2^8)^254 ] ], [ [ [ 2, 2 ], [ 1, 1 ] ], [ Z(2)^0, Z(2^8)^2 ] ], [ [ [ 2, 1 ], [ 1, 2 ] ], [ Z(2)^0, Z(2)^0 ] ], [ [ [ 1, 1, 1, 1, 1 ], [ 2 ] ], [ Z(2)^0, Z(2^8)^252 ] ] ] gap> B := BaseQA(GB,2,0); [ [ [ [ ] ], [ Z(2)^0 ] ], [ [ [ 1 ] ], [ Z(2)^0 ] ], [ [ [ 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1 ] ], [ Z(2)^0 ] ], [ [ [ 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1, 1 ] ], [ Z(2)^0 ] ] ] gap> MatrixQAC(1, B,GB); < mutable compressed matrix 8x8 over GF(256) >

<#/GAPDoc>

<#GAPDoc Label="example-MatricesQAC"> Example:

Consider the following two polynomials in NP format. gap> F := GF(256); GF(2^8) gap> z := GeneratorsOfField(F)[1]; Z(2^8) gap> p1 := [[[1,1,1,2],[]],[z,1]];; gap> p2 := [[[2,2,2,1],[]],[1,z]];;

The polynomials p1 and p2 have coefficients in the field F of order 256. The matrices of right multiplication by the indeterminates on the quotient algebra are just like for except for the format of the result. gap> GB := Grobner([p1,p2]); [ [ [ [ 1, 1, 1, 2 ], [ ] ], [ Z(2)^0, Z(2^8)^254 ] ], [ [ [ 2, 2 ], [ 1, 1 ] ], [ Z(2)^0, Z(2^8)^2 ] ], [ [ [ 2, 1 ], [ 1, 2 ] ], [ Z(2)^0, Z(2)^0 ] ], [ [ [ 1, 1, 1, 1, 1 ], [ 2 ] ], [ Z(2)^0, Z(2^8)^252 ] ] ] gap> B := BaseQA(GB,2,0); [ [ [ [ ] ], [ Z(2)^0 ] ], [ [ [ 1 ] ], [ Z(2)^0 ] ], [ [ [ 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1 ] ], [ Z(2)^0 ] ], [ [ [ 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1, 1 ] ], [ Z(2)^0 ] ] ] gap> MatricesQAC(2,B,GB); [ < mutable compressed matrix 8x8 over GF(256) >, < mutable compressed matrix 8x8 over GF(256) > ]

<#/GAPDoc>

<#GAPDoc Label="example-PreprocessAnalysisQA"> Example:

Consider the following two polynomials in NP format of which a Gröbner basis is computed. F := GF(256); z := GeneratorsOfField(F)[1]; gap> p1 := [[[1,1,1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,2,1,1,1],[]],[1,-1]];; gap> GB := Grobner([p1,p2]);; gap> PrintNPList(GB); a^4b - 1 ba - ab b^2 - a a^5 - b

Application of PreprocessAnalysisQA is carried out on the leading terms of GB, with 2, 4, 8, recursions, respectively. gap> L := LMonsNP(GB); [ [ 1, 1, 1, 1, 2 ], [ 2, 1 ], [ 2, 2 ], [ 1, 1, 1, 1, 1 ] ] gap> L1 := PreprocessAnalysisQA(L,2,2); [ [ 1, 1, 1 ], [ 2, 1 ], [ 1, 1, 2 ], [ 2, 2 ] ] gap> L2 := PreprocessAnalysisQA(L1,2,4); [ [ 1 ], [ 2 ] ]

<#/GAPDoc>

<#GAPDoc Label="example-EvalTrace"> Example:

First we compute the traced Gröbner basis of the list of the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> Lnp := [p1,p2];; gap> GBT := SGrobnerTrace(Lnp);;

In order to check that the polynomials in GBT belong to the ideal generated by p1 and p2, we evaluate the trace. For each traced polynomial p in GBT, the polynomial p.pol is equated to the evaluated expression p.trace, in which each occurrence of G(i) is replaced by Lnp[i] by use of .

gap> ForAll(GBT,q -> EvalTrace(q,Lnp) = q.pol); true
<#/GAPDoc>

<#GAPDoc Label="example-SGrobnerTrace"> Example:

For the list of the following two polynomials in NP format, a traced Gröbner basis is computed. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> GBT := SGrobnerTrace([p1,p2]); [ rec( pol := [ [ [ 2 ], [ 1 ] ], [ 1, -1 ] ], trace := [ [ [ ], 1, [ 2, 1, 1, 2 ], -1 ], [ [ 2 ], 1, [ ], -1 ], [ [ 1 ], 1, [ ], 1 ], [ [ 1, 1 ], 2, [ 1, 2 ], 1 ] ] ), rec( pol := [ [ [ 1, 1, 1 ], [ ] ], [ 1, -1 ] ], trace := [ [ [ 2 ], 1, [ 2, 1 ], 1 ], [ [ ], 1, [ 2, 1, 1 ], 1 ], [ [ ], 2, [ ], 1 ], [ [ 2, 1, 1 ], 2, [ ], -1 ], [ [ 1, 1 ], 2, [ 1 ], -1 ] ] ) ]

<#/GAPDoc>

<#GAPDoc Label="example-StrongNormalFormTraceDiff"> Example:

First we compute the traced Gröbner basis of the list of the following two polynomials in NP format. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> GBT := SGrobnerTrace([p1,p2]);;

Of the polynomial a^6 we compute its difference with the normal form. The result is printed by used of and . gap> f := [[[1,1,1,1,1,1]],[1]];; gap> sf := StrongNormalFormTraceDiff(f,GBT);; gap> PrintNP(sf.pol); a^6 - 1 gap> PrintTraceList([sf]); G(1)ba^2 + bG(1)ba + G(1)ba^5 + bG(1)ba^4 + G(2) + G(2)a^3 - a^2G( 2)a - ba^2G(2) - a^2G(2)a^4 - ba^2G(2)a^3

<#/GAPDoc>

<#GAPDoc Label="example-SGrobnerTrunc"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];; gap> p2 := [[[2,2,2],[1,1]],[1,-1]];; gap> PrintNPList([p1,p2]); ab^2a - ba^2b b^3 - a^2

These are homogeneous with respect to weights [3,2]. The degrees are 10 and 6, respectively. The Gröbner basis truncated above degree 12 of the list [p1,p2] is computed and subsequently printed as follows.

gap> PrintNPList(SGrobnerTrunc([p1,p2],12,[3,2])); ba^2 - a^2b b^3 - a^2 ab^2a - a^2b^2
<#/GAPDoc>

<#GAPDoc Label="example-CheckHomogeneousNPs"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];; gap> p2 := [[[2,2,2],[1,1]],[1,-1]];; gap> PrintNPList([p1,p2]); ab^2a - ba^2b b^3 - a^2

These are homogeneous with respect to weights [3,2]. The degrees are 10 and 6, respectively. This is checked as follows.

gap> CheckHomogeneousNPs([p1,p2],[3,2]); [ 10, 6 ]
<#/GAPDoc>

<#GAPDoc Label="example-BaseQATrunc"> Example:

Consider the truncated Gröbner basis of the following two polynomials in NP format. gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];; gap> p2 := [[[2,2,2],[1,1]],[1,-1]];; gap> wtv := [3,2];; gap> GB := SGrobnerTrunc([p1,p2],12,wtv);; gap> GBNP.ConfigPrint("a","b"); gap> PrintNPList(GB); ba^2 - a^2b b^3 - a^2 ab^2a - a^2b^2

A basis of standard monomials is found and printed as follows.

gap> BT := BaseQATrunc(GB,12,wtv);; gap> for degpart in BT do > for mon in degpart do PrintNP([[mon],[1]]); od; > od; 1 b a b^2 ba ab a^2 b^3 b^2a bab ab^2 aba a^2b b^4 a^3 b^3a b^2ab bab^2 ab^3 baba abab a^2b^2 b^5 a^2ba b^4a a^3b b^3ab b^2ab^2 bab^3 ab^4 a^4 b^2aba ab^3a babab abab^2 a^2b^3 b^6
<#/GAPDoc>

<#GAPDoc Label="example-DimsQATrunc"> Example:

Consider the truncated Gröbner basis of the following two polynomials in NP format. gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];; gap> p2 := [[[2,2,2],[1,1]],[1,-1]];; gap> wtv := [3,2];; gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;

Information on the dimensions of the homogeneous parts of the quotient algebra is found as follows,

gap> DimsQATrunc(GB,12,wtv); [ 1, 0, 1, 1, 1, 2, 2, 3, 3, 5, 4, 7, 7 ]
<#/GAPDoc>

<#GAPDoc Label="example-FreqsQATrunc"> Example:

Consider the truncated Gröbner basis of the following two polynomials in NP format. gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];; gap> p2 := [[[2,2,2],[1,1]],[1,-1]];; gap> wtv := [3,2];; gap> GB := SGrobnerTrunc([p1,p2],12,wtv);; gap> PrintNPList(GB); ba^2 - a^2b b^3 - a^2 ab^2a - a^2b^2

The multiplicities of the frequencies of of monomials in a standard basis of the quotient algebra with respect to the ideal generated by GB is found as follows, for weights up to and including 8.

gap> F := FreqsQATrunc(GB,8,wtv); [ [ [ [ ], 1 ] ], [ [ [ 0, 1 ], 1 ] ], [ [ [ 1, 0 ], 1 ] ], [ [ [ 0, 2 ], 1 ] ], [ [ [ 1, 1 ], 2 ] ], [ [ [ 2, 0 ], 1 ], [ [ 0, 3 ], 1 ] ], [ [ [ 1, 2 ], 3 ] ], [ [ [ 2, 1 ], 2 ], [ [ 0, 4 ], 1 ] ] ]

The interpretation of this data is given by the following lines of code.

gap> for f in F do > if f[1][1] <> [] then > Print("At level ", wtv * (f[1][1]), " the multiplicities are\n"); > for x in f do > Print(" for ",x[1],": ",x[2],"\n"); > od; > else > Print("At level ", 0 , " the multiplicity of [] is ",f[1][2],"\n"); > fi; > Print("\n"); > od; At level 0 the multiplicity of [] is 1

At level 2 the multiplicities are for [ 0, 1 ]: 1

At level 3 the multiplicities are for [ 1, 0 ]: 1

At level 4 the multiplicities are for [ 0, 2 ]: 1

At level 5 the multiplicities are for [ 1, 1 ]: 2

At level 6 the multiplicities are for [ 2, 0 ]: 1 for [ 0, 3 ]: 1

At level 7 the multiplicities are for [ 1, 2 ]: 3

At level 8 the multiplicities are for [ 2, 1 ]: 2 for [ 0, 4 ]: 1

<#/GAPDoc>

<#GAPDoc Label="example-PrintTraceList"> Example:

First we compute the traced Gröbner basis of the list of two polynomials in NP format and next we print it by use of PrintTraceList. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> GBT := SGrobnerTrace([p1,p2]);; gap> PrintTraceList(GBT); aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2) <#/GAPDoc>

<#GAPDoc Label="example-PrintTracePol"> Example:

First we compute the traced Gröbner basis of the list of two polynomials in NP format. Next we print the trace polynomial of the members of the list by use of PrintTracePol. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> GBT := SGrobnerTrace([p1,p2]);; gap> for np in GBT do PrintTracePol(np); Print("\n"); od; aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2) <#/GAPDoc>

<#GAPDoc Label="example-PrintNPListTrace"> Example:

First we compute the traced Gröbner basis of the list of two polynomials in NP format. Next we print the polynomials found by use of PrintNPListTrace. gap> p1 := [[[1,1,2],[]],[1,-1]];; gap> p2 := [[[2,2,1],[]],[1,-1]];; gap> GBT := SGrobnerTrace([p1,p2]);; gap> PrintNPListTrace(GBT); b - a a^3 - 1 <#/GAPDoc>

<#GAPDoc Label="example-DetermineGrowthQA"> Example:

For the list of monomials consisting of a single variable in a free algebra generated by two variables the growth is clearly polynomial of degree 1. This is verified by invoking DetermineGrowthQA with arguments [[1]] (the list of the single monomial consisting of the first variable), the number of generators of the free algebra to which the monomials belong (which is 2 here), and the boolean true indicating that we wish a precise degree in case of polynomial growth.

gap> DetermineGrowthQA([[1]],2,true); 1

Here is an example of polynomial growth of degree 2:

gap> L := [[1,2,1],[2,2,1]]; [ [ 1, 2, 1 ], [ 2, 2, 1 ] ] gap> DetermineGrowthQA(L,2,true); 2

In order to show how to apply the function to arbitrary polynomials, consider the following two polynomials in NP format.

gap> F := GF(256); GF(2^8) gap> z := GeneratorsOfField(F)[1]; Z(2^8) gap> p1 := [[[1,1,1,2],[]],[z,1]];; gap> p2 := [[[2,2,2,1],[]],[1,z]];;

The polynomials p1 and p2 have coefficients in the field F of order 256.

In order to study the growth of the quotient algebra we first compute the list of leading monomials of the Gröbner basis elements and next apply DetermineGrowthQA.

gap> GB := Grobner([p1,p2]);; gap> L := LMonsNP(GB);; gap> for lm in L do PrintNP( [ [ lm ], [ 1 ] ] ); od; a^3b b^2 ba a^5 gap> DetermineGrowthQA(L,2,true); 0
<#/GAPDoc>

<#GAPDoc Label="example-FinCheckQA"> Example:

Consider the following list L of two monomials. gap> L := [[1,2,1],[2,2,1]];;

Finiteness of the dimension of the quotient algebra of the free algebra by the ideal generated by these two monomials can be decided by means of FinCheckQA. Its arguments are L and the number of generators of the free algebra in which the monomials reside.

gap> FinCheckQA(L,2); false

This example turns out to be infinite dimensional. Here is a finite-dimensional example.

gap> FinCheckQA([[1],[2,2]],2); true
<#/GAPDoc>

<#GAPDoc Label="example-HilbertSeriesQA"> Example:

Consider the following list L of two monomials. gap> L := [[1,2,1],[2,2,1]];;

Finiteness of the dimension of the quotient algebra of the free algebra by the ideal generated by these two monomials can be decided by means of FinCheckQA. Its arguments are L and the number of generators of the free algebra in which the monomials reside.

gap> HilbertSeriesQA(L,2,10); [ 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ]

This indicates that the growth may be polynomial. can be used to check this.

<#/GAPDoc>

reset printing; note not inside a GAPDoc part here gap> GBNP.ConfigPrint();

<#GAPDoc Label="example-NumAlgGensNP"> Example:

Consider the following polynomial in NP format. gap> np := [[[2,2,2,1,1,1],[4],[3,2,3]],[1,-3,2]];; gap> PrintNP(np); b^3a^3 - 3d + 2cbc gap> NumAlgGensNP(np); 4 <#/GAPDoc>

<#GAPDoc Label="example-NumAlgGensNPList"> Example:

Consider the following two polynomials in NP format. gap> p1 := [[[1,1,2,3,1],[2],[1]],[1,-2,1]];; gap> p2 := [[[2,2,1,4,3],[]],[1,-1]];; gap> PrintNPList([p1,p2]); a^2bca - 2b + a b^2adc - 1 gap> NumAlgGensNPList([p1,p2]); 4 <#/GAPDoc>

<#GAPDoc Label="example-NumModGensNP"> Example:

Consider the following polynomial in NPM format. gap> np := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];; gap> PrintNP(np); [ abca + 1 , - 2 ] gap> NumModGensNP(np); 2 <#/GAPDoc>

<#GAPDoc Label="example-NumModGensNPList"> Example:

Consider the following two polynomials in NPM format. gap> v1 := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];; gap> v2 := [[[-2,2,1,4,3],[-3]],[1,-1]];; gap> PrintNPList([v1,v2]); [ abca + 1 , - 2 ] [ 0, badc , - 1 ] gap> NumModGensNPList([v1,v2]); 3 <#/GAPDoc>