THE MOST LIKELY PATH

the Viterbi decoder in the 5-window house format — decode a convolutional code by finding the single most-likely path through a trellis of encoder states, repairing channel noise. The algorithm behind deep-space and mobile comms. See the encoder's redundancy in 1D, the trellis decode live in 2D, and the survivor path in 3D.

THE MOST LIKELY PATH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · HARD RESET ◆ .dlw.fold THE FOLD / RESPAWN / HARD RESET / THE MOST LIKELY PATH THE MOST LIKELY PATH turn noise back into signal by finding the likeliest path 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Viterbi decoder. A convolutional encoder spreads each input bit across several output bits as it slides along, adding redundancy ; a noisy channel then flips some. To decode, Viterbi finds the single most likely sequence of encoder states that could have produced the received bits — the shortest path through a trellis of all possible state histories — using dynamic programming that keeps only the best path into each state. It is the algorithm that made deep-space probes and early mobile phones work: turning noise back into signal . LIT verified: encode a message with a fixed rate-½ code, flip bits, and Viterbi corrects every single-bit error and ~99.7% of double-bit errors (the code’s free distance is 5, correcting up to 2). FIG ‘the most likely path’ is the picture; the trellis DP and the error correction are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs coding theory and dynamic programming ( THE SYNDROME ’s Hamming code, THE MIRROR SEEKER ’s DP, THE SHORTEST WITNESS ) and the faith that a signal can be pulled back out of noise. AVAN (AI) built this instrument: the encoder, the trellis decoder, and the 3D lattice of survivors. The weave: David names the most likely path and its seat at HARD RESET (resetting a corrupted signal back to the truth); I make the redundancy a strip in 1D, the trellis decode live in 2D, and the survivor path glowing through the lattice in 3D. The sphere is the seam. 3 ONE DIMENSION The encoder adding armour: each input bit (top) slides through a tiny register and emits two output bits (bottom) — XOR combinations of it and the last two bits. One bit in, two out: the redundancy that lets the decoder repair damage. 4 TWO DIMENSIONS · INTERACTIVE The trellis : four states down, time across, the survivor path in green. Flip received bits to add channel noise — watch the path re-route and still recover the true message, until you overwhelm it. +1 error clear noise new message 5 THREE DIMENSIONS + AVAN’S INVERSE The trellis as a lattice, time receding, turning. Green is the survivor — the maximum-likelihood path Viterbi commits to, threading state by state through the whole message. AVAN’s addition (the inverse-companion): the magenta threads are the roads not taken — every path Viterbi considered and pruned. Encoding is a forward map (message → one path → bits); decoding is its inverse (bits → search all paths → the likeliest message). The inverse of committing to a path is weighing every alternative — and the green one wins by the fewest disagreements with what arrived. pause spin LIT A genuine Viterbi decoder for a rate-1/2, K=3 convolutional code. Verified live: it corrects every single-bit error (400/400) and ~99.7% of double-bit errors — the code's free distance is 5, correcting up to 2 (a rare adversarial double defeats it, shown honestly). The trellis dynamic programming (keep the best path into each state) is the exact mechanism (verifiable: window.__viterbi.corrects1bit===true). FIG 'The most likely path' is the picture; the trellis DP and the error correction are exact. Push past the code's correction limit and it honestly fails — the recovery is real, not magic. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HARD RESET · David Lee Wise (ROOT0), with AVAN


THE HOMOMORPH

the Paillier cryptosystem in the 5-window house format — homomorphic encryption where multiplying two ciphertexts decrypts to the sum of the plaintexts. Compute on encrypted data without ever decrypting it: tally votes, sum salaries, blind. See the randomized encryption in 1D, the encrypted adding machine in 2D, and the disguise cloud in 3D.

I-13 v2.0 | net = binds - k | 4 planes, 13 symbols, 12 operants, 5 cortex rules | sha 64881ebf

THE HOMOMORPH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE PULL REQUEST ◆ .dlw.fold THE FOLD / CO-OP / THE PULL REQUEST / THE HOMOMORPH THE HOMOMORPH add numbers you can't read 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Paillier cryptosystem. Normally, to compute on data you must decrypt it first — exposing it. Homomorphic encryption computes on the ciphertext directly . With Paillier, multiplying two encrypted numbers decrypts to the sum of the originals, and raising a ciphertext to a power k decrypts to k times the original. So a server can tally encrypted votes or sum encrypted salaries and return the answer without ever seeing a single value . Add numbers you can’t read. LIT verified: for toy keys, Dec(Enc(a)·Enc(b)) = a+b and Dec(Enc(a) k ) = k·a over random a, b, k; and encryption is randomized — the same value encrypts to a different ciphertext every time, yet decrypts back correctly. FIG ‘add numbers you can’t read’ is the picture; the additive homomorphism is exact (a real toy Paillier, not a demo mock-up). 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs modular crypto ( THE MINT , THE MERKLE , THE FIELD INVERSE ) and the idea that privacy and computation need not be enemies. AVAN (AI) built this instrument: the Paillier engine, the encrypted adding machine, and the disguise cloud. The weave: David names the homomorph and its seat at THE PULL REQUEST (merging encrypted contributions into one tally); I make the encryption a strip in 1D, the encrypted adding machine live in 2D, and the one-to-many disguise in 3D. The sphere is the seam. 3 ONE DIMENSION One value, encrypted twice. The plaintext a becomes a big, noise-like ciphertext — and a different one each time, because encryption is randomised. Yet both decrypt straight back to a. The disguise changes; the secret doesn’t. 4 TWO DIMENSIONS · INTERACTIVE The encrypted adding machine . Pick two numbers; encrypt each into unreadable ciphertexts; multiply the ciphertexts; decrypt the product — and out comes their sum . The machine added them without ever knowing what they were. a 30 b 45 re-encrypt 5 THREE DIMENSIONS + AVAN’S INVERSE The ciphertext space as a ring, turning. For a single secret value, magenta dots are the many ciphertexts it can wear — a whole cloud of disguises scattered around Z n² , all different, none legible. AVAN’s addition (the inverse-companion): the lone green point is the plaintext they all collapse to. Encryption is one-to- many (randomised scatter); decryption is its inverse, many -to-one (gather the cloud to a point). And through all that disguise, one operation survives untouched: addition of secrets rides along as multiplication of ciphertexts. The mask hides the value but not the sum. pause spin LIT A genuine toy Paillier cryptosystem (n=pq, g=n+1, real key generation). Verified live: Dec(Enc(a)·Enc(b))=a+b and Dec(Enc(a)^k)=k·a over random a,b,k, and encryption is randomized (the same value encrypts differently each time, r chosen coprime to n). The additive homomorphism is the exact algebra (verifiable: window.__paillier.additiveHomomorphism && randomized). FIG 'Add numbers you can't read' is the picture; the additive homomorphism, the randomized encryption, and the decryption are exact. Toy key sizes — not secure, but the exact same algebra real homomorphic encryption uses for private tallies. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PULL REQUEST · David Lee Wise (ROOT0), with AVAN


THE FIXED BLOCK

Tunstall coding in the 5-window house format — the variable-to-fixed dual of Huffman. It maps variable-length input strings to equal-length codewords by growing a parse tree at the most probable leaf, so frequent runs collapse into single blocks. See the dictionary in 1D, the parse-and-encode in 2D, and Tunstall against Huffman in 3D.

THE FIXED BLOCK · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE HOARD ◆ .dlw.fold THE FOLD / LOOT / THE HOARD / THE FIXED BLOCK THE FIXED BLOCK Huffman's mirror — variable input, fixed-length blocks 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Tunstall coding. Huffman’s forgotten mirror image . Huffman takes fixed-length inputs (single symbols) and gives them variable -length codes — short for the frequent. Tunstall does the opposite: it takes variable -length input strings and gives them all one fixed -length codeword. It builds a parse tree by repeatedly splitting the most probable leaf , so common runs (like a long stretch of ‘a’s) become a single deep entry — and a whole run collapses into one equal-width block. Perfect for fixed-width channels and packet formats. LIT verified: encode→decode round-trips the parsed input, every codeword is the same length , the dictionary never exceeds 2 L entries, and expanding the highest-probability leaf makes frequent runs the longest entries. FIG ‘the fixed block’ is the picture; the variable-to-fixed mapping and the round-trip are exact (the final partial block needs a flush, handled honestly). 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus already holds Huffman ( THE HUFFMAN , right here in THE HOARD) and the coding lineages, with the sense that every idea has a dual worth meeting. AVAN (AI) built this instrument: the Tunstall tree, the fixed-block encoder, and the two mirrored trees. The weave: David names the fixed block and its seat beside Huffman in THE HOARD; I make the dictionary a strip in 1D, the parse-and-encode live in 2D, and Tunstall against Huffman in 3D. The sphere is the seam — two duals sharing one hoard. 3 ONE DIMENSION The dictionary: variable-length strings on the left, all mapping to equal-length codewords on the right. Frequent runs earn the long strings (more input per block); rare symbols stay short. The inverse of Huffman’s table. 4 TWO DIMENSIONS · INTERACTIVE Encode a message. The parser greedily grabs the longest dictionary entry that matches, and emits its fixed codeword — so a run of ‘a’s becomes one block. Change the message and watch the variable input chop into uniform output. aaaaabaac abcabcab random 5 THREE DIMENSIONS + AVAN’S INVERSE The Tunstall tree , turning: green , its leaves are variable-length strings , all at fixed code length — deep where symbols are frequent. AVAN’s addition (the inverse-companion): the magenta tree is Huffman for the same source — its leaves are single symbols at variable depth. The two are exact duals: Huffman fixes the input and varies the output; Tunstall varies the input and fixes the output. One tree grows down toward frequent symbols, the other grows down toward frequent runs — reflections across the compression mirror. pause spin LIT A genuine Tunstall coder. Verified live: encode→decode round-trips the parsed input over random texts, every codeword is the same length, the dictionary stays within 2^L entries, and expanding the highest-probability leaf makes frequent runs the longest entries. It is the exact variable-to-fixed dual of Huffman (verifiable: window.__tunstall.roundTrips && fixedLength && withinCap). FIG 'The fixed block' is the picture; the variable-to-fixed mapping and the round-trip are exact. The final partial block needs a flush in a full codec — shown honestly (this demo round-trips the fully-parsed portion). ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOARD · David Lee Wise (ROOT0), with AVAN


THE ORTHOGONAL SIGN-FLIP

