Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

181–190 of 251 posts

Re: Learn Prolog Now (2006)

#181

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…

Prolog doesn't look like javascript or python so: 1. web devs are scared of it. 2. not enough training data? I do remember having to wrestle to get prolog to do what I wanted but I haven't written any in ~10 years.

>>Prolog doesn't look like javascript or python so:

Think of this way. In Python and Javascript you write code, and to test if its correct you write unit test cases.

A prolog program is basically a bunch of test cases/unit test cases, you write it, and then tell the Prolog compiler, 'write code, that passes these test cases'.

That is, you are writing the program specification, or tests that if pass would represent solution to the problem. The job of the compiler to write the code that passes these test cases.

Re: Learn Prolog Now (2006)

#182

Earlier quoted context omitted.

> Also, that you push Python and JavaScript I didn't push them. > Those are terrible languages to try to graft to anything. Web browsers, Blender, LibreOffice and Excel all use those languages for embedded scripting. They're fine. > Just because you only know those 2 languages doesn't make them good choices for something like this. You misunderstood my claim and are refuting something different. I said there is more…

I'm not. Python and JS are scripting languages. And in this case, we want something that models formal logic. We are hammering in a nail, you picked up a screwdriver and I am telling you to use a claw hammer.

What does this comment even mean? A claw hammer? By formal definitions, all 3 languages are Turing complete and can express programs of the same computational complexity.

Re: Learn Prolog Now (2006)

#183
post #90

Earlier quoted context omitted.

IIRC IBM’s Watson (the one that played Jeopardy) used primitive NLP (imagine!) to form a tree of factual relations and then passed this tree to construct Prolog queries that would produce an answer to a question. One could imagine that by swapping out the NLP part with an LLM, the model would have 1. a more thorough factual basis against which to write Prolog queries and 2. a better understanding of the queries it sh…

Please tell me that's approximately what Palantir Ontology is, because if it isn't, I've no idea what it could be.

https://www.palantir.com/docs/foundry/ontology/overview/

Re: Learn Prolog Now (2006)

#184

Earlier quoted context omitted.

Everything you've written here is an invalid over-reduction, I presume because you aren't terribly well versed with Prolog. Your simplification is not only outright erroneous in a few places, but essentially excludes every single facet of Prolog that makes it a turing complete logic language. What you are essentially presenting Prolog as would be like presenting C as a language where all you can do is perform operati…

The original suggestion was that LLMs should emit Prolog code to test their ideas. My reply was that there is nothing magic in Prolog which would help them over any other language, but there is something in other languages which would help them over Prolog - namely more training data. My example was to illustrate that, not to say Prolog literally is Python. Of course it's simplified to the point of being inaccurate,…

This is a philosophical argument.

The way to look at this is first to pin down what we mean when we say Human Commonsense Reasoning (https://en.wikipedia.org/wiki/Commonsense_reasoning). Obviously this is quite nebulous and cannot be defined precisely but OG AI researchers have a done a lot to identify and formalize subsets of Human Reasoning so that it can be automated by languages/machines.

See the section Successes in automated commonsense reasoning in the above wikipedia page - https://en.wikipedia.org/wiki/Commonsense_reasoning#Successe...

Prolog implements a language to logically interpret only within a formalized subset of human reasoning mentioned above. Now note that all our scientific advances have come from our ability to formalize and thus automate what was previously only heuristics. Thus if i were to move more of real-world heuristics (which is what a lot of human reasoning consists of) into some formal model then Prolog (or say LLMs) can be made to better reason about it.

See the paper Commonsense Reasoning in Prolog for some approaches - https://dl.acm.org/doi/10.1145/322917.322939

Note however the paper beautifully states at the end;

Prolog itself is all form and no content and contains no knowledge. All the tasks, such as choosing a vocabulary of symbols to represent concepts and formulating appropriate sentences to represent knowledge, are left to the users and are obviously domain-dependent. ... For each particular application, it will be necessary to provide some domain-dependent information to guide the program writing. This is true for any formal languages. Knowledge is power. Any formalism provides us with no help in identifying the right concepts and knowledge in the first place.

So Real-World Knowledge encoded into a formalism can be reasoned about by Prolog. LLMs claim to do the same on unstructured/non-formalized data which is untenable. A machine cannot do "magic" but can only interpret formalized/structured data according to some rules. Note that the set of rules can be dynamically increased by ML but ultimately they are just rules which interact with one another in unpredictable ways. Now you can see where Prolog might be useful with LLMs. You can impose structure on the view of the World seen by the LLM and also force it to confine itself only to the reasoning it can do within this world-view by asking it to do predominantly Prolog-like reasoning but you don't turn the LLM into just a Prolog interpreter. We don't know how it interacts with other heuristics/formal reasoning parts (eg. reinforcement learning) of LLMs but does seem to give better predictable and more correct output. This can then be iterated upon to get a final acceptable result.

PS: You might find the book Thinking and Deciding by Jonathan Baron useful for background knowledge - https://www.cambridge.org/highereducation/books/thinking-and...

Re: Learn Prolog Now (2006)

#185

Earlier quoted context omitted.

I'm not. Python and JS are scripting languages. And in this case, we want something that models formal logic. We are hammering in a nail, you picked up a screwdriver and I am telling you to use a claw hammer.

What does this comment even mean? A claw hammer? By formal definitions, all 3 languages are Turing complete and can express programs of the same computational complexity.

But we kinda don't use python for a database query over sql do we?

Re: Learn Prolog Now (2006)

#190

Earlier quoted context omitted.

What does this comment even mean? A claw hammer? By formal definitions, all 3 languages are Turing complete and can express programs of the same computational complexity.

But we kinda don't use python for a database query over sql do we?

I use an ORM every day.
Post reply on HN