law sub_wrap

bend-osdev-word64@0.1.1.0 · LAWS.bend:140

import bend-osdev-word64@0.1.1.0/LAWS.bend as LAWS
import Base
import bend-osdev-u32@0.1.0.0/u32.bend as U
import bend-osdev-word64@0.1.1.0/word64.bend as W

140# Subtraction, for every pair of words: the difference plus the subtrahend
141# is the minuend, plus 2^64 when the subtrahend is the larger; when it is
142# not, the difference is the Nat difference.
143law sub_wrap:
144  for +a: W.W64
145  for +b: W.W64
146  {Nat.add(W.W64.to_nat(W.W64.sub(a, b)), W.W64.to_nat(b)) == Nat.add(W.W64.to_nat(a), U.U32Nat.dbl(64n, U.U32Nat.bit(W.W64.is_lt(a, b)))) : Nat}

Uses (17)

Used by (2)