Skip to content

Implement generic fast polynomial multiplication - #9585

Open
kim-em wants to merge 9 commits into
mainfrom
poly-fast
Open

Implement generic fast polynomial multiplication#9585
kim-em wants to merge 9 commits into
mainfrom
poly-fast

Conversation

@kim-em

@kim-em kim-em commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • add proof-carrying schoolbook and Karatsuba multiplication plans
  • implement genuine three-product recursion, specialized squaring, and skew-operand blocking
  • add positive-length cyclic and negacyclic reference folds with checked zero-length forms
  • add guarded polynomial/truncated-series reversal bridges
  • add always-run conformance coverage for cutoff, odd split, skew, slice, reversal, cyclic, and negacyclic cases
  • register Mathlib-free scientific benchmarks for schoolbook, balanced Karatsuba, Karatsuba squaring, and 64:1 skew multiplication
  • correct three unsound signatures/statements discovered while implementing the merged SPEC

Spec corrections

  • zero-extended reversal must guard indices past f.size
  • MulPlan/DivPlan/GcdStep must derive the coefficient zero from the ring rather than accept an unrelated Zero
  • DivPlan.ofMonic also needs q ≠ 0, since the zero polynomial is monic in a degenerate commutative ring

Verification

  • lake build HexPolyFast hexpolyfast_bench conformance/HexPolyFast/Conformance.lean
  • .lake/build/bin/hexpolyfast_bench list
  • .lake/build/bin/hexpolyfast_bench verify
  • python3 scripts/ci/check_benches_mathlib_free.py
  • python3 scripts/bench/check_factor_sweep_freshness.py
  • python3 scripts/check_dag.py
  • source header and line-count lints
  • git diff --check

This PR is the generic multiplication slice. It intentionally does not add semantic wrappers for later milestones: reciprocal/division must use planned clipped products, half-gcd must contain real grouped recursion, and multipoint evaluation must use the reusable remainder tree before those APIs land.

@kim-em kim-em changed the title Build the generic fast polynomial arithmetic core Implement generic fast polynomial multiplication Aug 25, 2026
Kim Morrison added 5 commits August 25, 2026 04:05
The schoolbook path has quadratic coefficient work. Balanced multiplication and specialized squaring satisfy the three-recursion Karatsuba recurrence; the fixed 64-block skew dispatcher preserves that asymptotic bound.
Kim Morrison and others added 4 commits August 25, 2026 04:38
# Conflicts:
#	.github/workflows/ci.yml
#	scripts/bench/proof_only_runtime_exemptions.json
# Conflicts:
#	.github/workflows/ci.yml
#	scripts/bench/proof_only_runtime_exemptions.json
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