Documentation

HexPolyFast.Tree

theorem Hex.DensePoly.Monic.neOfOneNe {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] {p : DensePoly R} (hp : p.Monic) (hone : 1 ≠ 0) :
p ≠ 0

A monic polynomial over a nontrivial commutative ring is nonzero.

theorem Hex.DensePoly.Monic.mul {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] {p q : DensePoly R} (hp : p.Monic) (hq : q.Monic) :
(p * q).Monic

A product of monic polynomials over a commutative ring is monic.

Root split used by adjacent-pair product levels: the largest power of two strictly below n.

Equations
Instances For

    The adjacent-pair tree split is positive.

    theorem Hex.DensePoly.treeSplit_lt (n : Nat) (hn : 2 ≤ n) :

    For at least two leaves, the tree split is strictly smaller than the leaf count.

    An opaque balanced product tree with a cached root and on-demand levels.

    Instances For

      Build a balanced product tree without retaining intermediate levels. The empty tree has root 1 and one singleton level containing that root.

      Equations
      Instances For

        The leaf sequence in its original order.

        Equations
        Instances For

          Number of nonempty balanced levels, including the leaf and root levels.

          Equations
          Instances For

            Lawful multiplication plan used to build the tree.

            Equations
            Instances For

              A balanced level reconstructed from the leaves, from leaves upward. The empty tree has the singleton level [1].

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

                The product represented by the root node.

                Equations
                Instances For

                  The ordered leaf block represented by a node. Invalid level/node pairs represent the empty block; use nodeProduct? when validity matters.

                  Equations
                  Instances For

                    Product represented by a valid balanced node. The observation is semantic: it folds exactly that node's leaf block, independently of the internal level layout.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Hex.DensePoly.ProductTree.nodeProduct?_eq {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (tree : ProductTree R) (level index : Nat) (p : DensePoly R) (h : tree.nodeProduct? level index = some p) :
                      p = Array.foldl (fun (acc q : DensePoly R) => mulWith tree.plan acc q) 1 (tree.nodeLeaves level index)

                      Every observed node product is the planned product of precisely its represented leaf block.

                      @[simp]
                      theorem Hex.DensePoly.ProductTree.leaves_build {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (leaves : Array (DensePoly R)) :
                      (build plan leaves).leaves = leaves

                      Building preserves the supplied leaf sequence.

                      theorem Hex.DensePoly.ProductTree.root_build {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (leaves : Array (DensePoly R)) :
                      (build plan leaves).root = List.foldl (fun (acc p : DensePoly R) => mulWith plan acc p) 1 leaves.toList

                      The root is the planned product of all leaves in order.

                      theorem Hex.DensePoly.ProductTree.root_build_eq_foldl {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (leaves : Array (DensePoly R)) :
                      (build plan leaves).root = Array.foldl (fun (acc p : DensePoly R) => acc * p) 1 leaves

                      The root is independent of the selected lawful multiplication kernel.