ArrowLink

From OpenCog
Jump to: navigation, search

The ArrowLink is a type constructor used to represent (anonymous) function types. It corresponds to the usual right-arrow function-type constructor of typed functional languages such as CaML or Haskell. It has the form

   ArrowLink
        ...   ; the inputs
        ...   ; the outputs


The ArrowLink differs from other atoms in that it is explicitly a type object, i.e. usable wherever TypeNode is currently usable, or usable wherever SignatureLink is currently usable.

A Bio-AI Example

As an example usage, consider the following Atom-construct, which occurred in using PLN to do inference about gene expression data:

 (IntensionalEquivalenceLink (stv 0.19570713 0.99999982)

     (ExecutionOutputLink (stv 0.2 0.69999999)
        (GroundedSchemaNode "scm: make-overexpression-predicate")
        (ListLink
           (GeneNode "TBK1" (stv 4.1666666e-05 0.89999998))))

     (ExecutionOutputLink (stv 0.2 0.69999999)
        (GroundedSchemaNode "scm: make-overexpression-predicate")
        (ListLink
           (GeneNode "LY96" (stv 4.1666666e-05 0.89999998)))))

The above construct has semantics “Properties associated with over-expression of TBK1 are similar to properties associated with overexpression of LY96”.

The input and output types for the GSN used in the above can be represented using ArrowLink as follows:

TypedAtomLink
   GroundedSchemaNode "scm:make-overexpression-predicate"
   ArrowLink
      ListLink       ;; This is what you are accepting as input
         TypeNode "GeneNode"
      EvaluationLink ;; This is what you are returning
         TypeNode "PredicateNode"
         ListLink
            TypeNode "ConceptNode"
            TypeNode "GeneNode"

The length of lists (in the case of variable lneght input or output lists) can be specified with the IntervalLink used in combination with the TypeSetLink.

A TruthValue example

The GroundedPredicateNode specifies a function that, when called, returns a truth value. Since truth values, as values in general, are part of the atom type hierarchy, they can be specified as follows:

TypedAtomLink
   GroundedPredicateNode "scm:compute-truth"
   ArrowLink
      ListLink       ;; The input: a list of exactly two concepts
         TypeNode "ConceptNode"
         TypeNode "ConceptNode"
      TypeNode "TruthValue";; This is what is returned.