Rounded-real meaning of Lean accuracy certificates #
Lean's unpacked-float model represents a positive real by a truncated natural mantissa, an
exponent, and an Accuracy certificate. This module proves that roundWithAccuracy rounds that
real exactly as the independent Flocq-style roundAt model whenever normalization only shifts
right and the packed output remains finite. Agreement with roundAt requires a conventional
IEEE descriptor. This bridge is used by square root and other non-dyadic kernels.
The model and rounded-real semantics choose the same exponent for a valid certificate.
The certificate value at the model exponent is the canonical scaled mantissa.
When no left shift is needed, the first stage of roundWithAccuracy shifts the extended mantissa
right to the target exponent and reports that exponent unchanged.
When no left shift is needed, the rounded mantissa produced by the first stage of
roundWithAccuracy is the nearest-even integer of the represented real scaled to the target
exponent.
Lean's signed roundWithAccuracy result has the same real value as independent nearest-even
rounding of the represented signed real. The exponent premise is the documented precondition of
roundWithAccuracy: normalization may discard low bits, but must not require a preliminary left
shift. The finiteness premise excludes IEEE overflow, which has no value in Real.