Documentation

Init.Grind.Ring.Packed

Polynomials with packed monomials, for kernel-checked normalization in commutative rings.

The monomial x₀^k₀ * ... * xₙ^kₙ is packed as the natural number k₀ + k₁ * B + ... + kₙ * B^n for a base B larger than every degree, so multiplying monomials adds their codes and comparing them compares numbers, operations the kernel performs on literals directly. Each term also stores its degree, and terms are sorted by decreasing degree and then by increasing code, which is the order Mon.grevlex of Poly.

Polynomials whose monomials are packed: add k d v p is k * m + p, where the exponent of the variable i in m is the i-th digit of v in base B, and d is the degree of m.

Instances For
    noncomputable def Lean.Grind.CommRing.PPoly.addConst_k (p : PPoly) (k : Int) :
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def Lean.Grind.CommRing.PPoly.combine_k (p₁ : PPoly) :

      Terms are sorted by decreasing degree, and then by increasing packed exponents, i.e., in decreasing Mon.grevlex order.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def Lean.Grind.CommRing.PPoly.mulConst_k (k : Int) (p : PPoly) :
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def Lean.Grind.CommRing.PPoly.mulMon_k (k : Int) (d v : Nat) (p : PPoly) :
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  noncomputable def Lean.Grind.CommRing.PPoly.mulTerms_k (p₁ p₂ : PPoly) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    true if p is a single term without constant.

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

                      q multiplied by the first term of p.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        noncomputable def Lean.Grind.CommRing.PPoly.mulB_k (p₁ p₂ : PPoly) :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          noncomputable def Lean.Grind.CommRing.PPoly.powB_k (p : PPoly) (k : Nat) :
                          Equations
                          Instances For
                            noncomputable def Lean.Grind.CommRing.Expr.powPP_k (B : Nat) (a : Expr) (k : Nat) (p : PPoly) :

                            The polynomial of a ^ k, where p is the polynomial of a.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              noncomputable def Lean.Grind.CommRing.Expr.toPPAcc_k (B : Nat) (e : Expr) :

                              toPPAcc_k B e acc is the polynomial of e + acc. Sums are added from the right into the accumulator, so a sum of terms in decreasing order is normalized in linear time.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                noncomputable def Lean.Grind.CommRing.PPoly.signB_k (p : PPoly) (s : Bool) :

                                p, negated if s.

                                Equations
                                Instances For
                                  noncomputable def Lean.Grind.CommRing.Expr.sumsPP_k (B : Nat) (e : Expr) :

                                  sumsPP_k B e s acc prepends to acc the polynomials of the summands of e, negated if s.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    noncomputable def Lean.Grind.CommRing.Expr.toPPB_k (B : Nat) (e : Expr) :

                                    The polynomial of e, adding the summands pairwise.

                                    Equations
                                    Instances For
                                      noncomputable def Lean.Grind.CommRing.Expr.degB_k (e : Expr) :

                                      An upper bound on the degree of the monomials of e.

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

                                        The sum of the digits of v in base B.

                                        Equations
                                        Instances For
                                          @[irreducible]
                                          noncomputable def Lean.Grind.CommRing.PPoly.monDenote {α : Type u_1} [Semiring α] (ctx : Nat → α) (B i v : Nat) :
                                          α

                                          The monomial whose exponent of the variable i + j is the j-th digit of v in base B.

                                          Equations
                                          Instances For
                                            theorem Lean.Grind.CommRing.PPoly.dsum_eq {B : Nat} (hB : 1 < B) (v : Nat) :
                                            dsum B v = v % B + dsum B (v / B)
                                            theorem Lean.Grind.CommRing.PPoly.monDenote_zero {α : Type u_1} [Semiring α] (ctx : Nat → α) (B i : Nat) :
                                            monDenote ctx B i 0 = 1
                                            theorem Lean.Grind.CommRing.PPoly.monDenote_eq {B : Nat} {α : Type u_1} [Semiring α] (ctx : Nat → α) (hB : 1 < B) (i v : Nat) :
                                            monDenote ctx B i v = ctx i ^ (v % B) * monDenote ctx B (i + 1) (v / B)
                                            theorem Lean.Grind.CommRing.PPoly.mod_le_dsum {B : Nat} (hB : 1 < B) (v : Nat) :
                                            v % B ≤ dsum B v
                                            theorem Lean.Grind.CommRing.PPoly.dsum_div_le {B : Nat} (hB : 1 < B) (v : Nat) :
                                            dsum B (v / B) ≤ dsum B v
                                            theorem Lean.Grind.CommRing.PPoly.add_mod_div {B : Nat} (hB : 1 < B) (v₁ v₂ : Nat) (h : v₁ % B + v₂ % B < B) :
                                            (v₁ + v₂) % B = v₁ % B + v₂ % B ∧ (v₁ + v₂) / B = v₁ / B + v₂ / B

                                            Adding numbers whose digit sums add up to less than B adds their digits without carries.

                                            theorem Lean.Grind.CommRing.PPoly.dsum_add {B : Nat} (hB : 1 < B) (v₁ v₂ : Nat) (h : dsum B v₁ + dsum B v₂ < B) :
                                            dsum B (v₁ + v₂) = dsum B v₁ + dsum B v₂
                                            theorem Lean.Grind.CommRing.PPoly.monDenote_add {B : Nat} {α : Type u_1} [CommSemiring α] (ctx : Nat → α) (hB : 1 < B) (i v₁ v₂ : Nat) (h : dsum B v₁ + dsum B v₂ < B) :
                                            monDenote ctx B i (v₁ + v₂) = monDenote ctx B i v₁ * monDenote ctx B i v₂
                                            theorem Lean.Grind.CommRing.PPoly.dsum_mul_pow {B : Nat} (hB : 1 < B) (x k : Nat) (hk : k < B) :
                                            dsum B (k * B ^ x) = k
                                            theorem Lean.Grind.CommRing.PPoly.monDenote_mul_pow {B : Nat} {α : Type u_1} [Semiring α] (ctx : Nat → α) (hB : 1 < B) (i x k : Nat) (hk : k < B) :
                                            monDenote ctx B i (k * B ^ x) = ctx (i + x) ^ k
                                            theorem Lean.Grind.CommRing.PPoly.Deg.mono {B D D' : Nat} (h : D ≤ D') (p : PPoly) :
                                            Deg B D p → Deg B D' p
                                            theorem Lean.Grind.CommRing.PPoly.addConst_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (p : PPoly) (k : Int) :
                                            denote ctx B (p.addConst_k k) = denote ctx B p + ↑k ∧ (Deg B D p → Deg B D (p.addConst_k k))
                                            theorem Lean.Grind.CommRing.PPoly.combine_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (p₁ p₂ : PPoly) :
                                            denote ctx B (p₁.combine_k p₂) = denote ctx B p₁ + denote ctx B p₂ ∧ (Deg B D p₁ → Deg B D p₂ → Deg B D (p₁.combine_k p₂))
                                            theorem Lean.Grind.CommRing.PPoly.mulConst_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (k : Int) (p : PPoly) :
                                            denote ctx B (mulConst_k k p) = ↑k * denote ctx B p ∧ (Deg B D p → Deg B D (mulConst_k k p))
                                            theorem Lean.Grind.CommRing.PPoly.mulMon_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B D₁ D₂ : Nat) (hB : 1 < B) (k : Int) (d v : Nat) (hv : dsum B v ≤ D₁) (hD : D₁ + D₂ < B) (p : PPoly) (hp : Deg B D₂ p) :
                                            denote ctx B (mulMon_k k d v p) = ↑k * monDenote ctx B 0 v * denote ctx B p ∧ Deg B (D₁ + D₂) (mulMon_k k d v p)
                                            noncomputable def Lean.Grind.CommRing.PPoly.denoteList {α : Type u_1} [Ring α] (ctx : Nat → α) (B : Nat) (ps : List PPoly) :
                                            α
                                            Equations
                                            Instances For
                                              theorem Lean.Grind.CommRing.PPoly.denoteList_cons {α : Type u_1} [Ring α] (ctx : Nat → α) (B : Nat) (p : PPoly) (ps : List PPoly) :
                                              denoteList ctx B (p :: ps) = denote ctx B p + denoteList ctx B ps
                                              theorem Lean.Grind.CommRing.PPoly.pairs_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (ps : List PPoly) (pend : Option PPoly) :
                                              denoteList ctx B (pairs_k ps pend) = (pend.elim 0 fun (x : PPoly) => denote ctx B x) + denoteList ctx B ps ∧ (DegList B D ps → (∀ (p : PPoly), pend = some p → Deg B D p) → DegList B D (pairs_k ps pend))
                                              theorem Lean.Grind.CommRing.PPoly.foldr_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (ps : List PPoly) :
                                              denote ctx B (foldr_k ps) = denoteList ctx B ps ∧ (DegList B D ps → Deg B D (foldr_k ps))
                                              theorem Lean.Grind.CommRing.PPoly.sumGo_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (fuel ps : List PPoly) :
                                              denote ctx B (sumGo_k fuel ps) = denoteList ctx B ps ∧ (DegList B D ps → Deg B D (sumGo_k fuel ps))
                                              theorem Lean.Grind.CommRing.PPoly.sumB_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (ps : List PPoly) :
                                              denote ctx B (sumB_k ps) = denoteList ctx B ps ∧ (DegList B D ps → Deg B D (sumB_k ps))
                                              theorem Lean.Grind.CommRing.PPoly.mulTerms_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B D₁ D₂ : Nat) (hB : 1 < B) (hD : D₁ + D₂ < B) (p₁ p₂ : PPoly) (h₁ : Deg B D₁ p₁) (h₂ : Deg B D₂ p₂) :
                                              denoteList ctx B (p₁.mulTerms_k p₂) = denote ctx B p₁ * denote ctx B p₂ ∧ DegList B (D₁ + D₂) (p₁.mulTerms_k p₂)
                                              theorem Lean.Grind.CommRing.PPoly.mulB_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B D₁ D₂ : Nat) (hB : 1 < B) (hD : D₁ + D₂ < B) (p₁ p₂ : PPoly) (h₁ : Deg B D₁ p₁) (h₂ : Deg B D₂ p₂) :
                                              denote ctx B (p₁.mulB_k p₂) = denote ctx B p₁ * denote ctx B p₂ ∧ Deg B (D₁ + D₂) (p₁.mulB_k p₂)
                                              theorem Lean.Grind.CommRing.PPoly.powB_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B D : Nat) (hB : 1 < B) (p : PPoly) (k : Nat) (hp : Deg B D p) (hD : D * k < B) :
                                              denote ctx B (p.powB_k k) = denote ctx B p ^ k ∧ Deg B (D * k) (p.powB_k k)
                                              theorem Lean.Grind.CommRing.Expr.le_max_k (a b : Nat) :
                                              a ≤ Bool.rec a b (a.blt b) ∧ b ≤ Bool.rec a b (a.blt b)
                                              theorem Lean.Grind.CommRing.Expr.toPPAcc_k_add {a b : Expr} {B : Nat} {acc : PPoly} :
                                              toPPAcc_k B (a.add b) acc = toPPAcc_k B a (toPPAcc_k B b acc)
                                              theorem Lean.Grind.CommRing.Expr.toPPAcc_k_pow {a : Expr} {k B : Nat} {acc : PPoly} :
                                              toPPAcc_k B (a.pow k) acc = (powPP_k B a k (toPPAcc_k B a (PPoly.num (Int.ofNat 0)))).combine_k acc
                                              @[reducible, inline]
                                              noncomputable abbrev Lean.Grind.CommRing.Expr.denoteF {α : Type u_1} [Ring α] (f : Nat → α) (e : Expr) :
                                              α

                                              Expr.denote for a valuation f of the variables.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                theorem Lean.Grind.CommRing.Expr.denote_eq_denoteF {α : Type u_1} [Ring α] (ctx : Context α) (e : Expr) :
                                                denote ctx e = denoteF (Var.denote ctx) e
                                                theorem Lean.Grind.CommRing.PPoly.denote_num_zero {α : Type u_1} [Ring α] (ctx : Nat → α) (B : Nat) :
                                                denote ctx B (num (Int.ofNat 0)) = 0
                                                theorem Lean.Grind.CommRing.Expr.powPP_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B : Nat) (hB : 1 < B) (a : Expr) (k : Nat) (p : PPoly) (hp : 0 < k → PPoly.denote ctx B p = denoteF ctx a ∧ PPoly.Deg B a.degB_k p) (hk : a.degB_k * k < B) :
                                                PPoly.denote ctx B (powPP_k B a k p) = denoteF ctx a ^ k ∧ PPoly.Deg B (a.degB_k * k) (powPP_k B a k p)
                                                theorem Lean.Grind.CommRing.Expr.toPPAcc_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B : Nat) (hB : 1 < B) (e : Expr) (D : Nat) (acc : PPoly) :
                                                e.degB_k ≤ D → D < B → PPoly.Deg B D acc → PPoly.denote ctx B (toPPAcc_k B e acc) = denoteF ctx e + PPoly.denote ctx B acc ∧ PPoly.Deg B D (toPPAcc_k B e acc)
                                                theorem Lean.Grind.CommRing.Expr.denote_toPP_k {α : Type u_1} [CommRing α] (ctx : Nat → α) (B : Nat) (hB : 1 < B) (e : Expr) (he : e.degB_k < B) :
                                                PPoly.denote ctx B (toPP_k B e) = denoteF ctx e
                                                theorem Lean.Grind.CommRing.PPoly.signB_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (B D : Nat) (p : PPoly) (s : Bool) :
                                                denote ctx B (p.signB_k s) = Bool.rec (denote ctx B p) (-denote ctx B p) s ∧ (Deg B D p → Deg B D (p.signB_k s))
                                                theorem Lean.Grind.CommRing.PPoly.DegList.cons {B D : Nat} {p : PPoly} {ps : List PPoly} (h₁ : Deg B D p) (h₂ : DegList B D ps) :
                                                DegList B D (p :: ps)
                                                theorem Lean.Grind.CommRing.Expr.sumsPP_k_pow {a : Expr} {k B : Nat} {s : Bool} {acc : List PPoly} :
                                                sumsPP_k B (a.pow k) s acc = (powPP_k B a k (PPoly.sumB_k (sumsPP_k B a false []))).signB_k s :: acc
                                                theorem Lean.Grind.CommRing.Expr.sumsPP_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (B : Nat) (hB : 1 < B) (e : Expr) (D : Nat) (s : Bool) (acc : List PPoly) :
                                                e.degB_k ≤ D → D < B → PPoly.DegList B D acc → PPoly.denoteList ctx B (sumsPP_k B e s acc) = Bool.rec (denoteF ctx e) (-denoteF ctx e) s + PPoly.denoteList ctx B acc ∧ PPoly.DegList B D (sumsPP_k B e s acc)
                                                theorem Lean.Grind.CommRing.Expr.denote_toPPX_k {α : Type u_1} [CommRing α] (ctx : Nat → α) (B : Nat) (hB : 1 < B) (bal : Bool) (e : Expr) (he : e.degB_k < B) :
                                                PPoly.denote ctx B (toPPX_k B bal e) = denoteF ctx e
                                                noncomputable def Lean.Grind.CommRing.Expr.degOk_k (B : Nat) (a b : Expr) :

                                                Checks the degree bound of a and b for the base B.

                                                Equations
                                                Instances For
                                                  theorem Lean.Grind.CommRing.Expr.of_degOk_k {B : Nat} {a b : Expr} (h : degOk_k B a b = true) :
                                                  1 < B ∧ a.degB_k < B ∧ b.degB_k < B
                                                  theorem Lean.Grind.CommRing.Expr.eq_of_toPPX_eq {α : Type u_1} [CommRing α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : degOk_k B a b = true) (h₁ : p = toPPX_k B bal₁ a) (h₂ : p = toPPX_k B bal₂ b) :
                                                  denote ctx a = denote ctx b
                                                  theorem Lean.Grind.CommRing.eq_true_of_toPPX_eq {α : Type u_1} [CommRing α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :
                                                  theorem Lean.Grind.CommRing.le_true_of_toPPX_eq {α : Type u_1} [CommRing α] [LE α] [Std.IsPreorder α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :
                                                  theorem Lean.Grind.CommRing.lt_false_of_toPPX_eq {α : Type u_1} [CommRing α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :
                                                  theorem Lean.Grind.CommRing.Expr.sub_eq_of_toPPX {α : Type u_1} [CommRing α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (q : PPoly) (k : Int) (hB : degOk_k B a b = true) (h₁ : q.addConst_k k = toPPX_k B bal₁ a) (h₂ : q = toPPX_k B bal₂ b) :
                                                  denote ctx a - denote ctx b = ↑k

                                                  The difference of a and b is the constant k, for the theorems eq_false_of_sub, le_true_of_sub, ....

                                                  Packed sums of multiples for grind's Gröbner certificates (Stepwise.simpsP, Stepwise.d_stepsP). The polynomials of the steps stay Poly literals and are packed by the kernel (Poly.toPP_k). The operations take the normalization nrm of the coefficients: the identity in characteristic zero, and the remainder modulo c in characteristic c.

                                                  noncomputable def Lean.Grind.CommRing.Mon.code_k (B : Nat) (m : Mon) :

                                                  The packed code of m in base B.

                                                  Equations
                                                  Instances For
                                                    noncomputable def Lean.Grind.CommRing.Poly.maxDeg_k (p : Poly) :

                                                    The maximum degree of the monomials of p.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      noncomputable def Lean.Grind.CommRing.Poly.toPP_k (B : Nat) (p : Poly) :

                                                      p with packed monomials, in the same order.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        noncomputable def Lean.Grind.CommRing.PPoly.addConstN_k (nrm : Int → Int) (p : PPoly) (k : Int) :
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          noncomputable def Lean.Grind.CommRing.PPoly.combineN_k (nrm : Int → Int) (p₁ : PPoly) :
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            noncomputable def Lean.Grind.CommRing.PPoly.mulMonN_k (nrm : Int → Int) (k : Int) (d v : Nat) (p : PPoly) :

                                                            k * m * p for the monomial m with degree d and code v; the constant of p stays a constant when m is 1.

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

                                                              A sum of multiples k * m * p of packed polynomials p whose monomials have degree at most D, added in a balanced tree.

                                                              Instances For
                                                                noncomputable def Lean.Grind.CommRing.PSumTree.eval_k (nrm : Int → Int) (B : Nat) (t : PSumTree) :
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  noncomputable def Lean.Grind.CommRing.PSumTree.ok_k (B : Nat) (t : PSumTree) :

                                                                  The degrees of the products of t are below B.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    noncomputable def Lean.Grind.CommRing.PSumTree.AllZero {α : Type u_1} [Ring α] (ctx : Context α) (B : Nat) (t : PSumTree) :

                                                                    Every polynomial of the leaves of t denotes 0, and its monomials have degree at most D.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      theorem Lean.Grind.CommRing.Mon.code_k_spec {α : Type u_1} [CommSemiring α] (ctx : Context α) {B : Nat} (hB : 1 < B) (m : Mon) (h : m.degree < B) :
                                                                      theorem Lean.Grind.CommRing.Poly.toPP_k_spec {α : Type u_1} [CommRing α] (ctx : Context α) {B : Nat} (hB : 1 < B) (p : Poly) (h : p.maxDeg_k < B) :
                                                                      theorem Lean.Grind.CommRing.PPoly.addConstN_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (nrm : Int → Int) (hn : ∀ (k : Int), ↑(nrm k) = ↑k) (B D : Nat) (p : PPoly) (k : Int) :
                                                                      denote ctx B (addConstN_k nrm p k) = denote ctx B p + ↑k ∧ (Deg B D p → Deg B D (addConstN_k nrm p k))
                                                                      theorem Lean.Grind.CommRing.PPoly.combineN_k_spec {α : Type u_1} [Ring α] (ctx : Nat → α) (nrm : Int → Int) (hn : ∀ (k : Int), ↑(nrm k) = ↑k) (B D : Nat) (p₁ p₂ : PPoly) :
                                                                      denote ctx B (combineN_k nrm p₁ p₂) = denote ctx B p₁ + denote ctx B p₂ ∧ (Deg B D p₁ → Deg B D p₂ → Deg B D (combineN_k nrm p₁ p₂))
                                                                      theorem Lean.Grind.CommRing.PPoly.mulMonN_k_spec {α : Type u_1} [CommRing α] (ctx : Nat → α) (nrm : Int → Int) (hn : ∀ (k : Int), ↑(nrm k) = ↑k) (B D₁ D₂ : Nat) (hB : 1 < B) (k : Int) (d v : Nat) (hv : dsum B v ≤ D₁) (hD : D₁ + D₂ < B) (p : PPoly) (hp : Deg B D₂ p) :
                                                                      denote ctx B (mulMonN_k nrm k d v p) = ↑k * monDenote ctx B 0 v * denote ctx B p ∧ Deg B (D₁ + D₂) (mulMonN_k nrm k d v p)
                                                                      theorem Lean.Grind.CommRing.PSumTree.leaf_zero {α : Type u_1} [CommRing α] (ctx : Context α) (B : Nat) (p : Poly) (P : PPoly) (hB : Bool.rec false (p.maxDeg_k.blt B) (Nat.blt 1 B) = true) (h : P = Poly.toPP_k B p) (hp : Poly.denote ctx p = 0) :

                                                                      The packed polynomial P of p denotes 0, and its monomials have degree at most p.maxDeg_k.

                                                                      theorem Lean.Grind.CommRing.PSumTree.eval_k_spec {α : Type u_1} [CommRing α] (ctx : Context α) (nrm : Int → Int) (hn : ∀ (k : Int), ↑(nrm k) = ↑k) {B : Nat} (hB : 1 < B) (t : PSumTree) (hok : ok_k B t = true) (h : AllZero ctx B t) :
                                                                      PPoly.denote (Var.denote ctx) B (eval_k nrm B t) = 0 ∧ PPoly.Deg B (B - 1) (eval_k nrm B t)
                                                                      theorem Lean.Grind.CommRing.PSumTree.denote_eq {α : Type u_1} [CommRing α] (ctx : Context α) (nrm : Int → Int) (hn : ∀ (k : Int), ↑(nrm k) = ↑k) (B : Nat) (p₁ p : Poly) (P : PPoly) (t : PSumTree) (hB : Bool.rec false (Bool.rec false (Bool.rec false (ok_k B t) (p₁.maxDeg_k.blt B)) (p.maxDeg_k.blt B)) (Nat.blt 1 B) = true) (h₁ : P = Poly.toPP_k B p) (h₂ : P = PPoly.combineN_k nrm (Poly.toPP_k B p₁) (eval_k nrm B t)) (ht : AllZero ctx B t) :
                                                                      Poly.denote ctx p = Poly.denote ctx p₁

                                                                      p₁ + Σ of the multiples t is p, checked with packed monomials.

                                                                      theorem Lean.Grind.CommRing.Stepwise.simpsP {α : Type u_1} [CommRing α] (ctx : Context α) (B : Nat) (p₁ p : Poly) (P : PPoly) (t : PSumTree) (hB : Bool.rec false (Bool.rec false (Bool.rec false (PSumTree.ok_k B t) (p₁.maxDeg_k.blt B)) (p.maxDeg_k.blt B)) (Nat.blt 1 B) = true) (h₁ : P = Poly.toPP_k B p) (h₂ : P = PPoly.combineN_k (fun (k : Int) => k) (Poly.toPP_k B p₁) (PSumTree.eval_k (fun (k : Int) => k) B t)) :
                                                                      PSumTree.AllZero ctx B t → Poly.denote ctx p₁ = 0 → Poly.denote ctx p = 0
                                                                      theorem Lean.Grind.CommRing.Stepwise.simpsPC {α : Type u_1} {c : Nat} [CommRing α] [IsCharP α c] (ctx : Context α) (B : Nat) (p₁ p : Poly) (P : PPoly) (t : PSumTree) (hB : Bool.rec false (Bool.rec false (Bool.rec false (PSumTree.ok_k B t) (p₁.maxDeg_k.blt B)) (p.maxDeg_k.blt B)) (Nat.blt 1 B) = true) (h₁ : P = Poly.toPP_k B p) (h₂ : P = PPoly.combineN_k (fun (k : Int) => k.emod_k (Int.ofNat c)) (Poly.toPP_k B p₁) (PSumTree.eval_k (fun (k : Int) => k.emod_k (Int.ofNat c)) B t)) :
                                                                      PSumTree.AllZero ctx B t → Poly.denote ctx p₁ = 0 → Poly.denote ctx p = 0
                                                                      theorem Lean.Grind.CommRing.Stepwise.d_stepsP {α : Type u_1} [CommRing α] (ctx : Context α) (k : Int) (init : Poly) (B : Nat) (p₁ p : Poly) (P : PPoly) (t : PSumTree) (hB : Bool.rec false (Bool.rec false (Bool.rec false (PSumTree.ok_k B t) (p₁.maxDeg_k.blt B)) (p.maxDeg_k.blt B)) (Nat.blt 1 B) = true) (h₁ : P = Poly.toPP_k B p) (h₂ : P = PPoly.combineN_k (fun (k : Int) => k) (Poly.toPP_k B p₁) (PSumTree.eval_k (fun (k : Int) => k) B t)) :
                                                                      PSumTree.AllZero ctx B t → ↑k * Poly.denote ctx init = Poly.denote ctx p₁ → ↑k * Poly.denote ctx init = Poly.denote ctx p
                                                                      theorem Lean.Grind.CommRing.Stepwise.d_stepsPC {α : Type u_1} {c : Nat} [CommRing α] [IsCharP α c] (ctx : Context α) (k : Int) (init : Poly) (B : Nat) (p₁ p : Poly) (P : PPoly) (t : PSumTree) (hB : Bool.rec false (Bool.rec false (Bool.rec false (PSumTree.ok_k B t) (p₁.maxDeg_k.blt B)) (p.maxDeg_k.blt B)) (Nat.blt 1 B) = true) (h₁ : P = Poly.toPP_k B p) (h₂ : P = PPoly.combineN_k (fun (k : Int) => k.emod_k (Int.ofNat c)) (Poly.toPP_k B p₁) (PSumTree.eval_k (fun (k : Int) => k.emod_k (Int.ofNat c)) B t)) :
                                                                      PSumTree.AllZero ctx B t → ↑k * Poly.denote ctx init = Poly.denote ctx p₁ → ↑k * Poly.denote ctx init = Poly.denote ctx p

                                                                      Commutative semirings with AddRightCancel, through the ring envelope Ring.OfSemiring.Q, where toQ is injective.

                                                                      noncomputable def Lean.Grind.CommRing.PPoly.mapCtx {α : Type u_1} {β : Type u_2} (f : α → β) (ctx : Context α) :

                                                                      ctx mapped by f.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem Lean.Grind.CommRing.PPoly.get_mapCtx {α : Type u_1} {β : Type u_2} (f : α → β) (ctx : Context α) (i : Nat) :
                                                                        RArray.get (mapCtx f ctx) i = f (RArray.get ctx i)
                                                                        noncomputable def Lean.Grind.CommRing.Expr.semi_k (e : Expr) :

                                                                        true if e has no subtraction, negation, Int cast or negative numeral, so that its semiring denotation is its ring denotation.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          noncomputable def Lean.Grind.CommRing.Expr.degS_k (B : Nat) (e : Expr) :

                                                                          Expr.degB_k e, or B if e is not a semiring term (Expr.semi_k): one traversal checks both.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            noncomputable def Lean.Grind.CommRing.Expr.degSOk_k (B : Nat) (a b : Expr) :

                                                                            Checks 1 < B and the degree bounds of a and b for the base B, and that they are semiring terms.

                                                                            Equations
                                                                            Instances For
                                                                              theorem Lean.Grind.CommRing.Expr.eq_of_toPPX_eqS {α : Type u_1} [CommSemiring α] [AddRightCancel α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : degSOk_k B a b = true) (h₁ : p = toPPX_k B bal₁ a) (h₂ : p = toPPX_k B bal₂ b) :
                                                                              denoteS ctx a = denoteS ctx b
                                                                              theorem Lean.Grind.CommRing.eq_true_of_toPPX_eqS {α : Type u_1} [CommSemiring α] [AddRightCancel α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degSOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :
                                                                              theorem Lean.Grind.CommRing.le_true_of_toPPX_eqS {α : Type u_1} [CommSemiring α] [AddRightCancel α] [LE α] [Std.IsPreorder α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degSOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :
                                                                              theorem Lean.Grind.CommRing.lt_false_of_toPPX_eqS {α : Type u_1} [CommSemiring α] [AddRightCancel α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (ctx : Context α) (B : Nat) (bal₁ bal₂ : Bool) (a b : Expr) (p : PPoly) (hB : Expr.degSOk_k B a b = true) (h₁ : p = Expr.toPPX_k B bal₁ a) (h₂ : p = Expr.toPPX_k B bal₂ b) :