Documentation

Ratpoints.Spec.Basic

The specification #

The points that ratpoints finds, for a coefficient list c (constant term first) and a height bound H: the binary form F of c and the normalized points (x, y, z) of height at most H on y ^ 2 = F(x, z); and the binary form over ℚ that the refusals of the program speak about. The specification uses Mathlib and nothing of the model, so that it can be read on its own; the comparator challenge restates Ratpoints.degree, Ratpoints.binaryForm, Ratpoints.IsNormalizedPair, Ratpoints.IsPoint and Ratpoints.binaryFormPoly verbatim.

Main definitions #

Main statements #

Implementation notes #

The coefficients are written c.getD i 0: Mathlib's notation c[...] for cycles makes c[i] fail for a list named c wherever all of Mathlib is imported.

The file imports Mathlib.Algebra.Squarefree.Basic, which its definitions do not need, for the refusal theorems, which say that Ratpoints.binaryFormPoly c is not Squarefree: the comparator challenge imports, besides the model, which uses no Mathlib, exactly the Mathlib modules among the public imports of the files of the specification that it restates (this file, Ratpoints.Spec.Order, Ratpoints.Spec.Region and Ratpoints.Spec.Sturm), so that the definitions that it restates elaborate to the same terms as here.

The degree of the polynomial ∑ cᵢ Xⁱ: the largest index of a nonzero entry of c, or 0 if there is none.

Equations
Instances For
    def Ratpoints.binaryForm (c : List ℤ) (x z : ℤ) :

    The binary form F(x, z) = ∑ cᵢ xⁱ z^(D - i) of even degree D = d + d % 2 of the polynomial of degree d with coefficient list c.

    Equations
    Instances For
      noncomputable def Ratpoints.binaryFormPoly (c : List ℤ) :

      The binary form Φ = ∑ cᵢ Xⁱ Z^(N - i) over ℚ of degree N = 2 ⌈n / 2⌉, where n + 1 is the length of c: the polynomial made homogeneous of the even degree that the length of its coefficient list allows. The refusals of the program speak about this form; on every input that is not refused, it agrees with Ratpoints.binaryForm (Ratpoints.eval_binaryFormPoly).

      Equations
      Instances For
        theorem Ratpoints.degree_def (c : List ℤ) :
        degree c = (List.dropWhile (fun (x : ℤ) => x == 0) c.reverse).length - 1
        theorem Ratpoints.getD_eq_zero_of_degree_lt {c : List ℤ} {i : ℕ} (hi : degree c < i) :
        c.getD i 0 = 0
        theorem Ratpoints.eval_binaryFormPoly {c : List ℤ} (h : c.length / 2 ≤ (degree c + 1) / 2) (x z : ℤ) :

        On every input that the program does not refuse, Ratpoints.binaryFormPoly evaluates to Ratpoints.binaryForm: the hypothesis, ⌈n / 2⌉ ≤ ⌈d / 2⌉, makes the two degrees equal.

        The pair (x, z) is normalized and of height at most H, as the program prints the points: gcd(x, z) = 1, 0 < z or (x, z) = (1, 0), |x| ≤ H and z ≤ H. So is the pair (x, z) of every triple (x, 0, z) that the program prints under RATPOINTS_NO_CHECK, whether the triple is a point or not.

        Equations
        Instances For
          @[instance_reducible]
          Equations
          def Ratpoints.IsPoint (c : List ℤ) (H : ℕ) (p : ℤ × ℤ × ℤ) :

          (x, y, z) is a point of height at most H on y ^ 2 = F(x, z), F = Ratpoints.binaryForm c, normalized as the program prints it: the equation holds, and (x, z) is normalized and of height at most H (Ratpoints.IsNormalizedPair).

          Equations
          Instances For
            @[instance_reducible]
            Equations
            • One or more equations did not get rendered due to their size.
            noncomputable def Ratpoints.points (c : List ℤ) (H : ℕ) :

            The finite set of the normalized points of height at most H on y ^ 2 = F(x, z).

            Equations
            Instances For
              @[simp]
              theorem Ratpoints.mem_points {c : List ℤ} {H : ℕ} {p : ℤ × ℤ × ℤ} :
              p ∈ points c H ↔ IsPoint c H p

              Points from the program's output, checked by decide #