Packed native floating-point models #
The conversions below connect the descriptor-indexed Model to Lean's packed binary32 and
binary64 models. Converting from a native model retains every bit. Converting to one canonicalizes
NaN signs and payloads, as required by Lean's packed-value invariant.
Lean 4.33 introduced these logical floating-point models. Lean 4.34 adds public nan and inf
constants for Float32, Float, and their packed models, and strengthens the generic format
invariant to require at least two exponent bits. These additions let both native widths share the
representation and constant proofs below.
The generic representation lemmas imported here separate this normalization from arithmetic refinement. They concern Lean's logical definitions; they add no assumption about native machine instructions and do not select a floating-point backend.
Binary32 #
Read the exact canonical word stored by Lean's packed binary32 model.
Instances For
Pack binary32 bits into Lean's model, canonicalizing any NaN sign and payload.
Instances For
Native packed binary32 always satisfies the generic canonical-word invariant.
Unpacking the exact native binary32 word agrees with Lean's unpacked interpretation.
Packing an unpacked value agrees across the binary32 representation boundary.
Converting to a packed native model and back performs exactly NaN canonicalization.
Reading the exact binary32 word loses no information from a native packed model.
Every native binary32 model round-trips exactly through FloatLib's representation.
Canonicalization does not change the unpacked interpretation of a binary32 conversion.
Packing already packed model output agrees with the direct binary32 model constructor.
Equality of packed binary32 conversions is equality of their unpacked interpretations.
Binary64 #
Read the exact canonical word stored by Lean's packed binary64 model.
Instances For
Pack binary64 bits into Lean's model, canonicalizing any NaN sign and payload.
Instances For
Native packed binary64 always satisfies the generic canonical-word invariant.
Unpacking the exact native binary64 word agrees with Lean's unpacked interpretation.
Packing an unpacked value agrees across the binary64 representation boundary.
Converting to a packed native model and back performs exactly NaN canonicalization.
Reading the exact binary64 word loses no information from a native packed model.
Every native binary64 model round-trips exactly through FloatLib's representation.
Canonicalization does not change the unpacked interpretation of a binary64 conversion.
Packing already packed model output agrees with the direct binary64 model constructor.
Equality of packed binary64 conversions is equality of their unpacked interpretations.
Native constants #
Lean's binary32 NaN has FloatLib's canonical IEEE quiet-NaN word.
Lean's binary64 NaN has FloatLib's canonical IEEE quiet-NaN word.
Lean's positive binary32 infinity has the ordinary all-ones-exponent encoding.
Lean's positive binary64 infinity has the ordinary all-ones-exponent encoding.
The binary32 NaN constant converts back to Lean's packed NaN.
The binary64 NaN constant converts back to Lean's packed NaN.
The binary32 positive-infinity constant converts back to Lean's packed infinity.
The binary64 positive-infinity constant converts back to Lean's packed infinity.
Lean's native binary32 NaN denotes the unpacked model's single NaN value.
Lean's native binary64 NaN denotes the unpacked model's single NaN value.
Lean's native binary32 infinity denotes positive infinity in the unpacked model.
Lean's native binary64 infinity denotes positive infinity in the unpacked model.