Did you know? SWI-Prolog has lots of useful PackagesSearch Documentation:
SWI-Prolog owl logoPredicate permutation/2