TorchLean API

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

Basic policy-rounding facts #

This 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, so ordinary finite arithmetic and conversion modules do not inherit its larger 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_nearest_eq_execFloat (fmt : FloatFormat) (entropy : ℕ) (sign : Bool) (num den : ℕ) (hden : den ≠ 0) :
roundRat fmt Numerics.QuantizationPolicy.nearest 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.

The policy overflow direction of an embedded IEEE mode is the IEEE mode's own overflow direction.

Native policy overflow is the shared directed overflow rule.

Nearest rounding with ties away from zero overflows to the format's native overflow value.

Rounding away from zero overflows to the format's native overflow value of either sign.

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

Positive-direction rounding selects native positive overflow and saturates negative overflow.

Negative-direction rounding selects native negative overflow and saturates positive overflow.

Saturating overflow ignores the rounding direction.