feat(ReedSolomon): certify the forward NTT as a Reed-Solomon encoder - #266
feat(ReedSolomon): certify the forward NTT as a Reed-Solomon encoder#266Abraxas1010 wants to merge 2 commits into
Conversation
🤖 PR SummaryAdds Mathematical Formalization
Infrastructure
Statistics
Lean Declarations ✏️ Added: 5 declaration(s)
📋 **Additional Analysis**The diff introduces a new module 📄 **Per-File Summaries**
Last updated: 2026-07-28 14:31 UTC. |
|
Merged current Flagging for review because this side of the Reed-Solomon surface now has downstream consumers: the sibling decoder PR (#267) merged on 12 July, and Verified-zkEVM/ArkLib#574 integrates CompPoly's Guruswami–Sudan decoder against ArkLib Reed-Solomon inputs. If it would make review cheaper to split the encoder certificate from the supporting lemmas, or to rebase rather than merge, happy to do either. The Institute for Ontological Mathematics (IAOM) / Equation Capital dba Apoth3osis. |
Summary
Adds
CompPoly/Univariate/ReedSolomon/NTTEncode.lean, tying two existing developments together: over the evaluation domain induced by a radix-2 NTT domain, the forward NTT of a message polynomial's coefficients is exactly the Reed–Solomon encoding.nttDomainToRS : NTT.Domain F → ReedSolomon.Domain F— the node array#[ω⁰, …, ω^(n-1)], nodup viaIsPrimitiveRoot.pow_inj.forwardImpl_eq_encode—Forward.forwardImpl D (messagePoly msg).val = (encode (nttDomainToRS D) msg).toArray, for everymsg : Vector F kwithk ≤ D.n. No padding is needed:messagePolytrims, so the degree bound suffices; the degree obligation forforwardImpl_eq_evalOnDomainis discharged frommessagePoly_degree_lt+degree_toPoly(with thep = 0case from2^logN > 0).nttCodeword/nttCodeword_eq_encode— the vector-level packaging.#print axioms forwardImpl_eq_encode:[propext, Classical.choice, Quot.sound].Why
This gives the
O(n log n)evaluation path a certified encoder semantics: fast-encoded words provably live in the code the definitional encoder generates. Downstream (in ArkLib, where we are separately bridgingReedSolomon.encodeto the abstractReedSolomon.code— see the coordination note on ArkLib#574) this composes to "the NTT output is a member of the abstract Reed–Solomon code", the runnable content FRI-style proximity statements quantify over.The module docstring records the natural-order caveat explicitly:
NTTFast.forwardImplis bit-reversed (forwardImpl_eq_bitRevPermute_evalOnDomain), so this file deliberately usesNTT.Forward.forwardImpl; the fast variant composes withbitRevPermuteas follow-up.Validation performed (not in the diff)
Full
lake build CompPolygreen at heade95ba1b(2517 jobs, warning-free). Concrete corpus overZMod 17(ω = 2, n = 8, k = 4, with a fully constructiveIsPrimitiveRootwitness — bounded case split, no order-of machinery): forward NTT andencodeagree byte-for-byte (#[10, 15, 7, 13, 15, 11, 6, 16]). Mutation check: perturbing the induced domain's node order makesforwardImpl_eq_encodefail to compile (3 errors) — the equality is genuinely order-sensitive, not definitional coincidence.Contributed by The Institute for Ontological Mathematics (IAOM) / Equation Capital dba Apoth3osis.