IdenticalLink

From OpenCog

The IdenticalLink is a kind of virtual link that evaluates to true when its arguments are the same atom. If not, it evaluates to false. IdenticalLink is used to test for syntactic equality, that is, for identity. To test if atoms are semantically equal (identical after having been executed), use EqualLink.

The primary use of IdenticalLink is during pattern matching, when its arguments may contain variables to be grounded. Thus, when the pattern matcher grounds the variables with actual values, the IdenticalLink can be evaluated to see if identity holds or not (with the pattern match being accepted or rejected as a result). In many cases, IdentityLinks can be evaluated at pattern compile time, thus avoiding a run-time cost of evaluation. This makes them strictly more efficient than EqualLinks.

IdenticalLinks can be combined with AndLink, NotLink and OrLink to create arbitrarily evaluatable crisp-logic boolean expressions.

They can be evaluated with the cog-evaluate! function.

IdenticalLinks can have more than two arguments; if so, then they are all compared for identity. An IdenticalLink with zero or one arguments is trivially true.

See also