Have a good look at the facts. When you have done that, write down in colloquial English what these facts mean. Don't keep to the ``if-and'' form used by Prolog (unless you are in the habit of phrasing your sentences like that anyway :-). Instead, act as though you are translating from (say) French, and trying to make your translation read as naturally as possible.
You will see that the knowledge base uses the symbols
< means ``less-than'', as you might expect.
``greater-than-or-equal'', and is the nearest the keyboard can come to
the standard mathematical symbol for this operation.
We'll say more about ways to compare numbers in Lesson 5.
Notice that all the conditions are complete and mutually
exclusive. For example,
the three rules for
is_a cover all possible combinations of fitness
and number of lessons, and no two rules overlap. The same goes for
When you write your own rules, you need not make them
complete (i.e. covering all possible cases), but you should think
carefully about which cases are left out. It is a good idea to make
rules mutually exclusive. To see what happens when they're not, consider
Suppose that a skier can do a maximum of twelve pressups before dropping dead. The first rule then says that he has poor fitness; but the second contradicts it, saying he's got good fitness. If you were to make this change, and then ask for advice about someone in this situation (the next section tells how to do this), you'll find that you get two solutions, offering conflicting advice. This is not surprising: given the rules above, both solutions would be logically correct. In general, this is something to avoid. Unfortunately, the need to make rules mutually exclusive can make them rather verbose. There are ways to avoid this, but they require more knowledge of Prolog and of the order in which it visits facts during inference.