oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
338 stars 120 forks source link

Definition of is_global(ordering) does not match how it is used internally #1697

Open tthsqe12 opened 1 year ago

tthsqe12 commented 1 year ago

Due to the new definition of is_global, the following error is not caught by https://github.com/oscar-system/Oscar.jl/blob/c45e777cba4ef1ef0643e1712f5f09d221db6c45/src/Rings/groebner.jl#L159-L160

julia> R,(x,y,z)=PolynomialRing(QQ,[:x,:y,:z]);

julia> groebner_basis(ideal([x,y,z]); ordering=lex([x,y]))
ERROR: Non-square matrix
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] det(x::fmpz_mat)
    @ Nemo ~/.julia/dev/Nemo/src/flint/fmpz_mat.jl:676

@wdecker @ederc

hannes14 commented 1 year ago

The ordering must cover all variables, resp. the corresponding matrix must be a square matrix of full rank. Maybe a new function is_ordering(ordering,R::PolyRing) helps.

wdecker commented 1 year ago

How about all the other functions such as terms, leading_term etc. Same problem?

tthsqe12 commented 1 year ago

well, the user-facing cmp sometimes detects this and throws an error, but I am now thinking that the error that cmp can throw is useless. All of the terms, coefficients, etc. don't detect this. Maybe one should be able to order x+y wrt lex([x,y]), but trying to order x+y+z wrt lex([x,y]) should probably throw.

wdecker commented 1 year ago

Um 10 habe ich das wöchentliche Algebraische Geometrie Treffen. 9:45?

Am 09.11.2022 um 14:03 schrieb Hans Schoenemann @.***>:

The ordering must cover all variables, resp. the corresponding matrix must be a square matrix of full rank. Maybe a new function is_ordering(ordering,R::PolyRing) helps.

— Reply to this email directly, view it on GitHub https://github.com/oscar-system/Oscar.jl/issues/1697#issuecomment-1308719524, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASSXEQLI2P567426VIQMITWHOOLVANCNFSM6AAAAAAR3MZCGA. You are receiving this because you were mentioned.

tthsqe12 commented 1 year ago

Here is an only tangentially related issue brough to my attention by @afkafkafk13. Oscar's leading_ideal function currently only works with global ordering because it calls groebner_basis. Can we get around this just by using standard_basis instead?

julia> R, (x, y, z) = QQ["x", "y", "z"]
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])

julia> o = monomial_ordering(R, Singular.ordering_ds(3))
negdegrevlex([x, y, z])

julia> i = ideal([x+x*z, y+y*z])
ideal(x*z + x, y*z + y)

julia> leading_ideal(i; ordering = o)
ERROR: Ordering must be global

julia> my_leading_ideal(i::MPolyIdeal; ordering::MonomialOrdering) = ideal(base_ring(i), map(p->leading_term(p; ordering = o), gens(standard_basis(i; ordering = o))));

julia> my_leading_ideal(i; ordering = o)
ideal(x, y)
ederc commented 1 year ago

Yes, we should use standard_basis in leading_ideal.

afkafkafk13 commented 1 year ago

To me is_global and is_total are two properties of orderings which should not be mixed in any way.

I suggested the name is_total in this morning's meeting, because the relevant property here is being a total ordering on the set of exponents ${\mathbb N}_0^n$ for a specified $n$ (number of variables in the polynomial ring, in which its use is desired). As @hannes14 pointed out: If $n$ is not equal to the number of columns of the quadratic ordering matrix, is_total should return false; if n matches the number of columns, it is a question on the ordering matrix being of maximal rank.