Documentation

Ratpoints.Spec.Region

The search region #

The search region of ratpoints: search intervals [l, u] for x / z, whose ends are IEEE binary64 doubles, given here by their bits, and a range of the denominators z. A double has a value in ℚ extended by ⊥ and ⊤ (WithBotTop ℚ), the two infinities; a NaN has none (its value here is junk), and both zeros have the value 0; ratpoints refuses search intervals with a NaN end, with l > u or that are not increasing and strictly apart. A point lies in the region when it is at infinity, or its denominator is in the range and x / z lies in one of the intervals (in any, when there are none). The specification uses Mathlib and nothing of the model; the comparator challenge restates its definitions verbatim.

Main definitions #

Implementation notes #

The file imports Mathlib.Order.WithBotTop for the extended values and Mathlib.Algebra.Order.Field.Rat for the order and the field operations of ℚ, both publicly: the comparator challenge imports the Mathlib modules among the public imports of the files of the specification that it restates, so that the definitions it restates elaborate to the same terms as here.

Whether the IEEE binary64 bits x are a NaN: the exponent field all ones and the fraction nonzero.

Equations
Instances For
    @[instance_reducible]
    Equations

    The value of the IEEE binary64 double with the bits x: ±f 2 ^ (-1074) for the exponent field 0 (the zeros and the subnormals, both zeros giving 0), ±(2 ^ 52 + f) 2 ^ (e - 1075) for an exponent field e from 1 to 2046, and ⊥ and ⊤ for the infinities, where f is the fraction and the sign is that of the top bit. The value of a NaN (the exponent field 2047 with a nonzero fraction) is junk, an infinity: Ratpoints.IntervalsWF excludes NaNs.

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

      Closed intervals [l, u] with l ≤ u, increasing and strictly apart: the upper end of each below the lower end of the next.

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

        The search intervals with the ends of the bits of doubles that ratpoints accepts, the test of RATPOINTS_BAD_ARGS: no end is a NaN, and the values are closed intervals, increasing and strictly apart (Ratpoints.AreSearchIntervals); -0 and 0 have the same value.

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

          The rational number x lies in one of the intervals D, over the values of their ends, both ends included.

          Equations
          Instances For
            def Ratpoints.InRegion (dom : List (WithBotTop ℚ × WithBotTop ℚ)) (bLow bHigh : ℤ) (p : ℤ × ℤ × ℤ) :

            The triple p = (x, y, z) lies in the search region of the intervals dom (over the values of their ends) and the range of the denominators from bLow to bHigh: z = 0 (a point at infinity), or bLow ≤ z, z ≤ bHigh unless bHigh < 1 (no bound beyond the height bound), and x / z in one of the intervals (Ratpoints.InIntervals), or anywhere when there are none.

            Equations
            Instances For
              @[instance_reducible]
              instance Ratpoints.instDecidablePredInRegion (dom : List (WithBotTop ℚ × WithBotTop ℚ)) (bLow bHigh : ℤ) :
              DecidablePred (InRegion dom bLow bHigh)
              Equations
              • One or more equations did not get rendered due to their size.
              def Ratpoints.IsFullBox {α : Type u_1} (dom : List α) (bLow bHigh : ℤ) (H : ℕ) :

              The search region of the intervals dom and the range of the denominators from bLow to bHigh is the whole box of the height bound H: no intervals, bLow ≤ 1 and no bound below H on the denominators (bHigh < 1 or H ≤ bHigh). Only then may ratpoints reverse the polynomial (otherwise it sets RATPOINTS_NO_REVERSE_AUTO).

              Equations
              Instances For
                @[instance_reducible]
                instance Ratpoints.instDecidableIsFullBox {α : Type u_1} (dom : List α) (bLow bHigh : ℤ) (H : ℕ) :
                Decidable (IsFullBox dom bLow bHigh H)
                Equations
                def Ratpoints.denominatorBound (bHigh : ℤ) (H : ℕ) :

                The largest denominator of the search for the bound bHigh and the height bound H: bHigh when 1 ≤ bHigh ≤ H, and H otherwise.

                Equations
                Instances For

                  Examples, checked by decide #