feat(num): real-algebraic number kernel — replace the quadratic Ext tower #19

Merged
toph merged 9 commits from feat/real-algebraic-kernel into main 2026-06-30 12:58:29 +00:00
Owner

Slice 1 of axiom 7 (Justin ⑦, the Beloch fold): replaces Num's quadratic Ext tower with an exact real-algebraic kernel, so creases of degree ≤ 3 — including the casus-irreducibilis cubics axiom 7 needs — become representable. No .bel surface change; axioms 1–6 are unchanged in behaviour.

  • New lib/poly.ml: ℚ-polynomials — arithmetic, Sylvester resultant, Euclidean gcd/squarefree, Sturm sequences, real-root isolation. [bpr2006]
  • lib/num.ml rewritten: Rat of Q.t | Alg { poly; lo; hi } — the unique real root of a squarefree ℚ-polynomial in an isolating rational interval. Arithmetic builds the result's defining polynomial by resultant-via-interpolation (Alg±Rat/Alg×Rat fast paths); sqrt via poly(y²); exact sign/compare/equal by interval refinement; new real_roots. The Rat fast-path keeps axioms 1–4 in ℚ.
  • Public Num interface frozen (+ real_roots), so geom/isometry/fold_state/fold_emit/eval compile unchanged.
  • ADR 0012 supersedes 0010; bpr2006 (Basu–Pollack–Roy) added to the bibliography.

The casus irreducibilis is why a Cbrt generator won't do — three real roots that aren't real radicals — so the kernel stays on the real line via defining-polynomial + isolating interval, no complex arithmetic. Cost: √-heavy axioms 5/6 lose the closed-form a+b√d speed; correctness over speed, as ADR 0010 already bargained.

108/108 tests pass. Next slice: the axiom 7 statement surface (map .p onto --d and .q onto --e) on top of this kernel.

Design: docs/superpowers/specs/2026-06-30-real-algebraic-kernel-design.md

Slice 1 of axiom 7 (Justin ⑦, the Beloch fold): replaces `Num`'s quadratic `Ext` tower with an exact real-algebraic kernel, so creases of degree ≤ 3 — including the casus-irreducibilis cubics axiom 7 needs — become representable. No `.bel` surface change; axioms 1–6 are unchanged in behaviour. - New `lib/poly.ml`: ℚ-polynomials — arithmetic, Sylvester resultant, Euclidean gcd/squarefree, Sturm sequences, real-root isolation. `[bpr2006]` - `lib/num.ml` rewritten: `Rat of Q.t | Alg { poly; lo; hi }` — the unique real root of a squarefree ℚ-polynomial in an isolating rational interval. Arithmetic builds the result's defining polynomial by resultant-via-interpolation (`Alg±Rat`/`Alg×Rat` fast paths); `sqrt` via `poly(y²)`; exact `sign`/`compare`/`equal` by interval refinement; new `real_roots`. The `Rat` fast-path keeps axioms 1–4 in ℚ. - Public `Num` interface frozen (+ `real_roots`), so `geom`/`isometry`/`fold_state`/`fold_emit`/`eval` compile unchanged. - ADR 0012 supersedes 0010; `bpr2006` (Basu–Pollack–Roy) added to the bibliography. The casus irreducibilis is why a `Cbrt` generator won't do — three real roots that aren't real radicals — so the kernel stays on the real line via defining-polynomial + isolating interval, no complex arithmetic. Cost: √-heavy axioms 5/6 lose the closed-form `a+b√d` speed; correctness over speed, as ADR 0010 already bargained. 108/108 tests pass. Next slice: the axiom 7 statement surface (`map .p onto --d and .q onto --e`) on top of this kernel. Design: `docs/superpowers/specs/2026-06-30-real-algebraic-kernel-design.md`
toph merged commit 35ec244ed9 into main 2026-06-30 12:58:29 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!19
No description provided.