TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Queries.Proof

Numerical classification, cohorts and stored canonicality #

Zero, normal, and subnormal classification agrees with exact rational magnitudes and is preserved within a cohort. For a fixed encoding and format, canonical words are equal exactly when they decode to the same complete datum.

The zero predicate agrees with exact rational semantics, at every quantum.

Normality is a numerical threshold test, independent of sign and cohort.

The finite classes exhaust zero, normal and subnormal values.

@[simp]

Re-encoding always produces a canonical word, including on redundant input.

theorem FloatLib.Floats.Formats.DecimalInterchange.Encoding.eq_iff_decode_eq (encoding : Encoding) (f : Format) {x y : BitVec f.bitWidth} (hx : encoding.isCanonical f x = true) (hy : encoding.isCanonical f y = true) :
x = y encoding.decode f x = encoding.decode f y

Two canonical encodings in the same encoding and format are equal precisely when they decode to the same complete datum.