law to_nat_sub

lawful-words@0.1.0.0 · LAWS.bend:112

import lawful-words@0.1.0.0/LAWS.bend as LAWS
import Base

112# a - b wraps: it is a + 2^32 - b, modulo 2^32.
113law to_nat_sub:
114  for a: U32
115  for b: U32
116  {U32.to_nat(U32.sub(a, b)) == Nat.mod(Nat.sub(Nat.add(U32.to_nat(a), Nat.pow(2n, 32n)), U32.to_nat(b)), Nat.pow(2n, 32n)) : Nat}

Uses (9)

Used by (0)

No other definition uses this definition.