Index: Singular/LIB/freegb.lib
===================================================================
--- Singular/LIB/freegb.lib	(revision 957ae4a188be9d0bde5a80631c9bfd11d670f27a)
+++ Singular/LIB/freegb.lib	(revision 805b2d5487ee3197c7a4c071e48dfbb5865bb03a)
@@ -1,4 +1,4 @@
 //////////////////////////////////////////////////////////////////////////////
-version="$Id: freegb.lib,v 1.18 2009-03-06 20:54:45 levandov Exp $";
+version="$Id: freegb.lib,v 1.19 2009-03-10 18:15:13 levandov Exp $";
 category="Noncommutative";
 info="
@@ -21,7 +21,7 @@
 vct2str(M[, n]);   convert a vector into a word in free algebra
 lieBracket(a,b[, N]);    compute Lie bracket ab-ba of two letterplace polynomials
-serreRelations(A,z);          compute the ideal of Serre's relations associated to a generalized Cartan matrix A
-isVar(p);             check whether p is a power of a single variable
-adem(i,j);            compute the ideal of Adem relations for i<2j in char 0
+serreRelations(A,z);   compute the ideal of Serre's relations associated to a generalized Cartan matrix A
+isVar(p);                   check whether p is a power of a single variable
+ademRelations(i,j);    compute the ideal of Adem relations for i<2j in char 0
 
 SEE ALSO: LETTERPLACE
@@ -136,4 +136,5 @@
 {
   // skips zeros in a vector, producing another vector
+  if ( (v[1]==0) || (v==0) ) { return(vector(0)); }
   int sv = nrows(v);
   int sw = size(v);
@@ -170,4 +171,8 @@
   if ( size(#)>0 )
   {
+    if ( typeof(#[1]) != "int")
+    {
+      ERROR("Second argument of type int expected");
+    }
     if (#[1])
     {
@@ -177,4 +182,5 @@
   int i;
   int s    = size(L);
+  if (s<1) { return(list(""));}
   list N;
   for(i=1; i<=s; i++)
@@ -212,4 +218,5 @@
 "
 {
+  if (size(M)==0) { return(""); }
   // returns a string
   // a sentence in words built from M
@@ -218,4 +225,8 @@
   if ( size(#)>0 )
   {
+    if ( typeof(#[1]) != "int")
+    {
+      ERROR("Second argument of type int expected");
+    }
     if (#[1])
     {
@@ -236,5 +247,8 @@
     else
     {
-      t = t + "+" + mp;
+      if (mp != "")
+      {
+         t = t + "+" + mp;
+      }
     }
   }
@@ -262,4 +276,5 @@
 "
 {
+  if (v==0) { return(""); }
   // if #[1] = 1, use * between generators
   int useStar = 0;
@@ -275,4 +290,5 @@
   // produces a string for it
   v = skip0(v);
+  if (v==0) { return(string(""));}
   number cf = leadcoef(v[1]);
   int s = size(v);
@@ -284,7 +300,8 @@
     if (p==0)
     {
-      err = "Error: monomial expected at" + string(i+1);
-      dbprint(ppl,err);
-      return("_");
+      err = "Error: monomial expected at nonzero position " + string(i+1);
+      ERROR(err+" in vct2str");
+      //      dbprint(ppl,err);
+      //      return("_");
     }
     if (p==1)
@@ -324,5 +341,5 @@
   {
     scf = string(cf);
-    if (cf == 1)
+    if ( (cf == 1) && (size(vs)>0) )
     {
       scf = "";
@@ -348,6 +365,6 @@
 "USAGE:  isVar(p);  poly p
 RETURN:  int
-PURPOSE: checks whether p is a power of a single variable from the basering.
-@* Returns the exponent or 0 is p is not a power of  a single variable.
+PURPOSE: check, whether leading monomial of p is a power of a single variable 
+@* from the basering. Returns the exponent or 0 if p is multivariate.
 EXAMPLE: example isVar; shows examples
 "
@@ -381,7 +398,7 @@
   poly f = xy+1;
   isVar(f);
-  poly g = xy;
+  poly g = y^3;
   isVar(g);
-  poly h = y^3;
+  poly h = 7*x^3;
   isVar(h);
   poly i = 1;
@@ -1506,11 +1523,11 @@
 end older procs and tests */
 
-proc adem(int i, int j)
-"USAGE:  adem(i,j); i,j int
+proc ademRelations(int i, int j)
+"USAGE:  ademRelations(i,j); i,j int
 RETURN:  ring (and exports ideal)
 ASSUME: there are at least i+j variables in the basering
 PURPOSE: compute the ideal of Adem relations for i<2j in characteristic 0
 @*  the ideal is exported under the name AdemRel in the output ring
-EXAMPLE: example adem; shows examples
+EXAMPLE: example ademRelations; shows examples
 "
 {
@@ -1545,5 +1562,5 @@
 {
   "EXAMPLE:"; echo = 2;
-  def A = adem(2,5);
+  def A = ademRelations(2,5);
   setring A;
   AdemRel;
@@ -2526,2 +2543,13 @@
   return(0);
 }
+
+// alias libs for compatibility with older examples
+proc freegbRing(int d)
+{
+  return(makeLetterplaceRing(d));
+}
+
+proc freegbasis( list L, int n)
+{
+  return(freeGBasis(L, n));
+}
