Rule-Based Reasoning and Expert Systems
Rule-Based Reasoning and Expert Systems
What Is a Rule-Based Reasoning System?
A rule-based reasoning system stores facts and applies logical rules to derive conclusions or recommend actions.
For example, a technical-support system might use rules to identify possible causes of a network problem based on symptoms reported by the user.
A rule-based system typically contains:
- Knowledge base: Facts and rules.
- Inference engine: Applies the rules to available facts.
- User interface: Collects information and presents results.
Some systems also maintain an explanation component that describes which facts and rules contributed to a conclusion.
What Is an Expert System?
An expert system is an AI application designed to solve problems in a specialized domain by applying represented knowledge and reasoning techniques.
Traditional expert systems often rely on rules supplied by domain experts.
Examples include:
- Equipment troubleshooting.
- Configuration validation.
- Policy eligibility checks.
- Technical support.
- Certain forms of decision support.
An expert system does not automatically possess human expertise. Its results depend on the quality and completeness of the knowledge it contains.
Example: A Basic Troubleshooting System
The following Python program uses a few predefined rules to suggest a possible next step when a website cannot be accessed.
def troubleshoot_website(internet_available, site_available):
if not internet_available:
return "Check the network connection"
if not site_available:
return "Check the website or server status"
return "Check browser settings or other causes"
print(troubleshoot_website(False, False))
print(troubleshoot_website(True, False))
print(troubleshoot_website(True, True))Output:
Check the network connection
Check the website or server status
Check browser settings or other causes
The program uses the input conditions to select a recommendation. It does not independently test the network or verify the server's status.
Forward Chaining
Forward chaining begins with known facts and applies rules to derive new facts.
Example:
- Fact: The order is paid.
- Fact: Stock is available.
- Rule: If the order is paid and stock is available, the order can proceed to fulfillment.
- Conclusion: The order can proceed to fulfillment.
This approach is useful when the system receives new facts and needs to determine what follows from them.
Backward Chaining
Backward chaining begins with a goal or query and works backward to determine which facts or rules would establish it.
Example:
Goal: Can the order proceed to fulfillment?
The system checks whether:
- Payment is complete.
- Stock is available.
If both conditions are established, the goal is supported.
Forward chaining asks, "What conclusions follow from the facts I have?"
Backward chaining asks, "What facts do I need to establish this goal?"
Forward vs. Backward Chaining
Feature | Forward Chaining | Backward Chaining |
| Starting point | Known facts | A goal or query |
| Direction | Facts toward conclusions | Goal toward supporting facts |
| Best suited for | Deriving consequences from incoming information | Answering specific queries |
| Example | Process a set of incoming events | Check whether a user qualifies for access |
Limitations of Rule-Based Systems
- Rules must be created, tested, and maintained.
- Large rule sets can become difficult to manage.
- Conflicting rules may produce inconsistent results.
- Missing knowledge can prevent the system from reaching a useful conclusion.
- Traditional rule-based systems do not automatically learn new rules from data.
Practical Exercise
Design a small rule-based system for an online store.
Requirements:
- Store facts about whether an order is paid and whether stock is available.
- Create a rule for determining whether an order can proceed to fulfillment.
- Add a rule that flags unpaid orders.
- Test the system with different combinations of facts.
- Explain which rules produced each result.
Important: In a real e-commerce system, order processing should also account for fraud checks, payment confirmation, inventory consistency, and other business requirements.
Artificial Intelligence Tutorial
Vishalini A








