law to_nat_or_split
import lawful-words@0.1.0.0/LAWS.bend as LAWSimport Base
266# Or of a word with only bits from k up and a word below 2^k is their sum
267# (no bit in common). Xor likewise.
268law to_nat_or_split:
269 for a: U32
270 for b: U32
271 for k: Nat
272 for ha: {Nat.mod(U32.to_nat(a), Nat.pow(2n, k)) == 0n : Nat}
273 for hb: {Nat.is_lt(U32.to_nat(b), Nat.pow(2n, k)) == True{} : Bool}
274 {U32.to_nat(U32.or(a, b)) == Nat.add(U32.to_nat(a), U32.to_nat(b)) : Nat}
Uses (10)
Used by (0)
No other definition uses this definition.