Wide-limb storage #
The limb carrier of Core.Runtime represents the exact-width proof model through a bounded
storage invariant. The storage invariant topLimbFits is shown equivalent to the value lying
below 2 ^ bitWidth (topLimbFits_iff), which gives the codec laws toModel_ofModel and
ofModel_toModel. The field accessors then agree with Model.signBit, Model.expField, and
Model.fracField, so the compact finite decoder FiniteKernel.decode? of a stored value is
read off the limbs (decode?_toModel). Finally toModel_pack states the exact model that
pack produces; every arithmetic kernel of this backend ends in pack, so this is the contract
each refinement proof uses. The main storage and packing results are Value.toNat_lt and
toModel_pack.
Layout facts #
An eligible descriptor uses the conventional IEEE encoding and bias.
An eligible descriptor is wider than 128 bits.
An eligible exponent field fits one machine word.
Every descriptor has at least three encoded bits.
The limb count covers the encoded width.
The top limb holds at least one encoded bit.
Every descriptor needs at least one limb; backend eligibility is not required.
The encoded width fits the limbs as a power of two.
The fraction offset lies strictly below the top limb boundary.
The sign offset lies strictly below the top limb boundary.
The bit width is the sign bit plus the exponent and fraction widths.
The storage invariant #
The spare-bit test decides whether the value lies below 2 ^ bitWidth.
A stored value has exactly limbCount fmt limbs.
A stored value lies below 2 ^ bitWidth.
A well-sized array below 2 ^ bitWidth is stored unchanged.
The model of a stored value has the stored bit pattern.
Codec laws #
Storing and reading back a model value is the identity.
Reading a stored value and storing it again is the identity.
Two stored values with the same model are equal.
Field access #
The stored sign bit is the model sign.
The all-ones exponent word is the descriptor's all-ones exponent.
A nonzero, finite exponent word gives a normal exponent field.
The stored exponent field is the model exponent field.
The exponent field is below 2 ^ expWidth.
The fraction limbs denote the model fraction field.
The fraction of a stored value has the format's limb count.
The fraction limbs lie below 2 ^ fracWidth.
The normal significand is the fraction with the implicit bit.
The normal significand, fraction plus implicit bit, has the format's limb count.
The normal significand occupies exactly fracWidth + 1 bits.
Finite decoding #
For a conventional IEEE descriptor, finiteness is the exponent field being below all ones.
The compact finite decoder of a stored value with a finite exponent field reads its sign, exponent, and significand from the limbs.
The decoded significand of a normal stored value is its limb significand.
Packing #
The limbs produced by pack, before the storage wrapper.
pack produces exactly the model field constructor on the masked fields.
pack on in-range fields produces exactly the model field constructor.