Skip to content

Commit

Permalink
fix a problem with isomorphism for trivial groups (#3586)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBreuer authored Apr 12, 2024
1 parent da555c9 commit 0012b96
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 4 additions & 3 deletions experimental/GModule/Cohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ end
function fp_group_with_isomorphism(C::GModule)
#TODO: better for PcGroup!!!
if !isdefined(C, :F)
if (!isa(group(C), FPGroup)) && is_trivial(group(C))
G = group(C)
if (!isa(G, FPGroup)) && is_trivial(G)
C.F = free_group(0)
C.mF = hom(group(C), C.F, gens(group(C)), elem_type(C.F)[])
C.mF = hom(G, C.F, elem_type(G)[], elem_type(C.F)[])
else
C.F, C.mF = fp_group_with_isomorphism(gens(group(C)))
C.F, C.mF = fp_group_with_isomorphism(gens(G))
end
end
return C.F, C.mF
Expand Down
4 changes: 4 additions & 0 deletions experimental/GModule/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ end


@testset "Experimental.gmodule" begin
G = small_group(1, 1)
z = Oscar.RepPc.reps(QQ, G)
_, mp = Oscar.GrpCoh.fp_group_with_isomorphism(z[1])
@test is_bijective(mp)

G = small_group(7*3, 1)
z = Oscar.RepPc.reps(abelian_closure(QQ)[1], G)
Expand Down
12 changes: 10 additions & 2 deletions src/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,16 @@ function isomorphism(::Type{FPGroup}, G::GAPGroup; on_gens::Bool=false)
isos = get_attribute!(Dict{Tuple{Type, Bool}, Any}, G, :isomorphisms)::Dict{Tuple{Type, Bool}, Any}
return get!(isos, (FPGroup, on_gens)) do
if on_gens
f = GAPWrap.IsomorphismFpGroupByGenerators(G.X,
GAP.Globals.GeneratorsOfGroup(G.X))
Ggens = GAPWrap.GeneratorsOfGroup(G.X)
if length(Ggens) == 0
# TODO: remove this special treatment as soon as the change from
# https://github.com/gap-system/gap/pull/5700 is available in Oscar
# (not yet in GAP 4.13.0)
f = GAP.Globals.GroupHomomorphismByImages(G.X, GAP.Globals.FreeGroup(0), GAP.Obj([]), GAP.Obj([]))
GAP.Globals.SetIsBijective(f, true)
else
f = GAPWrap.IsomorphismFpGroupByGenerators(G.X, Ggens)
end
else
f = GAPWrap.IsomorphismFpGroup(G.X)
end
Expand Down
2 changes: 2 additions & 0 deletions test/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ end
@test [preimage(f2, x) for x in gens(codomain(f2))] == gens(G)
@test [preimage(f, x) for x in gens(codomain(f))] != gens(G)

@test is_bijective(isomorphism(FPGroup, symmetric_group(1), on_gens = true))

G = abelian_group(PermGroup, [2, 2])
f = @inferred isomorphism(FinGenAbGroup, G)
@test codomain(f) isa FinGenAbGroup
Expand Down

0 comments on commit 0012b96

Please sign in to comment.