def xor_bits
import bend-collections-laws-math@1.0.0.0/spec/math/random/pcg.bend as Pcgimport Base
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C
29# the exclusive or of the low w bits of a and b
30def xor_bits(w: Nat, +a: Nat, +b: Nat) -> Nat:
31 match w:
32 case 0n:
33 0n
34 case 1n+k:
35 Nat.add(b2n(Bool.not(Nat.is_eq(C.bit(a), C.bit(b)))), Nat.double(xor_bits(k, C.half(a), C.half(b))))
Uses (8)
Used by (13)
- bend-collections-laws-math@1.0.0.0/spec/math/random/pcg:dxsm1
- bend-collections-laws-math@1.0.0.0/proofs/math/random/proof_pcg:xs
- bend-collections-laws-math@1.0.0.0/spec/math/random/pcg:dxsm3
- bend-collections-laws-math@1.0.0.0/proofs/math/random/pcg/xor:step_eq
- bend-collections-laws-math@1.0.0.0/proofs/math/random/pcg/xor:xor32
- …