mod package:numeric-prelude
the modulus can be Nothing to denote a generic constant like
zero and
one which could not be bound to a specific
modulus so far
Abstraction of bases of finite dimensional modules
\n (QC.NonZero m) -> let (q,r) = divMod n m in n == (q*m+r :: Integer)
Allows division by zero. If the divisor is zero, then the dividend is
returned as remainder.
A normalization step which reduces all elements in sub-lists modulo
their denominators. Zeros might be the result, that must be remove
with
removeZeros.
\x y -> case (PolyCore.normalize x, PolyCore.normalize y) of (nx, ny) -> not (null (ratioPoly ny)) ==> mapSnd PolyCore.normalize (PolyCore.divMod nx ny) == mapPair (PolyCore.normalize, PolyCore.normalize) (PolyCore.divMod x y)
\x y -> not (isZero (ratioPoly y)) ==> let z = fst $ PolyCore.divMod (Poly.coeffs x) y in PolyCore.normalize z == z
\x y -> case PolyCore.normalize $ ratioPoly y of ny -> not (null ny) ==> List.length (snd $ PolyCore.divMod x y) < List.length ny
The modulus will always have one element less than the divisor. This
means that the modulus will be denormalized in some cases, e.g.
mod [2,1,1] [1,1,1] == [1,0] instead of [1].
divModLazy accesses the divisor in a lazy way. However this is only
relevant if the dividend is smaller than the divisor. For large
dividends the divisor will be accessed multiple times but since it is
already fully evaluated it could also be strict.
This function has a strict divisor and maintains the chunk structure
of the dividend at a smaller scale.