List-level Horner form of modular composition, reading coefficients from
low to high degree and preserving the acc * g + C c step orientation. The
body of the composeModMonic specification.
Equations
- g.composeModMonicList modulus hmonic [] = 0
- g.composeModMonicList modulus hmonic (c :: cs) = modulus.modByMonic (g.composeModMonicList modulus hmonic cs * g + Hex.FpPoly.C c) hmonic
Instances For
Horner-style modular composition in the quotient F_p[x] / (modulus).
The reduction after each multiplication keeps the intermediate polynomials bounded by the modulus degree while preserving the same result as composing first and reducing once at the end.
Kernel-facing specification: one cons walk of the coefficient list. Compiled
code uses the value-equal downward Array.foldr loop below through
@[csimp].
Equations
- f.composeModMonic g modulus hmonic = g.composeModMonicList modulus hmonic (Hex.DensePoly.toList f)
Instances For
Runtime implementation of composeModMonic: a downward Array.foldr
Horner loop (value-equal to composeModMonic by composeModMonic_eq_impl,
registered @[csimp]).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The reference composeModMonic and the Array.foldr runtime loop compute the
same polynomial.
Register the Array.foldr loop as the compiled implementation of
composeModMonic.
Modular composition of the zero polynomial is 0.
Modular composition of a constant C c reduces C c modulo the monic
modulus.
Executable modular composition agrees with ordinary dense-polynomial composition followed by one reduction modulo the monic modulus.
The converse rewrite direction for composeModMonic_eq_modByMonic_compose.
This is useful when a proof has already produced the reduced ordinary
composition and needs to recover the executable modular-composition spelling.
Executable modular composition agrees with
DensePoly.compose f g % modulus, the quotient-ring spelling preferred by
callers that reason with % rather than Hex.FpPoly.modByMonic.
The result of composeModMonic is already reduced modulo the monic modulus.
The modByMonic spelling of composeModMonic_mod_eq_self, useful for
callers that state reduction via modByMonic rather than %.