def mont_ok
import bend-collections@1.0.0.0/src/math/w64.bend as W64import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
632# m odd with 2^32 <= m < 2^63 and m minv(m) = -1 mod 2^64 (always so for odd
633# m; checked, so the proof needs no Hensel lemma)
634def mont_ok(+m: W.U64) -> Bool:
635 Bool.and(Bool.and(odd(m), eq(mul(m, minv(m)), W.U64{4294967295, 4294967295})), Bool.and(Bool.not(U32.is_zero(hi(m))), U32.is_lt(hi(m), 2147483648)))