Polynomial-time reduction of signed binary integers #
Reduce a signed binary integer modulo a binary natural and return the nonnegative residue.
The construction first computes r = z.natAbs % q. For a negative integer it returns
(q - r) % q; otherwise it returns r. This reuses binary natural division, subtraction
and the sign-magnitude interface, without enumerating the modulus or constructing a new machine.
The certificate is total: at modulus zero the result is z.toNat, matching Lean's integer
remainder convention followed by truncation at zero.
Main results #
Turing.MultiTapeTM.ComputableInPolyTime.intBin_emodNat: signed reduction with both operands and the result encoded in binary.Turing.MultiTapeTM.ComputableInPolyTime.intBin_emodNat': composition with computed inputs.
References #
The proof uses Lean's Int.emod_natAbs_of_nonneg and Int.emod_natAbs_of_neg and the native
arithmetic certificates in PolyTime/Int/Binary and PolyTime/Nat/BinaryDiv.
Reduce a signed binary integer modulo a binary natural. At modulus zero the result is the integer truncated at zero; no positive-modulus hypothesis is required.
Reduce computed signed integers by computed binary natural moduli, fixing the intermediate encodings for proof search.