Live data from Hacker News

The Power of Prolog

metalevel.at

1–10 of 164 posts

Re: The Power of Prolog

#2
Roughly half the 'power of prolog' comes from the 'power of logic programming' and prolog is by far not the only logic programming language, e.g.,

- You can do logic programming using minikanren in scheme. (you can also extend the minikanren system if you find a feature missing).

- Minikanren was implemented in clojure and called core.logic.

- It was also ported to python by Matthew Rocklin I think, called logpy.

- There is also datalog, with pydatalog it's python equivalent.

- Also pyke. And so on.

Plus logic programming has very important (arguably necessary) extensions in the form of constraint-logic-programming (CLP), inductive-logic-programming (ILP), and so on.

It's a huge area.

EDIT: ILP at an advanced level starts making connections with PGMs (probabilistic graphical models) and hence machine learning, but its a long way to go for me (in terms of learning) before I start to make sense of all these puzzle pieces.

EDIT 2: You can have a taste of logic programming without leaving your favorite programming language. Just try to solve the zebra puzzle [1] (without help if you can, esp. through any of Norvig posts or videos; they're addictive).

[1] https://en.wikipedia.org/wiki/Zebra_Puzzle

EDIT 3: An "expert system" (a term from the 1980s) is largely a logic programming system paired up with a huge database of facts (and probably some way of growing the database by providing an entry method to non-programmer domain experts).

EDIT 4: In other words, logic programming (along with other things like graph search etc) is at the core of GOFAI (good old fashioned AI), the pre-machine-learning form of AI, chess engine being a preeminent example of it.

Re: The Power of Prolog

#4
Never understood why natural numbers (or some set of N) is not in the search space:

fib(X,X):- Xfib(X,Y1+Y2):- fib(X-1,Y1),fib(X-2,Y2).

I tried to get answer to this kwestion in reddit, but all I got was personal insults.

Re: The Power of Prolog

#6
post #4

Never understood why natural numbers (or some set of N) is not in the search space: fib(X,X):- X fib(X,Y1+Y2):- fib(X-1,Y1),fib(X-2,Y2). I tried to get answer to this kwestion in reddit, but all I got was personal insults.

You can do this in SWI Prolog using the between/3 predicate for the inequality, and the is/2 predicate for the arithmetic.

Re: The Power of Prolog

#7
post #3

One of the nicest examples of the power of prolog is that Windows NT contained a prolog implementation to take care of network configuration, replacing the previous codebase: http://www.redditmirror.cc/cache/websites/web.archive.org_84...

My one regret in a project at work (internal tool) was that I didn't persuade management to let me use an embedded prolog in the application. Instead I rewrote half of Prolog (badly) in C#.

Re: The Power of Prolog

#8
post #2

Roughly half the 'power of prolog' comes from the 'power of logic programming' and prolog is by far not the only logic programming language, e.g., - You can do logic programming using minikanren in scheme. (you can also extend the minikanren system if you find a feature missing). - Minikanren was implemented in clojure and called core.logic. - It was also ported to python by Matthew Rocklin I think, called logpy. - T…

>Zebra puzzle

Interesting puzzle. I copied the puzzle text to a separate text file so that one does not accidentally read anything else in the Wikipedia article.

https://pastebin.com/0DWbSSx3

Re: The Power of Prolog

#9
post #3

One of the nicest examples of the power of prolog is that Windows NT contained a prolog implementation to take care of network configuration, replacing the previous codebase: http://www.redditmirror.cc/cache/websites/web.archive.org_84...

Also in applications with Prologue interpreters: you can express patch submitability predicates in Prolog for the Gerrit code review system.

Lets you automate arbitrary boring code submission prerequisite checks (e.g. "you must have a 'Verified' from a maintainer and a 'Code-Review +1' from 1 other person. If you are not the author and the author's email address doesn't end in @example.com you must have an 'IP-Reviewed' from a manager")

https://gerrit-review.googlesource.com/Documentation/prolog-...

Re: The Power of Prolog

#10
post #2

Roughly half the 'power of prolog' comes from the 'power of logic programming' and prolog is by far not the only logic programming language, e.g., - You can do logic programming using minikanren in scheme. (you can also extend the minikanren system if you find a feature missing). - Minikanren was implemented in clojure and called core.logic. - It was also ported to python by Matthew Rocklin I think, called logpy. - T…

It still seems fairly untapped in enterprise and entrepreneurial circles, too. I've been wanting to create a side project that is sort of like an expert system, except where users can create the rules as well as the facts, and that is also horizontally scalable (which doesn't seem to be a good fit for the Rete algorithm). So I'm not sure if I'm looking for some sort of jvm-runtime logic programming system that can be combined with a graph database or what.
Post reply on HN