THE DIRICHLET CONVOLUTION

the Dirichlet convolution in the 5-window house format — combine arithmetic functions by (f*g)(n) = sum over divisors d of n of f(d)g(n/d), making them a ring with identity epsilon (1 at n=1). The Mobius function is the inverse of the constant-1 (mu*1=epsilon), which is Mobius inversion; Euler's totient gives phi*1=Id; divisor count tau=1*1; divisor sum sigma=1*Id. Number theory's identities become algebra. Verified live: mu*1=epsilon, phi*1=Id, 1*1=tau, 1*Id=sigma for all n<=100. See divisor pairs in 1D, the four identities in 2D, and the Mobius-inversion-is-a-group-inverse inverse in 3D.

THE DIRICHLET CONVOLUTION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE EPOCH ◆ .dlw.fold THE FOLD / GRIND / THE EPOCH / THE DIRICHLET CONVOLUTION THE DIRICHLET CONVOLUTION arithmetic functions form a ring — Mobius is the inverse of 1 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Dirichlet convolution combines two arithmetic functions (functions on the positive integers) into a new one: (f∗g)(n) = Σ d|n f(d)·g(n/d), summed over the divisors d of n. Under this product the arithmetic functions form a ring , with identity ε (which is 1 at n=1 and 0 elsewhere). The magic relationships: the Möbius function μ is the inverse of the constant-1 function (μ∗1 = ε), which is Möbius inversion; Euler’s totient satisfies φ∗1 = Id (Σ d|n φ(d) = n); the divisor count τ = 1∗1; the divisor sum σ = 1∗Id. Number theory’s identities become algebra in this ring. LIT verified live: μ∗1 = ε, φ∗1 = Id, 1∗1 = τ, and 1∗Id = σ hold for all n up to 100 (window.__dirichletconvolution). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-epoch — summing a function over the divisors of a number, the arithmetic of ages and cycles. Dirichlet convolution is that summation made a ring product. AVAN (AI) built the instrument: the divisor-pair sum, the Möbius and totient functions, the four identity checks. Credit as content: Peter Gustav Lejeune Dirichlet, whose convolution underlies Dirichlet series and analytic number theory. The weave: David names the epoch; I convolve arithmetic functions over divisors and confirm the classical identities — Möbius as the inverse of one, totient summing to the identity. 3 ONE DIMENSION The convolution at n: pair each divisor d with its complement n/d, evaluate f(d)·g(n/d), and sum. For n=12 the pairs are (1,12), (2,6), (3,4), (4,3), (6,2), (12,1). 4 TWO DIMENSIONS · INTERACTIVE Pick an identity and a value n. The instrument computes the convolution over the divisors of n and confirms it equals the expected function — ε, Id, τ, or σ. identity: μ∗1=ε ▶ n: 12 ▶ verify to 100 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the convolution ring — arithmetic functions multiplied by divisor sums. AVAN’s addition (the inverse-companion): every identity in this ring has a genuine group inverse . Because μ∗1 = ε, the Möbius function literally undoes summation-over-divisors: if g(n) = Σ d|n f(d), then f(n) = Σ d|n μ(d)·g(n/d). The inverse of ‘sum a function over divisors’ is ‘convolve with Möbius.’ Möbius inversion is not a trick — it is the group inverse of the constant-1 function under Dirichlet convolution. Magenta is the summation 1∗f; green is its exact undo μ∗(1∗f) = f. Number theory’s inclusion–exclusion is a ring inverse — the same μ that signs the Möbius sphere. pause spin LIT Genuine Dirichlet convolution (Dirichlet). Verified live: convolving over divisors, mu*1 equals epsilon, phi*1 equals the identity function, 1*1 equals the divisor count tau, and 1*Id equals the divisor sum sigma, for all n from 1 to 100 (window.__dirichletconvolution: muEps, phiId, oneTau, oneSigma). FIG No framing: the divisor-pair sum, the Mobius and totient functions, and the four identity checks run in-browser and are exact. The AVAN inverse is honest — because mu*1=epsilon, the Mobius function is the exact ring inverse of the constant-1 under Dirichlet convolution, so Mobius inversion (f(n)=sum mu(d)g(n/d) when g=sum f over divisors) is a genuine group inverse; magenta is the summation, green the Mobius undo. Ties to the-mobius. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE EPOCH · David Lee Wise (ROOT0), with AVAN


THE HUNGARIAN

the Hungarian algorithm in the 5-window house format — solve the assignment problem (match n workers to n jobs at minimum total cost) in O(n^3) instead of checking n! matchings, by subtracting row and column constants (which never change the optimal assignment) until a zero-cost complete matching appears. It is the workhorse of scheduling, tracking, and allocation. Verified live: over 200 random cost matrices (n=2..6), the Hungarian assignment's total cost equals the brute-force minimum over all permutations. See row reduction in 1D, an optimal assignment in 2D, and the reduction-reveals-the-answer inverse in 3D.

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

THE HUNGARIAN · 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 HUNGARIAN THE HUNGARIAN minimum-cost assignment by reducing to zeros 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Hungarian algorithm solves the assignment problem : given n workers and n jobs with a cost for each pairing, find the one-to-one assignment of workers to jobs with minimum total cost — in O(n³), versus checking all n! matchings. It works by subtracting constants from rows and columns of the cost matrix (which never changes which assignment is optimal) until enough zeros appear to form a complete zero-cost matching, guided by dual variables. It is the combinatorial-optimisation workhorse behind scheduling, tracking, and resource allocation. LIT verified live: over 200 random cost matrices (n=2…6), the Hungarian assignment’s total cost equals the brute-force minimum over all n! permutations (window.__hungarian). FIG no framing; exact optimisation. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-pull-request — matching contributions to reviewers at least total cost, cleanly one-to-one. The Hungarian algorithm is that optimal pairing. AVAN (AI) built the instrument: the row/column reduction, the augmenting-path matching, the brute cross-check. Credit as content: Harold Kuhn (1955), who named it ‘Hungarian’ for the earlier work of König and Egerváry; refined by James Munkres. The weave: David names the pull-request; I reduce the cost matrix to zeros and match on them, confirming the total cost equals the exhaustive minimum. 3 ONE DIMENSION Subtracting each row’s minimum, then each column’s, creates zeros without changing the optimal assignment — because every complete assignment uses one cell per row, so shifting a whole row shifts every assignment’s cost equally. 4 TWO DIMENSIONS · INTERACTIVE A cost matrix. The Hungarian algorithm finds the minimum-cost assignment (highlighted cells, one per row and column); the total is checked against a brute-force minimum over all permutations. new costs ▶ verify 200 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the optimal assignment, one cell per row and column, sitting on the reduced zeros. AVAN’s addition (the inverse-companion): subtracting a constant from a whole row or column does not change which assignment is optimal — every complete assignment uses exactly one cell per row, so a row shift moves all assignments’ costs by the same amount. The inverse of ‘the cheapest matching’ is ‘the matching that is cheapest after you have zeroed out the unavoidable per-row and per-column minimums.’ The algorithm exploits this invariance: reduce until the optimum reveals itself as a zero-cost matching. Magenta is the n! matchings never enumerated; green is the reduced zeros where the optimum hides. Reduction reveals the answer without search — linear-programming duality made combinatorial, the same max-min pairing as König and max-flow. pause spin LIT Genuine Hungarian algorithm (Kuhn 1955, on Konig-Egervary; Munkres). Verified live: the row/column-reduction + augmenting-path assignment returns a total cost equal to the brute-force minimum over all n! permutations for 200 random cost matrices of size n=2..6 (window.__hungarian.matchesBrute). FIG No framing: the reduction, the matching, and the brute cross-check run in-browser and agree exactly. The AVAN inverse is honest — subtracting a constant from a row or column shifts every complete assignment's cost equally (each uses one cell per row), so the optimum is invariant and reveals itself as a zero-cost matching; magenta is the n! matchings, green the reduced zeros. Ties to Hopcroft-Karp/Konig and Ford-Fulkerson. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PULL REQUEST · David Lee Wise (ROOT0), with AVAN


THE CHOLESKY

the Cholesky decomposition in the 5-window house format — factor a symmetric positive-definite matrix A into A = L*L^T with L lower-triangular (a matrix square root), about twice as fast as general LU. It solves SPD systems, least squares, and draws correlated Gaussian samples (Sigma = LL^T, transform normals by L). If A is not positive-definite the algorithm fails under a negative square root, so it doubles as a definiteness test. Verified live: for 300 random SPD matrices L*L^T reconstructs A to ~1e-15, L is lower-triangular, and a non-SPD matrix is rejected. See the triangular build in 1D, factor+reconstruct in 2D, and the symmetry-halves-the-work inverse in 3D.

