Documentation

HexMvPoly.Kernel

@[reducible, inline]
abbrev Hex.MvPoly.Kernel.Term (κ : Type u) :

A list-form term: an exponent list and a coefficient.

Equations
Instances For
    @[reducible, inline]

    A sparse polynomial represented by a canonical list of terms.

    Equations
    Instances For

      Equality of exponent lists, using only Nat.beq and structural recursion.

      Equations
      Instances For
        noncomputable def Hex.MvPoly.Kernel.expBeq (a b : List Nat) :

        Kernel equality through a simple recursor; compiled calls use expBeqImpl.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def Hex.MvPoly.Kernel.expCmp (a b : List Nat) :

          Kernel comparison through a simple recursor; compiled calls use expCmpImpl.

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

            Pointwise addition of exponent lists. Canonical inputs have equal length; the trailing clauses make the operation total on untrusted data.

            Equations
            Instances For
              noncomputable def Hex.MvPoly.Kernel.addExp (a b : List Nat) :

              Kernel exponent addition through a simple recursor; compiled calls use addExpImpl.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem Hex.MvPoly.Kernel.expBeq_nil (b : List Nat) :
                expBeq [] b = match b with | [] => true | head :: tail => false
                @[simp]
                @[simp]
                theorem Hex.MvPoly.Kernel.expBeq_cons_cons (x y : Nat) (xs ys : List Nat) :
                expBeq (x :: xs) (y :: ys) = (x.beq y && expBeq xs ys)
                @[simp]
                theorem Hex.MvPoly.Kernel.expCmp_nil (b : List Nat) :
                expCmp [] b = match b with | [] => Ordering.eq | head :: tail => Ordering.lt
                @[simp]
                @[simp]
                theorem Hex.MvPoly.Kernel.addExp_cons_nil (x : Nat) (xs : List Nat) :
                addExp (x :: xs) [] = x :: xs
                @[simp]
                theorem Hex.MvPoly.Kernel.addExp_cons_cons (x y : Nat) (xs ys : List Nat) :
                addExp (x :: xs) (y :: ys) = x.add y :: addExp xs ys
                def Hex.MvPoly.Kernel.insert {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] (t : Term κ) :
                PolyList κ → PolyList κ

                Insert one term into descending lexicographic order, adding coefficients on a collision and dropping a zero coefficient.

                Equations
                Instances For
                  def Hex.MvPoly.Kernel.normalize {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] :
                  PolyList κ → PolyList κ

                  Canonicalize an arbitrary term stream by insertion.

                  Equations
                  Instances For
                    def Hex.MvPoly.Kernel.insertSum {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] :
                    PolyList κ → PolyList κ → PolyList κ

                    Insertion sum, also the total fallback for an undersupplied merge budget.

                    Equations
                    Instances For
                      def Hex.MvPoly.Kernel.merge {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] :
                      Nat → PolyList κ → PolyList κ → PolyList κ

                      Linear merge of descending term lists. Recursion is structural on fuel. The public caller supplies the sum of the lengths, so its fallback is never needed; the fallback keeps the denotation law unconditional.

                      Equations
                      Instances For
                        def Hex.MvPoly.Kernel.add {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] (p q : PolyList κ) :

                        Add canonical term lists in one merge pass.

                        Equations
                        Instances For
                          def Hex.MvPoly.Kernel.mapCoeffs {κ : Type u_1} [Zero κ] [DecidableEq κ] (f : κ → κ) :
                          PolyList κ → PolyList κ

                          Map coefficients, filtering zero results without changing exponents.

                          Equations
                          Instances For
                            def Hex.MvPoly.Kernel.neg {κ : Type u_1} [Zero κ] [Neg κ] [DecidableEq κ] (p : PolyList κ) :

                            Negate a canonical term list, defensively filtering zero results.

                            Equations
                            Instances For
                              def Hex.MvPoly.Kernel.sub {κ : Type u_1} [Zero κ] [Add κ] [Neg κ] [DecidableEq κ] (p q : PolyList κ) :

                              Subtraction through canonical addition and negation.

                              Equations
                              Instances For
                                def Hex.MvPoly.Kernel.smul {κ : Type u_1} [Zero κ] [Mul κ] [DecidableEq κ] (a : κ) (p : PolyList κ) :

                                Multiply every coefficient by a scalar, filtering zero products.

                                Equations
                                Instances For
                                  def Hex.MvPoly.Kernel.mulTermImpl {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] (t : Term κ) :
                                  PolyList κ → PolyList κ

                                  Multiply one term by every term of a polynomial, canonicalizing the row.

                                  Equations
                                  Instances For
                                    noncomputable def Hex.MvPoly.Kernel.mulTerm {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] (t : Term κ) (p : PolyList κ) :

                                    Kernel row multiplication; compilation uses the equation implementation.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[simp]
                                      theorem Hex.MvPoly.Kernel.mulTerm_nil {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] (t : Term κ) :
                                      @[simp]
                                      theorem Hex.MvPoly.Kernel.mulTerm_cons {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] (t u : Term κ) (us : PolyList κ) :
                                      mulTerm t (u :: us) = insert (addExp t.fst u.fst, t.snd * u.snd) (mulTerm t us)
                                      def Hex.MvPoly.Kernel.sumRows {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] :
                                      List (PolyList κ) → PolyList κ

                                      Sum rows, used for the total fallback of balanced merging.

                                      Equations
                                      Instances For
                                        def Hex.MvPoly.Kernel.mergeRows {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] :
                                        Nat → List (PolyList κ) → PolyList κ

                                        Balanced merge rounds, structurally recursive on a row-count budget.

                                        Equations
                                        Instances For
                                          def Hex.MvPoly.Kernel.mul {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] (p q : PolyList κ) :

                                          Multiply via translated rows and balanced linear merges.

                                          Equations
                                          Instances For

                                            The zero test for a canonical list.

                                            Equations
                                            Instances For
                                              def Hex.MvPoly.Kernel.beqImpl {κ : Type u_1} [DecidableEq κ] :
                                              PolyList κ → PolyList κ → Bool

                                              Structural equality of term lists, with explicit exponent comparison.

                                              Equations
                                              Instances For
                                                noncomputable def Hex.MvPoly.Kernel.beq {κ : Type u_1} [DecidableEq κ] (p q : PolyList κ) :

                                                Kernel list equality; compilation uses the equation implementation.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  @[simp]
                                                  theorem Hex.MvPoly.Kernel.beq_nil {κ : Type u_1} [DecidableEq κ] (q : PolyList κ) :
                                                  beq [] q = match q with | [] => true | head :: tail => false
                                                  @[simp]
                                                  theorem Hex.MvPoly.Kernel.beq_cons_nil {κ : Type u_1} [DecidableEq κ] (t : Term κ) (ts : PolyList κ) :
                                                  beq (t :: ts) [] = false
                                                  @[simp]
                                                  theorem Hex.MvPoly.Kernel.beq_cons_cons {κ : Type u_1} [DecidableEq κ] (t u : Term κ) (ts us : PolyList κ) :
                                                  beq (t :: ts) (u :: us) = (expBeq t.fst u.fst && decide (t.snd = u.snd) && beq ts us)
                                                  def Hex.MvPoly.Kernel.pow {κ : Type u_1} [One κ] [Mul κ] (a : κ) :
                                                  Nat → κ

                                                  Linear-time exponentiation used by evalAt; unlike the reference repeated-squaring helper this is visibly structural recursion on Nat.

                                                  Equations
                                                  Instances For
                                                    def Hex.MvPoly.Kernel.evalMono {κ : Type u_1} [One κ] [Mul κ] :
                                                    List κ → List Nat → κ

                                                    Evaluate a monomial at a list point, stopping at the shorter list.

                                                    Equations
                                                    Instances For
                                                      def Hex.MvPoly.Kernel.evalAt {κ : Type u_1} [Zero κ] [One κ] [Add κ] [Mul κ] (x : List κ) :
                                                      PolyList κ → κ

                                                      Evaluate a term list at a point.

                                                      Equations
                                                      Instances For
                                                        def Hex.MvPoly.Kernel.one {κ : Type u_1} [Zero κ] [One κ] [DecidableEq κ] (n : Nat) :

                                                        The list-form multiplicative identity in n variables.

                                                        Equations
                                                        Instances For
                                                          def Hex.MvPoly.Kernel.Canonical {κ : Type u_1} [Zero κ] (n : Nat) (p : PolyList κ) :

                                                          Canonical lists have the declared arity, strictly descending lexicographic exponents, and no zero coefficient. The arity conjunct is essential: without it distinct exponent lists can denote the same fixed-arity monomial.

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

                                                            The structurally generated zero exponent has its declared length.

                                                            theorem Hex.MvPoly.Kernel.one_canonical {κ : Type u_1} [Zero κ] [One κ] [DecidableEq κ] (n : Nat) :

                                                            The list-form multiplicative identity is canonical.

                                                            The explicit equality test agrees with equality of exponent lists.

                                                            The explicit kernel comparator is the standard lexicographic list comparison.

                                                            The result .lt of the explicit comparator is lexicographic <.

                                                            theorem Hex.MvPoly.Kernel.length_addExp {a b : List Nat} {n : Nat} (ha : a.length = n) (hb : b.length = n) :
                                                            (addExp a b).length = n

                                                            Pointwise exponent addition preserves a common arity.

                                                            theorem Hex.MvPoly.Kernel.exp_mem_insert {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {t u : Term κ} {us : PolyList κ} (h : u ∈ insert t us) :
                                                            u.fst = t.fst ∨ ∃ (v : Term κ), v ∈ us ∧ u.fst = v.fst

                                                            Every exponent emitted by insertion is either the inserted exponent or an exponent already present.

                                                            theorem Hex.MvPoly.Kernel.insert_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} {t : Term κ} {p : PolyList κ} (ht : t.fst.length = n) (hp : Canonical n p) :

                                                            Insertion preserves canonical form. The inserted coefficient may be zero; in that case no term is added.

                                                            theorem Hex.MvPoly.Kernel.normalize_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} {p : PolyList κ} (h : ∀ (t : Term κ), t ∈ p → t.fst.length = n) :

                                                            Normalization emits a canonical list when every input exponent has the declared arity.

                                                            theorem Hex.MvPoly.Kernel.insertSum_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :

                                                            Addition preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.merge_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} (fuel : Nat) {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :
                                                            Canonical n (merge fuel p q)

                                                            Merging preserves canonical form, including for an undersupplied budget.

                                                            theorem Hex.MvPoly.Kernel.add_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :
                                                            Canonical n (add p q)

                                                            Addition preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.merge_stable {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] (fuel extra : Nat) (p q : PolyList κ) (h : List.length p + List.length q ≤ fuel) :
                                                            merge (fuel + extra) p q = merge fuel p q

                                                            Once the combined input length is covered, extra fuel cannot change a merge. In particular the insertion fallback is irrelevant to public addition.

                                                            theorem Hex.MvPoly.Kernel.add_eq_merge {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] (p q : PolyList κ) (fuel : Nat) (h : List.length p + List.length q ≤ fuel) :
                                                            add p q = merge fuel p q

                                                            The public addition budget agrees with any larger merge budget.

                                                            theorem Hex.MvPoly.Kernel.exp_mem_mapCoeffs {κ : Type u_1} [Zero κ] [DecidableEq κ] (f : κ → κ) {u : Term κ} {p : PolyList κ} (hu : u ∈ mapCoeffs f p) :
                                                            ∃ (v : Term κ), v ∈ p ∧ u.fst = v.fst

                                                            A coefficient map preserves the exponent of every surviving term.

                                                            theorem Hex.MvPoly.Kernel.mapCoeffs_canonical {κ : Type u_1} [Zero κ] [DecidableEq κ] (f : κ → κ) {n : Nat} {p : PolyList κ} (hp : Canonical n p) :

                                                            Mapping and filtering coefficients preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.neg_canonical {κ : Type u_1} [Zero κ] [Neg κ] [DecidableEq κ] {n : Nat} {p : PolyList κ} (hp : Canonical n p) :

                                                            Negation preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.sub_canonical {κ : Type u_1} [Zero κ] [Add κ] [Neg κ] [DecidableEq κ] {n : Nat} {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :
                                                            Canonical n (sub p q)

                                                            Subtraction preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.smul_canonical {κ : Type u_1} [Zero κ] [Mul κ] [DecidableEq κ] (a : κ) {n : Nat} {p : PolyList κ} (hp : Canonical n p) :
                                                            Canonical n (smul a p)

                                                            Scalar multiplication preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.mulTerm_canonical {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] {n : Nat} {t : Term κ} {p : PolyList κ} (ht : t.fst.length = n) (hp : Canonical n p) :

                                                            A translated product row is canonical.

                                                            theorem Hex.MvPoly.Kernel.mergeRows_canonical {κ : Type u_1} [Zero κ] [Add κ] [DecidableEq κ] {n : Nat} (fuel : Nat) (ps : List (PolyList κ)) (h : ∀ (p : PolyList κ), p ∈ ps → Canonical n p) :
                                                            Canonical n (mergeRows fuel ps)

                                                            Balanced merging preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.mul_canonical {κ : Type u_1} [Zero κ] [Add κ] [Mul κ] [DecidableEq κ] {n : Nat} {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :
                                                            Canonical n (mul p q)

                                                            Multiplication preserves canonical form.

                                                            theorem Hex.MvPoly.Kernel.isCanonical_iff {κ : Type u_1} [Zero κ] [DecidableEq κ] {n : Nat} {p : PolyList κ} :

                                                            The Boolean canonicality check decides the proposition.

                                                            Read an exponent list as an n-variable monomial. Canonical inputs have exactly length n; getD merely makes denotation total on malformed input.

                                                            Equations
                                                            Instances For

                                                              Materialize the input once instead of repeatedly indexing a linked list.

                                                              Equations
                                                              Instances For
                                                                def Hex.MvPoly.Kernel.denote {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] :
                                                                PolyList κ → MvPoly n κ cmp

                                                                Denote a term list in the reference polynomial type.

                                                                Equations
                                                                Instances For
                                                                  def Hex.MvPoly.Kernel.toList {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : MvPoly n κ cmp) :

                                                                  Convert a reference polynomial to the fixed canonical list order. This is a producer-side conversion; certificate replay sees only its quoted result.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    theorem Hex.MvPoly.Kernel.denote_insert {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (t : Term κ) (p : PolyList κ) :

                                                                    Inserting a term has the denotation of adding its monomial.

                                                                    theorem Hex.MvPoly.Kernel.denote_normalize {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : PolyList κ) :

                                                                    Normalization does not change denotation.

                                                                    theorem Hex.MvPoly.Kernel.denote_insertSum {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p q : PolyList κ) :

                                                                    List addition denotes reference addition.

                                                                    theorem Hex.MvPoly.Kernel.denote_merge {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (fuel : Nat) (p q : PolyList κ) :
                                                                    denote (merge fuel p q) = denote p + denote q

                                                                    A merge has the denotation of the sum, for any fuel and any input.

                                                                    theorem Hex.MvPoly.Kernel.denote_add {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p q : PolyList κ) :

                                                                    List addition denotes reference addition.

                                                                    theorem Hex.MvPoly.Kernel.denote_neg {n : Nat} {κ : Type u} [Lean.Grind.CommRing κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : PolyList κ) :

                                                                    List negation denotes reference negation.

                                                                    theorem Hex.MvPoly.Kernel.denote_sub {n : Nat} {κ : Type u} [Lean.Grind.CommRing κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p q : PolyList κ) :

                                                                    List subtraction denotes reference subtraction.

                                                                    theorem Hex.MvPoly.Kernel.denote_smul {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (a : κ) (p : PolyList κ) :
                                                                    denote (smul a p) = C a * denote p

                                                                    List scalar multiplication denotes multiplication by a constant.

                                                                    theorem Hex.MvPoly.Kernel.get_mono (n : Nat) (e : List Nat) (i : Fin n) :
                                                                    (mono n e)[i] = e.getD (↑i) 0

                                                                    Reading a list exponent through its denotation uses getD.

                                                                    The zero exponent denotes the reference constant monomial.

                                                                    theorem Hex.MvPoly.Kernel.denote_one {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] :
                                                                    denote (one n) = 1

                                                                    The list multiplicative identity denotes the reference identity.

                                                                    theorem Hex.MvPoly.Kernel.getD_addExp {a b : List Nat} {n i : Nat} (ha : a.length = n) (hb : b.length = n) (hi : i < n) :
                                                                    (addExp a b).getD i 0 = a.getD i 0 + b.getD i 0

                                                                    A pointwise sum has the pointwise sum of getD values when both lists have the declared arity.

                                                                    theorem Hex.MvPoly.Kernel.mono_addExp {a b : List Nat} {n : Nat} (ha : a.length = n) (hb : b.length = n) :
                                                                    mono n (addExp a b) = (mono n a).mul (mono n b)

                                                                    List exponent addition denotes monomial multiplication.

                                                                    theorem Hex.MvPoly.Kernel.denote_mulTerm {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (t : Term κ) (p : PolyList κ) (ht : t.fst.length = n) (hp : ∀ (u : Term κ), u ∈ p → u.fst.length = n) :

                                                                    Multiplying one term through a list denotes multiplication by its reference monomial.

                                                                    theorem Hex.MvPoly.Kernel.denote_mergeRows {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (fuel : Nat) (ps : List (PolyList κ)) :

                                                                    Balanced merging denotes the sum of its rows, independently of fuel.

                                                                    theorem Hex.MvPoly.Kernel.denote_mul {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p q : PolyList κ) (hp : ∀ (t : Term κ), t ∈ p → t.fst.length = n) (hq : ∀ (t : Term κ), t ∈ q → t.fst.length = n) :

                                                                    List multiplication denotes reference multiplication.

                                                                    theorem Hex.MvPoly.Kernel.denote_eq_ofTerms {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : PolyList κ) :
                                                                    denote p = ofTerms (List.map (fun (t : Term κ) => (mono n t.fst, t.snd)) p)

                                                                    The recursive sum denotation agrees with the reference bulk constructor.

                                                                    theorem Hex.MvPoly.Kernel.mono_toList {n : Nat} (m : Mono n) :

                                                                    Converting a vector monomial to a list and reading it back is exact.

                                                                    theorem Hex.MvPoly.Kernel.toList_canonical {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : MvPoly n κ cmp) :

                                                                    Producer conversion always emits a canonical list.

                                                                    theorem Hex.MvPoly.Kernel.denote_toList {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (p : MvPoly n κ cmp) :

                                                                    Producer conversion round-trips through denotation.

                                                                    def Hex.MvPoly.Kernel.toRows {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (rows : List (List (MvPoly n κ cmp))) :

                                                                    Producer conversion for nested polynomial lists. A matrix consumer passes rowLists P; no matrix dependency is needed in this library.

                                                                    Equations
                                                                    Instances For
                                                                      theorem Hex.MvPoly.Kernel.denote_toRows {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (rows : List (List (MvPoly n κ cmp))) :

                                                                      Entrywise denotation identifies quoted rows with the original rows. In particular, instantiate rows with rowLists P for a reference matrix.

                                                                      theorem Hex.MvPoly.Kernel.pow_eq_pow {κ : Type u_1} [Lean.Grind.Semiring κ] (a : κ) (k : Nat) :
                                                                      pow a k = a ^ k

                                                                      The linear structural power used by certificate replay has the standard semiring value.

                                                                      theorem Hex.MvPoly.Kernel.evalMono_eq_prod {κ : Type u_1} [Lean.Grind.Semiring κ] {n : Nat} {x : List κ} {e : List Nat} (hx : x.length = n) (he : e.length = n) :
                                                                      evalMono x e = Mono.prod (fun (i : Fin n) => x.getD (↑i) 0) (mono n e)

                                                                      List monomial evaluation agrees with reference monomial evaluation when the point and exponent list have the declared arity.

                                                                      theorem Hex.MvPoly.Kernel.evalAt_denote {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (x : List κ) (p : PolyList κ) (hx : x.length = n) (hp : ∀ (t : Term κ), t ∈ p → t.fst.length = n) :
                                                                      evalAt x p = eval (fun (i : Fin n) => x.getD (↑i) 0) (denote p)

                                                                      List evaluation commutes with evaluation of the reference denotation.

                                                                      theorem Hex.MvPoly.Kernel.toList_mono {e : List Nat} {n : Nat} (h : e.length = n) :

                                                                      An exact-length exponent list is recovered from its monomial.

                                                                      theorem Hex.MvPoly.Kernel.mono_inj {a b : List Nat} {n : Nat} (ha : a.length = n) (hb : b.length = n) :
                                                                      mono n a = mono n b ↔ a = b

                                                                      Denotation of exponent lists is injective at a fixed arity.

                                                                      def Hex.MvPoly.Kernel.coeffAt {κ : Type u_1} [Zero κ] (e : List Nat) :
                                                                      PolyList κ → κ

                                                                      Coefficient lookup on a canonical list.

                                                                      Equations
                                                                      Instances For
                                                                        theorem Hex.MvPoly.Kernel.coeff_denote_eq_zero {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (e : List Nat) (p : PolyList κ) (he : e.length = n) (hp : ∀ (t : Term κ), t ∈ p → t.fst.length = n) (hnot : ∀ (t : Term κ), t ∈ p → e ≠ t.fst) :
                                                                        coeff (mono n e) (denote p) = 0

                                                                        A monomial absent from a well-formed list has zero coefficient in its denotation.

                                                                        theorem Hex.MvPoly.Kernel.coeff_denote {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] (e : List Nat) (p : PolyList κ) (he : e.length = n) (hp : Canonical n p) :
                                                                        coeff (mono n e) (denote p) = coeffAt e p

                                                                        Reference coefficients read back the stored coefficient of a canonical list.

                                                                        theorem Hex.MvPoly.Kernel.coeffAt_eq_zero_of_gt_head {κ : Type u_1} [Zero κ] {e : List Nat} {t : Term κ} {ts : PolyList κ} (hp : List.Pairwise (fun (a b : Term κ) => b.fst < a.fst) (t :: ts)) (he : t.fst < e) :
                                                                        coeffAt e (t :: ts) = 0

                                                                        Lookup is zero above the head of a descending canonical list.

                                                                        theorem Hex.MvPoly.Kernel.coeffAt_tail_eq_zero {κ : Type u_1} [Zero κ] {t : Term κ} {ts : PolyList κ} (hp : List.Pairwise (fun (a b : Term κ) => b.fst < a.fst) (t :: ts)) :
                                                                        coeffAt t.fst ts = 0

                                                                        The tail has zero coefficient at the head exponent.

                                                                        theorem Hex.MvPoly.Kernel.coeffAt_ext {κ : Type u_1} [Zero κ] {p q : PolyList κ} (hp : List.Pairwise (fun (a b : Term κ) => b.fst < a.fst) p) (hq : List.Pairwise (fun (a b : Term κ) => b.fst < a.fst) q) (hp0 : ∀ (t : Term κ), t ∈ p → t.snd ≠ 0) (hq0 : ∀ (t : Term κ), t ∈ q → t.snd ≠ 0) (h : ∀ (e : List Nat), coeffAt e p = coeffAt e q) :
                                                                        p = q

                                                                        Canonical lists with the same coefficient function are equal.

                                                                        theorem Hex.MvPoly.Kernel.coeffAt_eq_zero_of_length_ne {κ : Type u_1} [Zero κ] {e : List Nat} {n : Nat} {p : PolyList κ} (hp : ∀ (t : Term κ), t ∈ p → t.fst.length = n) (he : e.length ≠ n) :
                                                                        coeffAt e p = 0

                                                                        A lookup with the wrong arity is zero in a well-formed list.

                                                                        theorem Hex.MvPoly.Kernel.denote_injective {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) (h : denote p = denote q) :
                                                                        p = q

                                                                        Canonical list denotation is injective.

                                                                        theorem Hex.MvPoly.Kernel.toList_denote {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] {p : PolyList κ} (hp : Canonical n p) :

                                                                        A canonical list is recovered by converting its denotation back to list form.

                                                                        theorem Hex.MvPoly.Kernel.beq_eq_true_iff {κ : Type u_1} [DecidableEq κ] {p q : PolyList κ} :
                                                                        beq p q = true ↔ p = q

                                                                        Structural equality returns true exactly for equal term lists.

                                                                        theorem Hex.MvPoly.Kernel.isZero_iff {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] {p : PolyList κ} (hp : Canonical n p) :

                                                                        The empty-list test agrees with zero denotation on canonical inputs.

                                                                        theorem Hex.MvPoly.Kernel.beq_iff {n : Nat} {κ : Type u} [Lean.Grind.Semiring κ] [BEq κ] [LawfulBEq κ] [DecidableEq κ] {cmp : Mono n → Mono n → Ordering} [Std.TransCmp cmp] [Std.LawfulEqCmp cmp] {p q : PolyList κ} (hp : Canonical n p) (hq : Canonical n q) :

                                                                        Structural equality agrees with denotational equality on canonical inputs.

                                                                        theorem Hex.MvPoly.Kernel.beq_refl {κ : Type u_1} [DecidableEq κ] (p : PolyList κ) :
                                                                        beq p p = true

                                                                        Reflexivity of list equality, stated at the kernel Boolean interface.

                                                                        theorem Hex.MvPoly.Kernel.beq_symm {κ : Type u_1} [DecidableEq κ] {p q : PolyList κ} (h : beq p q = true) :
                                                                        beq q p = true

                                                                        Symmetry of list equality, stated at the kernel Boolean interface.

                                                                        theorem Hex.MvPoly.Kernel.beq_trans {κ : Type u_1} [DecidableEq κ] {p q r : PolyList κ} (hpq : beq p q = true) (hqr : beq q r = true) :
                                                                        beq p r = true

                                                                        Transitivity of list equality, stated at the kernel Boolean interface.