Index: Singular/extra.cc
===================================================================
--- Singular/extra.cc	(revision 4d22d3bbe140ec25c1d800b92606f9067563c581)
+++ Singular/extra.cc	(revision af71455603162123e6412ac27852bb08ea8f5126)
@@ -137,4 +137,5 @@
 
 #include <kernel/shiftgb.h>
+#include <kernel/linearAlgebra.h>
 
 #ifdef HAVE_EIGENVAL
@@ -629,4 +630,33 @@
         }
       }
+  /*==================== Hensel's lemma ======================*/
+      if(strcmp(sys_cmd, "henselfactors")==0)
+      {
+        if ((h != NULL) && (h->Typ() == POLY_CMD) &&
+            (h->next != NULL) && (h->next->Typ() == POLY_CMD) &&
+            (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
+            (h->next->next->next != NULL) &&
+                                     (h->next->next->next->Typ() == INT_CMD))
+        {
+          poly hh = (poly)h->Data();
+          poly f0 = (poly)h->next->Data();
+          poly g0 = (poly)h->next->next->Data();
+          int d   = (int)(long)h->next->next->next->Data();
+          poly f; poly g;
+          henselFactors(hh, f0, g0, d, f, g);
+          lists L = (lists)omAllocBin(slists_bin);
+          L->Init(2);
+          L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
+          L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
+          res->rtyp = LIST_CMD;
+          res->data = (char *)L;
+          return FALSE;
+        }
+        else
+        {
+          Werror( "expected argument list (poly, poly, poly, int)");
+          return TRUE;
+        }
+      }
   /*==================== forking experiments ======================*/
       if(strcmp(sys_cmd, "waitforssilinks")==0)
Index: kernel/linearAlgebra.cc
===================================================================
--- kernel/linearAlgebra.cc	(revision 4d22d3bbe140ec25c1d800b92606f9067563c581)
+++ kernel/linearAlgebra.cc	(revision af71455603162123e6412ac27852bb08ea8f5126)
@@ -1199,6 +1199,6 @@
 		w5 = nAdd(w2, w4);
 		if (!nGreater(w5, tt)) result = i;
-		nDelete(&w1); nDelete(&w2); nDelete(&w3); nDelete(&w4); nDelete(&w5);
-		nDelete(&rr); nDelete(&ii);
+		nDelete(&w1); nDelete(&w2); nDelete(&w3); nDelete(&w4);
+                nDelete(&w5); nDelete(&rr); nDelete(&ii);
 		if (result != -1) break;
 	}
@@ -1227,5 +1227,6 @@
   	result->Init(1);
   	result->m[0].rtyp = INT_CMD;
-	  result->m[0].data = (void*)0;   /* a list with a single entry (int 0) */
+	  result->m[0].data = (void*)0;   /* a list with a single entry
+                                             which is the int zero */
   }
   else
@@ -1270,2 +1271,10 @@
   return result;
 }
+
+void henselFactors(const poly h, const poly f0, const poly g0, const int d,
+                   poly &f, poly &g)
+{
+  f = NULL;
+  g = NULL;
+}
+
Index: kernel/linearAlgebra.h
===================================================================
--- kernel/linearAlgebra.h	(revision 4d22d3bbe140ec25c1d800b92606f9067563c581)
+++ kernel/linearAlgebra.h	(revision af71455603162123e6412ac27852bb08ea8f5126)
@@ -454,4 +454,31 @@
                    );
 
+/**
+ * Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a
+ * certain degree in x, whenever a factorization of h(0, y) is given.
+ *
+ * The algorithm is based on Hensel's lemma: Let h(x, y) denote a monic
+ * polynomial in y of degree m + n with coefficients in K[[x]]. Suppose there
+ * are two monic factors f_0(y) (of degree n) and g_0(y) of degree (m) such
+ * that h(0, y) = f_0(y) * g_0(y), and an integer d >= 0. Then there are
+ * monic polynomials in y with coefficients in K[[x]], namely f(x, y) of
+ * degree n and g(x, y) of degree m such that
+ *    h(x, y) = f(x, y) * g(x, y) modulo <x^(d+1)>   (*).
+ *
+ * This implementation expects h, f0, g0, and d as described and computes the
+ * factors f and g. Effectively, h will be given as an element of K[x, y] since
+ * all terms of h with x-degree larger than d can be ignored due to (*).
+ * The method expects the ground ring to contain at least two variables; then
+ * x is the first ring variable and y the second one.
+ **/
+void henselFactors(
+       const poly h,      /**< [in]  the polynomial h(x, y) to be factorized */
+       const poly f0,     /**< [in]  the first univariate factor of h(0, y)  */
+       const poly g0,     /**< [in]  the second univariate factor of h(0, y) */
+       const int d,       /**< [in]  the degree bound, d >= 0                */
+       poly &f,           /**< [out] the first factor of h(x, y)             */
+       poly &g            /**< [out] the second factor of h(x, y)            */
+                              );
+
 #endif
 /* LINEAR_ALGEBRA_H */
