Documentation

HexRoots.Basic

Absolute value of a dyadic number.

Equations
Instances For

    The larger of two dyadic numbers.

    Equations
    Instances For

      The smaller of two dyadic numbers.

      Equations
      Instances For
        def Hex.ceilLog2 (n : Nat) :

        Smallest t with n ≤ 2^t (junk 0 for n ≤ 1).

        Equations
        Instances For

          For x > 0: smallest t : Int with x ≤ 2^t; junk 0 for x ≤ 0. For x = n·2^{−k} with odd n > 0: ceilLog2 n − k.

          Equations
          Instances For
            @[reducible, inline]

            A Gaussian dyadic number re + im·i, represented as the pair (re, im).

            Equations
            Instances For

              The Gaussian dyadic i + 0·i for an integer i.

              Equations
              Instances For

                Sum of two Gaussian dyadics, (a+bi) + (c+di) = (a+c) + (b+d)i.

                Equations
                Instances For

                  Difference of two Gaussian dyadics, (a+bi) − (c+di) = (a−c) + (b−d)i.

                  Equations
                  Instances For

                    Complex conjugate a − b·i of a + b·i.

                    Equations
                    Instances For

                      Product of two Gaussian dyadics, (a+bi)(c+di) = (ac − bd) + (ad + bc)i.

                      Equations
                      Instances For

                        The squared modulus a² + b² of a + b·i, an exact dyadic.

                        Equations
                        Instances For

                          The squared distance |z − w|² between two Gaussian dyadics, an exact dyadic.

                          Equations
                          Instances For

                            A closed axis-aligned dyadic square in the complex plane: centre re + im·i, half-width 2^{−prec}, circumscribed disc radius 2^{−prec}·√2.

                            • re : Dyadic

                              Real part of the centre.

                            • im : Dyadic

                              Imaginary part of the centre.

                            • prec : Int

                              Base-2 exponent of the half-width 2^{−prec}.

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

                                The Gaussian-dyadic centre re + im·i of the square.

                                Equations
                                Instances For

                                  The half-width 2^{−prec} of the square, an exact dyadic.

                                  Equations
                                  Instances For

                                    The circumscribed discs of s and t intersect (closed discs): distSq centres ≤ (r_s + r_t)² with r = √2·2^{−prec}, so (r_s + r_t)² = 2·4^{−p_s} + 2·4^{−p_t} + 4·2^{−p_s−p_t}, all exact dyadics.

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

                                      The circumscribed disc of s contains the Gaussian-dyadic point z, including boundary contact. Squaring the radius removes the irrational √2, so the test is one exact dyadic comparison.

                                      Equations
                                      Instances For

                                        inner's circumscribed disc is contained in outer's: r_i ≤ r_o (i.e. outer.prec ≤ inner.prec) and distSq centres ≤ (r_o − r_i)² = 2·4^{−p_o} + 2·4^{−p_i} − 4·2^{−p_o−p_i}.

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

                                          inner's closed square is contained in outer's closed square: max |Δre| |Δim| + 2^{−p_i} ≤ 2^{−p_o} (exact dyadics).

                                          Equations
                                          Instances For

                                            A complex ball with dyadic data, the output type of numerical evaluation here and in hex-number-field.

                                            • re : Dyadic

                                              Real part of the centre.

                                            • im : Dyadic

                                              Imaginary part of the centre.

                                            • radius : Dyadic

                                              Radius of the ball.

                                            Instances For
                                              structure Hex.Component :

                                              An uncertified component in the refinement worklist: an edge-connected set of grid squares at a common prec, plus the root count of its most recently certified ancestor. candidateK only selects the order of the speculative Newton step; it is never trusted, since every output is re-certified.

                                              • The component's grid squares: nonempty, common prec, edge-connected.

                                              • candidateK : Nat

                                                Root count carried from the most recently certified ancestor; an untrusted hint for step ordering.

                                              Instances For

                                                Exact axis-aligned bounds used to enclose an array of dyadic squares.

                                                • xmin : Dyadic

                                                  Lower real-coordinate bound.

                                                • xmax : Dyadic

                                                  Upper real-coordinate bound.

                                                • ymin : Dyadic

                                                  Lower imaginary-coordinate bound.

                                                • ymax : Dyadic

                                                  Upper imaginary-coordinate bound.

                                                Instances For

                                                  The exact coordinate bounds contributed by one dyadic square.

                                                  Equations
                                                  Instances For

                                                    Extend exact coordinate bounds by one dyadic square.

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

                                                      Add one square to an optional bounding box.

                                                      Equations
                                                      Instances For

                                                        Exact bounding box of an array of dyadic squares.

                                                        Equations
                                                        Instances For

                                                          The smallest square with power-of-two half-width, centred at the bounding-box centre, containing every square. Junk ⟨0,0,0⟩ on the empty array (callers keep components nonempty).

                                                          Each square contributes its own half-width to the bounding box (robust to mixed prec), the centre is the exact midpoint of the box (a right shift by one bit), and the result prec is chosen so that its half-width 2^{−q} is the smallest power of two at least the box half-width. On a single square input this returns that square exactly.

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

                                                            p has only simple complex roots when the executable rational gcd of p and p' is constant. This is definitionally Hex.ZPoly.SquareFreeRat; the Mathlib bridge proves its equivalence to polynomial squarefreeness when p ≠ 0.

                                                            Equations
                                                            Instances For