Recovering a sign by the first flagged doubling #
Successive doublings of a small nonzero rational eventually enter a prescribed magnitude window. A sufficiently accurate approximation modulo one is then flagged, and its first flag lies on the correct side of one half. The threshold, flag margin, error and final index are parameters. In particular, a caller supplies the magnitude/product and precision bounds, not a correctness assertion about the sign procedure.
This is the mathematical first-flag argument of Section 2 of [OAI26f], generalized beyond its fixed constants. There is no complexity membership claim.
Main definitions #
Cslib.CircleFlag: the symmetric interval used to flag an approximation.Cslib.FirstCircleFlag: the first flagged index of a sequence.
Main results #
Cslib.firstCircleFlag_sign: the side of one half at the first flag determines the sign.
References #
- [OAI26f], Section 2, proof of Sign from residues.
An approximation is flagged when it stays at least t away from either endpoint.
No approximation of zero can be flagged when the error is below the flag margin.
A flag excludes wrapping at zero; a small target has the sign indicated by the side of one half. This also rules out a flag for a zero target.
A target whose magnitude is between a and b must be flagged, provided the
rounding error fits between that window and the endpoints.
Mathematical correctness of first-flag sign recovery. Approximation, magnitude, precision, flag margin and cutoff conditions are independent explicit inputs.
The first flagged index is unique, without any approximation hypotheses.
Any first flagged index has the correct sign, under the numerical doubling bounds.