Index: Singular/LIB/normal.lib
===================================================================
--- Singular/LIB/normal.lib	(revision a9cf54361b742e9fc5c8efe5927396e566518869)
+++ Singular/LIB/normal.lib	(revision b15ad03af9e72370358f8fc319adab20d9bb7b3f)
@@ -5,5 +5,5 @@
 ///////////////////////////////////////////////////////////////////////////////
 
-version="$Id: normal.lib,v 1.23 2000-05-09 14:28:41 Singular Exp $";
+version="$Id: normal.lib,v 1.24 2000-05-10 13:05:16 pfister Exp $";
 info="
 LIBRARY:  normal.lib     PROCEDURES FOR NORMALIZATION
@@ -377,5 +377,5 @@
 proc normal(ideal id, list #)
 "USAGE:   normal(i [,choose]);  i a radical ideal, choose empty or 1
-         if choose=1 the factorizing Buchberger algorithm is not used
+         if choose=1 the normalization of the associated primes is computed 
          (which is sometimes more efficient)
 RETURN:  a list of rings (say nor), in each ring nor[i] are two ideals
@@ -397,5 +397,6 @@
    list result,prim,keepresult;
    y = printlevel-voice+2;
-
+   
+   attrib(id,"isRadical",1);
    if ( find(ordstr(basering),"s")+find(ordstr(basering),"M") != 0)
    {
@@ -405,140 +406,108 @@
      return(result);
    }
-
+   if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
+   {
+      if(attrib(id,"isCompleteIntersection")==1)
+      {
+         attrib(id,"isCohenMacaulay",1);
+         attrib(id,"isEquidimensional",1);
+      } 
+   }       
+   if( typeof(attrib(id,"isCohenMacaulay"))=="int" )
+   {
+      if(attrib(id,"isCohenMacaulay")==1)
+      {
+         attrib(id,"isEquidimensional",1);
+      } 
+   }       
+   if( typeof(attrib(id,"isPrim"))=="int" )
+   {
+      if(attrib(id,"isPrim")==1)
+      {
+         attrib(id,"isEquidimensional",1);
+      } 
+   }       
    if(size(#)==0)
-//--------------- the factorizing Buchberger algorithm is used ---------------
-   {
-      prim[1]=id;
+   {
       if( typeof(attrib(id,"isEquidimensional"))=="int" )
       {
-        if(attrib(id,"isEquidimensional")==1)
-        {
-           attrib(prim[1],"isEquidimensional",1);
-        }
-      }
-      else
-      {
-         attrib(prim[1],"isEquidimensional",0);
-      }
-      if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
-      {
-        if(attrib(id,"isCompleteIntersection")==1)
-        {
-           attrib(prim[1],"isCompleteIntersection",1);
-        }
-      }
-      else
-      {
-         attrib(prim[1],"isCompleteIntersection",0);
-      }
-
-      if( typeof(attrib(id,"isPrim"))=="int" )
-      {
-        if(attrib(id,"isPrim")==1)  {attrib(prim[1],"isPrim",1); }
-      }
-      else
-      {
-         attrib(prim[1],"isPrim",0);
-      }
-      if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
-      {
-         if(attrib(id,"isIsolatedSingularity")==1)
-             {attrib(prim[1],"isIsolatedSingularity",1); }
-      }
-      else
-      {
-         attrib(prim[1],"isIsolatedSingularity",0);
-      }
-      if( typeof(attrib(id,"isCohenMacaulay"))=="int" )
-      {
-         if(attrib(id,"isCohenMacaulay")==1)
-           { attrib(prim[1],"isCohenMacaulay",1); }
-      }
-      else
-      {
-         attrib(prim[1],"isCohenMacaulay",0);
-      }
-      if( typeof(attrib(id,"isRegInCodim2"))=="int" )
-      {
-         if(attrib(id,"isRegInCodim2")==1)
-         { attrib(prim[1],"isRegInCodim2",1);}
-      }
-      else
-      {
-          attrib(prim[1],"isRegInCodim2",0);
-      }
-
-      result = normalizationPrimes(prim[1],maxideal(1));
-      sr = string(size(result));
-      
-      dbprint(y+1,"
-// 'normal' created a list of "+sr+" ring(s).
-// To see the rings, type (if the name of your list is nor):
-     show( nor);
-// To access the 1-st ring and map (and similair for the others), type:
-     def R = nor[1]; setring R;  norid; normap;
-// R/norid is the 1-st ring of the normalization and
-// normap the map from the original basering to R/norid");
-
-       return(result);
-   }
-   else
-//------------- the factorizing Buchberger algorithm is not used -------------
-   {
-      if(#[1]==0)
-      {
-         prim=minAssPrimes(id);
-      }
-      else
-      {
-         prim=minAssPrimes(id,1);
-      }
-
-      if(y>=1)
-      {
-         "// we have ",size(prim),"components";
-      }
-      for(i=1; i<=size(prim); i++)
-      {
-         if(y>=1)
+         if(attrib(id,"isEquidimensional")==1)
          {
-            "// we are in loop ",i;
-         }
-         attrib(prim[i],"isCohenMacaulay",0);
-         attrib(prim[i],"isPrim",1);
-         attrib(prim[i],"isRegInCodim2",0);
-         attrib(prim[i],"isIsolatedSingularity",0);
-         attrib(prim[i],"isEquidimensional",0);
-         attrib(prim[i],"isCompleteIntersection",0);
-
-         if( typeof(attrib(id,"isEquidimensional"))=="int" )
-         {
-           if(attrib(id,"isEquidimensional")==1)
-           {
-              attrib(prim[i],"isEquidimensional",1);
-           }
+            prim[1]=id;
          }
          else
          {
-            attrib(prim[i],"isEquidimensional",0);
+            prim=equidim(id);
          }
-         if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
+      }
+      else
+      {
+         prim=equidim(id);
+      }
+      if(y>=1)
+      {
+         "// we have ",size(prim),"equidimensional components";
+      }
+   }
+   else
+   {  
+      if( typeof(attrib(id,"isPrim"))=="int" )
+      {
+         if(attrib(id,"isPrim")==1)
          {
+            prim[1]=id;
+         }
+         else
+         {   
+            prim=minAssPrimes(id);
+         }
+      }
+      else
+      {
+         prim=minAssPrimes(id);
+      }         
+      if(y>=1)
+      {
+         "// we have ",size(prim),"irreducible components";
+      }
+   }
+   for(i=1; i<=size(prim); i++)
+   {
+      if(y>=1)
+      {
+         "// we are in loop ",i;
+      }
+      attrib(prim[i],"isCohenMacaulay",0);
+      if(size(#)!=0)
+      {
+         attrib(prim[i],"isPrim",1);
+      }
+      else
+      {
+         attrib(prim[i],"isPrim",0);
+      }
+      attrib(prim[i],"isRegInCodim2",0);
+      attrib(prim[i],"isIsolatedSingularity",0);
+      attrib(prim[i],"isEquidimensional",1);
+      attrib(prim[i],"isCompleteIntersection",0);
+
+      if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
+      {
             if(attrib(id,"isIsolatedSingularity")==1)
              {attrib(prim[i],"isIsolatedSingularity",1); }
-         }
-         else
-         {
-            attrib(prim[i],"isIsolatedSingularity",0);
-         }
-
-         keepresult=normalizationPrimes(prim[i],maxideal(1));
-         for(j=1;j<=size(keepresult);j++)
-         {
-            result=insert(result,keepresult[j]);
-         }
+      }
+
+      if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
+      {
+            if((attrib(id,"isIsolatedSingularity")==1)&&(size(#)==0))
+             {attrib(prim[i],"isIsolatedSingularity",1); }
+      }
+      keepresult=normalizationPrimes(prim[i],maxideal(1));
+      for(j=1;j<=size(keepresult);j++)
+      {
+         result=insert(result,keepresult[j]);
       }
       sr = string(size(result));
-
+   }
       dbprint(y+1,"
 // 'normal' created a list of "+sr+" ring(s). 
@@ -552,5 +521,4 @@
       //kill endphi,endid;
       return(result);
-   }
 }
 example
@@ -618,4 +586,5 @@
      "// SB-computation of the input ideal";
    }
+   
    list SM=mstd(i);                //here the work starts
    int dimSM =  dim(SM[1]);
@@ -688,5 +657,5 @@
       attrib(SM[2],"isRegInCodim2",0);
    }
-    if(attrib(i,"isEquidimensional")==1)
+   if(attrib(i,"isEquidimensional")==1)
    {
       attrib(SM[2],"isEquidimensional",1);
@@ -821,5 +790,4 @@
          dim(JM[1]); "";
       }
-
       attrib(JM[2],"isRad",0);
       //   timer-ti;
@@ -849,5 +817,5 @@
          attrib(SM[2],"isIsolatedSingularity",1);
       }
-      if(dim(JM[1])<=nvars(basering)-2)
+      if(dim(JM[1])<=dim(SM[1])-2)
       {
          attrib(SM[2],"isRegInCodim2",1);
@@ -862,4 +830,24 @@
         attrib(SM[2],"isRegInCodim2",1);
      }
+   }
+   if((attrib(SM[2],"isRegInCodim2")==1)&&(attrib(SM[2],"isCohenMacaulay")==1))
+   {      
+      if(y>=1)
+      {
+            "// the ideal was CohenMacaulay and regular in codimension 2";
+      }
+      MB=SM[2];
+      intvec rw;
+      list LL=substpart(MB,ihp,0,rw);
+      def newR6=LL[1];
+      setring newR6;
+      ideal norid=endid;
+      ideal normap=endphi;
+      kill endid,endphi;
+      export norid;
+      export normap;
+      result=newR6;
+      setring BAS;
+      return(result);          
    }
    //if it is an isolated singularity things are easier
@@ -1262,4 +1250,9 @@
 ring r=32003,(x,y,z),wp(2,3,6);
 ideal i=zy2-zx3-x6;
+
+//Theo1a (CohenMacaulay and regular in codimension 2)
+ring r=32003,(x,y,z,u),wp(2,3,6,6);
+ideal i=zy2-zx3-x6+u2;
+
 
 //Theo2
@@ -1412,4 +1405,8 @@
 puv2-puw;
 
+ring r=0,(u,v,w,x,y,z),wp(1,1,1,3,2,1);
+ideal i=wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;
+
+
 
 */