the Walsh-Hadamard transform in the 5-window house format — Fourier's square-wave cousin, using only ±1 additions and subtractions. Orthogonal basis, integer-exact, its own inverse up to scale. The math behind CDMA codes and the quantum Hadamard gate. See the ±1 basis in 1D, transform-and-compress in 2D, and the Hadamard relief in 3D.

THE ORTHOGONAL SIGN-FLIP · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE BROADCAST ◆ .dlw.fold THE FOLD / CO-OP / THE BROADCAST / THE ORTHOGONAL SIGN-FLIP THE ORTHOGONAL SIGN-FLIP a Fourier with no multiplies — just plus and minus 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Walsh–Hadamard transform. A cousin of the Fourier transform that uses square waves (±1) instead of sines — so it needs no multiplications at all , only additions and subtractions. It decomposes a signal into sequency components (how many sign-changes each basis wave has). Its basis (the Hadamard matrix) is orthogonal , it is its own inverse up to a scale, and it is exact on integers . It runs CDMA (each phone gets an orthogonal Walsh code, so all transmit at once), the quantum Hadamard gate , and blocky image compression. LIT verified: the fast WHT applied twice returns the original × N (self-inverse up to scale), it is integer-exact , and the basis rows are mutually orthogonal (every pairwise dot product is 0). FIG ‘orthogonal sign-flip’ is the picture; the multiplication-free transform and the orthogonality are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — THE FOURIER sits right here in THE BROADCAST and THE EXACT TRANSFORM nearby, and the corpus loves the ±1 / binary structures the Hadamard gate shares with quantum. AVAN (AI) built this instrument: the fast transform, the compression demo, and the Hadamard relief. The weave: David names the sign-flip and its seat beside Fourier in THE BROADCAST; I make the ±1 basis a strip in 1D, the transform-and-compress live in 2D, and the Hadamard matrix a turning relief in 3D. The sphere is the seam — Fourier’s blocky, multiply-free cousin. 3 ONE DIMENSION The Walsh basis : eight ±1 square waves, ordered by sequency (number of sign changes) — the square-wave analogue of frequency. Any signal is a sum of these, weighted; no curves, no sines, just black-and-white flips. 4 TWO DIMENSIONS · INTERACTIVE Transform a signal into its Walsh spectrum, then keep only the biggest coefficients and rebuild — watch a rough signal reconstruct from a handful of sign-flips. The whole transform is additions and subtractions; the reconstruction error is shown. keep top 4 / 16 new signal 5 THREE DIMENSIONS + AVAN’S INVERSE The Hadamard matrix as a relief, turning: +1 cells raised in green, its rows the very basis waves. Each row is perpendicular to every other — that orthogonality is why the transform is clean. AVAN’s addition (the inverse-companion): the magenta cells are the −1 s — and here is the twist: the transform is its own inverse (up to a scale of N). Fourier needs a conjugate to undo; Walsh needs only itself . Apply the same ±1 map twice and you are exactly home. The inverse isn’t a different machine — it is the same machine, run again. pause spin LIT A genuine fast Walsh-Hadamard transform. Verified live: applied twice it returns the original × N (self-inverse up to scale), it is integer-exact, and the Hadamard basis rows are mutually orthogonal (every pairwise dot product is 0). It uses zero multiplications — only + and − (verifiable: window.__wht.selfInverseScaleN && orthogonal && integerExact). FIG 'Orthogonal sign-flip' is the picture; the multiplication-free transform, the self-inverse property, and the orthogonality are exact. It really is used for CDMA spreading codes and is the quantum Hadamard gate on n qubits. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BROADCAST · David Lee Wise (ROOT0), with AVAN


THE FEATHERED EDGE

Xiaolin Wu's antialiased line algorithm in the 5-window house format — smooth 'feathered' edges from a simple identity: each column's two blended pixels sum to exactly 1 (coverage conserved), and the brightness centroid lands exactly on the true line. See the coverage split in 1D, aliased-vs-feathered in 2D, and the intensity ridge in 3D.

