The moduli of the choice #
The candidates of the composite moduli that the choice offers (Ratpoints.addModuli) factor over
the primes looked at into factors whose tables the choice holds, with codes that
Ratpoints.makeModulus can read (Ratpoints.IsFactorCode), and the sieve entries that it makes of
them are sound, each at its position (Ratpoints.IsChoiceEntry); the candidates of the primes have
the sieve entries of their primes (Ratpoints.ModulusCandidate.IsPrime). After the stages, every
candidate has its sieve entry (Ratpoints.ChoicePoolWF), the third stage keeping it so and exiting
only at a prime modulo which the curve has no points (Ratpoints.thirdStage_spec).
Main definitions #
Ratpoints.IsExaminedPrimeSe,Ratpoints.Sieve.Power.IsExamined: the tables of the primes and the records of the prime powers as the choice examines them.Ratpoints.factorOfCode,Ratpoints.IsFactorCode: the factor of a code of a composite modulus.Ratpoints.ModulusCandidate.IsPrime,Ratpoints.ModulusCandidate.IsComposite,Ratpoints.ModulusCandidate.IsPrimeOrComposite: the candidates before the stages.Ratpoints.PowerTable.WF,Ratpoints.FacState.WF: the state ofRatpoints.addModuli.Ratpoints.IsChoiceEntry: a sieve entry that the choice makes at a position.Ratpoints.ChoicePoolWF,Ratpoints.ThirdState.WF: the pool after the stages.
Main statements #
Ratpoints.factorCandidate_spec,Ratpoints.offerModulus_spec,Ratpoints.addModuli_spec: the composite moduli offered.Ratpoints.isFactorCode_of_getD_eq_some,Ratpoints.isFactorCode_add_of_getElem?_eq_some: the codes of the primes and of the prime powers can be read.Ratpoints.isChoiceEntry_primeEntry,Ratpoints.makeModulus_spec: the sieve entries.Ratpoints.stageEntries_spec,Ratpoints.thirdStage_spec: the pool after the stages.
The codes of the factors #
The factor of the code code of a composite modulus, as Ratpoints.makeModulus reads it: a
code below Ratpoints.numPrimes the table of the prime at that position from the loop of the tables
(primeSe), another the record of the prime power of its index (pws).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The tables and densities of the loop of the tables (primeSe) for the curve with the
coefficient list c: each table that it holds is that of Ratpoints.Sieve.examinePrime for the
prime of the table at its position, one of the first Ratpoints.numPrimes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The record of a prime power as Ratpoints.addModuli examines it: the tables of
Ratpoints.Sieve.examinePower of a prime of the table, one of the first Ratpoints.numPrimes, with
a positive exponent, for either path of the reduction and either value of the flag pinf.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A code of a factor of a composite modulus that Ratpoints.makeModulus can read: a code below
Ratpoints.numPrimes of a prime whose table the loop of the tables holds, another the index of a
record of the prime powers.
- prime : code < numPrimes → ∃ (r : Float), primeSe.getD code none = some (Sieve.examinePrime c (degree c) primeTable[code]!, r)
A code of a prime has its table.
- power : numPrimes ≤ code → ∃ (pw : Sieve.Power), pws[code - numPrimes]? = some pw ∧ Sieve.Power.IsExamined c pw
Another code has its record.
Instances For
The factor of a code that Ratpoints.makeModulus can read is sound for every modulus
0 < m < maxPrimeEven that its modulus divides.
A code that Ratpoints.makeModulus can read stays so when the records of the prime powers are
extended.
The factor of a code that Ratpoints.makeModulus can read stays the same when the records of
the prime powers are extended.
The candidates #
The candidate of a prime as the loop of the tables and the third stage make it for the curve
with the coefficient list c (Ratpoints.ModulusCandidate.ofPrime): no factors counted or the
count -1, a prime of the table, one of the first Ratpoints.numPrimes, with its sieve entry
(Ratpoints.primeEntry) of the table of Ratpoints.Sieve.examinePrime.
No factors counted, or the count
-1.- exists_eq : ∃ pn < numPrimes, ∃ (r : Float), e.p = primeTable[pn]! ∧ e.ssp = some (primeEntry (Sieve.examinePrime c (degree c) primeTable[pn]!) r)
A prime of the table with its sieve entry.
Instances For
The candidate of a composite modulus as Ratpoints.addModuli offers it for the curve with the
coefficient list c, the tables of the loop of the tables primeSe and the records of the prime
powers pws: the count of its factors, with codes that Ratpoints.makeModulus can read and whose
moduli multiply to the modulus, odd, between 1 and Ratpoints.maxPrimeEven, and no sieve entry
yet.
The count of the factors.
At least one factor.
No sieve entry yet.
The modulus is above
1.The modulus is below
Ratpoints.maxPrimeEven.The modulus is odd.
- isFactorCode (code : ℕ) : code ∈ e.fac → IsFactorCode c primeSe pws code
The codes can be read.
The moduli of the factors multiply to the modulus.
Instances For
A candidate of the pool before the stages: a prime (Ratpoints.ModulusCandidate.IsPrime) or a
composite modulus (Ratpoints.ModulusCandidate.IsComposite).
Equations
- Ratpoints.ModulusCandidate.IsPrimeOrComposite c primeSe pws e = (Ratpoints.ModulusCandidate.IsPrime c e ∨ Ratpoints.ModulusCandidate.IsComposite c primeSe pws e)
Instances For
A candidate with the count of factors, the modulus, the sieve entry and the codes of a candidate is a candidate: the predicate reads neither the density, the key, the cost nor the mask.
A candidate keyed for the first stage is a candidate.
The prime powers #
The prime powers examined so far by Ratpoints.addModuli for the curve with the coefficient
list c: each record that the table holds is that of a prime power of the table, and each index
that it holds for a prime power p ^ e, p at the position pn, is that of a record of the tables
of Ratpoints.Sieve.examinePower for it.
- isExamined (pw : Sieve.Power) : pw ∈ tab.pws → Sieve.Power.IsExamined c pw
Each record is that of a prime power of the table.
- idx (pn e i : ℕ) : List.lookup (pn, e) tab.idx = some (some i) → ∃ (pw : Sieve.Power), tab.pws[i]? = some pw ∧ ∃ (u : Bool) (pinf : Bool), pw = (Sieve.examinePower c (degree c) primeTable[pn]! e u pinf).run
Each index is that of the record of its prime power.
Instances For
The contract of Ratpoints.powerIndex for the prime power p ^ e, e ≥ 1, of the prime
p = primeTable[pn], one of the first Ratpoints.numPrimes: the prime powers examined stay those
of the table (Ratpoints.PowerTable.WF), the records extended, and the index it returns is
that of a record of the tables of Ratpoints.Sieve.examinePower for p ^ e.
The code of a prime whose table the loop of the tables holds can be read.
The factor of the code of a prime whose table the loop of the tables holds has the prime as its modulus.
The code numPrimes + i of the record i of the tables of a prime power of the table can be
read.
The factor of the code numPrimes + i of the record i of the tables of a prime power p ^ e
of the table has the modulus p ^ e.
The contract of Ratpoints.takeFactor for the factor p ^ e, e ≥ 1, of the prime
p = primeTable[st.pn], one of the first Ratpoints.numPrimes: the prime powers examined stay
those of the table, the records extended, the cofactor kept and the position not lowered,
and while the candidate is possible the code of the factor is appended, one that
Ratpoints.makeModulus can read (Ratpoints.IsFactorCode), with the modulus p ^ e.
The state st of the factorization of the candidate m (Ratpoints.FacState) for the curve
with the coefficient list c and the tables of the loop of the tables primeSe: the prime powers
examined are those of the table (Ratpoints.PowerTable.WF), and while the candidate is possible the
cofactor is positive and times the moduli of the factors taken, whose codes
Ratpoints.makeModulus can read, makes m.
- tab : PowerTable.WF c st.tab
The prime powers examined are those of the table.
The cofactor is positive.
The codes of the factors can be read.
- mul_prod : st.ok = true → st.rest * (List.map (fun (code : ℕ) => (factorOfCode primeSe st.tab.pws code).modulus) st.fac.toList).prod = m
The cofactor times the moduli of the factors makes
m.
Instances For
A state of the factorization with the cofactor, the flag, the codes and the table of the prime
powers of one of m is one of m: the predicate reads neither the position of the next prime, the
product of the densities nor the mask.
The state of the factorization after the factor p ^ e of the cofactor b.rest = rest p ^ e
is taken (Ratpoints.takeFactor), from one of m whose candidate is still possible: one of m.
The invariant of the loop of Ratpoints.factorCandidate over the primes, whose state is the
value of a return and the state of the factorization, from the state st₀: both are states of the
factorization of m (Ratpoints.FacState.WF) with the records of the prime powers of st₀
extended.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The invariant of the loop of Ratpoints.factorCandidate that divides the prime p off the
cofactor R, on the cofactor left and the exponent: the cofactor left is positive and times
p ^ e makes R, it is R before the first division, and p does not divide it at the end.
Equations
Instances For
The contract of Ratpoints.factorCandidate over the first pnLim ≤ numPrimes primes: the
state of the factorization of m stays one (Ratpoints.FacState.WF), with the records of the prime
powers extended. The loop ends, since the position of the next prime rises or the candidate is
refused, and the inner loops, since the position rises and the cofactor drops.
The candidate of a composite modulus 1 < m < maxPrimeEven, odd, from a state of its
factorization that ends with the candidate possible and the cofactor 1: the codes of its factors,
whose moduli multiply to m.
The contract of Ratpoints.offerModulus for an odd 1 < m < maxPrimeEven: the prime powers
examined stay those of the table, the records extended, and the candidate it offers is a composite
modulus whose codes Ratpoints.makeModulus can read and whose factors multiply to m
(Ratpoints.ModulusCandidate.IsComposite).
The invariant of the loop of Ratpoints.addModuli over the candidates m: the candidates of
the pool (Ratpoints.ModulusCandidate.IsPrimeOrComposite) for the records of the prime powers
examined so far, which are those of the table, and m odd from 9 on.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The contract of Ratpoints.addModuli, for any values of the doubles: from a pool of candidates
of the primes, it returns a pool of candidates of primes and composite moduli
(Ratpoints.ModulusCandidate.IsPrimeOrComposite) for the records of the prime powers that it
returns.
The sieve entries #
A sieve entry that the choice of the moduli makes for the curve with the coefficient list c,
at the position n of the entries: an entry of its modulus (Ratpoints.IsModulusEntry), with the
reference and the kind of builder of its position (Ratpoints.Sieve.SieveEntry.refInit), and a
prime entry of the table (Ratpoints.Sieve.SieveEntry.IsPrimeEntry) when it counts no factors.
- isModulusEntry : IsModulusEntry c se.p se
An entry of its modulus.
The reference and the kind of builder of its position.
- isPrimeEntry : se.nf = 0 → se.IsPrimeEntry
A prime entry when it counts no factors.
Instances For
The sieve entry of a prime of the table (Ratpoints.primeEntry), one of the first
Ratpoints.numPrimes, with its table, is one that the choice makes, at every position.
The factors of a composite candidate whose codes can be read are sound for its modulus.
The contract of Ratpoints.makeModulus: the sieve entry of a composite candidate whose codes
can be read is one that the choice makes at the position n (Ratpoints.IsChoiceEntry).
The candidates of the pool pool after the stages, whose second ends at sp2: those of the
first two stages each with its sieve entry, made for its position (Ratpoints.IsChoiceEntry), and
those from sp2 on primes (Ratpoints.ModulusCandidate.IsPrime).
- exists_isChoiceEntry_of_lt (n : ℕ) (h : n < pool.size) : n < sp2 → ∃ (se : Sieve.SieveEntry), pool[n].ssp = some se ∧ IsChoiceEntry c n se
The candidates of the first two stages have their sieve entries.
The candidates from
sp2on are primes.
Instances For
The invariant of the loop of Ratpoints.stageEntries after the positions below k, from the
pool pool₀: the size kept, the candidates below k with their sieve entries made for their
positions, and the others as they were.
The size is kept.
- exists_isChoiceEntry_of_lt (n : ℕ) (h : n < pool.size) : n < k → ∃ (se : Sieve.SieveEntry), pool[n].ssp = some se ∧ IsChoiceEntry c n se
The candidates below
khave their sieve entries, made for their positions. The other candidates are as they were.
Instances For
A prime candidate has the sieve entry of its prime, which the choice makes, at every position.
The contract of Ratpoints.stageEntries: after the stages, which leave composite moduli only
before sp2, every candidate before sp2 has its sieve entry, made for its position, and those
from sp2 on are primes (Ratpoints.ChoicePoolWF).
The result of Ratpoints.Sieve.examinePrime? as its own value, for the contracts of the loops
that bind it and read it through its own lemmas.
The candidate of a prime of the table, one of the first Ratpoints.numPrimes, from its
examination, which says something, is a prime candidate, whatever its key and cost.
The contract of Ratpoints.lookFurther for a position below Ratpoints.numPrimes: at none the
curve has no points; otherwise one more prime is looked at, and the pool gains at most the candidate
of a prime.
The state of the third stage (Ratpoints.ThirdState) after the first two stages, which end at
sp2: the pool after the stages (Ratpoints.ChoicePoolWF), the end of the third stage between
sp2 and the size of the pool.
Equations
Instances For
The invariant of the loop of Ratpoints.thirdStage, whose state is the value of a return and
the state of the stage: the value of a return is an exit, at which the curve has no points; the
state of the stage, from the end sp2 of the first two (Ratpoints.ThirdState.WF).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The contract of Ratpoints.thirdStage, for any values of the doubles: at an exit the curve has
no points; otherwise the pool stays one after the stages (Ratpoints.ThirdState.WF), the end of the
third stage within it. The loop ends, since the stage grows or one more prime is looked at.