Check identity in Gap How can I compute the identity of commutators? For instance, Let $H$ be a group. Then I want to know about $[h_1,h_2] [[h_1,h_2],k_1] [k_1,h_1h_2]$.
 A: One could use Comm to compute commutator of two group elements. Let's create an example:
gap> G:=DihedralGroup(512);
<pc group of size 512 with 9 generators>
gap> h1:=Random(G);
f4*f5
gap> h2:=Random(G);
f1*f3*f4*f5*f6*f8
gap> k1:=Random(G);
f3*f4*f7

Then the expression in the question will look like this:
gap> t:=Comm(h1,h2);
f5*f7*f8*f9
gap> t*Comm(t,k1)*Comm(k1,h1*h2);
f4*f5*f6*f9

Remark: Comm(a,b) calculates $a^{-1}b^{-1}ab$ and not $aba^{-1}b^{-1}$. 
Anyhow, instead of just trying to write the expression verbatim in GAP, it would be useful to see first if it could be simplified as shown in the answer by @Timbuc.
Furthermore, I am not sure how the term "identity" is used in the question. If one wants to check whether the expression is equal to identity element of the group, (for some groups) it could be seen as below, or checked with IsOne:
gap> a:=Random(G);
f2*f3*f4*f5*f6*f7*f8*f9
gap> b:=Random(Centre(G));
f9
gap> Comm(a,b);
<identity> of ...
gap> IsOne(last);
true

For finitely presented groups, that may be expensive. (cf. also SetReducedMultiplication which triggers display options for f.p.-group elements).
If instead one wants to check that the identity $[h_1,h_2] [[h_1,h_2],k_1] [k_1,h_1h_2]=1$ holds for any $h_1,h_2,k_1$, that's a different story. GAP can't check this symbolically, so one would have to check this for all possible triples of elements, and try to find various clever tricks to reduce the search domain.
A: In the general case commutators cannot be made much simpler, though there are some identities that can help. Here, for example:
$$[[h_1,h_2],k_1]=[h_1,h_2]^{-1}k_1^{-1}[h_1,h_2]k_1=h_2^{-1}h_1^{-1}h_2h_1k_1^{-1}h_1^{-1}h_2^{-1}h_1h_2k_1$$
so for example
$$[h_1,h_2][[h_1,h_2],k_1]=h_1^{-1}h_2^{-1}h_1h_2\left(h_2^{-1}h_1^{-1}h_2h_1k_1^{-1}h_1^{-1}h_2^{-1}h_1h_2k_1\right)=$$
$$k_1^{-1}h_1^{-1}h_2^{-1}h_1h_2k_1=[h_1,h_2]^{k_1}$$
and since
$$[k_1,h_1h_2]=[k_1,h_2][k_1,h_1]^{h_2}...\text{well, you see the picture, I hope}$$
