# 5.4.3 Knowledge-Level Explanation

The explicit use of semantics allows explanation and debugging at the knowledge level. To make a system usable by people, the system cannot just give an answer and expect the user to believe it. Consider the case of a system advising doctors who are legally responsible for the treatment that they carry out based on the diagnosis. The doctors must be convinced that the diagnosis is appropriate. The system must be able to justify that its answer is correct. The same mechanism can be used to explain how the system found a result and to debug the knowledge base.

Three complementary means of interrogation are used to explain the relevant knowledge: (1) a how question is used to explain how an answer was proved, (2) a why question is used to ask the system why it is asking the user a question, and (3) a whynot question is used to ask why an atom was not proven.

To explain how an answer was proved, a “how” question can be asked by a user when the system has returned the answer. The system provides the definite clause used to deduce the answer. For any atom in the body of the definite clause, the user can ask how the system proved that atom.

The user can ask “why” in response to being asked a question. The system replies by giving the rule that produced the question. The user can then ask why the head of that rule was being proved. Together these rules allow the user to traverse a proof or a partial proof of the top-level query.

A “whynot” question can be used to ask why a particular atom was not proven.

## How Did the System Prove an Atom?

The first explanation procedure allows the user to ask “how” an atom was proved. If there is a proof for $g$, either $g$ must be an atomic clause or there must be a rule

 $\displaystyle{g\leftarrow\mbox{}a_{1}\wedge\mbox{}\ldots\wedge\mbox{}a_{k}}$

such that each $a_{i}$ has been proved.

If the system has proved $g$, and the user asks how in response, the system can display the clause that was used to prove $g$. If this clause was a rule, the user could then ask

how $i$.

which will give the rule that was used to prove $a_{i}$. The user can continue using the how command to explore how $g$ was proved.

###### Example 5.14.

In the axiomatization of Example 5.7, the user can ask the query $\mbox{{ask}~{}}~{}\mbox{lit\_l}_{2}$. In response to the system proving this query, the user can ask how. The system would reply:

 $\displaystyle{\mbox{lit\_l}_{2}\leftarrow\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{light\_l}_{2}\wedge\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{live\_l}_{2}\wedge\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{ok\_l}_{2}.}$

This is the top-level rule used to prove $\mbox{lit\_l}_{2}$. To find out how $\mbox{live\_l}_{2}$ was proved, the user can ask

how 2.

The system can return the rule used to prove $\mbox{live\_l}_{2}$, namely,

 $\displaystyle{\mbox{live\_l}_{2}\leftarrow\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{live\_w}_{4}.}$

To find how $\mbox{live\_w}_{4}$ was proved, the user can ask

how 1.

The system presents the rule

 $\displaystyle{\mbox{live\_w}_{4}\leftarrow\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{live\_w}_{3}\wedge\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{up\_s}_{3}.}$

To find how first atom in the body was proved, the user can ask

how 1.

The first atom, $\mbox{live\_w}_{3}$, was proved using the following rule:

 $\displaystyle{\mbox{live\_w}_{3}\leftarrow\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{live\_w}_{5}\wedge\mbox{}}$ $\displaystyle\ \ \ \ {\mbox{ok\_cb}_{1}.}$

To find how the second atom in the body was proved, the user can ask

how 2.

The system will report that $\mbox{ok\_cb}_{1}$ is explicitly given.

Notice that the explanation here was only in terms of the knowledge level, and it only gave the relevant definite clauses it has been told. The user does not have to know anything about the proof procedure or the actual computation.

A method to implement how questions is presented in Section 14.4.5.

## Why Did the System Ask a Question?

Another useful explanation is for why a question was asked. This is useful for a number of reasons:

• We want the system to appear intelligent, transparent and trustworthy. Knowing why a question was asked will increase a user’s confidence that the system is working sensibly.

• One of the main measures of complexity of an interactive system is the number of questions asked of a user, which should be kept to a minimum. Knowing why a question was asked will help the knowledge designer reduce this complexity.

• An irrelevant question is usually a symptom of a deeper problem.

• The user may learn something from the system by knowing why the system is doing something. This learning is much like an apprentice asking a master why the master is doing something.

When the system asks the user a question ($q$), there must be a rule used by the system that contains $q$ in the body. The user can ask

 ${\mbox{{why}}}.$

This is read as “Why did you ask me that question?” The answer can be the rule that contains $q$ in the body. If the user asks why again, the system should explain why the atom at the head of the rule was asked, and so forth. Repeatedly asking why will eventually give the path of subgoals to the top-level query. If all of these rules are reasonable, this justifies why the system’s question to the user is reasonable.

###### Example 5.15.

Consider the dialog of Example 5.13. The following shows how repeated use of why can repeatedly find higher-level subgoals. The following dialog is for the query $\mbox{{ask}~{}}~{}\mbox{lit\_l}_{1}$, with user asking the initial query, and responding with “why”.

ailog: ask  $\mbox{lit\_l}_{1}$.
Is $\mbox{up\_s}_{1}$ true? why.
$\mbox{up\_s}_{1}$ is used in the rule $\mbox{live\_w}_{1}\leftarrow\mbox{}\mbox{live\_w}_{3}\wedge\mbox{}\mbox{up\_s}% _{1}$: why.
$\mbox{live\_w}_{1}$ is used in the rule $\mbox{live\_w}_{0}\leftarrow\mbox{}\mbox{live\_w}_{1}\wedge\mbox{}\mbox{up\_s}% _{2}$: why.
$\mbox{live\_w}_{0}$ is used in the rule $\mbox{live\_l}_{1}\leftarrow\mbox{}\mbox{live\_w}_{0}$: why.
$\mbox{live\_l}_{1}$ is used in the rule $\mbox{lit\_l}_{1}\leftarrow\mbox{}\mbox{light\_l}_{1}\wedge\mbox{}\mbox{live\_% l}_{1}\wedge\mbox{}\mbox{ok\_l}_{1}$: why.
Because that is what you asked me!

Typically, how and why are used together; how moves from higher-level to lower-level subgoals, and why moves from lower-level to higher-level subgoals. Together they let the user traverse a proof tree, where nodes are atoms, and a node together with its children corresponds to a clause in the knowledge base.

###### Example 5.16.

As an example of the need to combine how and why, consider the previous example where the user asked why $\mbox{up\_s}_{1}$. The system gave the following rule:

 $\mbox{live\_w}_{1}\leftarrow\mbox{}\mbox{live\_w}_{3}\wedge\mbox{}\mbox{up\_s}% _{1}.$

This means that $\mbox{up\_s}_{1}$ was asked because the system wants to know $\mbox{live\_w}_{1}$ and is using this rule to try to prove $\mbox{up\_s}_{1}$. The user may think it is reasonable that the system wants to know $\mbox{live\_w}_{1}$ but may think it is inappropriate that $\mbox{up\_s}_{1}$ be asked because the user may doubt that $\mbox{live\_w}_{3}$ should have succeeded. In this case it is useful for the user to ask how $\mbox{live\_w}_{3}$ was derived.