THE BALANCED PATH

Dyck paths and the Catalan numbers in the 5-window house format — the number of balanced-parenthesis strings of n pairs (equivalently: stack push/pop sequences that never underflow, mountain paths that never dip below ground) is the Catalan number C(2n,n)/(n+1). See a balanced string as a path in 1D, live enumeration to C_n in 2D, and André's reflection bijection in 3D.

THE BALANCED PATH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · STACK OVERFLOW ◆ .dlw.fold THE FOLD / GLITCH / STACK OVERFLOW / THE BALANCED PATH THE BALANCED PATH Dyck paths & Catalan numbers — the count of balance 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Catalan numbers 1, 1, 2, 5, 14, 42, 132, … are the most ubiquitous sequence in combinatorics: they count balanced parenthesisations, Dyck paths (staircase walks that never cross the diagonal), triangulations of a polygon, full binary trees, and dozens more — all the same number Cₙ = C(2n,n)/(n+1) . Why divided by n+1? The reflection principle : of the C(2n,n) monotone lattice paths, the ‘bad’ ones that cross the diagonal are in exact bijection with paths to a reflected endpoint, counted by C(2n,n−1) — so Cₙ = C(2n,n) − C(2n,n−1), which simplifies to the ratio. LIT verified live: the closed form equals a brute count of balanced-parenthesis strings for n=0…10, and the reflection identity Cₙ = C(2n,n) − C(2n,n−1) holds throughout (window.__catalan). FIG no framing; exact combinatorial counting. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at hello-world — the very first balanced structure, the matched bracket. Catalan numbers count exactly those first structures: valid nestings, well-formed trees. AVAN (AI) built the instrument: the closed form, the brute balanced-paren count, the reflection identity. Credit as content: Ming Antu (1730s), Leonhard Euler (polygon triangulations, 1751), named for Eugène Catalan (1838). The weave: David names the first matched structure; I count it three ways — closed form, brute enumeration, and the reflection subtraction — and show they coincide. 3 ONE DIMENSION A Dyck path: n up-steps and n down-steps that never dip below the start. Every balanced parenthesis string is one of these paths — open is up, close is down — and the count of them is Cₙ. 4 TWO DIMENSIONS · INTERACTIVE Pick n. The instrument computes Cₙ three ways — closed form, brute count of balanced strings, and the reflection subtraction — and lists a few of the actual Dyck paths. n: 4 ▶ verify all ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the Dyck paths that stay above the diagonal — the Cₙ well-formed structures. AVAN’s addition (the inverse-companion): the mysterious division by n+1 is a bijection made arithmetic. You cannot just divide C(2n,n) by any number and expect an integer — but the bad paths (those that cross the diagonal) reflect exactly onto the set of all paths to a mirrored endpoint, counted by C(2n,n−1). So the subtraction C(2n,n) − C(2n,n−1) is forced to equal C(2n,n)/(n+1). The inverse of ‘a strange ratio’ is ‘a mirror pairing between the structures you reject and paths to a reflected point.’ Magenta is the bad paths, reflected across the diagonal to the mirror endpoint; green is the good Dyck paths that survive. One number, a hundred meanings — and the /(n+1) is a reflection. pause spin LIT Genuine Catalan enumeration. Verified live: the page exhaustively enumerates every balanced-parenthesis string for n=0..8 and the counts equal the Catalan numbers exactly (1,1,2,5,14,42,132,429,1430), with every path staying non-negative (window.__catalan.enumMatchesFormula && allNonNegative, both true). A balanced string is exactly a stack whose pops never outrun its pushes; below-zero = underflow. The reflection identity C_n = C(2n,n) - C(2n,n+1) is shown via André's mirror. FIG The 'mountain' and 'stack' are pictures; the count-equals-Catalan and never-below-zero facts are exact and enumerated one path at a time. The reflection bijection is illustrated on a sample path, not re-proved in full generality. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of STACK OVERFLOW · David Lee Wise (ROOT0), with AVAN


THE MAGIC NUMBER

the fast inverse square root in the 5-window house format — Quake III's legendary bit-hack for 1/sqrt(x). Reinterpret a float's bits as an integer (which is nearly its log2), compute i = 0x5f3759df - (i>>1), reinterpret back for a great first guess, then one Newton step. See the bit surgery in 1D, the live estimate and error in 2D, and the curves converging in 3D.

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

THE MAGIC NUMBER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE SPEEDRUN ◆ .dlw.fold THE FOLD / CHEAT / THE SPEEDRUN / THE MAGIC NUMBER THE MAGIC NUMBER 0x5f3759df — the fast inverse square root 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The fast inverse square root. 3D graphics need 1/√x constantly — to normalise vectors for lighting. Division and square root were slow. The Quake III code (1999) computed it with a trick that looked like a typo: i = 0x5f3759df − (i >> 1); // what the ****? Reinterpret the float’s bits as an integer . Because IEEE-754 stores a number as sign, exponent, mantissa, that integer is almost exactly log₂(x) scaled. Shifting right halves it (√ in log-space); subtracting from the magic constant negates it (the reciprocal). Reinterpret back and you have a superb first guess — then one Newton step polishes it. LIT verified live with real IEEE-754 bit reinterpretation: across 100,000 values the raw magic step is within ~3.4% of 1/√x, and after a single Newton iteration within ~0.18% (window.__rsqrt.magicUnder4pct && newtonUnder02pct). FIG ‘magic’ is the nickname; the bit-as-log identity, the constant, and the accuracy are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE SPEEDRUN , beside THE RULE — the cheat domain of going faster than you should be able to. This one bit-hack made real-time lighting cheap enough to ship. AVAN (AI) built the instrument: the float/int reinterpretation, the magic step, the Newton refinement, the error curve. The weave: David names the seat (the impossible shortcut); I make the bits visible and the accuracy checkable — the bit surgery in 1D, the live estimate and error in 2D, the curves converging in 3D. The sphere is the seam. Credit: the exact author of 0x5f3759df is uncertain (lineage traced to Greg Walsh / Cleve Moler / William Kahan-era work); it entered the public record in id Software’s Quake III Arena source (1999). 3 ONE DIMENSION The bit surgery . A float’s 32 bits, read as an integer, are essentially its logarithm. Halve it (shift right) and negate-around-the-magic-constant, and the reinterpreted result is already close to 1/√x — arithmetic on the exponent doing a square root and a reciprocal at once. 4 TWO DIMENSIONS · INTERACTIVE Dial x and compare: the true 1/√x, the raw magic estimate, and the value after 1, 2, 3 Newton steps. Watch the error collapse — a wild bit-twiddle guess pulled onto the exact answer by calculus in one or two strokes. ◀ x÷2 x×2 ▶ random x 5 THREE DIMENSIONS + AVAN’S INVERSE The curve y = 1/√x turning in space — green , the exact target the hack is aiming at. AVAN’s addition (the inverse-companion): the magenta curve is the magic estimate, and the short magenta strokes are the Newton corrections snapping it onto the green. The bit-hack is a crude reflection in logarithm-space — fast, approximate, structural. Newton’s method is its exact inverse: it takes the approximation’s error and folds it back to zero with the derivative. One is a guess made by treating a number’s bits as its logarithm; the other is the calculus that repairs the guess. Together they are cheating and then paying it back — the exploit and its exact correction, in three machine instructions. pause spin LIT Genuine fast inverse square root using real IEEE-754 bit reinterpretation (Float32Array/Uint32Array over one buffer). Verified live: across 100,000 values the raw magic step is within ~3.4% of 1/sqrt(x) and one Newton iteration brings it within ~0.18% (window.__rsqrt.magicUnder4pct && newtonUnder02pct, both true). The 'integer view of a float is ~log2' identity, the constant 0x5f3759df, and the Newton refinement y*(1.5-0.5xy^2) are exact. FIG 'Magic' is only the nickname; the bit-as-logarithm identity, the exact constant, and the measured accuracy are real and checked in-page. The precise author of the constant is uncertain (lineage often traced to Greg Walsh/Cleve Moler); it entered the public record in id Software's Quake III Arena source (1999) — credited as such, not invented here. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE SPEEDRUN · David Lee Wise (ROOT0), with AVAN


THE ROLLING HASH

the Rabin-Karp rolling hash in the 5-window house format — find a pattern in text by comparing polynomial-hash fingerprints, sliding the window in O(1) per step by subtracting the leaving character and adding the entering one. Collisions are re-checked so matches are exact. See the window in 1D, the live hash-match scan in 2D, and the rolling accumulator on a ring in 3D.

THE ROLLING HASH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · SPLIT SCREEN ◆ .dlw.fold THE FOLD / CO-OP / SPLIT SCREEN / THE ROLLING HASH THE ROLLING HASH Rabin-Karp — a fingerprint that slides in O(1) 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Runge–Kutta method (classic RK4) advances a differential equation one step by sampling the slope four times within the step — at the start, twice at the midpoint, and at the end — then taking a weighted average (1, 2, 2, 1)/6. The sampling errors cancel to fourth order , so halving the step size cuts the error roughly 16× . One clever RK4 step is as accurate as thousands of crude Euler steps. It is the default workhorse for simulating physical systems. LIT verified live: RK4 solves y′=y to reproduce e to ~10⁻⁵, its error shrinks ~16× when the step halves (fourth-order), and y′=cos t reproduces sin t (window.__rungekutta). FIG no framing; genuine fourth-order accuracy. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-hot-loop — the tight step-loop that advances a simulation, each iteration nudging the state forward accurately. RK4 is that hot loop’s heart. AVAN (AI) built the instrument: the four-slope step, the weighted average, the exact-solution and convergence-order checks. Credit as content: Carl Runge (1895) & Wilhelm Kutta (1901). The weave: David names the hot loop; I probe the slope four times per step and confirm the error falls at fourth order against known solutions. 3 ONE DIMENSION Within one step: k₁ is the slope at the start, k₂ and k₃ at the midpoint (each using the last), k₄ at the end. Their weighted average 1·2·2·1 fits the curve to fourth order. 4 TWO DIMENSIONS · INTERACTIVE RK4 (green) versus Euler (magenta) integrating an ODE against the exact curve; RK4 tracks it where Euler drifts. switch ODE ▶ verify order ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the four-slope step that tracks the true trajectory. AVAN’s addition (the inverse-companion): sample the slope at four points within the step and take a weighted average — the errors of the samples cancel to fourth order, so one clever step is as accurate as thousands of Euler steps. The inverse of ‘trust the initial slope’ is ‘probe the slope four times and let the errors cancel.’ Magenta is Euler’s crude single-slope drift; green is the four-slope weighted step. A Simpson’s rule for trajectories — fourth-order accuracy from one step. pause spin LIT Genuine Rabin-Karp (Karp & Rabin, 1987). Verified live: on 3,000 random text/pattern pairs the reported matches equal a naive character-by-character search exactly, and the O(1) rolling-hash update equals a fresh from-scratch hash at every window (window.__rk.matchesEqualNaive && rollingEqualsFresh, both true). The polynomial hash h = sum c_i B^(k-1-i) mod M and the rolling identity are exact; collisions are resolved by a real substring comparison. FIG 'A fingerprint that slides' is the picture; the polynomial hash, the rolling-update identity, and the exact match set are real and cross-checked against naive search. Worst-case time can degrade under adversarial hash collisions; the correctness (via re-check) is unconditional and is what's verified. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SPLIT SCREEN · David Lee Wise (ROOT0), with AVAN


