inversions w
A permutation $p$ has an inversion $(i,j)$ if $i < j$ and $p(i) > p(j)$. inversions computes all of the inversions of a permutation.
i1 : p = permutation {3,1,2,5,4} o1 = Permutation{3, 1, 2, 5, 4} o1 : Permutation
i2 : inversions p o2 = {{1, 2}, {1, 3}, {4, 5}} o2 : List
The object inversions is a method function.