Remix.run Logo
TheRoque 13 hours ago

I remember learning it in univerisity. It's a really weird language to reason with IMO. But really fun. However I've heard the performances are not that good if you wanna make e.g. game AIs with it.

pjmlp 13 hours ago | parent | next [-]

First of all, it helps to actually use a proper compiled Prolog implementation like SWI Prolog.

Second you really need to understand and fine tune cuts, and other search optimization primitives.

Finally in what concerns Game AIs, it is a mixture of algorithms and heuristics, a single paradigm language (first order logic) like Prolog, can't be a tool for all nails.

dyingkneepad 8 hours ago | parent | prev | next [-]

I also learned Prolog in the university.

In the Classsic AI course we had to implement gaming AI algorithms (A*, alpha-beta pruning, etc) and in Prolog for one specific assignment. After trying for a while, I got frustrated and asked the teacher if I could do it in Ruby instead. He agreed: he was the kind of person who just couldn't say no, he was too nice for his own good. I still feel bad about it.

Rest In Peace, Alexandre.

iberator 6 hours ago | parent [-]

How is this fair to others?!

laksjhdlka 12 hours ago | parent | prev | next [-]

With λProlog in particular I think it probably finds most of its use in specifying and reasoning about systems/languages/logics, e.g. with Abella. I don't think many people are running it in production as an implementation language.

OneDeuxTriSeiGo 10 hours ago | parent [-]

Yeah the main use of it is probably in ELPI which is a higher order structural reasoning and AST transform tool for Coq/Rocq.

tannhaeuser 8 hours ago | parent | prev | next [-]

The term "AI" has changed in recent years but if you mean classic game logic such as complex rules and combinatorial opponents then there's plenty of Prolog game code on github eg. for Poker and other card or board games. Prolog is also as natural a choice for adventure puzzles as it gets with repository items and complicated conditions to advance the game. In fact, Amzi! Prolog uses adventure game coding as a topic for its classic (1980s) introductory Prolog learning book Adventure in Prolog ([1]). Based on a cursory look, most code in that book should run just fine on a modern ISO Prolog engine ([2]) in your browser.

[1]: https://www.amzi.com/AdventureInProlog/advtop.php

[2]: https://quantumprolog.sgml.net

ux266478 11 hours ago | parent | prev | next [-]

> It's a really weird language to reason with IMO

I know you likely mean regular Prolog, but that's actually fairly easy and intuitive to reason with (code dependent). Lambda Prolog is much, much harder to reason about IMO and there's a certain intractability to it because of just how complex the language is.

cubefox 8 hours ago | parent [-]

What would be some applications it handles better than regular Prolog? Something that naturally requires second or higher order logic rather first order logic?

ux266478 7 hours ago | parent [-]

Lambda Prolog isn't a "pure" HOL. It's a very restricted form of HOL using Higher-Order Hereditary Herrop formulas, granting us pretty solid generalized mechanisms of implication and universal quantification, which itself more or less means we get contextual reasoning and scoping rules baked into the grammar for free.

Implementing other programming languages and proving theorems are the low-hanging fruits since you get variable binding without name management, but I genuinely think it has profound implications for expert systems since it essentially removes a massive amount of complexity from contextual reasoning. Being able to account for patient history when providing a diagnosis, for example.

anonzzzies 13 hours ago | parent | prev [-]

λProlog or Prolog? Probably Prolog I guess?

TheRoque 10 hours ago | parent | next [-]

My bad. Was regular prolog yeah

wbolt 12 hours ago | parent | prev [-]

No. It is actually λProlog which seems to be an extension of Prolog.

anonzzzies 12 hours ago | parent | next [-]

I was responding to @TheRoque GP; I know λProlog quite well and I would be pleasantly surprised if they saw that in university, but I think they got taught Prolog. If you mean to say that they saw Lambda Prolog and it is therefor a lot more popular than I believed it to be, then excellent and ignore this reply.

ux266478 11 hours ago | parent | prev [-]

Not at all, it's a completely different language with a very different computational foundation. It's an SML-Haskell type situation.