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
unknown Prolog flag; see ref-lps-flg.
Calls to predicates that have no clauses are not caught.
Two development system predicates are handy in this context:
| ?- unknown(X,error). % Undefined predicates will raise an exception (error) X = error
This sets the flag and prints a message about the new value.
| ?- debugging. The debugger is switched off Using leashing stopping at [call,exit,redo,fail,exception] ports Undefined predicates will raise an exception (error) There are no breakpoints
This prints a message about the current value, as well as information about the state of the debugger.