Exact Horner semantics for a bounded block fold #
A partial fold of length n ≤ total evaluates the blocks beginning at
total-n, with its first block at exponent zero. This invariant makes the
reverse traversal explicit and gives the full coefficient sum at n=total.
The width and zero-modulus statements hold even outside this partial-fold
semantic domain.
theorem
Complexity.BitPolynomial.Internal.coefficientBlock_length_le
(coeffs : List Bool)
(width j : ℕ)
:
theorem
Complexity.BitPolynomial.Internal.blockEvalStep_length
(coefficient seed modulus state : List Bool)
:
theorem
Complexity.BitPolynomial.Internal.ofBits_blockEvalScan
(coeffs : List Bool)
(width : ℕ)
(seed modulus : List Bool)
(total : ℕ)
(count : List Bool)
(nonzero : ofBits modulus ≠ 0)
(bound : count.length ≤ total)
:
ofBits (blockEvalScan coeffs width seed modulus total count) = (∑ j ∈ Finset.range count.length,
ofBits (coefficientBlock coeffs width (total - count.length + j)) * ofBits seed ^ j) %ₘ ofBits modulus
theorem
Complexity.BitPolynomial.Internal.ofBits_blockEvalBits
(coeffs : List Bool)
(width : ℕ)
(seed modulus count : List Bool)
(nonzero : ofBits modulus ≠ 0)
:
ofBits (blockEvalBits coeffs width seed modulus count) = (∑ j ∈ Finset.range count.length, ofBits (coefficientBlock coeffs width j) * ofBits seed ^ j) %ₘ ofBits modulus