7 Some Permutation Essentials In this chapter we mention a couple functions that are fairly basic but useful tools to work with. 7.1 Complement 7.1-1 PermComplement PermComplement( perm )  function Returns: The permutation that is the complement of perm. The complement of a permutation τ=τ_1...τ_n is the permutation τ^C=(n+1)-τ_1 (n+1)-τ_2... (n+1)-τ_n .  Example  gap> PermComplement([3,2,8,6,7,1,5,4]); [ 6, 7, 1, 3, 2, 8, 4, 5 ] gap>   7.2 Rank Encoding 7.2-1 IsRankEncoding IsRankEncoding( perm )  function Returns: true if perm is a valid rank encoding of a permutation. IsRankEncoding checkes whether the input list perm is a valid rank encoding by checking whether it is accepted by the bounded class automaton, with the highest rank being set by the highest element in perm.  Example  gap> IsRankEncoding([3,2,6,4,4,1,2,1]); true gap> IsRankEncoding([3,2,6,4,5,1,2,1]); false gap>