Index: Singular/LIB/monomialideal.lib
===================================================================
--- Singular/LIB/monomialideal.lib	(revision c0b2e03243dcc8b84e3afb3a38cac55b6bb590c8)
+++ Singular/LIB/monomialideal.lib	(revision 28c48782282ffdadf330a53afdac48463c228c26)
@@ -1,62 +1,52 @@
+// last modified:  10.06.2010
 //////////////////////////////////////////////////////////////////////////////
 version = "$Id$";
 category = "Commutative algebra";
 info = "
-LIBRARY: monomialideal.lib   Primary and irreducible decompositions of
-                             monomial ideals
-AUTHORS: I.Bermejo,          ibermejo@ull.es
-@*       E.Garcia-Llorente,  evgarcia@ull.es
-@*       Ph.Gimenez,         pgimenez@agt.uva.es
+LIBRARY: monomialideal.lib   Primary and irreducible decompositions of monomial
+                             ideals
+AUTHORS: I.Bermejo,           ibermejo@ull.es
+@*       E.Garcia-Llorente,   evgarcia@ull.es
+@*       Ph.Gimenez,          pgimenez@agt.uva.es
 
 OVERVIEW:
- A library for computing a primary and the irreducible decomposition of
- a monomial ideal using several methods.@*
- In addition, taking advantage of the fact that the ideals under
- consideration are monomial, the library offers some basic operations
- on ideals which are Groebner free in the monomial case (radical,
- intersection, ideal quotient...). Note, however, that the general
- Singular kernel commands for these operations are usually faster.
- In a future edition of Singular, the specialized algorithms will also
- be implemented in the Singular kernel.
-
- Literature: Miller, Ezra  and Sturmfels, Bernd: Combinatorial Commutative
-             Algebra, Springer 2004
+ A library for computing a primary and the irreducible decompositions of a
+ monomial ideal using several methods.
+ In this library we also take advantage of the fact that the ideal is
+ monomial to make some computations that are Grobner free in this case
+ (radical, intersection, quotient...).
 
 PROCEDURES:
- isMonomial(id);        checks whether an ideal id is monomial
- minbaseMon(id);        computes the minimal monomial generating set of a
-                        monomial ideal id
- gcdMon(f,g);           computes the gcd of two monomials f, g
- lcmMon(f,g);           computes the lcm of two monomials f, g
- membershipMon(f,id);   checks whether a polynomial f belongs to a monomial
-                        ideal id
- intersectMon(id1,id2); intersection of monomial ideals id1 and id2
- quotientMon(id1,id2);  quotient ideal id1:id2
- radicalMon(id);        computes the radical of a monomial ideal id
- isprimeMon(id);        checks whether a monomial ideal id is prime
- isprimaryMon(id);      checks whether a monomial ideal id is primary
- isirreducibleMon(id);  checks whether a monomial ideal id is irreducible
- isartinianMon(id);     checks whether a monomial ideal id is artininan
- isgenericMon(id);      checks whether a monomial ideal id is generic, i.e.,
-                        no two minimal generators of it agree in the exponent
-                        of any variable that actually appears in both of them
- dimMon(id);            dimension of a monomial ideal id
- irreddecMon(id,..);    computes the irreducible decomposition of a monomial
-                        ideal id
- primdecMon(id,..);     computes a minimal primary decomposition of a monomial
-                        ideal id
+ isMonomial(id);       checks whether an ideal id is monomial
+ minbaseMon(id);       computes the minimal monomial generating set of a
+                       monomial ideal id
+ gcdMon(f,g);          computes the gcd of two monomials f, g
+ lcmMon(f,g);          computes the lcm of two monomials f, g
+ membershipMon(f,id);  checks whether a polynomial f belongs to a monomial
+                       ideal id
+ intersectMon(id1,id2);intersection of monomial ideals id1 and id2
+ quotientMon(id1,id2); quotient ideal id1:id2
+ radicalMon(id);       computes the radical of a monomial ideal id
+ isprimeMon(id);       checks whether a monomial ideal id is prime
+ isprimaryMon(id);     checks whether a monomial ideal id is primary
+ isirreducibleMon(id); checks whether a monomial ideal id is irreducible
+ isartinianMon(id);    checks whether a monomial ideal id is artininan
+ isgenericMon(id);     checks whether a monomial ideal id is generic
+ dimMon(id);           dimension of a monomial ideal id
+ irreddecMon(id,..);   computes the irreducible decomposition of a monomial
+                       ideal id
+ primdecMon(id,..);    computes a minimal primary decomposition of a monomial
+                       ideal id
 ";
