Fixed-width binary encodings of natural numbers #
Big-endian, fixed-width binary encoding Nat.toBits with its exact decoder
Nat.fromBits and round-trip lemmas. Values wider than the target width are
truncated modulo 2 ^ w.
This file lives in Complexitylib/Mathlib/ because it extends a Mathlib
type in its home (root) namespace — the sanctioned exception to the
Complexity root-namespace rule. Its contents are candidates for
upstreaming to Mathlib.
Nat.fromBits is a left inverse of Nat.toBits on values below 2 ^ w.