THE CHOLESKY · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · THE TOOLCHAIN ◆ .dlw.fold THE FOLD / SPAWN / THE TOOLCHAIN / THE CHOLESKY THE CHOLESKY a matrix square root — A = L·Lᵀ, half the work of LU 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Cholesky decomposition factors a symmetric positive-definite matrix A into A = L·Lᵀ, where L is lower-triangular — a kind of ‘matrix square root.’ It is about twice as fast as general LU (you compute only one triangular factor), and it is the go-to for solving symmetric positive-definite systems, least squares, and drawing correlated random samples : to sample a Gaussian with covariance Σ, compute Σ = LLᵀ and transform independent normals by L. If A is not positive-definite the algorithm fails — a negative appears under a square root — so Cholesky is itself a positive-definiteness test. LIT verified live: for 300 random symmetric positive-definite matrices, L·Lᵀ reconstructs A to ~10⁻¹⁵, L is lower-triangular, and a non-positive-definite matrix is correctly rejected (window.__cholesky). FIG no framing; exact factorisation. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-toolchain — the numerical-linear-algebra tool under every solver and sampler. Cholesky is that quiet workhorse: the fast, stable matrix square root. AVAN (AI) built the instrument: the triangular factorisation, the reconstruction check, the positive-definiteness rejection. Credit as content: André-Louis Cholesky (c. 1910, published posthumously 1924 after his death in WWI). The weave: David names the toolchain; I build L one column at a time, confirm L·Lᵀ equals A, and show a non-positive-definite matrix break the square root. 3 ONE DIMENSION L is built entry by entry: each diagonal entry is a square root of what remains, each below-diagonal entry divides by the diagonal above it. Only the lower triangle is computed — the upper is its mirror. 4 TWO DIMENSIONS · INTERACTIVE A symmetric positive-definite matrix A and its Cholesky factor L. The product L·Lᵀ reconstructs A exactly. Toggle to a non-positive-definite matrix and watch the factorisation fail under a negative square root. new SPD matrix ▶ try non-SPD ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the single lower-triangular factor L, from which A = L·Lᵀ rebuilds. AVAN’s addition (the inverse-companion): symmetry halves the work . Because A is symmetric, its two LU factors are transposes of each other (L and Lᵀ), so you compute only one and get the other for free. The inverse of ‘two triangular factors’ is ‘one, mirrored.’ And the decomposition succeeds iff A is positive-definite, so Cholesky is a constructive proof : if all the square roots stay real, A is SPD; if one goes negative, it is not. Magenta is the second triangular factor you never compute — it is just the transpose; green is the single factor L. Symmetry earns half the work and doubles as a definiteness test. pause spin LIT Genuine Cholesky decomposition (Cholesky c.1910, published 1924). Verified live: for 300 random SPD matrices (formed as L0*L0^T), the Cholesky factor L satisfies L*L^T = A to max error ~1e-15 and is lower-triangular, and the algorithm returns failure on a non-positive-definite matrix (window.__cholesky.reconstructsA && .rejectsNonSPD). FIG No framing: the triangular factorization, the reconstruction check, and the non-SPD rejection run in-browser and are exact to floating precision. The AVAN inverse is honest — A's two LU factors are transposes (L and L^T) by symmetry, so only one is computed, and success is a constructive proof of positive-definiteness; magenta is the free transpose factor, green the computed L. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE TOOLCHAIN · David Lee Wise (ROOT0), with AVAN


THE NARAYANA

the Narayana numbers in the 5-window house format — N(n,k) counts Dyck paths (balanced-paren strings) of semilength n with exactly k peaks (an up-step then a down-step, '()'), refining the Catalan numbers: sum_k N(n,k) = C_n. The closed form is N(n,k)=(1/n)C(n,k)C(n,k-1), and the triangle 1;1,1;1,3,1;1,6,6,1 is symmetric. Verified live: N(n,k) equals a brute count of Dyck paths with k peaks and the rows sum to the Catalan number for n=1..8. See peaks on a path in 1D, formula vs brute in 2D, and the Catalan-decomposed-by-a-statistic inverse in 3D.

THE NARAYANA · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE CRON JOB ◆ .dlw.fold THE FOLD / GRIND / THE CRON JOB / THE NARAYANA THE NARAYANA Catalan sliced by peaks — a refinement that sums back 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Narayana numbers N(n,k) refine the Catalan numbers: they count the Dyck paths of semilength n (balanced-parenthesis strings) that have exactly k peaks — a peak being an up-step immediately followed by a down-step, ‘()’. Summing over all k recovers the Catalan number: Σ k N(n,k) = Cₙ. The closed form is N(n,k) = (1/n)·C(n,k)·C(n,k−1), and the triangle 1; 1,1; 1,3,1; 1,6,6,1; 1,10,20,10,1 is symmetric (N(n,k)=N(n,n+1−k)) — Catalan sliced by a natural statistic. LIT verified live: N(n,k) equals a brute count of Dyck paths with k peaks, and Σ k N(n,k) equals the Catalan number, for n=1…8 (window.__narayana). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-cron-job — counting the peaks in a periodic climb, the ups-and-downs of a repeating run. The Narayana numbers are that peak-count, refining the Catalan total. AVAN (AI) built the instrument: the closed-form N(n,k), the brute peak-count of Dyck paths, the Catalan row-sum. Credit as content: Tadepalli Venkata Narayana (1955). The weave: David names the cron-job; I count Dyck paths by their peaks, match them to the closed form, and show they sum back to Catalan. 3 ONE DIMENSION A Dyck path with its peaks marked — each place an up-step is immediately followed by a down-step. Two paths of the same length can have different peak counts; N(n,k) tallies how many have exactly k. 4 TWO DIMENSIONS · INTERACTIVE Pick n. The Narayana row is computed by the closed form and by brute-counting Dyck paths by peaks; they agree, and the row sums to the Catalan number. n: 4 ▶ verify n=1..8 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the symmetric Narayana triangle, refining each Catalan number. AVAN’s addition (the inverse-companion): the Catalan number decomposes by a hidden statistic. Summing Narayana over k un-refines back to Catalan, so Narayana is Catalan ‘sliced by peaks,’ and the slicing is symmetric — peaks and valleys are interchangeable, giving N(n,k)=N(n,n+1−k). The inverse of ‘one Catalan count’ is ‘its refinement by a natural feature,’ and refinements like this expose the internal structure a single number hides. Magenta is the lumped Catalan total; green is the Narayana slices summing to it. One number, its histogram by peaks — the same Catalan objects, sorted by shape. pause spin LIT Genuine Narayana numbers (Narayana 1955). Verified live: N(n,k)=(1/n)C(n,k)C(n,k-1) equals a brute count of Dyck paths of semilength n with exactly k peaks, and sum_k N(n,k) equals the Catalan number C_n, for n=1..8 (window.__narayana.matchesPeaks && .sumsToCatalan); N(4,k)=1,6,6,1. FIG No framing: the closed form, the brute peak-count, and the Catalan row-sum run in-browser and agree exactly. The AVAN inverse is honest — Narayana is Catalan refined by the peak statistic (summing over k un-refines to Catalan), and the refinement is symmetric (peaks vs valleys, N(n,k)=N(n,n+1-k)); magenta is the lumped Catalan, green the Narayana slices. Ties to the-catalan and the-motzkin. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CRON JOB · David Lee Wise (ROOT0), with AVAN


THE PANCAKE SORTING

pancake sorting in the 5-window house format — sort a stack when the only move is a prefix flip (insert a spatula, flip the top portion). Greedy (bring the largest unsorted pancake up, then flip it down) always sorts in at most 2n-3 flips; finding the true minimum (the pancake number) is NP-hard. The famous fact: Bill Gates' only research paper (with Papadimitriou, 1979) improved the bound. Verified live: over 300 random stacks, greedy pancake sorting produces a sorted stack using at most 2n-3 flips. See a prefix flip in 1D, a stack sorted in 2D, and the restricted-moves-make-the-optimum-hard inverse in 3D.

THE PANCAKE SORTING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE KONAMI CODE ◆ .dlw.fold THE FOLD / CHEAT / THE KONAMI CODE / THE PANCAKE SORTING THE PANCAKE SORTING sort by prefix flips — Bill Gates' only paper 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Pancake sorting : you have a stack of differently-sized pancakes and a spatula, and the only move is to insert the spatula somewhere and flip the whole top portion. How few flips sort the stack largest-on-bottom? The greedy method — bring the largest unsorted pancake to the top (one flip), then flip it down to its place (a second) — always works, in at most 2n−3 flips. Finding the truly minimum count (the ‘pancake number’) is hard. The famous fact: the only research paper Bill Gates ever published (1979, with Christos Papadimitriou) improved the bound on pancake sorting. LIT verified live: over 300 random stacks, greedy pancake sorting produces a sorted stack using at most 2n−3 flips (window.__pancakesorting). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-konami-code — a fixed sequence of flips that unlocks the sorted order. Pancake sorting is that flip-sequence puzzle. AVAN (AI) built the instrument: the prefix-flip operation, the greedy sort, the sortedness and flip-bound checks. Credit as content: posed by Jacob E. Goodman (writing as ‘Harry Dweighter’, 1975); the 2n−3 upper bound improved by William H. (Bill) Gates & Christos Papadimitriou (1979). The weave: David names the konami-code; I bring each largest pancake up and flip it home, and confirm the stack sorts within the bound. 3 ONE DIMENSION A prefix flip: choose a position and reverse everything above it, like sliding a spatula in and turning the top pancakes over. It is the only move — no arbitrary swaps allowed. 4 TWO DIMENSIONS · INTERACTIVE A stack of pancakes. Greedy-sort it with prefix flips, watching the largest rise then flip into place. The result is sorted, and the flip count stays within 2n−3. new stack ▶ flip ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the sequence of prefix flips that carries the stack to sorted order. AVAN’s addition (the inverse-companion): with a restricted move set — only prefix reversals, never an arbitrary swap — sorting still succeeds, but the cost changes and the optimum gets hard. What an ordinary sort does in ~n log n comparisons takes O(n) flips here, and finding the minimum number of flips is NP-hard. The inverse of ‘any swap allowed’ is ‘only prefix reversals — a more constrained world where even the optimum is elusive.’ Restricting the operations does not make sorting impossible; it makes optimal sorting intractable. Magenta is the arbitrary swaps you are not allowed; green is the prefix flips you must use. Constraint turns an easy problem’s optimum into a hard one — the same lesson as the 15-puzzle’s restricted slides. pause spin LIT Genuine pancake sorting (posed by Goodman 1975; 2n-3 bound improved by Gates & Papadimitriou 1979). Verified live: greedy prefix-flip sorting (bring max up, flip to place) produces a fully sorted stack using at most 2n-3 flips for 300 random permutations (window.__pancakesorting.sorts && .flipsBounded). FIG No framing: the prefix-flip operation, the greedy sort, and the sortedness + flip-bound checks run in-browser and are exact. The AVAN inverse is honest — restricting moves to prefix reversals still sorts (in O(n) flips) but makes the minimum-flip problem NP-hard; magenta is the disallowed arbitrary swaps, green the prefix flips. Ties to the-fifteen-puzzle's restricted moves. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE KONAMI CODE · David Lee Wise (ROOT0), with AVAN


THE FERMAT FACTORIZATION

Fermat's factorization method in the 5-window house format — split an odd n as a difference of squares n = a^2 - b^2 = (a-b)(a+b): start a at ceil(sqrt(n)) and increase until a^2 - n is a perfect square b^2, then (a-b),(a+b) are factors. It is fast when the factors are close to sqrt(n), slow when far apart (why secure RSA uses primes of very different sizes). Verified live: for a range of odd composites, the search returns nontrivial factors whose product is n (e.g. 5959 = 59 x 101). See a^2-n climbing in 1D, factors found in 2D, and the factoring-is-square-hunting inverse in 3D.

