-
Notifications
You must be signed in to change notification settings - Fork 162
Add encode and pc_group for encoding finite pc groups into integers and back
#5456
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
base: master
Are you sure you want to change the base?
Add encode and pc_group for encoding finite pc groups into integers and back
#5456
Conversation
|
the new changes that I made are probably too clunky and overloaded, please let me know if they're right if not what's the correct approach. |
Could you clarify what you mean by that? |
test/Groups/pcgroup.jl
Outdated
| H = isa(code, Int) ? pcgroup_code(code, G) : pcgroup_code(code) | ||
|
|
||
| # Test that the original and reconstructed groups are isomorphic | ||
| @test is_isomorphic(G, H) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the return value H of pcgroup_code only guaranteed to be isomorphic with the group G from which the code was computed, or is H in fact guaranteed to have the same polycyclic presentation as G?
In the latter case, we could check that hom(G, H, gens(H)) does not throw an error, which is both stronger and cheaper.
If we document this stronger property then this property can be mentioned as a reason why code_pcgroup is not defined for groups of type SubPcGroup: The generators list of a SubPcGroup is in general not a polycyclic generating sequence, and GAP's CodePcGroup is defined w.r.t. such a sequence for its input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the same polycyclic presentation -- so, good point! well, we also should then add order(G) == order(H) to make sure we don't get a proper quotient.
And also good point about SubPcGroup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although.. GAP does support this on subgroups of pc groups, it delegates to CodePcgs( Pcgs( G ) ) -- so from that vantage point, it would be good to also support it. The hom test would still work though, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification, I'll update my tests according to all the suggestions made. I will also document the restricted support for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general not.
julia> g = small_group(24, 12);
julia> s, _ = pcore(g, 2)
(Sub-pc group of order 4, Hom: s -> g)
julia> gens(s)
3-element Vector{SubPcGroupElem}:
f3
f4
f3*f4
julia> GAP.Globals.Pcgs(GapObj(s))
GAP: Pcgs([ f3, f4 ])
The code for s will be computed w.r.t. the pcgs of s, and the PcGroup created from the code will have a pcgs as its gens value.
Then hom will be asked to map the 3-element gens(s) to the 2-element gens value of the new group.
I think supporting code_pcgroup for SubPcGroups would be asking for trouble.
It is safer to request explicitly switching from a given SubPcGroup to a PcGroup before creating the code, because this is then the group whose presentation will correspond to that of the group created from the code.
(The GAP documentation of CodePcGroup and PcGroupCode should also be made more precise.)
|
hi, sorry if I don't respond for a day. I have a flight in an hour, I see a lot of tests are failing, I will get to them immediately as soon as I land in Germany tomorrow. Apologies for the delay. |
|
This PR has a lot of open comments. @varuntrehan7 please have a look at all of them again, and if you think that you did that change in a commit, click on "resolve conversation". That way we (and in particular you) can more easily see which comments you missed. |
|
Meta-question to @fingolfin and @ThomasBreuer: I don't quite like the names of the two new functions; they don't seem to fit in the OSCAR naming scheme. To me, a more appropriate name for the direction "(code, order) -> group" would be @varuntrehan7 please do not attempt to do any renamings here, until we have resolved the naming discussion! |
|
In your latest commit, you again contradict with yourself. The docstring change there is not reflected in the code! |
Apologies for the late response. I think I was able to fix the mistake I was making, please let me know if this was what you were referring to |
No, you didn't fix it. The docstring claims that the input is converted to |
does this work? |
No. If you input eg |
In this new commit I have tested conversions from ZZRingElem, BigInt, and Int all successfully reaching GapInt with no overflow. |
|
@ThomasBreuer points out that that in the future this function could support arbitrary finite solvable groups / "pcgs" -- then it could be Perhaps this is a discussion we can have in the future, and for now we just do For the reverse, we can just have |
src/Groups/pcgroup.jl
Outdated
| ``` | ||
| """ | ||
| function pcgroup_code(code::IntegerUnion, order::IntegerUnion) | ||
| return PcGroup(GAP.Globals.PcGroupCode(GAP.GapInt(BigInt(code)),GAP.GapInt(BigInt(order)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @lgoettgens pointed out this is inefficient. We will add a GAP.GapInt constructor in GAP.jl so that one can directly write GAP.GapInt(code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See oscar-system/GAP.jl#1283. Once that and oscar-system/GAP.jl#1284 are merged (and further 20 minutes have passed), this line can be changed to
| return PcGroup(GAP.Globals.PcGroupCode(GAP.GapInt(BigInt(code)),GAP.GapInt(BigInt(order)))) | |
| return PcGroup(GAP.Globals.PcGroupCode(GapInt(code), GapInt(order))) |
At the same time, please change
Line 38 in c0fadd1
| GAP = "0.16.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GAP.jl 0.16.1 is out now, so this can be done.
src/Groups/pcgroup.jl
Outdated
| pc_group(order::IntegerUnion, code::IntegerUnion) | ||
| Given an integer `order` and an integer `code`, return the polycyclic group it encodes. | ||
| Both `order` and `code` can be of type `Int`, `BigInt`, or `ZZRingElem`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Both `order` and `code` can be of type `Int`, `BigInt`, or `ZZRingElem`. |
encode and pc_group for encoding finite pc groups into integers and back
|
@varuntrehan7 If you think that this is finished and CI passes (apart from any "nightly" and the "Enforce PR labels" jobs), please mark this PR as "ready to review" to get a final round of reviews. |
ThomasBreuer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encode and decode should eventually appear in the manual, for example in the section "Functions for (subgroups of) pc groups".
|
@varuntrehan7 this still needs to be hooked up in the |
I've added functions to wrap CodePcGroup and PcGroupCode and the doctoring,testsets with respect to it. let me know for any corrections, also unsure where I need to import so for the time being they're inside my testset