Skip to content

docs: document the integer encoding used by CodePcGroup and PcGroupCode#6441

Merged
fingolfin merged 4 commits into
gap-system:masterfrom
mvanhorn:fix/6419-2026-06-12-1011-docs-document-pcgroupcode-encoding
Jul 1, 2026
Merged

docs: document the integer encoding used by CodePcGroup and PcGroupCode#6441
fingolfin merged 4 commits into
gap-system:masterfrom
mvanhorn:fix/6419-2026-06-12-1011-docs-document-pcgroupcode-encoding

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

The reference manual now specifies the integer encoding behind CodePcgs / CodePcGroup / PcGroupCode, which #6419 (from @fingolfin) asked for: the best existing reference is half a page in Besche-Eick "Construction of finite groups", which leaves key details underspecified, including the canonically ordered element list used for tail encoding. The expanded GAPDoc blocks in lib/randiso.gd cover how relative orders are packed, how the right-hand sides of power and commutator relations are enumerated against the canonically ordered element list, and how the pieces combine into one integer, with a worked round-trip example and an interoperability note naming Magma's SmallGroupEncoding/SmallGroupDecoding and the OSCAR counterparts.

Fixes #6419

Text for release notes

The integer encoding used by CodePcgs, CodePcGroup and PcGroupCode is now fully documented in the reference manual, including a round-trip example and pointers to the Magma and OSCAR counterparts.

Further details

The specification prose was derived from the implementation in lib/randiso.gi, not from the paper. The new <Example> blocks follow the manual conventions so the example extraction test verifies them against actual GAP output.

@ThomasBreuer

Copy link
Copy Markdown
Contributor

I suggest to add a citation of the abovementioned paper.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.88%. Comparing base (83eab88) to head (184326c).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6441      +/-   ##
==========================================
- Coverage   78.89%   78.88%   -0.01%     
==========================================
  Files         685      685              
  Lines      293520   293520              
  Branches     8667     8667              
==========================================
- Hits       231558   231553       -5     
+ Misses      60162    60157       -5     
- Partials     1800     1810      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Added a citation to Besche-Eick, "Construction of finite groups" (<Cite Key="BescheEick98"/>) in the CodePcgs description where the integer encoding is introduced, since that is the existing published reference for it. Pushed in 184326c.

@ThomasBreuer ThomasBreuer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the fact that the relative orders must be prime integers should be mentioned, see the comment.

Comment thread lib/randiso.gd
## <P/>
## More precisely, let
## <M>g_1,\ldots,g_l</M> be the entries of <A>pcgs</A>, and let
## <M>r_1,\ldots,r_l</M> be their relative orders. If <M>l=0</M>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In [BescheEick98], it is assumed that the relative orders of the pcgs are prime integers.
Not every pcgs in GAP has this property, there is a GAP function IsPrimeOrdersPcgs for checking it.

If one admits non-prime relative orders then one cannot read off the relative orders from the order of a given p-group. Thus this assumption should be mentioned in the documentation. Perhaps CodePcgs should check the relative orders, and signal an error if not all of them are prime integers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding that check would certainly be a good idea (but of course this goes beyond the scope of this PR, i.e., is not a blocker).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Such a check has now been added by Thomas in PR #6451

Comment thread lib/randiso.gd
## More precisely, let
## <M>g_1,\ldots,g_l</M> be the entries of <A>pcgs</A>, and let
## <M>r_1,\ldots,r_l</M> be their relative orders. If <M>l=0</M>,
## the code is <M>0</M>. Otherwise put

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In fact, the code is 0 for any elementary abelian p-group.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ThomasBreuer By the way, is there a reason why the group order is not encoded in this code as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not know why the code was defined like this.
One reason to leave out the group order could be that whenever one stores many groups of the same order (which is not unlikely for p-groups), including the group order in each code would be redundant.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, that seems like a good reason.

@fingolfin fingolfin added topic: documentation Issues and PRs related to documentation release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Jun 23, 2026
Comment thread lib/randiso.gd Outdated
Comment thread lib/randiso.gd Outdated

@ThomasBreuer ThomasBreuer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request provides the documentation asked for in #6419.
The two suggested improvements concerning IsPrimeOrdersPcgs and the formulation of the (lexicographic) order of group elements should be added, and then the pull request can be merged.
Thanks for this work.

Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Thomas Breuer <sam@math.rwth-aachen.de>

@fingolfin fingolfin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this @mvanhorn much appreciated.

@fingolfin fingolfin enabled auto-merge (squash) July 1, 2026 11:19
@fingolfin fingolfin disabled auto-merge July 1, 2026 11:19
@fingolfin fingolfin enabled auto-merge (squash) July 1, 2026 11:20
Comment thread lib/randiso.gd Outdated
@fingolfin fingolfin merged commit 433541e into gap-system:master Jul 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: documentation Issues and PRs related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document encoding of CodePcGroup and PcGroupCode

4 participants