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.