\section{References}\label{refm}

 This chapter contains more formal, but also more complete
descriptions of the user available procedures and variables,
and choices of modes of operation. You may use it for
references. Since some of the alternatives were not mentioned
before, it may also be valuable to glance through e.g.\
the entire section~3.1, although part of the information may
not seem to be very clear at a first reading.


  \subsection{Mode handling}

 There are a large number of choices of modes of operations in
bergman. In this section, we list all of them, with brief (but
sometimes not quite complete) descriptions of their impacts.
All such chosen modes together form the {\sl setup}.

 The large number of possibilities may be good for flexibility,
but it also may be a bit hard to survey and handle in an easy
manner. For this reason, bergman provides three principal ways
to handle mode settings: By the shell interface, by individual
mode changing procedures, and by handling entire setups
directly as objects in their own right.

If you use the shell interface, the most convenient way to
inspect and change mode settings is by employing the
corresponding interface item. The shell choices are essentially
organised in the same tree-like manner as the mode setup as
described in this section, and you should have no trouble to
find the manual description corresponding to a shell choice, or
vice versa.

 (There is also an experimental and incomplete `dialogue'
interface, which is intended to have similar properties.)

Each individual major or minor mode change may be achieved by
calling a mode changing procedure. In fact, often there are
alternative such procedures; e.g., one for a specific mode
change effect, and one more general, where the arguments provided
by the user will decide the effect. In the latter case, giving
the argument "help" often yields a list of all legal alternatives,
followed by a prompt for inputting one of them.

Finally, the whole mode setup may be represented by a lisp object,
which may be inspected, saved, changed, checked for consistency,
and put into simultaneous effect. The latter is achieved by means
of the procedure {\bf putsetup}, which also may be given just a partial
setup as argument, effecting a single or a group of single mode
changes. We call this approach `the compact mode handler'.


It is worth to repeat, that there is no essential difference
between these three ways to change modes. Internally, the shell
employs the compact mode handler, which in its turn employs the
individual mode setting procedures. The user thus may learn one
way to handle this, and safely forget all about the others.

Internally, a mode change normally consists of two parts: a
change of some procedure definitions, and a reassignment of the
value of some variable or switch. The procedure definition changes
employs the fact that Lisp automatically has an element of
indirection in its function calls, even from within compiled
procedures (excepting macros or inlined procedures). Thus, in
time sensitive parts of the programme, a change of procedure
definitions offers flexibility at no run time cost. Instead,
the price is paid by the programmer, who has to define a
multitude of variants for the same procedure, and keep track of
which one of the function definition is to be `copied' (which
mostly essentially means `linked', but sometimes even may mean
`recompiled') in a specific situation.

Finally, one word of warning to the practioned Lisp or Reduce
programmer: You may view the source code, and help yourself to
customised deep level changes, as you wish. When you do, you'll
soon find out which switches (identifiers starting with an asterisk)
are accompanied to which mode choices. If you wish, you may
access them for direct information on the current mode setting
(always running the risk that these internal names are changed in
the next bergman version, of course). However, do not use them for
achieving mode changes! For a Reduce user or programmer, it is
natural to change switches by means of the procedures ON and OFF.
However, if you do, you miss the rather essential other part of
the mode change: the procedure redefinitions.

One example: In the present version, the switch associated with
the choice of commutativity or noncommutativity has a name like
 \verb|*#NonCommutativity#|, or in the `inverted case' implementations,
 \verb|*#nONcOMMUTATIVITY#|. You may turn on this directly, in order to
fool a few procedures that actually look at the value of the
switch to behave as if you were in noncommutative mode. However,
the actual mode change performed by the procedure {\bf noncommify}
essentially consists of more than twenty procedure redefinitions,
which you miss by just changing the switch value. Thus, if you
run your own variant, with this switch changed instead of the
mode changed in a proper manner, you are apt to run into rather
queer and unpredictable difficulties - and we will not be
inclined to help you to entangle this mess.



      \subsection {Sustained operating mode alternatives}

 In the right column, appropriate procedures or flags are named. The
procedures are described (in alphabetical orders) after the overview. Default settings (if any)
are underlined.

\vspace*{0.4cm}

{\bf Types of objects:}

\vspace*{0.4cm}
\begin{tabular}{|l|l|}
\hline
  Modes & Procedures\\
\hline
\underline{RING}       &  SETRINGOBJECT()\\
MODULE     &  SETMODULEOBJECT()\\
TWOMODULES & SETTWOMODULESOBJECT()\\
\hline
\end{tabular}
 \vspace*{0.4cm}


{\bf The polynomial ring set-up:}

\vspace*{0.4cm}
\begin{tabular}{|l|l|}
\hline
  Modes & Procedures\\
\hline
 Commutative DEG-REVLEX & COMMIFY(),DEGREVLEXIFY()  \\
 \underline{Commutative DEG-LEX} &       COMMIFY(),DEGLEXIFY()  \\
 Non-commutative  DEG-LEX &          NONCOMMIFY()\\
 Non-commutative   & \\
  ELIMLEFTLEX & ELIMORDER()\\
 Non-commutative  & \\
  INVELIMLEFTLEX & INVELIMORDER() \\
 Non-commutative & \\
 HOMOGELIMLEFTLEX & HOMOGELIMORDER()\\
\hline
\end{tabular}
 \vspace*{0.4cm}

{\bf Weights handling:}

\vspace*{0.3cm}
\begin{tabular}{|l|}
  \hline
  Procedures \\
 \hline
  SETWEIGHTS(list)\\
  GETWEIGHTS()\\
CLEARWEIGHTS()\\
\hline
 \end{tabular}


{\bf  Coefficient arithmetic:}
 
 \vspace*{0.4cm}
\begin{tabular}{|l|l|}
  \hline
  Modes & Procedures\\
  \hline    
         \underline{Characteristic 0,}  &  SETMODULUS(0) \\
        arbitrary integers & \\
        \hline
        Characteristic 0,  &     SETMODULUS(0)  \\
        only inums & \\
        \hline
             Characteristic 2 &  SETMODULUS(2)\\
        \hline
        Odd characteristic &   SETMODULUS(pr)  \\
          ordinary inum  &             \\
        \hline
        Odd characteristic &   SETMODULUS(pr) \\
        ordinary bignum &   SETODDPRIMESMODULI(ordinary)\\
        \hline
        Odd characteristic &  SETMODULUS(pr) \\
         logarithm table &  SETODDPRIMESMODULI(modlogarithmic)\\
         inum arithmetic &  \\
         \hline
        Arbitrary Reduce &         SETREDUCES\\
        Standard Forms & FCOEFFS() \\        
       (only available &  \\
        under REDUCE) &  \\
 \hline
 \end{tabular}
 \vspace*{0.4cm}







{\bf Fundamental strategy: }
  \vspace*{0.4cm}

\begin{tabular}{|l|l|c|}
  \hline
  Strategy &  Procedures \\
  \hline      
        \underline{Ordinary (Buchberger)} &  SETIMMEDIATEFULLREDUCTION(t)\\
           \underline{ with immediate }             &  \\
            full   autoreduction       &  \\
  \hline
        Ordinary (Buchberger) &   SETIMMEDIATEFULLREDUCTION(nil)  \\
            without immediate              &  \\
            full   autoreduction       &  \\
  \hline
       Dehomogenization  &  RABBIT (start step finish)\\
       and jumping & \\
  \hline
        
 \end{tabular}
 \vspace*{0.4cm}
 
 
{\bf  Major mode modifications: }
  \vspace*{0.4cm}

\begin{tabular}{|l|l|c|}
  \hline
  Strategy &  Procedures \\
  \hline      
        \underline{Work degree by degree} &  SETDEGREEWISE()\\
                       &  \\
          
  \hline
        Work item for item &  SETITEMWISE ()  \\
           (not for Rabbit or SAWS)             &  \\
        
  \hline
      \underline{Found leading monomials of} &  STABILISE()\\
      \underline{Gr\"obner basis are stable.} & SETSTABILITY (T) \\      
  \hline
       Found leading monomials &  DESTABILISE()\\
        Gr\"obner basis are unstable. & SETSTABILITY (NIL) \\
  \hline
        
 \end{tabular}
 \vspace*{0.4cm}
             

 {\bf Ordinary or Hilbert series limit interruption
  strategy:}

 \vspace*{0.4cm}
\begin{tabular}{|l|l|c|}
  \hline
  Mode  & Procedures \\
        \hline
  \underline{Ordinary } &    ORDNGBESTRATEGY()\\
  Hilbert series &   MINHILBLIMITSTRATEGY()\\
                \hline
 \end{tabular}
\vspace*{0.4cm}
\newpage 
{\bf Output mode:}

 \vspace*{0.4cm}
\begin{tabular}{|l|l|c|}
\hline
Mode & ALGOUTMODE set \\
\hline     
Lisp form     &              LISP\\
\underline{Ordinary algebraic form} &         ALG \\
Macaulay-like  form &           MACAULAY\\
\hline
\end{tabular}
\vspace*{0.4cm}






{\bf Minor mode modifications:}
 \vspace*{0.5cm}

\begin{tabular}{|l|l|c|}
  \hline
  Mode &  Procedures \\
  \hline      
        \underline{Densely }   & 
                         \index{densecontents}  DENSECONTENTS() \\
 Sparsely performed &    \index{sparsecontents} SPARSECONTENTS()\\
 factoring out      & \\
  of contents       & \\
   \hline
 \end{tabular}
\vspace*{0.3cm}
    

 In general, modes should not be changed while a set up is in progress.
Therefore, mode changing procedure calls are only recommended early in
a {\bf bergman} run, or (almost) immediately after a call to the procedure
{\bf clearideal}. If the latter does not work well, restart {\bf bergman} and try the
former.

 The {\bf saws} mode is achieved by calling {\bf saws} alternative procedures (such
as {\bf stagsimple} instead of {\bf simple}).


 \subsection{The mode designator tree structure}\label{tree}

 

 This section is intended to be an overview of the names used
for modes and submodes in the compact mode handler.  In principal, each line will contain
a mode designator, and may contain a list of valid
values of this. However, if the latter list is rather
long, it may continue over several lines.

 Submodes are denoted by indentation; and top level
modes are separated by empty lines. Thus

\begin{verbatim}
 XXXXX <...>
    YYYYY
    ZZZZZ <...>

 WWWWW <...>
\end{verbatim}

would denote two major modes XXXXX and WWWWW (two nodes
immediately under the mode tree root), while YYYYY
and ZZZZZ would be minor modes (nodes immediately
under XXXXX). In addition, 'legal values' for XXXXX,
ZZZZZ, and WWWWW would be enumerated.

\begin{verbatim}
 OBJECTTYPE  <RING | MODULE | TWOMODULES | FACTORALGEBRA>
    AUTOADDRELATIONSTATE  <NIL NIL | T NIL | NIL T>
    LOWTERMSHANDLING	  <QUICK | SAFE>
\end{verbatim}

\begin{verbatim}
 RESOLUTIONTYPE  <NONE | ANICK>

 ANICK
    TENSPOL-PRINTMODE     <SEMIDISTRIBUTED | DISTRIBUTED>
    TENSTERM-PRINTMODE    <NIL | <a string>> 
                          <NIL | <a string>> <NIL | <a string>> 
    EDGE-STRING           <<a string>>
    EDGE-STRING-PRINTING  <NIL | T>
    BETTI                 <T | NIL>
    BETTI-FOREACHDEGREE   <T | NIL>
\end{verbatim}

\begin{verbatim}
 VARIABLESETUP
    RINGTYPE            <COMMUTATIVE | NONCOMMUTATIVE>
    COMMUTATIVEORDER    <TDEGLEX | PURELEX | TDEGREVLEX>
    NONCOMMUTATIVEORDER <TDEGLEFTLEX | ELIMLEFTLEX
                         | HOMOGELIMLEFTLEX | INVELIMLEFTLEX>
    VARIABLENUMBER      <NIL | <a non-negative integer>>
    INVARIABLES         <<a list of different identifiers>>
    OUTVARIABLES        <<a list of different identifiers>>
    VARIABLEWEIGHTS
    HOMOGENISATIONVARIABLE <<an identifier>>
\end{verbatim}

\begin{verbatim}
 STRATEGY               <ORDINARY | RABBIT | SAWS>
    AUTOREDUCTION       <IMMEDIATE | POSTPONED>
    CONTENTS            <DENSE | SPARSE>
    MINDEG              <NIL | <a non-negative integer>>
    MAXDEG              <NIL | <a non-negative integer>>
    INTERRUPTION        <ORDINARY | MINHILBLIMITS>
    HSERIESLIMITATIONS
    CUSTOMISED		<NIL | T>
\end{verbatim}

\begin{verbatim}
 COEFFICIENTDOMAIN      <NIL | SF | 0 | <a prime>>
   ODDPRIMESMODULI      <MODLOGARITHMIC | ORDINARY>
\end{verbatim}

\begin{verbatim}
 INPUTFORMAT   <CASESENSALGIN | NOCASESENSALGIN>

 OUTPUTFORMAT  <LISP | ALG | MACAULAY> 
                         <NOEXPTSPRINT | EXPTSPRINT>
    IMMEDIATEASSOCRINGPBDISPLAY   <NIL | T>
    CUSTOMISED		          <NIL | T>
\end{verbatim}

\begin{verbatim}
 DEBUGSTATUS
    DIRECTALERTCLOSING  <NIL | T>
    CHECKFAILUREDISPLAY <NIL | T>
    ACTIVETRACEBREAKS	<NIL | T>
\end{verbatim}

\begin{verbatim}
 VARIOUSFLAGS
    DEGREEPRINTOUTPUT
    DYNAMICLOGTABLES
    IMMEDIATECRIT
    IMMEDIATERECDEFINE
    NOBIGNUM
    OBSOLETENAMESINFORM
    OLDPRINTMODES1
    OLDSERIESMODES1
    STANDARDANICKMODES
    PBSERIES
    REDUCTIVITY
    SAVEDEGREE
    SAVERECVALUES
\end{verbatim}

This tree contains branches and leaves. Some of the branches {\it bbb}
have  two  procedures with  the names  

\begin{description}

 \index{get procedures} \item [(GET{\it bbb}),] which returns for the given 
branch {\it bbb} the current
value of its chosen leaf or subtree.

 \index{set procedures} \item [(SET{\it bbb chosen}),] which sets the chosen
value  for the given branch {\it bbb}.

\end{description}


For the majority of the leaves {\it lll} from this tree there exists a  procedure:

\begin{description}

 \index{setsetup} \item [(SET{\it lll}),] which makes a leaf {\it lll} to be 
chosen as a current value.

\end{description}

For example, there exists a branch  procedure {\bf setobjecttype } which takes one parameter from the list
of the admisible object type values (e.g.
RING). There are also leaf procedures for each leaf (e.g. {\bf setringobject}). 

We do not itemize all of the leaf and branch procedures, because they are logically
quite similar  and limit our  description by the most important ones.



 \subsection {The mode handling procedures}

In the description below, an EXPR evals its arguments, while a FEXPR
doesn't. Recall, that in Lisp if you want to give an identifier name directly as an argument
to an EXPR, you must quote it (QUOTE name) or 'name; otherwise the Lisp
will try to feed the value of the identifier to the EXPR. On the other
hand, you should NOT quote the arguments to a FEXPR. (Numbers and
strings need never be quoted, since they are evaluated to themselves.)


\vspace{0.3cm}
\begin{center} {\bf \large General mode handling}\end{center}


\begin{description}

 \index{setsetup} \item [(SETSETUP mode-tree-structure)] : EXPR


  Sets the whole mode setup tree. Normally it is used to recover the peviously saved tree.
For changing a particular mode is more efficient to use specialised setting procedures
described below.

 \index{getsetup} \item [(GETSETUP)] : EXPR
 

  Gets the current mode setup tree.

\index{printsetup} \item [(PRINTSETUP)] : EXPR 


   Prints the current mode tree. 

\end{description}

\vspace{0.3cm}
\begin{center} {\bf \large Setup checking}\end{center}

\index{checksetup}The function {\bf CHECKSETUP} performs the following checks:

\begin{itemize}

\item It checks that the input is an association list  (i.e., a list,
   whose members are dotted pairs). 

\item It checks that the items are of different types, and of types
   which we consider as (major) modes.

\item If there is an OBJECTTYPE item, CHECKSETUP checks that its
   CDR is a list.

\item If there is a RESOLUTIONTYPE item, CHECKSETUP checks
     that it is a list of length two, and that its second
     member \verb|<s>| is a valid resolution type name.

\item  If there is a VARIABLESETUP item, CHECKSETUP checks that its
   CDR is an alist. If so, then this alist is searched for some
   subitems.

\item   If there is a VARIABLENUMBER subitem, CHECKSETUP should check that 
     the subitem is a
     list of length two, and that its second member  \verb|<s>| is either
     NIL or a non-negative integer. If \verb|<s>| is  a number, and
     INVARIABLES and/or OUTVARIABLES are explicitly given, but
     of length(s) different from  \verb|<s>|, then a non-fatal warning
     is issued (but this part of the setup is accepted).


\item If there is a STRATEGY item, CHECKSETUP checks that its
   CDR is an alist. If so, then this alist is searched for some
   subitems:\\
   If there is an INTERRUPTION subitem, CHECKSETUP checks
     that it is a list of length two, and that its second
     member  \verb|<s>| is a valid interruption minor strategy mode.
     If  \verb|<s>|$=$ MINHILBLIMITS, CHECKSETUP checks that the
     VARIABLESETUP item (if any) does not contain a
     VARIABLEWEIGHTS subitem, with a non-NIL argument.

\item If there is a COEFFICIENTDOMAIN item, CHECKSETUP checks that
   its CDR is a non-empty list, whose CAR is NIL or a
   non-negative integer, and whose CDR is an alist.

\item If there is an INPUTFORMAT item, CHECKSETUP checks that its
   CDR is a list.

\item If there is an OUTPUTFORMAT item, CHECKSETUP checks that its
   CDR is a list.

\item If there is an ANICK item, CHECKSETUP notes it but ignores
   it. 
%??

\item If there is a VARIOUSFLAGS item, CHECKSETUP checks that its
   CDR is an alist.

\end{itemize}

See an example of its using in the section \ref{debugg}.

The function displays the value {\bf t} which informs that the settings are OK
or yields the  following  message:
 
\begin{verbatim}
*** Clashes between different mode settings were found.
\end{verbatim}

There are two functions \index{findmodeclashes} {\bf findmodeclashes} and
\index{findmodeclashes1} {\bf findmodeclashes1} to analyse the setup and to give
detailed information about clashes.
 
\begin{description}
 \item [(FINDMODECLASHES mst1 mst2)] : EXPR

Gives the information about the found incompatibility between two setups 
{\bf mst1} {\bf  mst2}.
 
 \item [(FINDMODECLASHES1 mst)] : EXPR 

Gives the information about the found incompatibility into the setup {\bf mst}.
\end{description}

\vspace{0.3cm}
\begin{center} {\bf \large Objects  handling}\end{center}

 \begin{description}

 \index{setobjecttype} \item [(SETOBJECTTYPE objecttype)] : EXPR

Sets the current object type (e.g., RING, MODULE, TWOMODULES).

\index{getobjecttype} \item [(GETOBJECTTYPE)] : EXPR

Gets the current object type (e.g.,RING, MODULE, TWOMODULES).

\index{setringobject} \item [(SETRINGOBJECT)] : EXPR

Sets the current object type to RING.

\index{setmoduleobject} \item [(SETMODULEOBJECT)] : EXPR

Sets the current object type to MO\-DULE.

\index{settwomodulesobject} \item [(SETTWOMODULESOBJECT)] : EXPR

Sets the current object type to TWOMODULES.

\index{moduleobject} \item [(MODULEOBJECT)] : EXPR

A boolean procedure cheking if the current type is MODULE.


 \end{description}


\vspace{0.3cm}
\begin{center} {\bf \large Resolution setup}\end{center}

\begin{description}

 \index{setanickresolution} \item [(SETANICKRESOLUTION)] : EXPR

Sets the resolutiontype to ANICK which forced {\bf bergman} 
to compute Anick resolution together with Gr\"obner basis.

 \index{setnoresolution} \item [(SETNORESOLUTION)] : EXPR

Sets the resolutiontype to  NIL.


\index{setresolutiontype} \item [(SETRESOLUTIONTYPE rt) ]: EXPR

Sets the resolutiontype to  NIL or to ANICK depending of the value of {\it rt}.


\index{getresolutiontype} \item [(GETRESOLUTIONTYPE)] : EXPR

Gets the current resolutiontype.

 \end{description}



\vspace{0.3cm}
\begin{center} {\bf \large Input--output variables setup}\end{center}

The lists are set up in two variants: as plain lists, and as
alists. In the second case, the dotted pairs consist of variable
name identifiers and of integers, giving the position in the list.
Presently, input and output lists are EQUAL; this is not to be
relied on for the future.

\begin{description}

 \index{setinvars} \item [(SETINVARS list)] : EXPR

Sets the list of input variables. Sets also  the variable number, 
if it is not already set.


 \index{setoutvars} \item [(SETOUTVARS list)] : EXPR

Sets the list of output variables.

 \index{setiovars} \item [(SETIOVARS list)] : EXPR

Sets both lists of the input and output variables.

\index{clearvars} \item [(CLEARVARS)] : EXPR

Clears the variables lists.

\index{getinvars} \item [(GETINVARS)] : EXPR

Gets the list of input variables.

\index{getoutvars} \item [(GETOUTVARS)] : EXPR

Gets the list of output variables.

\index{getinvarno} \item [(GETINVARNO)] : EXPR

Gets the number of input variables.

 \end{description}


\vspace{0.3cm}
\begin{center} {\bf \large Switching commutativity}\end{center}

 \begin{description}

 \index{setringtype} \item [(SETRINGTYPE ringtype)] : FEXPR

Sets the current ring type to the parameter {\it ringtype} value
(COMMUTATIVE or NONCOMMUTATIVE).

 \index{getringtype} \item [(GETRINGTYPE)] : EXPR

Gets the current ring type (COMMUTATIVE or NONCOMMUTATIVE).

 \index{commify} \item [(COMMIFY)] : EXPR

Turns on commutative mode.

 \index{noncommify} \item [(NONCOMMIFY)] : EXPR

Turns on non-commutative mode. (It is automatically
performed by {\bf ncpbhgroebner,} {\bf rabbit} and a number of other 
procedures dealing with the Anick resolution. The procedures inter alia 
changes some flags, which should NOT be changed directly.)

 \end{description}

\vspace{0.3cm}
\begin{center} {\bf \large Orderings}\end{center}

\begin{description}

\index{deglexify} \item [(DEGLEXIFY)] : EXPR

Should only be used in the commutative mode. Sets the monoid order to
the TOTAL DEGREE -- LEXICOGRAPHICAL one. (In LISP form input, the
variable in first position is used first  in order comparisons. In ALG
form input, the first "vars" listed variable is used first.)

\index{degrevlexify} \item [(DEGREVLEXIFY)] : EXPR

Should only be used in the commutative mode. Sets the monoid order to
the TOTAL DEGREE -- REVERSE LEXICOGRAPHICAL one. (In LISP form input, the
variable in last position is first used in order comparisons. In ALG
form input, the last "vars" listed variable is first used.)

\index{degleftlexify} \item [(DEGLEFTLEXIFY)] : EXPR

Should only be used in the non-commutative mode. Sets the monoid order to
the TOTAL DEGREE -- LEFT LEXICOGRAPHICAL one.

\index{purelexify} \item [(PURELEXIFY)] : EXPR

ONLY interesting in conjunction with homogenisation. Not to be used
in ordinary manner.

\index{elimorder} \item [(ELIMORDER)] : EXPR

Sets an elimination ordering.  Should only be used in the non-commuta\-tive mode.

\index{invelimorder} \item [(INVELIMORDER)] : EXPR

Sets the INVELIMLEFTLEX elimination ordering.

\index{homogelimorder} \item [(HOMOGELIMORDER)] : EXPR

Sets the HOMOGELIMLEFTLEX ordering. Is authomatically
used with the {\bf rabbit} strategy only and
hardly can be used in other cases.

\index{noelim} \item [(NOELIM)] : EXPR 

Takes away the HOMOGELIMLEFTLEX ordering. By default
recovers DEGLEFTLEXIFY ordering.

\index{getorder} \item [(GETORDER)] : EXPR

Gets the current ordering.

\index{setcommorder} \item [(SETCOMMORDER order)]  : FEXPR

Sets the commutative ordering indicated as a argument.

\index{getcommorder} \item [(GETCOMMORDER)]  : EXPR

Gets the current commutative ordering.

\index{setnoncommorder} \item [(SETNONCOMMORDER order)]  : FEXPR

Sets the non-commutative ordering indicated as a argument.

\index{getnoncommorder} \item [(GETNONCOMMORDER)]  : EXPR

Gets the current non-commutative ordering.

 \end{description}


\vspace{0.3cm}
\begin{center} {\bf \large Coefficients domain  handling}\end{center}

\begin{description}


\index{setmodulus} \item [(SETMODULUS pr)] : EXPR

{\it pr} should be a prime, 0, or NIL. (NIL is interpreted as 0.) The new
coefficient field is set to the prime field of characteristic {\it pr}.
For  $pr > 2$, some recompilations (which may take several seconds) are
performed. If furthermore the mode MODLOGARITHMIC was choosen, a file with a
certain kind of "modular logarithm tables" is sought for. The (full)
name of the file is supposed to be a preamble followed by the number
{\it pr} (in decimal notation).  The creation of the table file
also requires some time, depending on the size of {\it pr}.

\index{restorechar0} \item [(RESTORECHAR0)] : EXPR

Has the same effects as\\ (SETMODULUS 0).

\index{setmodulus2} \item [(SETMODULUS2)] : EXPR

Has the same effects as\\ (SETMODULUS 2).

\index{setreducesfcoeffs} \item [(SETREDUCESFCOEFFS)] : EXPR

(Only in bergman-under-reduce.)
The coefficients are set to be Reduce 'standard forms'. (Any previous
SETMODULUS call is cancelled). In this mode, coefficient arithmetics
is performed by ordinary Reduce standard form procedures, whence any
Reduce flags or standard forms simplifications are in force. In this
way very general domains may be set up.

\index{getmodulus} \item [(GETMODULUS)] : EXPR 

    Returns the characteristic of the coefficient field, or SF
    if the coefficients are standard forms. (Characteristic 0
    may be represented by NIL.)

\index{setoddprimesmoduli} \item [(SETODDPRIMESMODULI)] : FEXPR 

Sets one of two possible values: {\bf ordinary} to use ordinary 
bignum arithmetic or {\bf modlogarithmic} to work with the logarithmic tables.

\index{getoddprimesmoduli} \item [(GETODDPRIMESMODULI)] : EXPR 

Informs about the current choice.


\end{description}

\vspace{0.3cm}
\begin{center} {\bf \large  Strategy modes}\end{center}
\begin{description}

\index{getstrategy} \item [(GETSTRATEGY)] : EXPR

Returns the present strategy of the calculations (DEFAULT, RABBIT or SAWS).


\index{setdefaultstrategy} \item [(SETDEFAULTSTRATEGY)] : EXPR

Sets DEFAULT strategy as a current strategy of the calculations.

\index{setrabbitstrategy} \item [(SETRABBITSTRATEGY)] : EXPR

Sets RABBIT strategy as a current strategy of the calculations.

\index{setsawsstrategy} \item [(SETSAWSSTRATEGY)] : EXPR

Sets SAWS strategy as a current strategy of the calculations.

\end{description}



\vspace{0.3cm}
\begin{center} {\bf \large  Interrupting strategy modes}\end{center}

\begin{description}

\index{setinterruptstrategy} \item [(SETINTERRUPTSTRATEGY 
strategy name)] : FEXPR

(Interruption) strategy name should be one of ORDINARY, NONE, NIL, or
MINHILBLIMITS. The first three cause the ordinary (default) strategy,
with no interruptions. The argument MINHILBLIMITS turns on the minimal
limit interruption strategy submode (see details in \ref{comHS}). 
In this, at any new current degree
cDeg the value $v$ of (GETHSERIESMINIMUM cDeg) is investigated.
If $v$ is NIL, no interruption is made at this degree.
If $v$ is SKIPCDEG, the degree is skipped but calculations continue for
higher degrees.
If $v$ is T, all further Gr\"{o}bner basis calculations are skipped.
If $v$ is an integer, then this is interpreted as the minimal possible
Hilbert function value of cDeg for the factor-ring. 
Calculations at this degree are interrupted as soon as the
found preliminary Gr\"{o}bner basis elements are enough to make the
corresponding monomial ring not to have a higher
Hilbert series value of cDeg.
(The check is performed by FixNcDeg, whence by defining CUSTNEWCDEGFIX
and turning on CUSTSTRATEGY you could modify the action; see this flag.)

\index{getinterruptstrategy} \item [(GETINTERRUPTSTRATEGY)] : EXPR

Returns the current interruption strategy (ORDINARY or MINHILBLI\-MITS).

\index{checkinterruptstrategy} \item [(CHECKINTERRUPTSTRATEGY)] : EXPR

Inspects the current interruption strategy.

\index{ordngbestrategy} \item [(ORDNGBESTRATEGY)] : EXPR

Has the same effects as (SETINTERRUPTSTRATEGY ORDINARY).

\index{minhilblimitstrategy} \item [(MINHILBLIMITSTRATEGY)] : EXPR


 Has the same effects as (SETINTERRUPTSTRATEGY MINHILBLI\-MITS), respectively.
\end{description}

\vspace{0.3cm}
\begin{center}\vspace{0.3cm}
 {\bf \large  Contents strategy modes}\end{center}

\begin{description}
\index{densecontents} \item [(DENSECONTENTS)] : EXPR

\index{sparsecontents} \item [(SPARSECONTENTS)] : EXPR

In the (integer of characteristic 0) and the (Reduce standard form)
coefficient major modes, the 'coefficient domain' does not coincide
with the 'base field'. Then the polynomials under reduction and the
preliminary Gr\"{o}bner basis elements will in general not be monic. As
a consequence, we now and then get non-unit contents of polynomials
under reduction (i.e., non-trivial greatest common divisors of all
coefficients). There are different possible strategies for how often
such contents should be calculated and factored out. The bergman
default is 'densely', i.e., more or less at each reduction steps.
A 'sparsely' variant is also available, where we postpone this until
we have normal forms. DENSECONTENTS/SPARSECONTENTS switches between
them.

(COMMENT: In the M\"{o}ller et al. Reduce GROEBNER package, an
intermediate strategy of some interest has been tested: Factor out
the content once for each (say) tenth step.)


%EXPTSPRINTMODE, NOEXPTSPRINTMODE: <Insert explanations here>


\end{description}

\vspace{0.3cm}
\begin{center} {\bf \large Degree limitations}\end{center}

\begin{description}
\index{setmaxdeg} \item [(SETMAXDEG Degree)] : EXPR

Sets the limit for maximum degree in the calculating of the Gr\"{o}bner basis.
It is normally used in the non-commutative calculations to avoid an infinite 
process.
Note that if the Gr\"{o}bner basis  have no elements greater than
 maximum degree the other calculations (as Betti numbers) 
 will be stopped before the maximum degeree will be achieved. 
 
\index{getmaxdeg} \item [(GETMAXDEG)] : EXPR

Gets the value of the current maximum degree.

\index{setmindeg} \item [(SETMINDEG Degree)] : EXPR 

Sets the lower limit for the degree
of the calculations. Is used in a very special situations.

\index{getmindeg} \item [(GETMINDEG)] : EXPR

Gets the value of the current minimum degree.


\end{description}

\section{Monomials and polynomials in {\bf bergman} }
\label{monomialsand}
To be able to work inside the {\bf bergman} it is important to understand 
the internal structure of the polynomial and monomial representation. 
It is far from being trivial, and efficiency, that {\bf bergman} has, is partly
achieved by using the  internal form of the polynomial representation.
 But this has its opposite side: because the  internal form is unprintable some
 intermediate forms are necessary too. The aim of this section is to explain 
in more details why the polynomials are implemented in different forms.

We start from the monomials forms. Monomials are always considered to be
monic, (i.e. coefficient free) monomials.
  The simplest form of a monomial is  Lisp form.
\index{Monomial, Lisp form}  Lisp form monomials are lists of
 exponents/of variable indices in the commutative/non-commutative case.
So, the monomial $x^2y^3z$ will be represented as $(2, 3, 1)$ in the
commutative case and $(1, 1, 2, 2, 2, 3, 0)$ in the non-commutative 
(if $x,y,z$ were variables, given in this order in the input). 
 The last zero in the non-commutative form is the end-mark.
The monomial $xzx$ will be represented as $(2, 0, 1)$ in the commutative case
and as $(1, 3, 1, 0)$ in the non-commutative. The Lisp form is printable and is 
used mainly for input-output procedures.

Internally monomials can be presented in two forms:  as 
pure monomial (abbreviated as pmon or puremon \index{Monomial, PMon} 
\index{Monomial, puremonomial} 
 in the procedure descriptions) and as augmonomial. "Aug" stands for
 "augmented", referring to the
extra information connected with the monomial. The typical abbreviation
 in the procedure descriptions is AugMon. \index{Monomial, AugMon}
\index{Monomial, Augmonomial}

Those two forms are closed to each other. It is
possible to get the augmonomial form from the pure one, and vice
versa; but information about the monomial pointer or associated
monomial flags or properties are directly accessible only from
the augmonomials.

 Pure monomials are used when no extra information about them
 (except the corresponding Lisp form)
 is necessary. For example we use it in all variants of MONLESSP
procedures for the monomial orderings, when we need to compare 
two monomials as if they are written in
 Lisp form. This is important to know when the user wants to create
 his own ordering. Technically it is implemented as a pair, consisting of
a pointer and a Lisp form monomial.

Augmented monomials have more complicated intern structure,
 which we will not
discuss here (see section \ref{monomials} if you want to know more).
 The augmonomials are used in the
terms (summands) of the  polynomials. 

One useful point of view is that pure monomial is a ``preliminary'' 
form of  the given monomial,
 which we started to work with but did not decided yet
to ``intern'' it in some kind of database of monomials, consisting of
augmented monomials.

The most important feature of an "interned" augmonomial is that  it has  
guaranteed unique representation in this database in
the sense that if the (mathematically) identical monomial is
"interned" to an augmonomial twice, then the two results
test as equal by Mon!=, and have the same monomial pointer, flags,
and properties.   

The advantage of this database is that new information 
(e.g. normal form of the monomial) is sent simultaneously to all the
 polynomials, 
containing this monomial. Another advantage is that for every monomial
in this database we check only once if it is normal. Next time when we need to
consider the same monomial we already know if it is normal or not, because
the information about this is one of the property of this augmonomial.

To see the difference between two forms let us
 consider two monomials $f,g$ and a (non-commutative)
polynomial $P.$ All terms of $P$ are augmonomials. The
product $fPg$ (such a product can appear during the constructing 
of a new Gr\"obner basis element)
 is also a polynomial and its monomials will be interned too. 
But $f$ and $g,$
which were used only temporary have no justification to be  interned, so it is
 reasonable to use them as a pure monomials only. 

Another example of  non-interned monomial are
 quotients, which are quite ephemeral.  They result from
certain monomial divisions and may be used in certain subsequent
multiplications.  They are not assumed to be comparable with
anything else in any way.  (In fact, in the non-commutative case
they might consist of pairs of monomials, one left and one right
'factor'.)

The important procedures working with the monomials are:
 \begin{description}
\index{monintern} \item [(MONINTERN LispFormMonomial)]: EXPR

  Changes its argument from a Lisp form monomial to a monomial
in the appropriate internal representation (augmonomial),
 and returns the
changed monomial.

Warning: The output monomial may not be a printable LISP object.

\index{monlispout} \item [(MONLISPOUT puremon)]: EXPR

  Produces a Lisp form of its argument (pure monomial), without changing the
argument.

\index{monprint} \item [(MONPRINT mon)]: EXPR

  Prints its argument (an internally represented monomial) in
algebraic form if the appropriate settings are done, else in Lisp
form.

\index{monlessp} \item [(MONLESSP Mon1:puremon, Mon2:puremon)]: EXPR

Evaluates  the current admissible order. Note, that the result may be 
 undefined (possibly erroneous) if Mon1 and Mon2 represent the
    same monomial or are of different total-degrees. Else, non-NIL
    iff Mon1 is less than Mon2 with respect to the active order.

\index{montimes2} \item [(MONTIMES2 Mon1:puremon, Mon2:puremon)] : EXPR 

    The output represents the product Mon1 * Mon2 (in the given order).
    
\index{monfactorp} \item [(MONFACTORP Mon1:puremon, Mon2:puremon)]: EXPR

    Decides whether or not the first puremon (pure monomial) is a
    factor of the second one. In the latter case, the output is non-nil,
    and may contain enough information for deciding in what manner the
    first one is a factor in the second. (In the non-commutative, there
    indeed may be several such ways.)

\index{totaldegree} \item [(TOTALDEGREE Mon:puremon)]: EXPR  

Calculates the degree of the monomial (using the weights, if they are given).

\index{getmonaugprop} \item [(GETMONAUGPROP mon prop)]: EXPR 
 
Returns T if {\it prop} is found, NIL else.

\index{remmonprop} \item [(REMMONPROP augmon prop)]: EXPR  

Returns T if {\it prop} is found (whence removed), NIL else.
Only the first occurrence of the {\it prop} property is removed
from the monomial property list of {\it augmon}.


\end{description}



There are a lot of low level procedures working with the monomials, normally
not available to the user directly, including all type of converters. 
The reader can find more details about monomials in the section \ref{monomials}.

Now let us discuss the polynomials. Here we have a variety of choices.
 Mostly it depends on the different choices for the coefficients. 
Formally a polynomial is nothing else than a list of monomials with the
coefficients. The trouble is that for the efficiency reasons we do not want
to have complicated coefficients, such as fractions. On the other hand one
 want them sometimes
rather in multiplicative than in additive form. 

Let us start from the fractions.
Recall that  there are two fundamental mathematical 
concepts for the polynomials,
the coefficient field and the coefficient domain. We always assume
that the polynomial base ring is a (commutative) field. The
\index{coefficient domain} coefficient domain may consist of the entire 
field, or of a proper
subring such that the coefficient field is its field of fractions.
A good example is the set of  integers {\bf Z} as a domain for the rational numbers {\bf Q}.

Recall also that two polynomials are associated if one of them is
obtained from another by the multiplication
 with some non-zero constant. 





 Most polynomials encountered in Gr\"{o}bner reductions are
defined ``up to association'' and thus may be represented as
"domain polynomials", polynomials all whose coefficients
belong to the coefficient domain.  For example we take
 a polynomial $f(x)=2x^2-3xy+5y^2$ as a polynomial, representing
a monic polynomial  $g(x)=x^2-\frac{3}{2}xy+\frac{5}{2}y^2.$ It
does not matter from the Gr\"obner basis point of view - they have the same
 leading monomial, but the first one is much more easy to work with.


 Therefore it is sufficient to use
coefficient domain elements to check if the given monomial is normal. 
We need, of course, the field elements when we want to get a normal form
of the given element, but we can get it ``up to association'' too, using
coefficient domain elements only. This is sufficient for the most important
question:
is a given element  equal to zero in the factor-ring? That is why in {\bf bergman}
we use mainly "domain polynomials".




But sometimes  general polynomials (where the coefficients are any field
elements) must be considered e.g. when we need to print this normal form
or  in some resolution
calculations. But even in this case internally it is much more convenient
to have the polynomial, represented as "domain polynomial" and corresponding
factor from the field, ``correcting'' this polynomial.
 So $g(x)$ above will be represented as a pair $\left(\frac{1}{2},f(x)\right),$ 
because $g(x)=\frac{f(x)}{2}.$

More formally, a general polynomial may always be factorised into a
product of a domain polynomial and one general field element.
The internal representation of the polynomial corresponds to
this, being a "quotient polynomial" (qpol) with one pure
polynomial part and one "quotient" part. 
The quotient is
of the ratio coefficient type. 

But even  domain polynomials have  different forms in {\bf bergman}.
 

Internally, domain polynomials are represented in two ways,
as reductand polynomials \index{redand} (redands) or as \index{redor} 
reductor polynomials
(redors). The difference is not as the difference between ``and'' and ``or'',
but rather 
as the  difference between ``operand'' and ``operator'' or  may be better to
say as a difference between ``summand'' and ``multiplicator''. Redands
have redand coefficients and redors have redor coefficients. 
What is the difference?
Redands are what we expect from the coefficient
 representation, but redors have form, more convenient for the multiplication.

Let us consider first an example. Suppose that our main field is $F_5$ and we consider
a representation of the polynomial $x^2+3xy+2y^2.$

In the redand form it will be represented as a list
$$(P\ (1\ \langle x^2 \rangle)\ (3\ \langle xy \rangle)\ (2\ \langle y^2 \rangle)),$$
where $P$ stands for a pointer which we do not discuss now, $\langle x^2 \rangle$
stands for  representation  of the pure monomial $x^2$ as it was discussed above.
But just now we are interested in the coefficients. $1,3,2$ are exactly what
 we expect. What we do not expect from the very beginning is that in the redor 
form the same polynomial will be written as
$$(P\ (0\ \langle x^2 \rangle)\ (3\ \langle xy \rangle)\ (1\ \langle y^2 \rangle)).$$



What does it mean? Recall that $2$ is a primitive element in $F_5$,  
so $$2^0=1, 2^1=2,2^2=4, 2^3=3$$ and all non-zero elements in $F_5$ can be
represented by the corresponding logarithms. So, we can represent our
elements in two different ways according to the table:
$$\begin{tabular}{|l|ccccc|}
 \hline
 & 0 & 1 &2 &3 &4\\
\hline
Normal representation & NIL & 1  &2 &3 &4\\
Logarithmic   representation & NIL & 0  &1 &3 &2\\
\hline
\end{tabular}$$

and it is quite clear now that redor polynomials use lo\-ga\-rithmic 
representation in this case.

More exactly redors coefficients are written in the form that is more 
convenient for the multiplication in the corresponding domain. In reality
it differs now from the redand coefficients only in the case when we work in
odd prime characteristics with the logarithmic tables. So practically the
user can skip to think about the inner representation of redors and redands,
but it is useful to say a pair of words in what role they are used.




 

Redands may be reduced by means of redors. So,
the Gr\"obner basis elements are redors.
 (Mathematically, the result of a
reduction step need not be a domain polynomial; however,
there are always associated domain polynomials to the
result.) In general, the redands are more ephemeral.
(In a good memory handling, the redors might be stored in
blocks which not so often were garbage collected. In the
present implementation, they are not.) The coefficients may
be represented in quite different manners. They should
be non-zero; any procedure which logically could yield a
zero polynomial should yield NIL instead of this, and NIL
should not be used as valid input to any procedures
expecting redand or redor arguments. 

Zero polynomial is always represented as NIL. 
A (redand or redor) term should always be non-zero. Different
terms in the same redand or redor should never contain the same
monomial.



A polynomial also can be pure or augmented.
 A pure (reductand or reductor) polynomial consists of terms,
which consists of (reductand or reductor) coefficients, and
(augmented) monomials. 

 An augmented (reductand or reductor) polynomial consists of a
pure polynomial and a polynomial `priority'. An 'augmented'
quotient polynomial consists of a pure polynomial and a
quotient, it is the same as a quotient
polynomial. The quotient is
of the ratio coefficient type (with reductand coefficients
for the numerator and the denominator parts).

The important procedures working with the polynomials and their
redor/redand coefficients are:
 \begin{description}
\index{algforminput} \item [(ALGFORMINPUT)]: EXPR

  Scans the succeeding input for variable lists and/or polynomial
input on ALG form; 

\index{lispforminput} \item [(LISPFORMINPUT)]: EXPR

  Scans the succeeding input for variable lists and/or polynomial
input on Lisp form;

\index{normalform} \item [(NORMALFORM ratpol)] : EXPR

  Changes its argument to the ratpol representation of the normal form
of its input (with respect to GBasis). Returns NIL if the normal form
is zero, its changed argument else.

%\index{polalgout} \item [(POLALGOUT InternalFormPolynomial)]: EXPR

%  Prints its argument (an internally represented polynomial), in
%algebraic form if the appropriate settings are done, else in 
%Lisp form.

%\index{polintern} \item [(POLINTERN LispFormPolynomial)]: EXPR

 % Changes its argument from a Lisp form polynomial to a polynomial
%in the appropriate internal representation, and returns the
%changed polynomial if it is non-zero; else it returns NIL.

Warning: The output polynomial may not be a printable lisp object.

\index{qpolmonmult} \item [(QPOLMONMULT ratpol puremon)] : EXPR

  Returns a ratpol representation of the product of ratpol
and puremon (in this order), without changing its arguments.

\index{redand2lispout} \item [(REDAND2LISPOUT Reductand-Polynomial)]: EXPR

  Produces a Lisp form of its argument, without changing the
argument.
\index{redandcf procedures}

\item [(REDANDCF!+)]:EXPR
\item [(REDANDCF!-)]:EXPR
\item [(REDANDCF!-!-)]:EXPR
\item [(REDANDCF!*)]:EXPR
\item [(REDANDCF!/)]:EXPR
\item [(REDANDCFREMAINDER)]:EXPR
\item [(REDANDCFDIVISION)]:EXPR

Each of these EXPRs take one or two redandcoeffs as input, and
perform the operations addition, negation ( = ''unary minus''),
subtraction, multiplication, truncated division, taking of remainder
with respect to truncated division, and lastly performing both these
operations at once  returning CONS of the resulting truncated
quotient and the remainder).  The output is a redandcoeff (or a
dotted pair of such), with NIL representing zero in the output; zero
input is not permitted.


Using these procedures in most cases would be very slow compared
to ordinary operations; thus they should be avoided.

 \item [(REDANDCFNEGATIVE)] : EXPR

    Returns T if there is a meaningful concept of "negativity" in the
    coefficient domain and Cf is negative; NIL else.

\index{redandmonmult} \item [(REDANDMONMULT augredand puremon)] : EXPR

  Returns the augredand representation of the product of augredand
and puremon (in this order), without changing its arguments.

\index{redor2lispout} \item [(REDOR2LISPOUT Reductor-Polynomial)]: EXPR

  Produce a Lisp form of its argument, without changing the
argument.



\index{ratcf} \item [(RATCF!- Cf)]: EXPR

  Performs negation ( = unary minus).

\index{shortenratcf} \item [(SHORTENRATCF Cf)]: EXPR

Changes {\it Cf} to a "simple" representative for the same coefficient
    field element, and returns this changed input. (Thus destructive.)
    If the coefficient domain comprises an algorithm for calculating greatest
    common divisors, the "simple" representative may be achieved by factoring
    out the GCD of the numerator and the denominator parts from both.

\index{integerise} \item [(INTEGERISE Line)]: EXPR

Each (non-NIL) ratcoeff in {\it  Line} is replaced by a redandcoeff,
    representing some $c$ times the element which the ratcoeff
    represents, using the same $c$ for the whole list. Returns $c.$
    
\index{cfmonredandmult}
 \item [(CFMONREDANDMULT Cf  Mon Pol)]: EXPR

augredand $:= Cf*Mon*Pol$ (non-destructively and in this order).
\end{description}

The following procedures are converters between different forms and
printing procedures:

 \begin{description}
\index{lisppol2input} \item [(LISPPOLS2INPUT)]: EXPR
\index{lisppol2redand} \item [(LISPPOL2REDAND)]: EXPR
\index{redand2lisppol} \item [(REDAND2LISPPOL)]: EXPR
\index{redor2lisppol} \item [(REDOR2LISPPOL)]: EXPR
\index{qpol2lisppol} \item [(QPOL2LISPPOL)]: EXPR
\index{output2lisppols} \item [(OUTPUT2LISPPOLS)]: EXPR
\index{redandalgout} \item [(REDANDALGOUT)]: EXPR
\index{redandalgin} \item [(REDANDALGIN)]: EXPR
\index{redoralgout} \item [(REDORALGOUT)]: EXPR
\index{redoralgin} \item [(REDORALGIN)]: EXPR
\index{qpolalgout} \item [(QPOLALGOUT)]: EXPR
\index{printqpolratfactor} \item [(PRINTQPOLRATFACTOR)]: EXPR
\index{printratfactcf} \item [(PRINTRATCF)]: EXPR
\end{description} 


\section{Controlling the calculations process}



In this section we will list the top level procedures that may be
 used to control the calculations process if the user plans to change some
standard
procedure. It is recommended to see first to the existing ones, because they
may  contain some nontrivial hints. But to understand them the
 user should be familiar with the
 procedures described here.

   \vspace{0.3cm}
\begin{center} {\bf \large Main cycle}\end{center}


\begin{description}

\index{groebnerinit} \item [(GROEBNERINIT)]: EXPR

  Initiates various internal global variables, et cetera, before
running GROEBNERKERNEL. It should be called {\it after} selecting modes
and performing input.

(The reason why this is not a part of GROEBNERKERNEL, is that for
some specialised applications (like reading in a partial Gr\"{o}bner
basis and continuing calculations from some high degree) one might
want to hand-set these variables.)

\index{groebnerkernel} \item [(GROEBNERKERNEL)]: EXPR

  Performs the main calculations. Should (normally) be preceded by
GROEBNERINIT and succeeded by GROEBNERFINISH.

\index{groebnerfinish} \item [(GROEBNERFINISH)]: EXPR

  Concludes the calculations; closes the DEGREEOUTPREPAREd file, if any;
print out the entire basis, if DEGREEOUTPREPARE was not called and
printing is customised; set some variables.

(Not a part of GROEBNERKERNEL for reasons similar to those for
GROEBNERINIT.)

\index{clearideal} \item [(CLEARIDEAL)]: EXPR

  This removes MOST remaining memories of former calculations, such
as remaining input, calculated (partial) Gr\"{o}bner basis, and
remaining critical pairs. It does not change the modes, nor the set
input or output variables or embedding dimension.

\index{clearring} \item [(CLEARRING)]: EXPR

A more powerful function than {\bf clearideal}, which clears also the
list of input and output variables and their weights.


\index{calctolimit} \item [(CALCTOLIMIT PositiveInteger)]: EXPR

  Continues the calculations different from Gr\"obner basis calculations
until the given degree. Is used for the calculating Betii numbers or Hilbert
series when  Gr\"obner basis maximum  degree is less than desired degree.
\end{description}

   \vspace{0.3cm}
\begin{center} {\bf \large SAWS cycle}\end{center}


\begin{description}
\index{staggerinit} \item [(STAGGERINIT)]: EXPR

  Used in the SAWS mode for some extra initiations (after GROEBNERINIT,
STAGTYPECHECKER, and AUTOREDUCEINPUT, but before STAGGERKERNEL).

\index{staggerkernel} \item [(STAGGERKERNEL)]: EXPR

  The SAWS mode replacement of GROEBNERKERNEL.

\index{staggerfinish} \item [(STAGGERFINISH)]: EXPR

  The SAWS mode replacement of GROEBNERFINISH.

\index{stagtypechecker} \item [(STAGTYPECHECKER)]: EXPR

  Used in the SAWS mode for some mode settings.

\index{autoreduceinput} \item [(AUTOREDUCEINPUT)]: EXPR

  This is used in the SAWS module, in order to auto-reduce the input
(after reading in but before starting the Gr\"{o}bner or SAWS basis
calculation). It is unnecessary with the ordinary algorithms. If you
are in SAWS mode and {\it know} that your input is auto-reduced anyhow,
you may omit it.


\end{description}


   \vspace{0.3cm}
\begin{center} {\bf \large Manipulations in the current degree}\end{center}


\begin{description}

\index{getcurrentdegree} \item [(GETCURRENTDEGREE)]: EXPR

  Returns the "current degree" (which is ordinarily set within the
Gr\"{o}bner basis routines), the total degree presently or last
under Gr\"{o}bner basis extension consideration. (Initially and
immediately after the CLEAR\-IDEAL, the current degree is NIL.)

\index{setcurrentdegree} \item [(SETCURRENTDEGREE int)]: EXPR

  For very special applications only, this procedure provides the
user the possibility to set the internal "current degree" to {\it int,}
which must be a non-negative integer or nil. (Cf. GETCURRENTDEGREE.)

 WARNING: Changing the current degree in the middle of 
calculations, or during succeeding series calculations to higher
degrees, might cause rather weird results.

\index{degreeoutprepare} \item [(DEGREEOUTPREPARE file-name)]: FEXPR 

(The argument is optional.)

  Redirects output to be performed degree by degree (by DEGREEOUTPUT
if printing is customised), by turning on DEGREEPRINTOUT. If given a
file-name argument, and the file doesn't exist, output by
DEGREEOUTPUT is directed to that file.

\index{enddegreeoutput} \item [(ENDDEGREEOUTPUT)]: EXPR

  Prints ''Done'', and closes the Gr\"{o}bner basis output file (if any)
opened with DEGREEOUTPREPARE.
 Is automatically called at the end of calculation of the entire
Gr\"{o}bner basis, if DEGREEPRINTOUT is on but there is no printing 
customisation.

\index{tdegreecalculatepbseries} 
\item [(TDEGREECALCULATEPBSERIES PositiveInteger)]: EXPR

  Only works if the associated monomial ring Poincare-Betti series has
been calculated, but only to some degree less than PositiveInteger.
It then causes a continued calculation up to and including
PositiveInteger. (It returns NIL; use other ways of seeing the
result.)



\end{description} 


   \vspace{0.3cm}
\begin{center} {\bf \large Automatic   relations adding  }\end{center}
 
\begin{description}
\index{autoaddrelationstate} 
\item [(AUTOADDRELATIONSTATE)]: EXPR

Informs if the  automatic  relations adding  mode is chosen.

\index{autoaddrelationstate} 
\item [(SETAUTOADDRELATIONSTATE state)]: EXPR

Sets the  automatic  relations adding  mode state  to the given value.

\index{autoaddrelations} 
\item [(AUTOADDRELATIONS)]: EXPR

Sets  the  automatic  relations adding  mode.

\index{cancelautoaddrelationssettings} 
\item [(CANCELAUTOADDRELATIONSSETTINGS)]: EXPR
Cancels  the  automatic  relations adding  
for the current moment, but does not turn off
the mode completely. 

\index{noautoaddrelations} 
\item [(NOAUTOADDRELATIONS)]: EXPR

Cancels  the  automatic  relations adding  mode completely.

\index{addalgforminput} 
\item [(ADDALGFORMINPUT)]: EXPR

New set of polynomials in algebraic form is added to those already saved in InPols.

\index{addlisppols2input} 
\item [(ADDLISPPOLS2INPUT)]: EXPR

New set of polynomials is added to those already saved in InPols.

\index{addlispforminput} 
\item [(ADDLISPFORMINPUT)]: EXPR

New set of polynomials in LISP form is added to those already saved in InPols.
   

\index{factalgadditionalrelations} 
\item [(FACTALGADDITIONALRELATIONS {\it ll})]: EXPR

Adds special relations to the list{\it ll.}

\index{hochadditionalrelations} 
\item [(HOCHADDITIONALRELATIONS {\it ll)}]: EXPR

Adds  special relations to the list {\it ll.}

\end{description}

   \vspace{0.3cm}
\begin{center} {\bf \large Input and output}\end{center}
 
\begin{description}
\index{addalgoutmode} \item [(ADDALGOUTMODE ]
  mode-name bop+ bop- ip+ ip- ip* ip$\verb-^-$ eop bol eol): FEXPR

  If mode-name is not a recognised algebraic output mode name (to which
you can set ALGOUTMODE), mode-name is added to the list of such names.
The seven first of the remaining arguments are used in printing
polynomials in this mode; the two last are at present only used in some
specialised series output printing. The mnemonics are:

 bop (eop) = beginning (end) of polynomial,
 
 ip = within a polynomial,
 
 bol (eol) = beginning (end) of list.
 
When a polynomial is output in mode mode-name, first bop+ or bop-
(depending on the sign of the first coefficient) is printed; then
the absolute value of the first coefficient, followed by ip*, if
this absolute value is not 1; et cetera. The polynomial is ended by
eop. (In {\it alg} mode, this has the bad effect of letting a comma
follow also the last polynomial.)

\index{exptsprintmode} \item [(EXPTSPRINTMODE)]: EXPR   

Chooses print  mode with the collecting of  the common factors to exponents.

\index{noexptsprintmode} \item [(NOEXPTSPRINTMODE)]: EXPR

Chooses print  mode when each factor is printing separately.

\index{bigoutput} \item [(BIGOUTPUT)]: EXPR

  Causes the printing of the calculated Gr\"{o}bner Basis, in LISP form
if {\bf algoutmode} has not been set to {\it alg}, 
{\it macaulay}, or a user defined
algebraic output mode. (See also {\bf addalgoutmode}.)

\index{degreeenddisplay} \item [(DEGREEENDDISPLAY)]: EXPR (User defined option.)

  Since control over output seems to be a very much wished possibility,
the user is given the option of defining his/her own degree-wise
output procedure. This procedure is performed after the calculation
of one degree, if we are in the customised displaying mode. 
It then replaces other
output; but you may call (e.g. DEGREEOUTPUT within it, see \ref{cust}
for details.) 

\index{degreepbseriesdisplay} \item [(DEGREEPBSERIESDISPLAY)]: EXPR

  Prints the last degree item on DEGREEPBSERIES in an algebraic
format, using the TDEGVARIABLE and HDEGVARIABLE values as names
for the total degree and the homological degree variables,
respectively.

\index{degreeoutput} \item [(DEGREEOUTPUT)]: EXPR

  Performs output of the newly calculated Gr\"{o}bner basis elements (of
the current degree). If DEGREEOUTPREPARE has been given a file name
argument, output is directed to that file.

Is automatically called at the end of calculations for each degree,
if DEGREEPRINTOUT is on but the printing process is not customised.




\index{ncpbhded} \item [(NCPBHDED)]: EXPR

  The DEGREEENDDISPLAY alternative definition used by\\ NCPBHGROEBNER.

\index{ncpbhdd} \item [(NCPBHDD)]: EXPR

Acts analogously  as  the previous one in the case 
when Gr\"obner basis is not printed.

\end{description}
   \vspace{0.3cm}
\begin{center} {\large \bf Working with variables lists}\end{center}

\begin{description}
\index{ALGOUTLIST} \item [(ALGOUTLIST listnvars)]: EXPR

Prepares variables to the algebraic form output.

\index{getvarno}
 \item [(GETVARNO)]: EXPR

Gives the number of variables in the input (embedding dimension).

\index{setvarno} 
\item [(SETVARNO (inum))]: EXPR

Sets the embedding dimension. Dangerous, but
useful when Lisp form input was done and we need series calculations
(e.g. in a free algebra, when there was no relations in the input). 

\index{clearvarno}
 \item [(CLEARVARNO)]: EXPR 

\index{INITVARNO}
\item [(INITVARNO u)]: EXPR 
Two (dangerous!) procedures to change embedding dimension interactively. 

\end{description}


   \vspace{0.3cm}
\begin{center} {\large \bf Specific Anick procedures}\end{center}


\begin{description}

\index{preparetoanick} \item [(PREPARETOANICK)]: EXPR

Switches several flags to the values necessary for Anick resolution 
computation.

\index{anickres} \item [(ANICKRES)]: FEXPR

Similarly with the  previous one switches flags and checks the correctness
of the input file in the case when input is performed by meaning of a file.




\index{printbettinumber} \item [(PRINTBETTINUMBER btnumber)]: EXPR

Prints Betti number {\it btnumber} as follows:
                         
B(homological degree, total degree) = value

\index{printbetti} \item [(PRINTBETTI)]: EXPR

 Prints all the calculated  Betti numbers,
          applying  the procedure {\bf printbettinumber}  to all elements of the
          anBETTINUMS list.

\index{printcurrentbetti} \item [(PRINTCURRENTBETTI)]: EXPR

Prints Betti numbers for the last calculated Gr\"obner basis
          degree (applying the procedure PRINTBETTINUMBER to all elements of the
          anCURRENTBETTINUMS list)

\index{macbettiprint} \item [(MACBETTIPRINT)]: EXPR

Prints Betti numbers in Macaulay form. Returns boolean value T.

\index{settenspolprtstrings} \item [(SETTENSPOLPRTSTRINGS {\it strings})]: EXPR

The list {\it strings} should consist of 3 strings which are
          used to print tensor product. First string is printed
          at the beginning, second - as a tensor multiplication sign
          and the third - as the ending of thensor monomial.
          The list of 3 strings of old settings is returned.

\index{gettenspolprtstrings} \item [(GETTENSPOLPRTSTRINGS)]: EXPR

Returns a list of 3 strings which are used when tensor
          monomials are printed as beginning, middle and ending
          strings.
\index{setedgestring} \item [(SETEDGESTRING strng)]: EXPR

The string {\it strng} is taken for printing as edges when chain
          vertexes are printed. The old value of it is returned.

\index{getedgestring} \item [(GETEDGESTRING)]: EXPR

Returns the value of string which is printed between chain
          vertexes.
\index{printnewchainsdiff} \item [(PRINTNEWCHAINSDIFF chan)]: EXPR


Prints differentials for the new generated chains
          to the channel {\it chan}.

\index{printchainsdiff} \item [(PRINTCHAINSDIFF chan)]: EXPR

Prints differentials for the all generated chains
          to the channel {\it chan}.

\index{prtchndiff} \item [(PRTCHNDIFF inchain)]: EXPR 

Prints differential for the chain {\it inchain} in form\\
             D (chain length, chain) = differential

\index{getbettinums} \item [(GETBETTINUMS)]: EXPR

 Returns the list of Betti numbers.

\index{getbtorder} \item [(GETBTORDER btnumber)]: EXPR

 Returns the order of Betti number {\it btnumber.}

\index{getbtdegree} \item [(GETBTDEGREE btnumber)]: EXPR

 Returns the degree of Betti number {\it btnumber.}

\index{getbtvalue} \item [(GETBTVALUE btnumber)]: EXPR

 Returns the value of Betti number {\it btnumber.}



\index{clearresolution} \item [(CLEARRESOLUTION)]: EXPR

 Calls ResolutionDone and ResolutionClear procedures.

\index{anickdisplay} \item [(ANICKDISPLAY )]: EXPR

Prints the Betti numbers into the result file.

\index{calculateanickresolutiontolimit} 
\item [(CALCULATEANICKRESOLUTIONTOLIMIT limdeg)]: EXPR

Continues the process of Anick resolution calculation up to
          the degree {\it limdeg.} It maybe called after the Gr\"obner basis is
          calculated, in case it is finite and calculations stopped
          at a lower degree than that to which the Anick resolution
          should be calculated.

\index{printchain} \item [(PRINTCHAIN chain)]: EXPR

Prints {\it chain.}  The vertices are printed as monomials
          (corresponding to the present ALGOUTMODE and minor output
          mode settings). If PRINTEDGESTRING is ON, then between
          vertices it prints the value of anEDGESTRING.



\index{prettyprintsdp} \item [(PRETTYPRINTSDP pol)]: EXPR

Prints the semi-distributed polynomial {\it  pol} in a form decided by
        the tensor polynomials print-mode. 
(See {\bf gettenspolsprintmode}).

\index{printtensorpolsdistributed} \item [(PRINTTENSORPOLSDISTRIBUTED)]: EXPR

Selects distributed form for printing semi-distributed
        polynomials.

\index{printtensorpolssemidistributed} \item [(PRINTTENSORPOLSSEMIDISTRIBUTED)]: EXPR

Selects semi-distributed form for printing semi-distributed
        polynomials.

\index{gettensorpolsprintmode} \item [(GETTENSORPOLSPRINTMODE)]: EXPR

Returns the identifier which is a keyword either DISTRIBUTED
        or SEMIDISTRIBUTED. This identifier points out how the current
        semi-distributed polynomials are printed.


\end{description}


  \vspace{0.3cm}
\begin{center} {\bf \large Procedures for Syzygies and Minimal resolution}\end{center}
\label{puresyz}
\begin{description}

\index{puresyzygies} \item [ (PURESYZYGIES (varsetup modlist) )]: EXPR

Procedure to calculate Gr\"obner basis  for module of syzygies in a free module. 

 Takes ring relations, saved in the global variable {\bf tmplist} in LISPFORM
 and elmetns of a free module, given in the second parameter {\bf  modlist} (also
 in the LISPFORM) and  generates new names for those elements.

 It is supposed that the 
 ring and module variables and the corresponding
 weights  are already introduced. Weights are mandatory! All this information is saved in the first parameter {\bf varsetup}.

 Special global values for indices in the list ov variables
{\bf ind1start ind1finish,ind21start, ind2finish} are already choosen,
{\bf MAXDEG,  NMODGEN}  are already known
 (but we may be in the situation after {\bf clearring}).

 The procedure puts new names between the ring and module variables.
 That is why it should change the inner numbering in all monoms.
 After that it calcultes GB and give as result only those elements
 of GB which starts from the new names.

\index{minr} \item [ (MINR (files) )]: FEXPR
  
 Procedure to calculate   Poincare-Betti numbers for a graded right 
module over non-commutative algebra using the minimal resolution. See
 section \ref{minres} for details.

\end{description} 


   \vspace{0.3cm}
\begin{center} {\bf \large Some linear algebra procedures}\end{center}


\begin{description}

\index{mprint} \item [ (MPRINT mat)]: EXPR

Prints {\it mat} as a matrix to standard output and returns T, if
          that is not NIL. Else it prints nothing and returns NIL.

\index{cflineprint} \item [(CFLINEPRINT {\it ln})]: EXPR

 Prints the list of coefficients {\it ln} in one line and returns
          T if{\it ln} is non-NIL. Else it prints nothing and returns NIL.

\index{rank} \item [(RANK mat)]: EXPR
Returns the rank of  {\it mat} calculated in present coefficient
          field.
\index{inputmatrix2redandmatrix} \item [(INPUTMATRIX2REDANDMATRIX mtrx)]: EXPR

Modifies the elements of {\it  mtrx} so that their type is of
          acceptance by further procedures.

\index{member2nil} \item [(MEMBER2NIL element list)]: EXPR

Searches {\it list} for its first occurrence of {\it element}.
          If found, the occurrence is (destructively) replaced by
          NIL, and the number of the position of element in {\it list} is
          returned. If element is not found in {\it list,}  NIL is returned.
\end{description}

   \vspace{0.3cm}
\begin{center} {\bf \large Some Filter Procedures}\end{center}

Sometimes the user needs to manipulate lists of polynomials (e.g. obtained Gr\"obner basis) and search some specific subsets, in other words to filter it.
Here  is a list of some useful procedures already written in {\bf bergman}, which can also serves as examples for own filter procedures. All of them are designed to work in the non-commutative case with the lists in the LISP form, so the user can print and easy manipulate them using own procedures. But to use them in the internal  {\bf bergman} procedures the lists first should be converted into appropriate form - see section \ref{monomialsand} for the details.

\begin{description}


\index{oneletterfilter} \item [( ONELETTERFILTER lst)]: EXPR

 The procedure consider the leading monomials
 of the list of polynomials in the LISP form 
 and creates another list that contains only those polynomials
 were this monomial is not  constant multiplied by single variable. Not destructive.

\index{pbsoneletterfilter} \item [( PBSONELETTERFILTER lst)]: EXPR

The same filter, but reduce the global variable PBS for every 
skipped polynomial.
\index{firstletterfilter} \item [( FIRSTLETTERFILTER lst m n  )]: EXPR

 The procedure consider the first variable of the leading monomials
 of the list of polynomials in the LISP form 
 and creates another list that contains only those polynomials for
  which the index of this letter (in the list of variables)is  between m and n. Not destructive.

 \index{gbleadmonfilter} \item [(GBLEADMONLFILTER  lst)]: EXPR
 Procedure that filter a list of polynomials(in LISP FORM) and gives as result
 the list consisting of those polynomials which leading monomial are not
  leading monomials of  Gr\"obner basis elements. Not destructive.  

\end{description}

   \vspace{0.3cm}
\begin{center} {\bf \large Local control}\end{center}


\begin{description}


\index{bigarithp} \item [(BIGARITHP)]: EXPR

  ''Big Arithmetics Property''. Should return T if big arithmetics work,
NIL else.


\index{calcreductorpriority} \item [(CALCREDUCTORPRIORITY augmon)]: EXPR

  When this procedure is called, the pointer of the input monomial
is set to a new Gr\"{o}bner basis element. The procedure should
return an integer. Such 'priority' integers later may be used in
order to compare Gr\"{o}bner basis elements in order to decide which
one of them to employ in a reduction. A Gr\"{o}bner basis element
with lower 'priority number' is preferred.

By redefining this procedure, the user thus may influence the
reductions of other polynomials, and the choices of what critical
pairs to consider.

(It should be noted, however, that 'priority comparisons' are made
only in some situations.)


\index{inpols2gbasis} \item [(INPOLS2GBASIS)]: EXPR

If a gbasis is read in (as InPols), it is moved to GBasis.
You then may make a new input, and start reducing.


\end{description}





\section{The commutative Hilbert series procedures} \label{comHS}

This section  contains information for the user about the 
commutative Hilbert series procedures.

There are two main uses for the \index{Hilbert series} 
Hilbert series facilities: Stand alone
and within the Hilbert series \index{interrupt strategy} interrupt
  strategy minor mode. In the
former case, you may get the Hilbert series of the residue class
ring modulo a calculated Gr\"obner basis or some user input
monomial ideal, as a rational expression $ \frac {p(t)}{(1-t)^{-q}}$, or with
the power series coefficient for some specified $t$ degree(s). In
the latter, you should communicate a Hilbert series limitation to
the programme; it will automatically invoke the appropriate Hilbert
series calculations.

In either case, you may wish to inspect resulting series in situ
(especially as there are few prepared good user interface procedures
for this). You then should note that the global variables
HILBERTNUMERATOR and HILBERTDENOMINATOR represent a calculated

$$ \frac {p(t)}{(1-t)^{-q}}=\frac{a_{n}t^{-n} + a_{n-1}t^{-(n-1)} +
\cdots + a_{0}}{(1-t)^{-q} }$$
by (the lisp items)  $ ((n\  .\  a_{n}) (n-1\  .\  a_{n-1})
\ldots (0\  .\  a_{0}))$  and   $ q$,
respectively.


 A principal use of Hilbert series calculation is with the Hilbert
series interrupt strategy (which is based on ideas by Ralf Fr\"oberg). You then
should provide a Hilbert series limitation. The limitation should be
a representation of a function f from the set {\bf N} = \{0,1,2,...\} to the
union of {\bf N} and the set \{{\it nil, t, skipcdeg}\} of lisp constants. The
default limitation function has the constant value {\it nil} for each
input. You may change the function with the {\bf SETHSERIES}  procedures,
and you may inspect the current limitation function or part thereof
with the {\bf GETHSERIES}  procedures, as explained below.

When {\bf bergman} is in the Hilbert series interrupt strategy minor mode
and is about to start considering a new current degree $d$ within the
{\bf GROEBNERKERNEL} execution, it extracts the limitation function value
$f(d)$ and proceeds as follows:
\begin{itemize}
\item If $ f(d)$ is {\it nil}, then {\bf GROEBNERKERNEL} follows "procedures as
    usual" for the current degree $d$ (with no non-ordinary
   constraints on the calculations).
\item If $ f(d)$ is {\it t}, then {\bf GROEBNERKERNEL} is exited without any further
   calculations. (Thus we get an effect similar to a MAXDEG
  setting, but probable with some unnecessary critical pair
  calculation performed on degree $d$ or higher.)
\item   If $f(d)$ is {\it skipcdeg}, then the current degree $d$ is "skipped":
  critical pairs and input polynomials of degree $d$ are removed,
  as if they (or the corresponding S--polynomials) were found to
  reduce to zero. (A new test is made for the next occurring
  degree.)
\item   If $f(d)$ is a non-negative integer, then calculation at degree
  $d$ continues only until either all input polynomials and
  critical pairs of degree d are processed, or the associated
  quotient ring Hilbert series value for $d,$ i.e., the vector
  space dimension of the degree $d$ component of the factor-ring of 
the current polynomial ring modulo the ideal generated
  by the leading monomials of all (partial) Gr\"obner basis
 elements found so far, no longer exceeds $f(d)$; the the
 remaining input polynomials and critical pairs of degree $d$
 (if any) are skipped (like in the {\it skipcdeg} case). 
\end{itemize}

An $f(d)$  value either may be specified explicitly, or be calculated
by a default expression. The latter may be a constant (an integer
or one of {\it nil, t} and  {\it skipcdeg}) or is considered as the definition
part of a lisp EXPR with the single argument  {\it hsdeg}. An explicitly
specified value takes precedence over a default one. An example of the
default expression is the following:

\begin{verbatim}
        (COND ((GREATERP HSDEG 10) T)
              ((LESSP HSDEG 3) SKIPCDEG)
              (T (PLUS HSDEG 2)))
\end{verbatim}

will make $  f(0) = f(1) = f(2) = SKIPCDEG,$
$  f(3) = 5, \,.\,.\,. , f(10) = 12,$ 
and $  f(d) = T$  for all other legitimate $d$ values, except for those $d$
for which explicit values are given.

\vspace{0.4cm}

\begin{center} {\large \bf Available high level procedures}\end{center}
 
\begin{description}
  
\index{calcpolringseries} \item [(CALCPOLRINGHSERIES varno)] : EXPR

 Initialises \index{hilbertnumerator} HILBERTNUMERATOR and
 \index{hilbertdenominator}  HILBERTDENOMINATOR values to
those for the present polynomial rings. Right now, varno isn't
used; instead, the numbers of variables is extracted by means
of GETVARNO.

\index{calcrathilbertseries} \item [(CALCRATHILBERTSERIES)] : EXPR

  Uses the calculated (full or partial) Gr\"obner basis in order to
calculate the Hilbert series for the factor-ring modulo
the ideal generated by the leading monomials of the basis elements.
 Errs if no (partial) Gr\"{o}bner basis is stored in GBasis.

\index{clearpbseries} \item [(CLEARPBSERIES)] : EXPR

Sets all series variables to {\it nil}.

\index{pbinit} \item [(PBINIT)] : EXPR

Sets constant and linear terms for all series variables.

\index{gbasis2hseriesmonid} \item [(GBASIS2HSERIESMONID)] : EXPR

  Creates a special kind of lisp form representation of the
monomial ideal generated by the leading monomials of the
calculated (full or partial) Gr\"{o}bner  basis. The format is a
(printable) list of flagged monomials (FMon's), as described in
the introduction to the source file hseries.sl.

\index{gethseriesminima} \item [(GETHSERIESMINIMA)] : EXPR

  Extracts the full information about the pre-stored Hilbert
series limitation, in a printable format acceptable as input to
SETHSERIESMINIMA.

\index{gethseriesminimum} \item [(GETHSERIESMINIMUM tdeg)] : EXPR

  Extracts the information about the pre--stored Hilbert series
limitation for degree tdeg, as an integer or as one of the
constants NIL, T, and \index{skipdeg} SKIPCDEG. ({\it tdeg} must be a non-negative
integer; else, rather weird errors may occur.)

\index{sethseriesminima} \item [(SETHSERIESMINIMA)] : FEXPR

  Specifies the Hilbert series limitations, as a sequence of
dotted pairs or as a list of limitation constants, in either
case optionally accompanied by a DEFAULT setting. In the
dotted pair variant, each dotted pair antecedent ("CAR part")
should be a non-negative integer or the identifier DEFAULT;
the postcedent ("CDR part") when the CAR is an integer d
should be the limitation for d (i.e., a non-negative integer
or one of the constants NIL, T, and SKIPCDEG), and when
the CAR is DEFAULT it should be of the
SETHSERIESMINIMUMDEFAULT input form. In the sequence case,
the items are considered as CDR parts corresponding to
CAR parts 0, 1, 2, \ldots  (in this order); everything after
DEFAULT is considered as the DEFAULT CDR part (whether or
not it is on list form). In either case, the default value
or procedure is changed only if a new DEFAULT is specified.

 Example:
\begin{verbatim}
(SETHSERIESMINIMA T SKIPCDEG NIL 6 7 8 9 DEFAULT 8)
\end{verbatim}
and
\begin{verbatim}
(SETHSERIESMINIMA (0 . T) (1 . SKIPCDEG) (2) (3 . 6)
                       (4 . 7) (6 . 9) (DEFAULT . 8))
\end{verbatim}
                       
have the same effects. (Note that in lisp, (2) and (2\  .\  NIL)
are considered as identical.)

\index{sethseriesminimumdefault} \item [(SETHSERIESMINIMUMDEFAULT)] : FEXPR

  Specify the Hilbert series limitation default value or
procedure. (Explicitly specified values for specified
degrees are not changed.)


\index{seriesprinting} \item [(SERIESPRINTING)]: EXPR

Calculates and prints the power series coefficients.

  

\index{tdegreehseriesout} \item [(TDEGREEHSERIESOUT PositiveInteger)]: EXPR

Returns the Hilbert function (i. e. Hilbert series coefficient)
for PositiveInteger (provided adequate series calculation up to
that degree is done previously). If necessary, induces calculations
of HILBERTSERIES and INVHILBERTSERIES items.

\index{revertseriescalc} \item [(REVERTSERIESCALC)]: EXPR

  Should be given the last total degree for which series were
 calculated as an argument, or possibly a higher value. If so,
 all effects of (possibly) having calculated the Hilbert series,
 associated monomial ring double Poincare-Betti series, et
 cetera, should be canceled; except induced calculations in
 lower total degrees.
\end{description}


\section{User available flags}\label{flags}

The following flags may be accessed by specific \index{set procedures}
\index{get procedures} SET/GET procedures:
CUSTDISPLAY, CUSTSTRATEGY, DEGREEPRINTOUTPUT, DYNA\-MICLOGTABLES,
 IMMEDIATECRIT, IMMEDIATEFULLREDUCTION, IMMEDIATERECDEFINE,
 NOBIGNUM, PBSERIES, REDUCTIVITY,\\ SAVEDEGREE, SAVERECVALUES.

All others are turned ON and OFF by the procedures with these names.
The flag names should not be quoted. If you need to access the flag
values, you should use the values of the names, preceded by *.
The value NIL means OFF, and T means ON. 


 Examples: You turn the flag FLAG on and off by (ON FLAG) and
(OFF FLAG) respectively if there is no a special switching
procedure.  When FLAG is ON, the value of *FLAG is T.



  If not otherwise indicated, the effect of the flag being ON is described
below.

  The default is OFF, if not otherwise indicated. Sometimes
  mode-changers will affect some flags.

\begin{description}
 
\index{custdisplay} \item [CUSTDISPLAY]\    

  If it is turned on (by the procedure {\bf setcustdisplay})
we get several customised display actions:

\begin{itemize}  
\item  GROEBNERKERNEL exhibits output degree by degree, by means of
  the user customised procedure DEGREEENDDISPLAY. (This is intended for
  customisation. There may exist an exemplifying definition, showing how
  to demand some statistics at each end of degree; if so, you could read
  it with (GETD DEGREEENDDISPLAY).)
\item If furthermore the user has defined CUSTDISPLAYINIT, then this
  procedure (with no argument) replaces the normal displaying initiation
  actions performed when executing GROEBNERINIT. (These normal actions
  are to set NOOFSPOLCALCS and NOOFNILREDUCTIONS to zero.)
\item  If the user has defined CUSTCLEARCDEGDISPLAY, then this procedure
  (with no argument) is called first within a CLEARCDEGREEGKINPUT call.
\item  If the user has defined HSERIESMINCRITDISPLAY and the MINHILBLIMIT
  strategy mode is active, then when this strategy leads to the abortion
  of the rest of the calculations at the current degree (since the last
  possible new Gr\"{o}bner basis element is just found)
  HSERIESMINCRITDISPLAY (with no argument) is called.
\end{itemize}

\index{custstrategy} \item [CUSTSTRATEGY]\ 

  WARNING: Don't turn this ON unless you have familiarised yourself
with the internal programming of bergman!
 If it is turned on and if the user has defined one or several of the
following procedures, calling them supplants the action of the
following procedures (see also \ref{cust}):
\begin{itemize}
  
\item  CUSTNEWINPUTGBEFIND supplants the action of FindInputNGbe;
\item  CUSTCRITPAIRTONEWGBE supplants the action of FindCritPairNGbe;
\item  CUSTENDDEGREECRITPAIRFIND supplants the action of\\ DEnSPairs;
\item  CUSTNEWCDEGFIX supplants the action of FixNcDeg.
\end{itemize}



It is possible to get the 'true' action of the bergman
procedure to be performed, by the 'PROG variable initiation trick'.
Whenever a variable is declared as a PROG variable, it is locally
bound to NIL. Thus e.g. the following bit of Standard Lisp code
\begin{verbatim}
(OFF RAISE)
(DE CUSTENDDEGREECRITPAIRFIND ()
 (PROG  (!*CUSTSTRATEGY)
        <action 1>
        (DEnSPairs)
        <action 2> ))
(ON RAISE)
\end{verbatim}

defines CUSTENDDEGREECRITPAIRFIND in such a way, that when
CUSTSTRATEGY is ON a call to DEnSPairs yields the following effect:
First $<$action 1$>$ is taken, then DEnSPairs is called recursively but
with CUSTSTRATEGY OFF (if $<$action 1$>$ didn't turn it ON), performing
its ordinary action, and last $<$action 2$>$ is taken.


\index{degreeprintoutput} \item [DEGREEPRINTOUTPUT]\ 

  Only influential when the SAWS algorithm is used. Then makes the final
reduced Gr\"{o}bner basis be exhibited degree by degree, with separating
degree annotations, as in `ordinary' degree-wise output. (C.f. SAVEDEGREE.)

\index{dynamiclogtables} \item [DYNAMICLOGTABLES]\ 

  When MODLOGARITHMIC is chosen and (SETMODULUS prime) is executed with an
 odd integer as {\it prime}, and a saved logarithms table file is not found,
 then logarithm tables are constructed. If DYNAMICLOGTABLES is OFF, this
 is done in a subshell, writing a file which is read into the bergman
 session but also saved for future use. If it is ON, then the tables
 should be constructed directly (and ephemerally).
  ({\it The dynamic logtables creation is not yet implemented.})


\index{immediatecrit} \item [IMMEDIATECRIT]\ 

  Turned ON/OFF by NONCOMMIFY/COMMIFY.
Tries to eliminate critical pairs (employing various criteria) as soon
as a degree is finished, instead of waiting until the degree of the
pair is reached. Should NOT be turned ON in the commutative case!

\index{immediatefullreduction} \item [IMMEDIATEFULLREDUCTION]\ 

  Default: ON.
Immediate full reduction of `old' Gr\"{o}bner basis elements by means of
newfound ones. (This is at variance with many other systems, where a
preliminary Gr\"{o}bner basis element will not be changed once it is
entered.)

\index{immediaterecdefine} \item [IMMEDIATERECDEFINE]\ 

  Intended meaning: When calculating PBseries, define the recursive
 monomial-bound sub-series while these monomials anyhow are considered
 from the critical pair point of view. This option is not fully
 implemented, however, so the flag should NOT be turned ON.

%\index{modlogarithms} \item [MODLOGARITHMS]\ 
%
%  Use `logarithm table methods' in (sufficiently small) positive
%characteristics. Provided the appropriate table files exist or
%a mechanism for automatically producing them is enabled, this
%flag is strongly recommended to be turned ON.

\index{monoidal} \item [MONOIDAL]\ 

  Used in some experimental variant to signify that we actually
 work within the monoid of monomials; i.e., that all relations are
 pure binomial. If this work is ever included into the general
 bergman framework, probably it will be in the form of mode
 changing procedures rather than by flag-setting, though.

\index{nobignum} \item [NOBIGNUM]\ 

  Inhibit automatic loading of the bignum package. If you "know" that
no bignums will be needed in your particular run (although it e. g.
is in characteristic zero or the Hilbert series is calculated), you
may turn it ON BEFORE initialisations or mode-changings have invoked
it.

(Note that in your installation the Bignum package may already be
loaded from start, in which case the flag should be on by default.
This is probable, if you run bergman under Reduce.)



\index{pbseries} \item [PBSERIES]\ 

  Turned ON/OFF by \index{setpbsermode} SETPBSERMODE.
Should NOT be  ON in the commutative case. Calculate the 
Poincar\'{e}-Betti series of the associated monomial ring 
(total degree-wise) (with a
method ONLY WORKING IN THE NON-COMMUTATIVE CASE)! Its effects are
partially superceeded by turning CUSTDISPLAY ON - take care that your
DEGREEENDDISPLAY calls e. g. TDEGREECALCULATEPBSERIES in this case. 
Should be ON if Hilbert series or Anick resolution are to be 
calculated in the non-commutative mode.

\index{posleadcoeffs} \item [POSLEADCOEFFS]\ 

  Default: ON.
In the characteristic 0 case, make sure that the final reduced Gr\"{o}bner
basis element leading coefficients are positive. (Turning it OFF saves
very little calculation, but makes the result compatible with results
from older versions of bergman.)

\index{reductivity} \item [REDUCTIVITY]\ 

  Turned ON when the SAWS module is loaded.
Inhibits the `cannibalising' garbage collection of lower degree
monomials, thus making it possible to use the Gr\"{o}bner basis for
calculating normal forms. It may be turned ON for this purpose, or
because the `cannibalism' may have unwanted side effects in the
context. 

\index{saveaccidentalreducibilityinfo} \item [SAVEACCIDENTALREDUCIBILITYINFO]\ 

  Only active within the SAWS mode. If ON, save and re-use information on
whether or not a leading monomial is divisible by another Gr\"obner basis  leading
monomial (disregarding substance).

\index{savedegree} \item [SAVEDEGREE]\ 

  Turned ON/OFF by\\
  DEGREEOUTPREPARE/ENDDEGREEOUTPUT.
Make GROEBNERKERNEL exhibit output degree by degree, by means of the
inbuilt procedure DEGREEOUTPUT. 
 In general, the final result is output. However, if the SAWS algorithm
is active, it is the preliminary (staggered linear) basis which is
output. In this case, the final reduced Gr\"{o}bner basis is NOT calculated
degree-wise, and so no speed is gained by exhibiting output degree-wise.
If you anyhow wish such output (e. g., for compatibility reasons), you
may turn ON DEGREEPRINTOUTPUT.



\index{saverecvaluse} \item [SAVERECVALUES]\ 

  Default: ON.
In the Poincar\'e-Betti series algorithm, numerous interdepending integer
series are defined by linear recursion formulae. When the flag is ON,
the calculated values at each degree are saved. This saves (considerable)
time, but sometimes may use considerable space.


\end{description}

\section{User available counters}

In most cases they should be initialised  to 0 by SETQ or Reduce assignment.

\begin{description}
\index{noofnilreductions} \item [NOOFNILREDUCTIONS]\ 

  Counts the total number of times the normal form procedure ("ReducePol")
is called with an argument representing the zero polynomial.
(Ordinarily, this happens precisely whenever a new-formed S-polynomial
is zero before reduction.)

\index{noofreprioritations} \item [NOOFREPRIORITATIONS]\ 

  In the SAWS algorithm, counts the number of times `all' the prioritation
values must be changed, in order to enable new (integer!) values between
two old ones.

\index{noofspolcalcs} \item [NOOFSPOLCALCS]\ 

  Counts the number of S-polynomials actually formed. Together with a
counting of the final basis (except the input), this gives a good measure
of the efficiency of the critical pair elimination criteria.

\index{noofstagconecrit} \item [NOOFSTAGCONECRIT] \ 

  Counts the number of applications of a SAWS algorithm elimination
 criterion. 

\end{description}






% -------------------------------------------------------------
%To document in protocol.txt:  HSeriesCommify, ... .

%Recently defined/employed only in the non-commutative mode:
%       DEGREEPBSERIESDISPLAY, PBINIT, TDEGREECALCULATEPBSERIES;
%       !*IMMEDIATERECDEFINE, !*PBSERIES.






























