Live data from Hacker News

Ask HN: Production Prolog in 2020?

news.ycombinator.com

21–30 of 72 posts

Re: Ask HN: Production Prolog in 2020?

#21
post #3

I think Prolog and logic programming will have a second renaissance. I think at the very least a general artificial intelligence would require a logical inference engine similar to Prolog.

Do any of the non-artificial intelligences walking around out there contain a logical inference engine similar to Prolog?

Yes. Logic wasn't conjured up from abstract ideas, but from a concerted effort to distill the essence of what humans (regular, average people) find reasonable and convincing. (To mention just one example, there is a reason one of George Boole's major works is called "The Laws of Thought".)

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...

Re: Ask HN: Production Prolog in 2020?

#22

There was a minor hype cycle with SMT solvers in 2019. 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 abou…

Prolog-style logic programming is very different from SAT, SMT and Answer Set Programming in this regard. Prolog has the same features that you describe in Lisp. It's homoiconic, infinitely malleable, meta-level programming is trivial, etc. I recommend having a look at:

https://www.metalevel.at/acomip/ (A Couple of Meta-interpreters in Prolog)

and

https://github.com/triska/lisprolog

Re: Ask HN: Production Prolog in 2020?

#24
post #10

I have used Prolog in a few professional projects. I think if they came out with a version in hardware like they use to have lisp machines, it would have much better performance.

That was one of the ideas of the Fifth Generation Computer Systems project, started in 1982 :)

Re: Ask HN: Production Prolog in 2020?

#25

I think Prolog and logic programming will have a second renaissance. I think at the very least a general artificial intelligence would require a logical inference engine similar to Prolog.

I don’t think it will come back as AI, the statistical/differentiable approach proved much more powerful given the amount of data.

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.

Re: Ask HN: Production Prolog in 2020?

#26

Our pay software at work needs a Prolog engine (SWI). I think it's exactly where it shines : a complex logic with a lot of small rules that would be a nightmare to implement and maintain with a if / else logic.

I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.

Yes, sort of rules engine like that is really nice when you have a hodgepodge of data and purposes for it: e.g. your users may supply names, countries, ID numbers, various documents, addresses, etc — often with branching flows. (If the user is a business you collect different information than if the user is investing through an IRA or investing individually. The ID verification process wants the front and back of the document if it's a US driver's license, but it is okay with the front only if the document is a passport.)

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?

Re: Ask HN: Production Prolog in 2020?

#27

Our pay software at work needs a Prolog engine (SWI). I think it's exactly where it shines : a complex logic with a lot of small rules that would be a nightmare to implement and maintain with a if / else logic.

I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.

had exactly the same problems 15 years ago:

   - 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.

Re: Ask HN: Production Prolog in 2020?

#28

Our pay software at work needs a Prolog engine (SWI). I think it's exactly where it shines : a complex logic with a lot of small rules that would be a nightmare to implement and maintain with a if / else logic.

I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.

Well done! I would leave to read a blog post on this kind of work.

Re: Ask HN: Production Prolog in 2020?

#29

Our pay software at work needs a Prolog engine (SWI). I think it's exactly where it shines : a complex logic with a lot of small rules that would be a nightmare to implement and maintain with a if / else logic.

I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.

Do you have any more information on that technique and how you approached it? Sounds interesting.
Post reply on HN