6.2 Whynot? Questions |
If a query fails when it should have succeeded, either there was a rule defining the query whose body fails when it should have succeeded, or else there is a missing rule for that query.
You can ask a query to determine why some query failed using:
cilog: whynot query.where query is an expression.
If the query is an atom, you can examine each rule whose head unifies with the query. For each such rule, the system asks whether you want to trace this rule. You can reply with:
To determine why a rule failed, we determine why the body failed. If
the body is atomic, we use the above whynot mechanism to
determine why the rule failed. If the body of the rule is a
conjunction, alpha&
beta, there are four cases:
Example.
Suppose we had the knowledge base from Example 4. Suppose
that, the user knew that Joe had a child called Jane, and wanted to
know why the system didn't think that Randy was Jane's grandfather.
We could imagine the following dialogue:
cilog: whynot grandfather(randy,jane).
grandfather(randy,jane) <- father(randy,A)&parent(A,jane).
Trace this rule? [yes,no,up,help]: yes.
The proof for father(randy,sally) succeeded.
Should this answer lead to a successful proof?
[yes,no,debug,help]: no.
The proof for father(randy,joe) succeeded.
Should this answer lead to a successful proof?
[yes,no,debug,help]: yes.
parent(joe,jane) <- mother(joe,jane).
Trace this rule? [yes,no,up,help]: no.
parent(joe,jane) <- father(joe,jane).
Trace this rule? [yes,no,up,help]: yes.
There is no applicable rule for father(joe,jane).
parent(joe,jane) <- father(joe,jane).
Trace this rule? [yes,no,up,help]: up.
grandfather(randy,jane) <- father(randy,joe)&parent(joe,jane).
Trace this rule? [yes,no,up,help]: up.
cilog:
6.2 Whynot? Questions |