Lecture 08.1: Rule-Based Expert Systems
An introduction to Expert Systems, their architecture, and the mechanics of Forward and Backward Chaining.
A computer program capable of performing at a human-expert level in a narrow problem domain area is called an Expert System. Rather than relying on traditional algorithmic logic, these systems use specific domain knowledge and rules to simulate human decision-making. Common examples include Rule-based expert systems, Fuzzy expert systems, and Frame-based expert systems.
Production System Model & Architecture
Introduced by Allen Newell and Herbert Simon at Carnegie-Mellon University in the early 1970s, the production system model forms the foundation of modern rule-based expert systems. It mirrors human cognitive problem-solving by separating long-term knowledge from short-term context.
Production Rule Structure
In a production system, domain knowledge is expressed as production rules consisting of an antecedent (condition) and a consequent (action):
- Example 1:
IF the 'traffic light' is green THEN the action is go - Example 2:
IF the 'traffic light' is red THEN the action is stop
Five Core Components
- Knowledge Base (Long-term Memory): Contains domain-specific production rules (
IF-THEN) acquired from human experts. - Database (Short-term Memory): Contains current problem-specific facts used to match the antecedent (
IF) part of production rules. - Inference Engine: The reasoning mechanism that matches database facts against knowledge base rules to infer new facts or conclusions.
- Explanation Facilities: Enables users to ask why specific questions are asked or how conclusions were derived.
- User Interface: The interaction channel between the non-expert user and the expert system.
The Five Categories of Rules
In an expert system, rules do not just represent simple conditional tests; they model different facets of human expertise and reasoning:
1. Relation
Expresses a static relationship or physical link between entities in the domain.
IF the 'fuel tank' is empty
THEN the car is dead2. Recommendation
Advises a specific course of action based on environmental conditions.
IF the season is autumn
AND the sky is cloudy
AND the forecast is drizzle
THEN the advice is 'take an umbrella'3. Directive
Gives a specific command or instruction to resolve a detected problem state.
IF the car is dead
AND the 'fuel tank' is empty
THEN the action is 'refuel the car'4. Strategy
Outlines sequential, procedural steps to troubleshoot or analyze a problem.
IF the car is dead
THEN the action is 'check the fuel tank'; step1 is complete
IF step1 is complete
AND the 'fuel tank' is full
THEN the action is 'check the battery'; step2 is complete5. Heuristic
Represents a rule-of-thumb, shortcut, or empirical observation used by human experts to solve problems quickly without full physical models.
IF the spill is liquid
AND the 'spill pH' < 6
AND the 'spill smell' is vinegar
THEN the 'spill material' is 'acetic acid'Inference Techniques: Forward vs. Backward Chaining
To illustrate how the Inference Engine operates, consider the following benchmark system setup:
- Knowledge Base (Rules):
- Rule 1:
- Rule 2:
- Rule 3:
- Rule 4:
- Rule 5:
- Database (Initial Facts):
- Goal: Infer
1. Forward Chaining (Data-Driven Reasoning)
Forward chaining starts with known data/facts in the database and proceeds forward by matching antecedents and firing rules to deduce new facts until no further rules can be fired or the goal is reached.
[!NOTE] Conflict Resolution Rule: When multiple rules match the database simultaneously, the inference engine executes the topmost rule in rule order. Each rule can be executed at most once.
Step-by-Step Execution Trace (Match-Fire Cycles)
- Cycle 1:
- Match: matches Rule 3 () and Rule 4 ().
- Fire: Rule 3 (topmost rule).
- Database Updated: .
- Cycle 2:
- Match: matches Rule 4 () and Rule 2 ().
- Fire: Rule 4 (topmost rule).
- Database Updated: .
- Cycle 3:
- Match: matches Rule 2 ().
- Fire: Rule 2.
- Database Updated: .
- Cycle 4:
- Match: matches Rule 1 ().
- Fire: Rule 1.
- Database Updated: .
- Result: Goal is added to the database. Match-fire cycle terminates!
[!WARNING] Efficiency Limitation: Forward chaining is not efficient if the goal is to infer only one particular fact, because it derives all intermediate facts (such as via Rule 4) regardless of whether they contribute to the goal .
2. Backward Chaining (Goal-Driven Reasoning)
Backward chaining starts with a hypothetical solution or goal () and searches the knowledge base backward to find supporting evidence and satisfy required sub-goals.
Step-by-Step Execution Trace (6-Pass Reasoning)
- Pass 1 (Goal ):
- Search KB for rules deriving Rule 1 ().
- Facts needed: and .
- Check DB: is in DB; is missing.
- New Sub-goal: .
- Pass 2 (Sub-goal ):
- Search KB for rules deriving Rule 2 ().
- Facts needed: .
- Check DB: and are in DB; is missing.
- New Sub-goal: .
- Pass 3 (Sub-goal ):
- Search KB for rules deriving Rule 3 ().
- Facts needed: .
- Check DB: is in DB!
- Pass 4: Fire Rule 3 Add to DB. Sub-goal proven.
- Pass 5: Fire Rule 2 () Add to DB. Sub-goal proven.
- Pass 6: Fire Rule 1 () Add to DB. Goal proven!
[!TIP] Goal-Directed Efficiency: Unlike forward chaining, backward chaining never evaluates Rule 4 () or Rule 5 () because they do not lead to goal . This makes backward chaining optimal when verifying a specific hypothesis.
Lecture 07.2: Backtracking and Local Search for CSPs
Exploring backtracking algorithms, intelligent heuristics (MRV, Degree, LCV), Forward Checking, and the Min-Conflicts Local Search.
Lecture 08.2: Fuzzy Expert Systems
Handling vagueness and ambiguity using Fuzzy Logic, membership functions, and the four steps of Fuzzy Inference.