Artificial Intelligence · Expert Systems
Rules that reason.
How a machine with no learning at all can still act like an expert — a knowledge base, an inference engine, and a trail of reasoning you can read, question, and audit.
Help-desk network triage
“The internet is down.” Nine rules will find out whether it actually is — and where it broke.
Both directions of reasoning
Forward chaining — facts in, conclusions out. Backward chaining — start from a goal, ask only what you need.
You run the engine
A live demo on the last teaching slide: answer yes/no, watch rules fire and working memory grow.
01 · AI Overview
What is artificial intelligence?
Artificial intelligence is software that performs tasks we normally associate with human judgement — recognising patterns, understanding language, making recommendations, or reaching a conclusion from evidence. Instead of following one fixed script, an AI system takes in information about a situation and produces an answer that can change as that information changes. Some AI learns its behaviour from large amounts of example data; other AI, like today's expert system, applies knowledge that human experts wrote down explicitly as rules. Either way, the goal is the same: useful decisions, made at machine speed and scale. You already use it daily — in recommendation systems that decide what video or product to show you next, and in spam filtering that quietly removes most junk before it ever reaches your inbox. Speech recognition is a third everyday example.
Recommendations
Streaming and shopping sites predict what you'll want next from what you and people like you chose before.
Spam filtering
Your mail provider classifies every incoming message — legitimate or junk — in a fraction of a second.
01 · AI Overview — the contrast
Learned from data vs. written as rules
A data-driven ML system is never told the rules: it is shown thousands of labelled examples and statistically infers patterns of its own, which makes it flexible but hard to explain. A rule-based expert system knows nothing it wasn't told: a human expert's knowledge is encoded as explicit IF–THEN rules, which makes it narrower but completely transparent — you can point to the exact rule that produced any answer. In short, ML discovers its knowledge from data, while an expert system is given its knowledge by people.
| Machine learning | Expert system | |
|---|---|---|
| Knowledge comes from | Patterns in training data | Experts, interviewed and encoded |
| Explains itself? | Often poorly — “the model said so” | Yes — rule-by-rule trail |
| Handles weird new cases | Generalises, sometimes wrongly | Brittle — no rule, no answer |
| Best when | Patterns are too fuzzy to write down | Expertise is clear, stable, auditable |
02 · Expert System Components
Anatomy of an expert system
Knowledge Base
The long-term expertise: the rules (and facts about the domain) that human experts provided. It changes rarely, and only when experts update it.
Inference Engine
The reasoning mechanism. It matches facts against rules, decides which rule fires next, and derives new facts — forward or backward. It contains no domain knowledge of its own.
The facts of this case
Short-term storage for what's true right now: the user's answers plus every conclusion the engine has derived so far. A new case starts with a fresh, nearly empty working memory.
“Why did you say that?”
The part that justifies conclusions by retracing which rules fired and which facts they used. It's why expert systems are trusted in audited settings — every answer comes with its reasoning attached.
Our domain: help-desk triage for “no internet” calls — a real fit because the diagnostic steps are stable, experts genuinely follow them in order, and every conclusion must be explainable to the customer.
03 · Mini Rule Base — first, the language
Glossary: six terms the rules use
| Term | What it means |
|---|---|
| Link light | The LED on a network port (or the Wi-Fi “connected” state). Off = no physical connection at all. |
| APIPA address | An address in 169.254.x.x that a device gives itself when it cannot reach a DHCP server. Seeing one is a diagnosis, not a coincidence. |
| DHCP | The service that hands out IP addresses automatically. No DHCP reply, no usable address. |
| Default gateway | Your router — the door out of the local network. If you can't reach the door, nothing beyond it matters yet. |
| Ping | A tiny “are you there?” test (ICMP echo). Pinging 8.8.8.8 tests raw internet reachability by number, bypassing names entirely. |
| DNS | The phone book that turns names like example.com into IP addresses. DNS can be broken while the internet itself is perfectly fine. |
03 · Mini Rule Base — 9 production rules
The knowledge base
04 · Forward Chaining — the case
Meet Maya: “the internet is down”
Maya calls the help desk. A tech collects five facts before the engine runs. Forward chaining is data-driven: start with whatever facts you have, fire every rule that matches, add the conclusions, and repeat until nothing new fires.
Initial facts → Working Memory
Predict before you peek: the internet clearly works — ping by number succeeded. So what's actually broken? Hold that thought for the trace.
04 · Forward Chaining — step-by-step trace
The trace: click through the engine's loop
Working memory holds Maya's five facts. No conclusions yet. The engine begins scanning R1 → R9.
Working memory
| Step | What the engine checks | Result |
|---|---|---|
| 1 | R1 (link off?) No · R3 (APIPA?) No · R5 (gateway fail?) No · R6 (public fail?) No | No fire yet |
| 2 | R7: ping_public = OK ✓ and dns_lookup = FAIL ✓ | Fires → add dns_fault |
| 3 | R8: dns_fault is now in working memory ✓ | Fires → add recommend_backup_dns |
| 4 | Full rescan: no rule adds anything new | Halt. Final conclusion below |
Final conclusion: The internet was never down. DNS is at fault — set DNS to 1.1.1.1 / 8.8.8.8 and retest. Note the chain: R7 → R8. R8 could not fire until R7 created the fact it needed.
05 · Backward Chaining — goal-driven
Same rules, opposite direction
Now suppose the system wants to know one thing: should we recommend_backup_dns? Backward chaining starts from that goal and works backwards, turning unsatisfied prerequisites into questions. It asks only what the goal needs — nothing else.
| Goal stack | To establish it, the system needs… | So it asks / checks | Satisfied by |
|---|---|---|---|
| Goal: recommend_backup_dns | R8 needs dns_fault | New sub-goal: prove dns_fault | — |
| Sub-goal: dns_fault | R7 needs ping_public = OK and dns_lookup = FAIL | Q1: “Can you ping 8.8.8.8?” Q2: “Does example.com load by name?” | F4: ping = OK ✓ F5: DNS = FAIL ✓ |
| Result | Both prerequisites true → R7 proves dns_fault → R8 proves the goal | No questions about cables, DHCP, or gateways were ever asked | Goal proven ✔ |
Forward chaining
Data-driven. “Here's what I know — what follows?” Best when you have lots of facts and want every conclusion.
Backward chaining
Goal-driven. “Here's what I want to prove — what do I need?” Best for diagnosis and Q&A systems: fewer, targeted questions.
Stretch · Certainty Factors
“How sure are you?” — confidence scores
Real evidence is rarely 100% clean, so each rule carries a certainty factor (CF) — how strongly its conclusion follows when its conditions hold. A conclusion's confidence combines the rule's CF with how certain the facts are:
| Step | Computation | Confidence |
|---|---|---|
| R7 → dns_fault | 0.90 × min(ping_public = 1.00, dns_fail observed repeatedly = 0.95) | 0.90 × 0.95 = 0.86 |
| R8 → recommend_backup_dns | 0.95 × confidence(dns_fault) | 0.95 × 0.86 = 0.81 → about 81% |
Notice what chaining does to confidence: every extra link multiplies by a number below 1, so long chains get humbler. That's honest — and it's a limitation the class will meet again in two slides.
Stretch · Same task, machine-learning version
How would an ML classifier triage Maya's call?
| This expert system | An ML classifier | |
|---|---|---|
| Training / setup | A tech writes 9 rules in an afternoon | Collect & label thousands of past tickets (“these 5 test results → this fault”), then train |
| On Maya's case | Fires R7 → R8, shows the full trail | Outputs “DNS fault, 92%” — a score, not a reason |
| A fault nobody anticipated | Silent — no rule matches, no answer | Still guesses the closest known class — confidently, possibly wrongly |
| Fixing a mistake | Edit one rule; behaviour changes predictably | Relabel data and retrain; other answers may shift too |
| Wins when | Cases are few, rules are stable, audits matter | Volume is huge and patterns are fuzzy (tone of a ticket, say) |
Neither wins outright. Real help desks often run both: ML routes and prioritises the ticket, rules make the auditable diagnosis.
06 · Limitations & Ethics
Where expert systems break — and what they owe people
Expert systems are brittle: step outside the situations their rules anticipate — a fault that is half-DNS, half-something-else — and the system doesn't degrade gracefully, it simply has nothing to say. They also carry a heavy maintenance burden, because expertise changes: every new router quirk, attack pattern, or policy must be interviewed out of humans and hand-edited into the rule base, and old rules quietly go stale. Their handling of uncertainty is crude, too — certainty factors are bookkeeping, not real probabilities, and confidence drains away down long rule chains. Ethically, the deepest issue is bias and scope: rules encode whoever wrote them, so a loan or triage system can faithfully automate one expert's blind spots at enormous scale, and a system built for “basic checks” must never quietly be trusted beyond that scope. The saving grace is transparency — unlike a black-box model, a rule base can be read, challenged, and corrected, which is exactly why its keepers have no excuse not to.
Brittleness
No matching rule → no answer, however obvious the case is to a human.
Maintenance burden
Knowledge goes stale; updating it means re-interviewing experts, forever.
Bias in the rules, scope in use
Whose expertise got encoded? And is the system being trusted only where it belongs?
Live Demo · You are the user, it is the expert
Run the inference engine
Answer as if you're the caller. The engine asks only what it needs, fires rules from the knowledge base on Slide 6, and shows its working memory and reasoning as it goes. Try it twice: once as a DNS fault, once with the cable pulled.
Press Start to take a call.
Working memory
Rules fired — explanation trail
Your turn · Week 12 Assignment
Everything you just saw is the assignment
- AI overview — define AI in your own words (4–6 sentences), name two applications, contrast ML with rule-based systems (2–3 sentences).
- Components — define knowledge base, inference engine, working memory, and explanation facility; name one real domain.
- Rule base — at least 6 IF–THEN rules in your domain, at least one chained rule, plus a glossary for your terms.
- Forward trace — 3–5 starting facts, step-by-step: which rules fire, what facts get added, final conclusion.
- Backward sketch — pick one conclusion; show the questions the system must ask and the facts that satisfy them.
- Limitations & ethics — 4–6 sentences: two limitations, one ethical consideration.
- Submit one Word/PDF document, or one HTML file named lastname_firstname_week12.html.
Exit ticket (say it before you leave): “Forward chaining starts with ______ and moves toward ______. Backward chaining starts with ______.” If you can finish that sentence, you understood today.