One kind is called forward chaining, and sometimes data directed, because inference is triggered by the arrival of new data in the knowledge base. For example, suppose we have the knowledge base:
and we add the fact
A forward-chaining system would immediately trigger any rules whose
conditions are satisfied by this fact. In this example, the conditions
the first two rules are both satisfied - i.e. both are true when we set
X=john
.
So the system would create the two facts below and add them
to the database
As each new fact is created, the system would look for yet more rules
that its arrival could trigger. In this case, the fact
has_exam(john,finals)
would trigger rule 30, because
has_exam(X,finals)
is true if X=john
. This would result
in the addition of
another new fact:
The fact lives_in(john,in_college)
would not trigger anything else
though.
Generally speaking, in a forward-chaining system, once a fact is created, it is there to stay until explicitly deleted. If this is so, answering a question need not itself require any inference. If on receiving a new fact, the system makes all possible inferences from it, then answering a question need only involve scanning these facts one by one.