Expert Systems and Prolog
Written by Mike James   
Thursday, 23 February 2023
Article Index
Expert Systems and Prolog
Reasoning
Logic Rules

Expert systems were once all the rage and the solution to every problem. They were the great hope of commercial AI and very much over hyped. However, behind the hype was a good idea and a useful technique that deserves to be better known.

 

 

One of the strangest things about the study of Artificial Intelligence (AI) is that every now and again you come across a theory that seems to explain it all - thought, problem solving, natural language and eventually life, the universe and everything.

Of course, once you try your theory out in practice it isn't long before you discover that there is some fundamental problem. It usually turns out that there are features of human behaviour that you have never noticed before that are infinitely more subtle than your theory allows for.

Sometimes the theory fails because to implement it you need a simple but almost infinitely powerful computer. For whatever reason there are no good AI theories that cover a decently wide range of situations and problems. There are vague and general themes that run through most of the practical work and it is often surprising how often a new and seemingly different approach to a problem turns out to be the same as an existing method.

 

Logic is one of the potentially all-embracing theories that sometimes traps people into thinking that they have found THE solution to AI.

If you are familar with the ideas of logic then you might find this difficult to believe. After all statements such as "A implies B" sound very dry and it is hard to see how they can encapsulate anything of human intelligence apart from the most formal aspects.

In fact logic is a complete theory in the sense that anything that can be computed can be reduced to logic. The easiest way to see that this is true is to notice that the AI language Prolog is based on logic and it is as least as powerful as any other computer language.

In this article we take a look at the  topic of expert systems but from a number of different points of view. In particular the relationship between expert systems, logic and Prolog is explained and this of interest because people often learn Prolog with the explicit intention of using it to create an expert system!

It has to be said that expert systems aren't as popular or in vogue as they once were and it is quite difficult to find an example of a standalone expert system any more. However they do exist and once you understand the simple principles that they operate on, you can implement one in almost any language you care to choose.

 IF..THEN implies something

The basic idea of an expert system is surprisingly well known considering that it is supposedly the product of many years of advanced AI research.

Like all good ideas expert systems have been discovered more than once in different ways, but the modern view is that they are an attempt to gather together and use a set of rules that encapsulate some small part of human knowledge.

Many areas of human expertise can be thought of as the intelligent application of a set of rules that all have the same general form:

IF something_or_other THEN 
                    draw some conclusion

For example,

IF the light doesn't come on 
    AND there is electricity
     AND the fuse is OK THEN
                the bulb has blown

In principle all you have to do to transfer the expert's knowledge to a computer is to collect all the rules that are used and write a simple program that will use the known facts to reach the correct conclusion.

Of course in practice this is virtually impossible. The main reason being that the human expert usually doesn't have the foggiest idea what the rules are and often why any particular conclusion is reached!

In the jargon of AI 'knowledge acquisition' is difficult!

So far this description of rules representing expert knowledge isn't particularly AI based. If you had never heard about AI and wanted to write a program that would find faults in electrical wiring you would automatically write it so that the known conditions resulted in the obvious conclusions.

The AI breakthrough was to realise that you didn't have to discover the whole rule in one complete, logically perfect, chunk. All you had to do was to ask the human expert to provide you with small chunks of rules that led to intermediate conclusions.

For example, you might say to an electrician - "the light doesn't work" and as part of the fault finding the first question he might ask could be "does everything else in the house work?" If you enquire why this question is important he might say "If everything else works then the electricity hasn't been cut off and the fuses are OK".

From this you, as the knowledge engineer in this project, would write down two rules -

Rule 1: IF everything else working THEN 
                 electricity not cut off
Rule 2: IF everything else working THEN
                 fuse OK

Notice that at this stage you might have absolutely no idea what bearing these rules have on the problem in hand - i.e. why the light doesn't come on - but as the electrician used it as part of his fault finding it is likely to lead to something useful.

The next stage in the consultation might be that the electrician suggests that the bulb is changed. If asked why he would reply - "the electricity is on and the fuse is OK so it must be the bulb". From this you would obtain a third rule

Rule 3: IF electricity not cut off AND
                fuse OK THEN bulb blown

You should be able to see that these three rules are indeed equivalent to the one long rule derived earlier but you should also be able to see that they were derived in a way that required little understanding of the problem being solved.

In this way a collection of short rules can be gathered by similar methods without any attempt to master the entire subject in one go. This collection of rules is generally referred to as a knowledge base and the program that makes use of it is called the inference engine or shell and you can say that

 expert system = knowledge base + inference engine

 If you buy an expert system shell  it is up to you to create the knowledge base that you need and this is of course where an expert system project succeeds or fails.

<ASIN:3540006788>

<ASIN:0262193388>

<ASIN:1904987176>



Last Updated ( Wednesday, 01 March 2023 )