TorchLean API

FloatLib.Floats.Formats.IEEE754.Native.Representation

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 #

@[simp]

Importing a native value reads the word in its logical binary32 model.

An imported native binary32 value already satisfies Lean's canonical-NaN invariant.

@[simp]

Every native binary32 value is recovered exactly after importing and exporting it.

Binary64 #

@[simp]

Importing a native value reads the word in its logical binary64 model.

An imported native binary64 value already satisfies Lean's canonical-NaN invariant.

@[simp]

Every native binary64 value is recovered exactly after importing and exporting it.