[GAP Forum] Is it possible to step through the program, like GNU GDB debugger, against built-in functions(ex. DerivedSubgroup, ClosureSubgroupNC )?
Alexander Konovalov
alexk at mcs.st-andrews.ac.uk
Wed Sep 17 12:19:35 BST 2014
On 16 Sep 2014, at 22:52, buynnnmmm1 at yahoo.co.jp wrote:
> Dear GAP forum,
>
> Is it possible to set break points against built-in functions (ex. DerivedSubgroup)?
>
> Is it possible to step through the program, like GNU GDB debugger, against built-in functions(ex. DerivedSubgroup, ClosureSubgroupNC )?
>
> Because I am a beginner the group theory , I would to examine in detail what functions are doing in what procedure .
>
> I check http://www.gap-system.org/Manuals/doc/ref/chap7.html, but I cannot find the function that set break points or step through the function.
No, there is no such functionality, but there are workarounds and alternatives.
First, you can add the line like
Error("Break point some text which you want to display...");
in the code, and then you will be able to investigate local variables from the break loop - see http://www.gap-system.org/Manuals/doc/ref/chap6.html
Second, you already know from your previous post how to find the code of the function. Since GAP is an interpreted language, you may try to paste the code of the function into your session line by line and see what happens.
Finally, YMMV (your mileage may vary): looking at the method below for IsSolvableGroup itself will likely not give an insight into the solvability of groups, it will just point to some other procedure:
> gap> g := SymmetricGroup(5);
> Sym( [ 1 .. 5 ] )
> gap> ApplicableMethod(IsSolvableGroup,[g]);
> function( G ) ... end
> gap> f := last;
> function( G ) ... end
> gap> Print(f);
> function ( G )
> local pcgs;
> pcgs := TryPcgsPermGroup( G, false, false, true );
> if IsPcgs( pcgs ) then
> SetIndicesEANormalSteps( pcgs, pcgs!.permpcgsNormalSteps );
> SetIsPcgsElementaryAbelianSeries( pcgs, true );
> if not HasPcgs( G ) then
> SetPcgs( G, pcgs );
> fi;
> if not HasPcgsElementaryAbelianSeries( G ) then
> SetPcgsElementaryAbelianSeries( G, pcgs );
> fi;
> return true;
> else
> return false;
> fi;
> return;
> end
What is does is that it calls TryPcgsPermGroup and then checks if it returns the object which is IsPcgs (polycyclic generating system, see http://www.gap-system.org/Manuals/doc/ref/chap45.html). If that calculation is not successful, the group is not solvable, otherwise it is. Now you may be interested to find the (undocumented!) function TryPcgsPermGroup which does the actual job, see for any comments in the code, etc.
Best wishes
Alexander
More information about the Forum
mailing list