Prolog implementations traditionally implement the concept of dynamic predicates: predicates which can be inspected or modified at run-time, adding or deleting individual clauses. The power of this feature comes at a cost: as new clause bodies can be arbitrarily added to the program, new predicate calls can arise which are not 'visible' at compile-time, thus complicating global analysis and optimization of the code. But it is the case that most of the time what the programmer wants is simply to store data, with the purpose of sharing it between search branches, predicates, or even execution threads. In Ciao the concept of data predicate serves this purpose: a data predicate is a predicate composed exclusively by facts, which can be inspected, and dynamically added or deleted, at run-time. Using data predicates instead of normal dynamic predicates brings benefits in terms of speed, but above all makes the code much easier to analyze automatically and thus allows better optimization.
Also, a special kind of data predicates exists, concurrent predicates, which can be used to communicate/synchronize among different execution threads (see Low-level concurrency/multithreading primitives).
Data predicates must be declared through a data/1 declaration. Concurrent data predicates must be declared through a concurrent/1 declaration. The allowed operations on data predicates are defined in datafacts_rt.