@[simp]
The small-modulus lower-bound proof stored by BarrettCtx.mk.
@[simp]
The small-modulus upper-bound proof stored by BarrettCtx.mk.
@[simp]
The reciprocal word stored by BarrettCtx.mk.
Multiply two residues modulo p using the Barrett reduction context. The
caller-side condition a, b < p < 2^32 ensures the product fits in one
UInt64.
Equations
- ctx.mulMod a b = barrettReduce ctx (a * b)
Instances For
theorem
BarrettCtx.mulMod_lt
{p : UInt64}
(ctx : BarrettCtx p)
(a b : UInt64)
(ha : a < p)
(hb : b < p)
:
Barrett modular multiplication returns a residue strictly below the modulus.
@[simp]
Zero is a left absorbing element for Barrett modular multiplication.
@[simp]
Zero is a right absorbing element for Barrett modular multiplication.
@[simp]
One is a left identity for Barrett modular multiplication on reduced residues.
@[simp]
One is a right identity for Barrett modular multiplication on reduced residues.
theorem
BarrettCtx.mulMod_comm
{p : UInt64}
(ctx : BarrettCtx p)
(a b : UInt64)
(ha : a < p)
(hb : b < p)
:
Barrett modular multiplication is commutative on reduced residues.