### 13.4.1 Functional Relations

One case in which the system may know the answer to an askable goal, even though it has not been directly answered by the user, is when a relation is functional. Relation r(X,Y) is functional if, for every X, there is a unique Y such that r(X,Y) is true. If the system has already found one Y for a particular X for which r(X,Y) is true, it should not re-ask for more instances.

Example 13.18: In the preceding example, it is redundant to ask the question "Is down(s2) true?" when the user has already told the system that up(s2) is true. It may be better to have a relation pos(Sw,Pos), where the position is a function of the switch. The system must be told that pos is functional; each switch only has one position. Once the system has determined the position of a switch, it does not have to ask any more questions about the position of that switch.

It is usually very inefficient to ask yes-or-no questions of a functional relation. Rather than enumerating every possible position of the switch and asking whether or not the switch is in that position, it may be better to ask once for the position of the switch and not ask this question again. If the system wants to know the age of a person, it would be better to ask outright for the age of the person rather than to enumerate all of the ages and ask true-or-false questions.

Asking these kinds of more general questions probably would not be appropriate for non-functional relations. For example, if the switch could be in many positions at once, then it would probably be better to ask for each position that is required.

A complication arises with respect to the vocabulary of answers. The user may not know what vocabulary is expected by the knowledge engineer. There are two sensible solutions to this problem:

• The system designer provides a menu of items from which the user selects the best fit. This works when there are few items or when the items can be arranged in a narrow hierarchy.
• The system designer provides a large dictionary to anticipate all possible answers. When the user gives an answer, the answer is mapped into the internal forms expected by the system. An assumption would be made that the vocabulary used by the user would be normal language or some abbreviated form. Thus, the user may not expect the system to understand such terms as "giganormous" (meaning "very big," of course).

Which of these works better is an empirical question. Such questions about how a computer can best interact with people is studied in the field of human-computer interaction (HCI).