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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
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
Instances For
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
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- p.powB_k k = Nat.rec (Lean.Grind.CommRing.PPoly.num (Int.ofNat 1)) (fun (k : Nat) (ih : Lean.Grind.CommRing.PPoly) => Bool.rec (p.mulB_k ih) p (k.beq 0)) k
Instances For
Equations
Instances For
p, negated if s.
Equations
- p.signB_k s = Bool.rec p (Lean.Grind.CommRing.PPoly.mulConst_k (Int.negSucc 0) p) s
Instances For
The polynomial of e, adding the summands pairwise.
Equations
Instances For
Equations
- Lean.Grind.CommRing.Expr.toPPX_k B bal e = Bool.rec (Lean.Grind.CommRing.Expr.toPP_k B e) (Lean.Grind.CommRing.Expr.toPPB_k B e) bal
Instances For
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
The sum of the digits of v in base B.
Equations
- Lean.Grind.CommRing.PPoly.dsum B v = if _h : 1 < B ∧ 0 < v then v % B + Lean.Grind.CommRing.PPoly.dsum B (v / B) else 0
Instances For
Equations
- Lean.Grind.CommRing.PPoly.denote ctx B (Lean.Grind.CommRing.PPoly.num k) = ↑k
- Lean.Grind.CommRing.PPoly.denote ctx B (Lean.Grind.CommRing.PPoly.add k d v p) = ↑k * Lean.Grind.CommRing.PPoly.monDenote ctx B 0 v + Lean.Grind.CommRing.PPoly.denote ctx B p
Instances For
All the monomials of the polynomial have degree at most D.
Equations
Instances For
Equations
- Lean.Grind.CommRing.PPoly.denoteList ctx B ps = List.foldr (fun (p : Lean.Grind.CommRing.PPoly) (acc : α) => Lean.Grind.CommRing.PPoly.denote ctx B p + acc) 0 ps
Instances For
Equations
- Lean.Grind.CommRing.PPoly.DegList B D ps = ∀ (p : Lean.Grind.CommRing.PPoly), p ∈ ps → Lean.Grind.CommRing.PPoly.Deg B D p
Instances For
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.
The packed code of m in base B.
Equations
- Lean.Grind.CommRing.Mon.code_k B m = Lean.Grind.CommRing.Mon.rec 0 (fun (pw : Lean.Grind.CommRing.Power) (x : Lean.Grind.CommRing.Mon) (ih : Nat) => (pw.k.mul (B.pow pw.x)).add ih) m
Instances For
The maximum degree of the monomials of p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
p with packed monomials, in the same order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The packed polynomial P of p denotes 0, and its monomials have degree at most p.maxDeg_k.
p₁ + Σ of the multiples t is p, checked with packed monomials.
Commutative semirings with AddRightCancel, through the ring envelope Ring.OfSemiring.Q, where
toQ is injective.
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
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
Checks 1 < B and the degree bounds of a and b for the base B, and that they are semiring terms.
Equations
- Lean.Grind.CommRing.Expr.degSOk_k B a b = Bool.rec false (Bool.rec false ((Lean.Grind.CommRing.Expr.degS_k B b).blt B) ((Lean.Grind.CommRing.Expr.degS_k B a).blt B)) (Nat.blt 1 B)