Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decide_du_val_singularity: Ideal does not describe a single K-point #2531

Closed
benlorenz opened this issue Jul 7, 2023 · 20 comments
Closed

decide_du_val_singularity: Ideal does not describe a single K-point #2531

benlorenz opened this issue Jul 7, 2023 · 20 comments
Assignees
Labels
bug Something isn't working singular coding sprint

Comments

@benlorenz
Copy link
Member

benlorenz commented Jul 7, 2023

Describe the bug
Infrequent bug during the tests after the merge of #2468 by @afkafkafk13, observed on julia 1.8 (ubuntu) and julia nightly (ubuntu)

To Reproduce
Maybe run the tests repeatedly?

Full error message:

du Val Tester: Error During Test at /home/runner/work/Oscar.jl/Oscar.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:13
  Test threw exception
  Expression: ((decide_du_val_singularity(X, J2))[1])[3] == (:A, 3)
  Ideal does not describe a single K-point
  Stacktrace:
   [1] error(s::String)
     @ Base ./error.jl:35
   [2] rational_point_coordinates(I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}})
     @ Oscar ~/work/Oscar.jl/Oscar.jl/experimental/Schemes/SpaceGerms.jl:128
   [3] _check_duval_at_point(IX::MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Ipt::MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}})
     @ Oscar ~/work/Oscar.jl/Oscar.jl/experimental/Schemes/duValSing.jl:219
   [4] decide_du_val_singularity(X::Spec{AnticNumberField, MPolyQuoRing{AbstractAlgebra.Generic.MPoly{nf_elem}}}, I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}})
     @ Oscar ~/work/Oscar.jl/Oscar.jl/experimental/Schemes/duValSing.jl:173
   [5] decide_du_val_singularity(X::Spec{QQField, MPolyQuoRing{QQMPolyRingElem}}, I::MPolyIdeal{QQMPolyRingElem})
     @ Oscar ~/work/Oscar.jl/Oscar.jl/experimental/Schemes/duValSing.jl:185
   [6] macro expansion
     @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:669 [inlined]
   [7] macro expansion
     @ ~/work/Oscar.jl/Oscar.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:13 [inlined]
   [8] macro expansion
     @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1577 [inlined]
   [9] top-level scope
     @ ~/work/Oscar.jl/Oscar.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:2
Test Summary: | Pass  Error  Total   Time
du Val Tester |    7      1      8  31.4s
ERROR: LoadError: LoadError: Some tests did not pass: 7 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /home/runner/work/Oscar.jl/Oscar.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:1

System (please complete the following information):
Current Oscar master on github actions, see logs for details.

@benlorenz benlorenz added the bug Something isn't working label Jul 7, 2023
@afkafkafk13
Copy link
Collaborator

I tried to reproduce the bug with 50 runs of the offending test on julia 1.8.5 and the current master of Oscar (each time restarting julia from scratch to avoid influence of prior runs -- e.g. on the random seed of Singular or on cached data), but the error did not manifest itself. I also tried 50 runs on the same setup, but without restarting Julia/Oscar. Again the error did not manifest itself.

I am a bit at a loss on how to reproduce the error. Any hint is welcome.

@afkafkafk13
Copy link
Collaborator

afkafkafk13 commented Jul 8, 2023

I tracked it down:

absolute_primary_decomposition may return something not fully decomposed in rare circomstances:

julia> I = ideal(w, z, y^3 + 2*y, x^3 + x, x^7 + 2*x^5 + x^3 + y^8 + 6*y^6 + 12*y^4 + 8*y^2 + z^4);

julia> decomp = absolute_primary_decomposition(I);

