Point-Free Logic Programming

8 points by veqq


carlomonte

something like this: https://sr.ht/~carlomonte/Alain/ ? (self-promotion)

veqq

we could sidestep all the complex semantics around logic variables by just talking about entire relations at once, could we open a whole new door to user-sculptable programming?

if you have relations, I think you can express both functions and types in them. That would mean you can get a whole new level of higher-order programming.

This leverages "binates", a terser relation syntax:

write relations in terms of more primitive relations using conjunction or intersection ,, union ;, converse or inverse ~, composition (concatenation), transitive closure *, either negation ! or set subtraction -, and a form of N-ary Cartesian product: {x: a, y: b, ...} produces a relation from the intersection of the domains of a and b etc. to a set of tuples which are the domain of the new relations x and y etc., whose codomains are the codomains of a and b etc. respectively - https://dercuano.github.io/notes/binate-kanren.html

ancestor = parent parent*.
father = parent, "male" ~sex.
sibling = parent ~parent.
cousin = parent sibling ~parent.

sufficient to express anything you can express in Codd’s N-ary relational algebra or relational calculus

In relational programming, a relation is also its inverse, so:

a function of multiple arguments may have many inverses, and you only have to write it once

by composing your program out of binary relations, you can describe the computation you want in a somewhat terser fashion than any previous language. You can beat APL for terseness.

This is exactly what my dataframes and query syntax needs.