THE FOLD / LOOT / THE STASH / THE ARITHMETIC CODING
THE ARITHMETIC CODING
the whole message as one number, at the entropy limit
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Arithmetic coding compresses a whole message into a single number in [0,1). It starts with the interval [0,1) and, for each symbol, narrows to the sub-interval whose width is that symbol’s probability. The final interval’s width is exactly the product of the symbol probabilities, so specifying a point in it costs −log₂(width) = the message’s Shannon entropy — beating Huffman, which is stuck at whole bits per symbol.
LIT verified live: over 300 random strings the exact (big-integer) coder round-trips — decode(encode(s)) = s — and the final interval width equals the exact product of symbol frequencies (window.__arithmeticcoding). FIG no framing; exact, at the entropy limit.
LIT verified live: over 300 random strings the exact (big-integer) coder round-trips — decode(encode(s)) = s — and the final interval width equals the exact product of symbol frequencies (window.__arithmeticcoding). FIG no framing; exact, at the entropy limit.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-stash — packing the loot as tightly as information theory allows, no wasted space. Arithmetic coding is that maximally-tight stash. AVAN (AI) built the instrument: the exact big-integer interval coder, the round-trip decoder, the width-equals-entropy check.
Credit as content: Peter Elias’s idea; practical form by Jorma Rissanen & Richard Pasco (1976) and Witten–Neal–Cleary (1987). The weave: David names the stash; I fold a whole message into one fraction whose width is the product of probabilities, then unfold it back exactly.
Credit as content: Peter Elias’s idea; practical form by Jorma Rissanen & Richard Pasco (1976) and Witten–Neal–Cleary (1987). The weave: David names the stash; I fold a whole message into one fraction whose width is the product of probabilities, then unfold it back exactly.
3 ONE DIMENSION
The [0,1) interval narrowing symbol by symbol: each step keeps the sub-interval for the next symbol, shrinking by its probability. The message is wherever the nested intervals converge.
4 TWO DIMENSIONS · INTERACTIVE
Encode a short string over {a,b,c,d}; watch the interval shrink to the code, then decode it back exactly, and compare the code length to the Shannon entropy.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the single fractional point that is the entire message.
AVAN’s addition (the inverse-companion): the message becomes one number. The whole string is a single point in [0,1), and its interval width equals the product of symbol probabilities, so the code length equals the Shannon entropy exactly — not rounded to whole bits per symbol the way Huffman must. The inverse of ‘one codeword per symbol’ is ‘one number for the entire message, at the entropy limit.’ Magenta is the per-symbol bit-boundaries Huffman is stuck on; green is the single fractional point. Fractional bits, actually achieved.
LIT Genuine arithmetic coding (Elias; Rissanen & Pasco 1976; Witten-Neal-Cleary 1987). Verified live (BigInt exact): decode(encode(s))==s for 300 random strings, and the final interval width numerator equals the exact product of symbol frequencies (window.__arithmeticcoding.roundTrips && .widthIsProduct).
FIG No framing: the exact big-integer interval coder, the round-trip decoder, and the width-equals-product check run in-browser and are exact. The AVAN inverse is honest — the whole string is one point in [0,1) whose interval width = product of probabilities, so code length = Shannon entropy exactly (fractional bits), not rounded per symbol like Huffman; magenta is Huffman's bit-boundaries, green the single point.
FIG No framing: the exact big-integer interval coder, the round-trip decoder, and the width-equals-product check run in-browser and are exact. The AVAN inverse is honest — the whole string is one point in [0,1) whose interval width = product of probabilities, so code length = Shannon entropy exactly (fractional bits), not rounded per symbol like Huffman; magenta is Huffman's bit-boundaries, green the single point.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE STASH · David Lee Wise (ROOT0), with AVAN