1% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
2\documentclass[a4paper,11pt]{report}
3
4\usepackage{a4wide}
5\sloppy
6\pagestyle{myheadings}
7\usepackage{amssymb}
8\usepackage[latin1]{inputenc}
9\usepackage{makeidx}
10\makeindex
11\usepackage{color}
12\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
13\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
14\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
15\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
16\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
17\definecolor{Black}{rgb}{0.0,0.0,0.0}
18
19\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
20\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
21\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
22\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
23\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
24\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
25\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
26\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}
27
28%%  for a long time these were red and blue by default,
29%%  now black, but keep variables to overwrite
30\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
31%% strange name because of pdflatex bug:
32\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
33\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}
34
35
36\usepackage{fancyvrb}
37
38\usepackage{mathptmx,helvet}
39\usepackage[T1]{fontenc}
40\usepackage{textcomp}
41
42
43\usepackage[
44            pdftex=true,
45            bookmarks=true,
46            a4paper=true,
47            pdftitle={Written with GAPDoc},
48            pdfcreator={LaTeX with hyperref package / GAPDoc},
49            colorlinks=true,
50            backref=page,
51            breaklinks=true,
52            linkcolor=linkColor,
53            citecolor=citeColor,
54            filecolor=fileColor,
55            urlcolor=urlColor,
56            pdfpagemode={UseNone},
57           ]{hyperref}
58
59\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}
60
61% write page numbers to a .pnr log file for online help
62\newwrite\pagenrlog
63\immediate\openout\pagenrlog =\jobname.pnr
64\immediate\write\pagenrlog{PAGENRS := [}
65\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
66%% were never documented, give conflicts with some additional packages
67
68\newcommand{\GAP}{\textsf{GAP}}
69
70%% nicer description environments, allows long labels
71\usepackage{enumitem}
72\setdescription{style=nextline}
73
74%% depth of toc
75\setcounter{tocdepth}{1}
76
77
78
79
80
81%% command for ColorPrompt style examples
82\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
83\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
84\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}
85
86
87\begin{document}
88
89\logpage{[ 0, 0, 0 ]}
90\begin{titlepage}
91\mbox{}\vfill
92
93\begin{center}{\maintitlesize \textbf{Documentation on the \textsf{GBNP} package\mbox{}}}\\
94\vfill
95
96\hypersetup{pdftitle=Documentation on the \textsf{GBNP} package}
97\markright{\scriptsize \mbox{}\hfill Documentation on the \textsf{GBNP} package \hfill\mbox{}}
98{\Huge Version 1.0.3\mbox{}}\\[1cm]
99{8 March 2016\mbox{}}\\[1cm]
100\mbox{}\\[2cm]
101{\Large \textbf{Arjeh M. Cohen \mbox{}}}\\
102{\Large \textbf{Jan Willem Knopper \mbox{}}}\\
103\hypersetup{pdfauthor=Arjeh M. Cohen ; Jan Willem Knopper }
104\end{center}\vfill
105
106\mbox{}\\
107{\mbox{}\\
108\small \noindent \textbf{Arjeh M. Cohen }  Email: \href{mailto://A.M.Cohen@tue.nl} {\texttt{A.M.Cohen@tue.nl}}}\\
109{\mbox{}\\
110\small \noindent \textbf{Jan Willem Knopper }  Email: \href{mailto://J.W.Knopper@tue.nl} {\texttt{J.W.Knopper@tue.nl}}}\\
111
112\noindent \textbf{Address: }\begin{minipage}[t]{8cm}\noindent
113TU/e,\\
114 POB 513, 5600 MB Eindhoven, the Netherlands \end{minipage}
115\end{titlepage}
116
117\newpage\setcounter{page}{2}
118{\small
119\section*{Abstract}
120\logpage{[ 0, 0, 1 ]}
121 We provide algorithms, written in the \textsf{GAP} 4 programming language, for computing Gr{\"o}bner bases of non-commutative
122polynomials, and some variations, such as a weighted and truncated version and
123a tracing facility. In addition, there are algorithms for analyzing the
124quotient of a non-commutative polynomial algebra by a 2-sided ideal generated
125by a set of polynomials whose Gr{\"o}bner basis has been determined and for
126computing quotient modules of free modules over quotient algebras.
127
128 The notion of algorithm is interpreted loosely: in general one cannot expect a
129non-commutative Gr{\"o}bner basis algorithm to terminate, as it would imply
130solvability of the word problem for finitely presented (semi)groups.
131
132 This documentation gives a short description of the mathematical content,
133explains the functions of the package, and provides more than twenty worked
134out examples. \mbox{}}\\[1cm]
135{\small
136\section*{Acknowledgements}
137\logpage{[ 0, 0, 2 ]}
138
139\begin{itemize}
140\item The package is based on an earlier version by Rosane Ushirobira.
141\item The bulk of the package is written by Arjeh M. Cohen and Di{\a'e} A.H.
142Gijsbers.
143\item The theory is mainly taken from literature by Teo Mora \cite{TCS::Mora1994:131} and Edward L. Green \cite{Green1997}.
144\item From Version 0.8.3 on the package has three additional files (\texttt{fincheck.g}, \texttt{tree.g} \texttt{graphs.g}) with routines for finding the Hilbert function and testing finite
145dimensionality when given a Gr{\"o}bner basis by Chris Krook \cite{Krook2003}, based on work by Victor Ufnarovski \cite{MR91d:16053}.
146\item From Version 0.9 on the package is enriched with support for fields
147implemented in GAP and additional prefix rules for quotient modules, as well
148as some speed improvements by Jan Willem Knopper. Knopper has also formatted
149the documentation in GAPDoc \cite{GAPDoc}.
150\item From Version 1.0 on the package is extended with NMO (for Noncommutative
151Monomial Orderings) by Randall Cone. This enables the GBNP user to choose a
152wider selection of monomial orderings than the standard one built into GBNP
153itself. Documentation on NMO can be found in the NMO manual \cite{NMODoc}.
154\end{itemize}
155 {\nobreakspace}  \mbox{}}\\[1cm]
156\newpage
157
158\def\contentsname{Contents\logpage{[ 0, 0, 3 ]}}
159
160\tableofcontents
161\newpage
162
163
164\chapter{\textcolor{Chapter }{Introduction}}\logpage{[ 1, 0, 0 ]}
165\hyperdef{L}{X7DFB63A97E67C0A1}{}
166{
167 This package, named GBNP for Gr{\"o}bner Bases for Non-commutative
168Polynomials, is intended for computing in (associative) non-commutative
169algebras with a finite presentation. Starting from a free algebra $A$ on a finite number of generating variables, the reader can specify a finite
170set $G$ of polynomials in these variables, in order to study the quotient algebra of $A$ by the (2-sided) ideal of $A$ generated by $G$.
171
172 This documentation gives a short description of the mathematical content in
173Chapter \ref{Description}, explains the functions of the package in Chapter \ref{Functions}, and provides more than twenty four worked out examples in Appendix \ref{Examples}. It is available as an HTML document at \href{http://mathdox.org/products/gbnp/} {\texttt{http://mathdox.org/products/gbnp/}} and as an pdf document at \href{http://mathdox.org/products/gbnp/manual.pdf} {\texttt{http://mathdox.org/products/gbnp/manual.pdf}}.
174\section{\textcolor{Chapter }{Installation}}\logpage{[ 1, 1, 0 ]}
175\hyperdef{L}{X8360C04082558A12}{}
176{
177 To install GBNP, first download it from \href{http://mathdox.org/products/gbnp/GBNP-1.0.3.tar.gz} {\texttt{http://mathdox.org/products/gbnp/GBNP-1.0.3.tar.gz}}, then unpack \texttt{GBNP-1.0.3.tar.gz} in the \texttt{pkg} subdirectory of your \textsf{GAP} installation (or in the \texttt{pkg} subdirectory of any other \textsf{GAP} root directory, for example one added with the \texttt{-l} argument) with the following command: \texttt{tar -xvzf GBNP-1.0.3.tar.gz}.
178
179 GBNP is then loaded with the GAP command
180\begin{Verbatim}[fontsize=\small,frame=single,label=]
181  gap> LoadPackage( "GBNP" );
182\end{Verbatim}
183
184
185 Those who want to download this documentation can find it at \href{http://mathdox.org/products/gbnp/GBNPdoc-1.0.3.tar.gz} {\texttt{http://mathdox.org/products/gbnp/GBNPdoc-1.0.3.tar.gz}} and extract it with \texttt{tar -xvzf GBNPdoc-1.0.3.tar.gz}. It is also included in the package. }
186
187
188\section{\textcolor{Chapter }{Using the package}}\label{intro}
189\logpage{[ 1, 2, 0 ]}
190\hyperdef{L}{X78629CD778BE8C5D}{}
191{
192 If you wish to compute a Gr{\"o}bner basis, create a list of NPs
193(non-commutative polynomials in NP format), as described in Section \ref{NP}. This can be done either directly or by use of the transition functions
194described in Section \ref{TransitionFunctions}. To run the standard algorithm use the functions from Section \ref{grobner}. With these functions, you can try and find a Gr{\"o}bner basis. The word try
195is included because the algorithm for computing Gr{\"o}bner bases is not
196guaranteed to terminate. Printing issues for polynomials in NP format are
197discussed in Section \ref{printing}. If the Gr{\"o}bner basis is found and the dimension of the quotient algebra $Q$ (see Section \ref{QuotientAlgs}) is finite, you can find a basis of monomials for $Q$ with the functions in Section \ref{QA}. For a more advanced analysis of $Q$, such as a proof of finite or infinite dimensionality, or for determining its
198growth or its partial Hilbert series, use the functions from Section \ref{finiteness} .
199
200 There are three variants of the Gr{\"o}bner basis algorithm, the truncated
201version, the trace version, and the module version. In the (weighted)
202homogeneous case (described in Section \ref{trunc}), the truncated version, given by the functions described in Section \ref{truncfun},  computes the part of a Gr{\"o}bner basis up to an indicated weight. The trace
203version (described in Section \ref{trace}), given by the functions described in Section \ref{tracefun},  computes an expression of the polynomials of the Gr{\"o}bner basis found in
204terms of the original generators. The module version (described in Sections \ref{NPM}, \ref{PrefixRels}, and \ref{GBR}), given by the functions described in Section \ref{NPMs},  computes a Gr{\"o}bner basis for a submodule of a free $Q$-module of finite rank.
205
206 Read the example files in Chapter \ref{Examples} for inspiration. The source of the files can be perused for auxiliary
207functions, which are often used in the main functions but not deemed necessary
208for a first time user. }
209
210
211\section{\textcolor{Chapter }{Further documentation}}\logpage{[ 1, 3, 0 ]}
212\hyperdef{L}{X7DDEF24284C861D8}{}
213{
214 The reports \cite{CohenGijsbersEtAl2007}, \cite{Krook2003}, and \cite{Knopper2004} can be downloaded from the web at these addresses:
215
216 The report ``Non-commutative polynomial computations'', by Arjeh M. Cohen (with support of Di{\a'e} Gijsbers, Jan Willem Knopper,
217and Chris Krook) can be downloaded from \href{http://mathdox.org/products/gbnp/gbnp.pdf} {\texttt{http://mathdox.org/products/gbnp/gbnp.pdf}}.
218
219 The report ``Dimensionality of quotient algebras'', by Chris Krook can be downloaded from \href{http://mathdox.org/products/gbnp/dqa.pdf} {\texttt{http://mathdox.org/products/gbnp/dqa.pdf}}.
220
221 The report ``GBNP and vector enumeration'', by Jan Willem Knopper can be downloaded from \href{http://mathdox.org/products/gbnp/knopper.pdf} {\texttt{http://mathdox.org/products/gbnp/knopper.pdf}}. }
222
223 }
224
225
226\chapter{\textcolor{Chapter }{Description}}\label{Description}
227\logpage{[ 2, 0, 0 ]}
228\hyperdef{L}{X7BBCB13F82ACC213}{}
229{
230
231\section{\textcolor{Chapter }{Non-commutative Polynomials (NPs)}}\label{NP}
232\logpage{[ 2, 1, 0 ]}
233\hyperdef{L}{X7FDF3E5E7F33D3A2}{}
234{
235 The main datatype of the GBNP package is a list of non-commutative polynomials
236(NPs). The data type for a \emph{non-commutative polynomial}, referred to as its NP format, is a list of two lists:
237\begin{itemize}
238\item The first list is a list \texttt{m} of monomials.
239\item The second list is a list \texttt{c} of coefficients of these monomials.
240\end{itemize}
241 The two lists have the same length. The polynomial represented by the ordered
242pair \texttt{[m,c]} is $\sum_i c_i m_i$.
243
244 A monomial is a list of positive integers. They are interpreted as the indices
245of the variables. So, if \texttt{k = [1,2,3,2,1]} and the variables are $x$,$y$,$z$ (in this order), then \texttt{k} represents the monomial $xyzyx$. By the way, the name of the variables has no meaning. There are various ways
246to print these but the default is $a$,$b$,$c$,$\ldots$ (see below).
247
248 The zero polynomial is represented by \texttt{[[],[]]}. The polynomial 1 is represented by \texttt{[[[]],[1]]}.
249
250 The algorithms work for the algebra $\mathbb F\langle\langle x_1,x_2,\ldots,x_t\rangle\rangle$ of non-commutative polynomials in \mbox{\texttt{\mdseries\slshape t}} variables over the field $\mathbb F$. Accordingly, the list \texttt{c} should contain elements of $\mathbb F$. It is not always easy to recover $\mathbb F$ from the list \texttt{c}. The GAP functions \texttt{One} and \texttt{Zero} can be of some help.
251
252 In order to facilitate viewing the polynomials, we provide the function \texttt{PrintNP} (\ref{PrintNP}). For instance
253\begin{Verbatim}[fontsize=\small,frame=single,label=]
254  PrintNP([[[1,2],[2,1]],[3,-1]]);
255\end{Verbatim}
256 yields
257\begin{Verbatim}[fontsize=\small,frame=single,label=]
258  3ab - ba
259\end{Verbatim}
260 Indeed, we have the names: \texttt{a}, \texttt{b}, \texttt{c}, $\ldots$ for $x_1$, $x_2$, $x_3$, $\ldots$, except that everything beyond $l$ (the 12-th letter) is called $x$. This can be easily changed by calling the function \texttt{GBNP.ConfigPrint}, which can be found in Section \ref{printing}.
261
262 The function \texttt{PrintNPList} (\ref{PrintNPList}) is available for printing a list of NPs (=non-commutative polynomials).
263
264 In order to facilitate testing whether two data structures represent the same
265NP, we use the convention that polynomials are ``clean''. This means that they look as if they are output of the function \texttt{CleanNP} (\ref{CleanNP}). In other words:
266\begin{itemize}
267\item each monomial occurs at most once in the list of monomials,
268\item no monomials occur whose coefficients are zero,
269\item the monomials are ordered (total degree first, then lexicographically) from
270big to small.
271\end{itemize}
272 An advantage of the ordering is that the leading monomial of an NP \texttt{p} is just \texttt{p[1][1]} and that its leading coefficient is \texttt{p[2][1]}. Users who want to work with other orderings can use the functions defined in
273the NMO extension \cite{NMODoc} to GBNP. }
274
275
276\section{\textcolor{Chapter }{Non-commutative Polynomials for Modules (NPMs)}}\label{NPM}
277\logpage{[ 2, 2, 0 ]}
278\hyperdef{L}{X7B27E2D1784538DE}{}
279{
280 In Section \ref{NP} the NP format for elements of a free algebra $A$ of non-commutative polynomials in a fixed number of variables is described.
281This format can be adjusted slightly to allow the use of a free right module $A^n$ of finite rank $n$ over $A$. The internal format of an element of the module is similar to that of a
282non-commutative polynomial. The only change is that each monomial will start
283with a negative number. The absolute value of this number is the index of the
284standard basis vector of the free module.
285
286 For example in the free $\mathbb F\langle\langle x_1, x_2,\ldots, x_t\rangle\rangle$-module of rank 3, the expression \texttt{[[[-1]],[1]]} represents $[1,0,0]$ and \texttt{[[[-1,1,2],[-1,2,1],[-3,2,2,2]],[6,-7,9]]} represents $[6x_1x_2-7x_2x_1,0,9x_2^3]$. The zero vector is the represented in the same way as its NP format
287counterpart in \ref{NP} and the only one without a negative entry: \texttt{[[],[]]}. We refer to this format as the NPM format.
288
289 Elements of modules are printed as vectors. See Section \ref{NPMs} on how to use modules. Examples \ref{Example20}, \ref{Example21}, and \ref{Example04} are also recommended. }
290
291
292\section{\textcolor{Chapter }{Core functions}}\logpage{[ 2, 3, 0 ]}
293\hyperdef{L}{X84BD98F5811EAC45}{}
294{
295 The core function is \texttt{SGrobner} (\ref{SGrobner}) (which is short for Strong Gr{\"o}bner, as we use the Strong Normal Form,
296discussed in Section \texttt{StrongNormalFormNPM} (\ref{StrongNormalFormNPM}), most of the time). It takes a list of NPs in a free algebra $A$ and prepares two lists for treatment in a loop:
297\begin{itemize}
298\item  First the list itself, called \texttt{G}. Before entering the loop, \texttt{G} is cleaned, ordered, and its elements are made monic, that is, multiplied by a
299scalar so that the leading coefficient becomes one. The ordering is done by
300comparison of leading monomials. The ordering on leading monomials is length
301lexicographic. For other orderings, the functions of the NMO extension can be
302used; see \cite{NMODoc}.
303\item Second the list of all normal forms with respect to \texttt{G} of S-polynomials of elements of \texttt{G}. This list is called \texttt{D}. For a Gr{\"o}bner basis, the S-polynomials of polynomials in \texttt{D} (possibly with an element of \texttt{G}) need to be computed. If \texttt{D} is empty then \texttt{G} is a Gr{\"o}bner basis.
304\end{itemize}
305 Then, the function calls the routine \texttt{GBNP.SGrobnerLoop} on the arguments \texttt{G}, \texttt{D} which are changed in an attempt to modify \texttt{G} while still preserving the following two properties.
306\begin{enumerate}
307\item \texttt{G} generates the same two-sided ideal $I$ in $A$ as before.
308\item \texttt{D} contains all normal forms with respect to \texttt{G} of S-polynomials of elements from \texttt{G} that need to reduce to zero for the basis to be a Gr{\"o}bner basis.
309\end{enumerate}
310 The importance of this feature is that, in case of huge computations, the user
311may store \texttt{G} and \texttt{D} at almost any time and resume the computation by reloading \texttt{G} and \texttt{D} and calling the loop function \texttt{GBNP.SGrobnerLoop} whenever convenient. The only technical detail to handle is that the last
312element of the list \texttt{G} should be copied into the \texttt{D} list. The loop itself performs a step towards making \texttt{G} more like a Gr{\"o}bner basis of $I$. As in the commutative case, the progress can be indicated by use of an
313ordering on the set of leading monomials of the elements of \texttt{G}.
314
315 In contrast to the commutative case, however, this ordering is not well
316founded, and there is no a priori guarantee that the loop will be exited after
317a finite number of iterations. The loop ends when the list \texttt{D} is empty, in which case the work is essentially done: after some internal
318cleaning and a bit of further rewriting, the computation is over.
319
320 There is also a \texttt{Grobner} (\ref{Grobner}) function. It uses (at some places) the Normal Form instead of the Strong
321Normal Form algorithm. In most of our applications, this usually led to slower
322performance, so we are not very keen to use it.
323
324 In many of our own applications, the full polynomial ring modulo the two-sided
325ideal $I$ generated by \texttt{G} is a finite-dimensional quotient algebra. In such cases, one would like to
326know the dimension (whence the function \texttt{DimQA} (\ref{DimQA}), QA for Quotient Algebra), find a basis (whence the function \texttt{BaseQA} (\ref{BaseQA})), or just the monomials up to a certain degree that are not divisible by a
327leading term of \texttt{G} (whence the function \texttt{GBNP.NondivMons}). Actually by use of \texttt{MulQA} (\ref{MulQA}), you can even multiply elements of the quotient algebra. In case it is
328unknown whether the quotient algebra is finite or infinite, one can use the
329functions \texttt{FinCheckQA} (\ref{FinCheckQA}) and \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}). When the quotient algebra is infinite dimensional you may want to determine
330its partial Hilbert Series. This can be done with the function \texttt{HilbertSeriesQA} (\ref{HilbertSeriesQA}). }
331
332
333\section{\textcolor{Chapter }{About the implementation}}\logpage{[ 2, 4, 0 ]}
334\hyperdef{L}{X7EEE260680A64013}{}
335{
336 Rather than storing all obstructions, the Gr{\"o}bner basis algorithm computes
337the (Strong) Normal Form of obstructions from \texttt{G} and puts them into \texttt{D} whenever nonzero. At the beginning of the loop, we take the first element of
338the \texttt{D} list and prepare it for addition to \texttt{G}. We are then concerned with two goals:
339\begin{enumerate}
340\item to restore the invariant properties,
341\item to clean up G (that is, reduce it to a more succinct, shorter set).
342\end{enumerate}
343 This is mainly done by means of additional S-polynomial and Normal Form
344computations.
345
346 As for data management, we have chosen to work with lists in situ, that is,
347not to copy the list but rather perform all operations on one and the same
348list. To this end we use operations like \texttt{RemoveElmList} and \texttt{Add}, see  \textbf{Reference: Add}. The idea here is to economize on space for large computations. We do not use
349in situ operations everywhere, but have concentrated on the potentially
350biggest lists: \texttt{G} and \texttt{D}.
351
352 For checking whether a monomial can be reduced, an internal tree structure is
353used. }
354
355
356\section{\textcolor{Chapter }{Tracing variant}}\label{trace}
357\logpage{[ 2, 5, 0 ]}
358\hyperdef{L}{X8739B6547BC89505}{}
359{
360 When computing with small examples, it may be handy to provide the elements of
361the Gr{\"o}bner basis with a way of expressing them as elements in \texttt{I}, that is, as combinations of elements of the input. This can be done, not
362only for elements of \texttt{G}, but for any element, by the functions in the file \texttt{trace.g}. This file calls the file \texttt{nparith.g} for arithmetic keeping track of the expressions of polynomials as combinations
363of elements from the original basis. With respect to a given input basis \texttt{B}, a polynomial \texttt{p} in the traced version is a record, called the traced polynomial, with two
364fields. One field, denoted \texttt{p.pol}, is the usual polynomial in NP format. The other, denoted \texttt{p.trace}, is a list of elements indexed by \texttt{B}. Each element of \texttt{p.trace} is a list whose elements are four-tuples \texttt{[ml,i,mr,c]} where \texttt{ml} and \texttt{mr} are monomials, \texttt{i} is an index of an element of \texttt{B} and \texttt{c} is a scalar. The interpretation of this data structure is that \texttt{p.pol} can be written as the sum over all four-tuples \texttt{[ml,i,mr,c]} of $c*ml*B_i*mr$. Functions for printing these expressions in a human understandable way are
365described in Section \ref{tracefun}. }
366
367
368\section{\textcolor{Chapter }{Truncation variant}}\label{trunc}
369\logpage{[ 2, 6, 0 ]}
370\hyperdef{L}{X78CF5C44879D34B6}{}
371{
372 For computations with large and/or infinite examples, it may be convenient to
373truncate everything above a certain degree. In fact, we encountered various
374examples where the polynomials are (weighted) homogeneous and then it makes
375perfect sense to truncate the polynomials, that is, to disregard everything
376above a certain degree. For then the Grobner basis, if it exists, will be also
377be homogeneous and the part consisting of all of its polynomials of degree
378less than a given degree $d$ is equal to the Grobner basis of the join of the original list of polynomials
379with all monomials of degree $d+1$. Here an NP polynomial in $n$ variables is called homogeneous of degree $d$ with respect to $v$, a vector with non-negative integers of length $n$, if, for each of its monomials $[t_1,...,t_k]$, the sum over all $v_{t_i}$ is equal to $d$. The most classical choice for $v$ is the all-one vector in which case one often speaks of homogeneous without
380mentioning the all-one vector. If two polynomials are homogeneous with respect
381to $v$, then so are their S-polynomials. If $K$ is a list of homogeneous polynomials with respect to $v$, then the normal form with respect to $K$ of any homogeneous polynomial of degree $d$ with respect to $v$ is again homogeneous of degree $d$ with respect to $v$. In particular, the Gr{\"o}bner basis of a list of polynomials that are
382homogeneous with respect to $v$, consists of homogeneous polynomials, and those input polynomials
383contributing to polynomials in the Gr{\"o}bner basis of degree at most $d$ have degree at most $d$ themselves. These facts enable the computation of the truncated Gr{\"o}bner
384basis. The functions of this variant can be found in Section \ref{truncfun}. }
385
386
387\section{\textcolor{Chapter }{Module variant}}\label{PrefixRels}
388\logpage{[ 2, 7, 0 ]}
389\hyperdef{L}{X86F1F4EE7D4D06B7}{}
390{
391  Suppose we are given a finite set $G$ of polynomials in a free non-commutative algebra $A$ generated by, say $t$ indeterminates, and a positive integer $s$. Denote by $I$ the two-sided ideal of $A$ generated by $G$. We can work with the free right $A/I$ module $(A/I)^s$. See Section \ref{NPM} on how to represent vectors of $(A/I)^s$ by elements of the free module $A^s$. Given a subset $W$ of $A^s$, whose elements are called prefix relations, let $W'$ be the submodule generated by the image of $W$ in $(A/I)^s$. The function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is meant to determine the quotient module $(A/I)^s/W'$. If the algorithm terminates, it delivers a Gr{\"o}bner basis for $I$ as well as a suitable set of generators for $W'$, with Gr{\"o}bner like properties. This implies that \texttt{StrongNormalFormNPM} (\ref{StrongNormalFormNPM}), a strong normal form computation, can be used to find the canonical
392representative in $A^s$ of an element in $(A/I)^s/W'$. Theoretic details can be found in \cite{CohenGijsbersEtAl2007}. If $(A/I)^s/W'$ is a finite-dimensional vector space over the coefficient field of $A$, then a basis can be found by use of \texttt{BaseQM} (\ref{BaseQM}) and its dimension can be computed by use of \texttt{DimQM} (\ref{DimQM}). }
393
394
395\section{\textcolor{Chapter }{Gr{\"o}bner basis records}}\label{GBR}
396\logpage{[ 2, 8, 0 ]}
397\hyperdef{L}{X80DAE0A97CFC95DD}{}
398{
399 The function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) calculates a Gr{\"o}bner basis consisting of some two-sided relations in the
400algebra and some prefix or module relations in the vector space. These are
401returned in a record \texttt{GBR}. The two-sided relations can be found under the name \texttt{GBR.ts} and the prefix relations under the name \texttt{GBR.p}. Some other information is stored in this record as well.
402
403 The prefix conditions are in NPM format (see \ref{NPM}) and the two-sided relations are in NP format. }
404
405
406\section{\textcolor{Chapter }{Quotient algebras}}\label{QuotientAlgs}
407\logpage{[ 2, 9, 0 ]}
408\hyperdef{L}{X85A91A467FF1DE45}{}
409{
410 Once a Gr{\"o}bner basis of a list $G$ of polynomials in NP format, defining elements of a free algebra $A$, is computed, the quotient algebra $QA$ of $A$ by the two-sided ideal generated by $G$ (or, which amounts to the same, the Gr{\"o}bner basis) can be analyzed. A
411number of functions are available to determine whether $QA$ is finite dimensional or not.
412
413 Elements of $QA$ are represented by elements of $A$. Two elements are equal if and only if their strong normal forms coincide;
414see \texttt{StrongNormalFormNP} (\ref{StrongNormalFormNP}). The multiplication is take care of by \texttt{MulQA} (\ref{MulQA}), which is little more than the strong normal form of the product of two
415polynomials in NP format representing elements of $QA$.
416
417 If $QA$ is finite dimensional, a basis of it over the field can be found by \texttt{BaseQA} (\ref{BaseQA}). The size of the base, in other words, the dimension of $QA$, can be computed with \texttt{DimQA} (\ref{DimQA}). Right multiplication by an element of $QA$ is a linear transformation. The matrix of this linear transformation with
418respect to the base, in case the element belongs to the base, can be computed
419by \texttt{MatrixQA} (\ref{MatrixQA}) or, for all basis elements, \texttt{MatricesQA} (\ref{MatricesQA}).
420
421 A list of leading terms of the Gr{\"o}bner basis $G$ can be constructed with \texttt{LMonsNP} (\ref{LMonsNP}). The dimension of $QA$ only depends on this list and is computationally easier to work with than $G$. Most functions designed to analyze dimensionality work with a monomial ideal
422generated by a strong Gr{\"o}bner basis, which in this case means that no
423element divides any other element.
424
425 The function \texttt{FinCheckQA} (\ref{FinCheckQA}) determines whether $QA$ is finite or infinite dimensional. More generally, the growth of $QA$ can be determined by means of the function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}), which either returns the information that $QA$ is finite dimensional, or that $QA$ has polynomial growth, in which case it gives bounds for the degree of
426polynomial growth, or that $QA$ has exponential growth. Finally, with the function \texttt{HilbertSeriesQA} (\ref{HilbertSeriesQA}) one can compute coefficients of the Hilbert series.
427
428 The purpose of the functions \texttt{FinCheckQA} (\ref{FinCheckQA}) and \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) are closely related. The former is faster, while the latter provides more
429information, as illustrated from the following table.
430
431 \begin{center}
432\begin{tabular}{|l|l|l|}\hline
433{\nobreakspace}&
434\texttt{FinCheckQA}&
435\texttt{DetermineGrowthQA}\\
436\hline
437finite&
438\texttt{true}&
439\texttt{0}\\
440polynomial growth&
441\texttt{false}&
442\texttt{d} or \texttt{[d1,d2]}\\
443exponential growth&
444\texttt{false}&
445\texttt{"exponential growth"}\\
446\hline
447\end{tabular}\\[2mm]
448\textbf{Table: }dimensionality functions; \texttt{d} stands for degree, \texttt{[d1,d2]} for an interval containing the degree\end{center}
449
450 The function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) may find the exact degree of polynomial growth (if at hand). If this is the
451case, that degree is returned. It may also happen that only an interval \texttt{[d1,d2]} is returned in which the dimension lies. To force an exact answer, its third
452argument should be \texttt{true}.
453
454 With the function \texttt{PreprocessAnalysisQA} (\ref{PreprocessAnalysisQA}), the computations done by these 3 functions can be sped up. Note however that
455by applying preprocessing of the data, the set of monomials in the ideal basis
456is changed and corresponds no longer to the same quotient algebra (but to a
457quotient algebra with the same growth). }
458
459 }
460
461
462\chapter{\textcolor{Chapter }{Functions}}\label{Functions}
463\logpage{[ 3, 0, 0 ]}
464\hyperdef{L}{X86FA580F8055B274}{}
465{
466
467\section{\textcolor{Chapter }{Converting polynomials into different formats}}\label{TransitionFunctions}
468\logpage{[ 3, 1, 0 ]}
469\hyperdef{L}{X81ABB91B79E00229}{}
470{
471
472
473\subsection{\textcolor{Chapter }{GP2NP}}
474\logpage{[ 3, 1, 1 ]}\nobreak
475\label{GP2NP}
476\hyperdef{L}{X7B0EBCBC7857F1AE}{}
477{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{GP2NP({\mdseries\slshape gp})\index{GP2NP@\texttt{GP2NP}}
478\label{GP2NP}
479}\hfill{\scriptsize (function)}}\\
480\textbf{\indent Returns:\ }
481If \mbox{\texttt{\mdseries\slshape gp}} is an element of a free algebra, then the polynomial in NP format (see Section \ref{NP}) corresponding to \mbox{\texttt{\mdseries\slshape gp}}; if \mbox{\texttt{\mdseries\slshape gp}} is an element of a free module, then the vector in NPM format (see Section \ref{NPM}) corresponding to \mbox{\texttt{\mdseries\slshape gp}}.
482
483
484
485 This function will convert an element of a free algebra to a polynomial in NP
486format and an element of a free right module to a vector in NPM format.
487
488 \emph{Example:} Let \texttt{A} be the free associative algebra with one over the rationals on the generators \texttt{a} and \texttt{b}. Let \texttt{e} be the one of the algebra.
489\begin{Verbatim}[fontsize=\small,frame=single,label=]
490  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
491  gap> a:=A.a;;
492  gap> b:=A.b;;
493  gap> e:=One(A);;
494  gap> z:=Zero(A);;
495\end{Verbatim}
496 Now let \texttt{gp} be the polynomial $ba-ab-e$.
497\begin{Verbatim}[fontsize=\small,frame=single,label=]
498  gap> gp:=b*a-a*b-e;
499  (-1)*<identity ...>+(-1)*a*b+(1)*b*a
500\end{Verbatim}
501 The polynomial in NP format, corresponding to \texttt{gp} can now be obtained with GP2NP:
502\begin{Verbatim}[fontsize=\small,frame=single,label=]
503  gap> GP2NP(gp);
504  [ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ 1, -1, -1 ] ]
505\end{Verbatim}
506 Let \texttt{D} be the free associative algebra over \texttt{A} of rank 2.
507\begin{Verbatim}[fontsize=\small,frame=single,label=]
508  gap> D := A^2;;
509\end{Verbatim}
510 Take the following list \texttt{R} of two elements of \texttt{D}.
511\begin{Verbatim}[fontsize=\small,frame=single,label=]
512  gap> R := [ [b-e, z], [e+a*(e+a+b), -e-a*(e+a+b)] ];;
513\end{Verbatim}
514 Convert the list \texttt{R} to a list of vectors in NPM format.
515\begin{Verbatim}[fontsize=\small,frame=single,label=]
516  gap> List(R,GP2NP);
517  [ [ [ [ -1, 2 ], [ -1 ] ], [ 1, -1 ] ],
518    [ [ [ -1, 1, 2 ], [ -1, 1, 1 ], [ -2, 1, 2 ], [ -2, 1, 1 ], [ -1, 1 ],
519            [ -2, 1 ], [ -1 ], [ -2 ] ], [ 1, 1, -1, -1, 1, -1, 1, -1 ] ] ]
520\end{Verbatim}
521 }
522
523
524
525\subsection{\textcolor{Chapter }{GP2NPList}}
526\logpage{[ 3, 1, 2 ]}\nobreak
527\label{GP2NPList}
528\hyperdef{L}{X7CF0ED937DDA5A7E}{}
529{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{GP2NPList({\mdseries\slshape Lgp})\index{GP2NPList@\texttt{GP2NPList}}
530\label{GP2NPList}
531}\hfill{\scriptsize (function)}}\\
532\textbf{\indent Returns:\ }
533The list of polynomials in NP or NPM format corresponding to elements of a
534free algebra or module occurring in the list \mbox{\texttt{\mdseries\slshape Lgp}}.
535
536
537
538 This function has the same effect as \texttt{List(Lgp,GBNP)}.
539
540 \emph{Example:} Let \texttt{A} be the free associative algebra with one over the rationals on the generators \texttt{a} and \texttt{b}. Let \texttt{e} be the one of the algebra.
541\begin{Verbatim}[fontsize=\small,frame=single,label=]
542  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
543  gap> a:=A.a;;
544  gap> b:=A.b;;
545  gap> e:=One(A);;
546\end{Verbatim}
547 Let \texttt{Lgp} be the list of polynomials $[a^2-e,b^2-e,ba-ab-e]$.
548\begin{Verbatim}[fontsize=\small,frame=single,label=]
549  gap> Lgp:=[a^2-e,b^2-e,b*a-a*b-e];
550  [ (-1)*<identity ...>+(1)*a^2, (-1)*<identity ...>+(1)*b^2,
551    (-1)*<identity ...>+(-1)*a*b+(1)*b*a ]
552\end{Verbatim}
553 The polynomial in NP format corresponding to \texttt{gp} can be obtained with GP2NP:
554\begin{Verbatim}[fontsize=\small,frame=single,label=]
555  gap> GP2NPList(Lgp);
556  [ [ [ [ 1, 1 ], [  ] ], [ 1, -1 ] ], [ [ [ 2, 2 ], [  ] ], [ 1, -1 ] ],
557    [ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ 1, -1, -1 ] ] ]
558\end{Verbatim}
559 The same result is obtained by a simple application of the standard List
560function in GAP:
561\begin{Verbatim}[fontsize=\small,frame=single,label=]
562  gap> List(Lgp,GP2NP) = GP2NPList(Lgp);
563  true
564\end{Verbatim}
565 }
566
567
568
569\subsection{\textcolor{Chapter }{NP2GP}}
570\logpage{[ 3, 1, 3 ]}\nobreak
571\label{NP2GP}
572\hyperdef{L}{X86C3912F781ABEDC}{}
573{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NP2GP({\mdseries\slshape np, A})\index{NP2GP@\texttt{NP2GP}}
574\label{NP2GP}
575}\hfill{\scriptsize (function)}}\\
576\textbf{\indent Returns:\ }
577The GAP format of the polynomial \mbox{\texttt{\mdseries\slshape np}} in NP format.
578
579
580
581 This function will convert a polynomial in NP format to a GAP polynomial in
582the free associative algebra \mbox{\texttt{\mdseries\slshape A}} and a vector in NPM format to a GAP vector in the free module \mbox{\texttt{\mdseries\slshape A}}. In case of the NP format, the number of variables should not exceed the rank
583of the free algebra \mbox{\texttt{\mdseries\slshape A}}. In case of the NPM format, the absolute of the negative numbers should not
584exceed the rank of the free module \mbox{\texttt{\mdseries\slshape A}}.
585
586 \emph{Example:} Let \texttt{A} be the free associative algebra with one over the rationals on the generators \texttt{a} and \texttt{b}.
587\begin{Verbatim}[fontsize=\small,frame=single,label=]
588  gap> A:=FreeAssociativeAlgebraWithOne(GF(3),"a","b");;
589\end{Verbatim}
590 Let \texttt{np} be a polynomial in NP format.
591\begin{Verbatim}[fontsize=\small,frame=single,label=]
592  gap> np:=[ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ Z(3)^0, Z(3), Z(3) ] ];;
593\end{Verbatim}
594 The polynomial can be converted to the corresponding element of \mbox{\texttt{\mdseries\slshape A}} with NP2GP:
595\begin{Verbatim}[fontsize=\small,frame=single,label=]
596  gap> NP2GP(np,A);
597  (Z(3)^0)*b*a+(Z(3))*a*b+(Z(3))*<identity ...>
598\end{Verbatim}
599 Note that some information of the coefficient field of a polynomial \texttt{np} in NP format can be obtained from the second list of \texttt{np}.
600\begin{Verbatim}[fontsize=\small,frame=single,label=]
601  gap> One(np[2][1]);
602  Z(3)^0
603\end{Verbatim}
604 Now let \texttt{M} be the module \texttt{A\texttt{\symbol{94}}2} and let \texttt{npm} be a polynomial over that module in NPM form.
605\begin{Verbatim}[fontsize=\small,frame=single,label=]
606  gap> M:=A^2;;
607  gap> npm:=[ [ [ -1, 1 ], [ -2, 2 ] ], [ Z(3)^0, Z(3)^0 ] ];;
608\end{Verbatim}
609 The element of \mbox{\texttt{\mdseries\slshape M}} corresponding to \texttt{npm} is
610\begin{Verbatim}[fontsize=\small,frame=single,label=]
611  gap> NP2GP(npm,M);
612  [ (Z(3)^0)*a, (Z(3)^0)*b ]
613\end{Verbatim}
614 If \texttt{M} is a module of dimension 2 over \texttt{A} and \texttt{Lnp} a list of polynomials in NPM format, then the polynomials can be converted to
615the corresponding polynomials of \texttt{M} as follows:
616\begin{Verbatim}[fontsize=\small,frame=single,label=]
617  gap> M:=A^2;;
618  gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ],
619  >   [ [ [ -1, 2, 2], [-2, 1 ] ], [ 1, -1 ]*Z(3)^0 ] ];;
620  gap> List(Lnp, m -> NP2GP(m,M));
621  [ [ <zero> of ..., (Z(3))*a+(Z(3)^0)*a^2 ], [ (Z(3)^0)*b^2, (Z(3))*a ] ]
622\end{Verbatim}
623 }
624
625
626
627\subsection{\textcolor{Chapter }{NP2GPList}}
628\logpage{[ 3, 1, 4 ]}\nobreak
629\label{NP2GPList}
630\hyperdef{L}{X844A23EA7D97150C}{}
631{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NP2GPList({\mdseries\slshape Lnp, A})\index{NP2GPList@\texttt{NP2GPList}}
632\label{NP2GPList}
633}\hfill{\scriptsize (function)}}\\
634\textbf{\indent Returns:\ }
635The list of polynomials corresponding to \mbox{\texttt{\mdseries\slshape Lnp}} in GAP format.
636
637
638
639 This function will convert the list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format to a list of GAP polynomials in the free
640associative algebra \mbox{\texttt{\mdseries\slshape A}}.
641
642 \emph{Example:} Let \texttt{A} be the free associative algebra with one over the rationals on the generators \texttt{a} and \texttt{b}.
643\begin{Verbatim}[fontsize=\small,frame=single,label=]
644  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
645\end{Verbatim}
646 Let \texttt{Lnp} be a list of polynomials in NP format. Then \texttt{Lnp} can be converted to a list of polynomials of \texttt{A} with NP2GPList:
647\begin{Verbatim}[fontsize=\small,frame=single,label=]
648  gap> Lnp:=[ [ [ [ 1, 1, 1 ], [ 1 ] ], [ 1, -1 ] ],
649  >   [ [ [ 2, 2 ], [ ] ], [ 1, -1 ] ] ];;
650  gap> NP2GPList(Lnp,A);
651  [ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]
652\end{Verbatim}
653 It has the same effect as the function \texttt{List} applied as follows.
654\begin{Verbatim}[fontsize=\small,frame=single,label=]
655  gap> List(Lnp, p -> NP2GP(p,A));
656  [ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]
657\end{Verbatim}
658 Now let \texttt{M} be a module of dimension 2 over \texttt{A} and \texttt{Lnp} a list of vectors in NPM format. Then polynomials \texttt{Lnp} can be converted to the corresponding vectors of \texttt{M} with NP2GPList:
659\begin{Verbatim}[fontsize=\small,frame=single,label=]
660  gap> M:=A^2;;
661  gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ],
662  >   [ [ [ -1, 1 ], [ -2 ] ], [ 1, -1 ] ] ];;
663  gap> NP2GPList(Lnp,M);
664  [ [ <zero> of ..., (-1)*a+(1)*a^2 ], [ (1)*a, (-1)*<identity ...> ] ]
665\end{Verbatim}
666 The same result can be obtained by application of the standard List function:
667\begin{Verbatim}[fontsize=\small,frame=single,label=]
668  gap> List(Lnp, m -> NP2GP(m,M)) = NP2GPList(Lnp,M) ;
669  true
670\end{Verbatim}
671 }
672
673 }
674
675
676\section{\textcolor{Chapter }{Printing polynomials in NP format}}\label{printing}
677\logpage{[ 3, 2, 0 ]}
678\hyperdef{L}{X78F44B01851B1020}{}
679{
680
681
682\subsection{\textcolor{Chapter }{PrintNP}}
683\logpage{[ 3, 2, 1 ]}\nobreak
684\label{PrintNP}
685\hyperdef{L}{X7B63BEA87A8D6162}{}
686{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PrintNP({\mdseries\slshape np})\index{PrintNP@\texttt{PrintNP}}
687\label{PrintNP}
688}\hfill{\scriptsize (function)}}\\
689
690
691 This function prints a polynomial \mbox{\texttt{\mdseries\slshape np}} in NP format, using the letters \texttt{a}, \texttt{b}, \texttt{c}, $\ldots$ for $x_1$, $x_2$, $x_3$, $\ldots$, except that everything beyond $l$ (the 12-th letter) is printed as $x$.
692
693 This function prints a polynomial \mbox{\texttt{\mdseries\slshape np}} in NP format as configured by the function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}).
694
695 \emph{Example:} Consider the following polynomial in NP format.
696\begin{Verbatim}[fontsize=\small,frame=single,label=]
697  gap> p := [[[1,1,2],[1,2,2],[]],[1,-2,3]];;
698\end{Verbatim}
699 It can be printed in the guise of a polynomial in \texttt{a} and \texttt{b} by the function \texttt{PrintNP}:
700\begin{Verbatim}[fontsize=\small,frame=single,label=]
701  gap> PrintNP(p);
702   a^2b - 2ab^2 + 3
703\end{Verbatim}
704 }
705
706
707
708\subsection{\textcolor{Chapter }{GBNP.ConfigPrint}}
709\logpage{[ 3, 2, 2 ]}\nobreak
710\label{GBNP.ConfigPrint}
711\hyperdef{L}{X7F7510A878045D3A}{}
712{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{GBNP.ConfigPrint({\mdseries\slshape arg})\index{GBNP.ConfigPrint@\texttt{GBNP.ConfigPrint}}
713\label{GBNP.ConfigPrint}
714}\hfill{\scriptsize (function)}}\\
715
716
717 By default the generators of the algebra are printed as \texttt{a}, ..., \texttt{l} and everything after the twelfth generator as \texttt{x}. By calling \texttt{ConfigPrint} it is possible to alter this printing convention. The argument(s) will be an
718algebra or arguments used for naming algebras in GAP upon creation. More
719specifically, we have the following choices.
720\begin{description}
721\item[{\emph{no arguments}}] When the function is invoked without arguments the printing is reset to the
722default (see above).
723\item[{algebra}] When the function is invoked with an algebra as argument, generators will be
724printed as they would be in the algebra.
725\item[{algebra,integer}] When the function is invoked with an algebra and an integer \mbox{\texttt{\mdseries\slshape n}} as arguments, generators will be printed as they would be in the algebra and
726seperated over the \mbox{\texttt{\mdseries\slshape n}} dimensions.
727\item[{leftmodule}] When the function is invoked with an leftmodule $A^n$ of an associative algebra as argument, generators will be printed as they
728would be in the algebra, seperated over the \mbox{\texttt{\mdseries\slshape n}} dimensions.
729\item[{string}] When the function is invoked with a string as its argument, it is assumed that
730there is only 1 generator and that this should be named as indicated by the
731string.
732\item[{integer}] When the function is invoked with an integer as its argument, the \mbox{\texttt{\mdseries\slshape n}}-th generator will be printed as \texttt{x.{\textless}n{\textgreater}}.
733\item[{integer, string}] When the function is invoked with a non-negative integer and a string as its
734arguments, generators will be printed as \texttt{{\textless}s{\textgreater}.{\textless}n{\textgreater}}, where \texttt{{\textless}s{\textgreater}} is the string given as argument and \texttt{{\textless}n{\textgreater}} the number of the generator. There is no checking whether the number given as
735argument is really the dimension. So it is possible that higher numbers return
736in the output. This way of input is useful however, because it is a
737distinction from the one-dimensional case and compatible with the way a free
738algebra is created.
739\item[{string, string, ..., string}] When the function is invoked with a sequence of strings, then generators will
740be printed with the corresponding string or \texttt{x} if the sequence is not long enough.
741\end{description}
742
743
744 \emph{Example:} Consider the following two polynomials in NP format.
745\begin{Verbatim}[fontsize=\small,frame=single,label=]
746  gap> p1 := [[[1,1,2],[]],[1,-1]];;
747  gap> p2 := [[[1,2,2],[]],[1,-1]];;
748\end{Verbatim}
749 They can be printed by the function \texttt{PrintNP}.
750\begin{Verbatim}[fontsize=\small,frame=single,label=]
751  gap> PrintNP(p1);
752   a^2b - 1
753  gap> PrintNP(p2);
754   ab^2 - 1
755\end{Verbatim}
756 We can let the variables be printed as \texttt{x} and \texttt{y} instead of \texttt{a} and \texttt{b} by means of \texttt{GBNP.ConfigPrint}.
757\begin{Verbatim}[fontsize=\small,frame=single,label=]
758  gap> GBNP.ConfigPrint("x","y");
759  gap> PrintNP(p1);
760   x^2y - 1
761  gap> PrintNP(p2);
762   xy^2 - 1
763\end{Verbatim}
764 We can also let the variables be printed as \texttt{x.1} and \texttt{x.2} instead of \texttt{a} and \texttt{b} by means of \texttt{GBNP.ConfigPrint}.
765\begin{Verbatim}[fontsize=\small,frame=single,label=]
766  gap> GBNP.ConfigPrint(2,"x");
767  gap> PrintNP(p1);
768   x.1^2x.2 - 1
769  gap> PrintNP(p2);
770   x.1x.2^2 - 1
771\end{Verbatim}
772 We can even assign strings to the variables to be printed like \texttt{alice} and \texttt{bob} instead of \texttt{a} and \texttt{b} by means of \texttt{GBNP.ConfigPrint}.
773\begin{Verbatim}[fontsize=\small,frame=single,label=]
774  gap> GBNP.ConfigPrint("alice","bob");
775  gap> PrintNP(p1);
776   alice^2bob - 1
777  gap> PrintNP(p2);
778   alicebob^2 - 1
779\end{Verbatim}
780 Alternatively, we can introduce the free algebra \mbox{\texttt{\mdseries\slshape A}} with two generators, and print the polynomials as members of \mbox{\texttt{\mdseries\slshape A}}:
781\begin{Verbatim}[fontsize=\small,frame=single,label=]
782  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
783  gap> GBNP.ConfigPrint(A);
784  gap> PrintNP(p1);
785   a^2b - 1
786  gap> PrintNP(p2);
787   ab^2 - 1
788\end{Verbatim}
789 }
790
791
792
793\subsection{\textcolor{Chapter }{PrintNPList}}
794\logpage{[ 3, 2, 3 ]}\nobreak
795\label{PrintNPList}
796\hyperdef{L}{X832103DC79A9E9D0}{}
797{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PrintNPList({\mdseries\slshape Lnp})\index{PrintNPList@\texttt{PrintNPList}}
798\label{PrintNPList}
799}\hfill{\scriptsize (function)}}\\
800
801
802 This function prints a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format, using the function \texttt{PrintNP}.
803
804 \emph{Example:} We put two polynomials in NP format into the list \texttt{Lnp}.
805\begin{Verbatim}[fontsize=\small,frame=single,label=]
806  gap> p1 := [[[1,1,2],[]],[1,-1]];;
807  gap> p2 := [[[1,2,2],[]],[1,-1]];;
808  gap> Lnp := [p1,p2];;
809\end{Verbatim}
810 We can print the list with \texttt{PrintNPList}.
811\begin{Verbatim}[fontsize=\small,frame=single,label=]
812  gap> PrintNPList(Lnp);
813   a^2b - 1
814   ab^2 - 1
815\end{Verbatim}
816 Alternatively, using the function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}), we can introduce the free algebra \mbox{\texttt{\mdseries\slshape A}} with two generators, and print the polynomials of the list as members of \mbox{\texttt{\mdseries\slshape A}}:
817\begin{Verbatim}[fontsize=\small,frame=single,label=]
818  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
819  gap> GBNP.ConfigPrint(A);
820  gap> PrintNPList(Lnp);
821   a^2b - 1
822   ab^2 - 1
823\end{Verbatim}
824 }
825
826 }
827
828
829\section{\textcolor{Chapter }{Calculating with polynomials in NP format}}\logpage{[ 3, 3, 0 ]}
830\hyperdef{L}{X83DE3F817EA74727}{}
831{
832
833
834\subsection{\textcolor{Chapter }{NumAlgGensNP}}
835\logpage{[ 3, 3, 1 ]}\nobreak
836\label{NumAlgGensNP}
837\hyperdef{L}{X7DB3792385AAA805}{}
838{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NumAlgGensNP({\mdseries\slshape np})\index{NumAlgGensNP@\texttt{NumAlgGensNP}}
839\label{NumAlgGensNP}
840}\hfill{\scriptsize (function)}}\\
841\textbf{\indent Returns:\ }
842 The minimum number \texttt{t} so that \mbox{\texttt{\mdseries\slshape np}} belongs to the free algebra on \texttt{t} generators.
843
844
845
846 When called with an NP polynomial \mbox{\texttt{\mdseries\slshape np}}, this function returns the minimum number of generators needed for the
847corresponding algebra to contain the \mbox{\texttt{\mdseries\slshape np}}. If \mbox{\texttt{\mdseries\slshape np}} is a polynomial without generators, that is, equivalent to $0$ or $1$, then \texttt{0} is returned.
848
849 \emph{Example:} Consider the following polynomial in NP format.
850\begin{Verbatim}[fontsize=\small,frame=single,label=]
851  gap> np := [[[2,2,2,1,1,1],[4],[3,2,3]],[1,-3,2]];;
852  gap> PrintNP(np);
853   b^3a^3 - 3d + 2cbc
854  gap> NumAlgGensNP(np);
855  4
856\end{Verbatim}
857 }
858
859
860
861\subsection{\textcolor{Chapter }{NumAlgGensNPList}}
862\logpage{[ 3, 3, 2 ]}\nobreak
863\label{NumAlgGensNPList}
864\hyperdef{L}{X865548F07C74AB0A}{}
865{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NumAlgGensNPList({\mdseries\slshape Lnp})\index{NumAlgGensNPList@\texttt{NumAlgGensNPList}}
866\label{NumAlgGensNPList}
867}\hfill{\scriptsize (function)}}\\
868\textbf{\indent Returns:\ }
869 The minimum number \texttt{t} so that each polynomial in \mbox{\texttt{\mdseries\slshape Lnp}} belongs to the free algebra on \texttt{t} generators.
870
871
872
873 When called with a list of NP polynomials \mbox{\texttt{\mdseries\slshape Lnp}}, this function returns the minimum number of generators needed for the
874corresponding algebra to contain the NP polynomials in \mbox{\texttt{\mdseries\slshape Lnp}}. If \mbox{\texttt{\mdseries\slshape Lnp}} only contains polynomials without generators, that is equivalent to $0$ and $1$, then \texttt{0} is returned.
875
876 \emph{Example:} Consider the following two polynomials in NP format.
877\begin{Verbatim}[fontsize=\small,frame=single,label=]
878  gap> p1 := [[[1,1,2,3,1],[2],[1]],[1,-2,1]];;
879  gap> p2 := [[[2,2,1,4,3],[]],[1,-1]];;
880  gap> PrintNPList([p1,p2]);
881   a^2bca - 2b + a
882   b^2adc - 1
883  gap> NumAlgGensNPList([p1,p2]);
884  4
885\end{Verbatim}
886 }
887
888
889
890\subsection{\textcolor{Chapter }{NumModGensNP}}
891\logpage{[ 3, 3, 3 ]}\nobreak
892\label{NumModGensNP}
893\hyperdef{L}{X782647C57D148379}{}
894{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NumModGensNP({\mdseries\slshape npm})\index{NumModGensNP@\texttt{NumModGensNP}}
895\label{NumModGensNP}
896}\hfill{\scriptsize (function)}}\\
897\textbf{\indent Returns:\ }
898 The minimum number \texttt{mt} so that \mbox{\texttt{\mdseries\slshape npm}} belongs to the free module on \texttt{mt} generators.
899
900
901
902 When called with a polynomial \mbox{\texttt{\mdseries\slshape npm}} in NPM format, this function returns the minimum number of module generators
903needed for the corresponding algebra to contain \mbox{\texttt{\mdseries\slshape npm}}. If \mbox{\texttt{\mdseries\slshape npm}} is an NP polynomial that does not contain module generators, then \texttt{0} is returned.
904
905 \emph{Example:} Consider the following polynomial in NPM format.
906\begin{Verbatim}[fontsize=\small,frame=single,label=]
907  gap> np := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];;
908  gap> PrintNP(np);
909  [ abca + 1 , - 2 ]
910  gap> NumModGensNP(np);
911  2
912\end{Verbatim}
913 }
914
915
916
917\subsection{\textcolor{Chapter }{NumModGensNPList}}
918\logpage{[ 3, 3, 4 ]}\nobreak
919\label{NumModGensNPList}
920\hyperdef{L}{X8119282084CA8076}{}
921{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{NumModGensNPList({\mdseries\slshape Lnpm})\index{NumModGensNPList@\texttt{NumModGensNPList}}
922\label{NumModGensNPList}
923}\hfill{\scriptsize (function)}}\\
924\textbf{\indent Returns:\ }
925 The minimum number \texttt{mt} so that each member of \mbox{\texttt{\mdseries\slshape npm}} belongs to the free module on \texttt{mt} generators.
926
927
928
929 When called with a list of polynomials \mbox{\texttt{\mdseries\slshape Lnpm}} in NPM format, this function returns the minimum number of module generators
930needed to contain the polynomials in \mbox{\texttt{\mdseries\slshape Lnpm}}. If there are only polynomials in \mbox{\texttt{\mdseries\slshape Lnpm}} in NP format, then \texttt{0} is returned.
931
932 \emph{Example:} Consider the following two polynomials in NPM format.
933\begin{Verbatim}[fontsize=\small,frame=single,label=]
934  gap> v1 := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];;
935  gap> v2 := [[[-2,2,1,4,3],[-3]],[1,-1]];;
936  gap> PrintNPList([v1,v2]);
937  [ abca + 1 , - 2 ]
938  [ 0, badc , - 1 ]
939  gap> NumModGensNPList([v1,v2]);
940  3
941\end{Verbatim}
942 }
943
944
945
946\subsection{\textcolor{Chapter }{AddNP}}
947\logpage{[ 3, 3, 5 ]}\nobreak
948\label{AddNP}
949\hyperdef{L}{X788E1ACA82A833A8}{}
950{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{AddNP({\mdseries\slshape u, v, c, d})\index{AddNP@\texttt{AddNP}}
951\label{AddNP}
952}\hfill{\scriptsize (function)}}\\
953\textbf{\indent Returns:\ }
954 \mbox{\texttt{\mdseries\slshape c}}$*$\mbox{\texttt{\mdseries\slshape u}}$+$\mbox{\texttt{\mdseries\slshape d}}$*$\mbox{\texttt{\mdseries\slshape v}}
955
956
957
958 Computes \mbox{\texttt{\mdseries\slshape c}}$*$\mbox{\texttt{\mdseries\slshape u}}$+$\mbox{\texttt{\mdseries\slshape d}}$*$\mbox{\texttt{\mdseries\slshape v}} where \mbox{\texttt{\mdseries\slshape u}} and \mbox{\texttt{\mdseries\slshape v}} are polynomials in NP format and \mbox{\texttt{\mdseries\slshape c}} and \mbox{\texttt{\mdseries\slshape d}} are scalars.
959
960 \emph{Example:} Consider the following two polynomials in NP format.
961\begin{Verbatim}[fontsize=\small,frame=single,label=]
962  gap> p1 := [[[1,1,2],[]],[1,-3]];;
963  gap> p2 := [[[1,2,2],[]],[1,-4]];;
964\end{Verbatim}
965 The second can be subtracted from the first by the function \texttt{AddNP}.
966\begin{Verbatim}[fontsize=\small,frame=single,label=]
967  gap> PrintNP(AddNP(p1,p2,1,-1));
968   - ab^2 + a^2b + 1
969\end{Verbatim}
970 }
971
972
973
974\subsection{\textcolor{Chapter }{BimulNP}}
975\logpage{[ 3, 3, 6 ]}\nobreak
976\label{BimulNP}
977\hyperdef{L}{X84FC611A822D808F}{}
978{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{BimulNP({\mdseries\slshape ga, np, dr})\index{BimulNP@\texttt{BimulNP}}
979\label{BimulNP}
980}\hfill{\scriptsize (function)}}\\
981\textbf{\indent Returns:\ }
982 the polynomial \mbox{\texttt{\mdseries\slshape ga}}$*$\mbox{\texttt{\mdseries\slshape np}}$*$\mbox{\texttt{\mdseries\slshape dr}} in NP format
983
984
985
986 When called with a polynomial \mbox{\texttt{\mdseries\slshape np}} and two monomials \mbox{\texttt{\mdseries\slshape ga}}, \mbox{\texttt{\mdseries\slshape dr}}, the function will return \mbox{\texttt{\mdseries\slshape ga}}$*$\mbox{\texttt{\mdseries\slshape np}}$*$\mbox{\texttt{\mdseries\slshape dr}}. Recall from Section \ref{NP} that monomials are represented as lists.
987
988 \emph{Example:} Consider the following two polynomials in NP format.
989\begin{Verbatim}[fontsize=\small,frame=single,label=]
990  gap> p1 := [[[1,1,2],[]],[1,-3]];;
991  gap> p2 := [[[1,2,2],[]],[1,-4]];;
992\end{Verbatim}
993 Multiplying \texttt{p1} from the right by \texttt{b} and multiplying \texttt{p2} from the left by \texttt{a} is possible with the function \texttt{BimulNP}:
994\begin{Verbatim}[fontsize=\small,frame=single,label=]
995  gap> PrintNP(BimulNP([],p1,[2]));
996   a^2b^2 - 3b
997  gap> PrintNP(BimulNP([1],p2,[]));
998   a^2b^2 - 4a
999\end{Verbatim}
1000 }
1001
1002
1003
1004\subsection{\textcolor{Chapter }{CleanNP}}
1005\logpage{[ 3, 3, 7 ]}\nobreak
1006\label{CleanNP}
1007\hyperdef{L}{X855F3D4C783000E3}{}
1008{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{CleanNP({\mdseries\slshape u})\index{CleanNP@\texttt{CleanNP}}
1009\label{CleanNP}
1010}\hfill{\scriptsize (function)}}\\
1011\textbf{\indent Returns:\ }
1012 The cleaned up version of \mbox{\texttt{\mdseries\slshape u}}
1013
1014
1015
1016 Given a polynomial in NP format, this function collects terms with same
1017monomial, removes trivial monomials, and orders the monomials, with biggest
1018one first.
1019
1020 \emph{Example:} Consider the following polynomial in NP format.
1021\begin{Verbatim}[fontsize=\small,frame=single,label=]
1022  gap> p := [[[1,1,2],[],[1,1,2],[]],[1,-3,-2,3]];;
1023  gap> PrintNP(p);
1024   a^2b - 3 - 2a^2b + 3
1025\end{Verbatim}
1026 The monomials \texttt{[1,1,2]} and \texttt{[]} occur twice each. For many functions this representation of a polynomial in NP
1027format is not allowed. It needs to be cleaned, as by \texttt{CleanNP}:
1028\begin{Verbatim}[fontsize=\small,frame=single,label=]
1029  gap> PrintNP(CleanNP(p));
1030   - a^2b
1031\end{Verbatim}
1032 In order to define a polynomial over $GF(2)$, the coefficients need to be defined over this field. Such a list of
1033coefficients can be obtained in GAP from a list of integers by multiplying
1034with the identity element of the field. The resulting polynomial need not be
1035clean, and so should be made clean again with \texttt{CleanNP}.
1036\begin{Verbatim}[fontsize=\small,frame=single,label=]
1037  gap> p := [[[1,1,2],[]],One(GF(2))*[1,-2]];;
1038  gap> CleanNP(p);
1039  [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ]
1040\end{Verbatim}
1041 }
1042
1043
1044
1045\subsection{\textcolor{Chapter }{GtNP}}
1046\logpage{[ 3, 3, 8 ]}\nobreak
1047\label{GtNP}
1048\hyperdef{L}{X7D05B60E83FDA567}{}
1049{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{GtNP({\mdseries\slshape u, v})\index{GtNP@\texttt{GtNP}}
1050\label{GtNP}
1051}\hfill{\scriptsize (function)}}\\
1052\textbf{\indent Returns:\ }
1053 \texttt{true} if $u > v$ and \texttt{false} if $u \leq v$
1054
1055
1056
1057 Greater than function for monomials \mbox{\texttt{\mdseries\slshape u}} and \mbox{\texttt{\mdseries\slshape v}} represented as in Section \ref{NP}. It tests whether \mbox{\texttt{\mdseries\slshape u}}$>$\mbox{\texttt{\mdseries\slshape v}}. The ordering is done by degree and then lexicographically.
1058
1059 \emph{Example:} Consider the following two monomials.
1060\begin{Verbatim}[fontsize=\small,frame=single,label=]
1061  gap> u := [1,1,2];
1062  [ 1, 1, 2 ]
1063  gap> v := [2,2,1];
1064  [ 2, 2, 1 ]
1065\end{Verbatim}
1066 We test whether \texttt{u} is greater than \texttt{v}.
1067\begin{Verbatim}[fontsize=\small,frame=single,label=]
1068  gap> GtNP(u,v);
1069  false
1070\end{Verbatim}
1071 }
1072
1073
1074
1075\subsection{\textcolor{Chapter }{LtNP}}
1076\logpage{[ 3, 3, 9 ]}\nobreak
1077\label{LtNP}
1078\hyperdef{L}{X8075AE7E7A8088FF}{}
1079{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{LtNP({\mdseries\slshape u, v})\index{LtNP@\texttt{LtNP}}
1080\label{LtNP}
1081}\hfill{\scriptsize (function)}}\\
1082\textbf{\indent Returns:\ }
1083 \texttt{true} if $u < v$ and \texttt{false} if $u \geq v$
1084
1085
1086
1087 Less than function for NP monomials, tests whether \mbox{\texttt{\mdseries\slshape u}}$<$\mbox{\texttt{\mdseries\slshape v}}. The ordering is done by degree and then lexicographically.
1088
1089 \emph{Example:} Consider the following two monomials.
1090\begin{Verbatim}[fontsize=\small,frame=single,label=]
1091  gap> u := [1,1,2];
1092  [ 1, 1, 2 ]
1093  gap> v := [2,2,1];
1094  [ 2, 2, 1 ]
1095\end{Verbatim}
1096 We test whether \texttt{u} is less than \texttt{v}.
1097\begin{Verbatim}[fontsize=\small,frame=single,label=]
1098  gap> LtNP(u,v);
1099  true
1100\end{Verbatim}
1101 }
1102
1103
1104
1105\subsection{\textcolor{Chapter }{LMonsNP}}
1106\logpage{[ 3, 3, 10 ]}\nobreak
1107\label{LMonsNP}
1108\hyperdef{L}{X86ECA4F57C720E45}{}
1109{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{LMonsNP({\mdseries\slshape Lnp})\index{LMonsNP@\texttt{LMonsNP}}
1110\label{LMonsNP}
1111}\hfill{\scriptsize (function)}}\\
1112\textbf{\indent Returns:\ }
1113 A list of leading monomials
1114
1115
1116
1117 This function returns the leading monomials of a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format. The polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} are required to be clean; see Section \ref{CleanNP}.
1118
1119 \emph{Example:} We put two polynomials in NP format into the list \texttt{Lnp}.
1120\begin{Verbatim}[fontsize=\small,frame=single,label=]
1121  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1122  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1123  gap> Lnp := [p1,p2];;
1124\end{Verbatim}
1125 The list of leading monomials is computed by \texttt{LMonsNP}:
1126\begin{Verbatim}[fontsize=\small,frame=single,label=]
1127  gap> LMonsNP(Lnp);
1128  [ [ 1, 1, 2 ], [ 1, 2, 2 ] ]
1129\end{Verbatim}
1130 For a nicer printing, the monomials can be converted into polynomials in NP
1131format, and then submitted to PrintNPList:
1132\begin{Verbatim}[fontsize=\small,frame=single,label=]
1133  gap> PrintNPList(List(LMonsNP(Lnp), q -> [[q],[1]]));
1134   a^2b
1135   ab^2
1136\end{Verbatim}
1137 }
1138
1139
1140
1141\subsection{\textcolor{Chapter }{MkMonicNP}}
1142\logpage{[ 3, 3, 11 ]}\nobreak
1143\label{MkMonicNP}
1144\hyperdef{L}{X878A8C027DA25196}{}
1145{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MkMonicNP({\mdseries\slshape np})\index{MkMonicNP@\texttt{MkMonicNP}}
1146\label{MkMonicNP}
1147}\hfill{\scriptsize (function)}}\\
1148\textbf{\indent Returns:\ }
1149 \mbox{\texttt{\mdseries\slshape np}} made monic
1150
1151
1152
1153 This function returns the scalar multiple of a polynomial \mbox{\texttt{\mdseries\slshape np}} in NP format that is monic, i.e., has leading coefficient equal to 1.
1154
1155 \emph{Example:} Consider the following polynomial in NP format.
1156\begin{Verbatim}[fontsize=\small,frame=single,label=]
1157  gap> p := [[[1,1,2],[]],[2,-1]];;
1158  gap> PrintNP(p);
1159   2a^2b - 1
1160\end{Verbatim}
1161 The coefficient of the leading term is $2$. The function \texttt{MkMonicNP} finds this coefficient and divides all terms by it:
1162\begin{Verbatim}[fontsize=\small,frame=single,label=]
1163  gap> PrintNP(MkMonicNP(p));
1164   a^2b - 1/2
1165\end{Verbatim}
1166 }
1167
1168
1169
1170\subsection{\textcolor{Chapter }{MulNP}}
1171\logpage{[ 3, 3, 12 ]}\nobreak
1172\label{MulNP}
1173\hyperdef{L}{X7ABA720E87EFF040}{}
1174{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MulNP({\mdseries\slshape np1, np2})\index{MulNP@\texttt{MulNP}}
1175\label{MulNP}
1176}\hfill{\scriptsize (function)}}\\
1177\textbf{\indent Returns:\ }
1178 \mbox{\texttt{\mdseries\slshape np1}}$*$\mbox{\texttt{\mdseries\slshape np2}}
1179
1180
1181
1182 When invoked with two polynomials \mbox{\texttt{\mdseries\slshape np1}} and \mbox{\texttt{\mdseries\slshape np2}} in NP format, this function will return the product \mbox{\texttt{\mdseries\slshape np1}}$*$\mbox{\texttt{\mdseries\slshape np2}}.
1183
1184 \emph{Example:} Consider the following two polynomials in NP format.
1185\begin{Verbatim}[fontsize=\small,frame=single,label=]
1186  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1187  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1188\end{Verbatim}
1189 The function \texttt{MulNP} multiplies the two polynomials.
1190\begin{Verbatim}[fontsize=\small,frame=single,label=]
1191  gap> PrintNP(MulNP(p1,p2));
1192   a^2bab^2 - ab^2 - a^2b + 1
1193\end{Verbatim}
1194 The fact that this multiplication is not commutative is illustrated by the
1195following comparison, using \texttt{MulNP} twice and \texttt{AddNP} once.
1196\begin{Verbatim}[fontsize=\small,frame=single,label=]
1197  gap> PrintNP(AddNP(MulNP(p1,p2),MulNP(p2,p1),1,-1));
1198   - ab^2a^2b + a^2bab^2
1199\end{Verbatim}
1200 }
1201
1202 }
1203
1204
1205\section{\textcolor{Chapter }{Gr{\"o}bner functions, standard variant}}\label{grobner}
1206\logpage{[ 3, 4, 0 ]}
1207\hyperdef{L}{X81381B2D83D2B9A9}{}
1208{
1209
1210
1211\subsection{\textcolor{Chapter }{Grobner}}
1212\logpage{[ 3, 4, 1 ]}\nobreak
1213\label{Grobner}
1214\hyperdef{L}{X7CD9F9C97B2563E2}{}
1215{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{Grobner({\mdseries\slshape Lnp[, D][, max]})\index{Grobner@\texttt{Grobner}}
1216\label{Grobner}
1217}\hfill{\scriptsize (function)}}\\
1218\textbf{\indent Returns:\ }
1219 If the algorithm terminates, a Gr{\"o}bner Basis or a record if \mbox{\texttt{\mdseries\slshape max}} is specified (see description).
1220
1221
1222
1223 For a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format this function will use Buchberger's algorithm with
1224normal form to find a Gr{\"o}bner Basis (if possible, the general problem is
1225unsolvable).
1226
1227 When called with the optional argument \mbox{\texttt{\mdseries\slshape max}}, which should be a positive integer, the calculation will be interrupted if
1228it has not ended after \mbox{\texttt{\mdseries\slshape max}} iterations. The return value will be a record containing lists \texttt{G} and \texttt{todo} of polynomials in NP format, a boolean \texttt{completed}, and an integer \texttt{iterations}. Here \texttt{G} and \texttt{todo} form a Gr{\"o}bner pair (see \cite{CohenGijsbersEtAl2007}). The number of performed iterations will be placed in \texttt{iterations}. If the algorithm has terminated, then \texttt{todo} will be the empty list and \texttt{completed} will be equal to \texttt{true}. If the algorithm has not terminated, then \texttt{todo} will be a non-empty list of polynomials in NP format and \texttt{completed} will be \texttt{false}.
1229
1230 By use of the optional argument \mbox{\texttt{\mdseries\slshape D}}, it is possible to resume a previously interrupted calculation.
1231
1232 \emph{Example:} Consider the following two polynomials in NP format.
1233\begin{Verbatim}[fontsize=\small,frame=single,label=]
1234  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1235  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1236  gap> PrintNPList([p1,p2]);
1237   a^2b - 1
1238   ab^2 - 1
1239\end{Verbatim}
1240 Their Gr{\"o}bner basis can be computed by the function \texttt{Grobner}.
1241\begin{Verbatim}[fontsize=\small,frame=single,label=]
1242  gap> G := Grobner([p1,p2]);;
1243  gap> PrintNPList(G);
1244   b - a
1245   a^3 - 1
1246\end{Verbatim}
1247 One iteration of the Gr{\"o}bner computations is invoked by use of the
1248parameter \texttt{max}:
1249\begin{Verbatim}[fontsize=\small,frame=single,label=]
1250  gap> R := Grobner([p1,p2],1);;
1251  gap> PrintNPList(R.G);
1252   b - a
1253  gap> PrintNPList(R.todo);
1254   a^3 - 1
1255  gap> R.iterations;
1256  1
1257  gap> R.completed;
1258  false
1259\end{Verbatim}
1260 The above list \texttt{R.todo} can be used to resume the computation of the Gr{\"o}bner basis computation
1261with the Gr{\"o}bner pair \texttt{R.G}, \texttt{R.todo}:
1262\begin{Verbatim}[fontsize=\small,frame=single,label=]
1263  gap> PrintNPList(Grobner(R.G,R.todo));
1264   b - a
1265   a^3 - 1
1266\end{Verbatim}
1267 In order to perform the Gr{\"o}bner basis computation with polynomials in a
1268free algebra over the field $GF(2)$, the coefficients of the polynomials need to be defined over that field.
1269\begin{Verbatim}[fontsize=\small,frame=single,label=]
1270  gap> PrintNPList(Grobner([[p1[1],One(GF(2))*p1[2]],[p2[1],One(GF(2))*p1[2]]]));
1271   b + a
1272   a^3 + Z(2)^0
1273\end{Verbatim}
1274 }
1275
1276
1277
1278\subsection{\textcolor{Chapter }{SGrobner}}
1279\logpage{[ 3, 4, 2 ]}\nobreak
1280\label{SGrobner}
1281\hyperdef{L}{X7FEDA29E78B0CEED}{}
1282{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{SGrobner({\mdseries\slshape Lnp[, todo][, max]})\index{SGrobner@\texttt{SGrobner}}
1283\label{SGrobner}
1284}\hfill{\scriptsize (function)}}\\
1285\textbf{\indent Returns:\ }
1286 If the algorithm terminates, a Gr{\"o}bner Basis or a record if \mbox{\texttt{\mdseries\slshape max}} is specified (see description).
1287
1288
1289
1290 For a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format this function will use Buchberger's algorithm with
1291strong normal form (see \cite{CohenGijsbersEtAl2007}) to find a Gr{\"o}bner Basis (if possible, the general problem is
1292unsolvable).
1293
1294 When called with the optional argument \mbox{\texttt{\mdseries\slshape max}}, which should be a positive integer, the calculation will be interrupted if
1295it has not ended after \mbox{\texttt{\mdseries\slshape max}} iterations. The return value will be a record containing lists \texttt{G} and \texttt{todo} of polynomials in NP format, a boolean \texttt{completed}, and an integer \texttt{iterations}. Here \texttt{G} and \texttt{todo} form a Gr{\"o}bner pair (see \cite{CohenGijsbersEtAl2007}). The number of performed iterations will be placed in \texttt{iterations}. If the algorithm has terminated, then \texttt{todo} will be the empty list and \texttt{completed} will be equal to \texttt{true}. If the algorithm has not terminated, then \texttt{todo} will be a non-empty list of polynomials in NP format and \texttt{completed} will be \texttt{false}.
1296
1297 By use of the optional argument \mbox{\texttt{\mdseries\slshape D}}, it is possible to resume a previously interrupted calculation.
1298
1299 \emph{Example:} Consider the following two polynomials in NP format.
1300\begin{Verbatim}[fontsize=\small,frame=single,label=]
1301  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1302  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1303  gap> PrintNPList([p1,p2]);
1304   a^2b - 1
1305   ab^2 - 1
1306\end{Verbatim}
1307 Their Gr{\"o}bner basis can be computed by the function \texttt{Grobner}.
1308\begin{Verbatim}[fontsize=\small,frame=single,label=]
1309  gap> G := SGrobner([p1,p2]);;
1310  gap> PrintNPList(G);
1311   b - a
1312   a^3 - 1
1313\end{Verbatim}
1314 One iteration of the Gr{\"o}bner computations is invoked by use of the
1315parameter \texttt{max}:
1316\begin{Verbatim}[fontsize=\small,frame=single,label=]
1317  gap> R := SGrobner([p1,p2],1);;
1318  gap> PrintNPList(R.G);
1319   b - a
1320  gap> PrintNPList(R.todo);
1321   a^3 - 1
1322  gap> R.iterations;
1323  1
1324  gap> R.completed;
1325  false
1326\end{Verbatim}
1327 The above list \texttt{R.todo} can be used to resume the computation of the Gr{\"o}bner basis computation
1328with the Gr{\"o}bner pair \texttt{R.G}, \texttt{R.todo}:
1329\begin{Verbatim}[fontsize=\small,frame=single,label=]
1330  gap> PrintNPList(SGrobner(R.G,R.todo));
1331   b - a
1332   a^3 - 1
1333\end{Verbatim}
1334 }
1335
1336
1337
1338\subsection{\textcolor{Chapter }{IsGrobnerBasis}}
1339\logpage{[ 3, 4, 3 ]}\nobreak
1340\label{IsGrobnerBasis}
1341\hyperdef{L}{X80D4D22C7E643C7B}{}
1342{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{IsGrobnerBasis({\mdseries\slshape G})\index{IsGrobnerBasis@\texttt{IsGrobnerBasis}}
1343\label{IsGrobnerBasis}
1344}\hfill{\scriptsize (function)}}\\
1345\textbf{\indent Returns:\ }
1346 \texttt{true} if \mbox{\texttt{\mdseries\slshape G}} is a Gr{\"o}bner basis and \texttt{false} otherwise
1347
1348
1349
1350 When invoked with a list \mbox{\texttt{\mdseries\slshape G}} of polynomials in NP format (see Section \ref{NP}), this function will check whether the list is a Gr{\"o}bner basis. The check
1351is based on Theorem 1.4 from \cite{CohenGijsbersEtAl2007}.
1352
1353 Polynomials representing zero are allowed in \mbox{\texttt{\mdseries\slshape G}}.
1354
1355 \emph{Example:} Consider the following list of two polynomials in NP format.
1356\begin{Verbatim}[fontsize=\small,frame=single,label=]
1357  gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];;
1358  gap> PrintNPList(Lnp);
1359   a^2b - 1
1360   ab^2 - 1
1361\end{Verbatim}
1362 The function \texttt{IsGrobner} checks whether the list is a Gr{\"o}bner basis.
1363\begin{Verbatim}[fontsize=\small,frame=single,label=]
1364  gap> IsGrobnerBasis(Lnp);
1365  false
1366\end{Verbatim}
1367 So the answer should be \texttt{true} for the result of a Gr{\"o}bner computation:
1368\begin{Verbatim}[fontsize=\small,frame=single,label=]
1369  gap> IsGrobnerBasis(Grobner(Lnp));
1370  true
1371\end{Verbatim}
1372 }
1373
1374
1375
1376\subsection{\textcolor{Chapter }{IsStrongGrobnerBasis}}
1377\logpage{[ 3, 4, 4 ]}\nobreak
1378\label{IsStrongGrobnerBasis}
1379\hyperdef{L}{X7D17F9027F08CF0B}{}
1380{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{IsStrongGrobnerBasis({\mdseries\slshape G})\index{IsStrongGrobnerBasis@\texttt{IsStrongGrobnerBasis}}
1381\label{IsStrongGrobnerBasis}
1382}\hfill{\scriptsize (function)}}\\
1383\textbf{\indent Returns:\ }
1384 \texttt{true} if \mbox{\texttt{\mdseries\slshape G}} is a strong Gr{\"o}bner basis and \texttt{false} otherwise
1385
1386
1387
1388 When invoked with a list \mbox{\texttt{\mdseries\slshape G}} of polynomials in NP format (see Section \ref{NP}), this function will check whether the polynomials in this list form a strong
1389Gr{\"o}bner basis (see \cite{CohenGijsbersEtAl2007}).
1390
1391 Polynomials representing zero are allowed in \mbox{\texttt{\mdseries\slshape G}}.
1392
1393 \emph{Example:} Consider the following list of two polynomials in NP format.
1394\begin{Verbatim}[fontsize=\small,frame=single,label=]
1395  gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];;
1396  gap> PrintNPList(Lnp);
1397   a^2b - 1
1398   ab^2 - 1
1399\end{Verbatim}
1400 The function \texttt{IsStrongGrobner} checks whether the list is a strong Gr{\"o}bner basis.
1401\begin{Verbatim}[fontsize=\small,frame=single,label=]
1402  gap> IsStrongGrobnerBasis(Lnp);
1403  false
1404\end{Verbatim}
1405 But the answer should be \texttt{true} for the result of a strong Gr{\"o}bner computation:
1406\begin{Verbatim}[fontsize=\small,frame=single,label=]
1407  gap> IsStrongGrobnerBasis(SGrobner(Lnp));
1408  true
1409\end{Verbatim}
1410 A Gr{\"o}bner basis that is not a strong Gr{\"o}bner basis:
1411\begin{Verbatim}[fontsize=\small,frame=single,label=]
1412  gap> B := SGrobner(Lnp);;
1413  gap> Add(B,AddNP(Lnp[1],B[1],1,-1));;
1414  gap> PrintNPList(B);
1415   b - a
1416   a^3 - 1
1417   a^2b - b + a - 1
1418  gap> IsGrobnerBasis(B);
1419  true
1420  gap> IsStrongGrobnerBasis(B);
1421  false
1422\end{Verbatim}
1423 }
1424
1425
1426
1427\subsection{\textcolor{Chapter }{IsGrobnerPair}}
1428\logpage{[ 3, 4, 5 ]}\nobreak
1429\label{IsGrobnerPair}
1430\hyperdef{L}{X7E0105ED7FF4210F}{}
1431{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{IsGrobnerPair({\mdseries\slshape G, D})\index{IsGrobnerPair@\texttt{IsGrobnerPair}}
1432\label{IsGrobnerPair}
1433}\hfill{\scriptsize (function)}}\\
1434\textbf{\indent Returns:\ }
1435 A boolean, which has the value \texttt{true} if the input forms a Gr{\"o}bner pair
1436
1437
1438
1439 When called with two lists of polynomials in NP format, this function returns
1440true if they form a Gr{\"o}bner pair. Testing whether \mbox{\texttt{\mdseries\slshape D}} is a basic set for \mbox{\texttt{\mdseries\slshape G}} might involve computing the Gr{\"o}bner basis. Instead of this only some
1441simple computations are done to see if it can easily be proven that \mbox{\texttt{\mdseries\slshape D}} is a basic set for \mbox{\texttt{\mdseries\slshape G}}. If this cannot be proven easily, then \texttt{false} is returned, even though $G, D$ might still be a Gr{\"o}bner pair.
1442
1443 \emph{Example:} Consider the following four polynomials in NP format.
1444\begin{Verbatim}[fontsize=\small,frame=single,label=]
1445  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1446  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1447  gap> q1 := [[[2],[1]],[1,-1]];;
1448  gap> q2 := [[[1,1,1],[]],[1,-1]];;
1449\end{Verbatim}
1450 The function \texttt{IsGrobnerPair} is used to check whether some combinations of these polynomials in two lists
1451provide Gr{\"o}bner pairs.
1452\begin{Verbatim}[fontsize=\small,frame=single,label=]
1453  gap> IsGrobnerPair([p1,p2,q1],[q2]);
1454  true
1455  gap> IsGrobnerPair([q1,q2],[p1,p2]);
1456  false
1457\end{Verbatim}
1458 The function \texttt{IsGrobnerPair} applied with an empty list as second argument is a check whether the first
1459argument is a Gr{\"o}bner basis.
1460\begin{Verbatim}[fontsize=\small,frame=single,label=]
1461  gap> IsGrobnerPair([p1,p2],[]) = IsGrobnerBasis([p1,p2]);
1462  true
1463\end{Verbatim}
1464 }
1465
1466
1467
1468\subsection{\textcolor{Chapter }{MakeGrobnerPair}}
1469\logpage{[ 3, 4, 6 ]}\nobreak
1470\label{MakeGrobnerPair}
1471\hyperdef{L}{X8752DA1A7CAF77D3}{}
1472{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MakeGrobnerPair({\mdseries\slshape G, D})\index{MakeGrobnerPair@\texttt{MakeGrobnerPair}}
1473\label{MakeGrobnerPair}
1474}\hfill{\scriptsize (function)}}\\
1475\textbf{\indent Returns:\ }
1476 A record containing a new Grobner pair
1477
1478
1479
1480 When called with as arguments a pair $G, D$, this function cleans \mbox{\texttt{\mdseries\slshape G}} and \mbox{\texttt{\mdseries\slshape D}} and adds some obstructions to \mbox{\texttt{\mdseries\slshape D}} till it is easily provable that \mbox{\texttt{\mdseries\slshape D}} is a basic set for \mbox{\texttt{\mdseries\slshape G}} (see \cite{CohenGijsbersEtAl2007}). The result is a record containing the fields \texttt{G} and \texttt{todo} representing the Gr{\"o}bner pair.
1481
1482 \emph{Example:} Consider the following two polynomials in NP format.
1483\begin{Verbatim}[fontsize=\small,frame=single,label=]
1484  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1485  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1486\end{Verbatim}
1487 The function \texttt{MakeGrobnerPair} turns the list with these two polynomials into a Gr{\"o}bner pair, once the
1488empty list is added as a second argument. The result is a record whose fields \texttt{G} and \texttt{todo}
1489\begin{Verbatim}[fontsize=\small,frame=single,label=]
1490  gap> GP := MakeGrobnerPair([p1,p2],[]);;
1491  gap> PrintNPList(GP.G);
1492   a^2b - 1
1493   ab^2 - 1
1494  gap> PrintNPList(GP.todo);
1495   b - a
1496\end{Verbatim}
1497 These fields are ready for use in \texttt{Grobner}
1498\begin{Verbatim}[fontsize=\small,frame=single,label=]
1499  gap> GB := Grobner(GP.G,GP.todo);;
1500  gap> PrintNPList(GB);
1501   b - a
1502   a^3 - 1
1503\end{Verbatim}
1504 }
1505
1506 }
1507
1508
1509\section{\textcolor{Chapter }{Finite-dimensional quotient algebras}}\label{QA}
1510\logpage{[ 3, 5, 0 ]}
1511\hyperdef{L}{X7F387F7780425B9A}{}
1512{
1513
1514
1515\subsection{\textcolor{Chapter }{BaseQA}}
1516\logpage{[ 3, 5, 1 ]}\nobreak
1517\label{BaseQA}
1518\hyperdef{L}{X7EAA04247B2C6330}{}
1519{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{BaseQA({\mdseries\slshape G, t, maxno})\index{BaseQA@\texttt{BaseQA}}
1520\label{BaseQA}
1521}\hfill{\scriptsize (function)}}\\
1522\textbf{\indent Returns:\ }
1523A list of terms forming a basis of the quotient algebra of the
1524(non-commutative) polynomial algebra in \mbox{\texttt{\mdseries\slshape t}} variables by the 2-sided ideal generated by \mbox{\texttt{\mdseries\slshape G}}
1525
1526
1527
1528 When called with a Gr{\"o}bner basis \mbox{\texttt{\mdseries\slshape G}}, the number \mbox{\texttt{\mdseries\slshape t}} of generators of the algebra, and a maximum number of terms to be found \mbox{\texttt{\mdseries\slshape maxno}}, BaseQA will return a (partial) base of the quotient algebra. If this
1529function is invoked with \mbox{\texttt{\mdseries\slshape maxno}} equal to 0, then a full basis will be given. If the dimension of this quotient
1530algebra is infinite and \mbox{\texttt{\mdseries\slshape maxno}} is set to 0, then the algorithm behind this function will not terminate.
1531
1532 \emph{Example:} Consider the following Gr{\"o}bner basis.
1533\begin{Verbatim}[fontsize=\small,frame=single,label=]
1534  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1535  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1536  gap> G := Grobner([p1,p2]);;
1537  gap> PrintNPList(G);
1538   b - a
1539   a^3 - 1
1540\end{Verbatim}
1541 The function \texttt{BaseQA} computes a basis for the quotient algebra of the free algebra over the
1542rationals with generators $a$ and $b$ by the two-sided ideal generated by \texttt{G}.
1543\begin{Verbatim}[fontsize=\small,frame=single,label=]
1544  gap> PrintNPList(G);
1545   b - a
1546   a^3 - 1
1547  gap> BaseQA(G,2,0);
1548  [ [ [ [  ] ], [ 1 ] ], [ [ [ 1 ] ], [ 1 ] ], [ [ [ 1, 1 ] ], [ 1 ] ] ]
1549  gap> PrintNPList(BaseQA(G,2,0));
1550   1
1551   a
1552   a^2
1553\end{Verbatim}
1554 It is necessary for a correct result that the first argument be a Gr{\"o}bner
1555basis, as will be clear from the following invocation of \texttt{BaseQA}.
1556\begin{Verbatim}[fontsize=\small,frame=single,label=]
1557  gap> PrintNPList(BaseQA([p1,p2],2,10));
1558   1
1559   a
1560   b
1561   a^2
1562   ab
1563   ba
1564   b^2
1565   a^3
1566   aba
1567   ba^2
1568   bab
1569   b^2a
1570   b^3
1571\end{Verbatim}
1572 }
1573
1574
1575
1576\subsection{\textcolor{Chapter }{DimQA}}
1577\logpage{[ 3, 5, 2 ]}\nobreak
1578\label{DimQA}
1579\hyperdef{L}{X81A50EEE7B56C723}{}
1580{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{DimQA({\mdseries\slshape G, t})\index{DimQA@\texttt{DimQA}}
1581\label{DimQA}
1582}\hfill{\scriptsize (function)}}\\
1583\textbf{\indent Returns:\ }
1584The dimension of the quotient algebra
1585
1586
1587
1588 When called with a Gr{\"o}bner basis \mbox{\texttt{\mdseries\slshape G}} and a number of variables \mbox{\texttt{\mdseries\slshape t}}, the function \texttt{DimQA} will return the dimension of the quotient algebra of the free algebra
1589generated by \mbox{\texttt{\mdseries\slshape t}} variables by the ideal generated by \mbox{\texttt{\mdseries\slshape G}} if it is finite. It will not terminate if the dimension is infinite.
1590
1591 If \mbox{\texttt{\mdseries\slshape t}}=0, the function will compute the minimal value of \texttt{t} such that the polynomials in \mbox{\texttt{\mdseries\slshape G}} belong to the free algebra on \texttt{t} generators.
1592
1593 To check whether the dimension of the quotient algebra is finite and to
1594determine the type of growth if it is infinite, see also the functions \texttt{FinCheckQA} (\ref{FinCheckQA}) and \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) in Section \ref{finiteness}.
1595
1596 \emph{Example:} Consider the following Gr{\"o}bner basis.
1597\begin{Verbatim}[fontsize=\small,frame=single,label=]
1598  gap> p1 := [[[1,1,2],[]],[1,-2]];;
1599  gap> p2 := [[[1,2,2],[]],[1,-2]];;
1600  gap> G := Grobner([p1,p2]);;
1601  gap> PrintNPList(G);
1602   b - a
1603   a^3 - 2
1604\end{Verbatim}
1605 The function \texttt{DimQA} computes the dimension of the quotient algebra of the free algebra over the
1606rationals with generators $a$ and $b$ by the two-sided ideal generated by \texttt{G}.
1607\begin{Verbatim}[fontsize=\small,frame=single,label=]
1608  gap> DimQA(G,2);
1609  3
1610\end{Verbatim}
1611 }
1612
1613
1614
1615\subsection{\textcolor{Chapter }{MatrixQA}}
1616\logpage{[ 3, 5, 3 ]}\nobreak
1617\label{MatrixQA}
1618\hyperdef{L}{X7DFA841A8425DD94}{}
1619{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MatrixQA({\mdseries\slshape i, B, GB})\index{MatrixQA@\texttt{MatrixQA}}
1620\label{MatrixQA}
1621}\hfill{\scriptsize (function)}}\\
1622\textbf{\indent Returns:\ }
1623 The matrix representation for the \mbox{\texttt{\mdseries\slshape i}}-th generator of the algebra for right multiplication in the quotient algebra
1624
1625
1626
1627 Given a basis \mbox{\texttt{\mdseries\slshape B}} of the quotient algebra, a Gr{\"o}bner basis (record) \mbox{\texttt{\mdseries\slshape GB}}, and a natural number \mbox{\texttt{\mdseries\slshape i}}, this function creates a matrix representation for the \mbox{\texttt{\mdseries\slshape i}}-th generator of the algebra for right multiplication.
1628
1629 \emph{Example:} Consider the following two polynomials in NP format.
1630\begin{Verbatim}[fontsize=\small,frame=single,label=]
1631  gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
1632  gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
1633\end{Verbatim}
1634 The matrix of right multiplication by the first indeterminate $a$ on the quotient algebra with respect to the ideal generated by \texttt{p1} and \texttt{p2} is obtained by applying \texttt{MatrixQA} to the Gr{\"o}bner basis of these generators and a basis of the quotient
1635algebra as found in \texttt{BaseQA} (\ref{BaseQA}):
1636\begin{Verbatim}[fontsize=\small,frame=single,label=]
1637  gap> GB := Grobner([p1,p2]);;
1638  gap> B := BaseQA(GB,2,0);;
1639  gap> PrintNPList(B);
1640   1
1641   a
1642   b
1643   a^2
1644   ab
1645   a^3
1646   a^2b
1647   a^4
1648  gap> Display(MatrixQA(1, B,GB));
1649  [ [  0,  1,  0,  0,  0,  0,  0,  0 ],
1650    [  0,  0,  0,  1,  0,  0,  0,  0 ],
1651    [  0,  0,  0,  0,  1,  0,  0,  0 ],
1652    [  0,  0,  0,  0,  0,  1,  0,  0 ],
1653    [  0,  0,  0,  0,  0,  0,  1,  0 ],
1654    [  0,  0,  0,  0,  0,  0,  0,  1 ],
1655    [  1,  0,  0,  0,  0,  0,  0,  0 ],
1656    [  0,  0,  1,  0,  0,  0,  0,  0 ] ]
1657\end{Verbatim}
1658 The function is also applicable to Gr{\"o}bner basis records for modules.
1659Consider the following two vectors.
1660\begin{Verbatim}[fontsize=\small,frame=single,label=]
1661  gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
1662  gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
1663\end{Verbatim}
1664 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule} (\ref{SGrobnerModule}) and a quotient module basis by \texttt{BaseQM} (\ref{BaseQM}):
1665\begin{Verbatim}[fontsize=\small,frame=single,label=]
1666  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
1667  gap> B := BaseQM(GBR,2,2,0);;
1668\end{Verbatim}
1669 The matrix of right multiplication by $a$, the first generator of the free algebra, is
1670\begin{Verbatim}[fontsize=\small,frame=single,label=]
1671  gap> Display(MatrixQA(1,B,GBR));
1672  [ [  0,  1 ],
1673    [  1,  0 ] ]
1674\end{Verbatim}
1675 }
1676
1677
1678
1679\subsection{\textcolor{Chapter }{MatricesQA}}
1680\logpage{[ 3, 5, 4 ]}\nobreak
1681\label{MatricesQA}
1682\hyperdef{L}{X78E4BF2F7F0D5E74}{}
1683{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MatricesQA({\mdseries\slshape t, B, GB})\index{MatricesQA@\texttt{MatricesQA}}
1684\label{MatricesQA}
1685}\hfill{\scriptsize (function)}}\\
1686\textbf{\indent Returns:\ }
1687 The matrix representation for the \mbox{\texttt{\mdseries\slshape t}} generators of the algebra for right multiplication in the quotient algebra
1688
1689
1690
1691 Given a basis \mbox{\texttt{\mdseries\slshape B}} of the quotient algebra, a Gr{\"o}bner basis (record) \mbox{\texttt{\mdseries\slshape GB}}, and a natural number \mbox{\texttt{\mdseries\slshape t}}, this function creates a list of \mbox{\texttt{\mdseries\slshape t}} matrices representing the linear transformations of the generators of the
1692algebra by right multiplication on the quotient algebra.
1693
1694 \emph{Example:} Consider the following two polynomials in NP format.
1695\begin{Verbatim}[fontsize=\small,frame=single,label=]
1696  gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
1697  gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
1698\end{Verbatim}
1699 The function \texttt{MatricesQA} gives the list of matrices found by \texttt{MatrixQA} (\ref{MatrixQA}) when the first argument takes the integer values between 1 and the number of
1700all algebra generators.
1701\begin{Verbatim}[fontsize=\small,frame=single,label=]
1702  gap> GB := Grobner([p1,p2]);;
1703  gap> B := BaseQA(GB,2,0);;
1704  gap> mats := MatricesQA(2,B,GB);;
1705  gap> for mat in mats do Display(mat); Print("\n"); od;
1706  [ [  0,  1,  0,  0,  0,  0,  0,  0 ],
1707    [  0,  0,  0,  1,  0,  0,  0,  0 ],
1708    [  0,  0,  0,  0,  1,  0,  0,  0 ],
1709    [  0,  0,  0,  0,  0,  1,  0,  0 ],
1710    [  0,  0,  0,  0,  0,  0,  1,  0 ],
1711    [  0,  0,  0,  0,  0,  0,  0,  1 ],
1712    [  1,  0,  0,  0,  0,  0,  0,  0 ],
1713    [  0,  0,  1,  0,  0,  0,  0,  0 ] ]
1714
1715  [ [  0,  0,  1,  0,  0,  0,  0,  0 ],
1716    [  0,  0,  0,  0,  1,  0,  0,  0 ],
1717    [  0,  0,  0,  1,  0,  0,  0,  0 ],
1718    [  0,  0,  0,  0,  0,  0,  1,  0 ],
1719    [  0,  0,  0,  0,  0,  1,  0,  0 ],
1720    [  1,  0,  0,  0,  0,  0,  0,  0 ],
1721    [  0,  0,  0,  0,  0,  0,  0,  1 ],
1722    [  0,  1,  0,  0,  0,  0,  0,  0 ] ]
1723
1724\end{Verbatim}
1725 The result is also obtainable by use of the List function:
1726\begin{Verbatim}[fontsize=\small,frame=single,label=]
1727  gap> MatricesQA(2,B,GB) = List([1,2], q -> MatrixQA(q,B,GB));
1728  true
1729\end{Verbatim}
1730 }
1731
1732
1733
1734\subsection{\textcolor{Chapter }{MulQA}}
1735\logpage{[ 3, 5, 5 ]}\nobreak
1736\label{MulQA}
1737\hyperdef{L}{X80C4D0E882B05FDF}{}
1738{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MulQA({\mdseries\slshape p1, p2, G})\index{MulQA@\texttt{MulQA}}
1739\label{MulQA}
1740}\hfill{\scriptsize (function)}}\\
1741\textbf{\indent Returns:\ }
1742The strong normal form of the product \mbox{\texttt{\mdseries\slshape p1}}$*$\mbox{\texttt{\mdseries\slshape p2}} with respect to \mbox{\texttt{\mdseries\slshape G}}
1743
1744
1745
1746 When called with two polynomials in NP form, \mbox{\texttt{\mdseries\slshape p1}} and \mbox{\texttt{\mdseries\slshape p2}}, and a Gr{\"o}bner basis \mbox{\texttt{\mdseries\slshape G}}, this function will return the product in the quotient algebra.
1747
1748 \emph{Example:} Consider the following Gr{\"o}bner basis.
1749\begin{Verbatim}[fontsize=\small,frame=single,label=]
1750  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1751  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1752  gap> G := Grobner([p1,p2]);;
1753  gap> PrintNPList(G);
1754   b - a
1755   a^3 - 1
1756\end{Verbatim}
1757 Print the product in the quotient algebra of the polynomials $a-2$ and $b-3$ by use of \texttt{MulQA}:
1758\begin{Verbatim}[fontsize=\small,frame=single,label=]
1759  gap> s1 := [[[1],[]],[1,-2]];;
1760  gap> s2 := [[[2],[]],[1,-3]];;
1761  gap> PrintNP(MulQA(s1,s2,G));
1762   a^2 - 5a + 6
1763\end{Verbatim}
1764 The result should be equal to the strong normal form of the product of $a-2$ and $b-3$ with respect to \texttt{G}:
1765\begin{Verbatim}[fontsize=\small,frame=single,label=]
1766  gap> MulQA(s1,s2,G) = StrongNormalFormNP(MulNP(s1,s2),G);
1767  true
1768\end{Verbatim}
1769 }
1770
1771
1772
1773\subsection{\textcolor{Chapter }{StrongNormalFormNP}}
1774\logpage{[ 3, 5, 6 ]}\nobreak
1775\label{StrongNormalFormNP}
1776\hyperdef{L}{X8563683E7FA604F8}{}
1777{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{StrongNormalFormNP({\mdseries\slshape f, G})\index{StrongNormalFormNP@\texttt{StrongNormalFormNP}}
1778\label{StrongNormalFormNP}
1779}\hfill{\scriptsize (function)}}\\
1780\textbf{\indent Returns:\ }
1781 The strong normal form of a polynomial with respect to \mbox{\texttt{\mdseries\slshape G}}
1782
1783
1784
1785 When invoked with a polynomial in NP format (see Section \ref{NP}) and a finite set \mbox{\texttt{\mdseries\slshape G}} of polynomials in NP format, this function will return a strong normal form
1786(that is, a polynomial that is equal to \mbox{\texttt{\mdseries\slshape f}} modulo \mbox{\texttt{\mdseries\slshape G}}, every monomial of which is a multiple of no leading monomial of an element
1787of \mbox{\texttt{\mdseries\slshape G}}).
1788
1789 Note that the StrongNormalForm with respect to a Gr{\"o}bner basis is uniquely
1790determined, but that for an arbitrary input \mbox{\texttt{\mdseries\slshape G}} the result may depend on the order in which the individual reduction steps are
1791implemented.
1792
1793 \emph{Example:} Consider the following two polynomials in NP format.
1794\begin{Verbatim}[fontsize=\small,frame=single,label=]
1795  gap> p1 := [[[1,1,2],[]],[1,-1]];;
1796  gap> p2 := [[[1,2,2],[]],[1,-1]];;
1797\end{Verbatim}
1798 The strong normal form of the polynomial
1799\begin{Verbatim}[fontsize=\small,frame=single,label=]
1800  gap> p := [[[1,1,1,2],[2,1],[]],[1,-1,3]];;
1801\end{Verbatim}
1802 with respect to the list \texttt{[p1,p2]} is computed by use of the function \texttt{StrongNormalFormNP}:
1803\begin{Verbatim}[fontsize=\small,frame=single,label=]
1804  gap> PrintNP(StrongNormalFormNP(p,[p1,p2]));
1805   - ba + a + 3
1806\end{Verbatim}
1807 }
1808
1809 }
1810
1811
1812\section{\textcolor{Chapter }{Finiteness and Hilbert series}}\label{finiteness}
1813\logpage{[ 3, 6, 0 ]}
1814\hyperdef{L}{X79FE4A3983E2329F}{}
1815{
1816
1817
1818\subsection{\textcolor{Chapter }{DetermineGrowthQA}}
1819\logpage{[ 3, 6, 1 ]}\nobreak
1820\label{DetermineGrowthQA}
1821\hyperdef{L}{X83C57C3A7DCF0471}{}
1822{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{DetermineGrowthQA({\mdseries\slshape Lm, t, exact})\index{DetermineGrowthQA@\texttt{DetermineGrowthQA}}
1823\label{DetermineGrowthQA}
1824}\hfill{\scriptsize (function)}}\\
1825\textbf{\indent Returns:\ }
1826 If the quotient algebra is finite dimensional, then the integer \texttt{0} is returned. If the growth is polynomial and the algorithm found a precise
1827degree \texttt{d} of the growth polynomial, then \texttt{d} is returned. If the growth is polynomial and no precise answer is found, an
1828interval \texttt{[d1,d2]} is returned in which the dimension lies. If the growth is exponential, the
1829string \texttt{"exponential growth"} is returned.
1830
1831
1832
1833 Given leading monomials \mbox{\texttt{\mdseries\slshape Lm}} of some Gr{\"o}bner basis (these can be obtained with the function \texttt{LMonsNP} (\ref{LMonsNP})), the number \mbox{\texttt{\mdseries\slshape t}} of generators of a free algebra, say $A$, in which the monomials lie, and a boolean \mbox{\texttt{\mdseries\slshape exact}}, this function checks whether the quotient algebra of $A$ by the ideal generated by \mbox{\texttt{\mdseries\slshape Lm}} is finite dimensional. In doing so it constructs a graph of normal words which
1834helps with the computations. It also checks for exponential or polynomial
1835growth in the infinite case.
1836
1837 If the precise degree is needed in the polynomial case, the argument \mbox{\texttt{\mdseries\slshape exact}} should be set to \texttt{true}.
1838
1839 The function \texttt{DetermineGrowthQA} allows preprocessing, which may speed up the computations. This can be done
1840with the function \texttt{PreprocessAnalysisQA} (\ref{PreprocessAnalysisQA}).
1841
1842 \emph{Example:} For the list of monomials consisting of a single variable in a free algebra
1843generated by two variables the growth is clearly polynomial of degree 1. This
1844is verified by invoking \texttt{DetermineGrowthQA} with arguments \texttt{[[1]]} (the list of the single monomial consisting of the first variable), the number
1845of generators of the free algebra to which the monomials belong (which is 2
1846here), and the boolean \texttt{true} indicating that we wish a precise degree in case of polynomial growth.
1847\begin{Verbatim}[fontsize=\small,frame=single,label=]
1848  gap> DetermineGrowthQA([[1]],2,true);
1849  1
1850\end{Verbatim}
1851 Here is an example of polynomial growth of degree 2:
1852\begin{Verbatim}[fontsize=\small,frame=single,label=]
1853  gap> L := [[1,2,1],[2,2,1]];
1854  [ [ 1, 2, 1 ], [ 2, 2, 1 ] ]
1855  gap> DetermineGrowthQA(L,2,true);
1856  2
1857\end{Verbatim}
1858 In order to show how to apply the function to arbitrary polynomials, consider
1859the following two polynomials in NP format.
1860\begin{Verbatim}[fontsize=\small,frame=single,label=]
1861  gap> F := GF(256);
1862  GF(2^8)
1863  gap> z := GeneratorsOfField(F)[1];
1864  Z(2^8)
1865  gap> p1 := [[[1,1,1,2],[]],[z,1]];;
1866  gap> p2 := [[[2,2,2,1],[]],[1,z]];;
1867\end{Verbatim}
1868 The polynomials \texttt{p1} and \texttt{p2} have coefficients in the field \texttt{F} of order 256. In order to study the growth of the quotient algebra we first
1869compute the list of leading monomials of the Gr{\"o}bner basis elements and
1870next apply \texttt{DetermineGrowthQA}.
1871\begin{Verbatim}[fontsize=\small,frame=single,label=]
1872  gap> GB := Grobner([p1,p2]);;
1873  gap> L := LMonsNP(GB);;
1874  gap> for lm  in L  do PrintNP( [ [ lm ], [ 1 ] ] ); od;
1875   a^3b
1876   b^2
1877   ba
1878   a^5
1879  gap> DetermineGrowthQA(L,2,true);
1880  0
1881\end{Verbatim}
1882 }
1883
1884
1885
1886\subsection{\textcolor{Chapter }{FinCheckQA}}
1887\logpage{[ 3, 6, 2 ]}\nobreak
1888\label{FinCheckQA}
1889\hyperdef{L}{X792E39A98717D779}{}
1890{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{FinCheckQA({\mdseries\slshape Lm, t})\index{FinCheckQA@\texttt{FinCheckQA}}
1891\label{FinCheckQA}
1892}\hfill{\scriptsize (function)}}\\
1893\textbf{\indent Returns:\ }
1894 \texttt{true}, if the quotient algebra is finite dimensional and\texttt{ false} otherwise
1895
1896
1897
1898 Given a list \mbox{\texttt{\mdseries\slshape Lm}} of leading monomials such that none of these divides another, and the number \mbox{\texttt{\mdseries\slshape t}} of generators of a free algebra in which they are embedded, this function
1899checks whether the quotient algebra of the free algebra by the ideal generated
1900by \mbox{\texttt{\mdseries\slshape Lm}} is finite dimensional.
1901
1902 When given a Gr{\"o}bner basis $G$, the dimension of the quotient algebra of the free algebra by the ideal
1903generated by $G$ coincides with the the dimension of the quotient algebra of the free algebra
1904by the ideal generated by the leading terms of elements of $G$. These can be obtained from $G$ with the function \texttt{LMonsNP} (\ref{LMonsNP}).
1905
1906 The function \texttt{FinCheckQA} allows for preprocessing with the function \texttt{PreprocessAnalysisQA} (\ref{PreprocessAnalysisQA}). This may speed up the computation.
1907
1908 \emph{Example:} Consider the following list \texttt{L} of two monomials.
1909\begin{Verbatim}[fontsize=\small,frame=single,label=]
1910  gap> L := [[1,2,1],[2,2,1]];;
1911\end{Verbatim}
1912 Finiteness of the dimension of the quotient algebra of the free algebra by the
1913ideal generated by these two monomials can be decided by means of \texttt{FinCheckQA}. Its arguments are \texttt{L} and the number of generators of the free algebra in which the monomials
1914reside.
1915\begin{Verbatim}[fontsize=\small,frame=single,label=]
1916  gap> FinCheckQA(L,2);
1917  false
1918\end{Verbatim}
1919 This example turns out to be infinite dimensional. Here is a
1920finite-dimensional example.
1921\begin{Verbatim}[fontsize=\small,frame=single,label=]
1922  gap> FinCheckQA([[1],[2,2]],2);
1923  true
1924\end{Verbatim}
1925 }
1926
1927
1928
1929\subsection{\textcolor{Chapter }{HilbertSeriesQA}}
1930\logpage{[ 3, 6, 3 ]}\nobreak
1931\label{HilbertSeriesQA}
1932\hyperdef{L}{X7CFD47367CF309EB}{}
1933{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{HilbertSeriesQA({\mdseries\slshape Lm, t, d})\index{HilbertSeriesQA@\texttt{HilbertSeriesQA}}
1934\label{HilbertSeriesQA}
1935}\hfill{\scriptsize (function)}}\\
1936\textbf{\indent Returns:\ }
1937 A list of coefficients of the Hilbert series up to degree \mbox{\texttt{\mdseries\slshape d}}
1938
1939
1940
1941 Given a set of monomials \mbox{\texttt{\mdseries\slshape Lm}}, none of which divides another, and the number \mbox{\texttt{\mdseries\slshape n}} of generators of the free algebra in which they occur, this function computes
1942the Hilbert series up to a given degree \mbox{\texttt{\mdseries\slshape d}}.
1943
1944 Internally, it builds (part of) the graph of standard words.  This function will remove zeroes from the end of the list of coefficients.
1945
1946 \emph{Example:} Consider the following list \texttt{L} of two monomials.
1947\begin{Verbatim}[fontsize=\small,frame=single,label=]
1948  gap> L := [[1,2,1],[2,2,1]];;
1949\end{Verbatim}
1950 Finiteness of the dimension of the quotient algebra of the free algebra by the
1951ideal generated by these two monomials can be decided by means of \texttt{FinCheckQA}. Its arguments are \texttt{L} and the number of generators of the free algebra in which the monomials
1952reside.
1953\begin{Verbatim}[fontsize=\small,frame=single,label=]
1954  gap> HilbertSeriesQA(L,2,10);
1955  [ 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ]
1956\end{Verbatim}
1957 This indicates that the growth may be polynomial. \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) can be used to check this. }
1958
1959
1960
1961\subsection{\textcolor{Chapter }{PreprocessAnalysisQA}}
1962\logpage{[ 3, 6, 4 ]}\nobreak
1963\label{PreprocessAnalysisQA}
1964\hyperdef{L}{X863124677B933CEE}{}
1965{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PreprocessAnalysisQA({\mdseries\slshape Lm, t, iterations})\index{PreprocessAnalysisQA@\texttt{PreprocessAnalysisQA}}
1966\label{PreprocessAnalysisQA}
1967}\hfill{\scriptsize (function)}}\\
1968\textbf{\indent Returns:\ }
1969 The left-reduced list of `obstructions', obtained by applying left-reduction
1970recursively
1971
1972
1973
1974 This preprocessing of the list \mbox{\texttt{\mdseries\slshape Lm}} of monomials can be applied to the set of leading terms of a Gr{\"o}bner basis
1975before calling the functions \texttt{FinCheckQA} (\ref{FinCheckQA}) or \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}), in order to speed up calculations using these functions. As the name
1976suggests, \mbox{\texttt{\mdseries\slshape t}} should be the size of the alphabet. The parameter \mbox{\texttt{\mdseries\slshape iterations}} gives the maximum number of recursion steps in the preprocessing (\mbox{\texttt{\mdseries\slshape 0}} means no restriction). For more information about this function see \cite{Krook2003}.
1977
1978 \emph{Example:} Consider the following two polynomials in NP format of which a Gr{\"o}bner
1979basis is computed.
1980\begin{Verbatim}[fontsize=\small,frame=single,label=]
1981  F := GF(256);
1982  z := GeneratorsOfField(F)[1];
1983  gap> p1 := [[[1,1,1,1,2],[]],[1,-1]];;
1984  gap> p2 := [[[2,2,2,1,1,1],[]],[1,-1]];;
1985  gap> GB := Grobner([p1,p2]);;
1986  gap> PrintNPList(GB);
1987   a^4b - 1
1988   ba - ab
1989   b^2 - a
1990   a^5 - b
1991\end{Verbatim}
1992 Application of \texttt{PreprocessAnalysisQA} is carried out on the leading terms of \texttt{GB}, with 2, 4, 8, recursions, respectively.
1993\begin{Verbatim}[fontsize=\small,frame=single,label=]
1994  gap> L := LMonsNP(GB);
1995  [ [ 1, 1, 1, 1, 2 ], [ 2, 1 ], [ 2, 2 ], [ 1, 1, 1, 1, 1 ] ]
1996  gap> L1 := PreprocessAnalysisQA(L,2,2);
1997  [ [ 1, 1, 1 ], [ 2, 1 ], [ 1, 1, 2 ], [ 2, 2 ] ]
1998  gap> L2 := PreprocessAnalysisQA(L1,2,4);
1999  [ [ 1 ], [ 2 ] ]
2000\end{Verbatim}
2001 }
2002
2003 }
2004
2005
2006\section{\textcolor{Chapter }{Functions of the trace variant}}\label{tracefun}
2007\logpage{[ 3, 7, 0 ]}
2008\hyperdef{L}{X7BA5CAA07890F7AA}{}
2009{
2010
2011
2012\subsection{\textcolor{Chapter }{EvalTrace}}
2013\logpage{[ 3, 7, 1 ]}\nobreak
2014\label{EvalTrace}
2015\hyperdef{L}{X813454F6799B1D57}{}
2016{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{EvalTrace({\mdseries\slshape p, Lnp})\index{EvalTrace@\texttt{EvalTrace}}
2017\label{EvalTrace}
2018}\hfill{\scriptsize (function)}}\\
2019\textbf{\indent Returns:\ }
2020 The trace evaluated to a polynomial in NP format.
2021
2022
2023
2024 For a traced polynomial \mbox{\texttt{\mdseries\slshape p}} and a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format, this program evaluates the trace by substituting
2025the polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} back in the expression \texttt{p.trace} and computing the resulting polynomial. The result should have the same value
2026as \texttt{p.pol}.
2027
2028 \emph{Example:} First we compute the traced Gr{\"o}bner basis of the list of the following two
2029polynomials in NP format.
2030\begin{Verbatim}[fontsize=\small,frame=single,label=]
2031  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2032  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2033  gap> Lnp := [p1,p2];;
2034  gap> GBT := SGrobnerTrace(Lnp);;
2035\end{Verbatim}
2036 In order to check that the polynomials in \texttt{GBT} belong to the ideal generated by \texttt{p1} and \texttt{p2}, we evaluate the trace. For each traced polynomial \texttt{p} in \texttt{GBT}, the polynomial \texttt{p.pol} is equated to the evaluated expression \texttt{p.trace}, in which each occurrence of \texttt{G(i)} is replaced by \texttt{Lnp[i]} by use of \texttt{EvalTrace}.
2037\begin{Verbatim}[fontsize=\small,frame=single,label=]
2038  gap> ForAll(GBT,q -> EvalTrace(q,Lnp) = q.pol);
2039  true
2040\end{Verbatim}
2041 }
2042
2043
2044
2045\subsection{\textcolor{Chapter }{PrintTraceList}}
2046\logpage{[ 3, 7, 2 ]}\nobreak
2047\label{PrintTraceList}
2048\hyperdef{L}{X83D1560C7F2A04BA}{}
2049{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PrintTraceList({\mdseries\slshape G})\index{PrintTraceList@\texttt{PrintTraceList}}
2050\label{PrintTraceList}
2051}\hfill{\scriptsize (function)}}\\
2052
2053
2054 When invoked with a list \mbox{\texttt{\mdseries\slshape G}} of traced polynomials, this function prints the traces of that list.
2055
2056 \emph{Example:} First we compute the traced Gr{\"o}bner basis of the list of two polynomials
2057in NP format and next we print it by use of \texttt{PrintTraceList}.
2058\begin{Verbatim}[fontsize=\small,frame=single,label=]
2059  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2060  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2061  gap> GBT := SGrobnerTrace([p1,p2]);;
2062  gap> PrintTraceList(GBT);
2063   aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab
2064
2065   G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2)
2066\end{Verbatim}
2067 }
2068
2069
2070
2071\subsection{\textcolor{Chapter }{PrintTracePol}}
2072\logpage{[ 3, 7, 3 ]}\nobreak
2073\label{PrintTracePol}
2074\hyperdef{L}{X8039BEE77C070FB1}{}
2075{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PrintTracePol({\mdseries\slshape p})\index{PrintTracePol@\texttt{PrintTracePol}}
2076\label{PrintTracePol}
2077}\hfill{\scriptsize (function)}}\\
2078
2079
2080 This function prints the trace of an NP polynomial \mbox{\texttt{\mdseries\slshape p}}.
2081
2082 \emph{Example:} First we compute the traced Gr{\"o}bner basis of the list of two polynomials
2083in NP format. Next we print the trace polynomial of the members of the list by
2084use of \texttt{PrintTracePol}.
2085\begin{Verbatim}[fontsize=\small,frame=single,label=]
2086  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2087  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2088  gap> GBT := SGrobnerTrace([p1,p2]);;
2089  gap> for np in GBT do PrintTracePol(np); Print("\n"); od;
2090   aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab
2091
2092   G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2)
2093
2094\end{Verbatim}
2095 }
2096
2097
2098
2099\subsection{\textcolor{Chapter }{PrintNPListTrace}}
2100\logpage{[ 3, 7, 4 ]}\nobreak
2101\label{PrintNPListTrace}
2102\hyperdef{L}{X7DD0B56D7BD6CD98}{}
2103{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{PrintNPListTrace({\mdseries\slshape G})\index{PrintNPListTrace@\texttt{PrintNPListTrace}}
2104\label{PrintNPListTrace}
2105}\hfill{\scriptsize (function)}}\\
2106
2107
2108 When invoked with a set of traced non-commutative polynomials \mbox{\texttt{\mdseries\slshape G}}, this function prints the list of the traced polynomials, without the trace.
2109
2110 \emph{Example:} First we compute the traced Gr{\"o}bner basis of the list of two polynomials
2111in NP format. Next we print the polynomials found by use of \texttt{PrintNPListTrace}.
2112\begin{Verbatim}[fontsize=\small,frame=single,label=]
2113  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2114  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2115  gap> GBT := SGrobnerTrace([p1,p2]);;
2116  gap> PrintNPListTrace(GBT);
2117   b - a
2118   a^3 - 1
2119\end{Verbatim}
2120 }
2121
2122
2123
2124\subsection{\textcolor{Chapter }{SGrobnerTrace}}
2125\logpage{[ 3, 7, 5 ]}\nobreak
2126\label{SGrobnerTrace}
2127\hyperdef{L}{X78AE6EED83B97595}{}
2128{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{SGrobnerTrace({\mdseries\slshape Lnp})\index{SGrobnerTrace@\texttt{SGrobnerTrace}}
2129\label{SGrobnerTrace}
2130}\hfill{\scriptsize (function)}}\\
2131\textbf{\indent Returns:\ }
2132 Gr{\"o}bner Basis, traceable
2133
2134
2135
2136 For a list of noncommutative polynomials \mbox{\texttt{\mdseries\slshape Lnp}} this function will use Buchberger's algorithm with strong normal form to find
2137a Gr{\"o}bner Basis \texttt{G} (if possible; the general problem is unsolvable).
2138
2139 The results will be traceable. Functions that can print the Gr{\"o}bner basis
2140are \texttt{PrintTraceList} (\ref{PrintTraceList}) (with the trace) and \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}) (without the trace).
2141
2142 \emph{Example:} For the list of the following two polynomials in NP format, a traced
2143Gr{\"o}bner basis is computed.
2144\begin{Verbatim}[fontsize=\small,frame=single,label=]
2145  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2146  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2147  gap> GBT := SGrobnerTrace([p1,p2]);
2148  [ rec( pol := [ [ [ 2 ], [ 1 ] ], [ 1, -1 ] ],
2149        trace := [ [ [  ], 1, [ 2, 1, 1, 2 ], -1 ], [ [ 2 ], 1, [  ], -1 ],
2150            [ [ 1 ], 1, [  ], 1 ], [ [ 1, 1 ], 2, [ 1, 2 ], 1 ] ] ),
2151    rec( pol := [ [ [ 1, 1, 1 ], [  ] ], [ 1, -1 ] ],
2152        trace := [ [ [ 2 ], 1, [ 2, 1 ], 1 ], [ [  ], 1, [ 2, 1, 1 ], 1 ],
2153            [ [  ], 2, [  ], 1 ], [ [ 2, 1, 1 ], 2, [  ], -1 ],
2154            [ [ 1, 1 ], 2, [ 1 ], -1 ] ] ) ]
2155\end{Verbatim}
2156 }
2157
2158
2159
2160\subsection{\textcolor{Chapter }{StrongNormalFormTraceDiff}}
2161\logpage{[ 3, 7, 6 ]}\nobreak
2162\label{StrongNormalFormTraceDiff}
2163\hyperdef{L}{X8219059A86A54130}{}
2164{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{StrongNormalFormTraceDiff({\mdseries\slshape np, GBT})\index{StrongNormalFormTraceDiff@\texttt{StrongNormalFormTraceDiff}}
2165\label{StrongNormalFormTraceDiff}
2166}\hfill{\scriptsize (function)}}\\
2167\textbf{\indent Returns:\ }
2168 The traced polynomial for the difference of \mbox{\texttt{\mdseries\slshape f}} with the strong normal form of \mbox{\texttt{\mdseries\slshape np}} with respect to \mbox{\texttt{\mdseries\slshape GBT}}
2169
2170
2171
2172 When invoked with a polynomial \mbox{\texttt{\mdseries\slshape np}} in NP format as its first argument, and a traced Gr{\"o}bner basis \mbox{\texttt{\mdseries\slshape GBT}} as generated by \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}), this function returns the difference of \mbox{\texttt{\mdseries\slshape np}} with the strong normal form of \mbox{\texttt{\mdseries\slshape np}} with respect to \mbox{\texttt{\mdseries\slshape GBT}}. This difference \texttt{d} is returned as a traced polynomial. The trace information \texttt{d.trace} gives an expression of \texttt{d.pol} as a combination of polynomials from the list of polynomials to which the
2173trace parts of \mbox{\texttt{\mdseries\slshape GBT}} are referring. Typically, this is the set of relations used as input to the
2174computation of \mbox{\texttt{\mdseries\slshape GBT}}.
2175
2176 Note that the difference of the polynomials \mbox{\texttt{\mdseries\slshape np}} and \texttt{d.pol} is the same as the StrongNormalForm of \mbox{\texttt{\mdseries\slshape np}}.
2177
2178 \emph{Example:} First we compute the traced Gr{\"o}bner basis of the list of the following two
2179polynomials in NP format.
2180\begin{Verbatim}[fontsize=\small,frame=single,label=]
2181  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2182  gap> p2 := [[[2,2,1],[]],[1,-1]];;
2183  gap> GBT := SGrobnerTrace([p1,p2]);;
2184\end{Verbatim}
2185 Of the polynomial $a^6$ we compute its difference with the normal form. The result is printed by used
2186of \texttt{PrintNP} (\ref{PrintNP}) and \texttt{PrintTraceList} (\ref{PrintTraceList}).
2187\begin{Verbatim}[fontsize=\small,frame=single,label=]
2188  gap> f := [[[1,1,1,1,1,1]],[1]];;
2189  gap> sf := StrongNormalFormTraceDiff(f,GBT);;
2190  gap> PrintNP(sf.pol);
2191   a^6 - 1
2192  gap> PrintTraceList([sf]);
2193   G(1)ba^2 + bG(1)ba + G(1)ba^5 + bG(1)ba^4 + G(2) + G(2)a^3 - a^2G(
2194  2)a - ba^2G(2) - a^2G(2)a^4 - ba^2G(2)a^3
2195\end{Verbatim}
2196 }
2197
2198 }
2199
2200
2201\section{\textcolor{Chapter }{Functions of the truncated variant}}\label{truncfun}
2202\logpage{[ 3, 8, 0 ]}
2203\hyperdef{L}{X7E4E3AD07B2465F9}{}
2204{
2205
2206\subsection{\textcolor{Chapter }{Examples}}\logpage{[ 3, 8, 1 ]}
2207\hyperdef{L}{X7A489A5D79DA9E5C}{}
2208{
2209 More about these functions can be found in \ref{Example11} }
2210
2211
2212
2213\subsection{\textcolor{Chapter }{SGrobnerTrunc}}
2214\logpage{[ 3, 8, 2 ]}\nobreak
2215\label{SGrobnerTrunc}
2216\hyperdef{L}{X7CD043E081BF2302}{}
2217{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{SGrobnerTrunc({\mdseries\slshape Lnp, deg, wtv})\index{SGrobnerTrunc@\texttt{SGrobnerTrunc}}
2218\label{SGrobnerTrunc}
2219}\hfill{\scriptsize (function)}}\\
2220\textbf{\indent Returns:\ }
2221 A list of homogeneous NP polynomials if the first argument of the input is a
2222list of homogeneous NP polynomials, and the boolean \texttt{false} otherwise.
2223
2224
2225
2226 This functions should be invoked with a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format, a natural number \mbox{\texttt{\mdseries\slshape deg}}, and a weight vector \mbox{\texttt{\mdseries\slshape wtv}} of length the number of generators of the free algebra $A$ containing the elements of \mbox{\texttt{\mdseries\slshape Lnp}}, and with positive integers for entries. If the polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} are homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, the function will return a Gr{\"o}bner basis of \mbox{\texttt{\mdseries\slshape Lnp}} truncated above \mbox{\texttt{\mdseries\slshape deg}}. If the list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}} is not homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, it returns \texttt{false}. The homogeneity check can be carried out by \texttt{CheckHomogeneousNPs} (\ref{CheckHomogeneousNPs}).
2227
2228 \emph{Example:} Consider the following two polynomials in NP format.
2229\begin{Verbatim}[fontsize=\small,frame=single,label=]
2230  gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
2231  gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
2232  gap> PrintNPList([p1,p2]);
2233   ab^2a - ba^2b
2234   b^3 - a^2
2235\end{Verbatim}
2236 These are homogeneous with respect to weights $[3,2]$. The degrees are $10$ and $6$, respectively. The Gr{\"o}bner basis truncated above degree 12 of the list \texttt{[p1,p2]} is computed and subsequently printed as follows.
2237\begin{Verbatim}[fontsize=\small,frame=single,label=]
2238  gap> PrintNPList(SGrobnerTrunc([p1,p2],12,[3,2]));
2239   ba^2 - a^2b
2240   b^3 - a^2
2241   ab^2a - a^2b^2
2242\end{Verbatim}
2243 }
2244
2245
2246
2247\subsection{\textcolor{Chapter }{CheckHomogeneousNPs}}
2248\logpage{[ 3, 8, 3 ]}\nobreak
2249\label{CheckHomogeneousNPs}
2250\hyperdef{L}{X83C9E598798D5809}{}
2251{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{CheckHomogeneousNPs({\mdseries\slshape Lnp, wtv})\index{CheckHomogeneousNPs@\texttt{CheckHomogeneousNPs}}
2252\label{CheckHomogeneousNPs}
2253}\hfill{\scriptsize (function)}}\\
2254\textbf{\indent Returns:\ }
2255 A list of weighted degrees of the polynomials if these are homogeneous with
2256respect to \mbox{\texttt{\mdseries\slshape wtv}}, and \texttt{false} otherwise.
2257
2258
2259
2260 When invoked with a list of NP polynomials \mbox{\texttt{\mdseries\slshape Lnp}} and a weight vector \mbox{\texttt{\mdseries\slshape wtv}} (whose entries should be positive integers), this function returns the list of
2261weighted degrees of the polynomials in \mbox{\texttt{\mdseries\slshape Lnp}} if these are all homogeneous and nonzero, and \texttt{false} otherwise. Here, a polynomial is (weighted) homogeneous with respect to a
2262weight vector $w$ if there is constant $d$ such that, for each monomial $[t_1,...,t_r]$ of the polynomial the sum of all $w[t_i]$ for $i$ in $[1..r]$ is equal to $d$. The natural number $d$ is then called the weighted degree of the polynomial.
2263
2264 \emph{Example:} Consider the following two polynomials in NP format.
2265\begin{Verbatim}[fontsize=\small,frame=single,label=]
2266  gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
2267  gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
2268  gap> PrintNPList([p1,p2]);
2269   ab^2a - ba^2b
2270   b^3 - a^2
2271\end{Verbatim}
2272 These are homogeneous with respect to weights $[3,2]$. The degrees are $10$ and $6$, respectively. This is checked as follows.
2273\begin{Verbatim}[fontsize=\small,frame=single,label=]
2274  gap> CheckHomogeneousNPs([p1,p2],[3,2]);
2275  [ 10, 6 ]
2276\end{Verbatim}
2277 }
2278
2279
2280
2281\subsection{\textcolor{Chapter }{BaseQATrunc}}
2282\logpage{[ 3, 8, 4 ]}\nobreak
2283\label{BaseQATrunc}
2284\hyperdef{L}{X7E33C064875D95CA}{}
2285{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{BaseQATrunc({\mdseries\slshape Lnp, deg, wtv})\index{BaseQATrunc@\texttt{BaseQATrunc}}
2286\label{BaseQATrunc}
2287}\hfill{\scriptsize (function)}}\\
2288\textbf{\indent Returns:\ }
2289 A list of monomials if the first argument of the input is a list of
2290homogeneous NP polynomials or \texttt{false}.
2291
2292
2293
2294 When invoked with a list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}}, a natural number \mbox{\texttt{\mdseries\slshape deg}}, and a weight vector \mbox{\texttt{\mdseries\slshape wtv}} of length the number of variables and with positive integers for entries, such
2295that the polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} are homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, it returns a list whose $i$-th entry is a basis of monomials of the homogeneous part of degree $i-1$ the quotient algebra of the free noncommutative algebra by the weighted
2296homogeneous ideal generated by \mbox{\texttt{\mdseries\slshape Lnp}} truncated above \mbox{\texttt{\mdseries\slshape deg}}. If the list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}} is not homogeneous, it returns \texttt{false}.
2297
2298 \emph{Example:} Consider the truncated Gr{\"o}bner basis of the following two polynomials in
2299NP format.
2300\begin{Verbatim}[fontsize=\small,frame=single,label=]
2301  gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
2302  gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
2303  gap> wtv := [3,2];;
2304  gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
2305  gap> GBNP.ConfigPrint("a","b");
2306  gap> PrintNPList(GB);
2307   ba^2 - a^2b
2308   b^3 - a^2
2309   ab^2a - a^2b^2
2310\end{Verbatim}
2311 A basis of standard monomials is found and printed as follows.
2312\begin{Verbatim}[fontsize=\small,frame=single,label=]
2313  gap> BT := BaseQATrunc(GB,12,wtv);;
2314  gap> for degpart in BT do
2315  >   for mon in degpart do PrintNP([[mon],[1]]); od;
2316  > od;
2317   1
2318   b
2319   a
2320   b^2
2321   ba
2322   ab
2323   a^2
2324   b^3
2325   b^2a
2326   bab
2327   ab^2
2328   aba
2329   a^2b
2330   b^4
2331   a^3
2332   b^3a
2333   b^2ab
2334   bab^2
2335   ab^3
2336   baba
2337   abab
2338   a^2b^2
2339   b^5
2340   a^2ba
2341   b^4a
2342   a^3b
2343   b^3ab
2344   b^2ab^2
2345   bab^3
2346   ab^4
2347   a^4
2348   b^2aba
2349   ab^3a
2350   babab
2351   abab^2
2352   a^2b^3
2353   b^6
2354\end{Verbatim}
2355 }
2356
2357
2358
2359\subsection{\textcolor{Chapter }{DimsQATrunc}}
2360\logpage{[ 3, 8, 5 ]}\nobreak
2361\label{DimsQATrunc}
2362\hyperdef{L}{X7C6882DB837A9F5A}{}
2363{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{DimsQATrunc({\mdseries\slshape Lnp, deg, wtv})\index{DimsQATrunc@\texttt{DimsQATrunc}}
2364\label{DimsQATrunc}
2365}\hfill{\scriptsize (function)}}\\
2366\textbf{\indent Returns:\ }
2367 A list of monomials if the first argument of the input is a list of
2368homogeneous NP polynomials or \texttt{false}.
2369
2370
2371
2372 When invoked with a list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}}, a natural number \mbox{\texttt{\mdseries\slshape deg}}, and a weight vector \mbox{\texttt{\mdseries\slshape wtv}} of length the number of variables and with positive integers for entries, such
2373that the polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} are homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, it returns a list of dimensions of the homogeneous parts of the quotient
2374algebra of the free noncommutative algebra by the ideal generated by \mbox{\texttt{\mdseries\slshape Lnp}} truncated above \mbox{\texttt{\mdseries\slshape deg}}. The $i$-th entry of the list gives the dimension of the homogeneous part of degree $i-1$ of the quotient algebra. If the list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}} is not homogeneous, it returns \texttt{false}.
2375
2376 \emph{Example:} Consider the truncated Gr{\"o}bner basis of the following two polynomials in
2377NP format.
2378\begin{Verbatim}[fontsize=\small,frame=single,label=]
2379  gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
2380  gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
2381  gap> wtv := [3,2];;
2382  gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
2383\end{Verbatim}
2384 Information on the dimensions of the homogeneous parts of the quotient algebra
2385is found as follows,
2386\begin{Verbatim}[fontsize=\small,frame=single,label=]
2387  gap> DimsQATrunc(GB,12,wtv);
2388  [ 1, 0, 1, 1, 1, 2, 2, 3, 3, 5, 4, 7, 7 ]
2389\end{Verbatim}
2390 }
2391
2392
2393
2394\subsection{\textcolor{Chapter }{FreqsQATrunc}}
2395\logpage{[ 3, 8, 6 ]}\nobreak
2396\label{FreqsQATrunc}
2397\hyperdef{L}{X7FBA7F1D79DA883F}{}
2398{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{FreqsQATrunc({\mdseries\slshape Lnp, deg, wtv})\index{FreqsQATrunc@\texttt{FreqsQATrunc}}
2399\label{FreqsQATrunc}
2400}\hfill{\scriptsize (function)}}\\
2401\textbf{\indent Returns:\ }
2402 A list of multiplicities of frequencies of monomials if the first argument of
2403the input is a list of homogeneous polynomials in NP format, and \texttt{false} otherwise.
2404
2405
2406
2407 The frequency of a monomial is the list of numbers of occurrences of a
2408variable in the monomial for each variable; the multiplicity of a frequency is
2409the number of monomials in the standard basis for a quotient algebra with this
2410frequency. When invoked with a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format representing a (truncated) Gr{\"o}bner basis, a
2411natural number \mbox{\texttt{\mdseries\slshape deg}}, and a weight vector \mbox{\texttt{\mdseries\slshape wtv}} of length the number of variables and with positive integers for entries, such
2412that the polynomials of \mbox{\texttt{\mdseries\slshape Lnp}} are homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, it returns a list of frequencies occurring with their multiplicities for the
2413quotient algebra of the free noncommutative algebra by the ideal generated by \mbox{\texttt{\mdseries\slshape Lnp}} truncated above \mbox{\texttt{\mdseries\slshape deg}}. The $i$-th entry of the list gives the frequencies of the weight $(i-1)$ basis monomials of the quotient algebra. If the list of polynomials \mbox{\texttt{\mdseries\slshape Lnp}} is not homogeneous with respect to \mbox{\texttt{\mdseries\slshape wtv}}, it returns \texttt{false}.
2414
2415 \emph{Example:} Consider the truncated Gr{\"o}bner basis of the following two polynomials in
2416NP format.
2417\begin{Verbatim}[fontsize=\small,frame=single,label=]
2418  gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
2419  gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
2420  gap> wtv := [3,2];;
2421  gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
2422  gap> PrintNPList(GB);
2423   ba^2 - a^2b
2424   b^3 - a^2
2425   ab^2a - a^2b^2
2426\end{Verbatim}
2427 The multiplicities of the frequencies of of monomials in a standard basis of
2428the quotient algebra with respect to the ideal generated by \texttt{GB} is found as follows, for weights up to and including 8.
2429\begin{Verbatim}[fontsize=\small,frame=single,label=]
2430  gap> F := FreqsQATrunc(GB,8,wtv);
2431  [ [ [ [  ], 1 ] ], [ [ [ 0, 1 ], 1 ] ], [ [ [ 1, 0 ], 1 ] ],
2432    [ [ [ 0, 2 ], 1 ] ], [ [ [ 1, 1 ], 2 ] ],
2433    [ [ [ 2, 0 ], 1 ], [ [ 0, 3 ], 1 ] ], [ [ [ 1, 2 ], 3 ] ],
2434    [ [ [ 2, 1 ], 2 ], [ [ 0, 4 ], 1 ] ] ]
2435\end{Verbatim}
2436 The interpretation of this data is given by the following lines of code.
2437\begin{Verbatim}[fontsize=\small,frame=single,label=]
2438  gap> for f in F do
2439  >   if f[1][1] <> [] then
2440  >     Print("At level ", wtv * (f[1][1]), " the multiplicities are\n");
2441  >     for x in f do
2442  >       Print("  for ",x[1],": ",x[2],"\n");
2443  >     od;
2444  >   else
2445  >     Print("At level ", 0 , " the multiplicity of [] is ",f[1][2],"\n");
2446  >   fi;
2447  >   Print("\n");
2448  > od;
2449  At level 0 the multiplicity of [] is 1
2450
2451  At level 2 the multiplicities are
2452    for [ 0, 1 ]: 1
2453
2454  At level 3 the multiplicities are
2455    for [ 1, 0 ]: 1
2456
2457  At level 4 the multiplicities are
2458    for [ 0, 2 ]: 1
2459
2460  At level 5 the multiplicities are
2461    for [ 1, 1 ]: 2
2462
2463  At level 6 the multiplicities are
2464    for [ 2, 0 ]: 1
2465    for [ 0, 3 ]: 1
2466
2467  At level 7 the multiplicities are
2468    for [ 1, 2 ]: 3
2469
2470  At level 8 the multiplicities are
2471    for [ 2, 1 ]: 2
2472    for [ 0, 4 ]: 1
2473
2474\end{Verbatim}
2475 }
2476
2477 }
2478
2479
2480\section{\textcolor{Chapter }{Functions of the module variant}}\label{NPMs}
2481\logpage{[ 3, 9, 0 ]}
2482\hyperdef{L}{X8706DD3287E82019}{}
2483{
2484
2485
2486\subsection{\textcolor{Chapter }{SGrobnerModule}}
2487\logpage{[ 3, 9, 1 ]}\nobreak
2488\label{SGrobnerModule}
2489\hyperdef{L}{X860966487ED88A43}{}
2490{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{SGrobnerModule({\mdseries\slshape Lnpm, Lnp})\index{SGrobnerModule@\texttt{SGrobnerModule}}
2491\label{SGrobnerModule}
2492}\hfill{\scriptsize (function)}}\\
2493\textbf{\indent Returns:\ }
2494 A record \texttt{GBR} containing a Gr{\"o}bner basis (if found...the general problem is unsolvable)
2495for modules; \texttt{GBR.p} will contain the prefix rules and \texttt{GBR.ts} will contain the two-sided rules, and \texttt{GBR.pg} will be the smallest rank of the free module to which all prefix relations
2496belong
2497
2498
2499
2500 For a list \mbox{\texttt{\mdseries\slshape Lnpm}} of vectors in NPM format (see Section \ref{NP}), and a list \mbox{\texttt{\mdseries\slshape Lnp}} of polynomials in NP format, this function will use Buchberger's algorithm
2501with strong normal form applied to the union of \mbox{\texttt{\mdseries\slshape Lnpm}}, \mbox{\texttt{\mdseries\slshape Lnp}}, the set of polynomials $x*e-x$ and $x*m[i]$ for $x$ a standard indeterminate, a module generator $m[j]$ or the dummy indeterminate $e$, and the set of all $e*x -x$ for $x$ a standard indeterminate, to find a Gr{\"o}bner Basis record \texttt{GBR} (if possible; the general problem is unsolvable). This record will have a
2502Gr{\"o}bner Basis \texttt{GBR.ts} for the two-sided ideal generated by \mbox{\texttt{\mdseries\slshape Lnp}} and an intersection with the module \texttt{GBR.p} representing the module relations needed to find representative vectors in the
2503module uniquely by means of a strong normal form computation modding out \texttt{GBR.p} and, for the scalars, \texttt{GBR.ts}.
2504
2505 \emph{Example:} Consider the following two polynomials in NP format.
2506\begin{Verbatim}[fontsize=\small,frame=single,label=]
2507  gap> p1 := [[[1,1,2],[]],[1,-2]];;
2508  gap> p2 := [[[1,2,2],[]],[1,-3]];;
2509\end{Verbatim}
2510 Consider also the following two vectors in NPM format.
2511\begin{Verbatim}[fontsize=\small,frame=single,label=]
2512  gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
2513  gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
2514\end{Verbatim}
2515 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule}:
2516\begin{Verbatim}[fontsize=\small,frame=single,label=]
2517  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
2518\end{Verbatim}
2519 The record \texttt{GBR} has two fields, \texttt{p} for prefix relations (vectors in the module) and \texttt{ts} for two-sided relations (polynomials in the algebra):
2520\begin{Verbatim}[fontsize=\small,frame=single,label=]
2521  gap> PrintNPList(GBR.p);
2522  [ 0, 1 ]
2523  [ 1 , 0]
2524  gap> PrintNPList(GBR.ts);
2525   b - 3/2a
2526   a^3 - 4/3
2527\end{Verbatim}
2528 }
2529
2530
2531
2532\subsection{\textcolor{Chapter }{BaseQM}}
2533\logpage{[ 3, 9, 2 ]}\nobreak
2534\label{BaseQM}
2535\hyperdef{L}{X7E3160E67C504F37}{}
2536{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{BaseQM({\mdseries\slshape GBR, t, mt, maxno})\index{BaseQM@\texttt{BaseQM}}
2537\label{BaseQM}
2538}\hfill{\scriptsize (function)}}\\
2539\textbf{\indent Returns:\ }
2540A basis of the module obtained from the free module of rank \mbox{\texttt{\mdseries\slshape mt}} over the free algebra on \mbox{\texttt{\mdseries\slshape t}} generators by factoring out the submodule generated by the elements of \mbox{\texttt{\mdseries\slshape GBR}}
2541
2542
2543
2544 When called with a Gr{\"o}bner basis record \mbox{\texttt{\mdseries\slshape GBR}} (see Section \ref{GBR}), the number of variables \mbox{\texttt{\mdseries\slshape t}}, the number of module generators \mbox{\texttt{\mdseries\slshape mt}}, and a maximum number of terms to be found, \mbox{\texttt{\mdseries\slshape maxno}}, the function \texttt{BaseQM} will return a (partial) base of the quotient module of $A^{mt}$ over the free algebra on $A$ on \texttt{t} generators by the right sub $A$-module generated by the elements of \mbox{\texttt{\mdseries\slshape GBR}}. Note that the record \mbox{\texttt{\mdseries\slshape GBR}} consists of two fields: the list \mbox{\texttt{\mdseries\slshape GBR.p}} of vectors in NPM format representing elements of the free module $A^{mt}$, and the list \mbox{\texttt{\mdseries\slshape GBR.ts}} of polynomials in NP format representing elements of $A$. The submodule generated by \mbox{\texttt{\mdseries\slshape GBR}} is considered to be the right submodule of $A^{mt}$ generated by \mbox{\texttt{\mdseries\slshape GBR.p}} and all elements of the form $v\cdot np$ with $np$ in the two-sided ideal of $A$ generated by \mbox{\texttt{\mdseries\slshape GBR.ts}} and $v$ in $A^{mt}$. If this function is invoked with \mbox{\texttt{\mdseries\slshape maxno}} equal to 0, then a full basis will be given.
2545
2546 If \mbox{\texttt{\mdseries\slshape t}}$=0$, then \texttt{t} will be set to the minimal value such that all polynomials of \mbox{\texttt{\mdseries\slshape GBR.ts}} and all polynomials occurring in \mbox{\texttt{\mdseries\slshape GBR.p}} have at most \texttt{t} variables.
2547
2548 If \mbox{\texttt{\mdseries\slshape mt}}$=0$, then \texttt{mt} will be set to the minimal value such that all vectors of \mbox{\texttt{\mdseries\slshape GBR.p}} belong to $A^{mt}$.
2549
2550 If the module is cyclic (that is, has a single generator), it is possible to
2551use the Gr{\"o}bner basis of the ideal in the algebra instead of the
2552Gr{\"o}bner basis record. This can be done by entering 0 for the number \mbox{\texttt{\mdseries\slshape mt}} of module generators.
2553
2554 \emph{Example:} Consider the following two polynomials in NP format.
2555\begin{Verbatim}[fontsize=\small,frame=single,label=]
2556  gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
2557  gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
2558\end{Verbatim}
2559 Consider also the following two vectors in NPM format.
2560\begin{Verbatim}[fontsize=\small,frame=single,label=]
2561  gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
2562  gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
2563\end{Verbatim}
2564 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule} (\ref{SGrobnerModule}):
2565\begin{Verbatim}[fontsize=\small,frame=single,label=]
2566  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
2567  gap> PrintNPList(GBR.ts);
2568   ba - ab
2569   b^2 - a^2
2570   a^3b - 1
2571   a^5 - b
2572  gap> PrintNPList(GBR.p);
2573  [ 0, 1 ]
2574  [ b - a , 0]
2575  [ a^2 - 1 , 0]
2576  [ ab - 1 , 0]
2577\end{Verbatim}
2578 The function \texttt{BaseQM} computes a basis.
2579\begin{Verbatim}[fontsize=\small,frame=single,label=]
2580  gap> B := BaseQM(GBR,2,2,0);;
2581  gap> PrintNPList(B);
2582  [ 1 , 0]
2583  [ a , 0]
2584\end{Verbatim}
2585 The function \texttt{BaseQM} with arguments so as to let the number of dimensions of the module and the
2586number of variables be chosen minimal.
2587\begin{Verbatim}[fontsize=\small,frame=single,label=]
2588  gap> B := BaseQM(GBR,0,0,0);;
2589  gap> PrintNPList(B);
2590  [ 1 , 0]
2591  [ a , 0]
2592\end{Verbatim}
2593 The function \texttt{BaseQM} can also be used to ompute the first three elements of a basis.
2594\begin{Verbatim}[fontsize=\small,frame=single,label=]
2595  gap> B := BaseQM(GBR,2,2,3);;
2596  gap> PrintNPList(B);
2597  [ 1 , 0]
2598  [ a , 0]
2599\end{Verbatim}
2600 }
2601
2602
2603
2604\subsection{\textcolor{Chapter }{DimQM}}
2605\logpage{[ 3, 9, 3 ]}\nobreak
2606\label{DimQM}
2607\hyperdef{L}{X813E6A2C8709C9F3}{}
2608{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{DimQM({\mdseries\slshape GBR, t, mt})\index{DimQM@\texttt{DimQM}}
2609\label{DimQM}
2610}\hfill{\scriptsize (function)}}\\
2611\textbf{\indent Returns:\ }
2612The dimension of the quotient module
2613
2614
2615
2616 When called with a Gr{\"o}bner basis record \mbox{\texttt{\mdseries\slshape GBR}} (see Section \ref{GBR}), a number of variables \mbox{\texttt{\mdseries\slshape t}} at least equal to the number of generators involved in the polynomials of \mbox{\texttt{\mdseries\slshape GBR.p}} and \mbox{\texttt{\mdseries\slshape GBR.ts}}, and a number of generators \mbox{\texttt{\mdseries\slshape mt}} of a free module containing the prefix relations in \mbox{\texttt{\mdseries\slshape GBR.p}}, the function \texttt{DimQM} will return the dimension over the coefficient field of the quotient module of
2617the free right module $A^{mt}$ of rank \mbox{\texttt{\mdseries\slshape mt}} over the free algebra $A$ on \texttt{t} generators by the right sub $A$-module generated by the elements of \mbox{\texttt{\mdseries\slshape GBR}}, if this dimension is finite. Otherwise, the computation invoked by the
2618function will not terminate.
2619
2620 If \mbox{\texttt{\mdseries\slshape t}}$=0$, then \texttt{t} will be set to the minimal value such that all polynomials of \mbox{\texttt{\mdseries\slshape GBR.ts}} and all polynomials occurring in \mbox{\texttt{\mdseries\slshape GBR.p}} belong to $A^{mt}$.
2621
2622 If \mbox{\texttt{\mdseries\slshape mt}}$=0$, then \texttt{mt} will be set to the minimal value such that all vectors of \mbox{\texttt{\mdseries\slshape GBR.p}} belong to $A^{mt}$. \emph{Example:} Consider the following two polynomials in NP format.
2623\begin{Verbatim}[fontsize=\small,frame=single,label=]
2624  gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
2625  gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
2626\end{Verbatim}
2627 Consider also the following two vectors in NPM format.
2628\begin{Verbatim}[fontsize=\small,frame=single,label=]
2629  gap> v1 := [[[-1,1,2],[-2]],[1,-1]];;
2630  gap> v2 := [[[-2,2,2],[-1]],[1,-2]];;
2631\end{Verbatim}
2632 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule} (\ref{SGrobnerModule}):
2633\begin{Verbatim}[fontsize=\small,frame=single,label=]
2634  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
2635\end{Verbatim}
2636 The function \texttt{DimQM} computes the dimension over the rationals of the quotient of the free module
2637over the free algebra on two generators by the submodule generated by the
2638vectors \texttt{v1}, \texttt{v2}, $[p,q]$, where $p$ and $q$ run over all elements of the two-sided ideal in the free algebra generated by \texttt{p1} and \texttt{p2}.
2639\begin{Verbatim}[fontsize=\small,frame=single,label=]
2640  gap> SetInfoLevel(InfoGBNP,2);
2641  gap> DimQM(GBR,2,2);
2642  0
2643\end{Verbatim}
2644 The answer should be equal to the size of \texttt{BaseQM(GBR,t,mt,0)}.
2645\begin{Verbatim}[fontsize=\small,frame=single,label=]
2646  gap> DimQM(GBR,2,2) = Length(BaseQM(GBR,2,2,0));
2647  true
2648  gap> SetInfoLevel(InfoGBNP,0);
2649\end{Verbatim}
2650 }
2651
2652
2653
2654\subsection{\textcolor{Chapter }{MulQM}}
2655\logpage{[ 3, 9, 4 ]}\nobreak
2656\label{MulQM}
2657\hyperdef{L}{X805FB42A7EEF510F}{}
2658{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{MulQM({\mdseries\slshape p1, p2, GBR})\index{MulQM@\texttt{MulQM}}
2659\label{MulQM}
2660}\hfill{\scriptsize (function)}}\\
2661\textbf{\indent Returns:\ }
2662The strong normal form of the product \mbox{\texttt{\mdseries\slshape p1}}$*$\mbox{\texttt{\mdseries\slshape p2}} with respect to \mbox{\texttt{\mdseries\slshape GBR}}
2663
2664
2665
2666 When called with three arguments, the first of which, \mbox{\texttt{\mdseries\slshape p1}}, is a module element in NPM format, the second of which, \mbox{\texttt{\mdseries\slshape p2}}, is a polynomial in NP format representing an element of the quotient
2667algebra, and the third of which is a Gr{\"o}bner basis record \mbox{\texttt{\mdseries\slshape GBR}}, this function will return the product \texttt{p1*p2} in the module.
2668
2669 \emph{Example:} Consider the following two polynomials in NP format.
2670\begin{Verbatim}[fontsize=\small,frame=single,label=]
2671  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2672  gap> p2 := [[[1,2,2],[]],[1,-1]];;
2673  gap> PrintNPList([p1,p2]);
2674   a^2b - 1
2675   ab^2 - 1
2676\end{Verbatim}
2677 Consider also the following two vectors in NPM format.
2678\begin{Verbatim}[fontsize=\small,frame=single,label=]
2679  gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
2680  gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
2681  gap> PrintNPList([v1,v2]);
2682  [ ab - 1 , 0]
2683  [ 0, b^2 - 2 ]
2684\end{Verbatim}
2685 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule} (\ref{SGrobnerModule}):
2686\begin{Verbatim}[fontsize=\small,frame=single,label=]
2687  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
2688  gap> PrintNPList(GBR.ts);
2689   b - a
2690   a^3 - 1
2691  gap> PrintNPList(GBR.p);
2692  [ 0, 1 ]
2693  [ a - 1 , 0]
2694\end{Verbatim}
2695 The function \texttt{MulQM} computes the product of the vector \texttt{w} with the polynomial \texttt{q}.
2696\begin{Verbatim}[fontsize=\small,frame=single,label=]
2697  gap> w := [[[-1,2],[-2,1]],[1,-4]];;
2698  gap> PrintNP(w);
2699  [ b , - 4a ]
2700  gap> q := [[[2,2,1],[1]],[2,3]];;
2701  gap> PrintNP(q);
2702   2b^2a + 3a
2703  gap> wq := MulQM(w,q,GBR);;
2704  gap> PrintNP(wq);
2705  [ 5 , 0]
2706\end{Verbatim}
2707 }
2708
2709
2710
2711\subsection{\textcolor{Chapter }{StrongNormalFormNPM}}
2712\logpage{[ 3, 9, 5 ]}\nobreak
2713\label{StrongNormalFormNPM}
2714\hyperdef{L}{X87D51A8379C50A80}{}
2715{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{StrongNormalFormNPM({\mdseries\slshape f, GBR})\index{StrongNormalFormNPM@\texttt{StrongNormalFormNPM}}
2716\label{StrongNormalFormNPM}
2717}\hfill{\scriptsize (function)}}\\
2718\textbf{\indent Returns:\ }
2719 The strong normal form of a polynomial in NP format with respect to \mbox{\texttt{\mdseries\slshape GBR}}
2720
2721
2722
2723 When invoked with a polynomial in NP format (see Section \ref{NP}) and a Gr{\"o}bner basis record \mbox{\texttt{\mdseries\slshape GBR}} (see Section \ref{GBR}), this function will return the strong normal form (the polynomial reduced by
2724the prefix and two-sided relations of the Gr{\"o}bner basis combination).
2725
2726 This function assumes that \mbox{\texttt{\mdseries\slshape GBR.p}} and \mbox{\texttt{\mdseries\slshape GBR.ts}} are ordered (with the ordering \texttt{LtNP} (\ref{LtNP})), that the polynomials in \mbox{\texttt{\mdseries\slshape GBR.ts}} are monic and clean (see \texttt{MkMonicNP} (\ref{MkMonicNP}) and \texttt{CleanNP} (\ref{CleanNP})), and that the polynomial \mbox{\texttt{\mdseries\slshape f}} is clean. Note that a Gr{\"o}bner basis record as returned by a function like \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is in the required form.
2727
2728 \emph{Example:} Consider the following two polynomials in NP format.
2729\begin{Verbatim}[fontsize=\small,frame=single,label=]
2730  gap> p1 := [[[1,1,2],[]],[1,-1]];;
2731  gap> p2 := [[[1,2,2],[]],[1,-1]];;
2732  gap> PrintNPList([p1,p2]);
2733   a^2b - 1
2734   ab^2 - 1
2735\end{Verbatim}
2736 Consider also the following two vectors in NPM format.
2737\begin{Verbatim}[fontsize=\small,frame=single,label=]
2738  gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
2739  gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
2740  gap> PrintNPList([v1,v2]);
2741  [ ab - 1 , 0]
2742  [ 0, b^2 - 2 ]
2743\end{Verbatim}
2744 The Gr{\"o}bner basis record for this data is found by \texttt{SGrobnerModule} (\ref{SGrobnerModule}):
2745\begin{Verbatim}[fontsize=\small,frame=single,label=]
2746  gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
2747  gap> PrintNPList(GBR.ts);
2748   b - a
2749   a^3 - 1
2750  gap> PrintNPList(GBR.p);
2751  [ 0, 1 ]
2752  [ a - 1 , 0]
2753\end{Verbatim}
2754 The vector \texttt{w} is brought into strong normal form with respect to \texttt{GBR}:
2755\begin{Verbatim}[fontsize=\small,frame=single,label=]
2756  gap> w := [[[-1,2],[-2,1]],[1,-4]];;
2757  gap> PrintNP(w);
2758  [ b , - 4a ]
2759  gap> v := StrongNormalFormNPM(w,GBR);;
2760  gap> PrintNP(v);
2761  [ 1 , 0]
2762\end{Verbatim}
2763 }
2764
2765 }
2766
2767 }
2768
2769
2770\chapter{\textcolor{Chapter }{Info Level}}\label{Info}
2771\logpage{[ 4, 0, 0 ]}
2772\hyperdef{L}{X79C5DF3782576D98}{}
2773{
2774
2775\section{\textcolor{Chapter }{Introduction}}\logpage{[ 4, 1, 0 ]}
2776\hyperdef{L}{X7DFB63A97E67C0A1}{}
2777{
2778 Many functions of the GBNP package can produce additional output. Such output
2779might be useful for long calculations, to see where the calculation is or to
2780gain more information about the calculation itself.
2781
2782 \textsf{GAP} provides the tools to be able to tune the output of the functions. All of the
2783functions of this package use the \texttt{InfoClass} \texttt{InfoGBNP} (\ref{InfoGBNP}) and some use the \texttt{InfoClass} \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}). As usual with GAP when this is left at 0, the functions will hardly print
2784additional information. It can be set to 1 or 2 with \texttt{SetInfoLevel} (more about this function can be found at  \textbf{Reference: SetInfoLevel}). A brief explanation about each infolevel will be given in the next
2785sections. }
2786
2787
2788\section{\textcolor{Chapter }{InfoGBNP}}\logpage{[ 4, 2, 0 ]}
2789\hyperdef{L}{X82D40B0E84383BBC}{}
2790{
2791
2792
2793\subsection{\textcolor{Chapter }{InfoGBNP}}
2794\logpage{[ 4, 2, 1 ]}\nobreak
2795\hyperdef{L}{X82D40B0E84383BBC}{}
2796{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{InfoGBNP\index{InfoGBNP@\texttt{InfoGBNP}}
2797\label{InfoGBNP}
2798}\hfill{\scriptsize (info class)}}\\
2799
2800
2801 The \texttt{InfoClass} for this package is used in almost all functions. To change this level to 1
2802(some information) or 2 (more information, also information from calculation
2803loops) use the function \texttt{SetInfoLevel}. }
2804
2805
2806\subsection{\textcolor{Chapter }{What will be printed at level 0}}\logpage{[ 4, 2, 2 ]}
2807\hyperdef{L}{X8222A2F67E4CC62B}{}
2808{
2809 At level 0 no information is printed beyond what functions themselves command
2810to be printed. These include functions like \texttt{PrintNP} (\ref{PrintNP}), \texttt{PrintNPList} (\ref{PrintNPList}), \texttt{PrintTraceList} (\ref{PrintTraceList}) and \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}), but it also includes the function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}), which only prints one or two lines and \texttt{DimsQATrunc} (\ref{DimsQATrunc}) which produces information about a truncated Gr{\"o}bner basis. }
2811
2812
2813\subsection{\textcolor{Chapter }{What will be printed at level 1}}\logpage{[ 4, 2, 3 ]}
2814\hyperdef{L}{X8552D1FF7EA2B8A6}{}
2815{
2816 The infolevel can be set to 1 with the following command:
2817\begin{Verbatim}[fontsize=\small,frame=single,label=]
2818  SetInfoLevel(InfoGBNP,1);
2819\end{Verbatim}
2820 At level 1 a large set of functions will produce a bit of output. Most of this
2821information reports on the phase of the algorithm the calculations are in or
2822some simple statistics about the input or output. }
2823
2824
2825\subsection{\textcolor{Chapter }{What will be printed at level 2}}\logpage{[ 4, 2, 4 ]}
2826\hyperdef{L}{X7CC244E47F903B31}{}
2827{
2828 The infolevel can be set to 2 with the following command.
2829\begin{Verbatim}[fontsize=\small,frame=single,label=]
2830  SetInfoLevel(InfoGBNP,2);
2831\end{Verbatim}
2832 At level 2 a large set of functions will produce a lot of output. This mostly
2833concerns information on loops in the calculations. Timing information will be
2834printed as well. }
2835
2836  }
2837
2838
2839\section{\textcolor{Chapter }{InfoGBNPTime}}\logpage{[ 4, 3, 0 ]}
2840\hyperdef{L}{X7FAE244E80397B9A}{}
2841{
2842
2843
2844\subsection{\textcolor{Chapter }{InfoGBNPTime}}
2845\logpage{[ 4, 3, 1 ]}\nobreak
2846\hyperdef{L}{X7FAE244E80397B9A}{}
2847{\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{InfoGBNPTime\index{InfoGBNPTime@\texttt{InfoGBNPTime}}
2848\label{InfoGBNPTime}
2849}\hfill{\scriptsize (info class)}}\\
2850
2851
2852 The \texttt{InfoClass} for timing is used in producing information about the runtime of the algorithm
2853in certain possibly lengthy calculations.
2854
2855 To change this level to 1 (Gr{\"o}bner functions give information) or 2 (more
2856information, also information from other functions, which might not always
2857take a long time and from inside loops) use the function \texttt{SetInfoLevel}. }
2858
2859
2860\subsection{\textcolor{Chapter }{What will be printed at level 0}}\logpage{[ 4, 3, 2 ]}
2861\hyperdef{L}{X8222A2F67E4CC62B}{}
2862{
2863 No timing information will be printed at level 0. This can be desirable for
2864small examples or when producing test output, for use with \texttt{ReadTest}. }
2865
2866
2867\subsection{\textcolor{Chapter }{What will be printed at level 1}}\logpage{[ 4, 3, 3 ]}
2868\hyperdef{L}{X8552D1FF7EA2B8A6}{}
2869{
2870 The infolevel can be set to 1 with the following command:
2871\begin{Verbatim}[fontsize=\small,frame=single,label=]
2872  SetInfoLevel(InfoGBNPTime,1);
2873\end{Verbatim}
2874 At level one there will be time information printed by the functions from
2875different variants of the Gr{\"o}bner basis algorithm: \texttt{Grobner} (\ref{Grobner}), \texttt{SGrobner} (\ref{SGrobner}), \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}), and \texttt{SGrobnerTrunc} (\ref{SGrobnerTrunc}). }
2876
2877
2878\subsection{\textcolor{Chapter }{What will be printed at level 2}}\logpage{[ 4, 3, 4 ]}
2879\hyperdef{L}{X7CC244E47F903B31}{}
2880{
2881 The infolevel can be set to 2 with the following command:
2882\begin{Verbatim}[fontsize=\small,frame=single,label=]
2883  SetInfoLevel(InfoGBNPTime,2);
2884\end{Verbatim}
2885 At level two there will also be some information printed from a loop from
2886within \texttt{SGrobnerTrunc} (\ref{SGrobnerTrunc}).  }
2887
2888  }
2889
2890 }
2891
2892
2893
2894\appendix
2895
2896
2897\chapter{\textcolor{Chapter }{Examples}}\label{Examples}
2898\logpage{[ "A", 0, 0 ]}
2899\hyperdef{L}{X7A489A5D79DA9E5C}{}
2900{
2901
2902\section{\textcolor{Chapter }{Introduction}}\label{ExamplesIntroduction}
2903\logpage{[ "A", 1, 0 ]}
2904\hyperdef{L}{X7DFB63A97E67C0A1}{}
2905{
2906 In this chapter all available commented examples can be found. Those without
2907comments are in the directory \texttt{gbnp/examples}. Timing results are obtained on an Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
2908processor running Linux (3.19.0-42-generic
2909\#48\texttt{\symbol{126}}14.04.1-Ubuntu SMP Fri Dec 18 10:24:49 UTC 2015) and
2910using GAP 4.6.5.
2911\begin{itemize}
2912\item \ref{Example01} \hyperref[Example01]{`A simple commutative Gr{\"o}bner basis computation'}
2913\item \ref{Example02} \hyperref[Example02]{`A truncated Gr{\"o}bner basis for Leonard pairs'}
2914\item \ref{Example11} \hyperref[Example11]{`The truncated variant on two weighted homogeneous polynomials'}
2915\item \ref{Example03} \hyperref[Example03]{`The order of the Weyl group of type E$_6$'}
2916\item \ref{Example05} \hyperref[Example05]{`The gcd of some univariate polynomials'}
2917\item \ref{Example06} \hyperref[Example06]{`From the Tapas book'}
2918\item \ref{Example07} \hyperref[Example07]{`The Birman-Murakami-Wenzl algebra of type A$_3$'}
2919\item \ref{Example08} \hyperref[Example08]{`The Birman-Murakami-Wenzl algebra of type A$_2$'}
2920\item \ref{Example10} \hyperref[Example10]{`A commutative example by Mora'}
2921\item \ref{Example09} \hyperref[Example09]{`Tracing an example by Mora'}
2922\item \ref{Example13} \hyperref[Example13]{`Finiteness of the Weyl group of type E$_6$'}
2923
2924 This extends Example \ref{Example03}.
2925\item \ref{Example14} \hyperref[Example14]{`Preprocessing for Weyl group computations'}
2926
2927 This extends two earlier examples \ref{Example03} and \ref{Example13}.
2928\item \ref{Example15} \hyperref[Example15]{`A quotient algebra with exponential growth'}
2929\item \ref{Example16} \hyperref[Example16]{`A commutative quotient algebra of polynomial growth'}
2930
2931 This extends Example \ref{Example06}.
2932\item \ref{Example17} \hyperref[Example17]{`An algebra over a finite field'}
2933\item \ref{Example18} \hyperref[Example18]{`The dihedral group of order 8'}
2934\item \ref{Example19} \hyperref[Example19]{`The dihedral group of order 8 on another module'}
2935
2936 This extends Example \ref{Example18}.
2937\item \ref{Example20} \hyperref[Example20]{`The dihedral group on a non-cyclic module'}
2938
2939 This example also extends Example \ref{Example18}.
2940\item \ref{Example04} \hyperref[Example04]{`The icosahedral group'}
2941\item \ref{Example21} \hyperref[Example21]{`The symmetric inverse monoid for a set of size four'}
2942\item \ref{Example22} \hyperref[Example22]{`A module of the Hecke algebra of type A$_3$ over GF(3)'}
2943\item \ref{Example23} \hyperref[Example23]{`Generalized Temperley-Lieb algebras'}
2944\item \ref{Example12} \hyperref[Example12]{`The universal enveloping algebra of a Lie algebra'}
2945\item \ref{Example24} \hyperref[Example24]{`Serre's exercise'}
2946\item \ref{Example25} \hyperref[Example25]{`Baur and Draisma's transformations'}
2947\item \ref{ExampleColagen} \hyperref[ExampleColagen]{`The cola gene puzzle'}
2948\end{itemize}
2949 }
2950
2951
2952\section{\textcolor{Chapter }{A simple commutative Gr{\"o}bner basis computation}}\label{Example01}
2953\logpage{[ "A", 2, 0 ]}
2954\hyperdef{L}{X784586E47E2739E3}{}
2955{
2956  In this commutative example the relations are $x^2y-1$ and $xy^2-1$; we add $xy-yx$ to enforce that $x$ and $y$ commute. The answer should be $\{x^3-1, x-y, xy-yx\}$, as the reduction ordering is total degree first and then lexicographic with $ x $ smaller than $y$.
2957
2958 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
2959\begin{Verbatim}[fontsize=\small,frame=single,label=]
2960  gap> LoadPackage("GBNP","0",false);;
2961  gap> SetInfoLevel(InfoGBNP,2);
2962  gap> SetInfoLevel(InfoGBNPTime,1);
2963\end{Verbatim}
2964 Then input the relations in NP format (see Section \ref{NP}). They will be put in the list \texttt{Lnp}.
2965\begin{Verbatim}[fontsize=\small,frame=single,label=]
2966  gap> Lnp := [ [[[1,2],[2,1]],[1,-1]]   ];
2967  [ [ [ [ 1, 2 ], [ 2, 1 ] ], [ 1, -1 ] ] ]
2968  gap> x2y := [[[1,1,2],[]],[1,-1]];
2969  [ [ [ 1, 1, 2 ], [  ] ], [ 1, -1 ] ]
2970  gap>     AddSet(Lnp,x2y);
2971  gap> xy2 := [[[1,2,2],[]],[1,-1]];
2972  [ [ [ 1, 2, 2 ], [  ] ], [ 1, -1 ] ]
2973  gap>     AddSet(Lnp,xy2);
2974\end{Verbatim}
2975 The relations can be exhibited with \texttt{PrintNPList} (\ref{PrintNPList}):
2976\begin{Verbatim}[fontsize=\small,frame=single,label=]
2977  gap> PrintNPList(Lnp);
2978   a^2b - 1
2979   ab - ba
2980   ab^2 - 1
2981\end{Verbatim}
2982 Let the variables be printed as $x$ and $y$ instead of $a$ and $b$ by means of \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
2983\begin{Verbatim}[fontsize=\small,frame=single,label=]
2984  gap> GBNP.ConfigPrint("x","y");
2985\end{Verbatim}
2986 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}):
2987\begin{Verbatim}[fontsize=\small,frame=single,label=]
2988  gap> GB := SGrobner(Lnp);
2989  #I  number of entered polynomials is 3
2990  #I  number of polynomials after reduction is 3
2991  #I  End of phase I
2992  #I  End of phase II
2993  #I  length of G =1
2994  #I  length of todo is 1
2995  #I  length of G =2
2996  #I  length of todo is 0
2997  #I  List of todo lengths is [ 1, 1, 0 ]
2998  #I  End of phase III
2999  #I  G: Cleaning finished, 0 polynomials reduced
3000  #I  End of phase IV
3001  #I  The computation took 4 msecs.
3002  [ [ [ [ 2 ], [ 1 ] ], [ 1, -1 ] ], [ [ [ 1, 1, 1 ], [  ] ], [ 1, -1 ] ] ]
3003\end{Verbatim}
3004 When printed, it looks like:
3005\begin{Verbatim}[fontsize=\small,frame=single,label=]
3006  gap> PrintNPList(GB);
3007   y - x
3008   x^3 - 1
3009\end{Verbatim}
3010 The dimension of the quotient algebra can be calculated with \texttt{DimQA} (\ref{DimQA}). The arguments are the Gr{\"o}bner basis \texttt{GB} and the number of variables is \texttt{2}:
3011\begin{Verbatim}[fontsize=\small,frame=single,label=]
3012  gap> DimQA(GB,2);
3013  3
3014\end{Verbatim}
3015 A basis of this quotient algebra can be calculated with \texttt{BaseQA} (\ref{BaseQA}). The arguments are a Gr{\"o}bner basis \texttt{GB}, the number of variables \mbox{\texttt{\mdseries\slshape t}} ($=2$) and a variable \mbox{\texttt{\mdseries\slshape maxno}} for returning partial quotient algebras (0 means full basis). The calculated
3016basis will be printed as well.
3017\begin{Verbatim}[fontsize=\small,frame=single,label=]
3018  gap> B:=BaseQA(GB,2,0);;
3019  gap> PrintNPList(B);
3020   1
3021   x
3022   x^2
3023\end{Verbatim}
3024 The strong normal form of the element $xyxyxyx$ can be found by use of \texttt{StrongNormalFormNP} (\ref{StrongNormalFormNP}). The arguments are this element and the Gr{\"o}bner basis \texttt{GB}.
3025\begin{Verbatim}[fontsize=\small,frame=single,label=]
3026  gap> f:=[[[1,2,1,2,1,2,1]],[1]];;
3027  gap> PrintNP(f);
3028   xyxyxyx
3029  gap> p:=StrongNormalFormNP(f,GB);;
3030  gap> PrintNP(p);
3031   x
3032\end{Verbatim}
3033 }
3034
3035
3036\section{\textcolor{Chapter }{A truncated Gr{\"o}bner basis for Leonard pairs}}\label{Example02}
3037\logpage{[ "A", 3, 0 ]}
3038\hyperdef{L}{X7E1B57AA85C2BA70}{}
3039{
3040 To provide Terwilliger with experimental dimension information in low degrees
3041for his theory of Leonard pairs a truncated Gr{\"o}bner basis computation was
3042carried out as follows.
3043
3044 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 2 (for more information about the info level, see Chapter \ref{Info}).
3045\begin{Verbatim}[fontsize=\small,frame=single,label=]
3046  gap> LoadPackage("GBNP","0",false);;
3047  gap> SetInfoLevel(InfoGBNP,1);
3048  gap> SetInfoLevel(InfoGBNPTime,2);
3049\end{Verbatim}
3050 We truncate the example by putting all monomials of degree $n$ in the ideal by means of the function \texttt{MkTrLst} to be introduced below; a better way to compute the result is by means of the
3051truncated GB algorithms (See \ref{Example12}).
3052
3053 We want to truncate at degree 7 so we have fixed $n = 8$.
3054\begin{Verbatim}[fontsize=\small,frame=single,label=]
3055  gap> n := 8;;
3056\end{Verbatim}
3057 Now enter the relations in NP form (see \ref{NP}). The function \texttt{MkTrLst} will be introduced, which will return all monomials of degree \texttt{n}. The list of ideal generators of interest is called \texttt{I}.
3058\begin{Verbatim}[fontsize=\small,frame=single,label=]
3059  gap> sqbr := function(n,q) ; return (q^3-q^-3)/(q-q^(-1)); end;;
3060
3061  gap> c := sqbr(3,5);
3062  651/25
3063
3064  gap> s1 :=[[[1,1,1,2],[1,1,2,1],[1,2,1,1],[2,1,1,1]],[1,-c,c,-1]];;
3065  gap> s2 :=[[[2,2,2,1],[2,2,1,2],[2,1,2,2],[1,2,2,2]],[1,-c,c,-1]];;
3066
3067  gap> MkTrLst := function(l) local ans, h1, h2, a, i;
3068  >    ans := [[1],[2]];
3069  >    for i in [2..l] do
3070  >       h1 := [];
3071  >       h2 := [];
3072  >       for a in ans do
3073  >         Add(h1,Concatenation([1],a));
3074  >         Add(h2,Concatenation([2],a));
3075  >       od;
3076  >       ans := Concatenation(h1,h2);
3077  >    od;
3078  >    return List(ans, a -> [[a],[1]]);
3079  > end;;
3080
3081  gap> I := Concatenation([s1,s2],MkTrLst(n));;
3082\end{Verbatim}
3083 To give an impression, we print the first 20 entries of this list:
3084\begin{Verbatim}[fontsize=\small,frame=single,label=]
3085  gap> PrintNPList(I{[1..20]});
3086   a^3b - 651/25a^2ba + 651/25aba^2 - ba^3
3087   b^3a - 651/25b^2ab + 651/25bab^2 - ab^3
3088   a^8
3089   a^7b
3090   a^6ba
3091   a^6b^2
3092   a^5ba^2
3093   a^5bab
3094   a^5b^2a
3095   a^5b^3
3096   a^4ba^3
3097   a^4ba^2b
3098   a^4baba
3099   a^4bab^2
3100   a^4b^2a^2
3101   a^4b^2ab
3102   a^4b^3a
3103   a^4b^4
3104   a^3ba^4
3105   a^3ba^3b
3106\end{Verbatim}
3107 We calculate the Gr{\"o}bner basis with \texttt{SGrobner} (\ref{SGrobner}):
3108\begin{Verbatim}[fontsize=\small,frame=single,label=]
3109  gap> GB := SGrobner(I);;
3110  #I  number of entered polynomials is 258
3111  #I  number of polynomials after reduction is 114
3112  #I  End of phase I
3113  #I  End of phase II
3114  #I  End of phase III
3115  #I  Time needed to clean G :0
3116  #I  End of phase IV
3117  #I  The computation took 176 msecs.
3118\end{Verbatim}
3119 Now print the first part of the Gr{\"o}bner basis with \texttt{PrintNPList} (\ref{PrintNPList}) (only the first 20 polynomials are printed here, the full Gr{\"o}bner basis
3120can be printed with \texttt{PrintNPList(GB)}):
3121\begin{Verbatim}[fontsize=\small,frame=single,label=]
3122  gap> PrintNPList(GB{[1..20]});
3123   ba^3 - 651/25aba^2 + 651/25a^2ba - a^3b
3124   b^3a - 651/25b^2ab + 651/25bab^2 - ab^3
3125   b^2a^2ba - bab^2a^2 - baba^2b + ba^2bab + ab^2aba - abab^2a - aba^2b^2 + a^2b\
3126  ^2ab
3127   b^2ab^2a^2 - 651/25b^2ababa + b^2aba^2b + 626/25bab^2aba - bab^2a^2b + babab^\
3128  2a - ba^2b^2ab + ba^2bab^2 - 651/25ab^2ab^2a + ab^2abab + 423176/625abab^2ab -\
3129   423801/625ababab^2 + 626/25aba^2b^3 - 406901/625a^2b^2ab^2 + 423176/625a^2bab\
3130  ^3 - 651/25a^3b^4
3131   a^8
3132   a^7b
3133   a^6ba
3134   a^6b^2
3135   a^5ba^2
3136   a^5bab
3137   a^5b^2a
3138   a^5b^3
3139   a^4ba^2b
3140   a^4baba
3141   a^4bab^2
3142   a^4b^2a^2
3143   a^4b^2ab
3144   a^4b^4
3145   a^3ba^2ba
3146   a^3ba^2b^2
3147\end{Verbatim}
3148 The truncated quotient algebra is obtained by factoring out the ideal
3149generated by the Gr{\"o}bner basis \texttt{GB} and so its dimension can be calculated with \texttt{DimQA} (\ref{DimQA}):
3150\begin{Verbatim}[fontsize=\small,frame=single,label=]
3151  gap> DimQA(GB,2);
3152  #I  The computation took 0 msecs.
3153  157
3154\end{Verbatim}
3155 Here is what Paul Terwilliger wrote in reaction to the computation carried out
3156by this example:
3157
3158 I just wanted to thank you again for the dimension data that you gave me after
3159the Durham meeting. It ended up having a large impact. See the attached paper;
3160joint with Tatsuro Ito.
3161
3162 I spent several weeks in Japan this past January, working with Tatsuro and
3163trying to find a good basis for the algebra on two symbols subject to the $q$-Serre relations. After much frustration, we thought of feeding your data into
3164Sloane's online handbook of integer sequences. We did it out of curiosity more
3165than anything; we did not expect the handbook data to be particularly useful.
3166But it was.
3167
3168 The handbook told us that the graded dimension generating function, using your
3169data for the coefficients, matched the $q$-series for the inverse of the Jacobi theta function $\vartheta_4$; armed with this overwhelming hint we were able to prove that the graded
3170dimension generating function was indeed given by the inverse of $\vartheta_4$. With that info we were able to get a nice result about td pairs.
3171
3172 Paul
3173
3174  }
3175
3176
3177\section{\textcolor{Chapter }{The truncated variant on two weighted homogeneous polynomials}}\label{Example11}
3178\logpage{[ "A", 4, 0 ]}
3179\hyperdef{L}{X79AC59C482A2E4C1}{}
3180{
3181 Here we exhibit a truncated non-commutative homogeneous weighted Gr{\"o}bner
3182basis computation. This example uses the functions from Section \ref{truncfun}, the truncation variants (see also Section \ref{trunc}).
3183
3184 The input is a set of polynomials in $x$ and $y$, which are homogeneous when the weight of $x$ is 2 and of $y$ is 3. The input is $\{x^3y^2-x^6+y^4,y^2x^3+xyxyx+x^2yxy\}$. We truncate the computation at degree 16. The truncated Gr{\"o}bner basis is $\{y^2x^3+xyxyx+x^2yxy,x^6-x^3y^2-y^4,x^3y^2x-x^4y^2-xy^4\}$ and the dimension of the quotient algebra is 134.
3185
3186 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
3187\begin{Verbatim}[fontsize=\small,frame=single,label=]
3188  gap> LoadPackage("GBNP","0",false);;
3189  gap> SetInfoLevel(InfoGBNP,1);
3190  gap> SetInfoLevel(InfoGBNPTime,1);
3191\end{Verbatim}
3192 The variables will be printed as $x$ and $y$.
3193\begin{Verbatim}[fontsize=\small,frame=single,label=]
3194  gap> GBNP.ConfigPrint("x","y");
3195\end{Verbatim}
3196 The level to truncate at is assigned to $n$.
3197\begin{Verbatim}[fontsize=\small,frame=single,label=]
3198  gap> n := 16;;
3199\end{Verbatim}
3200 Now enter the relations in NP form (see Section \ref{NP}) and the weights.
3201\begin{Verbatim}[fontsize=\small,frame=single,label=]
3202  gap> s1 :=[[[1,1,1,2,2],[1,1,1,1,1,1],[2,2,2,2]],[1,-1,1]];;
3203  gap> s2 :=[[[2,2,1,1,1],[1,2,1,2,1],[1,1,2,1,2]],[1,1,1]];;
3204  gap> K := [s1,s2];;
3205  gap> weights:=[2,3];;
3206\end{Verbatim}
3207 The input can be printed with \texttt{PrintNPList} (\ref{PrintNPList})
3208\begin{Verbatim}[fontsize=\small,frame=single,label=]
3209  gap> PrintNPList(K);
3210   x^3y^2 - x^6 + y^4
3211   y^2x^3 + xyxyx + x^2yxy
3212\end{Verbatim}
3213 Verify whether the list \texttt{K} consists only of polynomials that are homogeneous with respect to \texttt{weights} by means of \texttt{CheckHomogeneousNPs} (\ref{CheckHomogeneousNPs}).
3214\begin{Verbatim}[fontsize=\small,frame=single,label=]
3215  gap> CheckHomogeneousNPs(K,weights);
3216  #I  Input is homogeneous
3217  [ 12, 12 ]
3218\end{Verbatim}
3219 Now calculate the truncated Gr{\"o}bner basis with \texttt{SGrobnerTrunc} (\ref{SGrobnerTrunc}). The output will only contain homogeneous polynomials of degree at most \texttt{n}.
3220\begin{Verbatim}[fontsize=\small,frame=single,label=]
3221  gap> G := SGrobnerTrunc(K,n,weights);;
3222  #I  number of entered polynomials is 2
3223  #I  number of polynomials after reduction is 2
3224  #I  End of phase I
3225  #I  Input is homogeneous
3226  #I  Reached level 16
3227  #I  end of the algorithm
3228  #I  The computation took 4 msecs.
3229\end{Verbatim}
3230 The Gr{\"o}bner basis of the truncated quotient algebra can be printed with \texttt{PrintNPList} (\ref{PrintNPList}):
3231\begin{Verbatim}[fontsize=\small,frame=single,label=]
3232  gap> PrintNPList(G);
3233   y^2x^3 + xyxyx + x^2yxy
3234   x^6 - x^3y^2 - y^4
3235   x^3y^2x - x^4y^2 + y^4x - xy^4
3236\end{Verbatim}
3237 The standard basis of the quotient of the free noncommutative algebra on $n$ variables, where $n$ is the length of the vector \texttt{weights}, by the homogeneous ideal generated by \texttt{K} up to degree $n$ is obtained by means of the function \texttt{BaseQATrunc} (\ref{BaseQATrunc}) applied to \texttt{K}, \texttt{n}, and \texttt{weights}.
3238\begin{Verbatim}[fontsize=\small,frame=single,label=]
3239  gap> B := BaseQATrunc(K,n,weights);;
3240  #I  number of entered polynomials is 2
3241  #I  number of polynomials after reduction is 2
3242  #I  End of phase I
3243  #I  Input is homogeneous
3244  #I  Reached level 16
3245  #I  end of the algorithm
3246  #I  The computation took 0 msecs.
3247  gap> i := Length(B);
3248  17
3249  gap> Print("at level ",i-1," the standard monomials are:\n");
3250  at level 16 the standard monomials are:
3251  gap> PrintNPList(List(B[i], qq -> [[qq],[1]]));
3252   yxyx^4
3253   yx^2yx^3
3254   xyxyx^3
3255   yx^3yx^2
3256   xyx^2yx^2
3257   x^2yxyx^2
3258   y^4x^2
3259   yx^4yx
3260   xyx^3yx
3261   x^2yx^2yx
3262   x^3yxyx
3263   y^3xyx
3264   y^2xy^2x
3265   yxy^3x
3266   xy^4x
3267   yx^5y
3268   xyx^4y
3269   x^2yx^3y
3270   x^3yx^2y
3271   y^3x^2y
3272   x^4yxy
3273   y^2xyxy
3274   yxy^2xy
3275   xy^3xy
3276   x^5y^2
3277   y^2x^2y^2
3278   yxyxy^2
3279   xy^2xy^2
3280   yx^2y^3
3281   xyxy^3
3282   x^2y^4
3283\end{Verbatim}
3284 The same result can be obtained by using the truncated Gr{\"o}bner basis found
3285for \texttt{G} instead of \texttt{K}.
3286\begin{Verbatim}[fontsize=\small,frame=single,label=]
3287  gap> B2 := BaseQATrunc(G,n,weights);;
3288  #I  number of entered polynomials is 3
3289  #I  number of polynomials after reduction is 3
3290  #I  End of phase I
3291  #I  Input is homogeneous
3292  #I  Reached level 16
3293  #I  end of the algorithm
3294  #I  The computation took 0 msecs.
3295  gap> B = B2;
3296  true
3297\end{Verbatim}
3298 Also, the same result can be obtained by using the leading terms of the
3299truncated Gr{\"o}bner basis found for \texttt{G} instead of \texttt{K}.
3300\begin{Verbatim}[fontsize=\small,frame=single,label=]
3301  gap> B3 := BaseQATrunc(List( LMonsNP(G), qq -> [[qq],[1]]),n,weights);;
3302  #I  number of entered polynomials is 3
3303  #I  number of polynomials after reduction is 3
3304  #I  End of phase I
3305  #I  Input is homogeneous
3306  #I  Reached level 16
3307  #I  end of the algorithm
3308  #I  The computation took 0 msecs.
3309  gap> B = B3;
3310  true
3311\end{Verbatim}
3312 A list of dimensions of the homogeneous parts of the quotient algebra up to
3313degree $n$ is obtained by means of \texttt{DimsQATrunc} (\ref{DimsQATrunc}) with arguments \texttt{G}, \texttt{n}, and \texttt{weights}.
3314\begin{Verbatim}[fontsize=\small,frame=single,label=]
3315  gap> DimsQATrunc(G,n,weights);
3316  #I  number of entered polynomials is 3
3317  #I  number of polynomials after reduction is 3
3318  #I  End of phase I
3319  #I  Input is homogeneous
3320  #I  Reached level 16
3321  #I  end of the algorithm
3322  #I  The computation took 4 msecs.
3323  [ 1, 0, 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 10, 16, 17, 24, 31 ]
3324\end{Verbatim}
3325 Even more detailed information is given by the list of frequences up to degree \texttt{n}. This is obtained by means of \texttt{FreqsQATrunc} (\ref{FreqsQATrunc}) with arguments \texttt{G}, \texttt{n}, and \texttt{weights}.
3326\begin{Verbatim}[fontsize=\small,frame=single,label=]
3327  gap> FreqsQATrunc(G,n,weights);
3328  #I  number of entered polynomials is 3
3329  #I  number of polynomials after reduction is 3
3330  #I  End of phase I
3331  #I  Input is homogeneous
3332  #I  Reached level 16
3333  #I  end of the algorithm
3334  #I  The computation took 0 msecs.
3335  [ [ [ [  ], 1 ] ], [ [ [ 1, 0 ], 1 ] ], [ [ [ 0, 1 ], 1 ] ],
3336    [ [ [ 2, 0 ], 1 ] ], [ [ [ 1, 1 ], 2 ] ],
3337    [ [ [ 3, 0 ], 1 ], [ [ 0, 2 ], 1 ] ], [ [ [ 2, 1 ], 3 ] ],
3338    [ [ [ 4, 0 ], 1 ], [ [ 1, 2 ], 3 ] ], [ [ [ 3, 1 ], 4 ], [ [ 0, 3 ], 1 ] ],
3339    [ [ [ 5, 0 ], 1 ], [ [ 2, 2 ], 6 ] ], [ [ [ 4, 1 ], 5 ], [ [ 1, 3 ], 4 ] ],
3340    [ [ [ 3, 2 ], 9 ], [ [ 0, 4 ], 1 ] ], [ [ [ 5, 1 ], 6 ], [ [ 2, 3 ], 10 ] ],
3341    [ [ [ 4, 2 ], 12 ], [ [ 1, 4 ], 5 ] ],
3342    [ [ [ 6, 1 ], 5 ], [ [ 3, 3 ], 18 ], [ [ 0, 5 ], 1 ] ],
3343    [ [ [ 5, 2 ], 16 ], [ [ 2, 4 ], 15 ] ] ]
3344\end{Verbatim}
3345 }
3346
3347
3348\section{\textcolor{Chapter }{The order of the Weyl group of type E$_6$}}\label{Example03}
3349\logpage{[ "A", 5, 0 ]}
3350\hyperdef{L}{X7F9C11FD7D75C027}{}
3351{
3352 In order to show how the order of a finite group of manageable size with a
3353manageable presentation can be computed, we determine the order of the Weyl
3354group of type E$_6$. This number is well known to be 51840.
3355
3356 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 2 (for more information about the info level, see Chapter \ref{Info}).
3357\begin{Verbatim}[fontsize=\small,frame=single,label=]
3358  gap> LoadPackage("GBNP","0",false);;
3359  gap> SetInfoLevel(InfoGBNP,1);
3360  gap> SetInfoLevel(InfoGBNPTime,2);
3361\end{Verbatim}
3362 Then input the relations in NP format (see \ref{NP}). They come from the presentation of the Weyl group as a Coxeter group. This
3363means that there are six variables, one for each generator. We let the
3364corresponding variables be printed as $r_1$, ..., $r_6$ by means of \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
3365\begin{Verbatim}[fontsize=\small,frame=single,label=]
3366  gap> GBNP.ConfigPrint(6,"r");
3367\end{Verbatim}
3368 The relations are binomial and represent the group relations, which express
3369that the generators are involutions (that is, have order 2) and that the
3370orders of the products of any two generators is specified by the Coxeter
3371diagram (see any book on Coxeter groups for details). The relations will be
3372assigned to \texttt{KI}.
3373\begin{Verbatim}[fontsize=\small,frame=single,label=]
3374  gap> k1 := [[[1,3,1],[3,1,3]],[1,-1]];;
3375  gap> k2 := [[[4,3,4],[3,4,3]],[1,-1]];;
3376  gap> k3 := [[[4,2,4],[2,4,2]],[1,-1]];;
3377  gap> k4 := [[[4,5,4],[5,4,5]],[1,-1]];;
3378  gap> k5 := [[[6,5,6],[5,6,5]],[1,-1]];;
3379  gap> k6 := [[[1,2],[2,1]],[1,-1]];;
3380  gap> k7 := [[[1,4],[4,1]],[1,-1]];;
3381  gap> k8 := [[[1,5],[5,1]],[1,-1]];;
3382  gap> k9 := [[[1,6],[6,1]],[1,-1]];;
3383  gap> k10 := [[[2,3],[3,2]],[1,-1]];;
3384  gap> k11 := [[[2,5],[5,2]],[1,-1]];;
3385  gap> k12 := [[[2,6],[6,2]],[1,-1]];;
3386  gap> k13 := [[[3,5],[5,3]],[1,-1]];;
3387  gap> k14 := [[[3,6],[6,3]],[1,-1]];;
3388  gap> k15 := [[[4,6],[6,4]],[1,-1]];;
3389  gap> k16 := [[[1,1],[]],[1,-1]];;
3390  gap> k17 := [[[2,2],[]],[1,-1]];;
3391  gap> k18 := [[[3,3],[]],[1,-1]];;
3392  gap> k19 := [[[4,4],[]],[1,-1]];;
3393  gap> k20 := [[[5,5],[]],[1,-1]];;
3394  gap> k21 := [[[6,6],[]],[1,-1]];;
3395  gap> KI := [k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,
3396  >        k11,k12,k13,k14,k15,k16,k17,k18,k19,k20,k21
3397  >       ];;
3398\end{Verbatim}
3399 The relations can be shown with \texttt{PrintNPList} (\ref{PrintNPList}):
3400\begin{Verbatim}[fontsize=\small,frame=single,label=]
3401  gap> PrintNPList(KI);
3402   r.1r.3r.1 - r.3r.1r.3
3403   r.4r.3r.4 - r.3r.4r.3
3404   r.4r.2r.4 - r.2r.4r.2
3405   r.4r.5r.4 - r.5r.4r.5
3406   r.6r.5r.6 - r.5r.6r.5
3407   r.1r.2 - r.2r.1
3408   r.1r.4 - r.4r.1
3409   r.1r.5 - r.5r.1
3410   r.1r.6 - r.6r.1
3411   r.2r.3 - r.3r.2
3412   r.2r.5 - r.5r.2
3413   r.2r.6 - r.6r.2
3414   r.3r.5 - r.5r.3
3415   r.3r.6 - r.6r.3
3416   r.4r.6 - r.6r.4
3417   r.1^2 - 1
3418   r.2^2 - 1
3419   r.3^2 - 1
3420   r.4^2 - 1
3421   r.5^2 - 1
3422   r.6^2 - 1
3423\end{Verbatim}
3424 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}):
3425\begin{Verbatim}[fontsize=\small,frame=single,label=]
3426  gap> GB := SGrobner(KI);;
3427  #I  number of entered polynomials is 21
3428  #I  number of polynomials after reduction is 21
3429  #I  End of phase I
3430  #I  End of phase II
3431  #I  End of phase III
3432  #I  Time needed to clean G :0
3433  #I  End of phase IV
3434  #I  The computation took 132 msecs.
3435  gap> PrintNPList(GB);
3436   r.1^2 - 1
3437   r.2r.1 - r.1r.2
3438   r.2^2 - 1
3439   r.3r.2 - r.2r.3
3440   r.3^2 - 1
3441   r.4r.1 - r.1r.4
3442   r.4^2 - 1
3443   r.5r.1 - r.1r.5
3444   r.5r.2 - r.2r.5
3445   r.5r.3 - r.3r.5
3446   r.5^2 - 1
3447   r.6r.1 - r.1r.6
3448   r.6r.2 - r.2r.6
3449   r.6r.3 - r.3r.6
3450   r.6r.4 - r.4r.6
3451   r.6^2 - 1
3452   r.3r.1r.2 - r.2r.3r.1
3453   r.3r.1r.3 - r.1r.3r.1
3454   r.4r.2r.4 - r.2r.4r.2
3455   r.4r.3r.4 - r.3r.4r.3
3456   r.5r.4r.5 - r.4r.5r.4
3457   r.6r.5r.6 - r.5r.6r.5
3458   r.4r.3r.1r.4 - r.3r.4r.3r.1
3459   r.5r.4r.2r.5 - r.4r.5r.4r.2
3460   r.5r.4r.3r.5 - r.4r.5r.4r.3
3461   r.6r.5r.4r.6 - r.5r.6r.5r.4
3462   r.4r.2r.3r.4r.2 - r.3r.4r.2r.3r.4
3463   r.4r.2r.3r.4r.3 - r.2r.4r.2r.3r.4
3464   r.5r.4r.2r.3r.5 - r.4r.5r.4r.2r.3
3465   r.5r.4r.3r.1r.5 - r.4r.5r.4r.3r.1
3466   r.6r.5r.4r.2r.6 - r.5r.6r.5r.4r.2
3467   r.6r.5r.4r.3r.6 - r.5r.6r.5r.4r.3
3468   r.4r.2r.3r.1r.4r.2 - r.3r.4r.2r.3r.1r.4
3469   r.5r.4r.2r.3r.1r.5 - r.4r.5r.4r.2r.3r.1
3470   r.6r.5r.4r.2r.3r.6 - r.5r.6r.5r.4r.2r.3
3471   r.6r.5r.4r.3r.1r.6 - r.5r.6r.5r.4r.3r.1
3472   r.4r.2r.3r.1r.4r.3r.1 - r.2r.4r.2r.3r.1r.4r.3
3473   r.5r.4r.2r.3r.4r.5r.4 - r.4r.5r.4r.2r.3r.4r.5
3474   r.6r.5r.4r.2r.3r.1r.6 - r.5r.6r.5r.4r.2r.3r.1
3475   r.6r.5r.4r.2r.3r.4r.6 - r.5r.6r.5r.4r.2r.3r.4
3476   r.5r.4r.2r.3r.1r.4r.5r.4 - r.4r.5r.4r.2r.3r.1r.4r.5
3477   r.6r.5r.4r.2r.3r.1r.4r.6 - r.5r.6r.5r.4r.2r.3r.1r.4
3478   r.6r.5r.4r.2r.3r.1r.4r.3r.6 - r.5r.6r.5r.4r.2r.3r.1r.4r.3
3479   r.6r.5r.4r.2r.3r.4r.5r.6r.5 - r.5r.6r.5r.4r.2r.3r.4r.5r.6
3480   r.5r.4r.2r.3r.1r.4r.3r.5r.4r.3 - r.4r.5r.4r.2r.3r.1r.4r.3r.5r.4
3481   r.6r.5r.4r.2r.3r.1r.4r.5r.6r.5 - r.5r.6r.5r.4r.2r.3r.1r.4r.5r.6
3482   r.5r.4r.2r.3r.1r.4r.3r.5r.4r.2r.3 - r.4r.5r.4r.2r.3r.1r.4r.3r.5r.4r.2
3483   r.6r.5r.4r.2r.3r.1r.4r.3r.5r.6r.5 - r.5r.6r.5r.4r.2r.3r.1r.4r.3r.5r.6
3484   r.6r.5r.4r.2r.3r.1r.4r.3r.5r.4r.6r.5r.4 - r.5r.6r.5r.4r.2r.3r.1r.4r.3r.5r.4r.\
3485  6r.5
3486   r.6r.5r.4r.2r.3r.1r.4r.3r.5r.4r.2r.6r.5r.4r.2 - r.5r.6r.5r.4r.2r.3r.1r.4r.3r.\
3487  5r.4r.2r.6r.5r.4
3488\end{Verbatim}
3489 The base of the quotient algebra can be calculated with \texttt{BaseQA} (\ref{BaseQA}), which has as arguments a Gr{\"o}bner basis \texttt{GB}, a number of symbols \texttt{6} and a maximum terms to be found (here 0 is entered, for a full base) . Since
3490it is very long we will not print it here.
3491\begin{Verbatim}[fontsize=\small,frame=single,label=]
3492  gap> B:=BaseQA(GB,6,0);;
3493\end{Verbatim}
3494 The dimension of the quotient algebra can be calculated with \texttt{DimQA} (\ref{DimQA}), the arguments are the Gr{\"o}bner basis \texttt{GB} and the number of symbols \texttt{6}. Since \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) is set to 2, we get timing information from \texttt{DimQA} (\ref{DimQA}):
3495\begin{Verbatim}[fontsize=\small,frame=single,label=]
3496  gap> DimQA(GB,6);
3497  #I  The computation took 172 msecs.
3498  51840
3499\end{Verbatim}
3500 Note that the calculation of the dimension takes almost as long as calculating
3501the base. Since we have already calculated a base \texttt{B} it is much more efficient to calculate the dimension with \texttt{Length}:
3502\begin{Verbatim}[fontsize=\small,frame=single,label=]
3503  gap> Length(B);
3504  51840
3505\end{Verbatim}
3506 }
3507
3508
3509\section{\textcolor{Chapter }{The gcd of some univariate polynomials}}\label{Example05}
3510\logpage{[ "A", 6, 0 ]}
3511\hyperdef{L}{X7E39C9738509A036}{}
3512{
3513 A list of univariate polynomials is generated. The result of the Gr{\"o}bner
3514basis computation on this list should be a single monic polynomial, their gcd.
3515
3516 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
3517\begin{Verbatim}[fontsize=\small,frame=single,label=]
3518  gap> LoadPackage("GBNP","0",false);;
3519  gap> SetInfoLevel(InfoGBNP,2);
3520  gap> SetInfoLevel(InfoGBNPTime,1);
3521\end{Verbatim}
3522 Let the single variable be printed as x by means of \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
3523\begin{Verbatim}[fontsize=\small,frame=single,label=]
3524  gap> GBNP.ConfigPrint("x");
3525\end{Verbatim}
3526 Now input the relations in NP format (see \ref{NP}). They will be assigned to \texttt{KI}.
3527\begin{Verbatim}[fontsize=\small,frame=single,label=]
3528  gap> p0 := [[[1,1,1],[1,1],[1],[]],[1,2,2,1]];;
3529  gap> p1 := [[[1,1,1,1],[1,1],[]],[1,1,1]];;
3530  gap> KI := [p0,p1];;
3531
3532  gap> for i in [2..12] do
3533  >     h := AddNP(AddNP(KI[i],KI[i-1],1,3),
3534  >     	AddNP(BimulNP([1],KI[i],[]),KI[i-1],2,1),3,-5);
3535  >     Add(KI,h);
3536  > od;
3537\end{Verbatim}
3538 The relations can be shown with \texttt{PrintNPList} (\ref{PrintNPList}):
3539\begin{Verbatim}[fontsize=\small,frame=single,label=]
3540  gap> PrintNPList(KI);
3541   x^3 + 2x^2 + 2x + 1
3542   x^4 + x^2 + 1
3543   - 10x^5 + 3x^4 - 6x^3 + 11x^2 - 2x + 7
3544   100x^6 - 60x^5 + 73x^4 - 128x^3 + 57x^2 - 76x + 25
3545   - 1000x^7 + 900x^6 - 950x^5 + 1511x^4 - 978x^3 + 975x^2 - 486x + 103
3546   10000x^8 - 12000x^7 + 12600x^6 - 18200x^5 + 14605x^4 - 13196x^3 + 8013x^2 - 2\
3547  792x + 409
3548   - 100000x^9 + 150000x^8 - 166000x^7 + 223400x^6 - 204450x^5 + 181819x^4 - 123\
3549  630x^3 + 55859x^2 - 14410x + 1639
3550   1000000x^10 - 1800000x^9 + 2150000x^8 - 2780000x^7 + 2765100x^6 - 2504340x^5 \
3551  + 1840177x^4 - 982264x^3 + 343729x^2 - 70788x + 6553
3552   - 10000000x^11 + 21000000x^10 - 27300000x^9 + 34850000x^8 - 36655000x^7 + 342\
3553  32300x^6 - 26732590x^5 + 16070447x^4 - 6878602x^3 + 1962503x^2 - 335534x + 262\
3554  15
3555   100000000x^12 - 240000000x^11 + 340000000x^10 - 437600000x^9 + 479700000x^8 -\
3556   463408000x^7 + 381083200x^6 - 250919600x^5 + 124358069x^4 - 44189892x^3 + 106\
3557  17765x^2 - 1551904x + 104857
3558   - 1000000000x^13 + 2700000000x^12 - 4160000000x^11 + 5480000000x^10 - 6219000\
3559  000x^9 + 6212580000x^8 - 5347676000x^7 + 3789374800x^6 - 2103269850x^5 + 87925\
3560  4915x^4 - 266261734x^3 + 55222347x^2 - 7046418x + 419431
3561   10000000000x^14 - 30000000000x^13 + 50100000000x^12 - 68240000000x^11 + 79990\
3562  000000x^10 - 82533200000x^9 + 74033300000x^8 - 55790408000x^7 + 33925155700x^6\
3563   - 16106037100x^5 + 5797814361x^4 - 1527768240x^3 + 278602281x^2 - 31541180x +\
3564   1677721
3565   - 100000000000x^15 + 330000000000x^14 - 595000000000x^13 + 843500000000x^12 -\
3566   1021260000000x^11 + 1087222000000x^10 - 1012808600000x^9 + 804854300000x^8 - \
3567  528013485000x^7 + 277993337300x^6 - 114709334310x^5 + 36188145143x^4 - 8434374\
3568  466x^3 + 1372108031x^2 - 139586422x + 6710887
3569  gap> Length(KI);
3570  13
3571\end{Verbatim}
3572 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}):
3573\begin{Verbatim}[fontsize=\small,frame=single,label=]
3574  gap> GB := SGrobner(KI);;
3575  #I  number of entered polynomials is 13
3576  #I  number of polynomials after reduction is 1
3577  #I  End of phase I
3578  #I  End of phase II
3579  #I  List of todo lengths is [ 0 ]
3580  #I  End of phase III
3581  #I  G: Cleaning finished, 0 polynomials reduced
3582  #I  End of phase IV
3583  #I  The computation took 0 msecs.
3584\end{Verbatim}
3585 Printed it looks like:
3586\begin{Verbatim}[fontsize=\small,frame=single,label=]
3587  gap> PrintNPList(GB);
3588   x^2 + x + 1
3589\end{Verbatim}
3590 }
3591
3592
3593\section{\textcolor{Chapter }{From the Tapas book}}\label{Example06}
3594\logpage{[ "A", 7, 0 ]}
3595\hyperdef{L}{X7F5A6ABA85CDB6E2}{}
3596{
3597 This example is a standard commutative Gr{\"o}bner basis computation from the
3598book Some Tapas of Computer Algebra \cite{CohenCuypersSterk1999}, page 339. There are six variables, named $a$, ... , $f$ by default. We work over the rationals and study the ideal generated by the
3599twelve polynomials occurring on the middle of page 339 of the Tapas book in a
3600project by De Boer and Pellikaan on the ternary cyclic code of length 11.
3601Below these are named \texttt{p1}, ..., \texttt{p12}. The result should be the union of $\{a,b\}$ and the set of 6 homogeneous binomials (that is, polynomials with two terms)
3602of degree 2 forcing commuting between $c$, $d$, $e$, and $f$.
3603
3604
3605
3606 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
3607\begin{Verbatim}[fontsize=\small,frame=single,label=]
3608  gap> LoadPackage("GBNP","0",false);;
3609  gap> SetInfoLevel(InfoGBNP,2);
3610  gap> SetInfoLevel(InfoGBNPTime,1);
3611\end{Verbatim}
3612 Now define some functions which will help in the construction of relations.
3613The function \texttt{powermon(g, exp)} will return the monomial $g^{exp}$. The function \texttt{comm(a, b)} will return a relation forcing commutativity between its two arguments \texttt{a} and \texttt{b}.
3614\begin{Verbatim}[fontsize=\small,frame=single,label=]
3615  gap> powermon := function(base, exp)
3616  >  local ans,i;
3617  >  ans := [];
3618  >  for i in [1..exp] do ans :=  Concatenation(ans,[base]); od;
3619  >  return ans;
3620  > end;;
3621
3622  gap> comm := function(a,b)
3623  >   return [[[a,b],[b,a]],[1,-1]];
3624  > end;;
3625\end{Verbatim}
3626 Now the relations are entered.
3627\begin{Verbatim}[fontsize=\small,frame=single,label=]
3628  gap> p1 := [[[5,1]],[1]];;
3629  gap> p2 := [[powermon(1,3),[6,1]],[1,1]];;
3630  gap> p3 := [[powermon(1,9),Concatenation([3],powermon(1,3))],[1,1]];;
3631  gap> p4 := [[powermon(1,81),Concatenation([3],powermon(1,9)),
3632  > 	Concatenation([4],powermon(1,3))],[1,1,1]];;
3633  gap> p5 := [[Concatenation([3],powermon(1,81)),Concatenation([4],powermon(1,9)),
3634  > 	Concatenation([5],powermon(1,3))],[1,1,1]];;
3635  gap> p6 := [[powermon(1,27),Concatenation([4],powermon(1,81)),Concatenation([5],
3636  > 	powermon(1,9)),Concatenation([6],powermon(1,3))],[1,1,1,1]];;
3637  gap> p7 := [[powermon(2,1),Concatenation([3],powermon(1,27)),Concatenation([5],
3638  > 	powermon(1,81)),Concatenation([6],powermon(1,9))],[1,1,1,1]];;
3639  gap> p8 := [[Concatenation([3],powermon(2,1)),Concatenation([4],powermon(1,27)),
3640  > 	Concatenation([6],powermon(1,81))],[1,1,1]];;
3641  gap> p9 := [[Concatenation([],powermon(1,1)),Concatenation([4],powermon(2,1)),
3642  > 	Concatenation([5],powermon(1,27))],[1,1,1]];;
3643  gap> p10 := [[Concatenation([3],powermon(1,1)),Concatenation([5],powermon(2,1)),
3644  > 	Concatenation([6],powermon(1,27))],[1,1,1]];;
3645  gap> p11 := [[Concatenation([4],powermon(1,1)),Concatenation([6],powermon(2,1))],
3646  > 	[1,1]];;
3647  gap> p12 := [[Concatenation([],powermon(2,3)),Concatenation([],powermon(2,1))],
3648  > 	[1,-1]];;
3649  gap> KI := [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12];;
3650  gap> for i in [1..5] do
3651  >     for j in [i+1..6] do
3652  >         Add(KI,comm(i,j));
3653  >     od;
3654  > od;
3655\end{Verbatim}
3656 The relations can be shown with \texttt{PrintNPList} (\ref{PrintNPList}):
3657\begin{Verbatim}[fontsize=\small,frame=single,label=]
3658  gap> PrintNPList(KI);
3659   ea
3660   a^3 + fa
3661   a^9 + ca^3
3662   a^81 + ca^9 + da^3
3663   ca^81 + da^9 + ea^3
3664   a^27 + da^81 + ea^9 + fa^3
3665   b + ca^27 + ea^81 + fa^9
3666   cb + da^27 + fa^81
3667   a + db + ea^27
3668   ca + eb + fa^27
3669   da + fb
3670   b^3 - b
3671   ab - ba
3672   ac - ca
3673   ad - da
3674   ae - ea
3675   af - fa
3676   bc - cb
3677   bd - db
3678   be - eb
3679   bf - fb
3680   cd - dc
3681   ce - ec
3682   cf - fc
3683   de - ed
3684   df - fd
3685   ef - fe
3686  gap> Length(KI);
3687  27
3688\end{Verbatim}
3689 It is sometimes easier to enter the relations as elements of a free algebra
3690and then use the function \texttt{GP2NP} (\ref{GP2NP}) or the function \texttt{GP2NPList} (\ref{GP2NPList}) to convert them. This will be demonstrated below. More about converting can be
3691read in Section \ref{TransitionFunctions}.
3692\begin{Verbatim}[fontsize=\small,frame=single,label=]
3693  gap> F:=Rationals;;
3694  gap> A:=FreeAssociativeAlgebraWithOne(F,"a","b","c","d","e","f");;
3695  gap> a:=A.a;; b:=A.b;; c:=A.c;; d:=A.d;; e:=A.e;; f:=A.f;;
3696  gap> KI_gp:=[e*a,                         #p1
3697  >         a^3 + f*a,                      #p2
3698  >         a^9 + c*a^3,                    #p3
3699  >         a^81 + c*a^9 + d*a^3,           #p4
3700  >         c*a^81 + d*a^9 + e*a^3,         #p5
3701  >         a^27 + d*a^81 + e*a^9 + f*a^3,  #p6
3702  >         b + c*a^27 + e*a^81 + f*a^9,    #p7
3703  >         c*b + d*a^27 + f*a^81,          #p8
3704  >         a + d*b + e*a^27,               #p9
3705  >         c*a + e*b + f*a^27,             #p10
3706  >         d*a + f*b,                      #p11
3707  >         b^3 - b];;                      #p12
3708\end{Verbatim}
3709 These relations can be converted to NP form (see \ref{NP}) with \texttt{GP2NPList} (\ref{GP2NPList}). For use in a Gr{\"o}bner basis computation we have to order the NP
3710polynomials in \texttt{KI}. This can be done with \texttt{CleanNP} (\ref{CleanNP}).
3711\begin{Verbatim}[fontsize=\small,frame=single,label=]
3712  gap> KI_np:=GP2NPList(KI_gp);;
3713  gap> Apply(KI,x->CleanNP(x));;
3714  gap> KI_np=KI{[1..12]};
3715  true
3716\end{Verbatim}
3717 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}) and printed with \texttt{PrintNPList} (\ref{PrintNPList}).
3718\begin{Verbatim}[fontsize=\small,frame=single,label=]
3719  gap> GB := SGrobner(KI);;
3720  #I  number of entered polynomials is 27
3721  #I  number of polynomials after reduction is 8
3722  #I  End of phase I
3723  #I  End of phase II
3724  #I  List of todo lengths is [ 0 ]
3725  #I  End of phase III
3726  #I  G: Cleaning finished, 0 polynomials reduced
3727  #I  End of phase IV
3728  #I  The computation took 748 msecs.
3729  gap> PrintNPList(GB);
3730   a
3731   b
3732   dc - cd
3733   ec - ce
3734   ed - de
3735   fc - cf
3736   fd - df
3737   fe - ef
3738\end{Verbatim}
3739 }
3740
3741
3742\section{\textcolor{Chapter }{The Birman-Murakami-Wenzl algebra of type A$_3$}}\label{Example07}
3743\logpage{[ "A", 8, 0 ]}
3744\hyperdef{L}{X7D72F1237C364FAC}{}
3745{
3746 We study the Birman-Murakami-Wenzl algebra of type A$_3$ as an algebra given by generators and relations. A reference for the relations
3747used is \cite{MR2124811}.
3748
3749 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
3750\begin{Verbatim}[fontsize=\small,frame=single,label=]
3751  gap> LoadPackage("GBNP","0",false);;
3752  gap> SetInfoLevel(InfoGBNP,1);
3753  gap> SetInfoLevel(InfoGBNPTime,1);
3754\end{Verbatim}
3755 The variables are $g_1$, $g_2$, $g_3$, $e_1$, $e_2$, $e_3$, in this order. In order to have the results printed out with these symbols,
3756we invoke \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
3757\begin{Verbatim}[fontsize=\small,frame=single,label=]
3758  gap> GBNP.ConfigPrint("g1","g2","g3","e1","e2","e3");
3759\end{Verbatim}
3760 Now enter the relations. This will be done in NP form (see \ref{NP}). The inderminates $m$ and $l$ in the coefficient ring of the Birman-Murakami-Wenzl algebra are specialized
3761to 7 and 11 in order to make the computations more efficient.
3762\begin{Verbatim}[fontsize=\small,frame=single,label=]
3763  gap> m:= 7;;
3764  gap> l:= 11;;
3765
3766  gap> #relations Theorem 1.1
3767  gap> k1 := [[[4],[1,1],[1],[]],[1,-l/m,-l,l/m]];;
3768  gap> k2 := [[[5],[2,2],[2],[]],[1,-l/m,-l,l/m]];;
3769  gap> k3 := [[[6],[3,3],[3],[]],[1,-l/m,-l,l/m]];;
3770
3771  gap> #relations B1
3772  gap> #empty set here
3773
3774  gap> #relations B2:
3775  gap> k4 := [[[1,2,1],[2,1,2]],[1,-1]];;
3776  gap> k5 := [[[2,3,2],[3,2,3]],[1,-1]];;
3777  gap> k6 := [[[1,3],[3,1]],[1,-1]];;
3778
3779  gap> #relations R1
3780  gap> kr1 := [[[1,4],[4]],[1,-1/l]];;
3781  gap> kr2 := [[[2,5],[5]],[1,-1/l]];;
3782  gap> kr3 := [[[3,6],[6]],[1,-1/l]];;
3783
3784  gap> #relations R2:
3785  gap> kr4 := [[[4,2,4],[4]],[1,-l]];;
3786  gap> kr5 := [[[5,1,5],[5]],[1,-l]];;
3787  gap> kr6 := [[[5,3,5],[5]],[1,-l]];;
3788  gap> kr7 := [[[6,2,6],[6]],[1,-l]];;
3789
3790  gap> #relations R2'
3791  gap> km1 := [[[4,5,4],[4]],[1,-1]];;
3792  gap> km2 := [[[5,4,5],[5]],[1,-1]];;
3793  gap> km3 := [[[5,6,5],[5]],[1,-1]];;
3794  gap> km4 := [[[6,5,6],[6]],[1,-1]];;
3795
3796  gap> KI := [k1,k2,k3,k4,k5,k6,kr1,kr2,kr3,kr4,kr5,kr6,kr7,km1,km2,km3,km4];;
3797\end{Verbatim}
3798 Now print the relations with \texttt{PrintNPList} (\ref{PrintNPList}):
3799\begin{Verbatim}[fontsize=\small,frame=single,label=]
3800  gap> PrintNPList(KI);
3801   e1 - 11/7g1^2 - 11g1 + 11/7
3802   e2 - 11/7g2^2 - 11g2 + 11/7
3803   e3 - 11/7g3^2 - 11g3 + 11/7
3804   g1g2g1 - g2g1g2
3805   g2g3g2 - g3g2g3
3806   g1g3 - g3g1
3807   g1e1 - 1/11e1
3808   g2e2 - 1/11e2
3809   g3e3 - 1/11e3
3810   e1g2e1 - 11e1
3811   e2g1e2 - 11e2
3812   e2g3e2 - 11e2
3813   e3g2e3 - 11e3
3814   e1e2e1 - e1
3815   e2e1e2 - e2
3816   e2e3e2 - e2
3817   e3e2e3 - e3
3818  gap> Length(KI);
3819  17
3820\end{Verbatim}
3821 Now calculate the Gr{\"o}bner basis with \texttt{SGrobner} (\ref{SGrobner}):
3822\begin{Verbatim}[fontsize=\small,frame=single,label=]
3823  gap> GB := SGrobner(KI);;
3824  #I  number of entered polynomials is 17
3825  #I  number of polynomials after reduction is 17
3826  #I  End of phase I
3827  #I  End of phase II
3828  #I  End of phase III
3829  #I  End of phase IV
3830  #I  The computation took 76 msecs.
3831  gap> PrintNPList(GB);
3832   g1^2 - 7/11e1 + 7g1 - 1
3833   g1e1 - 1/11e1
3834   g2^2 - 7/11e2 + 7g2 - 1
3835   g2e2 - 1/11e2
3836   g3g1 - g1g3
3837   g3^2 - 7/11e3 + 7g3 - 1
3838   g3e3 - 1/11e3
3839   e1g1 - 1/11e1
3840   e1g3 - g3e1
3841   e1^2 + 43/77e1
3842   e2g2 - 1/11e2
3843   e2^2 + 43/77e2
3844   e3g1 - g1e3
3845   e3g3 - 1/11e3
3846   e3e1 - e1e3
3847   e3^2 + 43/77e3
3848   g1g2e1 - e2e1
3849   g1g3e1 - 1/11g3e1
3850   g1e2e1 + 7e2e1 - g2e1 - 7e1
3851   g2g1g2 - g1g2g1
3852   g2g1e2 - e1e2
3853   g2g3e2 - e3e2
3854   g2e1g2 - g1e2g1 - 7e2g1 + 7e1g2 + 7g2e1 - 7g1e2 - 49e2 + 49e1
3855   g2e1e2 + 7e1e2 - g1e2 - 7e2
3856   g2e3e2 + 7e3e2 - g3e2 - 7e2
3857   g3g2g3 - g2g3g2
3858   g3g2e3 - e2e3
3859   g3e1e3 - 1/11e1e3
3860   g3e2g3 - g2e3g2 - 7e3g2 + 7e2g3 + 7g3e2 - 7g2e3 - 49e3 + 49e2
3861   g3e2e3 + 7e2e3 - g2e3 - 7e3
3862   e1g2g1 - e1e2
3863   e1g2e1 - 11e1
3864   e1e2g1 + 7e1e2 - e1g2 - 7e1
3865   e1e2e1 - e1
3866   e2g1g2 - e2e1
3867   e2g1e2 - 11e2
3868   e2g3g2 - e2e3
3869   e2g3e2 - 11e2
3870   e2e1g2 + 7e2e1 - e2g1 - 7e2
3871   e2e1e2 - e2
3872   e2e3g2 + 7e2e3 - e2g3 - 7e2
3873   e2e3e2 - e2
3874   e3g2g3 - e3e2
3875   e3g2e3 - 11e3
3876   e3e2g3 + 7e3e2 - e3g2 - 7e3
3877   e3e2e3 - e3
3878   g1g2g3e1 - e2g3e1
3879   g1g3g2e1 - g3e2e1
3880   g1g3e2e1 + 7g3e2e1 - g3g2e1 - 7g3e1
3881   g1e2g3e1 + 7e2g3e1 - g2g3e1 - 7g3e1
3882   g1e3g2e1 - e3e2e1
3883   g1e3e2e1 + 7e3e2e1 - e3g2e1 - 7e1e3
3884   g3g2g1g3 - g2g3g2g1
3885   g3g2g1e3 - e2g1e3
3886   g3g2e1e3 - e2e1e3
3887   g3e1g2e3 - e1e2e3
3888   g3e1e2e3 + 7e1e2e3 - e1g2e3 - 7e1e3
3889   g3e2g1g3 - g2e3g2g1 - 7e3g2g1 + 7e2g1g3 + 7g3e2g1 - 7g2g1e3 + 49e2g1 - 49g1e3\
3890
3891   g3e2g1e3 + 7e2g1e3 - g2g1e3 - 7g1e3
3892   g3e2e1e3 + 7e2e1e3 - g2e1e3 - 7e1e3
3893   e1g2g3g2 - g3e1g2g3
3894   e1g2g3e1 - 11g3e1
3895   e1g2e3g2 - g3e1e2g3 + 7e1e3g2 - 7e1e2g3 + 7e1g2e3 - 7g3e1e2 + 49e1e3 - 49e1e2\
3896
3897   e1e2g3e1 - g3e1
3898   e1e3g2g1 - e1e3e2
3899   e1e3g2e1 - 11e1e3
3900   e1e3e2g1 + 7e1e3e2 - e1e3g2 - 7e1e3
3901   e1e3e2e1 - e1e3
3902   e2g3e1e2 - e2g1e3e2
3903   e2e1e3e2 + 7e2g1e3e2 - e2g1g3e2 - 77e2
3904   e3g2g1g3 - e3e2g1
3905   e3g2g1e3 - 11g1e3
3906   e3g2e1e3 - 11e1e3
3907   e3e2g1g3 + 7e3e2g1 - e3g2g1 - 7g1e3
3908   e3e2g1e3 - g1e3
3909   e3e2e1e3 - e1e3
3910   g1g2g1g3e2 - g2g1e3e2
3911   g1g2g1e3e2 + 7g2g1e3e2 - g2g1g3e2 - 7e1e2
3912   g1g2g3g2e1 - g2e3g2e1 - 7e3g2e1 + 7e2g3e1 + 7g3e2e1 - 7g2e1e3 + 49e2e1 - 49e1\
3913  e3
3914   g1g2e3g2e1 + 7g2e3g2e1 - g2g3g2e1 + 7e3e2e1 + 49e3g2e1 + 7e2e1e3 - 7g3g2e1 + \
3915  49g2e1e3 - 7g2g3e1 + 343e1e3 - 49g3e1 - 49g2e1 - 350e1
3916   g1e2g1g3e2 + 7e2g1g3e2 - g2e1e3e2 - 7g2g3e1e2 - 7e1e3e2 - 49g3e1e2 + 77g1e2 +\
3917   539e2
3918   g1e2g1e3e2 + 7e2g1e3e2 - g2g3e1e2 - 7g3e1e2
3919   g2g3e1g2g3 - g1e2g1g3g2 - 7e2g1g3g2 + 7g3e1g2g3 + 7g2g3e1g2 + 49g3e1g2 - 7g1e\
3920  2e3 - 49e2e3
3921   g2g3e1e2g3 - g1e2g1e3g2 - 7e2g1e3g2 + 7g3e1e2g3 + 7g2g3e1e2 - 7g1e2g1e3 - 49e\
3922  2g1e3 + 49g3e1e2
3923   e2g1g3g2g1 - e2g1e3g2
3924   e2g1g3e2g1 - e2e1e3g2 - 7e2g3e1g2 + 7e2g1g3e2 - 7e2e1e3 - 49e2g3e1 + 77e2g1 +\
3925   539e2
3926   e2g1e3g2g1 + 7e2g1e3g2 - e2g1g3g2 - 7e2e1
3927   e2g1e3e2g1 - e2g3e1g2 + 7e2g1e3e2 - 7e2g3e1
3928   e2g3e1g2g3 + 7e2g3e1g2 - e2g1g3g2 - 7e2e3
3929\end{Verbatim}
3930 Now calculate the dimension of the quotient algebra with \texttt{DimQA} (\ref{DimQA}) (the second argument is the number of symbols):
3931\begin{Verbatim}[fontsize=\small,frame=single,label=]
3932  gap> DimQA(GB,6);
3933  105
3934\end{Verbatim}
3935 The conclusion is that the BMW algebra of type A3 has dimension 105. }
3936
3937
3938\section{\textcolor{Chapter }{The Birman-Murakami-Wenzl algebra of type A$_2$}}\label{Example08}
3939\logpage{[ "A", 9, 0 ]}
3940\hyperdef{L}{X7D6ED780860F2D28}{}
3941{
3942 The trace variant (see sections \ref{trace} and \ref{tracefun}) will be used for a presentation of the Birman-Murakami-Wenzl algebra of type
3943A$_2$ by generators and relations in order to find a proof that the algebra has
3944dimension 15.
3945
3946 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
3947\begin{Verbatim}[fontsize=\small,frame=single,label=]
3948  gap> LoadPackage("GBNP","0",false);;
3949  gap> SetInfoLevel(InfoGBNP,1);
3950  gap> SetInfoLevel(InfoGBNPTime,1);
3951\end{Verbatim}
3952 The variables are $g_1$, $g_2$, $e_1$, $e_2$, in this order. In order to have the results printed out with these symbols,
3953we invoke \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
3954\begin{Verbatim}[fontsize=\small,frame=single,label=]
3955  gap> GBNP.ConfigPrint("g1","g2","e1","e2");
3956\end{Verbatim}
3957 Unlike Example \ref{Example07}, we work with a field of rational functions.
3958\begin{Verbatim}[fontsize=\small,frame=single,label=]
3959  gap> ll := Indeterminate(Rationals,"l");
3960  l
3961  gap> mm := Indeterminate(Rationals,"m");
3962  m
3963  gap> F := Field(ll,mm);
3964  <algebra-with-one over Field( [ 1 ] )>
3965  gap> gens := GeneratorsOfField(F);
3966  [ l, m ]
3967  gap> l := gens[1];;
3968  gap> m := gens[2];
3969  m
3970  gap> F1 := One(F);;
3971  gap> Print("identity element of F: ",F1,"\n");
3972  identity element of F: 1
3973\end{Verbatim}
3974 Now enter the relations. This will be done in NP form.
3975\begin{Verbatim}[fontsize=\small,frame=single,label=]
3976  gap> #relations Theorem 1.1
3977  gap> k1 := [[[3],[1,1],[1],[]],[F1,-l/m,-l,l/m]];;
3978  gap> k2 := [[[4],[2,2],[2],[]],[F1,-l/m,-l,l/m]];;
3979
3980  gap> #relations B1
3981  gap> #empty set here
3982
3983  gap> #relations B2:
3984  gap> k3 := [[[1,2,1],[2,1,2]],[F1,-F1]];;
3985
3986  gap> #relations R1
3987  gap> k4 := [[[1,3],[3]],[F1,-1/l]];;
3988  gap> k5 := [[[2,4],[4]],[F1,-1/l]];;
3989
3990  gap> #relations R2:
3991  gap> k6 := [[[3,2,3],[3]],[F1,-l]];;
3992  gap> k7 := [[[4,1,4],[4]],[F1,-l]];;
3993  gap> k8 := [[[3,4,3],[3]],[F1,-F1]];;
3994  gap> k9 := [[[4,3,4],[4]],[F1,-F1]];;
3995
3996  gap> KI := [k1,k2,k3,k4,k5,k6,k7,k8,k9];;
3997\end{Verbatim}
3998 The input can be displayed with \texttt{PrintNPList} (\ref{PrintNPList}):
3999\begin{Verbatim}[fontsize=\small,frame=single,label=]
4000  gap> PrintNPList(KI);
4001   e1 + -l/mg1^2 + -lg1 + l/m
4002   e2 + -l/mg2^2 + -lg2 + l/m
4003   g1g2g1 + -1g2g1g2
4004   g1e1 + -l^-1e1
4005   g2e2 + -l^-1e2
4006   e1g2e1 + -le1
4007   e2g1e2 + -le2
4008   e1e2e1 + -1e1
4009   e2e1e2 + -1e2
4010\end{Verbatim}
4011 Now calculate the Gr{\"o}bner basis with trace information, using the function \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}):
4012\begin{Verbatim}[fontsize=\small,frame=single,label=]
4013  gap> GB := SGrobnerTrace(KI);;
4014  #I  number of entered polynomials is 9
4015  #I  number of polynomials after reduction is 9
4016  #I  End of phase I
4017  #I  End of phase II
4018  #I  List of todo lengths is [ 8, 7, 6, 5, 4, 6, 4, 4, 4, 3, 3, 2, 1, 0 ]
4019  #I  End of phase III
4020  #I  End of phase IV
4021  #I  The computation took 484 msecs.
4022\end{Verbatim}
4023 The full trace can be printed with \texttt{PrintTraceList} (\ref{PrintTraceList}), while printing only the relations (and no trace) can be invoked by \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}). Since the total trace is very long we do not call \texttt{PrintTraceList(GB)} here but only show two polynomial expressions from the Gr{\"o}bner basis with \texttt{PrintTracePol} (\ref{PrintTracePol}):
4024\begin{Verbatim}[fontsize=\small,frame=single,label=]
4025  gap> PrintNPListTrace(GB);
4026   g1^2 + m/-le1 + mg1 + -1
4027   g1e1 + -l^-1e1
4028   g2^2 + m/-le2 + mg2 + -1
4029   g2e2 + -l^-1e2
4030   e1g1 + 1/-le1
4031   e1^2 + (l^2-l*m-1)/(l*m)e1
4032   e2g2 + 1/-le2
4033   e2^2 + (l^2-l*m-1)/(l*m)e2
4034   g1g2e1 + -1e2e1
4035   g1e2e1 + me2e1 + -1g2e1 + -me1
4036   g2g1g2 + 1/-1g1g2g1
4037   g2g1e2 + -1e1e2
4038   g2e1g2 + -1g1e2g1 + -me2g1 + me1g2 + mg2e1 + -mg1e2 + -m^2e2 + m^2e1
4039   g2e1e2 + me1e2 + -1g1e2 + -me2
4040   e1g2g1 + -1e1e2
4041   e1g2e1 + -le1
4042   e1e2g1 + me1e2 + -1e1g2 + -me1
4043   e1e2e1 + -1e1
4044   e2g1g2 + -1e2e1
4045   e2g1e2 + -le2
4046   e2e1g2 + me2e1 + -1e2g1 + -me2
4047   e2e1e2 + -1e2
4048  gap> PrintTracePol(GB[1]);
4049   m/-lG(1)
4050  gap> PrintTracePol(GB[10]);
4051   -l*m/(-l*m-1)G(1)g1e2e1 + -l*m/(l*m+1)g1G(1)e2e1 + l^2*m/(-l*m-1)G(
4052  1)g2g1e1 + l*m^2/(-l*m-1)G(1)g2g1e2e1 + -l/(-l*m-1)g2G(
4053  1)g1e2e1 + -l/(l*m+1)g2g1G(1)e2e1 + l^2/(-l*m-1)g2G(
4054  1)g2g1e1 + l*m/(-l*m-1)g2G(1)g2g1e2e1 + -l*m/(-l*m-1)e1g2G(
4055  1)g2g1e1 + -l/(-l*m-1)g2e1g2G(1)g2g1e1 + -m/-lG(
4056  2)g1e2e1 + -l^2*m/(-l*m-1)g2g1G(2)e1 + -l^2/(-l*m-1)g2^2g1G(
4057  2)e1 + m^2/(-l*m-1)e1G(2)g1e2e1 + m/(-l*m-1)g2e1G(
4058  2)g1e2e1 + -l*m/(l*m+1)e1g2^2g1G(2)e1 + -l/(l*m+1)g2e1g2^2g1G(
4059  2)e1 + l^3*m/(-l*m-1)G(3)e1 + l^3/(-l*m-1)g1G(3)e1 + l^3/(-l*m-1)G(
4060  3)g2e1 + l^3/(-l*m-1)g2G(3)e1 + l^2*m^2/(-l*m-1)G(3)e2e1 + l^2*m/(-l*m-1)g1G(
4061  3)e2e1 + l^3/(-l*m^2-m)g2g1G(3)e1 + l^3/(-l*m^2-m)g2G(
4062  3)g2e1 + l^2*m/(-l*m-1)G(3)g2e2e1 + l^2*m/(-l*m-1)g2G(
4063  3)e2e1 + -l^2*m/(-l*m-1)e1g2G(3)e1 + l^2/(-l*m-1)g2g1G(
4064  3)e2e1 + l^2/(-l*m-1)g2G(3)g2e2e1 + -l^2/(-l*m-1)g2e1g2G(
4065  3)e1 + -l^2/(-l*m-1)e1g2g1G(3)e1 + -l^2/(-l*m-1)e1g2G(
4066  3)g2e1 + -l^2/(-l*m^2-m)g2e1g2g1G(3)e1 + -l^2/(-l*m^2-m)g2e1g2G(
4067  3)g2e1 + -l*m/(-l*m-1)G(4)e2e1 + -l/(-l*m-1)g2G(4)e2e1 + -l*mg2g1G(
4068  5)e1 + l^2*m/(-l*m-1)g2g1g2G(5)e1 + -lg2^2g1G(5)e1 + l^2/(-l*m-1)g2^2g1g2G(
4069  5)e1 + l*m/(-l*m-1)G(6)g2g1e1 + l/(-l*m-1)g2G(6)g2g1e1 + m/-lG(
4070  7)e1 + -m^2/(-l*m-1)e1G(7)e1 + -m/(-l*m-1)g2e1G(7)e1 + mG(8) + g2G(8)
4071\end{Verbatim}
4072 In order to test whether the expression for \texttt{GB[10]} is as claimed we use \texttt{EvalTrace} (\ref{EvalTrace}), For each traced polynomial \texttt{x} in \texttt{GB}, we equate the evaluated expression \texttt{x.trace}, in which each occurrence of \texttt{G(i)} is replaced by \texttt{KI[i]} by use of \texttt{EvalTrace} (\ref{EvalTrace}), with \texttt{x.pol}.
4073\begin{Verbatim}[fontsize=\small,frame=single,label=]
4074  gap> ForAll(GB,x->EvalTrace(x,KI)=x.pol);
4075  false
4076\end{Verbatim}
4077 As a result the dimension of the quotient algebra can be calculated with \texttt{DimQA} (\ref{DimQA}) and the quotient algebra itself with \texttt{BaseQA} (\ref{BaseQA}).
4078\begin{Verbatim}[fontsize=\small,frame=single,label=]
4079  gap> GB_pols:=List(GB,x->x.pol);;
4080  gap> PrintNPList(GB_pols);
4081   g1^2 + m/-le1 + mg1 + -1
4082   g1e1 + -l^-1e1
4083   g2^2 + m/-le2 + mg2 + -1
4084   g2e2 + -l^-1e2
4085   e1g1 + 1/-le1
4086   e1^2 + (l^2-l*m-1)/(l*m)e1
4087   e2g2 + 1/-le2
4088   e2^2 + (l^2-l*m-1)/(l*m)e2
4089   g1g2e1 + -1e2e1
4090   g1e2e1 + me2e1 + -1g2e1 + -me1
4091   g2g1g2 + 1/-1g1g2g1
4092   g2g1e2 + -1e1e2
4093   g2e1g2 + -1g1e2g1 + -me2g1 + me1g2 + mg2e1 + -mg1e2 + -m^2e2 + m^2e1
4094   g2e1e2 + me1e2 + -1g1e2 + -me2
4095   e1g2g1 + -1e1e2
4096   e1g2e1 + -le1
4097   e1e2g1 + me1e2 + -1e1g2 + -me1
4098   e1e2e1 + -1e1
4099   e2g1g2 + -1e2e1
4100   e2g1e2 + -le2
4101   e2e1g2 + me2e1 + -1e2g1 + -me2
4102   e2e1e2 + -1e2
4103  gap> DimQA(GB_pols,2);
4104  6
4105  gap> B:=BaseQA(GB_pols,2,0);;
4106  gap> PrintNPList(B);
4107   1
4108   g1
4109   g2
4110   g1g2
4111   g2g1
4112   g1g2g1
4113\end{Verbatim}
4114 }
4115
4116
4117\section{\textcolor{Chapter }{A commutative example by Mora}}\label{Example10}
4118\logpage{[ "A", 10, 0 ]}
4119\hyperdef{L}{X83C81C987A4DE15F}{}
4120{
4121 Here we present a commutative example from page 339 of ``An introduction to commutative and non-commutative Gr{\"o}bner Bases'', by Teo Mora \cite{TCS::Mora1994:131}. It involves the seven variables $a,b,c,d,e,f,g$. In order to force commuting between each pair from $\{a,b,c,d,e,f,g\}$, we let part of the input equations be the homogeneous binomials of the form $xy - yx$. GBNP is built for non-commutative polynomial arithmetic, and should handle
4122the commutative case by means of this forced commutation. But it should not be
4123considered as a serious alternative to the well-known Gr{\"o}bner bases
4124packages when it comes to efficiency.
4125
4126 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4127\begin{Verbatim}[fontsize=\small,frame=single,label=]
4128  gap> LoadPackage("GBNP","0",false);;
4129  gap> SetInfoLevel(InfoGBNP,1);
4130  gap> SetInfoLevel(InfoGBNPTime,1);
4131\end{Verbatim}
4132 The relations will be entered as GAP polynomials and converted to NP form (see \ref{NP}) with \texttt{GP2NPList} (\ref{GP2NPList}).
4133\begin{Verbatim}[fontsize=\small,frame=single,label=]
4134  gap> F:=GF(7);; ef:=One(F);;
4135  gap> A:=FreeAssociativeAlgebraWithOne(F, "a", "b", "c", "d", "e", "f", "g");
4136  <algebra-with-one over GF(7), with 7 generators>
4137  gap> gens:=GeneratorsOfAlgebra(A);
4138  [ (Z(7)^0)*<identity ...>, (Z(7)^0)*a, (Z(7)^0)*b, (Z(7)^0)*c, (Z(7)^0)*d,
4139    (Z(7)^0)*e, (Z(7)^0)*f, (Z(7)^0)*g ]
4140  gap> a:=gens[2];; b:=gens[3];; c:=gens[4];; d:=gens[5];; e:=gens[6];; f:=gens[7];;
4141  gap> g:=gens[8];; ea:=gens[1];;
4142
4143  gap> rels := [ a^3 + f*a,
4144  > 	a^9 + c*a^3 + g*a,
4145  > 	a^81 + c*a^9 + d*a^3,
4146  > 	c*a^81 + d*a^9 + e*a^3,
4147  > 	a^27 + d*a^81 + e*a^9 + f*a^3,
4148  > 	b + c*a^27 + e*a^81 + f*a^9 + g*a^3,
4149  > 	c*b + d*a^27 + f*a^81 + g*a^9,
4150  > 	a + d*b + e*a^27 + g*a^81,
4151  > 	c*a + e*b + f*a^27,
4152  > 	d*a + f*b + g*a^27,
4153  > 	e*a + g*b,
4154  > 	b^3 - b ];;
4155\end{Verbatim}
4156 Some relations added to enforce commutativity.
4157\begin{Verbatim}[fontsize=\small,frame=single,label=]
4158  gap> for i in [1..6] do
4159  >     for j in [i+1..7] do
4160  >         Add(rels,gens[i+1]*gens[j+1]-gens[j+1]*gens[i+1]);
4161  >     od;
4162  > od;
4163\end{Verbatim}
4164 Now the relations are converted to NP form (see \ref{NP}) with the function \texttt{GP2NPList} (\ref{GP2NPList}).
4165\begin{Verbatim}[fontsize=\small,frame=single,label=]
4166  gap> KI:=GP2NPList(rels);;
4167\end{Verbatim}
4168 The Gr{\"o}bner basis can be calculated with \texttt{SGrobner} (\ref{SGrobner}) and printed with \texttt{PrintNPList} (\ref{PrintNPList}).
4169\begin{Verbatim}[fontsize=\small,frame=single,label=]
4170  gap> GB := SGrobner(KI);;
4171  #I  number of entered polynomials is 33
4172  #I  number of polynomials after reduction is 33
4173  #I  End of phase I
4174  #I  End of phase II
4175  #I  End of phase III
4176  #I  End of phase IV
4177  #I  The computation took 24820 msecs.
4178  gap> PrintNPList(GB);
4179   a
4180   b
4181   dc + Z(7)^3cd
4182   ec + Z(7)^3ce
4183   ed + Z(7)^3de
4184   fc + Z(7)^3cf
4185   fd + Z(7)^3df
4186   fe + Z(7)^3ef
4187   gc + Z(7)^3cg
4188   gd + Z(7)^3dg
4189   ge + Z(7)^3eg
4190   gf + Z(7)^3fg
4191\end{Verbatim}
4192 To determine whether the quotient algebra is finite dimensional we invoke \texttt{FinCheckQA} (\ref{FinCheckQA}), using as arguments the leading monomials of \texttt{GB} and 7, the number of variables involved. The leading monomials of \texttt{GB} are obtained by \texttt{LMonsNP} (\ref{LMonsNP}).
4193\begin{Verbatim}[fontsize=\small,frame=single,label=]
4194  gap> F := LMonsNP(GB);;
4195  gap> FinCheckQA(F,7);
4196  false
4197\end{Verbatim}
4198 Thus, the quotient algebra turns out to be infinite dimensional. This is no
4199surprise as the Gr{\"o}bner basis shows it is actually the free commutative
4200algebra generated by $c,d,e,f,g$. In particular, it has polynomial growth of degree 5. This is confirmed by
4201application of \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}), with the first two arguments as for \texttt{FinCheckQA} above and third argument \texttt{false}, indicating that an interval for the degree of the polynomial degree will
4202suffice.
4203\begin{Verbatim}[fontsize=\small,frame=single,label=]
4204  gap> DetermineGrowthQA(F,7,false);
4205  5
4206\end{Verbatim}
4207 It turns out that this quick version already gives an exact answer. More time
4208consuming would be the algorithm run with third argument equal to \texttt{true}.
4209\begin{Verbatim}[fontsize=\small,frame=single,label=]
4210  gap> DetermineGrowthQA(F,7,true);
4211  5
4212\end{Verbatim}
4213 }
4214
4215
4216\section{\textcolor{Chapter }{Tracing an example by Mora}}\label{Example09}
4217\logpage{[ "A", 11, 0 ]}
4218\hyperdef{L}{X7CAB94A37D580C4A}{}
4219{
4220 This example of a non-commutative Gr{\"o}bner basis computation is from page
422118 of ``An introduction to commutative and non-commutative Gr{\"o}bner Bases'', by Teo Mora \cite{TCS::Mora1994:131}. The traced version of the algorithm will be used. The input is $\{xyx-y,yxy-y\}$. The answer should be $\{yy-xy,yx-xy,xxy-y\}$.
4222
4223 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4224\begin{Verbatim}[fontsize=\small,frame=single,label=]
4225  gap> LoadPackage("GBNP","0",false);;
4226  gap> SetInfoLevel(InfoGBNP,2);
4227  gap> SetInfoLevel(InfoGBNPTime,1);
4228\end{Verbatim}
4229 Let the variables be printed as $x$ and $y$ instead of $a$ and $b$ by means of \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
4230\begin{Verbatim}[fontsize=\small,frame=single,label=]
4231  gap> GBNP.ConfigPrint("x","y");
4232\end{Verbatim}
4233 Next we input the relations in NP format (see Section \ref{NP}). They will be assigned to \texttt{KI}.
4234\begin{Verbatim}[fontsize=\small,frame=single,label=]
4235  gap> xyx := [[[1,2,1],[2]],[1,-1]];;
4236  gap> yxy := [[[2,1,2],[2]],[1,-1]];;
4237  gap> KI:=[xyx,yxy];;
4238\end{Verbatim}
4239 The relations can be shown with \texttt{PrintNPList} (\ref{PrintNPList}):
4240\begin{Verbatim}[fontsize=\small,frame=single,label=]
4241  gap> PrintNPList(KI);
4242   xyx - y
4243   yxy - y
4244\end{Verbatim}
4245 The Gr{\"o}bner basis with trace can now be calculated with \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}):
4246\begin{Verbatim}[fontsize=\small,frame=single,label=]
4247  gap> GB := SGrobnerTrace(KI);
4248  #I  number of entered polynomials is 2
4249  #I  number of polynomials after reduction is 2
4250  #I  End of phase I
4251  #I  End of phase II
4252  #I  j =2
4253  #I  Current number of elements in todo is 1
4254  #I  j =3
4255  #I  Current number of elements in todo is 0
4256  #I  List of todo lengths is [ 2, 1, 0 ]
4257  #I  End of phase III
4258  #I  End of phase IV
4259  #I  The computation took 4 msecs.
4260  [ rec( pol := [ [ [ 2, 1 ], [ 1, 2 ] ], [ 1, -1 ] ],
4261        trace := [ [ [  ], 1, [ 2 ], -1 ], [ [ 2 ], 1, [  ], 1 ],
4262            [ [ 1 ], 2, [  ], 1 ], [ [  ], 2, [ 1 ], -1 ] ] ),
4263    rec( pol := [ [ [ 2, 2 ], [ 1, 2 ] ], [ 1, -1 ] ],
4264        trace := [ [ [ 2 ], 1, [  ], -1 ], [ [  ], 1, [ 2 ], -1 ],
4265            [ [ 2 ], 1, [  ], 1 ], [ [  ], 2, [ 1 ], 1 ], [ [ 1 ], 2, [  ], 1 ],
4266            [ [  ], 2, [ 1 ], -1 ] ] ),
4267    rec( pol := [ [ [ 1, 1, 2 ], [ 2 ] ], [ 1, -1 ] ],
4268        trace := [ [ [  ], 1, [  ], 1 ], [ [ 1 ], 1, [ 2 ], 1 ],
4269            [ [ 1, 2 ], 1, [  ], -1 ], [ [ 1, 1 ], 2, [  ], -1 ],
4270            [ [ 1 ], 2, [ 1 ], 1 ] ] ) ]
4271\end{Verbatim}
4272 The Gr{\"o}bner basis can be printed with \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}):
4273\begin{Verbatim}[fontsize=\small,frame=single,label=]
4274  gap> PrintNPListTrace(GB);
4275   yx - xy
4276   y^2 - xy
4277   x^2y - y
4278\end{Verbatim}
4279 The trace of the Gr{\"o}bner basis can be printed with \texttt{PrintTraceList} (\ref{PrintTraceList}):
4280\begin{Verbatim}[fontsize=\small,frame=single,label=]
4281  gap> PrintTraceList(GB);
4282  - G(1)y + yG(1) - G(2)x + xG(2)
4283
4284  - G(1)y + xG(2)
4285
4286   G(1) + xG(1)y - xyG(1) + xG(2)x - x^2G(2)
4287\end{Verbatim}
4288 }
4289
4290
4291\section{\textcolor{Chapter }{ Finiteness of the Weyl group of type E$_6$}}\label{Example13}
4292\logpage{[ "A", 12, 0 ]}
4293\hyperdef{L}{X8737C45F8059A5E4}{}
4294{
4295
4296
4297 This example extends \ref{Example03}, which computes the order of the Weyl group of type E$_6$.
4298
4299 Here, before the dimension is calculated, it is checked whether the quotient
4300algebra is finite dimensional or infinite dimensional. The function \texttt{FinCheckQA} (\ref{FinCheckQA}) is used for this computation. For the use of \texttt{PreprocessAnalysisQA} (\ref{PreprocessAnalysisQA}) to speed up the check, see Example \ref{Example14}.
4301
4302 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 2 (for more information about the info level, see Chapter \ref{Info}).
4303\begin{Verbatim}[fontsize=\small,frame=single,label=]
4304  gap> LoadPackage("GBNP","0",false);;
4305  gap> SetInfoLevel(InfoGBNP,1);
4306  gap> SetInfoLevel(InfoGBNPTime,2);
4307\end{Verbatim}
4308 Then input the relations in NP format (see Section \ref{NP}). They will be assigned to \texttt{KI}. These relations are the same as those in Example 3.
4309\begin{Verbatim}[fontsize=\small,frame=single,label=]
4310  gap> k1 := [[[1,3,1],[3,1,3]],[1,-1]];;
4311  gap> k2 := [[[4,3,4],[3,4,3]],[1,-1]];;
4312  gap> k3 := [[[4,2,4],[2,4,2]],[1,-1]];;
4313  gap> k4 := [[[4,5,4],[5,4,5]],[1,-1]];;
4314  gap> k5 := [[[6,5,6],[5,6,5]],[1,-1]];;
4315  gap> k6 := [[[1,2],[2,1]],[1,-1]];;
4316  gap> k7 := [[[1,4],[4,1]],[1,-1]];;
4317  gap> k8 := [[[1,5],[5,1]],[1,-1]];;
4318  gap> k9 := [[[1,6],[6,1]],[1,-1]];;
4319  gap> k10 := [[[2,3],[3,2]],[1,-1]];;
4320  gap> k11 := [[[2,5],[5,2]],[1,-1]];;
4321  gap> k12 := [[[2,6],[6,2]],[1,-1]];;
4322  gap> k13 := [[[3,5],[5,3]],[1,-1]];;
4323  gap> k14 := [[[3,6],[6,3]],[1,-1]];;
4324  gap> k15 := [[[4,6],[6,4]],[1,-1]];;
4325  gap> k16 := [[[1,1],[]],[1,-1]];;
4326  gap> k17 := [[[2,2],[]],[1,-1]];;
4327  gap> k18 := [[[3,3],[]],[1,-1]];;
4328  gap> k19 := [[[4,4],[]],[1,-1]];;
4329  gap> k20 := [[[5,5],[]],[1,-1]];;
4330  gap> k21 := [[[6,6],[]],[1,-1]];;
4331  gap> KI := [k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,
4332  >        k11,k12,k13,k14,k15,k16,k17,k18,k19,k20,k21
4333  >       ];;
4334\end{Verbatim}
4335 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}):
4336\begin{Verbatim}[fontsize=\small,frame=single,label=]
4337  gap> GB := SGrobner(KI);;
4338  #I  number of entered polynomials is 21
4339  #I  number of polynomials after reduction is 21
4340  #I  End of phase I
4341  #I  End of phase II
4342  #I  End of phase III
4343  #I  Time needed to clean G :0
4344  #I  End of phase IV
4345  #I  The computation took 96 msecs.
4346\end{Verbatim}
4347 We will check whether the quotient algebra is finite dimensional or infinite
4348dimensional. The function \texttt{FinCheckQA} (\ref{FinCheckQA}) exists for this purpose. Its first argument is the list of leading monomials
4349of a Gr{\"o}bner basis and its second argument the number of symbols. The
4350leading monomials can be calculated with \texttt{LMonsNP} (\ref{LMonsNP}).
4351\begin{Verbatim}[fontsize=\small,frame=single,label=]
4352  gap> L:=LMonsNP(GB);;
4353  gap> FinCheckQA(L,6);
4354  true
4355  gap> time;
4356  60
4357\end{Verbatim}
4358 If a quotient algebra is finite dimensional, the dimension can be calculated
4359with \texttt{DimQA} (\ref{DimQA}), the arguments are the Gr{\"o}bner basis \texttt{GB} and the number of symbols \texttt{6}. Since \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) is set to 2, we get timing information from \texttt{DimQA} (\ref{DimQA}):
4360\begin{Verbatim}[fontsize=\small,frame=single,label=]
4361  gap> dim := DimQA(GB,6);
4362  #I  The computation took 144 msecs.
4363  51840
4364\end{Verbatim}
4365 }
4366
4367
4368\section{\textcolor{Chapter }{Preprocessing for Weyl group computations}}\label{Example14}
4369\logpage{[ "A", 13, 0 ]}
4370\hyperdef{L}{X7B1822C67CF83041}{}
4371{
4372 This example extends Example \ref{Example03} with the following action: after the Gr{\"o}bner basis computation, we first
4373check if the quotient algebra is finite dimensional or infinite dimensional
4374before we possibly try to compute that dimension. Preprocessing of the set of
4375leading terms of the Gr{\"o}bner basis is used to speed up the check. The
4376functions \texttt{PreprocessAnalysisQA} (\ref{PreprocessAnalysisQA}) and \texttt{FinCheckQA} (\ref{FinCheckQA}) are used for the computations. Even without preprocessing this already goes
4377fast. Still, preprocessing can speed up more involved cases. For instance,
4378after adapting this example to run for E7, we found that preprocessing speeds
4379up the computation from 400 secs to about 40 secs. (Be aware that Gr{\"o}bner
4380basis computation will take a while for E7.)
4381
4382 More information about the preprocessing can be found in the preprint ``The dimensionality of quotient algebras'' \cite{Krook2003} which is part of the documentation.
4383
4384 Note: there is no information on the amount of preprocessing which is optimal,
4385but in general for big examples, even full preprocessing is better than using
4386no preprocessing at all.
4387
4388 Note: Example \ref{Example13} also determines if the quotient algebra appearing here is finite or infinite
4389dimensional but does not use preprocessing.
4390
4391 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 0 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 2 (for more information about the info level, see Chapter \ref{Info}).
4392\begin{Verbatim}[fontsize=\small,frame=single,label=]
4393  gap> LoadPackage("GBNP","0",false);;
4394  gap> SetInfoLevel(InfoGBNP,0);
4395  gap> SetInfoLevel(InfoGBNPTime,2);
4396\end{Verbatim}
4397 Then input the relations in NP format (see Section \ref{NP}). They will be assigned to \texttt{KI}.
4398\begin{Verbatim}[fontsize=\small,frame=single,label=]
4399  gap> k1 := [[[1,3,1],[3,1,3]],[1,-1]];;
4400  gap> k2 := [[[4,3,4],[3,4,3]],[1,-1]];;
4401  gap> k3 := [[[4,2,4],[2,4,2]],[1,-1]];;
4402  gap> k4 := [[[4,5,4],[5,4,5]],[1,-1]];;
4403  gap> k5 := [[[6,5,6],[5,6,5]],[1,-1]];;
4404  gap> k6 := [[[1,2],[2,1]],[1,-1]];;
4405  gap> k7 := [[[1,4],[4,1]],[1,-1]];;
4406  gap> k8 := [[[1,5],[5,1]],[1,-1]];;
4407  gap> k9 := [[[1,6],[6,1]],[1,-1]];;
4408  gap> k10 := [[[2,3],[3,2]],[1,-1]];;
4409  gap> k11 := [[[2,5],[5,2]],[1,-1]];;
4410  gap> k12 := [[[2,6],[6,2]],[1,-1]];;
4411  gap> k13 := [[[3,5],[5,3]],[1,-1]];;
4412  gap> k14 := [[[3,6],[6,3]],[1,-1]];;
4413  gap> k15 := [[[4,6],[6,4]],[1,-1]];;
4414  gap> k16 := [[[1,1],[]],[1,-1]];;
4415  gap> k17 := [[[2,2],[]],[1,-1]];;
4416  gap> k18 := [[[3,3],[]],[1,-1]];;
4417  gap> k19 := [[[4,4],[]],[1,-1]];;
4418  gap> k20 := [[[5,5],[]],[1,-1]];;
4419  gap> k21 := [[[6,6],[]],[1,-1]];;
4420  gap> KI := [k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,
4421  >        k11,k12,k13,k14,k15,k16,k17,k18,k19,k20,k21
4422  >       ];;
4423\end{Verbatim}
4424 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}):
4425\begin{Verbatim}[fontsize=\small,frame=single,label=]
4426  gap> GB := SGrobner(KI);;
4427  #I  Time needed to clean G :0
4428  #I  The computation took 104 msecs.
4429\end{Verbatim}
4430 Check the dimensionality of the quotient algebra. We will check whether it is
4431finite dimensional or infinite dimensional. In case of finite dimensionality
4432we can compute this dimension.
4433
4434 The function \texttt{FinCheckQA} (\ref{FinCheckQA}), which is used to check finite dimensionality has as first argument the list
4435of leading monomials of a Gr{\"o}bner basis and as second argument the number
4436of symbols. The monomials can be calculated with \texttt{LMonsNP} (\ref{LMonsNP}). They then will be preprocessed using 4 recursions. If you want full
4437preprocessing, use 0 instead of 4 as a parameter for the number of recursions.
4438\begin{Verbatim}[fontsize=\small,frame=single,label=]
4439  gap> L:=LMonsNP(GB);;
4440  gap> L:=PreprocessAnalysisQA(L,6,4);;
4441  gap> time;
4442  4
4443  gap> fd:=FinCheckQA(L,6);
4444  true
4445  gap> time;
4446  4
4447\end{Verbatim}
4448 If a quotient algebra is finite dimensional, the dimension can be calculated
4449with \texttt{DimQA} (\ref{DimQA}), the arguments are the Gr{\"o}bner basis \texttt{GB} and the number of symbols \texttt{6}. Since \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) is set to 2, we get timing information from \texttt{DimQA} (\ref{DimQA}):
4450\begin{Verbatim}[fontsize=\small,frame=single,label=]
4451  gap> dim := DimQA(GB,6);
4452  #I  The computation took 176 msecs.
4453  51840
4454\end{Verbatim}
4455 }
4456
4457
4458\section{\textcolor{Chapter }{A quotient algebra with exponential growth}}\label{Example15}
4459\logpage{[ "A", 14, 0 ]}
4460\hyperdef{L}{X7BE4A97886B0930E}{}
4461{
4462 This example demonstrates an instance in which the quotient algebra is
4463infinite dimensional and has exponential growth. We start out with \texttt{KI}$:=[y^4-y^2,x^2y-xy]$ and obtain a Gr{\"o}bner basis with leading terms $[xxy,yyy]$. The quotient algebra will thus have exponential growth since the cycles $(xyyx)^n$ and $(xy)^m$ intersect in the common subwords $xy$ (and in $yx$). This is explained in \cite{Krook2003}. The function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) is used for the computation.
4464
4465 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4466\begin{Verbatim}[fontsize=\small,frame=single,label=]
4467  gap> LoadPackage("GBNP","0",false);;
4468  gap> SetInfoLevel(InfoGBNP,2);
4469  gap> SetInfoLevel(InfoGBNPTime,1);
4470\end{Verbatim}
4471 Let the variables be printed as $x$ and $y$ instead of $a$ and $b$ by means of \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint})
4472\begin{Verbatim}[fontsize=\small,frame=single,label=]
4473  gap> GBNP.ConfigPrint("x","y");
4474\end{Verbatim}
4475 Then input the relations in NP format (see Section \ref{NP}). They will be assigned to \texttt{KI}.
4476\begin{Verbatim}[fontsize=\small,frame=single,label=]
4477  gap> k1 := [[[2,2,2,2],[2,2]],[1,-1]];;
4478  gap> k2 := [[[1,1,2],[1,2]],[1,-1]];;
4479  gap> KI := [k1,k2];;
4480  gap> PrintNPList(KI);
4481   y^4 - y^2
4482   x^2y - xy
4483\end{Verbatim}
4484 We calculate the Gr{\"o}bner basis with the function \texttt{SGrobner} (\ref{SGrobner}) and print it with \texttt{PrintNPList} (\ref{PrintNPList}).
4485\begin{Verbatim}[fontsize=\small,frame=single,label=]
4486  gap> GB := SGrobner(KI);;
4487  #I  number of entered polynomials is 2
4488  #I  number of polynomials after reduction is 2
4489  #I  End of phase I
4490  #I  End of phase II
4491  #I  List of todo lengths is [ 0 ]
4492  #I  End of phase III
4493  #I  G: Cleaning finished, 0 polynomials reduced
4494  #I  End of phase IV
4495  #I  The computation took 0 msecs.
4496  gap> PrintNPList(GB);
4497   x^2y - xy
4498   y^4 - y^2
4499\end{Verbatim}
4500 Next we check the dimensionality of the quotient algebra with the function \texttt{FinCheckQA} (\ref{FinCheckQA}) or the function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}). These functions expect as first argument a list \mbox{\texttt{\mdseries\slshape F}} of leading terms of a Gr{\"o}bner basis, which can be calculated with the
4501function \texttt{LMonsNP} (\ref{LMonsNP}) and as second argument the number of symbols (here equal to 2). The function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) will not only report whether a Gr{\"o}bner basis is finite, but will also
4502provide information about its growth.
4503\begin{Verbatim}[fontsize=\small,frame=single,label=]
4504  gap> L:=LMonsNP(GB);
4505  [ [ 1, 1, 2 ], [ 2, 2, 2, 2 ] ]
4506  gap> fd:=FinCheckQA(L,2);
4507  false
4508  gap> fd:=DetermineGrowthQA(L,2,false);
4509  "exponential growth"
4510\end{Verbatim}
4511 Although the quotient algebra is infinite dimensional, multiplication of two
4512elements can be carried out by \texttt{MulQA} (\ref{MulQA}). We print three positive powers of $x+y$.
4513\begin{Verbatim}[fontsize=\small,frame=single,label=]
4514  gap> w := [[[1],[2]],[1,1]];;
4515  gap> hlp := [[[]],[1]];;
4516  gap> for i in [3..5] do
4517  >   hlp := MulQA(hlp, w, GB);
4518  >   Print("\n (x+y)^",i," = \n");
4519  >   PrintNP(hlp);
4520  > od;
4521
4522   (x+y)^3 =
4523   y + x
4524
4525   (x+y)^4 =
4526   y^2 + yx + xy + x^2
4527
4528   (x+y)^5 =
4529   y^3 + y^2x + yxy + yx^2 + xy^2 + xyx + x^3 + xy
4530\end{Verbatim}
4531 }
4532
4533
4534\section{\textcolor{Chapter }{A commutative quotient algebra of polynomial growth}}\label{Example16}
4535\logpage{[ "A", 15, 0 ]}
4536\hyperdef{L}{X78679D7D80CD8822}{}
4537{
4538 This example extends \ref{Example06}, a commutative example from Some Tapas of Computer Algebra \cite{CohenCuypersSterk1999}, page 339.
4539
4540 The result of the Gr{\"o}bner basis computation should be the union of $\{a,b\}$ and the set of 6 homogeneous binomials (that is, polynomials with two terms)
4541of degree 2 forcing commuting between $c$, $d$, $e$, and $f$, as before. After computation of the Gr{\"o}bner basis, the quotient algebra
4542is studied and found to be infinite dimensional of polynomial growth of degree
45434. The function \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}) is used for this computation. Then part of its Hilbert series is computed. The
4544function \texttt{HilbertSeriesQA} (\ref{HilbertSeriesQA}) is used for the computations.
4545
4546 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4547\begin{Verbatim}[fontsize=\small,frame=single,label=]
4548  gap> LoadPackage("GBNP","0",false);;
4549  gap> SetInfoLevel(InfoGBNP,2);
4550  gap> SetInfoLevel(InfoGBNPTime,1);
4551\end{Verbatim}
4552 Now define some functions which will help in the construction of relations.
4553The function \texttt{powermon(i, exp)} will return the monomial $i^{exp}$. The function \texttt{comm(aa, bb)} will return a relation forcing commutativity between its two arguments \texttt{aa} and \texttt{bb}.
4554\begin{Verbatim}[fontsize=\small,frame=single,label=]
4555  gap> powermon := function(base, exp)
4556  >  local ans,i;
4557  >  ans := [];
4558  >  for i in [1..exp] do ans :=  Concatenation(ans,[base]); od;
4559  >  return ans;
4560  > end;;
4561
4562  gap> comm := function(aa,bb)
4563  >   return [[[aa,bb],[bb,aa]],[1,-1]];
4564  > end;;
4565\end{Verbatim}
4566 Now the relations are entered:
4567\begin{Verbatim}[fontsize=\small,frame=single,label=]
4568  gap> p1 := [[[5,1]],[1]];;
4569  gap> p2 := [[powermon(1,3),[6,1]],[1,1]];;
4570  gap> p3 := [[powermon(1,9),Concatenation([3],powermon(1,3))],[1,1]];;
4571  gap> p4 := [[powermon(1,81),Concatenation([3],powermon(1,9)),Concatenation([4],
4572  > 	powermon(1,3))],[1,1,1]];;
4573  gap> p5 := [[Concatenation([3],powermon(1,81)),Concatenation([4],powermon(1,9)),
4574  > 	Concatenation([5],powermon(1,3))],[1,1,1]];;
4575  gap> p6 := [[powermon(1,27),Concatenation([4],powermon(1,81)),Concatenation([5],
4576  > 	powermon(1,9)),Concatenation([6],powermon(1,3))],[1,1,1,1]];;
4577  gap> p7 := [[powermon(2,1),Concatenation([3],powermon(1,27)),Concatenation([5],
4578  > 	powermon(1,81)),Concatenation([6],powermon(1,9))],[1,1,1,1]];;
4579  gap> p8 := [[Concatenation([3],powermon(2,1)),Concatenation([4],powermon(1,27)),
4580  > 	Concatenation([6],powermon(1,81))],[1,1,1]];;
4581  gap> p9 := [[Concatenation([],powermon(1,1)),Concatenation([4],powermon(2,1)),
4582  > 	Concatenation([5],powermon(1,27))],[1,1,1]];;
4583  gap> p10 := [[Concatenation([3],powermon(1,1)),Concatenation([5],powermon(2,1)),
4584  > 	Concatenation([6],powermon(1,27))],[1,1,1]];;
4585  gap> p11 := [[Concatenation([4],powermon(1,1)),Concatenation([6],powermon(2,1))],
4586  > 	[1,1]];;
4587  gap> p12 := [[Concatenation([],powermon(2,3)),Concatenation([],powermon(2,1))],
4588  > 	[1,-1]];;
4589  gap> KI := [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12];;
4590  gap> for i in [1..5] do
4591  >     for j in [i+1..6] do
4592  >         Add(KI,comm(i,j));
4593  >     od;
4594  > od;
4595\end{Verbatim}
4596 The relations can be shown with \texttt{PrintNPList} (\ref{PrintNPList}):
4597\begin{Verbatim}[fontsize=\small,frame=single,label=]
4598  gap> PrintNPList(KI);
4599   ea
4600   a^3 + fa
4601   a^9 + ca^3
4602   a^81 + ca^9 + da^3
4603   ca^81 + da^9 + ea^3
4604   a^27 + da^81 + ea^9 + fa^3
4605   b + ca^27 + ea^81 + fa^9
4606   cb + da^27 + fa^81
4607   a + db + ea^27
4608   ca + eb + fa^27
4609   da + fb
4610   b^3 - b
4611   ab - ba
4612   ac - ca
4613   ad - da
4614   ae - ea
4615   af - fa
4616   bc - cb
4617   bd - db
4618   be - eb
4619   bf - fb
4620   cd - dc
4621   ce - ec
4622   cf - fc
4623   de - ed
4624   df - fd
4625   ef - fe
4626\end{Verbatim}
4627 It is usually easier to use the function \texttt{GP2NP} (\ref{GP2NP}) or the function \texttt{GP2NPList} (\ref{GP2NPList}) to enter relations. Entering the first twelve relations and then converting
4628them with \texttt{GP2NPList} (\ref{GP2NPList}) is demonstrated in example 6 (\ref{Example06}). More about converting can be read in Section \ref{TransitionFunctions}.
4629
4630 The Gr{\"o}bner basis can now be calculated with \texttt{SGrobner} (\ref{SGrobner}) and printed with \texttt{PrintNPList} (\ref{PrintNPList}).
4631\begin{Verbatim}[fontsize=\small,frame=single,label=]
4632  gap> GB := SGrobner(KI);
4633  #I  number of entered polynomials is 27
4634  #I  number of polynomials after reduction is 8
4635  #I  End of phase I
4636  #I  End of phase II
4637  #I  List of todo lengths is [ 0 ]
4638  #I  End of phase III
4639  #I  G: Cleaning finished, 0 polynomials reduced
4640  #I  End of phase IV
4641  #I  The computation took 728 msecs.
4642  [ [ [ [ 1 ] ], [ 1 ] ], [ [ [ 2 ] ], [ 1 ] ],
4643    [ [ [ 4, 3 ], [ 3, 4 ] ], [ 1, -1 ] ], [ [ [ 5, 3 ], [ 3, 5 ] ], [ 1, -1 ] ]
4644      , [ [ [ 5, 4 ], [ 4, 5 ] ], [ 1, -1 ] ],
4645    [ [ [ 6, 3 ], [ 3, 6 ] ], [ 1, -1 ] ], [ [ [ 6, 4 ], [ 4, 6 ] ], [ 1, -1 ] ]
4646      , [ [ [ 6, 5 ], [ 5, 6 ] ], [ 1, -1 ] ] ]
4647  gap> PrintNPList(GB);
4648   a
4649   b
4650   dc - cd
4651   ec - ce
4652   ed - de
4653   fc - cf
4654   fd - df
4655   fe - ef
4656\end{Verbatim}
4657 The growth of the quotient algebra can be studied with \texttt{DetermineGrowthQA} (\ref{DetermineGrowthQA}). The first argument is the list of leading monomials, which can be calculated
4658with \texttt{LMonsNP} (\ref{LMonsNP}). The second argument is the size of the alphabet.
4659\begin{Verbatim}[fontsize=\small,frame=single,label=]
4660  gap> L:=LMonsNP(GB);;
4661  gap> DetermineGrowthQA(L,6,false);
4662  4
4663  gap> time;
4664  0
4665\end{Verbatim}
4666 Now compute the first 10 terms of the Hilbert Series with \texttt{HilbertSeriesQA} (\ref{HilbertSeriesQA}) (note that trailing zeroes are removed):
4667\begin{Verbatim}[fontsize=\small,frame=single,label=]
4668  gap> HilbertSeriesQA(L,6,10);
4669  [ 1, 4, 10, 20, 35, 56, 84, 120, 165, 220, 286 ]
4670\end{Verbatim}
4671 }
4672
4673
4674\section{\textcolor{Chapter }{An algebra over a finite field}}\label{Example17}
4675\logpage{[ "A", 16, 0 ]}
4676\hyperdef{L}{X7CE3005580EF632D}{}
4677{
4678 A small example over a field other than the rationals, using the conversion
4679functions from \ref{TransitionFunctions}. The input relations define the symmetric group of degree 3, denoted $S_3$.
4680
4681 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 2 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4682\begin{Verbatim}[fontsize=\small,frame=single,label=]
4683  gap> LoadPackage("GBNP","0",false);;
4684  gap> SetInfoLevel(InfoGBNP,2);
4685  gap> SetInfoLevel(InfoGBNPTime,1);
4686\end{Verbatim}
4687 Let \texttt{F} be the field GF(2). The relations can be entered as elements of a free
4688associative algebra with one \texttt{A} (see  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}).
4689\begin{Verbatim}[fontsize=\small,frame=single,label=]
4690  gap> F:=GF(2);;
4691  gap> A:=FreeAssociativeAlgebraWithOne(F,"a","b");
4692  <algebra-with-one over GF(2), with 2 generators>
4693  gap> g:=GeneratorsOfAlgebraWithOne(A);
4694  [ (Z(2)^0)*a, (Z(2)^0)*b ]
4695\end{Verbatim}
4696 Enter the relations $\{a^2-1,b^2-1,(ab)^3-1\}$, convert them to NP-form, see Section \ref{NP}, with \texttt{GP2NPList} (\ref{GP2NPList}) and print them with \texttt{PrintNPList} (\ref{PrintNPList}):
4697\begin{Verbatim}[fontsize=\small,frame=single,label=]
4698  gap> KI_GP := [ g[1]^2-g[1]^0, g[2]^2-g[1]^0, (g[1]*g[2])^3-g[1]^0];
4699  [ (Z(2)^0)*<identity ...>+(Z(2)^0)*a^2, (Z(2)^0)*<identity ...>+(Z(2)^0)*b^2,
4700    (Z(2)^0)*<identity ...>+(Z(2)^0)*(a*b)^3 ]
4701  gap> KI:=GP2NPList(KI_GP);;
4702  gap> PrintNPList(KI);
4703   a^2 + Z(2)^0
4704   b^2 + Z(2)^0
4705   ababab + Z(2)^0
4706\end{Verbatim}
4707 Now calculate the Gr{\"o}bner basis with \texttt{SGrobner} (\ref{SGrobner}) and print it with \texttt{PrintNPList} (\ref{PrintNPList}):
4708\begin{Verbatim}[fontsize=\small,frame=single,label=]
4709  gap> GB:=SGrobner(KI);;
4710  #I  number of entered polynomials is 3
4711  #I  number of polynomials after reduction is 3
4712  #I  End of phase I
4713  #I  End of phase II
4714  #I  length of G =3
4715  #I  length of todo is 2
4716  #I  length of G =3
4717  #I  length of todo is 1
4718  #I  length of G =3
4719  #I  length of todo is 0
4720  #I  List of todo lengths is [ 2, 2, 1, 0 ]
4721  #I  End of phase III
4722  #I  G: Cleaning finished, 0 polynomials reduced
4723  #I  End of phase IV
4724  #I  The computation took 0 msecs.
4725  gap> PrintNPList(GB);
4726   a^2 + Z(2)^0
4727   b^2 + Z(2)^0
4728   bab + aba
4729\end{Verbatim}
4730 Now calculate the dimension of the quotient algebra with \texttt{DimQA} (\ref{DimQA}) (2 symbols) and a base with \texttt{BaseQA} (\ref{BaseQA}) (2 symbols, 0 for whole base) and print the base. This will give a list of
4731elements of the group.
4732\begin{Verbatim}[fontsize=\small,frame=single,label=]
4733  gap> DimQA(GB,2);
4734  6
4735  gap> B:=BaseQA(GB,2,0);;
4736  gap> PrintNPList(B);
4737   Z(2)^0
4738   a
4739   b
4740   ab
4741   ba
4742   aba
4743\end{Verbatim}
4744 We can print the Gr{\"o}bner basis and the basis of the quotient algebra,
4745converted back to GAP polynomials with \texttt{NP2GPList} (\ref{NP2GPList}). The functions used to convert the polynomials also require the algebra as an
4746argument. The result is useful for further computations in $A$.
4747\begin{Verbatim}[fontsize=\small,frame=single,label=]
4748  gap> NP2GPList(GB,A);
4749  [ (Z(2)^0)*a^2+(Z(2)^0)*<identity ...>, (Z(2)^0)*b^2+(Z(2)^0)*<identity ...>,
4750    (Z(2)^0)*b*a*b+(Z(2)^0)*a*b*a ]
4751  gap> NP2GPList(B,A);
4752  [ (Z(2)^0)*<identity ...>, (Z(2)^0)*a, (Z(2)^0)*b, (Z(2)^0)*a*b,
4753    (Z(2)^0)*b*a, (Z(2)^0)*a*b*a ]
4754\end{Verbatim}
4755 The matrix of right multiplication with the image of the first variable can be
4756computed by \texttt{MatrixQA} (\ref{MatrixQA}).
4757\begin{Verbatim}[fontsize=\small,frame=single,label=]
4758  gap> Display(MatrixQA(1,B,GB));
4759   . 1 . . . .
4760   1 . . . . .
4761   . . . . 1 .
4762   . . . . . 1
4763   . . 1 . . .
4764   . . . 1 . .
4765\end{Verbatim}
4766 }
4767
4768
4769\section{\textcolor{Chapter }{The dihedral group of order 8}}\label{Example18}
4770\logpage{[ "A", 17, 0 ]}
4771\hyperdef{L}{X7E4CEC577A18C8ED}{}
4772{
4773 In this example (Example 1 from Linton \cite{MR94k:20022}) the two-sided relations give the group algebra of the group with
4774presentation $\langle a,b \mid a^4=b^2=(ab)^2=1\rangle$, the dihedral group of order 8. It is possible to construct a permutation
4775module of degree 4, over a field \texttt{k}. In this example \texttt{k} will be the field of rational numbers.
4776
4777 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4778\begin{Verbatim}[fontsize=\small,frame=single,label=]
4779  gap> LoadPackage("GBNP","0",false);;
4780  gap> SetInfoLevel(InfoGBNP,1);
4781  gap> SetInfoLevel(InfoGBNPTime,1);
4782\end{Verbatim}
4783 Now enter the relations as GAP polynomials. It is possible to enter them with
4784and without module generators. First it is shown how to enter the relations
4785without using a module. It is possible to enter them with a free associative
4786algebra with one over the field (the rational numbers) (see also  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}). For convenience we use the variables \texttt{a} and \texttt{b} for the generators of the algebra and \texttt{e} for the one of the algebra.
4787\begin{Verbatim}[fontsize=\small,frame=single,label=]
4788  gap> A:=FreeAssociativeAlgebraWithOne(Rationals, "a", "b");
4789  <algebra-with-one over Rationals, with 2 generators>
4790  gap> a:=A.a;;b:=A.b;;e:=One(A);;
4791\end{Verbatim}
4792 Now the relations are entered:
4793\begin{Verbatim}[fontsize=\small,frame=single,label=]
4794  gap> twosidrels:=[a^4-e,b^2-e,(a*b)^2-e];;
4795  gap> prefixrels:=[b-e];;
4796\end{Verbatim}
4797 First the relations are converted into NP format, see Section \ref{NP}, after which the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record.
4798\begin{Verbatim}[fontsize=\small,frame=single,label=]
4799  gap> GBR:=SGrobnerModule(GP2NPList(prefixrels),GP2NPList(twosidrels));;
4800  #I  number of entered polynomials is 3
4801  #I  number of polynomials after reduction is 3
4802  #I  End of phase I
4803  #I  End of phase II
4804  #I  End of phase III
4805  #I  End of phase IV
4806  #I  The computation took 0 msecs.
4807  #I  number of entered polynomials is 7
4808  #I  number of polynomials after reduction is 7
4809  #I  End of phase I
4810  #I  End of phase II
4811  #I  End of phase III
4812  #I  End of phase IV
4813  #I  The computation took 4 msecs.
4814\end{Verbatim}
4815 The record GBR has two members: the two-sided relations \texttt{GBR.ts} and the prefix relations \texttt{GBR.p}. It is possible to print these using the function \texttt{PrintNPList} (\ref{PrintNPList}):
4816\begin{Verbatim}[fontsize=\small,frame=single,label=]
4817  gap> PrintNPList(GBR.ts);
4818   b^2 - 1
4819   aba - b
4820   ba^2 - a^2b
4821   bab - a^3
4822   a^4 - 1
4823   a^3b - ba
4824  gap> PrintNPList(GBR.p);
4825  [ b - 1 ]
4826  [ a^3 - ab ]
4827  [ a^2b - a^2 ]
4828\end{Verbatim}
4829 It is now possible to calculate the standard basis of the quotient module with
4830the function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (2), the number of generators of the
4831module (1), and a variable \texttt{maxno} for returning partial bases (0 means full basis).
4832\begin{Verbatim}[fontsize=\small,frame=single,label=]
4833  gap> B:=BaseQM(GBR,2,1,0);;
4834  gap> PrintNPList(B);
4835  [ 1 ]
4836  [ a ]
4837  [ a^2 ]
4838  [ ab ]
4839\end{Verbatim}
4840 It is also possible to use a module with one generator to enter these
4841relations:
4842\begin{Verbatim}[fontsize=\small,frame=single,label=]
4843  gap> D:=A^1;;
4844  gap> gd:=GeneratorsOfLeftModule(D);;
4845  gap> prefixrelsdom:=[gd[1]*(b-e)];;
4846\end{Verbatim}
4847 It is possible to use the two-sided Gr{\"o}bner basis which was already
4848calculated.
4849\begin{Verbatim}[fontsize=\small,frame=single,label=]
4850  gap> GBR:=SGrobnerModule(GP2NPList(prefixrelsdom),GBR.ts);;
4851  #I  number of entered polynomials is 6
4852  #I  number of polynomials after reduction is 6
4853  #I  End of phase I
4854  #I  End of phase II
4855  #I  End of phase III
4856  #I  End of phase IV
4857  #I  The computation took 4 msecs.
4858  #I  number of entered polynomials is 7
4859  #I  number of polynomials after reduction is 7
4860  #I  End of phase I
4861  #I  End of phase II
4862  #I  End of phase III
4863  #I  End of phase IV
4864  #I  The computation took 0 msecs.
4865  gap> PrintNPList(GBR.p);;
4866  [ b - 1 ]
4867  [ a^3 - ab ]
4868  [ a^2b - a^2 ]
4869  gap> B:=BaseQM(GBR,2,1,0);;
4870  gap> PrintNPList(B);
4871  [ 1 ]
4872  [ a ]
4873  [ a^2 ]
4874  [ ab ]
4875\end{Verbatim}
4876 To compute the image of right multiplication of the basis element \texttt{B[Length(B)]} of the module with the quotient algebra element corresponding to $ab$ we use the function \texttt{MulQM} (\ref{MulQM}) with arguments \texttt{B[Length(B)]}, \texttt{GB2NP(a*b)}, and \texttt{GBR} We subsequently use \texttt{PrintNP} (\ref{PrintNP}) to display the result as a 1-dimensional vector with an entry from $A$.
4877\begin{Verbatim}[fontsize=\small,frame=single,label=]
4878  gap> v := MulQM(B[Length(B)],GP2NP(a*b),GBR);
4879  [ [ [ -1 ] ], [ 1 ] ]
4880  gap> PrintNP(v);
4881  [ 1 ]
4882\end{Verbatim}
4883 }
4884
4885
4886\section{\textcolor{Chapter }{The dihedral group of order 8 on another module}}\label{Example19}
4887\logpage{[ "A", 18, 0 ]}
4888\hyperdef{L}{X83328C357FB33D17}{}
4889{
4890 In this example (Example 2 from Linton \cite{MR94k:20022}) the two-sided relations give the group algebra of the group with
4891presentation $\langle a,b\mid a^4=b^2=(ab)^2=1\rangle$, the dihedral group of order 8. This module relation fixes the all-one vector
4892of Example \ref{Example18}: $1 + a(1+a+b)$.
4893
4894 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 0 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 0 (for more information about the info level, see Chapter \ref{Info}).
4895\begin{Verbatim}[fontsize=\small,frame=single,label=]
4896  gap> LoadPackage("GBNP","0",false);;
4897  gap> SetInfoLevel(InfoGBNP,0);
4898  gap> SetInfoLevel(InfoGBNPTime,0);
4899\end{Verbatim}
4900 We will enter the relations as GAP polynomials. It is possible to enter these
4901with and without a module. How to do this is shown in \ref{Example18}. The relations here are entered without a module, since the module is only
4902one-dimensional. It is possible to enter them using a free associative algebra
4903with one over the field (the rational numbers) (see also  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}). For convenience we use the variables \texttt{a} and \texttt{b} for the generators of the algebra and \texttt{e} for the one of the algebra.
4904\begin{Verbatim}[fontsize=\small,frame=single,label=]
4905  gap> A:=FreeAssociativeAlgebraWithOne(Rationals, "a", "b");
4906  <algebra-with-one over Rationals, with 2 generators>
4907  gap> g:=GeneratorsOfAlgebra(A);;
4908  gap> a:=g[2];;b:=g[3];;e:=g[1];;
4909\end{Verbatim}
4910 Now the relations are entered:
4911\begin{Verbatim}[fontsize=\small,frame=single,label=]
4912  gap> twosidrels:=[a^4-e,b^2-e,(a*b)^2-e];;
4913  gap> prefrels:=[ b-e, e + a * (e + a + b) ];;
4914\end{Verbatim}
4915 First the relations are converted into NP format (see \ref{NP}) after which the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record.
4916\begin{Verbatim}[fontsize=\small,frame=single,label=]
4917  gap> GBR:=SGrobnerModule(GP2NPList(prefrels),GP2NPList(twosidrels));;
4918\end{Verbatim}
4919 The record GBR has two members: the two-sided relations \texttt{GBR.ts} and the prefix relations \texttt{GBR.p}. It is possible to print these using the function \texttt{PrintNPList} (\ref{PrintNPList}):
4920\begin{Verbatim}[fontsize=\small,frame=single,label=]
4921  gap> PrintNPList(GBR.ts);
4922   b^2 - 1
4923   aba - b
4924   ba^2 - a^2b
4925   bab - a^3
4926   a^4 - 1
4927   a^3b - ba
4928  gap> PrintNPList(GBR.p);
4929  [ b - 1 ]
4930  [ ab + a^2 + a + 1 ]
4931  [ a^3 + a^2 + a + 1 ]
4932  [ a^2b - a^2 ]
4933\end{Verbatim}
4934 It is now possible to calculate the standard basis of the quotient module with
4935the function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (here it is 2), the number of
4936generators of the mdoule (here it is 1), and a variable \texttt{maxno} for returning partial bases (0 means full basis).
4937\begin{Verbatim}[fontsize=\small,frame=single,label=]
4938  gap> B:=BaseQM(GBR,2,1,0);;
4939  gap> PrintNPList(B);
4940  [ 1 ]
4941  [ a ]
4942  [ a^2 ]
4943\end{Verbatim}
4944 }
4945
4946
4947\section{\textcolor{Chapter }{The dihedral group on a non-cyclic module}}\label{Example20}
4948\logpage{[ "A", 19, 0 ]}
4949\hyperdef{L}{X85DBF3967C4DF5FE}{}
4950{
4951 In this example (Example 3 from Linton \cite{MR94k:20022}), the two-sided relations give the group algebra of the group with
4952presentation $\langle a,b\mid a^4=b^2=(ab)^2=1\rangle$, the dihedral group of order 8. The module under construction is a non-cyclic
4953module, obtained by taking two copies of the representation of Example \ref{Example18} and fusing their one-dimensional submodules.
4954
4955 Load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
4956\begin{Verbatim}[fontsize=\small,frame=single,label=]
4957  gap> LoadPackage("GBNP","0",false);;
4958  gap> SetInfoLevel(InfoGBNP,1);
4959  gap> SetInfoLevel(InfoGBNPTime,1);
4960\end{Verbatim}
4961 Create the free associative algebra to enter the relations in:
4962\begin{Verbatim}[fontsize=\small,frame=single,label=]
4963  gap> A:=FreeAssociativeAlgebraWithOne(Rationals, "a", "b");
4964  <algebra-with-one over Rationals, with 2 generators>
4965  gap> g:=GeneratorsOfAlgebra(A);;
4966  gap> a:=g[2];;b:=g[3];;e:=g[1];;
4967\end{Verbatim}
4968 Now the relations are entered:
4969\begin{Verbatim}[fontsize=\small,frame=single,label=]
4970  gap> twosidrels:=[a^4-e,b^2-e,(a*b)^2-e];;
4971  gap> D:=A^2;;
4972  gap> y:=GeneratorsOfLeftModule(D);;
4973  gap> modrels:=[y[1]*b-y[1], y[2]*b-y[2], y[1]+y[1]*a*(e+a+b) -y[2]-y[2]*a*(e+a+b)];;
4974\end{Verbatim}
4975 First the relations are converted into NP format (see \ref{NP}) with the function \texttt{GP2NPList} (\ref{GP2NPList}). They are printed in raw form and subsequently in a more legible format.
4976\begin{Verbatim}[fontsize=\small,frame=single,label=]
4977  gap> modrelsNP:=GP2NPList(modrels);
4978  [ [ [ [ -1, 2 ], [ -1 ] ], [ 1, -1 ] ], [ [ [ -2, 2 ], [ -2 ] ], [ 1, -1 ] ],
4979    [ [ [ -1, 1, 2 ], [ -1, 1, 1 ], [ -2, 1, 2 ], [ -2, 1, 1 ], [ -1, 1 ],
4980            [ -2, 1 ], [ -1 ], [ -2 ] ], [ 1, 1, -1, -1, 1, -1, 1, -1 ] ] ]
4981  gap> PrintNPList(modrelsNP);
4982  [ b - 1 , 0]
4983  [ 0, b - 1 ]
4984  [ ab + a^2 + a + 1 , - ab - a^2 - a - 1 ]
4985\end{Verbatim}
4986 Next the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record (see \ref{GBR}).
4987\begin{Verbatim}[fontsize=\small,frame=single,label=]
4988  gap> GBR:=SGrobnerModule(modrelsNP,GP2NPList(twosidrels));;
4989  #I  number of entered polynomials is 3
4990  #I  number of polynomials after reduction is 3
4991  #I  End of phase I
4992  #I  End of phase II
4993  #I  End of phase III
4994  #I  End of phase IV
4995  #I  The computation took 0 msecs.
4996  #I  number of entered polynomials is 9
4997  #I  number of polynomials after reduction is 9
4998  #I  End of phase I
4999  #I  End of phase II
5000  #I  End of phase III
5001  #I  End of phase IV
5002  #I  The computation took 0 msecs.
5003\end{Verbatim}
5004 The record \texttt{GBR} has two members: the two-sided relations \texttt{GBR.ts} and the prefix relations \texttt{GBR.p}. It is possible to print these using the function \texttt{PrintNPList} (\ref{PrintNPList}):
5005\begin{Verbatim}[fontsize=\small,frame=single,label=]
5006  gap> PrintNPList(GBR.ts);
5007   b^2 - 1
5008   aba - b
5009   ba^2 - a^2b
5010   bab - a^3
5011   a^4 - 1
5012   a^3b - ba
5013  gap> PrintNPList(GBR.p);
5014  [ 0, b - 1 ]
5015  [ b - 1 , 0]
5016  [ ab + a^2 + a + 1 , - ab - a^2 - a - 1 ]
5017  [ 0, a^3 - ab ]
5018  [ 0, a^2b - a^2 ]
5019  [ a^3 + a^2 + a + 1 , - ab - a^2 - a - 1 ]
5020  [ a^2b - a^2 , 0]
5021\end{Verbatim}
5022 It is now possible to calculate the standard basis of the quotient module with
5023the function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (in this case 2), the number of
5024generators of the module (in this case 2), and a variable \texttt{maxno} for returning partial bases (0 means full basis).
5025\begin{Verbatim}[fontsize=\small,frame=single,label=]
5026  gap> B:=BaseQM(GBR,2,2,0);;
5027  gap> PrintNPList(B);
5028  [ 0, 1 ]
5029  [ 1 , 0]
5030  [ 0, a ]
5031  [ a , 0]
5032  [ 0, a^2 ]
5033  [ 0, ab ]
5034  [ a^2 , 0]
5035\end{Verbatim}
5036 It is also possible to convert each member of the list \texttt{B} of polynomials in NP form to GAP polynomials to do further calculations within
5037the algebra or module. This can be done with the function \texttt{NP2GPList} (\ref{NP2GPList}).
5038\begin{Verbatim}[fontsize=\small,frame=single,label=]
5039  gap> NP2GPList(B,D);
5040  [ [ <zero> of ..., (1)*<identity ...> ], [ (1)*<identity ...>, <zero> of ... ]
5041      , [ <zero> of ..., (1)*a ], [ (1)*a, <zero> of ... ],
5042    [ <zero> of ..., (1)*a^2 ], [ <zero> of ..., (1)*a*b ],
5043    [ (1)*a^2, <zero> of ... ] ]
5044\end{Verbatim}
5045 Individual GAP polynomials can be obtained from polynomials in NP form with
5046the function \texttt{NP2GP} (\ref{NP2GP}). This also holds for elements of the free module \texttt{D} in NP form.
5047\begin{Verbatim}[fontsize=\small,frame=single,label=]
5048  gap> Display(NP2GP(B[Length(B)],D));
5049  [ (1)*a^2, <zero> of ... ]
5050\end{Verbatim}
5051 Next we write down the matrices for the right action of the generators on the
5052module by means of \texttt{MatrixQA} (\ref{MatrixQA}).
5053\begin{Verbatim}[fontsize=\small,frame=single,label=]
5054  gap> Display(MatrixQA(1,B,GBR));
5055  [ [   0,   0,   1,   0,   0,   0,   0 ],
5056    [   0,   0,   0,   1,   0,   0,   0 ],
5057    [   0,   0,   0,   0,   1,   0,   0 ],
5058    [   0,   0,   0,   0,   0,   0,   1 ],
5059    [   0,   0,   0,   0,   0,   1,   0 ],
5060    [   1,   0,   0,   0,   0,   0,   0 ],
5061    [   1,  -1,   1,  -1,   1,   1,  -1 ] ]
5062  gap> Display(MatrixQA(2,B,GBR));
5063  [ [   1,   0,   0,   0,   0,   0,   0 ],
5064    [   0,   1,   0,   0,   0,   0,   0 ],
5065    [   0,   0,   0,   0,   0,   1,   0 ],
5066    [   1,  -1,   1,  -1,   1,   1,  -1 ],
5067    [   0,   0,   0,   0,   1,   0,   0 ],
5068    [   0,   0,   1,   0,   0,   0,   0 ],
5069    [   0,   0,   0,   0,   0,   0,   1 ] ]
5070\end{Verbatim}
5071 In order to compute the image of the vector $2y[1]+3y[2]$ of the two standard generators of the module under the action of the element $aab$, we use \texttt{StrongNormalFormNPM} (\ref{StrongNormalFormNPM}). Its first argument will be the vector and its second the Gr{\"o}bner basis.
5072The transformation \texttt{GP2NP} (\ref{GP2NP}) to the NP format needs to be applied to the vector before it can be used as an
5073argument.
5074\begin{Verbatim}[fontsize=\small,frame=single,label=]
5075  gap> v:=StrongNormalFormNPM(GP2NP((y[1]*2+y[2]*3)*a*a*b), GBR);;
5076  gap> PrintNP(v);
5077  [ 2a^2 , 3a^2 ]
5078\end{Verbatim}
5079 }
5080
5081
5082\section{\textcolor{Chapter }{The icosahedral group}}\label{Example04}
5083\logpage{[ "A", 20, 0 ]}
5084\hyperdef{L}{X78FCAC347D9D607E}{}
5085{
5086  In this example the two-sided relations give the group algebra of the group
5087with presentation $\langle a,b,c \mid a^2=b^2=c^2=(ab)^3=(bc)^5=(ac)^2=1\rangle$, the icosahedral group of order 120. This is the Coxeter group of type H$_3$. The module under construction is a 3-dimensional reflection representation,
5088
5089 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
5090\begin{Verbatim}[fontsize=\small,frame=single,label=]
5091  gap> LoadPackage("GBNP","0",false);;
5092  gap> SetInfoLevel(InfoGBNP,1);
5093  gap> SetInfoLevel(InfoGBNPTime,1);
5094\end{Verbatim}
5095 Create the field containing the golden ratio \texttt{tau}.
5096\begin{Verbatim}[fontsize=\small,frame=single,label=]
5097  gap> x := Indeterminate(Rationals,"x");
5098  x
5099  gap> p := x^2+ x-1;
5100  x^2+x-1
5101  gap> K := AlgebraicExtension(Rationals,p);
5102  <algebraic extension over the Rationals of degree 2>
5103  gap> tau:=RootOfDefiningPolynomial(K);
5104  a
5105\end{Verbatim}
5106 Create the free algebra with three generators over this field:
5107\begin{Verbatim}[fontsize=\small,frame=single,label=]
5108  gap> A:=FreeAssociativeAlgebraWithOne(K, "a", "b", "c");
5109  <algebra-with-one over <algebraic extension over the Rationals of degree
5110  2>, with 3 generators>
5111  gap> e:=One(A);; a:=A.a;; b:=A.b;; c:=A.c;;
5112\end{Verbatim}
5113 The ideal for a quotient of the icosahedral group algebra over this field, in
5114which \texttt{b}$*$\texttt{c} has a quadratic minimal polynomial involving \texttt{tau}:
5115\begin{Verbatim}[fontsize=\small,frame=single,label=]
5116  gap> #(b*c)^2-tau*b*c+e
5117  gap> Irels:=[a^2-e,b^2-e,c^2-e,a*b*a-b*a*b,((b*c)^2-tau*b*c+e)*(b*c-e),a*c-c*a];
5118  [ (!-1)*<identity ...>+(!1)*a^2, (!-1)*<identity ...>+(!1)*b^2,
5119    (!-1)*<identity ...>+(!1)*c^2, (!1)*a*b*a+(!-1)*b*a*b,
5120    (!-1)*<identity ...>+(a+1)*b*c+(-a-1)*(b*c)^2+(!1)*(b*c)^3,
5121    (!1)*a*c+(!-1)*c*a ]
5122\end{Verbatim}
5123 We now give module relations. The first two describe group elements of a
5124vector stabilizer, the third forces the central element $(abc)^5$ to be nontrivial.
5125\begin{Verbatim}[fontsize=\small,frame=single,label=]
5126  gap> Mrels:=[b*c-e,b-e,(a*b*c)^5+e];;
5127\end{Verbatim}
5128 First the relations are converted into NP format (see \ref{NP}) with the function \texttt{GP2NPList} (\ref{GP2NPList}). Next the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record (see \ref{GBR}).
5129\begin{Verbatim}[fontsize=\small,frame=single,label=]
5130  gap> GBR:=SGrobnerModule(GP2NPList(Mrels),GP2NPList(Irels));;
5131  #I  number of entered polynomials is 6
5132  #I  number of polynomials after reduction is 6
5133  #I  End of phase I
5134  #I  End of phase II
5135  #I  End of phase III
5136  #I  End of phase IV
5137  #I  The computation took 16 msecs.
5138  #I  number of entered polynomials is 12
5139  #I  number of polynomials after reduction is 12
5140  #I  End of phase I
5141  #I  End of phase II
5142  #I  End of phase III
5143  #I  End of phase IV
5144  #I  The computation took 36 msecs.
5145  gap> PrintNPList(GBR.ts);;
5146   a^2 + !-1
5147   b^2 + !-1
5148   ca + !-1ac
5149   c^2 + !-1
5150   bab + !-1aba
5151   cbc + !-1bcb + -a-1c + a+1b
5152   bcba + !-1acba + !-1abcb + abac + cb + !-1bc + -a-2ba + a+2ab
5153   cbac + !-1acba + !-1abcb + abac + cb + !-1bc + !-1ba + -a-1ac + a+2ab
5154   bacba + abacb + !-1cba + !-1bcb + !-1abc + -a-2aba + c + a+2a
5155  gap> PrintNPList(GBR.p);;
5156  [ b + !-1 ]
5157  [ c + !-1 ]
5158  [ ac + !-1a ]
5159  [ aba + !-1ab ]
5160  [ abc + ab + -aa + -a ]
5161\end{Verbatim}
5162 It is now possible to calculate the basis of the quotient algebra with the
5163function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (in this case 3), the number of
5164generators of the free module in which the vectors are chosen (in this case
51651), and a variable \texttt{maxno} for returning partial quotient algebras (0 means full basis).
5166\begin{Verbatim}[fontsize=\small,frame=single,label=]
5167  gap> B:=BaseQM(GBR,3,1,0);;
5168  gap> PrintNPList(B);
5169  [ !1 ]
5170  [ a ]
5171  [ ab ]
5172\end{Verbatim}
5173 Calculate the dimension of the quotient algebra with the function \texttt{DimQM} (\ref{DimQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (in this case 3) and the number of
5174generators of the module (in this case 1).
5175\begin{Verbatim}[fontsize=\small,frame=single,label=]
5176  gap> DimQM(GBR,3,1);
5177  3
5178\end{Verbatim}
5179 Next we write down the matrices for the right action of the generators on the
5180module by means of \texttt{MatrixQA} (\ref{MatrixQA}).
5181\begin{Verbatim}[fontsize=\small,frame=single,label=]
5182  gap> aa := MatrixQA(1,B,GBR);;
5183  gap> Display(aa);
5184  [ [  !0,  !1,  !0 ],
5185    [  !1,  !0,  !0 ],
5186    [  !0,  !0,  !1 ] ]
5187  gap> bb := MatrixQA(2,B,GBR);;
5188  gap> Display(bb);
5189  [ [  !1,  !0,  !0 ],
5190    [  !0,  !0,  !1 ],
5191    [  !0,  !1,  !0 ] ]
5192  gap> cc := MatrixQA(3,B,GBR);;
5193  gap> Display(cc);
5194  [ [   !1,   !0,   !0 ],
5195    [   !0,   !1,   !0 ],
5196    [    a,    a,  !-1 ] ]
5197\end{Verbatim}
5198 Finally we check the defining relations for the icosahedral group on the three
5199new matrix generators. This can be done by verifying if the result is equal to
5200the identity matrix or with the function \texttt{IsOne} (\textbf{Reference: IsOne}).
5201\begin{Verbatim}[fontsize=\small,frame=single,label=]
5202  gap> ee := IdentityMat(3,K);;
5203  gap> Display(ee);
5204  [ [  !1,  !0,  !0 ],
5205    [  !0,  !1,  !0 ],
5206    [  !0,  !0,  !1 ] ]
5207  gap> aa^2 = ee;
5208  true
5209  gap> IsOne(aa^2);
5210  true
5211  gap> IsOne(bb^2);
5212  true
5213  gap> IsOne(cc^2);
5214  true
5215  gap> IsOne((aa*bb)^3);
5216  true
5217  gap> IsOne((aa*cc)^2);
5218  true
5219  gap> IsOne((bb*cc)^5);
5220  true
5221\end{Verbatim}
5222 }
5223
5224
5225\section{\textcolor{Chapter }{The symmetric inverse monoid for a set of size four}}\label{Example21}
5226\logpage{[ "A", 21, 0 ]}
5227\hyperdef{L}{X780C4B777FEA9080}{}
5228{
5229 The algebra we will consider is from Example 4 from Linton \cite{MR94k:20022}. Its monomials form the symmetric inverse monoid, that is, the monoid of all
5230partial bijections on a given set, for a set of size four. The presentation is $\langle s_1,s_2,s_3,e\mid s_i^2=(s_1s_2)^3=(s_2s_3)^3=(s_1s_3)^2=1, e^2=e,
5231s_1e=es_1,s_2e=es_2,es_3e=(es_3)^2=(s_3e)^2\rangle$. The dimension of the monoid algebra is 209. The monoid has a natural
5232representation of degree 4 by means of partial permutation matrices, which can
5233be obtained by taking prefix relations $\{e,s_1-1, s_2-1, s_3e-s_3\}$.
5234
5235 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
5236\begin{Verbatim}[fontsize=\small,frame=single,label=]
5237  gap> LoadPackage("GBNP","0",false);;
5238  gap> SetInfoLevel(InfoGBNP,1);
5239  gap> SetInfoLevel(InfoGBNPTime,1);
5240\end{Verbatim}
5241 Now enter the relations as GAP polynomials. The module is one dimensional so
5242it is possible to enter it with and without a module. In Example 18 (\ref{Example18}) both ways are shown. Here the relations will be entered without a module,
5243with a free associative algebra with one over the field (the rational numbers)
5244(see also  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}). For convenience we use the variables \texttt{s1}, \texttt{s2}, \texttt{s3}, and \texttt{e} for the generators of the algebra, and \texttt{o} for the identity element of the algebra.
5245\begin{Verbatim}[fontsize=\small,frame=single,label=]
5246  gap> A:=FreeAssociativeAlgebraWithOne(Rationals, "s1", "s2", "s3", "e");
5247  <algebra-with-one over Rationals, with 4 generators>
5248  gap> g:=GeneratorsOfAlgebra(A);;
5249  gap> s1:=g[2];;s2:=g[3];;s3:=g[4];;e:=g[5];;o:=g[1];;
5250\end{Verbatim}
5251 It is possible to print symbols like they are printed in the algebra \texttt{A} with the function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}):
5252\begin{Verbatim}[fontsize=\small,frame=single,label=]
5253  gap> GBNP.ConfigPrint(A);
5254\end{Verbatim}
5255 Now the relations are entered:
5256\begin{Verbatim}[fontsize=\small,frame=single,label=]
5257  gap> twosidrels:=[s1^2-o,s2^2-o,s3^2-o,(s1*s2)^3-o,(s2*s3)^3-o,(s1*s3)^2-o,
5258  > 	e^2-e,s1*e-e*s1,s2*e-e*s2,e*s3*e-(e*s3)^2,e*s3*e-(s3*e)^2];
5259  [ (-1)*<identity ...>+(1)*s1^2, (-1)*<identity ...>+(1)*s2^2,
5260    (-1)*<identity ...>+(1)*s3^2, (-1)*<identity ...>+(1)*(s1*s2)^3,
5261    (-1)*<identity ...>+(1)*(s2*s3)^3, (-1)*<identity ...>+(1)*(s1*s3)^2,
5262    (-1)*e+(1)*e^2, (1)*s1*e+(-1)*e*s1, (1)*s2*e+(-1)*e*s2,
5263    (1)*e*s3*e+(-1)*(e*s3)^2, (1)*e*s3*e+(-1)*(s3*e)^2 ]
5264  gap> prefixrels:=[e,s1-o,s2-o,s3*e-s3];
5265  [ (1)*e, (-1)*<identity ...>+(1)*s1, (-1)*<identity ...>+(1)*s2,
5266    (-1)*s3+(1)*s3*e ]
5267\end{Verbatim}
5268 First the relations are converted into NP format (see \ref{NP}) and next the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record.
5269\begin{Verbatim}[fontsize=\small,frame=single,label=]
5270  gap> GBR:=SGrobnerModule(GP2NPList(prefixrels),GP2NPList(twosidrels));;
5271  #I  number of entered polynomials is 11
5272  #I  number of polynomials after reduction is 11
5273  #I  End of phase I
5274  #I  End of phase II
5275  #I  End of phase III
5276  #I  End of phase IV
5277  #I  The computation took 24 msecs.
5278  #I  number of entered polynomials is 42
5279  #I  number of polynomials after reduction is 42
5280  #I  End of phase I
5281  #I  End of phase II
5282  #I  End of phase III
5283  #I  End of phase IV
5284  #I  The computation took 20 msecs.
5285\end{Verbatim}
5286 The record GBR has two members: the two-sided relations \texttt{GBR.ts} and the prefix relations \texttt{GBR.p}. We print these using the function \texttt{PrintNPList} (\ref{PrintNPList}):
5287\begin{Verbatim}[fontsize=\small,frame=single,label=]
5288  gap> PrintNPList(GBR.ts);
5289   s1^2 - 1
5290   s2^2 - 1
5291   s3s1 - s1s3
5292   s3^2 - 1
5293   es1 - s1e
5294   es2 - s2e
5295   e^2 - e
5296   s2s1s2 - s1s2s1
5297   s3s2s3 - s2s3s2
5298   s3s2s1s3 - s2s3s2s1
5299   s3es3e - es3e
5300   es3es3 - es3e
5301   s3es3s2e - es3s2e
5302   s2s3s2es3e - s3s2es3e
5303   s3es3s2s1e - es3s2s1e
5304   es3s2es3s2 - es3s2es3
5305   s2s3s2s1es3e - s3s2s1es3e
5306   s2s3s2es3s2e - s3s2es3s2e
5307   s2es3s2es3e - es3s2es3e
5308   s1s2s1s3s2es3e - s2s1s3s2es3e
5309   s2s3s2s1es3s2e - s3s2s1es3s2e
5310   s2s3s2es3s2s1e - s3s2es3s2s1e
5311   s2es3s2s1es3e - es3s2s1es3e
5312   es3s2s1es3s2s1 - es3s2s1es3s2
5313   s1s2s1s3s2s1es3e - s2s1s3s2s1es3e
5314   s1s2s1s3s2es3s2e - s2s1s3s2es3s2e
5315   s1s2s1es3s2es3e - s2s1es3s2es3e
5316   s2s3s2s1es3s2s1e - s3s2s1es3s2s1e
5317   s2es3s2s1es3s2e - es3s2s1es3s2e
5318   s1s2s1s3s2s1es3s2e - s2s1s3s2s1es3s2e
5319   s1s2s1s3s2es3s2s1e - s2s1s3s2es3s2s1e
5320   s1s2s1es3s2s1es3e - s2s1es3s2s1es3e
5321   s1s3s2s1es3s2es3e - s3s2s1es3s2es3e
5322   s1s2s1s3s2s1es3s2s1e - s2s1s3s2s1es3s2s1e
5323   s1s2s1es3s2s1es3s2e - s2s1es3s2s1es3s2e
5324   s1s3s2s1es3s2s1es3e - s3s2s1es3s2s1es3e
5325   s1es3s2s1es3s2es3e - es3s2s1es3s2es3e
5326   s1s3s2s1es3s2s1es3s2e - s3s2s1es3s2s1es3s2e
5327  gap> PrintNPList(GBR.p);
5328  [ s1 - 1 ]
5329  [ s2 - 1 ]
5330  [ e ]
5331  [ s3e - s3 ]
5332  [ s3s2e - s3s2 ]
5333  [ s3s2s1e - s3s2s1 ]
5334\end{Verbatim}
5335 It is now possible to calculate the standard basis of the quotient module with
5336the function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (here this is 4), the number of
5337generators of the module (here this is 1), and a variable \texttt{maxno} for returning partial bases (0 means full basis).
5338\begin{Verbatim}[fontsize=\small,frame=single,label=]
5339  gap> B:=BaseQM(GBR,4,1,0);;
5340  gap> PrintNPList(B);
5341  [ 1 ]
5342  [ s3 ]
5343  [ s3s2 ]
5344  [ s3s2s1 ]
5345\end{Verbatim}
5346 Next we write down the matrices for the right action of the generators on the
5347module. First by means of the list command \texttt{MatricesQA} (\ref{MatricesQA}), next one by one by means of \texttt{MatrixQA} (\ref{MatrixQA}) within a loop.
5348\begin{Verbatim}[fontsize=\small,frame=single,label=]
5349  gap> MatricesQA(4,B,GBR);
5350  [ [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 0, 1 ], [ 0, 0, 1, 0 ] ],
5351    [ [ 1, 0, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 0, 1 ] ],
5352    [ [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ],
5353    [ [ 0, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ] ]
5354  gap> for i in [1..4] do
5355  >   Display(MatrixQA(i,B,GBR)); Print("\n");
5356  > od;
5357  [ [  1,  0,  0,  0 ],
5358    [  0,  1,  0,  0 ],
5359    [  0,  0,  0,  1 ],
5360    [  0,  0,  1,  0 ] ]
5361
5362  [ [  1,  0,  0,  0 ],
5363    [  0,  0,  1,  0 ],
5364    [  0,  1,  0,  0 ],
5365    [  0,  0,  0,  1 ] ]
5366
5367  [ [  0,  1,  0,  0 ],
5368    [  1,  0,  0,  0 ],
5369    [  0,  0,  1,  0 ],
5370    [  0,  0,  0,  1 ] ]
5371
5372  [ [  0,  0,  0,  0 ],
5373    [  0,  1,  0,  0 ],
5374    [  0,  0,  1,  0 ],
5375    [  0,  0,  0,  1 ] ]
5376
5377\end{Verbatim}
5378 }
5379
5380
5381\section{\textcolor{Chapter }{A module of the Hecke algebra of type A$_3$ over GF(3)}}\label{Example22}
5382\logpage{[ "A", 22, 0 ]}
5383\hyperdef{L}{X801747D17F02450F}{}
5384{
5385 This example is an extension of Example 5 from Linton, \cite{MR94k:20022}. It concerns the Hecke Algebra of type A$_3$. By reducing mod 3 but without evaluating at $q=1$ it is possible to obtain the following representation of the Hecke algebra of
5386type A$_3$ over GF(3): $\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,
5387z*y*z-y*z*y, z*x-x*z\rangle$. It has a natural representation of the same dimension as the Lie algebra of
5388type A$_3$, namely 4. This representation can be obtained with the module relations $\{x+1,y+1\}$.
5389
5390 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 1 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about the info level, see Chapter \ref{Info}).
5391\begin{Verbatim}[fontsize=\small,frame=single,label=]
5392  gap> LoadPackage("GBNP","0",false);;
5393  gap> SetInfoLevel(InfoGBNP,1);
5394  gap> SetInfoLevel(InfoGBNPTime,1);
5395\end{Verbatim}
5396 Now enter the relations as GAP polynomials. The module is one dimensional so
5397it is possible to enter it with and without a module. Both are used in Example \ref{Example18}. Here the relations will be entered without using a module. First a free
5398associative algebra with one is created over the field (GF(3)) (see also  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}). For convenience we use the variables \texttt{a} and \texttt{b} for the generators of the algebra and \texttt{e} for the one of the algebra.
5399\begin{Verbatim}[fontsize=\small,frame=single,label=]
5400  gap> q:=Indeterminate(GF(3),"q");
5401  q
5402  gap> A:=FreeAssociativeAlgebraWithOne(Field(q), "x", "y", "z");;
5403  gap> g:=GeneratorsOfAlgebra(A);;
5404  gap> x:=g[2];;y:=g[3];;z:=g[4];;e:=g[1];;q:=q*e;;
5405\end{Verbatim}
5406 In order to print the variables like they are printed in the algebra \texttt{A} with the function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}):
5407\begin{Verbatim}[fontsize=\small,frame=single,label=]
5408  gap> GBNP.ConfigPrint(A);
5409\end{Verbatim}
5410 Now the relations are entered:
5411\begin{Verbatim}[fontsize=\small,frame=single,label=]
5412  gap> twosidrels:=[x^2+(e-q)*x-q,y^2+(e-q)*y-q,z^2+(e-q)*z-q,
5413  >   y*x*y-x*y*x,z*y*z-y*z*y,z*x-x*z];
5414  [ (-q)*<identity ...>+(-q+Z(3)^0)*x+(Z(3)^0)*x^2,
5415    (-q)*<identity ...>+(-q+Z(3)^0)*y+(Z(3)^0)*y^2,
5416    (-q)*<identity ...>+(-q+Z(3)^0)*z+(Z(3)^0)*z^2,
5417    (-Z(3)^0)*x*y*x+(Z(3)^0)*y*x*y, (-Z(3)^0)*y*z*y+(Z(3)^0)*z*y*z,
5418    (-Z(3)^0)*x*z+(Z(3)^0)*z*x ]
5419  gap> prefixrels:=[x+e,y+e];
5420  [ (Z(3)^0)*<identity ...>+(Z(3)^0)*x, (Z(3)^0)*<identity ...>+(Z(3)^0)*y ]
5421\end{Verbatim}
5422 First the relations are converted into NP format (see \ref{NP}) after which the function \texttt{SGrobnerModule} (\ref{SGrobnerModule}) is called to calculate a Gr{\"o}bner basis record.
5423\begin{Verbatim}[fontsize=\small,frame=single,label=]
5424  gap> GBR:=SGrobnerModule(GP2NPList(prefixrels),GP2NPList(twosidrels));;
5425  #I  number of entered polynomials is 6
5426  #I  number of polynomials after reduction is 6
5427  #I  End of phase I
5428  #I  End of phase II
5429  #I  End of phase III
5430  #I  End of phase IV
5431  #I  The computation took 4 msecs.
5432  #I  number of entered polynomials is 9
5433  #I  number of polynomials after reduction is 9
5434  #I  End of phase I
5435  #I  End of phase II
5436  #I  End of phase III
5437  #I  End of phase IV
5438  #I  The computation took 8 msecs.
5439\end{Verbatim}
5440 The record GBR has three members: the two-sided relations \texttt{GBR.ts}, the prefix relations \texttt{GBR.p}, and the number \texttt{GBR.pg} of generators of the free module. It is possible to print the first two using
5441the function \texttt{PrintNPList} (\ref{PrintNPList}):
5442\begin{Verbatim}[fontsize=\small,frame=single,label=]
5443  gap> PrintNPList(GBR.ts);
5444   x^2 + -q+Z(3)^0x + -q
5445   y^2 + -q+Z(3)^0y + -q
5446   zx + -Z(3)^0xz
5447   z^2 + -q+Z(3)^0z + -q
5448   yxy + -Z(3)^0xyx
5449   zyz + -Z(3)^0yzy
5450   zyxz + -Z(3)^0yzyx
5451  gap> PrintNPList(GBR.p);
5452  [ x + Z(3)^0 ]
5453  [ y + Z(3)^0 ]
5454\end{Verbatim}
5455 It is now possible to calculate the standard basis of the quotient module with
5456the function \texttt{BaseQM} (\ref{BaseQM}). This function has as arguments the Gr{\"o}bner basis record \texttt{GBR}, the number of generators of the algebra (here this is 3), the number of
5457generators of the module (here this is 1), and a variable \texttt{maxno} for returning partial bases (0 means full basis).
5458\begin{Verbatim}[fontsize=\small,frame=single,label=]
5459  gap> B:=BaseQM(GBR,3,1,0);;
5460  gap> PrintNPList(B);
5461  [ Z(3)^0 ]
5462  [ z ]
5463  [ zy ]
5464  [ zyx ]
5465\end{Verbatim}
5466 Next we write down the matrices for the right action of the generators on the
5467module, by means of the command \texttt{MatricesQA} (\ref{MatricesQA}).
5468\begin{Verbatim}[fontsize=\small,frame=single,label=]
5469  gap> MM := MatricesQA(3,B,GBR);;
5470  gap> for i in [1..Length(MM)] do
5471  > Display(MM[i]); Print("\n");
5472  > od;
5473  [ [   -Z(3)^0,    0*Z(3),    0*Z(3),    0*Z(3) ],
5474    [    0*Z(3),   -Z(3)^0,    0*Z(3),    0*Z(3) ],
5475    [    0*Z(3),    0*Z(3),    0*Z(3),    Z(3)^0 ],
5476    [    0*Z(3),    0*Z(3),         q,  q-Z(3)^0 ] ]
5477
5478  [ [   -Z(3)^0,    0*Z(3),    0*Z(3),    0*Z(3) ],
5479    [    0*Z(3),    0*Z(3),    Z(3)^0,    0*Z(3) ],
5480    [    0*Z(3),         q,  q-Z(3)^0,    0*Z(3) ],
5481    [    0*Z(3),    0*Z(3),    0*Z(3),   -Z(3)^0 ] ]
5482
5483  [ [    0*Z(3),    Z(3)^0,    0*Z(3),    0*Z(3) ],
5484    [         q,  q-Z(3)^0,    0*Z(3),    0*Z(3) ],
5485    [    0*Z(3),    0*Z(3),   -Z(3)^0,    0*Z(3) ],
5486    [    0*Z(3),    0*Z(3),    0*Z(3),   -Z(3)^0 ] ]
5487
5488\end{Verbatim}
5489 }
5490
5491
5492\section{\textcolor{Chapter }{Generalized Temperley-Lieb algebras}}\label{Example23}
5493\logpage{[ "A", 23, 0 ]}
5494\hyperdef{L}{X78C01D1987FEF3FE}{}
5495{
5496 This example shows how the dimension of a Generalized Temperley-Lieb Algebra
5497of type A, D, or E can be calculated. For $\textrm{A}_{n-1}$ this is the usual Temperley-Lieb Algebra on $n$ strands with dimension $\textrm{dim TL}(A_{n-1})={{2n \choose n}}/{(n+1)}$. For more information see \cite{Graham1995}.
5498
5499 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 0 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 1 (for more information about timing; see Chapter \ref{Info}).
5500\begin{Verbatim}[fontsize=\small,frame=single,label=]
5501  gap> LoadPackage("GBNP","0",false);;
5502  gap> SetInfoLevel(InfoGBNP,0);
5503  gap> SetInfoLevel(InfoGBNPTime,1);
5504\end{Verbatim}
5505 The relations are generated automatically from the Coxeter diagram. This
5506example can be easily adapted by specifying the number of points and the set
5507of edges describing another Coxeter diagram. First enter the number of points, \texttt{numpoints}.
5508\begin{Verbatim}[fontsize=\small,frame=single,label=]
5509  gap> numpoints:=8;
5510  8
5511\end{Verbatim}
5512 Now define some edges describing the diagrams of $\textrm{E}_n$, (these can be easily extended). In this example the dimension of the
5513Generalized Temperley-Lieb algebra of type $\textrm{E}_8$ will be calculated. For $\textrm{A}_{1\ldots 10}$ the command
5514
5515 \texttt{edges:=[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10]];}
5516
5517 can be used. For $\textrm{D}_{1\ldots 10}$ the command
5518
5519 \texttt{edges:=[[1,3],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10]];} can
5520
5521 be used.
5522\begin{Verbatim}[fontsize=\small,frame=single,label=]
5523  gap> edges:=[[1,3],[2,4],[3,4],[4,5],[5,6],[6,7],[7,8]]; # for E6..8
5524  [ [ 1, 3 ], [ 2, 4 ], [ 3, 4 ], [ 4, 5 ], [ 5, 6 ], [ 6, 7 ], [ 7, 8 ] ]
5525\end{Verbatim}
5526 Now enter the relations as GAP polynomials. First a free associative algebra
5527with identity element is created over the Rationals (see also  \textbf{Reference: FreeAssociativeAlgebraWithOne (for ring, rank (and name))}). For convenience the generators are stored in \texttt{gens}.
5528\begin{Verbatim}[fontsize=\small,frame=single,label=]
5529  gap> A:=FreeAssociativeAlgebraWithOne(Rationals,numpoints,"e");;
5530  gap> e := GeneratorsOfAlgebraWithOne(A);
5531  [ (1)*e.1, (1)*e.2, (1)*e.3, (1)*e.4, (1)*e.5, (1)*e.6, (1)*e.7, (1)*e.8 ]
5532\end{Verbatim}
5533 It is possible to print symbols like they are printed in the algebra \texttt{A} with the function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}):
5534\begin{Verbatim}[fontsize=\small,frame=single,label=]
5535  gap> GBNP.ConfigPrint(A);
5536\end{Verbatim}
5537 Now the relations are generated automatically. For this we need to make sure
5538the edges are sorted and converted to a set.
5539\begin{Verbatim}[fontsize=\small,frame=single,label=]
5540  gap> edges:=Set(edges, x->SortedList(x));
5541  [ [ 1, 3 ], [ 2, 4 ], [ 3, 4 ], [ 4, 5 ], [ 5, 6 ], [ 6, 7 ], [ 7, 8 ] ]
5542\end{Verbatim}
5543 Now the relations can be generated. The relations are $e_i*e_i=e_i$, for all $i$ and $e_i*e_j*e_i=e_i$ for all $i$,$j$ that are connected in the Coxeter diagram and $e_i*e_j=e_j*e_i$ for all $i$, $j$ that are not connected in the Coxeter diagram.
5544\begin{Verbatim}[fontsize=\small,frame=single,label=]
5545  gap> rels:=[];;
5546  gap> for i in [1..numpoints] do
5547  >   for j in [1..numpoints] do
5548  >     if (i=j) then
5549  >       # if i=j then add e.i*e.i=e.i
5550  >       Add(rels, e[i]*e[i]-e[i]);
5551  >     elif ([i,j] in edges) or ([j,i] in edges) then
5552  >       # if {i,j} is an edge then add e.i*e.j*e.i=e.i
5553  >       Add(rels, e[i]*e[j]*e[i]- e[i]);
5554  >     else
5555  >       # if {i,j} is not an edge then add e.i*e.j=e.j*e.i
5556  >       # (note: this causes double rules, but that's ok)
5557  >       Add(rels, e[i]*e[j]- e[j]*e[i]);
5558  >     fi;
5559  >   od;
5560  > od;
5561\end{Verbatim}
5562 Then the relations are converted into NP format (see \ref{NP}) after which the function \texttt{SGrobner} (\ref{SGrobner}) is called to calculate a Gr{\"o}bner basis.
5563\begin{Verbatim}[fontsize=\small,frame=single,label=]
5564  gap> relsNP:=GP2NPList(rels);;
5565  gap> GB:=SGrobner(relsNP);;
5566  #I  The computation took 184 msecs.
5567\end{Verbatim}
5568 It is now possible to calculate the dimension of the quotient algebra with the
5569function \texttt{DimQA} (\ref{DimQA}). This function has as arguments the Gr{\"o}bner basis \texttt{GB} and the number of generators of the algebra (here this is \texttt{numpoints}). To get the full basis the function \texttt{BaseQA} (\ref{BaseQA}) can be used.
5570\begin{Verbatim}[fontsize=\small,frame=single,label=]
5571  gap> DimQA(GB,numpoints);
5572  10846
5573\end{Verbatim}
5574 }
5575
5576
5577\section{\textcolor{Chapter }{The universal enveloping algebra of a Lie algebra}}\label{Example12}
5578\logpage{[ "A", 24, 0 ]}
5579\hyperdef{L}{X85A9CEF087F3936B}{}
5580{
5581 Consider the Lie algebra with generators $e$, $f$ and $h$, and relations $[e,f]=h$, $[e,h]=-2e$, $[f,h]=2f$. This is the well-known Lie algebra of type A$_1$. We construct the corresponding universal enveloping algebra of this Lie
5582algebra and show how one can prove that $f^2$ belongs to the ideal generated by $e^2$ in that associative algebra. The example is from Knopper's report \cite{Knopper2004}.
5583
5584 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 0 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 0 (for more information about the info level, see Chapter \ref{Info}).
5585\begin{Verbatim}[fontsize=\small,frame=single,label=]
5586  gap> LoadPackage("GBNP");
5587  -----------------------------------------------------------------------------
5588  Loading  GBNP 1.0.3 (Non-commutative Gr�bner bases)
5589  by A.M. Cohen (http://www.win.tue.nl/~amc) and
5590     J.W. Knopper (J.W.Knopper@tue.nl).
5591  Homepage: http://mathdox.org/products/gbnp/
5592  -----------------------------------------------------------------------------
5593  true
5594
5595  gap> SetInfoLevel(InfoGBNP,0);
5596  gap> SetInfoLevel(InfoGBNPTime,0);
5597\end{Verbatim}
5598 Then define the algebra and enter the relations as polynomials in GAP.
5599\begin{Verbatim}[fontsize=\small,frame=single,label=]
5600  gap> A:=FreeAssociativeAlgebraWithOne(Rationals, "e", "f", "h");
5601  <algebra-with-one over Rationals, with 3 generators>
5602  gap> e:=A.e;; f:=A.f;; h:=A.h;; o:=One(A);;
5603  gap> uerels:=[f*e-e*f+h,h*e-e*h-2*e,h*f-f*h+2*f];
5604  [ (1)*h+(-1)*e*f+(1)*f*e, (-2)*e+(-1)*e*h+(1)*h*e, (2)*f+(-1)*f*h+(1)*h*f ]
5605\end{Verbatim}
5606 The relations can be converted to NP format (see \ref{NP}) with the function \texttt{GP2NPList} (\ref{GP2NPList}) and can be subsequently displayed with \texttt{PrintNPList} (\ref{PrintNPList}).
5607\begin{Verbatim}[fontsize=\small,frame=single,label=]
5608  gap> uerelsNP:=GP2NPList(uerels);;
5609  gap> PrintNPList(uerelsNP);
5610   ba - ab + c
5611   ca - ac - 2a
5612   cb - bc + 2b
5613\end{Verbatim}
5614 Now configure printing in such a way that this algebra is used with the
5615function \texttt{GBNP.ConfigPrint} (\ref{GBNP.ConfigPrint}).
5616\begin{Verbatim}[fontsize=\small,frame=single,label=]
5617  gap> GBNP.ConfigPrint(A);
5618\end{Verbatim}
5619 The set is actually a Gr{\"o}bner basis, as can be verified by calculating the
5620Gr{\"o}bner basis with \texttt{SGrobner} (\ref{SGrobner}).
5621\begin{Verbatim}[fontsize=\small,frame=single,label=]
5622  gap> GB:=SGrobner(uerelsNP);;
5623  gap> PrintNPList(GB);
5624   fe - ef + h
5625   he - eh - 2e
5626   hf - fh + 2f
5627\end{Verbatim}
5628 Determine whether the quotient algebra is finite dimensional by means of \texttt{FinCheckQA} (\ref{FinCheckQA}), with arguments the leading monomials of \texttt{GB} and 3, the number of variables involved. The leading monomials of \texttt{GB} are found by invoking \texttt{LMonsNP} (\ref{LMonsNP}).
5629\begin{Verbatim}[fontsize=\small,frame=single,label=]
5630  gap> F:=LMonsNP(GB);
5631  [ [ 2, 1 ], [ 3, 1 ], [ 3, 2 ] ]
5632  gap> FinCheckQA(F,3);
5633  false
5634\end{Verbatim}
5635 Adding the relation $e^2=0$ results in a finite quotient algebra.
5636\begin{Verbatim}[fontsize=\small,frame=single,label=]
5637  gap> extendedrels:=[f*e-e*f+h,h*e-e*h-2*e,h*f-f*h+2*f,e^2];
5638  [ (1)*h+(-1)*e*f+(1)*f*e, (-2)*e+(-1)*e*h+(1)*h*e, (2)*f+(-1)*f*h+(1)*h*f,
5639    (1)*e^2 ]
5640  gap> extendedrelsNP:=GP2NPList(extendedrels);;
5641\end{Verbatim}
5642 With the function \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}) it is possible to calculate a Gr{\"o}bner basis with trace information.
5643\begin{Verbatim}[fontsize=\small,frame=single,label=]
5644  gap> GB:=SGrobnerTrace(extendedrelsNP);;
5645\end{Verbatim}
5646 The Gr{\"o}bner basis can now be displayed with \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}).
5647\begin{Verbatim}[fontsize=\small,frame=single,label=]
5648  gap> PrintNPListTrace(GB);
5649   e^2
5650   eh + e
5651   fe - ef + h
5652   f^2
5653   fh - f
5654   he - e
5655   hf + f
5656   h^2 - 2ef + h
5657\end{Verbatim}
5658 Note the fourth relation: $f^2=0$. To view a trace one can use the function \texttt{PrintTracePol} (\ref{PrintTracePol}).
5659\begin{Verbatim}[fontsize=\small,frame=single,label=]
5660  gap> PrintTracePol(GB[4]);
5661  - 1/12G(1)f^2 + 1/12f^2G(1) + 1/12f^2G(1)h - 1/6fG(1)hf + 1/12G(1)hf^2 + 1/
5662  24G(1)ef^3 + 1/24eG(1)f^3 - 1/8fG(1)ef^2 - 1/8feG(1)f^2 + 1/8f^2G(1)ef + 1/
5663  8f^2eG(1)f - 1/24f^3G(1)e - 1/24f^3eG(1) - 1/24G(2)f^3 + 1/8fG(2)f^2 - 1/
5664  8f^2G(2)f + 1/24f^3G(2) + 1/4G(3)f + 1/4fG(3) + 1/12fG(3)h + 1/12fhG(3) - 1/
5665  12G(3)hf - 1/12hG(3)f - 1/12eG(3)f^2 + 1/6feG(3)f - 1/12f^2eG(3) + 1/24G(
5666  4)f^4 - 1/6fG(4)f^3 + 1/4f^2G(4)f^2 - 1/6f^3G(4)f + 1/24f^4G(4)
5667\end{Verbatim}
5668 This proves that $f^2=0$ is a consequence of $e^2=0$ in the universal enveloping algebra of the simple Lie algebra of type A$_1$.
5669
5670 The function \texttt{StrongNormalFormTraceDiff} (\ref{StrongNormalFormTraceDiff}) can be used to trace the difference between an element and its strong normal
5671form in the terms of \texttt{extendedrels}. Apparently, in the first example the strong normal form of \texttt{r} is \texttt{r - s.pol=0}.
5672\begin{Verbatim}[fontsize=\small,frame=single,label=]
5673  gap> r := [[[2,2,2,2,1,1,1,1]],[1]];;
5674  gap> s := StrongNormalFormTraceDiff(r, GB);;
5675
5676  gap> PrintNP(s.pol);
5677   f^4e^4
5678  gap> PrintTracePol(s);
5679   f^4G(4)e^2
5680  gap> PrintNP(AddNP(r,s.pol,1,-1));
5681   0
5682\end{Verbatim}
5683 One more example where the strong normal form is not zero.
5684\begin{Verbatim}[fontsize=\small,frame=single,label=]
5685  gap> r := [[[3,3,3]],[1]];;
5686  gap> s := StrongNormalFormTraceDiff(r, GB);;
5687
5688  gap> PrintNP(s.pol);
5689   h^3 - h
5690  gap> PrintTracePol(s);
5691  - G(1) - 1/2G(1)ef - 1/6eG(1)f + 1/3efG(1) + 1/2fG(1)e + 1/2feG(1) + G(
5692  1)h^2 + 1/2G(1)efh + 1/2eG(1)fh + 1/3efG(1)h - 1/3eG(1)hf - 1/2fG(1)eh - 1/
5693  2feG(1)h - 1/6eG(1)ef^2 - 1/6e^2G(1)f^2 + 1/3efG(1)ef + 1/3efeG(1)f - 1/
5694  6ef^2G(1)e - 1/6ef^2eG(1) + 1/2G(2)f - 1/2fG(2) - 1/2G(2)fh + 1/2fG(2)h + 1/
5695  6eG(2)f^2 - 1/3efG(2)f + 1/6ef^2G(2) - 2/3eG(3)h + 1/3ehG(3) + 1/3e^2G(3)f -
5696  1/3efeG(3) - 1/2G(4)f^2 + fG(4)f - 1/2f^2G(4) + 1/2G(4)f^2h - fG(4)fh + 1/
5697  2f^2G(4)h - 1/6eG(4)f^3 + 1/2efG(4)f^2 - 1/2ef^2G(4)f + 1/6ef^3G(4)
5698  gap> PrintNP(AddNP(r,s.pol,1,-1));
5699   h
5700\end{Verbatim}
5701 }
5702
5703
5704\section{\textcolor{Chapter }{Serre's exercise}}\label{Example24}
5705\logpage{[ "A", 25, 0 ]}
5706\hyperdef{L}{X8498D69D8160E5FF}{}
5707{
5708
5709\begin{Verbatim}[fontsize=\small,frame=single,label=]
5710  gap> LoadPackage("GBNP","0",false);;
5711  gap> SetInfoLevel(InfoGBNP,1);
5712  gap> SetInfoLevel(InfoGBNPTime,1);
5713\end{Verbatim}
5714 In Serre's book \cite{MR1954121} the following exercise can be found: Prove that the group $ \langle \{a,b,c\}\mid \{ bab^{-1}a^{-2}, cbc^{-1}b^{-2},
5715aca^{-1}c^{-2}\}\right\rangle$ is the trivial group. Here we solve the exercise by running the trace variant
5716of the Gr{\"o}bner basis function with input the set of equations $ba - a^2 b, cb - b^2c, ac - c^2a$ together with relations forcing that $a,b,c$ are invertible with inverse $A,B,C$.
5717\begin{Verbatim}[fontsize=\small,frame=single,label=]
5718  gap> KI := [ [[[2,1],[1,1,2]],[1,-1]],
5719  >         [[[3,2],[2,2,3]],[1,-1]],
5720  >         [[[1,3],[3,3,1]],[1,-1]],
5721  >         [[[1,4], []],[1,-1]],
5722  >         [[[4,1], []],[1,-1]],
5723  >         [[[2,5], []],[1,-1]],
5724  >         [[[5,2], []],[1,-1]],
5725  >         [[[3,6], []],[1,-1]],
5726  >         [[[6,3], []],[1,-1]],
5727  >       ];;
5728  gap> PrintNPList(KI);
5729   ba - a^2b
5730   cb - b^2c
5731   ac - c^2a
5732   ad - 1
5733   da - 1
5734   be - 1
5735   eb - 1
5736   cf - 1
5737   fc - 1
5738\end{Verbatim}
5739 We use \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}), the trace variant of the Gr{\"o}bner basis computation,
5740\begin{Verbatim}[fontsize=\small,frame=single,label=]
5741  gap> GB := SGrobnerTrace(KI);;
5742  #I  number of entered polynomials is 9
5743  #I  number of polynomials after reduction is 9
5744  #I  End of phase I
5745  #I  End of phase II
5746  #I  List of todo lengths is [ 9, 10, 11, 12, 14, 16, 18, 20, 21, 22, 24, 26, 28, 31, 34, 33, 35, 37, 40,
5747    43, 46, 49, 52, 56, 59, 62, 61, 60, 64, 64, 65, 65, 68, 71, 76, 76, 80, 88,
5748    93, 94, 99, 110, 115, 117, 131, 139, 146, 150, 158, 171, 186, 198, 206,
5749    220, 229, 246, 260, 263, 102, 40, 19, 9, 3, 0 ]
5750  #I  End of phase III
5751  #I  End of phase IV
5752  #I  The computation took 19308 msecs.
5753\end{Verbatim}
5754 The dimension of the quotient algebra is 1, showing that the group algebra is
57551-dimensional. This implies that the group with the above presentation is
5756trivial.
5757\begin{Verbatim}[fontsize=\small,frame=single,label=]
5758  gap> GBpols := List([1..Length(GB)], x -> GB[x].pol);;
5759  gap> PrintNPList(GBpols);
5760   a - 1
5761   b - 1
5762   c - 1
5763   d - 1
5764   e - 1
5765   f - 1
5766  gap> DimQA(GBpols,6);
5767  1
5768\end{Verbatim}
5769 Since the output is large and might spoil the exercise, we confine ourselves
5770to the printing first polynomial \texttt{GB[1]} and the length of its trace. As the trace polynomial expresses \texttt{GB[1]}, which is equal to $a-1$, as a combination of the binomials in \texttt{KI}, it gives a proof that $a$ can be rewritten within the group to the trivial element. It is easy to derive
5771from this that $b$ and $c$ are also trivial in the group. This justifies the restriction to \texttt{GB[1]}.
5772\begin{Verbatim}[fontsize=\small,frame=single,label=]
5773  gap> PrintNP(GB[1].pol);
5774   a - 1
5775  gap> Length(GB[1].trace);
5776  1119
5777\end{Verbatim}
5778 }
5779
5780
5781\section{\textcolor{Chapter }{Baur and Draisma's transformations}}\label{Example25}
5782\logpage{[ "A", 26, 0 ]}
5783\hyperdef{L}{X8116448A84D69022}{}
5784{
5785
5786\begin{Verbatim}[fontsize=\small,frame=single,label=]
5787  gap> LoadPackage("GBNP","0",false);;
5788  gap> SetInfoLevel(InfoGBNP,0);
5789  gap> SetInfoLevel(InfoGBNPTime,0);
5790\end{Verbatim}
5791 The paper \cite{MR2090062} by Baur and Draisma uses the computation of a quotient algebra of dimension
579237, which we repeat here. The set of equations, after specialisation of the
5793scalars to 1, is as follows.
5794\begin{Verbatim}[fontsize=\small,frame=single,label=]
5795  gap> KI := [ [[[2,2]],[1]],
5796  >         [[[1,1]],[1]],
5797  >         [[[3,3]],[1]],
5798  >         [[[1,2,1],[1]],[1,-1]],
5799  >         [[[2,1,2],[2]],[1,-1]],
5800  >         [[[3,2,3],[3]],[1,-1]],
5801  >         [[[2,3,2],[2]],[1,-1]],
5802  >         [[[1,3,1],[1]],[1,-1]],
5803  >         [[[3,1,3],[3]],[1,-1]],
5804  >         [[[1,2,3,1,2,3,1],[1,3,2,1,3,2,1],[1]],[1,1,-1]],
5805  >         [[[3,1,2,3,1,2,3],[3,2,1,3,2,1,3],[3]],[1,1,-1]],
5806  >         [[[2,3,1,2,3,1,2],[2,1,3,2,1,3,2],[2]],[1,1,-1]],
5807  >       ];;
5808  gap> PrintNPList(KI);
5809   b^2
5810   a^2
5811   c^2
5812   aba - a
5813   bab - b
5814   cbc - c
5815   bcb - b
5816   aca - a
5817   cac - c
5818   abcabca + acbacba - a
5819   cabcabc + cbacbac - c
5820   bcabcab + bacbacb - b
5821\end{Verbatim}
5822 We carry out a traced Gr{\"o}bner basis computation by use of \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}), and form the usual Gr{\"o}bner basis by extracting the polynomials from the
5823traced polynomials using the field indicator \texttt{.pol}.
5824\begin{Verbatim}[fontsize=\small,frame=single,label=]
5825  gap> GBT := SGrobnerTrace(KI);;
5826  gap> GB := List([1..Length(GBT)], i -> GBT[i].pol);;
5827\end{Verbatim}
5828 The dimension of the quotient algebra is computable with \texttt{DimQA} (\ref{DimQA}).
5829\begin{Verbatim}[fontsize=\small,frame=single,label=]
5830  gap> DimQA(GB,3);
5831  37
5832\end{Verbatim}
5833 In order to express the last GB element, viz.
5834\begin{Verbatim}[fontsize=\small,frame=single,label=]
5835  gap> PrintNP(GB[Length(GB)]);
5836   cabcabca + cbacba - ca
5837\end{Verbatim}
5838 as a combination of elements of \texttt{KI}, we use \texttt{PrintTracePol} (\ref{PrintTracePol}):
5839\begin{Verbatim}[fontsize=\small,frame=single,label=]
5840  gap> PrintTracePol(GBT[Length(GBT)]);
5841  - G(9)bacba + cG(10)
5842\end{Verbatim}
5843 We compute matrices for left multiplication by generators using \texttt{MatricesQA} (\ref{MatricesQA}) and determine the minimal polynomial of the sum of the three matrices.
5844\begin{Verbatim}[fontsize=\small,frame=single,label=]
5845  gap> B := BaseQA(GB,3,0);;
5846  gap> M := MatricesQA(3,B,GB);;
5847  gap> f := MinimalPolynomial(Rationals,M[1]+M[2]+M[3]);
5848  x_1^7-6*x_1^5+9*x_1^3-3*x_1
5849  gap> Factors(f);
5850  [ x_1, x_1^6-6*x_1^4+9*x_1^2-3 ]
5851\end{Verbatim}
5852 It turns out that there are three non-zero numbers $u,v,w$ such that the eigenvalues of the sum are $0,u,v,w,-u,-v,-w$. This is the information used in \cite{MR2090062}. }
5853
5854
5855\section{\textcolor{Chapter }{The cola gene puzzle}}\label{ExampleColagen}
5856\logpage{[ "A", 27, 0 ]}
5857\hyperdef{L}{X7912E411867E5F8B}{}
5858{
5859
5860
5861 A prize question appearing in the January 2005 issue of the Dutch journal
5862"Natuur en Techniek" asked for a DNA change of cows so that they could produce
5863Cola instead of milk. A team of genetic manipulators has tools to perform the
5864following five DNA string operations. (Here the strings before and after the
5865equality sign can be interchanged at will.)
5866
5867 operation 1: TCAT = T;
5868
5869 operation 2: GAG = AG;
5870
5871 operation 3: CTC = TC;
5872
5873 operation 4: AGTA = A;
5874
5875 operation 5: TAT = CT.
5876
5877 The first question is to show how they can transform the milk gene
5878TAGCTAGCTAGCT to the cola gene CTGACTGACT.
5879
5880 A second question is to show that mad cow disease related retro virus
5881CTGCTACTGACT can be avoided at all times. Can this be guaranteed?
5882
5883 We answer these questions using the trace functions of the Gr{\"o}bner basis
5884package GBNP in Section \ref{tracefun}.
5885
5886 First load the package and set the standard infolevel \texttt{InfoGBNP} (\ref{InfoGBNP}) to 0 and the time infolevel \texttt{InfoGBNPTime} (\ref{InfoGBNPTime}) to 0 to minimize the printing of data regarding the computation (for more
5887information about the info level, see Chapter \ref{Info}).
5888\begin{Verbatim}[fontsize=\small,frame=single,label=]
5889  gap> LoadPackage("GBNP","0",false);;
5890  gap> SetInfoLevel(InfoGBNP,0);
5891  gap> SetInfoLevel(InfoGBNPTime,0);
5892\end{Verbatim}
5893 We introduce the free algebra \texttt{ALG} on the generators corresponding to the four letters in the DNA code and
5894express the milk gene and cola gene as monomials in this algebra.
5895\begin{Verbatim}[fontsize=\small,frame=single,label=]
5896  gap> ALG:=FreeAssociativeAlgebraWithOne(Rationals, "A", "C", "G", "T");;
5897  gap> g:=GeneratorsOfAlgebra(ALG);;
5898  gap> A:=g[2];;
5899  gap> C:=g[3];;
5900  gap> G:=g[4];;
5901  gap> T:=g[5];;
5902
5903  gap> milk := T*A*G*C*T*A*G*C*T*A*G*C*T;;
5904  gap> cola := C*T*G*A*C*T*G*A*C*T;;
5905\end{Verbatim}
5906 We next enter the set $K$ of binomials $x-y$ corresponding to the five operations $x = y$ listed above. We enter the binomials as members of \texttt{ALG} and let \texttt{KNP} be the corresponding set of NP polynomials.
5907\begin{Verbatim}[fontsize=\small,frame=single,label=]
5908  gap> rule1 := T*C*A*T - T;;
5909  gap> rule2 :=  G*A*G -  A*G;;
5910  gap> rule3 :=  C*T*C - T*C;;
5911  gap> rule4 := A*G*T*A - A;;
5912  gap> rule5 := T*A*T -  C*T;;
5913  gap> K := [rule1,rule2,rule3,rule4,rule5];;
5914  gap> KNP := List(K,x-> GP2NP(x));;
5915\end{Verbatim}
5916 We stipulate how the variables will be printed and print \texttt{KNP}. See \texttt{PrintNPList} (\ref{PrintNPList}).
5917\begin{Verbatim}[fontsize=\small,frame=single,label=]
5918  gap> GBNP.ConfigPrint("A","C","G","T");
5919  gap> PrintNPList(KNP);
5920   TCAT - T
5921   GAG - AG
5922   CTC - TC
5923   AGTA - A
5924   TAT - CT
5925\end{Verbatim}
5926 Now calculate the usual Gr{\"o}bner basis with \texttt{SGrobner} (\ref{SGrobner}).
5927\begin{Verbatim}[fontsize=\small,frame=single,label=]
5928  gap> GB := SGrobner(KNP);;
5929\end{Verbatim}
5930 Compare milk and cola after taking their strong normal forms with respect to \texttt{GB} using \texttt{StrongNormalFormNP} (\ref{StrongNormalFormNP}). We oberve that they have the same normal form and so there is a way to
5931transform the milk gene into the cola gene.
5932\begin{Verbatim}[fontsize=\small,frame=single,label=]
5933  gap> milkNP := GP2NP(milk);;
5934  gap> colaNP := GP2NP(cola);;
5935  gap> milkRed := NP2GP(StrongNormalFormNP(milkNP,GB),ALG);
5936  (1)*T
5937  gap> colaRed := NP2GP(StrongNormalFormNP(colaNP,GB),ALG);
5938  (1)*T
5939\end{Verbatim}
5940 But this information does not yet show us how to perform the transformation.
5941To this end we calculate the Gr{\"o}bner basis with trace information, using
5942the function \texttt{SGrobnerTrace} (\ref{SGrobnerTrace}).
5943\begin{Verbatim}[fontsize=\small,frame=single,label=]
5944  gap> GTrace := SGrobnerTrace(KNP);;
5945\end{Verbatim}
5946 The full trace can be printed with \texttt{PrintTraceList} (\ref{PrintTraceList}), but we only print the relations (and no trace) by invoking \texttt{PrintNPListTrace} (\ref{PrintNPListTrace}).
5947\begin{Verbatim}[fontsize=\small,frame=single,label=]
5948  gap> PrintNPListTrace(GTrace);
5949   CT - T
5950   GA - A
5951   AGT - AT
5952   ATA - A
5953   TAT - T
5954   TCA - TA
5955\end{Verbatim}
5956 In order to display a proof that $milk-cola$ belongs to the ideal we use \texttt{StrongNormalFormTraceDiff} (\ref{StrongNormalFormTraceDiff}), The result is a record, \texttt{p} say, containing \texttt{milk-cola} in the field \texttt{p.pol} (the normal form will be subtracted from the argument \texttt{milk-cola} to obtain \texttt{p.pol}, but the normal form is zero because the argument belongs to the ideal
5957generated by \texttt{K}). The other field of the record \texttt{p} is \texttt{p.trace}, the traced polynomial, which is best displayed by use of \texttt{PrintTracePol} (\ref{PrintTracePol}).
5958\begin{Verbatim}[fontsize=\small,frame=single,label=]
5959  gap> p := StrongNormalFormTraceDiff(CleanNP(GP2NP(milk-cola)),GTrace);;
5960  gap> NP2GP(p.pol,ALG);
5961  (1)*(T*A*G*C)^3*T+(-1)*(C*T*G*A)^2*C*T
5962  gap> PrintTracePol(p);
5963  - TGATGAG(1) + TAGG(1)ATAT - TATATAGG(1) - TGAG(1)GACT + TGATGACG(1) - G(
5964  1)GACTGACT - TAGCG(1)ATAT - TATAGG(1)AGT + TATATAGCG(1) + TGACG(1)GACT + CG(
5965  1)GACTGACT - TAGG(1)AGTAGT + TAGTAGTAGG(1) + TATAGCG(1)AGT + TAGCG(
5966  1)AGTAGT + TAGTAGG(1)AGCT - TAGTAGTAGCG(1) + TAGG(1)AGCTAGCT - TAGTAGCG(
5967  1)AGCT - TAGCG(1)AGCTAGCT - TATG(2)TAT - TG(2)TATGAT - TGATGAG(3)AT + TAGG(
5968  3)ATATAT - TATATAGG(3)AT - TGAG(3)ATGACT - G(3)ATGACTGACT - TATAGG(
5969  3)ATAGT - TAGG(3)ATAGTAGT + TAGTAGTAGG(3)AT + TAGTAGG(3)ATAGCT + TAGG(
5970  3)ATAGCTAGCT - TATG(4)T + TG(4)TAT + TATGG(4)T - TG(4)TGAT + TATATG(4)T + TGG(
5971  4)TGAT - TG(4)TATAT + TATG(4)TAGT + TG(4)TAGTAGT + TAGG(5)ATAT - TATATAGG(
5972  5) - TATAGG(5)AGT - TAGG(5)AGTAGT
5973\end{Verbatim}
5974 In order to give a precise answer to the first question we need to work a
5975little on \texttt{p.trace}. To do so, we introduce the following function, which creates the NP
5976polynomial corresponding to the \texttt{i}-th term in the expression \texttt{p.trace} of \texttt{p.pol} as a linear combination of members of \texttt{KNP}. It is used to obtain the list \texttt{EvalList} of polynomials for all \texttt{i}.
5977\begin{Verbatim}[fontsize=\small,frame=single,label=]
5978  gap> EvalTracePol := function(i,p,KNP)
5979  >   local x,pi;
5980  >   pi := p.trace[i];
5981  >   x := BimulNP(pi[1],KNP[pi[2]],pi[3]);
5982  >   return  [x[1],pi[4]*x[2]];
5983  > end;;
5984
5985  gap> lev :=  Length(p.trace);;
5986  gap> EvalList := List([1..lev], y -> CleanNP(EvalTracePol(y,p,KNP)));;
5987\end{Verbatim}
5988 In order to find the rewrite from the milk gene to the cola gene as required
5989for an answer to the first question, we match leading terms recursively.
5990\begin{Verbatim}[fontsize=\small,frame=single,label=]
5991  gap> UnusedIndices := Set([1..lev]);;
5992  gap> RunningTerm :=  milkNP[1][1];;
5993  gap> stepno := 0;;
5994  gap> NP2GP(milkNP,ALG);
5995  (1)*(T*A*G*C)^3*T
5996  gap> while Length(UnusedIndices) > 0 do
5997  >   i := 0;
5998  >   notfnd := true;
5999  >   while i < lev and notfnd do
6000  >     i := i+1;
6001  >     if EvalList[i][1][1] = RunningTerm and i in UnusedIndices then
6002  >        notfnd := false;
6003  >        RemoveSet(UnusedIndices, i);
6004  >        RunningTerm :=  EvalList[i][1][2];
6005  >        stepno := stepno+1;
6006  >     elif EvalList[i][1][2] = RunningTerm and i in UnusedIndices then
6007  >        notfnd := false;
6008  >        RemoveSet(UnusedIndices, i);
6009  >        RunningTerm :=  EvalList[i][1][1];
6010  >        stepno := stepno+1;
6011  >     fi;
6012  >   od;
6013  >   if i = lev and notfnd = true then Print("error not fnd in"); fi;
6014  >   Print(" -(",stepno,")- ");
6015  >   PrintNP([[p.trace[i][1]],[1]]);
6016  >   Print("         K[",p.trace[i][2],"]\n        ");
6017  >   PrintNP([[p.trace[i][3]],[1]]);
6018  >   Print(" --> ");
6019  >   PrintNP([[EvalList[i][1][2]],[1]]);
6020  > od;;
6021   -(1)-  TAGC
6022           K[1]
6023           AGCTAGCT
6024   -->  TAGCTAGCTAGCT
6025   -(2)-  TAG
6026           K[3]
6027           ATAGCTAGCT
6028   -->  TAGTCATAGCTAGCT
6029   -(3)-  TAG
6030           K[1]
6031           AGCTAGCT
6032   -->  TAGTAGCTAGCT
6033   -(4)-  TAGTAGC
6034           K[1]
6035           AGCT
6036   -->  TAGTAGCTAGCT
6037   -(5)-  TAGTAG
6038           K[3]
6039           ATAGCT
6040   -->  TAGTAGTCATAGCT
6041   -(6)-  TAGTAG
6042           K[1]
6043           AGCT
6044   -->  TAGTAGTAGCT
6045   -(7)-  TAGTAGTAGC
6046           K[1]
6047           1
6048   -->  TAGTAGTAGCT
6049   -(8)-  TAGTAGTAG
6050           K[3]
6051           AT
6052   -->  TAGTAGTAGTCAT
6053   -(9)-  TAGTAGTAG
6054           K[1]
6055           1
6056   -->  TAGTAGTAGT
6057   -(10)-  TAG
6058           K[1]
6059           AGTAGT
6060   -->  TAGTAGTAGT
6061   -(11)-  TAG
6062           K[3]
6063           ATAGTAGT
6064   -->  TAGTCATAGTAGT
6065   -(12)-  TAGC
6066           K[1]
6067           AGTAGT
6068   -->  TAGCTAGTAGT
6069   -(13)-  TAG
6070           K[5]
6071           AGTAGT
6072   -->  TAGCTAGTAGT
6073   -(14)-  T
6074           K[4]
6075           TAGTAGT
6076   -->  TATAGTAGT
6077   -(15)-  TATAG
6078           K[1]
6079           AGT
6080   -->  TATAGTAGT
6081   -(16)-  TATAG
6082           K[3]
6083           ATAGT
6084   -->  TATAGTCATAGT
6085   -(17)-  TATAGC
6086           K[1]
6087           AGT
6088   -->  TATAGCTAGT
6089   -(18)-  TATAG
6090           K[5]
6091           AGT
6092   -->  TATAGCTAGT
6093   -(19)-  TAT
6094           K[4]
6095           TAGT
6096   -->  TATATAGT
6097   -(20)-  TATATAG
6098           K[1]
6099           1
6100   -->  TATATAGT
6101   -(21)-  TATATAG
6102           K[3]
6103           AT
6104   -->  TATATAGTCAT
6105   -(22)-  TATATAGC
6106           K[1]
6107           1
6108   -->  TATATAGCT
6109   -(23)-  TATATAG
6110           K[5]
6111           1
6112   -->  TATATAGCT
6113   -(24)-  TATAT
6114           K[4]
6115           T
6116   -->  TATATAT
6117   -(25)-  T
6118           K[4]
6119           TATAT
6120   -->  TATATAT
6121   -(26)-  TAG
6122           K[5]
6123           ATAT
6124   -->  TAGCTATAT
6125   -(27)-  TAGC
6126           K[1]
6127           ATAT
6128   -->  TAGCTATAT
6129   -(28)-  TAG
6130           K[3]
6131           ATATAT
6132   -->  TAGTCATATAT
6133   -(29)-  TAG
6134           K[1]
6135           ATAT
6136   -->  TAGTATAT
6137   -(30)-  T
6138           K[4]
6139           TAT
6140   -->  TATAT
6141   -(31)-  TAT
6142           K[4]
6143           T
6144   -->  TATAT
6145   -(32)-  TAT
6146           K[2]
6147           TAT
6148   -->  TATAGTAT
6149   -(33)-  TATG
6150           K[4]
6151           T
6152   -->  TATGAT
6153   -(34)-  T
6154           K[4]
6155           TGAT
6156   -->  TATGAT
6157   -(35)-  T
6158           K[2]
6159           TATGAT
6160   -->  TAGTATGAT
6161   -(36)-  TG
6162           K[4]
6163           TGAT
6164   -->  TGATGAT
6165   -(37)-  TGATGA
6166           K[1]
6167           1
6168   -->  TGATGAT
6169   -(38)-  TGATGA
6170           K[3]
6171           AT
6172   -->  TGATGATCAT
6173   -(39)-  TGATGAC
6174           K[1]
6175           1
6176   -->  TGATGACT
6177   -(40)-  TGA
6178           K[1]
6179           GACT
6180   -->  TGATGACT
6181   -(41)-  TGA
6182           K[3]
6183           ATGACT
6184   -->  TGATCATGACT
6185   -(42)-  TGAC
6186           K[1]
6187           GACT
6188   -->  TGACTGACT
6189   -(43)-  1
6190           K[1]
6191           GACTGACT
6192   -->  TGACTGACT
6193   -(44)-  1
6194           K[3]
6195           ATGACTGACT
6196   -->  TCATGACTGACT
6197   -(45)-  C
6198           K[1]
6199           GACTGACT
6200   -->  CTGACTGACT
6201  gap> NP2GP(colaNP,ALG);
6202  (1)*(C*T*G*A)^2*C*T
6203\end{Verbatim}
6204 And now the second question regarding the retro virus.
6205\begin{Verbatim}[fontsize=\small,frame=single,label=]
6206  gap> retro := C*T*G*C*T*A*C*T*G*A*C*T;;
6207\end{Verbatim}
6208 We compute the Strong Normal Form \texttt{StrongNormalFormNP} (\ref{StrongNormalFormNP}) of \texttt{retro} with respect to \texttt{GB}. As it is \texttt{TGT}, distinct to \texttt{T}, the strong normal form of milk, there is no transformation from milk to
6209retro.
6210\begin{Verbatim}[fontsize=\small,frame=single,label=]
6211  gap> NP2GP(StrongNormalFormNP(CleanNP(GP2NP(retro)),GB), ALG);
6212  (1)*T*G*T
6213\end{Verbatim}
6214 Of course, here too we can verify the reduction, by computing \texttt{StrongNormalFormTraceDiff} (\ref{StrongNormalFormTraceDiff}) with input the NP polynomial corresponding to \texttt{retro} and with respect to \texttt{K}; it is called \texttt{retroTrace}. The symbol \texttt{G} in expression like \texttt{G(2)} are not to be confused with the single symbols \texttt{G} representing the DNA element.
6215\begin{Verbatim}[fontsize=\small,frame=single,label=]
6216  gap> retroTrace := StrongNormalFormTraceDiff(CleanNP(GP2NP(retro)),GTrace);;
6217  gap> PrintTracePol(retroTrace);
6218   TGG(1) - TGC^2G(1) - TGTAG(1) + TGTACG(1) + TGTAGG(1)AT + TGTATGAG(
6219  1) + TGTAG(1)GACT - TGTAGCG(1)AT - TGTATGACG(1) + TGG(1)ACTGACT - TGTACG(
6220  1)GACT + G(1)GCTACTGACT - TGCG(1)ACTGACT - CG(1)GCTACTGACT + TGTATG(
6221  2)TAT + TGG(3)AT + TGCG(3)AT - TGTAG(3)AT + TGTAGG(3)ATAT + TGTATGAG(
6222  3)AT + TGTAG(3)ATGACT + TGG(3)ATACTGACT + G(3)ATGCTACTGACT + TGTG(
6223  4)T + TGTATG(4)T - TGTG(4)TAT - TGTATGG(4)T + TGCG(5) + TGG(5)AT - TGTAG(
6224  5) + TGTAGG(5)AT
6225\end{Verbatim}
6226 }
6227
6228 }
6229
6230\def\bibname{References\logpage{[ "Bib", 0, 0 ]}
6231\hyperdef{L}{X7A6F98FD85F02BFE}{}
6232}
6233
6234\bibliographystyle{plainurl}
6235\bibliography{gbnp_doc}
6236
6237\addcontentsline{toc}{chapter}{References}
6238
6239\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}
6240\hyperdef{L}{X83A0356F839C696F}{}
6241}
6242
6243\cleardoublepage
6244\phantomsection
6245\addcontentsline{toc}{chapter}{Index}
6246
6247
6248\printindex
6249
6250\newpage
6251\immediate\write\pagenrlog{["End"], \arabic{page}];}
6252\immediate\closeout\pagenrlog
6253\end{document}
6254