Verified two-limb rounding #
These theorems connect the native UInt128 shifts, increments, and nearest-even rounding
operations to their natural-number meanings.
The runtime uses two UInt64 limbs, and the proof model interprets them as one Nat.
Carry propagation, cross-limb shifts, low-bit insertion, ties-to-even rounding, and the sticky
combination of an aligned sum preserve that interpretation under the stated capacity bounds.
Limb-local primitives #
Cross-limb shifts #
The native two-word one-bit shift is floor division by two.
Nearest-even right shifts #
The one-limb result of native two-limb nearest-even rounding agrees with the common mathematical rounder whenever the stated bounds exclude overflow.
Native two-limb nearest-even rounding with a two-limb quotient agrees with the common mathematical rounder for every shift strictly between zero and 64.
The two-word sticky combination is the natural-number jam of the exact aligned value.