Skip to content

Commit

Permalink
Merge pull request #1476 from AlexD97/FreeResolutionModule
Browse files Browse the repository at this point in the history
Improve simplify; make ext/tor work again, add test
  • Loading branch information
fieker committed Jul 25, 2022
2 parents 5a1d7f1 + b8bd7f0 commit 350e1e7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Modules/UngradedModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4187,8 +4187,8 @@ function Hecke.ring(I::MPolyIdeal)
return parent(gen(I, 1))
end

function *(I::MPolyIdeal{T}, F::FreeMod{T}) where {T<:RingElem}
return sub(F, [g*e for g in gens(I) for e in gens(F)])
function *(I::MPolyIdeal{T}, M::ModuleFP{T}) where {T<:RingElem}
return sub(M, [g*e for g in gens(I) for e in gens(M)])
end

@doc Markdown.doc"""
Expand Down Expand Up @@ -4880,9 +4880,9 @@ end
Compute $\text{Tor}_i(M,N)$.
"""
function tor(M::ModuleFP, N::ModuleFP, i::Int)
free_res = free_resolution_via_kernels(M)[1:end-2]
lifted_resolution = tensor_product(free_res, N) #TODO only three homs are necessary
return homology(lifted_resolution,length(lifted_resolution)-i)
free_res = free_resolution(M)
lifted_resolution = tensor_product(free_res.C, N) #TODO only three homs are necessary
return homology(lifted_resolution,i)
end

#TODO, mF
Expand Down Expand Up @@ -5053,8 +5053,8 @@ end
Compute $\text{Ext}^i(M,N)$.
"""
function ext(M::ModuleFP, N::ModuleFP, i::Int)
free_res = free_resolution_via_kernels(M)[1:end-2]
lifted_resolution = hom(free_res, N) #TODO only three homs are necessary
free_res = free_resolution(M)
lifted_resolution = hom(free_res.C, N) #TODO only three homs are necessary
return homology(lifted_resolution,i)
end

Expand Down Expand Up @@ -5378,7 +5378,13 @@ function simplify(M::SubQuo)
function rows_to_delete(A::MatElem, max_index::Int)
to_delete_indices::Vector{Int} = []
corresponding_row_index::Vector{Int} = []
if max_index < nrows(A)
A = vcat(A[(max_index+1):nrows(A),:],A[1:max_index,:])
end
K = matrix_kernel(A)
if max_index < nrows(A)
K = hcat(K[:,(ncols(K)-max_index+1):ncols(K)],K[:,1:(ncols(K)-max_index)])
end
for i=1:size(K)[1], j=1:max_index
if is_unit(K[i,j])
deletion_possible = true
Expand Down Expand Up @@ -5445,7 +5451,7 @@ function simplify(M::SubQuo)

if length(new_generators)==0
zero_module = FreeMod(R,0)
injection = FreeModuleHom(zero_module, M, [])
injection = FreeModuleHom(zero_module, M, Vector{ModuleFPElem}())
projection = SubQuoHom(M, zero_module, [zero(zero_module) for i=1:ngens(M)])
# TODO early return or register morphisms?
return zero_module,injection,projection
Expand Down
20 changes: 20 additions & 0 deletions test/Modules/UngradedModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,26 @@ end
end
end

@testset "Ext, Tor" begin
# These tests are only meant to check that the ext and tor function don't throw any error
# These tests don't check the correctness of ext and tor

R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
A = R[x; y]
B = R[x^2; x*y; y^2; z^4]
M = SubQuo(A, B)
F = free_module(R, 1)
Q, _ = quo(F, [x*F[1]])
T0 = tor(Q, M, 0)
T1 = tor(Q, M, 1)
T2 = tor(Q, M, 2)
@test iszero(T2)

E0 = ext(Q, M, 0)
E1 = ext(Q, M, 1)
E2 = ext(Q, M, 2)
end

@testset "Gröbner bases" begin
R, (x,y) = PolynomialRing(QQ, ["x", "y"])
F = FreeMod(R, 1)
Expand Down

0 comments on commit 350e1e7

Please sign in to comment.