Documentation

Ratpoints.Proof.Forbidden

The forbidden divisors #

For a polynomial of even degree d, a point (a, y, b) with m = v_p(b) ≥ 1 has the terms c_{d-j} a ^ (d - j) b ^ j of F(a, b) of the valuations w_j + j m at p, where w_j = v_p(c_{d-j}); when one of them alone has the least valuation, that valuation is even, and for even j the unit part of c_{d-j} is a square modulo p (Ratpoints.even_and_isSquare_of_sq_eq_binaryForm_of_even), the Newton polygon of the comment of forbidden_valuations. So the valuations that Ratpoints.Sieve.forbiddenAt excludes, with the unit parts of the coefficients (Ratpoints.Sieve.unitParts), are those of no denominator of a point, and so are the bits of the mask of Ratpoints.Sieve.forbiddenValuations, the unit parts read from the coefficients reduced modulo p that the table of p hands back. The forbidden divisors are therefore sound, those that the loop of the tables records prime by prime from what each table hands back (Ratpoints.tablesLoop), the coefficients modulo p and the entry at infinity, and those of the further primes (Ratpoints.Sieve.forbidden): a prime tested with words divides no denominator b ≤ bHigh of a point, since the mask holds every valuation that such a denominator can have (Ratpoints.Sieve.allValuations) or there are no points at infinity modulo p, that is c_d is not a square modulo p, and its words are those of Ratpoints.Sieve.forbiddenRow, bit j of word r clear exactly when p ∣ 64 r + j (Ratpoints.Sieve.getLsbD_getElem!_forbiddenRow); a prime tested by its valuation excludes no denominator of a point. The words of a forbidden divisor that is one of the first Ratpoints.numPrimes primes of the table are the first p words of its row of 0, the pattern sieves0, which are those of Ratpoints.Sieve.forbiddenRow (Ratpoints.Sieve.extract_sieves0). A forbidden divisor tested with words holds the reciprocal of its prime (Ratpoints.Sieve.IsForbiddenEntry.magic_eq), with which the C code reduces the word number of the first word of a block. The masks, which the C code keeps in an unsigned long, have no bit from 40 on for an odd prime and a long b_high, so that its cap on the valuations never binds (Ratpoints.Sieve.lt_forty_of_pow_le); the products pm p of its loops of the valuations and the square p p of a prime of the table that its loop over the further primes compares with b_high are longs (Ratpoints.Setup.fitsLong_mul_of_le_div, Ratpoints.Setup.mul_self_lt_of_mem_primeTable). Ratpoints.Sieve.lt_forty_of_pow_le and Ratpoints.Setup.fitsLong_mul_of_le_div discharge range obligations that the Deviation paragraphs of the model state, and no proof consumes them.

Main definitions #

Main statements #

Implementation notes #

The contracts are proved with vcgen, the program logic of Lean core, with loop invariants that are named definitions, in a file with Mathlib, since they speak of primes, their valuations and the squares modulo a prime. A contract that needs the exact value of a component that its loop calls takes a specification ⦃True⦄ x ⦃fun r ↦ r = Id.run x⦄ of it (Ratpoints.Setup.valuation_value for the valuation, private ones for the components of this file), since the registered contract would give only what it says of the value.

The Newton polygon at a prime #

theorem Ratpoints.binaryForm_eq_sum_of_even {c : List ℤ} (hd : degree c % 2 = 0) (a b : ℤ) :
binaryForm c a b = ∑ j ∈ Finset.range (degree c + 1), c.getD (degree c - j) 0 * a ^ (degree c - j) * b ^ j

The binary form of a polynomial of even degree d as the sum over the exponent j of b: F(a, b) = ∑ c_{d-j} a ^ (d - j) b ^ j.

theorem Ratpoints.even_and_isSquare_of_sq_eq_binaryForm_of_even {c : List ℤ} {p : ℕ} [hp : Fact (Nat.Prime p)] (hd : degree c % 2 = 0) {a y : ℤ} {b : ℕ} (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) (hm : padicValNat p b ≠ 0) {j w : ℕ} {u : ℤ} (hj : j ≤ degree c) (hu : c.getD (degree c - j) 0 = ↑p ^ w * u) (hpu : ¬↑p ∣ u) (hmin : ∀ i ≤ degree c, i ≠ j → ↑p ^ (w + j * padicValNat p b + 1) ∣ c.getD (degree c - i) 0 * ↑p ^ (i * padicValNat p b)) :
Even (w + j * padicValNat p b) ∧ (Even j → IsSquare ↑u)

