def andm

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/u32and.bend:42

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/u32and.bend as U32and
import Base
import bend-collections-laws-crypto@1.0.0.0/spec/lib/common.bend as C
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/logic.bend as L
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/word.bend as WD

42# x and c for a mask constant c = 2^k - 1
43def andm(+x: U32, +k: Nat, +c: U32, +hc: {c == U32{WD.mask(32n, k)} : U32}) -> {v(U32.and(x, c)) == C.low(k, v(x)) : Nat}:
44  L.subst(U32, z => {v(U32.and(x, z)) == C.low(k, v(x)) : Nat}, U32{WD.mask(32n, k)}, c, Equal.sym(U32, c, U32{WD.mask(32n, k)}, hc), andm0(x, k))

Uses (9)

Used by (2)