Knowledge Inference - Forward and Backward Chaining

An Inference Engine is a tool from artificial intelligence. The first inference engines were components of expert systems. The typical expert system consisted of a knowledge base and an inference engine. The knowledge base stored facts about the world. The inference engine applied logical rules to the knowledge base and deduced new knowledge. This process would iterate as each new fact in the knowledge base could trigger additional rules in the inference engine. Inference engines work primarily in one of two modes either special rule or facts: forward chaining and backward chaining. Forward chaining starts with the known facts and asserts new facts. Backward chaining starts with goals, and works backward to determine what facts must be asserted so that the goals can be achieved.

Inference Rules 

Deductive inference rule:
 
Forward Chaining: Conclude from "A" and "A implies B" to "B".
A
A ->  B
B
-------- ------------- -------------
Example:
It is raining.
If it is raining, the street is wet.
The street is wet.
-------- ------------- -------------
         
Abductive inference rule:
 
Backward Chaining: Conclude from "B" and "A implies B" to "A".
B
A ->  B
A
-------- ------------- -------------
Example:
                                                                  The street is wet.
                                                           If it is raining, the street is  wet.
                                                                       It is raining.
                                                                                                                     
Forward chaining 

Forward Chaining 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 for expert systems, business and production rule systems.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 such a rule is found, the engine can conclude, or infer, the consequent (Then clause), resulting in the addition of new information to its data.


A Horn clause C is called definite it contains exactly one positive literal, i.e., implications of type




are not possible.
If the knowledge base consists of Horn clauses only, then generalized modus ponens can be used just like modus ponens to infer statements iteratively by forward chaining


Example

The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American.Prove that Col. West is a criminal.

 

 

 

Step 1:

Step 2:

Step 3:
 
 

Finally from the given facts we proved that Col.West is Criminal by using Forward Chaining algorithm.

Backward Chaining:

Backward chaining (or backward reasoning) is an inference method that can be described (in lay terms) as working backward from the goal(s). It is used in automated theorem provers, inference engines, proof assistants and other artificial intelligence applications.
In game theory, its application to (simpler) subgames in order to find a solution to the game is called backward induction. In chess, it is called retrograde analysis, and it is used to generate tablebases for chess endgames for computer chess.
Backward chaining is implemented in logic programming by SLD resolution. Both rules are based on the modus pollens inference rule. It is one of the two most commonly used methods of reasoning with inference rules and logical implications – the other is forward chaining. Backward chaining systems usually employ a depth-first search strategy

Let us consider the same example and will prove Col.West is Criminal using Backward Chaining.

Step 1:
 

Step 2:
Step 3:
Step 4:
Step 5:

 

 Finally we proved Col.West is criminal using backward chaining algorithm.

20 comments:

  1. Extensively explained.... A great help to me in exams.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thank you very much. This has been a great help for my exam. And it's really interesting. Nice choice for the example😋

    ReplyDelete
  4. Thank you so much! Really appreciate it!

    ReplyDelete
  5. Awesome, gonna perform in my exam with this.

    ReplyDelete
  6. Explanation well.analysis..chaining system ..well awesome..sloving

    ReplyDelete
  7. Can I have a python code for both the reasoning please.

    ReplyDelete
  8. its good nut more explanations on diagram is necessary !!

    ReplyDelete
  9. This AI Training In Delhi program by certified trainers from IIT and IIM foundation is by a long shot consider to be the best in the AI training industry and is best trusted for success in the career of the students.
    For More Info: Artificial Intelligence Course in Delhi

    ReplyDelete
  10. This is good information and really helpful for the people who need information about this.
    Artificial intelligence Training in Delhi
    Artificial intelligence Course in Delhi

    ReplyDelete
  11. country(Nono) is not included? Doesn't all the facts need to be included for both forward and backward chaining?

    ReplyDelete