Opened 5 years ago

# Ideal operations unsupported over quotient rings

Reported by: Owned by: Brent Baccala minor sage-8.2 algebra Singular, quotient ring, ideal Samuel Lelièvre N/A

### Description

Some basic ideal operations are unsupported over quotient rings.

```R.<x,y,z> = QQ[]
SE = R.quotient(y^2*z - x*(x-z)*(x+3*z))
(x,y,z) = SE.gens()

I = ideal(x,z)

J = ideal(SE(1))
```

Now, both quotient and saturation:

```I.quotient(J)
I.saturation(J)
```

fail with almost the same error message:

```TypeError: Cannot call Singular function 'quotient' with ring parameter of type '<class 'sage.rings.quotient_ring.QuotientRing_generic_with_category'>'
```

Yet, we can perform the calculation by calling Singular directly:

```def newquotient(i,j):
iname = i._singular_().name()
jname = j._singular_().name()
return singular.ideal('quotient({0}, {1})'.format(iname, jname)).sage()

newquotient(I,J)
```

Something similar would probably work for saturation.

The problem, as I see it, is two fold. First, in libs/singular/function.pyx's `__call__` method, only rings of type `MPolynomialRing_libsingular` or `NCPolynomialRing_plural` are supported, although quotient rings can definitely be converted to Singular:

```sage: SE._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 3
//        block   1 : ordering dp
//                  : names    x y z
//        block   2 : ordering C
// quotient ring from ideal
_[1]=-x^3-2*x^2*z+y^2*z+3*x*z^2
```

...so we should have something in `__call__` that can handle a quotient ring, and maybe any ring that can be converted to a Singular representation.

Second, the `ideal` and `sat` functions in Singular don't seem to depend on the base ring being set, so the whole ring conversion problem is somewhat of a needless distraction. (Notice how simple the `newquotient` routine is.) Perhaps Singular functions should accept an additional option to bypass setting the base ring.

### comment:1 Changed 5 years ago by Samuel Lelièvre

Authors: → slelievre

### comment:3 Changed 9 months ago by Songtao Mao

Actually, I do not know why it does not work for saturation.

```S1.<a,b,c,d>=PolynomialRing(QQ,4)
S.<a,b,c,d>=S1.quotient(a*b*c*d-a^2-b^2-c^2)
ABC=S.ideal(a*b*c)
Dx=S.ideal(a*b*c, b^2*c^2*d-a^2*b*c, a^2*c^2*d-b*2*a*c, a^2*b^2*d-a*b*c^2)

def newsat(i,j):
iname = i._singular_().name()
jname = j._singular_().name()
return singular.ideal('sat({0}, {1})'.format(iname, jname)).sage()

L=newsat(ABC,Dx)
```

And some error occurs

```TypeError: Singular error:
? `ideal`(sage289) = `list` is not supported
? expected `ideal` = `ideal`
? expected `ideal` = `module`
? expected `ideal` = `matrix`
? error occurred in or before STDIN line 676: `ideal sage289=sage288;`
? expected ideal-expression. type 'help ideal;'
```

I do not know why. Hope someone can help.

Note: See TracTickets for help on using tickets.