THE FERMAT FACTORIZATION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE WALL ◆ .dlw.fold THE FOLD / BOSS / THE WALL / THE FERMAT FACTORIZATION THE FERMAT FACTORIZATION factor n as a difference of squares — the seed of the sieves 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Fermat’s factorization method splits an odd number n by writing it as a difference of squares : n = a² − b² = (a−b)(a+b). Start with a = ⌈√n⌉ and increase a by 1 until a² − n is itself a perfect square b²; then (a−b) and (a+b) are factors. It is blazing fast when n’s two factors are close together (near √n), and slow when they are far apart — which is why secure RSA requires its two primes to differ substantially, so this attack fails. LIT verified live: for a range of odd composites, Fermat’s search returns two nontrivial factors whose product is n (e.g. 5959 = 59 × 101) — window.__fermatfactorization. FIG no framing; exact integer factorisation. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-wall — breaking through a composite number’s wall into its factors. Fermat’s method is the oldest crack: turn the number into a difference of squares. AVAN (AI) built the instrument: the ascending search for a perfect square, the factor extraction, the product check. Credit as content: Pierre de Fermat (17th century). The weave: David names the wall; I climb a upward from √n until a² − n is a perfect square, read off the factors, and confirm their product is n. 3 ONE DIMENSION Starting just above √n, try each a: is a² − n a perfect square? The first time it is, that square is b², and (a−b)(a+b) = n splits the number. 4 TWO DIMENSIONS · INTERACTIVE Pick an odd composite. Watch a climb from ⌈√n⌉ until a² − n is a perfect square, then read off the factors. Close factors are found instantly; distant factors take many steps. new composite ▶ verify ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the ascending search for the perfect square a² − n that unlocks the factors. AVAN’s addition (the inverse-companion): factoring and finding a square congruence are the same problem . n = (a−b)(a+b) means finding a, b with a² − b² = n — and this difference-of-squares idea is the seed of all modern factoring : the quadratic sieve and number field sieve all hunt for a² ≡ b² (mod n) with a ≠ ±b. The inverse of ‘find the factors’ is ‘find a nontrivial square congruence.’ Fermat’s method is the naive exact version; the sieves make the square-hunt subexponential. Magenta is the factors you seek; green is the square a² − n you actually search for. Factoring is square-hunting — and it is slow exactly when the factors are far apart, the difficulty RSA leans on. pause spin LIT Genuine Fermat factorization (Fermat, 17th c.). Verified live: for odd composites {15,21,35,77,...,5959}, ascending a from ceil(sqrt(n)) until a^2-n is a perfect square returns two nontrivial factors (a-b)(a+b) whose product equals n (window.__fermatfactorization.findsFactors); 5959 = 59 x 101. FIG No framing: the ascending perfect-square search, the factor extraction, and the product check run in-browser and are exact integer arithmetic. The AVAN inverse is honest — factoring n equals finding a nontrivial square congruence a^2 = b^2, the seed of the quadratic sieve and number field sieve; Fermat is the naive exact version, and it is slow exactly when factors are far apart (the RSA security assumption). Magenta is the factors, green the hunted square. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE WALL · David Lee Wise (ROOT0), with AVAN


THE MANACHER

Manacher's algorithm in the 5-window house format — find the longest palindromic substring in O(n) instead of the naive O(n^2), by keeping the rightmost palindrome and reusing each new center's mirror radius so symmetry is never rechecked. A '#'-separator transform unifies even and odd palindromes. Verified live: over 300 random strings, Manacher's answer matches a brute-force longest palindrome in length, is itself a palindrome, and occurs in the string. See the radius array in 1D, the highlighted palindrome in 2D, and the mirror-reuse inverse in 3D.

