The domain \spadtype{GroupPresentation} implements group
presentations.

\xtc{
We first expose it to simplify notation.
}{
\spadcommand{)expose GroupPresentation}
}

\xtc{
We create cyclic group.
}{
\spadcommand{c3 := groupPresentation([1], [[1, 1, 1]]) \bound{c3}}
}

\xtc{
And we convert it to \spadtype{PermutationGroup} using Todd-Coxeter
coset enumeration.
}{
\spadcommand{toPermutationIfCan(c3)}
}

For nicer input there is package \spadtype{GroupPresentationFunctions1}.

\xtc{
We first assign generators of free group to variables.
}{
\spadcommand{fG := FreeGroup(Symbol) \bound{fG}}
}
\xtc{
}{
\spadcommand{a := (^$fG)('a, 1) \free{fG} \bound{a}}
}
\xtc{
}{
\spadcommand{b := (^$fG)('b, 1) \free{fG} \bound{b}}
}
\xtc{
}{
\spadcommand{c := (^$fG)('c, 1) \free{fG} \bound{c}}
}

\xtc{
Now we give presentation of Mathieu group M12.
}{
\spadcommand{m12f := [a^11, b^2, c^2, (a*b)^3, (a*c)^3, (b*c)^10, a^2*(b*c)^2*a*(b*c)^(-2)] \free{a b c} \bound{m11f}}
}
\xtc{
}{
\spadcommand{cP := GroupPresentationFunctions1(Symbol) \bound{cP}}
}
\xtc{
}{
\spadcommand{m12pres := convert(['a, 'b, 'c], m12f)$cP \free{m12f cP} \bound{m12pres}}
}
\xtc{
And convert it to permutation group.  Since Mathieu group has
many elements we compute representation on cosets of group
generated by \spad{a} and \spad{b}.
}{
\spadcommand{m12per := toPermutationIfCan(m12pres, [[1], [2]], false) \free{m12pres} \bound{m12per}}
}

\xtc{
To check the result we compute order.
}{
\spadcommand{order(m12per::PermutationGroup(Integer))}
}
