Lean4
/-- Given `f : G → G'` and `v : SkewMonoidAlgebra k G`, `mapDomain f v : SkewMonoidAlgebra k G'`
is the finitely supported additive homomorphism whose value at `a : G'` is the sum of `v x` over
all `x` such that `f x = a`.
Note that `SkewMonoidAlgebra.mapDomain` is defined as an `AddHom`, while `MonoidAlgebra.mapDomain`
is defined as a function. -/
@[simps]
def mapDomain : SkewMonoidAlgebra k G →+ SkewMonoidAlgebra k G'
where
toFun v := v.sum fun a ↦ single (f a)
map_zero' := sum_zero_index
map_add' _ _ := sum_add_index' (fun _ ↦ single_zero _) fun _ ↦ single_add _