julia> decomp
Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}[(ideal(w, z, y, x), ideal(x, y, z, w), ideal(w, z, y, x), 1), (ideal(w, z, y^2 + 2, x), ideal(w, z, y^2 + 2, x), ideal(-45*x + 3*z + w, z, x, y^2 + 2), 1), (ideal(w, z, y, x^2 + 1), ideal(w, z, y, x^2 + 1), ideal(-17*x - 10*y - 45*z + w - _a, z, y, w), 2), (ideal(w, z, y^2 + 2, x^2 + 1), ideal(w, z, y^2 + 2, x^2 + 1), ideal(-36*x + 35*y - 34*z + w - _a, z, 36*_a^2*x + (-35*_a^2 + 80780)*y - _a^2*w - 8646*_a, w), 4)]

More readable version of the components:

(ideal(w, z, y, x), ideal(x, y, z, w), ideal(w, z, y, x), 1), 
(ideal(w, z, y^2 + 2, x), ideal(w, z, y^2 + 2, x), ideal(-45*x + 3*z + w, z, x, y^2 + 2), 1), 
(ideal(w, z, y, x^2 + 1), ideal(w, z, y, x^2 + 1), ideal(-17*x - 10*y - 45*z + w - _a, z, y, w), 2),
 (ideal(w, z, y^2 + 2, x^2 + 1), ideal(w, z, y^2 + 2, x^2 + 1), ideal(-36*x + 35*y - 34*z + w - _a, z, 36*_a^2*x + (-35*_a^2 + 80780)*y - _a^2*w - 8646*_a, w), 4)

The offending component is the second one and the whole decomposition is handed to Oscar by Singular.LibPrimdec.absPrimdecGTZ.

@wdecker : Is it possible that some test on, whether a choice is sufficiently general, misses a case down in the Singular library (or even further down)?

@fingolfin
Copy link
Member

We just talked about this in our weekly meeting, @wdecker and @hannes14 will look into it.

@fingolfin
Copy link
Member

@afkafkafk13 your reproducing example is incomplete, there is no ring definition, could you provide one so we can more easily reproduce?

@fingolfin
Copy link
Member

Here is my guess:

julia> R, (x,y,z,w) = QQ[:x,:y,:z,:w]
(Multivariate polynomial ring in 4 variables over QQ, QQMPolyRingElem[x, y, z, w])

julia> I = ideal(R, [w, z, y^3 + 2*y, x^3 + x, x^7 + 2*x^5 + x^3 + y^8 + 6*y^6 + 12*y^4 + 8*y^2 + z^4]);

julia> decomp = absolute_primary_decomposition(I);

@fingolfin
Copy link
Member

It seems [x[end] for x in decomp] usually is 1,2,2,4 but in some cases 1,2,2,2 which I assume is wrong.

@afkafkafk13
Copy link
Collaborator

afkafkafk13 commented Jul 19, 2023

Yes, you see it in the multiplicities, and no, the erroneous one can also be 1,1,2,4.

Usually, it decomposes into 9 parts as it should, but sometimes it misses a decomposition.

I reran my test script again and made sure to copy properly today.
Here is run 73 of this example (1 to 72 were fine):

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

julia> I = ideal(R,[w, z, y^3 + 2*y, x^3 + x, x^7 + 2*x^5 + x^3 + y^8 + 6*y^6 + 12*y^4 + 8*y^2 + z^4])
ideal(w, z, y^3 + 2*y, x^3 + x, x^7 + 2*x^5 + x^3 + y^8 + 6*y^6 + 12*y^4 + 8*y^2 + z^4)

julia> absolute_primary_decomposition(I)
4-element Vector{Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}}:
 (ideal(w, z, y, x), ideal(x, y, z, w), ideal(w, z, y, x), 1)
 (ideal(w, z, y^2 + 2, x), ideal(w, z, y^2 + 2, x), ideal(27*x + 39*z + w, z, x, y^2 + 2), 1)
 (ideal(w, z, y, x^2 + 1), ideal(w, z, y, x^2 + 1), ideal(46*x + 34*y + 31*z + w - _a, z, y, -w), 2)
 (ideal(w, z, y^2 + 2, x^2 + 1), ideal(w, z, y^2 + 2, x^2 + 1), ideal(-16*x - 42*y + 30*z + w - _a, z, -16*_a^2*x + (-42*_a^2 + 274848)*y + _a^2*w + 10840*_a, w), 4)

