Like Shrdlu, PopBeast can obey simple commands. It can also answer questions. How does it represent their meaning? As with the non-analogue part of its world model, it uses propositions. Thus ``There is a key in a room'' would become
in( K, R ), key(K), room(R).Literally translated, this means ``K is in R, and K is a key, and R is a room'': by ``room'', PopBeast understands what I called a ``region'' earlier. The comma is the way that Prolog displays a logical ``and''. The K and R are what are called logical variables. In the world-model propositions, the arguments always named particular objects. Here by contrast, they could refer to any objects for which the proposition is true: that is, to any key K and room R such that K is in R. This is reasonable, since the sentence did not specify a particular room or key. Logicians may be puzzled by the lack of a quantifier for the variables K and R. As written in standard logic, this would have a quantifier in front of it, but in Prolog, this can be taken for granted. Non-logicians can ignore the last remark.
Verbs are also represented by propositions. Thus the sentence ``PopBeast opens a door'' would become
opens( me, D ), door(D).Literally translated from the logic, this means ``I (PopBeast) open D, and D is a door''.
There is actually slightly more to the representation than this. With each assertion, PopBeast stores a special marker to indicate that it is an assertion rather than a command. The reason for this is that the logical translation alone is insufficient to distinguish the two. The formula
opens( me, D ), door(D).could, as above, say something about the current state of the world. However, it could also describe a state of the world which we want PopBeast to make true, but which isn't true now - i.e. act in such a way that you are opening a door. PopBeast can tell from the grammatical structure of a sentence whether it is meant to be a command or an assertion. To summarise, the two meanings are represented as
command markers are not part of
You may have noticed that above I have talked about the sentence ``Open a door'', whereas earlier I said that I could give PopBeast the command ``Open the door''. What is the difference in meaning? It is often the case in English, though not always, that ``the'' refers back to some previously mentioned item, or points at an item which is special in some way to the listener or speaker. To deal with this properly, PopBeast would have to determine which item this is, possibly by examining the context built up by previous dialogue. I have finessed this by ignoring it, and fixing PopBeast so that ``the'' and ``a'' are treated alike. Future PopBeasts will be cleverer.