From OpenCog
Jump to: navigation, search

The GreaterThanLink is a kind of virtual link that evaluates to true when its two arguments evaluate to NumberNodes, and the first argument is numerically greater than the second.

For example,

       (NumberNode 2)
       (NumberNode 2))
       (NumberNode 3)
       (NumberNode 0.5)))

evaluates to 'true'. GreaterThanLinks can be combined with AndLink, NotLink and OrLink to create arbitrarily evaluatable crsip-logic boolean expressions. GreaterThanLinks can be evaluated with the cog-evaluate! function. The above is valid code, and thus, the above can be cut-n-pasted to the guile prompt, as (cog-evaluate! (GreaterThankLink ...)) to yield

(stv 1 1)

When used with the pattern matcher, GreaterThanLinks may contain VariableNodes; they are evaluated when the VariableNodes are grounded.

The GreaterThanLink works only for scalar arguments, and always evaluates to a SimpleTruthValue. For vectors, use the HeavisideLink, which implements the Heaviside step function, and can accept a vector and return a vector.

Design history

The GreaterThanLink was invented during the earlier days of the AtomSpace, before the use of formulas for vectors was anticipated. At the time, it seemed to make sense to make it evaluatable, returning a SimpleTruthValue. The HeavisideLink does almost the same thing, but there is no particularly easy or straight-forward way of merging these two link types together in a backwards-compatible way. And this is why there are two link types. It might make sense to change this situation some time in the future...

See also