Skip to content

Commit

Permalink
avoid an attribute value after leaving a break loop
Browse files Browse the repository at this point in the history
When one creates a f.p. group and triggers an element comparison
then it may happen that GAP does not return.
Hit CTRL-C, then GAP enters a break loop,
and when one leaves it with `quit` then it is currently too late
for triggering the computation of an `IsomorphismPermGroup` or so
that will control the behaviour of the group.

Here is an example that shows the situation in GAP 4.12.
The master branch version is already too clever for this particular group,
currently I have no test example that demonstrate the changes there.

```
f:= FreeGroup(3);;
AssignGeneratorVariables( f );;
rels:= [f3^6, f2^3, (f1^-1*f2^-1*f1*f2^-1)^2,
f2*f1^-1*f2^-1*f1^2*f2*f1^3*f2^-1*f1^-2*f2*f1^-1,
f1*(f1^2*f2^-1)^2*f1^-2*f2^-1*f1*f2*f1^-3*f2^-1,
f2*(f1^-1*f2*f1^-1)^2*f2*f1^2*f2^-1*f1^-4*f2^-1*f1^2,
f1*f2*f1^-1*f2^-1*(f1^-1*f2)^2*f1^-1*(f1^-1*f2^-1)^2*f1^4*f2*f1^2,
(f2*f1*f2^-1*f1^-2*f2^-1*f1)^3,
f1^4*f2*(f1^-1*f2^-1)^2*(f1^-1*f2)^2*f1^-2*f2*f1*f2^-1*f1^-1*f2*f1^-3*f2^-1*f1,
f2*f1*f2*f1^-2*f2^-1*f1*f2*f1^-1*f2^-1*f1^3*f2*f1^-2*f2*f1^-1*f2^-1*f1^2*f2^-1*(f1*f2)^2*f1^-1*(f2^-1*f1)^2,
f3*f1*f3^-1*f1^-1,
f3*f2*f3^-1*f2^-1];;
Q:= f / rels;;
Order(Q);
Order(Q.3);  # hangs in GAP 4.12, hit CTRL-C, enter quit;
IsomorphismPermGroup(Q);;   # the value will not be used automatically later on
Order(Q.3);  # hangs again
```

Does it make sense at all to try to avoid this kind of "object corruption"
after leaving a break loop?
  • Loading branch information
ThomasBreuer authored and ChrisJefferson committed Oct 22, 2024
1 parent 93f800f commit 1817615
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,20 @@ BindGlobal( "MakeFpGroupCompMethod", function(CMP)
com:=x->Image(hom,x);
# if neither is known, try a faithful representation (forcing its
# computation)
elif FPFaithHom(fam)<>fail then
hom:=FPFaithHom(fam);
com:=x->Image(hom,x);
#T Here one could try more elaborate things first
# otherwise force computation of a normal form.
else
f:=FpElementNFFunction(fam);
com:=x->f(UnderlyingElement(x));
hom:= AttributeValueNotSet( FPFaithHom, fam );
if hom <> fail then
SetFPFaithHom( fam, hom );
com:=x->Image(hom,x);
#T Here one could try more elaborate things first
# otherwise force computation of a normal form.
else
f:=FpElementNFFunction(fam : CallFromMakeFpGroupCompMethod:= true);
com:=x->f(UnderlyingElement(x));
# Set the attribute value only *after* we are sure
# that the user has not interrupted the 'FpElementNFFunction' call.
SetFPFaithHom(fam, fail);
fi;
fi;
SetCanEasilyCompareElements(fam,true);
SetCanEasilySortElements(fam,true);
Expand Down Expand Up @@ -5203,7 +5209,8 @@ InstallMethod(FpElementNFFunction,true,[IsElementOfFpGroupFamily],0,
function(fam)
local iso,k,id,f,ran,g;
g:=CollectionsFamily(fam)!.wholeGroup;
if not (HasIsomorphismFpMonoid(g) and
if ValueOption( "CallFromMakeFpGroupCompMethod" ) <> true and
not (HasIsomorphismFpMonoid(g) and
HasReducedConfluentRewritingSystem(Image(IsomorphismFpMonoid(g)))) then
# first try whether the group is ``small''
iso:=FPFaithHom(fam);
Expand Down

0 comments on commit 1817615

Please sign in to comment.