Skip to content

Commit

Permalink
fix _as_subgroups (#4277)
Browse files Browse the repository at this point in the history
and extend tests accordingly,
and fix `==` for group homomorphisms
  • Loading branch information
ThomasBreuer authored Nov 6, 2024
1 parent 953ad23 commit 8bea0b6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Base.show(io::IO, x::GAPGroupHomomorphism)
end


function ==(f::GAPGroupHomomorphism{S,T}, g::GAPGroupHomomorphism{S,T}) where S where T
function ==(f::GAPGroupHomomorphism, g::GAPGroupHomomorphism)
return GapObj(f) == GapObj(g)
end

Expand Down
10 changes: 1 addition & 9 deletions src/Groups/sub.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,7 @@ end

# convert a GAP list of subgroups into a vector of Julia groups objects
function _as_subgroups(G::T, subs::GapObj) where T <: GAPGroup
res = Vector{T}(undef, length(subs))
for i = 1:length(res)
res[i] = _as_subgroup_bare(G, subs[i]::GapObj)
end
return res
end

function _as_subgroups(G::PcGroup, subs::GapObj)
res = Vector{SubPcGroup}(undef, length(subs))
res = Vector{sub_type(T)}(undef, length(subs))
for i = 1:length(res)
res[i] = _as_subgroup_bare(G, subs[i]::GapObj)
end
Expand Down
60 changes: 36 additions & 24 deletions test/Groups/subgroups_and_cosets.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
@testset "Subgroups" begin
G = symmetric_group(7)
x = cperm(G,[1,2,3,4,5,6,7])
y = cperm(G,[1,2,3])
z = cperm(G,[1,2])

H,f=sub(G,[x,y])
K,g=sub(x,y)
@test H isa PermGroup
@test H==alternating_group(7)
@test domain(f)==H
@test codomain(f)==G
@test [f(x) for x in gens(H)]==gens(H)
@test (H,f)==(K,g)
@test is_subset(K, G)
flag, emb = is_subgroup(K, G)
@test flag
@test g == emb
@test g == embedding(K, G)
@test K === domain(emb)
@test G === codomain(emb)
@test is_normal_subgroup(H, G)
H,f=sub(G,[x,z])
@test H==G
@test f==id_hom(G)
S = symmetric_group(7)
Sx = cperm(S, [1, 2, 3, 4, 5, 6, 7])
Sy = cperm(S, [1, 2, 3])
Sz = cperm(S, [1, 2])

for T in [PermGroup, FPGroup]
iso = isomorphism(T, S)
G = codomain(iso)
x = iso(Sx)
y = iso(Sy)
z = iso(Sz)

H, f = sub(G, [x, y])
K, g = sub(x, y)
@test H isa Oscar.sub_type(T)
@test domain(f) == H
@test codomain(f) == G
@test [f(x) for x in gens(H)] == gens(H)
@test (H, f) == (K, g)
@test is_subset(K, G)
flag, emb = is_subgroup(K, G)
@test flag
@test g == emb
@test g == embedding(K, G)
@test K === domain(emb)
@test G === codomain(emb)
@test is_normal_subgroup(H, G)
H, f = sub(G, [x, z])
@test H == G
@test f == id_hom(G)
end

G = symmetric_group(7)
x = cperm(G, [1, 2, 3, 4, 5, 6, 7])
y = cperm(G, [1, 2, 3])
H, f = sub(G, [x, y])
@test H == alternating_group(7)
@test !is_subset(symmetric_group(8), G)
@test_throws ArgumentError embedding(symmetric_group(8), G)

Expand Down

0 comments on commit 8bea0b6

Please sign in to comment.