More efficient check for Prolog built-in predicates