by disambiguation
18 subcomments
- 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
- 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 bunker easily missed. A supercomputer with the REPL's cursor flickering away in monochrome phosphor. It's sitting there, forgotten. Dutifully waiting for you to jack in.
by mattbettinson
3 subcomments
- In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
by droningparrot
0 subcomment
- I had more success with the Prolog language track on https://exercism.org/tracks/prolog
It's a mind-bending language and if you want to experience the feeling of learning programming from the beginning again this would be it
- My prolog anecdote: ~2001 my brother and I writing an A* pathfinder in prolog to navigate a bot around the world of Asheron's Call (still the greatest MMORPG of all time!). A formative experience in what can be done with code. Others had written a plugin system (called Decal) in C for the game and a parser library for the game's terrain file format. We took that data and used prolog to write an A* pathfinder that could navigate the world, avoiding un-walkable terrain and even using the portals to shortcut between locations. Good times.
by myth_drannon
0 subcomment
- Two Prolog books that I find very interesting:
Advanced Turbo prolog -
https://archive.org/details/advancedturbopro0000schi/mode/2u...
Prolog programming for artificial intelligence -
https://archive.org/details/prologprogrammin0000brat_l1m9/mo...
by eatsleepmonad
1 subcomments
- 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.
- There seems to an interesting difference between Prolog and conventional (predicate) logic.
In Prolog, anything that can't be inferred from the knowledge base is false. If nothing about "playsAirGuitar(mia)" is implied by the knowledge base, it's false. All the facts are assumed to be given; therefore, if something isn't given, it must be false.
Predicate logic is the opposite: If I can't infer anything about "playsAirGuitar(mia)" from my axioms, it might be true or false. It's truth value is unknown. It's true in some model of the axioms, and false in others. The statement is independent of the axioms.
Deductive logic assumes an open universe, Prolog a closed universe.
- I only read the first 88 pages of Prolog Programming in Depth but I found it to be the best introductory book for programming in Prolog because it presents down to earth examples of coding like e.g. reading a file, storing data. Most other books are mainly or only focused on the pure logic stuff of Prolog but when you program you need more.
Another way of getting stuff done would be to use another programming language with its standard library (with regex, networking, json, ...) and embed or call Prolog code for the pure logic stuff.
- I've recently started modeling some of my domains/potential code designs in Prolog. I'm not that advanced. I don't really know Prolog that well. But even just using a couple basic prolog patterns to implement a working spec in the 'prolog way' is *unbelievably* useful for shipping really clean code designs to replace hoary old chestnut code. (prolog -> ruby)
- 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
by waynecochran
1 subcomments
- I remember writing a Prolog(ish) interpreter in Common Lisp in an 90's AI course in grad school for Theorem proving (which is essentially what Prolog is doing under the hood). Really foundational to my understanding of how declarative programming works. In an ideal world I would still be programming in Lisp and using Prolog tools.
by _spduchamp
0 subcomment
- I remember a project I did in undergrad with Prolog that would fit connecting parts of theoretical widgets together based on constraints about how different pieces could connect and it just worked instantly and it felt like magic because I had absolutely no clue how I would have coded that in Pascal or COBOL at that time. It blew my mind because the program was so simple.
- Prolog is easily one of my favorite languages, and as many others in this thread, I first encountered it during university. I ended up teaching it for a couple of years (along with Haskell) and ever since, I've gone on an involuntary prolog bender of sorts once or twice a year. I almost always use it for Advent of code as well.
- Hah. Found this book back at my dad's this past winter: https://imgur.com/a/CyG1E2P
Had never heard of it before, and this is first I'm hearing of it since.
Also had other cool old shit, like CIB copies of Borland Turbo Pascal 6.0, old Maxis games, Windows 3.1
- 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 parallel implementations such as BigQuery, Trino and to some extent DuckDB. And what about adding a CUDA backend?
But all this comes at a cost and needs to be planned so it is only used when needed.
- Previously:
Learn Prolog Now - https://news.ycombinator.com/item?id=9246897 - March 2015 (72 comments)
Learn Prolog now - https://news.ycombinator.com/item?id=1976127 - Dec 2010 (31 comments)
- How many Prolog programmers does it take to change a lightbulb?
No.
- I'll never understand how it's a programming language not a graph database with query language. It's more MongoDb than Fortran.
by dukeofdoom
1 subcomments
- Always felt this would be language that Sherlock Holmes would use...so be sure to wear the hat when learning it
- That's it, I'm convinced. Now I'm doing my next startup in Prolog.
- 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.
- There are declarative languages like SQL and XSLT.
And then there are declarative languages like Prolog.
- I really enjoyed learning Prolog in university, but it is a weird language. I think that 98% of tasks I would not want to use Prolog for, but for that remaining 2% of tasks it's extremely well suited for. I have always wished that I could easily call Prolog easily from other languages when it suited the use case, however good luck getting most companies to allow writing some code in Prolog.
by shevy-java
0 subcomment
- But I don't wanna!
- I love Prolog, and have seen so many interesting use cases for it.
In the end though, it mostly just feels enough of a separate universe to any other language or ecosystem I'm using for projects that there's a clear threshold for bringing it in.
If there was a really strong prolog implementation with a great community and ecosystem around, in say Python or Go, that would be killer. I know there are some implementations, but the ones I've looked into seem to be either not very full-blown in their Prolog support, or have close to non-existent usage.
by DeathArrow
7 subcomments
- What kind of problems is Prolog helping to solve besides GOFAI, theorem proving and computational linguistics?
by wodenokoto
1 subcomments
- The background image says "testing version" - is there a production version?
- Learn Datalog Now!
by jackallis
6 subcomments
- is prolog a use-case language or is it as versatile as python?
- Is there a WebAssembly WASI version of swi prolog ?
- Learn it now? I learned back in the 80s... and have since forgotten
- yes
- [flagged]
- Farts:
- We had it in university courses and it seemed useless. DSL for backtracking.