RatScaling #
Small algebraic helper lemmas about powers of two and Nat.shiftLeft used by the IEEE32Exec
kernel.
Several proofs (notably the bridge theorems and division soundness) need to normalize expressions
of the form dyadicToReal dx / dyadicToReal dy into the same signed rational shape that the
executable implementation uses:
- align dyadic exponents by shifting either the numerator or denominator,
- extract a sign bit via
Bool.xor, - and express the quotient as
±(num/den).
This module provides the shared normalization lemmas used by the bridge theorems without creating import cycles.
Interpret an exact dyadic (-1)^sign * mant * 2^exp as a real.
Instances For
Scale a rational by a nonnegative exponent difference by shifting the numerator.
Scale a rational by a negative exponent difference by shifting the denominator.
Exponent subtraction law for neuralBpow, packaged as a division identity.
Rewrite dyadic division into the same signed rational shape used by div/divDown/divUp.
This is the "multiplicative" form: (-1)^sign * (num/den).
Rewrite dyadic division into a signed rational ±(num/den).
This is the "conditional negation" form used by the directed rounding soundness proofs.