Native 32-bit Montgomery Reduction #
Raw word operations for Montgomery reduction with radix 2 ^ 32.
The native pre-subtraction quotient in 32-bit Montgomery reduction.
Instances For
Conditional subtraction of the modulus in 32-bit Montgomery reduction.
Instances For
theorem
Montgomery.Native32.reduceRaw_eq_conditionalSubtract
{p32 negInv : UInt32}
{p64 x : UInt64}
:
theorem
Montgomery.Native32.reduceRaw_toNat
{modulus : ℕ}
{p32 negInv : UInt32}
{p64 x : UInt64}
(hp32 : p32.toNat = modulus)
(hp64 : p64.toNat = modulus)
(hp_pos : 0 < modulus)
(hp_bound : modulus < 2 ^ 31)
(h : x.toNat < modulus * 2 ^ 32)
:
Native Montgomery reduction agrees with the natural-number specification.
theorem
Montgomery.Native32.reduceRaw_cast
{modulus : ℕ}
{p32 negInv : UInt32}
{p64 x : UInt64}
[Fact (Nat.Prime modulus)]
(hp32 : p32.toNat = modulus)
(hp64 : p64.toNat = modulus)
(hp_pos : 0 < modulus)
(hp_bound : modulus < 2 ^ 31)
(hnegInv : negInv.toNat * modulus % 2 ^ 32 = 2 ^ 32 - 1)
(hRne : ↑(2 ^ 32) ≠ 0)
(h : x.toNat < modulus * 2 ^ 32)
: