> < ^ Date: Wed, 10 Nov 1999 08:05:27 +0000 (WET)
> < ^ From: Jan De Beule <jdebeule@cage.rug.ac.be >
< ^ Subject: Re: the function "Group()"

Dear Forum,

first of all thanks for the fast and accurate response.

Indeed, ther is a recursion in the method for PrintObj (and I didn't
notice). When you look at the code fot the creation of the "NewGroup", you
will notice that the new created objects are stored in a list. So when a
object is created with e.g. NewGroup(4,5) and you call again NewGroup(4,5)
then simply the same object should be returned without any calculation.
There are some reasons why I didn't notice the recursion. First of all,
it seems a bit strange that the funtion Group() needs the method for
PrintObj. This method is only mentioned for objects belonging to
the NewGroup, not for the NewGroup self. Second, this code comes from
other people who started develop a program under gap4b5. I should mention
that this code (with the recursion) works perfectly well in gap4b5. So I
only have this question unanswered namely why the function Group() needs
the method for PrintObj and why the function GroupWithGenerators don't.


Jan De Beule

On Fri, 5 Nov 1999, Alexander Hulpke wrote:

Dear Gap-Forum,

Jan de Beule wrote:
> There seems to be a problem with the function Group();
> I have attached a file named "testgroup". You should use this in gap with
> Read("testgroup").

What happens is not a bug in GAP but an error in the `PrintObj' method for
your new objects:

When creating groups, GAP tests the property
`IsGeneratorsOfMagmaWithInverses' for the argument. (This is to stop the
creation of groups, if the generators are non-invertible elements.)

The default method for `IsGeneratorsOfMagmaWithInverses' now checks, whether
`Inverse' is computable. This alone does not prove for example that the
multiplication is associative, and therefore this method prints a warning:
#I default `IsGeneratorsOfMagmaWithInverses' method returns `true' for
followed by the respective generators. (You can turn this and other warnings
off by setting SetInfoLevel(InfoWarning,0); )

Your Print method however calls `NewGroup' again (why it does this, I don't
understand). This leads to an infinite recursion and the error you observed.
(Normally such infinite recursions are trapped by GAP, but because `Print'
interfaces through the kernel, this last safety feature does not apply here.

If you change this `PrintObj' method (or provide a private method for
`IsGeneratorsOfMagmaWithInverses' which will not issue a warning), your
example works without problems.

InstallMethod( PrintObj,
    "for new object",
    [ IsNewObject and IsNewObjectRep ],
    function( x )
    local H, G;
H:= FamilyObj( x );
# this line is the problem:
>     G:= NewGroup( H!.n, H!.q );
Print( "NewObject( ", G,", ", x![1],", ", x![2], " )" );
end );

Best regards,

Alexander Hulpke

> < [top]