Documentation

HexMvPoly.Mono

@[reducible, inline]
abbrev Hex.Mono (n : Nat) :

An exponent vector for n ordered variables.

Equations
Instances For
    def Hex.Mono.zero {n : Nat} :

    The constant monomial.

    Equations
    Instances For
      @[instance_reducible]
      Equations
      def Hex.Mono.unit {n : Nat} (i : Fin n) :

      The monomial consisting of one copy of variable i.

      Equations
      Instances For
        def Hex.Mono.mul {n : Nat} (a b : Mono n) :

        Monomial multiplication, represented by pointwise exponent addition.

        Equations
        Instances For
          def Hex.Mono.scale {n : Nat} (k : Nat) (m : Mono n) :

          Multiply every exponent by k.

          Equations
          Instances For
            def Hex.Mono.dvd {n : Nat} (a b : Mono n) :

            Whether a divides b, i.e. whether every exponent of a is at most the corresponding exponent of b.

            Equations
            Instances For
              def Hex.Mono.div {n : Nat} (a b : Mono n) :

              The exact quotient b / a, returning none when a does not divide b.

              Equations
              Instances For
                def Hex.Mono.lcm {n : Nat} (a b : Mono n) :

                Pointwise maximum of two monomials.

                Equations
                Instances For
                  def Hex.Mono.gcd {n : Nat} (a b : Mono n) :

                  Pointwise minimum of two monomials.

                  Equations
                  Instances For
                    def Hex.Mono.degree {n : Nat} (m : Mono n) :

                    Total degree of a monomial.

                    Equations
                    Instances For
                      def Hex.Mono.degreeOf {n : Nat} (i : Fin n) (m : Mono n) :

                      Exponent of variable i in a monomial.

                      Equations
                      Instances For
                        def Hex.Mono.support {n : Nat} (m : Mono n) :
                        List (Fin n)

                        Variables occurring with positive exponent, in increasing index order.

                        Equations
                        Instances For
                          def Hex.Mono.rename {n k : Nat} (f : Fin nFin k) (m : Mono n) :

                          Rename variables, adding exponents when several source variables map to the same target variable.

                          Equations
                          Instances For
                            def Hex.Mono.succAt {n : Nat} (i : Fin n) (m : Mono n) :

                            Increase the exponent of variable i by one.

                            Equations
                            Instances For
                              def Hex.Mono.dropHead {n : Nat} (m : Mono (n + 1)) :

                              Remove the first exponent from a nonempty monomial.

                              Equations
                              Instances For
                                def Hex.Mono.prepend {n : Nat} (e : Nat) (m : Mono n) :
                                Mono (n + 1)

                                Add an exponent at the front of a monomial.

                                Equations
                                Instances For
                                  def Hex.Mono.splits {n : Nat} :
                                  Mono nList (Mono n × Mono n)

                                  All decompositions a * b = m. Each exponent is split independently, so the list has ∏ i, (m[i] + 1) entries.

                                  Equations
                                  Instances For
                                    @[irreducible]
                                    def Hex.Mono.powBySq {R : Type u_1} [One R] [Mul R] (a : R) :
                                    NatR

                                    Exponentiation by repeated squaring, used here so monomial evaluation does not depend on a coefficient type's choice of Pow implementation.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    • Hex.Mono.powBySq a 0 = 1
                                    Instances For
                                      theorem Hex.Mono.powBySq_eq_pow {R : Type u_1} [Lean.Grind.Semiring R] (a : R) (k : Nat) :
                                      powBySq a k = a ^ k

                                      Repeated-squaring exponentiation agrees with the semiring power.

                                      def Hex.Mono.prod {R : Type u_1} {n : Nat} [One R] [Mul R] (x : Fin nR) (m : Mono n) :
                                      R

                                      Evaluate a monomial at x, using logarithmic exponentiation for each variable.

                                      Equations
                                      Instances For
                                        def Hex.Mono.lex {n : Nat} (a b : Mono n) :

                                        Plain lexicographic comparison, with the first variable most significant.

                                        Equations
                                        Instances For
                                          def Hex.Mono.grlex {n : Nat} (a b : Mono n) :

                                          Graded lexicographic comparison: total degree first, then lex.

                                          Equations
                                          Instances For
                                            def Hex.Mono.revlex {n : Nat} (a b : Mono n) :

                                            Reverse-lexicographic tie breaker used by grevlex.

                                            Equations
                                            Instances For
                                              def Hex.Mono.grevlex {n : Nat} (a b : Mono n) :

                                              Graded reverse lexicographic comparison: total degree first; among equal-degree monomials, the monomial with the larger exponent in the last differing variable compares smaller.

                                              Equations
                                              Instances For
                                                class Hex.IsMonomialOrder {n : Nat} (cmp : Mono nMono nOrdering) extends Std.TransCmp cmp, Std.LawfulEqCmp cmp :

                                                Laws needed of a comparator by leading-term and reduction algorithms. Storage itself uses the inherited TransCmp and LawfulEqCmp laws.

                                                Instances
                                                  @[simp]
                                                  theorem Hex.Mono.getElem_zero {n : Nat} (i : Fin n) :

                                                  Every exponent of the zero monomial is zero.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_unit {n : Nat} (i j : Fin n) :
                                                  (unit i)[j] = if j = i then 1 else 0

                                                  A unit monomial has exponent one at its selected variable and zero elsewhere.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_mul {n : Nat} (a b : Mono n) (i : Fin n) :
                                                  (a.mul b)[i] = a[i] + b[i]

                                                  Monomial multiplication adds exponents pointwise.

                                                  @[simp]
                                                  theorem Hex.Mono.zero_mul {n : Nat} (m : Mono n) :
                                                  zero.mul m = m

                                                  The zero monomial is a left identity for monomial multiplication.

                                                  @[simp]
                                                  theorem Hex.Mono.mul_zero {n : Nat} (m : Mono n) :
                                                  m.mul zero = m

                                                  The zero monomial is a right identity for monomial multiplication.

                                                  theorem Hex.Mono.mul_assoc {n : Nat} (a b c : Mono n) :
                                                  (a.mul b).mul c = a.mul (b.mul c)

                                                  Monomial multiplication is associative.

                                                  theorem Hex.Mono.mul_comm {n : Nat} (a b : Mono n) :
                                                  a.mul b = b.mul a

                                                  Monomial multiplication is commutative.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_scale {n : Nat} (k : Nat) (m : Mono n) (i : Fin n) :
                                                  (scale k m)[i] = k * m[i]

                                                  Scaling a monomial multiplies every exponent by the scale.

                                                  @[simp]
                                                  theorem Hex.Mono.zero_scale {n : Nat} (m : Mono n) :

                                                  Scaling by zero yields the zero monomial.

                                                  @[simp]
                                                  theorem Hex.Mono.scale_zero {n : Nat} (k : Nat) :

                                                  Every scaling of the zero monomial is zero.

                                                  @[simp]
                                                  theorem Hex.Mono.one_scale {n : Nat} (m : Mono n) :
                                                  scale 1 m = m

                                                  Scaling by one leaves a monomial unchanged.

                                                  theorem Hex.Mono.add_scale {n : Nat} (a b : Nat) (m : Mono n) :
                                                  scale (a + b) m = (scale a m).mul (scale b m)

                                                  Scaling by a sum is multiplication of the separately scaled monomials.

                                                  theorem Hex.Mono.mul_units {n : Nat} (m : Mono n) :
                                                  List.foldl (fun (acc : Mono n) (i : Fin n) => acc.mul (scale m[i] (unit i))) zero (List.finRange n) = m

                                                  Every monomial is the product of its scaled unit monomials.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_lcm {n : Nat} (a b : Mono n) (i : Fin n) :
                                                  (a.lcm b)[i] = max a[i] b[i]

                                                  The monomial least common multiple takes pointwise maximum exponents.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_gcd {n : Nat} (a b : Mono n) (i : Fin n) :
                                                  (a.gcd b)[i] = min a[i] b[i]

                                                  The monomial greatest common divisor takes pointwise minimum exponents.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_dropHead {n : Nat} (m : Mono (n + 1)) (i : Fin n) :

                                                  Dropping the head shifts every remaining exponent down one coordinate.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_prepend_zero {n : Nat} (e : Nat) (m : Mono n) :
                                                  (prepend e m)[0] = e

                                                  The head of a prepended monomial is the supplied exponent.

                                                  @[simp]
                                                  theorem Hex.Mono.getElem_prepend_succ {n : Nat} (e : Nat) (m : Mono n) (i : Fin n) :
                                                  (prepend e m)[i.succ] = m[i]

                                                  The tail of a prepended monomial contains the original exponents.

                                                  @[simp]
                                                  theorem Hex.Mono.dropHead_prepend {n : Nat} (e : Nat) (m : Mono n) :

                                                  Dropping a freshly prepended exponent recovers the original monomial.

                                                  Prepending a monomial's head to its tail reconstructs it.

                                                  theorem Hex.Mono.mul_prepend {n : Nat} (ea eb : Nat) (a b : Mono n) :
                                                  (prepend ea a).mul (prepend eb b) = prepend (ea + eb) (a.mul b)

                                                  Multiplication distributes across prepended exponent vectors.

                                                  theorem Hex.Mono.dropHead_mul {n : Nat} (a b : Mono (n + 1)) :

                                                  Dropping the head commutes with monomial multiplication.

                                                  theorem Hex.Mono.dvd_eq_true_iff {n : Nat} (a b : Mono n) :
                                                  a.dvd b = true ∀ (i : Fin n), a[i] b[i]

                                                  Boolean monomial divisibility is pointwise exponent comparison.

                                                  theorem Hex.Mono.div_eq_some_iff {n : Nat} (a b q : Mono n) :
                                                  a.div b = some q a.mul q = b

                                                  Exact monomial division returns a quotient exactly when multiplying it back recovers the dividend.

                                                  theorem Hex.Mono.div_eq_none_iff {n : Nat} (a b : Mono n) :
                                                  a.div b = none ¬∀ (i : Fin n), a[i] b[i]

                                                  Exact monomial division fails exactly when the divisor does not divide.

                                                  theorem Hex.Mono.degree_mul {n : Nat} (a b : Mono n) :

                                                  Total degree is additive under monomial multiplication.

                                                  @[simp]
                                                  theorem Hex.Mono.toList_prepend {n : Nat} (e : Nat) (m : Mono n) :

                                                  Converting a prepended monomial to a list prepends the exponent.

                                                  theorem Hex.Mono.toList_mul {n : Nat} (a b : Mono n) :
                                                  Vector.toList (a.mul b) = List.zipWith (fun (x1 x2 : Nat) => x1 + x2) (Vector.toList a) (Vector.toList b)

                                                  The exponent list of a product is the pointwise sum of exponent lists.

                                                  theorem Hex.Mono.lex_prepend {n : Nat} (ea eb : Nat) (a b : Mono n) :
                                                  (prepend ea a).lex (prepend eb b) = (compare ea eb).then (a.lex b)

                                                  Lexicographic comparison of prepended monomials first compares their heads.

                                                  @[simp]

                                                  The zero monomial has total degree zero.

                                                  theorem Hex.Mono.degreeOf_le_degree {n : Nat} (i : Fin n) (m : Mono n) :

                                                  Every individual exponent is bounded by total degree.

                                                  theorem Hex.Mono.rename_mul {n k : Nat} (f : Fin nFin k) (a b : Mono n) :
                                                  rename f (a.mul b) = (rename f a).mul (rename f b)

                                                  Renaming variables commutes with monomial multiplication.

                                                  theorem Hex.Mono.splits_mem_iff {n : Nat} (m a b : Mono n) :
                                                  (a, b) m.splits a.mul b = m

                                                  A pair occurs in splits m exactly when its monomial product is m.

                                                  theorem Hex.Mono.splits_nodup {n : Nat} (m : Mono n) :

                                                  Every monomial decomposition occurs exactly once in splits.

                                                  theorem Hex.Mono.dvd_lcm_left {n : Nat} (a b : Mono n) :
                                                  a.dvd (a.lcm b) = true

                                                  The left input divides the monomial least common multiple.

                                                  theorem Hex.Mono.dvd_lcm_right {n : Nat} (a b : Mono n) :
                                                  b.dvd (a.lcm b) = true

                                                  The right input divides the monomial least common multiple.

                                                  theorem Hex.Mono.lcm_dvd {n : Nat} (a b c : Mono n) (ha : a.dvd c = true) (hb : b.dvd c = true) :
                                                  (a.lcm b).dvd c = true

                                                  The monomial least common multiple divides every common multiple.

                                                  theorem Hex.Mono.gcd_dvd_left {n : Nat} (a b : Mono n) :
                                                  (a.gcd b).dvd a = true

                                                  The monomial greatest common divisor divides the left input.

                                                  theorem Hex.Mono.gcd_dvd_right {n : Nat} (a b : Mono n) :
                                                  (a.gcd b).dvd b = true

                                                  The monomial greatest common divisor divides the right input.

                                                  theorem Hex.Mono.dvd_gcd {n : Nat} (a b c : Mono n) (ha : c.dvd a = true) (hb : c.dvd b = true) :
                                                  c.dvd (a.gcd b) = true

                                                  Every common divisor divides the monomial greatest common divisor.