Skip to content

Fix SimpleGroupsIterator for start values just below 10^18 - #6512

Merged
fingolfin merged 3 commits into
masterfrom
mh/fix-simplegroupsiterator-second-table
Aug 16, 2026
Merged

Fix SimpleGroupsIterator for start values just below 10^18#6512
fingolfin merged 3 commits into
masterfrom
mh/fix-simplegroupsiterator-second-table

Conversation

@fingolfin

Copy link
Copy Markdown
Member

The orders of the non-PSL(2,q) simple groups come in two lists, the second loaded on demand. The iterator asked for it once start reached 10^18, but the first list ends already at 911215823217986880, so for a start value between the two nothing was loaded, the search for the first relevant entry returned fail, and building the iterator broke on indexing the list with it.

Load the second list when the search comes up empty instead, which is what NextIterator_SimGp already does, and report an order beyond the documented range rather than indexing with fail -- that case failed the same way above the second list.

Assistance from Claude Code (Claude Opus 5): diagnosis from a stack trace, the fix, and the regression test.

The orders of the non-PSL(2,q) simple groups come in two lists,
the second loaded on demand. The iterator asked for it once
`start` reached 10^18, but the first list ends already at
911215823217986880, so for a start value between the two nothing
was loaded, the search for the first relevant entry returned
`fail`, and building the iterator broke on indexing the list with
it.

Load the second list when the search comes up empty instead, which
is what `NextIterator_SimGp` already does, and report an order
beyond the documented range rather than indexing with `fail` --
that case failed the same way above the second list.

Assistance from Claude Code (Claude Opus 5): diagnosis from a
stack trace, the fix, and the regression test.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Aug 15, 2026
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.94%. Comparing base (8636b5a) to head (9959481).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6512      +/-   ##
==========================================
+ Coverage   78.91%   78.94%   +0.02%     
==========================================
  Files         685      685              
  Lines      294164   294222      +58     
  Branches     8669     8669              
==========================================
+ Hits       232151   232266     +115     
+ Misses      60210    60153      -57     
  Partials     1803     1803              

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

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

Nice.
Once we are at it, the documentation can can be fixed as well.

Comment thread grp/simple.gi Outdated
pos:=PositionProperty(SIMPLEGPSNONL2,x->x[1]>=start);
if pos=fail then
Error("List of simple groups only available up to order ",
SIMPLE_GROUPS_ITERATOR_RANGE);

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.

The effect is that already the SimpleGroupsIterator( start ) call errors with a useful message if start is too large, which is good. (This can be even tested cheaply now.)

The documentation of SimpleGroupsIterator

This function returns an iterator that will run over all nonabelian simple groups, starting at order start if specified, up to order 10^27 (or -- if specified -- order end).

is not correct if end is larger than 10^27.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread grp/simple.gi Outdated
if start>=10^18 then LOADSIMPLE2(); fi;
pos:=First([1..Length(SIMPLEGPSNONL2)],x->SIMPLEGPSNONL2[x][1]>=start);
# Running off the end of the first list is what says the second one is
# needed. Testing `start' against a fixed bound instead left a window between

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 comment describes the current change.
As a comment in the code, it might be irritating.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

indeed. I've rewritten the comments

fingolfin and others added 2 commits August 16, 2026 13:34
Say what the code does rather than what changed about it.

Look the order up before searching for the PSL(2,q) order to start from, so
that one beyond the range is rejected at once instead of after a search that
takes minutes -- which is what makes it cheap to test. Shorten the message
accordingly: with the 28-digit bound the old one wrapped, and matching that
in a test needs a trailing space, which `Test` does not normalise away. The
wording now matches what `lib/grp.gi` says for the same condition.

The documentation claimed the iteration runs up to 10^27 or to `end`, which
was wrong for an `end` beyond 10^27.

Assistance from Claude Code (Claude Opus 5).

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@fingolfin
fingolfin enabled auto-merge (squash) August 16, 2026 12:20
@fingolfin
fingolfin merged commit 6e71f21 into master Aug 16, 2026
33 checks passed
@fingolfin
fingolfin deleted the mh/fix-simplegroupsiterator-second-table branch August 16, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants