Skip to content

better IsAlmostSimple support in AllPrimitiveGroups - #79

Open
ThomasBreuer wants to merge 4 commits into
gap-packages:masterfrom
ThomasBreuer:TB_IsAlmostSimple
Open

better IsAlmostSimple support in AllPrimitiveGroups#79
ThomasBreuer wants to merge 4 commits into
gap-packages:masterfrom
ThomasBreuer:TB_IsAlmostSimple

Conversation

@ThomasBreuer

Copy link
Copy Markdown

Up to now, the groups had to be constructed and were checked. Now we use that IsAlmostSimple is determined by ONanScottType.

The IsAlmostSimpleGroup flag is now set in the groups returned by PrimitiveGroup.

(The primgrp package does not say which functions have special support in AllPrimitiveGroups, but is_almost_simple is listed in the Oscar documentation.)

Up to now, the groups had to be constructed and were checked.
Now we use that `IsAlmostSimple` is determined by `ONanScottType`.

The `IsAlmostSimpleGroup` flag is now set in the groups returned by
`PrimitiveGroup`.

(The primgrp package does not say which functions have special support,
but `is_almost_simple` is listed in the Oscar documentation.)
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.13%. Comparing base (dbae2c0) to head (ee7d23d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
lib/primitiv.gi 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
+ Coverage   99.11%   99.13%   +0.02%     
==========================================
  Files          46       46              
  Lines       38324    38327       +3     
==========================================
+ Hits        37984    37995      +11     
+ Misses        340      332       -8     
Files with missing lines Coverage Δ
lib/primitiv.gd 100.00% <ø> (ø)
lib/primitiv.gi 59.75% <40.00%> (+1.61%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

(These are only tests for my additions,
most features of `AllPrimitiveGroups` do not have tests.)
@fingolfin

Copy link
Copy Markdown
Member

Thanks @ThomasBreuer! I let Claude have a closer look, and it pointed out three issues:

  1. Documentation: lib/primitiv.gd:166-172 does list which properties come from the database. IsAlmostSimpleGroup should be added there.
  2. CHANGES.md should be updated with this
  3. "values" can also be lists, which this does not support
AllPrimitiveGroups(NrMovedPoints,12,IsAlmostSimple,[true])       ->  0  (want 6)
AllPrimitiveGroups(NrMovedPoints,12,IsAlmostSimple,[true,false]) ->  0  (want 6)
AllPrimitiveGroups(NrMovedPoints,12,IsSimple,[true,false])       ->  6  (correct)

Wrong answer, no error. STGSelFunc already dispatches on true/false/
function/list, so delegating to it fixes all cases and removes both the
four-way branch and the hand-maintained type blacklist:

elif a=IsAlmostSimpleGroup or a=IsAlmostSimple then
  # for primitive groups, almost simple means O'Nan-Scott type 2
  bfunc:= b;
  b:= val -> STGSelFunc(val = "2", bfunc);
  gut[i]:=Filtered(gut[i],j->STGSelFunc(PRIMGrp(i,j)[4],b));

@ThomasBreuer

Copy link
Copy Markdown
Author

Just for the record:
I do not agree with Claude's suggestion for 3.

Comment thread lib/primitiv.gi Outdated
Comment on lines +732 to +754
elif a=IsAlmostSimpleGroup or a=IsAlmostSimple then
# for primitive groups, almost simple means O'Nan-Scott type 2
if IsFunction(b) then
# does not really make sense but is allowed
gut[i]:=Filtered(gut[i],j->b(PRIMGrp(i,j)[4]="2"));
else
if IsBool(b) then
b:= [b];
fi;
if IsList(b) then
if true in b and false in b then
# nothing is to do
elif true in b then
gut[i]:=Filtered(gut[i],j->PRIMGrp(i,j)[4]="2");
elif false in b then
gut[i]:=Filtered(gut[i],j->PRIMGrp(i,j)[4]<>"2");
else
gut[i]:=[];
fi;
else
gut[i]:=[];
fi;
fi;

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.

You wrote "for the record" that you don't agree with Claude's suggestion for 3. It was indeed needlessly complicated, this version already does it, and is very similar to the code right above and below this case:

Suggested change
elif a=IsAlmostSimpleGroup or a=IsAlmostSimple then
# for primitive groups, almost simple means O'Nan-Scott type 2
if IsFunction(b) then
# does not really make sense but is allowed
gut[i]:=Filtered(gut[i],j->b(PRIMGrp(i,j)[4]="2"));
else
if IsBool(b) then
b:= [b];
fi;
if IsList(b) then
if true in b and false in b then
# nothing is to do
elif true in b then
gut[i]:=Filtered(gut[i],j->PRIMGrp(i,j)[4]="2");
elif false in b then
gut[i]:=Filtered(gut[i],j->PRIMGrp(i,j)[4]<>"2");
else
gut[i]:=[];
fi;
else
gut[i]:=[];
fi;
fi;
elif a=IsAlmostSimpleGroup or a=IsAlmostSimple then
# for primitive groups, almost simple means O'Nan-Scott type 2
gut[i]:=Filtered(gut[i],j->STGSelFunc(PRIMGrp(i,j)[4]="2",b));

So, also for the record: what are your concerns with that, if there are any?

My main reason for preferring the version with STGSelFunc is that by having these checks similar, it is much easier for me to trust that they behave consistently. So the code becomes easier to maintain.

But I am happy to be convinced otherwise, I just haven't heard the arguments yet :-)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

O.k., apologies to Claude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants