- 2071 Bhadra · 7 marks
Backward chaining with example
Short answer
Backward chaining is goal-driven: start with goal, find rules with matching conclusion, prove conditions as sub-goals recursively. Example: goal green(Fritz) uses rule frog→green, sub-goal frog(Fritz) uses rule croaks∧eats_flies→frog, sub-goals croaks(Fritz) and eats_flies(Fritz) are facts, proving goal.
Explain Backward Chaining with suitable example.
Backward chaining is a goal-driven reasoning method used in rule-based systems. It starts with the goal (hypothesis) and works backwards: it finds rules whose THEN part (conclusion) matches the goal, and then tries to prove the IF parts (conditions) of those rules as new sub-goals. A sub-goal is proved if it is a known fact, or if it can in turn be proved by another rule. If a sub-goal cannot be proved and cannot be asked from the user, the rule fails and another rule is tried (backtracking). Prolog and MYCIN use backward chaining.
Algorithm
prove(goal):
if goal is in the fact base -> return TRUE
for each rule whose conclusion matches goal:
if prove(every condition of the rule) -> return TRUE
return FALSE
Example
Rules:
- R1: IF X croaks AND X eats flies THEN X is a frog
- R2: IF X chirps AND X sings THEN X is a canary
- R3: IF X is a frog THEN X is green
- R4: IF X is a canary THEN X is yellow
Facts: Fritz croaks. Fritz eats flies.
Goal: Is Fritz green?
| Step | Goal / sub-goal | Action |
|---|---|---|
| 1 | green(Fritz)? | Not a fact; rule R3 concludes "green": new sub-goal frog(Fritz) |
| 2 | frog(Fritz)? | Not a fact; R1 concludes "frog": sub-goals croaks(Fritz), eats_flies(Fritz) |
| 3 | croaks(Fritz)? | Known fact: TRUE |
| 4 | eats_flies(Fritz)? | Known fact: TRUE |
| 5 | R1 conditions satisfied | frog(Fritz) is TRUE |
| 6 | R3 condition satisfied | green(Fritz) is TRUE |
green(Fritz)
| R3
frog(Fritz)
| R1
+-- croaks(Fritz) [fact]
+-- eats_flies(Fritz) [fact]
Result: The goal is proved: Fritz is green. Rules R2 and R4 are never examined, which shows why backward chaining is efficient when there is a specific goal.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Forward vs backward chaining · Artificial Intelligence, chapter 4 · asked 3×
- Rule based reasoning; backward chaining · Artificial Intelligence, chapter 4