TorchLean API

NN.Floats.Interval.Rounders

Directed rounding (down/up) for Flocq-style formats #

For interval propagation under a discrete numeric grid (float, fixed-point, quantization), one typically wants directed rounding at interval endpoints:

In IEEE-754 hardware this corresponds to rounding modes “toward $-\infty$” and “toward $+\infty$”. In TorchLean’s proof-oriented model we represent this with Flocq-style rounding on $\mathbb{R}$ via neuralRound together with the floor/ceil rounding functions from NN/Floats/NeuralFloat/Rounding/Core.lean.

This file is format-generic: it works for any radix $\beta$ and exponent selection function fexp satisfying NeuralValidExp.

References:

noncomputable def TorchLean.Floats.Interval.roundDown {β : NeuralRadix} {fexp : } [NeuralValidExp fexp] (x : ) :

Format-directed rounding down to the $(\beta,\mathtt{fexp})$ grid (via floor rounding of the scaled mantissa).

Instances For
    noncomputable def TorchLean.Floats.Interval.roundUp {β : NeuralRadix} {fexp : } [NeuralValidExp fexp] (x : ) :

    Format-directed rounding up to the $(\beta,\mathtt{fexp})$ grid (via ceil rounding of the scaled mantissa).

    Instances For

      Correctness of directed rounding down: roundDown x is an enclosure lower bound.

      This is the format-generic analogue of the IEEE-754 fact that rounding toward $-\infty$ never exceeds the exact real value.

      Correctness of directed rounding up: roundUp x is an enclosure upper bound.

      This is the format-generic analogue of the IEEE-754 fact that rounding toward $+\infty$ is never below the exact real value.

      A focused “rounder” interface for enclosure-style interval arithmetic.

      Monotonicity of down/up is not required: enclosure proofs use only $\operatorname{down}(x)\le x\le\operatorname{up}(x)$.

      Instances For

        Canonical rounder for the $(\beta,\mathtt{fexp})$ format via roundDown/roundUp.

        Instances For