[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 22:19:55 BST 2014


On 17 Sep 2014, at 14:51, buynnnmmm1 at yahoo.co.jp wrote:

> Dear Alexander Konovalov,
> 
> Thank you very much for your help.
> 
>> Not really - the method for IsSolvable did not evolve from the code similar to 
>> myIsSolvable at all.
>> 
>> Perhaps the key is to read about GAP method selection and learn the concept of 
>> methods as bundles of functions:
>> 
>> http://www.gap-system.org/Manuals/doc/tut/chap8.html#X7AEED9AB824CD4DA
>> 
>> - that is, IsSolvable(G) will select the best available method to apply to G, 
>> taking into account what's known about G at the moment. With myIsSolvable, 
>> you enforce the calculation of DerivedSeries, while some of the methods may need 
>> not to know the derived series at all to give an answer. The profile below just 
>> illustrates this, since the number of methods involved in the calls to GAP's 
>> IsSolvable is much smaller.
> 
> IsSolvable in lib/grp.gi is the same as the method for determining whether or not solvable group I have learned .
> I'll try to understand that the method for determining whether or not solvable group I have learned is the same the built-in IsSolvable function.
> I think it will be the good study of group theory .
> I'll try to be able to understand "Operations and Methods of GAP" with the document, too.
> Thank you very much for your help.
> 
> With best regards
> buynnnmmm1

Note also that several lines above there is an immediate method which
expresses the famous Feit–Thompson theorem stating that any group of 
odd order is solvable:


InstallImmediateMethod( IsSolvableGroup, IsGroup and HasSize, 10,
    function( G )
    G:= Size( G );
    if IsInt( G ) and G mod 2 = 1 then
      return true;
    fi;
    TryNextMethod();
    end );


The method to which you refer is generic, as its description says - like a
fallback method that is deemed to work for any group:


InstallMethod( IsSolvableGroup,
    "generic method for groups",
    [ IsGroup ],
    function ( G )
    local   S;          # derived series of <G>

    # compute the derived series of <G>
    S := DerivedSeriesOfGroup( G );

    # the group is solvable if the derived series reaches the trivial group
    return IsTrivial( S[ Length( S ) ] );
    end );


You may trace how the method selection works adding the optional argument "full".
For example, for S(3) the method ``IsSolvableGroup: for permgrp'' will be used
quite early:

gap> ApplicableMethod(IsSolvableGroup,[SymmetricGroup(3)],"full");
#I  Searching Method for IsSolvableGroup with 1 arguments:
#I  Total: 11 entries
#I  Method 1: ``IsSolvableGroup: system getter'', value: 2*SUM_FLAGS+21
#I   - 1st argument needs [ "Tester(IsSolvableGroup)" ]
#I  Method 2: ``IsSolvableGroup: handled by nice monomorphism: Attribute'', value: 360
#I   - 1st argument needs [ "IsHandledByNiceMonomorphism", 
  "Tester(IsHandledByNiceMonomorphism)" ]
#I  Method 3: ``IsSolvableGroup: for permgrp'', value: 48
#I  Function Body:
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;
endfunction( G ) ... end
gap> 

To give an example of a group for which method selection descends to the 
fallback method, let's construct a dihedral group of order 16 as a finitely 
presented group:

gap> f:=FreeGroup("x","y");
<free group on the generators [ x, y ]>
gap> r:=ParseRelators(GeneratorsOfGroup(f),"x^8=y^2=1,yxy=x^-1");
[ x^8, y^2, (x^-1*y^-1)^2 ]
gap> G:=f/r;
<fp group on the generators [ x, y ]>

Now after some information about other available methods, 
the last one is precisely the generic method:

gap> ApplicableMethod(IsSolvableGroup,[G],"full");
#I  Searching Method for IsSolvableGroup with 1 arguments:
#I  Total: 11 entries
#I  Method 1: ``IsSolvableGroup: system getter'', value: 2*SUM_FLAGS+21
#I   - 1st argument needs [ "Tester(IsSolvableGroup)" ]
#I  Method 2: ``IsSolvableGroup: handled by nice monomorphism: Attribute'', value: 360
#I   - 1st argument needs [ "IsHandledByNiceMonomorphism", 
  "Tester(IsHandledByNiceMonomorphism)" ]
#I  Method 3: ``IsSolvableGroup: for permgrp'', value: 48
#I   - 1st argument needs [ "CategoryCollections(IsPerm)" ]
#I  Method 4: ``IsSolvableGroup: for AffineCrystGroup, via PointGroup'', value: 43
#I   - 1st argument needs [ "IsAffineCrystGroupOnLeftOrRight", 
  "Tester(IsAffineCrystGroupOnLeftOrRight)" ]
#I  Method 5: ``IsSolvableGroup: for rational matrix groups (Polenta)'', value: 40
#I   - 1st argument needs [ "IsRationalMatrixGroup", "Tester(IsRationalMatrixGroup)" ]
#I  Method 
6: ``IsSolvableGroup: for matrix groups over a finte field (Polenta)'', value: 38
#I   - 1st argument needs 
[ 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsNearAdditiveElementWithIn\
verse)))", 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsAdditiveElement)))", 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsMultiplicativeElement)))\
", "CategoryCollections(CategoryCollections(CategoryCollections(IsFFE)))" ]
#I  Method 7: ``IsSolvableGroup: fallback method to test conditions'', value: 38
#I   - 1st argument needs 
[ 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsNearAdditiveElementWithIn\
verse)))", 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsAdditiveElement)))", 
  "CategoryCollections(CategoryCollections(CategoryCollections(IsMultiplicativeElement)))\
", "CategoryCollections(CategoryCollections(CategoryCollections(IsCyclotomic)))" ]
#I  Method 8: ``IsSolvableGroup'', value: 27
#I   - 1st argument needs [ "Tester(Size)" ]
#I  Method 9: ``IsSolvableGroup: for direct products'', value: 26
#I   - 1st argument needs [ "Tester(DirectProductInfo)" ]
#I  Method 10: ``IsSolvableGroup: generic method for groups'', value: 25
#I  Function Body:
function ( G )
    local  S;
    S := DerivedSeriesOfGroup( G );
    return IsTrivial( S[Length( S )] );
endfunction( G ) ... end

However, if you create D_16 as permutation group, ApplicableMethod
will return the same ``IsSolvableGroup: for permgrp'' as for S(3) 
above:

gap> G:=Group([ (1,2,3,4,5,6,7,8), (2,8)(3,7)(4,6) ]);
Group([ (1,2,3,4,5,6,7,8), (2,8)(3,7)(4,6) ])
gap> ApplicableMethod(IsSolvableGroup,[G],"full");
...
#I  Method 3: ``IsSolvableGroup: for permgrp'', value: 48
#I  Function Body:
function ( G )
    local  pcgs;
    pcgs := TryPcgsPermGroup( G, false, false, true );

...

so as you may see, different methods may be used dependently on how the
group is represented. Hope that clarifies some more details!

Alexander





More information about the Forum mailing list