## Monday, August 19, 2013

### Functional relational programming

I have long had an appreciation for one to one correspondences which like functions can be called but unlike ordinary functions they have also an inverse. An example of such a one to one correspondence is the increment function:
(inc ? 10) ; 9
(inc 10 ?) ; 11

Ordering relations like the total ordering relation on numbers and the inclusion relation on sets are of an unmatched level of importance to my algebra system. The first and second parts of a partial ordering relation are the parts and parents respectively:
(subset ? #{0 1}) ;  #{#{} #{0} #{1} #{0 1}}
(subpartition {1 2} ?) ; #{{1 2} {2 1}}

Equivalencies are another fundamental type of relation that together with partial ordering relations can be used to define preordering relations. Equivalence relations return the equivalence class of an element when subjected to a query. All binary operations including categories, magmas, quasigroups, loops, semigroups, monoids, semilattices and groups can be defined as ternary relations:
(+ ? 15 25) ; 10
(+ 10 15 ?) ; 25

A wide variety of simple graphs like forests, cographs, permutation graphs, interval graphs, and comparability graphs are also of interest to us as well as other binary relations that generalized directed cycles that haven't been mentioned so far. The key means by which I will relate my functional programming with the theory of relations is through the use of a system of functional dependencies based upon armstrongs axioms.