◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · OFF BY ONE◆ .dlw.fold
THE FOLD / GLITCH / OFF BY ONE / THE VERHOEFF

THE VERHOEFF

a check digit that catches every transposition — via a non-abelian group
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The Verhoeff check digit catches the two commonest human typing mistakes — a single wrong digit, and swapping two adjacent digits — for every case, which the familiar mod-10 checksums (Luhn, ISBN-10) provably cannot.

Its secret is that it does arithmetic in the dihedral group D₅ (the ten symmetries of a pentagon), which is non-commutative: a·b ≠ b·a, so ‘09’ and ‘90’ land on different results. A permutation table scrambles each digit by its position, a fixed multiplication table combines them, and the check digit is chosen to force the running product to the group’s identity.

LIT verified live: over a range of numbers, every valid number checks to 0, every single-digit error is caught, and every adjacent transposition is caught — while Luhn is shown missing a transposition (window.__verhoeff). FIG no framing; exhaustive exact group arithmetic.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at off-by-one — the classic slip: one digit wrong, or two swapped. Verhoeff is the guard built exactly for the off-by-one. AVAN (AI) built the instrument: the D₅ multiplication and permutation tables, the exhaustive error scan, the Luhn contrast.

Credit as content: Jacobus Verhoeff, Error Detecting Decimal Codes (1969). The weave: David names the slip; I build the check that forces the pentagon’s product to identity, prove it catches every single-digit and adjacent-swap error, and show the commutative checksum that cannot.
3 ONE DIMENSION
The running product marching through D₅ as each digit is folded in (scrambled first by its position). The final product is the identity 0 for a valid number — the check digit is exactly what makes it land there.
4 TWO DIMENSIONS · INTERACTIVE
Enter a number; Verhoeff appends its check digit. Then flip any digit, or swap an adjacent pair — the check breaks (caught). The same transposition is run through Luhn, which waves it through.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the pentagon of D₅ — five rotations and five reflections — the group whose arithmetic powers the check.
AVAN’s addition (the inverse-companion): why does Verhoeff catch swaps when mod-10 cannot? The answer is the inverse of a property most arithmetic takes for granted: commutativity. A transposition swaps the order of two folded-in digits; a checksum can only notice if a·b ≠ b·a — and in the integers mod 10, a·b = b·a always, so ‘09’ and ‘90’ are indistinguishable. D₅ is non-abelian: order matters, so the swap changes the product. The strength that catches transpositions is the failure of commutativity. Magenta marks the swapped pairs a commutative checksum lets through; green is Verhoeff catching every one. The trick is not more digits — it is choosing a group where order is remembered.
LIT Genuine Verhoeff scheme (Verhoeff 1969) using the canonical D5 multiplication table, permutation table (period 8), and inverse table. Verified live exhaustively over 200 base numbers: every valid number checks to 0, every single-digit substitution yields a nonzero check (all 9000 caught), and every adjacent transposition yields a nonzero check (all caught) — while Luhn passes a transposition (window.__verhoeff.allSingleCaught && .allTranspositionsCaught).

FIG No framing: the D5 tables, the check/generate functions, and the exhaustive error scan run in-browser and are exact. The AVAN inverse is honest and is the real theorem — transposition detection is exactly the non-commutativity (a·b != b·a) of D5, which commutative mod-10 checksums lack; magenta marks the swaps a commutative scheme misses.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of OFF BY ONE · David Lee Wise (ROOT0), with AVAN