TorchLean API

FloatLib.Floats.Formats.P3109.Arithmetic.Extrema.Proof

Mathematical order and extrema for P3109 #

Finite extrema agree with the rational field's minimum and maximum. Comparisons agree with rational order, while NaN stays unordered. Magnitude ties and the preference for finite values are stated apart from rounding. The executable extrema use the same binary refinement as arithmetic, so these identities describe the expression at their single projection boundary. Clamping rejects reversed bounds and agrees with the rational interval clamp for ordered bounds.

@[simp]

Finite strict comparison is rational strict order.

@[simp]

Finite non-strict comparison is rational order.

@[simp]

Finite comparison equality is equality of rational values.

@[simp]

No datum is strictly less than itself, even NaN.

@[simp]

Finite minimum is the ordinary rational minimum.

@[simp]

Finite maximum is the ordinary rational maximum.

Exact closed minimum is commutative, including NaN and infinity.

Exact closed maximum is commutative, including NaN and infinity.

@[simp]

A finite operand wins over either infinity in minimum-finite.

@[simp]

A finite operand wins over either infinity in maximum-finite.

@[simp]

The number variant ignores NaN in favor of a finite operand.

@[simp]

The number variant ignores NaN in favor of a finite operand.

Equal nonnegative magnitudes are resolved toward the negative datum by minimum.

Equal nonnegative magnitudes are resolved toward the positive datum by maximum.

theorem FloatLib.Floats.Formats.P3109.Arithmetic.clamp_of_reversed (value lower upper : Numerics.NumericalValue ℚ) (hbounds : greater lower upper = true) :
clamp value lower upper = nan

Reversed clamp bounds have the report's indeterminate NaN result.

Clamping a finite value between ordered finite bounds gives the rational interval clamp.

theorem FloatLib.Floats.ExecFloat.P3109.decode_clamp {format : Formats.P3109.Format} (value lower upper : P3109 format) (target : Formats.P3109.Format) (mode : Formats.P3109.RoundingMode) (saturation : Formats.P3109.SaturationMode) :
Formats.P3109.Format.SameDatum (value.clamp lower upper target mode saturation).decode (target.projectRatValue { rounding := mode, saturation := saturation } (Formats.P3109.Arithmetic.clamp value.toClosedRat lower.toClosedRat upper.toClosedRat))

Clamp encoding refines the exact closed clamp followed by one report projection.