From 745309dc662a8dfbf16d1773f16a76bc3fc4f548 Mon Sep 17 00:00:00 2001 From: ederc Date: Mon, 19 Feb 2024 14:26:20 +0100 Subject: [PATCH 1/4] uses new divrem from Singular, fits Singular's reduce --- src/Rings/groebner.jl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Rings/groebner.jl b/src/Rings/groebner.jl index 27f78a457047..04cee1145f50 100644 --- a/src/Rings/groebner.jl +++ b/src/Rings/groebner.jl @@ -881,11 +881,6 @@ Return a `Vector` which contains, for each element `g` of `G`, quotients and a r !!! note The returned remainders are fully reduced if `complete_reduction` is set to `true` and `ordering` is global. -!!! note - The reduction strategy behind the `reduce` function and the reduction strategy behind the functions - `reduce_with_quotients` and `reduce_with_quotients_and_unit` differ. As a consequence, the computed - remainders may differ. - # Examples ```jldoctest @@ -898,7 +893,7 @@ julia> g = x^3*y+x^5+x^2*y^2*z^2+z^6; julia> Q, h = reduce_with_quotients(g, [f1,f2, f3], ordering = lex(R)); julia> h --z^9 + z^7 + z^6 + z^4 +x^5 - x^3 + y^6 + z^6 julia> g == Q[1]*f1+Q[2]*f2+Q[3]*f3+h true @@ -929,7 +924,7 @@ function _reduce_with_quotients_and_unit(I::IdealGens, J::IdealGens, ordering::M @assert base_ring(J) == base_ring(I) sI = singular_generators(I, ordering) sJ = singular_generators(J, ordering) - res = Singular.divrem(sI, sJ, complete_reduction=complete_reduction) + res = Singular.divrem2(sI, sJ, complete_reduction=complete_reduction) return matrix(base_ring(I), res[3]), matrix(base_ring(I), res[1]), [J.gens.Ox(x) for x = gens(res[2])] end From 2a2d27a739731d54319e8aadd2f9dec4e88d308e Mon Sep 17 00:00:00 2001 From: ederc Date: Mon, 19 Feb 2024 14:50:06 +0100 Subject: [PATCH 2/4] adds test case from issue #3105 --- test/Rings/groebner.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Rings/groebner.jl b/test/Rings/groebner.jl index a06d2e390259..37a592d6692a 100644 --- a/test/Rings/groebner.jl +++ b/test/Rings/groebner.jl @@ -59,6 +59,13 @@ @test q * F + [r] != [f] u, q, r = reduce_with_quotients_and_unit(f, F, ordering=neglex(R)) @test q * F + [r] == u * [f] + # Issue 3105 + R, (x,y,z) = QQ[:x, :y, :z] + f = x^3 - x^2*y - x^2*z + x + f1 = x^2*y - z + f2 = x*y - 1 + _,r = reduce_with_quotients(f, [f1, f2], ordering = deglex(R)) + @test r == x^3-x^2*z I = ideal(R,[y^2 - x, x^3 - 2*y^2]) @test is_groebner_basis(I.gens, ordering=degrevlex(R)) == true @test is_groebner_basis(I.gens, ordering=lex(R)) == false From e6239fa932c56b36f7a592e113eb9cfe03ac4c40 Mon Sep 17 00:00:00 2001 From: ederc Date: Mon, 26 Feb 2024 14:05:01 +0100 Subject: [PATCH 3/4] bump Singular to v0.22.4 for divrem2 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 465636a01a0c..767cce3c8c03 100644 --- a/Project.toml +++ b/Project.toml @@ -42,7 +42,7 @@ Preferences = "1" Random = "1.6" RandomExtensions = "0.4.3" Serialization = "1.6" -Singular = "0.22.3" +Singular = "0.22.4" TOPCOM_jll = "0.17.8" UUIDs = "1.6" cohomCalg_jll = "0.32.0" From 577b49ba47f5042b98d235913bf83457596a90b8 Mon Sep 17 00:00:00 2001 From: ederc Date: Mon, 26 Feb 2024 14:36:06 +0100 Subject: [PATCH 4/4] fixes doctests --- src/Rings/groebner.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Rings/groebner.jl b/src/Rings/groebner.jl index 04cee1145f50..6436a60ecc7b 100644 --- a/src/Rings/groebner.jl +++ b/src/Rings/groebner.jl @@ -719,8 +719,8 @@ julia> U [ 0 y + 1] julia> Q -[x^3 - x*y^2*z^2 + x*y + y^2*z^2 0 y*z^2 + z^2] -[ -3*y^2*z^2 - y*z x*y + x 0] +[ x^3 - x*y^2*z^2 + x*y + y^2*z^2 0 y*z^2 + z^2] +[x*y*z^2 + y^3*z - 3*y^2*z^2 - y*z -x^2*y*z - x^2*z + x*y + x 0] julia> H 2-element Vector{QQMPolyRingElem}: @@ -798,7 +798,7 @@ julia> reduce_with_quotients_and_unit(f, F) ([1], [x*y 10*x+1], x^4 + 10*x^3 + 1) julia> unit, M, res = reduce_with_quotients_and_unit(f, F, ordering=lex(R)) -([1], [0 y^2], y^6 + 10*y^4 + 1) +([1], [x*y 0], x*y^4 + 10*y^4 + 1) julia> M * F + [res] == unit * [f] true @@ -855,7 +855,7 @@ julia> reduce_with_quotients_and_unit(f, F) ([1], [x*y 10*x+1], x^4 + 10*x^3 + 1) julia> unit, M, res = reduce_with_quotients_and_unit(f, F, ordering=lex(R)) -([1], [0 y^2], y^6 + 10*y^4 + 1) +([1], [x*y 0], x*y^4 + 10*y^4 + 1) julia> M * F + [res] == unit * [f] true