-
 LIB "poly.lib";  // Para "maxdeg1" en "isprimeMon"
-
 //---------------------------------------------------------------------------
 //-----------------------   INTERNOS    -------------------------------------
 //---------------------------------------------------------------------------
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc checkIdeal (ideal I)
 "
 USAGE:    checkIdeal (I); I ideal.
-RETURN:   1, if the given generators of I are monomials; 0, otherwise.
+RETURN:   1, if ideal is generated by monomials; 0, otherwise.
 "
 // Aqui NO estoy quitando el caso de que el ideal sea el trivial.
@@ -73,11 +63,11 @@
   return (1);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-static proc quotientIdealMon (ideal I, poly f)
+//
+static proc quotientIdealMon (ideal I,poly f)
 "
 USAGE:    quotientIdealMon(I,f); I ideal, f polynomial.
 RETURN:   an ideal, the quotient ideal I:(f).
-ASSUME:   I is an ideal given by a list of monomials and f is a monomial
+ASSUME:   I is an ideal generated by a list of monomials and f is a monomial
           of the basering.
 "
@@ -106,6 +96,6 @@
   return ( minbase(J) );
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc soporte (poly f)
 "
@@ -140,16 +130,16 @@
   return(sop);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc irredAux (ideal I)
 "
 USAGE:    irredAux (I); I ideal.
-RETURN:   1, if I is irreducible; otherwise, an intvec whose first entry is
+RETURN:   1, if I is irreducible; otherwise, an intvec whose fist entry is
           the position of a generator which is the product of more than one
-          variable, the next entries are the indices of those variables.
+          variable, the next entries are the indexes of those variables.
 ASSUME:   I is a monomial ideal of the basering K[x(1)..x(n)] and it is
           generated by its minimal monomial generators.
 NOTE:     This procedure is a modification of isirreducibleMon to give
-          more information when the ideal is not irreducible.
+          more information when ideal is not irreducible.
 "
 {
@@ -182,11 +172,11 @@
   return(1);
 }
-
-/////////////////////////////////////////////////////////////////////////////
-static proc contents (ideal I, ideal J)
+//////////////////////////////////////////////////////////////////////
+//
+static proc contents (ideal I,ideal J)
 "
 USAGE:    contents (I,J); I,J ideals.
 RETURN:   1, if I is contained in J; 0, otherwise.
