def check_r
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/schnorr.bend as Schnorrimport Base
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/curve.bend as CV
67# fail if is_infinite(R) or not has_even_y(R) or x(R) != r
68def check_r(+r: Nat, inf: Bool, a: CV.SAffine) -> Bool:
69 match a:
70 case CV.SAffine{x, y}: Bool.and(Bool.not(inf), Bool.and(Nat.is_eq(Nat.mod(y, 2n), 0n), Nat.is_eq(x, r)))