def small_val
bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/scalarops.bend:167
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/scalarops.bend as Scalarops
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/src/crypto/secp256k1/scalar.bend as S
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/ineq.bend as I
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/consts.bend as K
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/listops.bend as LO
167def small_val(+one: Nat, +h1: {one == 1n : Nat}, +k: Nat, +hk: {Nat.is_lt(k, FS.order(one)) == True{} : Bool}) -> {FS.value(one, S.small(k)) == k : Nat}:
168 +hk2 = I.lt_subst_r(k, FS.order(one), 1n+K.np(one), K.order_eq(one, h1), hk)
169 +hkt = N.lt_le_trans(k, 1n+K.np(one), C.shift(256n, one), hk2, I.le_subst_r(1n+K.np(one), Nat.add(1n+K.np(one), FS.cn(one)), C.shift(256n, one), K.hm_n(one, h1), N.le_add_right(1n+K.np(one), FS.cn(one))))
170 Equal.trans(Nat, FS.value(one, S.small(k)), LV.ev(S.small(k)), k, LV.ev_value(one, h1, S.small(k)), LO.small_v(one, h1, k, hkt))