def ev_q

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

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/spec/crypto/secp256k1/schnorr.bend as SS
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

76def ev_q(+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.value(one, S.select(q, S.neg(x), x)) == SS.even_b(FS.order(one), q, FS.value(one, x)) : Nat}:
77  match q:
78    case 0n:
79      %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.value(one, _) == FS.value(one, x) : Nat}
80      {==}
81    case 1n:
82      %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.value(one, _) == FS.mneg(FS.order(one), FS.value(one, x)) : Nat}
83      SO.neg_v(one, h1, x, hx)
84    case 2n+ +c:
85      Empty.absurd({FS.value(one, S.select(2n+c, S.neg(x), x)) == SS.even_b(FS.order(one), 2n+c, FS.value(one, x)) : Nat}, SL.not01(c, hq))

Uses (20)

Used by (1)