TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Model.Packing.Special

Packing special values in Lean's float model #

These packing identities preserve the sign of zero and infinity in Lean's IEEE model. They apply to arbitrary field widths; descriptor-level classification additionally requires the relevant encoding support. In particular, negZero is a NaN word under FNUZ, and posInf and negInf need not denote infinities under finite-only policies.

The shared lemmas let operation proofs handle zero and overflow results without unfolding their exponent and significand fields.

@[simp]

Model packing exposes the all-ones exponent field for either infinity sign.

@[simp]

Model packing exposes a zero fraction field for either infinity sign.

@[simp]

A model-packed infinity is classified as infinity by every infinity-bearing descriptor.

@[simp]

A model-packed infinity is not classified as NaN by an infinity-bearing descriptor.

@[simp]

A model-packed infinity is not finite under an infinity-bearing descriptor.

@[simp]

Positive executable infinity has positive sign.

@[simp]

Negative executable infinity has negative sign.

@[simp]

Positive executable infinity is classified as infinity whenever the format supports it.

@[simp]

Negative executable infinity is classified as infinity whenever the format supports it.

@[simp]

Positive executable infinity is not a NaN whenever the format supports infinity.

@[simp]

Negative executable infinity is not a NaN whenever the format supports infinity.

@[simp]

Positive executable infinity is not finite whenever the format supports infinity.

@[simp]

Negative executable infinity is not finite whenever the format supports infinity.

@[simp]

Model packing exposes a zero exponent field for either signed zero.

@[simp]

Model packing exposes a zero fraction field for either signed zero.

@[simp]

A model-packed signed zero is classified as zero by a conventional IEEE descriptor.

@[simp]

A model-packed signed zero is not infinity under a conventional IEEE descriptor.

@[simp]

A model-packed signed zero is not NaN under a conventional IEEE descriptor.

@[simp]

A model-packed signed zero is finite under a conventional IEEE descriptor.

@[simp]

Re-decoding a model-packed signed zero recovers the same logical value.

@[simp]

IEEE model packing preserves the real value of signed zero.

@[simp]

Positive executable zero has positive sign.

@[simp]

Negative executable zero has negative sign.

@[simp]

The policy-aware zero constructor keeps the requested sign exactly when signed zero is supported.

@[simp]

The canonical positive-zero word is classified as zero in every supported encoding.

@[simp]

Positive executable zero has a zero exponent field.

@[simp]

Positive executable zero has a zero fraction field.

@[simp]

Negative executable zero has a zero exponent field.

@[simp]

Negative executable zero has a zero fraction field.

@[simp]

In an encoding with two zero words, negative executable zero is classified as zero.

Under the finite-unsigned-zero encoding the negative-zero word is the NaN, so the hypothesis cannot be dropped.

@[simp]

Positive executable zero is not a NaN in any encoding.

@[simp]

Negative executable zero is not a NaN when the encoding has two zero words.

Under the finite-unsigned-zero encoding the negative-zero word is the NaN, so the hypothesis cannot be dropped.

@[simp]

Positive executable zero is not infinity in any encoding.

@[simp]

Negative executable zero is not infinity in any encoding.

@[simp]

Positive executable zero is finite in any encoding.

@[simp]

Negative executable zero is finite when the encoding has two zero words.

Under the finite-unsigned-zero encoding the negative-zero word is the NaN, so the hypothesis cannot be dropped.

@[simp]

Positive zero denotes real zero in every conventional IEEE format.

@[simp]

Negative zero denotes real zero in every conventional IEEE format.

@[simp]

Either signed-zero constructor has real value zero in a conventional IEEE format.