# PredicateNode

The ** PredicateNode** names the predicate of a relation. Predicates are functions that have arguments, and produce a truth value as output. These are commonly used with EvaluationLinks, which specify the arguments to the predicate.

Predicates in OpenCog roughly resemble the predicate of first-order logic. However, because all atoms in the AtomSpace carry a truth value, the concept of a predicate in OpenCog is more general than that of a predicate in first-order logic. It is more closely akin to an characteristic function in probability theory, which helps assign a floating-point truth value to a declaration, or to a classifying topos in mathematical logic, which is used to assign arbitrary "truth values" or "classifications" to expressions.

## Example

The following uses the `PredicateNode "breathe"`

to define things that breathe air:

EvaluationLink PredicateNode "breathe" ListLink VariableNode "$X" ConceptNode "air"

This can be converted to the concept of "all things that breath air" by means of the SatisfyingSetLink.

## Semantics, Usage

Some usage notes:

### Semantics

The semantics of a PredicateNode can be made concrete by converting it into a ConceptNode, and back. Roughly speaking, a PredicateNode can be thought of as being similar to a predicate *P(x)* for first-order logic or of predicate logic. The corresponding set of all things *x* that make *P(x)* true is the satisfying set. The correspondence can be loosely thought of as a "semantic interpretation". The SatisfyingSetLink, together with the EquivalenceLink, is used to perform this conversion.

### Defined Predicates

A DefinedPredicateNode is a single atom that is attached to a more complex definition by means of a DefineLink. During the evaluation of the predicate, it's definition is looked up, and that definition is used during evaluation. The definition is typically some formula or other complex expression that behaves like a predicate or relation. The definition consists entirely of Atoms.

### Grounded Predicates

A GroundedPredicateNode specifies a predicate whose truth value is updated by the evaluation of a scheme, python or C++ code snippet. It is similar to a DefinedPredicateNode; however, it is a "black box" from the point of view of logical inference and knowledge representation. That is, there is no way to guess what the scheme/python/c++ code might do, and so it is impossible to reason with GroundedPredicates. This stands in sharp contrast to DefinedPredicates, which are "clear boxes" whose inner workings are visible to inference, learning and analysis algorithms.

The primary usefulness of GroundedPredicates is for attaching to external systems: e.g. to robot control systems, sensory and perceptual systems, Neural Network systems and other external sources/sinks of data.

See also GroundedSchemaNode for a related notion.

### See also

See the page on CombinatorsAndProcedureNodes for a more detailed discussion of what PredicateNodes are, and how they work.

### PLN Semantics

In PLN, the TruthValue of a PredicateNode is defined as the average over all evaluations of that predicate. Roughly speaking, it is the probability of that predicate being true in the universe of all things. The AverageLink page provides an explicit example.

### Examples

Multiple examples can be found in the `/examples/atomspace`, the `/examples/pattern-matcher` and the `/examples/rule-engine` directories.