Checking facts, sources and generated code
A polished reply, a neat citation, or clean-looking code can still be wrong. One verification habit lets you check all three before you rely on them.
One habit covers facts, sources, and code.
In Lesson 2.7 you saw that an AI model writes fluent text without checking whether each detail is supported. That means confident wording, a formatted reference, or neat code is not proof that an answer is right.
One verification principle covers all three: test any claim that matters with an independent check outside the AI’s own reply. Asking the same chat “are you sure?” is not an independent check, because the model can smoothly repeat or defend a mistake.
In this lesson you will apply that habit in order: checking a fact against a primary source, running a citation check on a named reference, and (optionally, with no programming background needed) checking generated code with a test case and a boundary case.

Maya is an invented community volunteer drafting a neighborhood FAQ and a tiny day-pass price rule for the invented Riverbend Community Pool. Every claim in this lesson is checked against one invented 2026 official notice so no real-world fact is at stake.
Single-page notice (updated April 2026; replaces archived 2023 flyer). All ages are whole years.
- Opening date: May 15, 2026 (open daily, 7:00 AM to 8:00 PM).
- Resident day pass: $6 per visit; ages 5 and under enter free ($0).
- Senior discount: ages 65 and older pay $4 per visit.
- Lap-swim lane booking: required only on weekends (Saturday and Sunday); no booking needed Monday–Friday.
Checking facts: go to the primary record.
A primary source is the original official record, document, or data where a fact comes from, rather than a summary or an AI reply.
Specific details — numbers, dates, fees, and age cutoffs — are often where an AI draft blends a real detail with a plausible-sounding slip.
The assistant writes: “Resident day passes cost $6, and children under 10 enter free.” Comparing that sentence against the Official 2026 Notice shows the $6 fee is right, but the free-entry cutoff is ages 5 and under, not under 10.
Everyday example: if an assistant tells you a local clinic’s holiday hours, check the clinic’s own website or call them directly instead of relying on an AI summary that may blend last year’s hours.
Checking sources: a citation is a lead, not proof.
A common trap is assuming that a formatted citation means the claim was verified. In practice, a citation is only a lead until you run a citation check: open the named source yourself and check three things.
- Exists? Does the page, book, or section actually exist?
- Matches claim? Does it actually say what the AI claims, rather than something different or opposite?
- Current? Is it the current version for your situation, not an archived rule?

The assistant writes: “Lap-swim lanes require advance booking every day (Source: Riverbend Pool Notice, Section 4: Daily Lane Policy).” Opening the official 2026 notice reveals two problems: it is a single page with no Section 4, and booking is required only on weekends.
Everyday example: an assistant quotes a book and gives a page number; opening that page can show a completely different paragraph or a chapter that does not exist.
- What if the link opens a real website?
- Still read the page: an assistant can attach a real link to a claim that the page never makes.
- What if I ask the assistant to double-check its own citation?
- Asking the same chat is not an independent check; it can smoothly confirm an invented reference.
Checking generated code (optional).
You can skip code practice if you do not work with code, or follow along here with zero programming background.
The same verification principle applies: do not judge code by how neat it looks — test what it actually does. Think of checking a recipe by tasting the dish rather than admiring how cleanly it is printed.
In technical terms, you check code with a test case (a concrete input whose right answer you already know) and a boundary case (an input right on the edge of a rule, such as age 5 for “ages 5 and under”).
Below is pseudocode — simplified step-by-step instructions written like code. Read it from top to bottom and stop at the first match: if checks the first condition, else if checks the next only if the first failed, and else catches everything left (< means less than, > means greater than, and -> means “give this price”).
if age < 5 -> $0 (under 5)
else if age > 65 -> $4 (over 65)
else -> $6 (everyone else)Testing a normal case like age 30 returns $6, which matches the 2026 notice. Testing the boundary cases age 5 and age 65 catches the bug: both return $6 instead of $0 and $4, because 5 is not less than 5 and 65 is not greater than 65.
Everyday example: if an assistant writes a spreadsheet formula for a 10% discount on orders of $50 or more, testing $60 may pass while testing exactly $50 catches whether “$50 or more” was accidentally written as “over $50.”
Safety note: before running unfamiliar AI-generated code on your own computer, check what files or accounts it touches, or run it in a safe sandbox.
Lab: verify Maya’s AI draft step by step.
Walk through Maya’s flawed draft using the same verification habit for each claim. Try it in this order:
- In Step 1 (Fact check), open the Official 2026 Notice, compare the age cutoff, and pick your verdict.
- In Step 2 (Source check), first try asking the AI “Are you sure?” to see why self-checking fails, then open the Official 2026 Notice and pick your verdict.
- Optionally open Step 3 (Code check), run Age 30 (normal) first, then test Age 5 (boundary) and Age 65 (boundary) before picking a verdict.
Simulation note: Maya’s draft, the AI follow-up reply, the Riverbend Pool notice, and the rule runner below are invented and scripted for this lesson — not a live AI model or real town pool.
“Resident day passes cost $6, and children under 10 enter free.”
Check your understanding.
Take this with you.
One habit covers facts, sources, and generated code: verify what matters with an independent check outside the AI’s own reply.
Check facts against primary records, open citations to confirm they exist, match, and are current, and test code on both normal and boundary cases.