Correctness and bounds for binary-polynomial remainder #
The scan maintains the monic remainder of the coefficients already read. Its
fixed width gives a state bound independent of the dividend length, and the
outer zero-modulus branch agrees with Polynomial.modByMonic_zero.
theorem
Complexity.BitPolynomial.Internal.remainderScan_correct
(modulus a : List Bool)
(hm : 0 < significantLength modulus)
:
theorem
Complexity.BitPolynomial.Internal.remainderBits_length
(a modulus : List Bool)
:
(remainderBits a modulus).length = if significantLength modulus = 0 then a.length else significantLength modulus - 1