def absdiff

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/secp256k1/listops.bend:138

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/listops.bend as Listops
import Base

138# (x - y) + (y - x) == 0 exactly when x == y
139def absdiff(x: Nat, y: Nat) -> {Nat.is_eq(Nat.add(Nat.sub(x, y), Nat.sub(y, x)), 0n) == Nat.is_eq(x, y) : Bool}:
140  match x y:
141    case 0n 0n:
142      {==}
143    case 0n 1n+q:
144      {==}
145    case 1n+p 0n:
146      {==}
147    case 1n+p 1n+q:
148      absdiff(p, q)

Uses (5)

Used by (1)