My AI::Prolog Victim ... I Mean "Hero"

Ovid on 2005-03-16T22:33:32

You've possibly noticed lately that I've been rather quiet on the AI::Prolog front. This has been deliberate. Right now, adding new predicates and behavior is rather easy -- so long as I do not alter the grammar. Altering the grammar has proven rather difficult. Adding the unary cut operator was a pain. I gave up on binary infix operators and simply allowed math to be declared via predicates. This has led to the following ugliness:

% Instead of
%   X is (Z+2) * Y - 1.
% We have to use
is(X, minus(times(Y,plus(Z,2))1)).

Syntactic sugar is clearly needed here.

Enter Richard Freytag. He's taking a compiler class and volunteered to write a proper parser for AI::Prolog. You can read quite a bit about his work at the Prolog section of his Wiki. Specifically, the grammar section details quite a bit about the new grammar.

This should make extending AI::Prolog much easier. Infix operators should be coming soon. I also hope to add definite clause grammars, too, but that's almost impossible with the current ad hoc parser.

Thank you, Richard!


Prolog?

jhannah on 2005-03-17T07:17:35

What practical applications do you use Prolog or other AI for?

Just curious.

Re:Prolog?

Ovid on 2005-03-17T07:58:31

Well, to be fair, I regret putting this into the AI namespace. Logic programming, while frequently used for AI, is not AI. Of course, the caveat here is that you can ask ten AI researches what AI is and get ten different answers.

Possibly one of the most common uses of Prolog is expert systems. These are systems where you take the knowledge of a specialist in a field and encode it in such a way that your software can usually offer similar answers as a human expert. Medical diagnostic expert systems even back in the 80s were frequently better at diagnosing disease than interns. Sometimes these systems can take the load off of an expert and she merely refines the presented knowledge. Sometimes they can be used when an expert is not available, such as in insurance underwriting or automotive diagnostics.

Prolog is also used with natural language processing and theorem proving. Also, any time that you are using a rules-based system is clue that logic programming may be a better fit for what you're trying to do.

Ooh ... I almost forgot agent-based systems. There's been a large body of work done on creating autonomous software agents that can handle varying environments, communicate with other agents and still get their work done. It's nifty stuff and a Java-based version of Prolog that I borrowed some ideas from was originally created for research in this field.