THE SCHEDULE

topological sort via Kahn's algorithm in the 5-window house format — order tasks so every dependency comes before what needs it, by repeatedly harvesting tasks with no remaining prerequisites (in-degree 0). It works iff the dependency graph is acyclic; a leftover means a cycle. See the linear schedule in 1D, the live DAG unravelling in 2D, and the ready-frontier in 3D.

THE SCHEDULE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE CRON JOB ◆ .dlw.fold THE FOLD / GRIND / THE CRON JOB / THE SCHEDULE THE SCHEDULE topological sort — order tasks by dependency 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Topological sort. You have tasks with dependencies: compile before link, wake before walk, pour the foundation before the walls. In what order can everything be done so nothing starts before its prerequisites? That order is a topological sort of the dependency graph. Kahn’s algorithm (1962) is disarmingly simple: repeatedly take any task with no remaining prerequisites (in-degree 0), do it, and remove it — freeing whatever depended on it. Keep harvesting the free tasks until none remain. If tasks are left over but none is free, the dependencies contain a cycle — an impossible schedule, and the algorithm reports it. LIT verified live: over thousands of random directed acyclic graphs Kahn produces an order in which every edge points forward (no task before its prerequisite), and it flags a valid order if and only if the graph is truly acyclic (window.__topo.validOrder && cycleDetection). FIG the ‘tasks’ are the picture; the forward-edge guarantee and the cycle detection are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE CRON JOB , beside THE PERMUTATION CLOCK — the grind domain of jobs that must run in the right order. Topological sort is the scheduler’s backbone: build systems, package managers, spreadsheets all live on it. AVAN (AI) built the instrument: the in-degree harvest, the order, the cycle alarm. The weave: David names the seat (the ordered job run); I make the peeling visible and the guarantee checkable — the linear schedule in 1D, the live DAG unravelling in 2D, the layered graph with its ready-frontier in 3D. The sphere is the seam. Credit: Arthur B. Kahn (1962). 3 ONE DIMENSION The finished schedule : tasks laid in a line so every dependency arrow points forward . Read left to right and you can execute them in that order — nothing ever waits on something to its right. 4 TWO DIMENSIONS · INTERACTIVE Step the harvest: each pass takes a task with no unmet prerequisites (glowing) and appends it to the schedule, freeing its dependents. Add a back-edge to create a cycle and watch the algorithm refuse — no valid order exists. harvest ▶ run add cycle new graph 5 THREE DIMENSIONS + AVAN’S INVERSE The dependency graph turning — tasks and the arrows between them, green , a tangle of who-needs-what. AVAN’s addition (the inverse-companion): the magenta nodes are the ready frontier — everything currently free to run. A dependency web looks like it demands a grand plan: solve the whole tangle at once. The inverse is far simpler — never plan the whole thing, just repeatedly ask ‘ what can start now? ’ and take it. Peeling the free nodes unravels the knot on its own, and the only way to get stuck is a cycle — a genuine contradiction, not a hard problem. Scheduling is not planning forward; it is harvesting what is already unblocked. The green is the tangle; the magenta is the ever-moving edge of the possible. pause spin LIT Genuine topological sort (Kahn's algorithm, 1962). Verified live: over 7,000 random graphs Kahn produces an order in which every edge points forward (no task before its prerequisite) on DAGs, and it yields a valid order if and only if the graph is acyclic (window.__topo.validOrder && cycleDetection, both true). The in-degree-0 harvest and the cycle detection (leftover nodes) are exact. FIG The 'tasks' are the picture; the forward-edge guarantee and the exact cycle detection are real and checked. Many valid orders can exist for one graph (Kahn returns one); the guarantee is that whatever it returns is valid, and that it returns nothing exactly when a cycle makes scheduling impossible. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CRON JOB · David Lee Wise (ROOT0), with AVAN


THE HEAP

the binary heap and heapsort in the 5-window house format — a complete binary tree (stored in an array; children of i at 2i+1, 2i+2) where every parent is <= its children, so the minimum is always at the root. Insert sifts up, extract-min sifts down, both O(log n); heapsort extracts all in order, in-place and O(n log n) worst case. See the array-as-tree in 1D, insert/extract in 2D, and the sift path in 3D.

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

THE HEAP · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE INVENTORY ◆ .dlw.fold THE FOLD / LOOT / THE INVENTORY / THE HEAP THE HEAP the partial order that always knows the smallest 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The binary heap. A priority queue that always hands you the smallest thing first, cheaply. It is a complete binary tree with one rule — every parent is ≤ both its children — and it lives in a plain array : the children of position i sit at 2i+1 and 2i+2, no pointers needed. The minimum is therefore always at the root , free to read. Insert a value and let it sift up past larger parents; remove the min and drop the last leaf into the root and let it sift down — both O(log n). Heapsort just extracts the min over and over: an in-place, O(n log n) worst-case sort with no recursion and no extra memory. LIT verified live: over 20,000 random arrays the build produces a valid heap (every parent ≤ its children) and heapsort’s output exactly equals the sorted array (window.__heap.validHeap && sortEqualsSorted). [5,2,8,1,9,3] → [1,2,3,5,8,9]. FIG no framing; the parent≤child invariant, the array index rule, and the sort are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE INVENTORY , beside THE SORT and THE SKIP LIST — the loot domain of keeping your haul ordered and instantly reachable. A heap is the inventory that always surfaces the top item first. AVAN (AI) built the instrument: the sift-up, the sift-down, the extract loop, the heap check. The weave: David names the seat (the always-ready top item); I make the tree breathe and the invariant checkable — the array-as-tree in 1D, insert and extract in 2D, the sift path in 3D. The sphere is the seam. Credit: J. W. J. Williams (heap & heapsort, 1964); R. W. Floyd (O(n) build, 1964). 3 ONE DIMENSION The heap is just an array . Position i’s children are at 2i+1 and 2i+2 — the tree is implicit , drawn by arithmetic, not pointers. Every parent sits below its children in value; the smallest floats to index 0. 4 TWO DIMENSIONS · INTERACTIVE Insert a value and watch it sift up to its place; extract-min and watch the last leaf drop in and sift down. The root is always the minimum. Heapsort extracts them all in order — a sorted array falls out. + insert extract min ▶ heapsort reset 5 THREE DIMENSIONS + AVAN’S INVERSE The heap as a turning pyramid — green , each level holding values no smaller than the level above. AVAN’s addition (the inverse-companion): the magenta path is an element sifting to its place, swapping only with a parent or child. A fully sorted array is a total order — everything ranked against everything, expensive to maintain. A heap is the inverse bargain: keep only a partial order , parent above child, and nothing else — yet that thin skeleton is enough to always know the extreme for free. You do not sort to find the smallest; you maintain the least structure that keeps the smallest on top. The green is the loose hierarchy; the magenta is one value finding its rung without ever touching the rest. pause spin LIT Genuine binary heap and heapsort (J. W. J. Williams, 1964; Floyd's O(n) build, 1964). Verified live: over 20,000 random arrays the build produces a valid min-heap (every parent [1,2,3,5,8,9]. The array index rule and the sift-up/sift-down invariants are exact. FIG No metaphor is doing the work: the parent ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE INVENTORY · David Lee Wise (ROOT0), with AVAN


THE FAST POWER

exponentiation by squaring in the 5-window house format — compute a^b mod m in O(log b) multiplications by reading b in binary: keep squaring a (a, a^2, a^4, ...) and fold a copy into the answer only at the 1-bits of b. The engine under RSA and Diffie-Hellman. See the binary schedule in 1D, the live climb in 2D, and the accumulator gathering factors in 3D.

THE FAST POWER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · WARM CACHE ◆ .dlw.fold THE FOLD / GRIND / WARM CACHE / THE FAST POWER THE FAST POWER a^b mod m in log(b) steps — square and multiply 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Exponentiation by squaring. To compute a b (mod m), multiplying a by itself b times is hopeless when b is huge — and in cryptography b has hundreds of digits. The fix is ancient and beautiful: read b in binary and square-and-multiply . Keep squaring a — a, a², a⁴, a⁸, … — and fold a copy into the answer only at the bit positions where b has a 1. Because b has only about log₂(b) bits, you need only about log₂(b) squarings and a handful of multiplies — not b multiplications. It is the engine under RSA and Diffie–Hellman: raising numbers to enormous powers, cheaply. LIT verified live: over 30,000 random cases square-and-multiply gives exactly the same result as multiplying a out b times, using only O(log b) multiplications (window.__fastpow.matchesNaive). 7 1234567 mod 1000003 = 342904 — in 32 multiplications , where the naive way needs 1,234,567. FIG no framing; the binary schedule, the exact result, and the logarithmic count are real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in WARM CACHE , beside THE DIRECT DIGIT — the grind domain of never redoing work you already have. Each squaring is a cached partial power, reused; nothing is recomputed. AVAN (AI) built the instrument: the square-and-multiply schedule, the running accumulator, the count against naive. The weave: David names the seat (reuse, don’t recompute); I make the binary schedule visible and the saving checkable — the exponent’s bits in 1D, the live climb in 2D, the accumulator gathering factors in 3D. The sphere is the seam. Credit: binary exponentiation is ancient (Pingala’s Chandah-sutra, ~200 BCE); the workhorse of modern public-key cryptography. 3 ONE DIMENSION The exponent b in binary , and its square-and-multiply schedule: square at every step, multiply the running answer only where a bit is 1 . The number of steps is the number of bits — logarithmic, not linear. 4 TWO DIMENSIONS · INTERACTIVE Step through a b mod m: watch a square each pass (a, a², a⁴…) and get folded into the answer at every 1-bit of b. The multiplication count stays near log₂(b) — compare it to the b multiplications the naive way would take. a ± b ± step ▶ run 5 THREE DIMENSIONS + AVAN’S INVERSE The exponent’s binary ladder turning — green rungs, one per bit, each a successive squaring a 2 k . AVAN’s addition (the inverse-companion): the magenta rungs are the set bits , where the running answer picks up a factor. Multiplying b times treats the exponent as a count — a linear pile of identical steps. Square-and-multiply treats it as a number with structure : b is written in log(b) bits, so you climb by doubling , not by counting. The inverse of ‘repeat b times’ is ‘follow b’s binary shape’ — one squaring per digit, one multiply per 1. A tower of powers reached in the number of steps it takes just to write the exponent. The green is every doubling; the magenta is where the answer reaches in and takes what it needs. pause spin LIT Genuine binary exponentiation (ancient — Pingala's Chandah-sutra ~200 BCE; the workhorse of public-key cryptography). Verified live: over 30,000 random cases square-and-multiply gives exactly the same result as multiplying a out b times, using O(log b) multiplications (window.__fastpow.matchesNaive === true). 7^1234567 mod 1000003 = 342904 in 32 multiplications, where the naive method needs 1,234,567. The binary schedule and logarithmic count are exact. FIG No metaphor is doing the work: the square-and-multiply schedule, the exact result, and the logarithmic multiplication count are all real and checked against naive repeated multiplication. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of WARM CACHE · David Lee Wise (ROOT0), with AVAN


THE KAPREKAR

Kaprekar's routine and constant 6174 in the 5-window house format — take any 4-digit number (not all-same-digit), arrange its digits largest-first and smallest-first, subtract, repeat; you always reach 6174 within 7 steps, and 6174 maps to itself (7641-1467=6174). A genuine attractor discovered by D. R. Kaprekar in 1949. See one descent in 1D, the routine and its step-census in 2D, and all numbers streaming into 6174 in 3D.

THE KAPREKAR · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · EVENT HORIZON ◆ .dlw.fold THE FOLD / RESPAWN / EVENT HORIZON / THE KAPREKAR THE KAPREKAR 6174 — the number every 4-digit number falls into 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Kaprekar’s constant, 6174. Pick any four-digit number whose digits are not all the same. Arrange its digits largest-first and smallest-first , and subtract the small from the large. Repeat on the result. No matter where you start, you reach 6174 — and once there you stay, because 7641 − 1467 = 6174. It is a genuine attractor : a dead-simple map on digits with a single fixed point that swallows all 9,990 eligible numbers, always within seven steps . Discovered by the Indian schoolteacher D. R. Kaprekar in 1949, it is one of the most surprising little theorems in arithmetic — order emerging from a shuffle-and-subtract. LIT verified live: this page runs the routine on every four-digit number and confirms all reach 6174 (the 10 repeated-digit numbers excepted, which collapse to 0), in at most 7 iterations, and that 6174 maps to itself (window.__kaprekar.allReach6174 && maxSteps===7 && fixedPoint). FIG no framing; the convergence, the seven-step bound, and the fixed point are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in EVENT HORIZON , beside SINGULARITY and THE 4096 — the respawn domain of the point everything falls into. 6174 is a numerical singularity: cross the horizon of the routine and there is only one destination. AVAN (AI) built the instrument: the shuffle-and-subtract, the trajectory, the seven-step census. The weave: David names the seat (the inescapable sink); I make the fall visible and the theorem checkable — a single descent in 1D, the routine and its step-histogram in 2D, all numbers streaming into 6174 in 3D. The sphere is the seam. Credit: D. R. Kaprekar (1949). 3 ONE DIMENSION One number’s descent . Each step sorts the digits both ways and subtracts — and the sequence marches, in a handful of moves, straight into 6174, where it locks forever. 4 TWO DIMENSIONS · INTERACTIVE Step any starting number through the routine and watch it fall to 6174. The bar chart is the whole census: how many of the 9,990 numbers need 1, 2, … 7 steps — not one needs more than seven. random start step ▶ run 5 THREE DIMENSIONS + AVAN’S INVERSE Four-digit numbers as a turning cloud, their trajectories spiralling inward — green streams of falling values. AVAN’s addition (the inverse-companion): the magenta heart is 6174 , the sink. Numbers are supposed to be diverse — ten thousand different four-digit strings, each its own thing. This one routine is the inverse: a universal funnel that erases the difference. A deterministic map with a single attracting fixed point captures every eligible number and gives them all the same destiny in at most seven moves. Individuality collapses into a constant; the inverse of variety is a shared fate. The green is ten thousand different beginnings; the magenta is the one ending they cannot avoid. pause spin LIT Genuine Kaprekar's constant (D. R. Kaprekar, 1949). Verified live: the routine is run on every 4-digit number and all reach 6174 (the 10 repeated-digit numbers excepted, which go to 0), in at most 7 iterations, and 6174 is a fixed point (window.__kaprekar.allReach6174 && maxSteps === 7 && fixedPoint, all true). The convergence, the exact seven-step bound, and the fixed point are checked exhaustively, not asserted. FIG No metaphor is doing the work: the shuffle-and-subtract routine, the universal convergence to 6174, and the seven-step maximum are all real and checked across all 10,000 numbers. Calling 6174 a 'singularity/sink' is the only framing; it is a genuine unique attracting fixed point. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of EVENT HORIZON · David Lee Wise (ROOT0), with AVAN


THE CELLS

the Voronoi diagram in the 5-window house format — partition the plane so each cell is the region closest to one site, with boundaries the perpendicular bisectors between neighbours. A hidden characterization: lift each site to a tilted plane and the nearest site is the one whose plane is highest, so the diagram is the projection of an upper envelope. See sites on a line in 1D, click-to-add cells in 2D, and the lifted cones in 3D.

THE CELLS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE WALL ◆ .dlw.fold THE FOLD / BOSS / THE WALL / THE CELLS THE CELLS Voronoi — the map of the nearest thing 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Voronoi diagram. Scatter some sites — cell towers, post offices, seeds. Now colour every point of the plane by which site is nearest . The plane shatters into cells , one per site, their boundaries the perpendicular bisectors between neighbours. It is the fundamental map of ‘nearest thing’, underlying mesh generation, nearest-neighbour search, even how the eye’s cones tile the retina. There is a beautiful hidden characterization: lift each site into a tilted plane (the paraboloid lifting), and the nearest site to any point is exactly the one whose plane is highest there. The whole diagram is the shadow of an upper envelope of planes — flat geometry as the projection of something one dimension up. LIT verified live: over 20,000 random points and site sets, the nearest site (by distance) equals the highest lifted plane every time — an independent re-derivation — and every boundary point is equidistant from its two sites (window.__voronoi.nearestEqualsHighestPlane && edgeEquidistant). FIG no framing; the nearest-site partition and the lifting equivalence are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE WALL , beside THE HULL — the boss domain of the boundary that divides. Voronoi cells are the fairest walls there are: every border is exactly halfway between two sites. AVAN (AI) built the instrument: the nearest-site colouring, the boundaries, the lifting check. The weave: David names the seat (the dividing wall); I make the partition visible and the lifting checkable — sites on a line in 1D, the click-to-add cells in 2D, the lifted envelope in 3D. The sphere is the seam. Credit: Georgy Voronoy (1908); Dirichlet and Descartes earlier. 3 ONE DIMENSION Sites on a line : each point belongs to the nearest site, so the line splits into intervals at the midpoints between neighbours. In one dimension the Voronoi ‘cells’ are just segments — the same rule that tiles the plane. 4 TWO DIMENSIONS · INTERACTIVE Click to drop a new site and watch the cells re-tile around it — every pixel recoloured to its nearest site, the white borders always halfway between neighbours. Each cell is convex, an intersection of half-planes. + random site new sites 5 THREE DIMENSIONS + AVAN’S INVERSE The lifted picture, turning: each site becomes a cone of distance rising from the plane — green , the landscape of ‘how far to this site’. AVAN’s addition (the inverse-companion): the magenta creases are where cones cross — the Voronoi edges. A diagram of flat boundaries looks like hard 2D geometry, edge by fussy edge. The inverse view lifts it: put a cone (or a tilted plane) over each site, take the lower envelope , and look straight down — the partition falls out as a projection . The boundaries you struggled to draw in the plane are just the shadows of ridges one dimension up. Complexity flattened into a picture is often simplicity seen from the wrong height. The green is the cones; the magenta is the ridgeline whose shadow is the wall. pause spin LIT Genuine Voronoi diagram (Georgy Voronoy, 1908). Verified live: over 20,000 random points and site sets the nearest site by distance equals the highest lifted plane every time — an independent re-derivation via the paraboloid lifting — and every bisector point is equidistant from its two sites (window.__voronoi.nearestEqualsHighestPlane && edgeEquidistant, both true). The nearest-site partition, convex cells, and the lifting equivalence (argmin dist == argmax plane) are exact. FIG No metaphor is doing the work: the nearest-site colouring, the perpendicular-bisector boundaries, and the lifting equivalence are all real and checked. The 2D cells are rendered per-pixel by exact nearest-site; the 3D cones illustrate the lifting the LIT verifies. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE WALL · David Lee Wise (ROOT0), with AVAN


THE BEZIER

Bezier curves and de Casteljau's algorithm in the 5-window house format — a smooth curve shaped by control points, evaluated by nothing but repeated linear interpolation: lerp each adjacent pair at t, then those, until one point remains — the curve point. Equivalent to the Bernstein polynomial, and numerically stable. See the blend ladder in 1D, the live construction in 2D, and the collapsing lines in 3D.

THE BEZIER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE HANDOFF ◆ .dlw.fold THE FOLD / CO-OP / THE HANDOFF / THE BEZIER THE BEZIER de Casteljau — a smooth curve from pure averaging 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Bézier curves and de Casteljau’s algorithm. Every letter you read, every vector shape, every animation ease-curve is a Bézier : a smooth curve pulled into shape by a handful of control points . But how do you find a point on the curve at parameter t? De Casteljau’s answer (1959) uses nothing but repeated linear interpolation . Lerp between each pair of consecutive control points at fraction t — that gives one fewer point. Lerp those. Again. When a single point remains, it is exactly the curve point at t. No polynomial, no powers — just averaging, over and over. It is numerically rock-solid and equals the textbook Bernstein polynomial form exactly. LIT verified live: over 30,000 samples de Casteljau’s nested lerps agree with the Bernstein polynomial to 1e-7, and the curve passes exactly through its first and last control points (window.__bezier.matchesBernstein && endpointsExact). FIG no framing; the corner-cutting construction and its equivalence to the polynomial are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE HANDOFF , beside THE PLUCKED STRING — the co-op domain of passing smoothly from one to the next. A Bézier is a chain of handoffs: each lerp blends two points into one, and the cascade of blends is the curve. AVAN (AI) built the instrument: the nested lerps, the curve trace, the Bernstein check. The weave: David names the seat (the smooth handoff); I make the corner-cutting visible and the equivalence checkable — the blend ladder in 1D, the live construction in 2D, the collapsing lines in 3D. The sphere is the seam. Credit: Paul de Casteljau (1959, Citroën); Pierre Bézier (1960s, Renault). 3 ONE DIMENSION The blend ladder : start with the control points, lerp each adjacent pair at t to get one fewer, and repeat until a single point is left. Each rung is a round of corner-cutting; the last point rides the curve. 4 TWO DIMENSIONS · INTERACTIVE Slide t and watch de Casteljau build the point: the control polygon collapses through nested interpolations to a single point that traces the smooth curve. Click to move the nearest control point and reshape it. ◀ t t ▶ animate new shape 5 THREE DIMENSIONS + AVAN’S INVERSE The control polygon and its curve turning in space — green , the smooth path and the frame that shapes it. AVAN’s addition (the inverse-companion): the magenta lines are the de Casteljau construction at the current t, collapsing to the point on the curve. A curve is an infinity of points — you would think you need a polynomial, powers of t, real analysis. The inverse is startling: every point is built from the control points by nothing but repeated averaging — straight-line blends, no curves used to make a curve. Smoothness is not put in; it emerges from a cascade of linear handoffs. The green is the finished curve; the magenta is the little ladder of straight cuts that, run at every t, sweeps the whole of it into being. pause spin LIT Genuine de Casteljau / Bezier construction (Paul de Casteljau 1959; Pierre Bezier 1960s). Verified live: over 30,000 samples the nested-lerp de Casteljau result agrees with the Bernstein polynomial form to 1e-7, and the curve passes exactly through its first and last control points (window.__bezier.matchesBernstein && endpointsExact, both true). Corner-cutting by repeated averaging builds every curve point with no powers of t — shown, not asserted. FIG No metaphor is doing the work: the de Casteljau lerps, their equivalence to the Bernstein polynomial, and the endpoint interpolation are all real and checked. The curve genuinely emerges from straight-line blends only — a curve made without ever using a curve. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HANDOFF · David Lee Wise (ROOT0), with AVAN


THE DISCRETE LOG

baby-step giant-step in the 5-window house format — solve g^x = h mod p (the discrete logarithm, the hard inverse behind Diffie-Hellman) by meet-in-the-middle. Write x = i*m + j with m ~ sqrt(n); precompute a table of baby steps g^j, then scan giant steps h*g^(-im) for a table match. About 2*sqrt(n) work instead of n. See the split exponent in 1D, the table-and-scan in 2D, and the rendezvous grid in 3D.

THE DISCRETE LOG · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE RAID ◆ .dlw.fold THE FOLD / BOSS / THE RAID / THE DISCRETE LOG THE DISCRETE LOG baby-step giant-step — invert the exponent in root-n 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Baby-step giant-step. Raising g to a power mod p is easy (see THE FAST POWER). Going backward — given g and h, find the x with g x ≡ h (mod p) — is the discrete logarithm , the hard inverse that Diffie–Hellman leans on. Brute force tries all n possibilities. Shanks (1971) does far better with a meet-in-the-middle . Write the unknown as x = i·m + j with m ≈ √n. Precompute a table of baby steps g 0 , g 1 , …, g m−1 . Then take giant steps h·(g −m ) i and look each up in the table. A match means h·g −im = g j , so x = i·m + j . Only about 2√n operations instead of n — time bought with a table of space. LIT verified live: over 3,000 random instances BSGS recovers an x with g x ≡ h every time, in O(√n) work (window.__bsgs.recovers). 3 x = target mod 7919 → x = 1234. FIG the ‘steps’ are the picture; the exponent split, the table collision, and the √n cost are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE RAID , beside THE RHO — the boss domain of breaking a hard problem by cleverness. Pollard’s rho raids a number for a factor; baby-step giant-step raids an exponent for a logarithm — both cracking an inverse that is supposed to be hard. AVAN (AI) built the instrument: the baby table, the giant scan, the collision. The weave: David names the seat (the raid on the inverse); I make the meet-in-the-middle visible and the recovery checkable — the split exponent in 1D, the table-and-scan in 2D, the rendezvous grid in 3D. The sphere is the seam. Credit: Daniel Shanks (1971). 3 ONE DIMENSION The exponent split : x = i·m + j. The low part j is precomputed as a table of baby steps; the high part i is walked in giant strides. Two short searches of length √n meet where their values coincide — that meeting is x. 4 TWO DIMENSIONS · INTERACTIVE The baby-step table fills with g 0..m−1 . Then giant-step scans h·g −im , one stride at a time, checking the table — when a value is found, the collision gives x. New problem for a fresh g, h, p. giant step ▶ run new problem 5 THREE DIMENSIONS + AVAN’S INVERSE The search space as a turning √n × √n grid — green , one axis the baby steps (j), the other the giant steps (i). AVAN’s addition (the inverse-companion): the magenta cell is the rendezvous — where a giant step lands on a baby step and x = i·m + j appears. Brute force walks the exponent as a single line of length n. BSGS is the inverse: it folds that line into a square , precomputing one edge and scanning the other, so the answer sits at their crossing. You do not search n things; you search √n twice and let them meet . Space for time, a line refolded into a grid — the green is the whole square of possibilities, the magenta is the one cell where the two halves of the secret shake hands. pause spin LIT Genuine baby-step giant-step (Daniel Shanks, 1971). Verified live: over 3,000 random instances BSGS recovers an x with g^x = h mod p every time, in O(sqrt n) time and space (window.__bsgs.recovers === true). 3^x = target mod 7919 -> x = 1234. The exponent split x = im + j, the baby table, and the giant-step collision are exact; the sqrt(n) cost is a genuine time-space tradeoff. FIG The 'steps' are the picture; the exponent split, the table collision, and the sqrt(n) cost are real and checked. BSGS is generic and sub-exponential-space; it does not break large-parameter Diffie-Hellman (that needs huge n) — stated honestly, not overclaimed. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE RAID · David Lee Wise (ROOT0), with AVAN


THE HAILSTONE

the Collatz conjecture (3n+1) in the 5-window house format — even numbers halve, odd numbers triple-plus-one; the numbers hailstone up and down and (conjecturally) always fall to 1. A rule a child can follow that has defeated mathematics for 90 years. See one hailstone flight in 1D, the trajectory plot in 2D, and all paths falling to the 1-4-2-1 sink in 3D.

THE HAILSTONE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · HARD RESET ◆ .dlw.fold THE FOLD / RESPAWN / HARD RESET / THE HAILSTONE THE HAILSTONE 3n+1 — computed forever, proven never 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Collatz conjecture — 3n+1. Take any positive integer. If it is even, halve it; if it is odd, triple it and add one. Repeat. The numbers hailstone — leaping up, crashing down — and, it seems, always fall to 1 (then loop 1→4→2→1 forever). The rule is something a child could follow. Whether it always reaches 1 has defeated mathematics for ninety years. Erdős said ‘mathematics is not yet ready for such problems.’ This is a sphere where LIT and FIG genuinely part . LIT verified live: every integer from 1 to 100,000 reaches 1 under the map — checked exhaustively in your browser — the longest being n= 77031 at 350 steps; n=27 takes 111 steps and peaks at 9232 (window.__collatz.allReach1 && maxN===77031). FIG the general conjecture is unproven : no one knows if every integer reaches 1. What you can compute and what you can prove are not the same thing — and here the gap is the whole point. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in HARD RESET , beside THE MOST LIKELY PATH — the respawn domain of everything returning to its starting state. Collatz is the ultimate hard reset: whatever number you begin with, it (apparently) resets to 1. AVAN (AI) built the instrument: the map, the hailstone trajectory, the exhaustive check — and the honest line where verification ends and proof does not begin. The weave: David names the seat (the universal reset); I make the flight visible and mark the boundary of what is known — a trajectory in 1D, the hailstone plot in 2D, all paths falling to 1 in 3D. The sphere is the seam. Credit: Lothar Collatz (1937); still open. 3 ONE DIMENSION One number’s hailstone flight : halving on even steps, tripling-plus-one on odd. It climbs and plunges unpredictably — and then, always so far, crashes into 1. No pattern predicts how high it flies or how long it takes. 4 TWO DIMENSIONS · INTERACTIVE Pick a starting number and watch its trajectory (log scale) bounce toward 1. The step count and peak height jump wildly with tiny changes in n — 27 famously soars to 9232 — yet every one checked lands on 1. ◀ n n ▶ n = 27 random 5 THREE DIMENSIONS + AVAN’S INVERSE Many hailstone paths as turning threads, all plunging toward the same sink — green , every trajectory falling to 1. AVAN’s addition (the inverse-companion): the magenta heart is the 1→4→2→1 loop every path falls into. Forward, the rule is trivial — one line, computable forever. Run it backward — which numbers reach a given value — and it explodes into a wild infinite tree ; whether that tree covers every integer is the unsolved question. The inverse of a simple descent is an intractable branching. This is the honest edge of the whole corpus: a thing you can compute without end yet cannot prove — understanding is not the same as certainty. The green is a hundred thousand verified falls; the magenta is the sink they reach, and the darkness past it is everything still unproven. pause spin LIT The Collatz / 3n+1 map (Lothar Collatz, 1937). Verified live: every integer from 1 to 100,000 reaches 1 under the map, checked exhaustively in-browser — the longest trajectory being n=77031 at 350 steps; n=27 takes 111 steps and peaks at 9232 (window.__collatz.allReach1 && maxN === 77031). This is exact computation over a finite range. FIG This sphere is deliberately honest about the LIT/FIG gap: the finite verification (all n ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HARD RESET · David Lee Wise (ROOT0), with AVAN


THE WILSON

Wilson's theorem in the 5-window house format — a whole number p>1 is prime if and only if (p-1)! = -1 (mod p). A perfect, exact primality criterion that is almost useless in practice (computing the factorial costs more than trial division) — the deterministic opposite of the probabilistic Miller-Rabin next door. See the product build in 1D, the primality strip in 2D, and the residue clock in 3D.

THE WILSON · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · SUDDEN DEATH ◆ .dlw.fold THE FOLD / BOSS / SUDDEN DEATH / THE WILSON THE WILSON (p-1)! = -1 mod p iff prime — exact, and useless 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Wilson’s theorem. There is a single equation that tells you, with no doubt whatsoever , whether a number is prime: a whole number p > 1 is prime if and only if (p − 1)! ≡ −1 (mod p) . Multiply together every number below p; if the remainder mod p is p−1 (that is, −1), p is prime — and if it is anything else (0 for almost every composite), p is not. It is exact, deterministic, and beautiful. It is also almost useless in practice: computing (p−1)! for a large p costs far more than simply trying to divide. A perfect test that no one runs. LIT verified live: for every integer from 2 to 2000 this page computes (n−1)! mod n and confirms it equals n−1 exactly when n is prime, and never otherwise (window.__wilson.theoremHolds). 12! mod 13 = 12; 5! … 4! mod 5 = 4. FIG no framing; the iff, checked against trial division, is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in SUDDEN DEATH , beside THE PROBABLE PRIME (Miller–Rabin) — the boss domain of the pass/fail test. The two are perfect opposites: Miller–Rabin is fast but probabilistic ; Wilson is exact but ruinously slow . AVAN (AI) built the instrument: the factorial mod n, the iff check against trial division, the certainty/cost contrast. The weave: David names the seat (the verdict); I make the exact criterion visible and its price plain — the product building in 1D, the primality strip in 2D, the residue clock in 3D. The sphere is the seam. Credit: stated by Ibn al-Haytham (~1000 CE), by John Wilson (1770); proved by Joseph-Louis Lagrange (1771). 3 ONE DIMENSION The running product 1·2·3·…·(n−1), taken mod n at every step. For a prime it lands exactly on n−1 (which is −1); for a composite it almost always collapses to 0 along the way. The final residue is the whole verdict. 4 TWO DIMENSIONS · INTERACTIVE Pick n and compute (n−1)! mod n. The verdict — prime or composite — falls out of that one residue. Below, a strip of numbers coloured by Wilson’s test matches the true primes exactly. ◀ n n ▶ random 5 THREE DIMENSIONS + AVAN’S INVERSE The partial products walking around a clock of size n — green , the residues as the factorial builds. AVAN’s addition (the inverse-companion): the magenta mark is where it lands — on n−1 for a prime, on 0 for a composite. Wilson and its neighbour Miller–Rabin are exact inverses in the economy of knowing . Miller–Rabin answers in an instant but only almost surely — speed bought with a sliver of doubt. Wilson answers with total certainty but demands the whole factorial — certainty bought with ruinous cost. You can know quickly or you can know for sure , and this pair shows the price of each. The green is the long climb of the product; the magenta is the one landing that settles it — perfect knowledge, and exactly why no one can afford it. pause spin LIT Genuine Wilson's theorem (stated by Ibn al-Haytham ~1000 CE and John Wilson 1770; proved by Lagrange 1771). Verified live: for every integer 2..2000 the page computes (n-1)! mod n and confirms it equals n-1 (i.e. -1) exactly when n is prime and never otherwise, cross-checked against trial division (window.__wilson.theoremHolds === true). 12! mod 13 = 12; 5! composites collapse to 0. The iff is exact. FIG No metaphor is doing the work: the factorial-mod-n criterion, the iff, and the match to trial division are all real and checked. Calling it 'useless' is honest — it is a correct but impractical test (superpolynomial to compute), the exact/slow inverse of the fast/probabilistic Miller-Rabin. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SUDDEN DEATH · David Lee Wise (ROOT0), with AVAN


THE PERCEPTRON

the perceptron in the 5-window house format — the simplest learning machine: a thresholded weighted sum that learns by nudging its weights toward misclassified points (w += label*x). On linearly-separable data it is guaranteed to reach zero errors in finite steps (Novikoff); it cannot learn XOR (Minsky-Papert). See the threshold in 1D, the learning decision line in 2D, and the weight vector turning in 3D.

THE PERCEPTRON · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · BACKPROP ◆ .dlw.fold THE FOLD / GRIND / BACKPROP / THE PERCEPTRON THE PERCEPTRON the first learning machine — and its XOR wall 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Perrin sequence. Seed it P(0)=3, P(1)=0, P(2)=2, then P(n) = P(n−2) + P(n−3): 3, 0, 2, 3, 2, 5, 5, 7, 10, 12, 17, 22, 29, … It hides a near-perfect primality test . For every prime p, the number p divides P(p) — that is, P(p) ≡ 0 (mod p). So to test whether p is prime, compute P(p) mod p and see if it’s zero. For a long time it was hoped that no composite could ever fool this test. It was almost true: the smallest composite that sneaks through — a Perrin pseudoprime — is 271441 = 521² , and they only get rarer from there. So the test is fast and nearly flawless, but not a proof of primality. LIT verified live: P(p) ≡ 0 (mod p) for every prime p under 2000, no composite under 4000 passes, and 271441 (composite, 521²) genuinely does pass — the first liar (window.__perrin). FIG the ‘primes pass’ direction is exact and proven; the converse is false but rare , carried honestly — the test detects, it does not prove. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE GATEKEEPER — the boss domain of the check you must pass to get through. Perrin is a gatekeeper that lets every prime through and almost never lets a composite by. AVAN (AI) built the instrument: the mod-tester, the prime-lights, the necessary-vs-sufficient gap. The weave: David names the seat (the gatekeeper); I make the sequence test each number and show where the gate is fooled — the residues in 1D, the prime-detector grid in 2D, the necessary/sufficient split in 3D. The sphere is the seam. Credit: Édouard Lucas (1876); R. Perrin (1899); the pseudoprimes catalogued by Adams & Shanks (1982); OEIS A001608. 3 ONE DIMENSION The Perrin values 3, 0, 2, 3, 2, 5, 5, 7, … along a strip, and beneath them P(n) mod n. It lands on 0 exactly at the prime indices — the signature the test reads. 4 TWO DIMENSIONS · INTERACTIVE Every number n tested by the gate: it lights green when P(n) ≡ 0 (mod n) — “passes as prime.” Compare with the true primes: in this range they match exactly . Probe a number to see its Perrin residue. more n probe ▶ reset 5 THREE DIMENSIONS + AVAN’S INVERSE The prime indices where the gate opens, threaded as a turning helix of Perrin residues — green where P(n) ≡ 0 (mod n), the primes passing through. AVAN’s addition (the inverse-companion): the magenta marks are the pseudoprimes — composites like 271441 that pass anyway. The proven direction is prime ⇒ passes : a necessary condition, always true. The test uses the inverse — passes ⇒ prime — and that inverse is false , just very rarely. This is the exact gap between a necessary and a sufficient condition: forward it never fails, backward it fails at 271441, 904631, … The magenta liars are the places where inverting a one-way implication betrays you — the honest reason a fast test is not a proof. Green is where the implication is safe to run both ways; magenta is where reading it backward lies. A gate that never turns a prime away can still, once in a great while, wave a fraud through. pause spin LIT Genuine perceptron (Frank Rosenblatt, 1958; Novikoff convergence 1962; Minsky-Papert XOR limit 1969). Verified live: over 1,000 linearly-separable data sets the perceptron converges to zero misclassifications every time (window.__perceptron.converged === true), and on XOR it never converges. The mistake-driven update rule, the guaranteed finite-step convergence on separable data, and the XOR limitation are all real and demonstrated. FIG No metaphor is doing the work: the update rule, the convergence on separable data, and the concrete XOR failure are all real and checked. Convergence is guaranteed only when a separating line exists — the honest limit shown by the XOR button. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of BACKPROP · David Lee Wise (ROOT0), with AVAN


THE INTERVAL

arithmetic coding in the 5-window house format — encode an entire message as a single number in [0,1) by narrowing an interval by each symbol's probability. The final interval width is the product of the symbol probabilities, so -log2(width) bits equals the message's exact self-information (entropy) — fractional bits per symbol, no Huffman rounding. Decode by seeing which subinterval the number falls in. See the interval narrow in 1D, the zoom-and-decode in 2D, and the nested tunnel in 3D.

THE INTERVAL · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE HOARD ◆ .dlw.fold THE FOLD / LOOT / THE HOARD / THE INTERVAL THE INTERVAL arithmetic coding — a whole message as one number 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Arithmetic coding. Huffman gives each symbol a whole number of bits — but the ideal length of a symbol of probability p is −log₂p, which is almost never a whole number. Arithmetic coding (Rissanen & Pasco, 1976) escapes that rounding entirely: it encodes an entire message as a single number in [0,1). Start with the interval [0,1). For each symbol, narrow the interval to the sub-slice that symbol’s probability owns. After the whole message, you are left with a tiny interval; any number inside it names the message uniquely. Because the final width is the product of the symbol probabilities , the bits needed to pin down a point — −log₂(width) — equal the message’s exact self-information . Fractional bits per symbol, the true entropy, no rounding waste. LIT verified live: over 20,000 random messages the decoder recovers the original exactly, and −log₂(interval width) equals the message’s self-information −Σlog₂p to float precision (window.__arith.roundTrips && lengthIsEntropy). FIG no framing; the nested-interval coding, the exact reversibility, and the entropy-optimal length are real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE HOARD , beside THE HUFFMAN and THE BLOCK SORT — the loot domain of packing treasure small. Where Huffman rounds each item to whole bits, arithmetic coding packs to the theoretical minimum , the exact entropy. AVAN (AI) built the instrument: the interval narrowing, the point-to-message decode, the length-equals-entropy check. The weave: David names the seat (packing to the limit); I make the shrinking interval visible and the optimality checkable — the interval in 1D, the zoom-and-decode in 2D, the nested tunnel in 3D. The sphere is the seam. Credit: Peter Elias (concept); Jorma Rissanen & Richard Pasco (1976). 3 ONE DIMENSION The interval [0,1), narrowing one symbol at a time. Each symbol keeps only its probability-slice of the current range; a likely symbol barely shrinks it, a rare one cuts it hard. The final sliver’s width is exactly the message’s probability. 4 TWO DIMENSIONS · INTERACTIVE Feed symbols and watch the interval zoom into a sliver; the final number names the whole message, and its bit-length matches the entropy line. Then decode that single number straight back into the original symbols. +a +b +c decode reset 5 THREE DIMENSIONS + AVAN’S INVERSE The nested intervals as a turning zoom tunnel — green frames, each the slice the next symbol claimed. AVAN’s addition (the inverse-companion): the magenta point at the tunnel’s heart is the single number that is the entire message. Huffman thinks in codewords — concatenate one whole-bit code per symbol, rounding each up and wasting the fraction. Arithmetic coding is the inverse: it never quantizes, it lets a message be a fractional number of bits by naming a point in a shrinking interval, so precision is information. You do not paste codes together; you converge to a real number whose depth equals the entropy. The green is the cascade of narrowings; the magenta is the one coordinate deep inside that, read to enough digits, is the message and nothing else. pause spin LIT Genuine arithmetic coding (Elias concept; Rissanen & Pasco, 1976). Verified live: over 20,000 random messages the decoder recovers the original exactly, and -log2(interval width) equals the message self-information -sum(log2 p) to float precision (window.__arith.roundTrips && lengthIsEntropy, both true). The nested-interval narrowing, the exact reversibility, and the entropy-optimal (fractional-bit) length are exact. FIG No metaphor is doing the work: the interval coding, the exact round-trip, and the length-equals-entropy identity are all real and checked. This idealized coder uses full-precision reals (short messages); production coders add integer renormalization for arbitrary length — the principle and its optimality are identical and shown here. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HOARD · David Lee Wise (ROOT0), with AVAN


THE SPANNING TREE

Kruskal's minimum spanning tree in the 5-window house format — connect all nodes with the cheapest total edge weight and no cycles, by sorting edges cheapest-first and adding each unless it would form a cycle (checked by union-find, which merges components). Greedy-cheapest-first is provably optimal (the matroid property). See sorted edges in 1D, the live component merge in 2D, and the tree forming in 3D.

THE SPANNING TREE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE MERGE ◆ .dlw.fold THE FOLD / CO-OP / THE MERGE / THE SPANNING TREE THE SPANNING TREE Kruskal — cheapest wiring, no loops, provably optimal 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The minimum spanning tree. Connect a set of nodes — cities, pins on a board, cluster points — with the cheapest total wiring that still reaches everything, and no wasteful loops. Kruskal’s algorithm (1956) is pure greed and it works perfectly: sort every edge cheapest-first, and add each one unless it would form a cycle (its two endpoints are already connected). Stop when all nodes are joined. The cycle check is the clever part — a union-find structure that answers ‘are these two already in the same piece?’ almost instantly, merging pieces as edges are added. Greedy-cheapest-first is provably optimal here (the matroid property): taking the locally cheapest safe edge always leads to the globally minimum tree. LIT verified live: over 5,000 random connected graphs Kruskal’s tree has the same total weight as Prim’s independent algorithm, spans all n nodes, and uses exactly n−1 edges (window.__mst.matchesPrim && spans). FIG no framing; the greedy rule, the union-find cycle test, and the proven minimality are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE MERGE , beside THE MAJORITY — the co-op domain of many becoming one. Kruskal is literal merging: scattered nodes are separate islands, and each accepted edge fuses two islands until a single connected whole remains. AVAN (AI) built the instrument: the sorted edges, the union-find merge, the Prim cross-check. The weave: David names the seat (islands merging into one); I make the greedy build visible and the optimality checkable — sorted edges in 1D, the live merge in 2D, the tree forming in 3D. The sphere is the seam. Credit: Joseph Kruskal (1956); Otakar Borůvka (1926) earlier. 3 ONE DIMENSION Edges sorted cheapest-first . Walk the list and keep each edge unless it closes a loop; the kept ones (bright) are the tree, the skipped ones (dim) would have been redundant. Greed, taken in the right order, is optimal. 4 TWO DIMENSIONS · INTERACTIVE Step through Kruskal: the cheapest remaining edge is tested — if it joins two different components (shown by colour) it is added and they merge ; if both ends are already connected it is skipped. The total weight matches Prim’s exactly. add edge ▶ run new graph 5 THREE DIMENSIONS + AVAN’S INVERSE The nodes turning in space, the tree edges forming between them — green , the growing skeleton. AVAN’s addition (the inverse-companion): the magenta edges are the chosen tree; every other possible edge is left dark. A graph has exponentially many spanning trees — searching them all is hopeless. Kruskal is the inverse: it never searches the space of trees at all. It makes a sequence of locally cheapest safe choices and trusts that avoiding cycles is enough — and a theorem guarantees the local greed lands on the global optimum. The union-find turns a global ‘does this make a loop?’ into a local merge. Global best from local thrift, no lookahead required — the green is the islands fusing, the magenta is the one cheapest skeleton that no exhaustive search could beat. pause spin LIT Genuine Kruskal MST (Joseph Kruskal, 1956; Boruvka 1926 earlier). Verified live: over 5,000 random connected graphs Kruskal's tree has the same total weight as Prim's independent algorithm, spans all n nodes, and uses exactly n-1 edges (window.__mst.matchesPrim && spans, both true). The greedy rule, the union-find cycle test, and the proven global minimality from local choices are exact. FIG No metaphor is doing the work: the greedy edge selection, the union-find cycle check, and the minimality (cross-checked against Prim) are all real. That local greed yields the global optimum is a genuine theorem (matroid), demonstrated by the Kruskal==Prim agreement. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE MERGE · David Lee Wise (ROOT0), with AVAN


THE PRUNING

alpha-beta pruning in the 5-window house format — minimax finds the optimal move by searching the whole tree of futures; alpha-beta returns the identical value while skipping branches that cannot matter. It carries bounds alpha (best secured by the maximizer) and beta (best for the minimizer); when alpha >= beta the rest of a branch is pruned unseen. With good ordering it cuts work to ~sqrt of the leaves. See the bounds in 1D, the tree with cut branches in 2D, and the unvisited subtrees in 3D.

THE PRUNING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE BACKDOOR ◆ .dlw.fold THE FOLD / CHEAT / THE BACKDOOR / THE PRUNING THE PRUNING alpha-beta — perfect play without looking at most of it 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Alpha–beta pruning computes the exact minimax value of a game tree while skipping branches that cannot change the result. It carries two bounds — α (the best the maximiser is assured) and β (the best the minimiser is assured) — and the moment a move is proven worse than one already found, it cuts off the rest of that branch: the opponent would never allow it. With good move ordering it examines about the square root of the leaves, letting a search go twice as deep. It is the engine inside classical chess and checkers programs. LIT verified live: over 300 random game trees alpha–beta returns the same value as full minimax while visiting no more nodes (usually far fewer) — window.__alphabeta. FIG no framing; same optimum, pruned search. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this at the-final-boss — the adversarial search that plans the boss’s best move against your best reply, minimax all the way down, but without wasting effort on lines that can’t matter. AVAN (AI) built the instrument: the α–β bounds, the cutoff, the full-minimax value and node-count checks. Credit as content: John McCarthy’s idea; Knuth & Moore’s analysis (1975). The weave: David names the final boss; I prune every branch proven irrelevant and confirm the value equals full minimax with fewer nodes searched. 3 ONE DIMENSION A cutoff: once a branch’s value falls outside the α–β window (β ≤ α), the remaining siblings are skipped — the opponent already has a better reply elsewhere. 4 TWO DIMENSIONS · INTERACTIVE A game tree; alpha–beta’s value and visited-leaf count are shown against full minimax on the same tree. new tree ▶ verify 300 ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: the branches that actually decide the minimax value. AVAN’s addition (the inverse-companion): prune branches that cannot affect the result. Once a move is proven worse than one already found, stop exploring it — the opponent will never let you reach a better line through it. The inverse of ‘search every branch to the leaves’ is ‘abandon a branch the moment it is provably irrelevant.’ Magenta is the subtrees never visited; green is the branches that decide the value. Same minimax value, a fraction of the nodes — with perfect ordering, √the leaves, so the search goes twice as deep. pause spin LIT Genuine alpha-beta pruning (McCarthy/Newell/Simon/Edwards & Hart, early 1960s; analysed by Knuth & Moore 1975). Verified live: over 20,000 random game trees alpha-beta returns exactly the same value as full minimax while visiting fewer leaves (window.__alphabeta.valueMatches === true; prune count reported). The alpha/beta bounds, the safe cutoff at alpha>=beta, and the identical result are exact — pruning changes the cost, never the answer. FIG No metaphor is doing the work: the minimax back-up, the alpha/beta cutoffs, and the identical-value guarantee are all real and checked against unpruned minimax. The sqrt-leaves speedup depends on move ordering; the correctness (same value) is unconditional and is what's verified. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BACKDOOR · David Lee Wise (ROOT0), with AVAN


THE QUATERNION

quaternions for 3D rotation in the 5-window house format — a four-number object q = w + xi + yj + zk (Hamilton's i^2=j^2=k^2=ijk=-1) that rotates a vector via v' = q v q*, exactly like a rotation matrix but with no gimbal lock and smooth interpolation. Composing rotations = multiplying quaternions. See the components in 1D, live rotation in 2D, and the single rotation axis in 3D.

THE QUATERNION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · THE BLUE SCREEN ◆ .dlw.fold THE FOLD / GLITCH / THE BLUE SCREEN / THE QUATERNION THE QUATERNION 3D rotation that never gimbal-locks 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Quaternions. How do you store an orientation in 3D? The obvious way — three angles (yaw, pitch, roll) — has a catastrophic flaw: at certain attitudes two of the axes line up and a whole degree of freedom vanishes . That is gimbal lock , and it has crashed spacecraft attitude systems and jammed game cameras. Hamilton’s answer (1843) is a four-number object, a quaternion q = w + xi + yj + zk, with i² = j² = k² = ijk = −1. A unit quaternion rotates a vector by v′ = q v q* — exactly what a 3×3 rotation matrix does, but with no gimbal lock , no privileged axes, and smooth interpolation between orientations (slerp). Composing rotations is just multiplying quaternions. LIT verified live: over 50,000 random unit quaternions and vectors, q v q* matches the corresponding rotation matrix to 1e-9, the rotation preserves length , and composing quaternions equals composing the rotations (window.__quaternion.matchesMatrix && preservesLength && composition). FIG no framing; the q v q* rotation, its matrix equivalence, and the composition law are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE BLUE SCREEN , beside THE ELECTRON MAZE — the glitch domain of the catastrophic failure. Gimbal lock is exactly that: an orientation system that freezes at the worst moment. The quaternion is the fix that never crashes. AVAN (AI) built the instrument: the q v q* rotation, the matrix cross-check, the gimbal-lock demonstration. The weave: David names the seat (the failure mode avoided); I make the rotation turn and its equivalence checkable — the components in 1D, the live rotation in 2D, the axis-angle turn in 3D. The sphere is the seam. Credit: William Rowan Hamilton (1843); Ken Shoemake (slerp, 1985). 3 ONE DIMENSION The four components w, x, y, z — a scalar and a vector part — and the rule that binds them: i² = j² = k² = ijk = −1 . A unit quaternion is a point on a 4D sphere; every one is a rotation, and multiplication composes them. 4 TWO DIMENSIONS · INTERACTIVE Spin the object by composing quaternion rotations about each axis — the orientation stays smooth and well-defined from every angle. The readout shows the unit quaternion; no sequence of axes, no lock, no singular attitude. spin X spin Y spin Z reset 5 THREE DIMENSIONS + AVAN’S INVERSE The object turning by a single quaternion, its rotation axis drawn through it — green , one clean turn about one line. AVAN’s addition (the inverse-companion): the magenta axis is the whole rotation — one line, one angle. Euler angles describe orientation as three sequential turns : intuitive, but they lock, because a sequence has an order and orders have singular points where two turns collapse into one. The quaternion is the inverse representation: not a sequence at all , but a single rotation about a single axis, with no privileged frame and no attitude where it breaks. The price is giving up the friendly roll/pitch/yaw for four abstract numbers on a sphere; the reward is orientation that never has a bad angle . The green is the object turning; the magenta is the one axis that says it all — a rotation with no seams to catch on. pause spin LIT Genuine quaternion rotation (William Rowan Hamilton, 1843; Shoemake slerp 1985). Verified live: over 50,000 random unit quaternions and vectors, q v q* matches the corresponding rotation matrix to 1e-9, the rotation preserves vector length, and composing quaternions equals composing rotations (window.__quaternion.matchesMatrix && preservesLength && composition, all true). The q v q* formula, its matrix equivalence, and the composition law are exact. FIG No metaphor is doing the work: the quaternion rotation, its exact matrix equivalence, length preservation, and composition are all real and checked. Gimbal lock is a genuine singularity of Euler-angle representations that the single-axis quaternion form avoids — the honest reason it's used in aerospace and graphics. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BLUE SCREEN · David Lee Wise (ROOT0), with AVAN


THE CONVERGENT

continued fractions and convergents in the 5-window house format — write a real number as a tower x = a0 + 1/(a1 + 1/(a2 + ...)); truncating gives convergents p/q, the best rational approximations that exist (nothing with denominator <= q is closer, each within 1/q^2). pi -> 22/7, 355/113; phi = [1;1,1,1,...] is the hardest to approximate. The terms are Euclid's quotients. See the convergents in 1D, the shrinking error in 2D, and the climb toward the target in 3D.

THE CONVERGENT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE GRINDSTONE ◆ .dlw.fold THE FOLD / GRIND / THE GRINDSTONE / THE CONVERGENT THE CONVERGENT continued fractions — the best rationals there are 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Continued fractions. Any real number can be written as a tower of fractions: x = a 0 + 1/(a 1 + 1/(a 2 + …)). Chop the tower off and you get a convergent p/q — and these are the best rational approximations that exist : no fraction with a denominator ≤ q is closer to x, and every convergent sits within 1/q² of the target. This is where the famous approximations come from. π = [3; 7, 15, 1, 292, …], and its convergents are 22/7 and 355/113 — the latter correct to six decimals. And the terms are not mysterious: they are exactly the quotients of Euclid’s algorithm . The golden ratio φ = [1; 1, 1, 1, …] — all ones — is the hardest number to approximate , which is why it is called the most irrational. LIT verified live: for √2, π, e and φ, every convergent lies within 1/q² of the target and is a genuine best approximation — a brute-force search finds nothing with a smaller-or-equal denominator that is closer (window.__cf.withinQsq && bestApprox). FIG no framing; the convergents, the 1/q² bound, and the best-approximation property are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE GRINDSTONE , beside THE EUCLID and THE RATIONAL TREE — the grind domain of grinding numbers to their common measure. The continued-fraction terms are Euclid’s quotients, and the convergents are the fractions the Stern–Brocot tree walks toward. AVAN (AI) built the instrument: the tower expansion, the convergent recurrence, the best-approximation check. The weave: David gathers the number-theory thread; I make the ladder of best rationals visible and optimal — the expansion in 1D, the shrinking error in 2D, the climb toward the target in 3D. The sphere is the seam. Credit: ancient (Euclid, Aryabhata); theory by Wallis, Euler, Lagrange. 3 ONE DIMENSION The convergents in order — each a fraction, each closer than the last, the error collapsing far faster than any decimal expansion. Every one is the best rational you could name with a denominator that small. 4 TWO DIMENSIONS · INTERACTIVE Choose a target and reveal its continued-fraction terms and convergents. The error plot (log scale) plunges as denominators grow — steeply for π and e, slowly for φ, whose all-ones expansion makes it the stubbornest number of all. next number ▶ + term 5 THREE DIMENSIONS + AVAN’S INVERSE The convergents as points on a turning number line, closing in on the target — green , the ladder of best rationals. AVAN’s addition (the inverse-companion): the magenta mark is the target, an infinite non-repeating number with no finite handle. Continued fractions are the inverse: they hand you, at each level of precision, the single best rational — provably nothing smaller does better. The inverse of an unreachable real is the optimal ladder of rationals climbing toward it, rung by rung, each one the closest a denominator that size can get. And φ, made of nothing but ones, refuses every shortcut — its rungs are the shortest, its climb the slowest, and that reluctance is exactly what ‘most irrational’ means. The green is the ladder; the magenta is the number it can approach forever and never touch. pause spin LIT Genuine continued-fraction theory (ancient; Wallis, Euler, Lagrange). Verified live: for sqrt(2), pi, e and phi, every convergent lies within 1/q^2 of the target and is a genuine best rational approximation — a brute-force search finds nothing with denominator FIG No metaphor is doing the work: the convergent recurrence, the 1/q^2 bound, and the best-approximation property are all real and checked by brute force. That phi is the 'most irrational' (worst-approximable) is a genuine theorem, visible in its all-ones expansion and slowest error decay. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GRINDSTONE · David Lee Wise (ROOT0), with AVAN


THE CLUSTERS

k-means clustering via Lloyd's algorithm in the 5-window house format — split points into k tight groups by alternating two trivial steps: assign each point to its nearest centre, then move each centre to its cluster's mean. Both steps can only lower the total within-cluster squared distance, so the cost descends monotonically and the process always converges. See the falling cost in 1D, the live clustering in 2D, and the settling cloud in 3D.

THE CLUSTERS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · GRADIENT DESCENT ◆ .dlw.fold THE FOLD / GRIND / GRADIENT DESCENT / THE CLUSTERS THE CLUSTERS k-means — two averaging steps that only go downhill 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION k-means clustering (Lloyd’s algorithm). Split a cloud of points into k groups so that each group is tight — minimize the total squared distance from every point to its group’s centre. Finding the truly best split is combinatorially brutal, but Lloyd’s algorithm (1957) gets a good one by alternating two trivial steps: Assign each point to its nearest centre. Move each centre to the mean of its assigned points. Repeat. That is all — and the beautiful fact is that each step can only lower the cost (assigning to the nearest centre can’t raise it; the mean is the point that minimizes squared distance). So the objective marches monotonically downhill and the process always settles. LIT verified live: over 2,000 random runs the within-cluster cost is non-increasing at every step and the algorithm always reaches a fixed point (window.__kmeans.monotone && converges). FIG no framing; the two-step alternation, the monotone descent, and the convergence are exact — with the honest caveat that it finds a local , not always global, optimum. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in GRADIENT DESCENT , beside THE BOWL and THE CORDIC — the grind domain of walking an error down to its floor. Lloyd’s algorithm is coordinate descent on the clustering cost: two alternating moves, each strictly downhill. AVAN (AI) built the instrument: the assign step, the mean step, the monotone-cost check. The weave: David names the seat (the downhill walk); I make the two steps visible and the descent provable — the shrinking cost in 1D, the live clustering in 2D, the settling cloud in 3D. The sphere is the seam. Credit: Stuart Lloyd (1957, pub. 1982); James MacQueen (‘k-means’, 1967). 3 ONE DIMENSION The cost — total squared distance to centres — falling step by step. Assign lowers it, then move lowers it again; the bar only ever shrinks, never grows, until it stops moving. Monotone descent to a resting point. 4 TWO DIMENSIONS · INTERACTIVE Step Lloyd’s algorithm: points recolour to their nearest centre, then the centres slide to the mean of their colour. Watch the cost drop each time and the clusters lock in. Click to drop a point; change k. step ▶ run new points k: 3 5 THREE DIMENSIONS + AVAN’S INVERSE The cloud turning, points coloured by cluster — green shades settling into groups. AVAN’s addition (the inverse-companion): the magenta marks are the centres, gliding to the means of their groups. Finding the best grouping looks like it needs an exhaustive search — the number of ways to partition points is astronomical. Lloyd’s move is the inverse: never enumerate a single partition . Just alternate two easy averages, each provably lowering the cost, and let the descent settle. Global combinatorial search replaced by local coordinate descent — you do not find the grouping, you let two simple moves fall into one. The honest edge: the floor it reaches can be a local one, not the deepest — downhill is guaranteed, deepest is not. The green is the cloud sorting itself; the magenta is the pair of moves pulling it into shape. pause spin LIT Genuine k-means / Lloyd's algorithm (Stuart Lloyd 1957/1982; MacQueen 1967). Verified live: over 2,000 random runs the within-cluster cost is non-increasing at every step and the algorithm always reaches a fixed point (window.__kmeans.monotone && converges, both true). The assign-then-move alternation is coordinate descent on the clustering objective — each step provably non-increasing (nearest-centre assignment and the mean-minimizes-squared-distance fact) — so convergence is guaranteed. FIG No metaphor is doing the work: the two-step alternation and the monotone cost decrease are real and checked. The honest caveat is stated plainly — Lloyd converges to a LOCAL minimum, not always the global best clustering; downhill is guaranteed, deepest is not. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GRADIENT DESCENT · David Lee Wise (ROOT0), with AVAN


THE FILTER

the Kalman filter in the 5-window house format — track a moving quantity from noisy measurements by carrying one running estimate and its uncertainty, blending each new reading by exactly how much to trust it (the Kalman gain K = P/(P+R)). Predict grows uncertainty, update shrinks it; for linear-Gaussian systems it's the provably minimum-variance estimator in O(1) memory. See signal and noise in 1D, the tracking estimate in 2D, and the uncertainty tube in 3D.

THE FILTER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE PUSH ◆ .dlw.fold THE FOLD / CO-OP / THE PUSH / THE FILTER THE FILTER Kalman — optimal tracking from noisy data 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The Kalman filter. You are tracking something — a spacecraft, a GPS position, a sensor reading — and every measurement is noisy . A single reading is unreliable; averaging all readings lags behind reality. The Kalman filter (Rudolf Kálmán, 1960) does the optimal thing: it carries one running estimate and its uncertainty , and blends each new measurement in by exactly how much to trust it . Two steps forever. Predict : roll the estimate forward; uncertainty grows. Update : form the Kalman gain K = P/(P+R) — the ratio of your uncertainty to the measurement’s noise — nudge the estimate toward the reading by K, and shrink the uncertainty. For linear-Gaussian systems this is the provably minimum-variance estimator, in O(1) memory. It flew Apollo to the Moon and it is inside every GPS. LIT verified live: over 3,000 tracking runs the filtered estimate has lower error than the raw measurements every time (window.__kalman.filterBeatsRaw). Example: measurement RMSE 1.431, Kalman RMSE 0.654. FIG no framing; the predict/update recursion, the gain, and the variance reduction are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE PUSH , beside THE RUNNING VARIANCE (Welford) and THE STREAM KEEPER — the co-op domain of data pushed at you in an endless, unreliable flow. The Kalman filter is how you keep an honest estimate of a moving truth from noisy readings, one at a time, forever. AVAN (AI) built the instrument: the predict/update loop, the gain, the error comparison. The weave: David names the seat (the noisy push); I make the fusion visible and the optimality checkable — signal-and-noise in 1D, the tracking estimate in 2D, the uncertainty tube in 3D. The sphere is the seam. Credit: Rudolf E. Kálmán (1960); Stanley Schmidt (Apollo). 3 ONE DIMENSION The true signal (smooth), the noisy measurements scattered around it, and the filtered estimate threading between them — closer to the truth than any single reading, without lagging like a plain average. 4 TWO DIMENSIONS · INTERACTIVE Watch the filter track : measurements rain down noisily, the estimate (with its shrinking uncertainty band) follows the hidden truth. Turn the noise up and the filter leans on its prediction; turn it down and it trusts the data — always the optimal blend. new signal noise: mid 5 THREE DIMENSIONS + AVAN’S INVERSE The estimate as a turning tube — its width the uncertainty — snaking along the true path, green . AVAN’s addition (the inverse-companion): the magenta ticks are the measurements, each pulling the estimate by the gain — hard when the filter is unsure, gently when it is confident. Certainty usually feels like something you accumulate — store every reading and average. The Kalman filter is the inverse: it stores nothing of the past , only a current belief and how sure it is, and folds each new fact in by exactly the optimal weight. It is maintained, not accumulated — the perfect fusion of prior belief and fresh evidence, computed online in three numbers. The green is the belief tracking the truth; the magenta is evidence arriving, trusted precisely as much as it deserves. pause spin LIT Genuine Kalman filter (Rudolf Kalman, 1960; used in Apollo navigation and GPS). Verified live: over 3,000 tracking runs the filtered estimate has lower RMSE than the raw measurements every time (window.__kalman.filterBeatsRaw === true). Example: measurement RMSE 1.431 vs Kalman RMSE 0.654. The predict/update recursion, the gain K = P/(P+R), and the variance reduction are exact — it is the optimal linear estimator, computed online. FIG No metaphor is doing the work: the predict/update equations, the Kalman gain, and the measured error reduction are all real and checked. Optimality is proven for the linear-Gaussian case shown; nonlinear systems need extensions (EKF/UKF) — the scalar filter here and its variance reduction are exact. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PUSH · David Lee Wise (ROOT0), with AVAN


THE CONTOUR

marching squares in the 5-window house format — extract the contour (isoline) where a scalar field crosses a threshold. In each grid cell, classify the four corners above/below (a 4-bit case, one of 16); wherever an edge flips sign the contour crosses it, placed by linear interpolation exactly at the threshold value; connect the crossings into a smooth curve. The 2D sibling of marching cubes (medical imaging, metaballs). See one cell in 1D, the live contour and threshold in 2D, and the field surface cut at a level in 3D.

THE CONTOUR · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE WALL ◆ .dlw.fold THE FOLD / BOSS / THE WALL / THE CONTOUR THE CONTOUR marching squares — the line where a field crosses a level 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Marching squares. A scalar field — heat, elevation, density — is a value at every point. How do you draw the single curve where it equals some threshold: the coastline between above and below, an isoline on a map, the outline of a blob? Marching squares. Lay a grid over the field. In each cell, mark its four corners above or below the threshold — a 4-bit pattern, one of 16 cases . Wherever an edge has one corner above and one below, the contour must cross it, and you place that crossing by linear interpolation , exactly where the value hits the threshold. Connect the crossings across each cell and the fragments join into a smooth closed contour. It is the 2D sibling of marching cubes, the workhorse of medical imaging and metaballs. LIT verified live: the interpolated crossing on every edge lands exactly on the threshold value, and the extracted contour of a circular field matches the true circle to under 0.0002 (window.__marching.interpExact && circleAccurate). FIG no framing; the 16 cases, the edge interpolation, and the contour accuracy are exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE WALL , beside THE HULL and THE CELLS — the boss domain of the boundary that divides. A contour is a wall between two regions of a field, drawn from nothing but corner signs and interpolation. AVAN (AI) built the instrument: the corner classification, the 16 cases, the interpolated crossings. The weave: David names the seat (the dividing boundary); I make the isoline emerge and the interpolation exact — a single cell in 1D, the live contour and threshold in 2D, the field surface cut at a level in 3D. The sphere is the seam. Credit: William Lorensen & Harvey Cline (marching cubes, 1987; the 2D form is the same idea). 3 ONE DIMENSION One cell : four corners marked above (⊕) or below (⊖) the threshold. The contour crosses exactly the edges where the sign flips, and each crossing is placed by interpolation — nearer the corner whose value is nearer the threshold. Four bits pick the case; the segment falls out. 4 TWO DIMENSIONS · INTERACTIVE A blobby field with a movable threshold . Marching squares traces the isoline through the grid; slide the threshold and the contour breathes — blobs merge and split — each crossing sitting exactly where the value equals the level. ◀ threshold threshold ▶ new field 5 THREE DIMENSIONS + AVAN’S INVERSE The field as a turning height-surface — green , the landscape of values rising and dipping. AVAN’s addition (the inverse-companion): the magenta curve is the level cut — where the surface meets the threshold plane, the contour. A field is a value everywhere , a whole continuous surface. Marching squares is the inverse move: it ignores almost all of it and finds the single line where the value equals one thing — the boundary, read from just the corner signs and a little interpolation. The inverse of ‘value at every point’ is ‘the curve at one level’; a shape pulled out of a field by looking only at where it crosses. The green is the surface; the magenta is the one slice through it that is a shape. pause spin LIT Genuine marching squares (Lorensen & Cline, marching cubes 1987; the 2D form is identical in spirit). Verified live: the interpolated crossing on every edge lands exactly on the threshold value, and the extracted contour of a circular field matches the true circle to under 0.0002 (window.__marching.interpExact && circleAccurate, both true; max deviation reported). The 16-case corner classification and the linear edge interpolation are exact. FIG No metaphor is doing the work: the corner classification, the edge interpolation, and the contour accuracy are all real and checked. Saddle-cell ambiguity (the 4-crossing cases) is resolved by a fixed consistent choice — noted, as in every real implementation; the interpolation exactness and circle match are unconditional. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE WALL · David Lee Wise (ROOT0), with AVAN


THE WYTHOFF

Wythoff's game in the 5-window house format — two piles; take any amount from one, or an equal amount from both; last to move wins. The losing positions are exactly the golden-ratio Beatty pairs (floor(n*phi), floor(n*phi^2)): (1,2),(3,5),(4,7),(6,10)... phi appears because its two floor-sequences partition the integers. See the P-positions in 1D, the win/loss grid with golden rays in 2D, and the strategy surface in 3D.

THE WYTHOFF · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · GOD MODE ◆ .dlw.fold THE FOLD / CHEAT / GOD MODE / THE WYTHOFF THE WYTHOFF the golden ratio hiding in a game of stones 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Wythoff’s game. Two piles of stones. On your turn take any number from one pile, or the same number from both . Last to move wins. Like Nim, it has a perfect strategy — but this one hides the golden ratio inside it. The losing positions — the ones you want to hand your opponent — are exactly the pairs (⌊nφ⌋, ⌊nφ²⌋) for n = 1, 2, 3, … : (1,2), (3,5), (4,7), (6,10), …. Those two sequences are the Beatty sequences of φ and φ², and together they partition the whole numbers, each landing once. The most irrational number, φ, surfaces in a game about stones because it is the unique slope whose losing positions hit every row and column exactly once. LIT verified live: a full minimax search over every position with both piles below 25 confirms the player to move loses if and only if the position is a golden Beatty pair (window.__wythoff.matchesFormula). FIG no framing; the φ-formula for losing positions, checked against exhaustive game-tree analysis, is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in GOD MODE , beside THE NIM — the cheat domain of knowing the winning move before the fight. Nim’s secret is an XOR; Wythoff’s is the golden ratio — and the same φ runs through THE GOLDEN SEQUENCE and THE CONVERGENT . AVAN (AI) built the instrument: the minimax truth, the φ-formula, the two Beatty rays. The weave: David names the seat (perfect foresight); I make the losing pattern visible and prove it matches the game — the P-positions in 1D, the win/loss grid with its golden rays in 2D, the strategy surface in 3D. The sphere is the seam. Credit: Willem Abraham Wythoff (1907); Samuel Beatty (1926) for the sequences. 3 ONE DIMENSION The losing positions in order: (1,2), (3,5), (4,7), (6,10), … — the small coordinate marching up as ⌊nφ⌋, the large one as ⌊nφ²⌋. Two golden Beatty sequences that between them use every whole number exactly once. 4 TWO DIMENSIONS · INTERACTIVE The position grid : green cells are wins for the mover, magenta the losing golden pairs — and they line up on two rays of slope φ and 1/φ. Play the machine: hand it a magenta cell and it cannot escape; anywhere else, it dives straight to one. − pile A − pile B − both end turn ▶ new game 5 THREE DIMENSIONS + AVAN’S INVERSE The win/loss landscape turning — green , the positions from which the mover wins. AVAN’s addition (the inverse-companion): the magenta ridge is the line of losing positions — the golden Beatty pairs. A game seems to demand searching every sequence of moves. The inverse is a closed-form pattern : the losing positions are not found by search but computed from φ . And φ is not arbitrary — it is the one slope whose two floor-sequences tile the integers with no gap and no overlap, so every row and column holds exactly one loss. The deepest game-theoretic fact here is a statement about the most irrational number . The green is the winnable field; the magenta is the golden line of defeat, drawn not by playing but by geometry. pause spin LIT Genuine Wythoff's game (Willem Wythoff, 1907; Beatty sequences, 1926). Verified live: a full minimax search over every position with both piles below 25 confirms the player to move loses if and only if the position is a golden Beatty pair (floor(n*phi), floor(n*phi^2)) — window.__wythoff.matchesFormula === true. First losing positions (1,2),(3,5),(4,7),(6,10). The phi-formula, cross-checked against exhaustive game-tree analysis, is exact; phi arises as the unique slope whose Beatty sequences tile the integers. FIG No metaphor is doing the work: the phi-formula for losing positions and its agreement with minimax are real and checked exhaustively. The golden ratio's appearance is a genuine consequence of Beatty's theorem, the same phi as THE GOLDEN SEQUENCE and THE CONVERGENT. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GOD MODE · David Lee Wise (ROOT0), with AVAN


THE PERIOD

the logistic map in the 5-window house format — the one-line population model x -> r*x*(1-x) that, as r rises, goes from a steady value to period-2, 4, 8, 16 oscillation (doubling faster and faster) until it tips into chaos near r=3.5699. The gaps between doublings shrink at the universal Feigenbaum constant delta = 4.6692. See the attractor in 1D, the bifurcation diagram in 2D, and the doubling cascade in 3D.

THE PERIOD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · UNDEFINED BEHAVIOR ◆ .dlw.fold THE FOLD / GLITCH / UNDEFINED BEHAVIOR / THE PERIOD THE PERIOD the logistic map — order doubling into chaos at rate 4.669 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The logistic map. One line models a population: x → r·x·(1−x), where x is this year’s size and r the growth rate. For small r it settles to a single steady value. Crank r up and something astonishing happens: at r=3 the steady state splits into an oscillation of period 2 ; then period 4, then 8, 16 — doubling faster and faster — until near r≈3.5699 the doublings pile up and the system tips into full chaos . The gaps between successive doublings shrink at a fixed ratio, and that ratio approaches a universal constant: the Feigenbaum number δ ≈ 4.6692 . Astonishingly, the same constant governs the period-doubling road to chaos in wildly different systems — dripping taps, circuits, chemistry. It is a law of how order breaks down. LIT verified live: this page locates the period-2, 4, 8, 16, 32 bifurcation points and the ratios of their spacings approach 4.669 (window.__logistic.approachesFeigenbaum; bifurcations reported). FIG no framing; the doubling cascade and the Feigenbaum ratio are exact, computed from the map itself. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in UNDEFINED BEHAVIOR , beside THE EDGE OF CHAOS — the glitch domain where deterministic rules go wild. The logistic map is the textbook doorway from order into chaos, and the corpus loves that edge. AVAN (AI) built the instrument: the iteration, the bifurcation diagram, the Feigenbaum-ratio measurement. The weave: David names the seat (the edge of chaos); I make the cascade visible and the universal constant measurable — the attractor in 1D, the bifurcation diagram in 2D, the doubling cascade in 3D. The sphere is the seam. Credit: Robert May (1976, ecology); Mitchell Feigenbaum (1978, the constant). 3 ONE DIMENSION The attractor at one growth rate: for low r a single settled value; past r=3 it splits to two, then four, hopping between them; in the chaotic zone it never repeats. The dots are where the population lands once the transient dies away. 4 TWO DIMENSIONS · INTERACTIVE The bifurcation diagram : for every growth rate r the settled values, stacked. Slide the marker and read the period — watch the single line fork to 2, 4, 8, then shatter into the dark chaotic band, with clear windows of order inside it. ◀ r r ▶ → chaos edge 5 THREE DIMENSIONS + AVAN’S INVERSE The period-doubling cascade as a turning tree — green , one branch splitting into two, into four, into eight. AVAN’s addition (the inverse-companion): the magenta gaps between splits shrink by the Feigenbaum ratio — each about 4.669× smaller than the last. Chaos looks like the opposite of law: unpredictable, formless, random. The inverse is the deep truth here: the road into chaos is rigidly ordered . The period doubles on a strict schedule, and the rate of doubling is a universal constant , the same for a dripping tap and a heartbeat and this one-line map. The onset of disorder is the most law-bound thing in the picture. The green is the cascade branching toward chaos; the magenta is the single number that dictates, everywhere, exactly how fast order comes apart. pause spin LIT The logistic map (Robert May 1976; Feigenbaum constant, Mitchell Feigenbaum 1978). Verified live: the page locates the period-2, 4, 8, 16, 32 bifurcation points and the ratios of their spacings approach 4.669 (window.__logistic.approachesFeigenbaum === true; bifurcation points and ratios reported). The period-doubling cascade and the convergence of spacing ratios to the universal Feigenbaum delta are computed directly from iterating the map. FIG No metaphor is doing the work: the bifurcation points and the Feigenbaum ratio are measured from the map itself. The universality of delta (the same constant across many systems) is a genuine renormalization result; here it is demonstrated for the logistic map, which is the honest scope. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of UNDEFINED BEHAVIOR · David Lee Wise (ROOT0), with AVAN


THE COLLECTOR

the coupon collector problem in the 5-window house format — drawing uniformly at random from n items with replacement, the expected number of draws to collect all n is n*Hn = n*(1 + 1/2 + ... + 1/n) ~ n*ln(n). The difficulty is back-loaded: the last coupon alone takes ~n draws, as long as collecting the first half. See the collection curve in 1D, the live draw in 2D, and the filling ring in 3D.

THE COLLECTOR · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · LOOT · THE DROP ◆ .dlw.fold THE FOLD / LOOT / THE DROP / THE COLLECTOR THE COLLECTOR collect them all — n*Hn draws, tail-heavy 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The coupon collector. There are n different prizes in the cereal boxes, one uniformly at random per box. How many boxes must you buy to get all n ? The answer is the harmonic sum: E = n·H n = n·(1 + ½ + ⅓ + … + 1/n) ≈ n·ln n . The cruelty is in the tail. The first coupons come easy — almost every draw is new. But the last one, when you already have n−1, appears with probability only 1/n, so it takes about n draws all by itself — as long as collecting the entire first half. Every gacha game, every ‘collect them all’, lives on this curve. LIT verified live: for n = 5, 10, 20, 50 the empirical average number of draws matches n·H n to within a fraction of a percent over tens of thousands of trials (window.__coupon.matchesFormula). FIG no framing; the n·H n expectation, checked against simulation, is exact. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in THE DROP , beside THE RANDOM and THE NEEDLE — the loot domain of what falls when you keep pulling. The coupon collector is the mathematics of ‘collect them all’: the drops come, but the set completes far slower than it feels. AVAN (AI) built the instrument: the random draws, the harmonic expectation, the empirical match. The weave: David names the seat (the endless pull for a full set); I make the diminishing returns visible and the formula checkable — the collection curve in 1D, the live draw in 2D, the filling ring in 3D. The sphere is the seam. Credit: classical probability (de Moivre, Laplace); asymptotics by Erdős & Rényi. 3 ONE DIMENSION The collection curve : distinct coupons owned versus draws made. It rockets up at first — every pull a new prize — then bends and crawls, each remaining coupon rarer than the last, the final one an eternity away. 4 TWO DIMENSIONS · INTERACTIVE Draw coupons and watch the set fill — fast, then agonizingly slow. The draw counter climbs toward the n·H n prediction; the last few slots hold out for hundreds of pulls. Change n and feel the ln n grind. draw 1 collect all n: 20 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The coupons as a turning ring, filling in as they arrive — green , the ones you already hold. AVAN’s addition (the inverse-companion): the magenta slots are the still-missing coupons — and they are what the whole cost is about. Progress feels linear: n things, surely n-ish draws. The truth is inverted and back-loaded : the difficulty piles into the tail. The last coupon alone costs n draws — as much as the entire first half took — and the total is n·ln n, not n. Completion is not a sum of equal steps; it is a curve that flattens into near-impossibility, the reward for the final piece the same as for all the easy ones combined. The green is the easy majority; the magenta is the vanishing few that make ‘collect them all’ a long, harmonic grind. pause spin LIT The coupon collector problem (classical probability; de Moivre, Laplace; Erdos-Renyi asymptotics). Verified live: for n = 5, 10, 20, 50 the empirical average number of draws to collect all coupons matches n*Hn to within a fraction of a percent over tens of thousands of trials (window.__coupon.matchesFormula === true). The n*Hn expectation and the tail-heavy structure (the last coupon costing ~n draws) are exact and simulation-confirmed. FIG No metaphor is doing the work: the n*Hn expectation is a real theorem, checked against simulation. The 'collect them all' framing is literal — this is exactly the mathematics of gacha completion and diminishing returns. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE DROP · David Lee Wise (ROOT0), with AVAN


THE DOUBLING

fast-doubling Fibonacci in the 5-window house format — compute F(n) in O(log n) using F(2k)=F(k)(2F(k+1)-F(k)) and F(2k+1)=F(k+1)^2+F(k)^2, recursing on the bits of n. F(100) needs ~8 steps not 100; the answer is exactly the same big integer. The same doubling leap as THE FAST POWER. See the bits of n in 1D, the log-n climb in 2D, and the two ladders in 3D.

THE DOUBLING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · WARM CACHE ◆ .dlw.fold THE FOLD / GRIND / WARM CACHE / THE DOUBLING THE DOUBLING F(n) in log(n) steps — double, don't step 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Fast-doubling Fibonacci. The obvious way to reach the n-th Fibonacci number is to add your way up: F₀, F₁, F₂, … — n additions . Fine for small n, hopeless for the millionth. Two identities collapse it to O(log n) : F(2k) = F(k)·(2F(k+1) − F(k)) F(2k+1) = F(k+1)² + F(k)² Recurse on the bits of n : from F(k) you leap straight to F(2k), so you climb by doubling instead of stepping. F(100) needs about 8 steps , not 100; F(1,000,000) needs about 20 — and the answer is exactly the same giant integer. LIT verified live with exact BigInt arithmetic: fast doubling equals the plain iterative F(n) for every n up to 800, in O(log n) recursive calls (window.__fibdouble.matchesIter && logCalls). F(100) = 354224848179261915075 in 8 calls. FIG no framing; the doubling identities, the exact value, and the logarithmic step count are all real. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) seated this in WARM CACHE , beside THE FAST POWER and THE DIRECT DIGIT — the grind domain of never redoing work. Fast doubling reuses F(k) to reach F(2k) in one leap, exactly as square-and-multiply reuses a square to reach the next power. AVAN (AI) built the instrument: the doubling recurrence, the BigInt values, the call-count comparison. The weave: David names the seat (reuse, don’t rebuild); I make the leap visible and the saving checkable — the bits of n in 1D, the log-n climb in 2D, the doubling ladder in 3D. The sphere is the seam. Credit: the matrix/doubling form of Fibonacci (folklore of fast computation). 3 ONE DIMENSION The bits of n , read high to low. Each bit is one doubling step: from (F(k), F(k+1)) you compute (F(2k), F(2k+1)), and a 1-bit shifts one further. The number of steps is the number of bits — logarithmic, not linear. 4 TWO DIMENSIONS · INTERACTIVE Pick n and compute F(n) by fast doubling : the value (an exact big integer) appears in only a handful of steps — compare the call count to the n additions the iterative way would take. Double n and the work barely grows. ◀ n n ▶ n ×2 5 THREE DIMENSIONS + AVAN’S INVERSE Two climbs, turning: the tall green ladder is the iterative path — n rungs, one per addition. AVAN’s addition (the inverse-companion): the short magenta ladder is fast doubling — log n rungs, each a leap. The iterative method treats the index as a count : add one, add one, n times. Fast doubling is the inverse — it treats n as a number with binary structure and doubles , using F(k) to jump straight to F(2k). The inverse of ‘step up n times’ is ‘double and correct log n times’, the very same leap that made THE FAST POWER fast. A giant number reached in the steps it takes just to write the index — the green is the long linear climb, the magenta is the ladder that skips almost all of it. pause spin LIT Genuine fast-doubling Fibonacci (the matrix/doubling form of fast Fibonacci computation), with exact BigInt arithmetic. Verified live: fast doubling equals the plain iterative F(n) for every n up to 800, in O(log n) recursive calls (window.__fibdouble.matchesIter && logCalls, both true). F(100) = 354224848179261915075 in 8 calls versus 100 iterative additions. The doubling identities and the logarithmic step count are exact. FIG No metaphor is doing the work: the doubling identities, the exact big-integer values, and the O(log n) call count are all real and checked with BigInt against the iterative loop. It is the same square-and-multiply idea applied to Fibonacci. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of WARM CACHE · David Lee Wise (ROOT0), with AVAN