# GAP:SymmetricGroup

## Definition

### Function type

This function takes as input either a nonegative integer or a list of nonnegative integers and outputs a group. An optional filter may be provided.

### Behavior

Nature of input Output
A nonnegative integer $n$ no more than $2^{28}$ The symmetric group (more specifically, symmetric group on finite set) of degree $n$, taken to be acting on the set $\{ 1,2,\dots, n \}$
An integer $n > 2^{28}$ a range error
A negative integer, fractional integer, or some other weird input A NoMethodFound error
A list of positive integers The symmetric group on the underlying set of the list of positive integers
A list comprising one element that could be anything The trivial group
A list comprising more than one element, not all of which are positive integers Usually, a NoMethodFound error
A nonnegative integer $n$, IsPcGroup as filter If $n \le 4$, the symmetric group of degree $n$ as a PcGroup (i.e., in terms of a polycyclic series). If $n \ge 5$, an error stating that degree can be at most $4$ (because $S_n$ is not solvable for $n \ge 5$).

## Examples of usage

### Single command examples

```gap> G := SymmetricGroup(0);
Sym( [  ] )
gap> H := SymmetricGroup(1);
Sym( [  ] )
gap> Order(SymmetricGroup([2,3,5,9]));
24
gap> SymmetricGroup(4);
Sym( [ 1 .. 4 ] )
gap> SymmetricGroup(['a']);
Sym( [  ] )
gap> SymmetricGroup([-1]);
Sym( [  ] )
gap> SymmetricGroup(IsPcGroup,4);
<pc group of size 24 with 4 generators>
gap> IdGroup(SymmetricGroup(5));
[ 120, 34 ]
```

Below is an explanation:

Command GAP output/print Other GAP functions used Explanation
G := SymmetricGroup(0); Sym( [ ] ) -- GAP is asked for the symmetric group of degree zero and returns it as the symmetric group on an empty set. It is a trivial group.
H := SymmetricGroup(1); Sym( [ ] ) -- GAP is asked for the symmetric group of degree one and returns it as the symmetric group on an empty set. Note that the empty set has size zero and not one, but the symmetric group of degree one does not move its fixed point, so it can be viewed as the symmetric group on the empty set.
Order(SymmetricGroup([2,3,5,9])); 24 Order GAP is asked to construct a symmetric group on the set $\{ 2,3,5,9 \}$, and then asked for the order. This group is isomorphic to symmetric group:S4 and its order is $4! = 24$, which is what GAP returns.
SymmetricGroup(4); Sym( [ 1 .. 4 ] ) -- GAP is asked to construct the symmetric group of degree 4, which it does (the group is symmetric group:S4).
SymmetricGroup(['a']); Sym( [ ] ) -- GAP is asked to construct a symmetric group on the set $\{ 'a' \}$ and returns the trivial group. As such, GAP does not construct symmetric groups on sets of things other than positive integers. However, for sets of size one, it always returns the trivial group, and does not return an error message.
SymmetricGroup([-1]); Sym( [ ] ) -- GAP is asked to construct a symmetric group on the set $\{ -1 \}$ and returns the trivial group. As such, GAP does not construct symmetric groups on sets of things other than positive integers. However, for sets of size one, it always returns the trivial group, and does not return an error message.
SymmetricGroup(IsPcGroup,4); <pc group of size 24 with 4 generators> -- GAP is asked to construct symmetric group:S4 and store it as a PcGroup with a polycyclic generating set and presentation. (rather than the default permutation group method used for creating symmetric groups). It is able to do this because symmetric group:S4 is indeed a finite solvable group (and hence polycyclic).
IdGroup(SymmetricGroup(5)); [ 120, 34 ] IdGroup GAP is asked to construct symmetric group:S5 and determine its group ID. It returns [120, 34] indicating that the group has order 120 and is the $34^{th}$ among groups of this order in GAP's SmallGroup library.

### Typical command sequences using this function

```gap> K := SymmetricGroup(2);
Sym( [ 1 .. 2 ] )
gap> L := SymmetricGroup([1,2]);
Sym( [ 1 .. 2 ] )
gap> M := SymmetricGroup([1,3]);
Sym( [ 1, 3 .. 3 ] )
gap> K = L;
true
gap> K = M;
false
gap> L = M;
false```

Below is an explanation:

Command GAP output/print Other GAP functions used Explanation
K := SymmetricGroup(2); Sym( [ 1 .. 2 ] ) -- GAP constructs the symmetric group of degree two as the symmetric group on the set $\{ 1, 2 \}$ and stores it as $K$. This is isomorphic to cyclic group:Z2.
L := SymmetricGroup([1,2]); Sym( [ 1 .. 2 ] ) -- GAP constructs the symmetric group on the set $\{ 1,2 \}$ and stores it as $L$.
M := SymmetricGroup([1,3]); Sym( [ 1, 3 .. 3 ] ) -- GAP constructs the symmetric group on the set $\{ 1, 3 \}$.
K = L; true -- GAP thinks that $K$ and $L$ are the same group, because they are both stored as the symmetric group on $\{ 1, 2 \}$.
K = M; false -- GAP thinks that $K$ and $M$ are not the same group, because $K$ is on the set $\{ 1 , 2 \}$ and $M$ is on the set $\{ 1, 3 \}$.
L = M; false -- GAP thinks that $L$ and $M$ are not the same group, because $L$ is on the set $\{ 1 , 2 \}$ and $M$ is on the set $\{ 1, 3 \}$.

### Error message examples

```gap> SymmetricGroup(IsPcGroup,5);
Error, <deg> must be at most 4 called from
SymmetricGroupCons( arg, arg ) called from
<function>( <arguments> ) called from read-eval-loop
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;
gap> P := SymmetricGroup([rabbit]);
Variable: 'rabbit' must have a value
gap> Q := SymmetricGroup([1,-1]);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `INV' on 1 arguments called from
InverseOp( elm ) called from
LeftQuotient( PermList( src ), PermList( dst ) ) called from
MappingPermListList( dom, Concatenation( dom{[ 2 .. Length( dom ) ]}, [ dom ] ) ) called from
SymmetricGroupCons( IsPermGroup, arg ) called from
<function>( <arguments> ) called from read-eval-loop
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;
gap> Q := SymmetricGroup(-1);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 3rd choice method found for `SymmetricGroupCons' on 2 arguments called from
SymmetricGroupCons( IsPermGroup, arg ) called from
Error( no_method_found ); called from
InverseOp( elm ) called from
LeftQuotient( PermList( src ), PermList( dst ) ) called from
MappingPermListList( dom, Concatenation( dom{[ 2 .. Length( dom ) ]}, [ dom ] ) ) called from
...