The Newton polygon at a prime p (even degree): for a point (a, y, b) with m = v_p(b) ≥ 1, whose term c_{d-j} a ^ (d - j) b ^ j of F(a, b) alone has the least valuation w + j m, where c_{d-j} = p ^ w u with p ∤ u and p ^ (w + j m + 1) divides c_{d-i} p ^ (i m) for every other i ≤ d, the valuation w + j m is even, and for even j the unit part u is a square modulo p, since a ^ (d - j) and (b / p ^ m) ^ j then are.

The unit parts of the coefficients #

What an entry o of Ratpoints.Sieve.unitParts says of the coefficient x at the prime p: none for x = 0, and otherwise the pair (w, r) with x = p ^ w u, p ∤ u, and r < p the residue of the unit part u modulo p.

Equations
Instances For
    theorem Ratpoints.Sieve.isUnitPart_of_emod_ne_zero {p : ℕ} (hp : 0 < p) {x : ℤ} (hx : x % ↑p ≠ 0) :
    IsUnitPart p x (some (0, (x % ↑p).toNat))
    theorem Ratpoints.Sieve.isUnitPart_of_eq_toNat_emod {p : ℕ} (hp : 0 < p) {x : ℤ} {r : ℕ} (hr : r = (x % ↑p).toNat) (h : r ≠ 0) :

    The residue r ≠ 0 of the coefficient x modulo p, as the table of p hands it back (Ratpoints.Sieve.examinePrime?), describes x at p with the valuation 0.

    theorem Ratpoints.Sieve.isUnitPart_of_eq_run_valuation {p : ℕ} (hp : 1 < p) {x : ℤ} (hx : x ≠ 0) {w r : ℕ} (h : (w, r) = (Setup.valuation x p).run) :
    IsUnitPart p x (some (w, if x < 0 then p - r else r))

    The valuation of a nonzero coefficient x with the residue r of |x| / p ^ w modulo p (Ratpoints.Setup.valuation), and p - r for x < 0, describes x at p: the unit part of x carries its sign.

    The invariant of the loop of Ratpoints.Sieve.unitParts after k coefficients: the entries describe the coefficients c_d, …, c_{d-k+1}.

    Equations
    Instances For
      theorem Ratpoints.Sieve.UnitPartsInvariant.push {c : List ℤ} {d p : ℕ} {pref suff : List ℕ} {cur : ℕ} {us : Array (Option (ℕ × ℕ))} {o : Option (ℕ × ℕ)} (h : UnitPartsInvariant c d p pref.length us) (hl : ForIn.toList [:d + 1] = pref ++ cur :: suff) (ho : IsUnitPart p (c.getD (d - cur) 0) o) :
      UnitPartsInvariant c d p (pref ++ [cur]).length (us.push o)
      theorem Ratpoints.Sieve.UnitPartsInvariant.size_eq_and_isUnitPart {c : List ℤ} {d p : ℕ} {us : Array (Option (ℕ × ℕ))} (h : UnitPartsInvariant c d p (ForIn.toList [:d + 1]).length us) :
      us.size = d + 1 ∧ ∀ j ≤ d, IsUnitPart p (c.getD (d - j) 0) us[j]!
      theorem Ratpoints.Sieve.unitParts_spec (c : List ℤ) (d p : ℕ) (cm : Array ℕ) :
      ⦃ 1 < p ∧ ∀ j ≤ d, cm[j]! = (c.getD j 0 % ↑p).toNat ⦄ unitParts c d p cm ⦃ fun (us : Array (Option (ℕ × ℕ))) => us.size = d + 1 ∧ ∀ j ≤ d, IsUnitPart p (c.getD (d - j) 0) us[j]! ⦄

      The contract of Ratpoints.Sieve.unitParts: for p > 1 and the coefficients cm reduced modulo p, as the table of p hands them back (Ratpoints.Sieve.examinePrime?), its entries describe the coefficients c_d, …, c_0 at p (Ratpoints.Sieve.IsUnitPart).

      theorem Ratpoints.Sieve.isUnitPart_run_unitParts {c : List ℤ} {d p : ℕ} (hp : 1 < p) {cm : Array ℕ} (hcm : ∀ j ≤ d, cm[j]! = (c.getD j 0 % ↑p).toNat) {j : ℕ} (hj : j ≤ d) :
      IsUnitPart p (c.getD (d - j) 0) (unitParts c d p cm).run[j]!

      Ratpoints.Sieve.unitParts_spec as a plain statement.

      theorem Ratpoints.Sieve.le_of_getElem!_run_unitParts_eq_some {c : List ℤ} {d p j : ℕ} (hp : 1 < p) {cm : Array ℕ} (hcm : ∀ j ≤ d, cm[j]! = (c.getD j 0 % ↑p).toNat) {x : ℕ × ℕ} (h : (unitParts c d p cm).run[j]! = some x) :
      j ≤ d

      The valuations that the terms exclude #

      @[reducible, inline]

      The terms of F(a, b) exclude the valuation m at a prime, with the entries us of the coefficients at the prime (Ratpoints.Sieve.IsUnitPart) and the table sq of the squares modulo it: the term of some j₀, 0 or a coefficient present, has a valuation w_{j₀} + j₀ m less than those of the other terms (the term of j = 0 counted as present), which is odd, or j₀ is even and the residue of its unit part is not marked in sq; by the Newton polygon at the prime, no denominator of a point then has the valuation m.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Ratpoints.Sieve.ForbiddenAtInvariant (us : Array (Option (ℕ × ℕ))) (m k jmin vmin : ℕ) (tie : Bool) :

        The invariant of the loop of Ratpoints.Sieve.forbiddenAt over the coefficients j ≤ k, on the index jmin, the least valuation vmin and the flag tie: jmin is 0 or a coefficient present, vmin is the valuation w_jmin + jmin m of its term, at most that of every term j ≤ k (the term of j = 0 counted as present), and less than those of the others unless tie.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Ratpoints.Sieve.ForbiddenAtInvariant.update {us : Array (Option (ℕ × ℕ))} {m jmin vmin : ℕ} {tie : Bool} {pref suff : List ℕ} {cur w r : ℕ} (h : ForbiddenAtInvariant us m pref.length jmin vmin tie) (hl : ForIn.toList [1:us.size] = pref ++ cur :: suff) (hw : us[cur]! = some (w, r)) (hlt : w + cur * m < vmin) :
          ForbiddenAtInvariant us m (pref ++ [cur]).length cur (w + cur * m) false

          The step of Ratpoints.Sieve.forbiddenAt at a coefficient whose term has a valuation less than vmin: it becomes the least one, with no tie.

          theorem Ratpoints.Sieve.ForbiddenAtInvariant.tie {us : Array (Option (ℕ × ℕ))} {m jmin vmin : ℕ} {tie : Bool} {pref suff : List ℕ} {cur w r : ℕ} (h : ForbiddenAtInvariant us m pref.length jmin vmin tie) (hl : ForIn.toList [1:us.size] = pref ++ cur :: suff) (hw : us[cur]! = some (w, r)) (heq : w + cur * m = vmin) :
          ForbiddenAtInvariant us m (pref ++ [cur]).length jmin vmin true

          The step of Ratpoints.Sieve.forbiddenAt at a coefficient whose term has the valuation vmin: a tie.

          theorem Ratpoints.Sieve.ForbiddenAtInvariant.keep {us : Array (Option (ℕ × ℕ))} {m jmin vmin : ℕ} {tie : Bool} {pref suff : List ℕ} {cur : ℕ} (h : ForbiddenAtInvariant us m pref.length jmin vmin tie) (hl : ForIn.toList [1:us.size] = pref ++ cur :: suff) (hw : ∀ (w r : ℕ), us[cur]! = some (w, r) → vmin < w + cur * m) :
          ForbiddenAtInvariant us m (pref ++ [cur]).length jmin vmin tie

          The step of Ratpoints.Sieve.forbiddenAt at a coefficient absent or whose term has a valuation greater than vmin: nothing changes.

          theorem Ratpoints.Sieve.ForbiddenAtInvariant.exists_of_eq_true {us : Array (Option (ℕ × ℕ))} {sq : Array Bool} {m jmin vmin : ℕ} {tie : Bool} (h : ForbiddenAtInvariant us m (ForIn.toList [1:us.size]).length jmin vmin tie) (hr : (!tie && (vmin % 2 == 1 || jmin % 2 == 0 && !sq[(us[jmin]!.getD (0, 0)).2]!)) = true) :
          theorem Ratpoints.Sieve.forbiddenAt_spec (us : Array (Option (ℕ × ℕ))) (sq : Array Bool) (m : ℕ) :
          ⦃ True ⦄ forbiddenAt us sq m ⦃ fun (r : Bool) => r = true → ExcludesByTerm us sq m ⦄

          The contract of Ratpoints.Sieve.forbiddenAt: it excludes the valuation m only when the terms exclude it (Ratpoints.Sieve.ExcludesByTerm).

          theorem Ratpoints.Sieve.pow_dvd_mul_pow_of_isUnitPart {p : ℕ} {x : ℤ} {o : Option (ℕ × ℕ)} (h : IsUnitPart p x o) {V i m : ℕ} (hV : ∀ (w r : ℕ), o = some (w, r) → V < w + i * m) :
          ↑p ^ (V + 1) ∣ x * ↑p ^ (i * m)

          A coefficient x with the entry o at p makes x p ^ (i m) divisible by p ^ (V + 1) when V < w + i m for the valuation w of o; for o = none, x = 0.

          theorem Ratpoints.Sieve.even_and_getElem!_squaresMod_of_sq_eq {c : List ℤ} (hd : degree c % 2 = 0) {p : ℕ} (hp : Nat.Prime p) {cm : Array ℕ} (hcm : ∀ j ≤ degree c, cm[j]! = (c.getD j 0 % ↑p).toNat) {a y : ℤ} {b : ℕ} (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) (hm : padicValNat p b ≠ 0) {j₀ w r : ℕ} (hus : (unitParts c (degree c) p cm).run[j₀]! = some (w, r)) (hmin : ∀ (j : ℕ), (unitParts c (degree c) p cm).run[j]!.isSome = true → j ≠ j₀ → w + j₀ * padicValNat p b < ((unitParts c (degree c) p cm).run[j]!.getD (0, 0)).1 + j * padicValNat p b) :
          Even (w + j₀ * padicValNat p b) ∧ (Even j₀ → (squaresMod p)[r]! = true)

          For a point (a, y, b) of a curve of even degree with v_p(b) = m ≥ 1, a coefficient c_{d-j₀}, with the entry (w, r) at p, whose term has a valuation w + j₀ m less than those of the other terms present has an even w + j₀ m, and for even j₀ a unit part whose residue r is marked as a square modulo p (Ratpoints.even_and_isSquare_of_sq_eq_binaryForm_of_even); cm are the coefficients reduced modulo p.

          theorem Ratpoints.Sieve.run_forbiddenAt_eq_false_of_sq_eq {c : List ℤ} (hd : degree c % 2 = 0) {p : ℕ} (hp : Nat.Prime p) {cm : Array ℕ} (hcm : ∀ j ≤ degree c, cm[j]! = (c.getD j 0 % ↑p).toNat) {a y : ℤ} {b : ℕ} (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) (hm : padicValNat p b ≠ 0) :

          The forbidden valuations are sound. No denominator b of a point of a curve of even degree has a valuation v_p(b) ≥ 1 at a prime p that Ratpoints.Sieve.forbiddenAt excludes, with the unit parts of the coefficients at p (Ratpoints.Sieve.unitParts) and the squares modulo p: the term of the least valuation would make F(a, b) a non-square (Ratpoints.Sieve.even_and_getElem!_squaresMod_of_sq_eq), and for c_d = 0 the term of j = 0, of the valuation 0 and the unit part 0, a square, is the least one; cm are the coefficients reduced modulo p.

          The masks of the valuations #

          The invariant of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations on the mask, the valuation m and pm, for the test f of the valuations: before the exit, pm = p ^ m with m ≥ 1, p ^ t ≤ bHigh for 1 ≤ t < m, and the mask holds the t with 1 ≤ t < m that pass f; at the exit, the mask holds the t ≥ 1 with p ^ t ≤ bHigh that pass f.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Ratpoints.Sieve.ValuationsInvariant.exit_of_div_lt {f : ℕ → Bool} {p bHigh mask m pm mask' : ℕ} (hp : 0 < p) (h : ValuationsInvariant f p bHigh false (mask, m, pm)) (hpm : pm ≤ bHigh) (hb : bHigh / p < pm) (h' : ∀ (t : ℕ), mask'.testBit t = (mask.testBit t || decide (t = m) && f m)) :
            ValuationsInvariant f p bHigh true (mask', m, pm)

            The step of the valuation m of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations that ends them, p ^ (m + 1) > bHigh, with the bit of m set when m passes f.

            theorem Ratpoints.Sieve.ValuationsInvariant.add_one {f : ℕ → Bool} {p bHigh mask m pm mask' : ℕ} (h : ValuationsInvariant f p bHigh false (mask, m, pm)) (hpm : pm ≤ bHigh) (hb : ¬bHigh / p < pm) (h' : ∀ (t : ℕ), mask'.testBit t = (mask.testBit t || decide (t = m) && f m)) :
            ValuationsInvariant f p bHigh false (mask', m + 1, pm * p)

            The step of the valuation m of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations that goes on, with the bit of m set when m passes f.

            theorem Ratpoints.Sieve.ValuationsInvariant.exit {f : ℕ → Bool} {p bHigh mask m pm : ℕ} (hp : 0 < p) (h : ValuationsInvariant f p bHigh false (mask, m, pm)) (hpm : ¬pm ≤ bHigh) :
            ValuationsInvariant f p bHigh true (mask, m, pm)

            The exit of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations at p ^ m > bHigh.

            theorem Ratpoints.Sieve.ValuationsInvariant.testBit {f : ℕ → Bool} {p bHigh mask m pm : ℕ} (h : ValuationsInvariant f p bHigh true (mask, m, pm)) (t : ℕ) :
            mask.testBit t = (decide (1 ≤ t) && decide (p ^ t ≤ bHigh) && f t)
            theorem Ratpoints.Sieve.ValuationsInvariant.sub_mul_lt {f : ℕ → Bool} {p bHigh mask m pm : ℕ} (hp : 1 < p) (h : ValuationsInvariant f p bHigh false (mask, m, pm)) (hb : ¬bHigh / p < pm) :
            bHigh + 1 - pm * p < bHigh + 1 - pm

            The measure of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations drops with each step that goes on: pm p ≤ bHigh, and pm p > pm since pm = p ^ m ≥ 1 and p > 1.

            theorem Ratpoints.Sieve.ValuationsInvariant.sub_lt_and_add_one {f : ℕ → Bool} {p bHigh mask m pm mask' : ℕ} (hp : 1 < p) (h : ValuationsInvariant f p bHigh false (mask, m, pm)) (hpm : pm ≤ bHigh) (hb : ¬bHigh / p < pm) (h' : ∀ (t : ℕ), mask'.testBit t = (mask.testBit t || decide (t = m) && f m)) :
            bHigh + 1 - pm * p < bHigh + 1 - pm ∧ ValuationsInvariant f p bHigh false (mask', m + 1, pm * p)

            The step of the loops of Ratpoints.Sieve.forbiddenValuations and Ratpoints.Sieve.allValuations that goes on, with the measure.

            theorem Ratpoints.Sieve.forbiddenValuations_spec (c : List ℤ) (d p bHigh : ℕ) (cm : Array ℕ) :
            ⦃ 1 < p ⦄ forbiddenValuations c d p bHigh cm ⦃ fun (mask : ℕ) => ∀ (m : ℕ), mask.testBit m = (decide (1 ≤ m) && decide (p ^ m ≤ bHigh) && (forbiddenAt (unitParts c d p cm).run (squaresMod p) m).run) ⦄

            The contract of Ratpoints.Sieve.forbiddenValuations: bit m of the mask is set exactly for the m ≥ 1 with p ^ m ≤ bHigh that Ratpoints.Sieve.forbiddenAt excludes. The loop ends for p > 1, since pm = p ^ m grows and stays at most bHigh while it goes on.

            theorem Ratpoints.Sieve.allValuations_spec (p bHigh : ℕ) :
            ⦃ 1 < p ⦄ allValuations p bHigh ⦃ fun (all : ℕ) => ∀ (m : ℕ), all.testBit m = (decide (1 ≤ m) && decide (p ^ m ≤ bHigh)) ⦄

            The contract of Ratpoints.Sieve.allValuations: bit m of the mask is set exactly for the m ≥ 1 with p ^ m ≤ bHigh.

            theorem Ratpoints.Sieve.testBit_run_forbiddenValuations (c : List ℤ) (d : ℕ) {p : ℕ} (hp : 1 < p) (bHigh : ℕ) (cm : Array ℕ) (m : ℕ) :
            (forbiddenValuations c d p bHigh cm).run.testBit m = (decide (1 ≤ m) && decide (p ^ m ≤ bHigh) && (forbiddenAt (unitParts c d p cm).run (squaresMod p) m).run)

            Ratpoints.Sieve.forbiddenValuations_spec as a plain statement.

            theorem Ratpoints.Sieve.testBit_run_allValuations {p : ℕ} (hp : 1 < p) (bHigh m : ℕ) :
            (allValuations p bHigh).run.testBit m = (decide (1 ≤ m) && decide (p ^ m ≤ bHigh))

            Ratpoints.Sieve.allValuations_spec as a plain statement.

            theorem Ratpoints.Sieve.testBit_run_forbiddenValuations_eq_false_of_sq_eq {c : List ℤ} (hd : degree c % 2 = 0) {p : ℕ} (hp : Nat.Prime p) (bHigh : ℕ) {cm : Array ℕ} (hcm : ∀ j ≤ degree c, cm[j]! = (c.getD j 0 % ↑p).toNat) {a y : ℤ} {b : ℕ} (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) :

            The mask of the forbidden valuations at a prime p, with the coefficients cm reduced modulo p, has no bit v_p(b) for the denominator b of a point of a curve of even degree (Ratpoints.Sieve.run_forbiddenAt_eq_false_of_sq_eq); its bit 0 is never set.

            The forbidden divisors #

            theorem Ratpoints.Sieve.eq_of_run_forbiddenOfPrime_eq_inl {c : List ℤ} {d p bHigh : ℕ} {cm : Array ℕ} {atInf : Bool} {e : ForbiddenEntry} (h : (forbiddenOfPrime c d p bHigh cm atInf).run = some (Sum.inl e)) :
            e = { p := p, words := forbiddenRow p, magic := magic p } ∧ (cm[d]! = 0 ∧ (forbiddenValuations c d p bHigh cm).run &&& (allValuations p bHigh).run = (allValuations p bHigh).run ∨ atInf = false)

            A forbidden divisor tested with words that Ratpoints.Sieve.forbiddenOfPrime gives for p from the coefficients cm and the entry atInf at infinity is p with its words, for cm[d] = 0 and a mask of the forbidden valuations that holds every valuation a denominator can have, or for atInf = false: for the coefficients reduced modulo p and the entry at infinity of the table of p, when p ∣ c_d, or when there are no points at infinity modulo p.

            theorem Ratpoints.Sieve.eq_of_run_forbiddenOfPrime_eq_inr {c : List ℤ} {d p bHigh : ℕ} {cm : Array ℕ} {atInf : Bool} {e : ForbiddenVal} (h : (forbiddenOfPrime c d p bHigh cm atInf).run = some (Sum.inr e)) :
            e = { p := p, mask := (forbiddenValuations c d p bHigh cm).run }

            A forbidden divisor tested by its valuation that Ratpoints.Sieve.forbiddenOfPrime gives for p from the coefficients cm is p with the mask of the forbidden valuations of cm (Ratpoints.Sieve.forbiddenValuations).

            theorem Ratpoints.Sieve.not_dvd_of_run_forbiddenOfPrime_eq_inl {c : List ℤ} (hd : degree c % 2 = 0) {p bHigh : ℕ} (hp : Nat.Prime p) {cm : Array ℕ} (hcm : ∀ j ≤ degree c, cm[j]! = (c.getD j 0 % ↑p).toNat) {atInf : Bool} (hinf : atInf = (examinePrime c (degree c) p).isFSquare[p]!) {e : ForbiddenEntry} (he : (forbiddenOfPrime c (degree c) p bHigh cm atInf).run = some (Sum.inl e)) {a y : ℤ} {b : ℕ} (hb : b ≠ 0) (hbH : b ≤ bHigh) (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) :
            ¬p ∣ b

            A forbidden divisor tested with words that an examined prime gives is sound, from the coefficients cm reduced modulo p and the entry atInf at infinity of the table of p, as the table hands them back: for a point (a, y, b) of a curve of even degree with b ≤ bHigh, the prime would divide b with a valuation that the mask holds, if it holds every valuation a denominator can have, or c_d would be a square modulo p, so that there are points at infinity modulo p.

            Whether the forbidden divisor e tested by its valuation excludes the denominator b: bit v_p(b) of its mask, for the valuation v_p(b) of Ratpoints.Setup.valuation, the test that the tests of the word shape make with e (Ratpoints.Sieve.wordsTest).

            Equations
            Instances For
              theorem Ratpoints.Sieve.ForbiddenVal.excludes_eq_false_of_run_forbiddenOfPrime_eq_inr {c : List ℤ} (hd : degree c % 2 = 0) {p bHigh : ℕ} (hp : Nat.Prime p) {cm : Array ℕ} (hcm : ∀ j ≤ degree c, cm[j]! = (c.getD j 0 % ↑p).toNat) {atInf : Bool} {e : ForbiddenVal} (he : (forbiddenOfPrime c (degree c) p bHigh cm atInf).run = some (Sum.inr e)) {a y : ℤ} {b : ℕ} (hb : b ≠ 0) (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) :

              A forbidden divisor tested by its valuation that an examined prime p gives, from the coefficients cm reduced modulo p, excludes no denominator of a point of a curve of even degree: the valuations of its mask are excluded by the terms of F(a, b) (Ratpoints.Sieve.forbiddenValuations).

              A forbidden divisor tested with words that the loop of the tables (Ratpoints.tablesLoop) and Ratpoints.Sieve.forbidden may record: the one that Ratpoints.Sieve.forbiddenOfPrime gives for a prime p of Ratpoints.primeTable from the coefficients reduced modulo p and the entry at infinity of the table of the reference (Ratpoints.Sieve.examinePrime), what Ratpoints.Sieve.examinePrime? hands back for the primes the loop of the tables examines, or a prime of the table with its words (Ratpoints.Sieve.forbiddenRow) and its reciprocal at which c_d is not a square modulo it.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                A forbidden divisor tested by its valuation that the loop of the tables may record: the one that Ratpoints.Sieve.forbiddenOfPrime gives for a prime p of Ratpoints.primeTable from the coefficients reduced modulo p and the entry at infinity of the table of the reference (Ratpoints.Sieve.examinePrime).

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Ratpoints.Sieve.getElem!_map_range_toNat_emod (c : List ℤ) {d : ℕ} (p : ℕ) {j : ℕ} (hj : j ≤ d) :
                  (Array.map (fun (n : ℕ) => (c.getD n 0 % ↑p).toNat) (Array.range (d + 1)))[j]! = (c.getD j 0 % ↑p).toNat
                  theorem Ratpoints.Sieve.IsForbiddenEntry.magic_eq {c : List ℤ} {d bHigh : ℕ} {e : ForbiddenEntry} (h : IsForbiddenEntry c d bHigh e) :

                  A forbidden divisor tested with words holds the reciprocal of its prime, with which the C code reduces the word number of the first word of a block.

                  theorem Ratpoints.Sieve.IsForbiddenEntry.not_dvd {c : List ℤ} {bHigh : ℕ} {e : ForbiddenEntry} (h : IsForbiddenEntry c (degree c) bHigh e) (hd : degree c % 2 = 0) {a y : ℤ} {b : ℕ} (hb : b ≠ 0) (hbH : b ≤ bHigh) (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) :
                  ¬e.p ∣ b

                  A forbidden divisor tested with words divides no denominator b ≤ bHigh of a point of a curve of even degree: either every valuation that such a denominator can have at p is excluded by the terms of F(a, b) (Ratpoints.Sieve.forbiddenValuations), or c_d is not a square modulo p while F(a, b) ≡ c_d a ^ d (mod p) for p ∣ b.

                  theorem Ratpoints.Sieve.IsForbiddenVal.excludes_eq_false {c : List ℤ} {bHigh : ℕ} {e : ForbiddenVal} (h : IsForbiddenVal c (degree c) bHigh e) (hd : degree c % 2 = 0) {a y : ℤ} {b : ℕ} (hb : b ≠ 0) (hab : a.gcd ↑b = 1) (hy : y ^ 2 = binaryForm c a ↑b) :

                  A forbidden divisor tested by its valuation excludes no denominator of a point of a curve of even degree (Ratpoints.Sieve.ForbiddenVal.excludes_eq_false_of_run_forbiddenOfPrime_eq_inr).

                  The loop of the tables #

                  The forbidden divisor that the prime at the position k < Ratpoints.numPrimes of the table gives from what its table hands back (Ratpoints.Sieve.examinePrime?) is that of the coefficients reduced modulo the prime and the entry at infinity of the table of the reference.

                  theorem Ratpoints.Sieve.isForbiddenEntry_of_run_examinePrime?_eq_some {c : List ℤ} {d bHigh k : ℕ} {u : Bool} {e : Entry} {cm : Array ℕ} {code : ℕ} {dens : Float} {f : ForbiddenEntry} (hk : k < numPrimes) (he : (examinePrime? c d primeTable[k]! u).run = some (e, cm, code, dens)) (hf : (forbiddenOfPrime c d primeTable[k]! bHigh cm e.isFSquare[primeTable[k]!]!).run = some (Sum.inl f)) :
                  IsForbiddenEntry c d bHigh f

                  A forbidden divisor tested with words that the prime at the position k < Ratpoints.numPrimes gives from what its table hands back is one that the loop of the tables may record.

                  theorem Ratpoints.Sieve.isForbiddenVal_of_run_examinePrime?_eq_some {c : List ℤ} {d bHigh k : ℕ} {u : Bool} {e : Entry} {cm : Array ℕ} {code : ℕ} {dens : Float} {f : ForbiddenVal} (hk : k < numPrimes) (he : (examinePrime? c d primeTable[k]! u).run = some (e, cm, code, dens)) (hf : (forbiddenOfPrime c d primeTable[k]! bHigh cm e.isFSquare[primeTable[k]!]!).run = some (Sum.inr f)) :
                  IsForbiddenVal c d bHigh f

                  A forbidden divisor tested by its valuation that the prime at the position k < Ratpoints.numPrimes gives from what its table hands back is one that the loop of the tables may record.

                  The further primes #

                  theorem Ratpoints.Sieve.forall_isForbiddenEntry_push {c : List ℤ} {d examined bHigh : ℕ} {pref suff : List ℕ} {cur : ℕ} {ba : Array ForbiddenEntry} (h : ∀ e ∈ ba, IsForbiddenEntry c d bHigh e) (hl : ForIn.toList [examined:primeTable.size] = pref ++ cur :: suff) (hs : (!(squaresMod primeTable[cur]!)[(c.getD d 0 % ↑primeTable[cur]!).toNat]!) = true) (e : ForbiddenEntry) :

                  The step of the loop of Ratpoints.Sieve.forbidden over the further primes that records a prime of the table at which c_d is not a square modulo it, with its words: the forbidden divisors stay of the kind that Ratpoints.Sieve.IsForbiddenEntry describes.

                  theorem Ratpoints.Sieve.forall_isForbiddenEntry_and_forall_isForbiddenVal {c : List ℤ} {d bHigh : ℕ} {ba : Array ForbiddenEntry} {val : Array ForbiddenVal} (h : ∀ e ∈ val, IsForbiddenVal c d bHigh e) (h' : ∀ e ∈ ba, IsForbiddenEntry c d bHigh e) :
                  (∀ e ∈ ba.toList, IsForbiddenEntry c d bHigh e) ∧ ∀ e ∈ val.toList, IsForbiddenVal c d bHigh e
                  theorem Ratpoints.Sieve.forbidden_spec (c : List ℤ) (d examined maxForbidden bHigh : ℕ) (ba : Array ForbiddenEntry) (val : Array ForbiddenVal) :
                  ⦃ (∀ e ∈ ba, IsForbiddenEntry c d bHigh e) ∧ ∀ e ∈ val, IsForbiddenVal c d bHigh e ⦄ forbidden c d examined maxForbidden bHigh ba val ⦃ fun (r : List ForbiddenEntry × List ForbiddenVal) => (∀ e ∈ r.1, IsForbiddenEntry c d bHigh e) ∧ ∀ e ∈ r.2, IsForbiddenVal c d bHigh e ⦄

                  The contract of Ratpoints.Sieve.forbidden: from forbidden divisors ba and val of the kinds that Ratpoints.Sieve.IsForbiddenEntry and Ratpoints.Sieve.IsForbiddenVal describe, such as the loop of the tables records, it returns forbidden divisors of the same kinds, since the further primes add only primes of the table with their words at which c_d is not a square modulo the prime, and val passes through.

                  The longs of the C code #

                  theorem Ratpoints.Sieve.lt_forty_of_pow_le {p m bHigh : ℕ} (hp : 3 ≤ p) (hH : bHigh < 2 ^ 63) (h : p ^ m ≤ bHigh) :
                  m < 40

                  The valuations m with p ^ m ≤ bHigh for p ≥ 3, as for an odd prime, and a long bHigh are below 40, since 3 ^ 40 > 2 ^ 63: the cap m < LONG_LENGTH - 1 of the loops of forbidden_valuations and of the valuations that a denominator can have (find_points.c:2217, find_points.c:2636-2637), which the model drops, never binds, and the bits 1UL << m that they set are defined, so that the masks fit an unsigned long (find_points.c:2229, find_points.c:2638). The values pm * p of these loops, computed only for pm ≤ ⌊b_high / p⌋, are longs too (Ratpoints.Setup.fitsLong_mul_of_le_div).