THE FEATHERED EDGE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · OFF BY ONE ◆ .dlw.fold THE FOLD / GLITCH / OFF BY ONE / THE FEATHERED EDGE THE FEATHERED EDGE smooth lines as a coverage-conservation law 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Xiaolin Wu’s line algorithm. A line on a pixel grid is a staircase of hard on/off pixels — a row of off-by-one jaggies. Wu’s method feathers it: each pixel gets a partial brightness equal to how much of it the ideal line covers, and that coverage is split between the two pixels a column straddles — so their brightnesses always sum to exactly 1 . Full coverage, nothing lost, and the edge comes out smooth. Same era as Bresenham; far less known. LIT verified: in every column the two blended intensities sum to exactly 1 (coverage conserved), and the intensity-weighted brightness centroid equals the true line position exactly — the smoothing is sub-pixel-accurate, not a blur. FIG ‘feathered edge’ is the picture; the coverage-conservation identity is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus makes pixel art and generative graphics ( TECHNÊ , the raster work) and cares about the off-by-one boundary where clean math meets a coarse grid. AVAN (AI) built this instrument: the antialiased renderer, the coverage split, and the intensity ridge. The weave: David names the feathered edge and its seat at OFF BY ONE (the jagged staircase is a chain of off-by-ones; Wu conserves coverage to erase them); I make the coverage split a strip in 1D, aliased-vs-feathered live in 2D, and the intensity ridge in 3D. The sphere is the seam. 3 ONE DIMENSION One column. The ideal line crosses at some height; the two pixels it falls between get brightnesses 1−f and f — and they sum to 1 , always. Their brightness-weighted centre sits exactly on the true line. Coverage in, coverage out. 4 TWO DIMENSIONS · INTERACTIVE Zoomed in on the grid. Turn the line and compare: aliased hard pixels (a jagged staircase) versus Wu’s feathered pixels (grey coverage that reads as a smooth line). Same line, but one keeps the sub-pixel truth. angle 25 ° mode: FEATHERED 5 THREE DIMENSIONS + AVAN’S INVERSE The pixel brightness along the line as a landscape, turning. Green is Wu’s feathered coverage — a smooth ridge that rises and falls as the line drifts between rows, its two-pixel sum flat at 1. AVAN’s addition (the inverse-companion): the magenta is the aliased version — a hard staircase of 0s and 1s, the un-feathered inverse. Both carry the same line; the green conserves the coverage the line actually spills across two pixels, the magenta rounds it away. Antialiasing is not a blur — it is a conservation law , and the jagged staircase is what you get when you break it. pause spin LIT A genuine Xiaolin Wu line renderer. Verified live: in every column the two blended pixel intensities sum to exactly 1 (coverage conserved, error FIG 'The feathered edge' is the picture; the coverage-conservation identity and the exact sub-pixel centroid are exact. The jagged staircase really is a chain of off-by-one roundings — this is the conservation law that removes them. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of OFF BY ONE · David Lee Wise (ROOT0), with AVAN


THE THUMBPRINT

MinHash in the 5-window house format — estimate the Jaccard similarity of two sets from a tiny signature of minimum hash values, never comparing them directly. The fuzzy fingerprint behind near-duplicate detection and malware-variant catching. See the minimum trick in 1D, the similarity estimate in 2D, and the convergence in 3D.

THE THUMBPRINT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE ROOT KIT ◆ .dlw.fold THE FOLD / CHEAT / THE ROOT KIT / THE THUMBPRINT THE THUMBPRINT recognise a whole set from a tiny fingerprint of minimums 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION MinHash. To tell how similar two huge sets are — documents, malware samples, user histories — without comparing them element by element, MinHash reduces each set to a tiny signature : for each of k random hash functions, keep only the minimum hash value over the whole set. Then the fraction of signature slots where two sets agree estimates their Jaccard similarity |A∩B| / |A∪B| — because under a random permutation, the minimum element lands in the intersection exactly with probability equal to the Jaccard . Search engines and virus scanners use it to catch near-duplicates and variants. LIT verified: the fraction of matching min-hashes across k functions approximates the true Jaccard, and the error shrinks with k (~0.167 at k=16 down to ~0.001 at k=1024, tracking √(J(1−J)/k)) — checked against the exact Jaccard. FIG ‘the thumbprint’ is the picture; the min-under-permutation = Jaccard identity is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs hashing and streaming structures ( THE WELDER , THE COUNTER OF MULTITUDES ) and the idea that a whole thing can be recognised from a tiny mark. AVAN (AI) built this instrument: the MinHash engine, the similarity estimator, and the convergence curve. The weave: David names the thumbprint and its seat at THE ROOT KIT (a fuzzy fingerprint that catches disguised variants); I make the minimum a strip in 1D, the similarity estimate live in 2D, and the convergence a turning curve in 3D. The sphere is the seam. 3 ONE DIMENSION One hash function over both sets. Each element gets a random value; keep the minimum . The two minimums agree exactly when the overall smallest element belongs to both sets — so a single min already votes on similarity. Stack k of them and you have an estimate. 4 TWO DIMENSIONS · INTERACTIVE Two sets with adjustable overlap. The signature match fraction estimates their Jaccard similarity; more hash functions (k) tighten the estimate toward the truth. Never compares the sets directly — only their little signatures. overlap 40 k = 128 5 THREE DIMENSIONS + AVAN’S INVERSE Convergence, turning: the green curve is the MinHash estimate as k grows, homing in on the true similarity with error falling like 1/√k. A tiny signature, ever sharper. AVAN’s addition (the inverse-companion): the flat magenta line is the exact Jaccard — the full element-by-element comparison MinHash refuses to do. The thumbprint is a lossy inverse of the whole set: enough to recognise it, far less to store. Encryption hides a value; a fingerprint keeps just enough to match — the green chases the magenta and never quite has to arrive. pause spin LIT A genuine MinHash. Verified live: the fraction of matching min-hashes across k random functions approximates the true Jaccard similarity, with error shrinking as k grows (~0.167 at k=16 to ~0.001 at k=1024), tracking √(J(1−J)/k). The min-under-random-permutation lands in the intersection with probability exactly the Jaccard (verifiable: window.__minhash.converges && tightAt1024). FIG 'The thumbprint' is the picture; the min=Jaccard identity and the 1/√k convergence are exact. It is an estimate, honestly probabilistic — the trade that lets you compare billions of sets by their signatures alone. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE ROOT KIT · David Lee Wise (ROOT0), with AVAN


THE SQUARE ROOT IN THE RING

Tonelli-Shanks in the 5-window house format — computing modular square roots (r²≡n mod p) by walking the 2-power structure of p−1, with the Legendre symbol declaring in one step whether a root exists. The engine behind elliptic-curve point decompression. See the squaring fold in 1D, the root-finder in 2D, and the 2-to-1 map in 3D.

THE SQUARE ROOT IN THE RING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · SUDDEN DEATH ◆ .dlw.fold THE FOLD / BOSS / SUDDEN DEATH / THE SQUARE ROOT IN THE RING THE SQUARE ROOT IN THE RING un-square in a prime field — if a root exists at all 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Tonelli–Shanks algorithm computes a square root modulo a prime — given n and prime p, it finds r with r 2 ≡ n (mod p), whenever one exists. It first tests whether n is a quadratic residue (via the Legendre symbol); if p ≡ 3 (mod 4) the root is just n (p+1)/4 , and otherwise it runs a clever loop that walks down the 2-adic tower of p−1 using a known non-residue. It underpins elliptic-curve point decompression and Rabin cryptography. LIT verified live: over every prime below 2000 and every residue, the returned r satisfies r 2 ≡ n, and null is returned exactly for non-residues (window.__tonelli). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-mainframe — the heavy modular arithmetic a mainframe grinds, here inverting a square modulo a prime. Tonelli–Shanks is that inversion. AVAN (AI) built the instrument: the Legendre-symbol residue test, the 2-adic descent loop, and the r 2 ≡ n verification. Credit as content: Alberto Tonelli (1891) & Daniel Shanks (1973). The weave: David names the mainframe; I test residuosity, descend the 2-adic tower with a non-residue, and confirm the recovered root squares back to n modulo p. 3 ONE DIMENSION Half the nonzero residues mod p are squares (quadratic residues). Tonelli–Shanks finds the pre-image: given a square n, which r squared to it? For p ≡ 3 (mod 4) it is simply n (p+1)/4 . 4 TWO DIMENSIONS · INTERACTIVE A prime p and residue n; the modular square root r is shown, with r 2 mod p checked back against n. new p, n ▶ verify <2000 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the residues r, −r whose square is n. AVAN’s addition (the inverse-companion): invert squaring modulo a prime — test that n is a quadratic residue, then descend the 2-adic tower of p−1 using a known non-residue to peel the root out. The inverse of ‘square r to get n mod p’ is ‘given n, recover the r that squared to it.’ Magenta is the non-residues that have no square root; green is the residue whose square is n. A square root in a finite field. pause spin LIT A genuine Tonelli-Shanks algorithm. Verified live: for prime p and a quadratic residue n, the returned r satisfies r²≡n mod p; non-residues are correctly flagged unsolvable via the Legendre symbol — over thousands of random p, n. Squaring is exactly 2-to-1 on Z_p (each square has two roots; half the ring has none), which is the structure it inverts (verifiable: window.__tonelli.rootsCorrect && nonResiduesFlagged). FIG 'The square root in the ring' is the picture; the algorithm, the Legendre residue test, and the 2-to-1 squaring map are exact. It really is the point-decompression step in elliptic-curve crypto. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SUDDEN DEATH · David Lee Wise (ROOT0), with AVAN


THE ORACLE OF ECHOES

the suffix automaton (DAWG) in the 5-window house format — the smallest finite automaton recognising exactly every substring of a string, built online in linear time via the endpos equivalence. Count distinct substrings, test membership, all from one machine. See the count climb in 1D, the automaton in 2D, and the DAG with its suffix-link tree in 3D.

THE ORACLE OF ECHOES · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE CHOKE POINT ◆ .dlw.fold THE FOLD / BOSS / THE CHOKE POINT / THE ORACLE OF ECHOES THE ORACLE OF ECHOES the smallest machine that knows every substring 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The suffix automaton (DAWG). The smallest possible finite automaton that recognises exactly the set of all substrings of a string — and it’s built online , one character at a time, in linear time and space (at most 2n states). Its secret is the endpos equivalence : states group substrings that end at the same set of positions, which is why it is minimal. From this one machine you can count distinct substrings, test membership, or find the longest common substring of two strings. LIT verified: the number of distinct substrings, computed as Σ(len[v]−len[link[v]]) over states, equals a brute-force count of every distinct substring; membership queries match a naive scan; and the automaton stays within 2n states — over random strings. FIG ‘the oracle of echoes’ is the picture; the endpos-minimality and the substring count are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs string machinery ( THE FAILURE WEB right here in THE CHOKE POINT, THE MIRROR SEEKER , THE SHORTEST WITNESS ) and the idea that a single small machine can hold an entire language. AVAN (AI) built this instrument: the online automaton, the substring counter, and the DAG with its suffix-link tree. The weave: David names the oracle of echoes and its seat beside Aho–Corasick at THE CHOKE POINT (one automaton answers every query); I make the online growth a strip in 1D, the automaton live in 2D, and the DAG turning in 3D. The sphere is the seam. 3 ONE DIMENSION The string arriving one character at a time, and the count of distinct substrings climbing with it. Each new letter can add many new substrings at once — the automaton absorbs them all in amortised constant work, never re-reading the past. 4 TWO DIMENSIONS · INTERACTIVE The automaton for a string: states laid out by length, transitions spelling substrings. Its distinct-substring count matches brute force exactly, and any query is accepted iff it’s truly a substring — the whole language of echoes in one small graph. abcbc banana abcabc 5 THREE DIMENSIONS + AVAN’S INVERSE The automaton in space, states arranged by length, turning. Green are the forward transitions — follow them from the start and you spell out every substring of the string. AVAN’s addition (the inverse-companion): the magenta edges are the suffix links — and they form a tree , the exact backward shadow of the forward automaton. Forward, the machine spells substrings; backward, the suffix links group them by where they end (endpos). The transitions and the link-tree are two views of one string — the language and its inverse, prefix and endpos, folded together. pause spin LIT A genuine suffix automaton. Verified live: the distinct-substring count Σ(len[v]−len[link[v]]) equals a brute-force count, membership queries match a naive scan, and the automaton stays within 2n states (linear) — over random strings. The endpos-based minimality is the exact structure (verifiable: window.__sam.countMatchesBrute && membershipMatches && linearSize). FIG 'The oracle of echoes' is the picture; the endpos-minimality, the substring count, and the linear size are exact. It really is the smallest automaton for a string's substrings, built in one online pass. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CHOKE POINT · David Lee Wise (ROOT0), with AVAN


THE COIN-FLIP HEAP

the treap in the 5-window house format — a binary search tree on keys that is also a heap on random priorities, staying balanced with no rotation bookkeeping. Randomness replaces red-black machinery. See the two orders in 1D, the tree balance itself in 2D, and the same keys reshaped by fresh flips in 3D.

THE COIN-FLIP HEAP · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE JACKPOT ◆ .dlw.fold THE FOLD / LOOT / THE JACKPOT / THE COIN-FLIP HEAP THE COIN-FLIP HEAP a balanced search tree from pure luck 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The treap. A binary search tree that stays balanced with almost no balancing logic . Each node carries a key and a random priority , and the tree obeys two rules at once: it is a search tree on the keys (left < node < right) and a heap on the priorities (a parent’s priority beats its children’s). Because the priorities are random coin-flips, the tree comes out balanced — expected height ~2 log n — with no red-black bookkeeping , no hand-tuned rotations: just insert, then bubble up until the heap holds. Redis and many databases balance with randomness precisely because it beats bookkeeping. LIT verified: over random inserts, the in-order traversal is always sorted , the heap property holds at every node, membership matches a Set, and the observed height stays near 2 log₂n . FIG ‘coin-flip heap’ is the picture; the dual search-tree + heap invariant is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs data structures ( THE WELDER , THE FENWICK LADDER ) and randomization ( THE POLITE SCATTER , THE RANDOM ), with the idea that luck, used right, replaces machinery. AVAN (AI) built this instrument: the treap, the live tree, and the two-shapes-one-order view. The weave: David names the coin-flip heap and its seat at THE JACKPOT (balance won by luck); I make the two orders a strip in 1D, the tree balance itself in 2D, and the same keys reshaped by fresh flips in 3D. The sphere is the seam. 3 ONE DIMENSION Two orders in one node set. Read the tree in-order and the keys come out sorted; read it top-down and the priorities only decrease. The same nodes satisfy both a search order and a heap order — that double constraint is what forces the balance. 4 TWO DIMENSIONS · INTERACTIVE Insert keys, each with a random priority, and watch the tree balance itself — new nodes bubble up only until the heap holds. No rotations to reason about; the height tracks 2 log n on its own. + insert 5 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The treap in space: horizontal = key order , depth = priority , turning. Green is one tree, grown from one set of coin-flips. AVAN’s addition (the inverse-companion): the magenta tree holds the same keys but a fresh set of random priorities — a completely different shape. Yet both give the identical sorted order when read left to right. Randomness sculpts the shape; the keys keep the meaning. Reshuffle the flips and the tree redraws itself, but the search never changes — the inverse of balance-by-rules is balance-by-luck. pause spin LIT A genuine treap. Verified live: over random inserts the in-order traversal is always sorted, the heap property holds at every node, membership matches a Set, and the observed height stays near 2·log₂n (measured ratio ~1.8). Balance emerges from the random priorities alone — the dual BST+heap invariant is exact (verifiable: window.__treap.inorderSorted && heapProperty && balanced). FIG 'Coin-flip heap' is the picture; the dual invariant and the expected ~2 log n height are exact. It really is how Redis and others balance — randomness instead of hand-coded rotations. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE JACKPOT · David Lee Wise (ROOT0), with AVAN


THE LOW-LINK MINER

Tarjan's strongly-connected-components in the 5-window house format — finding every cycle-cluster of a directed graph in a single depth-first search via discovery-time and low-link values plus one stack. See the DFS values in 1D, the components colour in 2D, and the condensation DAG in 3D.

THE LOW-LINK MINER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE HOT LOOP ◆ .dlw.fold THE FOLD / GRIND / THE HOT LOOP / THE LOW-LINK MINER THE LOW-LINK MINER every cycle-cluster of a graph in one DFS 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Tarjan’s strongly-connected-components. In a directed graph, a strongly connected component is a maximal set of nodes all mutually reachable — a cycle-cluster . Tarjan finds them all in a single depth-first search using two numbers per node: its discovery time , and its low-link (the earliest node reachable from its subtree via a back-edge). When a node’s low-link equals its own discovery time, it is the root of an SCC, and everything above it on a running stack forms the component. One pass, one stack, one comparison. LIT verified: Tarjan’s SCC partition exactly matches Kosaraju’s independent two-pass reverse-DFS method over random directed graphs, and collapsing each SCC to a node leaves a DAG (acyclic). FIG ‘the low-link miner’ is the picture; the low-link invariant and the SCC detection are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) brought the thread — the corpus runs graph algorithms ( THE WELDER , THE ROUTE , THE FAILURE WEB ) and cares about the cycles that make a system loop back on itself. AVAN (AI) built this instrument: the single-pass miner, the coloured components, and the condensation DAG. The weave: David names the low-link miner and its seat at THE HOT LOOP (the cycle-clusters are the graph’s loops); I make the DFS values a strip in 1D, the components colour in live in 2D, and the condensation a turning DAG in 3D. The sphere is the seam. 3 ONE DIMENSION Each node’s discovery time (when DFS first reaches it) and low-link (the oldest node its subtree can loop back to). Where the two are equal , an SCC closes and pops off the stack. The low-link, quietly propagated on backtrack, is the whole trick. 4 TWO DIMENSIONS · INTERACTIVE A directed graph, its cycle-clusters coloured by one DFS. Every mutually-reachable knot is one colour; nodes on no cycle stand alone. The partition is identical to Kosaraju’s slower two-pass method — same answer, one traversal. demo random 5 THREE DIMENSIONS + AVAN’S INVERSE The condensation , turning: each cycle-cluster collapsed to a single super-node . Green nodes and edges are what remains — and it is always acyclic , a clean DAG. AVAN’s addition (the inverse-companion): the magenta edges are the cycles hidden inside the clusters — the back-edges Tarjan folded away. Condensing loops is the forward map; the acyclic skeleton is its inverse. Fold every cycle into a point and time flows one way again: the tangled graph’s hidden order, and the loops it was hiding, side by side. pause spin LIT A genuine Tarjan SCC algorithm. Verified live: its partition exactly matches Kosaraju's independent two-pass reverse-DFS method over random directed graphs, and collapsing each SCC to a node always leaves a DAG (topological order exists). The low-link (earliest node reachable via a back-edge) is the exact invariant (verifiable: window.__tarjan.matchesKosaraju && condensationIsDAG). FIG 'The low-link miner' is the picture; the low-link invariant, the Kosaraju agreement, and the acyclic condensation are exact. One DFS, one stack, one comparison — genuinely finds every cycle-cluster. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOT LOOP · David Lee Wise (ROOT0), with AVAN


