Skip to content

Commit

Permalink
Add hasgens(G::GAPGroup)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Mar 2, 2022
1 parent 248d61f commit 9f88359
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/src/Groups/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ one(x::GAPGroup)
one(x::GAPGroupElem)
isfiniteorder(x::GAPGroupElem)
gens(::GAPGroup)
hasgens(::GAPGroup)
ngens(G::GAPGroup)
gen(::GAPGroup, i::Int)
Base.rand(G::GAPGroup)
Expand Down
24 changes: 23 additions & 1 deletion src/Groups/GAPGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export
frattini_subgroup, hasfrattini_subgroup, setfrattini_subgroup,
gap_perm, # HACK
gen,
gens,
gens, hasgens,
hall_subgroup,
hall_subgroups_representatives,
hall_system, hashall_system, sethall_system,
Expand Down Expand Up @@ -368,6 +368,28 @@ function gens(G::GAPGroup)
return res
end

"""
hasgens(G::Group)
Return whether generators for the group `G` are known.
# Examples
```jldoctest
julia> F = free_group(2)
<free group on the generators [ f1, f2 ]>
julia> hasgens(F)
true
julia> H = derived_subgroup(F)[1]
Group(<free, no generators known>)
julia> hasgens(H)
false
```
"""
hasgens(G::GAPGroup) = GAP.Globals.HasGeneratorsOfGroup(G.X)::Bool

"""
gen(G::GAPGroup, i::Int)
Expand Down
1 change: 1 addition & 0 deletions src/imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import AbstractAlgebra:

import AbstractAlgebra.GroupsCore
import AbstractAlgebra.GroupsCore:
hasgens,
isfiniteorder,
istrivial

Expand Down

0 comments on commit 9f88359

Please sign in to comment.