Forward chaining
Encyclopedia
Forward chaining is one of the two main methods of reasoning when using inference rules (in artificial intelligence
) and can be described logically as repeated application of modus ponens
. Forward chaining is a popular implementation strategy for expert system
s, business
and production rule systems
. The opposite of forward chaining is backward chaining
.
Forward chaining starts with the available data
and uses inference rules to extract more data (from an end user for example) until a goal is reached. An inference engine
using forward chaining searches the inference rules until it finds one where the antecedent
(If clause) is known to be true. When found it can conclude, or infer, the consequent
(Then clause), resulting in the addition of new information
to its data.
Inference engines will iterate through this process until a goal is reached.
For example, suppose that the goal is to conclude the color of a pet named Fritz, given that he croaks and eats flies, and that the rule base contains the following four rules:
This rule base would be searched and the first rule would be selected, because its antecedent (If Fritz croaks and eats flies) matches our data. Now the consequents (Then X is a frog) is added to the data. The rule base is again searched and this time the third rule is selected, because its antecedent (If Fritz is a frog) matches our data that was just confirmed. Now the new consequent (Then Fritz is green) is added to our data. Nothing more can be inferred from this information, but we have now accomplished our goal of determining the color of Fritz.
Because the data determines which rules are selected and used, this method is called data-driven
, in contrast to goal-driven
backward chaining inference. The forward chaining approach is often employed by expert system
s, such as CLIPS
.
One of the advantages of forward-chaining over backward-chaining is that the reception of new data can trigger new inferences, which makes the engine better suited to dynamic situations in which conditions are likely to change.
Artificial intelligence
Artificial intelligence is the intelligence of machines and the branch of computer science that aims to create it. AI textbooks define the field as "the study and design of intelligent agents" where an intelligent agent is a system that perceives its environment and takes actions that maximize its...
) and can be described logically as repeated application of modus ponens
Modus ponens
In classical logic, modus ponendo ponens or implication elimination is a valid, simple argument form. It is related to another valid form of argument, modus tollens. Both Modus Ponens and Modus Tollens can be mistakenly used when proving arguments...
. Forward chaining is a popular implementation strategy for expert system
Expert system
In artificial intelligence, an expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning about knowledge, like an expert, and not by following the procedure of a developer as is the case in...
s, business
Business rules engine
A business rules engine is a software system that executes one or more business rules in a runtime production environment. The rules might come from legal regulation , company policy , or other sources...
and production rule systems
Production system
A production system is a computer program typically used to provide some form of artificial intelligence, which consists primarily of a set of rules about behavior. These rules, termed productions, are a basic representation found useful in automated planning, expert systems and action selection...
. The opposite of forward chaining is backward chaining
Backward chaining
Backward chaining is an inference method that can be described as working backward from the goal...
.
Forward chaining starts with the available data
Data
The term data refers to qualitative or quantitative attributes of a variable or set of variables. Data are typically the results of measurements and can be the basis of graphs, images, or observations of a set of variables. Data are often viewed as the lowest level of abstraction from which...
and uses inference rules to extract more data (from an end user for example) until a goal is reached. An inference engine
Inference engine
In computer science, and specifically the branches of knowledge engineering and artificial intelligence, an inference engine is a computer program that tries to derive answers from a knowledge base. It is the "brain" that expert systems use to reason about the information in the knowledge base for...
using forward chaining searches the inference rules until it finds one where the antecedent
Antecedent (logic)
An antecedent is the first half of a hypothetical proposition.Examples:* If P, then Q.This is a nonlogical formulation of a hypothetical proposition...
(If clause) is known to be true. When found it can conclude, or infer, the consequent
Consequent
A consequent is the second half of a hypothetical proposition. In the standard form of such a proposition, it is the part that follows "then".Examples:* If P, then Q.Q is the consequent of this hypothetical proposition....
(Then clause), resulting in the addition of new information
Information
Information in its most restricted technical sense is a message or collection of messages that consists of an ordered sequence of symbols, or it is the meaning that can be interpreted from such a message or collection of messages. Information can be recorded or transmitted. It can be recorded as...
to its data.
Inference engines will iterate through this process until a goal is reached.
For example, suppose that the goal is to conclude the color of a pet named Fritz, given that he croaks and eats flies, and that the rule base contains the following four rules:
- If X croaks and eats flies - Then X is a frog
- If X chirps and sings - Then X is a canary
- If X is a frog - Then X is green
- If X is a canary - Then X is yellow
This rule base would be searched and the first rule would be selected, because its antecedent (If Fritz croaks and eats flies) matches our data. Now the consequents (Then X is a frog) is added to the data. The rule base is again searched and this time the third rule is selected, because its antecedent (If Fritz is a frog) matches our data that was just confirmed. Now the new consequent (Then Fritz is green) is added to our data. Nothing more can be inferred from this information, but we have now accomplished our goal of determining the color of Fritz.
Because the data determines which rules are selected and used, this method is called data-driven
Data driven
Data driven means that progress in an activity is compelled by data, rather than by intuition or personal experience. This often refers to:* Data-driven programming* Data driven journalism* Data-driven testing* Data driven learning, or DDL...
, in contrast to goal-driven
Goal-oriented
The concept of goal orientation was developed to describe variability in dispositional or situational goal preferences that an individual implicitly sets for him/herself in achievement situations. GOs assist in providing a motivational framework for how individuals perceive, interpret, and judge...
backward chaining inference. The forward chaining approach is often employed by expert system
Expert system
In artificial intelligence, an expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning about knowledge, like an expert, and not by following the procedure of a developer as is the case in...
s, such as CLIPS
CLIPS
CLIPS is a public domain software tool for building expert systems. The name is an acronym for "C Language Integrated Production System." The syntax and name was inspired by Charles Forgy's OPS...
.
One of the advantages of forward-chaining over backward-chaining is that the reception of new data can trigger new inferences, which makes the engine better suited to dynamic situations in which conditions are likely to change.