|
|
|
|
Quelle Defs.lean
Sprache: Lean
|
|
/-
Copyright (c) 2026 Bingyu Xia. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Bingyu Xia
-/
module
public import Mathlib.Algebra.BigOperators.Finsupp.Basic
public import Mathlib.Algebra.GroupWithZero.Action.Pi
public import Mathlib.Algebra.GroupWithZero.Action.TransferInstance
public import Mathlib.Algebra.Order.Antidiag.Prod
/-! # Total Monoid Algebras
This file mirrors the construction in `MonoidAlgebra/Defs.lean`, but drops the
finiteness condition on the support of the elements. In the literature,
this construction is called the "large algebra of a monoid" or "total algebra"
(see https://en.wikipedia.org/wiki/Total_algebra). When the underlying monoid is
finitely supported functions valued in `ℕ`, this construction corresponds to
the multivariate formal power series in the large sense, where arbitrary infinite sums of
monomials are permitted.
-/
@[expose] public noncomputable section
open Finset
variable {R M N O ι : Type*}
variable (R M) in
/-- The additive total monoid algebra over a semiring `R` generated by the additive monoid `M`.
It is the type of all formal `R`-linear combinations of terms of `M`,
endowed with the convolution product. -/
@[wikidata Q30704565]
structure TotalAddMonoidAlgebra [Semiring R] where
/-- Construct an element of the total additive monoid algebra `R⟦M⟧`
from its coefficients `M → R`. -/
ofCoeff ::
/-- The coefficients `M → R` of an element of the total additive monoid algebra `R⟦M⟧`. -/
coeff : M → R
variable (R M) in
/-- The total monoid algebra over a semiring `R` generated by the monoid `M`.
It is the type of all formal `R`-linear combinations of terms of `M`,
endowed with the convolution product. -/
@[to_additive (relevant_arg := M), to_additive_dont_translate, wikidata Q30704565]
structure TotalMonoidAlgebra [Semiring R] where
/-- Construct an element of the total monoid algebra `R⟦M⟧`
from its coefficients `M → R`. -/
ofCoeff ::
/-- The coefficients `M → R` of an element of the total monoid algebra `R⟦M⟧`. -/
coeff : M → R
initialize_simps_projections TotalAddMonoidAlgebra (as_prefix coeff)
initialize_simps_projections TotalMonoidAlgebra (as_prefix coeff)
namespace TotalAddMonoidAlgebra
open Lean.PrettyPrinter Delaborator
@[inherit_doc TotalAddMonoidAlgebra]
scoped syntax:max (priority := high) term noWs "⟦" term "⟧" : term
macro_rules | `($R⟦$M⟧) => `(TotalAddMonoidAlgebra $R $M)
/-- Unexpander for `TotalAddMonoidAlgebra`. -/
@[scoped app_unexpander TotalAddMonoidAlgebra]
meta def unexpander : Unexpander
| `($_ $R $M) => `($R⟦$M⟧)
| _ => throw ()
/-- This prevents `ofCoeff x` being printed as `{ coeff := x }` by `delabStructureInstance`. -/
@[app_delab ofCoeff] meta def delabOfCoeff : Delab := delabApp
end TotalAddMonoidAlgebra
namespace TotalMonoidAlgebra
section Notation
open Lean.PrettyPrinter Delaborator
/-- This prevents `ofCoeff x` being printed as `{ coeff := x }` by `delabStructureInstance`. -/
@[app_delab ofCoeff] meta def delabOfCoeff : Delab := delabApp
@[inherit_doc TotalMonoidAlgebra]
scoped syntax:max (priority := high) term noWs "⟦" term "⟧" : term
macro_rules | `($R⟦$M⟧) => `(TotalMonoidAlgebra $R $M)
/-- Unexpander for `TotalMonoidAlgebra`. -/
@[scoped app_unexpander TotalMonoidAlgebra]
meta def unexpander : Unexpander
| `($_ $R $M) => `($R⟦$M⟧)
| _ => throw ()
end Notation
section Semiring
variable [Semiring R] {x y : R⟦M⟧} {r r₁ r₂ : R} {m m' m₁ m₂ m₁' m₂' : M}
@[to_additive] lemma coeff_ofCoeff (x : M → R) : (ofCoeff x).coeff = x := rfl
@[to_additive] lemma ofCoeff_coeff (x : R⟦M⟧) : ofCoeff x.coeff = x := rfl
/-- `TotalMonoidAlgebra.coeff` as an equiv. -/
@[to_additive (attr := simps symm_apply)
/-- `TotalAddMonoidAlgebra.coeff` as an equiv. -/]
def coeffEquiv : R⟦M⟧ ≃ (M → R) where
toFun := coeff
invFun := ofCoeff
left_inv _ := rfl
right_inv _ := rfl
@[to_additive (attr := simp)]
lemma coeffEquiv_apply : coeffEquiv x = x.coeff := rfl
@[to_additive]
lemma «forall» {P : R⟦M⟧ → Prop} : (∀ p, P p) ↔ ∀ q, P (ofCoeff q) :=
coeffEquiv.forall_congr_left
@[to_additive]
lemma «exists» {P : R⟦M⟧ → Prop} : (∃ p, P p) ↔ ∃ q, P (ofCoeff q) :=
coeffEquiv.exists_congr_left
@[to_additive]
lemma coeff_injective : (coeff : R⟦M⟧ → M → R).Injective := coeffEquiv.injective
@[to_additive]
lemma ofCoeff_injective : (ofCoeff : (M → R) → R⟦M⟧).Injective :=
coeffEquiv.symm.injective
@[to_additive (attr := simp)]
lemma coeff_inj : x.coeff = y.coeff ↔ x = y := coeff_injective.eq_iff
@[to_additive]
lemma ofCoeff_inj {x y : M → R} : ofCoeff x = ofCoeff y ↔ x = y := ofCoeff_injective.eq_iff
@[to_additive (attr := ext)] alias ⟨ext, _⟩ := coeff_inj
@[to_additive]
instance instInhabited : Inhabited R⟦M⟧ := ⟨ofCoeff 0⟩
@[to_additive]
instance instNontrivial [Nontrivial R] [Nonempty M] : Nontrivial R⟦M⟧ := coeffEquiv.nontrivial
@[to_additive]
instance instUnique [Subsingleton R] : Unique R⟦M⟧ :=
⟨⟨ofCoeff 0⟩, fun x ↦ by cases x; rw [ofCoeff.injEq]; subsingleton⟩
@[to_additive instAddMonoid]
instance instAddMonoid : AddMonoid R⟦M⟧ := fast_instance% coeffEquiv.addMonoid
@[to_additive instAddCommMonoid]
instance instAddCommMonoid : AddCommMonoid R⟦M⟧ := fast_instance% coeffEquiv.addCommMonoid
@[to_additive]
instance instIsCancelAdd [IsCancelAdd R] : IsCancelAdd R⟦M⟧ :=
coeffEquiv.isCancelAdd
/-- `TotalMonoidAlgebra.coeff` as an `AddEquiv`. -/
@[to_additive (attr := simps! apply symm_apply)
/-- `TotalAddMonoidAlgebra.coeff` as an `AddEquiv`. -/]
def coeffAddEquiv : R⟦M⟧ ≃+ (M → R) := coeffEquiv.addEquiv
@[to_additive (attr := simp)] lemma coeff_zero : coeff (0 : R⟦M⟧) = 0 := rfl
@[to_additive (attr := simp)] lemma ofCoeff_zero : (ofCoeff 0 : R⟦M⟧) = 0 := rfl
@[to_additive (attr := simp)] lemma coeff_eq_zero : coeff x = 0 ↔ x = 0 := coeff_inj
@[to_additive (attr := simp)] lemma ofCoeff_eq_zero {x : M → R} : ofCoeff x = 0 ↔ x = 0 :=
ofCoeff_inj
@[to_additive (attr := simp)]
lemma coeff_add (x y : R⟦M⟧) : coeff (x + y) = coeff x + coeff y := rfl
@[to_additive (attr := simp)]
lemma ofCoeff_add (x y : M → R) : ofCoeff (x + y) = ofCoeff x + ofCoeff y := rfl
@[to_additive (attr := simp)]
lemma coeff_sum (s : Finset ι) (f : ι → R⟦M⟧) :
coeff (∑ i ∈ s, f i) = ∑ i ∈ s, coeff (f i) := map_sum coeffAddEquiv ..
@[to_additive (attr := simp)]
lemma ofCoeff_sum (s : Finset ι) (f : ι → M → R) :
ofCoeff (∑ i ∈ s, f i) = ∑ i ∈ s, ofCoeff (f i) := map_sum coeffAddEquiv.symm ..
@[to_additive (attr := simp)]
lemma coeff_finsuppSum [AddCommMonoid N] (f : ι →₀ N) (g : ι → N → R⟦M⟧) :
coeff (f.sum g) = f.sum (fun i n ↦ coeff (g i n)) := map_finsuppSum coeffAddEquiv ..
@[to_additive (attr := simp)]
lemma ofCoeff_finsuppSum [AddCommMonoid N] (f : ι →₀ N) (g : ι → N → M → R) :
ofCoeff (f.sum g) = f.sum (fun i n ↦ ofCoeff (g i n)) := map_finsuppSum coeffAddEquiv.symm ..
/-- `TotalMonoidAlgebra.single m r` for `m : M`, `r : R` is the element `rm : R⟦M⟧`. -/
@[to_additive
/-- `TotalAddMonoidAlgebra.single m r` for `m : M`, `r : R` is the element `rm : R⟦M⟧`. -/]
def single [DecidableEq M] (m : M) (r : R) : R⟦M⟧ := .ofCoeff <| Pi.single m r
@[to_additive (attr := simp)]
lemma coeff_single (m : M) (r : R) [DecidableEq M] : (single m r).coeff = Pi.single m r := rfl
@[to_additive (attr := simp)]
lemma ofCoeff_single (m : M) (r : R) [DecidableEq M] : ofCoeff (Pi.single m r) = single m r := rfl
@[to_additive]
lemma single_inj [DecidableEq M] :
single m₁ r₁ = single m₂ r₂ ↔ m₁ = m₂ ∧ r₁ = r₂ ∨ r₁ = 0 ∧ r₂ = 0 := by
simp [← coeff_inj, Pi.single_eq_single_iff]
@[to_additive]
lemma single_left_inj [DecidableEq M] (hr : r ≠ 0) : single m₁ r = single m₂ r ↔ m₁ = m₂ := by
simp [single_inj, hr]
@[to_additive (attr := simp)]
lemma single_right_inj [DecidableEq M] : single m r₁ = single m r₂ ↔ r₁ = r₂ := by
simp +contextual [single_inj]
/-- `TotalMonoidAlgebra.single m r` is injective in `m` if `r ≠ 0`. For injectivity in `r`, see
`TotalMonoidAlgebra.single_right_injective`. -/
@[to_additive
/-- `TotalAddMonoidAlgebra.single m r` is injective in `m` if `r ≠ 0`. For injectivity in `r`, see
`TotalAddMonoidAlgebra.single_right_injective`.-/]
lemma single_left_injective [DecidableEq M] (hr : r ≠ 0) :
Function.Injective fun m : M ↦ single m r :=
fun _ _ ↦ (single_left_inj hr).1
@[to_additive]
lemma single_right_injective [DecidableEq M] : (single m : R → R⟦M⟧).Injective :=
fun _ _ ↦ single_right_inj.1
/-- Replace the `m`-th coefficient of an element `x` of the total monoid algebra
by a given value `r : R`. -/
@[to_additive
/-- Replace the `m`-th coefficient of an element `x` of the total additive monoid algebra
by a given value `r : R`.
-/]
def update [DecidableEq M] (m : M) (r : R) (x : R⟦M⟧) : R⟦M⟧ :=
ofCoeff (Function.update x.coeff m r)
@[to_additive (attr := simp)]
lemma coeff_update [DecidableEq M] (m : M) (r : R) (x : R⟦M⟧) :
(x.update m r).coeff = Function.update x.coeff m r := rfl
@[to_additive (attr := simp)]
lemma ofCoeff_update [DecidableEq M] (m : M) (r : R) (x : M → R) :
ofCoeff (Function.update x m r) = (ofCoeff x).update m r := rfl
section SMul
variable {A : Type*} [SMulZeroClass A R]
@[to_additive (dont_translate := A) smulZeroClass]
instance smulZeroClass : SMulZeroClass A R⟦M⟧ :=
fast_instance% coeffEquiv.smulZeroClass _ coeff_zero
section
-- Ensure that the different smul instances do not create a diamond.
example : (smulZeroClass (A := ℕ) (R := R) (M := M)).smul = instAddCommMonoid.nsmul := by
with_reducible_and_instances rfl
-- Ensure that smul has good defeq properties
private local instance {α} [Monoid M] [SMul M α] : SMul Mˣ α where smul m a := (m : M) • a
example [Monoid A] (a : Units A) (x : R⟦M⟧) :
a • x = (a : A) • x := by
with_reducible_and_instances rfl
end
@[to_additive (attr := simp) (dont_translate := A) coeff_smul]
lemma coeff_smul (a : A) (x : R⟦M⟧) : coeff (a • x) = a • coeff x := rfl
@[to_additive (attr := simp) (dont_translate := A) ofCoeff_smul]
lemma ofCoeff_smul (a : A) (x : M → R) : ofCoeff (a • x) = a • ofCoeff x := rfl
@[to_additive (dont_translate := A) coeff_smul_apply]
lemma coeff_smul_apply (a : A) (x : R⟦M⟧) (m : M) : coeff (a • x) m = a • coeff x m := rfl
@[to_additive (attr := simp) (dont_translate := A) smul_single]
lemma smul_single [DecidableEq M] (a : A) (m : M) (r : R) :
a • single m r = single m (a • r) := by
ext; simp [Pi.single_apply]
@[to_additive (dont_translate := R) smul_single']
lemma smul_single' [DecidableEq M] (r' : R) (m : M) (r : R) :
r' • single m r = single m (r' * r) := smul_single ..
@[to_additive (dont_translate := N) distribSMul]
instance distribSMul [DistribSMul N R] : DistribSMul N R⟦M⟧ :=
fast_instance% coeffAddEquiv.distribSMul _
@[to_additive (dont_translate := N) isScalarTower]
instance isScalarTower [SMulZeroClass N R] [SMulZeroClass O R] [SMul N O] [IsScalarTower N O R] :
IsScalarTower N O R⟦M⟧ := coeffEquiv.isScalarTower ..
@[to_additive (dont_translate := N) smulCommClass]
instance smulCommClass [SMulZeroClass N R] [SMulZeroClass O R] [SMulCommClass N O R] :
SMulCommClass N O R⟦M⟧ := coeffEquiv.smulCommClass ..
@[to_additive (dont_translate := N) isCentralScalar]
instance isCentralScalar [SMulZeroClass N R] [SMulZeroClass Nᵐᵒᵖ R] [IsCentralScalar N R] :
IsCentralScalar N R⟦M⟧ := coeffEquiv.isCentralScalar _
end SMul
@[to_additive (attr := simp)]
lemma single_zero [DecidableEq M] (m : M) : (single m 0 : R⟦M⟧) = 0 := by ext; simp
@[to_additive (attr := simp)]
lemma single_add [DecidableEq M] (m : M) (r₁ r₂ : R) :
single m (r₁ + r₂) = single m r₁ + single m r₂ := by
ext; simp [Pi.single_add]
/-- `TotalMonoidAlgebra.single` as an `AddMonoidHom`. -/
@[to_additive (attr := simps)
/-- `TotalAddMonoidAlgebra.single` as an `AddMonoidHom`. -/]
def singleAddMonoidHom [DecidableEq M] (m : M) : R →+ R⟦M⟧ where
toFun := single m
map_zero' := single_zero _
map_add' := single_add _
@[to_additive]
theorem coeff_single_apply [DecidableEq M] {a a' : M} {b : R} :
(single a b).coeff a' = if a = a' then b else 0 := by simp [Pi.single_apply, eq_comm]
@[to_additive (attr := simp)]
lemma single_eq_zero [DecidableEq M] : single m r = 0 ↔ r = 0 := by simp [← coeff_inj]
@[to_additive] lemma single_ne_zero [DecidableEq M] : single m r ≠ 0 ↔ r ≠ 0 := single_eq_zero.not
section One
variable [One M]
/-- The unit of the multiplication is `single 1 1`,
i.e. the function that is `1` at `1` and `0` elsewhere. -/
@[to_additive (dont_translate := R)
/-- The unit of the multiplication is `single 0 1`,
i.e. the function that is `1` at `0` and `0` elsewhere. -/]
instance one [DecidableEq M] : One R⟦M⟧ where one := single 1 1
@[to_additive (dont_translate := R) one_def]
lemma one_def [DecidableEq M] : (1 : R⟦M⟧) = single 1 1 := rfl
@[to_additive (attr := simp) (dont_translate := R) coeff_one_zero]
lemma coeff_one_one [DecidableEq M] : (1 : R⟦M⟧).coeff 1 = 1 := by simp [one_def]
end One
section Mul
/-! ### The multiplication in a total monoid algebra.
Unlike `MonoidAlgebra` which is based on finitely supported functions, `TotalMonoidAlgebra` allows
elements with infinite support. Consequently, to ensure that the convolution product is
well-defined (i.e., the coefficient sum is finite), we require the underlying monoid `M` to
satisfy the `Finset.HasMulAntidiagonal` condition. This guarantees that
for any element `z : M`, there are only finitely many pairs `(x, y)` such that `x * y = z`.
-/
variable [Mul M] [HasMulAntidiagonal M]
/-- The product of `x y : R⟦M⟧` is the function whose value at `m` is the sum of `x m₁ * y m₂`
over all pairs `m₁, m₂` such that `m₁ * m₂ = m`. -/
@[to_additive (dont_translate := R) instMul
/-- The product of `x y : R⟦M⟧` is the function whose value at `m` is the sum of `x m₁ * y m₂`
over all pairs `m₁, m₂` such that `m₁ + m₂ = m`. -/]
instance instMul : Mul R⟦M⟧ where
mul x y := private .ofCoeff fun z ↦ ∑ i ∈ mulAntidiagonal z, x.coeff i.1 * y.coeff i.2
@[to_additive (dont_translate := R) mul_def]
lemma mul_def (x y : R⟦M⟧) : x * y =
.ofCoeff fun z ↦ ∑ p ∈ mulAntidiagonal z, x.coeff p.1 * y.coeff p.2 := by
with_unfolding_all rfl
@[to_additive (dont_translate := R) coeff_mul]
lemma coeff_mul (x y : R⟦M⟧) (m : M) : (x * y).coeff m =
∑ p ∈ mulAntidiagonal m, x.coeff p.1 * y.coeff p.2 := by simp [mul_def]
@[to_additive (dont_translate := R)]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring R⟦M⟧ where
zero_mul _ := by ext; simp [mul_def]
mul_zero _ := by ext; simp [mul_def]
left_distrib _ _ _ := by ext; simp [mul_def, mul_add, sum_add_distrib]
right_distrib _ _ _ := by ext; simp [mul_def, add_mul, sum_add_distrib]
@[to_additive (attr := simp) (dont_translate := R) single_mul_single]
lemma single_mul_single [DecidableEq M] (m₁ m₂ : M) (r₁ r₂ : R) :
single m₁ r₁ * single m₂ r₂ = single (m₁ * m₂) (r₁ * r₂) := by
ext m
suffices {x ∈ {x ∈ mulAntidiagonal m | x.2 = m₂} | x.1 = m₁} =
if m = m₁ * m₂ then {(m₁, m₂)} else ∅ by
simp [coeff_mul, Pi.single_apply, sum_ite, this, apply_ite]; grind
ext; simp; grind
@[to_additive (attr := simp) (dont_translate := R) single_commute_single]
lemma single_commute_single [DecidableEq M] (hm : Commute m₁ m₂) (hr : Commute r₁ r₂) :
Commute (single m₁ r₁) (single m₂ r₂) := by simp [commute_iff_eq, hm.eq, hr.eq]
@[to_additive (attr := simp) (dont_translate := R) single_commute]
lemma single_commute [DecidableEq M] (hm : ∀ m', Commute m m') (hr : ∀ r', Commute r r')
(x : R⟦M⟧) : Commute (single m r) x := by
ext m'; simp_rw [commute_iff_eq] at hm hr
suffices ∑ p ∈ mulAntidiagonal m' with p.1 = m, r * x.coeff p.2 =
∑ p ∈ mulAntidiagonal m' with p.2 = m, x.coeff p.1 * r by
simpa [coeff_mul, Pi.single_apply, sum_ite]
refine sum_bij (fun p _ ↦ p.swap) ?_ ?_ ?_ ?_
all_goals intros; simp_all
all_goals grind
@[to_additive (dont_translate := R) coeff_mul_single_eq_coeff_mul]
lemma coeff_mul_single_eq_coeff_mul [DecidableEq M] (m₂ : M) (H : ∀ m', m' * m = m₁ ↔ m' = m₂) :
(x * single m r).coeff m₁ = x.coeff m₂ * r := by
suffices {x ∈ mulAntidiagonal m₁ | x.2 = m} = {(m₂, m)} by
simp [coeff_mul, Pi.single_apply, sum_ite, this]
ext; simp; grind
@[to_additive (dont_translate := R) coeff_single_mul_eq_mul_coeff]
lemma coeff_single_mul_eq_mul_coeff [DecidableEq M] (m₂ : M) (H : ∀ m', m * m' = m₁ ↔ m' = m₂) :
(single m r * x).coeff m₁ = r * x.coeff m₂ := by
suffices {x ∈ mulAntidiagonal m₁ | x.1 = m} = {(m, m₂)} by
simp [coeff_mul, Pi.single_apply, sum_ite, this]
ext; simp; grind
@[to_additive (attr := simp) (dont_translate := R) coeff_mul_single_of_forall_add_ne]
lemma coeff_mul_single_of_forall_mul_ne [DecidableEq M] (r : R) (x : R⟦M⟧) (h : ∀ d, d * m ≠ m') :
(x * single m r).coeff m' = 0 := by
suffices {x ∈ mulAntidiagonal m' | x.2 = m} = ∅ by
simp [coeff_mul, Pi.single_apply, sum_ite, this]
ext; simp; grind
@[to_additive (attr := simp) (dont_translate := R) coeff_single_mul_of_forall_add_ne]
lemma coeff_single_mul_of_forall_mul_ne [DecidableEq M] (r : R) (x : R⟦M⟧) (h : ∀ d, m * d ≠ m') :
(single m r * x).coeff m' = 0 := by
suffices {x ∈ mulAntidiagonal m' | x.1 = m} = ∅ by
simp [coeff_mul, Pi.single_apply, sum_ite, this]
ext; simp; grind
/-- The embedding of a magma into its total magma algebra. -/
@[simps]
def ofMagma (R M : Type*) [Semiring R] [Mul M] [HasMulAntidiagonal M]
[DecidableEq M] : M →ₙ* R⟦M⟧ where
toFun a := single a 1
map_mul' a b := by ext; simp
end Mul
section Semigroup
variable [Semigroup M] [HasMulAntidiagonal M]
@[to_additive (dont_translate := R)]
instance nonUnitalSemiring : NonUnitalSemiring R⟦M⟧ where
mul_assoc _ _ _ := by
ext; simp_rw [mul_def, sum_mul, mul_sum, sum_sigma']
refine sum_bij (fun p _ ↦ ⟨(p.snd.1, p.snd.2 * p.fst.2), (p.snd.2, p.fst.2)⟩) ?_ ?_ ?_ ?_
all_goals intros; simp_all; grind
end Semigroup
section MulOneClass
variable [MulOneClass M] [HasMulAntidiagonal M]
@[to_additive (dont_translate := R)]
instance nonAssocSemiring [DecidableEq M] : NonAssocSemiring R⟦M⟧ where
natCast n := single 1 n
natCast_zero := by simp
natCast_succ := by simp [one_def]
one_mul _ := by
ext m; suffices {x ∈ mulAntidiagonal m | x.1 = 1} = {(1, m)} by
simp [mul_def, one_def, Pi.single_apply, sum_ite, this]
ext; simp; aesop
mul_one _ := by
ext m; suffices {x ∈ mulAntidiagonal m | x.2 = 1} = {(m, 1)} by
simp [mul_def, one_def, Pi.single_apply, sum_ite, this]
ext; simp; aesop
@[to_additive (dont_translate := R)]
lemma natCast_def [DecidableEq M] (n : ℕ) : (n : R⟦M⟧) = single 1 (n : R) := rfl
@[to_additive (dont_translate := R)]
lemma ofNat_def [DecidableEq M] (n : ℕ) [n.AtLeastTwo] :
(ofNat(n) : R⟦M⟧) = single 1 ofNat(n) := rfl
@[to_additive (dont_translate := R) (attr := simp)]
lemma coeff_natCast [DecidableEq M] (n : ℕ) : (n : R⟦M⟧).coeff = Pi.single 1 (n : R) := rfl
@[to_additive (dont_translate := R) (attr := simp)]
lemma coeff_ofNat [DecidableEq M] (n : ℕ) [n.AtLeastTwo] :
(ofNat(n) : R⟦M⟧).coeff = Pi.single 1 ofNat(n) := rfl
@[to_additive (dont_translate := R) coeff_mul_single_zero]
lemma coeff_mul_single_one [DecidableEq M] (x : R⟦M⟧) (r : R) (m : M) :
(x * single 1 r).coeff m = x.coeff m * r :=
coeff_mul_single_eq_coeff_mul _ (by simp)
@[to_additive (dont_translate := R) coeff_single_zero_mul]
lemma coeff_single_one_mul [DecidableEq M] (x : R⟦M⟧) (r : R) (m : M) :
(single 1 r * x).coeff m = r * x.coeff m :=
x.coeff_single_mul_eq_mul_coeff _ (by simp)
@[to_additive (dont_translate := R) coeff_mul_natCast]
lemma coeff_mul_natCast [DecidableEq M] (x : R⟦M⟧) (n : ℕ) (m : M) :
(x * n).coeff m = x.coeff m * n := coeff_mul_single_one ..
@[to_additive (dont_translate := R) coeff_natCast_mul]
lemma coeff_natCast_mul [DecidableEq M] (x : R⟦M⟧) (n : ℕ) (m : M) :
(n * x).coeff m = n * x.coeff m := coeff_single_one_mul ..
@[to_additive (dont_translate := R) coeff_mul_ofNat]
lemma coeff_mul_ofNat [DecidableEq M] (x : R⟦M⟧) (n : ℕ) [n.AtLeastTwo] (m : M) :
(x * ofNat(n)).coeff m = x.coeff m * ofNat(n) := coeff_mul_single_one ..
@[to_additive (dont_translate := R) coeff_ofNat_mul]
lemma coeff_ofNat_mul [DecidableEq M] (x : R⟦M⟧) (n : ℕ) [n.AtLeastTwo] (m : M) :
(ofNat(n) * x).coeff m = ofNat(n) * x.coeff m := coeff_single_one_mul ..
/-- The embedding of a unital magma into its total magma algebra. -/
@[simps! apply]
def of (R M : Type*) [Semiring R] [MulOneClass M] [HasMulAntidiagonal M]
[DecidableEq M] : M →* R⟦M⟧ where
__ := ofMagma R M
map_one' := rfl
lemma of_injective [DecidableEq M] [Nontrivial R] : Function.Injective (of R M) := fun a b h ↦ by
simpa [← coeff_inj, Pi.single_eq_single_iff] using h
lemma of_commute [DecidableEq M] (h : ∀ m', Commute m m') (f : R⟦M⟧) : Commute (of R M m) f :=
single_commute h .one_left f
/-- `TotalMonoidAlgebra.single` as a `MonoidHom` from the product type into
the total monoid algebra.
Note the order of the elements of the product are reversed compared to the arguments of
`TotalMonoidAlgebra.single`. -/
@[simps]
def singleHom [DecidableEq M] : R × M →* R⟦M⟧ where
toFun a := single a.2 a.1
map_one' := rfl
map_mul' := by simp
/-- `TotalMonoidAlgebra.single 1` as a `RingHom` -/
@[to_additive (attr := simps) (dont_translate := R)
/-- `TotalAddMonoidAlgebra.single 1` as a `RingHom` -/]
def singleOneRingHom [DecidableEq M] : R →+* R⟦M⟧ where
__ := singleAddMonoidHom 1
map_one' := rfl
map_mul' _ _ := by simp
end MulOneClass
section Monoid
variable [Monoid M] [HasMulAntidiagonal M]
@[to_additive (dont_translate := R)]
instance semiring [DecidableEq M] : Semiring R⟦M⟧ where
@[to_additive (attr := simp) (dont_translate := R) single_pow]
lemma single_pow [DecidableEq M] (m : M) (r : R) : ∀ n : ℕ, single m r ^ n = single (m ^ n) (r ^ n)
| 0 => by simp [one_def]
| n + 1 => by simp [pow_succ, single_pow _ _ n]
end Monoid
end Semiring
end TotalMonoidAlgebra
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|