Membership in the committed prime table, by binary search.
3.6. The prime table and initial segments
A committed table of the 9,592 primes below 10^5 anchors the small
end: membership is binary search, and both directions of correctness
are proved against a kernel-replayed sieve run (the batched
verification is regenerated, never hand-edited, via the
#rebuild_primeTable command).
Arbitrary initial segments come from trial division, with no upper bound tied to the table:
#eval Hex.Nat.primesIn 0 100
def
The primes in [lo, hi), ascending. Runtime decision through the
isPrimeTrial-backed Decidable instance; the committed table plays no
role, so the range is unrestricted.
theorem
Membership in primesIn lo hi is exactly primality in the half-open
interval [lo, hi).