TorchLean API

NN.Floats.NeuralFloat.Rounding.Predicates

Rounding Predicates #

Semantic specifications for directed, toward-zero, and nearest rounding. They are independent of any radix or concrete format: a predicate F : ℝ → Prop identifies the representable values, and the point predicates characterize the required output among those values.

These definitions correspond to Flocq's Rnd_DN_pt, Rnd_UP_pt, Rnd_ZR_pt, and Rnd_N_pt.

f is the greatest F-value no larger than x.

Instances For

    f is the least F-value no smaller than x.

    Instances For

      Toward-zero rounding uses directed down on nonnegative inputs and directed up on negative ones.

      Instances For

        f is an F-value at least as close to x as every other representable value.

        Instances For
          def TorchLean.Floats.NeuralRoundDown (F : Prop) (round : ) :

          A rounding function rounds downward with respect to F at every input.

          Instances For
            def TorchLean.Floats.NeuralRoundUp (F : Prop) (round : ) :

            A rounding function rounds upward with respect to F at every input.

            Instances For

              A rounding function rounds toward zero with respect to F at every input.

              Instances For

                A rounding function rounds to a nearest F-value at every input.

                Instances For
                  theorem TorchLean.Floats.neuralRoundDownPoint_unique {F : Prop} {x f g : } (hf : NeuralRoundDownPoint F x f) (hg : NeuralRoundDownPoint F x g) :
                  f = g

                  A downward rounding point is unique.

                  theorem TorchLean.Floats.neuralRoundUpPoint_unique {F : Prop} {x f g : } (hf : NeuralRoundUpPoint F x f) (hg : NeuralRoundUpPoint F x g) :
                  f = g

                  An upward rounding point is unique.

                  A representable value is its own downward rounding point.

                  theorem TorchLean.Floats.neuralRoundUpPoint_refl {F : Prop} {x : } (hx : F x) :

                  A representable value is its own upward rounding point.

                  theorem TorchLean.Floats.neuralRoundUpPoint_neg {F : Prop} (hneg : ∀ (x : ), F xF (-x)) {x f : } (hf : NeuralRoundDownPoint F x f) :

                  Negation turns a downward point into an upward point for a symmetric format.

                  theorem TorchLean.Floats.neuralRoundDownPoint_neg {F : Prop} (hneg : ∀ (x : ), F xF (-x)) {x f : } (hf : NeuralRoundUpPoint F x f) :

                  Negation turns an upward point into a downward point for a symmetric format.

                  theorem TorchLean.Floats.neuralRoundDownUpPoint_split {F : Prop} {x d u f : } (hd : NeuralRoundDownPoint F x d) (hu : NeuralRoundUpPoint F x u) (hf : F f) :
                  f d u f

                  Any representable value lies below the downward point or above the upward point.

                  theorem TorchLean.Floats.neuralRoundNearestPoint_of_down_up {F : Prop} {x d u f : } (hd : NeuralRoundDownPoint F x d) (hu : NeuralRoundUpPoint F x u) (hf : F f) (hfd : |f - x| |d - x|) (hfu : |f - x| |u - x|) :

                  A representable value no farther than both directed neighbors is globally nearest. Every other representable value lies outside the interval between those neighbors.