Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cardinality of functions #7

Open
bblfish opened this issue Apr 20, 2022 · 1 comment
Open

Cardinality of functions #7

bblfish opened this issue Apr 20, 2022 · 1 comment

Comments

@bblfish
Copy link

bblfish commented Apr 20, 2022

In §4.1 I read

No cardinalities are defined in the Function Ontology, as there are no hard limits on cardinality to be defined. A function can implement multiple algorithms, solve multiple problems, and have multiple executions. All executions can have multiple input parameters and output values. Vice versa, input parameters and output values can be linked to multiple executions, and an execution (i.e., a set of input values and output values) can be linked to multiple functions.

I think all these are non-controversial, except that a function can have multiple results. So I think this decision needs to be argued for carefully.

Here is the counterargument that would need to be answered: In mathematics (such as category theory) a function is a relation that covers the whole of a domain and has exactly one value for each element of the domain, each of those values being located in the range. We find this in owl, where an owl:FunctionalProperty is a relation for any object on which it is defined, has exactly one value.

In Category Theory we have the following two categories which are related by 3)

  1. For functions we have the category of Sets and functions between them
  2. For relations we have the category of Sets and relations between them (see @epatters excellent paper Knowledge Representation in Bicategories of Relations)
  3. The Kleisli category of the Powerset monad on the category of Sets is the Bicategory of Relations see Example 5.1.17 page 142 in @paoloperrone's 2019 Notes on Category Theory. I.E. functions from A to the powerset of B form relations and can be composed.

So there are some interesting questions:

  • can one model functions from the bicategory of relations (ie. RDF)? If so how? (esp. how would one specify that all elements of a domain are mapped?)
  • if one can model functions one can model partial functions using functors 1+X (aka optional), that add an extra point 1 for functions that have no values. But then one would need to model such functor. Is that possible?
  • what is still functional about the function ontology if one gives up the single value?
@bblfish
Copy link
Author

bblfish commented May 3, 2022

Assuming one found a way of adding a pure definition of a function to the Function Ontology. How would one model Java? The key article to read there is Bart Jacobs's classic 2003 Coalgebras and monads in the semantics of Java - and his earlier articles on OO and colagebras from the 1990s.

The semantis of a statement

public B foo(A x)

is written mathematically as

$$S × A → Hang + Normal + Abrupt$$

ie a function that takes a pair of a state and an argument A and returns either a result that specifies the Hanging of the VM or a Normal return value (e.g. B ) or an Abrupt termination given by an exception. Both the exception and the Normal termination return a new state of the VM expressed as

$$S × A → 1 + (S × B) + (S × E)$$

a function takes a state and an argument and returns either a singleton (unit) or a new state and the result or a new state and the Exception. Bart Jacobs then shows how one can transform that into a monad view and also into a coalgebraic view. The coalgebraic view is the OO perspective: objects with methods that transform its state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant