Binary predicate semantics #
All predicates use exact extended-real order on non-NaN inputs and their specified unordered truth value on NaNs. The exception theorems distinguish quiet and signaling comparisons without changing their Boolean answers.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Comparison.quiet_value_of_toEReal?
{fmt : FloatFormat}
(predicate : Predicate)
{x y : Model fmt}
{a b : EReal}
(hx : x.toEReal? = some a)
(hy : y.toEReal? = some b)
:
(quiet predicate x y).value = Numerics.IEEEComparison.Predicate.accepts predicate (some (Ord.compare a b))
Every quiet predicate agrees with its truth table on exact extended-real order.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Comparison.signaling_value_of_toEReal?
{fmt : FloatFormat}
(predicate : Predicate)
{x y : Model fmt}
{a b : EReal}
(hx : x.toEReal? = some a)
(hy : y.toEReal? = some b)
:
(signaling predicate x y).value = Numerics.IEEEComparison.Predicate.accepts predicate (some (Ord.compare a b))
Every signaling predicate has the same exact numerical truth table.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Comparison.quiet_value_eq_signaling
{fmt : FloatFormat}
(predicate : Predicate)
(x y : Model fmt)
:
Quiet and signaling comparisons differ only in their exception behavior.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Comparison.quiet_invalid_iff
{fmt : FloatFormat}
(predicate : Predicate)
(x y : Model fmt)
:
Quiet comparisons raise invalid exactly for signaling NaN operands.
theorem
FloatLib.Floats.Formats.BinaryInterchange.Model.Comparison.signaling_invalid_iff
{fmt : FloatFormat}
(predicate : Predicate)
(x y : Model fmt)
:
Signaling comparisons raise invalid exactly for NaN operands.