Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

131–140 of 251 posts

Re: Learn Prolog Now (2006)

#131

I am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents. https://news.ycombinator.com/context?id=43948657 Thesis: 1. LLMs are bad at counting the number of r's in strawberry. 2. LLMs are good at writing code that counts letters in a string. 3. LLMs are bad at solving reasoning problems. 4. Prolog is good at solving reasoning problems. 5. ??? 6. LLM…

I think that's what these guys are doing

https://www.symbolica.ai/

Re: Learn Prolog Now (2006)

#132
post #95

Earlier quoted context omitted.

Of course it does "reasoning", what do you think reasoning is? From a quick google: "the action of thinking about something in a logical, sensible way". Prolog searches through a space of logical proposition (constraints) and finds conditions that lead to solutions (if one exists). (a) Trying adding another 100 or 1000 interlocking proposition to your problem. It will find solutions or tell you one doesn't exist. (b)…

Of course it doesn't "do reasoning", why do you think "following the instructions you gave it in the stupidest way imaginable" is 'obviously' reasoning? I think one definition of reasoning is being able to come up with any better-than-brute-force thing that you haven't been explicitly told to use on this problem. Prolog isn't "thinking". Not about anything, not about your problem, your code, its implementation, or an…

Its a Horn clause interpreter. Maybe lookup what that is before commenting on it. Clearly you don't have a good grasp of Computer Science concepts or math based upon your comments here. You also don't seem to understand the AI/ML definition of reasoning (which is based in formal logic, much like Prolog itself).

Python and Prolog are based upon completely different kinds of math. The only thing they share is that they are both Turing complete. But being Turing complete isn't a strong or complete mathematical definition of a programming language. This is especially true for Prolog which is very different from other languages, especially Python. You shouldn't even think of Prolog as a programming language, think of it as a type of logic system (or solver).

Re: Learn Prolog Now (2006)

#133
post #33

Prolog really is such a fantastic system, if I can justify its usage then I won't hesitate to do so. Most of the time I'll call a language that I find to be powerful a "power tool", but that doesn't apply here. Prolog is beyond a power tool. A one-off bit of experimental tech built by the greatest minds of a forgotten generation. You'd it find deep in irradiated ruins of a dead city, buried far underground in a bunke…

When I entered university for my Bachelors, I was 28 years old and already worked for 5 or 6 years as a self-taught programmer in the industry. In the first semester, we had a Logic Programming class and it was solely taught in Prolog. At first, I was mega overwhelmed. It was so different than anything I did before and I had to unlearn a lot of things that I was used to in "regular" programming. At the end of the cla…

Prolog is a great language to learn. But I wouldn't want to use it for anything more than what its directly good at. Especially the cut operator, that's pretty mind bending. But once you get good at it, it all just flows. But I doubt more than 1% of devs could ever master it, even on an unlimited timeline. Its just much harder than any other type of non-research dev work.

Re: Learn Prolog Now (2006)

#134
post #95

Earlier quoted context omitted.

Of course it does "reasoning", what do you think reasoning is? From a quick google: "the action of thinking about something in a logical, sensible way". Prolog searches through a space of logical proposition (constraints) and finds conditions that lead to solutions (if one exists). (a) Trying adding another 100 or 1000 interlocking proposition to your problem. It will find solutions or tell you one doesn't exist. (b)…

Of course it doesn't "do reasoning", why do you think "following the instructions you gave it in the stupidest way imaginable" is 'obviously' reasoning? I think one definition of reasoning is being able to come up with any better-than-brute-force thing that you haven't been explicitly told to use on this problem. Prolog isn't "thinking". Not about anything, not about your problem, your code, its implementation, or an…

The disagreement you have with the person you are relying to just boils down to a difference in the definition of "reasoning."

Re: Learn Prolog Now (2006)

#135
post #18

Earlier quoted context omitted.

I also found it mindbending. But some parts, like e.g. the cut operator is something I've copied several times over for various things. A couple of prototype parser generators for example - allowing backtracking, but using a cut to indicate when backtracking is an error can be quite helpful.

"Keep your exclamation points under control. You are allowed no more than two or three per 100,000 words of prose." Elmore Leonard, on writing. But he might as well have been talking about the cut operator. At uni I had assignments where we were simply not allowed to use it.

I used to use a cut operator about every 2 to 4 rules. If you are constantly using it as error handling, I would agree you are using it too often. If you are using it to turn sets into scalars or cells, then you are using it correctly. It just makes the code really hard to reason about and maintain.

Re: Learn Prolog Now (2006)

#137

I'll never understand how it's a programming language not a graph database with query language. It's more MongoDb than Fortran.

Because its more powerful than MongoDb or Fortran. The cut operator for instance gives it the ability to express things you just can't do in those other systems. The trade-off is that mastering the cut operator is a rare skill and only that one person who can do it can maintain the Prolog code. Compare that with MongoDb where even the village idiot can use it but with a huge performance cost.

Re: Learn Prolog Now (2006)

#139
I recently asked @grok about Prolog being useless incomprehensible shit for anything bigger than one page:

Professionals write Prolog by focusing on the predicates and relations and leaving the execution flow to the interpreter. They also use the Constraint Logic Programming extensions (like clpfd) which use smart, external algorithms to solve problems instead of relying on Prolog's relatively "dumb" brute-force search, which is what typically leads to the "exploding brain" effect in complex code.

--- Worth mentioning here is that I wrote Prolog all on my own in 1979. On top of Nokolisp of course. There was no other functioning Prolog at that time I knew about.

Thereafter I have often planned "Infinity-Prolog" which can solve impossible problem with lazy evaluation.

I just learned from @grok that this Constraint Logic is basically what was aiming at.

Re: Learn Prolog Now (2006)

#140

I'll never understand how it's a programming language not a graph database with query language. It's more MongoDb than Fortran.

Because its more powerful than MongoDb or Fortran. The cut operator for instance gives it the ability to express things you just can't do in those other systems. The trade-off is that mastering the cut operator is a rare skill and only that one person who can do it can maintain the Prolog code. Compare that with MongoDb where even the village idiot can use it but with a huge performance cost.

I don't know about MongoDB and its query language, but wrt Fortran, it's unreasonable to say that Prolog is more powerful than Fortran (or vice versa). A more reasonable statement is that Prolog is more expressive than Fortran (though this gets fuzzy, we have to define expressiveness in a way that lets us rank languages). But the power of a language normally means what we can compute using that language. Prolog and Fortran both have the same level of "power", but it's certainly fair to say that expressing many programs is easier in Prolog than Fortran, and there are some (thinking back to my scientific computing days) that are easier to express in Fortran than Prolog.
Post reply on HN