There is a difference between predicates that have no definition and predicates that have no clauses. The latter case is meaningful e.g. for dynamic predicates (see Declarations) that clauses are being added to or removed from. There are good reasons for treating calls to undefined predicates as errors, as such calls easily arise from typing errors.
The system can optionally catch calls to predicates that have no
definition. First the user defined predicate
user:unknown_predicate_handler/3 (see Exception) is called.
If undefined or if the call fails the action is governed by the state of
unknown Prolog flag, which can be:
Calls to predicates that have no clauses are not caught.
The built-in predicate
) unifies OldState with the current state
and sets the state to NewState. The built-in predicate
debugging/0 prints the value of this state along with its other
information. This state is also controlled by the
unknown Prolog flag.