-ASSUME:   I, J are monomial ideals of the basering.
+ASSUME:   I,J are monomial ideals of the basering.
 "
 {
@@ -207,11 +197,11 @@
   return(1);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-static proc equal (ideal I, ideal J)
+//
+static proc equal (ideal I,ideal J)
 "
 USAGE:    equal (I,J); I,J ideals.
 RETURN:   1, if I and J are the same ideal; 0, otherwise.
-ASSUME:   I, J are monomial ideals of the basering and are defined by their
+ASSUME:   I,J are monomial ideals of the basering and are defined by their
           minimal monomial generators.
 "
@@ -222,5 +212,5 @@
   // Si no tienen el mismo numero de generadores, no pueden ser iguales; ya
   // que vienen dados por el sistema minimal de generadores.
-  if (ncols(I) <> ncols(J))
+  if (size(I) <> size(J))
   {
     return(0);
@@ -243,6 +233,6 @@
   //return(1);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc radicalAux (ideal I)
 "
@@ -279,6 +269,6 @@
   return (rad);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc primAux (ideal I)
 "
@@ -287,8 +277,8 @@
           0, the second is the index of one variable such that a power of it
           does not appear as a generator of I, the rest of the elements are
-          the position in the ideal of those elements of I which are product
-          of more than one variable.
+          the situation in the ideal of that elements of I which
+          are product of more than one variable.
 ASSUME:   I is a monomial ideal of the basering K[x(1)..x(n)].
-NOTE:     This procedure detects if the ideal is primary. When the
+NOTE:     This procedure detects if the ideal is primary, when the
           ideal is not primary, it gives some additional information.
 "
@@ -346,7 +336,7 @@
   return (1);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-static proc maxExp (ideal I, intvec v)
+//
+static proc maxExp (ideal I,intvec v)
 "
 USAGE:    maxExp (I,v); I ideal, v integer vector.
@@ -356,5 +346,5 @@
           variable considered is v[2].
           If the ideal I is primary, it returns 0.
-NOTE:     The elements of the vector suggest what variable and which
+NOTE:     The elements of the vector shows what variable and what
           generators we must consider to look for the greatest power
           of this variable.
@@ -381,6 +371,6 @@
   return (max);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc irredundant (list l)
 "
@@ -388,5 +378,5 @@
 RETURN:   a list such that the intersection of the elements in that list has
           no redundant component.
-ASSUME:   The elements of l are monomial ideals of the basering.
+ASSUME:   elements of l are monomial ideals of the basering.
 "
 {
@@ -419,7 +409,7 @@
   return (l);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-static proc alexDif (intvec v, ideal I)
+//
+static proc alexDif (intvec v,ideal I)
 "
 USAGE:    alexDif (v,I); v, intvec; I, ideal.
@@ -428,5 +418,5 @@
 ASSUME:   I is a monomial ideal of the basering K[x(1),...,x(n)] given by
           its minimal monomial generators and v is an integer vector with
-          n entries s.t. monomial(v) is a multiple of all minimal monomial
+          n entries s.t.monomial(v) is a multiple of all minimal monomial
           generators of I.
 "
@@ -461,6 +451,6 @@
   return (l);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc irredPrimary (list l1)
 "
@@ -513,12 +503,12 @@
   return (l3);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc isMinimal (ideal I)
 "
 USAGE:    isMinimal (I); I ideal.
-RETURN:   1, if the given generators of I are the minimal ones;
+RETURN:   1, if the generators of I are the minimal ones;
           0 & minimal generators of I, otherwise.
-ASSUME:   I is an ideal of the basering given by monomial generators.
+ASSUME:   I is an ideal of the basering generated by monomials.
 "
 {
@@ -559,5 +549,5 @@
         I = J;
         i--;
-        sizI = ncols(I);
+        sizI = size(I);
       }
     }
@@ -572,6 +562,6 @@
   }
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 static proc isMonomialGB (ideal I)
 "
@@ -579,8 +569,8 @@
 RETURN:   a list, 1 & the minimal generators of I, if I is a monomial ideal;
           0, otherwise.
-ASSUME:   I is an ideal of the basering whose given generators are not
+ASSUME:   I is an ideal of the basering which is not generated by
           monomials.
-NOTE:     This procedure is NOT Groebner free and should be used only if the
-          given generators are not monomials. (Use the proc checkIdeal first.)
+NOTE:     this procedure is NOT Grobner free and should be used only if the
+          ideal has non-monomial generators (use first checkIdeal)
 "
 {
@@ -610,5 +600,4 @@
   }
 }
-
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -616,7 +605,7 @@
 // WARNING: this is not a test, when the answer is 1 and the decompositions
 //          may not coincide but it is fast and easy and when the answer is
-//          0 the decompositions do not coincide.
-//
-proc areEqual(list l1, list l2)
+//          0 the decomposition do not coincide.
+//
+proc areEqual(list l1,list l2)
 {
   int i,j,sizIdeal;
@@ -647,5 +636,4 @@
   return (equal(l1Ideal,l2Ideal));
 }
