Expert Systems — Live Demo Week 12 · Teach with ← → keys or the buttons below

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.

TODAY'S DOMAIN

Help-desk network triage

“The internet is down.” Nine rules will find out whether it actually is — and where it broke.

YOU WILL SEE

Both directions of reasoning

Forward chaining — facts in, conclusions out. Backward chaining — start from a goal, ask only what you need.

AT THE END

You run the engine

A live demo on the last teaching slide: answer yes/no, watch rules fire and working memory grow.

Say: “Everything in this deck is one worked example of your Week 12 assignment. If you can explain what happens on each slide, you can write the assignment.” Set expectations: no maths beyond one confidence multiplication in the stretch slide.

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.

APPLICATION 1

Recommendations

Streaming and shopping sites predict what you'll want next from what you and people like you chose before.

APPLICATION 2

Spam filtering

Your mail provider classifies every incoming message — legitimate or junk — in a fraction of a second.

Ask the room: “Where did AI touch your morning?” Take two answers. Land the point: AI is the umbrella; machine learning and expert systems are two different ways of getting there — that's the next slide.

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 learningExpert system
Knowledge comes fromPatterns in training dataExperts, interviewed and encoded
Explains itself?Often poorly — “the model said so”Yes — rule-by-rule trail
Handles weird new casesGeneralises, sometimes wronglyBrittle — no rule, no answer
Best whenPatterns are too fuzzy to write downExpertise is clear, stable, auditable
Analogy that works: ML is a student who did 10,000 practice problems. An expert system is an expert's checklist, laminated. Both can be right; only one can show its working on demand.

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.

WORKING MEMORY

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.

EXPLANATION FACILITY

“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.

Emphasise the separation: swap the knowledge base and the same engine becomes a loan pre-screener or a symptom checker. Knowledge and reasoning are separate parts — that's the whole design idea. Students must define all four components in the assignment.

03 · Mini Rule Base — first, the language

Glossary: six terms the rules use

TermWhat it means
Link lightThe LED on a network port (or the Wi-Fi “connected” state). Off = no physical connection at all.
APIPA addressAn 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.
DHCPThe service that hands out IP addresses automatically. No DHCP reply, no usable address.
Default gatewayYour router — the door out of the local network. If you can't reach the door, nothing beyond it matters yet.
PingA tiny “are you there?” test (ICMP echo). Pinging 8.8.8.8 tests raw internet reachability by number, bypassing names entirely.
DNSThe phone book that turns names like example.com into IP addresses. DNS can be broken while the internet itself is perfectly fine.
Teach the trick: pinging by number vs. by name is how a tech separates “the internet is down” from “only DNS is down.” That one distinction drives the payoff case in two slides.

03 · Mini Rule Base — 9 production rules

The knowledge base

R1  IF link_light = OFF THEN physical_fault CF 0.95
R2  IF physical_fault AND cable_swap_still_no_link THEN nic_or_port_failure → escalate to Tier 2 CF 0.90⬆ Chained: R2 consumes R1's conclusion — it can only fire after R1 has.
R3  IF ip_address = APIPA (169.254.x.x) THEN dhcp_not_reached CF 0.90
R4  IF dhcp_not_reached AND static_ip_test = WORKS THEN dhcp_server_fault → check the DHCP server / scope CF 0.85⬆ Chained from R3.
R5  IF valid_ip AND ping_gateway = FAIL THEN gateway_unreachable → check the router CF 0.85
R6  IF ping_gateway = OK AND ping_public_ip = FAIL THEN upstream_wan_fault → the fault is beyond the router CF 0.85
R7  IF ping_public_ip = OK AND dns_lookup = FAIL THEN dns_fault CF 0.90
R8  IF dns_fault THEN recommend_backup_dns (set DNS to 1.1.1.1 / 8.8.8.8, then retest) CF 0.95⬆ Chained from R7 — a rule firing purely because another rule concluded something.
R9  IF ping_public_ip = OK AND dns_lookup = OK AND web_page = FAIL THEN app_or_proxy_fault → the network is fine; look at the app CF 0.80
Point at R2, R4, R8: “These three are why it's called chaining — conclusions become facts, and facts fire more rules.” The assignment requires at least 6 rules and at least one chain; this base has 9 and three chains.

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

F1 · link_light = ON F2 · ip = 192.168.1.47 (valid) F3 · ping_gateway = OK F4 · ping 8.8.8.8 = OK F5 · dns_lookup = FAIL

