Documentation

HexNumberFieldTower.RawArithmetic

Fixed-width rational coordinates, padding with zero and truncating excess entries.

Equations
Instances For

    Fixed-width coordinate addition.

    Equations
    Instances For

      Fixed-width coordinate subtraction.

      Equations
      Instances For

        Fixed-width coordinate negation.

        Equations
        Instances For

          Adding back the subtrahend recovers the fixed-width minuend.

          One mixed-radix block.

          Equations
          Instances For
            theorem Hex.NumberTower.Arithmetic.block_fixed (count width index : Nat) (a : Array Rat) (hindex : index < count) :
            block (fixedCoeffs (count * width) a) index width = fixedCoeffs width (block a index width)

            A block of fixed-width coordinates is the fixed-width source block.

            theorem Hex.NumberTower.Arithmetic.block_one (count width index : Nat) (hindex : index < count) :
            block (fixedCoeffs (count * width) #[1]) index width = if index = 0 then fixedCoeffs width #[1] else fixedCoeffs width #[]

            The only nonzero block of the fixed-width coordinate one is its constant block.

            theorem Hex.NumberTower.Arithmetic.block_add (count width index : Nat) (a b : Array Rat) (hindex : index < count) :
            block (addCoords (count * width) a b) index width = addCoords width (block a index width) (block b index width)

            A block of fixed-width coordinate addition is the sum of the blocks.

            Flatten a fixed number of equally wide coordinate blocks.

            Equations
            Instances For
              @[simp]
              theorem Hex.NumberTower.Arithmetic.flattenBlocks_size (count width : Nat) (blocks : Array (Array Rat)) :
              (flattenBlocks count width blocks).size = count * width

              Flattening fixed-width blocks always produces the requested total width.

              theorem Hex.NumberTower.Arithmetic.block_flatten (count width index : Nat) (blocks : Array (Array Rat)) (hindex : index < count) :
              block (flattenBlocks count width blocks) index width = fixedCoeffs width (blocks.getD index #[])

              Reading an in-range block after flattening recovers that source block at the fixed lower width.

              def Hex.NumberTower.Arithmetic.convolveRow (degree width i : Nat) (multiply : Array RatArray RatArray Rat) (a b : Array Rat) (work : Array (Array Rat)) :

              Add one row of schoolbook block products to a convolution workspace.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem Hex.NumberTower.Arithmetic.convolveRow_size (degree width i : Nat) (multiply : Array RatArray RatArray Rat) (a b : Array Rat) (work : Array (Array Rat)) :
                (convolveRow degree width i multiply a b work).size = work.size

                One convolution row edits the work array in place, preserving its size.

                def Hex.NumberTower.Arithmetic.convolve (degree width : Nat) (multiply : Array RatArray RatArray Rat) (a b : Array Rat) :

                Schoolbook convolution of fixed-width coefficient blocks.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  theorem Hex.NumberTower.Arithmetic.convolve_size (degree width : Nat) (multiply : Array RatArray RatArray Rat) (a b : Array Rat) :
                  (convolve degree width multiply a b).size = 2 * degree - 1

                  Convolution allocates exactly the coefficient range of a product of two polynomials of degree below degree.

                  def Hex.NumberTower.Arithmetic.reduceCoeffs (degree width k : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) (work : Array (Array Rat)) :

                  Apply all lower-coefficient corrections for eliminating the coefficient at k with a monic relation.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    theorem Hex.NumberTower.Arithmetic.reduceCoeffs_size (degree width k : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) (work : Array (Array Rat)) :
                    (reduceCoeffs degree width k defining multiply work).size = work.size

                    One coefficient-reduction step edits the work array in place, preserving its size.

                    def Hex.NumberTower.Arithmetic.reduceAt (degree width k : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) (work : Array (Array Rat)) :

                    Eliminate the coefficient at k, then discard it.

                    Equations
                    Instances For
                      @[simp]
                      theorem Hex.NumberTower.Arithmetic.reduceAt_size (degree width k : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) (work : Array (Array Rat)) (hsize : work.size = k + 1) :
                      (reduceAt degree width k defining multiply work).size = k

                      One descending reduction step removes exactly its top coefficient.

                      def Hex.NumberTower.Arithmetic.reduce (degree width : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) :

                      Descending monic reduction of all coefficients at or above degree.

                      Equations
                      Instances For
                        @[simp]
                        theorem Hex.NumberTower.Arithmetic.reduce_size (degree width fuel : Nat) (defining : Array (Array Rat)) (multiply : Array RatArray RatArray Rat) (work : Array (Array Rat)) (hsize : work.size = degree + fuel) :
                        (reduce degree width defining multiply fuel work).size = degree

                        Descending reduction consumes its whole high-coefficient fuel.

                        Recursive mixed-radix multiplication on top-first raw level data.

                        Equations
                        Instances For
                          @[simp]
                          theorem Hex.NumberTower.Arithmetic.mulCoords_size (levels : List Level) (a b : Array Rat) :
                          (mulCoords levels a b).size = levelsDim levels

                          Recursive multiplication returns exactly one mixed-radix coordinate vector.

                          Dynamically indexed tower coefficient used internally when an algorithm recurses through runtime level data rather than a dependent NumberTower. The raw helper normalizes to the represented mixed-radix dimension.

                          • data : Array Rat

                            The flattened mixed-radix rational coordinates.

                          Instances For
                            def Hex.NumberTower.Arithmetic.raw (levels : List Level) (data : Array Rat) :
                            RawElem levels

                            Wrap coordinate data as a RawElem, zero-padding or truncating to the represented mixed-radix dimension.

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

                              Canonical lower-tower coefficient used by recursive inversion. Unlike the general-purpose RawElem, this type carries the fixed-width invariant needed by the semantic field bridge for polynomial xgcd.

                              • data : Array Rat

                                The flattened mixed-radix rational coordinates.

                              • size_eq : self.data.size = levelsDim levels

                                The coordinate array has exactly the represented dimension.

                              Instances For

                                Normalize arbitrary data into a canonical lower-tower coefficient.

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

                                  View one top-level coordinate array as a polynomial over canonical lower tower coefficients.

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

                                    The monic defining relation as a polynomial over canonical lower-tower coefficients.

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

                                      Recursive inverse coordinates. The zero convention is inherited at every level; defensive nonconstant/zero gcd branches are unreachable for certified level lists. The extended gcd makes every remainder monic before dividing by it, so each lower-field inversion acts on a normalized operand and the quotient coefficients stay bounded in height; the unnormalized DensePoly.xgcdLeft chain amplified the heights of every later lower-field inversion.

                                      Equations
                                      Instances For
                                        @[simp]

                                        Recursive inversion always returns the canonical mixed-radix width, including its defensive zero fallbacks.

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