ComposeLink

From OpenCog
Jump to: navigation, search

ComposeLink (not implemented yet) would implement function composition.

Format

ComposeLink
  <g>
  <f>

if g is unary, or

ComposeLink
  <g>
  List
    <f1>
    ...
    <fn>

if g is n-ary.

Semantics

ComposeLink
  <g>
  <f>

is equivalent to

g(f(x1,...,xm))

While

ComposeLink
  <g>
  List
    <f1>
    ...
    <fn>
g(f1(x1,...,xm),...,fn(x1,...,xm))

Obviously g can only be composed with f if the co-domain of f inherits from the domain of g. Also in the case of multivariate function composition, the resulting domain of the composition is the intersection of the domains of f1 to fn (in case f1 to fn do not have exactly the same domains).

Examples

The following

DefineLink
   DefinedSchemaNode “getRobotCurrentSeriesPredictabilityDiscontinuitySeries”
   LambdaLink
      VariableList
         TypedVariableLink
            VariableNode "$T"
            TypeNode "TimeNode"
         TypedVariableLink
            VariableNode "$N"
            TypeNode "NumberNode"
      ExecutionOutputLink
         GroundedSchemaNode “py:calculateDiscontinuities”
         ExecutionOutputLink
            DefinedSchemaNode “getRobotCurrentSeriesPredictability”
            ListLink
               VariableNode "$T"
               VariableNode "$N"

is equivalent to

DefineLink
   DefinedSchemaNode “getRobotCurrentSeriesPredictabilityDiscontinuitySeries”
   ComposeLink
      GroundedSchemaNode “py:calculateDiscontinuities”
      DefinedSchemaNode “getRobotCurrentSeriesPredictability”