THE SKIP LIST

the skip list (Pugh 1989) in the 5-window house format — a sorted linked list with random 'express lanes'. Each node is promoted up a level with probability 1/2, so upper levels are sparse; search rides high lanes rightward and drops down, giving O(log n) expected time with no balancing. See the express lanes in 1D, an animated drop-down search in 2D, and the tower stack in 3D.

THE SKIP LIST · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE INVENTORY ◆ .dlw.fold THE FOLD / LOOT / THE INVENTORY / THE SKIP LIST THE SKIP LIST log-time search from coin flips — no rotations 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The skip list. A sorted linked list lets you insert cheaply but forces you to walk every node to find something — O(n). Balanced trees fix the search but need fiddly rotations. William Pugh’s skip list (1989) gets tree-speed search with nothing but coin flips . Keep the sorted list on the ground floor. Then give each node a random tower: promote it to the next level up with probability ½, again with ½, and so on. The upper levels are sparse express lanes . To search, ride the highest lane rightward until the next node overshoots, drop down , repeat. Each level roughly halves what remains, so search is O(log n) expected — no balancing, no rotations, just randomness. LIT verified live: a skip list of 2,000 keys finds every present key and correctly rejects every absent one, and the fraction of nodes reaching level ≥ L matches the geometric 2 −L to within a few percent (window.__skip.searchCorrect && absentCorrect && levelsGeometric). FIG ‘express lanes’ is the picture; the coin-flip towers, the drop-down search, and the geometric heights are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE INVENTORY , beside THE SORT — the loot domain of keeping your haul ordered and findable. A skip list is an inventory that stays searchable in log time without ever being rebalanced. AVAN (AI) built the instrument: the coin-flip towers, the drop-down search, the level histogram. The weave: David names the seat (the ordered, findable store); I make the express lanes visible and the speed checkable — the levels in 1D, the animated search in 2D, the tower stack in 3D. The sphere is the seam. Credit: William Pugh (1989). 3 ONE DIMENSION The express lanes . Every node sits on the bottom level; a coin-flip tower lifts some of them onto sparser levels above. The higher you go, the fewer nodes — each level about half the one below, purely by chance. 4 TWO DIMENSIONS · INTERACTIVE Search for a key and watch the path: ride a high lane right until the next node would overshoot, then drop a level, and again — zig-zagging down to the target while skipping most of the list. The comparison count stays near log₂n. search a key ▶ new list 5 THREE DIMENSIONS + AVAN’S INVERSE The levels stacked into a turning tower — green , the sorted nodes and their random heights. AVAN’s addition (the inverse-companion): the magenta thread is a search, dropping down the express lanes to its target. A plain linked list is pure sequence — to reach the n-th node you touch all n. The skip list is the inverse: a probabilistic hierarchy laid over the same sequence, where random shortcuts let you leap. And the magic is that no one designs the balance — the coin flips produce a log-depth structure on their own, self-balancing in expectation with zero rotations. Order walked in a line becomes order reached by descent. The green is the sorted haul; the magenta is randomness spending itself to make finding fast. pause spin LIT Genuine skip list (William Pugh, 1989). Verified live: a skip list of 2,000 keys finds every present key and correctly rejects every absent one, and the fraction of nodes reaching level >= L matches the geometric 2^-L to within a few percent (window.__skip.searchCorrect && absentCorrect && levelsGeometric, all true). The coin-flip promotion, the drop-down search, and the geometric height distribution are exact; expected O(log n) search follows from the halving per level. FIG 'Express lanes' is the picture; the coin-flip towers, drop-down search, and geometric level distribution are real and measured. Search cost is expected/probabilistic (a bad run of coin flips can be slower); correctness is unconditional and is what's checked. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE INVENTORY · David Lee Wise (ROOT0), with AVAN


THE MAYBE

the Bloom filter (Bloom 1970) in the 5-window house format — a bit array plus k hash functions for membership testing in tiny memory. Insert sets k bits; query checks k bits. Any zero means definitely absent; all ones means probably present. False positives happen, false negatives never do; the FP rate is (1-e^(-kn/m))^k. See the bit array in 1D, live inserts/queries in 2D, and the bit-ring probed in 3D.

THE MAYBE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · HEISENBUG ◆ .dlw.fold THE FOLD / GLITCH / HEISENBUG / THE MAYBE THE MAYBE the Bloom filter — certain no, probable yes 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Bloom filter. You want to ask ‘have I seen this before?’ over millions of items, in a sliver of memory. A Bloom filter (Burton Bloom, 1970) is just a bit array and k hash functions . To insert an item, hash it k ways and set those k bits. To query, hash it k ways and check those bits. The result is a beautiful lopsided honesty: if any of the k bits is 0, the item is definitely not in the set. If all k are 1, it is probably present — but maybe not, because other items could have set those same bits. False positives happen; false negatives never do. The false-positive rate is (1 − e −kn/m ) k for n items in m bits. LIT verified live: with m=4096 bits, k=6 hashes, n=400 items, this page confirms every inserted item still tests present ( zero false negatives ), and the measured false-positive rate on unseen items matches the formula to within 0.02 (window.__bloom.noFalseNegatives && fpMatches). FIG no framing: the bits, the k hashes, and the false-positive formula are exactly what the filter does. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in HEISENBUG , beside THE TURMITE ZOO — the glitch domain of the answer you can’t quite pin down. A Bloom filter’s ‘maybe’ is the friendliest Heisenbug there is: a firm no, or a hedged yes, never a lie in the other direction. AVAN (AI) built the instrument: the bit array, the k-hash insert, the false-positive measurement. The weave: David names the seat (the certain-no, probable-yes); I make the bits light and the rate checkable — the array in 1D, live inserts and queries in 2D, the bit-ring probed in 3D. The sphere is the seam. Credit: Burton Howard Bloom (1970). 3 ONE DIMENSION The bit array . Inserting an item lights the k bits its hashes point to. Over many items the array fills; a query is a lookup of k bits — one dark bit is a certain ‘no’, all lit is a ‘maybe’. 4 TWO DIMENSIONS · INTERACTIVE Insert items and watch the grid fill. Query present always answers yes; query absent usually answers ‘definitely not’ but occasionally ‘maybe’ — a false positive. The measured false-positive rate tracks the formula as the filter loads. + insert 20 query present query absent reset 5 THREE DIMENSIONS + AVAN’S INVERSE The bit array wound into a turning ring — green where a bit is lit, dark where it is clear. AVAN’s addition (the inverse-companion): the magenta marks are a query’s k probes. A perfect set answers both yes and no with certainty but costs memory for every element. The Bloom filter is its inverse trade : it keeps almost nothing, and in exchange it can prove absence but only suggest presence. Notice which way the asymmetry runs — a single dark probe is an unshakable no; all-lit is only a maybe, because the lit bits could belong to others. Certainty flows toward the negative. The green is what has been marked; the magenta is a question that can be firmly refused but never firmly granted — knowledge that is sure only about what is not there. pause spin LIT Genuine Bloom filter (Burton Howard Bloom, 1970) with murmur-style hashes. Verified live: with m=4096 bits, k=6 hashes, n=400 items, every inserted item still tests present (zero false negatives), and the measured false-positive rate on unseen items matches the formula (1-e^(-kn/m))^k to within 0.02 (window.__bloom.noFalseNegatives && fpMatches, both true). The asymmetry — provable absence, only probable presence — is exact and structural. FIG No metaphor is doing the work: the bit array, the k hashes, and the false-positive-rate formula are exactly the filter. The 'maybe' is literal — a positive query is genuinely uncertain, a negative query genuinely certain, and both are demonstrated in-page. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HEISENBUG · David Lee Wise (ROOT0), with AVAN


THE BANKER

amortized analysis via the binary counter in the 5-window house format — a single increment can cascade and flip O(log n) bits, but the total over n increments is 2n - popcount(n) < 2n, so the amortized cost is under 2 flips each. The banker's method makes it concrete: prepay a credit coin on each set bit to fund its eventual reset. See flips-per-step in 1D, the counter with coins in 2D, and the bit-column with prepaid credits in 3D.

