Forward Chaining and backward chaining in AI

In this page we will learn about What is Forward Chaining and backward chaining in AI?, What is Inference engine?, Forward Chaining, Properties of Forward-Chaining, Facts Conversion into FOL,


What is Forward Chaining and backward chaining in AI?

Forward and backward chaining is an essential topic in artificial intelligence, but before we go into forward and backward chaining, let's look at where these two phrases come from.

What is Inference engine?

In artificial intelligence, the inference engine is a component of the intelligent system that applies logical rules to the knowledge base to infer new information from known facts. The expert system included the first inference engine. Inference engines often operate in one of two modes:
a) Forward chaining
b) Backward chaining

Horn Clause and Definite clause:

Horn clause and definite clause are sentence types that allow the knowledge base to apply a more limited and efficient inference algorithm. Forward and backward chaining techniques are used in logical inference algorithms, and they both need KB in the form of a first-order definite sentence.
Definite clause: sometimes known as a strict horn clause, is a clause that is a disjunction of literals with exactly one affirmative literal.
Horn clause: A horn clause is a clause that is a disjunction of literals with at most one affirmative literal. As a result, all of 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

When employing an inference engine, forward chaining is also known as forward deduction or forward reasoning. Forward chaining is a type of reasoning that starts with atomic sentences in a knowledge base and uses inference rules (Modus Ponens) to extract more data in the forward direction until a goal is attained.

The Forward-chaining algorithm begins with known facts, then activates all rules with satisfied premises and adds their conclusion to the known facts. This process continues until the issue is resolved.

Properties of Forward-Chaining:

  • As it moves from bottom to top, it is a down-up method.
  • It is a method of arriving at a conclusion based on known facts or data by starting at the beginning and working one's way to the end.
  • Forward-chaining is also known as data-driven since it allows us to achieve our goal by utilizing existing data.
  • Expert systems, such as CLIPS, business, and production rule systems, frequently employ the forward-chaining approach.
Consider the following well-known example, which we'll apply to both ways.
Example:

"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."
To answer the problem, we'll turn all of the facts above into first-order definite clauses, then utilize a forward-chaining procedure to get to the goal.

Facts Conversion into FOL:

  • Selling weapons to unfriendly or hostile countries is illegal in the United States. (Let's say p, q, and r are variables)
    American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) → Criminal(p) ...(1)
  • It is a method of arriving at a conclusion based on known facts or data by starting at the beginning and working one's way to the end.
  • Forward-chaining is also known as data-driven since it allows us to achieve our goal by utilizing existing data.
  • Expert systems, such as CLIPS, business, and production rule systems, frequently employ the forward-chaining approach.

Difference between backward chaining and forward chaining

Following is the difference between the forward chaining and backward chaining:
  • Forward chaining begins with known facts and moves forward by applying inference rules to extract more data until it reaches the goal, whereas backward chaining begins with the goal and moves backward by applying inference rules to determine the facts that satisfy the goal.
  • The down-up strategy is known as forward chaining, and the top-down approach is known as backward chaining.
  • Forward chaining employs a breadth-first search approach, whereas reverse chaining employs a depth-first search approach.
  • The Modus ponens inference rule is used in both forward and backward chaining.
  • Forward chaining is useful for jobs like planning, design process monitoring, diagnosis, and classification, whereas backward chaining is useful for tasks like categorization and diagnosis.
  • Backward chaining aims to avoid the needless path of reasoning, whereas forward chaining can be like an exhaustive search.
  • There may be a variety of ASK questions from the knowledge base in forward-chaining, whereas there may be fewer ASK questions in backward-chaining.
  • Forward chaining is sluggish because it tests all of the rules, whereas backward chaining is quick since it simply checks the rules that are required.
Forward chaining Backward chaining
1. Forward chaining begins with known facts and uses inference rules to extract more data units until it gets the desired outcome. Backward chaining starts with the objective and works backwards using inference rules to locate the necessary facts to support it.
2. It is a bottom-up approach. It is a top-down approach.
3. Forward chaining is also regarded as a data-driven inference strategy because it allows us to attain our goal using the data we already have. Backward chaining is a goal-driven strategy since it begins with the objective and divides it into sub-goals in order to extract the facts.
4. Forward chaining is also regarded as a data-driven inference strategy because it allows us to attain our goal using the data we already have. Backward chaining is a goal-driven strategy since it begins with the objective and divides it into sub-goals in order to extract the facts.
5. All of the available rules are subjected to forward chaining testing. Only a few required rules are tested via backward chaining.
6. Forward chaining is appropriate for applications such as planning, monitoring, control, and interpretation. Backward chaining is a useful technique for diagnosing, prescribing, and debugging.
7. Forward chaining can lead to an unlimited number of different outcomes. The number of possible conclusions generated by backward chaining is finite.
8. It works in the forward direction. It works in the backward direction.
9. The goal of forward chaining is to reach any conclusion. Backward chaining is only for the data that is required.