gap-system

Need a help to call a code appropriately in GAP


I have the following input in GAP's environment:

enter image description here

I wanted to check whether a certain element of my Free group is in the group or not, so I used the code:

    > a in e;

and expected to get

    [ true

But it didn't work:

    [ false

But when I eliminated the long green [ in above pic on the right by hand, the answer got clear:

enter image description here

May I ask a help not to do it by hand? Thanks.

Edit: Here is the codes I did for a Free group for two generators. Look at the results at the end.

enter image description here


Solution

  • Indeed, GAP behaves correctly here: a is an element of f and not of w. If you want to access generators of the newly created finitely presented group, use GeneratorsOfGroup(w) to get their list.

    An example based on the original question, but also demonstrating how to use ParseRelators to simplify input:

    gap> f:=FreeGroup("a","b");
    <free group on the generators [ a, b ]>
    gap> w:=f/ParseRelators(f,"a^2,b^3,(ab)^4");
    <fp group on the generators [ a, b ]>
    gap> Size(w);
    24
    gap> e:=Elements(w);
    [ <identity ...>, a*b*a*b^-1*a*b, b, (a*b)^2, b*a*b^-1*a*b, a*b^-1*a*b*a, 
      b^-1*a*b^-1, a, b^-1, a*b^-1*a, a*b*a*b^-1, (a*b^-1)^2, a*b*a*b^-1*a, 
      b*a*b^-1, b^-1*a, b*a*b, b*a*b^-1*a, a*b^-1*a*b, b^-1*a*b*a, a*b^-1, b*a, 
      a*b, a*b*a, b^-1*a*b ]
    gap> gens:=GeneratorsOfGroup(w);
    [ a, b ]
    gap> a:=gens[1];
    a
    gap> a in e;
    true
    

    Now quite technical detail: indeed, a from f and a from w belong to different families:

    gap> FamilyObj(GeneratorsOfGroup(f)[1]) = FamilyObj(GeneratorsOfGroup(w)[1]);
    false
    

    This is why you were getting false in your examples.