Skip to content

Commit

Permalink
Fixes grading in _presentation_minimal (oscar-system#3799)
Browse files Browse the repository at this point in the history
* fix for grading when using mres

* adds test for issue 3797
  • Loading branch information
ederc authored May 27, 2024
1 parent 9be5eff commit 7d851c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Modules/UngradedModules/Presentation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,15 @@ function _presentation_minimal(SQ::ModuleFP{T};
F0_to_SQ.generators_map_to_generators = true
AbstractAlgebra.set_name!(F0, "$br_name^$(ngens(F0))")

is_sq_graded = is_graded(SQ)

# if we want a minimal kernel too, we go to prune_with_map
K, inc = sub(F0, relations(SQ_new))
if minimal_kernel
K, inc2 = prune_with_map(K)
inc = compose(inc2, inc)
end
F1 = if is_graded(SQ)
F1 = if is_sq_graded
graded_free_module(R, degrees_of_generators(K))
else
free_module(R, ngens(K))
Expand All @@ -598,12 +600,21 @@ function _presentation_minimal(SQ::ModuleFP{T};

# When there is no kernel, clean things up
if is_zero(F1)
F1 = FreeMod(R, 0)
if is_sq_graded
F1 = graded_free_module(R, 0)
else
F1 = FreeMod(R, 0)
end
AbstractAlgebra.set_name!(F1, "$br_name^$(ngens(F1))")
F1_to_F0 = hom(F1, F0, elem_type(F0)[]; check=false)
end

# prepare the end of the presentation
Z = FreeMod(R, 0)
if is_sq_graded
Z = graded_free_module(R, 0)
else
Z = FreeMod(R, 0)
end
AbstractAlgebra.set_name!(Z, "0")
SQ_to_Z = hom(SQ, Z, elem_type(Z)[zero(Z) for i in 1:ngens(SQ)]; check=false)

Expand Down
5 changes: 5 additions & 0 deletions test/Modules/UngradedModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ end
@test is_bijective(p)
end

# issue 3797
R, (x,y) = graded_polynomial_ring(QQ, [:x, :y])
I = ideal(R, [x, y])
FIm = free_resolution(I, algorithm = :mres)
@test is_graded(FIm)

# over Rationals
R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"])
Expand Down

0 comments on commit 7d851c2

Please # to comment.