0% found this document useful (0 votes)
81 views20 pages

Forward Chaining and Backward Chaining

Uploaded by

khatuaryan16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views20 pages

Forward Chaining and Backward Chaining

Uploaded by

khatuaryan16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Forward Chaining and backward

chaining
• Inference engine:
• The inference engine is the component of the
intelligent system in artificial intelligence, which
applies logical rules to the knowledge base to
infer new information from known facts. The first
inference engine was part of the expert system.
Inference engine commonly proceeds in two
modes, which are:
• Forward chaining
• Backward chaining
Horn Clause and Definite clause:
• Horn clause and definite clause are the forms of sentences, which
enables knowledge base to use a more restricted and efficient
inference algorithm. Logical inference algorithms use forward and
backward chaining approaches, which require KB in the form of
the first-order definite clause.
• Definite clause: A clause which is a disjunction of literals
with exactly one positive literal is known as a definite clause or
strict horn clause.
• Horn clause: A clause which is a disjunction of literals with at most
one positive literal is known as horn clause. Hence all the definite
clauses are horn clauses.
• Example: (¬ p V ¬ q V k). It has only one positive literal k.
• It is equivalent to p ∧ q → k.
A. Forward Chaining

• Forward chaining is also known as a forward deduction


or forward reasoning method when using an inference
engine.
• Forward chaining is a form of reasoning which start
with atomic sentences in the knowledge base and
applies inference rules (Modus Ponens) in the forward
direction to extract more data until a goal is reached.
• The Forward-chaining algorithm starts from known
facts, triggers all rules whose premises are satisfied,
and add their conclusion to the known facts. This
process repeats until the problem is solved.
Properties of Forward-Chaining:

• It is a down-up approach, as it moves from


bottom to top.
• It is a process of making a conclusion based on
known facts or data, by starting from the initial
state and reaches the goal state.
• Forward-chaining approach is also called as data-
driven as we reach to the goal using available
data.
• Forward -chaining approach is commonly used in
the expert system, such as CLIPS, business, and
production rule systems.
• "As per the law, it is a crime for an American
to sell weapons to hostile nations. Country A,
an enemy of America, has some missiles, and
all the missiles were sold to it by Robert, who
is an American citizen."
• Prove that "Robert is criminal."
Facts Conversion into FOL

• It is a crime for an American to sell weapons to hostile


nations. (Let's say p, q, and r are variables)
American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) →
Criminal(p) ...(1)
• Country A has some missiles. ∃ p Owns(A, p) ∧ Missile(p).
It can be written in two definite clauses by using Existential
Instantiation, introducing new Constant T1.
Owns(A, T1) ......(2)
Missile(T1) .......(3)
• All of the missiles were sold to country A by Robert.
∀ p Missiles(p) ∧ Owns (A, p) → Sells (Robert, p,
A) ......(4)
• Missiles are weapons.
Missile(p) → Weapons (p) .......(5)
• Enemy of America is known as hostile.
Enemy(p, America)
→Hostile(p) ........(6)
• Country A is an enemy of America.
Enemy (A, America) .........(7)
• Robert is American
American(Robert). ..........(8)
Forward chaining proof:

• Step-1:
• Step-2:
• Step 3: In step 3 we can check the given
statement that needs to be checked and check
whether it is satisfied with the substitution
which infers all the previously stated facts.
Thus we reach our goal.
Backward Chaining

• Backward Chaining is a logical process of determining


unknown facts from known solutions by moving
backwards from known solutions to determine the
initial conditions and rules.
• This means that Backward Chaining is a top-down
reasoning approach that starts from conclusions and
then goes back towards the conditions it was inferred
from using the depth-first approach.
• In short, this means that Backward Chaining traces
back through the code and applies logic to determine
which of the following actions would have caused the
result.
Backward Chaining in AI

• The Backward Chaining approach is used in AI to find


the conditions and rules because of which a particular
logical result or conclusion was reached.
• Real-life applications of Backward Chaining include use
to find information regarding conclusions and solutions
in reverse engineering practices as well as game theory
applications.
• Some other applications of Backward Chaining include
automated theorem proving tools, inference engines,
proof assistants and other artificial intelligence
applications.
Steps of working for Backward
Chaining
• Step 1. In the first step, we’ll take the Goal Fact and
from the goal fact, we’ll derive other facts that we’ll
prove true.
• Step 2: We’ll derive other facts from goal facts that
satisfy the rules
• Step 3: At step-3, we will extract further fact which
infers from facts inferred in step 2.
• Step 4: We’ll repeat the same until we get to a certain
fact that satisfies the conditions.
• Let’s take the same example as taken in Forward
Chaining, to prove this time that Robert is the criminal.
• Step 1:
• In the first step, we’ll take the Goal Fact and
from the goal fact, we’ll derive other facts that
we’ll prove true.
• In second step, we’ll derive other facts from
goal facts that satisfy the rules


• Step 3: At step-3, we will extract further facts
which infers from facts inferred in step 2.


• Step 4: We’ll repeat the same until we get to a
certain fact that satisfies the conditions.

• Step 5:
• Once all the facts and conditions have been derived, the iteration process
stops.

You might also like