doc-next-gen

Mathlib.Data.Finsupp.SMul

Module docstring

{"# Declarations about scalar multiplication on Finsupp

Implementation notes

This file is a noncomputable theory and uses classical logic throughout.

","Throughout this section, some Monoid and Semiring arguments are specified with {} instead of []. See note [implicit instance arguments]. "}

Finsupp.single_smul theorem
(a b : α) (f : α → M) (r : R) : single a r b • f a = single a (r • f b) b
Full source
@[simp]
theorem single_smul (a b : α) (f : α → M) (r : R) : single a r b • f a = single a (r • f b) b := by
  by_cases h : a = b <;> simp [h]
Scalar Multiplication Property of Single-Point Finitely Supported Functions
Informal description
Let $R$ be a scalar multiplication structure, $\alpha$ a type, and $M$ a type with a zero element. For any elements $a, b \in \alpha$, any function $f : \alpha \to M$, and any scalar $r \in R$, the scalar multiplication of the finitely supported function $\text{single}(a, r)$ evaluated at $b$ with $f(a)$ equals the finitely supported function $\text{single}(a, r \cdot f(b))$ evaluated at $b$. In other words: $$(\text{single}(a, r))(b) \cdot f(a) = (\text{single}(a, r \cdot f(b)))(b)$$
Finsupp.comapSMul definition
: SMul G (α →₀ M)
Full source
/-- Scalar multiplication acting on the domain.

This is not an instance as it would conflict with the action on the range.
See the `instance_diamonds` test for examples of such conflicts. -/
def comapSMul : SMul G (α →₀ M) where smul g := mapDomain (g • ·)
Scalar multiplication on finitely supported functions via domain action
Informal description
The scalar multiplication structure on finitely supported functions `α →₀ M` induced by a scalar multiplication structure on `α`. Specifically, for any scalar `g` in `G` and any finitely supported function `f : α →₀ M`, the scalar multiplication `g • f` is defined as the finitely supported function obtained by mapping the domain of `f` under the action of `g` on `α`, i.e., `mapDomain (g • ·) f`.
Finsupp.comapSMul_def theorem
(g : G) (f : α →₀ M) : g • f = mapDomain (g • ·) f
Full source
theorem comapSMul_def (g : G) (f : α →₀ M) : g • f = mapDomain (g • ·) f :=
  rfl
Definition of Scalar Multiplication on Finitely Supported Functions via Domain Action
Informal description
For any scalar $g \in G$ and any finitely supported function $f \colon \alpha \to_{\text{f}} M$, the scalar multiplication $g \cdot f$ is equal to the finitely supported function obtained by mapping the domain of $f$ via the action of $g$ on $\alpha$, i.e., $\text{mapDomain}\, (g \cdot \cdot)\, f$.
Finsupp.comapSMul_single theorem
(g : G) (a : α) (b : M) : g • single a b = single (g • a) b
Full source
@[simp]
theorem comapSMul_single (g : G) (a : α) (b : M) : g • single a b = single (g • a) b :=
  mapDomain_single
Scalar multiplication of a single finitely supported function
Informal description
For any scalar $g \in G$, any element $a \in \alpha$, and any element $b \in M$, the scalar multiplication of $g$ with the finitely supported function $\text{single}(a, b)$ is equal to the finitely supported function $\text{single}(g \cdot a, b)$. That is, \[ g \cdot \text{single}(a, b) = \text{single}(g \cdot a, b). \]
Finsupp.comapMulAction definition
: MulAction G (α →₀ M)
Full source
/-- `Finsupp.comapSMul` is multiplicative -/
def comapMulAction : MulAction G (α →₀ M) where
  one_smul f := by rw [comapSMul_def, one_smul_eq_id, mapDomain_id]
  mul_smul g g' f := by
    rw [comapSMul_def, comapSMul_def, comapSMul_def, ← comp_smul_left, mapDomain_comp]
Multiplicative action on finitely supported functions via domain action
Informal description
The structure defining a multiplicative action of a group `G` on the type of finitely supported functions `α →₀ M`, where the action is induced by the action of `G` on `α`. Specifically, for any `g ∈ G` and `f : α →₀ M`, the action `g • f` is given by the finitely supported function obtained by mapping the domain of `f` under the action of `g` on `α`, i.e., `mapDomain (g • ·) f`. This action satisfies the multiplicative action axioms: `1 • f = f` and `(g * g') • f = g • (g' • f)` for all `g, g' ∈ G` and `f : α →₀ M`.
Finsupp.comapDistribMulAction definition
: DistribMulAction G (α →₀ M)
Full source
/-- `Finsupp.comapSMul` is distributive -/
def comapDistribMulAction : DistribMulAction G (α →₀ M) where
  smul_zero g := by
    ext a
    simp only [comapSMul_def]
    simp
  smul_add g f f' := by
    ext
    simp only [comapSMul_def]
    simp [mapDomain_add]
Distributive multiplicative action on finitely supported functions via domain action
Informal description
The structure defining a distributive multiplicative action of a group `G` on the type of finitely supported functions `α →₀ M`, where the action is induced by the action of `G` on `α`. Specifically, for any `g ∈ G` and `f, f' : α →₀ M`, the action satisfies: 1. `g • 0 = 0` (preservation of zero) 2. `g • (f + f') = g • f + g • f'` (distributivity over addition) This action is implemented by mapping the domain of `f` under the action of `g` on `α` (i.e., `mapDomain (g • ·) f`).
Finsupp.comapSMul_apply theorem
(g : G) (f : α →₀ M) (a : α) : (g • f) a = f (g⁻¹ • a)
Full source
/-- When `G` is a group, `Finsupp.comapSMul` acts by precomposition with the action of `g⁻¹`.
-/
@[simp]
theorem comapSMul_apply (g : G) (f : α →₀ M) (a : α) : (g • f) a = f (g⁻¹ • a) := by
  conv_lhs => rw [← smul_inv_smul g a]
  exact mapDomain_apply (MulAction.injective g) _ (g⁻¹ • a)
Action of Group on Finitely Supported Functions via Precomposition with Inverse
Informal description
Let $G$ be a group acting on a type $\alpha$, and let $M$ be a type with a zero element. For any finitely supported function $f \colon \alpha \to_{\text{f}} M$, any element $g \in G$, and any $a \in \alpha$, the scalar multiplication action of $g$ on $f$ evaluated at $a$ satisfies $(g \cdot f)(a) = f(g^{-1} \cdot a)$.
IsSMulRegular.finsupp theorem
[Zero M] [SMulZeroClass R M] {k : R} (hk : IsSMulRegular M k) : IsSMulRegular (α →₀ M) k
Full source
theorem _root_.IsSMulRegular.finsupp [Zero M] [SMulZeroClass R M] {k : R}
    (hk : IsSMulRegular M k) : IsSMulRegular (α →₀ M) k :=
  fun _ _ h => ext fun i => hk (DFunLike.congr_fun h i)
Regularity of Scalar Multiplication on Finitely Supported Functions
Informal description
Let $R$ be a type with a scalar multiplication action on $M$ that preserves zero, and let $k \in R$ be a regular scalar (i.e., the map $x \mapsto k \cdot x$ is injective on $M$). Then the induced scalar multiplication action of $k$ on the space of finitely supported functions $\alpha \to_{\text{f}} M$ is also regular.
Finsupp.faithfulSMul instance
[Nonempty α] [Zero M] [SMulZeroClass R M] [FaithfulSMul R M] : FaithfulSMul R (α →₀ M)
Full source
instance faithfulSMul [Nonempty α] [Zero M] [SMulZeroClass R M] [FaithfulSMul R M] :
    FaithfulSMul R (α →₀ M) where
  eq_of_smul_eq_smul h :=
    let ⟨a⟩ := ‹Nonempty α›
    eq_of_smul_eq_smul fun m : M => by simpa using DFunLike.congr_fun (h (single a m)) a
Faithfulness of Scalar Multiplication on Finitely Supported Functions
Informal description
For any nonempty type $\alpha$, any type $M$ with a zero element, and any type $R$ with a scalar multiplication action on $M$ that preserves zero, if the scalar multiplication action of $R$ on $M$ is faithful (i.e., distinct elements of $R$ act differently on some element of $M$), then the induced scalar multiplication action of $R$ on the space of finitely supported functions $\alpha \to_{\text{f}} M$ is also faithful.
Finsupp.distribMulAction instance
[Monoid R] [AddMonoid M] [DistribMulAction R M] : DistribMulAction R (α →₀ M)
Full source
instance distribMulAction [Monoid R] [AddMonoid M] [DistribMulAction R M] :
    DistribMulAction R (α →₀ M) :=
  { Finsupp.distribSMul _ _ with
    one_smul := fun x => ext fun y => one_smul R (x y)
    mul_smul := fun r s x => ext fun y => mul_smul r s (x y) }
Distributive Multiplicative Action on Finitely Supported Functions
Informal description
For any monoid $R$ and additive monoid $M$ equipped with a distributive multiplicative action of $R$ on $M$, the space of finitely supported functions $\alpha \to_{\text{f}} M$ inherits a distributive multiplicative action from $R$, defined pointwise as $(r \cdot f)(a) = r \cdot f(a)$ for $r \in R$, $f \in \alpha \to_{\text{f}} M$, and $a \in \alpha$.
Finsupp.module instance
[Semiring R] [AddCommMonoid M] [Module R M] : Module R (α →₀ M)
Full source
instance module [Semiring R] [AddCommMonoid M] [Module R M] : Module R (α →₀ M) :=
  { toDistribMulAction := Finsupp.distribMulAction α M
    zero_smul := fun _ => ext fun _ => zero_smul _ _
    add_smul := fun _ _ _ => ext fun _ => add_smul _ _ _ }
Module Structure on Finitely Supported Functions
Informal description
For any semiring $R$ and any additive commutative monoid $M$ equipped with a module structure over $R$, the space of finitely supported functions $\alpha \to_{\text{f}} M$ forms a module over $R$ with pointwise scalar multiplication.
Finsupp.support_smul_eq theorem
[Zero R] [Zero M] [SMulWithZero R M] [NoZeroSMulDivisors R M] {b : R} (hb : b ≠ 0) {g : α →₀ M} : (b • g).support = g.support
Full source
@[simp]
theorem support_smul_eq [Zero R] [Zero M] [SMulWithZero R M] [NoZeroSMulDivisors R M] {b : R}
    (hb : b ≠ 0) {g : α →₀ M} : (b • g).support = g.support :=
  Finset.ext fun a => by simp [Finsupp.smul_apply, hb]
Support Equality under Scalar Multiplication for Finitely Supported Functions
Informal description
Let $R$ and $M$ be types with zero elements, equipped with a scalar multiplication operation $R \times M \to M$ that preserves zero (i.e., $0 \cdot m = 0$ for all $m \in M$) and has no zero divisors (i.e., $r \cdot m = 0$ implies $r = 0$ or $m = 0$). For any nonzero element $b \in R$ and any finitely supported function $g : \alpha \to_{\text{f}} M$, the support of the scalar multiple $b \cdot g$ is equal to the support of $g$.
Finsupp.filter_smul theorem
[Zero M] [SMulZeroClass R M] {b : R} {v : α →₀ M} : (b • v).filter p = b • v.filter p
Full source
@[simp]
theorem filter_smul [Zero M] [SMulZeroClass R M] {b : R} {v : α →₀ M} :
    (b • v).filter p = b • v.filter p :=
  DFunLike.coe_injective <| by
    simp only [filter_eq_indicator, coe_smul]
    exact Set.indicator_const_smul { x | p x } b v
Commutativity of Filtering and Scalar Multiplication for Finitely Supported Functions
Informal description
Let $R$ and $M$ be types with $M$ having a zero element and $R$ acting on $M$ via a scalar multiplication that preserves zero. For any scalar $b \in R$ and any finitely supported function $v : \alpha \to_{\text{f}} M$, the filtered version of the scalar multiple $b \cdot v$ is equal to the scalar multiple of the filtered version of $v$. That is, for any predicate $p$ on $\alpha$, we have $(b \cdot v)\text{.filter } p = b \cdot (v\text{.filter } p)$.
Finsupp.mapDomain_smul theorem
[AddCommMonoid M] [DistribSMul R M] {f : α → β} (b : R) (v : α →₀ M) : mapDomain f (b • v) = b • mapDomain f v
Full source
theorem mapDomain_smul [AddCommMonoid M] [DistribSMul R M] {f : α → β} (b : R)
    (v : α →₀ M) : mapDomain f (b • v) = b • mapDomain f v :=
  mapDomain_mapRange _ _ _ _ (smul_add b)
Commutativity of Domain Mapping and Scalar Multiplication for Finitely Supported Functions
Informal description
Let $M$ be an additive commutative monoid and $R$ be a type with a distributive scalar multiplication action on $M$. For any function $f : \alpha \to \beta$, any scalar $b \in R$, and any finitely supported function $v : \alpha \to_{\text{f}} M$, we have \[ \operatorname{mapDomain} f (b \cdot v) = b \cdot \operatorname{mapDomain} f v. \]
Finsupp.smul_single' theorem
{_ : Semiring R} (c : R) (a : α) (b : R) : c • Finsupp.single a b = Finsupp.single a (c * b)
Full source
theorem smul_single' {_ : Semiring R} (c : R) (a : α) (b : R) :
    c • Finsupp.single a b = Finsupp.single a (c * b) := by simp
Scalar Multiplication Commutes with Single-Point Function in Semiring: $c \cdot (\text{single}\, a\, b) = \text{single}\, a\, (c \cdot b)$
Informal description
Let $R$ be a semiring. For any scalar $c \in R$, any element $a \in \alpha$, and any element $b \in R$, the scalar multiple $c \cdot (\text{single}\, a\, b)$ is equal to the single-point finitely supported function $\text{single}\, a\, (c \cdot b)$. In mathematical notation: $$c \cdot (\text{single}\, a\, b) = \text{single}\, a\, (c \cdot b).$$
Finsupp.smul_single_one theorem
[MulZeroOneClass R] (a : α) (b : R) : b • single a (1 : R) = single a b
Full source
theorem smul_single_one [MulZeroOneClass R] (a : α) (b : R) :
    b • single a (1 : R) = single a b := by
  rw [smul_single, smul_eq_mul, mul_one]
Scalar Multiplication of Single-Point Function with Identity: $b \cdot \text{single}_a(1) = \text{single}_a(b)$
Informal description
Let $R$ be a multiplicative monoid with zero and a multiplicative identity, and let $\alpha$ be a type. For any element $a \in \alpha$ and any scalar $b \in R$, the scalar multiple $b \cdot \text{single}_a(1)$ is equal to the finitely supported function $\text{single}_a(b)$, where $\text{single}_a$ denotes the function that is zero everywhere except at $a$ where it takes the given value. In mathematical notation: $$b \cdot \text{single}_a(1) = \text{single}_a(b).$$
Finsupp.comapDomain_smul_of_injective theorem
[Zero M] [SMulZeroClass R M] {f : α → β} (hf : Function.Injective f) (r : R) (v : β →₀ M) : comapDomain f (r • v) hf.injOn = r • comapDomain f v hf.injOn
Full source
/-- A version of `Finsupp.comapDomain_smul` that's easier to use. -/
theorem comapDomain_smul_of_injective [Zero M] [SMulZeroClass R M] {f : α → β}
    (hf : Function.Injective f) (r : R) (v : β →₀ M) :
    comapDomain f (r • v) hf.injOn = r • comapDomain f v hf.injOn :=
  comapDomain_smul _ _ _ _
Scalar Multiplication Commutes with Preimage Composition for Finitely Supported Functions
Informal description
Let $M$ be a type with a zero element and a scalar multiplication action by $R$ that preserves zero. Given an injective function $f \colon \alpha \to \beta$, a scalar $r \in R$, and a finitely supported function $v \colon \beta \to_{\text{f}} M$, the following equality holds: \[ \text{comapDomain}_f (r \cdot v) = r \cdot \text{comapDomain}_f v, \] where $\text{comapDomain}_f$ denotes the preimage composition with $f$ (restricted to the support of $v$).
Finsupp.sum_smul_index theorem
[MulZeroClass R] [AddCommMonoid M] {g : α →₀ R} {b : R} {h : α → R → M} (h0 : ∀ i, h i 0 = 0) : (b • g).sum h = g.sum fun i a => h i (b * a)
Full source
theorem sum_smul_index [MulZeroClass R] [AddCommMonoid M] {g : α →₀ R} {b : R} {h : α → R → M}
    (h0 : ∀ i, h i 0 = 0) : (b • g).sum h = g.sum fun i a => h i (b * a) :=
  Finsupp.sum_mapRange_index h0
Linearity of Summation under Scalar Multiplication for Finitely Supported Functions
Informal description
Let $R$ be a multiplicative monoid with zero, $M$ an additive commutative monoid, $g : \alpha \to_{\text{f}} R$ a finitely supported function, $b \in R$, and $h : \alpha \to R \to M$ a family of functions such that $h_i(0) = 0$ for all $i \in \alpha$. Then the sum over the scalar multiple $b \cdot g$ satisfies: \[ \sum_{i \in \alpha} h_i((b \cdot g)(i)) = \sum_{i \in \alpha} h_i(b \cdot g(i)) \]
Finsupp.sum_smul_index' theorem
[Zero M] [SMulZeroClass R M] [AddCommMonoid N] {g : α →₀ M} {b : R} {h : α → M → N} (h0 : ∀ i, h i 0 = 0) : (b • g).sum h = g.sum fun i c => h i (b • c)
Full source
theorem sum_smul_index' [Zero M] [SMulZeroClass R M] [AddCommMonoid N] {g : α →₀ M} {b : R}
    {h : α → M → N} (h0 : ∀ i, h i 0 = 0) : (b • g).sum h = g.sum fun i c => h i (b • c) :=
  Finsupp.sum_mapRange_index h0
Linearity of Summation under Scalar Multiplication for Finitely Supported Functions
Informal description
Let $M$ be a type with a zero element and a scalar multiplication action by $R$ that preserves zero, and let $N$ be an additive commutative monoid. Given a finitely supported function $g \colon \alpha \to_{\text{f}} M$, a scalar $b \in R$, and a family of functions $h_i \colon M \to N$ such that $h_i(0) = 0$ for all $i \in \alpha$, the sum over the scalar multiple $b \cdot g$ satisfies: \[ \sum_{i \in \alpha} h_i((b \cdot g)(i)) = \sum_{i \in \alpha} h_i(b \cdot g(i)). \]
Finsupp.sum_smul_index_addMonoidHom theorem
[AddZeroClass M] [AddCommMonoid N] [SMulZeroClass R M] {g : α →₀ M} {b : R} {h : α → M →+ N} : ((b • g).sum fun a => h a) = g.sum fun i c => h i (b • c)
Full source
/-- A version of `Finsupp.sum_smul_index'` for bundled additive maps. -/
theorem sum_smul_index_addMonoidHom [AddZeroClass M] [AddCommMonoid N] [SMulZeroClass R M]
    {g : α →₀ M} {b : R} {h : α → M →+ N} :
    ((b • g).sum fun a => h a) = g.sum fun i c => h i (b • c) :=
  sum_mapRange_index fun i => (h i).map_zero
Sum of Scalar Multiples of Finitely Supported Functions under Additive Monoid Homomorphisms
Informal description
Let $M$ be an additive monoid with a zero element, $N$ a commutative additive monoid, and $R$ a type with a scalar multiplication action on $M$ that preserves zero. Given a finitely supported function $g : \alpha \to_{\text{f}} M$, a scalar $b \in R$, and a family of additive monoid homomorphisms $h_i : M \to N$ (for each $i \in \alpha$) such that $h_i(0) = 0$ for all $i$, the sum over the scalar multiple $b \cdot g$ satisfies: \[ \sum_{a \in \alpha} h_a((b \cdot g)(a)) = \sum_{i \in \alpha} h_i(b \cdot g(i)). \]
Finsupp.noZeroSMulDivisors instance
[Zero R] [Zero M] [SMulZeroClass R M] {ι : Type*} [NoZeroSMulDivisors R M] : NoZeroSMulDivisors R (ι →₀ M)
Full source
instance noZeroSMulDivisors [Zero R] [Zero M] [SMulZeroClass R M] {ι : Type*}
    [NoZeroSMulDivisors R M] : NoZeroSMulDivisors R (ι →₀ M) :=
  ⟨fun h => or_iff_not_imp_left.mpr fun hc => Finsupp.ext fun i =>
    (eq_zero_or_eq_zero_of_smul_eq_zero (DFunLike.ext_iff.mp h i)).resolve_left hc⟩
No Zero Divisors in Pointwise Scalar Multiplication of Finitely Supported Functions
Informal description
For any type $R$ and $M$ with zero elements and a scalar multiplication action on $M$ that preserves zero, if $R$ and $M$ have no zero divisors with respect to scalar multiplication (i.e., $r \cdot m = 0$ implies $r = 0$ or $m = 0$), then the type of finitely supported functions $\iota \to_{\text{f}} M$ also has no zero divisors with respect to the pointwise scalar multiplication from $R$.
Finsupp.DistribMulActionHom.single definition
(a : α) : M →+[R] α →₀ M
Full source
/-- `Finsupp.single` as a `DistribMulActionSemiHom`.

See also `Finsupp.lsingle` for the version as a linear map. -/
def DistribMulActionHom.single (a : α) : M →+[R] α →₀ M :=
  { singleAddHom a with
    map_smul' := fun k m => by simp }
Equivariant additive monoid homomorphism of single-point finitely supported functions
Informal description
For a fixed element $a \in \alpha$, the function $\operatorname{single}(a) \colon M \to \alpha \to_{\text{f}} M$ is an equivariant additive monoid homomorphism (with respect to the monoid $R$) that maps each $m \in M$ to the finitely supported function $\operatorname{single}(a, m)$. Here, $\operatorname{single}(a, m)$ is the function that takes the value $m$ at $a$ and zero elsewhere. The homomorphism preserves both the additive structure and the scalar multiplication, satisfying: 1. $\operatorname{single}(a)(0) = \operatorname{single}(a, 0)$, 2. $\operatorname{single}(a)(m_1 + m_2) = \operatorname{single}(a, m_1) + \operatorname{single}(a, m_2)$ for all $m_1, m_2 \in M$, and 3. $\operatorname{single}(a)(r \cdot m) = r \cdot \operatorname{single}(a, m)$ for all $r \in R$ and $m \in M$.
Finsupp.distribMulActionHom_ext theorem
{f g : (α →₀ M) →+[R] N} (h : ∀ (a : α) (m : M), f (single a m) = g (single a m)) : f = g
Full source
theorem distribMulActionHom_ext {f g : (α →₀ M) →+[R] N}
    (h : ∀ (a : α) (m : M), f (single a m) = g (single a m)) : f = g :=
  DistribMulActionHom.toAddMonoidHom_injective <| addHom_ext h
Extensionality of Equivariant Additive Monoid Homomorphisms on Finitely Supported Functions via Single Elements
Informal description
Let $R$ be a monoid acting distributively on additive monoids $M$ and $N$, and let $f, g \colon (\alpha \to_{\text{f}} M) \to_{e+}[R] N$ be two equivariant additive monoid homomorphisms from the space of finitely supported functions $\alpha \to_{\text{f}} M$ to $N$. If for every $a \in \alpha$ and $m \in M$, the equality $f(\text{single}(a, m)) = g(\text{single}(a, m))$ holds, then $f = g$.
Finsupp.distribMulActionHom_ext' theorem
{f g : (α →₀ M) →+[R] N} (h : ∀ a : α, f.comp (DistribMulActionHom.single a) = g.comp (DistribMulActionHom.single a)) : f = g
Full source
/-- See note [partially-applied ext lemmas]. -/
@[ext]
theorem distribMulActionHom_ext' {f g : (α →₀ M) →+[R] N}
    (h : ∀ a : α, f.comp (DistribMulActionHom.single a) = g.comp (DistribMulActionHom.single a)) :
    f = g :=
  distribMulActionHom_ext fun a => DistribMulActionHom.congr_fun (h a)
Extensionality of Equivariant Additive Monoid Homomorphisms via Single-Point Compositions
Informal description
Let $R$ be a monoid acting distributively on additive monoids $M$ and $N$, and let $f, g \colon (\alpha \to_{\text{f}} M) \to_{e+}[R] N$ be two equivariant additive monoid homomorphisms from the space of finitely supported functions $\alpha \to_{\text{f}} M$ to $N$. If for every $a \in \alpha$, the composition of $f$ with the single-point homomorphism $\operatorname{single}(a) \colon M \to \alpha \to_{\text{f}} M$ equals the composition of $g$ with $\operatorname{single}(a)$, then $f = g$.