Backward chaining

Next: Longer example of backward chaining
Up: How the inference engine works
Previous: Forward chaining
Back: to main list of student notes

## Backward chaining

This is a lazy kind of inference. It does no work until absolutely necessary, in distinction to forward chaining, where the system eagerly awaits new facts and tries applying conditions as soon as they arrive.

So, if we had this knowledge base again

```1 If someone is a third year, then they need a job.
2 If someone is a third year, then they live in.
3 If someone needs a job, they will apply to be an accountant.```
`John is a third year`
the system would do nothing at all.

But if we were then to ask the question

`Is there anyone who is going to become an accountant?`
the system would try to answer. It would begin by searching either for a fact that gives the answer directly, or for a rule by which the answer could be inferred. To find such a rule, it searches the entire knowledge base for rules whose conclusions, if made true, will answer the question.

In this example, there are no facts giving the answer; there's one rule whose conclusion, if true, would supply an answer, and that's rule 3.

The system next checks the rule's conditions. Is there anyone who needs a job? As with the original question, we look either for a fact that answers directly, or for a rule. There are no facts, but rule 1 is relevant.

So we now check its conditions. Is there a third year? This time, there is a fact that answers this: `John is a third year`. So we've proved rule 1, and that's proved rule 3, and that's answered the question.

Next: Longer example of backward chaining
Up: How the inference engine works
Previous: Forward chaining
Back: to main list of student notes

Jocelyn Ireson-Paine
Wed Feb 14 23:39:25 GMT 1996