Skip to content

Prolog and artificial intelligence

Time I think for a bit of variety. I’ve recently started lectures on the subject of artificial intelligence and AI programming, and I have to say I find the whole subject thoroughly interesting if somewhat mind-melting if you think about it too much. There are applications for intelligent systems in the spheres of business and entertainment including game-playing, path-finding, robotics and expert systems.

The programming language we’ve been studying for this module is Prolog which takes some getting used to. We were given further lectures on propositional and predicate logic before we started the Prolog work and this has probably helped to understand the reasoning behind a Prolog declaration and procedure.

A brief point I’d like to make is that many introductory tutorials  will name their variables and predicates (functions if you like) with such helpful convention as X, Y, Z / A, B, C and P, Q, R. Needless to say this doesn’t help to convey much understanding about the operation of such functions. Prolog programming does indeed require a massive shift in perspective from programming in many other languages, and many built-in predicates are defined in this way so it is important to be able to see X, Y, Z for what they are in relation to the application of the predicate. However it might do well to describe your own identifiers more clearly. For example I found it much easier to write a function that finds the maximum number in a list using: CurrentMax and Max than X and Y!

The message is simple, but it might assist those who are struggling to understand more complicated aspects of the programming such as when lists and elements from those lists are utilised. e.g. [X | Y] can become [Element | List].

Leave a Reply