TorchLean API

FloatLib.Floats.Formats.Posit.Configured.Value.Proof

Correctness of the configured posit value interface #

The public constructors form a lossless equivalence with the exact-width model and every in-range word. Exact decoding and classification preserve the standardized zero and NaR observations, and the common Boolean comparison API agrees with the configured signed-word order.

@[simp]
theorem FloatLib.Floats.ExecFloat.Posit.compare_def {format : Formats.Posit.Format} {plan : Formats.Posit.Configured.StoragePlan format} {code : Type} [ModelCodec plan (Formats.Posit.Model format) code] (left right : ExecFloat (Formats.Posit.Configured.Family format code plan)) :
left.compare right = some (cmp (toModel left) (toModel right))

The common comparison capability reduces to signed-word posit comparison.

This theorem is the public semantic boundary for proofs: clients need not unfold the typeclass instance or depend on its implementation name.

@[simp]

Decoding immediately after packing a posit proof model returns the original model.

@[simp]

Packing immediately after decoding a configured posit returns the original value.

@[simp]

Reconstructing a configured posit from its complete word is lossless.

@[simp]
theorem FloatLib.Floats.ExecFloat.Posit.toNatBits_ofNatBits_of_lt {format : Formats.Posit.Format} {plan : Formats.Posit.Configured.StoragePlan format} {code : Type} [ModelCodec plan (Formats.Posit.Model format) code] (bits : ) (bits_lt : bits < format.modulus) :
toNatBits (ofNatBits bits) = bits

Reading an in-range complete posit word immediately after constructing it returns that word.

@[simp]

The configured zero code denotes the ordinary rational value zero.

@[simp]

The configured NaR code denotes the common exceptional Not-a-Real observation.

@[simp]

The configured zero code is recognized as zero.

@[simp]

The configured NaR code is recognized as Not-a-Real.

@[simp]

The configured zero code is not Not-a-Real.

@[simp]

The configured NaR code is not the ordinary zero code.

@[simp]

The public optional rational view is absent precisely for the unique NaR value.

@[simp]

Boolean posit equality agrees exactly with equality of configured values.

@[simp]

Boolean posit inequality agrees exactly with inequality of configured values.

@[simp]

Boolean posit less-than agrees with the standard signed-word order.

@[simp]

Boolean posit less-than-or-equal agrees with the standard signed-word order.

@[simp]

Boolean posit greater-than agrees with the standard signed-word order.

@[simp]

Boolean posit greater-than-or-equal agrees with the standard signed-word order.