Documentation

CslibFrontier.Computability.PolyTime.ZMod.ModulusSwitch

Native binary modulus switching #

The source and target moduli use binary encNat; representatives and rounded integers use signed binary encIntBin. The certificates charge the complete input bit length and reuse native signed multiplication, division and remainder. No rational-arithmetic machine or unary expansion of the moduli is needed.

Main results #

Scale a signed binary integer by the ratio of two binary naturals and round exactly. At source modulus zero, the rational specification and the implementation both return zero.

Compute the integer implementation of modulus switching on binary parameters and a signed binary representative, returning a binary natural residue. The implementation is total.