Unit Check¶
First-line checklist — instantiates Dimensional Consistency Check
The first-line check that every input, output, and intermediate expression carries a compatible unit label before a calculation is trusted.
Unit Check is the lightweight, first-line verification that the unit labels line up: that inputs, outputs, and intermediate steps carry units that are actually compatible for the operations performed, and that the units cancel to leave the units the answer should have. Its defining feature is that it is a label check, not a magnitude or meaning check — it asks whether you are adding metres to metres and not to seconds, whether the units cancel correctly through a division, and whether the final unit is the one you expected. It is the cheapest and most universal member of the archetype's family, the quick pass anyone can run on any calculation. It does not ask whether the number is plausible or whether the construct is right — only whether the units are legal — which is exactly why it is fast enough to run every time.
Example¶
An analyst estimates fuel needed for a delivery route: distance divided by fuel economy. The distance is entered as 240 (kilometres), the vehicle's economy as 30 (miles per gallon), and the formula returns "8." The unit check refuses to trust it. Writing the units out — 240 km ÷ 30 (mi/gal) — the kilometres and miles do not cancel, because they are different length units; the "8" is dimensionally meaningless. The fix is to get both onto one length unit before dividing, after which the units cancel cleanly to gallons, the unit a fuel estimate should carry.
This is precisely the class of failure that a unit check exists to catch, and its most famous instance is a spacecraft: two teams exchanged a thrust figure where one used pound-force seconds and the other assumed newton-seconds, the labels were never reconciled, and the mismatch went undetected all the way to the encounter.[1] The unit check is the discipline of writing the units alongside the numbers and confirming they cancel to the expected result — a habit cheap enough to apply to every calculation, which is the whole point of it being first-line.
How it works¶
- Attach a unit to every quantity. Inputs, outputs, and each intermediate get an explicit unit label, so no bare number enters the calculation.
- Check operation legality on labels. Confirm you are only adding and comparing like units, and that multiplications and divisions combine units in the way the operation requires.
- Cancel through to the result. Carry the units symbolically along the calculation and verify they reduce to the unit the answer is supposed to have; a wrong final unit means a wrong calculation.
- Stop at the label. It deliberately does not judge magnitude or construct — a clean cancellation is a pass at this level.
Tuning parameters¶
- Coverage — just inputs and the final output, or every intermediate too. Checking intermediates catches errors that cancel out by coincidence at the end.
- Formality — a mental glance versus writing the units out symbolically. Writing them out is slower but catches the cancellations the eye skips.
- Prefix strictness — whether SI prefixes and sub-units (km vs. m, ms vs. s) are reconciled or waved through as "same dimension." Strictness catches prefix slips; leniency is faster.
- Trigger frequency — run once at the end, or at every step of a longer derivation. More frequent checking localizes an error to the step that introduced it.
When it helps, and when it misleads¶
Its strength is ubiquity and cost: it is fast enough to apply to literally every calculation, and it catches the single most common quantitative error — combining incompatible units — before anything downstream depends on it. It is the reflex the rest of the archetype's heavier machinery builds on.
Its weakness is that it only checks labels. It passes any calculation whose units cancel correctly even when the number is wildly implausible or the construct is wrong — matching units do not guarantee matching meaning, and it is blind to denominators, scale bases, and stock/flow distinctions that share a unit. Treating a clean unit check as a full validation is its classic misuse. The discipline is to use it as the first gate, not the only one, and to escalate to a magnitude check, a meaning check, or a stock/flow check whenever the quantities involved carry more than their unit label suggests.
How it implements the components¶
unit_dimension_map— attaching an explicit unit to every quantity is the minimal version of the unit/dimension map.operation_compatibility_rule— checking that operations only combine like units, at the label level, is its enforcement of compatibility.consistency_test— cancelling units through to the expected result is the test it performs.
It stops at labels: it does not judge whether the resulting magnitude is physically plausible (that is Engineering Equation Sanity Check) nor whether same-unit quantities share a meaning (that is Finance / Accounting Unit Check or Stock / Flow Separation Check).
Related¶
- Instantiates: Dimensional Consistency Check — the archetype's cheapest and most universal instance, the label-level check the others extend.
- Sibling mechanisms: Engineering Equation Sanity Check · Unit Conversion Workflow · Cross-Scale Transfer Review · Dimensional Analysis Table · Dimensionless Ratio Construction · Finance / Accounting Unit Check · Model Input / Output Contract · Normalized Metric Design · Per-Capita or Per-Unit Conversion · Spreadsheet Unit Audit · Stock / Flow Separation Check
Notes¶
Unit Check detects a mismatch; it does not resolve one. When the check fails, the fix — converting quantities onto a shared unit — is Unit Conversion Workflow. The two are a natural pair: check first, convert if the check fails, then re-check.
References¶
[1] NASA's 1999 Mars Climate Orbiter was lost when navigation software exchanged an impulse figure in pound-force seconds while the receiving system expected newton-seconds; the unit label was never reconciled. It is the canonical illustration of why a first-line unit check is worth running on values that cross a boundary. ↩