Correctness of exact IEEE decoding #
Binary arithmetic proofs need an exact value that is cheaper and more concrete than a real
number. toDyadic? decodes every finite encoding to that value and rejects exceptional
encodings. Conventional IEEE descriptors reuse the established unpacked model; configurable
descriptors follow their declared bias and exceptional-value policy.
The central theorem proves that executable field decoding agrees with Lean's logical floating model. Later lemmas recover finiteness, sign, zero, and sign-toggle facts from successful decoding. This direction is deliberate: optimized kernels may inspect fields, while their proofs can immediately move to one canonical exact dyadic semantics.
Complete-format decoding #
Decode a finite Model into an exact dyadic under its complete format descriptor.
The conventional IEEE case delegates to the established decoder. Other encodings use their declared exponent bias and exceptional-value policy directly.
Instances For
Exact rational value of a finite executable float; returns none for NaN or infinity.
Instances For
The IEEE field decoder agrees with Lean's logical IEEE model.
The theorem is width-generic. Both sides use the conventional IEEE interpretation of the layout;
the descriptor's custom bias and exceptional-value policy are handled separately by toDyadic?.
A nonzero successful dyadic decode determines the corresponding finite logical model value.
A zero dyadic decode determines the corresponding signed model zero.
Decoding and finiteness #
A successful dyadic decode rules out NaN.
A successful dyadic decode rules out infinity.
IEEE decoding preserves magnitude and exponent when the storage sign bit is toggled.
IEEE dyadic decoding preserves the stored sign bit.
A decoded dyadic has zero mantissa only when the source is an IEEE signed zero.
A successful dyadic decode certifies that the source bit pattern is finite.
Every bit pattern that is neither NaN nor infinity has an exact dyadic decode.
Every bit pattern classified as finite by IEEE rules has an exact dyadic decode.
IEEE dyadic decoding succeeds exactly on bit patterns classified as finite by IEEE rules.