Orbital library

Interface Functor

All Known Subinterfaces:
BinaryFunction, BinaryFunction, BinaryFunction.Composite, BinaryFunction.Composite, BinaryPredicate, BinaryPredicate.Composite, Formula, Formula.Composite, Function, Function, Function.Composite, Function.Composite, Functor.Composite, MathFunctor, MathFunctor.Composite, MutableFunction, Polynomial, Predicate, Predicate.Composite, Substitution, Type, Type.Composite, UnivariatePolynomial, VoidFunction, VoidFunction.Composite, VoidPredicate, VoidPredicate.Composite
All Known Implementing Classes:
Closer, Functionals.Anamorphism, Functionals.Catamorphism, Functionals.Hylomorphism, Functionals.Paramorphism, HeuristicAlgorithm.PatternDatabaseHeuristic, LogicBasis, MutableFunction.TableFunction

public interface Functor

An abstract base interface for all functors of an arity n applicable in any predicate-logic style. Usually denoted like "f(...)" or "P(...)". It provides a way for callers applying the functor, to callback callees implementing a derivative of Functor.

A Functor f/n is any function-like object (resembling function-pointers in C++) implementing Functor. Its signature Specification declares which methods are contained. The exact signature specification of a functor can either be defined explicitly with a sub interface of Functor that encapsulates those methods, or generically with an implicit interface accessed via Functor.Specification.

Types of functors:
the return-type will be modelled as a boolean-value, and P/n is interpreted as a relation, i.e. a subset of a cartesian product.
the return-type will be any type and the symbol f/n is interpreted as a function-object.
(a higher-order function) are special functions where the return-type or any of the argument-types will be a kind of Functor.
Duality between functions and predicates:
Every function f/n:A→B induces an implicit predicate with the same extensional semantics
fP/(n+1) := {(a1,...,an,f(a1,...,an)) ¦ (a1,a2,...,an)∈A}
If a predicate P/n⊆A is unique with respect to a certain parameter ak it induces an implicit function with the same extensional semantics
Pf/(n-1) := {f(a1,...,ak-1,ak+1,...an):=ak ¦ P(a1,a2,...,an) is true}
Also, whether the extension of a predicate is specified as a subset ρ∈℘(A), or with its characterisitic function χρ with χρ(x)=1 iff x∈ρ is a matter purely syntactic variant. Note however, that inspite of all this duality, functions and predicates can differ intensionally regardless of their extensional equality.

Finally, functions, predicates, relations, and graphs are all "isomorph" anyhow!

André Platzer
See Also:
Functor.Specification, Functor.Specification.getSpecification(Functor), Function, Predicate, Properties of Functions, Functors in the sense of category-theory

Nested Class Summary
static interface Functor.Composite
          The base interface for all functors that are composed of other functors.
static class Functor.Specification
          Represents a signature and type specification belonging to a functor.
Method Summary
 boolean equals(java.lang.Object o)
 int hashCode()
 java.lang.String toString()
          Returns a string representation of the Functor.

Method Detail


boolean equals(java.lang.Object o)

Note that functors will often provide intensional equality only, since the mathematical notion of extensional equality for functions and predicates is undecidable anyway (Proposition of Rice). Nevertheless implementations are encouraged to provide a larger subset of extensional equality as far as possible.

equals in class java.lang.Object


int hashCode()
hashCode in class java.lang.Object


java.lang.String toString()
Returns a string representation of the Functor.

This method is already provided in Object.toString(). If it is overwritten it should return a nice name for the functor.

toString in class java.lang.Object
a nice name for the functor.

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.