Documentation

Mathlib.Algebra.MonoidAlgebra.Defs

Monoid algebras #

When the domain of a Finsupp has a multiplicative or additive structure, we can define a convolution product. To mathematicians this structure is known as the "monoid algebra", i.e. the finite formal linear combinations over a given semiring of elements of the monoid. The "group ring" ℤ[G] or the "group algebra" k[G] are typical uses.

In fact the construction of the "monoid algebra" makes sense when G is not even a monoid, but merely a magma, i.e., when G carries a multiplication which is not required to satisfy any conditions at all. In this case the construction yields a not-necessarily-unital, not-necessarily-associative algebra but it is still adjoint to the forgetful functor from such algebras to magmas, and we prove this as MonoidAlgebra.liftMagma.

In this file we define MonoidAlgebra k G := G →₀ k, and AddMonoidAlgebra k G in the same way, and then define the convolution product on these.

When the domain is additive, this is used to define polynomials:

Polynomial R := AddMonoidAlgebra R ℕ
MvPolynomial σ α := AddMonoidAlgebra R (σ →₀ ℕ)

When the domain is multiplicative, e.g. a group, this will be used to define the group ring.

Notation #

We introduce the notation R[A] for AddMonoidAlgebra R A.

Implementation note #

Unfortunately because additive and multiplicative structures both appear in both cases, it doesn't appear to be possible to make much use of to_additive, and we just settle for saying everything twice.

Similarly, I attempted to just define k[G] := MonoidAlgebra k (Multiplicative G), but the definitional equality Multiplicative G = G leaks through everywhere, and seems impossible to use.

Multiplicative monoids #

def MonoidAlgebra (k : Type u₁) (G : Type u₂) [Semiring k] :
Type (max u₁ u₂)

The monoid algebra over a semiring k generated by the monoid G. It is the type of finite formal k-linear combinations of terms of G, endowed with the convolution product.

