# 20.1 Comparisons of Permutations

`p1 = p2`
`p1 < p2`

The equality operator `=` evaluates to `true` if the two permutations p1 and p2 are equal, and to `false` otherwise. The inequality operator `<` evaluates to `true` if the two permutations p1 and p2 are not equal, and to `false` otherwise. You can also compare permutations with objects of other types, of course they are never equal.

Two permutations are considered equal if and only if they move the same points and if the images of the moved points are the same under the operation of both permutations.

```    gap> (1,2,3) = (2,3,1);
true
gap> (1,2,3) * (2,3,4) = (1,3)(2,4);
true ```

`p1 < p2`
`p1 <= p2`
`p1 p2`
`p1 = p2`

The operators `<`, `<=`, , and `=` evaluate to `true` if the permutation p1 is less than, less than or equal to, greater than, or greater than or equal to the permutation p2, and to `false` otherwise.

Let p_1 and p_2 be two permutations that are not equal. Then there exists at least one point i such that i^{p_1} <> i^{p_2}. Let k be the smallest such point. Then p_1 is considered smaller than p_2 if and only if k^{p_1} < k^{p_2}. Note that this implies that the identity permutation is the smallest permutation.

You can also compare permutations with objects of other types. Integers, rationals, cyclotomics, unknowns, and finite field elements are smaller than permutations. Everything else is larger.

```    gap> (1,2,3) < (1,3,2);
true    # \$1^{(1,2,3)} = 2 \<\ 3 = 1^{(1,3,2)}\$
gap> (1,3,2,4) < (1,3,4,2);
false    # \$2^{(1,3,2,4)} = 4 > 1 = 2^{(1,3,4,2)}\$ ```

GAP 3.4.4
April 1997