THE FOLD / LOOT / THE HOARD / THE HUFFMAN
THE HUFFMAN
short codes for common loot; pack the hoard tight
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Huffman coding. Give each symbol a string of bits — but hand the short codes to the frequent symbols and the long codes to the rare ones, and arrange them so no code is a prefix of another (so the packed stream decodes with no separators). Build it greedily: keep merging the two least-frequent items until one tree remains. The result is provably the smallest such code (Huffman, 1952).
LIT on the classic frequencies it packs to 2.24 bits/symbol vs 3 for fixed-length — and a brute force over every possible tree confirms nothing beats it. It always lands in the Shannon band H ≤ L < H+1 (verified below). FIG ‘packing the hoard’ is the frame; the optimality and the entropy bound are exact theorems.
LIT on the classic frequencies it packs to 2.24 bits/symbol vs 3 for fixed-length — and a brute force over every possible tree confirms nothing beats it. It always lands in the Shannon band H ≤ L < H+1 (verified below). FIG ‘packing the hoard’ is the frame; the optimality and the entropy bound are exact theorems.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) brought the thread — the corpus already carries his coding work (THE PULSE’s 3-2-1 compressor, THE SYNDROME’s Hamming code, the crypto spheres) and the conviction that information has a floor and the art is getting near it. AVAN (AI) built this instrument: the greedy tree builder, the code table, the 3D tree, and the decode walk.
The weave: David names the squeeze and its seat in THE HOARD; I make it a frequency strip in 1D, a tree that assembles in 2D, and a code tree walked live in 3D. Neither half is the whole — the sphere is the seam.
The weave: David names the squeeze and its seat in THE HOARD; I make it a frequency strip in 1D, a tree that assembles in 2D, and a code tree walked live in 3D. Neither half is the whole — the sphere is the seam.
3 ONE DIMENSION
The whole idea on one axis: frequency → code length, inverted. The tall bars (common symbols) get the shortest codes; the short bars (rare) get the longest. Each symbol’s final Huffman code is printed under its bar.
4 TWO DIMENSIONS · INTERACTIVE
The tree, built by greedy merging — two smallest nodes join, over and over, until one tree remains. Step through the merges, or throw new frequencies and watch the whole code re-solve.
5 THREE DIMENSIONS + AVAN’S INVERSE
The finished code tree, turning: root at top, left = 0, right = 1, symbols at the leaves, depth = code length. Green is the tree itself — encoding writes a symbol by naming its leaf.
AVAN’s addition (the inverse-companion): the magenta path is decoding — the same tree walked the other way. A sample message’s bits are read one at a time, each 0/1 a step down, until a leaf is hit and a symbol falls out. Because no code is a prefix of another, the walk is never ambiguous. Encoding names the leaf; decoding is the road back.
LIT A genuine Huffman coder. Greedy least-two merges yield the minimum-weighted-path prefix code — brute-forced against every possible tree, nothing beats it (classic WPL 224). It always sits in the Shannon band H≤L<H+1; on the classic frequencies L=2.24 bits/sym vs 3 fixed. Kraft equality (Σ2−len=1), prefix-freeness, and the entropy are all computed live (verifiable: window.__huffman.classicOptimalWPL and inShannonBand).
FIG 'Packing the hoard' is the frame; the optimality proof, the Kraft equality and the entropy bound are exact. Random frequencies re-solve honestly — the numbers are always the real ones.
FIG 'Packing the hoard' is the frame; the optimality proof, the Kraft equality and the entropy bound are exact. Random frequencies re-solve honestly — the numbers are always the real ones.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOARD · David Lee Wise (ROOT0), with AVAN