Equations
    Instances For
      instance MonoidAlgebra.inhabited (k : Type u₁) (G : Type u₂) [Semiring k] :
      Equations
        instance MonoidAlgebra.addCommMonoid (k : Type u₁) (G : Type u₂) [Semiring k] :
        Equations
          instance MonoidAlgebra.coeFun (k : Type u₁) (G : Type u₂) [Semiring k] :
          CoeFun (MonoidAlgebra k G) fun (x : MonoidAlgebra k G) => Gk
          Equations
            @[reducible, inline]
            abbrev MonoidAlgebra.single {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b : k) :

            MonoidAlgebra.single a r for a : M, r : R is the element ar : R[M].

            Equations
              Instances For
                theorem MonoidAlgebra.single_zero {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) :
                single a 0 = 0
                theorem MonoidAlgebra.single_add {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b₁ b₂ : k) :
                single a (b₁ + b₂) = single a b₁ + single a b₂
                theorem MonoidAlgebra.sum_single_index {k : Type u₁} {G : Type u₂} [Semiring k] {N : Type u_5} [AddCommMonoid N] {a : G} {b : k} {h : GkN} (h_zero : h a 0 = 0) :
                Finsupp.sum (single a b) h = h a b
                @[simp]
                theorem MonoidAlgebra.sum_single {k : Type u₁} {G : Type u₂} [Semiring k] (f : MonoidAlgebra k G) :
                theorem MonoidAlgebra.single_apply {k : Type u₁} {G : Type u₂} [Semiring k] {a a' : G} {b : k} [Decidable (a = a')] :
                (single a b) a' = if a = a' then b else 0
                @[simp]
                theorem MonoidAlgebra.single_eq_zero {k : Type u₁} {G : Type u₂} [Semiring k] {a : G} {b : k} :
                single a b = 0 b = 0
                theorem MonoidAlgebra.single_ne_zero {k : Type u₁} {G : Type u₂} [Semiring k] {a : G} {b : k} :
                single a b 0 b 0
                theorem MonoidAlgebra.induction_linear {k : Type u₁} {G : Type u₂} [Semiring k] {p : MonoidAlgebra k GProp} (f : MonoidAlgebra k G) (zero : p 0) (add : ∀ (f g : MonoidAlgebra k G), p fp gp (f + g)) (single : ∀ (a : G) (b : k), p (single a b)) :
                p f
                @[irreducible]
                def MonoidAlgebra.mul' {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (f g : MonoidAlgebra k G) :

                The multiplication in a monoid algebra. We make it irreducible so that Lean doesn't unfold it trying to unify two things that are different.

                Equations
                  Instances For
                    instance MonoidAlgebra.instMul {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] :

                    The product of f g : MonoidAlgebra k G is the finitely supported function whose value at a is the sum of f x * g y over all pairs x, y such that x * y = a. (Think of the group ring of a group.)

                    Equations
                      theorem MonoidAlgebra.mul_def {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] {f g : MonoidAlgebra k G} :
                      f * g = Finsupp.sum f fun (a₁ : G) (b₁ : k) => Finsupp.sum g fun (a₂ : G) (b₂ : k) => single (a₁ * a₂) (b₁ * b₂)
                      instance MonoidAlgebra.one {k : Type u₁} {G : Type u₂} [Semiring k] [One G] :

                      The unit of the multiplication is single 1 1, i.e. the function that is 1 at 1 and zero elsewhere.

                      Equations
                        theorem MonoidAlgebra.one_def {k : Type u₁} {G : Type u₂} [Semiring k] [One G] :
                        1 = single 1 1
                        theorem MonoidAlgebra.natCast_def {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] (n : ) :
                        n = single 1 n

                        Basic scalar multiplication instances #

                        This section collects instances needed for the algebraic structure of Polynomial, which is defined in terms of MonoidAlgebra. Further results on scalar multiplication can be found in Mathlib/Algebra/MonoidAlgebra/Module.lean.

                        instance MonoidAlgebra.smulZeroClass {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [SMulZeroClass R k] :
                        Equations
                          instance MonoidAlgebra.distribSMul {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [DistribSMul R k] :
                          Equations
                            instance MonoidAlgebra.isScalarTower {k : Type u₁} {G : Type u₂} {R : Type u_2} {S : Type u_5} [Semiring k] [SMulZeroClass R k] [SMulZeroClass S k] [SMul R S] [IsScalarTower R S k] :
                            instance MonoidAlgebra.smulCommClass {k : Type u₁} {G : Type u₂} {R : Type u_2} {S : Type u_5} [Semiring k] [SMulZeroClass R k] [SMulZeroClass S k] [SMulCommClass R S k] :

                            Semiring structure #

                            instance MonoidAlgebra.semiring {k : Type u₁} {G : Type u₂} [Semiring k] [Monoid G] :
                            Equations
                              @[simp]
                              theorem MonoidAlgebra.coe_add {G : Type u₂} {R : Type u_2} [Monoid G] [Semiring R] (f g : MonoidAlgebra R G) :
                              ⇑(f + g) = f + g

                              Derived instances #

                              Equations
                                instance MonoidAlgebra.unique {k : Type u₁} {G : Type u₂} [Semiring k] [Subsingleton k] :
                                Equations
                                  instance MonoidAlgebra.addCommGroup {k : Type u₁} {G : Type u₂} [Ring k] :
                                  Equations
                                    Equations
                                      instance MonoidAlgebra.nonUnitalRing {k : Type u₁} {G : Type u₂} [Ring k] [Semigroup G] :
                                      Equations
                                        instance MonoidAlgebra.nonAssocRing {k : Type u₁} {G : Type u₂} [Ring k] [MulOneClass G] :
                                        Equations
                                          theorem MonoidAlgebra.intCast_def {k : Type u₁} {G : Type u₂} [Ring k] [MulOneClass G] (z : ) :
                                          z = single 1 z
                                          instance MonoidAlgebra.ring {G : Type u₂} {R : Type u_2} [Ring R] [Monoid G] :
                                          Equations
                                            theorem MonoidAlgebra.single_neg {R : Type u_2} {M : Type u_4} [Ring R] (a : M) (b : R) :
                                            single a (-b) = -single a b
                                            @[simp]
                                            theorem MonoidAlgebra.neg_apply {R : Type u_2} {M : Type u_4} [Ring R] (m : M) (x : MonoidAlgebra R M) :
                                            (-x) m = -x m
                                            instance MonoidAlgebra.commRing {k : Type u₁} {G : Type u₂} [CommRing k] [CommMonoid G] :
                                            Equations
                                              @[simp]
                                              theorem MonoidAlgebra.smul_apply {R : Type u_2} {S : Type u_3} {M : Type u_4} [Semiring S] [SMulZeroClass R S] (r : R) (m : M) (x : MonoidAlgebra S M) :
                                              (r x) m = r x m
                                              @[simp]
                                              theorem MonoidAlgebra.smul_single {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [SMulZeroClass R k] (a : G) (c : R) (b : k) :
                                              c single a b = single a (c b)

                                              Copies of ext lemmas and bundled singles from Finsupp #

                                              As MonoidAlgebra is a type synonym, ext will not unfold it to find ext lemmas. We need bundled version of Finsupp.single with the right types to state these lemmas. It is good practice to have those, regardless of the ext issue.

                                              theorem MonoidAlgebra.ext {k : Type u₁} {G : Type u₂} [Semiring k] f g : MonoidAlgebra k G (H : ∀ (x : G), f x = g x) :
                                              f = g

                                              A copy of Finsupp.ext for MonoidAlgebra.

                                              theorem MonoidAlgebra.ext_iff {k : Type u₁} {G : Type u₂} [Semiring k] {f g : MonoidAlgebra k G} :
                                              f = g ∀ (x : G), f x = g x
                                              @[reducible, inline]
                                              abbrev MonoidAlgebra.singleAddHom {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) :

                                              A copy of Finsupp.singleAddHom for MonoidAlgebra.

                                              Equations
                                                Instances For
                                                  @[simp]
                                                  theorem MonoidAlgebra.singleAddHom_apply {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b : k) :
                                                  theorem MonoidAlgebra.addHom_ext' {k : Type u₁} {G : Type u₂} {N : Type u_5} [Semiring k] [AddZeroClass N] f g : MonoidAlgebra k G →+ N (H : ∀ (x : G), f.comp (singleAddHom x) = g.comp (singleAddHom x)) :
                                                  f = g

                                                  A copy of Finsupp.addHom_ext' for MonoidAlgebra.

                                                  theorem MonoidAlgebra.addHom_ext'_iff {k : Type u₁} {G : Type u₂} {N : Type u_5} [Semiring k] [AddZeroClass N] {f g : MonoidAlgebra k G →+ N} :
                                                  f = g ∀ (x : G), f.comp (singleAddHom x) = g.comp (singleAddHom x)
                                                  theorem MonoidAlgebra.mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [DecidableEq G] [Mul G] (f g : MonoidAlgebra k G) (x : G) :
                                                  (f * g) x = Finsupp.sum f fun (a₁ : G) (b₁ : k) => Finsupp.sum g fun (a₂ : G) (b₂ : k) => if a₁ * a₂ = x then b₁ * b₂ else 0
                                                  theorem MonoidAlgebra.mul_apply_antidiagonal {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (f g : MonoidAlgebra k G) (x : G) (s : Finset (G × G)) (hs : ∀ {p : G × G}, p s p.1 * p.2 = x) :
                                                  (f * g) x = ps, f p.1 * g p.2
                                                  @[simp]
                                                  theorem MonoidAlgebra.single_mul_single {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] {a₁ a₂ : G} {b₁ b₂ : k} :
                                                  single a₁ b₁ * single a₂ b₂ = single (a₁ * a₂) (b₁ * b₂)
                                                  theorem MonoidAlgebra.single_commute_single {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] {a₁ a₂ : G} {b₁ b₂ : k} (ha : Commute a₁ a₂) (hb : Commute b₁ b₂) :
                                                  Commute (single a₁ b₁) (single a₂ b₂)
                                                  theorem MonoidAlgebra.single_commute {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] {a : G} {b : k} (ha : ∀ (a' : G), Commute a a') (hb : ∀ (b' : k), Commute b b') (f : MonoidAlgebra k G) :
                                                  Commute (single a b) f
                                                  @[simp]
                                                  theorem MonoidAlgebra.single_pow {k : Type u₁} {G : Type u₂} [Semiring k] [Monoid G] {a : G} {b : k} (n : ) :
                                                  single a b ^ n = single (a ^ n) (b ^ n)
                                                  def MonoidAlgebra.ofMagma (k : Type u₁) (G : Type u₂) [Semiring k] [Mul G] :

                                                  The embedding of a magma into its magma algebra.

                                                  Equations
                                                    Instances For
                                                      @[simp]
                                                      theorem MonoidAlgebra.ofMagma_apply (k : Type u₁) (G : Type u₂) [Semiring k] [Mul G] (a : G) :
                                                      (ofMagma k G) a = single a 1
                                                      def MonoidAlgebra.of (k : Type u₁) (G : Type u₂) [Semiring k] [MulOneClass G] :

                                                      The embedding of a unital magma into its magma algebra.

                                                      Equations
                                                        Instances For
                                                          @[simp]
                                                          theorem MonoidAlgebra.of_apply (k : Type u₁) (G : Type u₂) [Semiring k] [MulOneClass G] (a : G) :
                                                          (of k G) a = single a 1
                                                          theorem MonoidAlgebra.of_commute {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] {a : G} (h : ∀ (a' : G), Commute a a') (f : MonoidAlgebra k G) :
                                                          Commute ((of k G) a) f
                                                          def MonoidAlgebra.singleHom {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] :

                                                          Finsupp.single as a MonoidHom from the product type into the monoid algebra.

                                                          Note the order of the elements of the product are reversed compared to the arguments of Finsupp.single.

                                                          Equations
                                                            Instances For
                                                              @[simp]
                                                              theorem MonoidAlgebra.singleHom_apply {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] (a : k × G) :
                                                              singleHom a = single a.2 a.1
                                                              theorem MonoidAlgebra.mul_single_apply_aux {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G} (H : af.support, a * x = z a = y) :
                                                              (f * single x r) z = f y * r
                                                              theorem MonoidAlgebra.mul_single_one_apply {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] (f : MonoidAlgebra k G) (r : k) (x : G) :
                                                              (f * single 1 r) x = f x * r
                                                              theorem MonoidAlgebra.mul_single_apply_of_not_exists_mul {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G) (h : ¬∃ (d : G), g' = d * g) :
                                                              (x * single g r) g' = 0
                                                              theorem MonoidAlgebra.single_mul_apply_aux {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G} (H : af.support, x * a = y a = z) :
                                                              (single x r * f) y = r * f z
                                                              theorem MonoidAlgebra.single_one_mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] (f : MonoidAlgebra k G) (r : k) (x : G) :
                                                              (single 1 r * f) x = r * f x
                                                              theorem MonoidAlgebra.single_mul_apply_of_not_exists_mul {k : Type u₁} {G : Type u₂} [Semiring k] [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G) (h : ¬∃ (d : G), g' = g * d) :
                                                              (single g r * x) g' = 0
                                                              theorem MonoidAlgebra.single_one_comm {k : Type u₁} {G : Type u₂} [CommSemiring k] [MulOneClass G] (r : k) (f : MonoidAlgebra k G) :
                                                              single 1 r * f = f * single 1 r

                                                              Finsupp.single 1 as a RingHom

                                                              Equations
                                                                Instances For
                                                                  @[simp]
                                                                  theorem MonoidAlgebra.singleOneRingHom_apply {k : Type u₁} {G : Type u₂} [Semiring k] [MulOneClass G] (b : k) :
                                                                  theorem MonoidAlgebra.ringHom_ext {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R} (h₁ : ∀ (b : k), f (single 1 b) = g (single 1 b)) (h_of : ∀ (a : G), f (single a 1) = g (single a 1)) :
                                                                  f = g

                                                                  If two ring homomorphisms from MonoidAlgebra k G are equal on all single a 1 and single 1 b, then they are equal.

                                                                  theorem MonoidAlgebra.ringHom_ext' {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R} (h₁ : f.comp singleOneRingHom = g.comp singleOneRingHom) (h_of : (↑f).comp (of k G) = (↑g).comp (of k G)) :
                                                                  f = g

                                                                  If two ring homomorphisms from MonoidAlgebra k G are equal on all single a 1 and single 1 b, then they are equal.

                                                                  See note [partially-applied ext lemmas].

                                                                  theorem MonoidAlgebra.ringHom_ext'_iff {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R} :
                                                                  f = g f.comp singleOneRingHom = g.comp singleOneRingHom (↑f).comp (of k G) = (↑g).comp (of k G)
                                                                  theorem MonoidAlgebra.induction_on {k : Type u₁} {G : Type u₂} [Semiring k] [Monoid G] {p : MonoidAlgebra k GProp} (f : MonoidAlgebra k G) (hM : ∀ (g : G), p ((of k G) g)) (hadd : ∀ (f g : MonoidAlgebra k G), p fp gp (f + g)) (hsmul : ∀ (r : k) (f : MonoidAlgebra k G), p fp (r f)) :
                                                                  p f
                                                                  theorem MonoidAlgebra.prod_single {k : Type u₁} {G : Type u₂} {ι : Type ui} [CommSemiring k] [CommMonoid G] {s : Finset ι} {a : ιG} {b : ιk} :
                                                                  is, single (a i) (b i) = single (∏ is, a i) (∏ is, b i)
                                                                  @[simp]
                                                                  theorem MonoidAlgebra.mul_single_apply {k : Type u₁} {G : Type u₂} [Semiring k] [Group G] (f : MonoidAlgebra k G) (r : k) (x y : G) :
                                                                  (f * single x r) y = f (y * x⁻¹) * r
                                                                  @[simp]
                                                                  theorem MonoidAlgebra.single_mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [Group G] (r : k) (x : G) (f : MonoidAlgebra k G) (y : G) :
                                                                  (single x r * f) y = r * f (x⁻¹ * y)
                                                                  theorem MonoidAlgebra.mul_apply_left {k : Type u₁} {G : Type u₂} [Semiring k] [Group G] (f g : MonoidAlgebra k G) (x : G) :
                                                                  (f * g) x = Finsupp.sum f fun (a : G) (b : k) => b * g (a⁻¹ * x)
                                                                  theorem MonoidAlgebra.mul_apply_right {k : Type u₁} {G : Type u₂} [Semiring k] [Group G] (f g : MonoidAlgebra k G) (x : G) :
                                                                  (f * g) x = Finsupp.sum g fun (a : G) (b : k) => f (x * a⁻¹) * b

                                                                  Additive monoids #

                                                                  def AddMonoidAlgebra (k : Type u₁) (G : Type u₂) [Semiring k] :
                                                                  Type (max u₂ u₁)

                                                                  The monoid algebra over a semiring k generated by the additive monoid G, denoted by k[G]. It is the type of finite formal k-linear combinations of terms of G, endowed with the convolution product.

                                                                  Equations
                                                                    Instances For

                                                                      The monoid algebra over a semiring k generated by the additive monoid G, denoted by k[G]. It is the type of finite formal k-linear combinations of terms of G, endowed with the convolution product.

                                                                      Equations
                                                                        Instances For
                                                                          instance AddMonoidAlgebra.inhabited (k : Type u₁) (G : Type u₂) [Semiring k] :
                                                                          Equations
                                                                            Equations
                                                                              instance AddMonoidAlgebra.coeFun (k : Type u₁) (G : Type u₂) [Semiring k] :
                                                                              CoeFun (AddMonoidAlgebra k G) fun (x : AddMonoidAlgebra k G) => Gk
                                                                              Equations
                                                                                @[reducible, inline]
                                                                                abbrev AddMonoidAlgebra.single {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b : k) :

                                                                                MonoidAlgebra.single a r for a : M, r : R is the element ar : R[M].

                                                                                Equations
                                                                                  Instances For
                                                                                    theorem AddMonoidAlgebra.single_zero {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) :
                                                                                    single a 0 = 0
                                                                                    theorem AddMonoidAlgebra.single_add {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b₁ b₂ : k) :
                                                                                    single a (b₁ + b₂) = single a b₁ + single a b₂
                                                                                    theorem AddMonoidAlgebra.sum_single_index {k : Type u₁} {G : Type u₂} [Semiring k] {N : Type u_5} [AddCommMonoid N] {a : G} {b : k} {h : GkN} (h_zero : h a 0 = 0) :
                                                                                    Finsupp.sum (single a b) h = h a b
                                                                                    @[simp]
                                                                                    theorem AddMonoidAlgebra.sum_single {k : Type u₁} {G : Type u₂} [Semiring k] (f : AddMonoidAlgebra k G) :
                                                                                    theorem AddMonoidAlgebra.single_apply {k : Type u₁} {G : Type u₂} [Semiring k] {a a' : G} {b : k} [Decidable (a = a')] :
                                                                                    (single a b) a' = if a = a' then b else 0
                                                                                    @[simp]
                                                                                    theorem AddMonoidAlgebra.single_eq_zero {k : Type u₁} {G : Type u₂} [Semiring k] {a : G} {b : k} :
                                                                                    single a b = 0 b = 0
                                                                                    theorem AddMonoidAlgebra.single_ne_zero {k : Type u₁} {G : Type u₂} [Semiring k] {a : G} {b : k} :
                                                                                    single a b 0 b 0
                                                                                    instance AddMonoidAlgebra.hasMul {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] :

                                                                                    The product of f g : k[G] is the finitely supported function whose value at a is the sum of f x * g y over all pairs x, y such that x + y = a. (Think of the product of multivariate polynomials where α is the additive monoid of monomial exponents.)

                                                                                    Equations
                                                                                      theorem AddMonoidAlgebra.mul_def {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] {f g : AddMonoidAlgebra k G} :
                                                                                      f * g = Finsupp.sum f fun (a₁ : G) (b₁ : k) => Finsupp.sum g fun (a₂ : G) (b₂ : k) => single (a₁ + a₂) (b₁ * b₂)
                                                                                      instance AddMonoidAlgebra.one {k : Type u₁} {G : Type u₂} [Semiring k] [Zero G] :

                                                                                      The unit of the multiplication is single 0 1, i.e. the function that is 1 at 0 and zero elsewhere.

                                                                                      Equations
                                                                                        theorem AddMonoidAlgebra.one_def {k : Type u₁} {G : Type u₂} [Semiring k] [Zero G] :
                                                                                        1 = single 0 1
                                                                                        theorem AddMonoidAlgebra.natCast_def {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] (n : ) :
                                                                                        n = single 0 n

                                                                                        Basic scalar multiplication instances #

                                                                                        The SMul section for MonoidAlgebra collects instances needed for the algebraic structure of Polynomial, which is defined in terms of MonoidAlgebra. This section mirrors the MonoidAlgebra section.

                                                                                        Further results on scalar multiplication can be found in Mathlib/Algebra/MonoidAlgebra/Module.lean.

                                                                                        instance AddMonoidAlgebra.smulZeroClass {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [SMulZeroClass R k] :
                                                                                        Equations
                                                                                          instance AddMonoidAlgebra.distribSMul {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [DistribSMul R k] :
                                                                                          Equations
                                                                                            instance AddMonoidAlgebra.isScalarTower {k : Type u₁} {G : Type u₂} {R : Type u_2} {S : Type u_5} [Semiring k] [SMulZeroClass R k] [SMulZeroClass S k] [SMul R S] [IsScalarTower R S k] :

                                                                                            Semiring structure #

                                                                                            instance AddMonoidAlgebra.semiring {k : Type u₁} {G : Type u₂} [Semiring k] [AddMonoid G] :
                                                                                            Equations
                                                                                              @[simp]
                                                                                              theorem AddMonoidAlgebra.coe_add {G : Type u₂} {R : Type u_2} [AddMonoid G] [Semiring R] (f g : AddMonoidAlgebra R G) :
                                                                                              ⇑(f + g) = f + g

                                                                                              Derived instances #

                                                                                              instance AddMonoidAlgebra.unique {k : Type u₁} {G : Type u₂} [Semiring k] [Subsingleton k] :
                                                                                              Equations
                                                                                                instance AddMonoidAlgebra.addCommGroup {k : Type u₁} {G : Type u₂} [Ring k] :
                                                                                                Equations
                                                                                                  Equations
                                                                                                    Equations
                                                                                                      theorem AddMonoidAlgebra.intCast_def {k : Type u₁} {G : Type u₂} [Ring k] [AddZeroClass G] (z : ) :
                                                                                                      z = single 0 z
                                                                                                      instance AddMonoidAlgebra.ring {G : Type u₂} {R : Type u_2} [Ring R] [AddMonoid G] :
                                                                                                      Equations
                                                                                                        theorem AddMonoidAlgebra.single_neg {R : Type u_2} {M : Type u_4} [Ring R] (a : M) (b : R) :
                                                                                                        single a (-b) = -single a b
                                                                                                        @[simp]
                                                                                                        theorem AddMonoidAlgebra.neg_apply {R : Type u_2} {M : Type u_4} [Ring R] (m : M) (x : MonoidAlgebra R M) :
                                                                                                        (-x) m = -x m
                                                                                                        instance AddMonoidAlgebra.commRing {k : Type u₁} {G : Type u₂} [CommRing k] [AddCommMonoid G] :
                                                                                                        Equations
                                                                                                          @[simp]
                                                                                                          theorem AddMonoidAlgebra.smul_apply {R : Type u_2} {S : Type u_3} {M : Type u_4} [Semiring S] [SMulZeroClass R S] (r : R) (m : M) (x : MonoidAlgebra S M) :
                                                                                                          (r x) m = r x m
                                                                                                          @[simp]
                                                                                                          theorem AddMonoidAlgebra.smul_single {k : Type u₁} {G : Type u₂} {R : Type u_2} [Semiring k] [SMulZeroClass R k] (a : G) (c : R) (b : k) :
                                                                                                          c single a b = single a (c b)

                                                                                                          Copies of ext lemmas and bundled singles from Finsupp #

                                                                                                          As AddMonoidAlgebra is a type synonym, ext will not unfold it to find ext lemmas. We need bundled version of Finsupp.single with the right types to state these lemmas. It is good practice to have those, regardless of the ext issue.

                                                                                                          theorem AddMonoidAlgebra.ext {k : Type u₁} {G : Type u₂} [Semiring k] f g : AddMonoidAlgebra k G (H : ∀ (x : G), f x = g x) :
                                                                                                          f = g

                                                                                                          A copy of Finsupp.ext for AddMonoidAlgebra.

                                                                                                          theorem AddMonoidAlgebra.ext_iff {k : Type u₁} {G : Type u₂} [Semiring k] {f g : AddMonoidAlgebra k G} :
                                                                                                          f = g ∀ (x : G), f x = g x
                                                                                                          @[reducible, inline]
                                                                                                          abbrev AddMonoidAlgebra.singleAddHom {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) :

                                                                                                          A copy of Finsupp.singleAddHom for AddMonoidAlgebra.

                                                                                                          Equations
                                                                                                            Instances For
                                                                                                              @[simp]
                                                                                                              theorem AddMonoidAlgebra.singleAddHom_apply {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) (b : k) :
                                                                                                              theorem AddMonoidAlgebra.addHom_ext' {k : Type u₁} {G : Type u₂} {N : Type u_5} [Semiring k] [AddZeroClass N] f g : AddMonoidAlgebra k G →+ N (H : ∀ (x : G), f.comp (singleAddHom x) = g.comp (singleAddHom x)) :
                                                                                                              f = g

                                                                                                              A copy of Finsupp.addHom_ext' for AddMonoidAlgebra.

                                                                                                              theorem AddMonoidAlgebra.addHom_ext'_iff {k : Type u₁} {G : Type u₂} {N : Type u_5} [Semiring k] [AddZeroClass N] {f g : AddMonoidAlgebra k G →+ N} :
                                                                                                              f = g ∀ (x : G), f.comp (singleAddHom x) = g.comp (singleAddHom x)
                                                                                                              theorem AddMonoidAlgebra.mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [DecidableEq G] [Add G] (f g : AddMonoidAlgebra k G) (x : G) :
                                                                                                              (f * g) x = Finsupp.sum f fun (a₁ : G) (b₁ : k) => Finsupp.sum g fun (a₂ : G) (b₂ : k) => if a₁ + a₂ = x then b₁ * b₂ else 0
                                                                                                              theorem AddMonoidAlgebra.mul_apply_antidiagonal {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] (f g : AddMonoidAlgebra k G) (x : G) (s : Finset (G × G)) (hs : ∀ {p : G × G}, p s p.1 + p.2 = x) :
                                                                                                              (f * g) x = ps, f p.1 * g p.2
                                                                                                              theorem AddMonoidAlgebra.single_mul_single {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] {a₁ a₂ : G} {b₁ b₂ : k} :
                                                                                                              single a₁ b₁ * single a₂ b₂ = single (a₁ + a₂) (b₁ * b₂)
                                                                                                              theorem AddMonoidAlgebra.single_commute_single {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] {a₁ a₂ : G} {b₁ b₂ : k} (ha : AddCommute a₁ a₂) (hb : Commute b₁ b₂) :
                                                                                                              Commute (single a₁ b₁) (single a₂ b₂)
                                                                                                              theorem AddMonoidAlgebra.single_pow {k : Type u₁} {G : Type u₂} [Semiring k] [AddMonoid G] {a : G} {b : k} (n : ) :
                                                                                                              single a b ^ n = single (n a) (b ^ n)

                                                                                                              The embedding of an additive magma into its additive magma algebra.

                                                                                                              Equations
                                                                                                                Instances For
                                                                                                                  @[simp]
                                                                                                                  theorem AddMonoidAlgebra.ofMagma_apply (k : Type u₁) (G : Type u₂) [Semiring k] [Add G] (a : Multiplicative G) :
                                                                                                                  (ofMagma k G) a = single a 1

                                                                                                                  Embedding of a magma with zero into its magma algebra.

                                                                                                                  Equations
                                                                                                                    Instances For
                                                                                                                      def AddMonoidAlgebra.of' (k : Type u₁) (G : Type u₂) [Semiring k] :

                                                                                                                      Embedding of a magma with zero G, into its magma algebra, having G as source.

                                                                                                                      Equations
                                                                                                                        Instances For
                                                                                                                          @[simp]
                                                                                                                          theorem AddMonoidAlgebra.of_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] (a : Multiplicative G) :
                                                                                                                          @[simp]
                                                                                                                          theorem AddMonoidAlgebra.of'_apply {k : Type u₁} {G : Type u₂} [Semiring k] (a : G) :
                                                                                                                          of' k G a = single a 1
                                                                                                                          theorem AddMonoidAlgebra.of'_eq_of {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] (a : G) :
                                                                                                                          of' k G a = (of k G) (Multiplicative.ofAdd a)
                                                                                                                          theorem AddMonoidAlgebra.of'_commute {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] {a : G} (h : ∀ (a' : G), AddCommute a a') (f : AddMonoidAlgebra k G) :
                                                                                                                          Commute (of' k G a) f

                                                                                                                          Finsupp.single as a MonoidHom from the product type into the additive monoid algebra.

                                                                                                                          Note the order of the elements of the product are reversed compared to the arguments of Finsupp.single.

                                                                                                                          Equations
                                                                                                                            Instances For
                                                                                                                              @[simp]
                                                                                                                              theorem AddMonoidAlgebra.smul_single' {k : Type u₁} {G : Type u₂} [Semiring k] (c : k) (a : G) (b : k) :
                                                                                                                              c single a b = single a (c * b)

                                                                                                                              Copy of Finsupp.smul_single' that avoids the AddMonoidAlgebra = Finsupp defeq abuse.

                                                                                                                              theorem AddMonoidAlgebra.mul_single_apply_aux {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] (f : AddMonoidAlgebra k G) (r : k) (x y z : G) (H : af.support, a + x = z a = y) :
                                                                                                                              (f * single x r) z = f y * r
                                                                                                                              theorem AddMonoidAlgebra.mul_single_zero_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] (f : AddMonoidAlgebra k G) (r : k) (x : G) :
                                                                                                                              (f * single 0 r) x = f x * r
                                                                                                                              theorem AddMonoidAlgebra.mul_single_apply_of_not_exists_add {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] (r : k) {g g' : G} (x : AddMonoidAlgebra k G) (h : ¬∃ (d : G), g' = d + g) :
                                                                                                                              (x * single g r) g' = 0
                                                                                                                              theorem AddMonoidAlgebra.single_mul_apply_aux {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] (f : AddMonoidAlgebra k G) (r : k) (x y z : G) (H : af.support, x + a = y a = z) :
                                                                                                                              (single x r * f) y = r * f z
                                                                                                                              theorem AddMonoidAlgebra.single_zero_mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddZeroClass G] (f : AddMonoidAlgebra k G) (r : k) (x : G) :
                                                                                                                              (single 0 r * f) x = r * f x
                                                                                                                              theorem AddMonoidAlgebra.single_mul_apply_of_not_exists_add {k : Type u₁} {G : Type u₂} [Semiring k] [Add G] (r : k) {g g' : G} (x : AddMonoidAlgebra k G) (h : ¬∃ (d : G), g' = g + d) :
                                                                                                                              (single g r * x) g' = 0
                                                                                                                              theorem AddMonoidAlgebra.mul_single_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddGroup G] (f : AddMonoidAlgebra k G) (r : k) (x y : G) :
                                                                                                                              (f * single x r) y = f (y - x) * r
                                                                                                                              theorem AddMonoidAlgebra.single_mul_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddGroup G] (r : k) (x : G) (f : AddMonoidAlgebra k G) (y : G) :
                                                                                                                              (single x r * f) y = r * f (-x + y)
                                                                                                                              theorem AddMonoidAlgebra.induction_on {k : Type u₁} {G : Type u₂} [Semiring k] [AddMonoid G] {p : AddMonoidAlgebra k GProp} (f : AddMonoidAlgebra k G) (hM : ∀ (g : G), p ((of k G) (Multiplicative.ofAdd g))) (hadd : ∀ (f g : AddMonoidAlgebra k G), p fp gp (f + g)) (hsmul : ∀ (r : k) (f : AddMonoidAlgebra k G), p fp (r f)) :
                                                                                                                              p f

                                                                                                                              Algebra structure #

                                                                                                                              Finsupp.single 0 as a RingHom

                                                                                                                              Equations
                                                                                                                                Instances For
                                                                                                                                  @[simp]
                                                                                                                                  theorem AddMonoidAlgebra.singleZeroRingHom_apply {k : Type u₁} {G : Type u₂} [Semiring k] [AddMonoid G] (b : k) :
                                                                                                                                  theorem AddMonoidAlgebra.ringHom_ext {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [AddMonoid G] [Semiring R] {f g : AddMonoidAlgebra k G →+* R} (h₀ : ∀ (b : k), f (single 0 b) = g (single 0 b)) (h_of : ∀ (a : G), f (single a 1) = g (single a 1)) :
                                                                                                                                  f = g

                                                                                                                                  If two ring homomorphisms from k[G] are equal on all single a 1 and single 0 b, then they are equal.

                                                                                                                                  theorem AddMonoidAlgebra.ringHom_ext' {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [AddMonoid G] [Semiring R] {f g : AddMonoidAlgebra k G →+* R} (h₁ : f.comp singleZeroRingHom = g.comp singleZeroRingHom) (h_of : (↑f).comp (of k G) = (↑g).comp (of k G)) :
                                                                                                                                  f = g

                                                                                                                                  If two ring homomorphisms from k[G] are equal on all single a 1 and single 0 b, then they are equal.

                                                                                                                                  See note [partially-applied ext lemmas].

                                                                                                                                  theorem AddMonoidAlgebra.ringHom_ext'_iff {k : Type u₁} {G : Type u₂} {R : Type u_5} [Semiring k] [AddMonoid G] [Semiring R] {f g : AddMonoidAlgebra k G →+* R} :
                                                                                                                                  f = g f.comp singleZeroRingHom = g.comp singleZeroRingHom (↑f).comp (of k G) = (↑g).comp (of k G)
                                                                                                                                  theorem AddMonoidAlgebra.prod_single {k : Type u₁} {G : Type u₂} {ι : Type ui} [CommSemiring k] [AddCommMonoid G] {s : Finset ι} {a : ιG} {b : ιk} :
                                                                                                                                  is, single (a i) (b i) = single (∑ is, a i) (∏ is, b i)