Unknown Procedures

The built-in predicate prolog_flag/3 or unknown/2 can be used to determine or set Prolog's behavior when it comes across an undefined predicate. By default, unknown procedures raise an exception.

Procedures that are known to be dynamic fail when there are no clauses for them.

When an undefined predicate is called and the undefined predicate behavior is set to error rather than fail, unknown_predicate_handler/3 is called in module user. By defining this predicate, you can (selectively) trap calls to undefined predicates in a program.