# "f not in I" and singular errors during "lift" of a polynomial, but "f in I" returns True

I am trying to understand whether an ideal is the unit ideal and if so - to get the combination of the original generators that shows 1 is indeed there. For some odd reason checking whether 1 is there using

One in J_pairs


outputs True, but trying to get the polynomial coefficients using lift

One.lift(J_pairs)


raises an f not in I error. I also couldn't find any information about this error - maybe it's thrown in other cases, and it's just a misleading error message?

This error appears after several Singular errors, so I suspect the heart of the problem is at some type and conversion issue - but I also fail to find any information online about the raised lift(ideal,number) failed error (note my One is of the type sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict, which is a correct type for a polynomial to be lifted as far as I understand).

Would love some insight about this - to me it looks like a bug but I may well be doing something obviously stupid here that I fail to see.

Details to reproduce, including the errors traceback (was checked both on 8.6 and on 9.2 versions):

sage: vars=var("a11 a12 a13 b11 b12 b13 c11 c12 c13 a21 a22 a23 b21 b22 b23 c21 c22 c23")
sage: equations_pairs = [a11*b11*c11+a21*b21*c21-1,a12*b12*c12+a22*b22*c22-1,a13*b13*c13+a23*b23*c23-1,a11*b11*c12+a21*b21*c22,a12*b12*c11+a22*b22*c21
....: ,a12*b12*c13+a22*b22*c23,a13*b13*c12+a23*b23*c22,a13*b13*c11+a23*b23*c21,a11*b11*c13+a21*b21*c23]
sage: R = PolynomialRing(CC, names=vars)
sage: J_pairs = R.ideal(equations_pairs)
sage: One = R.one()
sage: One in J_pairs
True
sage: One.lift(J_pairs)
---------------------------------------------------------------------------
SingularError                             Traceback (most recent call last)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in __init__(self, parent, type, value, is_name)
1352             try:
-> 1353                 self._name = parent._create(value, type)
1354             # Convert SingularError to TypeError for

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in _create(self, value, type)
755         name = self._next_var_name()
--> 756         self.set(type, name, value)
757         return name

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in set(self, type, name, value)
698         self.__to_clear = []
--> 699         self.eval(cmd)
700

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in eval(self, x, allow_semicolon, strip, **kwds)
656         if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
--> 657             raise SingularError('Singular error:\n%s'%s)
658

SingularError: Singular error:
? lift(ideal,number) failed
? expected lift(ideal,ideal)
? error occurred in or before STDIN line 173: 

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/rings/polynomial/multi_polynomial_element.py in lift(self, I)
1944         try:
-> 1945             M = Is.lift(fs)._sage_(P)
1946         except TypeError:

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, *args, **kwds)
679     def __call__(self, *args, **kwds):
--> 680         return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
681

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in function_call(self, function, args, kwds)
600                                        ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
--> 601         return self.new(s)
602

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in new(self, code)
369     def new(self, code):
--> 370         return self(code)
371

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in __call__(self, x, type)
794
--> 795         return SingularElement(self, type, x, False)
796

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/singular.py in __init__(self, parent, type, value, is_name)
1357                 self._session_number = -1
-> 1358                 raise TypeError(x)
1359             except BaseException:

TypeError: Singular error:
? lift(ideal,number) failed
? expected lift(ideal,ideal)
? error occurred in or before STDIN line 173: 

During handling of the above exception, another exception occurred:

ArithmeticError                           Traceback (most recent call last)
<ipython-input-39-8498fc7aa607> in <module>
----> 1 One.lift(J_pairs)

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/rings/qqbar_decorators.py in wrapper(*args, **kwds)
94                    or is_PolynomialSequence(a)
95                    and is_AlgebraicField_common(a.ring().base_ring()) for a in args):
---> 96             return func(*args, **kwds)
97
98         polynomials = []

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/rings/polynomial/multi_polynomial_element.py in lift(self, I)
1945             M = Is.lift(fs)._sage_(P)
1946         except TypeError:
-> 1947             raise ArithmeticError("f is not in I")
1948         return Sequence(M.list(), P, check=False, immutable=True)
1949

ArithmeticError: f is not in I
sage: type(One)
<class 'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>

edit retag close merge delete

Sort by ยป oldest newest most voted

The algorithms behind ideal membership testing cannot work reliably over inexact fields such as CC. For a simple example that goes wrong over CC, consider

sage: CC(1/10) + CC(2/10) - CC(3/10)
5.55111512312578e-17


which is not exactly zero.

Instead, work with polynomials over an exact field such as QQ, QQbar or a number field. Over QQ, one gets:

sage: vars=var("a11 a12 a13 b11 b12 b13 c11 c12 c13 a21 a22 a23 b21 b22 b23 c21 c22 c23")
sage: equations_pairs = [a11*b11*c11+a21*b21*c21-1,a12*b12*c12+a22*b22*c22-1,a13*b13*c13+a23*b23*c23-1,a11*b11*c12+a21*b21*c22,a12*b12*c11+a22*b22*c21
....: ,a12*b12*c13+a22*b22*c23,a13*b13*c12+a23*b23*c22,a13*b13*c11+a23*b23*c21,a11*b11*c13+a21*b21*c23]
sage: R = PolynomialRing(QQ, names=vars)
sage: J_pairs = R.ideal(equations_pairs)
sage: One = R.one()
sage: One in J_pairs
True
sage: One.lift(J_pairs)
[-a13*b13*c13*a22*b22*c22 + 3/2*a12*b12*c13*a23*b23*c22 - a12*b12*c12*a23*b23*c23 - 1/2*a13*b13*c13*a23*b23*c23, 1/2*a11*b11*c13*a23*b23*c21 + 1/2*a13*b13*c13*a23*b23*c23 - a13*b13*c13 - a23*b23*c23, -1/2*a11*b11*c13*a23*b23*c21 + 1/2*a12*b12*c13*a23*b23*c22 - 1, a13*b13*c13*a22*b22*c21 - 3/2*a12*b12*c13*a23*b23*c21 + a12*b12*c11*a23*b23*c23, -1/2*a11*b11*c13*a23*b23*c22, -1/2*a13*b13*c13*a23*b23*c22 - a13*b13*c12, -a11*b11*c13*a22*b22*c21 - 1/2*a12*b12*c13*a23*b23*c23 + 2*a12*b12*c13 + a22*b22*c23, a11*b11*c13*a22*b22*c22 + 1/2*a11*b11*c13*a23*b23*c23, a12*b12*c12*a23*b23*c21 + 1/2*a13*b13*c13*a23*b23*c21 - a12*b12*c11*a23*b23*c22]

more

Makes sense. Annoying - but absolutely reasonable. Thanks!

( 2021-05-29 14:30:13 +0200 )edit