def vok

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/pver.bend:79

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/pver.bend as Pver
import Base
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/spec/crypto/secp256k1/ecdsa.bend as ES
import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/point.bend as P
import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/ecdsa.bend as E
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/point.bend as PT

79def vok(+one: Nat, +h1: {one == 1n : Nat}, +q: P.Point, +hq: {PT.pred(one, q) == True{} : Bool}, +z: List<&2, Nat>, +hz: {FS.reduced(one, FS.order(one), z) == True{} : Bool}, +r: List<&2, Nat>, +hlr: {FS.limbs16(one, 16n, r) == True{} : Bool}, +s: List<&2, Nat>, +hls: {FS.limbs16(one, 16n, s) == True{} : Bool}, a: Bool, b: Bool, c: Bool, +ha: {ES.scalar_ok(one, FS.value(one, r)) == a : Bool}, +hb: {ES.scalar_ok(one, FS.value(one, s)) == b : Bool}) -> {E.verify_ok(q, z, r, s, Bool.and(Bool.and(a, b), c)) == ES.verify_ok(one, PT.pv(one, q), FS.value(one, z), FS.value(one, r), FS.value(one, s), Bool.and(Bool.and(a, b), c)) : Bool}:
80  match a b c:
81    case True{} True{} True{}:
82      vrs(one, h1, q, hq, z, hz, r, ok_red(one, r, hlr, ha), s, ok_red(one, s, hls, hb))
83    case True{} True{} False{}:
84      {==}
85    case True{} False{} _:
86      {==}
87    case False{} _ _:
88      {==}

Uses (16)

Used by (1)