Skip to content

Commit

Permalink
Fixes small_generating_set, mininimal_primes over a number field (#4279)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: HechtiDerLachs <[email protected]>
Co-authored-by: ederc <[email protected]>
Co-authored-by: Lars Göttgens <[email protected]>
Co-authored-by: Max Horn <[email protected]>
  • Loading branch information
5 people authored Nov 6, 2024
1 parent 8bea0b6 commit e91af41
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/Rings/mpoly-ideals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1203,17 +1203,27 @@ function minimal_primes(

# This will in many cases lead to an easy simplification of the problem
if factor_generators
J = typeof(I)[ideal(R, elem_type(R)[])]
J = [ideal(R, gens(I))] # A copy of I as initialization
for g in gens(I)
K = typeof(I)[]
is_zero(g) && continue
for (b, k) in factor(g)
# Split the already collected components with b
for j in J
push!(K, j + ideal(R, b))
end
end
J = K
end

unique_comp = typeof(I)[]
for q in J
is_one(q) && continue
q in unique_comp && continue
push!(unique_comp, q)
end
J = unique_comp

# unique! seems to fail here. We have to do it manually.
pre_result = filter!(!is_one, vcat([minimal_primes(j; algorithm, factor_generators=false) for j in J]...))
result = typeof(I)[]
Expand Down Expand Up @@ -2110,7 +2120,8 @@ function small_generating_set(
computed_gb = IdealGens(ring, sing_gb, true)
if !haskey(I.gb,computed_gb.ord)
# if not yet present, store gb for later use
I.gb[computed_gb.ord] = computed_gb
I.gb[computed_gb.ord] = computed_gb
I.gb[computed_gb.ord].isGB = true
end

# we do not have a notion of minimal generating set in this context!
Expand Down Expand Up @@ -2328,4 +2339,3 @@ end
function hash(I::Ideal, c::UInt)
return hash(base_ring(I), c)
end

15 changes: 13 additions & 2 deletions test/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ end
l = minimal_primes(i, algorithm=:charSets)
@test length(l) == 2
@test l[1] == i1 && l[2] == i2 || l[1] == i2 && l[2] == i1

R, (a, b, c, d) = polynomial_ring(ZZ, [:a, :b, :c, :d])
i = ideal(R, [R(9), (a+3)*(b+3)])
i1 = ideal(R, [R(3), a])
Expand Down Expand Up @@ -232,6 +231,19 @@ end
R, (x, y) = polynomial_ring(QQ, [:x, :y])
I = ideal(R, [one(R)])
@test is_prime(I) == false

J = ideal(R, [x*(x-1), y*(y-1), x*y])
l = minimal_primes(J)
@test length(l) == 3

QQt, t = QQ[:t]
kk, a = extension_field(t^2 + 1)

R, (x, y) = kk[:x, :y]
J = ideal(R, [x^2 + 1, y^2 + 1, (x - a)*(y - a)])
l = minimal_primes(J)
@test length(l) == 3

end

@testset "Groebner" begin
Expand Down Expand Up @@ -601,4 +613,3 @@ end
I = ideal(P, elem_type(P)[])
@test !radical_membership(x, I)
end

0 comments on commit e91af41

Please sign in to comment.