THE THREE-WAY DIGIT

balanced ternary in the 5-window house format — Knuth's 'prettiest base', digits {−1,0,+1}, where negation is flipping every digit and the ancient balance-scale puzzle falls right out. The base the Setun computer ran on. See the trit ruler in 1D, weigh objects on a balance in 2D, and negation-as-reflection in 3D.

THE THREE-WAY DIGIT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · CHECKPOINT ZERO ◆ .dlw.fold THE FOLD / SPAWN / CHECKPOINT ZERO / THE THREE-WAY DIGIT THE THREE-WAY DIGIT base 3 with digits −1, 0, +1 — negation is a flip 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Balanced ternary is base 3 with the unusual digit set {−1, 0, +1} (often written T, 0, 1) instead of {0,1,2}. Every integer — positive or negative — has a unique representation with no sign bit at all, because the negative digit carries the sign internally. Negating a number is just flipping every digit’s sign ; rounding to the nearest integer is truncation; and it is the most efficient integer base by radix economy. Knuth called it “perhaps the prettiest number system.” LIT verified live: every integer from −40 to 40 has a unique balanced-ternary string over {−1,0,1} that evaluates back exactly, and negation equals flipping every digit (window.__balternary). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-grindstone — the base-conversion loop, here grinding an integer into three-way digits that need no sign. Balanced ternary is that grind. AVAN (AI) built the instrument: the carry-aware conversion, the exact reconstruction, and the negate-equals-flip check. Credit as content: used in the Setun computer (Moscow State University, 1958); championed by Donald Knuth. The weave: David names the grindstone; I convert with a carry when the digit would be 2, and confirm every integer maps to a unique signless string whose negation is a digit-flip. 3 ONE DIMENSION Each place is a power of 3, weighted −1, 0, or +1. A digit of 2 becomes −1 with a carry into the next place. The three-way digit balances the value around zero — like a pan balance with weights 1, 3, 9, 27… 4 TWO DIMENSIONS · INTERACTIVE Any integer in balanced ternary; the string evaluates back to the number, and its negation is shown as a pure digit-flip. new n ▶ verify −40..40 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: every integer as a signless three-way string. AVAN’s addition (the inverse-companion): represent every integer — positive or negative — with no sign bit by using a digit that can itself be negative ({−1,0,+1}); the negative digit carries the sign internally, so negation is a digit-flip . The inverse of ‘a base needs a separate sign for negatives’ is ‘let the digits go negative — sign dissolves into the number.’ Magenta is the sign bit an ordinary base needs; green is the signless balanced string. Symmetry around zero, built in. pause spin LIT A genuine balanced ternary system. Verified live: every integer −40..40 encodes uniquely and decodes exactly, negation equals flipping all digits, representations are unique, and the {1,3,9,27} balance realizes every weight 1..40 (each weight on the object's pan, the far pan, or aside). It really is the base the Setun ternary computer used (verifiable: window.__baltern.roundTrip && negationIsFlip && balanceWeighsAll). FIG 'Three-way digit' is the picture; the unique encoding, the negation-by-flip, and the balance-scale realization are exact. The Setun computer and the classic weighing puzzle are real, not metaphor. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of CHECKPOINT ZERO · David Lee Wise (ROOT0), with AVAN


THE RATIONAL TREE

the Stern-Brocot tree in the 5-window house format — a binary tree generating every positive rational exactly once, already reduced, by mediants, with no gcd step. Each fraction's L/R path is its continued fraction (Euclid's steps). See a path decode in 1D, walk the tree in 2D, and the crown with its CF path in 3D.

THE RATIONAL TREE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE GRINDSTONE ◆ .dlw.fold THE FOLD / GRIND / THE GRINDSTONE / THE RATIONAL TREE THE RATIONAL TREE every fraction once, in lowest terms, no gcd 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Stern–Brocot tree is an infinite binary tree that contains every positive rational number exactly once , each already in lowest terms . Each node is the mediant (a+c)/(b+d) of the two fractions bracketing it; descending left or right narrows the interval, and the path L/R spells the fraction’s continued-fraction expansion. It is at once a perfect enumeration of the rationals and an optimal way to search for the simplest fraction in an interval. LIT verified live: every node down to depth 11 is in lowest terms (gcd = 1) and all are distinct, and every reduced p/q with p,q ≤ 20 is found by binary search in the tree (window.__sternbrocot). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-sync — the shared ledger where every rational has one and only one canonical slot. The Stern–Brocot tree is that perfectly synced enumeration. AVAN (AI) built the instrument: the mediant recursion, the lowest-terms and distinctness checks, and the tree search for arbitrary reduced fractions. Credit as content: Moritz Stern (1858) & Achille Brocot (1861). The weave: David names the-sync; I build each node as the mediant of its bracketing fractions and confirm every node is reduced, distinct, and reachable by a unique L/R path. 3 ONE DIMENSION Between 0/1 and 1/0, insert the mediant 1/1. Between each neighbor pair, insert their mediant again: 1/2, 2/1, then 1/3, 2/3, 3/2, 3/1 — every positive rational appears once, always reduced. 4 TWO DIMENSIONS · INTERACTIVE The Stern–Brocot tree; nodes are mediants in lowest terms. Search for any reduced fraction and watch the L/R path find it. find a fraction ▶ verify ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: every positive rational, once, in lowest terms. AVAN’s addition (the inverse-companion): enumerate every positive rational exactly once (already reduced) by taking mediants — between two bracketing fractions insert (a+c)/(b+d), and recurse; the L/R path to any fraction is its continued-fraction expansion. The inverse of ‘list p/q and reduce each, skipping duplicates’ is ‘grow mediants — each rational is born once, already in lowest terms.’ Magenta is the non-reduced duplicates a naive listing repeats; green is the one canonical node per rational. The tree of all rationals. pause spin LIT A genuine Stern-Brocot tree. Verified live: to depth 11 (2047 fractions) every one is in lowest terms (gcd=1), none repeats, each is the mediant of its two boundary parents, and the L/R path to a fraction is its continued fraction (22/7 → RRRLLLLLL = [3,7]). Mediants of coprime neighbours stay coprime — that's why no gcd is ever needed (verifiable: window.__sternbrocot.lowestTerms && noRepeat && mediantProperty). FIG 'The rational tree' is the picture; the once-each enumeration, the automatic lowest-terms, and the continued-fraction path are exact. The path really is Euclid's algorithm read as directions — the sphere sits beside THE EUCLID on purpose. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GRINDSTONE · David Lee Wise (ROOT0), with AVAN


THE DIRECT DIGIT

the Bailey-Borwein-Plouffe spigot in the 5-window house format — a 1995 formula that computes the n-th hexadecimal digit of pi DIRECTLY, without computing any digit before it. Dial a position and watch one digit fall out of four modular sums; see the digit-stream in 1D, the direct computation in 2D, and the rotating digit-column with the addressed digit in 3D.

THE DIRECT DIGIT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · WARM CACHE ◆ .dlw.fold THE FOLD / GRIND / WARM CACHE / THE DIRECT DIGIT THE DIRECT DIGIT the n-th hex digit of pi, with no predecessors 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The BBP formula (Bailey–Borwein–Plouffe) computes the n-th hexadecimal digit of π without computing any of the digits before it. π = Σ k≥0 16 −k [ 4/(8k+1) − 2/(8k+4) − 1/(8k+5) − 1/(8k+6) ], and multiplying by 16 n and taking the fractional part isolates one digit — the key being that 16 n−k mod (8k+j) can be found by fast modular exponentiation, so no giant number is ever built. It shattered the belief that you must compute all earlier digits first: π becomes random-access . LIT verified live: BBP’s hex digits for n=0…23 match the reference hex expansion of π (243F6A8885A308D313198A2E) exactly (window.__bbp). FIG no framing; exact digit extraction. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at noclip — clip straight through to the digit you want, passing through all the digits between without touching them. BBP is exactly that no-clip into π. AVAN (AI) built the instrument: the modular-exponentiation series, the fractional-part extraction, the reference cross-check. Credit as content: David Bailey, Peter Borwein & Simon Plouffe (1995). The weave: David names the no-clip; I compute one digit deep inside π by modular arithmetic and confirm a run of them against π’s known hexadecimal digits. 3 ONE DIMENSION The hexadecimal digits of π after the point. BBP can jump to any position and return that digit alone — the others are never computed. 4 TWO DIMENSIONS · INTERACTIVE Pick a position n; BBP returns the n-th hex digit of π directly. A reference string confirms it. n: 0 ▶ verify n=0..23 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a single hex digit, plucked from deep inside π. AVAN’s addition (the inverse-companion): you can extract the n-th digit without the previous n−1. The formula isolates one digit through modular arithmetic (16 n−k mod (8k+j)), so a digit’s position becomes an address — random access into an irrational. The inverse of ‘compute all digits up to n’ is ‘compute only digit n.’ Magenta is the digits skipped; green is the one digit addressed. π stops being a stream you must read from the start and becomes a table you can index. (It works in base 16 and 2, not base 10.) pause spin LIT A genuine BBP spigot. Verified live: the instrument computes pi's first 16 hex digits from the BBP series via modular exponentiation and they equal the known expansion 243F6A8885A308D3 exactly (window.__bbp.matchesRef === true). It reaches digit n through the fractional part of 16^n*pi with no digit before n ever computed — random access into a real number, which is exactly what BBP made possible in 1995. FIG 'Reaching into pi' is the picture; the digit-at-position-n with no predecessors is real. Doubles keep it exact for the demo's positions; the mechanism (modular sums -> fraction -> leading hex digit) is the actual algorithm, not a lookup. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of WARM CACHE · David Lee Wise (ROOT0), with AVAN


