

\section{Bergman under Reduce} \label{reduce}


\subsection{Working in the Reduce syntax}

Starting {\bf bergman} you are in the algebraic mode of Reduce
\index{Reduce mode}.
It means that
you have the possibility to work in the Reduce syntax, and someone
can prefer it because the notation is  more closed to usual algebraic mode
and to most of Algol--like programming languages. 

There are several important syntactical differences.

For example, you can use infix operators in algebraic formulae and write $a+b$ instead of {\it (plus a b)} in Lisp.
You can done also the assignment in prefix form:
the usual command
$$x:=2+3;$$
produces the expected assignment 5 to a variable x.

You can check the result, for example,  by

if $x =5$ then print (x);

There are also {\it while} and {\it repeat} statements, {\it for} and {\it for each} loops and so on. See for details Anthony C.Hearn "Reduce User's Manual",
here we use only some examples from this manual.


Note that all the
commands are finished by a semicolon. 

The important
difference is that empty parenthesis are necessary in every
call of a procedure without arguments, for example, to call the
procedure \index{simple} {\bf simple} it is necessary to write {\bf
  simple();} .
If you write {\bf simple;} (without parenthesis)  the
following message will occurred:

***** `simple' is an unbound ID


Being in the Reduce mode one has the full access to Lisp
\index{symbolic mode} symbolic
calculations switching the  mode to the symbolic one by means of
{\bf symbolic;} or {\bf lisp;}

To return to the \index{algebraic mode} algebraic mode  it is necessary to type {\bf algebraic;}

To check the current mode one types {\bf eval\underline{ }mode;} .
The current mode will be printed as {\bf ALGEBRAIC} or {\bf SYMBOLIC}.

One can prefixes the relevant expression by the appropriate mode. For example,
if the current mode is {\bf algebraic}, then the commands

\begin{verbatim}
symbolic car '(a);
x+y;
\end{verbatim}

will cause the first expression to be evaluated and printed in symbolic mode
and the second in algebraic mode.



Now let us check  a {\bf bergman} session in the Reduce mode.


\begin{verbatim}
> bergman
 4: simple();
Now input in-variables and ideal generators in algebraic form, thus:
        vars v1, ..., vn;
        r1, ..., rm;
where v1, ..., vn are the variables, and r1, ..., rm the generators.
algebraic form (comm.) input> vars x,y; x^2-y^2,x*y;
% 2
x*y,
   x^2-y^2,
   
% 3
y^3,
   
Done
 - All is OK (I hope). Now you may (e. g.):
   - kill bergman with (QUIT); or
   - interrupt bergman with ^Z; or
   - clear the memory with (CLEARALL), and run a new (SIMPLE).

nil

5: quit;

Quitting

\end{verbatim}

Note that {\bf quit;} is with the semicolon too.

To switch from the Reduce mode to the Lisp one the user can use the familiar
command {\bf end;}



\subsection{Parametric coefficients}

One of the advantages in using Reduce mode is the possibility to use
arbitrary coefficients that allows Reduce. For example, it is possible
to use \index{parametric coefficients} parametric coefficients and to work with the generic rings.
The idea is that you allow coefficients and operations be taken from
Reduce,
but the main procedures for Gr\"{o}bner bases calculations are  the
same.


Let us check one example. Suppose that we need a  Gr\"{o}bner basis
for a generic ring
$$A=<x,y\mid x^2-a*y^2,x*y>,$$
where $a$ is a parameter (it means that we work over the  field of
fractions $K(a)$).

The session begins with switching to symbolic mode.
The input variables are setted up and the coefficients handling
procedure  \index{setreducesfcoeffs} {\bf setreducesfcoeffs()} is called. After that
we switch to algebraic mode  and start Gr\"{o}bner basis
calculations.

%-------------------------------------
\begin{verbatim}

> bergman

7:  symbolic;

nil

8:  setreducesfcoeffs();

nil

9: setiovars '(x,y);

nil

10:  algebraic;

11: lpol:= {x^2-a*y^2,x*y};

               2    2
lpol := { - a*y  + x ,x*y}

12:  bmgroebner lpol;

           2    2    3
{x*y, - a*y  + x ,a*y }

13:  bye;

\end{verbatim}


 Note, that all mode--changers (including {\bf setiovars}) must be
 run symbolically.
Then {\bf bmgroebner}  \index{bmgroebner} may be called {\it from  algebraic mode}, with a list of
polynomials as (single) argument. Each polynomial should be homogeneous,
and {\it only} contain input variables listed in {\bf setiovars}.
If all is well, {\bf bmgroebner}
returns a reduced groebner basis (as a list of polynomials).

 Right now, only integer or standard form coefficients are permitted.

 Important! Only commutative version is available: the noncommutative
 version can be called, but right now produces wrong results.
