Opened 3 years ago

Closed 3 years ago

# Support constructing Singular ring with ring order with 'c' or 'C'

Reported by: Owned by: klee minor sage-9.1 commutative algebra saliola, gh-antonleykin, gh-mwageringel Kwankyu Lee Dima Pasechnik N/A d16fe7a d16fe7a987e7645a932a9067478faaba4bb3207c

### Description

Presently, there is no way to construct a multi-variate polynomial ring based on a Singular ring with ring order with 'c' or 'C'. Singular ring order with 'c' or 'C' is useful if computation with modules over the ring is needed.

This ticket aims to support constructing base Singular ring with ring order with 'c' or 'C'.

This enhancement is mainly for developers.

With the patch, we have for instance:

```sage: T = TermOrder('degrevlex(2),lex(3)')
sage: P.<a,b,x,y,z> = PolynomialRing(QQ,order=T)
sage: P._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 5
//        block   1 : ordering dp
//                  : names    a b
//        block   2 : ordering lp
//                  : names    x y z
//        block   3 : ordering C
sage: T._singular_ringorder_column = 0
sage: P.<a,b,x,y,z> = PolynomialRing(QQ,order=T)
sage: P._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 5
//        block   1 : ordering C
//        block   2 : ordering dp
//                  : names    a b
//        block   3 : ordering lp
//                  : names    x y z
sage: T._singular_ringorder_column = 1
sage: P.<a,b,x,y,z> = PolynomialRing(QQ,order=T)
sage: P._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 5
//        block   1 : ordering c
//        block   2 : ordering dp
//                  : names    a b
//        block   3 : ordering lp
//                  : names    x y z
sage: T._singular_ringorder_column = 2
sage: P.<a,b,x,y,z> = PolynomialRing(QQ,order=T)
sage: P._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 5
//        block   1 : ordering dp
//                  : names    a b
//        block   2 : ordering C
//        block   3 : ordering lp
//                  : names    x y z
sage: T._singular_ringorder_column = 3
sage: P.<a,b,x,y,z> = PolynomialRing(QQ,order=T)
sage: P._singular_()
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 5
//        block   1 : ordering dp
//                  : names    a b
//        block   2 : ordering c
//        block   3 : ordering lp
//                  : names    x y z
```

### comment:1 Changed 3 years ago by klee

• Authors set to Kwankyu Lee
• Branch set to u/klee/28389
• Summary changed from Support Singular ringorder column in term order to Support constructing Singular ring with ring order with 'c' or 'C'

### comment:2 Changed 3 years ago by git

• Commit set to cb8a69d7b6dda5fc8f89a26a5e0c15d1acd47c73

Branch pushed to git repo; I updated commit sha1. New commits:

 ​cb8a69d `Support singular ring order column(c or C)`

### comment:3 Changed 3 years ago by git

• Commit changed from cb8a69d7b6dda5fc8f89a26a5e0c15d1acd47c73 to b240299192b177b018bf0a7736b6fbdfa8a0aab4

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

 ​b240299 `Support singular ring order column(c or C)`

### comment:4 Changed 3 years ago by klee

• Status changed from new to needs_review

### comment:5 follow-up: ↓ 6 Changed 3 years ago by dimpase

what are these c/C orderings? I never heard of them...

### comment:6 in reply to: ↑ 5 Changed 3 years ago by klee

what are these c/C orderings? I never heard of them...

Let R=k[x,y,z] and R3 be a free module over R. Then an element of the free module is represented, in Singular, like

(x, -y, x+z) = x*gen(1) - y*gen(2) + (x+z)*gen(3)

That is, gen(1), gen(2), gen(3) denotes the "columns" of the free module. On the other hand, an element of R is viewed as

x3+z = (x3+z)*gen(1)

by Singular. The ordering of monomials of a free module is determined by ordering of monomial of R like x, y, x+z, ... and ordering of generators like gen(1), gen(2), ...

c/C ordering is ordering of the generators, and the position of c/C ordering in term order determine when to break ties by ordering of generators. TOP (term over position) and POT (position over term) are used to denote typical special cases. C denotes ascending order, and c denotes descending order.

Hence position of c/C ordering affects computations of Groebner bases in free modules over R.