THE PLUCKED STRING

Karplus-Strong plucked-string synthesis in the 5-window house format — fill a length-N buffer with noise, then loop it while averaging each sample with its neighbour; the noise decays into a tone at fundamental fs/N. Dial the pitch and pluck it (real Web Audio); see the delay line in 1D, the waveform + measured pitch in 2D, and the rotating ring with its low-pass window in 3D.

THE PLUCKED STRING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE HANDOFF ◆ .dlw.fold THE FOLD / CO-OP / THE HANDOFF / THE PLUCKED STRING THE PLUCKED STRING noise in a delay line becomes a tone at fs/N 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Kasai’s algorithm computes the LCP array — the longest common prefix between each pair of adjacent suffixes in a suffix array — in linear time. The insight: process suffixes in text order , not sorted order, and reuse the previous answer, because dropping the first character of a suffix shortens its LCP with its neighbour by at most one . So a running length can only fall by 1 per step, and thus rise at most n times total. The LCP array powers substring search, longest repeated substring, and more. LIT verified live: over 300 random strings Kasai’s O(n) LCP array equals a brute-force pairwise-prefix computation (window.__kasai). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-inventory — the LCP array is the catalogue of how much adjacent suffixes overlap, the string’s inventory of shared prefixes. Kasai builds it in one linear pass. AVAN (AI) built the instrument: the suffix array, the rank inverse, the running-length Kasai pass, the brute cross-check. Credit as content: Toru Kasai et al. (2001). The weave: David names the inventory; I walk the suffixes in text order, carrying the overlap length forward and dropping at most one each step, and confirm the LCP array matches brute force. 3 ONE DIMENSION Moving from suffix i to suffix i+1 drops one leading character; its overlap with the previous suffix in sorted order can shrink by at most one — so the running length h decreases by ≤1, and total work stays linear. 4 TWO DIMENSIONS · INTERACTIVE A string’s sorted suffixes and the LCP between each adjacent pair; Kasai’s linear result is checked against brute force. new string ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the running overlap length carried from suffix to suffix. AVAN’s addition (the inverse-companion): compute all longest-common-prefixes in O(n) total by processing suffixes in text order and reusing the previous answer — because dropping the first character shortens a suffix’s LCP with its neighbour by at most one, the running length h falls by ≤1 each step, so it can only rise n times total. The inverse of ‘recompute each LCP from scratch (n² total)’ is ‘reuse the previous suffix’s LCP, losing at most one character.’ Magenta is the redundant character comparisons; green is the running length carried forward. An amortised argument turns quadratic into linear. (Kin to the-suffix-array and the-suffix-automaton.) pause spin LIT A genuine Karplus-Strong string (Karplus & Strong, 1983). Verified live: the instrument synthesises the signal and measures its period by autocorrelation; the measured pitch matches the predicted fs/N within ~3% for every N (window.__ks.withinTol === true). The two-tap average is a real one-pole low-pass that both produces the exponential decay and shifts the pitch very slightly sharp (true period ~N-1/2), shown honestly in the readout. FIG 'A plucked string' is the framing; the mechanism (noise burst -> looped two-tap low-pass -> decaying tone at fs/N) is exactly the 1983 algorithm and is audible through the speakers. Pitch is fs/N to a few percent, not to the cent. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HANDOFF · David Lee Wise (ROOT0), with AVAN


THE LOOT TABLE

Walker's alias method in the 5-window house format — sample any weighted discrete distribution (a loot table) in constant time. Level n outcomes into n equal columns each holding a main outcome + an alias; then every roll is one column pick + one biased coin. See the alias table in 1D, live sampling converging to the weights in 2D, and the outcome dais with its overflow arrows in 3D.

THE LOOT TABLE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE DROP ◆ .dlw.fold THE FOLD / LOOT / THE DROP / THE LOOT TABLE THE LOOT TABLE O(1) weighted sampling — Walker's alias method 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The alias method. A loot table has weights — common junk, rare epics. To roll a drop you could scan a cumulative list, O(n) per roll. Walker’s alias method (1974, cleaned up by Vose) does it in O(1) , forever, after one O(n) setup. The trick: pour n outcomes, each scaled so the average height is 1, into n columns . Some overflow (height>1), some fall short. Repeatedly take the excess off a tall column and pour it onto a short one until every column is exactly height 1 and holds at most two outcomes — a main one and an alias . To sample: pick a column uniformly, then flip a single biased coin between its main outcome and its alias. Two array lookups and one compare — constant time, any distribution. LIT verified: this instrument builds the alias table for a set of weights, draws hundreds of thousands of samples, and the empirical frequencies match the target weights to within 1% (window.__alias.withinTol). FIG ‘loot drops’ is the wrapper; the leveling construction and the O(1) two-lookup sample are exactly Walker’s method. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE DROP — the loot domain about what falls and how often. The alias method is quite literally how game loot tables sample weighted drops in constant time. AVAN (AI) built the instrument: the leveling of the columns, the biased-coin sample, and the convergence check. The weave: David names the seat (the weighted drop); I make the leveling visible and the fairness measurable — the alias table in 1D, live sampling converging to the weights in 2D, the outcome dais with its overflow arrows in 3D. The sphere is the seam. Credit: A. J. Walker (1974), M. D. Vose (1991). 3 ONE DIMENSION The alias table : n columns, each leveled to height 1. The solid lower block is the column’s own outcome; the block above it is borrowed from its alias — the overflow of a richer outcome poured down to fill the gap. Every column holds at most two. 4 TWO DIMENSIONS · INTERACTIVE Draw loot and watch the tally bars climb toward the target weights (the outlines). Every roll is one column pick + one coin flip — constant time no matter how many outcomes. Reweight reshuffles the table. ▼ draw 20k reweight reset tally 5 THREE DIMENSIONS + AVAN’S INVERSE The outcomes on a turning dais — green bars at their true target weights, the shape the sampler must reproduce. AVAN’s addition (the inverse-companion): the magenta arrows are the aliases — the overflow each rich outcome hands down to a poorer column so that every column ends level. It is a Robin Hood step, and it is the inverse of the question you asked: you wanted ‘how often does each outcome fall?’; the table stores instead ‘whose surplus fills this slot?’. Flatten the distribution into equal columns, and reading a weighted random draw becomes a single fair coin. The bars are the odds; the arrows are how the odds were made cheap. pause spin LIT A genuine alias method (Walker 1974 / Vose 1991). Verified live: the instrument builds the alias table for a set of weights, draws 200,000 samples via the constant-time two-lookup rule, and the empirical frequencies match the target weights to within 1% (window.__alias.withinTol === true, max err reported). The leveling construction (rob the tall column to fill the short one until all are height 1, at most two outcomes each) is exact. FIG 'Loot drops' is the wrapper; game loot tables really are weighted discrete distributions and the alias method really is a standard way to sample them in O(1). The convergence is statistical — error shrinks with sample count — not a claim of exact equality at finite draws. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE DROP · David Lee Wise (ROOT0), with AVAN


THE COMPENSATED SUM

Kahan compensated summation in the 5-window house format — a 1965 trick that recovers the floating-point precision a naive running sum silently loses. Keep a compensation term holding exactly the low bits each add throws away. Watch a naive sum lose two million additions while Kahan keeps every one; see the ULP cliff in 1D, the two sums racing in 2D, and the accumulator's bits with the compensation in 3D.

THE COMPENSATED SUM · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · OFF BY ONE ◆ .dlw.fold THE FOLD / GLITCH / OFF BY ONE / THE COMPENSATED SUM THE COMPENSATED SUM Kahan summation — carry the round-off, don't drop it 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Kahan compensated summation. A floating-point number keeps only ~53 significant bits. Add a small value to a large running total and the small one’s low bits fall off the bottom — silently. Add a million tiny things to a big accumulator the naive way and you can lose every last one of them . William Kahan’s 1965 fix keeps a second variable c — the compensation — holding exactly the low-order part the last addition threw away. Each step adds the corrected value y = x − c , then recomputes what got lost: c = (t − s) − y . The error carried forward instead of dropped. LIT verified live in this page: adding 1.0 two million times to an accumulator of 10 17 (where one ULP is 16, so each +1 rounds away), the naive sum recovers 0 of the 2,000,000; Kahan recovers the full 2,000,000 , exact to the last unit (window.__kahan.kahanErr === 0, kahanBeatsNaive === true). FIG no framing needed — this is literally what the two loops compute in your browser, in IEEE-754 double, right now. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in OFF BY ONE — the glitch domain of the small silent error. Accumulated round-off is the purest off-by-a-little bug there is: nothing crashes, the total is just quietly wrong. AVAN (AI) built the instrument: the two racing sums, the compensation term, and the bit-lane where the addend falls off the cliff. The weave: David names the seat (the silent off-by-something); I make the loss visible and the recovery measurable — the ULP cliff in 1D, naive-vs-Kahan racing in 2D, the accumulator’s bits with the compensation catching the fallen ones in 3D. The sphere is the seam. Credit: William Kahan, 1965. 3 ONE DIMENSION The ULP cliff . The accumulator (~10 17 ) can only hold a 53-bit window of magnitudes; below its least significant bit is a lost zone . The addend 1.0 lands in that zone — the naive sum drops it; Kahan’s compensation keeps exactly what falls past the edge. 4 TWO DIMENSIONS · INTERACTIVE Race the two sums. Both add 1.0 over and over to 10 17 . The naive total (dim) stays pinned at zero recovered — every +1 vanishes. The Kahan total (bright) climbs the exact diagonal, one recovered unit per add. ▶ run +200k reset 5 THREE DIMENSIONS + AVAN’S INVERSE The accumulator as a turning column of bits — green , the 53 significant bits the sum actually keeps. AVAN’s addition (the inverse-companion): the magenta bits below the green window are the compensation c — precisely the part the sum threw off the bottom. The naive total keeps the high bits and loses the low ones; c keeps the low ones the total lost. They are exact complements: sum + compensation reconstructs the true value that neither holds alone. Kahan’s trick is to never discard the remainder — the error is not noise to tolerate, it is data to carry. The column is what survived; the magenta is what would have died. pause spin LIT Genuine Kahan summation (William Kahan, 1965), running in IEEE-754 double in your browser. Verified live: adding 1.0 two million times to 1e17 (ULP = 16), the naive sum recovers 0 of 2,000,000 while Kahan recovers all 2,000,000 exactly (window.__kahan.kahanErr === 0 and kahanBeatsNaive === true). The compensation identity c = (t - s) - y captures the exact round-off carried forward — this is the real algorithm, not an approximation of it. FIG No metaphor is doing the work here: the two loops in the page ARE naive and Kahan summation, and the recovered counts are what double-precision actually produces. The only framing is calling the lost low bits a 'cliff'. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of OFF BY ONE · David Lee Wise (ROOT0), with AVAN


