forked from Verified-zkEVM/CompPoly
-
Notifications
You must be signed in to change notification settings - Fork 0
Project Documentation
erdkocak edited this page Mar 28, 2026
·
1 revision
The goal of this project is to build a kernel-safe and efficient NTT-based fast multiplication path for CompPoly in Lean 4.
We want the implementation to be:
- mathematically clean
- executable inside Lean
- suitable for full formal verification
The implementation is currently split into four main modules.
Domain.lean defines the parameters of a radix-2 NTT domain:
- transform size
2^logN - primitive root of unity
omega - proof that
omegais a primitive root - proof that the domain size is invertible in the field
Forward.lean contains:
- a direct mathematical NTT specification
- an iterative radix-2 butterfly implementation
- bit-reversal permutation support
Inverse.lean contains:
- a direct mathematical inverse NTT specification
- an iterative inverse transform
- final normalization by
n⁻¹
FastMul.lean contains the full multiplication pipeline:
- forward transform of both inputs
- pointwise multiplication in evaluation form
- inverse transform
- truncation back to the needed coefficient range
Our methodology separates the code into two layers:
-
Specfunctions: direct mathematical definitions -
Implfunctions: efficient executable implementations
This lets us:
- test the implementation against the specification
- benchmark the optimized version
- later prove that the implementation is equivalent to the specification
Validation currently relies on:
- unit-style test files under the test namespace
- direct comparisons between NTT-based multiplication and naive multiplication
- benchmark runs over the
KoalaBearfield
The benchmark results show that the NTT-based multiplication becomes significantly faster than naive multiplication for medium and large input sizes.
This work matters because verified polynomial multiplication is relevant for:
- formal verification of mathematical software
- cryptographic correctness
- reliable low-level algebraic infrastructure