Predict before you peek: the internet clearly works — ping by number succeeded. So what's actually broken? Hold that thought for the trace.

Run the prediction out loud. Most students will say DNS — good. Now make them watch the machine reach the same answer mechanically, with no intuition at all. Use the stepper buttons on the next slide, one click per step, and narrate the scan each time.

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

link_light=ON · ip=192.168.1.47 · ping_gateway=OK · ping_public=OK · dns_lookup=FAIL
StepWhat the engine checksResult
1R1 (link off?) No · R3 (APIPA?) No · R5 (gateway fail?) No · R6 (public fail?) NoNo fire yet
2R7: ping_public = OK ✓ and dns_lookup = FAIL ✓Fires → add dns_fault
3R8: dns_fault is now in working memory ✓Fires → add recommend_backup_dns
4Full rescan: no rule adds anything newHalt. 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.

Key vocabulary: match → fire → add → rescan. Ask: “Why does the engine rescan from the top after R7?” Because a new fact can unlock rules it already passed. That's the forward-chaining loop, and it's exactly what their trace tables must show.

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 stackTo establish it, the system needs…So it asks / checksSatisfied by
Goal: recommend_backup_dnsR8 needs dns_faultNew sub-goal: prove dns_fault—
Sub-goal: dns_faultR7 needs ping_public = OK and dns_lookup = FAILQ1: “Can you ping 8.8.8.8?”
Q2: “Does example.com load by name?”
F4: ping = OK ✓
F5: DNS = FAIL ✓
ResultBoth prerequisites true → R7 proves dns_fault → R8 proves the goalNo questions about cables, DHCP, or gateways were ever askedGoal 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.

Contrast to land: forward chaining in Maya's case scanned all 9 rules; backward chaining asked 2 questions. Same knowledge base, same conclusion, completely different path. Classic backward-chaining systems (like MYCIN) feel like interviews for exactly this reason.

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:

confidence(conclusion) = CF(rule) × min( confidence of each IF fact )
StepComputationConfidence
R7 → dns_fault0.90 × min(ping_public = 1.00, dns_fail observed repeatedly = 0.95)0.90 × 0.95 = 0.86
R8 → recommend_backup_dns0.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.

Work it live on the board with these exact numbers; students consistently lose marks by adding CFs instead of multiplying / taking the minimum. Emphasise: CFs are a simple bookkeeping device, not true probabilities.

Stretch · Same task, machine-learning version

How would an ML classifier triage Maya's call?

This expert systemAn ML classifier
Training / setupA tech writes 9 rules in an afternoonCollect & label thousands of past tickets (“these 5 test results → this fault”), then train
On Maya's caseFires R7 → R8, shows the full trailOutputs “DNS fault, 92%” — a score, not a reason
A fault nobody anticipatedSilent — no rule matches, no answerStill guesses the closest known class — confidently, possibly wrongly
Fixing a mistakeEdit one rule; behaviour changes predictablyRelabel data and retrain; other answers may shift too
Wins whenCases are few, rules are stable, audits matterVolume 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.

Discussion prompt (2 min): “Your hospital / bank / help desk — which failure mode scares you more: silence, or a confident wrong guess?” There's no right answer; the trade-off is the lesson.

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.

LIMITATION 1

Brittleness

No matching rule → no answer, however obvious the case is to a human.

LIMITATION 2

Maintenance burden

Knowledge goes stale; updating it means re-interviewing experts, forever.

ETHICS

Bias in the rules, scope in use

Whose expertise got encoded? And is the system being trusted only where it belongs?

Tie it back: Maya's system said nothing about why DNS failed — scope. And notice the assignment asks for 4–6 sentences here, not a list; the paragraph above is a model of the expected shape.

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.

INFERENCE ENGINE ASKS

Press Start to take a call.

Working memory

(empty — no case yet)

Rules fired — explanation trail

The explanation facility will narrate here.
Demo script: Run 1 (project it): link Yes → valid IP Yes → gateway Yes → 8.8.8.8 Yes → name loads No = Maya's DNS case, R7→R8. Run 2: link No → cable swap still dead Yes = R1→R2, Tier 2 escalation. Run 3 if time: IP is 169.254 = R3→R4 DHCP chain. Ask a student to drive each run.

Your turn · Week 12 Assignment

Everything you just saw is the assignment

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.

Close: answers — facts / conclusions; a goal. Stretch goals are 0 extra points but are the best exam prep in the packet: certainty factors, an interactive page like the demo, and the ML comparison are all modelled in this deck.