Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add letters function for PcGroupElem #4202

Merged
merged 20 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,57 @@ function pc_group(c::GAP_Collector)
end
end

"""
letters(g::PcGroupElem)

Return the letters of `g` as a list of integers, each entry corresponding to
a group generator.
Copy link
Member

@fingolfin fingolfin Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we can also produce negative numbers: e.g. -3 means "inverse of 3rd generator". This should be explained, and perhaps an example added showing that. E.g. based on this:

julia> x = (gg[1]*gg[2]*gg[3])^-2
g1*g2^-2*g3^3

Perhaps also add something like this (and then mirror it in the other function)

See also [`syllables`](@ref).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a small example with some brief explanation to letters for this. However I am unsure if the example is good as I was not able to get elements with negative exponents and test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that you need an infinite group. E.g.

julia> g = dihedral_group(PosInf())
Pc group of infinite order

julia> g[1]^-3 * g[2]^-3
g1*g2^-3

or

julia> g = abelian_group(PcGroup, [5, 0])
Pc group of infinite order

julia> g[1]^-3 * g[2]^-3
g1^2*g2^-3


# Examples
```jldoctest
julia> c = collector(2, Int);

julia> Oscar.set_relative_orders!(c, [2, 3])

julia> Oscar.set_conjugate!(c, 2, 1, [2 => 2])

julia> gg = pc_group(c)
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
Pc group of order 6

julia> letters(gg[1]^5*gg[2]^-4)
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
3-element Vector{Int64}:
1
2
2
```
"""
function letters(g::PcGroupElem)
w = GAPWrap.UnderlyingElement(GapObj(g))
return Vector{Int}(GAPWrap.LetterRepAssocWord(w))
end

function Oscar.syllables(g::Union{PcGroupElem, SubPcGroupElem})
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
l = GAPWrap.ExtRepOfObj(GapObj(g))
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
@assert iseven(length(l))
return Pair{Int, ZZRingElem}[l[i-1] => l[i] for i = 2:2:length(l)]
end

# Convert syllables in canonical form into exponent vector
#Thomas
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
function exponent_vector(sylls::Vector{Pair{Int64, ZZRingElem}}, n)
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
res = zeros(ZZRingElem, n)
for pair in sylls
@assert res[pair.first] == 0 #just to make sure
res[pair.first] = pair.second
end
return res
end

# Convert syllables in canonical form into group element
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
#Thomas
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
function (G::PcGroup)(sylls::Vector{Pair{Int64, ZZRingElem}})
e = exponent_vector(sylls, ngens(G))
pcgs = Oscar.GAPWrap.FamilyPcgs(GapObj(G))
x = Oscar.GAPWrap.PcElementByExponentsNC(pcgs, GapObj(e, true))
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
return Oscar.group_element(G, x)
end
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions test/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,17 @@ end
@test GAP.Globals.IsMutable(cgg)
@test cgg !== c.X
end

@testset "generate letters from polycyclic group element" begin

# finite polycyclic groups
c = collector(2, Int);
set_relative_order!(c, 1, 2)
set_relative_order!(c, 2, 3)
set_power!(c, 1, [2 => 1])
gg = pc_group(c)
@test letters(gg[1]^5*gg[2]^-4) == [1, 2, 2]
@test letters(gg[1]^5*gg[2]^4) == [1, 2] # all positive exp
@test letters(gg[1]^-5*gg[2]^-7) == [1, 2, 2] # all negative exp
@test letters(gg[1]^2*gg[2]^3) == [] # both identity elements
end
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved