←back to thread

Learn Prolog Now

(lpn.swi-prolog.org)
226 points rramadass | 1 comments | | HN request time: 0s | source
Show context
disambiguation ◴[] No.45902807[source]
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. LLMs are good at writing prolog that solves reasoning problems.

Common replies:

1. The bitter lesson.

2. There are better solvers, ex. Z3.

3. Someone smart must have already tried and ruled it out.

Successful experiments:

1. https://quantumprolog.sgml.net/llm-demo/part1.html

replies(15): >>45903080 #>>45903178 #>>45903192 #>>45903204 #>>45903228 #>>45903263 #>>45903361 #>>45903376 #>>45903458 #>>45903841 #>>45904155 #>>45904166 #>>45904490 #>>45906435 #>>45907115 #
jodrellblank ◴[] No.45903192[source]
> "4. Prolog is good at solving reasoning problems."

Plain Prolog's way of solving reasoning problems is effectively:

    for person in [martha, brian, sarah, tyrone]:
      if timmy.parent == person:
        print "solved!"
You hard code some options, write a logical condition with placeholders, and Prolog brute-forces every option in every placeholder. It doesn't do reasoning.

Arguably it lets a human express reasoning problems better than other languages by letting you write high level code in a declarative way, instead of allocating memory and choosing data types and initializing linked lists and so on, so you can focus on the reasoning, but that is no benefit to an LLM which can output any language as easily as any other. And that might have been nice compared to Pascal in 1975, it's not so different to modern garbage collected high level scripting languages. Arguably Python or JavaScript will benefit an LLM most because there are so many training examples inside it, compared to almost any other langauge.

replies(6): >>45903331 #>>45903911 #>>45904372 #>>45905822 #>>45906071 #>>45907029 #
nuc1e0n ◴[] No.45903331[source]
What makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?
replies(4): >>45903373 #>>45903697 #>>45904109 #>>45906445 #
mkirsten ◴[] No.45903373{3}[source]
Can you try calculating 101 * 70 in your head?
replies(4): >>45903488 #>>45903556 #>>45904347 #>>45907080 #
ang_cire ◴[] No.45903556{4}[source]
Um, that's really easy to do in your head, there's no carrying or anything? 7,070

7 * 101 = 707 * 10 = 7,070

And computers don't brute-force multiplication either, so I'm not sure how this is relevant to the comment above?

replies(2): >>45904373 #>>45904833 #
1. jabbywocker ◴[] No.45904833{5}[source]
It’s almost like you’re proving the point of his reply…