Atom relationships

From OpenCog
Jump to: navigation, search

This page summarizes some of the different atom types that play an important role in the pattern matcher, and in atomese in general, with the goal of comparing and contrasting their similarities and differences. There are many different link types that are "dual" to each other, in some way, or perform "opposite" tasks. Others perform similar tasks in "opposite" domains.

Existence predicates

Various different atoms deal with the need to determine if some term is present or absent in the atomspace. This table illustrates how these are inter-related.

link type variables join valuation notes
GetLink bound - Atom Use cog-execute! to execute it.
SatisfactionLink bound - TV Use cog-evaluate! to evaluate it.
PresentLink free and TV All of the terms must be present.
ChoiceLink free or TV At least one term must be present.
AbsentLink free  ? TV Term must be absent.

The column indicated "variables" indicates whether or not the link binds its variables. Links that bind their variables can be evaluated or executed outside of the pattern matcher. Links that do not bind their variables can be used to define multi-clause patterns inside of links that do bind their variables.

The column marked "join" indicates how multiple terms are treated; thus, PresentLink requires that all terms be present, while ChoiceLink requires that any one term be present.

The column marked "valuation" indicates how the different link types are meant to be valued: this can be either a TV or an atom. Thus, for example, executing a GetLink returns a set of atoms. Evaluating a SatisfactionLink returns a TV.

Dualities

Some link types act as opposites to each other, in that one link "undoes" what the other link "does". Alternately, these duals can also be thought of as adjoints.

morphism dual notes
GetLink DualLink Pattern matching is the task of finding all data that match a particular pattern. Pattern recognition is the task of finding all patterns that match a particular bit of data.
MapLink PutLink PutLink performs beta-reduction. Maplink can "unput" or un-beta-reduce expressions, extracting values from them, using the supplied pattern template to locate values.


Note that MapLink resembles BindLink; however, MapLink only searches its argument list, while BindLink searches the entire atomspace.

Imperative vs. Declarative

There is a mirror symmetry between many link types used by PLN, and the link types used by the pattern matcher. The convention is that the PLN link types are "declarative", whereas the pattern matcher links are "imperative". The distinction here is that the PLN link types assert some fact that is meant to hold; the truth of that fact is given a valuation by the associated TV: the PLN links "declare" facts. The pattern matcher link types are instead transformations to be applied: when the pattern matcher runs, the application of an "imperative" link type causes something to happen.


declarative imperative notes
ImplicationLink BindLink P implies Q; if P exists, create Q
SatisfyingSetLink GetLink What is the set of atoms that satisfy a predicate?
 ? DualLink What is the set of predicates that an atom satisfies?
EquivalenceLink DefineLink What formula or structure defines a predicate?
MemberLink PutLink An element belongs to a set; add an element to a set.
 ? MapLink Extract an element from a structured set (a graph)
ForAllLink PresentLink Do all of the elements exist (in the atomspace)?
ExistsLink ChoiceLink Does at least one element exist (in the atomspace)?
OrLink ChoiceLink A or B is true; choose either A or choose B.
none RandomChoiceLink At execution time, pick an element randomly.

Note that RandomChoiceLink has no declarative analog: that is because the concept of "picking something" is inherently anchored in time and space, and, once done, cannot be un-done.

The PutLink behaves a lot like an EvaluationLink, when it is used with DefinedPredicateNodes. See PutLink and EvaluationLink for examples.

The PutLink behaves a lot like an ExecutionOutputLink, when it is used with DefinedSchemaNodes. See PutLink and LambdaLink for an example.