The fast search on byte-array masks finds exactly the points #
Ratpoints.FastMask.fastPoints lists the same points as Ratpoints.Fast.fastPoints, in another
order (Ratpoints.FastMask.fastPoints_perm), so it lists only points of the region
(Ratpoints.FastMask.isPoint_and_inRegion_of_mem_fastPoints), each once
(Ratpoints.FastMask.nodup_fastPoints), and, assuming Sturm's theorem, all of them
(Ratpoints.FastMask.mem_fastPoints_iff).
A mask is read as the natural number Ratpoints.Mask.toNat, whose bit j is bit j of the mask
(Ratpoints.Mask.testBit_toNat). The reference definitions of the three primitives then do what the
search on natural numbers does: Ratpoints.Mask.andShr is the AND with a row shifted to the right
(Ratpoints.Mask.toNat_andShr), Ratpoints.Mask.andRows the AND with all the shifted rows of a
denominator (Ratpoints.Mask.toNat_andRowsFrom), which on the mask of a chunk is the sieve of the
search on natural numbers (Ratpoints.Mask.toNat_andRows_of_toNat_eq), and
Ratpoints.Mask.setBits, on Ratpoints.Mask.nextSet, lists the set bits in ascending order where
Ratpoints.Fast.setBits lists them in descending order (Ratpoints.Mask.setBits_perm). The
periodic rows of Ratpoints.FastMask.baseRow and Ratpoints.Fast.baseRow agree on the bits that a
family keeps (Ratpoints.FastMask.testBit_toNat_baseRow, Ratpoints.Fast.testBit_baseRow_of_lt),
so the families of the two searches agree once their rows are read as numbers
(Ratpoints.FastMask.map_toFast_mkFamily), and so do the parameters, the zero tests of the rows of
a denominator (Ratpoints.Mask.any_isZero) and the candidates that the sieve leaves in a chunk or
in a part of it, whose mask is cut from that of the chunk (Ratpoints.Mask.toNat_extract_ones,
Ratpoints.FastMask.partPoints_perm); the exact check with the data made once per denominator is
that of the brute force (Ratpoints.FastMask.pointsOfDenWith_eq_pointsOfDen), so the two searches
agree denominator by denominator (Ratpoints.FastMask.denPoints_perm) and on the whole
(Ratpoints.FastMask.search_perm, Ratpoints.FastMask.sievePoints_perm), also when the
coefficients are reversed, which both decide alike (Ratpoints.Fast.reversed).
Main statements #
Ratpoints.FastMask.fastPoints_perm: the two searches list the same points.Ratpoints.FastMask.isPoint_and_inRegion_of_mem_fastPoints: the list holds only points of the region.Ratpoints.FastMask.mem_fastPoints_iff: assuming Sturm's theorem, it holds exactly the points of the region.Ratpoints.FastMask.nodup_fastPoints: each of them once.
Bytes and bits #
Masks as numbers #
The mask a as a natural number, byte i of a standing for its value times 256 ^ i: bit
j of it is Ratpoints.Mask.bit a j (Ratpoints.Mask.testBit_toNat).
Equations
- Ratpoints.Mask.toNat a = List.foldr (fun (x : UInt8) (n : ℕ) => x.toNat + 256 * n) 0 a.data.toList
Instances For
The AND with a shifted row #
The set bits #
Ratpoints.Mask.setBits lists the set bits in ascending order, Ratpoints.Fast.setBits in
descending order.
Appending and extracting #
The bits t₁, …, t₁ + len₁ - 1 of the mask of len bits, all set, from the byte of t₁ to
the end of the 64-bit word of the last of them, are all set, and no other bit is when they end at
the end of the mask or of a word.
The rows of the search on natural numbers #
The sieve on rows read as numbers (Ratpoints.Mask.toNat), without its zero tests: an AND with
0 stays 0.
The AND with several rows #
The reference definition of Ratpoints.Mask.andRows, from position i on, is the AND with
the shifted rows from i on; its zero tests drop nothing, an AND with 0 staying 0.
The primitive Ratpoints.Mask.andRows (by its reference definition) on a mask with exactly
its len lowest bits set is the sieve of the search on natural numbers.
The rows #
The families #
The row of a family for the residue r is the same in both searches: the AND of the rows
of the moduli agrees on the bits below N, and the full mask clears the others.
The family F with its rows as natural numbers (Ratpoints.Mask.toNat): the family of
Ratpoints.Fast that Ratpoints.Fast.mkFamily makes where Ratpoints.FastMask.mkFamily makes
F (Ratpoints.FastMask.map_toFast_mkFamily).
Instances For
The points #
The two searches list the same points of a chunk, up to order, when the mask has exactly its
len lowest bits set and the exact check gets the scaled coefficients of b and its factor.
The two searches list the same points of the part of a chunk, up to order: the part that is the
whole chunk with the mask of the chunk, another with the bytes of the mask that hold its bits
(Ratpoints.Mask.toNat_extract_ones).
The two searches list the same points of the denominator b in the chunks l, up to order,
each chunk with its mask of len bits, all set, and the shifts of the families to it.
The families of the search on masks that have a row for each residue of a positive product, as families of the search on natural numbers.
The searches without the reversal list the same points.
The search on byte-array masks lists the same points as the search on natural numbers,
Ratpoints.Fast.fastPoints, in another order, for every coefficient list, every height bound,
every range and every setting of the parameters.
The fast search lists only points of height at most H with their denominator in the range
of bLow and bHigh, for every coefficient list, every height bound, every range and every setting
of the parameters.
The fast search lists exactly the points of height at most H with their denominator in
the range of bLow and bHigh, for every coefficient list, every height bound, every range and
every setting of the parameters, assuming Sturm's theorem.
The fast search lists each point once.