Skip to content

Conversation

@varuntrehan7
Copy link
Contributor

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

@varuntrehan7
Copy link
Contributor Author

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.

@varuntrehan7 varuntrehan7 marked this pull request as ready for review October 17, 2025 09:43
@varuntrehan7 varuntrehan7 marked this pull request as draft October 17, 2025 09:43
@fingolfin
Copy link
Member

the new changes that I made are probably too clunky and overloaded

Could you clarify what you mean by that?

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)
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.)

@varuntrehan7
Copy link
Contributor Author

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.

@lgoettgens
Copy link
Member

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.

@lgoettgens
Copy link
Member

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 pcgroup or PcGroup, for the other direction I suggest code.

@varuntrehan7 please do not attempt to do any renamings here, until we have resolved the naming discussion!

@lgoettgens
Copy link
Member

In your latest commit, you again contradict with yourself. The docstring change there is not reflected in the code!

@varuntrehan7
Copy link
Contributor Author

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

@lgoettgens
Copy link
Member

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 GapInt, but in the code the input is converted to Int...

@varuntrehan7
Copy link
Contributor Author

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 GapInt, but in the code the input is converted to Int...

does this work?

@lgoettgens
Copy link
Member

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 GapInt, but in the code the input is converted to Int...

does this work?

No. If you input eg ZZ(2)^65, you will get an overflow when converting to the Int and don't even reach the GapInt conversion

@varuntrehan7
Copy link
Contributor Author

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 GapInt, but in the code the input is converted to Int...

does this work?

No. If you input eg ZZ(2)^65, you will get an overflow when converting to the Int and don't even reach the GapInt conversion

In this new commit I have tested conversions from ZZRingElem, BigInt, and Int all successfully reaching GapInt with no overflow.

@fingolfin
Copy link
Member

encode / encoding for mapping a PcGroup to a code (I don't like encoding_pcgroup or pcgroup_encoding because the input type already indicates this)

@ThomasBreuer points out that that in the future this function could support arbitrary finite solvable groups / "pcgs" -- then it could be encode_solvable_group or encode_pcgs ("pcgs" - "pc-group generating system"). Or maybe encode_presentation ?

Perhaps this is a discussion we can have in the future, and for now we just do encode ?

For the reverse, we can just have pc_group(order, code) (yes, with that order of arguments -- because that matches what small_group, transitive_group, primitive_group etc. all do -- of course that case is a bit different, but I feel that's what I'd guess).

```
"""
function pcgroup_code(code::IntegerUnion, order::IntegerUnion)
return PcGroup(GAP.Globals.PcGroupCode(GAP.GapInt(BigInt(code)),GAP.GapInt(BigInt(order))))
Copy link
Member

@fingolfin fingolfin Nov 5, 2025

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)

Copy link
Member

@lgoettgens lgoettgens Nov 5, 2025

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

Suggested change
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

GAP = "0.16.0"
to "0.16.1"

Copy link
Member

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.

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`.
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
Both `order` and `code` can be of type `Int`, `BigInt`, or `ZZRingElem`.

@fingolfin fingolfin added the enhancement New feature or request label Nov 5, 2025
@fingolfin fingolfin changed the title Add Oscar wrappers for GAP's CodePcGroup and PcGroupCode Add encode and pc_group for encoding finite pc groups into integers and back Nov 5, 2025
@lgoettgens
Copy link
Member

@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.

@varuntrehan7 varuntrehan7 marked this pull request as ready for review November 7, 2025 04:18
Copy link
Member

@ThomasBreuer ThomasBreuer left a 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".

@fingolfin
Copy link
Member

@varuntrehan7 this still needs to be hooked up in the .md files. Please ask questions if you have trouble with that.

@fingolfin fingolfin added the release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: groups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants