def ev_qr

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/pschn.bend:87

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/pschn.bend as Pschn
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/src/crypto/secp256k1/limbs.bend as L
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/crypto/secp256k1/scalarops.bend as SO
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/sel.bend as SL

87def ev_qr(+one: Nat, +h1: {one == 1n : Nat}, q: Nat, +x: List<&2, Nat>, +hx: {FS.reduced(one, FS.order(one), x) == True{} : Bool}, +hq: {Nat.is_lt(q, 2n) == True{} : Bool}) -> {FS.reduced(one, FS.order(one), S.select(q, S.neg(x), x)) == True{} : Bool}:
88  match q:
89    case 0n:
90      %Equal.sym(List<&2, Nat>, L.select(0n, S.neg(x), x), x, SL.sel0(one, 16n, S.neg(x), x, SL.sl16(one, S.neg(x), SO.neg_r(one, h1, x, hx)), SL.sl16(one, x, hx))) : {FS.reduced(one, FS.order(one), _) == True{} : Bool}
91      hx
92    case 1n:
93      %Equal.sym(List<&2, Nat>, L.select(1n, S.neg(x), x), S.neg(x), SL.sel1(one, 16n, S.neg(x), x, SL.sl16(one, S.neg(x), SO.neg_r(one, h1, x, hx)), SL.sl16(one, x, hx))) : {FS.reduced(one, FS.order(one), _) == True{} : Bool}
94      SO.neg_r(one, h1, x, hx)
95    case 2n+ +c:
96      Empty.absurd({FS.reduced(one, FS.order(one), S.select(2n+c, S.neg(x), x)) == True{} : Bool}, SL.not01(c, hq))

Uses (16)

Used by (1)