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.

Theory

The ArrowLink is the Curry–Howard correspondent to the ImplicationLink. The adjoint to the ArrowLink is the TensorLink ... except we do not have a TensorLink, because we've never needed one. The wikipedia article on currying explains the general nature of tensor-hom adjunction, that is, it explains how arrows and tensor products are adjoints of one-another.

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)

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

     (ExecutionOutput (stv 0.2 0.69999999)
        (GroundedSchema "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:

TypedAtom
   GroundedSchema "scm:make-overexpression-predicate"
   Arrow
      ListLink       ;; This is what you are accepting as input
         Type "GeneNode"
      EvaluationLink ;; This is what you are returning
         Type "PredicateNode"
         ListLink
            Type "ConceptNode"
            Type "GeneNode"

The length of lists (in the case of variable lenght 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:

TypedAtom
   GroundedPredicate "scm:compute-truth"
   Arrow
      ListLink          ;; The input: a list of exactly two concepts
         Type "ConceptNode"
         Type "ConceptNode"
      Type "TruthValue"   ;; This is what is returned.