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
344 stars 126 forks source link

normal form of polynomials and vectors w.r.t. local orderings #2477

Open afkafkafk13 opened 1 year ago

afkafkafk13 commented 1 year ago

Describe the bug Applying normal_form to an ideal I and an ideal J w.r.t. a local ordering provides a correct answer, i.e. a set of polynomials in weak normal form in R which generate I/J in R/J. But applying normal_form to a polynomial or a vector provides polynomials in R in weak normal form which are not in the same class modulo J as the original ones.

To Reproduce

julia> R,(x,y) = polynomial_ring(QQ,["x","y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> f = x+x^2
x^2 + x

julia> J =ideal(R,[y])
ideal(y)

julia> o = negdegrevlex(R)
negdegrevlex([x, y])

julia> normal_form(f, J, ordering = o)
x

Expected behavior Output of 'normal_form(f,J)` should be a polynomial g, whose leading monomial is not in L(J) and such that g differs from f only by multiples of the elements of a standard basis of J, say a_alpha f_alpha with LT(a_alphy f_alpha) \leq LT(f)

System (please complete the following information):

julia> Oscar.versioninfo(full=true)
OSCAR version 0.12.2-DEV
  combining:
    AbstractAlgebra.jl   v0.30.9
    GAP.jl               v0.9.6
    Hecke.jl             v0.18.14
    Nemo.jl              v0.34.5
    Polymake.jl          v0.9.2
    Singular.jl          v0.18.5
  building on:
    Antic_jll               v0.201.500+0
    Arb_jll                 v200.2300.0+0
    Calcium_jll             v0.401.100+0
    FLINT_jll               v200.900.6+0
    GAP_jll                 v400.1200.200+1
    Singular_jll            v403.203.200+0
    libpolymake_julia_jll   v0.9.2+0
    libsingular_julia_jll   v0.33.0+0
    polymake_jll            v400.900.0+0
See `]st -m` for a full list of dependencies.

Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, znver1)
Official https://julialang.org/ release

Additional context The key to the problem lies in the design decision to handle normal forms of polynomials via normal forms of the ideal they generate. This is fine for the global case, but causes huge problems in the local case, as units might pop up/disappear. Both functionalities are required (i.e. ideals for idealtheoretic work, as they are handled now, and separately polynomials and vectors for element oriented work as described above).

afkafkafk13 commented 1 year ago

additional information: I am talking about src/Rings/groebner.jl and the functions

function normal_form(f::T, J::MPolyIdeal; ordering::MonomialOrdering = default_ordering(base_ring(J))) where { T <: MPolyRingElem }

function normal_form(A::Vector{T}, J::MPolyIdeal; ordering::MonomialOrdering=default_ordering(base_ring(J))) where { T <: MPolyRingElem }
fingolfin commented 1 year ago

Editorial remark: use triple backticks, not triple quotes, to format code blocks :-)