Documentation

Init.Grind.Ring.CommSemiringAdapter

@[inline]
noncomputable abbrev Lean.Grind.CommRing.Expr.denoteS {α : Type u_1} [Semiring α] (ctx : Context α) (e : Expr) :
α
Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem Lean.Grind.CommRing.Expr.denoteS_intCast {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) :
    denoteS ctx (intCast k) = 0
    theorem Lean.Grind.CommRing.Expr.denoteS_var {α : Type u_1} [Semiring α] (ctx : Context α) (v : Var) :
    denoteS ctx (var v) = Var.denote ctx v
    theorem Lean.Grind.CommRing.Expr.denoteS_neg {α : Type u_1} [Semiring α] (ctx : Context α) (a : Expr) :
    denoteS ctx a.neg = 0
    theorem Lean.Grind.CommRing.Expr.denoteS_add {α : Type u_1} [Semiring α] (ctx : Context α) (a b : Expr) :
    denoteS ctx (a.add b) = denoteS ctx a + denoteS ctx b
    theorem Lean.Grind.CommRing.Expr.denoteS_sub {α : Type u_1} [Semiring α] (ctx : Context α) (a b : Expr) :
    denoteS ctx (a.sub b) = 0
    theorem Lean.Grind.CommRing.Expr.denoteS_mul {α : Type u_1} [Semiring α] (ctx : Context α) (a b : Expr) :
    denoteS ctx (a.mul b) = denoteS ctx a * denoteS ctx b
    theorem Lean.Grind.CommRing.Expr.denoteS_pow {α : Type u_1} [Semiring α] (ctx : Context α) (a : Expr) (k : Nat) :
    denoteS ctx (a.pow k) = denoteS ctx a ^ k
    @[inline]
    noncomputable abbrev Lean.Grind.CommRing.Expr.denoteSAsRing {α : Type u_1} [Semiring α] (ctx : Context α) (e : Expr) :
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Lean.Grind.CommRing.Expr.denoteAsRing_eq {α : Type u_1} [Semiring α] (ctx : Context α) (e : Expr) :
      denoteSAsRing ctx e = ↑(denoteS ctx e)
      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
          Instances For
            def Lean.Grind.CommRing.denoteSInt {α : Type u_1} [Semiring α] (k : Int) :
            α
            Equations
            Instances For
              theorem Lean.Grind.CommRing.Poly.denoteS_ofMon {α : Type u_1} [Semiring α] (ctx : Context α) (m : Mon) :
              denoteS ctx (ofMon m) = Mon.denote ctx m
              theorem Lean.Grind.CommRing.Poly.denoteS_ofVar {α : Type u_1} [Semiring α] (ctx : Context α) (x : Var) :
              denoteS ctx (ofVar x) = Var.denote ctx x
              theorem Lean.Grind.CommRing.Poly.denoteS_addConst {α : Type u_1} [Semiring α] (ctx : Context α) (p : Poly) (k : Int) :
              k ≥ 0 → p.NonnegCoeffs → denoteS ctx (p.addConst k) = denoteS ctx p + ↑k.toNat
              theorem Lean.Grind.CommRing.Poly.denoteS_insert {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (m : Mon) (p : Poly) :
              k ≥ 0 → p.NonnegCoeffs → denoteS ctx (insert k m p) = ↑k.toNat * Mon.denote ctx m + denoteS ctx p
              theorem Lean.Grind.CommRing.Poly.denoteS_concat {α : Type u_1} [Semiring α] (ctx : Context α) (p₁ p₂ : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → denoteS ctx (p₁.concat p₂) = denoteS ctx p₁ + denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_mulConst {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (p : Poly) :
              k ≥ 0 → p.NonnegCoeffs → denoteS ctx (mulConst k p) = ↑k.toNat * denoteS ctx p
              theorem Lean.Grind.CommRing.Poly.denoteS_combine {α : Type u_1} [Semiring α] (ctx : Context α) (p₁ p₂ : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → denoteS ctx (p₁.combine p₂) = denoteS ctx p₁ + denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_mulMon {α : Type u_1} [CommSemiring α] (ctx : Context α) (k : Int) (m : Mon) (p : Poly) :
              k ≥ 0 → p.NonnegCoeffs → denoteS ctx (mulMon k m p) = ↑k.toNat * Mon.denote ctx m * denoteS ctx p
              theorem Lean.Grind.CommRing.Poly.denoteS_mulMon_nc_go {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (m : Mon) (p acc : Poly) :
              k ≥ 0 → p.NonnegCoeffs → acc.NonnegCoeffs → denoteS ctx (mulMon_nc.go k m p acc) = ↑k.toNat * Mon.denote ctx m * denoteS ctx p + denoteS ctx acc
              theorem Lean.Grind.CommRing.Poly.denoteS_mulMon_nc {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (m : Mon) (p : Poly) :
              k ≥ 0 → p.NonnegCoeffs → denoteS ctx (mulMon_nc k m p) = ↑k.toNat * Mon.denote ctx m * denoteS ctx p
              theorem Lean.Grind.CommRing.Poly.mul_go_NonnegCoeffs (p₁ p₂ acc : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → acc.NonnegCoeffs → (mul.go p₂ p₁ acc).NonnegCoeffs
              theorem Lean.Grind.CommRing.Poly.denoteS_mul_go {α : Type u_1} [CommSemiring α] (ctx : Context α) (p₁ p₂ acc : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → acc.NonnegCoeffs → denoteS ctx (mul.go p₂ p₁ acc) = denoteS ctx acc + denoteS ctx p₁ * denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_mul {α : Type u_1} [CommSemiring α] (ctx : Context α) (p₁ p₂ : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → denoteS ctx (p₁.mul p₂) = denoteS ctx p₁ * denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_mul_nc_go {α : Type u_1} [Semiring α] (ctx : Context α) (p₁ p₂ acc : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → acc.NonnegCoeffs → denoteS ctx (mul_nc.go p₂ p₁ acc) = denoteS ctx acc + denoteS ctx p₁ * denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_mul_nc {α : Type u_1} [Semiring α] (ctx : Context α) (p₁ p₂ : Poly) :
              p₁.NonnegCoeffs → p₂.NonnegCoeffs → denoteS ctx (p₁.mul_nc p₂) = denoteS ctx p₁ * denoteS ctx p₂
              theorem Lean.Grind.CommRing.Poly.denoteS_pow {α : Type u_1} [CommSemiring α] (ctx : Context α) (p : Poly) (k : Nat) :
              p.NonnegCoeffs → denoteS ctx (p.pow k) = denoteS ctx p ^ k
              theorem Lean.Grind.CommRing.Poly.denoteS_pow_nc {α : Type u_1} [Semiring α] (ctx : Context α) (p : Poly) (k : Nat) :
              p.NonnegCoeffs → denoteS ctx (p.pow_nc k) = denoteS ctx p ^ k
              noncomputable def Lean.Grind.CommRing.eq_normS_cert (lhs rhs : Expr) :
              Equations
              Instances For
                theorem Lean.Grind.CommRing.eq_normS {α : Type u_1} [CommSemiring α] (ctx : Context α) (lhs rhs : Expr) :
                eq_normS_cert lhs rhs = true → Expr.denoteS ctx lhs = Expr.denoteS ctx rhs
                theorem Lean.Grind.CommRing.eq_normS_nc {α : Type u_1} [Semiring α] (ctx : Context α) (lhs rhs : Expr) :
                eq_normS_nc_cert lhs rhs = true → Expr.denoteS ctx lhs = Expr.denoteS ctx rhs

                Certificates that check the normal form of a commutative semiring term by definitional equality, as Expr.eq_of_toPolyX_eq_toExpr does for rings: the kernel computes the polynomial of the term once and renders it with Poly.toExpr_k, instead of normalizing both sides.

                theorem Lean.Grind.CommRing.Expr.denoteS_num_of_nonneg {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (h : k ≥ 0) :
                theorem Lean.Grind.CommRing.Power.denoteS_toExpr {α : Type u_1} [Semiring α] (ctx : Context α) (pw : Power) :
                Expr.denoteS ctx pw.toExpr = denote ctx pw
                theorem Lean.Grind.CommRing.Mon.denoteS_toExpr_go {α : Type u_1} [Semiring α] (ctx : Context α) (m : Mon) (acc : Expr) :
                Expr.denoteS ctx (toExpr.go m acc) = Expr.denoteS ctx acc * denote ctx m
                theorem Lean.Grind.CommRing.Mon.denoteS_toExpr {α : Type u_1} [Semiring α] (ctx : Context α) (m : Mon) :
                theorem Lean.Grind.CommRing.Poly.denoteS_toExpr_goTerm {α : Type u_1} [Semiring α] (ctx : Context α) (k : Int) (m : Mon) (h : k ≥ 0) :
                theorem Lean.Grind.CommRing.Poly.denoteS_toExpr_go {α : Type u_1} [Semiring α] (ctx : Context α) (p : Poly) (acc : Expr) (h : p.NonnegCoeffs) :
                Expr.denoteS ctx (toExpr.go p acc) = Expr.denoteS ctx acc + denoteS ctx p
                theorem Lean.Grind.CommRing.Poly.denoteS_toExpr {α : Type u_1} [Semiring α] (ctx : Context α) (p : Poly) (h : p.NonnegCoeffs) :
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Balanced polynomial normalization for commutative semiring certificates, like Expr.toPolyB_k for rings.

                  noncomputable def Lean.Grind.CommRing.Expr.powLeafSB_k (a : Expr) (k : Nat) (p : Poly) :

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

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

                    e.sumsSB_k acc prepends to acc the polynomials of the summands of e in a semiring.

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

                      Expr.toPolySB_k if bal, and Expr.toPolyS_k otherwise.

                      Equations
                      Instances For
                        def Lean.Grind.CommRing.Poly.denoteSList {α : Type u_1} [Semiring α] (ctx : Context α) :
                        List Poly → α

                        The sum of the semiring denotations of ps.

                        Equations
                        Instances For
                          theorem Lean.Grind.CommRing.Poly.combine_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) {a b : Poly} (ha : a.NonnegCoeffs) (hb : b.NonnegCoeffs) :
                          theorem Lean.Grind.CommRing.Poly.pairs_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) (ps : List Poly) (pend : Option Poly) (hps : NonnegList ps) (hpend : ∀ (p : Poly), pend = some p → p.NonnegCoeffs) :
                          NonnegList (pairs_k combine_k ps pend) ∧ denoteSList ctx (pairs_k combine_k ps pend) = Option.rec 0 (fun (p : Poly) => denoteS ctx p) pend + denoteSList ctx ps
                          theorem Lean.Grind.CommRing.Poly.sumGo_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) (fuel ps : List Poly) (hps : NonnegList ps) :
                          theorem Lean.Grind.CommRing.Poly.mulTerms_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) (p₁ p₂ : Poly) (h₁ : p₁.NonnegCoeffs) (h₂ : p₂.NonnegCoeffs) :
                          NonnegList (p₁.mulTerms_k p₂) ∧ denoteSList ctx (p₁.mulTerms_k p₂) = denoteS ctx p₁ * denoteS ctx p₂
                          theorem Lean.Grind.CommRing.Poly.mulB_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) {p₁ p₂ : Poly} (h₁ : p₁.NonnegCoeffs) (h₂ : p₂.NonnegCoeffs) :
                          (p₁.mulB_k p₂).NonnegCoeffs ∧ denoteS ctx (p₁.mulB_k p₂) = denoteS ctx p₁ * denoteS ctx p₂
                          theorem Lean.Grind.CommRing.Poly.powB_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) {p : Poly} (k : Nat) (h : p.NonnegCoeffs) :
                          (p.powB_k k).NonnegCoeffs ∧ denoteS ctx (p.powB_k k) = denoteS ctx p ^ k
                          theorem Lean.Grind.CommRing.Expr.powLeafSB_k_nonneg {α : Type u_1} [CommSemiring α] (ctx : Context α) (a : Expr) (k : Nat) {p : Poly} (hp : p.NonnegCoeffs) (h : Poly.denoteS ctx p = denoteS ctx a) :
                          theorem Lean.Grind.CommRing.Expr.eq_of_toPolyS_eq_toExpr {α : Type u_1} [CommSemiring α] (ctx : Context α) (bal : Bool) (a b : Expr) (p : Poly) (h₁ : p = toPolySX_k bal a) (h₂ : b = p.toExpr_k) :
                          denoteS ctx a = denoteS ctx b
                          theorem Lean.Grind.CommRing.Expr.eq_of_toPolyS_eq_add_toExpr {α : Type u_1} [CommSemiring α] (ctx : Context α) (bal : Bool) (a b : Expr) (p q r : Poly) (h₁ : p = toPolySX_k bal a) (h₂ : b = q.toExpr_k.add r.toExpr_k) (h₃ : p = q.combine_k r) (h₄ : (q.nonneg_k && r.nonneg_k) = true) :
                          denoteS ctx a = denoteS ctx b
                          theorem Lean.Grind.CommRing.Expr.eq_of_denoteS_eq_toExpr {α : Type u_1} [CommSemiring α] (ctx : Context α) (a b : Expr) (p : Poly) (h₁ : denoteS ctx a = Poly.denoteS ctx p ∧ p.NonnegCoeffs) (h₂ : b = p.toExpr_k) :
                          denoteS ctx a = denoteS ctx b
                          theorem Lean.Grind.CommRing.Expr.eq_of_denoteS_eq_add_toExpr {α : Type u_1} [CommSemiring α] (ctx : Context α) (a b : Expr) (p q r : Poly) (h₁ : denoteS ctx a = Poly.denoteS ctx p ∧ p.NonnegCoeffs) (h₂ : b = q.toExpr_k.add r.toExpr_k) (h₃ : p = q.combine_k r) (h₄ : (q.nonneg_k && r.nonneg_k) = true) :
                          denoteS ctx a = denoteS ctx b

                          Relations whose sides have the same polynomial in a commutative semiring.

                          theorem Lean.Grind.CommRing.eq_true_of_toPolyS {α : Type u_1} [CommSemiring α] (ctx : Context α) (bal₁ bal₂ : Bool) (lhs rhs : Expr) (p : Poly) (h₁ : p = Expr.toPolySX_k bal₁ lhs) (h₂ : p = Expr.toPolySX_k bal₂ rhs) :
                          (Expr.denoteS ctx lhs = Expr.denoteS ctx rhs) = True
                          theorem Lean.Grind.CommRing.le_true_of_toPolyS {α : Type u_1} [CommSemiring α] [LE α] [Std.IsPreorder α] (ctx : Context α) (bal₁ bal₂ : Bool) (lhs rhs : Expr) (p : Poly) (h₁ : p = Expr.toPolySX_k bal₁ lhs) (h₂ : p = Expr.toPolySX_k bal₂ rhs) :
                          (Expr.denoteS ctx lhs ≤ Expr.denoteS ctx rhs) = True
                          theorem Lean.Grind.CommRing.lt_false_of_toPolyS {α : Type u_1} [CommSemiring α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (ctx : Context α) (bal₁ bal₂ : Bool) (lhs rhs : Expr) (p : Poly) (h₁ : p = Expr.toPolySX_k bal₁ lhs) (h₂ : p = Expr.toPolySX_k bal₂ rhs) :
                          (Expr.denoteS ctx lhs < Expr.denoteS ctx rhs) = False

                          Stepwise certificates for large products in a commutative semiring, like Expr.denote_mul_of_terms.

                          theorem Lean.Grind.CommRing.Expr.denoteS_eq_of_toPolySX {α : Type u_1} [CommSemiring α] (ctx : Context α) (bal : Bool) (e : Expr) (p : Poly) (h : p = toPolySX_k bal e) :
                          theorem Lean.Grind.CommRing.Expr.denoteS_mul_of_terms {α : Type u_1} [CommSemiring α] (ctx : Context α) (a b : Expr) (pa pb : Poly) (ts : List Poly) (p : Poly) (ha : denoteS ctx a = Poly.denoteS ctx pa ∧ pa.NonnegCoeffs) (hb : denoteS ctx b = Poly.denoteS ctx pb ∧ pb.NonnegCoeffs) (ht : ts = pa.mulTerms_k pb) (hp : p = Poly.sumB_k Poly.combine_k ts) :
                          theorem Lean.Grind.CommRing.Expr.denoteS_add_of {α : Type u_1} [CommSemiring α] (ctx : Context α) (a b : Expr) (pa pb p : Poly) (ha : denoteS ctx a = Poly.denoteS ctx pa ∧ pa.NonnegCoeffs) (hb : denoteS ctx b = Poly.denoteS ctx pb ∧ pb.NonnegCoeffs) (hp : p = pa.combine_k pb) :
                          theorem Lean.Grind.CommRing.Expr.denoteS_pow_succ_of_terms {α : Type u_1} [CommSemiring α] (ctx : Context α) (a : Expr) (k : Nat) (pa q : Poly) (ts : List Poly) (p : Poly) (ha : denoteS ctx a = Poly.denoteS ctx pa ∧ pa.NonnegCoeffs) (hq : denoteS ctx (a.pow k) = Poly.denoteS ctx q ∧ q.NonnegCoeffs) (ht : ts = pa.mulTerms_k q) (hp : p = Poly.sumB_k Poly.combine_k ts) :
                          denoteS ctx (a.pow (k + 1)) = Poly.denoteS ctx p ∧ p.NonnegCoeffs
                          theorem Lean.Grind.CommRing.Expr.denoteS_pow_one_of {α : Type u_1} [CommSemiring α] (ctx : Context α) (a : Expr) (pa : Poly) (ha : denoteS ctx a = Poly.denoteS ctx pa ∧ pa.NonnegCoeffs) :
                          theorem Lean.Grind.CommRing.eq_true_of_denoteS_eq {α : Type u_1} [CommSemiring α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) (h₁ : Expr.denoteS ctx lhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) (h₂ : Expr.denoteS ctx rhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) :
                          (Expr.denoteS ctx lhs = Expr.denoteS ctx rhs) = True
                          theorem Lean.Grind.CommRing.le_true_of_denoteS_eq {α : Type u_1} [CommSemiring α] [LE α] [Std.IsPreorder α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) (h₁ : Expr.denoteS ctx lhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) (h₂ : Expr.denoteS ctx rhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) :
                          (Expr.denoteS ctx lhs ≤ Expr.denoteS ctx rhs) = True
                          theorem Lean.Grind.CommRing.lt_false_of_denoteS_eq {α : Type u_1} [CommSemiring α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) (h₁ : Expr.denoteS ctx lhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) (h₂ : Expr.denoteS ctx rhs = Poly.denoteS ctx p ∧ p.NonnegCoeffs) :
                          (Expr.denoteS ctx lhs < Expr.denoteS ctx rhs) = False