The bounds of the search intervals #
What the library makes of the search intervals of the caller before the Sturm step
(Ratpoints.searchIntervals): it refuses them exactly when the specification says
(Ratpoints.IntervalsWF), keeps them as they are, and for none takes the default interval
[-h, h], which holds a / b for every numerator |a| ≤ H and every denominator b ≥ 1; and the
bounds of the search intervals of a run (Ratpoints.Sieve.exactBounds), which give, for each
denominator up to the largest, the ranges of the numerators ⌈b l⌉, …, ⌊b u⌋ of the intervals
(Ratpoints.Sieve.numeratorRanges, Ratpoints.Sieve.RangesFor) to the sieve of one denominator.
The ends of the bounds are those of exact_end: ±m 2 ^ (-s) with the value of the double, or
capped for a tiny end or one beyond 2 ^ 63, with the same numerators for every denominator
1 ≤ b < 2 ^ 63 (Ratpoints.Sieve.lowNumerator_eq_and_highNumerator_eq_run_exactEnd);
exact_scale computes min (2 ^ 64 - 1) ⌊(b m + r) / 2 ^ s⌋ on two words
(Ratpoints.Sieve.toNat_exactScale), so that interval_bits_exact gives the clamped numerators of
the ends (Ratpoints.Sieve.toInt_intervalBitsExact); and the forms (b M + C) >> s of end_form
are exact on the longs (Ratpoints.Sieve.lowNumerator_of_endForm,
Ratpoints.Sieve.highNumerator_of_endForm), so that interval_bits on an interval taken inline
gives them too (Ratpoints.Sieve.IntervalBounds.represents_of_fast).
Main definitions #
Ratpoints.Sieve.IsExactMantissa,Ratpoints.Sieve.IsEnd,Ratpoints.Sieve.ExactEnd.value: the mantissa and the ends thatexact_endmakes, and the value of an end.Ratpoints.Sieve.intervalBoundsOf: the bounds of one search interval, the body of the loop ofRatpoints.Sieve.exactBounds.
Main statements #
Ratpoints.run_searchIntervals_eq_none_iff: the refusal of the search intervals is the negation ofRatpoints.IntervalsWF.Ratpoints.run_searchIntervals_of_ne_nil,Ratpoints.exists_run_searchIntervals_nil: the search intervals of the caller, or the default interval, which holds everya / bof the search.Ratpoints.Sieve.toNat_exactScale,Ratpoints.Sieve.lowNumerator_eq_and_highNumerator_eq_run_exactEnd:exact_scaleand the ends ofexact_end.Ratpoints.Sieve.represents_intervalBoundsOf: the bounds of one search interval give the range of its numerators, on both paths ofinterval_bits.Ratpoints.Sieve.rangesFor_run_exactBounds: the bounds of the search intervals give the ranges of the numerators of every denominator up to the largest.
The caller's search intervals are well formed when Ratpoints.searchIntervals does not refuse
them.
The search intervals that Ratpoints.searchIntervals returns for 1 ≤ H < 2 ^ 63 are well
formed: the caller's, which it refuses otherwise, or the default interval.
exact_scale: min (2 ^ 64 - 1) ⌊(b m + r) / 2 ^ s⌋ whenever b m + r fits 128 bits, with the
end ±m 2 ^ (-s) and its rounding r = rh 2 ^ 64 + rl.
The mantissa and the exponent (m, s) of exact_end for an end of absolute value v > 0:
s ≤ 127, 0 < m < 2 ^ 63, and m 2 ^ (-s) = v, or s capped at 127 for a tiny
v < 2 ^ (-75) with m < 2 ^ 53, where ⌊b v⌋ = 0 and ⌈b v⌉ = 1 for every b < 2 ^ 63, as for
m 2 ^ (-127).
Equations
Instances For
The mantissa and the exponent that exact_end makes for the absolute value of a finite end
x ≠ 0 with |x| < 2 ^ 63.
The numerators of the end x of a search interval with |x| ≥ 2 ^ 63 (an infinity included)
are those of exact_end's ±2 ^ 63: beyond the height bound on the side of its sign.
A tiny end 0 < |q| < 2 ^ (-75) has the numerators of exact_end's ±m 2 ^ (-127) with
0 < m < 2 ^ 53 and the same sign, for every denominator 1 ≤ b < 2 ^ 63: b |q| and
b m 2 ^ (-127) lie strictly between 0 and 1.
The numerators of the end x of a search interval with |x| < 2 ^ 63 are those of the value
of exact_end, exact unless capped for a tiny x, for every denominator 1 ≤ b < 2 ^ 63.
The numerators of the end x of a search interval, not a NaN, are those of the value of
exact_end, for every denominator 1 ≤ b < 2 ^ 63 and height bound H < 2 ^ 63.
The end e of a search interval, at its lower end if lower, is one that exact_end makes:
s ≤ 127, m ≤ 2 ^ 63, and the rounding 2 ^ s - 1 when the end wants b |x| rounded up.
Equations
Instances For
interval_bits_exact at a lower end x ≥ 0: the code 2 exactly when ⌈b x⌉ > h, and
otherwise ⌈b x⌉.
interval_bits_exact at a lower end x < 0: ⌈b x⌉ = -⌊b |x|⌋, clipped to -h.
interval_bits_exact at an upper end x ≥ 0: ⌊b x⌋, clipped to h.
interval_bits_exact at an upper end x < 0: the code 1 exactly when ⌊b x⌋ < -h, and
otherwise ⌊b x⌋ = -⌈b |x|⌉.
The bits of the range L, …, U of numerators within -H - 1, …, H + 1 in the packing of a
class, in the form of numerators_to_bits that the sieve takes for the height bound H, the plain
one for H ≤ 2 ^ 63 - 65.
interval_bits_exact gives the range of the numerators of the ends: the code 2 only above
H, the code 1 only below -H, and otherwise the bits of the range within -H, …, H.
The form (b M + C) >> sh of an end on the longs, without overflow: the floor of
(b M + C) / 2 ^ sh.
The form (b M + C) >> s of an end with C ≥ 0, without overflow for b up to the largest
denominator by the guard of end_form, on the longs: the floor of (b (±m) + C) / 2 ^ s.
The guard m ≤ (LONG_MAX - c) / b_high of end_form on the longs: m b_high + c is a
long.
The form (b (±m) + 2 ^ s - 1) >> s of a lower end with s < 64 and the guard of end_form,
clamped to -H, …, H + 1, is the least numerator of the end.
An end whose magnitude, rounded down, exact_scale at b = 1 finds at least H, has
⌊b |x|⌋ ≥ H for every denominator b ≥ 1.
The form of a lower end, clamped to -H, …, H + 1, is the least numerator of the end: the
constant -H for an end x ≤ -H, which exact_scale at b = 1 finds, and ⌈b x⌉ for an end
with a short mantissa.
The form (b (±m)) >> s of an upper end with s < 64 and the guard of end_form, clamped to
-H - 1, …, H, is the largest numerator of the end.
The form (0, H, 0) of an upper end x ≥ H, clamped, is the largest numerator H.
The form of an upper end, clamped to -H - 1, …, H, is the largest numerator of the end: the
constant H for an end x ≥ H, which exact_scale at b = 1 finds, and ⌊b x⌋ for an end with
a short mantissa.
The bits of interval_bits on an interval taken inline, from the values lo ≤ H and
hi ≥ -H of the forms of its ends clipped to -H, …, H: those of the least numerator L and the
largest numerator U.
The bounds bd of an interval taken inline give the range L, …, U of the numerators, from the
forms of its ends clamped to the least numerator L and the largest numerator U: in
interval_bits, the code 2 only above H, the code 1 only below -H, and otherwise the bits
of L, …, U.
The bounds of the search interval i that Ratpoints.Sieve.exactBounds makes for the height
bound height and the largest denominator bHigh: the body of its loop.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An interval that is not taken inline has the forms of an empty one, and interval_bits goes to
interval_bits_exact for it.
The bounds of a search interval [l, u] give, for the denominator 1 ≤ B ≤ bHigh ≤ H < 2 ^ 63,
the range of the numerators ⌈B l⌉, …, ⌊B u⌋ of the values of exact_end, clamped, in both
paths of interval_bits.
The bounds of well-formed search intervals for H < 2 ^ 63 and the largest denominator
bHigh ≤ H give, for every denominator 1 ≤ b ≤ bHigh, the ranges of the numerators of the
intervals (Ratpoints.Sieve.numeratorRanges).