Skip to main content

Forward Chaining

note

Generated by ChatGPT, leaving it here for my own reference

Scenario

Imagine we have an expert system for diagnosing simple car issues based on a set of rules.

Rules

  • Rule 1: If the car won't start and the headlights are not working, then the battery is dead.
  • Rule 2: If the car won't start but the headlights are working, then check the fuel system.
  • Rule 3: If the battery is dead and the car was fine yesterday, then the lights were left on.
  • Rule 4: If the battery is dead and the car had issues yesterday, then the battery needs to be replaced.

Facts

  • The car won't start.
  • The headlights are not working.
  • The car was fine yesterday.

Forward Chaining Process

  • Start with the Facts: We begin with the facts we have about the situation - the car won't start, the headlights are not working, and the car was fine yesterday.

  • Apply Rule 1: Given that the car won't start and the headlights are not working, Rule 1 applies. So, we infer a new fact: the battery is dead.

  • Update Facts: Now our facts are: the car won't start, the headlights are not working, the car was fine yesterday, and the battery is dead.

  • Apply Rule 3: With the new fact (the battery is dead) and the existing fact (the car was fine yesterday), Rule 3 applies. We infer that the lights were left on.

Conclusion: We conclude that the car's battery is dead because the lights were left on.

Diagram Representation

[Facts]
|
[Rule 1: Car won't start, headlights not working -> Battery is dead]
|
[New Fact: Battery is dead]
|
[Rule 3: Battery dead, car fine yesterday -> Lights were left on]
|
[Conclusion: Lights were left on, leading to a dead battery]

Summary

In this forward chaining example, starting from an initial set of facts, we applied rules in sequence based on the evolving set of known facts. This led us to the conclusion about the car's issue. Forward chaining is particularly useful in situations where we need to discover a conclusion from a known set of facts, making it a popular choice in expert systems and automated reasoning environments.