Native values through the shared representation bridge #
Lean 4.34 exposes named NaN and infinity constants alongside the logical floating-point models
introduced in Lean 4.33. We're glad Lean is making more of this model available for proofs.
Here we connect those constants and the existing ofFloat / toFloat adapters to the same
packed-model proofs used for arithmetic and integer conversion.
Every native value round-trips exactly. In the other direction, a FloatLib word may carry a
NaN payload that Lean's model does not retain; Model.canonicalizeModel describes that change.
Finite values, infinities, and both signed zeros retain their bits.
Binary32 #
Importing a native value reads the word in its logical binary32 model.
Exporting binary32 uses the shared packed-model conversion, including NaN normalization.
An imported native binary32 value already satisfies Lean's canonical-NaN invariant.
Lean 4.34's binary32 NaN imports as FloatLib's canonical quiet NaN.
Lean 4.34's binary32 infinity imports as FloatLib's positive infinity.
Binary64 #
Importing a native value reads the word in its logical binary64 model.
Exporting binary64 uses the shared packed-model conversion, including NaN normalization.
An imported native binary64 value already satisfies Lean's canonical-NaN invariant.
Lean 4.34's binary64 NaN imports as FloatLib's canonical quiet NaN.
Lean 4.34's binary64 infinity imports as FloatLib's positive infinity.