Permutations

&GAP; offers a data type permutation to describe the elements of permutation groups.

The points on which permutations in &GAP; act are the positive integers up to a certain architecture dependent limit, and the image of a point i under a permutation p is written i^p, which is expressed as i^p in &GAP;. (This action is also implemented by the function .) If i^p is different from i, we say that i is moved by p, otherwise it is fixed. Permutations in &GAP; are entered and displayed in cycle notation, such as (1,2,3)(4,5).

The preimage of the point i under the permutation p can be computed as i/p, without constructing the inverse of p.

For arithmetic operations for permutations and their precedence, see .

In the names of the &GAP; functions that deal with permutations, the word Permutation is usually abbreviated to Perm, to save typing. For example, the category test function for permutations is .

IsPerm (Filter)
<#Include Label="[1]{permutat}"> <#Include Label="IsPerm"> <#Include Label="IsPermCollection"> <#Include Label="PermutationsFamily">

Comparison of Permutations
equality test
precedence test
Two permutations are equal if they move the same points and all these points have the same images under both permutations.

The permutation p1 is smaller than p2 if p1 \neq p2 and i^{{p1}} < i^{{p2}}, where i is the smallest point with i^{{p1}} \neq i^{{p2}}. Therefore the identity permutation is the smallest permutation, see also Section .

Permutations can be compared with certain other &GAP; objects, see for the details.

gap> (1,2,3) = (2,3,1); true gap> (1,2,3) * (2,3,4) = (1,3)(2,4); true gap> (1,2,3) < (1,3,2); # 1^(1,2,3) = 2 < 3 = 1^(1,3,2) true gap> (1,3,2,4) < (1,3,4,2); # 2^(1,3,2,4) = 4 > 1 = 2^(1,3,4,2) false
<#Include Label="DistancePerms"> <#Include Label="SmallestGeneratorPerm">

Moved Points of Permutations
<#Include Label="SmallestMovedPoint"> <#Include Label="LargestMovedPoint"> <#Include Label="MovedPoints"> <#Include Label="NrMovedPoints">

Sign and Cycle Structure
<#Include Label="SignPerm"> <#Include Label="CycleStructurePerm">

Creating Permutations
<#Include Label="ListPerm"> <#Include Label="PermList"> <#Include Label="MappingPermListList"> <#Include Label="RestrictedPerm">

A permutation or fail.
Partial permutations and transformations which define permutations (mathematically) can be converted into &GAP; permutations using AsPermutation; see Chapters and for more details about transformations and partial permutations.

for partial permutations
If the partial permutation f is a permutation of its image, then AsPermutation returns this permutation. If f does not permute its image, then fail is returned.

for transformations
A transformation is a permutation if and only if its rank equals its degree. If a transformation in &GAP; is a permutation, then AsPermutation returns this permutation. If f is not a permutation, then fail is returned.

The function can also be used to convert partial permutations and transformations into permutations where appropriate. gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], > [ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] ); (1,2,7,5)(3,9)(4)(6,10,8) gap> AsPermutation(f); (1,2,7,5)(3,9)(6,10,8) gap> f:= PartialPerm( [ 1, 2, 3, 4, 5, 7, 8 ], [ 5, 3, 8, 1, 9, 4, 10 ] ); [2,3,8,10][7,4,1,5,9] gap> AsPermutation(f); fail gap> f:=Transformation( [ 5, 8, 3, 5, 8, 6, 2, 2, 7, 8 ] );; gap> AsPermutation(f); fail gap> f:=Transformation( [ 1, 3, 6, 6, 2, 10, 2, 3, 10, 5 ] );; gap> AsPermutation(f); fail gap> f:=Transformation( [ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] ); Transformation( [ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] ) gap> AsPermutation(f); (1,2,7,5)(3,9)(6,10,8)