add is_permutation and tests