You are on page 1of 12

Forward &

Backward Chaining
Forward Chaining
Also called data driven or forward deduction method.
Known as bottom-up approach
It starts with the facts, and sees what rules apply.
Forward chaining starts with the available data and uses inference
rules to extract more data until an optimal goal is reached.
A inference engine using forward chaining searches the inference
rules until it finds one where the if clause is known to be true.
Forward Chaining Contd.
Forward chaining is widely used in deductive databases
Proofs start with the given axioms/premises in KB, deriving new
sentences using inferences until the goal/query sentence is derived
This defines a forward-chaining inference procedure because it
moves forward from the KB to the goal [eventually]
Forward Chaining

facts are held in a working memory


condition-action rules represent actions to be taken when
specified facts occur in working memory.
typically, actions involve adding or deleting facts from the
working memory.
Forward Chaining Example
Goal: Conclude the color of pet frog.
Given that: He croaks and eats flies and that the rule base contains
the following two rules:
If x croaks and eats flies then x is a frog.
If x is a frog then x is green.

The given rule would first be added to the knowledge base , as the
rule base is searched for a consequent that matches its antecedent.

So the conclusion is also added to the knowledge base, and the rule
base is again searched.
Forward Chaining Flow Chart
Backward Chaining
Also called goal driven or backward deduction.
Known as top-down approach.
It starts with something to find out, and looks for rules that will
help in answering it.
Backward chaining means reasoning from goals back to facts.
The goal is broken into many sub-goals or sub-sub goals which can
be solved more easily.
Backward Chaining Contd.
Widely used for logic programming
It starts with a list of goals and works backward to see if there is
data available that will support any of these goals.
An inference engine using backward chaining would search the
inference rules until it finds one which has a Then clause that
matches a desired goal.
If the If clause of that inference rule is not known to be true, then it
added to the list of goals.
Backward Chaining Example
Goal: Conclude the color of my pet fritz.
Given that: He croaks and eats flies and that the rule base contains
the following two rules:
If x croaks and eats flies - Then x is a frog.
If x is a frog - Then x is green.
This rule base would be searched and the second rule would be
selected, because its conclusion matches the goal.
It is not yet known that x is a frog, so the If statement is added to
the goal list.
Backward Chaining Example Contd.
The rule base is again searched and this time the first rule is
selected, because its Then clause matches the new goal that was
just added to the list .
The If clause is known to be true and therefore the goal that x is a
frog can be concluded.
Backward Chaining Flow Chart
Forward Chaining & Backward Chaining
Conclusion

In the forward chaining, start with given that and process the rules
and on the basis of rules find the goal.
In the backward chaining, we start with goal and add the rules on
goal list as a sub-goal.

You might also like