Predicate Definitions

A knowledge base consists of zero, one or more predicates. Each predicate is either a built-in or a defined predicate. Built-ins are implemented via Java methods whereas defined predicates are implemented via associated clauses. A defined predicate can have zero, one or more associated clauses. Each defined predicate is either static, dynamic or thread local. A predicate is identified by a predicate indicator:

indicator --> module ":" indicator
            | atom "/" integer.

module    --> package "/" atom
            | "{" array "}"
            | reference
            | atom.

array     --> package "/" atom.
            | "{" array "}"
            | atom.

package   --> package "/" atom.
            | atom.

The name of a predicate is qualified when it starts with a module name separated by the colon (:) operator. Unqualified predicate names are extended by the module name of the Prolog text if the Prolog text has been elevated to a module, or by the module names of corresponding public or package local predicates found in dependent modules.

Examples:
call/1			% is a predicate indicator
(=)/2			% is a predicate indicator
basic/lists:member/2	% is a predicate indicator

A non-dynamic predicate without clauses can be declared via the directive static/1. The context of a clause is determined from the predicate name atom of the clause head. Context and pretty printing information of an atom can be accessed and modified by the predicates atom_property/2, set_atom_property/3 and reset_atom_property/3.

The predicate current_predicate/1 succeeds for a predicate that is visible in the current context. The different visibility parameters are documented in the module system section. Properties of a predicate can be accessed and modified by the predicates predicate_property/2, set_predicate_property/2 and reset_predicate_property/3.

The following predicate definition predicates are provided:

static P, ...:
The predicate sets the predicate P to static.
current_predicate(P): [ISO 8.8.2]
The predicate succeeds for the user predicates P.
predicate_property(P, Q):
The predicate succeeds for the properties Q of the predicate P.
set_predicate_property(P, Q):
The predicate assigns the property Q to the predicate P.
reset_predicate_property(P, Q):
The predicate de-assigns the property Q from the predicate P.
current_module(M):
The predicate succeeds for the modules M.
sys_neutral_predicate(I):
If no predicate has yet been defined for the predicate indicator I, defines a corresponding neutral predicate.
sys_make_indicator(F, A, I):
The predicate succeeds when I is the indicator for the possibly quantified name F and the arity A.
The following predicate properties for predicate definitions are provided:
built_in:
The property indicates that the predicate is a built-in. The property cannot be changed.
static:
The property indicates that the predicate is static. The property cannot be changed.
full_name(N):
The property indicates that the predicate has the flattened name N. The property cannot be changed.

Comments