-
 /////////////////////////////////////////////////////////////////////////////
 //-------------------------------------------------------------------------//
@@ -653,9 +641,8 @@
 //-------------------------------------------------------------------------//
 /////////////////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////////////////
+//
 proc isMonomial (ideal I)
-"USAGE:   isMonomial (I); I ideal
-RETURN:   1, if I is a monomial ideal; 0, otherwise.
+"USAGE:    isMonomial (I); I ideal.
+RETURN:   1, if I is monomial ideal; 0, otherwise.
 ASSUME:   I is an ideal of the basering.
 EXAMPLE:  example isMonomial; shows some examples.
@@ -694,10 +681,10 @@
  isMonomial(J);
 }
-
 /////////////////////////////////////////////////////////////////////////////
+//
 proc minbaseMon (ideal I)
-"USAGE:   minbaseMon (I); I ideal.
+"USAGE:    minbaseMon (I); I ideal.
 RETURN:   an ideal, the minimal monomial generators of I.
-          -1 if the given generators of I are not monomials
+          (-1 if the generators of I are not monomials)
 ASSUME:   I is an  ideal generated by a list of monomials of the basering.
 EXAMPLE:  example minbaseMon; shows an example.
@@ -711,5 +698,5 @@
   if (control == 0)
   {
-    ERROR ("the ideal is not monomial");
+    return (-1);
   }
   // Quitamos los ceros del sistema de generadores.
@@ -758,8 +745,8 @@
  minbaseMon(I);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-proc gcdMon (poly f, poly g)
-"USAGE:   gcdMon (f,g); f,g polynomials.
+//
+proc gcdMon (poly f,poly g)
+"USAGE:    gcdMon (f,g); f,g polynomials.
 RETURN:   a monomial, the greatest common divisor of f and g.
 ASSUME:   f and g are monomials of the basering.
@@ -804,8 +791,8 @@
   gcdMon(f,g);
 }
-
 /////////////////////////////////////////////////////////////////////////////
-proc lcmMon (poly f, poly g)
-"USAGE:   lcmMon (f,g); f, g polynomials.
+//
+proc lcmMon (poly f,poly g)
+"USAGE:    lcmMon (f,g); f,g polynomials.
 RETURN:   a monomial,the least common multiple of f and g.
 ASSUME:   f,g are monomials of the basering.
@@ -849,10 +836,10 @@
   lcmMon(f,g);
 }
-
-/////////////////////////////////////////////////////////////////////////////
-proc membershipMon(poly f, ideal I)
-"USAGE:   membershipMon(f, I); f polynomial, I ideal.
+//////////////////////////////////////////////////////////////////////
+//
+proc membershipMon(poly f,ideal I)
+"USAGE:    membershipMon(f,I); f polynomial, I ideal.
 RETURN:   1, if f lies in I; 0 otherwise.
-          -1 if I and f are nonzero and I is not a monomial ideal
+          (-1 if I and f are nonzero and I is not a monomial ideal)
 ASSUME:   I is a monomial ideal of the basering.
 EXAMPLE:  example membershipMon; shows some examples
@@ -951,13 +938,12 @@
  membershipMon(g,I);
 }
-
-/////////////////////////////////////////////////////////////////////////////
-proc intersectMon (ideal I, ideal J)
-"USAGE:   intersectMon (I, J); I, J ideals.
+//////////////////////////////////////////////////////////////////////
+//
+proc intersectMon (ideal I,ideal J)
+"USAGE:    intersectMon (I,J); I,J ideals.
 RETURN:   an ideal, the intersection of I and J.
           (it returns -1 if I or J are not monomial ideals)
 ASSUME:   I,J are monomial ideals of the basering.
 NOTE:     the minimal monomial generating set is returned.
