Series E · Field Primer · Trits Only

Coding Theory

The Ternary Introduction · How To Send Truth Through Noise

Coding theory is the mathematics of surviving error — sending a message through a noisy channel and recovering it intact even when some symbols get corrupted. The RAID levels you recognized, the parity in your kernel, the witness that locates a fault — all of it lives here. This primer stays in base 3: trits, not bits. Three states { , 0, + }, balanced around zero — and a parity that doesn't just say that an error happened but which way it broke.

§1 The Problem · noise eats symbols

Send a message across any real channel — wire, radio, disk, DNA, a copied corpus — and some symbols flip. The naïve fix is to repeat: send everything three times, take the majority. It works, but it's wasteful — you tripled the data to survive one flip. Coding theory asks the sharper question: what is the least redundancy that still recovers the message? The answer is to add a few carefully-computed check symbols that constrain the whole, so a corruption breaks a constraint and reveals itself. Not brute repetition — structured redundancy.

A code takes k data symbols and adds redundancy to make n total (n > k). Only certain n-symbol words are valid codewords; the rest are "impossible," so an error lands on an impossible word and is caught.

§2 Why Trits · a symbol worth 1.585 bits

A bit holds 2 states; a trit holds 3. So one trit carries log₂3 ≈ 1.585 bits of information — more per symbol. And n trits encode 3ⁿ values: 3, 9, 27, 81… Balanced ternary makes each trit { −1, 0, +1 }, symmetric about zero — which gives the codes a property binary can't have cleanly: an error has not just a magnitude but a sign, a direction. A flipped trit went up or down, and balanced-ternary parity can tell which.

symbolstatesinfo eachn symbols encode
bit2 (0,1)1.000 bit2ⁿ
trit3 (0+)1.585 bit3ⁿ

§3 Hamming Distance · how far apart are two messages

The Hamming distance between two words is the number of positions where they differ. It is the master quantity of coding theory, because it sets everything: if every pair of valid codewords is at least distance d apart, then the code detects d−1 errors and corrects ⌊(d−1)/2⌋. Intuition: spread your valid codewords far apart in symbol-space, and a corrupted word is still closest to the one you meant — so you snap it back. Bigger minimum distance = more errors survived, paid for in redundancy.

distance d → detects (d−1) errors, corrects ⌊(d−1)/2⌋.
d=3 → detect 2, correct 1.   d=5 → detect 4, correct 2.

§4 Balanced-Ternary Parity · the residue that points

The simplest real code: add one check trit equal to the negative sum of the data trits (mod 3, balanced). Now the total of all trits is ≡ 0. Corrupt any one trit and the total is no longer zero — error detected. The beautiful part, unique to balanced ternary: the leftover total isn't just "nonzero," it's itself a trit0 means clean, +1 or −1 tells you the direction the error pushed. The check residue is a tiny compass. Try it:

Live · balanced-ternary parity

CHECK

§5 The Ternary Hamming Code · locate, don't just detect

Parity detects but can't say where. The ternary Hamming code can. Using r = 2 check trits over 4 total — written [4, 2, 3]₃ — it carries 2 data trits and corrects 1 error by pointing at its position. The check trits form an address: when an error occurs, the pattern of failed checks is the coordinate of the broken trit, in balanced ternary. This is your kernel's "3 locates" in its native habitat — the witness that doesn't just see a fault but names it. The same structure scales: more check trits, larger codes, more errors located.

[n, k, d]₃  =  n total trits, k data, distance d, over GF(3).
Ternary Hamming [4,2,3]₃: 4 trits, 2 carry data, corrects 1 error by address.

§6 The Perfect Code · ternary Golay

Some codes are perfect: they pack codewords so tightly that every possible word is within correcting-distance of exactly one codeword — no symbol-space wasted, no gaps. Perfect codes are rare and precious; only a handful exist. One of them is ternary: the Golay code [11, 6, 5]₃ — 6 data trits inside 11, corrects 2 errors, and tiles the space flawlessly. It's one of the most elegant objects in the field, and it lives in base 3. When you reached for ternary as the substrate of a witness kernel, you reached toward the base that hosts a perfect code — not a reason in itself, but a sign you were in good territory.

Perfect code: sphere-packing (Hamming) bound met with equality — zero wasted space.
Ternary Golay [11,6,5]₃ — corrects 2 errors, perfect, one of the few that exist in any base.

§7 Where This Connects

Coding theory is the floor under everything you've been building: parity is your single witness; the Hamming code is "3 locates"; distance-d codes are "tolerate d−1 faults" = the RAID progression; independence reappears as the rule that errors must be uncorrelated or a burst defeats the code (which is why real systems interleave — spreading correlated errors apart so the code sees them as separate). Same skeleton you've met all series: redundancy across independent parts, a residue that witnesses, a bound on how much corruption truth survives. Now you have the field's name for it — and it speaks ternary.