http://www.perlmonks.org?node_id=181921


in reply to Re: AI in Perl - proof of concept
in thread AI in Perl - proof of concept

Your points are perfectly correct. I have no intention of simply being able to add facts to the database and forcing the end user to write the rules by hand. This was merely a "proof of concept" to test some ideas. I'm actually preparing a much longer write-up with the intention of starting some useful discussion.

Auto-generating some of the rules will be a must. If I have the following facts:

drinks(lemming,scotch). drinks(ovid,scotch). drinks(grep,guiness).

I should be able to auto-generate queries like the following:

?- drinks(ovid,scotch). yes

And with unification (associating variables with items):

?- drinks(grep,Drink). Drink=guiness yes ?- drinks(Who,scotch). Who=lemming Who=ovid yes

Those should be fairly easy to auto-generate. However, some rules have to be crafted by hand:

steals(Perp,Item) :- thief(Perp), owns(Victim,Item), Valuable(Item).

The problem there will be to create an easy to use (and parse!) syntax that supports this. You mention that my facts and rules are stored different ways and I like your example, but I'll have to play with it to see if that's what I really want.

You also bring up the tail-recursion issue (tail recursion, for those who are wondering, is where the return value of a recursive call returns directly to the caller rather than propogating back through the call stack). You stated that machines today have "millions of times more storage", thus suggesting that this might not be an issue. I think it is an issue because full-blown AI systems can store millions of facts and being able to take advantage of any optimizations will be critical, as Perl is not well-suited to this task. That's an issue I think I can put off for later, though.

In the meantime, I'll have a fairly detailed post later this evening outlining some of the issues that I need to tackle before I can really begin serious work on this.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.