def du

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/pdec.bend:59

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/pdec.bend as Pdec
import Base
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/sel.bend as SL
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/curve.bend as CV
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/proofs/crypto/secp256k1/penc.bend as PE

59def du(+one: Nat, +h1: {one == 1n : Nat}, +x: List<&2, Nat>, +y: List<&2, Nat>, +hlx: {FS.limbs16(one, 16n, x) == True{} : Bool}, +hly: {FS.limbs16(one, 16n, y) == True{} : Bool}, a: Bool, bx: Bool, by: Bool, +hbx: {Nat.is_lt(FS.value(one, x), FS.prime(one)) == bx : Bool}, +hby: {Nat.is_lt(FS.value(one, y), FS.prime(one)) == by : Bool}) -> {PE.mpv(one, P.decode_u(x, y, Bool.and(Bool.and(a, Bool.and(bx, by)), P.on_curve(x, y)))) == CV.decompress_if(FS.value(one, x), FS.value(one, y), Bool.and(Bool.and(a, Bool.and(bx, by)), CV.on_curve(FS.prime(one), FS.value(one, x), FS.value(one, y)))) : Maybe<&2, CV.SPoint>}:
60  match a bx by:
61    case True{} True{} True{}:
62      %Equal.sym(Bool, P.on_curve(x, y), CV.on_curve(FS.prime(one), FS.value(one, x), FS.value(one, y)), PE.on_curve_v(one, h1, x, y, SL.red_of(one, x, hlx, hbx), SL.red_of(one, y, hly, hby))) : {PE.mpv(one, P.decode_u(x, y, Bool.and(Bool.and(a, Bool.and(bx, by)), _))) == CV.decompress_if(FS.value(one, x), FS.value(one, y), Bool.and(Bool.and(a, Bool.and(bx, by)), CV.on_curve(FS.prime(one), FS.value(one, x), FS.value(one, y)))) : Maybe<&2, CV.SPoint>}
63      duv(one, h1, x, y, CV.on_curve(FS.prime(one), FS.value(one, x), FS.value(one, y)))
64    case True{} True{} False{}:
65      {==}
66    case True{} False{} _:
67      {==}
68    case False{} _ _:
69      {==}

Uses (19)

Used by (1)