Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

151–160 of 251 posts

Re: Learn Prolog Now (2006)

#151

Earlier quoted context omitted.

I think it is very relevant, because no brute-forcing is involved in this solution.

That's not true, the 'brute force' part is searching for a shortcut that works.

The brute force got reduced down to fast heuristics, like Arthur Benjamin's Mathemagics.

Re: Learn Prolog Now (2006)

#152
post #75

Earlier quoted context omitted.

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.

It's been a while since I have done web dev, but web devs back then were certainly not scared of any language. Web devs are like the ultimate polyglots. Or at least they were. I was regularly bouncing around between a half dozen languages when I was doing pro web dev. It was web devs who popularized numerous different languages to begin with simply because delivering apps through a browser allowed us a wide variety o…

No web dev I have ever met could use Prolog well. I think your statement about web devs being polyglots is based upon the fact that web devs chase every industry fad. I think that has a lot to do with the nature and economics of web dev work (I'm not blaming the web devs for this). I mean the best way to succeed as a webdev is to write your own version of a framework that does the same thing as the last 10 frameworks but with better buzzword marketing.

Generally speaking, all the languages they know are pretty similar to each other. Bolting on lambdas isn't the same as doing pure FP. Also, anytime a problem comes up where you would actually need a weird language based upon different math, those problems will be assigned to some other kind of developer (probably one with a really strong CS background).

Re: Learn Prolog Now (2006)

#153
post #66

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…

We've done this, and it works. Our setup is to have some agents that synthesize Prolog and other types of symbolic and/or probabilistic models. We then use these models to increase our confidence in LLM reasoning and iterate if there is some mismatch. Making synthesis work reliably on a massive set of queries is tricky, though. Imagine a medical doctor or a lawyer. At the end of the day, their entire reasoning proces…

The next step is can in solve the Wicked Problems

https://en.wikipedia.org/wiki/Wicked_problem

Re: Learn Prolog Now (2006)

#154

I studied prolog back in 2014. It was used in AI course. I found it very confusing: trying to code A*, N-Queens, or anything in it was just too much. Python, in contrast, was a god-send. I failed the subject twice in my MSc (luckily passing the MSc was based on the total average), but did a similar course in UC Berkeley, with python: aced it, loved it, and learned a lot. Never again :D

It's a query language for graph database. You can write A* and N-Queens in SQL, but why?

Performance, far better performance. Same reason you ever use SQL. Prolog can do the same thing for very specific problems.

PS Prolog is a Horn clause solver. You characterizing it as a query language for a graph database, well it doesn't put you in the best light. It makes it seem like you don't understand important foundational CS math concepts.

Re: Learn Prolog Now (2006)

#155

Declarative languages are fantastic to reason about code. But the true power is unlocked once the underlying libraries are implemented in a way that surpassesthe performance that a human can achieve. Since implementation details are hidden, caches and parallelism can be added without the programmer noticing anything else than a performance increase. This is why SQL has received a boost the last decade with massively…

Look into Futhark, its a pure FP language (based on ML, ick) that outputs CUDA.

Re: Learn Prolog Now (2006)

#156
I recently implemented an eagerly evaluated embedded Prolog dialect in Dart for my game applications. I used SWI documentation extensively to figure out what to implement.

But I think I had the most difficulty designing the interface between the logic code and Dart. I ended up with a way to add "Dart-defined relations", where you provide relations backed dynamically by your ECS or database. State stays in imperative land, rules stay in logic land.

Testing on Queens8, SWI is about 10,000 times faster than my implementation. It's a work of art! But it doesn't have the ease of use in my game dev context as a simple Dart library does.

Re: Learn Prolog Now (2006)

#157

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 prolog is the right format to codify expertise in Claude Skills. I just haven’t tested it yet.

Re: Learn Prolog Now (2006)

#158

Earlier quoted context omitted.

> "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 bet…

Its a Horn clause resolver...that's exactly the kind of reasoning that LLMs are bad at. I have no idea how to graft Prolog to an LLM but if you can graft any programming language to it, you can graft Prolog more easily. Also, that you push Python and JavaScript makes me think you don't know many languages. Those are terrible languages to try to graft to anything. Just because you only know those 2 languages doesn't m…

> 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 training data for LLMs to use to generate Python and JavaScript, than Prolog.

Re: Learn Prolog Now (2006)

#159

Earlier quoted context omitted.

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 F…

I would say most programs are easier in Fortran. But there are things you can't express in Fortran but you can in Prolog. There is nothing like the cut operator in Fortran for example. They are very different animals.

Re: Learn Prolog Now (2006)

#160

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.

There's also another difference. MongoDb and Fortran served a purpose.
Post reply on HN