feat(univariate): add fixed-domain barycentric interpolation#184
feat(univariate): add fixed-domain barycentric interpolation#184eliasjudin wants to merge 1 commit intoVerified-zkEVM:masterfrom
Conversation
🤖 Gemini PR SummaryAdds a fixed-domain barycentric interpolation module to the univariate polynomial library, optimized for repeated evaluations over a stable set of nodes. Key Definitions
Mathematical ResultsThe following theorems relate the new evaluator to standard interpolation forms:
All theorems and definitions are fully proved; the implementation contains no Documentation and Infrastructure
Statistics
Lean Declarations ✏️ **Added:** 9 declaration(s)
🎨 **Style Guide Adherence**There are 28 violations of the style guide. They are grouped by rule below:
📄 **Per-File Summaries**
Last updated: 2026-04-04 11:29 UTC. |
853a5a5 to
2691ef9
Compare
Add CLagrange.BarycentricDomain with precomputed barycentric weights, the second-form evaluator, and correctness theorems identifying it with Lagrange.interpolate, CLagrange.interpolate, and CLagrange.interpolatePow. Co-authored-by: Aristotle (Harmonic) <aristotle-harmonic@harmonic.fun>
2691ef9 to
f2cb15d
Compare
Summary
Add
CompPoly.Univariate.Barycentric, introducing:CLagrange.BarycentricDomain, bundling pairwise distinct nodes and precomputed weights;BarycentricDomain.eval, the second-form barycentric evaluator with an explicit node-hit branch;Lagrange.interpolate,CLagrange.interpolate, andCLagrange.interpolatePow.The exposed evaluator is computable: the node-hit branch uses finite search over
Fin nrather than a classical witness.This PR adds proofs autoformalised by @Aristotle-Harmonic.
Motivation
CLagrange.interpolateandCLagrange.interpolatePowalready provide interpolation, but repeated evaluation on a fixed node set had no proof-backed API that reuses the one-time weight computation.Mathematical content
For a field
R, pairwise distinct nodesx : Fin n → R, and valuesy : Fin n → R, the stored weights satisfyw_i = ∏_{j ≠ i} (x_i - x_j)⁻¹.The evaluator is defined by:
z = x_i, returny_i;(∑ i, w_i * y_i * (z - x_i)⁻¹) / (∑ i, w_i * (z - x_i)⁻¹).The main results prove:
weights_eq_nodalWeight;eval_at_node;eval_eq_interpolate_eval, namelyBarycentricDomain.eval y z = (Lagrange.interpolate Finset.univ x y).eval z;eval_eq_cinterpolate_eval;ofPow_eval_eq_interpolatePow_eval.Testing
./scripts/update-lib.sh./scripts/check-imports.shlake buildlake test./scripts/lint-style.sh CompPoly/Univariate/Barycentric.lean tests/CompPolyTests.lean tests/CompPolyTests/Univariate/Barycentric.leanpython3 ./scripts/check-docs-integrity.pyrg -n "sorry|admit|axiom|unsafe" CompPoly.lean CompPoly/**/*.leanRefs #183
Co-authored-by: Aristotle (Harmonic) aristotle-harmonic@harmonic.fun