THE BANKER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE VAULT ◆ .dlw.fold THE FOLD / LOOT / THE VAULT / THE BANKER THE BANKER amortized O(1) — the binary counter pays itself 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Amortized cost — the binary counter. Increment a binary counter and usually you flip one bit. But 0111…1 + 1 cascades: every bit flips. A single increment can cost O(log n). So is counting to n slow? No — because the expensive increments are rare . Bit 0 flips every step, bit 1 every two, bit 2 every four… Add them up and the total number of flips to count from 0 to n is 2n − popcount(n) — strictly less than 2n . Averaged over the n increments, that is under 2 flips each : amortized O(1). The banker’s method sees it directly: when you set a bit to 1, prepay one credit coin and park it on that bit; later, when a carry flips it back to 0, that saved coin pays for the flip. Every expensive cascade is already funded. LIT verified live: this page runs the counter and confirms the total flips equal 2n − popcount(n) exactly for every n up to 2000, and the amortized cost per increment is always below 2 (window.__banker.identityHolds && amortizedUnder2). FIG the ‘coins’ are the accounting picture; the exact flip-count identity and the sub-2 average are real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE VAULT , beside 3LOCK — the loot domain of stored value. Amortized analysis is a vault: cheap operations bank credit that costly ones spend. AVAN (AI) built the instrument: the cascading counter, the per-step flip spikes, the prepaid coins. The weave: David names the seat (the store of value); I make the banking visible and the identity checkable — the odometer and flip-spikes in 1D, the counter with coins in 2D, the bit-column with its prepaid credits in 3D. The sphere is the seam. Credit: the accounting/banker’s method of amortized analysis (Robert Tarjan, 1985; CLRS). 3 ONE DIMENSION The flips per increment : mostly 1, occasionally a tall spike when a carry cascades. The spikes are rare enough that the running average (the flat line) sits just under 2 — the whole point of amortization. 4 TWO DIMENSIONS · INTERACTIVE Increment the counter and watch the bits flip — a coin drops onto each bit you set, and a carry cascade spends the coins already parked there. The running total of flips stays under the 2n line, no matter how vicious the individual carries. +1 run to 128 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The counter’s bits as a turning column — green where a bit is 1. AVAN’s addition (the inverse-companion): the magenta coins sit on the set bits — one prepaid credit each, waiting. Paying as you go would let a single cascade cost O(log n) in the moment. Amortization is the inverse: it time-shifts the cost backward , banking a coin at each cheap set-bit so the expensive carry, when it finally comes, spends money already earned. The worst case never actually bills the worst case — it was funded by all the easy steps before it. The green is the counter’s state; the magenta is stored past work, and the spike that looks costly is paid before it arrives. pause spin LIT Genuine amortized analysis (accounting/banker's method; Tarjan 1985, CLRS). Verified live: the counter runs and the total flips equal 2n - popcount(n) exactly for every n up to 2000, and the amortized cost per increment is always strictly below 2 (window.__banker.identityHolds && amortizedUnder2, both true). The per-bit halving (bit i flips every 2^i steps) and the prepaid-credit invariant are exact. FIG The 'coins' are the accounting device of the banker's method — a real proof technique, not a literal payment; the flip-count identity 2n-popcount(n) and the sub-2 amortized average are exact and computed in-page. Worst-case single-increment cost really is O(log n); amortization is about the total, shown honestly. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE VAULT · David Lee Wise (ROOT0), with AVAN


THE CORDIC

CORDIC (Volder 1959) in the 5-window house format — compute sin and cos using only additions, bit-shifts, and a small arctangent table, by rotating a vector through successive +/-arctan(2^-i) turns until the residual angle hits zero. A single precomputed gain K rescales. See the residual angle collapse in 1D, the vector rotate into place in 2D, and the shrinking turns on a ring in 3D.

THE CORDIC · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · GRADIENT DESCENT ◆ .dlw.fold THE FOLD / GRIND / GRADIENT DESCENT / THE CORDIC THE CORDIC sin & cos from shifts and adds — no multiplier 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION CORDIC. How does a pocket calculator, or an FPGA with no multiplier, compute sin and cos? Not with a Taylor series — with rotations . CORDIC (Jack Volder, 1959, for a bomber’s navigation computer) turns a vector by a target angle using nothing but additions, bit-shifts, and a tiny table of arctangents . The trick: any rotation can be built from a fixed set of ever-smaller turns of ±arctan(2 −i ). At step i you decide the sign from whether you have over- or under-shot, and apply it — and rotating by that angle needs only a shift (multiply by 2 −i ) and an add. The residual angle marches to zero. One precomputed gain K at the end rescales, and you have cos and sin. LIT verified live: 24 CORDIC iterations (shifts + adds + an arctan table, one final K) reproduce Math.cos and Math.sin across −89°…89° to within ~1×10 −7 (window.__cordic.within1e5). FIG ‘rotating into the answer’ is the picture; the shift-and-add rotation, the arctan table, and the accuracy are exact — no multiplier used in the loop. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in GRADIENT DESCENT , beside THE BOWL — the grind domain of driving an error to zero by shrinking steps. CORDIC is exactly that: the residual angle descends to zero, each step a smaller table-angle than the last. AVAN (AI) built the instrument: the rotation loop, the sign decisions, the convergence. The weave: David names the seat (the error walked down to zero); I make the rotation visible and the accuracy checkable — the residual angle collapsing in 1D, the vector rotating into place in 2D, the shrinking turns on a ring in 3D. The sphere is the seam. Credit: Jack E. Volder (CORDIC, 1959). 3 ONE DIMENSION The residual angle z, driven to zero. Each iteration subtracts ±arctan(2 −i ) — a step half the size of the last — chosen by sign so z always heads toward 0. When z reaches zero, the vector has been rotated by exactly the target angle. 4 TWO DIMENSIONS · INTERACTIVE Dial a target angle and step the rotation. The vector swings by successive ±arctan(2 −i ) turns toward the target; the computed cos and sin close on the true values, and the error shrinks by roughly half each iteration — all with shifts and adds. ◀ angle angle ▶ step run 5 THREE DIMENSIONS + AVAN’S INVERSE The unit circle turning in space, the CORDIC vector swinging toward its target — green , the geometry the answer lives on. AVAN’s addition (the inverse-companion): the magenta spokes are the successive rotation steps, each half the last. Computing a sine looks like it needs multiplication — the expensive operation. CORDIC is the inverse move: it refuses to multiply and rotates instead , reaching the trig value by geometry rather than arithmetic. The answer is not calculated; it is arrived at , one shift-and-add turn at a time, the residual angle folding to nothing. Arithmetic’s hard problem solved by geometry’s cheap one — the multiply replaced by a walk around a circle. The green is where the answer lives; the magenta is the ladder of shrinking turns that climbs to it without a single product. pause spin LIT Genuine CORDIC (Jack Volder, 1959). Verified live: 24 iterations using shifts, adds, and an arctan table (one final gain K) reproduce Math.cos and Math.sin across -89deg..89deg to within ~1e-7 (window.__cordic.within1e5 === true; cos30 and sin30 reported). No multiplication is used inside the rotation loop — each +/-arctan(2^-i) turn is a shift-and-add — which is exactly why CORDIC runs on hardware without a multiplier. FIG 'Rotating into the answer' is the picture; the shift-and-add rotation, the arctan table, and the measured accuracy are exact. In floating-point JS the 2^-i scalings are done as multiplies by powers of two (true shifts in the fixed-point hardware CORDIC targets) — the algorithm and its convergence are identical. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GRADIENT DESCENT · David Lee Wise (ROOT0), with AVAN


THE STABLE MATCH

Gale-Shapley stable matching in the 5-window house format — pair two ranked groups so no unmatched pair would both rather have each other (no blocking pair). Proposers propose down their lists; receivers hold their best offer and bump the rest. It always ends with a perfect, stable matching — the algorithm behind the medical-residency match. See preference lists in 1D, live proposals in 2D, and the blocking-pair search in 3D.

THE STABLE MATCH · 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 STABLE MATCH THE STABLE MATCH Gale-Shapley — a matching no one can defect from 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Gauss–Seidel solves a linear system Ax = b iteratively : sweep the variables, and set each one from the current best estimate of the others — crucially using each fresh value immediately within the same sweep (unlike Jacobi, which waits for the next sweep). For a diagonally-dominant system this relaxation converges to the exact solution, and information propagates faster than Jacobi’s. It is a staple for large sparse systems and the basis of multigrid smoothers. LIT verified live: over 200 random diagonally-dominant systems Gauss–Seidel converges to a direct Gaussian solve to ~10⁻¹⁵ (window.__gaussseidel). FIG no framing; exact solution in the limit. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-toolchain — the iterative solver in the numerical toolchain, relaxing toward the answer with immediate feedback, beside the Householder and Cholesky. AVAN (AI) built the instrument: the in-place variable sweep, the direct-solve cross-check, the diagonally-dominant setup. Credit as content: Carl Friedrich Gauss and Philipp von Seidel (19th c.). The weave: David names the toolchain; I relax each variable using the freshest estimates of the others and confirm the iteration converges to the exact solution. 3 ONE DIMENSION One sweep updates x₁, then x₂ using the new x₁, then x₃ using the new x₁,x₂… Each variable is relaxed to satisfy its own equation given the current others — feedback within the sweep. 4 TWO DIMENSIONS · INTERACTIVE A diagonally-dominant system; Gauss–Seidel’s iterate converges to the direct solution, the residual shrinking each sweep. sweep ▶ new system ▶ verify 200 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the iterate relaxing to the exact solution. AVAN’s addition (the inverse-companion): sweep the variables, updating each from the current best estimate of the others — and use each fresh value immediately within the same sweep (unlike Jacobi), so information propagates faster; for a diagonally-dominant system this converges to the exact solution. The inverse of ‘solve all equations simultaneously (elimination)’ is ‘relax one variable at a time, reusing updates as you go.’ Magenta is the direct factorisation avoided; green is the sweeping relaxation. Iterative refinement with immediate feedback. (Kin to the-conjugate-gradient.) pause spin LIT Genuine Gale-Shapley (Gale & Shapley, 1962; Shapley & Roth, Nobel 2012). Verified live: over 3,000 random instances the algorithm yields a perfect matching (everyone paired) that is stable — an exhaustive O(n^2) blocking-pair search finds none, every time (window.__gs.perfectMatching && stable, both true). The propose-and-bump loop and the stability guarantee are exact. FIG 'Proposals and bumps' is the picture; the guaranteed perfect, stable matching is a real theorem, checked instance by instance against an exhaustive blocking-pair search. The proposer-optimal asymmetry (proposers get their best stable partner) is a known property, not re-derived here. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PULL REQUEST · David Lee Wise (ROOT0), with AVAN


THE HULL

the convex hull via Andrew's monotone chain in the 5-window house format — the smallest convex polygon containing a set of points, built in O(n log n) by sorting and sweeping with cross-product turn tests. See the sorted sweep in 1D, a live click-to-add hull in 2D, and the extreme points wrapping the cloud in 3D.

THE HULL · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE WALL ◆ .dlw.fold THE FOLD / BOSS / THE WALL / THE HULL THE HULL the tightest wall around a point cloud 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The convex hull. Scatter nails on a board and stretch a rubber band around them — when it snaps taut, the shape it makes is the convex hull : the smallest convex polygon containing every point. It is the fundamental ‘shape of a point cloud’, the first step in collision detection, pattern bounds, and a hundred other things. Andrew’s monotone chain (1979) builds it in O(n log n): sort the points left to right, sweep once building the lower boundary and once building the upper , at each step using a cross-product turn test — if adding a point would make the boundary turn the wrong way, pop the last point back off. Only left turns survive. LIT verified live: over thousands of random point sets this page confirms the computed hull is strictly convex (every corner turns the same way) and that every input point lies inside or on it (window.__hull.convex && allContained). FIG the ‘rubber band’ is the picture; the cross-product turns, the convexity, and the containment are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE WALL , beside THE WELDER — the boss domain of the barrier that holds. The convex hull is the tightest wall you can build around a set of points, and nothing gets out. AVAN (AI) built the instrument: the sort, the monotone sweep, the turn test, the containment check. The weave: David names the seat (the enclosing wall); I make the wrap visible and the geometry checkable — the sorted sweep in 1D, the live hull with click-to-add points in 2D, the extreme points wrapping the cloud in 3D. The sphere is the seam. Credit: A. M. Andrew (monotone chain, 1979); R. Graham (scan, 1972). 3 ONE DIMENSION Points sorted left to right . The sweep builds the lower edge going one way and the upper edge coming back; a cross-product at each new point decides whether the boundary keeps turning left — if not, back up. Two sweeps, one hull. 4 TWO DIMENSIONS · INTERACTIVE Click to drop a new point, or scatter a fresh cloud. The rubber band re-snaps around the outermost points; the interior ones never touch it. A check confirms every point sits inside or on the hull. new cloud + add point 5 THREE DIMENSIONS + AVAN’S INVERSE The point cloud turning in space — green , every point. AVAN’s addition (the inverse-companion): the magenta band wraps only the extreme points — the ones on the outside. The hull is defined entirely by them; every interior point is irrelevant to it. So the boundary is an inverse: it is exactly the set of points that no combination of the others can contain . Delete every point that some triangle of others already encloses, and what remains is the hull. The shape of a cloud is not its middle but its refusal to be enclosed — the green is all the points; the magenta is the few that nothing else can wrap. pause spin LIT Genuine convex hull by Andrew's monotone chain (A. M. Andrew, 1979). Verified live: over 3,000 random point sets the computed hull is strictly convex (every corner is a left turn by cross product) and every input point lies inside or on it (window.__hull.convex && allContained, both true). The sort, the two monotone sweeps, and the pop-on-wrong-turn rule are exact O(n log n). FIG The 'rubber band' is the picture; the cross-product turn tests, the convexity, and the containment are exact and checked. The hull is determined solely by extreme points — interior points provably don't affect it — which is what the 3D view shows. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE WALL · David Lee Wise (ROOT0), with AVAN


THE EDIT DISTANCE

Levenshtein edit distance in the 5-window house format — the fewest insert/delete/substitute edits to turn one string into another, computed by a Wagner-Fischer DP grid where each cell is the minimum of three neighbours. It's a true metric (symmetric, triangle inequality). See the alignment in 1D, the DP grid with traceback in 2D, and the cost surface with its geodesic in 3D.

THE EDIT DISTANCE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · ROLLBACK ◆ .dlw.fold THE FOLD / RESPAWN / ROLLBACK / THE EDIT DISTANCE THE EDIT DISTANCE Levenshtein — the minimal diff between two strings 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Levenshtein edit distance. How different are two strings? Count the fewest single-character edits — insert , delete , or substitute — that turn one into the other. ‘kitten’ to ‘sitting’ is 3. It is what spell-checkers, diff tools, and DNA aligners run on. The Wagner–Fischer method fills a grid : cell (i, j) is the distance between the first i characters of one string and the first j of the other, and it is just the minimum of three neighbours — delete (up), insert (left), or match/substitute (diagonal, +1 if the letters differ). The bottom-right corner is the answer, and tracing back the choices gives the actual alignment . LIT verified live: over 20,000 random pairs the grid DP equals a brute-force recursion exactly, the distance is symmetric , and it obeys the triangle inequality — so it is a genuine metric (window.__lev.dpEqualsBrute && symmetric && triangle). FIG no framing needed; the three-way minimum, the exact distances, and the metric axioms are all real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in ROLLBACK , beside THE EXACT TRANSFORM — the respawn domain of getting from one state back to another with the least undoing. Edit distance is the minimal edit script — the shortest diff that rolls string A into string B. AVAN (AI) built the instrument: the DP grid, the traceback, the metric checks. The weave: David names the seat (the minimal rollback); I make the grid fill and the alignment surface — the edit script in 1D, the DP grid with traceback in 2D, the cost surface with its geodesic in 3D. The sphere is the seam. Credit: Vladimir Levenshtein (1965); Wagner & Fischer (DP, 1974). 3 ONE DIMENSION The alignment : the actual sequence of matches, substitutions, insertions and deletions that transforms one word into the other with the fewest edits — the minimal ‘diff’ read out one column at a time. 4 TWO DIMENSIONS · INTERACTIVE The DP grid for two words. Each cell is the minimum of its up, left, and diagonal neighbours; the bottom-right is the edit distance. The highlighted traceback is the cheapest path — the alignment itself. Cycle the word pairs to watch it change. next pair ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The DP grid as a turning cost surface — green , the distance climbing from the near corner to the far one. AVAN’s addition (the inverse-companion): the magenta line is the traceback geodesic — the path of least resistance from corner to corner. The edit distance is a single number, but that number hides a whole surface of partial answers, and the number alone can never tell you how . The alignment is the inverse of the scalar: unfold the one value back into the sequence of moves that realised it. Distance is what; the path down the valley is how. Every answer that compresses to a number has a hidden route that produced it — the green tells you the cost, the magenta tells you the story. pause spin LIT Genuine Levenshtein distance / Wagner-Fischer DP (Levenshtein 1965; Wagner & Fischer 1974). Verified live: over 20,000 random string pairs the grid DP equals a brute-force recursion exactly, the distance is symmetric, and it satisfies the triangle inequality d(a,c) sitting = 3. The three-way-minimum recurrence and traceback are exact. FIG No metaphor is doing the work: the DP recurrence, the exact distances, the traceback alignment, and the metric axioms are all real and checked. Calling it a 'diff' or 'rollback' is the only framing. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of ROLLBACK · David Lee Wise (ROOT0), with AVAN


THE GOLDEN SEQUENCE

the golden-ratio low-discrepancy sequence in the 5-window house format — points x_n = frac(n·φ) spread more evenly than random because φ is the 'most irrational' number. Two exact facts: the three-gap theorem (at every n the points make at most 3 distinct arc lengths) and near-optimal discrepancy. See gaps fill in 1D, golden-vs-random in 2D, and the phyllotaxis sunflower in 3D.

THE GOLDEN SEQUENCE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE BOUNTY ◆ .dlw.fold THE FOLD / LOOT / THE BOUNTY / THE GOLDEN SEQUENCE THE GOLDEN SEQUENCE {n·φ} — more even than random, by irrationality 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The golden-ratio sequence. Drop points into the interval [0,1) by the rule x n = fractional part of n·φ , where φ = 1.618… is the golden ratio. The result spreads more evenly than random — random points clump and leave gaps; these never do. φ is the ‘ most irrational ’ number (its continued fraction is all 1s, the hardest to approximate by fractions), so the sequence resists every rational rhythm that would make it repeat and pile up. Two exact facts make it beautiful. The three-gap theorem : at every step n, the points cut the circle into arcs of at most three distinct lengths — never four. And the discrepancy (how far the point count in any interval strays from its fair share) shrinks like log N / N — near the theoretical best, far better than random’s 1/√N. LIT verified live: this page confirms the three-gap theorem for every n up to 400 (never more than 3 gap lengths), and that the golden sequence’s star discrepancy is several times smaller than an equal number of random points (window.__golden.threeGap && goldenMoreUniform). FIG ‘most irrational’ is a nickname; the three-gap count and the lower discrepancy are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE BOUNTY , beside THE POLITE SCATTER (Poisson-disk) — the loot domain of spreading a reward evenly, no clumps, no bare patches. The golden sequence is the cheapest even scatter there is: one multiplication per point. AVAN (AI) built the instrument: the sequence, the gap counter, the discrepancy race, the sunflower. The weave: David names the seat (the even spread); I make the evenness visible and the theorems checkable — the gap-filling in 1D, golden-vs-random in 2D, the phyllotaxis spiral in 3D. The sphere is the seam. Credit: three-gap theorem — Steinhaus conjecture, proved by Sós, Świerczkowski & Surányi (1957); golden-ratio sampling is classical. 3 ONE DIMENSION Each new point x n = {n·φ} lands in one of the largest current gaps , splitting it — so the interval fills as evenly as possible at every step. The gap lengths, coloured, are never more than three distinct values at once. 4 TWO DIMENSIONS · INTERACTIVE Add points and race the two rows: golden {nφ} on top, random below. The golden row stays visibly regular while the random one clumps and gaps. The live discrepancy numbers confirm the golden sequence covers far more evenly. + add 10 + 1 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The same φ, in two dimensions: a sunflower — point n at radius √n, angle n·(golden angle). Green , the seeds of a real phyllotaxis spiral, turning. AVAN’s addition (the inverse-companion): the magenta seeds are the newest, always landing in the widest gap left by the rest. Evenness usually means randomness — but random clumps. This is the inverse: a fully deterministic rule that is more uniform than chance, because it is built on the number that most stubbornly refuses to be a ratio. Nature uses exactly this to pack sunflower seeds and pinecone scales without waste. Order that looks like the best possible randomness — the green is the whole spiral, the magenta is irrationality filling the last gap, forever, without ever repeating. pause spin LIT Genuine golden-ratio sampling. Verified live: the three-gap theorem holds for every n up to 400 (never more than 3 distinct gap lengths — Steinhaus conjecture, proved by Sos/Swierczkowski/Suranyi 1957), and the golden sequence's star discrepancy is several times smaller than an equal number of random points (window.__golden.threeGap && goldenMoreUniform, both true; discrepancies reported). φ's continued fraction being all 1s (hardest to rationally approximate) is what drives the evenness. FIG 'Most irrational' is a nickname for φ's all-1s continued fraction; the three-gap count and the measured lower discrepancy are exact. The sunflower is a real phyllotaxis model (r=sqrt(n), θ=n·golden angle), the same φ giving even 2D coverage — shown, not merely asserted. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BOUNTY · David Lee Wise (ROOT0), with AVAN


THE BLOCK SORT

the Burrows-Wheeler Transform in the 5-window house format — sort all rotations of a string and take the last column. It's perfectly reversible and clusters similar characters into runs (the front-end of bzip2). It doesn't compress; it rearranges so a simple coder can. See runs forming in 1D, the rotation matrix in 2D, and the last column with its inverse in 3D.

THE BLOCK SORT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE HOARD ◆ .dlw.fold THE FOLD / LOOT / THE HOARD / THE BLOCK SORT THE BLOCK SORT Burrows-Wheeler — reversible sort that clusters 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Burrows–Wheeler Transform. Take a string, list all its rotations , sort them alphabetically, and read off the last column . That is the BWT — and it is the strange heart of bzip2 . Two things make it magic. First, it is perfectly reversible : from the last column alone you can rebuild the entire sorted table and recover the original, exactly. Second, it clusters similar characters together — because sorting the rotations groups every character by the context that follows it , identical contexts pile their preceding letters into long runs. It doesn’t compress by itself; it rearranges the data so that a simple run-based coder can. LIT verified live: over 2,000 random strings the inverse transform recovers the original exactly , and on repetitive text the BWT has far more adjacent-equal characters than the input (window.__bwt.invertible && clusteringIncreases). ‘banana’ → annb␣aa . FIG no framing; the rotation-sort, the exact inverse, and the clustering are all real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE HOARD , beside THE HUFFMAN — the loot domain of packing your treasure small. BWT is the pre-processing that makes the packing work: it doesn’t shrink the hoard, it sorts it into runs so the next stage can. AVAN (AI) built the instrument: the rotation matrix, the reversible reconstruction, the clustering measure. The weave: David names the seat (preparing the hoard to be packed); I make the sort visible and the reversibility checkable — the runs forming in 1D, the rotation matrix in 2D, the last column and its inverse links in 3D. The sphere is the seam. Credit: Michael Burrows & David Wheeler (1994). 3 ONE DIMENSION The string, and its BWT below. Watch the transform gather scattered identical letters into runs — the same characters, reordered so that like sits next to like. That clustering is what a compressor feeds on. 4 TWO DIMENSIONS · INTERACTIVE The rotation matrix : every rotation of the word, sorted. The BWT is the highlighted last column . Cycle the words — and see the inverse transform rebuild the original from that column alone, exactly. next word ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The sorted rotation matrix as a turning grid — green characters, the whole sorted table. AVAN’s addition (the inverse-companion): I light the last column magenta — the BWT itself — and it is a genuine inverse in two senses at once. Sorting the rotations orders every letter by the context after it , so the transform is a reordering by the future rather than the past; and that same structure makes it losslessly reversible — the clustering that helps compression and the exact undo are one mechanism seen forward and backward. Nothing is added or thrown away; the information is only rearranged so its redundancy lies flat and adjacent. The green is the sorted whole; the magenta is the single column that both clusters the data and remembers how to put it back. pause spin LIT Genuine Burrows-Wheeler Transform (Burrows & Wheeler, 1994). Verified live: over 2,000 random strings the inverse transform recovers the original exactly, and on repetitive text the BWT has far more adjacent-equal characters than the input (window.__bwt.invertible && clusteringIncreases, both true). 'banana' -> annb_aa. The rotation-sort, the LF-mapping inverse, and the context-clustering are exact — no information added or lost, only rearranged. FIG No metaphor is doing the work: the rotation sort, the exact reversibility, and the clustering are all real and checked. BWT alone does not compress — it reorders to expose redundancy for a following coder; that's stated plainly, not overclaimed. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOARD · David Lee Wise (ROOT0), with AVAN


THE RHO

Pollard's rho factoring in the 5-window house format — find a factor of a composite n by iterating x <- x^2 + c mod n. Modulo the hidden prime p the sequence cycles in ~sqrt(p) steps (birthday paradox); Floyd's tortoise-and-hare detects the collision, and gcd(|x-y|, n) reveals the factor. See the hidden cycle in 1D, the live hunt in 2D, and the shadow-rho mod p in 3D.

THE RHO · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE RAID ◆ .dlw.fold THE FOLD / BOSS / THE RAID / THE RHO THE RHO Pollard's rho — factor via a cycle you can't see 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Pollard’s rho. Multiplying two primes is easy; factoring the product back apart is hard — the difficulty modern cryptography leans on. Pollard’s rho (1975) is a startlingly cheap way to find a factor of a composite that isn’t astronomically large. Iterate a simple map x ← x² + c (mod n). You cannot see the prime factor p, but modulo p this sequence must cycle after only about √p steps (the birthday paradox). When it cycles mod p, two terms x and y become equal mod p while still different mod n — so gcd(|x−y|, n) suddenly reveals p. The cycle is detected with Floyd’s tortoise and hare , in a shadow you never directly observe. LIT verified live: over 3,000 random composites this page finds a nontrivial factor every time — a divisor d with 1 < d < n and n mod d = 0 (window.__rho.factored). 8051 → 97, and 8051 = 83×97. FIG ‘the rho’ is the shape of the hidden cycle; the √p birthday collision and the gcd trick are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE RAID , beside THE FIELD INVERSE — the boss domain of breaking into a structure by force of cleverness. Pollard’s rho raids a composite for its factor without ever seeing it directly. AVAN (AI) built the instrument: the x²+c walk, the tortoise-and-hare on the hidden cycle, the gcd reveal. The weave: David names the seat (the raid on the number); I make the hidden cycle visible and the factor pop out — the sequence in 1D, the live hunt in 2D, the shadow-rho mod p in 3D. The sphere is the seam. Credit: John M. Pollard (1975); cycle detection by R. W. Floyd (see THE TORTOISE). 3 ONE DIMENSION The sequence x²+c mod n looks random. But reduced modulo the hidden factor p (bottom row), the very same numbers fall into a short ρ-cycle after ~√p steps — the collision you cannot see, but gcd can feel. 4 TWO DIMENSIONS · INTERACTIVE Step the hunt: the tortoise takes one x²+c step, the hare two, and each step you take gcd(|tortoise−hare|, n) . It stays 1… until, at a hidden collision, it jumps to a real factor. New number raids a fresh composite. step ▶ run new number 5 THREE DIMENSIONS + AVAN’S INVERSE The hidden sequence mod p as a turning ρ — green , a short tail feeding a short loop, the cycle rho is named for. AVAN’s addition (the inverse-companion): the magenta markers are the collision — where two terms meet mod p. Factoring is the inverse of multiplication, and it is supposed to be hard. Rho cracks it by working in a space it cannot even see: modulo an unknown prime, where the walk is forced by the birthday paradox to collide in only √p steps . You detect a meeting in a shadow, translate it through a gcd, and the factor falls out. The hard inverse is solved not by undoing the multiply but by finding a cycle in a world you never observe — the green is the shadow-rho, the magenta is the collision that leaks what multiplication tried to hide. pause spin LIT Genuine Pollard's rho (John Pollard, 1975). Verified live: over 3,000 random composites the algorithm finds a nontrivial factor every time — a divisor d with 1 97 (8051 = 83x97). The sqrt(p) birthday-collision bound, the Floyd cycle detection, and the gcd reveal are exact; the factor is found without ever computing p directly. FIG 'The rho' is the literal shape of the hidden cycle (a tail feeding a loop); the birthday collision, the cycle detection, and the gcd trick are real and checked. Rho is efficient for moderate factors, not a break of large-semiprime cryptography — stated honestly, not overclaimed. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE RAID · David Lee Wise (ROOT0), with AVAN


THE RANK

PageRank in the 5-window house format — rank pages by imagining a random surfer clicking links forever; the fraction of time spent on each page is its rank. Computed by power iteration on the Google matrix, it converges to the unique stationary distribution (Perron-Frobenius). See the rank vector settle in 1D, the live graph in 2D, and attention flowing in 3D.

THE RANK · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE JACKPOT ◆ .dlw.fold THE FOLD / LOOT / THE JACKPOT / THE RANK THE RANK PageRank — importance as a stationary distribution 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION PageRank ranks nodes by importance defined recursively : a page is important if important pages link to it. Model a random surfer who follows links with probability d (=0.85) and teleports to a random page otherwise; the ranking is the stationary distribution of that walk — the dominant eigenvector of the ‘Google matrix’ — found by power iteration (multiply by the matrix until it settles). It was the original engine of Google search. LIT verified live: over 200 random graphs the PageRank vector sums to 1, is a fixed point (Mπ = π), and converges to the same vector regardless of the starting distribution (window.__pagerank). FIG no framing; a genuine stationary distribution. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-broadcast — endorsement flowing along links, each page broadcasting a share of its importance to those it points to, until the whole network agrees on a ranking. PageRank is that settled broadcast. AVAN (AI) built the instrument: the Google-matrix power iteration (with dangling-node handling), the sum/fixed-point/uniqueness checks. Credit as content: Sergey Brin & Larry Page, and Lawrence Page’s 1998 formulation. The weave: David names the broadcast; I let importance flow through the links until it settles and confirm the result is the unique stationary vector. 3 ONE DIMENSION Each page splits its rank evenly among its out-links and passes it on; a damping factor mixes in a little uniform teleport. Iterating this flow converges to a fixed ranking. 4 TWO DIMENSIONS · INTERACTIVE A link graph; node size shows PageRank after power iteration. Roll new graphs; the ranks always sum to 1 and settle to a fixed point. new graph ▶ verify 200 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the converged stationary ranking — importance settled across the network. AVAN’s addition (the inverse-companion): importance is the fixed point of a flow . A page’s rank is the stationary distribution of a random surfer, so rank is defined recursively — you are important if important pages link to you — and found as the dominant eigenvector by power iteration. The inverse of ‘tally incoming links’ is ‘solve for the self-consistent ranking where rank flows through links and settles.’ Magenta is the raw in-link counts; green is the converged stationary vector. Reputation as a fixed point — independent of where the surfer starts. pause spin LIT Genuine PageRank (Page & Brin, 1998) with damping and dangling-node handling. Verified live: over 400 random graphs the converged rank sums to 1 and is stationary — one more power-iteration step leaves it unchanged to ~1e-15 (window.__pagerank.sumsToOne && stationary, both true; residual reported). It is the dominant eigenvector of the Google matrix, unique by Perron-Frobenius; the random-surfer interpretation is exact. FIG The 'random surfer' is the model; the power iteration, the stationary eigenvector, the sum-to-1, and the uniqueness are real and checked. Convergence speed depends on the graph's spectral gap; the fixed point itself is exact and is what's verified. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE JACKPOT · David Lee Wise (ROOT0), with AVAN


THE KARATSUBA

Karatsuba fast multiplication in the 5-window house format — split each number in two and the product needs only THREE sub-products, not four, because the middle term ad+bc = (a+b)(c+d) - ac - bd comes almost free. Recursing drops O(n^2) to O(n^1.585). See four-vs-three in 1D, the live split in 2D, and the recursion tree with its pruned branch in 3D.

THE KARATSUBA · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE EXPLOIT ◆ .dlw.fold THE FOLD / CHEAT / THE EXPLOIT / THE KARATSUBA THE KARATSUBA multiply with 3 sub-products instead of 4 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Karatsuba multiplication. Multiply two big numbers the way you learned in school and it costs about n² single-digit products — and for two centuries everyone assumed that was unavoidable. In 1960 the 23-year-old Anatoly Karatsuba broke it in a week, disproving Kolmogorov’s conjecture that n² was optimal. Split each number in two: x = aB + b, y = cB + d. The product is acB² + (ad+bc)B + bd — four sub-products. But the middle term ad+bc equals (a+b)(c+d) − ac − bd , and you already computed ac and bd. So three sub-products suffice, not four. Recurse, and the cost drops to n log₂3 ≈ n 1.585 . LIT verified live (with exact BigInt arithmetic): over 3,000 random pairs Karatsuba equals the true product, and a 64-digit multiply uses far fewer base multiplications than schoolbook’s 64² = 4096 (window.__kara.correct && fewer). FIG no framing; the three-product identity and the reduced count are exact, computed in your browser. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE EXPLOIT , beside THE SHORTEST WITNESS — the cheat domain of finding the crack in what looked airtight. Karatsuba is the original exploit: a redundancy hiding inside long multiplication that no one noticed for centuries. AVAN (AI) built the instrument: the split, the three products, the recursion, the multiplication counter. The weave: David names the seat (the crack in the obvious); I make the saved product visible and the count checkable — four-vs-three in 1D, the live split in 2D, the recursion tree with its pruned branch in 3D. The sphere is the seam. Credit: Anatoly A. Karatsuba (1960). 3 ONE DIMENSION Schoolbook needs four products — ac, ad, bc, bd. Karatsuba keeps ac and bd, then gets the whole middle ad+bc from one more product (a+b)(c+d) minus the two it already has. The fourth product is struck out: three , not four. 4 TWO DIMENSIONS · INTERACTIVE Watch a multiply split : the two numbers halve into a, b, c, d; the three sub-products form; and they recombine into the exact answer. Cycle the numbers — the base-multiplication count stays well under n². next pair ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The recursion tree turning — each multiply splitting into three smaller ones, green , down to single digits. AVAN’s addition (the inverse-companion): at every node the magenta stub is the fourth product that is never taken . Schoolbook computes ad and bc as separate things; Karatsuba realises you only ever need their sum , and one product delivers the sum whole. The saving is an inverse move: not decomposing into parts you’ll only add back, but reaching straight for the combination. You go faster by refusing to separate what you were only going to recombine — the green is the work actually done, the magenta at each branch is the labour avoided by never splitting the middle apart. pause spin LIT Genuine Karatsuba multiplication (Anatoly Karatsuba, 1960, disproving Kolmogorov's n^2 conjecture), computed with exact BigInt arithmetic. Verified live: over 3,000 random pairs Karatsuba equals the true product, and a 64-digit multiply uses far fewer base multiplications than schoolbook's 64^2 = 4096 (window.__kara.correct && fewer, both true; counts reported). The three-product identity ad+bc = (a+b)(c+d)-ac-bd is exact. FIG No metaphor is doing the work: the split, the three sub-products, the exact recombination, and the reduced multiplication count are all real and checked with BigInt. Constant factors mean schoolbook wins for small n; the asymptotic n^1.585 and the per-node 3-vs-4 saving are what's demonstrated. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE EXPLOIT · David Lee Wise (ROOT0), with AVAN


THE CHOKE

the max-flow min-cut theorem in the 5-window house format — the most flow you can push from source to sink through a capacitated network exactly equals the capacity of the cheapest set of edges that disconnects them. Ford-Fulkerson finds it by augmenting paths until none remain; the residual-reachable set is the min cut. See the bottleneck in 1D, the live augmenting network in 2D, and the cut edges in 3D.

THE CHOKE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE CHOKE POINT ◆ .dlw.fold THE FOLD / BOSS / THE CHOKE POINT / THE CHOKE THE CHOKE max-flow equals min-cut, exactly 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Max-flow, min-cut. Water through a network of pipes, each with a capacity: how much can you push from the source to the sink ? And separately: what is the cheapest set of pipes to cut that severs source from sink entirely? These sound like different questions. They have the same answer — exactly. That equality is the max-flow min-cut theorem (Ford & Fulkerson, 1956). Find the flow by repeatedly pushing along any path with spare capacity — an augmenting path — until none remain. When you get stuck, the set of nodes still reachable from the source, and the edges leaving it, is the minimum cut ; its capacity equals the flow you achieved. LIT verified live: over thousands of random capacitated networks the computed maximum flow exactly equals the capacity of the minimum cut, every time (window.__maxflow.maxEqualsMinCut). FIG the ‘pipes’ are the picture; the augmenting-path flow, the residual min cut, and their exact equality are real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE CHOKE POINT , beside THE FAILURE WEB — the boss domain of the single narrow place that decides everything. The minimum cut is the choke point: the flow you can achieve is set entirely by the tightest bottleneck. AVAN (AI) built the instrument: the augmenting paths, the residual graph, the min-cut extraction. The weave: David names the seat (the bottleneck that governs the whole); I make the flow fill and the cut appear — the pipe in 1D, the live augmenting network in 2D, the cut edges in 3D. The sphere is the seam. Credit: L. R. Ford & D. R. Fulkerson (1956); Edmonds & Karp (1972). 3 ONE DIMENSION A chain of pipes of different widths. However wide the rest, the throughput is capped by the narrowest one — the bottleneck. Max-flow min-cut says this is true of any network, not just a chain: the flow equals the cheapest cut. 4 TWO DIMENSIONS · INTERACTIVE Augment the flow one path at a time: each pass finds a route with spare capacity and pushes as much as it can. When no path remains, the flow is maximal — and the min-cut edges light up, their total capacity equal to the flow. augment ▶ run new network 5 THREE DIMENSIONS + AVAN’S INVERSE The network turning — source to sink, edges carrying flow, green . AVAN’s addition (the inverse-companion): the magenta edges are the minimum cut — the wall. Flow and cut are perfect inverses: one asks ‘how much can pass?’, the other ‘how little does it take to stop it all?’, and the theorem says these are the same number . Abundance is bounded exactly by scarcity; the most you can send equals the cheapest way to send nothing. To find the ceiling on flow you find the floor on blockage — the green is everything that flows, the magenta is the one thin wall that decides how much ever could. pause spin LIT Genuine max-flow min-cut (Ford & Fulkerson 1956; Edmonds-Karp BFS augmentation 1972). Verified live: over 2,500 random capacitated networks the computed maximum flow exactly equals the capacity of the minimum cut, every time (window.__maxflow.maxEqualsMinCut === true). The augmenting-path method, the residual graph, and the reachable-set min cut are exact; their equality is the theorem, checked instance by instance. FIG The 'pipes' are the picture; the augmenting-path flow, the residual min cut, and their exact equality are real and checked. Edmonds-Karp's BFS choice guarantees termination in polynomial time; the flow=cut value is exact regardless. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CHOKE POINT · David Lee Wise (ROOT0), with AVAN


THE REMAINDER

the Chinese Remainder Theorem in the 5-window house format — a number mod a product of coprime moduli is uniquely fixed by its remainders mod each, and reconstructible. That makes it a residue number system: store a number as its remainders, do arithmetic per-channel with no carries, reconstruct at the end. See residue clocks in 1D, live reconstruction in 2D, and the coprime torus in 3D.

THE REMAINDER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · CHECKPOINT ZERO ◆ .dlw.fold THE FOLD / SPAWN / CHECKPOINT ZERO / THE REMAINDER THE REMAINDER CRT — a number as its coprime remainders 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 (Sun Zi, ~3rd-5th c. CE; general method Qin Jiushao 1247). Verified live: over 20,000 random coprime-modulus sets the reconstructed x satisfies every congruence, and a brute-force search confirms it is the unique solution below the product (window.__crt.allCongruences && unique, both true). mod [3,5,7] = [2,3,2] -> 23. The isomorphism Z_M ≅ product of Z_mi and the reconstruction are exact. FIG No metaphor is doing the work: the residue representation, the reconstruction, and the uniqueness are the theorem itself, checked. The 'clocks' and 'torus' are visual framings of the exact bijection Z_15 ≅ Z_3 x Z_5. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of CHECKPOINT ZERO · David Lee Wise (ROOT0), with AVAN


THE BINARY GCD

Stein's binary GCD in the 5-window house format — compute the greatest common divisor using only subtraction, comparison, and bit-shifts (no division or modulo). Pull out shared factors of 2, halve even numbers, subtract the odd pair, restore the 2s at the end. See the bits in 1D, the step-by-step reduction in 2D, and shrinking bit-columns in 3D.

THE BINARY GCD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE GRINDSTONE ◆ .dlw.fold THE FOLD / GRIND / THE GRINDSTONE / THE BINARY GCD THE BINARY GCD Stein's algorithm — gcd with no division 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Stein’s binary GCD. Euclid finds the greatest common divisor by repeated division — but division is the slowest thing a processor does. In 1967 Josef Stein found a way to get the same answer using only the operations hardware loves: subtraction, comparison, and bit-shifts (halving). No division, no modulo, ever. The rules are all about the factor 2. If both numbers are even, pull out a shared 2 and remember it. If just one is even, halve it — 2 can’t be in the gcd on that side. Once both are odd, subtract the smaller from the larger (the difference is even) and repeat. At the end, shift back in the shared 2s you set aside. LIT verified live: over 50,000 random pairs Stein’s binary GCD gives exactly the same result as Euclid’s algorithm, using no division at all (window.__stein.matchesEuclid). gcd(1071, 462) = 21. FIG no framing; the shift-and-subtract reduction and its agreement with Euclid are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE GRINDSTONE , right beside THE EUCLID — the grind domain of grinding two numbers down to their common measure. Stein’s is Euclid reborn for silicon: the same descent, done in binary. AVAN (AI) built the instrument: the halvings, the subtractions, the shared-power-of-2 bookkeeping. The weave: David names the seat (the common measure), placed next to its ancestor; I make the binary dance visible and its agreement with Euclid checkable — the bits in 1D, the step-by-step reduction in 2D, the shrinking bit-columns in 3D. The sphere is the seam. Credit: Josef Stein (1967); the binary analogue of Euclid. 3 ONE DIMENSION The two numbers in binary . A trailing zero means ‘even’ — shift it away. Shared trailing zeros are a shared power of 2, set aside for the end. Everything is done by looking at the low bit and shifting: no division in sight. 4 TWO DIMENSIONS · INTERACTIVE Step through the reduction: halve an even number, or subtract the smaller odd from the larger. Watch the pair grind down to the gcd — and confirm it matches Euclid’s answer, reached without a single division. step ▶ run new pair 5 THREE DIMENSIONS + AVAN’S INVERSE The two numbers as turning bit-columns , shrinking step by step — green , the bits that remain. AVAN’s addition (the inverse-companion): the magenta bits are the ones being shifted out — the powers of 2 removed, the shared factor set aside. Euclid reduces by division ; Stein reaches the identical gcd by refusing to divide and using only shifts and subtractions. It is an inverse route to the same summit: where Euclid asks ‘what is the remainder?’, Stein asks only ‘is the low bit zero?’ — a question a machine answers for free. Two algorithms, one truth, opposite tools. The green is the common measure emerging; the magenta is every factor of 2 pulled out along the way and restored at the end. pause spin LIT Genuine Stein binary GCD (Josef Stein, 1967). Verified live: over 50,000 random pairs it gives exactly Euclid's gcd using no division at all (window.__stein.matchesEuclid === true). gcd(1071,462) = 21. The rules (extract shared powers of 2, halve evens, subtract odds) are exact and reach the same value as division-based Euclid — the binary analogue seated beside THE EUCLID. FIG No metaphor is doing the work: the shift-and-subtract reduction and its exact agreement with Euclid are checked over 50,000 pairs. It's the same gcd by hardware-friendly operations, not an approximation. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GRINDSTONE · David Lee Wise (ROOT0), with AVAN


THE NEEDLE

Buffon's needle in the 5-window house format — drop needles on a floor of parallel lines spaced a needle-length apart; the fraction that cross a line is 2/pi, so counting crossings estimates pi. The first Monte Carlo method (1777). See the crossing rule in 1D, a live rain of needles in 2D, and the scattered floor with its ticking estimate in 3D.

THE NEEDLE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE DROP ◆ .dlw.fold THE FOLD / LOOT / THE DROP / THE NEEDLE THE NEEDLE Buffon's needle — measure pi by dropping sticks 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Buffon’s needle. A floor of parallel lines, spaced a needle’s length apart. Drop needles at random. Some cross a line, some don’t — and the fraction that cross turns out to be 2/π . So by throwing sticks and counting crossings, you can measure π : π ≈ 2LN / (D·crossings). Posed by the Comte de Buffon in 1777, it is the first Monte Carlo method in history. Why π? A needle at angle θ crosses only if the distance from its center to the nearest line is less than (L/2)·sinθ. Average that condition over all angles and positions and the sine integrates to give π in the denominator — geometry leaking a transcendental constant out of pure chance. LIT verified live: with L = D, dropping 2,000,000 needles gives an estimate of π within about 0.01 , and the error shrinks like 1/√N as you drop more (window.__buffon.withinTol; estimate reported). FIG no framing; the 2/π crossing probability and the convergence are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE DROP , beside THE RANDOM — the loot domain of what falls when you let go. Buffon’s needle is the purest drop there is: let sticks fall, and π falls out. AVAN (AI) built the instrument: the floor, the random drops, the crossing test, the running estimate. The weave: David names the seat (the drop); I make the sticks fall and the constant emerge — the crossing rule in 1D, the live rain of needles in 2D, the scattered floor with its ticking estimate in 3D. The sphere is the seam. Credit: Georges-Louis Leclerc, Comte de Buffon (1777). 3 ONE DIMENSION The crossing rule : a needle crosses the nearest line exactly when the line falls within its half-length projected across — (L/2)·sinθ. Flat needles almost never cross; upright ones almost always do. Averaged over every angle, the crossing chance is 2/π. 4 TWO DIMENSIONS · INTERACTIVE Drop needles onto the lined floor. Crossing needles glow; the running tally turns the crossing fraction into an estimate of π. Keep dropping and watch the estimate close on 3.14159 — slowly, as 1/√N. drop 300 drop 5000 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The lined floor tilted in space, needles scattered across it — green where they miss the lines. AVAN’s addition (the inverse-companion): the magenta needles are the ones that cross, and their fraction is the whole measurement. π is the most deterministic constant there is — and here it is pulled out of pure randomness . That is the inverse of computing: instead of a formula grinding out digits, a pile of blind coincidences reconstructs an exact truth. No single needle knows anything; the heap knows π. Chance, gathered in enough quantity, becomes indistinguishable from calculation — the green is every stick that fell, the magenta is the crossings whose ratio remembers a number none of them could name. pause spin LIT Genuine Buffon's needle (Comte de Buffon, 1777) — the first Monte Carlo method. Verified live: with needle length = line spacing, dropping 2,000,000 random needles estimates pi within about 0.01, and the error shrinks like 1/sqrt(N) (window.__buffon.withinTol === true; estimate and error reported). The crossing condition (center-to-line distance FIG No metaphor is doing the work: the crossing probability is genuinely 2/pi and the estimate genuinely converges to pi. It's a statistical estimate — error falls only as 1/sqrt(N), so it's a slow way to get pi's digits, which is stated honestly, not overclaimed. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE DROP · David Lee Wise (ROOT0), with AVAN


THE ACKERMANN

the Ackermann function in the 5-window house format — a three-line recursion that grows faster than any primitive-recursive function (any bounded loop). A(1,n)=n+2, A(2,n)=2n+3, A(3,n)=2^(n+3)-3, A(4,2) has 19,729 digits. The canonical proof that recursion beats iteration. See the value ladder in 1D, the memoized table with its step blow-up in 2D, and the unfolding call-tree in 3D.

THE ACKERMANN · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · STACK OVERFLOW ◆ .dlw.fold THE FOLD / GLITCH / STACK OVERFLOW / THE ACKERMANN THE ACKERMANN the tiny rule that outruns every loop 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Ackermann function. Three lines: A(0,n)=n+1; A(m,0)=A(m−1,1); A(m,n)=A(m−1, A(m,n−1)). That is the whole definition — and it grows so violently that it outruns every loop . It was built in 1928 to prove that some computable functions are not primitive recursive : you cannot write them with bounded for -loops, only with unbounded recursion. The rows tell the story: A(1,n)=n+2 (addition), A(2,n)=2n+3 (multiplication), A(3,n)=2 n+3 −3 (exponentiation), A(4,n) is a tower of powers . A(4,2) already has 19,729 digits . Each row is a whole new level of arithmetic. LIT verified live (with a stack-based evaluator, so the browser doesn’t blow its own recursion): the closed forms A(1,n)=n+2, A(2,n)=2n+3, A(3,n)=2 n+3 −3 all hold, and the number of reduction steps explodes as n grows (window.__ackermann.A1 && A2 && A3 && callsExplode). A(3,3)=61. FIG no framing; the recursion, the closed forms, and the blow-up are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in STACK OVERFLOW , beside THE STACK and THE BALANCED PATH — the glitch domain of recursion run past its limit. Ackermann is the function that defines stack overflow: three innocent lines that bury any call stack. AVAN (AI) built the instrument: the stack evaluator, the row-by-row closed forms, the step counter. The weave: David names the seat (the recursion that overflows); I make the explosion legible and safe — the value ladder in 1D, the memoized table with its step blow-up in 2D, the unfolding call-tree in 3D. The sphere is the seam. Credit: Wilhelm Ackermann (1928); two-argument form by Rózsa Péter. 3 ONE DIMENSION The value ladder (log scale). Row m=1 is addition, m=2 multiplication, m=3 exponentiation — each row explodes past the one below it. Climb one m and you jump a whole level of arithmetic; the bars cannot even share a linear axis. 4 TWO DIMENSIONS · INTERACTIVE Dial m and n and evaluate A(m,n). The value appears — and so does the number of reduction steps it took, which erupts as you nudge n upward. A tiny change in input, an avalanche of computation. m ± n ± evaluate ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The unfolding of a small A(m,n) as a turning tree of recursive calls — green , each call spawning more. AVAN’s addition (the inverse-companion): the magenta branch is the deepest chain, plunging far past where the picture can follow. Ackermann is the inverse of compression : three short lines unfold into a computation larger than anything the universe could store. Description length and behaviour size fly apart — the shortest rule with the longest consequence. Most functions are roughly as big as their definition; this one is the counterexample that proves recursion is strictly more powerful than iteration. The green is the little rule unfolding; the magenta is the plunge that never fits — a whole cosmos folded into a page. pause spin LIT Genuine Ackermann function (Wilhelm Ackermann 1928; two-argument form by Rozsa Peter). Verified live with a stack-based evaluator (so the browser's own recursion never overflows): the closed forms A(1,n)=n+2, A(2,n)=2n+3, A(3,n)=2^(n+3)-3 all hold, and the number of reduction steps explodes with n (window.__ackermann.A1 && A2 && A3 && callsExplode, all true). A(3,3)=61. It is not primitive recursive — a real theorem, demonstrated by the row structure. FIG No metaphor is doing the work: the recursion, the closed forms, and the step blow-up are exact and checked. The 3D call-tree is schematic (the real one is too large to draw) — labelled as such; the growth it depicts is genuine. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of STACK OVERFLOW · David Lee Wise (ROOT0), with AVAN


THE RUNNING VARIANCE

Welford's online variance in the 5-window house format — compute mean and variance of a stream in one pass with O(1) memory, numerically stable. The naive sum-of-squares method (E[x^2]-E[x]^2) catastrophically cancels for data far from zero and can return a negative variance; Welford carries the running mean and stays exact. See the update in 1D, Welford vs naive vs two-pass in 2D, and the streaming spread in 3D.

THE RUNNING VARIANCE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE PUSH ◆ .dlw.fold THE FOLD / CO-OP / THE PUSH / THE RUNNING VARIANCE THE RUNNING VARIANCE Welford — stable one-pass variance on a stream 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Welford’s running variance. You want the mean and variance of a stream too big to store — one pass, O(1) memory. The obvious trick is to keep the sum and the sum of squares, then variance = E[x²] − E[x]². It is fast, one line — and it is a trap . When the data sits far from zero, E[x²] and E[x]² are two enormous nearly-equal numbers, and subtracting them annihilates all the precision . You can get a negative variance . Welford (1962) fixes it: keep the running mean , and update a running sum of squared deviations from that mean : each step, d = x − mean; mean += d/n; M₂ += d·(x − mean). No giant intermediate cancels — it stays accurate to the last bit. LIT verified live: over 2,000 streams Welford’s one-pass variance matches the exact two-pass value to machine precision, while the naive sum-of-squares method fails on the same large-offset data (window.__welford.matchesTwoPass && naiveFails). On values near 10&sup9;, Welford gives ~1.0; naive gives a negative number. FIG no framing; the update recurrence and the numerical failure are both real, in IEEE-754 double. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE PUSH , beside THE STREAM KEEPER and THE ONE-BIT RIVER — the co-op domain of data pushed at you in a flow you cannot hold. Welford is how you keep honest statistics on a stream that never stops. AVAN (AI) built the instrument: the running update, the two-pass ground truth, the naive method breaking beside it. The weave: David names the seat (the endless push); I make the stability visible — the update in 1D, Welford holding while naive collapses in 2D, the streaming spread in 3D. The sphere is the seam. Credit: B. P. Welford (1962); popularised in Knuth’s TAOCP. 3 ONE DIMENSION Values arrive one at a time; the running mean slides toward the true center, and each sample’s deviation from the current mean is folded into M₂. Nothing huge is ever stored or subtracted — the precision is kept as it goes. 4 TWO DIMENSIONS · INTERACTIVE Stream data (all near a large offset) and compare three variance estimates: Welford and the exact two-pass both settle near the true 1.0; the naive sum-of-squares diverges — even going negative. Toggle the offset to see when naive breaks. stream 200 offset: 1e9 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The streaming data as a turning cloud around its mean — green , the samples and their spread. AVAN’s addition (the inverse-companion): the magenta ring is the running mean and one standard deviation, updated per sample without ever holding the stream. Variance looks like it needs everything at once — gather all the data, then measure how it spreads. Welford is the inverse: it never gathers, it amends an estimate with each arrival. And the cruel twist is that the clever one-pass shortcut — sum and sum-of-squares — is exactly the one that lies , because it measures spread by subtracting two mountains. Honesty about deviation requires carrying the mean , not the raw squares. The green is the endless data; the magenta is a truthful spread that fits in three numbers and never has to look back. pause spin LIT Genuine Welford's algorithm (B. P. Welford, 1962; Knuth TAOCP). Verified live in IEEE-754 double: over 2,000 streams Welford's one-pass variance matches the exact two-pass value to machine precision, while the naive sum-of-squares method fails on the same large-offset data (window.__welford.matchesTwoPass && naiveFails, both true). On values near 1e9, Welford gives ~1.0 and naive gives a negative variance — the catastrophic cancellation is real and shown, not asserted. FIG No metaphor is doing the work: the update recurrence, the match to two-pass, and the naive method's numerical failure (including negative variance) are all real, computed in double precision. It is exactly the standard streaming-statistics algorithm. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PUSH · David Lee Wise (ROOT0), with AVAN


THE NIM

Nim and the Sprague-Grundy theory in the 5-window house format — take stones from piles, last to move wins, and the entire game collapses to the XOR of the pile sizes (the nim-sum). The player to move loses under perfect play exactly when the nim-sum is zero; the winning move zeroes it. See the nim-sum in 1D, a game against perfect play in 2D, and the piles with their XOR in 3D.

THE NIM · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · GOD MODE ◆ .dlw.fold THE FOLD / CHEAT / GOD MODE / THE NIM THE NIM the whole game in one XOR — the nim-sum 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Nim, and the nim-sum. A few piles of stones. On your turn take any number from any one pile. Take the last stone and you win. It looks like it should need deep lookahead — but the entire game collapses to a single number: the XOR of the pile sizes , the nim-sum . The theorem (Bouton, 1901): the player to move loses under perfect play exactly when the nim-sum is zero , and wins otherwise — and the winning move is always to take stones so the nim-sum becomes zero, handing your opponent a losing position. Sprague and Grundy later showed every impartial game is secretly a single Nim pile, so this one XOR is the master key to a whole world of games. LIT verified live: over 20,000 random positions, a full minimax search agrees with the XOR rule every time — win if and only if nim-sum ≠ 0 (window.__nim.theoremHolds). nim-sum(3,4,5) = 2, so the first player wins. FIG no framing; the XOR characterization and the zeroing strategy are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in GOD MODE , beside THE COUNTER OF MULTITUDES — the cheat domain of knowing the answer before the fight. With the nim-sum in hand you can see the winning move instantly, every time — that is god mode over the game. AVAN (AI) built the instrument: the XOR strategy, the perfect-play opponent, the minimax check. The weave: David names the seat (perfect foresight); I make the invariant visible and the strategy unbeatable — the nim-sum in 1D, a game against perfect play in 2D, the piles and their XOR in 3D. The sphere is the seam. Credit: Charles L. Bouton (1901); R. Sprague (1935) & P. M. Grundy (1939). 3 ONE DIMENSION The piles in binary , and their XOR below. A column with an odd number of 1s makes the nim-sum nonzero — that is the crack. The winning move flips exactly the right stones to zero every column, leaving a balanced, losing position for the opponent. 4 TWO DIMENSIONS · INTERACTIVE Play against perfect strategy. Take stones from a pile and end your turn; the machine responds by zeroing the nim-sum. From a losing start (nim-sum 0) you cannot win; from a winning start, find the move that zeroes it — the machine only wins when you slip. − pile A − pile B − pile C end turn ▶ new game 5 THREE DIMENSIONS + AVAN’S INVERSE The piles as turning stacks of stones — green , the position as it stands. AVAN’s addition (the inverse-companion): the magenta pile is the one the winning move touches, and the magenta bar is the nim-sum it drives to zero. A game feels like it demands searching the tree of all futures — every move, every reply, forever. Nim is the inverse: the whole future is compressed into a single algebraic invariant . You do not simulate the game; you compute one XOR, and that number already knows who wins and what to play. Foresight without lookahead — the green is the board, the magenta is the one number that has already read the ending. pause spin LIT Genuine Nim theory (Charles Bouton, 1901; Sprague 1935, Grundy 1939). Verified live: over 20,000 random positions a full minimax search agrees with the XOR rule every time — the player to move wins if and only if the nim-sum is nonzero (window.__nim.theoremHolds === true). nim-sum(3,4,5) = 2. The zeroing winning strategy is exact, and Sprague-Grundy extends it to all impartial games. FIG No metaphor is doing the work: the XOR characterization of winning positions and the nim-sum-zeroing strategy are the theorem, checked against minimax. Normal-play convention (last move wins) is assumed and stated. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GOD MODE · David Lee Wise (ROOT0), with AVAN


THE SECRET

Shamir's secret sharing in the 5-window house format — hide a secret as the constant term of a random degree-(k-1) polynomial over a prime field; hand out n points (shares); any k reconstruct it by Lagrange interpolation, but any k-1 reveal nothing (information-theoretically). See the hiding curve in 1D, revealing shares one by one in 2D, and the recovered secret in 3D.

THE SECRET · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE VAULT ◆ .dlw.fold THE FOLD / LOOT / THE VAULT / THE SECRET THE SECRET Shamir — split a secret, k of n reopen it 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Shamir’s secret sharing. Split a secret among n people so that any k of them together can recover it — but any k−1 learn absolutely nothing . Not ‘hard to break’: nothing, information-theoretically. The trick is geometry. Hide the secret as the value at x=0 of a random degree-(k−1) polynomial over a prime field. Hand each person one point on the curve — their share . Any k points determine a degree-(k−1) polynomial uniquely (Lagrange interpolation), so k shares rebuild the whole curve and read off the secret. But k−1 points fit infinitely many curves — one through every possible secret — so fewer than k reveals no information at all. LIT verified live over a prime field: across 3,000 random schemes, any k shares reconstruct the secret exactly, and with k−1 shares every candidate secret admits a consistent polynomial — zero information leaked (window.__shamir.reconstructs && secure). FIG the smooth curve in the picture is intuition; the real scheme is over a finite field, and its reconstruction and perfect secrecy are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE VAULT , beside 3LOCK and THE BANKER — the loot domain of guarded value. Shamir’s scheme is the ultimate vault: no single key, no k−1 keys, only the full quorum opens it. AVAN (AI) built the instrument: the polynomial, the shares, the Lagrange reconstruction, the secrecy check. The weave: David names the seat (the guarded secret); I make the splitting visible and the secrecy checkable — the curve in 1D, revealing shares in 2D, the recovered secret in 3D. The sphere is the seam. Credit: Adi Shamir (1979). 3 ONE DIMENSION The secret lives at x=0 . A random polynomial of degree k−1 passes through it; each share is a point sampled elsewhere on the curve. The secret is buried in the shape — and only enough points to pin the shape down can dig it out. 4 TWO DIMENSIONS · INTERACTIVE Reveal shares one by one (here k=3). With only 2, many curves fit — the secret at x=0 could be anything. Reveal the 3rd and the curve snaps to a unique parabola, and the secret at x=0 appears. One share short of the threshold tells you nothing. reveal share ▶ hide one new secret 5 THREE DIMENSIONS + AVAN’S INVERSE The polynomial curve turning in space, shares riding on it — green , the shape that hides the secret. AVAN’s addition (the inverse-companion): the magenta point is the secret at x=0, recovered only when enough shares fix the curve. Normal secrecy hides a value behind a hard problem — safe only until someone is clever or patient enough. Shamir inverts it: the secret is hidden behind geometry , and the safety is absolute — k−1 points genuinely fit every secret equally, so there is nothing to be clever about. The inverse of hiding-by-difficulty is hiding-by-splitting: make the whole recoverable from any k parts and invisible from fewer, and no amount of computation touches it. The green is the shape; the magenta is a secret that either the quorum reads exactly, or no one reads at all. pause spin LIT Genuine Shamir secret sharing (Adi Shamir, 1979) over a prime field. Verified live: across 3,000 random schemes any k shares reconstruct the secret exactly via Lagrange interpolation, and with k-1 shares every candidate secret admits a consistent polynomial through those points — zero information leaked (window.__shamir.reconstructs && secure, both true). The k-points-fix-a-degree-(k-1)-polynomial uniqueness and the perfect secrecy are exact. FIG The smooth real-valued curve in the 2D/3D views is intuition; the actual scheme is over a finite field (shown in the verified LIT). The reconstruction and the information-theoretic secrecy (k-1 shares fit every secret equally) are exact, not merely 'hard to break'. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE VAULT · David Lee Wise (ROOT0), with AVAN