If you compute only over R, c/C ordering doesn't matter. But if you start computing on free modules over R in Singular, it does. But currently Sage does not allow to specify the position of c/C ordering when you create a polynomial ring based on Singular. Typically you want POT or `(c,dp)` in Singular string.

If you start computing with free modules over the Singular ring underlying (or derived from by `_singular_`) Sage polynomial ring, then you want to control c/C ordering (the default is TOP, c/C ordering at the end in term order).

This is a developer thing. Hence I decided to make the handle `_singular_ringorder_column` an underlined attribute.

### comment:7 follow-up: ↓ 8 Changed 3 years ago by dimpase

I don't understand how this is "a developer thing". For actually carrying out computations orderings are essential, and for different tasks the user might want to choose a different order. So it should not be hidden from the user.

### comment:8 in reply to: ↑ 7 Changed 3 years ago by klee

I don't understand how this is "a developer thing". For actually carrying out computations orderings are essential, and for different tasks the user might want to choose a different order. So it should not be hidden from the user.

Note that `_singular_ringorder_column` is an attribute of `TermOrder`. A `TermOrder` object is to specify ordering of monomials of a multi-variate polynomial ring of Sage. For a (non-developer) user of `TermOrder`, an attribute that is concerned with ordering of monomials of free modules over the underlying Singular ring is irrelevant.

If someday we add a new class `ModuleTermOrder` for free modules over polynomial rings, then it would internally set `_singular_ringorder_column` of the `TermOrder` of the polynomial ring. Then a user is just concerned with the `ModuleTermOrder` object, but not directly with _singular_ringorder_column`.

### comment:9 follow-up: ↓ 10 Changed 3 years ago by dimpase

As a matter of fact, we're interested in getting `ChainComplex` functionality for modules over polynomial rings (Macaulay2 can do such computations).

But even without `ModuleTermOrder`, but with `c/C`, one would be able to do computations in modules over polynomial rings, no?

### comment:10 in reply to: ↑ 9 Changed 3 years ago by klee

As a matter of fact, we're interested in getting `ChainComplex` functionality for modules over polynomial rings (Macaulay2 can do such computations).

Nice. Then you will need this branch :-)

But even without `ModuleTermOrder`, but with `c/C`, one would be able to do computations in modules over polynomial rings, no?

I just checked this:

```sage: R.<x,y,z> = PolynomialRing(QQ)
sage: R
Multivariate Polynomial Ring in x, y, z over Rational Field
sage: type(R)
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular'>
sage: M = R**3
sage: M
Ambient free module of rank 3 over the integral domain Multivariate Polynomial Ring in x, y, z over Rational Field
sage: type(M)
<class 'sage.modules.free_module.FreeModule_ambient_domain_with_category'>
```

Apparently sage doesn't have a `FreeModule_libsingular`. (If it had, then there would also be `ModuleTermOrder`)

So sage doesn't have functionality for modules over polynomial rings like singular or macaulay2.

But sage has singular interface, and we can do

```sage: I = R.ideal([x+y,x-y])
sage: Ising = I._singular_()
sage: Ising.syz()
-x+y,
x+y
sage: _.sage()
[-x + y]
[ x + y]
```

and the computation above would be affected by `c/C` ordering.

```sage: R._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
```

### comment:11 Changed 3 years ago by git

• Commit changed from b240299192b177b018bf0a7736b6fbdfa8a0aab4 to d16fe7a987e7645a932a9067478faaba4bb3207c

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

 ​d16fe7a `Support singular ring order column(c or C)`

### comment:12 Changed 3 years ago by dimpase

• Cc saliola gh-antonleykin gh-mwageringel added
• Component changed from basic arithmetic to commutative algebra
• Milestone changed from sage-8.9 to sage-9.0

### comment:13 Changed 3 years ago by chapoton

Should we merge this as it is now ? the patchbot is green.

### comment:14 Changed 3 years ago by dimpase

• Milestone changed from sage-9.0 to sage-9.1
• Reviewers set to Dima Pasechnik
• Status changed from needs_review to positive_review

Thanks for the reminder. I keep forgetting about reviewing these things, sorry.

### comment:15 Changed 3 years ago by vbraun

• Branch changed from u/klee/28389 to d16fe7a987e7645a932a9067478faaba4bb3207c
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.