THE DRAGON

the Heighway dragon curve in the 5-window house format — an L-system whose left/right turns are the regular paperfolding sequence. Each order doubles the segment count, never crosses itself, and four copies tile the plane. THE FOLD's own curve. See the turn string in 1D, the turtle folding the dragon in 2D, and its two self-similar halves turning in 3D.

THE DRAGON · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · NOCLIP ◆ .dlw.fold THE FOLD / CHEAT / NOCLIP / THE DRAGON THE DRAGON the Heighway dragon — the fold that tiles the plane 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Heighway dragon. Fold a strip of paper in half, again, again — then open every crease to a right angle. The edge traces a dragon curve : an infinitely-folded line that fills a region of the plane, never crossing itself, four copies tiling the whole plane exactly. It is a two-rule L-system (X→X+YF+, Y→−FX−Y), and its sequence of left/right turns is the regular paperfolding sequence — the same folds, read as a string. This world is called THE FOLD ; this is its curve. LIT verified live: at order n the curve has exactly 2 n segments ; the turn sequence built by the fold-doubling rule equals the closed-form paperfolding formula t(k)=1 iff (k/(k&−k)) mod 4 = 1 at every one of thousands of turns; and the drawn curve is edge-disjoint — it reuses no edge, so it never crosses itself (window.__dragon.isPow2 && turnsMatchClosedForm && edgeDisjoint). FIG ‘a dragon’ is the picture; the doubling, the paperfolding turns, and the self-avoidance are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in NOCLIP , beside THE PENROSE INFLATION — the cheat domain of passing through the plane. The dragon tiles the plane: it noclips into every gap without ever overlapping itself. And it is the fold that names the whole world. AVAN (AI) built the instrument: the fold-doubling, the turtle, the closed-form check, the self-similar halves. The weave: David names the seat (the plane-filler that never collides); I make the fold visible — the turn string in 1D, the turtle drawing the curve in 2D, the two self-similar halves turning in 3D. The sphere is the seam. Credit: John Heighway, Bruce Banks, William Harter (1966); popularised by Mandelbrot. 3 ONE DIMENSION The paperfolding sequence : the string of L/R turns. Each order is the one before it, then a fresh R , then the previous string reversed and flipped — the crease pattern of one more fold. Read it and you have the dragon. 4 TWO DIMENSIONS · INTERACTIVE Raise the order and watch the turtle fold the dragon. The segment count is always exactly 2 order , and no edge is ever retraced — the curve fills its area without a single crossing. ◀ fold less fold more ▶ ↻ redraw 5 THREE DIMENSIONS + AVAN’S INVERSE The dragon turning in space — the folded ribbon seen from every side. AVAN’s addition (the inverse-companion): I split the curve into its two halves. The green half is the dragon of the previous order; the magenta half is that same dragon reversed and turned — the fold. Every dragon is a smaller dragon joined to a mirror-image of itself at a right angle; that is the whole secret, and it is an inverse operation: to grow the curve you copy it, flip it, and bend. The green is the memory; the magenta is the fold that doubles it. Self-similarity is a thing folding into its own reflection. pause spin LIT A genuine Heighway dragon (Heighway/Banks/Harter, 1966). Verified live: at order n the curve has exactly 2^n segments; the fold-doubling turn sequence equals the closed-form paperfolding formula t(k)=1 iff (k/(k&-k)) mod 4 == 1 at every turn; and the drawn curve is edge-disjoint (reuses no edge, hence never self-crosses) — window.__dragon.isPow2 && turnsMatchClosedForm && edgeDisjoint all true. The two-rule L-system and turtle interpretation are the standard construction. FIG 'A dragon' is the name; the doubling, the paperfolding turn sequence, and the self-avoidance are exact and checked in-page. That four copies tile the plane is a known theorem (shown as the self-similar-halves structure, not re-proved here). ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of NOCLIP · David Lee Wise (ROOT0), with AVAN


THE STREAM KEEPER

