def ev512

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/pscal.bend:25

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/pscal.bend as Pscal
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/spec/crypto/secp256k1/field.bend as FS
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/nat.bend as N
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/limbs.bend as LV
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/scalarops.bend as SO

25# a 16-limb value is below 2^512
26def ev512(+one: Nat, +h1: {one == 1n : Nat}, +x: List<&2, Nat>, +hx: {FS.limbs16(one, 16n, x) == True{} : Bool}) -> {Nat.is_lt(LV.ev(x), Nat.mul(C.shift(256n, one), C.shift(256n, one))) == True{} : Bool}:
27  +t = C.shift(256n, one)
28  SO.lt3(one, h1, LV.ev(x), N.lt_le_trans(LV.ev(x), t, Nat.add(t, Nat.add(t, t)), SO.tt_lt(one, h1, x, hx), N.le_add_right(t, Nat.add(t, t))))

Uses (13)

Used by (2)