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 -∞” and “toward +∞”. In TorchLean’s proof-oriented stack we model this with Flocq-style rounding on via neural_round together with the floor/ceil rounding functions from NN/Floats/NeuralFloat/Rounding.lean.

This file is format-generic: it works for any radix β 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 (β,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 (β,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 -∞” 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 +∞” 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 down x ≤ x ≤ up x.

      Instances For

        Canonical rounder for the (β,fexp) format via roundDown/roundUp.

        Instances For