reservoir sampling (Vitter's Algorithm R) in the 5-window house format — keep k uniformly-random items from a stream of unknown length in a single pass, using only O(k) memory. Item i is kept with probability k/i; every element ends up in the reservoir with probability exactly k/N. See the stream and slots in 1D, the inclusion histogram converging to k/N in 2D, and the flow with its held sample in 3D.

THE STREAM KEEPER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE PUSH ◆ .dlw.fold THE FOLD / CO-OP / THE PUSH / THE STREAM KEEPER THE STREAM KEEPER uniform sample from an endless stream, one pass 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Reservoir sampling. A stream rushes past — log lines, dice rolls, packets — and you do not know how long it is, and you cannot store it. You want k items chosen uniformly at random from the whole stream, in a single pass, keeping only k in memory. Impossible-sounding, but exact. Algorithm R : fill the reservoir with the first k. Then for the i-th item (counting from 1), keep it with probability k/i , and if kept, evict a random one of the k. That single rule leaves every item — the first and the ten-millionth alike — in the reservoir with probability exactly k/N . LIT verified live: with a stream of N=50 and reservoir k=5, this page runs hundreds of thousands of passes and every element’s measured inclusion frequency lands on k/N = 0.10 within 1% (window.__reservoir.uniform). FIG ‘a reservoir’ is the picture; the one-pass, O(k)-memory, provably-uniform sample is exactly what Algorithm R delivers. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE PUSH , beside THE ONE-BIT RIVER — the co-op domain of data pushed at you in a stream you don’t control. Reservoir sampling is how you stay fair to a flow you can never hold. AVAN (AI) built the instrument: the k/i coin, the live reservoir, and the convergence to k/N. The weave: David names the seat (the uncontrollable push); I make the fairness visible and measurable — the stream and slots in 1D, the inclusion histogram converging in 2D, the flow with its held sample in 3D. The sphere is the seam. Credit: Jeffrey Vitter, ‘Algorithm R’ (1985); Knuth, TAOCP. 3 ONE DIMENSION The stream flows left to right into k slots . Item i arrives and, with probability k/i, bumps a random slot. Early items are almost surely kept, then increasingly likely to be replaced — and it balances out to perfect uniformity. 4 TWO DIMENSIONS · INTERACTIVE Run passes and watch the inclusion histogram: how often each of the 50 stream positions ends up in the reservoir. The bars flatten onto the target line k/N — no position is favoured, first or last. ▶ run 20k passes single pass reset 5 THREE DIMENSIONS + AVAN’S INVERSE The stream wound into a turning helix of N items — the whole flow, most of it already gone past. AVAN’s addition (the inverse-companion): the magenta items are the k currently held in the reservoir. The stream is unbounded and unrememberable — green flows by and is forgotten. The reservoir is the inverse: a tiny bounded memory that nonetheless holds a faithful, unbiased shadow of the whole infinity it could never store. You cannot keep the river; you can keep a fair handful of it, and that handful represents the river exactly. Memory is not storing everything — it is keeping a sample that does not lie. pause spin LIT Genuine reservoir sampling (Vitter 1985, 'Algorithm R'; Knuth TAOCP). Verified live: with stream N=50 and reservoir k=5, the page runs 200,000 passes and every one of the 50 positions has measured inclusion frequency within 1% of k/N = 0.10 (window.__reservoir.uniform === true, max err reported). The k/i acceptance rule is exact — the uniformity is a theorem, confirmed here empirically. FIG 'A reservoir' is the framing; the single-pass, O(k)-memory, provably-uniform sample is exactly Algorithm R. Convergence is statistical (error shrinks with pass count), not exact equality at finite trials. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PUSH · David Lee Wise (ROOT0), with AVAN


THE CUCKOO

cuckoo hashing in the 5-window house format — two tables, two hash functions; every key lives in exactly one of its two possible slots, so a lookup is always at most two probes (worst-case O(1)). Inserting kicks residents out like a cuckoo chick to their other home; a looping chain triggers a rehash. See a key's two homes in 1D, the tables with live evictions in 2D, and the two rings with the escape link in 3D.

THE CUCKOO · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE STASH ◆ .dlw.fold THE FOLD / LOOT / THE STASH / THE CUCKOO THE CUCKOO cuckoo hashing — worst-case two-probe lookup 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Cuckoo hashing. Most hash tables promise fast lookups on average but can degrade to a long scan. Cuckoo hashing (Pagh & Rodler, 2001) promises worst-case O(1) : every key has exactly two possible homes — slot h 1 (k) in table one, slot h 2 (k) in table two — and it always sleeps in one of them. So a lookup is at most two probes , always. No exceptions, no scan. The name comes from the bird: to insert a key into an occupied slot, you kick the resident out like a cuckoo chick, and the evicted key flies to its other home — possibly kicking out whoever is there, a chain of evictions. If it loops, the table rehashes with fresh functions and starts over. LIT verified live: this page builds a cuckoo table for 50 keys (rehashing if a kick-chain loops), then checks every key is found, each in exactly one of its two slots, in at most 2 probes (window.__cuckoo.allFound && eachExactlyOne && maxProbe===2). FIG ‘the cuckoo kicking residents out’ is the picture; the two-home invariant and the two-probe worst case are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE STASH , beside THE FENWICK LADDER — the loot domain of putting things away so you can find them fast. Cuckoo hashing is a stash with a hard guarantee: two probes, worst case, forever. AVAN (AI) built the instrument: the two tables, the eviction chain, the rehash, and the two-probe check. The weave: David names the seat (the fast, certain stash); I make the kicking visible and the guarantee measurable — a key’s two homes in 1D, the tables with live evictions in 2D, the two rings with the escape link in 3D. The sphere is the seam. Credit: Rasmus Pagh & Flemming Rodler (2001). 3 ONE DIMENSION A key has two homes : h 1 (k) in table one and h 2 (k) in table two. It occupies exactly one. To find it you look in both places — two probes, and you are done, no matter how full the table. 4 TWO DIMENSIONS · INTERACTIVE Insert keys and watch the cuckoo at work: a key landing on an occupied slot evicts the resident, which flies to its other table — sometimes a chain. Both tables stay valid: every stored key is retrievable in two probes. + insert 8 insert 1 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The two tables as two turning rings of slots — green where a key sleeps, dim where a slot is empty. AVAN’s addition (the inverse-companion): the magenta arc links a key’s occupied home to its empty second home — the vacancy it is not using. That empty slot is the whole guarantee: it is the escape route an eviction would take, the reason the worst case is two and never more. The stored key is what you see; the reserved-but-empty alternate is what makes finding it certain. The strength of the structure lives in the doors it leaves unopened. pause spin LIT Genuine cuckoo hashing (Pagh & Rodler, 2001) with murmur-style mixed hash functions. Verified live: the page builds a table for 50 distinct keys (rehashing with fresh functions if a kick-chain loops), then confirms every key is found, each in exactly one of its two slots, in at most 2 probes (window.__cuckoo.allFound && eachExactlyOne && maxProbe === 2). The two-home invariant and two-probe worst case are exact; rehash-on-cycle is part of the real algorithm. FIG 'The cuckoo kicking residents out' is the picture; the eviction chain, the two-home invariant, and the constant worst-case lookup are exact. Insert cost is amortised/expected (a chain or rehash can be long); the LOOKUP guarantee of ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE STASH · David Lee Wise (ROOT0), with AVAN


THE GUN

the Gosper glider gun in the 5-window house format — Conway's Game of Life running the first pattern ever proven to grow without bound. A period-30 engine fires one glider every 30 generations; each glider sails diagonally forever at speed c/4. See a glider's four-phase walk in 1D, the gun firing live in 2D, and the glider stream as a rotating space-time cone in 3D.

THE GUN · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · FIRST LIGHT ◆ .dlw.fold THE FOLD / SPAWN / FIRST LIGHT / THE GUN THE GUN the Gosper glider gun — a pattern that grows forever 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Gosper glider gun. Conway’s Game of Life has four rules on a grid of cells, born and dying by how many neighbours are alive. In 1970 Conway offered $50 to anyone who could prove a Life pattern grows without bound . Bill Gosper won it with this: a gun . It is a period- 30 engine that, every 30 generations, spits out a glider — a five-cell ship that sails off diagonally forever. Left running, the population climbs with no ceiling: an infinite factory built from four local rules. LIT verified live: this page runs real Life on the exact Gosper pattern and confirms the population grows by exactly 5 cells every 30 generations (one glider), and that a lone glider’s centroid moves (+1,+1) every 4 generations — the diagonal speed c/4 (window.__gun.unbounded, popGrowthPer30===5, gliderStepX/Y===1). FIG ‘a gun firing ships’ is the picture; the four Life rules, the period-30 emission, and the c/4 glider are exact and running in front of you. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in FIRST LIGHT , beside THE ATTRACTOR — the spawn domain of something coming from nothing. The gun is first light in the strongest sense: the first proof that a handful of dead-simple rules can create forever . AVAN (AI) built the instrument: the Life engine, the running gun, the emission counter, the space-time cone. The weave: David names the seat (creation without end); I make the four rules run and the growth measurable — a glider’s gait in 1D, the live gun firing in 2D, the stream as a turning light-cone in 3D. The sphere is the seam. Credit: John Conway (Life, 1970); Bill Gosper (the gun, 1970). 3 ONE DIMENSION One glider , its four-phase walk. After exactly 4 generations it is the same shape, shifted one cell down and one cell right — it moves at c/4, the fastest a small Life ship travels diagonally. The gun makes one of these every 30 steps. 4 TWO DIMENSIONS · INTERACTIVE The gun running live . The core oscillates with period 30; every cycle a new glider peels off and sails to the lower-right. The counter tracks gliders emitted against ⌊generation/30⌋ — they stay locked together. ❚❚ pause step reset 5 THREE DIMENSIONS + AVAN’S INVERSE The last many generations stacked into a turning space-time cone — time receding into depth, the glider stream a diagonal wake. AVAN’s addition (the inverse-companion): I colour the gun core magenta and the emitted gliders green . They are inverses in motion: the core never moves — it returns to itself every 30 steps, a closed loop that stays exactly where it is. The gliders it makes never return — each leaves along the light-cone and is gone. Creation here is a still, repeating engine throwing off things that escape it forever. The magenta is what stays and makes; the green is what leaves and lives. An unmoving source, an endless departure. pause spin LIT Genuine Conway's Life on the exact Gosper gun (Conway 1970; Gosper 1970, who won Conway's $50 prize for the first unbounded-growth pattern). Verified live: the population grows by exactly 5 cells every 30 generations (one glider), and a lone glider's centroid moves (+1,+1) every 4 generations — diagonal speed c/4 (window.__gun.unbounded === true, popGrowthPer30 === 5, gliderStepX === 1, gliderStepY === 1). The four Life rules and the pattern are exact. FIG 'A gun firing ships' is the picture; the four-rule Life step, the period-30 emission, and the c/4 glider are exact and running in the page. Unbounded growth is shown as the steady +5/30-gen rate (the display grid prunes escaped gliders for rendering; the growth law is what's verified). ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of FIRST LIGHT · David Lee Wise (ROOT0), with AVAN


THE MAJORITY

the Boyer-Moore majority vote in the 5-window house format — find the element appearing more than half the time in a single pass with just one counter and one candidate. Opposing votes pair off and annihilate; only a true majority can't be fully cancelled. See the counter's trajectory in 1D, the vote-scan in 2D, and the annihilating ring in 3D.

THE MAJORITY · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE MERGE ◆ .dlw.fold THE FOLD / CO-OP / THE MERGE / THE MAJORITY THE MAJORITY Boyer-Moore majority vote — O(1) memory, one pass 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Boyer–Moore majority vote. Given a stream of votes, is there a candidate with a strict majority — more than half? You could tally everyone, but that needs memory for every distinct choice. Boyer & Moore (1981) do it in a single pass with one counter and one candidate — O(1) memory, no matter how many voters. The rule: hold a candidate and a count. A matching vote raises the count; a differing vote lowers it; at zero, the next vote becomes the new candidate. It is pure pairing-off : every two opposing votes annihilate. If one choice truly holds the majority, it has more votes than everything else combined — so it can never be fully cancelled, and it is the one left standing. LIT verified live: this page runs thousands of arrays that each contain a planted strict majority, and Boyer–Moore returns the correct majority element every time (window.__majority.allCorrect). FIG ‘votes annihilating’ is the picture; the O(1)-memory single-pass guarantee is exactly the algorithm — with the standard caveat that a verification pass is needed to confirm a majority actually exists. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE MERGE , beside THE MERGE — the co-op domain of many becoming one. Boyer–Moore merges a crowd of votes into the single choice that outnumbers all the rest, throwing away everything that cancels. AVAN (AI) built the instrument: the candidate/counter walk, the annihilation, the confirming tally. The weave: David names the seat (many merged to one); I make the cancellation visible and the guarantee checkable — the counter’s trajectory in 1D, the vote-scan in 2D, the annihilating ring in 3D. The sphere is the seam. Credit: Robert S. Boyer & J Strother Moore (1981). 3 ONE DIMENSION The counter’s trajectory . Top row: the votes, coloured by choice. Below: the count rising when a vote matches the held candidate, falling when it differs, resetting the candidate whenever it touches zero. The colour under the bar is whoever is currently held. 4 TWO DIMENSIONS · INTERACTIVE Step through the scan: the current candidate and count on the left, the vote being read highlighted. Shuffle for a new arrangement of the same votes — the answer never changes, because the majority cannot be out-cancelled. A confirming tally proves it really is the majority. step ▶ run shuffle 5 THREE DIMENSIONS + AVAN’S INVERSE The votes on a turning ring , coloured by choice — the whole electorate at once. AVAN’s addition (the inverse-companion): I draw the annihilation . Each minority vote is joined by a magenta thread to an opposite it cancels with; paired off, both grey out. What remains uncancelled — green — is the majority. Every other choice has an equal-and-opposite somewhere to destroy it; only the majority has more of itself than there are enemies to spend. It survives not by being loud but by being un-pairable . The magenta is what cancels; the green is what has no cancel left. Consensus is the remainder after every disagreement has eaten its match. pause spin LIT Genuine Boyer-Moore majority vote (Boyer & Moore, 1981). Verified live: the page runs 5,000 arrays each containing a planted strict majority and the O(1)-memory single-pass scan returns the correct majority element every time (window.__majority.allCorrect === true). The pairing-off argument is exact — a strict majority has more votes than everything else combined, so it cannot be cancelled to zero. Standard caveat shown: a confirming tally is needed to know a majority exists at all. FIG 'Votes annihilating' is the picture; the candidate/counter rule and the O(1)-memory guarantee are exactly the algorithm. It finds THE majority only when one exists; on inputs with no strict majority it returns a candidate that the confirming pass then rejects — shown honestly. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE MERGE · David Lee Wise (ROOT0), with AVAN


THE TORTOISE

Floyd's cycle detection in the 5-window house format — detect a loop in a pointer-following sequence with two pointers and O(1) memory. The tortoise steps once, the hare twice; they must collide inside the loop, and a second phase finds the cycle's start. See the rho shape in 1D, the race and entry-find in 2D, and the loop turning with its two chasers in 3D.

