From c38c14b0b437f29e6e5e1b9b3cad2238d5c60791 Mon Sep 17 00:00:00 2001 From: Johannes Schmitt Date: Wed, 21 Aug 2024 15:59:17 +0200 Subject: [PATCH] Fix #4018 --- src/Rings/mpoly-graded.jl | 4 ++-- src/Rings/mpoly-ideals.jl | 2 +- src/Rings/mpoly.jl | 8 ++++++-- test/Rings/mpoly.jl | 15 ++++++++++++--- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index a1b1f6f4a727..4e6432bf3184 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -1502,8 +1502,8 @@ mutable struct HilbertData @req coefficient_ring(R) isa AbstractAlgebra.Field "The coefficient ring must be a field" @req all(is_homogeneous, gens(I)) "The generators of the ideal must be homogeneous" - G = groebner_assure(I) - cf = Singular.hilbert_series_data(G.S, W) + S = singular_groebner_generators(I, false, true) + cf = Singular.hilbert_series_data(S, W) return new(cf, W, I) end function HilbertData(B::IdealGens) diff --git a/src/Rings/mpoly-ideals.jl b/src/Rings/mpoly-ideals.jl index 2ac686fad008..fc3085415601 100644 --- a/src/Rings/mpoly-ideals.jl +++ b/src/Rings/mpoly-ideals.jl @@ -2112,7 +2112,7 @@ function grassmann_pluecker_ideal(ring::MPolyRing, return coeff_ring(numerator(c)) end if !is_graded(ring) - ring, _ = grade(ring) + ring, _ = grade(ring) end h = hom(base_ring(I), ring, coeffmap, gens(ring)) converted_generators = elem_type(ring)[h(g) for g in groebner_basis(I; ordering = degrevlex(base_ring(I)))] diff --git a/src/Rings/mpoly.jl b/src/Rings/mpoly.jl index 75942e246997..f3e0bc3ce23f 100644 --- a/src/Rings/mpoly.jl +++ b/src/Rings/mpoly.jl @@ -383,7 +383,11 @@ function singular_generators(B::IdealGens, monorder::MonomialOrdering=default_or isdefined(B, :ord) && B.ord == monorder && monomial_ordering(B.Ox, Singular.ordering(base_ring(B.S))) == B.ord && return B.gens.S SR = singular_poly_ring(B.Ox, monorder) f = Singular.AlgebraHomomorphism(B.Sx, SR, gens(SR)) - return Singular.map_ideal(f, B.gens.S) + S = Singular.map_ideal(f, B.gens.S) + if isdefined(B, :ord) && B.ord == monorder + S.isGB = B.isGB + end + return S end @doc raw""" @@ -745,7 +749,7 @@ function singular_assure(I::IdealGens) I.gens.Sx = singular_poly_ring(I.Ox; keep_ordering = I.keep_ordering) I.gens.S = Singular.Ideal(I.Sx, elem_type(I.Sx)[I.Sx(x) for x = I.O]) end - if I.isGB + if I.isGB && (!isdefined(I, :ord) || I.ord == monomial_ordering(I.gens.Ox, internal_ordering(I.gens.Sx))) I.gens.S.isGB = true end end diff --git a/test/Rings/mpoly.jl b/test/Rings/mpoly.jl index e37ecce6ca33..cfd420f78912 100644 --- a/test/Rings/mpoly.jl +++ b/test/Rings/mpoly.jl @@ -300,9 +300,18 @@ end end @testset "Grassmann Plücker Relations" begin - R, x = graded_polynomial_ring(residue_ring(ZZ, 7)[1], "x" => (1:2, 1:3)) - test_ideal =ideal([x[1, 2]*x[2, 2] + 6*x[2, 1]*x[1, 3] + x[1, 1]*x[2, 3]]) - @test grassmann_pluecker_ideal(R, 2, 4) == test_ideal + R, x = graded_polynomial_ring(residue_ring(ZZ, 7)[1], "x" => (1:2, 1:3)) + test_ideal =ideal([x[1, 2]*x[2, 2] + 6*x[2, 1]*x[1, 3] + x[1, 1]*x[2, 3]]) + @test grassmann_pluecker_ideal(R, 2, 4) == test_ideal + + # Issue #4018 + I = grassmann_pluecker_ideal(2, 5) + @test degree(I) == 5 + @test dim(I) == 7 + R, x = graded_polynomial_ring(GF(7), 10, "x") + I = grassmann_pluecker_ideal(R, 2, 5) + @test degree(I) == 5 + @test dim(I) == 7 end @testset "IdealGens" begin