-          USING THE SINGULAR COMMAND 'intersect' IS USUALLY FASTER
 EXAMPLE:  example intersectMon; shows some examples
 "
@@ -1037,11 +1023,11 @@
  intersectMon (I,J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
-proc quotientMon (ideal I, ideal J)
-"USAGE:   quotientMon (I, J); I, J ideals.
+//////////////////////////////////////////////////////////////////////
+//
+proc quotientMon (ideal I,ideal J)
+"USAGE:    quotientMon (I,J); I,J ideals.
 RETURN:   an ideal, the quotient I:J.
           (returns -1 if I or J is not monomial)
-ASSUME:   I, J are monomial ideals of the basering.
+ASSUME:   I,J are monomial ideals of the basering.
 NOTE:     the minimal monomial generating set is returned.
 EXAMPLE:  example quotientMon; shows an example.
@@ -1084,4 +1070,5 @@
     {
       ERROR ("the second ideal is not monomial.");
+      return (-1);
     }
     else
@@ -1119,12 +1106,12 @@
  quotientMon (I,J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc radicalMon(ideal I)
-"USAGE:   radicalMon(I); I ideal
+"USAGE:    radicalMon(I); I ideal
 RETURN:   an ideal, the radical ideal of the ideal I.
           (returns -1 if I is not a monomial ideal)
 ASSUME:   I is a monomial ideal of the basering.
-NOTE:     The minimal monomial generating set is returned.
+NOTE:     the minimal monomial generating set is returned.
 EXAMPLE:  example radicalMon; shows an example.
 "
@@ -1186,8 +1173,8 @@
  radicalMon(I);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc isprimeMon (ideal I)
-"USAGE:   isprimeMon (I); I ideal
+"USAGE:    isprimeMon (I); I ideal
 RETURN:   1, if I is prime; 0, otherwise.
           (returns -1 if I is not a monomial ideal)
@@ -1236,8 +1223,8 @@
  isprimeMon (J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc isprimaryMon (ideal I)
-"USAGE:   isprimaryMon (I); I ideal
+"USAGE:    isprimaryMon (I); I ideal
 RETURN:   1, if I is primary; 0, otherwise.
           (returns -1 if I is not a monomial ideal)
@@ -1338,10 +1325,10 @@
  isprimaryMon (J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc isirreducibleMon (ideal I)
-"USAGE:   isirreducibleMon(I); I ideal
+"USAGE:    isirreducibleMon(I); I ideal
 RETURN:   1, if I is irreducible; 0, otherwise.
-          returns -1 if I is not a monomial ideal
+          (return -1 if I is not a monomial ideal)
 ASSUME:   I is a monomial ideal of the basering.
 EXAMPLE:  example isirreducibleMon; shows some examples
@@ -1394,10 +1381,10 @@
  isirreducibleMon (J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc isartinianMon (ideal I)
-"USAGE:   isartinianMon(I); I ideal.
+"USAGE:    isartinianMon(I); I ideal.
 RETURN:   1, if ideal is artinian; 0, otherwise.
-          returns -1 if ideal I is not a monmomial ideal
+          (return -1 if ideal I is not a monmomial ideal).
 ASSUME:   I is a monomial ideal of the basering.
 EXAMPLE:  example isartinianMon; shows some examples
@@ -1462,10 +1449,10 @@
  isartinianMon (J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc isgenericMon (ideal I)
-"USAGE:   isgenericMon(I); I ideal.
+"USAGE:    isgenericMon(I); I ideal.
 RETURN:   1, if ideal is generic; 0, otherwise.
-          returns -1 if ideal I is not a monomial ideal
+          (return -1 if ideal I is not a monomial ideal)
 ASSUME:   I is a monomial ideal of the basering.
 EXAMPLE:  example isgenericMon; shows some examples.
@@ -1533,11 +1520,11 @@
  isgenericMon (J);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc dimMon (ideal I)
-"USAGE:  dimMon (I); I ideal
+"USAGE:   dimMon (I); I ideal
 RETURN:  an integer, the dimension of the affine variety defined by
          the ideal I.
-         returns -1 if I is not a monomial ideal
+         (returns -1 if I is not a monomial ideal)
 ASSUME:  I is a monomial ideal of the basering.
 EXAMPLE: example dimMon; shows some examples.
@@ -1640,5 +1627,4 @@
  dimMon (J);
 }
-
 /////////////////////////////////////////////////////////////////////////////
 //-------------------------------------------------------------------------//
@@ -1646,6 +1632,5 @@
 //-------------------------------------------------------------------------//
 /////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 1: Metodo directo para descomp. irreducible (ver Vasconcelos)
 //
@@ -1656,4 +1641,5 @@
 // (Vasconcelos)                                                    //
 //////////////////////////////////////////////////////////////////////
+//
 static proc irredDec1 (ideal I)
 {
@@ -1721,9 +1707,9 @@
   return (l2);
 }
-
 //////////////////////////////////////////////////////////////////////
 // La siguiente funcion va a obtener una descomposicion primaria    //
 // minimal a partir de la irreducible anterior.                     //
 //////////////////////////////////////////////////////////////////////
+//
 static proc primDec1 (ideal I)
 {
@@ -1736,6 +1722,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 2: Metodo directo para descomp. primaria (ver Vasconcelos)
 //
@@ -1746,4 +1731,5 @@
 //  hace uso de esta (Vasconcelos).                                 //
 //////////////////////////////////////////////////////////////////////
+//
 static proc primDec2 (ideal I)
 {
@@ -1797,5 +1783,5 @@
   return (l2);
 }
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 3: via dual de Alexander y doble dual (Miller)
 //
@@ -1805,4 +1791,5 @@
 // ideal de partida (Miller)                                        //
 //////////////////////////////////////////////////////////////////////
+//
 static proc irredDec3 (ideal I)
 {
@@ -1835,9 +1822,9 @@
   return (l);
 }
-
 //////////////////////////////////////////////////////////////////////
 // En este caso hallamos una descomposicion primaria minimal usando //
 // la irreducible irredundante del procedimiento anterior.          //
 //////////////////////////////////////////////////////////////////////
+//
 static proc primDec3 (ideal I)
 {
@@ -1850,6 +1837,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 4: via dual de Alexander y cociente (Miller)
 //
@@ -1859,4 +1845,5 @@
 // Alexander (con el cociente) (Miller)                             //
 //////////////////////////////////////////////////////////////////////
+//
 static proc irredDec4 (ideal I)
 {
@@ -1907,5 +1894,4 @@
   return (L);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Ahora hallamos una descomposicion primaria irredundante usando   //
@@ -1913,4 +1899,5 @@
 // ideal monomial dado por sus generadores minimales.               //
 //////////////////////////////////////////////////////////////////////
+//
 static proc primDec4 (ideal I)
 {
@@ -1923,6 +1910,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 5: un misterio!!
 //
@@ -1932,4 +1918,5 @@
 // irreducibles del ideal 1-1.                                      //
 //////////////////////////////////////////////////////////////////////
+//
 static proc irredDec5 (ideal I)
 {
@@ -2015,5 +2002,4 @@
   return (facets);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Ahora hallamos una descomposicion primaria irredundante usando   //
@@ -2021,4 +2007,5 @@
 // ideal monomial dado por sus generadores minimales.               //
 //////////////////////////////////////////////////////////////////////
+//
 static proc primDec5 (ideal I)
 {
@@ -2031,6 +2018,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 6: via complejo de Scarf (Milovsky)
 //
@@ -2043,4 +2029,5 @@
 // generadores del ideal.                                           //
 //////////////////////////////////////////////////////////////////////
+//
 static proc maximoExp(ideal I,int i)
 {
@@ -2060,5 +2047,4 @@
   return(max);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Esta funcion estudia si un ideal monomial dado por su sistema    //
@@ -2067,4 +2053,5 @@
 // que han sido introducidos.                                       //
 //////////////////////////////////////////////////////////////////////
+//
 static proc artinian (ideal I)
 {
@@ -2150,5 +2137,4 @@
   }
 }
-
 //////////////////////////////////////////////////////////////////////
 // En este caso vamos primero a chequear si el ideal es o no        //
@@ -2156,4 +2142,5 @@
 // pues estos son una aplicacion biyectiva.                         //
 //////////////////////////////////////////////////////////////////////
+//
 static proc generic (ideal I)
 {
@@ -2219,5 +2206,4 @@
   }
 }
-
 //////////////////////////////////////////////////////////////////////
 // Esta funci?n obtiene una descomposicion irreducible del ideal    //
@@ -2225,4 +2211,5 @@
 // generico que le asociamos.                                       //
 //////////////////////////////////////////////////////////////////////
+//
 static proc nonGeneric (EXP,NEWEXP,Faces,sizI)
 {
@@ -2259,5 +2246,4 @@
   return (newFaces);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Este procedimiento va a dar una faceta inicial para el complejo  //
@@ -2265,4 +2251,5 @@
 // y generico (evidentemente I dado por la bse minimal)             //
 //////////////////////////////////////////////////////////////////////
+//
 static proc initialFacet (ideal I)
 {
@@ -2351,9 +2338,9 @@
   return (face);
 }
-
 //////////////////////////////////////////////////////////////////////
 // La funcion que sigue devuelve las facetas adyacentes a una dada  //
 // en el complejo de Scarf asociado a I.                            //
 //////////////////////////////////////////////////////////////////////
+//
 static proc adyacency (list l1, ideal I)
 {
@@ -2515,9 +2502,9 @@
   return(l2);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Metodo que calcula la descomposicion irreducible de un ideal     //
 // monomial usando el complejo de Scarf (Milowski)                  //
 //////////////////////////////////////////////////////////////////////
+//
 static proc ScarfMethod (ideal I)
 {
@@ -2666,5 +2653,5 @@
   }
   // Generico
-  sizI = ncols(I);
+  sizI = size(I);
   if (genericlist[1] == 0)
   {
@@ -2694,9 +2681,9 @@
   return(Faces);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Devuelve una descomposicion primaria minimal de un ideal         //
 // monomial via el complejo de Scarf.                               //
 //////////////////////////////////////////////////////////////////////
+//
 static proc scarfMethodPrim (ideal I)
 {
@@ -2710,6 +2697,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 7: algoritmo de etiquetas (Roune)
 //
@@ -2719,4 +2705,5 @@
 // algoritmo de etiquetas de B. Roune.                              //
 //////////////////////////////////////////////////////////////////////
+//
 static proc phi (list F)
 {
@@ -2749,6 +2736,6 @@
   return (listphi);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc pi(poly f)
 {
@@ -2768,6 +2755,6 @@
   return (f);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc conditionComplex (intvec posActual,ideal I,ideal S)
 {
@@ -2826,6 +2813,6 @@
   return (0);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc findFaces (ideal I)
 {
@@ -2879,5 +2866,4 @@
   return (F);
 }
-
 //////////////////////////////////////////////////////////////////////
 // La siguiente funcion calcula la descomposicion en irreducibles de//
@@ -2885,4 +2871,5 @@
 // metodo de Bjarke Roune.                                          //
 //////////////////////////////////////////////////////////////////////
+//
 static proc labelAlgorithm(ideal I)
 {
@@ -2955,10 +2942,10 @@
   return (facets);
 }
-
 //////////////////////////////////////////////////////////////////////
 // Devuelve una descomposicion primaria minimal de un ideal monomial//
 // dado.                                                            //
 //////////////////////////////////////////////////////////////////////
-static proc labelAlgPrim (ideal I)
+//
+static proc  labelAlgPrim (ideal I)
 {
   // VARIABLES
@@ -2971,9 +2958,9 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 8: Gao-Zhu
 //
 //////////////////////////////////////////////////////////////////////
+//
 static proc divide (intvec v, intvec w, int k)
 {
@@ -3000,6 +2987,8 @@
   return (1);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//                                        //
+//////////////////////////////////////////////////////////////////////
+//
 static proc incrementalAlg (ideal I)
 {
@@ -3092,7 +3081,7 @@
   {
     expartI = leadexp(artI[1]);
-    if (ncols(artI) <> 1)
-    {
-      artI = artI[2..ncols(artI)];
+    if (size(artI) <> 1)
+    {
+      artI = artI[2..size(artI)];
     }
     // Hay que distinguir T_1 y T_2. Para ello se comparar vectores
@@ -3210,6 +3199,6 @@
   return (facets);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc  incrementalAlgPrim (ideal I)
 {
@@ -3223,6 +3212,5 @@
   return (l2);
 }
-
-//////////////////////////////////////////////////////////////////////
+//
 // METODO 9: slice algorithm (Roune)
 //
@@ -3230,4 +3218,5 @@
 // SLICE ALGORITHM (B.Roune)                                        //
 //////////////////////////////////////////////////////////////////////
+//
 static proc divideMon (poly f , poly g)
 {
@@ -3245,6 +3234,6 @@
   //return (1);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc pivot (ideal I , poly lcmMin, ideal S)
 {
@@ -3309,6 +3298,6 @@
   }
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc simplification (I)
 {
@@ -3431,6 +3420,6 @@
   return (lcmMi,I);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc con (ideal I , ideal S , poly q)
 {
@@ -3543,6 +3532,6 @@
   return (con(I1,S1,p*q),con(I,S2,q));
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc irredDecMonSlice (ideal I)
 {
@@ -3565,5 +3554,5 @@
   {
     artI = sort(artI)[1];
-    int sizartI = ncols(artI);
+    int sizartI = size(artI);
     for (i = 1 ; i <= sizartI - 1 ; i ++)
     {
@@ -3589,5 +3578,5 @@
   poly comp;
   intvec exp;
-  int sizIrred = ncols(irredDec);
+  int sizIrred = size(irredDec);
   ideal auxIdeal;
   for (i = 1 ; i <= sizIrred ; i ++)
@@ -3621,6 +3610,6 @@
   return (components);
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 static proc primDecMonSlice (ideal I)
 {
@@ -3634,5 +3623,4 @@
   return (l2);
 }
-
 //////////////////////////////////////////////////////////////////////
 //                                                                  //
@@ -3641,14 +3629,11 @@
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////////////////
+//
 proc irreddecMon
-"USAGE:   irreddecMon (I[,alg]); I ideal, alg string.
+"USAGE:    irreddecMon (I[,alg]); I ideal, alg string.
 RETURN:   list, the irreducible components of the monomial ideal I.
           (returns -1 if I is not a monomial ideal).
 ASSUME:   I is a monomial ideal of the basering k[x(1)..x(n)].
-NOTE:     This procedure returns the irreducible decomposition of I,
-          i.e., the unique irredundant decomposition of I into irreducible
-          monomial ideals.
+NOTE:     This procesure returns the irreducible decomposition of I.
           One may call the procedure with different algorithms using
           the optional argument 'alg':
@@ -3748,12 +3733,12 @@
  irreddecMon(I,"sr");
 }
-
-/////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//
 proc primdecMon
-"USAGE:   primdecMon (I[,alg]); I ideal, alg string
+"USAGE:    primdecMon (I[,alg]); I ideal, alg string
 RETURN:   list, the components in a minimal primary decomposition of I.
           (returns -1 if I is not a monomial ideal).
 ASSUME:   I is a monomial ideal of the basering k[x(1)..x(n)].
-NOTE:     This procedure returns a minimal primary decomposition of I.
+NOTE:     This procesure returns a minimal primary decomposition of I.
           One may call the procedure with different algorithms using
           the optional argument 'alg':
