\section{Modules over non-commutative algebras}


\subsection{ Gr\"{o}bner basis for modules over non-commutative algebras}
In the previous sections we have described how to work with the ring 
(more exactly with the algebra over a field $K$)
both in  the commutative and non-commutative cases. In this section we
 restrict ourselves to
non-commutative algebras only and will study modules over such algebras,
 and their homological properties.

Let $A$ be a non-commutative algebra and  $M$ be a right module $M$ over  $A.$
{\bf Bergman} does not consider the module $M$ as a special structure.
Instead {\bf bergman} works with a larger ring, that has  as  a generators set  the 
union of the generators for $A$ and $M$ and as the set of the relations the union
of the relations. This ring mathematically can be considered as the
  $A\otimes T(M),$ where $T(M)$ is the 
tensor algebra $$T(M)=K\oplus M\oplus M\otimes M+ M\otimes M\otimes M+\cdots,$$
and the multiplications gives by 
$$(a\otimes m_1\cdots\otimes m_r)\cdot (a'\otimes n_1\cdots\otimes n_s)=
a\otimes m_1\cdots\otimes m_ra'\otimes n_1\cdots\otimes n_s.$$

It is important to understand  how to extract the information from this extended ring
 to obtain the necessary results about the module $M.$ We use mainly mathematics
and partly some programming tricks to do this.
But we still are working with the ring (though large). Nevertheless the computations
of the Anick resolution are different in differnt cases and the user will get the
warning about the changing mode from RING to MODULE, or TWOMODULES. All the
procedures we describe below do changes automaticaly and those modes are important
for Anick calculations only.

The structure of the section is the following. First we describe how to get
Gr\"{o}bner basis and Hilbert series for modules. Then  the Anick resolution will be 
introduced and will be explained how to calculate Betti numbers for algebra
$A$ (i.e. dimensions
$B(i,j)=\dim\mbox{\it Tor}^A_{i,j}(K,K)$
in homological degree $i$ and  degree $j.$ Betti numbers can be printed in two
forms - ordinary $B(i,j)=\cdots$ and so-called Macaulay form, i.e.
in matrix form $C,$ where $C(k,l)=B(l,k+l).$ We do not loose any information because
$B(i,j)=0$ if $j<i.$

Using Anick resolution for the extended ring we will extract
  Anick resolution and Betti numbers for the right module (i.e.
$B(i,j)=\dim\mbox{\it Tor}^A_{i,j}(M,K)$
and will show how to proceed with the  right ideals, two-sided ideals,
factor-algebras (considered as right modules) and how to work with this 
for left modules.

Then we consider the most general case
$B(i,j)=\dim\mbox{\it Tor}^A_{i,j}(M,N)$. Since this employs the computer 
resources maximally, it should not be 
used in the previous cases (although of course this can be done).


At last we will show how to calculate the Hochschild homology of an algebra.


\subsection{Gr\"{o}bner basis for  modules over non-commutative algebras}

To obtain a Gr\"{o}bner basis for a right  module $M$ over a non-commutative algebra $A$
it is sufficient to calculate the Gr\"{o}bner basis for the extended ring.
In other words, one needs to input the union of the set of variables and a set of 
generators for $M$ (considered as a right module)
and all algebra and module relations (in any order). What we get
is the set that is the union of two Gr\"{o}bner bases - one for the algebra and one
for our module. To distinguish them we need only to check the presence of a  module variables.
If an element contains a module variable (it should be on the first place if it was
a right module and on  the last if it was a left module) then the element belongs to 
the module Gr\"{o}bner basis.
Let us consider an example. Suppose we want to calculate a Gr\"{o}bner basis for the
right module $M=$ $<a,b|ax-by>$ over the algebra $A=<x,y|x^2-y^2>.$
We can do it (after the switching to the non-commutative mode),
 for example, with the help of the procedure {\bf simple}
(note the order we used in variable names - we want $x$ be larger than $y$ and
$a$ larger than $b$).


\begin{verbatim}
2 lisp>  (noncommify)
nil
3 lisp> (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 (noncomm.) input> vars y,x,b,a;x*x-y*y,a*x-b*y;
+t^2*(2*z^2)
% 2
x*x-y*y,
   a*x-b*y,
 
+t^3*(2*z^2+2*z^3)
% 3
x*y*y-y*y*x,
   a*y*y-b*y*x,
 
+t^4*(2*z^3+2*z^4)
Done
\end{verbatim}

What we get are  two  Gr\"{o}bner bases:
one for the algebra:
$$xx-yy,xy^2-y^2x$$
and another for the module:
$$ax-by,ay^2-byx.$$
Now we can construct a $K-$basis for $M,$ which consists of the normal words,
containing $a$ or $b$ on the first place and only algebra variables after them, i.e.:
$$a,b; ay, bx,by; ayx,bxy,byx,byy; ayxy,bxyx, byxy, byyx,byyy;\cdots$$
and we can even calculate the Hilbert series:
$$H_M(t)=2t+3t^2+4t^3+\cdots= \frac{2t-t^2}{(1-t)^2}.$$
Unfortunately we do not get the correct Hilbert series if we will try to use
the procedure {\bf ncpbhgroebner} - instead we get the Hilbert series for the
extended ring $R.$  But knowing it and the Hilbert series for algebra $A$ one
can obtain the Hilbert series for $M$ using the formula
$$  H_R=H_A\left(\frac{1}{1-H_M}\right).$$
But if the user needs a Hilbert series he can apply a procedure that uses this formula
and is described in the following section.

\subsection{Hilbert series for  modules over non-commutative algebras}



It is possible to calculate both Gr\"{o}bner basis and Hilbert series for 
finitely-presented (right or left) modules.
Gr\"{o}bner bases and Hilbert series computations for  modules are
performed by the top level procedure \index{modulehseries} {\bf modulehseries.} 
It is necessary to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of module variables,
\item the list of the algebra  and module variables,
 (the algebra  variables should be at the beginning of the list),
\item the  algebra relations (more exactly - ideal generators, because instead of the
relation $r_i=0$ we input $r_i$ itself.)
\item the module relations.
\end{itemize}

The input/output may be performed from the screen or by means of files. Depending of 
this the procedure call may contain 0,2,3 or 4 parameters.

{\bf Interactive input/output}.  It is the simplest way to start the
computations. You should type only:\\
{\bf (modulehseries)}

In this case a dialogue is initiated. The user is asked to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of module variables,
\item the list of the algebra  and module variables (the algebra 
  variables  should be at the beginning of the list) and the ideal generators,
\end{itemize}

Receiving this data the Gr\"{o}bner basis for ideal is calculated and user
is asked to input

\begin{itemize}
\item  the module relations.
\end{itemize}

Here is an example of computations over modules:

\begin{verbatim}


2 lisp> (MODULEHSERIES)
*** Function `modulehseries' has been redefined
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
2 lisp> 4
Input the number of module generators
2 lisp> 2
Now input ALL ring and module variables but ONLY
the ring ideal generators in algebraic form, thus:
      vars v1, ..., vn;
       r1, ..., rm;
where v1, ..., vn are all the variables, 
and r1, ..., rm the generators.
algebraic form (noncomm.) input> vars x,y,a,b;
algebraic form (noncomm.) input> x*x-y*y, x*y;
+t^2*(2*z^2)
% 2
x*y,
   -y^2+x^2,
   
+t^3*(2*z^2+2*z^3)
% 3
x^3,
   y*x^2,
   
+t^4*(6*z^3+2*z^4)
+14*z^2
+48*z^3
+168*z^4
Now input ONLY the module relations, 
thus:    r1, ..., rm;
where  r1, ..., rm are the module relations.
algebraic form (noncomm.) input> a*x-b*y;
+t^2*(3*z^2)
% 2
-b*y+a*x,

+t^3*(3*z^2+3*z^3)
% 3
b*x*x,

+t^4*(9*z^3+3*z^4)
Done
+13*z^2
+40*z^3
+127*z^4

Here is (1-H)^(-1) for the Hilbert series H of the module

 +1
 +2*t^1
 +7*t^2
+22*t^3
+69*t^4
Here is the Hilbert series H of the module
+2*t^1
+3*t^2
+2*t^3
nil
3 lisp>

\end{verbatim}

{\bf Input from a file -- output on the screen.} In this case you
should type
the procedure call with two parameters, which
are names of existing files.\\
{\bf (modulehseries $<$file1$>$ $<$file2$>$)}


The file $<$file1$>$ should contain:

\begin{itemize}
\item the maximal degree of computation defined by

{\bf (setmaxdeg degree)}
\item the number of module generators defined by

{\bf (setq nmodgen number)} \index{nmodgen}

\item the procedure call to process the list of variables presented in
  algebraic form:

{\bf (algforminput)}


\item  the list of the algebra  and module variables (the algebra  variables 
should be at the beginning of the list). To input them it is necessary to write
(without brackets!):

{\bf vars $v_1, ... , v_n$;\\
$r_1,...,r_n$;\\}

where $v_i$ are the algebra   and module variables, $r_i$ are the ideal 
generators {\bf only}. Note that the items are separated by commas and every list is ended
by semicolon.
\end{itemize}

Besides the above mentioned strings this file may contain flags and
variables setting etc. according to {\bf bergman} common rules
explained above and in the next chapter.

The file $<$file2$>$ should contain:

\begin{itemize}
\item the procedure call to process the list of variables presented in algebraic form:

{\bf (algforminput)}
\item the module relations:

$m_1,...,m_n$;
\end{itemize}

The file ``tesths1'' ís an example of $<$file1$>$:

\begin{verbatim}
(SETMAXDEG 16)
(SETQ NMODGEN 2)
(ALGFORMINPUT)
vars z,y,x,b,a;
x*x, x*y+z*x;
\end{verbatim}

and the file ``tesths2'' ís an example of $<$file2$>$:

\begin{verbatim}

(ALGFORMINPUT)
a*x*y-b*y*y+14*b*z*z,
a*z*z*z-b*x*z*y;
\end{verbatim}

{\large {\bf Errors messages}}.

If there was only one parameter in the
parameter list it yields  the following message:\\
{\bf ***It must be two input files.\\
Input data from keyboard\\}
and the system will turn to the interactive input/output mode.

If some file name is not a name of an existing file it yields the following message:\\
{\bf ***Input file must exist\\
Input data from keyboard\\}
and the system will turn to the interactive input/output mode.


{\bf Input from the files -- output to one or two files.} In this case the procedure 
call contains three or four parameters and looks like\\
{\bf (modulehseries $<$file1$>$ $<$file2$>$ $<$file3$>$ $<$file4$>$)}

The first two are input files and should respect all  the rules
mentioned above.
The third parameter is a file to output Gr\"{o}bner basis, the fourth is
destined for Hilbert series output. If the last parameter is absent only the Gr\"{o}bner basis
 will be printed in the file. Independently of the number of parameters, the resulted Gr\"{o}bner
 basis and Hilbert series always are displayed on the screen (in the two last cases the output is 
performed simultaneously in  files and on the screen). If the output file is one of the
existing it will be overwritten without some warning message.

{\large {\bf Errors messages}}.

If the name of the third file is incorrect (it is not
a quoted string), it yields the following message:\\
{\bf ***Incorrect output file.\\
 Do you agree to use the file outf\underline{ }mgb as output?\\
Type Yes or No}\\
and the system will be switched to waiting of input.


If your answer is Y (it means "Yes") the following message will be
displayed:\\
{\bf outf\underline{ }mgb is used as output file.\\
  Don't forget to rename it after calculations!}\\
and computing will continue using the file outf\underline{ }mgb as output file to print the 
resulting Gr\"{o}bner basis.

If your answer is N ("Not") the following message will be displayed:\\
{\bf No output file. Program is cancelled}\\
and {\bf bergman} will finish its work.

If the fourth parameter is incorrect an analogous dialogue appears pro\-po\-sing
to use the file outf\underline{ }mhs to output Hilbert series.




\subsection{The Anick resolution and Betti numbers for the trivial module}

\index{Anick resolution} The Anick resolution and \index{Betti numbers}
 the Betti numbers for $K$
may be computed in the non-commutative
case. Resolution and Betti numbers for an arbitrary right module over
non-commutative ring are described in the  subsection \ref{onemodbetti}.

To perform the calculations it is necessary to apply the procedure 
\index{anick}{\bf anick}

It is necessary to input:

\begin{itemize}
\item the maximal degree of computation,
\item the list of the algebra  variables,
\item the algebra relations.
\end{itemize}

The input/output may be performed from the screen or by means of files. 
Depending of this the procedure call may contain 0,1 or 2 parameters.

{\bf Interactive input/output}.  It is the simplest way to start the
computations. You should type only:\\
{\bf (anick)}

In this case a dialog is initiated. The user is asked to input:

\begin{itemize}
\item the maximal degree of computation,
\item the list of the ideal variables and relations.
\end{itemize}



Here is an example of computation:
\begin{verbatim}

2 lisp> (ANICK)
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
2 lisp> 4

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 input> vars x,y; x*x+y*y+x*y+y*x;
The Anick resolution initialization...
B(1,1)=2
The Anick resolution initialization done.
+t^2*(z^2)
% 2
y^2+y*x+x*y+x^2,

Calculating the Anick resolution in degree 2...
B(1,1)=2
B(2,2)=1
    0   1   2
  +----------
0 | 1   2   1
1 | -   -
end of Calculations.
+t^3*(z^3)
Calculating the Anick resolution in degree 3...
B(1,1)=2
B(2,2)=1
B(3,3)=1
    0   1   2   3
  +--------------
0 | 1   2   1   1
1 | -   -   -
2 | -   -
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until maximal degree
type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
3 lisp> (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the Anick resolution in degree 4...
B(1,1)=2
B(2,2)=1
B(3,3)=1
B(4,4)=1
    0   1   2   3   4
  +------------------
0 | 1   2   1   1   1
1 | -   -   -   -
2 | -   -   -
3 | -   -
end of Calculations.
nil
4 lisp> (ANICKDISPLAY)
Printing the results ...
Printing is done.
nil
5 lisp> (QUIT)
\end{verbatim}


The procedure prints in every degree new  Gr\"{o}bner basis elements
and all Betti numbers both in ordinary and Macaulay form. Sometimes
(when the Gr\"{o}bner basis is finite) it finish the calculations before
the desired maximal degree is achieved. To continue the calulations
the user can write the suggested line \index{calculateanickresolutiontolimit}

(CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG)) 

(e.g. copiing from the prompt). Of course the number {\bf (getmaxdeg)} 
may be replaced by another number.
All the intermediate results, if any,  are printed on the terminal.



%Here should be comments about nil as input

The procedure {\bf (anick)} does not print the resolution itself, though calculates it.
To print the resolution and Betti numbers into a file one should use
the procedure \index{anickdisplay} {\bf (anickdisplay)}. 
It  prints the result resolution in
the file which name is assigned to the variable
\index{anickresolutionoutputfile} {\bf anickresolutionoutputfile}.
 If no file name is assigned the
result by default will be printed in the file  \index{andifres} {\bf andifres.txt}.
Note that the assigment should be done before the call of {\bf (anick)},
for example as

\begin{verbatim}
(SETQ ANICKRESOLUTIONOUTPUTFILE "resolution.txt")
\end{verbatim}

Another important note is that this file is impossible to see before it will be closed.
In our example it was achieved simply by quitting {\bf bergman}.
 You can see the computed
resolution in the resulting file ({\bf andifres.txt} by default)
  in your current directory.

\begin{verbatim}

D(0, x)=1.x
D(0, y)=1.y
D(1, yy)=y.y+y.x+x.y+x.x
D(2, yyy)=yy.y+yy.x
D(3, yyyy)=yyy.y+yyy.x
B(1,1)=2
B(2,2)=1
B(3,3)=1
B(4,4)=1
    0   1   2   3   4
  +------------------
0 | 1   2   1   1   1
1 | -   -   -   -
2 | -   -   -
3 | -   -
\end{verbatim}



 D(1, yy)=y.y+y.x+x.y+x.x means that there exists the only 1-chain -- $yy$ and the
differential $d_1$ acts as
$$ d_1: xy\otimes 1 \longrightarrow y\otimes y+y\otimes x+ x\otimes y +x\otimes x,$$ 
thus the sign ''.'' means the tensor product
(see more comments about the Anick resolution for example in
V.Ufnarovski, ``Introduction to Noncomutative Gr\"{o}bner Bases
Theory'',
in ``Gr\"{o}bner Bases and Applications'', Lect.Notes. London
Math.Soc, 251, 1998, Cambridge Univ. Press).

\subsection{Writing own procedures}
The procedures described above and later are sufficient to make different
type of calculations of Betti numbers. Nevertheless the user can find their
output inconvenient or insufficient. To give him a possibility  to create
without problem his own procedure we will describe in this subsection how the
procedure {\bf anick} is organized.

Inside this short procedure the reader can find the following important lines.

{\bf (setringobject)} to switch to the RING mode.\\ 

{\bf (noncommify)}
 to switch to the
non-commutative mode and\\

{\bf (load anick)}
 to load the corresponding binary file.

Those lines are mandatory.


As usual,  doing non-commutative computations it is recommended to
limit  the process with some  maximal degree. Thus
the next procedure could be:\\
{\bf (setmaxdeg degree)}


Two following flags are switched on:
\begin{itemize}
\item {\bf (on calcbetti)} \index{calcbetti} -- turns on the Betti numbers
  calculation  mode. This flag is mandatory.
\item {\bf (on onflybetti)} \index{onflybetti} -- informs the application to calculate Betti
 numbers after each degree of Gr\"{o}bner basis is operated out.
 This allows to view Betti numbers degree by degree  during the
 Gr\"{o}bner basis computations. 
\end{itemize}

Both switches can be set on by the only procedure  {\bf (onflybetti)}.

After that the user can call {\bf simple},
 which performs all the calculations, the user can obtain now
not only Gr\"{o}bner basis, but the Anick resolution and Betti numbers
also.
 But he may also replace {\bf simple} 
 by the series of procedures, described in 
section  \ref{sec:bricks}. 

 One useful procedure is
 \index{calculateanickresolutiontolimit} {\bf (calculateanickresolutiontolimit 
n)} which invokes
a method for calculation of the Anick resolution till the given degree
$n.$

All the intermediate results, if any,  are printed on the terminal.
Here is an example of the session.

\begin{verbatim}

2 lisp> (SETRINGOBJECT)
nil
3 lisp> (NONCOMMIFY)
nil
4 lisp> (LOAD anick)
nil
5 lisp> (SETMAXDEG 4)
nil
6 lisp> (ONFLYBETTI)
nil
7 lisp> (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 input> vars x;x*x;
The Anick resolution initialization...
B(1,1)=1
The Anick resolution initialization done.
+t^2*(z^2)
% 2
x^2,

Calculating the Anick resolution in degree 2...
B(1,1)=1
B(2,2)=1
    0   1   2
  +----------
0 | 1   1   1
1 | -   -
end of Calculations.
+t^3*(z^3)
Calculating the Anick resolution in degree 3...
B(1,1)=1
B(2,2)=1
B(3,3)=1
    0   1   2   3
  +--------------
0 | 1   1   1   1
1 | -   -   -
2 | -   -
end of Calculations.
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 (CLEARIDEAL), 
     and run a new (SIMPLE).
nil
8 lisp>

\end{verbatim}




\subsection{The Anick resolution and Betti numbers for a right module}
\label{onemodbetti}

It is possible to calculate Anick resolution and Betti numbers for a homogenious right 
module over non-commutative algebra. The computation is performed by the top level
 procedure \index{modulebettinumbers} {\bf modulebettinumbers.} 
It is necessary to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of module variables,
\item the list of the algebra  and module variables
 (the algebra variables should be at the beginning of the list),
\item the algebra relations (more exactly -- the corresponding ideal generators,
but it will be convenient to call them relations 
to avoid in the future ambiguity in the interpretation of the word ``generators'')
\item the module relations.
\end{itemize}

The input/output may be performed from the screen or by means of files. 
Depending of this the procedure call may contain 0,1 or 2 parameters.

{\bf Interactive input/output}.  It is the simplest way to start the
computations. You should type only:\\
{\bf (modulebettinumbers)}

In this case a dialogue is initiated. The user is asked to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of module variables,
\item the list of the algebra and module variables (the algebra 
  variables  should be at the beginning of the list)
 and the algebra and module relations.
\end{itemize}

Here is an example of computations over modules:

\begin{verbatim}
1 lisp> (SETQ ANICKRESOLUTIONOUTPUTFILE "resolution.txt")
"resolution.txt"
2 lisp> (MODULEBETTINUMBERS)

*** We turn on the MODULE mode
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
2 lisp> 5
Input the number of the module variables
2 lisp> 1
Now input all ring and then all module variables.
Input  the ring ideal and module relations 
in algebraic form  thus:
      vars v1, ..., vn;
       r1, ..., rm;
where v1, ..., vn are all the variables, 
and r1, ..., rm the  relations.
algebraic form input>  vars x,a;x*x,a*x;
The Anick resolution initialization...
B(0,0)=1
The Anick resolution initialization done.
+t^2*(2*z^2)
% 2
x^2,
   a*x,
Calculating the module Anick resolution in degree 2...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.
+t^3*(2*z^3)
Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(1,1)=1
B(2,2)=1
    0   1   2   3
  +--------------
0 | 1   1   1
1 | -   -
2 | -
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until the maximal 
degree type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
3 lisp>  (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(1,1)=1
B(2,2)=1
B(3,3)=1
    0   1   2   3   4
  +------------------
0 | 1   1   1   1
1 | -   -   -
2 | -   -
3 | -
end of Calculations.
Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(1,1)=1
B(2,2)=1
B(3,3)=1
B(4,4)=1
    0   1   2   3   4   5
  +----------------------
0 | 1   1   1   1   1
1 | -   -   -   -
2 | -   -   -
3 | -   -
4 | -
end of Calculations.
nil
4 lisp> (ANICKDISPLAY)
Printing the results ...
Printing is done.
nil
5 lisp> (QUIT)

\end{verbatim}



In this example the input is  performed from the screen and, 
correspondingly, the result is displayed on the screen also. The computed 
resolution you can see in the file {\bf resolution.txt} in your current 
directory.

For this example it contains just:\\

\begin{verbatim}

D(0, a)=1.a
D(1, ax)=a.x
D(2, axx)=ax.x
D(3, axxx)=axx.x
D(4, axxxx)=axxx.x
B(0,0)=1
B(1,1)=1
B(2,2)=1
B(3,3)=1
B(4,4)=1
    0   1   2   3   4   5
  +----------------------
0 | 1   1   1   1   1
1 | -   -   -   -
2 | -   -   -
3 | -   -
4 | -

\end{verbatim}

Note that in the case of  Betti numbers computations the module generators 
are considered as zero degree elements. That is why 
 the maximal degree 
 which  we have got  for Betti numbers is one less than the  maximal degree
 used in the Gr\"{o}bner basis calculations.

To have a file input and screen output one 
should type\\

{\bf (modulebettinumbers $<$file1$>$)}

The file $<$file1$>$ should contain:

\begin{itemize}
\item the maximal degree of computation defined by

{\bf (setmaxdeg degree)}. In fact this line may be omitted. In this case calculations
 will finish when the  Gr\"{o}bner basis will be completely calculated or be 
formally infinite (until there are enough resources).

\item the number of module generators defined by

{\bf (setq nmodgen number)} \index{nmodgen} 

\item the procedure call to process the list of variables presented in
  algebraic form:

{\bf (algforminput)}

\item  the list of the algebra  and module variables (the algebra  variables should
 be at the beginning of the list) and the list of the algebra and module relations.
 To input them it is necessary to write
(without brackets!):

{\bf vars $v_1, ... , v_n$;\\
$r_1,...,r_n$;\\}

where $v_i$ are the algebra   and module variables, $r_i$ are the algebra and module 
relations. Note that the items are separated by commas and every list is ended
by semicolon.
\end{itemize}

Besides the above mentioned strings this file may contain flags and
variables setting etc. according to {\bf bergman} common rules
explained above and in the next chapter.\\

The following file``bnmt'' is an example of $<$file1$>$:

\begin{verbatim}
(SETMAXDEG 4)
(SETQ NMODGEN 2)
(ALGFORMINPUT)
vars x,y,a,b;
x*x-y*y, a*x-b*y;
\end{verbatim}

To have a file input and  file output for Gr\"{o}bner basis  one 
should type\\

{\bf (modulebettinumbers $<$file1$>$ $<$file2$>$)}


where $<$file2$>$ is an output file containing the corresponding 
 Gr\"{o}bner basis. Note that output file does not contain results 
related to the Anick resolution.





\subsection{The Anick resolution and Betti numbers for right ideals, two-sided ideals,
and factor-algebras, considered as  right modules}

Though we have a possibility to calculate Betti numbers for arbitrary
 module, we need to know defining relations for it and it is not always
 convenient. Here we describe another procedure that may be used for
 calculating Betti numbers for an ideal $ I$ in a given
algebra $ A.$ 
 
If I is a right ideal, generated by the set  $S$, then we can consider
a factor-module $ M= A/I$
and get an exact sequence $ I \rightarrow A \rightarrow M.$
 
The  Betti numbers for $ I  $ could be extracted  without 
problem from the Betti numbers for $ M$ (they are only shifted by one), but  the module $ M $ 
is nothing else
than a one-generated module. It means that
 we can use our   procedure {\bf modulebettinumbers} to calculate the  Betti
 numbers.
 
The situation is more complicated if $I$ is a two-sided ideal, generated by
a set $ S.$  In this case $ M$ is nothing else than the factor-algebra, 
and still is one-generated (considered as a right module).
 But now we do not know the defining relations for this module, because
$I $ was two-sided and we do not have generators for $I$ as a right ideal.
 
There is a special procedure {\bf factalgbettinumbers}  that solves this
problem. It calculates Betti numbers for $ M$ using only $S$ (and the $A$ relations).
It has usual
parameters, described later, but to work with the input for this procedure 
the user should introduce additional variables and relations.
 
We start from the variable list {\bf vars.}  The  user needs the algebra variables,
a copy for every algebra variable,  and one additional variable for the module.
In the list of variables  the single module variable
should be in the middle - after
algebra variables and before their copies.
 
As to the relations, they should contain (in any order)
 all algebra relations,
all ideal generators, multiplied from the left by the module variable.


Some  additional relations of the form
\begin{center}
(copy of variable)*(module\_ variable)-(module\_ variable)*(variable)
\end{center}
for every variable of the algebra are generated automatically by the corresponding 
procedure. 
 
{\bf Example.} Suppose that  the algebra has $ x, y $ as variables and $ x*y $ as
single defining relation. We want to consider a two-sided ideal generated
 by $x$ and to calculate Betti numbers for a corresponding factor-algebra.
 
Suppose that we have selected the names $ X$ and $Y$ for copies of $ x $ and  $y $ 
and  $c $ for
 module variable. Then the input my look like

\begin{verbatim}
vars x,y,c,X,Y; x*y, c*x;
\end{verbatim}

 The computation is performed by the top level procedure \index{factalgbettinumbers} 
{\bf factalgbettinumbers.} It is necessary to input:

\begin{itemize}
\item the maximal degree of Gr\"{o}bner basis computation,
\item the list of the algebra variables,  the  module variable and copies of the algebra variables,
as it is described above.
\item the algebra relations, 
\item the ideal generators, multiplied by the module variable. 
\end{itemize}

The input/output may be performed from the screen or by means of files. Depending of this 
the procedure call may contain 0,1 or 2 parameters.

{\bf Interactive input/output}.  It is the simplest way to start the
computations. You should type only:\\
{\bf (factalgbettinumbers)}

In this case a dialog is initiated. The user is asked to input:

\begin{itemize}
\item the maximal degree of computation,
\item the input list of  variables  and  relations.
\end{itemize}



Here is an example of computation:

\begin{verbatim}

1 lisp> (factalgbettinumbers)
*** We turn on the MODULE mode
*** Function `addadditionalrelations' has been redefined
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
1 lisp> 5
Now input all ring variables, a dummy variable (D),
and copies of the ring variables 
(in this order), in this manner:
    vars x1, ..., xn, D, y1, ..., yn;
(where x1,..., xn are the ring varables,
and y1,...,yn their copies)
Then input  the ring ideal relations 
(in ordinary algebraic form);
but the factor algebra relations in the form
     D*r1, ..., D*rm,
where r1, ..., rm are the relations.
algebraic form input>  vars x,y, D, X,Y;
algebraic form input>  x*y,y*x, y*y,D*x*x;
*** Function `addadditionalrelations' has been redefined
The Anick resolution initialization...
B(0,0)=1
The Anick resolution initialization done.
+t^2*(5*z^2)
% 2
x*y,
   y*x,
   y^2,
   X*D-D*x,
   Y*D-D*y,

Calculating the module Anick resolution in degree 2...
B(0,0)=1
    0   1
  +------
0 | 1
end of Calculations.
+t^3*(z^2+5*z^3)
% 3
D*x^2,

Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(1,2)=1
    0   1   2   3
  +--------------
0 | 1   -   -
1 | -   1
2 | -
end of Calculations.
+t^4*(3*z^3+8*z^4)
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(1,2)=1
B(2,3)=1
    0   1   2   3   4
  +------------------
0 | 1   -   -   -
1 | -   1   1
2 | -   -
3 | -
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until the maximal 
degree type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
2 lisp> (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(1,2)=1
B(2,3)=1
B(3,4)=2
    0   1   2   3   4   5
  +----------------------
0 | 1   -   -   -   -
1 | -   1   1   2
2 | -   -   -
3 | -   -
4 | -
end of Calculations.
nil
3 lisp> (anickdisplay)
Printing the results ...
Printing is done.

\end{verbatim}


In this example the input is  performed from the screen and, 
correspondingly, the result is displayed on the screen also. The computed 
resolution you can see in the file {\bf andifres.txt} in your current 
directory.

For this example it contains just:\\

\begin{verbatim}
D(0, D)=1.D
D(1, Dx^2)=D.x^2
D(2, Dx^2y)=Dx^2.y
D(3, Dx^2yx)=Dx^2y.x
D(3, Dx^2yy)=Dx^2y.y
B(0,0)=1
B(1,2)=1
B(2,3)=1
B(3,4)=2
    0   1   2   3   4   5
  +----------------------
0 | 1   -   -   -   -
1 | -   1   1   2
2 | -   -   -
3 | -   -
4 | -

\end{verbatim} 

Note that in the case of  Betti numbers computations the module generators 
are considered as zero degree elements. That is why 
 the maximal degree 
 which  we have got  for Betti numbers is one less than the  maximal degree
 used in the Gr\"{o}bner basis calculations. One can see in the second degree 
of Groebner basis the automatically generated additional realtions $X*D-D*x, Y*D-D*y.$



To have a file input and screen output one 
should type\\

{\bf (factalgbettinumbers $<$file1$>$ )}

The file $<$file1$>$ should contain:

\begin{itemize}
\item the maximal degree of computation defined by

{\bf (setmaxdeg degree)}


\item the procedure call to process the list of variables presented in algebraic form:

{\bf (algforminput)}

\item the input list of  variables  and  relations. To input them it is necessary to write
(without brackets!):

{\bf vars $v_1, ... , v_n$;\\
$r_1,...,r_n$;\\}

where $v_i$ are the algebra, module or copy variables, $r_i$ are all the relations. 
Note that the items are separated by commas and every list is ended by semicolon.
\end{itemize}

Besides the above mentioned strings this file may contain flags and
variables setting etc. according to {\bf bergman} common rules
explained above and in the next chapter.

The following file``ftinput'' is an example of $<$file1$>$:

\begin{verbatim}
(SETMAXDEG 8)
(ALGFORMINPUT)
vars  x,y,c,X,Y;
x*y,  c*x;
\end{verbatim}


One can apply {\bf factalgbettinumbers} with two parameters:

{\bf (factalgbettinumbers $<$file1$>$ $<$file2$>$)}

The $<$file2$>$ is an output file containing the corresponding  Gr\"{o}bner basis.

Sometimes,  especially if the  Gr\"{o}bner basis is finite,
 the calculation of the Anick resolution can be stopped
before the desired degree is  achieved. One can see in the example how to continue 
the computing using
the procedure \index{calculateanickresolutiontolimit}
 {\bf (calculateanickresolutiontolimit)}.


The procedure \index{anickdisplay} {\bf (anickdisplay)}  prints the complete resolution
(with the differentials) into
the file. Because no file name was assigned to the variable
\index{anickresolutionoutputfile} {\bf anickresolutionoutputfile} the
result by default was printed into the file  \index{andifres} {\bf andifres.txt}.



\subsection{Working with the left modules}

We have described some procedures for right modules. The user might expect that
the same procedure can be used for the left modules, but it is not the case
for the procedures calculating resolution and Betti numbers. The reason is that   
the Anick resolution is constructed as an exact sequence of right modules, and this
was essentially used in programming. Of course,  it would be possible to program
the left variant too, but it is much less trivial than one might expect.
There is the only  procedure designed to operate with left modules: 
 \index{leftmodulebettinumbers} {\bf leftmodulebettinumbers }. Let us see an example of
its applying:

\begin{verbatim}
1 lisp>  (leftmodulebettinumbers)
Input the Maximum Degree you want to calculate
1 lisp> 5
Input the number of the module variables
1 lisp> 1
Now input all ring and then all module variables.
Input  the ring ideal and module relations 
in algebraic form  thus:
      vars v1, ..., vn;
       r1, ..., rm;
where v1, ..., vn are all the variables, 
and r1, ..., rm the  relations.
algebraic form input> vars x,a; x*x, x*a;
The Anick resolution initialization...
B(0,0)=1
The Anick resolution initialization done.
+t^2*(2*z^2)
% 2
x^2,
   a*x,

Calculating the module Anick resolution in degree 2...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.
+t^3*(2*z^3)
Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(1,1)=1
B(2,2)=1
    0   1   2   3
  +--------------
0 | 1   1   1
1 | -   -
2 | -
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until the maximal 
degree type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
2 lisp> (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(1,1)=1
B(2,2)=1
B(3,3)=1
    0   1   2   3   4
  +------------------
0 | 1   1   1   1
1 | -   -   -
2 | -   -
3 | -
end of Calculations.
Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(1,1)=1
B(2,2)=1
B(3,3)=1
B(4,4)=1
    0   1   2   3   4   5
  +----------------------
0 | 1   1   1   1   1
1 | -   -   -   -
2 | -   -   -
3 | -   -
4 | -
end of Calculations.
nil
3 lisp>

\end{verbatim}

Unfortunately, there are no more special left module processing procedures in {\bf bergman.}
 Instead the user
should use mathematical approach and replace a left module $N$  over an
algebra $A$ by the right module $M$ over the algebra $A^{op}.$ What one need to do is
only  to rewrite
all words in the defining relations in the inverse order. For example, if one
have two relations:  $x*y+ y*y $ in the algebra and  $y*x*a+2*y*x*b $
 in the module they should 
be replaced by  $y*x+y*y $ and  $a*x*y+2*b*x*y $ correspondingly.

{\bf Example.} We would like to know if the two-sided ideal $I,$ generated in the algebra
$A=<x,y|xx-xy>$ by the element $x$ has the same Betti numbers considered as a right
or as  a left module. The following session gives us both calculations 
(we start from the right module and after that perform computing for the left module).

\begin{verbatim}
2 lisp>  (FACTALGBETTINUMBERS)

*** We turn on the MODULE mode
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
2 lisp> 4
Now input all ring variables, a dummy variable (D),
and copies of the ring variables 
(in this order), in this manner:
    vars x1, ..., xn, D, y1, ..., yn;
(where x1,..., xn are the ring varables,
and y1,...,yn their copies
Then input  the ring ideal relations 
(in ordinary algebraic form);
but the factor algebra relations in the form
     D*r1, ..., D*rm,
where r1, ..., rm are the relations.
Finally, input the dummy commutators
   y1*D-D*x1, ..., ym*D-D*ym;
algebraic form input>  vars x,y,c, X,Y;
algebraic form input>  x*x-x*y, c*x;
The Anick resolution initialization...
B(0,0)=1
The Anick resolution initialization done.
+t^2*(4*z^2)
% 2
-x*y+x^2,
   c*x,
   X*c,
   Y*c-c*y,
   
Calculating the module Anick resolution in degree 2...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.
+t^3*(z^2+3*z^3)
% 3
c*y*x,
   
Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(1,1)=1
B(1,2)=1
B(2,2)=1
    0   1   2   3
  +--------------
0 | 1   1   1
1 | -   1
2 | -
end of Calculations.
+t^4*(z^2+3*z^3+2*z^4)
% 4
c*y^2*x,
   
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(1,1)=1
B(1,2)=1
B(2,2)=1
B(1,3)=1
B(2,3)=1
    0   1   2   3   4
  +------------------
0 | 1   1   1   -
1 | -   1   1
2 | -   1
3 | -
end of Calculations.

nil
3 lisp>  (CLEARIDEAL)
Closing the streams.Cleaning the variables
nil
4 lisp> (FACTALGBETTINUMBERS)
Input the Maximum Degree you want to calculate
4 lisp> 4
Now input all ring variables, a dummy variable (D),
and copies of the ring variables 
(in this order), in this manner:
    vars x1, ..., xn, D, y1, ..., yn;
(where x1,..., xn are the ring varables,
and y1,...,yn their copies
Then input  the ring ideal relations 
(in ordinary algebraic form);
but the factor algebra relations in the form
     D*r1, ..., D*rm,
where r1, ..., rm are the relations.
Finally, input the dummy commutators
   y1*D-D*x1, ..., ym*D-D*ym;
algebraic form input>  vars x,y,c, X,Y;
algebraic form input>  x*x-y*x,c*x;
The Anick resolution initialization...
B(0,0)=1
The Anick resolution initialization done.
+t^2*(4*z^2)
% 2
-y*x+x^2,
   c*x,
   X*c,
   Y*c-c*y,
   
Calculating the module Anick resolution in degree 2...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.
+t^3*(2*z^3)
Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until the maximal 
degree type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
5 lisp> (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(1,1)=1
    0   1   2
  +----------
0 | 1   1
1 | -
end of Calculations.
nil 



\end{verbatim}

Note that the only difference is  the term $y*x$ instead of $x*y,$ because other terms
($x*x$ and $x$) are symmetric, but the results are quite different. Note that
in fact we could skip the call of the procedure
 {\bf calculateanickresolutiontolimit}, because we could see that degree 3
was already proceeded and gave different result.



\subsection{ Betti numbers for two modules}

Here we describe a procedure that calculates
the Betti numbers  for the most general situation when we have two modules:
a right $A$-module $M$ and a left $A$-module $N$ and want to know the dimensions
$B(i,j)=\mbox{\it Tor}^A_{i,j}(M,N)$ in every homological degree $i$ and degree $j$ as
a vector graded space. Note that the procedure takes a lot of resources and it is
 recommended to use the procedures, described above for those special cases where they 
can be applied.


 The computation is performed by the top level
 procedure \index{twomodbettinumbers} {\bf twomodbettinumbers.} 
It is necessary to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of the right module variables,
\item the number of the left module variables,
\item the list of the algebra  and module variables
 (the algebra variables should be at the beginning of the list,
followed by right module variables. 
The left module variables should be at the end of the list.)
\item the algebra and both module relations (in arbitrary order).
\end{itemize}

The input/output may be performed from the screen or by means of files. 
Depending of this the procedure call may contain 0,1 or 2 parameters.

{\bf Interactive input/output}.  It is the simplest way to start the
computations. You should type only:\\
{\bf (twomodbettinumbers)}

In this case a dialogue is initiated. The user is asked to input:

\begin{itemize}
\item the maximal degree of computation,
\item the number of the right module variables,
\item the number of the left module variables,
\item the list of the algebra and module variables (the algebra 
  variables  should be at the beginning and
the left module variables should be at the end of the list.)
 and the ideal and module relations.
\end{itemize}



Here is an example of computations over modules:

\begin{verbatim}
1 lisp> (twomodbettinumbers)

*** We turn on the TWOMODULES mode
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
1 lisp> 6
Input the number of the right  module variables
1 lisp> 1
Input the number of the left  module variables
1 lisp> 1
Now input all ring and then all module variables.
Right module variables should be before the left ones.
Input  the ring ideal and module relations 
in algebraic form  thus:
      vars v1, ..., vn;
       r1, ..., rm;
where v1, ..., vn are all the variables, 
and r1, ..., rm the  relations.
algebraic form input> vars x,y,r,l;
algebraic form input> r*x, y*l-x*l;
SetupGlobals
 ... done
The Anick resolution initialization (for two modules)...
The Anick resolution initialization done.
+t^2*(2*z^2)
% 2
y*l-x*l,
   r*x,

Calculating the module Anick resolution in degree 2...
B(0,0)=1
    0   1   2
  +----------
0 | 1
end of Calculations.

Groebner basis is finite.
If you want to continue calculations until the maximal 
degree type (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
nil
2 lisp> (CALCULATEANICKRESOLUTIONTOLIMIT (GETMAXDEG))
Calculating the module Anick resolution in degree 3...
B(0,0)=1
    0   1   2
  +----------
0 | 1
end of Calculations.
Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(0,2)=1
    0   1   2   3   4
  +------------------
0 | 1   -   -
1 | -   -
2 | 1
end of Calculations.
Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(0,2)=1
B(0,3)=2
    0   1   2   3   4   5
  +----------------------
0 | 1   -   -   -
1 | -   -   -
2 | 1   -
3 | 2
end of Calculations.
Calculating the module Anick resolution in degree 6...
B(0,0)=1
B(0,2)=1
B(0,3)=2
B(0,4)=4
    0   1   2   3   4   5   6
  +--------------------------
0 | 1   -   -   -   -
1 | -   -   -   -
2 | 1   -   -
3 | 2   -
4 | 4
end of Calculations.
nil
3 lisp>
\end{verbatim}

In our example the algebra is free - there were no algebra relations.
Note that in the case of  Betti numbers computations the module generators 
(both left and right)
are considered as zero degree elements. That is why 
 the maximal degree 
 which  we have got  for Betti numbers is two less than the  maximal degree
 used in the Gr\"{o}bner basis calculations.

In this example the input is  performed from the screen and, correspondingly,
 the result is displayed on the screen also.
To have a file input and screen output one 
should type\\

{\bf (twomodbettinumbers $<$file1$>$)}

The file $<$file1$>$ should contain:

\begin{itemize}
\item the maximal degree of computation defined by

{\bf (setmaxdeg degree)}. In fact this line may be omitted. In this case calculations
 will finish when the  Gr\"{o}bner basis will be completely calculated or be 
formally infinite (until the resources are exhausted).

\item the number of the right module generators defined by

{\bf (setq nrmodgen number)} \index{nrmodgen} 

\item the number of the left module generators defined by

{\bf (setq nlmodgen number)} \index{nlmodgen} 
\item the procedure call to process the list of variables presented in
  algebraic form:

{\bf (algforminput)}

\item  the list of the algebra  and module variables (in the order described above)
 and the list of the ideal and module relations.
 To input them it is necessary to write
(without brackets!):

{\bf vars $v_1, ... , v_n$;\\
$r_1,...,r_n$;\\}

where $v_i$ are the algebra   and module variables, $r_i$ are the ideal and module 
relations. Note that the items are separated by commas and every list is ended
by semicolon.
\end{itemize}

Besides the above mentioned strings this file may contain flags and
variables setting etc. according to {\bf bergman} common rules
explained above and in the next chapter.\\

The following file``twomodtest'' is an example of $<$file1$>$:

\begin{verbatim}
(SETMAXDEG 4)
(SETQ NRMODGEN 2)
(SETQ NLMODGEN 2)
(ALGFORMINPUT)
vars  x,y,A1,A2,B1,B2;
x*x+x*y+y*x+y*y,
A1*x*x+A2*y*y,A1*y*y,y*x*B1+x*y*B2,y*y*y*B1;
\end{verbatim}

To have a file input and  file output for the Gr\"{o}bner basis  one 
should type\\

{\bf (twomodbettinumbers $<$file1$>$ $<$file2$>$)}


where $<$file2$>$ is an output file containing the corresponding 
 Gr\"{o}bner basis. Note that output file does not contain results 
related to the Anick resolution.







\subsection{Calculating Hochschild homology of an algebra}

Let $A$ be an algebra over $K,$ $A^{op}$ be the opposite algebra and $A^e=A\otimes A^{op}.$
It is known that in this situation  $A$ is $K-$flat and
its Hochschild homology  $H_n(A)$ can be obtained by the isomorphism
$$H_n(A)=\mbox{\it Tor}^{A^e}_{n}(A,A),$$
where $A$ is considered both as right and left $A^e-$ module.
Because we have a possibility to calculate $\mbox{\it Tor}^{A^e}_{n}(A,A)$ we need only to know
how to get the defining relations for the algebra  $A^e,$ right $A^e-$ module $A$ and
left $A^e-$module $A.$

Besides the original variables $x,y\ldots$ of the algebra $A$ we need copies of them
(for example $X,Y\ldots)$ to generate the algebra $A^{op},$ and two variables (for example,
$r$ and $l$ ) for  the right  $A^e-$ module $A$ and
left $A^e-$module $A.$

Now let us consider the relations. We need, of course, the defining 
relations for $A,$  and the relations for $A^{op},$
which we get from $A$ by reverting all the monomials
 and replacing variables by their copies.

To create  $A^e$ we need only to add the commutativity relations between all variables
and all copies:
$$xX-Xx, xY-Yx, yX-Xy, yY-Yy\cdots$$

At last the module relations. For the right module they looks like $rx-rX, ry-rY\cdots$
i.e. module generator, multiplied by the difference $x-X$ between a variable and its copy for
every variable $x.$  Note that as a right $A^e-$module $A$
is isomorphic to the  factor module
$$A^e/(x\otimes 1 - 1\otimes x)A^e+
(y\otimes 1 - 1\otimes y)A^e+\cdots, $$
so the corresponding cyclic right module get the relations 
$rx-rX, ry-rY,\cdots.$  For the left module
we need, of course the symmetric variant: $xl-Xl, yl-Yl\cdots.$

Let us consider an example. Suppose that we want to calculate the 
Hochschild homology of the algebra $A=<x,y|xy=0>.$ The session looks as

\begin{verbatim}




2 lisp> (twomodbettinumbers)

*** We turn on the TWOMODULES mode
*** We turn on noncommutativity
Input the Maximum Degree you want to calculate
2 lisp> 5
Input the number of the right  module variables
2 lisp> 1
Input the number of the left  module variables
2 lisp> 1
Now input all ring and then all module variables.
Right module variables should be before the left ones.
Input  the ring ideal and module relations 
in algebraic form  thus:
      vars v1, ..., vn;
       r1, ..., rm;
where v1, ..., vn are all the variables, 
and r1, ..., rm the  relations.
algebraic form input> vars x,y,X,Y,r,l;  
algebraic form input> x*y,Y*X, x*X-X*x, 
algebraic form input> x*Y-Y*x, y*X-X*y, y*Y-Y*y,
algebraic form input> r*x-r*X, r*y-r*Y, x*l-X*l, y*l-Y*l;
The Anick resolution initialization (for two modules)...
The Anick resolution initialization done.
+t^2*(10*z^2)
% 2
x*y,
   -X*x+x*X,
   -X*y+y*X,
   -X*l+x*l,
   -Y*x+x*Y,
   -Y*y+y*Y,
   Y*X,
   -Y*l+y*l,
   -r*X+r*x,
   -r*Y+r*y,

Calculating the module Anick resolution in degree 2...
B(0,0)=1
    0   1   2
  +----------
0 | 1
end of Calculations.
+t^3*(4*z^2+12*z^3)
% 3
r*x*X-r*x^2,
   -r*y*x+r*x*Y,
   r*y*X,
   r*y*Y-r*y^2,

Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(0,1)=2
B(1,1)=2
    0   1   2   3
  +--------------
0 | 1   2
1 | 2
end of Calculations.
+t^4*(4*z^2+11*z^3+6*z^4)
% 4
r*x^2*X-r*x^3,
   -r*y^2*x+r*x*Y^2,
   r*y^2*X,
   r*y^2*Y-r*y^3,

Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(0,1)=2
B(1,1)=2
B(0,2)=2
B(1,2)=2
    0   1   2   3   4
  +------------------
0 | 1   2   -
1 | 2   2
2 | 2
end of Calculations.
+t^5*(4*z^2+11*z^3+6*z^4+z^5)
% 5
r*x^3*X-r*x^4,
   -r*y^3*x+r*x*Y^3,
   r*y^3*X,
   r*y^3*Y-r*y^4,
 
Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(0,1)=2
B(1,1)=2
B(0,2)=2
B(1,2)=2
B(0,3)=2
B(1,3)=2
    0   1   2   3   4   5
  +----------------------
0 | 1   2   -   -
1 | 2   2   -
2 | 2   2
3 | 2
end of Calculations.

\end{verbatim}

Once again, the maximal degree of Betti numbers is two less than maximal degree
we used in Gr\"{obner} basis calculations.

Instead of universal  procedure {\bf twomodbettinumbers} it is possibly to use a more 
convenient one \index{hochschild}{\bf hochschild} designed especially for this purpose. In fact, it 
performs the same  calculations, but the additional relations are generated 
automatically.

The following example (using the same variables and relations as abowe) illustrates 
its application:

\begin{verbatim}
4 lisp> (hochschild)
*** Function `addadditionalrelations' has been redefined
Input the Maximum Degree you want to calculate
4 lisp> 5


Now input all ring variables, copies of the ring variables,
  and two dummy variable (D1,D2) 
(in this order), in this manner:
    vars x1, ..., xn,  y1, ..., yn, D1, D2;
(where x1,..., xn are the ring varables,
and y1,...,yn their copies)
Then input  the ring ideal relations 
(in ordinary algebraic form);
       r1, ..., rm;

algebraic form input> vars  x,y, X,Y,r,l;
algebraic form input> x*y;
*** Function `addadditionalrelations' has been redefined
The Anick resolution initialization (for two modules)...
The Anick resolution initialization done.
+t^2*(10*z^2)
% 2
x*y,
   -X*x+x*X,
   -X*y+y*X,
   X*l-x*l,
   -Y*x+x*Y,
   -Y*y+y*Y,
   Y*X,
   Y*l-y*l,
   r*X-r*x,
   r*Y-r*y,

Calculating the module Anick resolution in degree 2...
B(0,0)=1
    0   1   2
  +----------
0 | 1
end of Calculations.
+t^3*(4*z^2+12*z^3)
% 3
r*x*X-r*x^2,
   -r*y*x+r*x*Y,
   r*y*X,
   r*y*Y-r*y^2,

Calculating the module Anick resolution in degree 3...
B(0,0)=1
B(0,1)=2
B(1,1)=2
    0   1   2   3
  +--------------
0 | 1   2
1 | 2
end of Calculations.
+t^4*(4*z^2+11*z^3+6*z^4)
% 4
r*x^2*X-r*x^3,
   -r*y^2*x+r*x*Y^2,
   r*y^2*X,
   r*y^2*Y-r*y^3,

Calculating the module Anick resolution in degree 4...
B(0,0)=1
B(0,1)=2
B(1,1)=2
B(0,2)=2
B(1,2)=2
    0   1   2   3   4
  +------------------
0 | 1   2   -
1 | 2   2
2 | 2
end of Calculations.
+t^5*(4*z^2+11*z^3+6*z^4+z^5)
% 5
r*x^3*X-r*x^4,
   -r*y^3*x+r*x*Y^3,
   r*y^3*X,
   r*y^3*Y-r*y^4,

Calculating the module Anick resolution in degree 5...
B(0,0)=1
B(0,1)=2
B(1,1)=2
B(0,2)=2
B(1,2)=2
B(0,3)=2
B(1,3)=2
    0   1   2   3   4   5
  +----------------------
0 | 1   2   -   -
1 | 2   2   -
2 | 2   2
3 | 2
end of Calculations.

nil
5 lisp>
\end{verbatim}

One can see all the automatically generated additional relations in degree 2
of Groebner basis.


 

