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

Something goes wrong with divides in quotient rings #645

Closed HechtiDerLachs closed 3 years ago

HechtiDerLachs commented 3 years ago

Try the following code in julia:

using Oscar

R, vars = QQ["x","y"] x = vars[1] y = vars[2] I = ideal(R, [zero(R)] ) Q, proj = quo(R,I) f = proj(x*y) # This command works: divides( one(R), x*y ) # this one doesn't: divides( one(Q), f )

What's going wrong there?

fingolfin commented 3 years ago

To expand on this message, this is what happens:

julia> # This command works:
       divides( one(R), x*y )
(false, 0)

julia> # this one doesn't:
       divides( one(Q), f )
ERROR: Expected an array of length 1, got 0
Stacktrace:
 [1] _check_dim
   @ ~/.julia/packages/AbstractAlgebra/PirHd/src/Matrix.jl:57 [inlined]
 [2] matrix
   @ ~/.julia/packages/AbstractAlgebra/PirHd/src/Matrix.jl:6055 [inlined]
 [3] groebner_basis_with_transform(I::MPolyIdeal{fmpq_mpoly}; ordering::Symbol, complete_reduction::Bool, use_hilbert::Bool)
   @ Oscar.ModStdQ ~/.julia/packages/Oscar/Bh1Um/experimental/ModStd/ModStdQ.jl:187
 [4] groebner_assure(I::MPolyIdeal{fmpq_mpoly}, ord::Symbol; use_hilbert::Bool, Proof::Bool)
   @ Oscar.ModStdQ ~/.julia/packages/Oscar/Bh1Um/experimental/ModStd/ModStdQ.jl:36
 [5] groebner_assure (repeats 2 times)
   @ ~/.julia/packages/Oscar/Bh1Um/experimental/ModStd/ModStdQ.jl:32 [inlined]
 [6] simplify!(f::MPolyQuoElem{fmpq_mpoly})
   @ Oscar ~/.julia/packages/Oscar/Bh1Um/src/Rings/MPolyQuo.jl:536
 [7] divides(a::MPolyQuoElem{fmpq_mpoly}, b::MPolyQuoElem{fmpq_mpoly})
   @ Oscar ~/.julia/packages/Oscar/Bh1Um/src/Rings/MPolyQuo.jl:776
 [8] top-level scope
   @ REPL[8]:2

So it looks to me that simplify! for MPolyQuoElem{fmpq_mpoly} has a bug?

Ironically, the divides code says this:

function divides(a::MPolyQuoElem, b::MPolyQuoElem)
  check_parent(a, b)
  simplify!(a) #not neccessary
  simplify!(b) #not neccessary

[ Off-topic hint: you can use triple backtick notation to format whole swaths of code. You can even turn on syntax highlighting if you like: This input...

```julia
using Oscar

R, vars = QQ["x","y"]
x = vars[1]
y = vars[2]
I = ideal(R, [zero(R)] )
Q, proj = quo(R,I)
f = proj(x*y)
# This command works:
divides( one(R), x*y )
# this one doesn't:
divides( one(Q), f )
leads to this output:
```julia
using Oscar

R, vars = QQ["x","y"]
x = vars[1]
y = vars[2]
I = ideal(R, [zero(R)] )
Q, proj = quo(R,I)
f = proj(x*y)
# This command works:
divides( one(R), x*y )
# this one doesn't:
divides( one(Q), f )
ederc commented 3 years ago

Strangely simplify seems to use the "other" groebner_assure from @fieker's experimental code on modular std over QQ. Using the groebner_assure from groebner.jl everything works fine. I will look at this tomorrow.

HechtiDerLachs commented 3 years ago

Ok, nice. Then there's hope this that this will be resolved soon. @fingolfin :Thanks for the hint!

thofma commented 3 years ago

@ederc Can you isolate the input for which the groebner_basis_with_transform in ModStdQ.jl throws?