Backward Chaining is an incredibly powerful yet widely
misunderstood concept; key to building many types of expert systems.
It is particularly well suited for interactive systems that emulate
a conversion between a user and a human expert. Backward chaining
enables systems to know what question to ask and when. It facilitates
the dismantling of complex problems into small, easily defined sections,
which the system automatically uses if needed. An understanding
of backward chaining is fundamental to building an expert system
with most popular development shells.
Backward chaining is the default method of operation
in many expert system tools. If the system must determine the value
of a variable, and a rule for deriving that value exists, backward
chaining can automatically execute the rule to obtain the value.
If this rule requires additional information before it can succeed,
then the system can execute additional rules, recursively if necessary.
Unfortunately, this simplicity enables developers to implement systems
without fully considering the operation of the inference engine;
sometimes producing unexpected side effects.
Goal Driven, another commonly used term for describing
backward chaining, refers to the method used to process the rules.
Data Driven, the other common approach, is associated with
Forward Chaining. These terms add to the confusion since
they actually refer to how the inference engine uses the rules,
and not to any required system architecture for data. A backward
chaining system can be driven by a block of data supplied at the
start - and there are often good reasons to do so. Likewise, a data
driven system may appear to interact with the user in a manner similar
to a backward chaining system.
Goal Driven System
A goal driven system always has a Goal List to attempt
to complete. This list, which is fundamental to backward chaining,
dynamically adds new goals to its top, pushing the other goals down
in the list. A key concept is that at a given time the system only
works on the top goal, which once achieved drops off the list and
the next goal becomes the top and active goal. The system is finished
once it removes all goals from the list.The inference engine actively attempts to achieve
top goal, which usually requires the determination of a value for
a variable. To obtain that value, the inference engine checks the
rules to establish if any could derive a value for that variable.
This requires an If/Then rule that assigns a value to the variable
in the THEN part of the rule. If such a rule is found, that
rule's IF portion is tested to determine if it is true.
Determining whether the IF portion is true typically
requires data for other variables. Values for these other variables
may already be available, making it possible to immediately determine
if the rule is true or false. Alternatively, if the value needed
to evaluate the rule is unknown, then that variable becomes the
new top-level goal and the inference
engine looks for rules that might assign it a value. This is one
way the system dynamically adds new goals (variables) to the top
of the goal list.
If no rule is available to assign a value to the top-level
goal variable, the system asks the user directly. The user's input
sets the value of that goal variable, dropping it off the goal list.
The next goal in the list becomes the top goal, with this additional
information to try to achieve that goal. This process continues
with the adding and removing of goals from the list until all goals
The following example shows how backward chaining
adds goals to the goal list, and how it can make a system modular.
The sample system helps first-level support staff prioritize support
requests by ensuring that certain customers receive priority service
and a response within 4 hours.
When building a Backward Chaining system, start with
the highest-level rules and add additional detailed rules as they
are needed. At the highest level, the system is one rule: