From 9b0e7579c5f0a17232ce2cbaf317fbe4f93124c8 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Tue, 20 Jan 2026 23:38:40 +0100 Subject: [PATCH 1/2] avoid errors due to too large range bounds --- lib/morpheus.gi | 14 +++++--- .../2026-01-20-IsomorphismSimpleGroups.tst | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst diff --git a/lib/morpheus.gi b/lib/morpheus.gi index 96449e1625..0e92772399 100644 --- a/lib/morpheus.gi +++ b/lib/morpheus.gi @@ -2627,7 +2627,13 @@ local d,iso,a,b,c,o,s,two,rt,r,z,e,y,re,m,gens,cnt,lim,p, a:=PseudoRandom(gp); fi; e:=Order(a); - if e in r then + # `r` is either a list or a record, + # the latter describing the range + # `[ r.first, r.first + r.offset .. r.last ]`, + # also if this range cannot be created in GAP. + if ( IsList( r ) and e in r ) or + ( IsRecord( r ) and r.first <= e and e <= r.last + and ( e - r.first ) mod r.offset = 0 ) then a:=a^QuoInt(e,o); if z=fail or Size(Centralizer(gp,a))=z then return a; @@ -2731,7 +2737,7 @@ local d,iso,a,b,c,o,s,two,rt,r,z,e,y,re,m,gens,cnt,lim,p, if gens=fail then Info(InfoMorph,1,"Isomorphism simple: ad-hoc"); # not found by table or other -- try a 2/something ad-hoc - rt:=[2,4..Size(g)]; + rt:= rec( first:= 2, offset:= 2, last:= Size(g) ); gens:=[findElm(g,2,fail,rt)]; z:=Size(Centralizer(g,gens[1])); @@ -2740,7 +2746,7 @@ local d,iso,a,b,c,o,s,two,rt,r,z,e,y,re,m,gens,cnt,lim,p, m:=Maximum(Filtered(Factors(Size(g)),x->x<100)); cnt:=0; repeat - gens[2]:=findElm(g,m,fail,[m,2*m..Size(g)]); + gens[2]:=findElm(g,m,fail, rec( first:= m, offset:= m, last:= Size(g) )); if isFull(SubgroupNC(g,gens)) then b:=gens; y:=Size(Centralizer(g,gens[2])); @@ -2765,7 +2771,7 @@ local d,iso,a,b,c,o,s,two,rt,r,z,e,y,re,m,gens,cnt,lim,p, od; gens:=b; e:=Order(gens[2]); - re:=[e,2*e..Size(g)]; + re:= rec( first:= e, offset:= e, last:= Size(g) ); y:=Size(Centralizer(g,gens[2])); fi; Info(InfoMorph,1,"generators ",List(gens,Order)); diff --git a/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst b/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst new file mode 100644 index 0000000000..b99a3db833 --- /dev/null +++ b/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst @@ -0,0 +1,32 @@ +# Fix #6200 IsomorphismSimpleGroups +#@local F, G, hom, gens, gens8, i, H, gens4, gens5, K, res; +gap> START_TEST("IsomorphismSimpleGroups.tst"); + +# +gap> F:= GF(2);; +gap> G:= GL(9, F);; +gap> hom:= IsomorphismPermGroup( G );; +gap> gens:= List( [ 1 .. 3 ], i -> IdentityMat( 9, F ) );; +gap> gens8:= GeneratorsOfGroup( SO(1, 8, 2) );; +gap> for i in [ 1 .. 3 ] do +> gens[i]{ [ 1 .. 8 ] }{ [ 1 .. 8 ] }:= gens8[i]; +> od; +gap> H:= Group( gens );; +gap> gens:= List( [ 1 .. 5 ], i -> IdentityMat( 9, F ) );; +gap> gens4:= GeneratorsOfGroup( GL(4, F) );; +gap> gens5:= GeneratorsOfGroup( GL(5, F) );; +gap> for i in [ 1, 2 ] do +> gens[i]{ [ 1 .. 4 ] }{ [ 1 .. 4 ] }:= gens4[i]; +> gens[i+2]{ [ 5 .. 9 ] }{ [ 5 .. 9 ] }:= gens5[i]; +> od; +gap> gens[5][5][1]:= One(F);; +gap> K:= Group( gens );; +gap> G:= Image( hom, G );; +gap> H:= Image( hom, H );; +gap> K:= Image( hom, K );; +gap> res:= DoubleCosetRepsAndSizes( G, H, K : cheap:= true );; +gap> Length( res ); +28 + +# +gap> STOP_TEST("IsomorphismSimpleGroups.tst"); From 978c0a66f967202d827fbf97a570c0a5a39f854d Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Wed, 21 Jan 2026 11:13:35 +0100 Subject: [PATCH 2/2] simplify the test and make sure that the runtime is short (this is of course cheating, without the "hint" for `GlobalMersenneTwister` the runtime will in general be much longer) --- .../2026-01-20-IsomorphismSimpleGroups.tst | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst b/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst index b99a3db833..0f317ce56f 100644 --- a/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst +++ b/tst/testbugfix/2026-01-20-IsomorphismSimpleGroups.tst @@ -1,32 +1,15 @@ # Fix #6200 IsomorphismSimpleGroups -#@local F, G, hom, gens, gens8, i, H, gens4, gens5, K, res; +#@local G, x, H gap> START_TEST("IsomorphismSimpleGroups.tst"); -# -gap> F:= GF(2);; -gap> G:= GL(9, F);; -gap> hom:= IsomorphismPermGroup( G );; -gap> gens:= List( [ 1 .. 3 ], i -> IdentityMat( 9, F ) );; -gap> gens8:= GeneratorsOfGroup( SO(1, 8, 2) );; -gap> for i in [ 1 .. 3 ] do -> gens[i]{ [ 1 .. 8 ] }{ [ 1 .. 8 ] }:= gens8[i]; -> od; -gap> H:= Group( gens );; -gap> gens:= List( [ 1 .. 5 ], i -> IdentityMat( 9, F ) );; -gap> gens4:= GeneratorsOfGroup( GL(4, F) );; -gap> gens5:= GeneratorsOfGroup( GL(5, F) );; -gap> for i in [ 1, 2 ] do -> gens[i]{ [ 1 .. 4 ] }{ [ 1 .. 4 ] }:= gens4[i]; -> gens[i+2]{ [ 5 .. 9 ] }{ [ 5 .. 9 ] }:= gens5[i]; -> od; -gap> gens[5][5][1]:= One(F);; -gap> K:= Group( gens );; -gap> G:= Image( hom, G );; -gap> H:= Image( hom, H );; -gap> K:= Image( hom, K );; -gap> res:= DoubleCosetRepsAndSizes( G, H, K : cheap:= true );; -gap> Length( res ); -28 +# The runtime depends very much on random choices in the code, +# it can vary from a few milliseconds (rare) to several minutes. +gap> Reset( GlobalMersenneTwister, 2^19 );; +gap> G:= AlternatingGroup( 20 );; +gap> x:= ();; +gap> H:= ConjugateGroup( G, x );; +gap> IsomorphismSimpleGroups( G, H : cheap:= true ) <> fail; +true # gap> STOP_TEST("IsomorphismSimpleGroups.tst");