cog-evaluate! function is a scheme function that is able to evaluate EvaluationLinks and return a TruthValue and is part of
(opencog exec) module. This page attempts to explain what
cog-evaluate! does today. This may change over time.
cog-evaluate should be distinguished from
cog-execute!, which is able to execute functions that return an Atom, and from
cog-reduce!, which is able to reduce expressions to normal form.
There are two basic types of links that can be evaluated: "black-box" links, and "clear-box" links. Black-box links can execute arbitrary scheme or python code (returning a TruthValue). Because of this, black-box links cannot be reasoned over, or reduced. Examples of "clear-box" evaluatable links include GreaterThanLink and EqualLink. Evaluatable links can be composed with AndLink, OrLink and NotLink to propage crisp-logic boolean truth values.
(cog-evaluate! (GreaterThanLink (PlusLink (NumberNode 2) (NumberNode 2)) (TimesLink (NumberNode 3) (NumberNode 0.5))))
(stv 1 1)
when evaluated at the guile prompt.
Both atoms and truth values are special cases of values. As such, cog-evaluate could be updated to return values in general, and therefore, return both truth values and atoms as special cases. Exactly how this could work is not yet known.