@wdecker
Copy link
Collaborator

wdecker commented Jul 19, 2023

@hannes14 The bug seems to boil down to this strange behaviour:

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

julia> I = ideal(R, [y^2+2]);

julia> decompI = absolute_primary_decomposition(I)
1-element Vector{Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}}:
 (ideal(y^2 + 2), ideal(y^2 + 2), ideal(y - _a), 2)

julia> J = ideal(R, [x, y^2+2]);

julia> decompJ = absolute_primary_decomposition(J)
1-element Vector{Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}}:
 (ideal(y^2 + 2, x), ideal(y^2 + 2, x), ideal(y - _a, x), 2)

julia> K = ideal(R, [z, y^2+2]);

julia> decompK = absolute_primary_decomposition(K)
1-element Vector{Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}}:
 (ideal(z, y^2 + 2), ideal(z, y^2 + 2), ideal(17*y + z - _a, -z), 2)

@wdecker
Copy link
Collaborator

wdecker commented Jul 19, 2023

The problem is already on the Singular side

@fingolfin
Copy link
Member

@afkafkafk13 just to clarify, I got 1,2,2,2 in a test run (out of many) so this can fail in multiple ways it seems

@afkafkafk13
Copy link
Collaborator

@fingolfin This is precisely, what I understood.

@thofma
Copy link
Collaborator

thofma commented Aug 1, 2023

Is someone working on this? This pops up regularly in CI.

@afkafkafk13
Copy link
Collaborator

Yes, @wdecker and @hannes14 are working on it. It is a Singular problem.

@fieker
Copy link
Contributor

fieker commented Aug 9, 2023

fixed by Singular/Singular#1182

@benlorenz
Copy link
Member Author

benlorenz commented Feb 7, 2024

It looks like this was not really fixed, it recently happened here:
https://github.com/oscar-system/Oscar.jl/actions/runs/7766397045/job/21182180188?pr=3255#step:8:1271
(Probably depending on which other tests use the random number generation before...)

It has since disappeared again on that PR but a similar error can be reproduced by running through a few random seeds:

using Oscar, Test

mod = "$(Oscar.oscardir)/test/AlgebraicGeometry/Schemes/duValSing.jl";
seed = UInt32(0)
while (true)
   seed = seed+1
   println("running with seed $seed")
   Oscar.randseed!(seed)
   Oscar.set_seed!(seed)
   Oscar.test_module(mod; new=false)
end

On my setup this fails at seed 25:

running with seed 25
du Val Tester: Error During Test at /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:12
  Test threw exception
  Expression: is_du_val_singularity(X, J3) == false
  Ideal does not describe a single K-point
  Stacktrace:
   [1] error(s::String)
     @ Base ./error.jl:35
   [2] rational_point_coordinates(I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/SpaceGerms.jl:343
   [3] _check_duval_at_point(IX::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}}, Ipt::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:242
   [4] is_du_val_singularity(X::Spec{AbsSimpleNumField, MPolyQuoRing{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}}}, I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:116
   [5] is_du_val_singularity(X::Spec{QQField, MPolyQuoRing{QQMPolyRingElem}}, I::MPolyIdeal{QQMPolyRingElem})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:127
   [6] macro expansion
     @ /net/site-local.linux64/julia/julia-1.10.0/share/julia/stdlib/v1.10/Test/src/Test.jl:669 [inlined]
   [7] macro expansion
     @ /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:12 [inlined]
   [8] macro expansion
     @ /net/site-local.linux64/julia/julia-1.10.0/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [9] top-level scope
     @ /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:2
