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

Conversation

jamesnohilly
Copy link
Contributor

@jamesnohilly jamesnohilly commented Oct 14, 2024

As a starting point for this PR, I've borrowed the syllable functions for PcGroup from PR #4108 to use as a reference for planned work.

Planned work for this PR:

  • New function letters for (Sub)PcGroupElem.
  • A check in _exponent_vector for whether the input is really "canonical".
  • Test cases in test/Groups/pcgroups.jl for the new functions.
  • Add doc strings for new functions.

Suggestions from @fingolfin

Moved from the mjrodgers-OW_GModules branch.
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.52%. Comparing base (e8f8ecc) to head (c07db31).
Report is 27 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #4202    +/-   ##
========================================
  Coverage   84.52%   84.52%            
========================================
  Files         646      645     -1     
  Lines       85631    85743   +112     
========================================
+ Hits        72382    72477    +95     
- Misses      13249    13266    +17     
Files with missing lines Coverage Δ
src/GAP/wrappers.jl 95.06% <100.00%> (+0.04%) ⬆️
src/Groups/pcgroup.jl 81.25% <100.00%> (+3.89%) ⬆️

... and 28 files with indirect coverage changes

@fingolfin
Copy link
Member

Thanks @jamesnohilly to clarify: what you posted in the description is not (yet) what you did, but a description of the work programme, right? Also, should mention that the code here was taken from PR #4108 by @fieker and is only the starting point.

@jamesnohilly
Copy link
Contributor Author

Yes, that's correct! I've now updated the description to make it clearer and also included a note that the code originates from PR #4108 as the starting point.

Copy link
Member

@lgoettgens lgoettgens left a comment

Choose a reason for hiding this comment

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

some comments. Maybe more directed towards @fingolfin and @ThomasBreuer instead of @jamesnohilly

src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Show resolved Hide resolved
test/Groups/pcgroup.jl Outdated Show resolved Hide resolved
@fingolfin
Copy link
Member

@jamesnohilly tests are still failing. are on onto that, or do you need assistance?

@jamesnohilly jamesnohilly marked this pull request as ready for review October 31, 2024 12:09
test/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
julia> gg = pc_group(c)
Pc group of order 6

julia> syllables(gg[1]^5*gg[2]^-4)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
julia> syllables(gg[1]^5*gg[2]^-4)
julia> x = gg[1]^5*gg[2]^-4
f1*f2^2
julia> syllables(x)

src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved

# Convert syllables in canonical form into group element
#Thomas
function (G::PcGroup)(sylls::Vector{Pair{Int64, ZZRingElem}}; check::Bool=true)
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a similar constructor which takes an exponent vector, i.e., an inverse to letters?

Copy link
Member

Choose a reason for hiding this comment

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

One needs to watch out for the semantic difference to the already existing function for FPGroups in

function (G::FPGroup)(extrep::AbstractVector{T}) where T <: IntegerUnion
, which expects a flattened list of syllable pairs instead.

Copy link
Member

Choose a reason for hiding this comment

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

ugh, OK. perhaps we should kill that (is it documented?) first then. In GAP it made some sense to use such a flat list to avoid memory, as there are no tuples in GAP, only lists. But in Julia there is no real benefit of this over a Vector{Pair{Int64, ZZRingElem}}.

But that is way beyond this PR. So let's leave out the constructor I mentioned.

Copy link
Member

Choose a reason for hiding this comment

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

No, not documented, but used for serialization. I haven't looked into how it is used there, so maybe we can just adapt the deserialization function, in the worst case it needs an upgrade script.

Copy link
Member

Choose a reason for hiding this comment

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

ugh, OK. perhaps we should kill that (is it documented?) first then.

maybe @ThomasBreuer can look into that?

letters(g::Union{PcGroupElem, SubPcGroupElem})

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

src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
@lgoettgens
Copy link
Member

This PR now unfortunately has conflicts with #4157.

@fingolfin
Copy link
Member

@jamesnohilly please try to resolve the conflicts. If you run into troubles (this is something that causes pain to many people esp. at the beginning) drop by my office and we'll figure it out together (ideally with your laptop if you have one)

@jamesnohilly
Copy link
Contributor Author

I've now merged the changes from #4157 with the changes made in this PR. From a quick look it seems to have merged without any major issues.

src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
src/Groups/pcgroup.jl Outdated Show resolved Hide resolved
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks good to me now!

@fingolfin fingolfin merged commit 39afcf9 into oscar-system:master Nov 27, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants