Small fixes

Permutations:
- bitwise inversion (~) can be used as shorthand for inverting a
permutation.
- methods for applying permutations to lists
Trees:
- to_partition just returns the partition and delegates to an internal
method
TreePair: making expand() an internal method