Simple, pure, and total functional language that generalizes Datalog
rntz.net
rntz.net
So Datalog is a better starting point, extend it in some other better ways than Prolog does.
However, Prolog predicates are relations, not functions. i.e. they have no fixed "input" and "output" arguments. So Prolog is not a functional language.
______________________
[1] In "p(X):- q(X)", p(X) and q(X) are literals.
I think we’ve really missed a trick with declarative programming beyond the database. I find it much easier to think about simple rules, and I think it would be easier to share these rules with less technical business partners too.
The reason for the restriction is completeness and efficiency. Definite datalog programs are guaranteed to terminate (given a finite predicate and constant signature), so the search for a hypothesis (the learned program) cannot "go infinite" even when the target theory (what you are trying to learn) is recursive, even when it has mutually recursive clauses. As a result our algorithms can learn recursive programs (which, is rather important). The space of hypotheses doubles in size when negation as failure is allowed, which improves the efficiency of the search for hypotheses.
The problem of course is that some programs cannot be expressed in definite datalog than can be expressed in Prolog with negation as failure and arbitrary functions as arguments. So that's a bit of a limitation. For instance, one has to jump through hoops to learn programs with "exceptions" (A if B except if C), say like a program calculating leap years (which have exceptions for years divisible by 100 and 400) or fizzbuzz.
This is not directly programming with datalog- it's machine learning of datalog programs from data. But I think it's similar to the experience you're asking for.
My group's algorithms:
Metagol (a meta-interpretive learner for definite datalog programs):
https://github.com/metagol/metagol
Louise (a polynomial-time version of Metagol):
> The space of hypotheses doubles in size when negation as failure is allowed, which improves the efficiency of the search for hypotheses.
That line confused me. Shouldn't a double in the search space decrease the efficiency of the search for the hypothesis?
I am an more on the applied maths camp rather than the CS camp but I feel a practical and effective merger of logic and probabilistic reasoning is sorely needed to climb out of the rut we are in.
Neural Turing is all nice and dandy but it seems a very heavy handed way of expressing/learning dependencies.
The work I described falls under the category of Inductive Logic Programming, a field at the intersection of machine learning and logic programming. In ILP (as in logic programming) it's typical to restrict the expressivity of first-order languages to improve efficiency and to guarantee termination.
Such restrictions often apply primarily to theoretical results, while in practice there is more freedom. For example, my group's algorithms can learn normal programs in practice, but our theoretical results only guarantee termination (and so, learnability) of definite datalog programs.
In general, it takes a lot of work to find a representation language that is expressive enough to allow learing of interesting and useful programs, and at the same time, restricted enough to guarantee those programs _can_ be learned.
>> The space of hypotheses doubles in size when negation as failure is allowed, which improves the efficiency of the search for hypotheses
I'm sorry if this was confusing. I meant that restricting hypotheses to definite programs improves efficiency compared to allowing normal programs (with negation as failure). The reason is that, if negation as failure is allowed, in the worst case, an algorithm must consider both a literal and its negation for inclusion in a clause, which doubles the cost of search for a hypothesis.