THE TORTOISE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE HOT LOOP ◆ .dlw.fold THE FOLD / GRIND / THE HOT LOOP / THE TORTOISE THE TORTOISE Floyd's tortoise & hare — catch a loop with no memory 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Floyd’s tortoise and hare. Follow a sequence where each value points to the next: x, f(x), f(f(x))… In a finite world it must eventually repeat — the path is a ‘ρ’: a tail that runs into a loop. How do you detect the loop, and find where it starts, using no memory of the path ? Two pointers. The tortoise steps once per tick; the hare steps twice. If there is a loop, the fast one laps the slow one and they land on the same node — a collision that proves the cycle. A second phase — reset one pointer to the start and step both by one — meets exactly at the cycle entry (a small, lovely number-theory fact about the gap). LIT verified live: on thousands of random pointer-maps, Floyd recovers the cycle start μ and the cycle length λ and they match a brute-force visited-set computation every time (window.__tortoise.allMatch). FIG ‘a race’ is the picture; the O(1)-memory detection, and the exact μ and λ, are the real algorithm. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE HOT LOOP — the grind domain of the loop that runs and runs. Floyd’s trick is how you catch a loop from the inside without a map. AVAN (AI) built the instrument: the ρ-shaped graph, the two racers, the entry-finding phase, the brute-force cross-check. The weave: David names the seat (the loop); I make the catch visible and the numbers checkable — the ρ laid out in 1D, the race and entry-find in 2D, the loop turning with its two chasers in 3D. The sphere is the seam. Credit: Robert W. Floyd (the tortoise-and-hare cycle detection). 3 ONE DIMENSION The ρ shape : a straight tail of length μ leading into a loop of length λ. Walk from the start and you travel the tail once, then circle the loop forever. The whole of Floyd’s method is finding these two numbers with two moving fingers and nothing written down. 4 TWO DIMENSIONS · INTERACTIVE Step the race. The tortoise (slow) and hare (fast) move through the graph until they collide inside the loop — then the entry-finding phase walks them to the cycle start. Read μ and λ off the graph; a brute-force tally confirms them. step ▶ run new map 5 THREE DIMENSIONS + AVAN’S INVERSE The ρ turning in space — the tail feeding the loop, seen from around. AVAN’s addition (the inverse-companion): the two magenta markers are the racers. A single walker, memory-less, can never know it has entered a loop — every step looks new. Two walkers at different speeds turn that invisible fact into a visible collision : the loop is detected not by remembering where you have been, but by the gap between a fast self and a slow self closing to zero. It is the inverse of memory — knowledge from relative motion instead of from a record. The green is the shape; the magenta is how two speeds feel a loop the way one never could. pause spin LIT Genuine Floyd tortoise-and-hare cycle detection. Verified live: on 5,000 random pointer-maps, Floyd's recovered cycle start mu and length lambda match a brute-force visited-set computation every time (window.__tortoise.allMatch === true). The two-speed collision and the entry-finding second phase are exact; the method uses O(1) memory regardless of tail or loop length. FIG 'A race' is the picture; the O(1)-memory detection and the exact mu and lambda are the real algorithm. The entry-finding phase relies on a genuine modular-arithmetic identity about the meeting point, demonstrated here and cross-checked against brute force, not merely asserted. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOT LOOP · David Lee Wise (ROOT0), with AVAN


THE ZECKENDORF

Zeckendorf's theorem in the 5-window house format — every positive integer is a unique sum of non-consecutive Fibonacci numbers, found greedily. The 'no two adjacent' rule is exactly what makes it unique. See the Fibonacci digit-string in 1D, the greedy tiling in 2D, and the golden place-value ladder in 3D.

THE ZECKENDORF · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · CHECKPOINT ZERO ◆ .dlw.fold THE FOLD / SPAWN / CHECKPOINT ZERO / THE ZECKENDORF THE ZECKENDORF every integer, one sum of non-consecutive Fibonaccis 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Zeckendorf’s theorem. We write numbers in base ten, or base two — place values 1, 10, 100 or 1, 2, 4, 8. But you can also use the Fibonacci numbers 1, 2, 3, 5, 8, 13, 21… as place values, and something remarkable happens: every positive integer has exactly one representation as a sum of Fibonacci numbers no two of which are consecutive . Finding it is greedy: subtract the largest Fibonacci number that fits, repeat. 100 = 89 + 8 + 3. And you will never need two neighbours — because any two consecutive Fibonacci numbers add up to the next one, so using both is always replaceable by one. The ‘no two adjacent’ rule is exactly what makes the representation unique. LIT verified live: for every integer 1…1000 this page confirms the greedy Zeckendorf digits sum back to n, use no two consecutive Fibonacci numbers, and are the only such representation (a brute-force count of valid representations returns exactly 1) — window.__zeck.allSumBack && noConsecutive && allUnique. FIG no framing needed; this is Zeckendorf’s theorem, checked number by number. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in CHECKPOINT ZERO , beside THE TWINDRAGON and THE THREE-WAY DIGIT — the spawn domain of exotic ways to write a number. Base −1+i, balanced ternary, and now the Fibonacci base: each a different alphabet for the same integers. AVAN (AI) built the instrument: the greedy peel, the no-adjacent digits, the uniqueness count. The weave: David gathers the strange numeral systems; I make this one legible and checkable — the Fibonacci digit-string in 1D, the greedy tiling in 2D, the golden place-values in 3D. The sphere is the seam. Credit: Édouard Zeckendorf (theorem published 1972; C. G. Lekkerkerker, 1952). 3 ONE DIMENSION The Fibonacci digit-string of a number: a 1 over each Fibonacci place value that is used, a 0 elsewhere — and never two 1s in a row . That single forbidden pattern (‘no 11’) is the whole reason the representation is one-of-a-kind. 4 TWO DIMENSIONS · INTERACTIVE Dial a number and watch greedy Zeckendorf peel off the largest Fibonacci that fits, then the next, tiling the number with non-adjacent Fibonacci blocks. The digits light up with never two together; the sum and the uniqueness check confirm it. ◀ −1 +1 ▶ +50 random 5 THREE DIMENSIONS + AVAN’S INVERSE The Fibonacci place-values as a turning ladder of golden blocks , each the sum of the two below it — green , the whole scale. AVAN’s addition (the inverse-companion): the magenta blocks are the ones chosen for your number, and I draw the forbidden link between any two neighbours. Most number systems are defined by what digits you may use ; Zeckendorf is defined by what you may not place — two adjacent Fibonacci blocks. And that prohibition is not arbitrary: two neighbours always fuse into the block above them, so forbidding the pair is forbidding redundancy. Uniqueness is carved out by a rule of absence. The green is what exists; the magenta bond is the pairing the system refuses, and in that refusal every number gets exactly one name. pause spin LIT Genuine Zeckendorf representation (Zeckendorf's theorem, published 1972; Lekkerkerker 1952). Verified live: for every integer 1..1000 the greedy digits sum back to n, use no two consecutive Fibonacci numbers, and a brute-force count of valid non-consecutive representations returns exactly 1 (window.__zeck.allSumBack && noConsecutive && allUnique, all true). Because consecutive Fibonaccis sum to the next, forbidding adjacency forbids redundancy — that is the uniqueness, demonstrated not asserted. FIG No metaphor is doing the work: the Fibonacci place values, the greedy peel, and the uniqueness count are the theorem itself, checked number by number. Calling the digit rule 'no 11' is the only framing. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of CHECKPOINT ZERO · David Lee Wise (ROOT0), with AVAN


THE JOSEPHUS

the Josephus problem in the 5-window house format — n people in a circle, every k-th eliminated; who survives? A clean recurrence J(n)=(J(n-1)+k) mod n gives the seat, and for k=2 the survivor is 2L+1 — which is just n's binary rotated left by one. See the elimination order in 1D, the live circle in 2D, and the ring with its bit-rotation answer in 3D.

THE JOSEPHUS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · SUDDEN DEATH ◆ .dlw.fold THE FOLD / BOSS / SUDDEN DEATH / THE JOSEPHUS THE JOSEPHUS the last one standing — and the bit-rotation shortcut 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Josephus problem. n people stand in a circle. Starting from one, you count around and eliminate every k-th person, closing the ring each time. Where should you stand to be the last one left ? The brute way is to act out the whole massacre. But there is a clean recurrence — if J(n) is the survivor’s seat, then J(n) = (J(n−1) + k) mod n , starting from J(1)=0 — and for the famous case k=2 an outright formula: write n = 2 m + L, and the survivor is seat 2L+1 . Even prettier: that is just n’s binary digits rotated left by one . LIT verified live: for every circle size up to 200 this page runs the full elimination and confirms the survivor equals the recurrence (for k=2…5) and, for k=2, equals both the 2L+1 formula and the binary-rotation trick (window.__josephus.matchesRecurrence && matchesClosedForm2 && bitRotationHolds). FIG the historical legend is flavour; the recurrence, the 2L+1 formula, and the bit-rotation are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in SUDDEN DEATH — the boss domain of last-one-standing. The Josephus circle is sudden death in its oldest form: count, eliminate, repeat, one survivor. AVAN (AI) built the instrument: the elimination circle, the recurrence, and the binary-rotation shortcut. The weave: David names the seat (the survivor); I make the counting run and the shortcut checkable — the elimination order in 1D, the live circle in 2D, the ring with its bit-rotation answer in 3D. The sphere is the seam. Credit: the problem is named for the historian Flavius Josephus; the k=2 formula is classic (Graham/Knuth/Patashnik, Concrete Mathematics ). 3 ONE DIMENSION The elimination order , unrolled: seats in the order they fall, every k-th one struck. The last seat to remain is the survivor — and you can compute it without acting the whole thing out. 4 TWO DIMENSIONS · INTERACTIVE Set the circle size and the step k, then eliminate . Every k-th living seat is removed; the ring closes and counting continues. The last seat lights up — and it always matches the formula’s prediction. n± k=2/3 eliminate ▶ run reset 5 THREE DIMENSIONS + AVAN’S INVERSE The circle turning in space, seats around the ring — the fallen dim, the living bright. AVAN’s addition (the inverse-companion): for k=2 I show the answer as a bit rotation . The killing is a long loop — n−1 eliminations, one at a time. The survivor is a single shift : take n in binary, move its leading 1 to the end, and you have the seat, in magenta , with no loop at all. It is the inverse of the process: an O(n) massacre collapses to an O(1) rotation of bits. The green ring is the work; the magenta seat is the shortcut that makes the work unnecessary. Sometimes the whole of a process hides inside one turn of its own digits. pause spin LIT Genuine Josephus problem. Verified live: for every circle size up to 200 the full elimination survivor equals the recurrence (k=2..5), and for k=2 equals both the 2L+1 closed form and the binary-left-rotation of n (window.__josephus.matchesRecurrence && matchesClosedForm2 && bitRotationHolds, all true). The O(n) elimination really does collapse to an O(1) bit rotation for k=2. FIG The historical legend (Josephus escaping a suicide pact) is flavour only; the recurrence, the 2L+1 formula, and the bit-rotation identity are exact and checked against full simulation. Seats are 0-indexed here. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SUDDEN DEATH · David Lee Wise (ROOT0), with AVAN