Correctness of binary subtraction #
Subtraction is implemented as addition of the negated right operand. These theorems connect that implementation to exact real subtraction followed by one nearest-even rounding step.
Finite operands whose exact real difference is within the destination's largest finite magnitude cannot overflow under nearest-even subtraction.
The triangle bound |x| + |y| ≤ maxFinite is a symbolic sufficient condition for finite
nearest-even subtraction.
Finite subtraction is exact real subtraction followed by one nearest-even format rounding.
The hypothesis hfin excludes overflow by asking that the executable difference be finite;
toReal_sub_eq_roundAt_of_abs_add_le_posMaxFinite supplies it from a bound on the operands.
Finite subtraction under a symbolic triangle bound is exact real subtraction followed by one nearest-even format rounding.