First-Order Logic

Started by
3 comments, last by mnansgar 18 years, 10 months ago
Hi, I took an AI course a couple years ago but had to pretty much rush through it so I didn't feel like I really had time to learn anything useful. I've been going back through the book now so that I can get a better idea of how to program an agent that uses a knowledgebase to perform decisions. I used the Russell/Norvig book and it has a sample idea of a game called "Wumpus". Unfortunately, it doesn't have any real examples of how to develop it but I did find a place that you could download a FOL parser that was written in java based on the book but it has too many problems and doesn't work properly. I've also found several pieces of source code for this "Wumpus" game but none of them actually use a knowledgebase, they all just do things like "if block->hasWumpus() { your_dead(); }" kind of things. What I would really like is to find some implementation of a knowledgebase that I could feed strings in FOL format that would be able to use forward chaining to make decisions. I would liek to be able to say something like: HasWumpus(x) => NextTo(x, y) AND Smelly(y) NextTo(Loc13, Loc12) NextTo(Loc13, Loc14) HasWumpus(Loc13) then forward chaining, I should be able to get the sentences: Smelly(Loc12) and Smelly(Loc14) ---------- If this stuff is really not useful in the real world, please let me know because I don't want to waste time trying to learn things that aren't useful. I want to get deeper into the world of AI, but I learn best by trying things and most of the course that I took was just theory, so I pretty much forgot most of it since I wasn't able to use any of it. Thanks! -- Rocky
Advertisement
Prolog is what you need. Don't bother trying to do this stuff in Java, it's really the wrong tool for the job.
I saw an article once, from 1998, that described an idea they had for an AI to be used in a game that was based in a reward/punishment system in which both of the AIs didn't know what was to be done, but tried to achieve the way to get the most reward out of the game...

In that article they used Sicstus-Prolog embended in a C++ application (even though they did make there own Prolog implementation afterwards with less features, so that it'd ran faster). I think that there are other Prolog systems that can interact with other languages... I think that Swi-prolog has the ability to interface with C and Java (a wrapper), but I'm not sure...

Prolog for AI is a great tool, even if isn't used a lot in games...
Yeah, I think nearly all modern Prolog systems provide a way to interact with other, more widely used, languages.
Like the other posters, I recommend using a more appropriate language such as Prolog, but if you insist on using C there are several possibilities. For instance, one popular system of inputting well-formed first-order logic formulas is STRIPS, which was originally developed at Stanford and is now often used for planning problems (which if you think about it boils down to automatic theorem proving). A popular planner which has the ability to read in STRIPS files is FF (Fast Forward), so you could likely borrow its parser. Another way to read in first-order logic is by looking at the ways that automatic theorem provers input their formulas then borrow their code and input representation (try Google -- there are lots of these available).
h20, member of WFG 0 A.D.

This topic is closed to new replies.

Advertisement