TorchLean API

NN.Floats.NeuralFloat.Rounding.Double

Double Rounding #

Directed rounding through a finer intermediate format gives the same answer as direct rounding to the coarser format. The order-theoretic proof only needs inclusion of representable values, so it applies beyond the standard FIX, FLX, and FLT families.

theorem TorchLean.Floats.neuralRoundDownPoint_double {fine coarse : Prop} {x fineValue coarseValue : } (hsubset : ∀ (z : ), coarse zfine z) (hf : NeuralRoundDownPoint fine x fineValue) (hc : NeuralRoundDownPoint coarse x coarseValue) :
NeuralRoundDownPoint coarse fineValue coarseValue

Downward rounding through a containing format collapses to direct downward rounding.

theorem TorchLean.Floats.neuralRoundUpPoint_double {fine coarse : Prop} {x fineValue coarseValue : } (hsubset : ∀ (z : ), coarse zfine z) (hf : NeuralRoundUpPoint fine x fineValue) (hc : NeuralRoundUpPoint coarse x coarseValue) :
NeuralRoundUpPoint coarse fineValue coarseValue

Upward rounding through a containing format collapses to direct upward rounding.

theorem TorchLean.Floats.neural_generic_format_FLX_mono {β : NeuralRadix} {coarsePrec finePrec : } (hcoarse : 0 < coarsePrec) (hfine : 0 < finePrec) (hprec : coarsePrec finePrec) {x : } (hx : neuralGenericFormat β (FLXExp coarsePrec) x) :
neuralGenericFormat β (FLXExp finePrec) x

Increasing FLX precision preserves every exactly representable value.

theorem TorchLean.Floats.neuralRound_floor_double_FLX {β : NeuralRadix} {coarsePrec finePrec : } (hcoarse : 0 < coarsePrec) (hfine : 0 < finePrec) (hprec : coarsePrec finePrec) (x : ) :

Downward FLX double rounding equals direct rounding to the coarser precision.

theorem TorchLean.Floats.neuralRound_ceil_double_FLX {β : NeuralRadix} {coarsePrec finePrec : } (hcoarse : 0 < coarsePrec) (hfine : 0 < finePrec) (hprec : coarsePrec finePrec) (x : ) :

Upward FLX double rounding equals direct rounding to the coarser precision.