du Val Tester: Error During Test at /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:15
  Test threw exception
  Expression: ((decide_du_val_singularity(X, J3))[1])[1] == false
  Ideal does not describe a single K-point
  Stacktrace:
   [1] error(s::String)
     @ Base ./error.jl:35
   [2] rational_point_coordinates(I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/SpaceGerms.jl:343
   [3] _check_duval_at_point(IX::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}}, Ipt::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:242
   [4] decide_du_val_singularity(X::Spec{AbsSimpleNumField, MPolyQuoRing{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}}}, I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbsSimpleNumFieldElem}})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:196
   [5] decide_du_val_singularity(X::Spec{QQField, MPolyQuoRing{QQMPolyRingElem}}, I::MPolyIdeal{QQMPolyRingElem})
     @ Oscar /home/datastore/lorenz/software/julia/Oscar-duval.jl/experimental/Schemes/duValSing.jl:208
   [6] macro expansion
     @ /net/site-local.linux64/julia/julia-1.10.0/share/julia/stdlib/v1.10/Test/src/Test.jl:669 [inlined]
   [7] macro expansion
     @ /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:15 [inlined]
   [8] macro expansion
     @ /net/site-local.linux64/julia/julia-1.10.0/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [9] top-level scope
     @ /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:2
Test Summary: | Pass  Error  Total  Time
du Val Tester |    6      2      8  0.7s
ERROR: LoadError: Some tests did not pass: 6 passed, 0 failed, 2 errored, 0 broken.
in expression starting at /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:1

This is on master, commit a91222c.

Note that the failure of the reproducer is at Expression: is_du_val_singularity(X, J3) == false but the CI test died at Expression: has_du_val_singularities(X) == false.

Seed 94 gives the same error as the CI:

running with seed 94
du Val Tester: Error During Test at /home/datastore/lorenz/software/julia/Oscar-duval.jl/test/AlgebraicGeometry/Schemes/duValSing.jl:16
  Test threw exception
  Expression: has_du_val_singularities(X) == false
  Ideal does not describe a single K-point

cc: @antonydellavecchia

@benlorenz benlorenz reopened this Feb 7, 2024
@afkafkafk13
Copy link
Collaborator

afkafkafk13 commented Feb 7, 2024

I confirm: It is the same old bug coming up from Singular. It is again an incomplete absolute primary decomposition.

In the context of the code to reproduce provided by @benlorenz today, I see the following absolute primary decompositon in my debug output (newlines included for readability):

decomp = Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}
[(ideal(w, z, y^2 + 2, x), ideal(w, z, y^2 + 2, x), ideal(-6*x - 7*z + w, z, x, y^2 + 2), 1)]

Note that this describes two conjugate points over the algebraic closure (i.e. this is not absolutely primary) , but the number at the end indicates just 1 (i.e. absolutely primary). This mistake arises from the fact the the third ideal in the list, which should provide an ideal of any of the two points over a algebraic suitable field extension, is in reality just the same ideal as the original one.

@fieker originally tracked this down in the Singular library. The codeblock he changed in the Singular library, works fine now! Unfortunately, there seem to be additional copies of this precise codeblock in the file, which are still unchanged. (Look for randomLast in this file)

@afkafkafk13
Copy link
Collaborator

Could @fieker and @hannes14 please jointly have a look at this? This is also linked to Singular's#1186 and it seems that @hannes14 might have reverted the bugfix in the meantime -- on the other hand, the original problem (independently reported by fchyzak to Singular) might still have persisted after the original fix, just because only one of three or four occurrences had been fixed by @fieker .

@hannes14
Copy link
Member

hannes14 commented Feb 8, 2024

sShould be fixed with Singular/Singular@70c8c34
(atleast the test above has now error till seed 1700)

@afkafkafk13
Copy link
Collaborator

Thank you for the quick reaction.

@lgoettgens
Copy link
Member

should be fixed upstream. If someone sees it again, please re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working singular coding sprint
Projects
None yet
Development

No branches or pull requests

8 participants