Closed lgoettgens closed 10 months ago
I can relate to the confusion, but I am not sure I would consider this a bug, since it is already covered in the documentation. Also I think SageMath, Magma, Macaulay2, Singular all use these definitions. Adding the dozens of textbooks and articles, I don't think it would be a good idea to change it. I guess for people that were in contact with those materials, there would be nothing unintuitive about the current Oscar behaviour.
PS: I was wrong. Everything is inconsistent, even among the systems, see https://github.com/oscar-system/Oscar.jl/issues/2950#issuecomment-1778570799.
I agree with both of you. It is unintuitive, but that's just how things are. The root problem is that reverse lexicographic order
is ambiguous and this isn't just a problem with monomial orderings. I also think that we shouldn't change it, but I wouldn't be opposed to a warning in the documentation of revlex
or degrevlex
.
I agree with @thofma and @YueRen : As unintuitive as some standard definitions might be, we should stick to the textbook definitions of the respective field, but a warning remark for the user from outside the field might be helpful in this case.
The definition of revlex
in Singular
is in my eyes non-standard. Accordingly, the definition of negrevlex
is non-standard. In fact, negrevlex
should be called revlex
to make things consistent
(note that this is a local ordering). And revlex
should just be removed. Similarly in OSCAR
.
@hannes14, @ederc What do you think? Where in Singular are these orderings used? @gfourier, @lgoettgens thx for bringing this up.
@wdecker I think you are right. Renaming negrevlex
to revlex
would then also be consistent with Macaulay2 if I remember correctly.
Hm, if we were consistent with Macaulay2, I guess it would still be unintuitive? By it I mean the observation of @lgoettgens and @gfourier. Even with the Macaulay2 convention, degree reverse lexicographical ordering is not degree comparison followed by "reverse lexicographical ordering":
i1 : R = QQ[x,y,z,MonomialOrder => RevLex, Global => false];
i2 : x*z^2 > x^2 * z
o2 = true
i3 : R = QQ[x,y,z,MonomialOrder => GRevLex, Global => true];
i4 : x*z^2 > x^2 * z
o4 = false
For whatever reason, "reverse" seems to have different meanings depending on what substantive is following. Using the language of https://oeis.org/wiki/Orderings#Reverse_lexicographic_order, here is a small summary: Singular:
revlex
: Reflected lexicographic order.degrevlex
: Degree + Reverse reflected lexicographic order.Macaulay2:
RevLex
: Reverse lexicographic order.GRevLex
: Degree + Reverse reflected lexicographic order.Magma:
grev-lex
: Degree + Reverse reflected lexicographic order.SageMath:
There seems to be no rhyme or reason to the usage of the word "reverse".
If I remember correctly SageMath calls Singular's revlex
invlex
, I recall that there were a discussion about this years ago at some Sage days.
@wdecker I think you are right. Renaming
negrevlex
torevlex
would then also be consistent with Macaulay2 if I remember correctly.
Suppressing the inconsistent and ambiguous identifier revlex completely would be fine with me. With the crucial difference between Macaulay and Singular, it will be a constant source of confusion between the communities anyway. But I am opposed to not prepending a local ordering by neg
, which would again be a source of confusion for users. Therefore, I would leave negrevlex as it is -- it is reverse reflected lexciographical ordering, which is again clear on all sides.
@ederc : Indeed, Singular's revlex is called invlex in sage and another revlex is not present in the documentation.
Regarding how this is defined in books: in e.g. Cox, Little, O'Shea they justify their choices by requiring that "standard" orderings they describe all satisfy that $x_1 > x_2 > \dots$. And this is satisfied by our lex, deglex, degrevlex ordering, but not by revlex.
So all in all, I think we should remove the current revlex
. E.g. by renaming it to invlex
as in the book by Cox, Little, O'Shea, and apparently also in SageMath.
By the way, I also think that the docstring for deglex
, degrevlex
etc. should be improved -- saying "this is the XYZ order" is not so helpful, it should also be explained what is meant by that.
Hm, if we were consistent with Macaulay2, I guess it would still be unintuitive? By it I mean the observation of @lgoettgens and @gfourier. Even with the Macaulay2 convention, degree reverse lexicographical ordering is not degree comparison followed by "reverse lexicographical ordering":
i1 : R = QQ[x,y,z,MonomialOrder => RevLex, Global => false]; i2 : x*z^2 > x^2 * z o2 = true i3 : R = QQ[x,y,z,MonomialOrder => GRevLex, Global => true]; i4 : x*z^2 > x^2 * z o4 = false
For whatever reason, "reverse" seems to have different meanings depending on what substantive is following. Using the language of https://oeis.org/wiki/Orderings#Reverse_lexicographic_order, here is a small summary: Singular:
* `revlex`: Reflected lexicographic order. * `degrevlex`: Degree + Reverse reflected lexicographic order.
Macaulay2:
* `RevLex`: Reverse lexicographic order. * `GRevLex`: Degree + Reverse reflected lexicographic order.
Magma:
* Has no "reverse" lexicographical ordering. * `grev-lex`: Degree + Reverse reflected lexicographic order.
SageMath:
* I think has the same as Singular, but I did not check the details.
There seems to be no rhyme or reason to the usage of the word "reverse".
@thofma I believe "revlex" in Singular and M2 is called "reverse colexicographic" in oeis. See for example how the following monomials are ordered in Singular:
> f;
x1*x2*x3+x1*x2*x4+x1*x3*x4+x2*x3*x4+x1*x2*x5+x1*x3*x5+x2*x3*x5+x1*x4*x5+x2*x4*x5+x3*x4*x5+x1*x2*x6+x1*x3*x6+x2*x3*x6+x1*x4*x6+x2*x4*x6+x3*x4*x6+x1*x5*x6+x2*x5*x6+x3*x5*x6+x4*x5*x6
Anyways, I think we should just add a warning and leave things as they are. At least Singular / M2 / OSCAR are consistent with each other and with the Greuel-Pfister / Cox-Little-OShea book.
I didn't expect this thread to blow up like this 😅
But apart from the confusion, we would like to have the "two missing" orderings available in OSCAR as well (with monomial_ordering(Rx, :name)
), under whatever name the people of the topic can agree on.
revlex
(Note that this is not our degrevlex
)degrevlex
without checking the degree.Furthermore, I noticed that almost all definitions of graded orderings are wrong in the documentation (https://docs.oscar-system.org/dev/CommutativeAlgebra/GroebnerBases/orderings/), as they are missing the deg(x^α) = deg(x^β) and...
on the right side of the or
.
revlex in Singular is used to construct monomial orderings for the opposite algebra (of a PBW algebra)
@lgoettgens In order to avoid confusion: Please write down explicit definitions for this:
Degree graded revlex (Note that this is not our degrevlex)
degrevlex without checking the degree.
I'll list all 4 combinations here and name them each with their OSCAR name, if they exist.
revlex
)revlex
")degrevlex
if I fix the error in the docs definition (the deg = deg
part is missing there)degrevlex
without checking the degree")Please note that both 1 and 4, and 2 and 3 just differ by the direction of a single <
.
Here is a plan people here seem to be OK with:
revlex
to invlex
revlex
which just throws an error that explains the situation (and points to invlex
and possibly whatever name for "revlex as in M2" or so); its docstring could explain the situation in a bit more details.No, I disagree. I will make a more detailed suggestion later on today.
@thofma I think the definition of revlex
in 'Macaulay2' is inconsistent with the behaviour shown in your example:
https://macaulay2.com/doc/Macaulay2/share/doc/Macaulay2/Macaulay2Doc/html/___Rev__Lex.html
@fingolfin I will move the (corrected) definitions of monomial orderings from the .md files to the .jl files.
@thofma I believe "revlex" in Singular and M2 is called "reverse colexicographic" in oeis.
@YueRen Are you saying that both are equal? According to the documentation, they are not if I understand correctly. https://docs.oscar-system.org/dev/CommutativeAlgebra/GroebnerBases/orderings/#The-Reverse-Lexicographical-Ordering and https://macaulay2.com/doc/Macaulay2/share/doc/Macaulay2/Macaulay2Doc/html/___Rev__Lex.html look different. For example, revlex
(Singular) starts at the end, while RevLex
(M2) startes at the beginning?
@wdecker: I am not sure I follow. A = [1, 0, 2]
, B = [2, 0, 1]
, A - B = [-1, 0, 1]
and -1
is negative and the first non-zero entry. So x^A > x^B
?
@wdecker Sorry, I was actually looking at this link of the manual when I started to type:
So they probably changed this at some time.
I summarize the discussion, using 1-4 as done by @lgoettgens:
revlex
--> new invlex
deginvlex
degrevlex
stays as it is (the copy and paste error in the docu will be corrected)negrevlex
--> new revlex
The suggestion 4 is consistent but does differ from current Maculay2
due to the afore mentioned change. Also, it does not please @afkafkafk13. Any other suggestion?Names of non-global orderings should start with neg
I could live with the proposal by @wdecker but so far everyone I talked to was concerned that using the name revlex
would lead to people making mistakes.
Worse, if we just change its meaning, that means we will potentially break code by people currently using it in their Oscar code outside of this repository. I'd be very wary about tusch a move.
A compromise could be to turn revlex
into a helpful error (in the way I described) for some time (say until after OSCAR 1.0), and then when we think nobody is still using it, we could think about reusing it for some order or another.
O.k., how about the following:
negrevlex
--> new neginvlex
O.k., how about the following: 4. current
negrevlex
--> newneginvlex
Sounds good to me.
I think that this can be closed now due to the changes in https://github.com/oscar-system/Oscar.jl/pull/3038. @gfourier Can you please have a look there as well if that resolves your confusion about the ordering? The updated docs are available at https://docs.oscar-system.org/dev/CommutativeAlgebra/GroebnerBases/orderings/.
I think that this can be closed now due to the changes in #3038. @gfourier Can you please have a look there as well if that resolves your confusion about the ordering? The updated docs are available at https://docs.oscar-system.org/dev/CommutativeAlgebra/GroebnerBases/orderings/.
Yes, this resolved the confusion.
@gfourier found this today while trying around with #2936.
Describe the bug We expect that a degree-graded ordering behaves exactly as the non-graded ordering on same-degree monomials. So
revlex
anddegrevlex
should behave exactly the same incmp
when both input monomials have the same total degree. The behavior is consistent with the documentation (revlex and degrevlex), but nonetheless, we find it extremely unintuitive.To Reproduce
System (please complete the following information): Please paste the output of
Oscar.versioninfo(full=true)
below. If this does not work, please paste the output of Julia'sversioninfo()
and your Oscar version.