prolog utilities