http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-a...
?- applicationof(prolog, X), domain(X, Y), nonai(Y).
I'm not sure what you mean by this. Do you mean people? I don't think our 'inference engine' is much like Prolog, no.
--is what he means.
> Yes, they do have engines similar to those found in planes, cars, etc. and so do humans - fuel goes in, chemistry happens, and energy is provided for physical movement in the form of rotation, flapping, or one foot in front of the other.
Idk who I agree with, I suppose it's a fairly pointless exercise in 'how similar constitutes 'similar'' all the way down.
Our strategies for understanding language also involve inference and unification that is similar to logic programming. This is not to say the exact semantics and evaluation strategy of Prolog is what humans carry around, but part of our cognitive apparatus clearly operates in a manner similar to logic, and by extension Prolog.
I discussed this topic with one of the inventors of Prolog recently: https://thesearch.space/episodes/1-the-poet-of-logic-program...
"Intelligence" is a vague term, but if you mean the ability to act rationally or even in a coherently self-interested way, then surely logic has something to do with it.
Obviously I could very easily be wrong, and we could possess hard coded rules of logical inference which form part of the basis for all the other things we do that you might call intelligence. But I'm not sure that anyone should claim "a general artificial intelligence would require a logical inference engine similar to Prolog".
However, Inference-based A.I. is actually needed to properly tackle many of the business problems that are being thrown at ML systems today. Explainability and bias reduction can probably only be be taken so far with the current approaches, and I suspect that this "so far" is not far enough for many tasks. It's definitely the case from a practical standpoint today.
So inference-based A.I. is due for a comeback indeed, but I'd say AGI is looking like one of the main areas where the current techniques might work.
It's almost more of a cultural issue than a technical one. The level of explainability currently desired from automated systems is possibly not achievable, simply because we want to uphold them to a different standard.
I think it will come back in programming tools / program synthesis though. There are many use cases for it and not enough people using in production.
would you mind expanding on this?
it's been on my backburner to learn prolog, but i have gotten a sense that it could be useful as a side-tool during development.
See https://youtu.be/OyfBQmvr2Hc (skip to 1h mark to see some examples)
At some point, you have partial answers for everything, depending on what flows users have gone through, in what order, and what the validation requirements of those forms were at that time.
Logic engines can answer questions like: Do we need to ask the user for more info for the Invest In XYZ flow? If so, which forms will supply the needed information?
- business payment logic that fits prolog perfectly.
- no buy-in whatsoever for prolog.
In the end, they bought a rules engine.
Ignorance is bliss I guess.Highly regular logic is better expressed in generalizations, and inferable logic is better expressed in a compressed, normalized fashion rather than repeated and duplicated.
The more irregular logic becomes, the more it fights generalization and needs special cases. The ultimate special case is a programming language (and code is data too!). The risk in expressing rules in the form of data is that to handle all edge cases, you encode a custom programming language without all the resources that supports programming languages, like editors, debuggers, source control, developer mindshare, stack overflow, etc. But not all logic is irregular enough to warrant it.
SQL is a deductive logic engine (same maths root as prolog IIRC, predicate calculus) but to bend it to work outside its domain, well the one time I tried it didn't work out so I'm extremely interested in what you did - TIA!
I was hired on to the team about 3 years after the nightmare tipping point. There were no tests. There were no real expected outcomes. Just angry customers sometimes. And angry product managers who were still pointing at the original workflow diagram telling us to just make it do that. And there were people who had been dealing with it who were all, "Yeah, that's not even close anymore."
So instead of trying to solve all that mess of code, I backed up the chain a little bit and looked at things from the point of view of what variables are getting passed into this shitshow and what are their possible valid values. I came up with about a dozen that matter. Really variable variables like the dollar amount of a transaction don't really matter. It's other things like has this transaction settled? Is this a chargeback? Etc. Lots of binary switches. Some of them could have 3-4 legit dispositions. But if you look at their sources and what they imply, the possible valid states isn't the combination of all possible positions of all 12 variables. Some of them are exclusive. So I figured out that there's about 100-ish valid ways for these 12 variables to be arranged. And that only those 12 variables were actually driving all the logical outcomes.
At that point I was able to go to the product managers with a spreadsheet and say, "Okay. Tell me what's supposed to happen when a=True, b=3, c=debit, d=whatever, etc." They would go huddle up for a day or two and then come back with an answer. X, Y, and Z should happen, but not A and B, and not-not-C. And over time we were able to get a mapping from all valid states to all valid outcomes.
We all know what a finite state machine is, and it would be trivial to implement in any language. But in this case, lots of different systems needed to be able to work with this, and the only thing they had in common was the ability to connect to the database. So that's where we did it.
I had two tables. One was the rule and one was the outcome. Each row of the rule table had vars/values of a valid state and a foreign key to the outcome table it mapped to. The outcome table columns where the names of transformation functions and bool flags on them. So the process was 1) query for the relevant variables, 2) bounce them off the rule table to find a match or error on no match (which was useful in finding bugs higher up the call chain), 3) query the outcome table from the foreign key and get the values of the transformations, 4) push all of that into a stored proc that had a totally flat if/else chain 5) exec state transformations where indicated. Very easy to grok, not hard to implement, and as I said, the rules and outcomes could be added to or changed very easily by the people who were expert in understanding the business rules.
I hope that's enough detail to be useful to the people who were asking for it. I don't really want to be more specific. I think it would be crude and maybe a tad unprofessional to go deeper than that.
If I may, however, I want to respond to the person that said logic wants to be code and not data. And that it's risky to do otherwise. Without getting on a LISPy high horse (I've ridden that horse only a few times), I disagree. Sometimes logic drives data and sometimes data drives logic. I don't think there's as clear a distinction as you are suggesting, and I don't understand how you draw the line.
E.g., if a ======== 1{ //No seriously, I mean really really equal return a }
What's happening here? Is your logic in the driver's seat? Or is the data in the driver's seat? Who is determining the behavior? Your holy code? Or the value that gets passed to it?
I feel like arguing about data and code is like arguing about the difference between putting a net in place on a river and letting the fish get caught and dragging a net behind a boat so fish get caught.
But I'm not going to dwell on it too much. I think it's kind of silly to get dogmatic about it.
For a while I was extremely fascinated by SAT as an encoding for hard problems that somehow had heuristic fast solvers; particularly by SATPLAN, the blocks world, etc.
But there's an useful contrast with Lisp, the other thing everyone within a radius of HN would like to emerge as winner. Lisp is essentially a syntax concept. It isn't particularly opinionated about problems -- on the opposite, it's indefinitely extensible to accomodate nearly everything. So we have Clojure and Hy (a Lisp that superficially imitates Clojure but compiles to the Python AST) and people doing scikit-learn ML on Lisp.
Logic programming, on the other hand, wants problems to be formulated on its terms. It needs the world itself to change to "win big". Of course logic programming problems aren't going to disappear, as sparse linear algebra programs won't. But this isn't a paradigm, it's an application.
https://www.metalevel.at/acomip/ (A Couple of Meta-interpreters in Prolog)
and
As always, best to choose the tool / language that best suits the problem.
https://gerrit-review.googlesource.com/Documentation/prolog-...
Slides: https://software.imdea.org/Conferences/CICLOPS2017/files/tar...
Paper: https://drops.dagstuhl.de/opus/volltexte/2018/8453/pdf/OASIc...
- - - -
The canonical method is teh WAM: https://en.wikipedia.org/wiki/Warren_Abstract_Machine
https://dev.to/arcanis/introducing-yarn-2-4eh1#workspace-con...
(Reminds me I've got to get to work on it! Anybody ping me if you want to help.)
There was a (unlikely to be merged at least in its current form) proposal for Kotlin -> https://github.com/Kotlin/KEEP/pull/199/files
Maybe LINQ from .NET could be included
There is also chalk from Rust https://github.com/rust-lang/chalk
LINQ is extensible and you can connect it to arbitrary data sources by writing a query provider.
awesome-linq[0] has some examples of what can be done with it.
I think if they came out with a version in hardware like they use to have lisp machines, it would have much better performance.