TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Neighbors.Adjacency

Adjacency of the public decimal neighbor operations #

The quantified bounds compare the delivered result with every valid finite datum, including other cohorts and either sign of zero. The endpoint theorems cover infinite results separately.

theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.nextUp_finite_adjacent (f : Format) (s : Bool) (c : ) (q : ) (hx : Datum.Valid f (Datum.finite s c q)) (v : ) (hout : (nextUp f (Datum.finite s c q)).value.toRat? = some v) :
Datum.finiteValue s c q < v ∀ (t : Bool) (d : ) (r : ), Datum.Valid f (Datum.finite t d r)Datum.finiteValue s c q < Datum.finiteValue t d rv Datum.finiteValue t d r

The finite successor is strictly greater, and no valid finite value lies between them.

theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.nextUp_adjacent (f : Format) (x : Datum) (hx : Datum.Valid f x) (a b : ) (ha : x.toRat? = some a) (hb : (nextUp f x).value.toRat? = some b) :
a < b ∀ (y : Datum) (v : ), Datum.Valid f yy.toRat? = some va < vb v

Public successor adjacency expressed entirely in exact numerical values.

theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.nextDown_adjacent (f : Format) (x : Datum) (hx : Datum.Valid f x) (a b : ) (ha : x.toRat? = some a) (hb : (nextDown f x).value.toRat? = some b) :
b < a ∀ (y : Datum) (v : ), Datum.Valid f yy.toRat? = some vv < av b

Negation transfers successor adjacency to the public predecessor operation.