Addition and subtraction through Lean's floating-point model #
The exact dyadic addition used by FloatLib and Lean's unpacked addition align the operands at the smaller exponent before rounding once. Their agreement includes cancellation to positive zero and overflow to infinity. A descriptor must have the conventional IEEE encoding and bias. These bridges are checked against the logical floating-point model shipped with Lean 4.34.
NaN payloads require care at the native boundary: FloatLib propagates a quieted payload, whereas Lean's unpacked model has a single NaN.
For finite nonzero operands, dispatched addition commutes with Lean's unpacked addition and packing. The result may be zero or infinity; no finiteness assumption on the sum is needed.
Lean's unpacked subtraction is addition after exact negation, including exceptional values.
For finite nonzero operands, dispatched subtraction commutes with Lean's unpacked subtraction and packing, including exact cancellation and overflow.