def add_cancel

bend-collections-laws-crypto@1.0.0.0 · proofs/math/natural/arith.bend:40

import bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend as Arith
import Base
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/nat.bend as N

40# c + a == c + b gives a == b   (Mathlib Nat.add_left_cancel)
41def add_cancel(+c: Nat, +a: Nat, +b: Nat, +e: {Nat.add(c, a) == Nat.add(c, b) : Nat}) -> {a == b : Nat}:
42  match c:
43    case 0n:
44      e
45    case 1n+ +cp:
46      add_cancel(cp, a, b, N.succ_inj(Nat.add(cp, a), Nat.add(cp, b), e))

Uses (3)

Used by (15)