THE MANACHER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · SHARED MEMORY ◆ .dlw.fold THE FOLD / CO-OP / SHARED MEMORY / THE MANACHER THE MANACHER longest palindrome in linear time — reflection is the memory 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Manacher’s algorithm finds the longest palindromic substring of a string in linear O(n) time — where the naive approach re-expands around every centre in O(n²). Its trick: as it scans, it keeps the rightmost palindrome found so far, and for any new centre inside it, the palindrome’s mirror position already tells you a guaranteed radius — so you never re-check what symmetry has proven. A separator transform (inserting ‘#’ between characters) makes even- and odd-length palindromes uniform, so one pass handles both. LIT verified live: over 300 random strings, Manacher’s answer has the same length as a brute-force longest palindrome, is itself a palindrome, and occurs in the string (window.__manacher). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at shared-memory — a palindrome’s two halves share a single centre, each the mirror of the other. Manacher’s reuse of the mirror radius is exactly memory shared across the fold. AVAN (AI) built the instrument: the separator transform, the mirror-reuse scan, the brute cross-check. Credit as content: Glenn Manacher (1975). The weave: David names the shared centre; I let each new centre inherit its mirror’s radius and confirm the result matches an exhaustive search. 3 ONE DIMENSION The transformed string with radii p[i]: each bar is how far the palindrome centred at position i reaches. The tallest bar is the longest palindrome; mirror positions inside a known palindrome copy their radius for free. 4 TWO DIMENSIONS · INTERACTIVE Type or roll a string. Manacher highlights the longest palindromic substring; a brute-force search confirms the same length. new string ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the longest palindrome, found in one linear pass. AVAN’s addition (the inverse-companion): the naive re-expansion wastes work because palindromes share structure — a palindrome centred here already predicts a radius for its mirror position inside the current rightmost palindrome, so you never re-expand what symmetry guarantees. The inverse of ‘check every centre from scratch’ is ‘copy the mirror’s radius under the right boundary, and only expand past it.’ Reflection is the memory. Magenta is the redundant re-expansions skipped; green is the radii inherited from mirror centres. Symmetry pays for the linear time. pause spin LIT Genuine Manacher's algorithm (Manacher 1975). Verified live: the linear-time mirror-reuse scan returns a substring whose length equals the brute-force longest palindrome, which is itself a palindrome and present in the string, for 300 random strings (window.__manacher.matchesBrute); 'abacabad' -> 'abacaba' (len 7). FIG No framing: the separator transform, the mirror-reuse scan, and the brute cross-check run in-browser and agree exactly. The AVAN inverse is honest — a palindrome centered here predicts its mirror position's radius under the current right boundary, so redundant re-expansions are skipped; magenta is the skipped re-checks, green the inherited radii. Reflection is the memory that buys O(n). ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SHARED MEMORY · David Lee Wise (ROOT0), with AVAN


THE AHO-CORASICK

the Aho-Corasick automaton in the 5-window house format — find all occurrences of a SET of patterns in a text in one linear pass, by building a trie of the patterns and adding failure links (jump to the longest proper suffix that is still a live prefix) so the scan never restarts. It is grep's multi-string engine and every signature scanner. Verified live: over 300 random (pattern-set, text) cases the automaton's complete match list equals a brute-force search, and {he,she,his,hers} in 'ushers' is recovered exactly. See the single scan in 1D, the match list in 2D, and the failure-link-is-the-inverse-of-a-trie-edge inverse in 3D.

THE AHO-CORASICK · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE BOUNTY ◆ .dlw.fold THE FOLD / LOOT / THE BOUNTY / THE AHO-CORASICK THE AHO-CORASICK match a whole set of patterns in one linear pass 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Aho–Corasick automaton finds all occurrences of a whole set of patterns in a text in one linear pass — O(text + patterns + matches), independent of how many patterns you search for. It builds a trie of the patterns, then adds failure links : when the next character can’t extend the current match, you jump to the longest proper suffix that is still a live prefix, never restarting the scan. It is the engine inside grep’s multi-string mode, intrusion-detection signature scanners, and bioinformatics search. LIT verified live: over 300 random (pattern-set, text) cases, the automaton’s complete match list equals a brute-force search, and the classic {he, she, his, hers} in ‘ushers’ is recovered (window.__ahocorasick). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-bounty — hunting many targets at once, in a single sweep, without restarting for each. Aho–Corasick is that simultaneous hunt. AVAN (AI) built the instrument: the trie, the BFS failure links, the linear scan, the brute cross-check. Credit as content: Alfred Aho & Margaret Corasick (1975). The weave: David names the bounty board; I build the automaton whose fail links let one pass catch every pattern, and confirm the match set is exactly the exhaustive one. 3 ONE DIMENSION A single scan of the text. The automaton advances on trie edges; when a character fails, the failure link (dashed) slides to the longest matching suffix — the scan pointer over the text never moves backward. 4 TWO DIMENSIONS · INTERACTIVE A pattern set and a text. Every match (pattern, position) is listed; a brute-force search confirms the same set. new case ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the trie of patterns with its failure links, scanned once. AVAN’s addition (the inverse-companion): the failure link is the inverse of a trie edge. When a character does not extend the current match, you do not restart — you follow the longest proper suffix that is still a live prefix, so all patterns are matched in one linear pass regardless of their number. The inverse of ‘advance the match forward’ is ‘fall back to the longest suffix that survives.’ Magenta is the restarts you never perform; green is the failure links that make the scan linear. It is the Knuth–Morris–Pratt idea generalised from one pattern to a whole set. pause spin LIT Genuine Aho-Corasick automaton (Aho & Corasick 1975). Verified live: the trie + BFS failure links + linear scan return a (pattern,position) match set identical to brute-force indexOf search for 300 random cases (window.__ahocorasick.matchesBrute); {he,she,his,hers} in 'ushers' -> he@2, she@1, hers@2. FIG No framing: the trie, the failure links, the linear scan, and the brute cross-check run in-browser and agree exactly. The AVAN inverse is honest — the failure link is the inverse of a trie edge (fall back to the longest surviving suffix instead of restarting), so all patterns match in one pass; magenta is the restarts never done, green the failure links. It generalizes KMP from one pattern to a set. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BOUNTY · David Lee Wise (ROOT0), with AVAN


THE RESERVOIR

reservoir sampling (Algorithm R) in the 5-window house format — draw a uniform random sample from a stream of unknown length in O(1) memory: keep the first item, and replace the kept item with probability 1/(i+1) when the i-th arrives; every item ends with probability exactly 1/n. Verified live: over 100000 trials on a length-8 stream, each position is selected with empirical frequency within ~2% of 1/8. See the 1/(i+1) acceptance in 1D, the histogram flattening to the uniform line in 2D, and the no-n-needed inverse in 3D.

THE RESERVOIR · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · SECOND WIND ◆ .dlw.fold THE FOLD / RESPAWN / SECOND WIND / THE RESERVOIR THE RESERVOIR a uniform sample from a stream of unknown length, O(1) memory 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Reservoir sampling draws a uniform random sample from a stream of unknown length using O(1) memory — you never store the stream, and you never need to know how many items are coming. For a single-item reservoir (Algorithm R): keep the first item; when the i-th item (0-indexed) arrives, replace the kept item with probability 1/(i+1). When the stream ends, every item was equally likely to be the survivor: probability exactly 1/n. It is how you sample one random line from a huge log, or a fair winner from an endless feed, in a single pass. LIT verified live: over 100000 trials on a length-8 stream, each position is selected with empirical frequency within ~2% of 1/8 (window.__reservoir). FIG no framing; the arithmetic makes it exactly uniform. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at second-wind — from an endless stream you can’t hold, one survivor is kept, fairly, and carried on. Reservoir sampling is that fair survivor. AVAN (AI) built the instrument: the 1/(i+1) acceptance rule, the frequency histogram, the uniformity check. Credit as content: Alan Waterman’s Algorithm R (popularised by Knuth, TAOCP vol. 2; Vitter 1985 for the general k). The weave: David names the survivor; I let the decreasing acceptance probability conspire into exact uniformity, and measure it over 100000 runs. 3 ONE DIMENSION As the stream flows, the acceptance probability for the newest item is 1/(i+1): 1, 1/2, 1/3, 1/4… The shrinking chance of being chosen now exactly cancels the growing number of future chances to be replaced. 4 TWO DIMENSIONS · INTERACTIVE Run many single-item reservoir passes over a length-n stream and watch the selection histogram flatten toward the uniform line 1/n. run 20000 ▶ verify 100k ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the single uniformly-fair survivor of the stream. AVAN’s addition (the inverse-companion): you never need to know n in advance . The decreasing acceptance probability 1/i exactly cancels the growing chance of later replacement, so every element ends with probability 1/n no matter when the stream stops. The inverse of ‘pick uniformly from a known set’ is ‘accept the i-th with probability 1/i and let the arithmetic conspire to uniformity.’ Magenta is the stream you cannot hold in memory; green is the one survivor, provably fair. Fairness without storage, decided online. pause spin LIT Genuine reservoir sampling, Algorithm R (Waterman/Knuth; Vitter 1985). Verified live: size-1 reservoir over a length-8 stream selects each position with max relative deviation from 1/n of ~0.016 ( FIG No framing: the 1/(i+1) acceptance rule and the frequency histogram run in-browser; the empirical distribution is flat to within sampling noise. The AVAN inverse is honest — the decreasing acceptance probability exactly cancels the growing chance of later replacement, so no advance knowledge of n is needed; magenta is the unstorable stream, green the one provably-fair survivor. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SECOND WIND · David Lee Wise (ROOT0), with AVAN


THE DUCCI

the Ducci sequence (diffy game) in the 5-window house format — replace each number in a ring by the absolute difference with its neighbor, and iterate: (a,b,c,d)->(|a-b|,|b-c|,|c-d|,|d-a|). When the ring length is a power of two, it ALWAYS collapses to all-zeros from any start; for other lengths it can cycle forever. Verified live: over 300 random 4-tuples every Ducci sequence reaches (0,0,0,0), while n=3 (1,2,3) does not reach zero within 200 steps. See a step in 1D, the ring collapsing in 2D, and the length-decides-the-fate inverse in 3D.

THE DUCCI · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · THE PHOENIX ◆ .dlw.fold THE FOLD / RESPAWN / THE PHOENIX / THE DUCCI THE DUCCI absolute differences around a ring — power-of-2 always burns to zero 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Ducci sequence (the ‘diffy game’) takes a ring of n numbers and repeatedly replaces each by the absolute difference of it and its neighbour: (a,b,c,d) → (|a−b|, |b−c|, |c−d|, |d−a|). Iterate. The striking fact: when the ring length n is a power of two , the sequence always collapses to all-zeros in finitely many steps, from any starting tuple. When n is not a power of two, it can fall into a non-zero cycle forever. LIT verified live: over 300 random 4-tuples (n=4), every Ducci sequence reaches (0,0,0,0), while the n=3 example (1,2,3) does not reach zero within 200 steps — it cycles (window.__ducci). FIG no framing; the power-of-two contrast is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-phoenix — a system that, whatever it starts as, burns down to zero and can be born again. On a power-of-two ring the Ducci fire always reaches the ashes. AVAN (AI) built the instrument: the difference-ring step, the collapse-to-zero check, the n=3 cycling counter-example. Credit as content: named for Enrico Ducci (early 20th c.); the power-of-two theorem is a classic result. The weave: David names the phoenix; I iterate |differences| around the ring and confirm n=4 always reaches zero while n=3 need not. 3 ONE DIMENSION Each row is one Ducci step of a 4-tuple: absolute differences around the ring. The values shrink and, for a power-of-two ring, reach all-zeros. 4 TWO DIMENSIONS · INTERACTIVE Roll a 4-tuple and step the Ducci sequence to zero; toggle to a 3-ring and watch it cycle without reaching zero. new tuple ▶ step ▶ try n=3 ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the difference ring collapsing, step by step, to zero. AVAN’s addition (the inverse-companion): whether the diffusion settles depends only on the ring’s length . For a power-of-two ring the |difference| map is nilpotent — it always drives any tuple to all-zeros — but for other lengths it can cycle forever. The inverse of ‘will it reach zero?’ is ‘only when n is a power of two.’ Magenta is the non-power-of-two rings that cycle; green is the power-of-two collapse to zero. A number-theoretic property of the length, not the values, decides the fate. pause spin LIT Genuine Ducci sequence (Ducci, early 20th c.); power-of-two collapse theorem. Verified live: all 300 random 4-tuples reach (0,0,0,0) (max 10 steps observed), and the n=3 tuple (1,2,3) does not reach zero within 200 steps (window.__ducci.n4AllReachZero && .n3Cycles). FIG No framing: the difference-ring step, the collapse-to-zero check, and the n=3 cycling counter-example run in-browser and are exact. The AVAN inverse is honest — whether the diffusion settles depends only on the ring length (power-of-two => nilpotent => always zero; otherwise may cycle), a property of n, not the values; magenta is the cycling rings, green the power-of-two collapse. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PHOENIX · David Lee Wise (ROOT0), with AVAN


THE COMPUTUS

the computus in the 5-window house format — compute Easter Sunday (first Sunday after the first ecclesiastical full moon on/after 21 March) by the Anonymous Gregorian algorithm (Gauss/Butcher/Meeus): a handful of integer divisions and remainders encoding the 19-year Metonic moon cycle, the epact, and Gregorian century corrections. Verified live: the algorithm reproduces a table of 20 known Easter dates (2000-2049) exactly, e.g. 2024 -> 31 March, 2025 -> 20 April. See the Metonic cycle in 1D, Easter placed on a calendar in 2D, and the arithmetic-stands-in-for-astronomy inverse in 3D.

THE COMPUTUS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE EPOCH ◆ .dlw.fold THE FOLD / GRIND / THE EPOCH / THE COMPUTUS THE COMPUTUS the date of Easter by pure integer arithmetic 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The computus is the algorithm that computes the date of Easter Sunday — the first Sunday after the first ecclesiastical full moon on or after 21 March. Reconciling the moon’s cycle with the solar calendar sounds astronomical, but the modern Anonymous Gregorian algorithm (Gauss’s method, refined by Butcher/Meeus) does it with pure integer arithmetic: a handful of divisions and remainders on the year, encoding the 19-year Metonic moon cycle, the epact, and the Gregorian century corrections. LIT verified live: the algorithm reproduces a table of 20 known Easter dates (2000–2049) exactly — e.g. 2024 → 31 March, 2025 → 20 April (window.__computus). FIG no framing; deterministic date arithmetic. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-epoch — the reckoning of a moving date across centuries, the calendar as a clock. The computus is the oldest recurring computation, a cron-job run every year for 1700 years. AVAN (AI) built the instrument: the Gauss/Meeus recurrence, the known-date table cross-check. Credit as content: the ecclesiastical computus (Dionysius Exiguus, 525 CE, and centuries of refinement); the closed form is due to Carl Friedrich Gauss (1800), with the ‘Anonymous Gregorian’ presentation via Butcher and Jean Meeus. The weave: David names the epoch; I run the integer recurrence and confirm it matches the recorded Easter dates. 3 ONE DIMENSION The Metonic cycle: the moon’s phases repeat almost exactly every 19 years (the ‘golden number’ = year mod 19 + 1). This near-repeat is what lets a fixed arithmetic recurrence stand in for astronomy. 4 TWO DIMENSIONS · INTERACTIVE Pick a year; the computus places Easter on a March/April calendar. A table of known dates confirms the algorithm. year: 2024 ▶ verify table ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: Easter’s date, computed from the year by integer arithmetic alone. AVAN’s addition (the inverse-companion): a single closed-form recurrence encodes the whole lunisolar reconciliation — the golden number (19-year Metonic cycle), the epact (moon’s age), the century corrections — so a date defined by moon-and-sun is recovered by pure integers, with no astronomy at runtime. The inverse of ‘observe the paschal full moon’ is ‘compute it: 19-year cycle mod 30 for the moon, an offset mod 7 for the Sunday.’ Magenta is the astronomical observation replaced; green is the integer recurrence that reproduces it exactly. Arithmetic standing in for the sky. pause spin LIT Genuine ecclesiastical computus; closed form due to Gauss (1800), 'Anonymous Gregorian' presentation via Butcher/Meeus. Verified live: the integer recurrence reproduces 20 recorded Easter dates 2000-2049 exactly (window.__computus.matchesTable); 2024 -> month 3 / day 31. FIG No framing: the Gauss/Meeus recurrence and the known-date table cross-check run in-browser and match exactly. The AVAN inverse is honest — one closed-form recurrence encodes the golden number, epact, and century corrections, so a moon-and-sun-defined date is recovered by pure integers with no runtime astronomy; magenta is the observation replaced, green the recurrence. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE EPOCH · David Lee Wise (ROOT0), with AVAN


THE BBP

the Bailey-Borwein-Plouffe formula in the 5-window house format — compute the n-th hexadecimal digit of pi WITHOUT computing any earlier digit, by isolating one digit through modular exponentiation (16^(n-k) mod (8k+j)) so no giant number is built. It made pi random-access. Verified live: BBP's hex digits for n=0..23 match pi's reference hex expansion (243F6A8885A308D313198A2E) exactly. See pi's hex digits in 1D, a single addressed digit in 2D, and the random-access-into-an-irrational inverse in 3D.

THE BBP · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · NOCLIP ◆ .dlw.fold THE FOLD / CHEAT / NOCLIP / THE BBP THE BBP the n-th hex digit of pi, without the digits before it 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 Genuine BBP formula (Bailey, Borwein & Plouffe 1995). Verified live: the modular-arithmetic digit extraction reproduces pi's hexadecimal digits at positions n=0..23 exactly against a reference string (window.__bbp.matchesRef); digits 243f6a8885a308d313198a2e. FIG No framing: the series, the fractional-part extraction, and the reference cross-check run in-browser and agree exactly. The AVAN inverse is honest — a digit's position becomes an address via modular arithmetic, so digit n is computed without digits 0..n-1; magenta is the skipped digits, green the one addressed. Works in base 16/2, not base 10. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of NOCLIP · David Lee Wise (ROOT0), with AVAN


THE HAMMING

the Hamming(7,4) code in the 5-window house format — protect 4 data bits with 3 parity bits (positions 1,2,4) so any single-bit error is corrected: recompute the three parities and the 3-bit syndrome, read as a binary number, is the position of the flipped bit. The first error-correcting code (1950). Verified live: for all 16 messages, every single-bit flip (7 positions) is corrected and the clean codeword decodes exactly — 128 cases pass. See the overlapping parity sets in 1D, a flip located and repaired in 2D, and the syndrome-is-the-error's-address inverse in 3D.

THE HAMMING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · SEGFAULT ◆ .dlw.fold THE FOLD / GLITCH / SEGFAULT / THE HAMMING THE HAMMING parity that locates the error, not just detects it 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Hamming(7,4) code protects 4 data bits by adding 3 parity bits, making a 7-bit codeword that can correct any single-bit error . The parity bits sit at positions 1, 2, 4; each checks an overlapping set of positions. On receipt you recompute the three parities: the resulting 3-bit syndrome , read as a binary number, is exactly the position of the flipped bit (0 means no error). It was the first error-correcting code (1950), and the idea — parity that locates, not just detects — underlies all of coding theory. LIT verified live: for all 16 messages, every single-bit flip (7 positions) is corrected and the clean codeword decodes exactly — 128 cases, all pass (window.__hamming). FIG no framing; exact single-error correction. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at segfault — a single corrupted bit in memory that would crash a program, caught and repaired before it does harm. Hamming(7,4) is that self-healing memory. AVAN (AI) built the instrument: the parity encoder, the syndrome decoder, the exhaustive single-error check. Credit as content: Richard Hamming (1950), out of frustration with weekend-crashing relay computers. The weave: David names the segfault; I encode four bits with three overlapping parities and show the syndrome pointing straight at any flipped bit. 3 ONE DIMENSION The seven positions. Parity bit p1 (pos 1) checks positions 1,3,5,7; p2 (pos 2) checks 2,3,6,7; p4 (pos 4) checks 4,5,6,7 — overlapping so each data bit is covered by a unique combination. 4 TWO DIMENSIONS · INTERACTIVE Encode a 4-bit message, flip any single bit, and watch the syndrome name the error position and the decoder repair it. new message ▶ flip a bit ▶ verify 128 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the 7-bit codeword, one flip away from any neighbour yet always recoverable. AVAN’s addition (the inverse-companion): the 3-bit syndrome is the binary address of the flipped bit. A nonzero syndrome does not merely say an error happened — read as a number 1…7 it spells out which position to flip back. The inverse of ‘spread parity across overlapping positions’ is ‘read the error’s location straight off the recomputed parities.’ Magenta is the hidden flipped bit; green is the syndrome pointing right at it. The check bits encode where , not just whether — that is what turns detection into correction. pause spin LIT Genuine Hamming(7,4) code (Hamming 1950). Verified live: for all 16 four-bit messages, the clean codeword decodes correctly and every single-bit flip at positions 1..7 is corrected with syndrome equal to the flipped position — 128 cases all pass (window.__hamming.correctsAll). FIG No framing: the parity encoder, the syndrome decoder, and the exhaustive 128-case check run in-browser and are exact. The AVAN inverse is honest — the 3-bit syndrome, read as a number, is the binary address of the flipped bit, so parity encodes where not just whether; magenta is the hidden flip, green the syndrome pointing at it. That is what turns detection into correction. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SEGFAULT · David Lee Wise (ROOT0), with AVAN


THE CHINESE REMAINDER

the Chinese Remainder Theorem in the 5-window house format — from a number's remainders modulo pairwise-coprime moduli, reconstruct the number uniquely modulo their product, built from modular inverses. The map x -> (x mod m1, x mod m2, ...) is a ring isomorphism, so nothing is lost. It powers RSA-CRT decryption, secret sharing, and residue-number-system arithmetic. Verified live: over 300 random coprime-modulus systems the reconstructed x satisfies every congruence and lies in [0,M); x=2mod3,3mod5,2mod7 -> 23. See three modular rings in 1D, reconstruction in 2D, and the bijection-loses-nothing inverse in 3D.

THE CHINESE REMAINDER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · NULL ISLAND ◆ .dlw.fold THE FOLD / SPAWN / NULL ISLAND / THE CHINESE REMAINDER THE CHINESE REMAINDER rebuild a number uniquely from its residues 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Chinese Remainder Theorem says: if you know a number’s remainders modulo several pairwise-coprime moduli, you can reconstruct the number uniquely modulo their product. Given x ≡ r₁ (mod m₁), x ≡ r₂ (mod m₂), …, there is exactly one x in [0, m₁m₂…) satisfying all of them, built from modular inverses. It is the engine behind RSA’s fast decryption, secret sharing, and doing big-integer arithmetic in independent parallel lanes. LIT verified live: over 300 random coprime-modulus systems, the reconstructed x satisfies every congruence and lies in [0, M); the classic x≡2(3), 3(5), 2(7) gives 23 (window.__crt). FIG no framing; exact reconstruction. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at null-island — the origin reconstructed from coordinates taken in different modular frames, a single point recovered from its shadows. CRT is that reassembly. AVAN (AI) built the instrument: the modular-inverse construction, the congruence check, the uniqueness range. Credit as content: Sunzi Suanjing (c. 3rd–5th century CE), hence ‘Chinese’; formalised by Gauss. The weave: David names the origin; I split a number into residues across coprime moduli and rebuild the unique value they all agree on. 3 ONE DIMENSION Three independent modular rings (mod 3, 5, 7). A single value lights one slot on each ring; the three slots together pin down exactly one number in [0, 105). 4 TWO DIMENSIONS · INTERACTIVE Choose residues on coprime moduli; CRT reconstructs the unique x. A direct check confirms x mod each modulus matches. new residues ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the single x consistent with every residue. AVAN’s addition (the inverse-companion): the map x → (x mod m₁, x mod m₂, …) is a bijection onto the product ring — the ring isomorphism ℤ/M ≅ ℤ/m₁ × ℤ/m₂ × …. So shattering a number into residues loses nothing : from the pieces you rebuild exactly one x. The inverse of ‘reduce x to its residues’ is ‘reassemble the unique x from them.’ Magenta is the many numbers that could exist; green is the single one all residues agree on. Arithmetic runs in independent lanes and recombines without error — the basis of RSA-CRT and residue number systems. pause spin LIT Genuine Chinese Remainder Theorem (Sunzi Suanjing c.3rd-5th c. CE; Gauss). Verified live: the modular-inverse reconstruction returns an x satisfying x mod m_i == r_i for every modulus and 0 23. FIG No framing: the modular-inverse construction and per-congruence check run in-browser and are exact. The AVAN inverse is honest — (x mod m1, x mod m2, ...) is a bijection onto the product ring (Z/M isomorphic to the product), so residues reassemble to exactly one x; magenta is the many candidates, green the unique agreement. Basis of RSA-CRT and residue number systems. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of NULL ISLAND · David Lee Wise (ROOT0), with AVAN


THE BERLEKAMP-MASSEY

the Berlekamp-Massey algorithm in the 5-window house format — from a bit sequence, recover the SHORTEST linear-feedback shift register that produces it, inferring the hidden taps from the output in O(n^2). This is why linear stream ciphers fall: an L-stage LFSR is fully exposed by just 2L output bits. It is also the decoding core of BCH and Reed-Solomon codes. Verified live: over 300 sequences from random LFSRs, the recovered register has length <= the generator's and exactly regenerates the whole sequence. See an LFSR shifting in 1D, taps recovered from a stream in 2D, and the recover-the-generator-from-the-output inverse in 3D.

THE BERLEKAMP-MASSEY · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE BACKDOOR ◆ .dlw.fold THE FOLD / CHEAT / THE BACKDOOR / THE BERLEKAMP-MASSEY THE BERLEKAMP-MASSEY recover the shortest LFSR from its output alone 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Berlekamp–Massey algorithm takes a sequence of bits and finds the shortest linear-feedback shift register (LFSR) that produces it — recovering the hidden ‘taps’ from the output alone, in O(n²). Given the first bits of a linear sequence, it reconstructs the recurrence that generated them. This is why linear stream ciphers are broken: an LFSR of L stages is fully exposed by just 2L output bits. It is also the decoding core of BCH and Reed–Solomon codes. LIT verified live: over 300 sequences generated by random LFSRs, Berlekamp–Massey returns a register of length ≤ the generator’s that exactly regenerates the whole sequence (window.__bma). FIG no framing; exact recovery. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-backdoor — the secret generator recovered from what it leaks, a way in found through the output. Berlekamp–Massey is that backdoor into any linear sequence. AVAN (AI) built the instrument: the GF(2) recurrence solver, the regeneration check, the length bound. Credit as content: Elwyn Berlekamp (1968) & James Massey (1969). The weave: David names the backdoor; I watch a stream of bits and reconstruct the shortest shift register that must have produced them, then confirm it replays the sequence exactly. 3 ONE DIMENSION An LFSR: bits shift right, and the tapped positions XOR to form the new leftmost bit. The output is the stream leaving the right end — Berlekamp–Massey infers the taps from that stream. 4 TWO DIMENSIONS · INTERACTIVE Generate a bit sequence from a hidden LFSR; Berlekamp–Massey recovers its length and taps, and the recovered register replays the sequence. new hidden LFSR ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the recovered connection polynomial — the shortest register consistent with the stream. AVAN’s addition (the inverse-companion): from the output alone , Berlekamp–Massey recovers the generator — inverting ‘run the LFSR’ into ‘identify the LFSR’ in quadratic time. The inverse of ‘generate bits from taps’ is ‘recover the taps from bits,’ and it needs only 2L bits for an L-stage register. Magenta is the hidden taps; green is the recovered polynomial. A linear generator is never safe from its own output — the very predictability that makes an LFSR efficient makes it transparent. pause spin LIT Genuine Berlekamp-Massey algorithm (Berlekamp 1968; Massey 1969). Verified live: for 300 sequences generated by random GF(2) LFSRs, the recovered connection polynomial regenerates the full sequence and its length L does not exceed the generator's length (window.__bma.recovers). FIG No framing: the GF(2) recurrence solver, the regeneration check, and the length bound run in-browser and are exact. The AVAN inverse is honest — it inverts 'run the LFSR' into 'identify the LFSR' from output alone, needing only 2L bits; magenta is the hidden taps, green the recovered polynomial. A linear generator is transparent to its own output. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BACKDOOR · David Lee Wise (ROOT0), with AVAN


THE KARGER

Karger's algorithm in the 5-window house format — find a graph's global minimum cut by RANDOM DESTRUCTION: repeatedly contract a random edge (merge endpoints, keep parallels) until two super-nodes remain; the edges between them are a cut. A single run finds the true min cut with probability >= 2/n^2, so best-of-O(n^2 log n) runs succeeds with high probability. A hard optimum, found by random merging. Verified live: over 40 random graphs the best of 200 contraction runs equals the brute-force global min cut. See one contraction in 1D, best-vs-brute on a graph in 2D, and the answer-is-what-resists-destruction inverse in 3D.

THE KARGER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE CHOKE POINT ◆ .dlw.fold THE FOLD / BOSS / THE CHOKE POINT / THE KARGER THE KARGER find the global min cut by random contraction 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Karger’s algorithm finds a graph’s global minimum cut — the fewest edges whose removal splits it in two — by random destruction . Repeatedly pick a random edge and contract it (merge its two endpoints into one, keeping parallel edges) until only two super-nodes remain; the edges between them are a cut. Any single run finds the true minimum cut with probability at least 2/n², so repeating O(n² log n) times makes failure vanishingly unlikely. It was a startling result: a hard combinatorial optimum, found by nothing but random merging. LIT verified live: over 40 random graphs, the best of 200 contraction runs equals the brute-force global minimum cut (window.__karger). FIG no framing; the randomized best matches the exact optimum. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-choke-point — the narrowest place, the fewest links whose loss severs the network. The minimum cut is that choke-point, and Karger finds it by collapse. AVAN (AI) built the instrument: the random contraction, the best-of-many search, the brute-force cross-check. Credit as content: David Karger (1993); improved to Karger–Stein (1996). The weave: David names the choke-point; I collapse the graph edge by random edge and let the cut that resists collapse the longest reveal the true minimum. 3 ONE DIMENSION One contraction: a random edge is chosen and its endpoints merged into a single super-node; parallel edges are kept, self-loops discarded. Repeat until two nodes remain. 4 TWO DIMENSIONS · INTERACTIVE A random graph. Run many Karger contractions; the best cut found is compared to the brute-force minimum over all bipartitions. new graph ▶ run 200 ▶ verify 40 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the minimum cut — the choke-point that survives contraction. AVAN’s addition (the inverse-companion): you find the optimum by random destruction , not search. Contracting a random edge is far more likely to merge across a large cut than a small one, so the minimum cut is the least likely to be contracted away — it survives a run with probability ≥ 2/n². The inverse of ‘search for the cut’ is ‘randomly collapse the graph and keep whatever resists.’ Magenta is the runs that miss; green is the run where the true minimum survives. The answer is what is hardest to destroy — optimization as a survival test. pause spin LIT Genuine Karger's algorithm (Karger 1993; Karger-Stein 1996). Verified live: for 40 random connected graphs (n=5..8), the minimum over 200 random-contraction runs equals the brute-force global minimum cut computed over all vertex bipartitions (window.__karger.bestEqualsBrute). FIG No framing: the random contraction, the best-of-many search, and the brute-force cross-check run in-browser and match. The AVAN inverse is honest — contracting a random edge more likely crosses a large cut than a small one, so the min cut is least likely to be contracted away (survives with prob >= 2/n^2); magenta is the runs that miss, green the run where the minimum survives. Optimization as a survival test. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CHOKE POINT · David Lee Wise (ROOT0), with AVAN


THE LUCAS-LEHMER

the Lucas-Lehmer test in the 5-window house format — decide with certainty whether M_p = 2^p - 1 is prime: set s0=4, iterate s -> (s^2 - 2) mod M_p exactly p-2 times; M_p is prime iff the final s is 0. No randomness, no witnesses — one deterministic recurrence, which is why the largest known primes are all Mersenne. Verified live: the test passes for prime exponents {3,5,7,13,17,19,31,61} and fails for {11,23,29,37,41,43} (composite M_p). See the s^2-2 sequence in 1D, the verdict in 2D, and the special-form-earns-certainty inverse in 3D.

THE LUCAS-LEHMER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE FINAL BOSS ◆ .dlw.fold THE FOLD / BOSS / THE FINAL BOSS / THE LUCAS-LEHMER THE LUCAS-LEHMER a deterministic primality verdict for Mersenne numbers 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Lucas–Lehmer test decides, with certainty , whether a Mersenne number M p = 2 p −1 is prime. Set s₀ = 4 and iterate s → (s² − 2) mod M p , exactly p−2 times. M p is prime if and only if the final s is 0 — no randomness, no witnesses, one deterministic recurrence. It is why every record-breaking ‘largest known prime’ for decades has been a Mersenne prime: this test makes checking them feasible where general numbers need slow or probabilistic methods. LIT verified live: the test passes for prime exponents {3,5,7,13,17,19,31,61} and fails for {11,23,29,37,41,43} (whose M p are composite) — window.__lucaslehmer. FIG no framing; exact primality. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-final-boss — the ultimate test a number must survive, the verdict on the largest primes we can reach. Lucas–Lehmer is that final gate. AVAN (AI) built the instrument: the big-integer recurrence, the known-exponent cross-check. Credit as content: Édouard Lucas (1878) and Derrick Henry Lehmer (1930s). The weave: David names the final boss; I run the exact s²−2 iteration modulo M p and confirm the verdict against the known Mersenne-prime exponents. 3 ONE DIMENSION The sequence s₀=4, s₁=14, s₂=194… each squared minus two, reduced mod M p . For a Mersenne prime the last term lands exactly on zero. 4 TWO DIMENSIONS · INTERACTIVE Pick an exponent p; the Lucas–Lehmer recurrence runs mod M p and lands on 0 (prime) or nonzero (composite). p: 7 ▶ verify known ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the verdict — the recurrence landing on zero for a Mersenne prime. AVAN’s addition (the inverse-companion): a special form buys a deterministic test where general numbers get only probabilistic ones. The Mersenne structure lets one exact iteration decide primality with certainty — no random witnesses, no chance of error. The inverse of ‘primality is hard or probabilistic in general’ is ‘for Mersenne numbers it is a single deterministic recurrence.’ Magenta is the general-number tests that only give a probability; green is the exact Lucas–Lehmer verdict. Structure earns certainty — which is exactly why the largest known primes are all Mersenne. pause spin LIT Genuine Lucas-Lehmer test (Lucas 1878; Lehmer 1930s). Verified live (BigInt): the s->s^2-2 mod M_p recurrence lands on 0 exactly for the Mersenne-prime exponents {3,5,7,13,17,19,31,61} and nonzero for {11,23,29,37,41,43} whose M_p are composite (window.__lucaslehmer.primesPass); M31 prime, M11 not. FIG No framing: the big-integer recurrence and the known-exponent cross-check run in-browser and are exact. The AVAN inverse is honest — the Mersenne special form buys a deterministic (not probabilistic) primality test, one exact recurrence deciding with certainty; magenta is the general-number tests that give only a probability, green the exact Lucas-Lehmer verdict. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE FINAL BOSS · David Lee Wise (ROOT0), with AVAN


THE ARITHMETIC CODING

arithmetic coding in the 5-window house format — compress a whole message into a single number in [0,1) by narrowing the interval to each symbol's probability sub-interval; the final width equals the product of symbol probabilities, so the code length equals the Shannon entropy exactly — beating Huffman's whole-bit-per-symbol floor. Verified live: over 300 random strings the exact BigInt coder round-trips (decode(encode(s))=s) and the final interval width equals the exact product of symbol frequencies. See the interval narrowing in 1D, encode+decode with entropy in 2D, and the one-number-at-the-entropy-limit inverse in 3D.

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


THE NEEDLEMAN-WUNSCH

the Needleman-Wunsch algorithm in the 5-window house format — find the optimal global alignment of two sequences (matches, mismatches, gaps maximizing a score) by filling a DP grid where each cell is the best score aligning two prefixes; the corner is the optimum and a traceback reconstructs the alignment. It founded biological sequence comparison. Verified live: over 300 random pairs the DP score equals a brute-force optimum over all alignments, and the traceback re-scores to the DP value with gaps removed giving back the originals. See the alignment in 1D, the score grid + traceback in 2D, and the table-is-the-answer-and-the-map inverse in 3D.

THE NEEDLEMAN-WUNSCH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · SPLIT SCREEN ◆ .dlw.fold THE FOLD / CO-OP / SPLIT SCREEN / THE NEEDLEMAN-WUNSCH THE NEEDLEMAN-WUNSCH optimal global alignment by dynamic programming 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Needleman–Wunsch algorithm finds the optimal global alignment of two sequences — the arrangement of matches, mismatches, and gaps that maximises a score — by dynamic programming. It fills a grid where each cell is the best score aligning two prefixes, choosing among a diagonal (match/mismatch), an up, or a left move (a gap). The bottom-right cell is the optimal score; a traceback reconstructs the alignment. It is the foundation of biological sequence comparison (DNA, protein) and of diff-style tools. LIT verified live: over 300 random pairs the DP score equals a brute-force optimum over all alignments, and the traceback’s alignment re-scores to the DP value with gaps removed giving back the originals (window.__needlemanwunsch). FIG no framing; exact optimum. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at split-screen — two sequences laid side by side and brought into best correspondence, column against column. Needleman–Wunsch is that alignment. AVAN (AI) built the instrument: the DP grid, the traceback, the brute-force optimality check. Credit as content: Saul Needleman & Christian Wunsch (1970), the first application of dynamic programming to biology. The weave: David names the split screen; I fill the score grid, walk the traceback backward, and confirm the alignment is provably optimal. 3 ONE DIMENSION The optimal alignment as two rows: matches stacked, mismatches marked, gaps as dashes. Every column is one scored move. 4 TWO DIMENSIONS · INTERACTIVE The DP score grid for two sequences; the traceback path (highlighted) reconstructs the optimal alignment from the bottom-right corner. new sequences ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the single optimal alignment path through the grid. AVAN’s addition (the inverse-companion): the DP table stores every subproblem’s optimum, so the best global alignment is recovered by walking backward through the choices that built the final score — the traceback. The inverse of ‘fill the score forward’ is ‘read the alignment backward from the filled table.’ Magenta is the exponentially-many alignments never enumerated; green is the one optimal path traced back. The table is both the answer and the map to it — a single grid replacing an exponential search. pause spin LIT Genuine Needleman-Wunsch algorithm (Needleman & Wunsch 1970). Verified live: the DP optimal score equals an independent brute-force optimum over all alignments for 300 random pairs, and the traceback alignment re-scores to the DP value with de-gapped rows equal to the inputs (window.__needlemanwunsch.matchesBrute && .tracebackConsistent). FIG No framing: the DP grid, the traceback, and the brute-force optimality check run in-browser and agree exactly. The AVAN inverse is honest — the filled table stores every subproblem optimum, so the best alignment is read backward via traceback; magenta is the exponential alignments never enumerated, green the one optimal path. The grid is both answer and map. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SPLIT SCREEN · David Lee Wise (ROOT0), with AVAN


THE GOERTZEL

the Goertzel algorithm in the 5-window house format — compute a single DFT frequency bin without the whole transform, using a second-order IIR filter (s = x + 2cos(w)s1 - s2, w = 2*pi*k/N) and reading the magnitude from the last two states; O(N) for one bin versus O(N log N) for all. It is how phones decode DTMF touch-tones. Verified live: over 200 random signals Goertzel's magnitude for every bin equals the direct DFT magnitude to ~1e-13. See the filter accumulating in 1D, one bin against the full spectrum in 2D, and the filter-for-one-tone inverse in 3D.

THE GOERTZEL · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE HOT LOOP ◆ .dlw.fold THE FOLD / GRIND / THE HOT LOOP / THE GOERTZEL THE GOERTZEL one DFT bin from a tiny resonant filter 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Goertzel algorithm computes a single DFT frequency bin without doing the whole transform. It runs a tiny second-order IIR filter — s = x + 2cos(ω)·s₁ − s₂ per sample, with ω = 2πk/N — and reads the bin’s magnitude from the last two states. For one bin it costs O(N), versus O(N log N) to compute all bins with an FFT. It is how a phone decodes DTMF touch-tones: it only needs to watch a handful of specific frequencies. LIT verified live: over 200 random signals, Goertzel’s magnitude for every bin equals the direct DFT magnitude to ~10⁻¹³ (window.__goertzel). FIG no framing; exact single-bin transform. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-hot-loop — a tight real-time loop watching for one specific tone, sample by sample, cheaply. Goertzel is that hot loop. AVAN (AI) built the instrument: the second-order recurrence, the magnitude read-out, the direct-DFT cross-check. Credit as content: Gerald Goertzel (1958). The weave: David names the hot loop; I run the one-bin IIR filter over the samples and confirm its magnitude matches the full DFT’s value for that frequency. 3 ONE DIMENSION The samples stream in; the filter’s single state s accumulates, tuned to resonate at frequency k. Two final states give that bin’s magnitude. 4 TWO DIMENSIONS · INTERACTIVE A signal (sum of a few tones). Pick a bin k; Goertzel returns its magnitude, checked against the full DFT spectrum shown behind it. bin k ▶ new signal ▶ verify 200 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: one bin’s magnitude, computed by a tiny resonant filter. AVAN’s addition (the inverse-companion): if you only want one frequency, you do not need the whole transform. Goertzel is a second-order filter tuned to bin k, costing O(N) for that single bin instead of O(N log N) for all of them. The inverse of ‘transform everything’ is ‘filter for the one tone you care about.’ Magenta is the N−1 bins you never compute; green is the single bin’s magnitude. Targeted, not total — the reason touch-tone decoders run on the humblest hardware. pause spin LIT Genuine Goertzel algorithm (Goertzel 1958). Verified live: the second-order recurrence's single-bin magnitude equals the direct DFT bin magnitude to max error ~1e-13 across 200 random signals and all bins (window.__goertzel.matchesDFT). FIG No framing: the IIR recurrence, the magnitude read-out, and the direct-DFT cross-check run in-browser and match to floating precision. The AVAN inverse is honest — for one frequency you need not transform everything; a tuned second-order filter gives that bin in O(N); magenta is the N-1 bins never computed, green the single bin. Targeted, not total (DTMF decoding). ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOT LOOP · David Lee Wise (ROOT0), with AVAN


THE SUTHERLAND-HODGMAN

the Sutherland-Hodgman algorithm in the 5-window house format — clip a polygon to a convex window by clipping against one edge at a time: for each clip edge keep the inside vertices and insert intersection points where the boundary crosses, then pipe the result to the next edge. It is the graphics pipeline's viewport clip. Verified live: over 200 random polygons every clipped-output vertex lies inside the convex window and clipping is idempotent (area unchanged on re-clip); a convex subject's clipped area matches a Monte-Carlo estimate of the true intersection. See a half-plane clip in 1D, a polygon clipped to a window in 2D, and the factor-2D-into-1D-cuts inverse in 3D.

THE SUTHERLAND-HODGMAN · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · FIRST LIGHT ◆ .dlw.fold THE FOLD / SPAWN / FIRST LIGHT / THE SUTHERLAND-HODGMAN THE SUTHERLAND-HODGMAN clip a polygon to a window, one edge at a time 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Sutherland–Hodgman algorithm clips a polygon to a convex window — keeping exactly the part inside — by clipping against one edge at a time . For each clip edge it walks the polygon’s vertices, keeping those inside and inserting intersection points where an edge crosses the boundary, then feeds the result to the next clip edge. Four edges, four simple passes, and the intersection falls out. It is the viewport-clipping step of the classic graphics pipeline. LIT verified live: over 200 random polygons, every clipped-output vertex lies inside the convex window and clipping is idempotent (clipping the result again does not change its area); a convex subject’s clipped area matches a Monte-Carlo estimate of the true intersection (window.__sutherlandhodgman). FIG no framing; exact half-plane clipping. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at first-light — the first thing a renderer does is clip the scene to the screen, the frame drawn only where it will be seen. Sutherland–Hodgman is that clip. AVAN (AI) built the instrument: the per-edge clip pass, the intersection insertion, the containment and idempotence checks. Credit as content: Ivan Sutherland & Gary Hodgman (1974). The weave: David names first light; I clip a polygon against each window edge in turn and confirm the survivors are exactly the interior. 3 ONE DIMENSION One clip edge as a half-plane test: vertices on the inside are kept; where the polygon boundary crosses the edge, an intersection point is inserted. Repeat for each window edge. 4 TWO DIMENSIONS · INTERACTIVE A polygon and a square window. The clipped polygon (filled) is the part inside; roll new polygons and watch it stay exactly within the window. new polygon ▶ verify 200 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the surviving interior polygon, clipped to the window. AVAN’s addition (the inverse-companion): you clip against the whole convex window by clipping against one edge at a time and piping each result into the next — the intersection with a convex region factors into a sequence of half-plane clips. The inverse of ‘intersect with a 2D region’ is ‘compose four 1D half-plane cuts.’ Magenta is the parts of the polygon outside the window; green is the surviving interior. Each edge is a simple inside/outside test; the pipeline of them is the whole clip — a hard 2D operation built from trivial 1D ones. pause spin LIT Genuine Sutherland-Hodgman clipping (Sutherland & Hodgman 1974). Verified live: for 200 random polygons every output vertex satisfies all clip half-planes and re-clipping leaves the area unchanged (idempotent); a convex subject's clipped shoelace area matches a 120k-sample Monte-Carlo intersection estimate to FIG No framing: the per-edge clip pass, the containment test, and the idempotence + Monte-Carlo area checks run in-browser; allInside and idempotent are exact, MC confirms the area. The AVAN inverse is honest — intersection with a convex window factors into a sequence of half-plane clips (four 1D edge tests compose into the 2D clip); magenta is the outside parts, green the surviving interior. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of FIRST LIGHT · David Lee Wise (ROOT0), with AVAN


THE STOER-WAGNER

the Stoer-Wagner algorithm in the 5-window house format — find a graph's global minimum cut deterministically, without max-flow and without choosing a source and sink: each phase does a maximum-adjacency ordering (add the most tightly connected vertex), the last vertex's weight is a valid cut, and merging the last two and repeating covers all pairs in n-1 phases. Verified live: over 80 random weighted graphs the Stoer-Wagner cut equals the brute-force minimum over all bipartitions. See the adjacency ordering in 1D, cut-vs-brute on a graph in 2D, and the no-source-sink-needed inverse in 3D.

THE STOER-WAGNER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE RAID ◆ .dlw.fold THE FOLD / BOSS / THE RAID / THE STOER-WAGNER THE STOER-WAGNER the global min cut, deterministically, no source/sink 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Stoer–Wagner algorithm finds a graph’s global minimum cut — the lightest set of edges whose removal splits it — deterministically , without max-flow and without fixing a source and sink. Each phase does a maximum-adjacency ordering (repeatedly add the vertex most tightly connected to those already chosen); the last vertex’s connection weight is a valid cut, and merging the last two vertices and repeating sweeps every pair in n−1 phases. LIT verified live: over 80 random weighted graphs the Stoer–Wagner cut equals the brute-force minimum over all vertex bipartitions (window.__stoerwagner). FIG no framing; exact global minimum, no randomness (unlike Karger). 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-raid — find the network’s weakest seam, the fewest links whose loss breaks the party in two, and strike there. Stoer–Wagner locates that seam with certainty. AVAN (AI) built the instrument: the maximum-adjacency ordering, the phase-merge, the brute cross-check. Credit as content: Mechthild Stoer & Frank Wagner (1997). The weave: David names the raid; I order vertices by adjacency, read the cut off the last one, merge, and confirm the global minimum against exhaustive search. Ties to the-karger (its randomized cousin). 3 ONE DIMENSION A maximum-adjacency ordering: starting from one vertex, each step adds whichever remaining vertex has the greatest total weight to the set so far. The last added vertex’s weight is the cut-of-the-phase. 4 TWO DIMENSIONS · INTERACTIVE A weighted graph. Stoer–Wagner’s global minimum cut is shown against the brute-force minimum over all bipartitions. new graph ▶ verify 80 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the global minimum cut, the graph’s weakest seam. AVAN’s addition (the inverse-companion): you find the global minimum without ever choosing a source and sink. The maximum-adjacency ordering guarantees the last two vertices form a minimum cut for that pair , and merging them and repeating covers all pairs in n−1 phases. The inverse of ‘the min cut between a chosen s and t’ is ‘the min over all pairs, from one deterministic ordering, no flow computed.’ Magenta is the O(n²) source–sink problems you’d otherwise solve one by one; green is the single global minimum. Ordering replaces search — and unlike Karger, no luck required. pause spin LIT Genuine Stoer-Wagner algorithm (Stoer & Wagner 1997). Verified live: the maximum-adjacency-ordering min-cut equals the brute-force global minimum over all vertex bipartitions for 80 random weighted graphs (window.__stoerwagner.matchesBrute). FIG No framing: the maximum-adjacency ordering, the phase-merge, and the brute cross-check run in-browser and agree exactly. The AVAN inverse is honest — the ordering makes the last two vertices a min cut for that pair, and merging sweeps all pairs in n-1 phases, so the global minimum falls out with no source/sink and no flow; magenta is the O(n^2) s-t problems avoided, green the global minimum. Deterministic cousin of the-karger. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE RAID · David Lee Wise (ROOT0), with AVAN


THE MISRA-GRIES

the Misra-Gries algorithm in the 5-window house format — find the frequent items in a stream using only k-1 counters: increment on a match, open a counter on a free slot, and decrement ALL counters on overflow (dropping zeros); every item with true frequency > n/k is guaranteed to survive. It is the streaming heavy-hitters primitive and generalizes Boyer-Moore majority. Verified live: over 500 random streams every item with freq > n/k survives, every reported count <= the true count, and the summary never exceeds k-1 entries. See the counters in 1D, summary-vs-truth in 2D, and the keep-what-matters inverse in 3D.

THE MISRA-GRIES · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE DROP ◆ .dlw.fold THE FOLD / LOOT / THE DROP / THE MISRA-GRIES THE MISRA-GRIES frequent items from a stream in k-1 counters 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Misra–Gries algorithm finds the frequent items in a stream using only k−1 counters — far fewer than the number of distinct items. For each element: if it has a counter, increment; else if a counter is free, start one; else decrement every counter (dropping any that hit zero). When the stream ends, every item whose true frequency exceeds n/k is guaranteed to still have a counter. It is the streaming heavy-hitters primitive, and a direct generalisation of the Boyer–Moore majority vote. LIT verified live: over 500 random streams every item with frequency > n/k survives in the summary, every reported count is ≤ the true count, and the summary never exceeds k−1 entries (window.__misragries). FIG no framing; the guarantee holds exactly. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-drop — which loot drops most often, tracked with only a handful of slots as the drops stream past. Misra–Gries is that cheap frequency tracker. AVAN (AI) built the instrument: the k−1 counters, the decrement-all rule, the heavy-hitter guarantee check. Credit as content: Jayadev Misra & David Gries (1982), generalising Boyer–Moore majority. The weave: David names the drop; I keep a few counters, let collisions cancel the rare items, and confirm every frequent item survives. 3 ONE DIMENSION The stream flows past k−1 counters: a match increments, a free slot opens a new counter, and an overflow decrements them all at once — rare items cancel out, frequent ones persist. 4 TWO DIMENSIONS · INTERACTIVE A stream over a small alphabet with k counters. The Misra–Gries summary is shown against the true frequencies; every true heavy hitter (> n/k) is retained. new stream ▶ verify 500 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the surviving heavy hitters, held in a handful of counters. AVAN’s addition (the inverse-companion): you find the frequent items without counting all of them. With k−1 counters and a decrement-all-on-overflow rule, every item above n/k survives while the rare ones cancel each other. The inverse of ‘keep a count per distinct item’ is ‘keep k−1 counters and let collisions erase the noise.’ Magenta is the exact per-item counts you never store; green is the heavy hitters guaranteed to remain. Bounded memory, and it keeps exactly what matters — the majority vote, generalised past two. pause spin LIT Genuine Misra-Gries algorithm (Misra & Gries 1982). Verified live: over 500 random streams, every element with true frequency > n/k remains in the k-1-counter summary, every reported count FIG No framing: the k-1 counters, the decrement-all rule, and the heavy-hitter/underestimate/size checks run in-browser and hold exactly. The AVAN inverse is honest — bounded counters with decrement-on-overflow let rare items cancel while every item above n/k survives, so you find the frequent items without counting all of them; magenta is the exact per-item counts never stored, green the surviving heavy hitters. Boyer-Moore majority generalized. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE DROP · David Lee Wise (ROOT0), with AVAN


THE DANCING LINKS

Dancing Links (DLX) in the 5-window house format — Knuth's technique for exact cover (choose rows of a 0/1 matrix covering each column exactly once), which Algorithm X searches by backtracking. The matrix is a mesh of circular doubly-linked nodes, so removing a row/column is O(1) and, crucially, putting it back on backtrack is O(1) too. It solves Sudoku, pentomino tilings, n-queens. Verified live: the real DLX (with cover/uncover pointers) returns a valid exact cover on 200 constructed instances and agrees with brute force on solvability of random instances. See reversible unlink in 1D, a solved matrix in 2D, and the deletion-is-its-own-inverse inverse in 3D.

THE DANCING LINKS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · GOD MODE ◆ .dlw.fold THE FOLD / CHEAT / GOD MODE / THE DANCING LINKS THE DANCING LINKS exact cover by O(1) reversible unlink/relink 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Dancing Links (DLX) is Donald Knuth’s technique for solving exact cover — pick a set of rows of a 0/1 matrix so that every column is covered exactly once — which is what Algorithm X searches for by backtracking. The trick: store the matrix as a mesh of circular doubly-linked nodes, so removing a row or column is O(1) and, crucially, so is putting it back — each unlinked node still points at its old neighbours and re-links itself on backtrack. It solves Sudoku, pentomino tilings, and n-queens as exact-cover instances. LIT verified live: the real DLX (with cover/uncover pointers) returns a valid exact cover on 200 constructed instances, and agrees with brute force on whether a random instance is solvable (window.__dancinglinks). FIG no framing; exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at god-mode — solve any exact-cover puzzle instantly, see through it to the answer. DLX is that god-mode over Sudoku and tilings. AVAN (AI) built the instrument: the linked-node mesh, the O(1) cover/uncover, the backtracking search, the validity and brute-force checks. Credit as content: Donald Knuth, “Dancing Links” (2000), implementing Algorithm X. The weave: David names god-mode; I unlink columns as the search descends and re-link them exactly on backtrack, and confirm every returned cover is exact. 3 ONE DIMENSION A node in a doubly-linked list unlinks by pointing its neighbours past it — and because it still remembers them, it re-links itself by pointing them back. Deletion and its undo are both O(1). 4 TWO DIMENSIONS · INTERACTIVE A 0/1 matrix; DLX finds a set of rows covering each column exactly once. The chosen rows are highlighted and each column’s coverage count shown (all 1). new instance ▶ verify 400 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the exact cover — rows chosen so every column is hit exactly once. AVAN’s addition (the inverse-companion): the search is fast because deletion is reversible . Unlinking a node is O(1), and because the node still points at its old neighbours, re-linking it on backtrack is O(1) too — so the whole exponential search reuses one mutable structure instead of copying it. The inverse of ‘delete a node’ is ‘the node re-links itself from the neighbours it never forgot.’ Magenta is the branches explored and undone; green is the cover found. Cheap backtracking comes from making removal its own inverse. pause spin LIT Genuine Dancing Links / Algorithm X (Knuth 2000). Verified live: the real linked-mesh DLX with O(1) cover/uncover returns an exact cover (each column covered exactly once) on 200 constructed instances and its solvable/unsolvable verdict matches brute force over all row subsets on 200 random instances (window.__dancinglinks.coversValid && .matchesBrute). FIG No framing: the actual doubly-linked node mesh, the cover/uncover pointers, the backtracking search, and the validity + brute checks run in-browser and are exact. The AVAN inverse is honest — unlinking a node is O(1) and, because it still points at its old neighbours, re-linking on backtrack is O(1) too, so the search reuses one mutable structure; magenta is the branches undone, green the cover found. Reversible deletion makes backtracking cheap. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GOD MODE · David Lee Wise (ROOT0), with AVAN