feat(univariate): Horner's method implementation#199
feat(univariate): Horner's method implementation#199dhsorens merged 9 commits intoVerified-zkEVM:masterfrom
Conversation
🤖 PR SummaryMathematical Formalization
Refactoring & Architecture
Documentation
Statistics
Lean Declarations ✏️ **Added:** 3 declaration(s)
🎨 **Style Guide Adherence**The following style guide violations were found:
📄 **Per-File Summaries**
Last updated: 2026-04-29 14:33 UTC. |
dhsorens
left a comment
There was a problem hiding this comment.
this looks great, thank you @DimitriosMitsios ! Once we move the theorems as in the comment above I'm happy to merge this. What I would ideally like next is actually swap eval₂ for eval₂Horner and fix all the proofs.
More explicitly, in the next PR we should rewrite eval₂ => eval₂Naive and eval₂Horner => eval₂. Keep the theorems you've already proved as a proof that eval₂ (the Horner evaluation) is correct wrt the naive spec eval₂Naive.
| def eval₂Horner [Semiring R] [Semiring S] (f : R →+* S) (x : S) (p : CPolynomial.Raw R) : S := | ||
| p.foldr (fun a acc => acc * x + f a) 0 | ||
|
|
||
| private lemma foldl_zipIdx_eq_foldr_pow_k [Semiring R] [Semiring S] |
There was a problem hiding this comment.
could we move this lemma and the theorem below to Univariate/Raw/Proofs.lean?
There was a problem hiding this comment.
Ok, I think that it's fixed now!
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30c3016 to
db10879
Compare
dhsorens
left a comment
There was a problem hiding this comment.
looks good, thank you! merging
This PR implements Horner's method (
eval₂Horner) for univariate polynomial evaluation and provides a correctness proof (eval₂_eq_eval₂Horner). It does not replace the current implementation ofeval₂and thus there is no proof breakage in the codebase. This is a deliberate choice that avoids refactoring all the proofs that depend onevaleach time a new optimisation is introduced during Phase 2 of the Roadmap e.g. multi-point evaluation.See also a much larger PR #190 that goes the other way modifying directly
eval, eval₂, fixing broken proofs and adding even more optimisations!Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com