The 2-adic information #
The words of the classes of the denominators modulo 64 (Ratpoints.Sieve.twoAdic) let the numerator
of every point through, and the word of the classes that admit a numerator
(Ratpoints.Sieve.denBits) has the bit of every class whose word is not 0. The mask of the
squares modulo 64 is checked by decide; Horner's rule on words is exact modulo 2 ^ 64 and so
modulo 64 (UInt64.natCast_toNat_foldr, UInt64.natCast_toNat_foldl), so that the word of f
(Ratpoints.Sieve.fsq) has bit k set exactly when f(k) is a square modulo 64, and the word of
the reversed polynomial (Ratpoints.Sieve.gsq) bit t for the even t at which it takes a square
value; the loops of Ratpoints.Sieve.twoAdic scatter these bits into the words of the classes. A
point (a, y, b) with odd b has a ≡ k b (mod 64) for a k with f(k) a square, since
F(a, b) = b ^ D f(k) modulo 64, and one with even b an odd a and b ≡ t a (mod 64) for an
even t at which the reversed polynomial takes a square value; so when no class admits a numerator,
the curve has no points at all, not even at infinity
(Ratpoints.Sieve.not_isPoint_of_denBits_eq_zero).
Main definitions #
Ratpoints.Sieve.TwoAdicBits: the bits of the words of the classes after the scatter of the set bitsk < k0of the word offinto the odd classes and of the set bitst < t0of the word of the reversed polynomial into the even ones, the postcondition ofRatpoints.Sieve.twoAdic_specfork0 = t0 = 64.
Main statements #
Ratpoints.Sieve.squares64_test_iff: the test of the maskRatpoints.Sieve.squares64is the test of the squares modulo 64.Ratpoints.Sieve.getLsbD_fsq_coeffsMod64,Ratpoints.Sieve.getLsbD_gsq_coeffsMod64: the bits of the words offand of the reversed polynomial.Ratpoints.Sieve.twoAdic_spec: bitaof the word of the classb < 64is set exactly whenbis odd anda ≡ k bfor a set bitkof the word off, ora < 64is odd andb ≡ t afor a set bittof the word of the reversed polynomial;Ratpoints.Sieve.getLsbD_run_twoAdicstates this as a plain statement.Ratpoints.Sieve.classBit_twoAdic_of_sq_eq: for a point(a, y, b), bita mod 64of the word of the classb mod 64is set;Ratpoints.Sieve.getElem!_twoAdic_ne_zero: so the word of the class of the denominator of a point is not0.Ratpoints.Sieve.getLsbD_denBits: bitjofRatpoints.Sieve.denBits nbsays whethernb[j]is not0;Ratpoints.Sieve.snd_run_numClasses: the wordden_bitsofRatpoints.Sieve.numClassesisRatpoints.Sieve.denBits.Ratpoints.Sieve.not_isPoint_of_denBits_eq_zero: when no class of the denominators admits a numerator, the curve has no points, so that the 2-adic exit of the search is sound.
Implementation notes #
The square values that a point gives in a commutative ring
(Ratpoints.isSquare_sum_mul_pow_of_sq_eq_binaryForm,
Ratpoints.isSquare_sum_mul_pow_sub_of_sq_eq_binaryForm) are stated in Ratpoints.Proof.Tables,
where the square value modulo a prime follows from the first.
The squares modulo 64 and Horner's rule on words #
The test of the mask of the squares modulo 64 (Ratpoints.Sieve.squares64) on the residue
s mod 64 of a word, as Ratpoints.Sieve.fsq and Ratpoints.Sieve.gsq make it, is the test of
the squares modulo 64, which decide checks for each residue.
Horner's rule on words from the last entry of l down, as Ratpoints.Sieve.fsq evaluates f,
read in ZMod n for n ∣ 2 ^ 64: the value of the polynomial with the coefficients l at x.
Horner's rule on words from the first entry of l on and from the value s, as
Ratpoints.Sieve.gsq evaluates the reversed polynomial, read in ZMod n for n ∣ 2 ^ 64.
The words of f and of the reversed polynomial #
Bit k of the word of f (Ratpoints.Sieve.fsq) for the coefficients modulo 64 is set
exactly when k < 64 and f(k) = ∑ cᵢ kⁱ is a square modulo 64.
Bit t of the word of the reversed polynomial (Ratpoints.Sieve.gsq) for the coefficients
modulo 64 is set exactly when t < 64 is even and ∑ cᵢ t^(D - i) is a square modulo 64, for
D = d + d % 2.
The scatter #
The bits of the words nb of the classes after the scatter of the set bits k < k0 of f into
the odd classes and of the set bits t < t0 of g into the even ones: bit a of the word of the
class b < 64 is set exactly when b is odd and a = k b mod 64 for a set bit k < k0 of f, or
a < 64 is odd and b = t a mod 64 for a set bit t < t0 of g.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The invariant of the loop of Ratpoints.Sieve.twoAdic that scatters the bit k of f into the
odd classes, from the words nb0: after the classes 1, 3, … of the positions pref, the words
are those of nb0 with bit k b mod 64 set in the word of each of these classes b.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The invariant of the loop of Ratpoints.Sieve.twoAdic that scatters the bit t of g into the
even classes, from the words nb0: after the numerators 1, 3, … of the positions pref, the
words are those of nb0 with bit a set in the word of the class t a mod 64 of each of them.
Equations
- One or more equations did not get rendered due to their size.
Instances For
At the exit of the loop over the set bits of f, all of them are scattered into the odd
classes.
At the exit of the loop over the set bits of g, all of them are scattered into the even
classes.
The scatter of the lowest set bit k of w into the odd classes, for a word w with the bits
of f from k0 on: the bits of the set bits of f below k0 become those of its set bits up to
k.
The scatter of the lowest set bit t of w into the even classes, for a word w with the bits
of g from t0 on: the bits of the set bits of g below t0 become those of its set bits up to
t.
The loops over the set bits end, since clearing the lowest set bit makes a word other than 0
smaller.
Ratpoints.Sieve.twoAdic_spec as a plain statement, which the soundness of the classes uses
without the program logic.
The classes of a point #
A point (a, y, b) with odd b has a ≡ k b (mod 64) for a set bit k of the word of f
(Ratpoints.Sieve.fsq), since f(k) is a square modulo 64
(Ratpoints.isSquare_sum_mul_pow_of_sq_eq_binaryForm).
A point (a, y, b) with even b has an odd a, since gcd(a, b) = 1, and b ≡ t a (mod 64)
for a set bit t of the word of the reversed polynomial (Ratpoints.Sieve.gsq), since it takes a
square value at t (Ratpoints.isSquare_sum_mul_pow_sub_of_sq_eq_binaryForm).
The 2-adic information lets the numerator a of every point (a, y, b) through the word of the
class b mod 64: a or b is odd, since gcd(a, b) = 1, and F(a, b) is a square, so a square
modulo 64; neither b ≥ 1 nor a degree of a given parity is needed.
The classes that admit a numerator #
The word den_bits that Ratpoints.Sieve.numClasses returns with the classes is
Ratpoints.Sieve.denBits (Ratpoints.Sieve.numClasses_spec).
The 2-adic exit #
When no class of the denominators modulo 64 admits a numerator (Ratpoints.Sieve.denBits), the
curve has no normalized point of any height, a point at infinity included: the word of the class of
the denominator b of a point (a, y, b), b = 0 included, has bit a mod 64 set
(Ratpoints.Sieve.classBit_twoAdic_of_sq_eq), so the class has its bit in
Ratpoints.Sieve.denBits (Ratpoints.Sieve.getLsbD_denBits). So the 2-adic exit of the search
needs no test of the points at infinity: no class admits a numerator only for even degree and c_d
not a square modulo 64.