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 ref-lod-dcl) 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 ref-ere) is called.
If undefined or if the call fails the action is governed by the state of
the unknown
Prolog flag, which can be:
trace
error
warning
fail
Calls to predicates that have no clauses are not caught.
The built-in predicate unknown(
OldState,
NewState)
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.