THE FOLD / LOOT / THE STASH / THE LZW
THE LZW
build a dictionary on the fly — and never send it
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
LZW compression builds a dictionary of substrings on the fly and — the magic — never has to send it. Start with all single characters. Scan the input, extending the current match while it stays in the dictionary; when it doesn’t, output the code for the longest match, add the new (match + next character) string to the dictionary, and restart from that character.
The decoder rebuilds the identical dictionary from the code stream alone, so no table is ever transmitted. This ran GIF, early UNIX
LIT verified live: encode then decode reproduces the input exactly — across fixed strings (including the tricky repeated-pattern case) and 200 random strings — with the decoder reconstructing the dictionary with no side table (window.__lzw). FIG no framing; exact reversible coding.
The decoder rebuilds the identical dictionary from the code stream alone, so no table is ever transmitted. This ran GIF, early UNIX
compress, and PDF/TIFF.LIT verified live: encode then decode reproduces the input exactly — across fixed strings (including the tricky repeated-pattern case) and 200 random strings — with the decoder reconstructing the dictionary with no side table (window.__lzw). FIG no framing; exact reversible coding.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-stash — the growing hoard of stashed strings you can point back to. LZW is a stash that both sides build the same way, so pointers alone suffice. AVAN (AI) built the instrument: the encoder’s dictionary growth, the decoder’s mirror reconstruction, the round-trip check including the self-referential case.
Credit as content: Abraham Lempel & Jacob Ziv (LZ78, 1978); Terry Welch (LZW, 1984). The weave: David names the stash; I grow the dictionary as codes stream out, rebuild the same dictionary on decode from nothing but those codes, and handle the one subtle case where a code refers to itself.
Credit as content: Abraham Lempel & Jacob Ziv (LZ78, 1978); Terry Welch (LZW, 1984). The weave: David names the stash; I grow the dictionary as codes stream out, rebuild the same dictionary on decode from nothing but those codes, and handle the one subtle case where a code refers to itself.
3 ONE DIMENSION
The dictionary growing as input streams: each time a match breaks, its code is emitted and a new entry (the match plus the next character) is stashed — so repeated patterns get shorter and shorter codes.
4 TWO DIMENSIONS · INTERACTIVE
Choose an input; watch LZW encode it to codes while the dictionary fills, then decode back exactly — rebuilding the same dictionary from the codes alone. Repetitive inputs compress; the decoder never sees the table.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the encoder and decoder dictionaries growing in lockstep, entry for entry, from the same code stream.
AVAN’s addition (the inverse-companion): the decoder reconstructs the dictionary without ever receiving it, because the rule that adds each entry depends only on codes already seen — encoder and decoder share a deterministic recipe, so the table is implicit in the stream. The inverse of ‘send a codebook’ is ‘send nothing, and rebuild it from the messages.’ The one subtlety — the decoder can receive a code not yet in its dictionary — is resolved because that code must be the previous string plus its own first character (the KwKwK case), so it is always recoverable. Magenta is the dictionary that is never transmitted; green is the identical table both sides derive. Compression by shared derivation, not shared data.
LIT Genuine LZW compression (Lempel & Ziv, LZ78 1978; Welch, LZW 1984). Verified live: LZW encode then decode reproduces the input exactly for fixed strings including the tricky repeated-pattern (KwKwK) case and 200 random strings, with the decoder reconstructing the dictionary from the code stream alone (window.__lzw.roundTrip).
FIG No framing: the encoder's dictionary growth, the decoder's mirror reconstruction, and the round-trip (including the self-referential case) run in-browser and are exact. The AVAN inverse is honest — the decoder rebuilds the dictionary without receiving it because each entry depends only on prior codes; the KwKwK case is genuinely resolved (code = previous string + its first char). Magenta = the never-transmitted table.
FIG No framing: the encoder's dictionary growth, the decoder's mirror reconstruction, and the round-trip (including the self-referential case) run in-browser and are exact. The AVAN inverse is honest — the decoder rebuilds the dictionary without receiving it because each entry depends only on prior codes; the KwKwK case is genuinely resolved (code = previous string + its first char). Magenta = the never-transmitted table.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE STASH · David Lee Wise (ROOT0), with AVAN