TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Rounding.Policy.Proof

Basic policy-rounding facts #

This lightweight module contains the facts needed by arithmetic and conversion proofs: deterministic nearest-even behavior, flush-to-zero behavior, IEEE dispatch, and overflow policy equations.

The independent proof that the general rational policy engine agrees with the directed dyadic engine lives in Rounding.Policy.Agreement. Keeping that larger proof separate prevents ordinary finite arithmetic and conversion modules from inheriting its directed-semantics dependency graph.

Nearest-even quotient rounding does not inspect the entropy source.

Nearest-even dyadic quantization is independent of the entropy argument.

Flushing a subnormal result produces the format's corresponding zero.

theorem FloatLib.Floats.Formats.BinaryInterchange.Model.Policy.roundRat_nearestEven_eq_execFloat (fmt : FloatFormat) (entropy : ) (sign : Bool) (num den : ) (hden : den 0) :
roundRat fmt Numerics.QuantizationPolicy.nearestEven entropy sign num den = some (Model.roundRat fmt sign num den)

Default rational quantization is the canonical format-parameterized nearest-even rounder.

The entropy argument is irrelevant because nearest-even rounding is deterministic.

Default dyadic quantization is the canonical format-parameterized nearest-even rounder.

@[simp]

Embedding an IEEE direction into the policy vocabulary and back is the identity.

@[simp]

A native-overflow, gradual-underflow policy built from an IEEE direction names that direction.

Each embedded IEEERoundingMode dispatches to the directed engine.

Native policy overflow is the shared directed overflow rule.

Toward-zero rounding saturates to the largest finite magnitude with the requested sign.

Saturating overflow ignores the rounding direction.