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 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 result is Value.toNat_lt.
Layout facts #
An eligible descriptor uses the conventional IEEE encoding and bias.
An eligible descriptor is wider than 128 bits.
An eligible exponent field has at most 32 bits.
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, eligible or not.
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 that pack builds, before the storage wrapper, denote the masked fields.
pack is the model field constructor on the masked fields.
On in-range fields, pack is the model field constructor.