|  |  A.3.4 Free resolution 
In SINGULAR a free resolution of a module or ideal has its own type:
resolution. It is a structure that stores all information related to
free resolutions. This allows partial computations of resolutions via
the commandres. After applyingres, only a pre-format of the
resolution is computed which allows to determine invariants like
Betti-numbers or homological dimension. To see the differentials
of the complex, a resolution must be converted into the type list which
yields a list of modules: the k-th module in this
list is the first syzygy-module (module of relations) of the (k-1)st module.
There are the following commands to compute a resolution: 
res rescomputes a free resolution of an ideal or module using a heuristically
chosen method.
This is the preferred method to compute free resolutions of ideals or
modules.
fres fresimproved version of  sres, computes a free resolution of an ideal or
module using Schreyer's method. The input has to be a standard basis.
lres lrescomputes a free resolution of an ideal or module with LaScala's
method. The input needs to be homogeneous.
mres mrescomputes a minimal free resolution of an ideal or module with the syzygy
method.
sres srescomputes a free resolution of an ideal or module with Schreyer's
method. The input has to be a standard basis.
nres nrescomputes a free resolution of an ideal or module with the standard basis
method.
minres minresminimizes a free resolution of an ideal or module.
syz syzcomputes the first syzygy module.
 res(i,r),lres(i,r),sres(i,r),mres(i,r),nres(i,r)compute the first r modules of the resolution
of i, resp. the full resolution if r=0 and the basering is not a qring.
See the manual for a precise description of these commands.Note: The command
 bettidoes not require a minimal
resolution for the minimal Betti numbers.
Now let us take a look at an example which uses resolutions: The Hilbert-Burch
theorem says that the ideal i of a reduced curve in
 has a free resolution of length 2 and that i is given by the 2x2 minors
of the 2nd matrix in the resolution.
We test this for two transversal cusps in  .Afterwards we compute the resolution of the ideal j of the tangent developable
of the rational normal curve in  from above.
Finally we demonstrate the use of the type resolutionin connection with
thelrescommand. 
 |  |   // Two transversal cusps in (k^3,0):
  ring r2 =0,(x,y,z),ds;
  ideal i =z2-1y3+x3y,xz,-1xy2+x4,x3z;
  resolution rs=mres(i,0);   // computes a minimal resolution
  rs;                        // the standard representation of complexes
==>   1       3       2       
==> r2 <--  r2 <--  r2
==> 
==> 0       1       2       
==> 
    list resi=rs;            // conversion to a list
  print(resi[1]);            // the 1st module is i minimized
==> xz,
==> z2-y3+x3y,
==> xy2-x4
  print(resi[2]);            // the 1st syzygy module of i
==> -z,-y2+x3,
==> x, 0,     
==> y, z      
  resi[3];                   // the 2nd syzygy module of i
==> _[1]=0
  ideal j=minor(resi[2],2);
  reduce(j,std(i));          // check whether j is contained in i
==> _[1]=0
==> _[2]=0
==> _[3]=0
  size(reduce(i,std(j)));    // check whether i is contained in j
==> 0
  // size(<ideal>) counts the non-zero generators
  // ---------------------------------------------
  // The tangent developable of the rational normal curve in P^4:
  ring P = 0,(a,b,c,d,e),dp;
  ideal j= 3c2-4bd+ae, -2bcd+3ad2+3b2e-4ace,
           8b2d2-9acd2-9b2ce+9ac2e+2abde-1a2e2;
  resolution rs=mres(j,0);
  rs;
==>  1      2      1      
==> P <--  P <--  P
==> 
==> 0      1      2      
==> 
  list L=rs;
  print(L[2]);
==> 2bcd-3ad2-3b2e+4ace,
==> -3c2+4bd-ae         
  // create an intmat with graded Betti numbers
  intmat B=betti(rs);
  // this gives a nice output of Betti numbers
  print(B,"betti");
==>            0     1     2
==> ------------------------
==>     0:     1     -     -
==>     1:     -     1     -
==>     2:     -     1     -
==>     3:     -     -     1
==> ------------------------
==> total:     1     2     1
==> 
  // the user has access to all Betti numbers
  // the 2-nd column of B:
  B[1..4,2];
==> 0 1 1 0
  ring cyc5=32003,(a,b,c,d,e,h),dp;
  ideal i=
  a+b+c+d+e,
  ab+bc+cd+de+ea,
  abc+bcd+cde+dea+eab,
  abcd+bcde+cdea+deab+eabc,
  h5-abcde;
  resolution rs=lres(i,0);   //computes the resolution according LaScala
  rs;                        //the shape of the minimal resolution
==>     1         5         10         10         5         1         
==> cyc5 <--  cyc5 <--  cyc5 <--   cyc5 <--   cyc5 <--  cyc5
==> 
==> 0         1         2          3          4         5         
==> 
  print(betti(rs),"betti");  //shows the Betti-numbers of cyclic 5
==>            0     1     2     3     4     5
==> ------------------------------------------
==>     0:     1     1     -     -     -     -
==>     1:     -     1     1     -     -     -
==>     2:     -     1     1     -     -     -
==>     3:     -     1     2     1     -     -
==>     4:     -     1     2     1     -     -
==>     5:     -     -     2     2     -     -
==>     6:     -     -     1     2     1     -
==>     7:     -     -     1     2     1     -
==>     8:     -     -     -     1     1     -
==>     9:     -     -     -     1     1     -
==>    10:     -     -     -     -     1     1
==> ------------------------------------------
==> total:     1     5    10    10     5     1
==> 
  dim(rs);                   //the homological dimension
==> 4
  size(list(rs));            //gets the full (non-reduced) resolution
==> 6
  minres(rs);                //minimizes the resolution
==>     1         5         10         10         5         1         
==> cyc5 <--  cyc5 <--  cyc5 <--   cyc5 <--   cyc5 <--  cyc5
==> 
==> 0         1         2          3          4         5         
==> 
  size(list(rs));            //gets the minimized resolution
==> 6
 | 
 
 |