Representation semantics of fixed-width signed integers #
The executable two's-complement carrier has a NumericalSystem interpretation. The
representation laws characterize the signed interval, encoding and decoding, and the clamp used
by saturating arithmetic.
Keeping this adapter separate from arithmetic is useful: generic operation contracts only need to
know what a code denotes, while the implementation remains free to use BitVec overflow
instructions and fixed-width storage.
Fixed-width integers interpreted as their signed two's-complement values.
Instances For
@[reducible, inline]
A fixed-width word with an erased proof of its signed value.
Instances For
@[simp]
theorem
FloatLib.Numerics.Representations.FixedInt.numericalSystem_represents_iff
{width : ℕ}
(code : FixedInt width)
(value : ℤ)
:
Representation by a fixed-width integer is equality with its signed two's-complement value.
@[simp]
theorem
FloatLib.Numerics.Representations.FixedInt.toInt_ofIntSaturating
{width : ℕ}
(hwidth : 0 < width)
(value : ℤ)
:
Saturating conversion denotes exact clamping to the signed storage interval.