Skip to content

perf(primality): accelerate kernel certificate replay - #10284

Merged
kim-em merged 6 commits into
mainfrom
perf-primality-replay
Sep 15, 2026
Merged

kim-em merged 6 commits into
mainfrom
perf-primality-replay

Conversation

@kim-em

@kim-em kim-em commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Reduce kernel certificate replay with fixed-window powering, checked power-of-two shifts, direct structural folds, and shared Fermat checks. Proved compiler rewrites (@[csimp]) connect the kernel specifications to the original compiled algorithms. Checker acceptance, search budgets, and the exact Curve25519 primality? suggestion are preserved.

Hex wins all eight supplied inputs and all 32 adjacent pairs against compact PrimeCert certificates with matching selected factors and its certified sieve for larger table leaves:

Input Hex kernel PrimeCert kernel
31 bits 0.524 ms 0.579 ms
61 bits 0.470 ms 0.774 ms
123 bits 0.731 ms 1.553 ms
256 bits 1.244 ms 3.234 ms
511 bits 2.627 ms 6.731 ms
512 bits 3.132 ms 10.033 ms
Curve25519 5.178 ms 14.419 ms
Curve448 10.166 ms 35.211 ms

These are complete proof-body kernel checks, excluding imports and elaboration, on Hex/Lean 4.34 and unmodified PrimeCert/Lean 4.33. Every sample is retained. Margins range from 1.11× to 3.46× on this shared host. The earlier PrimeCert Pocklington-leaf variant was slightly faster than its sieve variant; Hex won all eight cases against it too. Curve448 is supplied in both systems, and automatic Hex construction still exhausts there. Chart, sources, and reproduction.

Includes updated SPECs/manual, a checker-only Curve448 fixture, overflow and witness-cache regressions, and arithmetic-specific negative controls. Local verification: full build (14,434 jobs), focused conformance, existing HexArith/HexPrimality/HexIntFactor benchmark verification, and all 64 fresh oracle cases.

🤖 Implemented with Codex assistance.

@kim-em
kim-em force-pushed the perf-primality-replay branch from 0ee3e54 to c9e5f27 Compare September 15, 2026 15:38
@kim-em kim-em changed the title perf(primality): halve Curve25519 kernel replay time versus PrimeCert perf(primality): accelerate kernel certificate replay Sep 15, 2026
@kim-em
kim-em merged commit 615181a into main Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant