oscar-system / Singular.jl

Julia package for the Singular library
Other
30 stars 31 forks source link

Singular.jl broken, possibly due to new Singular_jll release? #811

Open fingolfin opened 3 weeks ago

fingolfin commented 3 weeks ago

The Singular.jl CI tests started to fail. Nothing in Singular.jl changed, but there is a new Singular_jll release which is

sideal.slimgb: Error During Test at /Users/runner/work/Singular.jl/Singular.jl/test/ideal/sideal-test.jl:398
  Test threw exception
  Expression: isequal(B, Ideal(R, 2 * y ^ 2 + 3, x ^ 2 + x * y + 1)) || isequal(B, Ideal(x ^ 2 + x * y + 1, 2 * y ^ 2 + 3))
  MethodError: no method matching Ideal(::spoly{n_Q}, ::spoly{n_Q})

  Closest candidates are:
    Ideal(::PolyRing{T}, ::spoly{T}...) where T<:AbstractAlgebra.RingElem
     @ Singular ~/work/Singular.jl/Singular.jl/src/ideal/ideal.jl:1188

  Stacktrace:
   [1] macro expansion
     @ ~/work/Singular.jl/Singular.jl/test/ideal/sideal-test.jl:398 [inlined]
   [2] macro expansion
     @ ~/hostedtoolcache/julia/1.10.4/aarch64/share/julia/stdlib/v1.10/Test/src/Test.jl:669 [inlined]
   [3] macro expansion
     @ ~/work/Singular.jl/Singular.jl/test/ideal/sideal-test.jl:398 [inlined]
   [4] macro expansion
     @ ~/hostedtoolcache/julia/1.10.4/aarch64/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [5] top-level scope
     @ ~/work/Singular.jl/Singular.jl/test/ideal/sideal-test.jl:384
Test Summary: | Pass  Error  Total  Time
sideal.slimgb |    3      1      4  0.8s
ERROR: LoadError: Some tests did not pass: 3 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /Users/runner/work/Singular.jl/Singular.jl/test/ideal/sideal-test.jl:383
in expression starting at /Users/runner/work/Singular.jl/Singular.jl/test/ideal-test.jl:1
in expression starting at /Users/runner/work/Singular.jl/Singular.jl/test/runtests.jl:17
ERROR: LoadError: Package Singular errored during testing

If I downgrade Singular_jll from v404.0.301 to v404.0.100 it works.

Possible solutions:

  1. we yank that Singular_jll version from the registry, and re-release it with a version number offset that modifies the "minor" (middle) part, i.e. offset 0.1.0 or so
  2. update Singular.jl to deal with the changes, increase the Singular_jll compat to ~404.000.301, and make a quick release
  3. update Singular.jl to use Singular_jll compat=404.000.100` and make a quick release.

@hannes14 I can't judge how hard/easy option 2 would be. Which should we try?

ederc commented 3 weeks ago

Maybe use option 3 for a fast fix, I'm not sure how fast option 2 can be done.

benlorenz commented 3 weeks ago

Option 3 might not work in all cases because new jll + old Singular.jl will still be a valid resolution for the package manager and not much different from old jll + new Singular.jl.

I think the call isequal(B, Ideal(x ^ 2 + x * y + 1, 2 * y ^ 2 + 3)) was also invalid before the update (missing the R argument), the main issue seems to be that this is not equal anymore:

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Singular polynomial ring (QQ),(x,y),(dp(2),C), spoly{n_Q}[x, y])

julia> I = Ideal(R, x^2 + x*y + 1, 2y^2 + 3)
Singular ideal over Singular polynomial ring (QQ),(x,y),(dp(2),C) with generators (x^2 + x*y + 1, 2*y^2 + 3)

julia> B = slimgb(I, complete_reduction=false)
Singular ideal over Singular polynomial ring (QQ),(x,y),(dp(2),C) with generators (y^2 + 3//2, x^2 + x*y + 1)

julia> isequal(B, Ideal(R, 2 * y ^ 2 + 3, x ^ 2 + x * y + 1))
false

Before the update the coefficients in B were not normalized like that:

julia> B = slimgb(I, complete_reduction=false)
Singular ideal over Singular polynomial ring (QQ),(x,y),(dp(2),C) with generators (2*y^2 + 3, x^2 + x*y + 1)

julia> isequal(B, Ideal(R, 2 * y ^ 2 + 3, x ^ 2 + x * y + 1))
true

And this normalization issue looks very similar to the doctest failure in Oscar (e.g. in #3889): https://github.com/oscar-system/Oscar.jl/actions/runs/9704350563/job/26795722745?pr=3889#step:8:3878

│ Evaluated output:
│ 
│ Gröbner basis with elements
│ 1 -> x*y - 3*x
│ 2 -> y^3 - 6*x^2
│ 3 -> x^3 - 9//2*x
│ with respect to the ordering
│ degrevlex([x, y])
│ 
│ Expected output:
│ 
│ Gröbner basis with elements
│ 1 -> x*y - 3*x
│ 2 -> y^3 - 6*x^2
│ 3 -> 2*x^3 - 9*x
│ with respect to the ordering
│ degrevlex([x, y])

Also it looks like the booktests are getting stuck during algebraic-geometry/zariski.jlcon now, maybe this is also related but I haven't really looked into it.

hannes14 commented 3 weeks ago

I vote for option 2, as now there are fixes to the option handling in libsingular: resetting options must be done after resetting the ring