THE FOLD / BOSS / THE-GATEKEEPER / THE CIPOLLA
THE CIPOLLA
a square root through a field extension
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Cipolla’s algorithm finds a modular square root — a solution to x² ≡ n (mod p) — by stepping outside the field. It picks a value a so that a²−n is a non-residue, then builds the quadratic extension Fp² = Fp[√(a²−n)] and raises (a + √(a²−n)) to the power (p+1)/2. Remarkably, the result lands back in Fp as a genuine square root of n. Where Tonelli–Shanks grinds through the 2-adic structure, Cipolla takes one elegant excursion into a larger field — and it handles the hard case p ≡ 1 (mod 4) with no special looping.
LIT verified live: over ~2000 random (prime p, quadratic residue n), Cipolla returns an x with x² ≡ n (mod p), including many p ≡ 1 (mod 4) (window.__cipolla). FIG no framing; the Fp² arithmetic and exponentiation run in-browser.
LIT verified live: over ~2000 random (prime p, quadratic residue n), Cipolla returns an x with x² ≡ n (mod p), including many p ≡ 1 (mod 4) (window.__cipolla). FIG no framing; the Fp² arithmetic and exponentiation run in-browser.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-gatekeeper — the square root sits behind a gate, and the key is to step into a bigger field, turn once, and step back with it. AVAN (AI) built the instrument: the non-residue search, Fp² multiplication, fast exponentiation, and the x²≡n check.
Credit as content: Michele Cipolla (1907). The weave: David names the gatekeeper; I confirm the excursion into Fp² returns a true square root, back inside Fp.
Credit as content: Michele Cipolla (1907). The weave: David names the gatekeeper; I confirm the excursion into Fp² returns a true square root, back inside Fp.
3 ONE DIMENSION
The squares mod p fold two values onto each residue; Cipolla inverts that fold for any quadratic residue n.
4 TWO DIMENSIONS · INTERACTIVE
Pick a prime and a residue; Cipolla returns x (and p−x), and squaring it recovers n exactly.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the recovered square root, back inside Fp.
AVAN’s addition (the inverse-companion): don’t search Fp — step outside it. The inverse of ‘square a number’ is ‘pick a non-residue direction, exponentiate in Fp², and the imaginary part vanishes, leaving the root.’ Magenta is the non-residue excursion; green is the root it returns. Out through a bigger field, back with the answer.
LIT Genuine Cipolla's algorithm for modular square roots (Michele Cipolla, 1907), the field-extension alternative to Tonelli–Shanks. Verified live: over ~2000 random (prime p ≤ 2000, quadratic residue n), the F_{p²} exponentiation (a+√(a²−n))^{(p+1)/2} returns an x with x²≡n mod p, including many p≡1 mod4 (window.__cipolla.allCorrect, .covers1mod4).
FIG No framing: the F_{p²} arithmetic and fast exponentiation run in-browser. The AVAN inverse is honest — instead of searching F_p for a root, one picks a non-residue direction, exponentiates in the quadratic extension F_{p²}, and the imaginary part vanishes, leaving the root back in F_p. Magenta is the non-residue excursion; green is the root it returns. Out through a bigger field, back with the answer.
FIG No framing: the F_{p²} arithmetic and fast exponentiation run in-browser. The AVAN inverse is honest — instead of searching F_p for a root, one picks a non-residue direction, exponentiates in the quadratic extension F_{p²}, and the imaginary part vanishes, leaving the root back in F_p. Magenta is the non-residue excursion; green is the root it returns. Out through a bigger field, back with the answer.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE-GATEKEEPER · David Lee Wise (ROOT0), with AVAN