DivideLink are special cases of FunctionLinks that can be used to symbolically represent arithmetic formulas in the AtomSpace, as well as performing actual numeric computations.
These link types can be used both to represent arithmetic formulas, as graphs, so that symbolic manipulations can be performed, and also as active, functional elements that actually perform arithmetic computations.
For example, the knowledge graph of "2+3" can be expressed in Atomese as
(PlusLink (NumberNode 2) (NumberNode 3)))
It can also be directly executed, to obtain an a numeric result:
(cog-execute! (PlusLink (NumberNode 2) (NumberNode 3)))
Besides NumberNodes, the arithmetic links can perform computations on FloatValues and TruthValues. Thus, they can be used to "flow" numeric data through the knowledge graph. See PredicateFormulaLink for a basic example, and the /examples/atomspace/formulas.scm for a detailed tutorial.
Symbolic Representation and Reduction
MinusLink (and all the other arithmetic link types) are useful for representing numeric knowledge in a form that can be algebraically manipulated, reasoned with, subjected to analysis and logical inference, and general symbolic manipulation.
cog-execute! function can perform some basic algebraic reduction on arithmetic links. Thus, for example:
(cog-execute! (PlusLink (VariableNode "$x") (NumberNode 2) (NumberNode 3)))
(PlusLink (VariableNode "$x") (NumberNode 5)
More reduction examples
The current implementation of symbolic reduction is not terribly powerful (interested parties are invited to take it to the next level), but it can do a many basic reductions. The following should work.
(cog-execute! (PlusLink (NumberNode 0) (VariableNode "$x")))
(cog-execute! (PlusLink (NumberNode 2) (VariableNode "$x") (NumberNode -2)))
will both return
Multiple addition is reduced to multiplication:
(cog-execute! (PlusLink (VariableNode "$x") (VariableNode "$x")))
(TimesLink (VariableNode "$x") (NumberNode "2"))
The post-ordering of numbers after variables is a convention coded in the reduct code.
The PlusLink and TimesLink are implemented on top of FoldLink, which roughly corresponds to the generic comp-sci concept of folding as a specific kind of iterated associative operation applied to a list.