Backward chaining (or backward reasoning) is an
inference
Inferences are steps in reasoning, moving from premises to logical consequences; etymologically, the word '' infer'' means to "carry forward". Inference is theoretically traditionally divided into deduction and induction, a distinction that in ...
method described colloquially as working backward from the goal. It is used in
automated theorem provers,
inference engine
In the field of artificial intelligence, an inference engine is a component of the system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems. The typical expert ...
s,
proof assistant
In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human-machine collaboration. This involves some sort of interactive proof editor ...
s, and other
artificial intelligence
Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech re ...
applications.
In
game theory
Game theory is the study of mathematical models of strategic interactions among rational agents. Myerson, Roger B. (1991). ''Game Theory: Analysis of Conflict,'' Harvard University Press, p.&nbs1 Chapter-preview links, ppvii–xi It has appli ...
, researchers apply it to (simpler)
subgame
In game theory, a subgame is any part (a subset) of a game that meets the following criteria (the following terms allude to a game described in extensive form):
#It has a single initial node that is the only member of that node's information ...
s to find a solution to the game, in a process called ''
backward induction
Backward induction is the process of reasoning backwards in time, from the end of a problem or situation, to determine a sequence of optimal actions. It proceeds by examining the last point at which a decision is to be made and then identifying wha ...
''. In chess, it is called
retrograde analysis
In chess problems, retrograde analysis is a technique employed to determine which moves were played leading up to a given position. While this technique is rarely needed for solving ordinary chess problems, there is a whole subgenre of chess pr ...
, and it is used to generate table bases for
chess endgame
In chess and other similar games, the endgame (or end game or ending) is the stage of the game when few pieces are left on the board.
The line between middlegame and endgame is often not clear, and may occur gradually or with the quick exchange o ...
s for
computer chess
Computer chess includes both hardware (dedicated computers) and software capable of playing chess. Computer chess provides opportunities for players to practice even in the absence of human opponents, and also provides opportunities for analysi ...
.
Backward chaining is implemented in
logic programming
Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic pro ...
by
SLD resolution SLD resolution (''Selective Linear Definite'' clause resolution) is the basic inference rule used in logic programming. It is a refinement of resolution, which is both sound and refutation complete for Horn clauses.
The SLD inference rule
Given ...
. Both rules are based on the
modus ponens
In propositional logic, ''modus ponens'' (; MP), also known as ''modus ponendo ponens'' (Latin for "method of putting by placing") or implication elimination or affirming the antecedent, is a deductive argument form and rule of inference. ...
inference rule. It is one of the two most commonly used methods of
reasoning
Reason is the capacity of consciously applying logic by drawing conclusions from new or existing information, with the aim of seeking the truth. It is closely associated with such characteristically human activities as philosophy, science, lang ...
with
inference rule
In the philosophy of logic, a rule of inference, inference rule or transformation rule is a logical form consisting of a function which takes premises, analyzes their syntax, and returns a conclusion (or conclusions). For example, the rule of ...
s and
logical implications – the other is
forward chaining
Forward chaining (or forward reasoning) is one of the two main methods of reasoning when using an inference engine and can be described logically as repeated application of ''modus ponens''. Forward chaining is a popular implementation strategy ...
. Backward chaining systems usually employ a
depth-first search strategy, e.g.
Prolog
Prolog is a logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
.
How it works
Backward chaining starts with a list of
goal
A goal is an idea of the future or desired result that a person or a group of people envision, plan and commit to achieve. People endeavour to reach goals within a finite time by setting deadlines.
A goal is roughly similar to a purpose or ai ...
s (or a
hypothesis
A hypothesis (plural hypotheses) is a proposed explanation for a phenomenon. For a hypothesis to be a scientific hypothesis, the scientific method requires that one can test it. Scientists generally base scientific hypotheses on previous obse ...
) and works backwards from the
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". In an implication, if ''P'' implies ''Q'', then ''P'' is called the antecedent and ''Q'' is called ...
to the
antecedent to see if any
data
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted ...
supports any of these consequents.
An
inference engine
In the field of artificial intelligence, an inference engine is a component of the system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems. The typical expert ...
using backward chaining would search the
inference
Inferences are steps in reasoning, moving from premises to logical consequences; etymologically, the word '' infer'' means to "carry forward". Inference is theoretically traditionally divided into deduction and induction, a distinction that in ...
rules until it finds one with a consequent (Then clause) that matches a desired goal. If the antecedent (If clause) of that rule is known to be true, then it is added to the list of goals (for one's goal to be confirmed one must also provide data that confirms this new rule).
For example, suppose a new pet, Fritz, is delivered in an opaque box along with two facts about Fritz:
* Fritz croaks
* Fritz eats flies
The goal is to decide whether Fritz is green, based on a
rule base
In computer science, a rule-based system is used to store and manipulate knowledge to interpret information in a useful way. It is often used in artificial intelligence applications and research.
Normally, the term ''rule-based system'' is appli ...
containing the following four rules:
# If X croaks and X eats flies – Then X is a frog
# If X chirps and X sings – Then X is a canary
# If X is a frog – Then X is green
# If X is a canary – Then X is yellow
With backward reasoning, an inference engine can determine whether Fritz is green in four steps. To start, the query is phrased as a goal assertion that is to be proven: "Fritz is green".
1. Fritz is substituted for X in rule #3 to see if its consequent matches the goal, so rule #3 becomes:
If Fritz is a frog – Then Fritz is green
Since the consequent matches the goal ("Fritz is green"), the rules engine now needs to see if the antecedent ("Fritz is a frog") can be proven. The antecedent, therefore, becomes the new goal:
Fritz is a frog
2. Again substituting Fritz for X, rule #1 becomes:
If Fritz croaks and Fritz eats flies – Then Fritz is a frog
Since the consequent matches the current goal ("Fritz is a frog"), the inference engine now needs to see if the antecedent ("Fritz croaks and eats flies") can be proven. The antecedent, therefore, becomes the new goal:
Fritz croaks and Fritz eats flies
3. Since this goal is a conjunction of two statements, the inference engine breaks it into two sub-goals, both of which must be proven:
Fritz croaks
Fritz eats flies
4. To prove both of these sub-goals, the inference engine sees that both of these sub-goals were given as initial facts. Therefore, the conjunction is true:
Fritz croaks and Fritz eats flies
therefore the antecedent of rule #1 is true and the consequent must be true:
Fritz is a frog
therefore the antecedent of rule #3 is true and the consequent must be true:
Fritz is green
This derivation, therefore, allows the inference engine to prove that Fritz is green. Rules #2 and #4 were not used.
Note that the goals always match the affirmed versions of the consequents of implications (and not the negated versions as in
modus tollens
In propositional logic, ''modus tollens'' () (MT), also known as ''modus tollendo tollens'' (Latin for "method of removing by taking away") and denying the consequent, is a deductive argument form and a rule of inference. ''Modus tollens' ...
) and even then, their antecedents are then considered as the new goals (and not the conclusions as in
affirming the consequent
Affirming the consequent, sometimes called converse error, fallacy of the converse, or confusion of necessity and sufficiency, is a formal fallacy of taking a true conditional statement (e.g., "If the lamp were broken, then the room would be dar ...
), which ultimately must match known facts (usually defined as consequents whose antecedents are always true); thus, the inference rule used is
modus ponens
In propositional logic, ''modus ponens'' (; MP), also known as ''modus ponendo ponens'' (Latin for "method of putting by placing") or implication elimination or affirming the antecedent, is a deductive argument form and rule of inference. ...
.
Because the list of goals determines which rules are selected and used, this method is called
goal-driven, in contrast to
data-driven forward-chaining inference. The backward chaining approach is often employed by
expert systems
In artificial intelligence, an expert system is a computer system emulating the decision-making ability of a human expert.
Expert systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as if†...
.
Programming languages such as
Prolog
Prolog is a logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
,
Knowledge Machine and
ECLiPSe support backward chaining within their inference engines.
See also
*
Backtracking
Backtracking is a class of algorithms for finding solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it d ...
*
Backward induction
Backward induction is the process of reasoning backwards in time, from the end of a problem or situation, to determine a sequence of optimal actions. It proceeds by examining the last point at which a decision is to be made and then identifying wha ...
*
Forward chaining
Forward chaining (or forward reasoning) is one of the two main methods of reasoning when using an inference engine and can be described logically as repeated application of ''modus ponens''. Forward chaining is a popular implementation strategy ...
*
Opportunistic reasoning
References
[
Definition of backward chaining as a depth-first search method:
*
]
[
Languages that support backward chaining:
*
]
Sources
*
External links
Backward chaining example
{{Automated reasoning
Expert systems
Logic in computer science
Reasoning
Automated reasoning