Index: Singular/LIB/classify.lib
===================================================================
--- Singular/LIB/classify.lib	(revision 6f033b6b6340279e600b54c5c6afc99b846b49cf)
+++ Singular/LIB/classify.lib	(revision 5c8c19056d07b66b391e75ff3ed5f2a0fefb4faf)
@@ -1,7 +1,7 @@
-e// $Id: classify.lib,v 1.42 2000-05-12 12:25:41 Singular Exp $
+e// $Id: classify.lib,v 1.43 2000-12-04 13:48:16 Singular Exp $
 // KK, last modified: 04.04.1998
 ///////////////////////////////////////////////////////////////////////////////
 
-version  = "$Id: classify.lib,v 1.42 2000-05-12 12:25:41 Singular Exp $";
+version  = "$Id: classify.lib,v 1.43 2000-12-04 13:48:16 Singular Exp $";
 info="
 LIBRARY:  classify.lib  Procedures for the Arnold-Classifier of Singularities
@@ -132,77 +132,85 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Klassifiziere (poly f)
+static proc Klassifiziere (poly f)
 {
 //--------------------------- initialisation ----------------------------------
-    string s1;
-    int    n, cnt, corank_f, K, Mu;
-    list   v, cstn;
-    map    PhiG;
-    def ring_top = basering;
-
-    n = nvars(basering);    // Zahl der Variablen des aktuellen Rings.
-    PhiG = ring_top, maxideal(1);
-    cstn[4] = PhiG;
-    if( defined(@ringdisplay) == 0) {
-      string @ringdisplay;               // Define always 'ringdisplay' to be
-      export @ringdisplay;               // able to run 'Show(f)'
-    }
-    @ringdisplay = "setring RingB;";
-    if(defined(RingB)!=0) { kill RingB; }
-    execute ("ring RingB="+charstr(basering)+",("+A_Z("x", n)+"),(c,ds);");
-    export RingB;
-    setring ring_top;
+  string s1;
+  int    n, cnt, corank_f, K, Mu;
+  list   v, cstn;
+  map    PhiG;
+  def ring_top = basering;
+
+  n = nvars(basering);    // Zahl der Variablen des aktuellen Rings.
+  PhiG = ring_top, maxideal(1);
+  cstn[4] = PhiG;
+  if( defined(@ringdisplay) == 0)
+  {
+    string @ringdisplay;               // Define always 'ringdisplay' to be
+    export @ringdisplay;               // able to run 'Show(f)'
+  }
+  @ringdisplay = "setring RingB;";
+  if(defined(RingB)!=0) { kill RingB; }
+  execute ("ring RingB="+charstr(basering)+",("+A_Z("x", n)+"),(c,ds);");
+  export RingB;
+  setring ring_top;
 
 //---------------------- compute basciinvariants ------------------------------
-    if(jet(f,0) != 0 ) {
-      cstn[1] = corank(f); cstn[2]=-1; cstn[3]=1;
-      return(printresult(1, f, "a unit", cstn, -1));
-    }
-
-    debug_log(1, "Computing Basicinvariants of f ...");
-    K, Mu, corank_f = basicinvariants(f);
-    debug_log(0, "About the singularity :");
-    debug_log(0, "          Milnor number(f)   = "+string(Mu));
-    debug_log(0, "          Corank(f)          = "+string(corank_f));
-    debug_log(0, "          Determinacy       <= "+string(K));
-    cstn[1] = corank_f;
-    cstn[2] = Mu;
-    cstn[3] = K;
-
-    if( Mu == 0) {
-      cstn[1]=1; cstn[3]=1;
-      return(printresult(1, f, "A[0]", cstn, 0)); }
-
-    if(Mu<0) {
-      debug_log(0, "The Milnor number of the function is infinite.");
-      debug_log(0, "The singularity is not in Arnolds list.");
-      return(printresult(1, 1, "error!", cstn, -1));
-    }
-
-    f = jet(f, K);
-    v = HKclass(milnorcode(f));
-    if(v[2]>0) { debug_log(0, "Guessing type via Milnorcode: ", v[1]);}
-    else {
-      debug_log(0, "Hilbert polynomial not recognised. Milnor code = ",
-                milnorcode(f));
-    }
-    debug_log(0, "");
-    debug_log(0, "Computing normal form ...");
+  if(jet(f,0) != 0 )
+  {
+    cstn[1] = corank(f); cstn[2]=-1; cstn[3]=1;
+    return(printresult(1, f, "a unit", cstn, -1));
+  }
+
+  debug_log(1, "Computing Basicinvariants of f ...");
+  K, Mu, corank_f = basicinvariants(f);
+  debug_log(0, "About the singularity :");
+  debug_log(0, "          Milnor number(f)   = "+string(Mu));
+  debug_log(0, "          Corank(f)          = "+string(corank_f));
+  debug_log(0, "          Determinacy       <= "+string(K));
+  cstn[1] = corank_f;
+  cstn[2] = Mu;
+  cstn[3] = K;
+
+  if( Mu == 0)
+  {
+    cstn[1]=1; cstn[3]=1;
+    return(printresult(1, f, "A[0]", cstn, 0));
+  }
+
+  if(Mu<0)
+  {
+    debug_log(0, "The Milnor number of the function is infinite.");
+    debug_log(0, "The singularity is not in Arnolds list.");
+    return(printresult(1, 1, "error!", cstn, -1));
+  }
+
+  f = jet(f, K);
+  v = HKclass(milnorcode(f));
+  if(v[2]>0) { debug_log(0, "Guessing type via Milnorcode: ", v[1]);}
+  else
+  {
+    debug_log(0, "Hilbert polynomial not recognised. Milnor code = ",
+              milnorcode(f));
+  }
+  debug_log(0, "");
+  debug_log(0, "Computing normal form ...");
 
 //------------ step 1, classification according to corank(f) ------------------
-    if(corank_f == 0) {
-       return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0)); }
-    if(corank_f == 1) {
-       return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0)); }
-    cstn[4] = 0;
-    if(corank_f == 2) { return(Funktion1bis(f, cstn)); }
-    if(corank_f == 3) { return(Funktion1bis(f, cstn)); }
-    return(printresult(105, f, "NoClass", cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion1bis (poly f, list cstn)
+  if(corank_f == 0)
+  {
+    return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0));
+  }
+  if(corank_f == 1)
+  {
+    return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0));
+  }
+  cstn[4] = 0;
+  if(corank_f == 2) { return(Funktion1bis(f, cstn)); }
+  if(corank_f == 3) { return(Funktion1bis(f, cstn)); }
+  return(printresult(105, f, "NoClass", cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion1bis (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -270,6 +278,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion3 (poly f, list cstn)
+static proc Funktion3 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -301,6 +308,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion6 (poly f, list cstn)
+static proc Funktion6 (poly f, list cstn)
 { // Arnold's steps 6-12
 //---------------------------- initialisation ---------------------------------
@@ -380,6 +386,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion13 (poly f, list cstn)
+static proc Funktion13 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -418,6 +423,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion17 (poly f, list cstn)
+static proc Funktion17 (poly f, list cstn)
 { // Analog zu Fumktion 6, Kombination 17-24
 //---------------------------- initialisation ---------------------------------
@@ -485,6 +489,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion25 (poly f, list cstn)
+static proc Funktion25 (poly f, list cstn)
 { // Analog zu Fumktion 6, Kombination 25-46
 //---------------------------- initialisation ---------------------------------
@@ -594,6 +597,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion40 (poly f, list cstn, int k)
+static proc Funktion40 (poly f, list cstn, int k)
 {
 //---------------------------- initialisation ---------------------------------
@@ -652,6 +654,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion50 (poly f, list cstn)
+static proc Funktion50 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -705,6 +706,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion58 (poly fin, list cstn)
+static proc Funktion58 (poly fin, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -855,6 +855,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion59 (poly f, list cstn)
+static proc Funktion59 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -933,6 +932,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion66 (poly f, list cstn)
+static proc Funktion66 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -963,6 +961,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion82 (poly f, list cstn)
+static proc Funktion82 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1058,6 +1055,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Isomorphie_s82_z (poly f, poly fk, int p)
+static proc Isomorphie_s82_z (poly f, poly fk, int p)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1086,6 +1082,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Isomorphie_s82_x (poly f, poly fk, int p)
+static proc Isomorphie_s82_x (poly f, poly fk, int p)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1115,6 +1110,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion83 (poly f, list cstn)
+static proc Funktion83 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1202,6 +1196,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion97 (poly f, list cstn)
+static proc Funktion97 (poly f, list cstn)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1319,6 +1312,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Isomorphie_s17 (poly f, poly fk, int k, int ct, list #)
+static proc Isomorphie_s17 (poly f, poly fk, int k, int ct, list #)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1439,6 +1431,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc printresult (int step, poly f, string typ, list cstn, int m)
+static proc printresult (int step, poly f, string typ, list cstn, int m)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1448,11 +1439,14 @@
   corank, Mu, K = cstn[1..3];
   debug_log(0,"   Arnold step number "+string(step));
-  if( @DeBug >= 0 ) {
+  if( @DeBug >= 0 )
+  {
     "The singularity";
     "   "+Show(jet(f, K))+"";
-    if( typ != "error!" && typ != "NoClass" ) {
+    if( typ != "error!" && typ != "NoClass" )
+    {
       "is R-equivalent to "+typ+".";
     }
-    if ( typ == "NoClass" ) {
+    if ( typ == "NoClass" )
+    {
       "is not in Arnolds list.";
     }
@@ -1466,66 +1460,59 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion47 (poly f, list cstn)
-{
-    int corank = cstn[1];
-    int Mu = cstn[2];
-    int K  = cstn[3];
-    string s = "The Singularity ";+Show(jet(f, K), corank, K);
-    string tp="";
-//    return(printresult(47, f, tp, cstn, -1));
-
-    s = s +" has 4-jet equal to zero. (F47), mu="+string(Mu);
-
-    s; // +"  ("+SG_Typ+")";
-    return(Show(f), tp, corank);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion91 (poly f, list cstn, int k)
-{
-    string tp  = "U*[k,0]";
-    return(printresult(91, f, tp, cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion92 (poly f, list cstn, int k)
-{
-    string tp  = "UP[k]";
-    return(printresult(92, f, tp, cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion93 (poly f, list cstn, int k)
-{
-    string tp  = "UQ[k]";
-    return(printresult(93, f, tp, cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion94 (poly f, list cstn, int k)
-{
-    string tp  = "UR[k]";
-    return(printresult(94, f, tp, cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion95 (poly f, list cstn, int k)
-{
-    string tp  = "US[k]";
-    return(printresult(95, f, tp, cstn, -1));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Funktion96 (poly f, list cstn, int k)
-{
-    string tp  = "UT[k]";
-    return(printresult(96, f, tp, cstn, -1));
+static proc Funktion47 (poly f, list cstn)
+{
+  int corank = cstn[1];
+  int Mu = cstn[2];
+  int K  = cstn[3];
+  string s = "The Singularity ";+Show(jet(f, K), corank, K);
+  string tp="";
+//  return(printresult(47, f, tp, cstn, -1));
+
+  s = s +" has 4-jet equal to zero. (F47), mu="+string(Mu);
+
+  s; // +"  ("+SG_Typ+")";
+  return(Show(f), tp, corank);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion91 (poly f, list cstn, int k)
+{
+  string tp  = "U*[k,0]";
+  return(printresult(91, f, tp, cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion92 (poly f, list cstn, int k)
+{
+  string tp  = "UP[k]";
+  return(printresult(92, f, tp, cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion93 (poly f, list cstn, int k)
+{
+  string tp  = "UQ[k]";
+  return(printresult(93, f, tp, cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion94 (poly f, list cstn, int k)
+{
+  string tp  = "UR[k]";
+  return(printresult(94, f, tp, cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion95 (poly f, list cstn, int k)
+{
+  string tp  = "US[k]";
+  return(printresult(95, f, tp, cstn, -1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Funktion96 (poly f, list cstn, int k)
+{
+  string tp  = "UT[k]";
+  return(printresult(96, f, tp, cstn, -1));
 }
 
@@ -1575,6 +1562,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Coeffs (list #)
+static proc Coeffs (list #)
 {
   matrix m=matrix(coeffs(#[1],#[2]), deg(#[1])+1, 1);
@@ -1583,154 +1569,166 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Morse(poly f, int K, int corank, int ShowPhi)
-{
-//---------------------------- initialisation ---------------------------------
-    poly   fc, f2, a, P, Beta, fi;
-    ideal  Jfx, B;
-    int    n, i, j, k, Rang, Done;
-    matrix Mat;
-    map    Id, Psi, Phi, PhiG;
-    intvec Abb, RFlg;
-    list   v;
-
-    fi = f;
-    n = nvars(basering);
-    init_debug();
-
-    def ring_top=basering;
-
-    debug_log(3, "Spalte folgendes Polynom mit Bestimmtheit: ", string(K));
-    debug_log(3, Show(fi));
-
-    for( j=1; j<=n ; j++) { Abb[j] = 0; }
-
-    RFlg = GetRf(fi, n);
-    debug_log(2, "Reihenfolge fuer Vertauschungen:", RFlg );
-    PhiG=ring_top,maxideal(1);
+static proc Morse(poly f, int K, int corank, int ShowPhi)
+{
+//---------------------------- initialisation ---------------------------------
+  poly   fc, f2, a, P, Beta, fi;
+  ideal  Jfx, B;
+  int    n, i, j, k, Rang, Done;
+  matrix Mat;
+  map    Id, Psi, Phi, PhiG;
+  intvec Abb, RFlg;
+  list   v;
+
+  fi = f;
+  n = nvars(basering);
+  init_debug();
+
+  def ring_top=basering;
+
+  debug_log(3, "Spalte folgendes Polynom mit Bestimmtheit: ", string(K));
+  debug_log(3, Show(fi));
+
+  for( j=1; j<=n ; j++) { Abb[j] = 0; }
+
+  RFlg = GetRf(fi, n);
+  debug_log(2, "Reihenfolge fuer Vertauschungen:", RFlg );
+  PhiG=ring_top,maxideal(1);
 
 //----------------- find quadratic term, if there is only one -----------------
-    B = maxideal(1);
-    if(corank == (n-1)) {
-      Done = 0;
-      f2   = jet(fi, 2);
-      j    = 1;
-      Jfx  = f2, diff(f2, x(j));
-      while(j<=n && (diff(f2, x(j))==0)) {
-        j   = j+1;
-        Jfx = f2, diff(f2, x(j));
-      }
-      Mat  = matrix(syz(Jfx));
-      Beta = 2*Mat[2,1]/Mat[1,1];
-      for( j=1; j<=n ; j=j+1) {
-        f2 = Coeff(Beta, x(RFlg[j]), x(RFlg[j]));
-        if(f2!=0) {
-          k = RFlg[j];
+  B = maxideal(1);
+  if(corank == (n-1))
+  {
+    Done = 0;
+    f2   = jet(fi, 2);
+    j    = 1;
+    Jfx  = f2, diff(f2, x(j));
+    while(j<=n && (diff(f2, x(j))==0))
+    {
+      j++;
+      Jfx = f2, diff(f2, x(j));
+    }
+    Mat  = matrix(syz(Jfx));
+    Beta = 2*Mat[2,1]/Mat[1,1];
+    for( j=1; j<=n ; j++)
+    {
+      f2 = Coeff(Beta, x(RFlg[j]), x(RFlg[j]));
+      if(f2!=0)
+      {
+        k = RFlg[j];
+        break;
+      }
+    }
+    for( j=1; j<=n ; j=j+1)
+    {
+      f2 = Coeff(Beta, x(j), x(j));
+      if(j == k) { B[rvar(x(j))] = (2*f2*x(j)-Beta) / number(f2); }
+    }
+    Phi  =ring_top,B;
+    fi   = Phi(fi);
+    PhiG = Phi(PhiG);
+  }
+  if( ShowPhi > 1) { PhiG; }
+
+//------------------------ compute spliting lemma -----------------------------
+  fc = fi;
+  i  = 1;              // Index fuer Variablen wird bearbeitet
+  while( i <= n)
+  {
+    Phi=ring_top,maxideal(1);
+    debug_log(6, "Pruefe Variable x(" +string(RFlg[i]) + ")");
+    debug_log(6, "--------------------");
+    j  = i + 1;        // setze j fuer evtle Verschiebung
+    f2 = jet(fc,2);
+    debug_log(6, "Rechne 2-Jet =" , string(f2));
+    if( (f2 - subst(f2, x(RFlg[i]), 0)) == 0 ) { Abb[RFlg[i]] = 1; }
+    if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 )
+    {
+      while( (j<=n) || (i==n) )
+      {
+        debug_log(6, "Pruefe 2-Jet mit Wert : " + string(jet(fc,2)));
+        a = Coeff(jet(fc,2), x(RFlg[i]), x(RFlg[i])^2);
+        debug_log(6,"Koeffizient von x(" + string(RFlg[i]) + ")^2 ist:", a);
+        if( (a != 0) || (i==n) )
+	{
+          debug_log(6, "BREAK!!!!!!!!!!!!!!");
           break;
         }
-      }
-      for( j=1; j<=n ; j=j+1) {
-        f2 = Coeff(Beta, x(j), x(j));
-        if(j == k) { B[rvar(x(j))] = (2*f2*x(j)-Beta) / number(f2); }
-      }
-      Phi  =ring_top,B;
-      fi   = Phi(fi);
+        debug_log(6,"Verschiebe evtl Variable x(",string(RFlg[j]),") um x(",
+                     string(RFlg[i]), ")");
+        B = maxideal(1);
+        for( k=1; k<=n ; k=k+1)
+	{
+          if(k==RFlg[j]) { B[rvar(x(k))] = x(k) + x(RFlg[i]); }
+        }
+        Phi = ring_top,B;
+        fc  = Phi(fi);
+        j++;
+      }               // Ende while( (j<=n) || (i==n) )
+
+      debug_log(6, "Moegliche Verschiebung fertig!");
       PhiG = Phi(PhiG);
-    }
-    if( ShowPhi > 1) { PhiG; }
-
-//------------------------ compute spliting lemma -----------------------------
-    fc = fi;
-    i  = 1;              // Index fuer Variablen wird bearbeitet
-    while( i <= n) {
-      Phi=ring_top,maxideal(1);
-      debug_log(6, "Pruefe Variable x(" +string(RFlg[i]) + ")");
-      debug_log(6, "--------------------");
-      j  = i + 1;        // setze j fuer evtle Verschiebung
-      f2 = jet(fc,2);
-      debug_log(6, "Rechne 2-Jet =" , string(f2));
-      if( (f2 - subst(f2, x(RFlg[i]), 0)) == 0 ) { Abb[RFlg[i]] = 1; }
-      if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 ) {
-        while( (j<=n) || (i==n) ) {
-          debug_log(6, "Pruefe 2-Jet mit Wert : " + string(jet(fc,2)));
-          a = Coeff(jet(fc,2), x(RFlg[i]), x(RFlg[i])^2);
-          debug_log(6,"Koeffizient von x(" + string(RFlg[i]) + ")^2 ist:", a);
-          if( (a != 0) || (i==n) ) {
-            debug_log(6, "BREAK!!!!!!!!!!!!!!");
-            break;
+      if( ShowPhi > 1) { "NachVersch.:"; Phi; }
+
+      if( (j<=n) || (i==n))
+      {
+        P = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
+        debug_log(6, "Koeffizient von x("+string(RFlg[i])+") ist: ",
+                      string(P));
+        if(P != 0)
+	{
+          debug_log(6, "1 Koeffizient von x("+string(RFlg[i])+") ist: ",
+                       string(P));
+          debug_log(6, "a=" + string(a));
+          P = P / number (2 * a);
+          debug_log(6, "2 Koeffizient von x("+string(RFlg[i])+") ist: ",
+                       string(P));
+          B = maxideal(1);
+          for( k=1; k<=n ; k=k+1) {if(k==RFlg[i]) {B[rvar(x(k))]=x(k)-P;}}
+          Phi =ring_top,B;
+          debug_log(6, "Quadratische-Ergaenzung durch:", Phi);
+          fi   = Phi(fc);
+          PhiG = Phi(PhiG);
+          fc   = jet(fi,K);
+          P    = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
+          if( P != 0)
+	  {
+            fi = fc;
+            continue;
           }
-          debug_log(6,"Verschiebe evtl Variable x(",string(RFlg[j]),") um x(",
-                       string(RFlg[i]), ")");
-          B = maxideal(1);
-          for( k=1; k<=n ; k=k+1) {
-            if(k==RFlg[j]) { B[rvar(x(k))] = x(k) + x(RFlg[i]); }
-          }
-          Phi = ring_top,B;
-          fc  = Phi(fi);
-          j   = j + 1;
-        }               // Ende while( (j<=n) || (i==n) )
-
-        debug_log(6, "Moegliche Verschiebung fertig!");
-        PhiG = Phi(PhiG);
-        if( ShowPhi > 1) { "NachVersch.:"; Phi; }
-
-        if( (j<=n) || (i==n)) {
-          P = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
-          debug_log(6, "Koeffizient von x("+string(RFlg[i])+") ist: ",
-                        string(P));
-          if(P != 0) {
-            debug_log(6, "1 Koeffizient von x("+string(RFlg[i])+") ist: ",
-                         string(P));
-            debug_log(6, "a=" + string(a));
-            P = P / number (2 * a);
-            debug_log(6, "2 Koeffizient von x("+string(RFlg[i])+") ist: ",
-                         string(P));
-            B = maxideal(1);
-            for( k=1; k<=n ; k=k+1) {if(k==RFlg[i]) {B[rvar(x(k))]=x(k)-P;}}
-            Phi =ring_top,B;
-            debug_log(6, "Quadratische-Ergaenzung durch:", Phi);
-            fi   = Phi(fc);
-            PhiG = Phi(PhiG);
-            fc   = jet(fi,K);
-            P    = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
-            if( P != 0) {
-              fi = fc;
-              continue;
-            }
-          }     // Ende if(P != 0)
-                // Fertig mit Quadratischer-Ergaenzung
-        }               // Ende if( (j<=n) || (i==n))
-      }                 // Ende if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 )
-
-      fi = fc;
-      i  = i + 1;
-      debug_log(6, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
-    }
-    debug_log(6, "Ende  ---------------------------------------------------");
+        }     // Ende if(P != 0)
+              // Fertig mit Quadratischer-Ergaenzung
+      }               // Ende if( (j<=n) || (i==n))
+    }                 // Ende if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 )
+
+    fi = fc;
+    i++;
+    debug_log(6, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+  }
+  debug_log(6, "Ende  ---------------------------------------------------");
 
 //--------------------------- collect results ---------------------------------
-    if( ShowPhi > 0 ) {
-      "Abbildung innerhalb des Morse-Lemmas:";
-      PhiG;
-      "Vergleich:";
-      "PhiG(f)= " + Show(jet(PhiG(f), K));
-      "fi     = " + Show(fi);
-    }
-
-    Rang = 0;
-    B    = maxideal(1);
-    for( i=1; i<=n ; i++) { if(Abb[i] != 1) { Rang ++; B[rvar(x(i))] = 0; } }
-    Phi  = ring_top,B;
-    PhiG = Phi(PhiG);
-    fi   = Phi(fi);
-    v    = fi, PhiG;
-    debug_log(2, "rank determined with Morse rg=", Rang);
-    debug_log(1, "Rest singularity f=",Show(fi));
-    return(v);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-static
-proc Coeff(poly f, list #)
+  if( ShowPhi > 0 )
+  {
+    "Abbildung innerhalb des Morse-Lemmas:";
+    PhiG;
+    "Vergleich:";
+    "PhiG(f)= " + Show(jet(PhiG(f), K));
+    "fi     = " + Show(fi);
+  }
+
+  Rang = 0;
+  B    = maxideal(1);
+  for( i=1; i<=n ; i++) { if(Abb[i] != 1) { Rang ++; B[rvar(x(i))] = 0; } }
+  Phi  = ring_top,B;
+  PhiG = Phi(PhiG);
+  fi   = Phi(fi);
+  v    = fi, PhiG;
+  debug_log(2, "rank determined with Morse rg=", Rang);
+  debug_log(1, "Rest singularity f=",Show(fi));
+  return(v);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static proc Coeff(poly f, list #)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1755,6 +1753,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc ReOrder(poly f)
+static proc ReOrder(poly f)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1906,6 +1903,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Cubic (poly f)
+static proc Cubic (poly f)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1951,6 +1947,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc parity  (int e)
+static proc parity  (int e)
 "USAGE:    parity()"
 {
@@ -1961,6 +1956,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass (intvec sg)
+static proc HKclass (intvec sg)
 {
 //---------------------------- initialisation ---------------------------------
@@ -1982,6 +1976,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass3 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass3 (intvec sg, string SG_Typ, int cnt)
 {
   list v;
@@ -1993,6 +1986,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass3_teil_1 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass3_teil_1 (intvec sg, string SG_Typ, int cnt)
 {
   int  k, r, s;
@@ -2030,6 +2022,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass5 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass5 (intvec sg, string SG_Typ, int cnt)
 {
   list v;
@@ -2042,6 +2033,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass5_teil_1 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass5_teil_1 (intvec sg, string SG_Typ, int cnt)
 {
   int  k, r, s;
@@ -2144,6 +2134,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass5_teil_2 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass5_teil_2 (intvec sg, string SG_Typ, int cnt)
 {
   int k, r, s;
@@ -2223,6 +2212,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass7 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass7 (intvec sg, string SG_Typ, int cnt)
 {
   list v;
@@ -2234,6 +2222,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc HKclass7_teil_1 (intvec sg, string SG_Typ, int cnt)
+static proc HKclass7_teil_1 (intvec sg, string SG_Typ, int cnt)
 {
   int k, r, s;
@@ -2346,6 +2333,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Singularitaet (string typ,int k,int r,int s,poly a,poly b,poly c,poly d)
+static proc Singularitaet (string typ,int k,int r,int s,poly a,poly b,poly c,poly d)
 {
   list   v;
@@ -2560,6 +2546,5 @@
 }
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Faktorisiere(poly f, poly fk, int pt, int k, intvec RFlg)
+static proc Faktorisiere(poly f, poly fk, int pt, int k, intvec RFlg)
 {
 //---------------------------- initialisation ---------------------------------
@@ -2612,6 +2597,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Teile(poly f, poly fk)
+static proc Teile(poly f, poly fk)
 {
   ideal  Jfsyz = f, fk;
@@ -2623,6 +2607,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc GetRf (poly fi, int n)
+static proc GetRf (poly fi, int n)
 "USAGE:    GetRf();"
 {
@@ -2652,6 +2635,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc Show(poly g)
+static proc Show(poly g)
 {
   string s;
@@ -2666,6 +2648,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc checkring
+static proc checkring
 {
   int CH = char(basering);
@@ -2679,6 +2660,5 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-static
-proc DecodeNormalFormString (string S_in)
+static proc DecodeNormalFormString (string S_in)
 "USAGE:    DecodeNormalFormString"
 {
