Module docstring
{"# Additional lemmas about monoid and group homomorphisms
"}
{"# Additional lemmas about monoid and group homomorphisms
"}
powMonoidHom
definition
(n : ℕ) : α →* α
/-- The `n`th power map on a commutative monoid for a natural `n`, considered as a morphism of
monoids. -/
@[to_additive (attr := simps) "Multiplication by a natural `n` on a commutative additive monoid,
considered as a morphism of additive monoids."]
def powMonoidHom (n : ℕ) : α →* α where
toFun := (· ^ n)
map_one' := one_pow _
map_mul' a b := mul_pow a b n
zpowGroupHom
definition
(n : ℤ) : α →* α
/-- The `n`-th power map (for an integer `n`) on a commutative group, considered as a group
homomorphism. -/
@[to_additive (attr := simps) "Multiplication by an integer `n` on a commutative additive group,
considered as an additive group homomorphism."]
def zpowGroupHom (n : ℤ) : α →* α where
toFun := (· ^ n)
map_one' := one_zpow n
map_mul' a b := mul_zpow a b n
invMonoidHom
definition
: α →* α
/-- Inversion on a commutative group, considered as a monoid homomorphism. -/
@[to_additive "Negation on a commutative additive group, considered as an additive monoid
homomorphism."]
def invMonoidHom : α →* α where
toFun := Inv.inv
map_one' := inv_one
map_mul' := mul_inv
coe_invMonoidHom
theorem
: (invMonoidHom : α → α) = Inv.inv
@[simp]
theorem coe_invMonoidHom : (invMonoidHom : α → α) = Inv.inv := rfl
invMonoidHom_apply
theorem
(a : α) : invMonoidHom a = a⁻¹
@[simp]
theorem invMonoidHom_apply (a : α) : invMonoidHom a = a⁻¹ := rfl
MulHom.instMul
instance
[Mul M] [CommSemigroup N] : Mul (M →ₙ* N)
/-- Given two mul morphisms `f`, `g` to a commutative semigroup, `f * g` is the mul morphism
sending `x` to `f x * g x`. -/
@[to_additive "Given two additive morphisms `f`, `g` to an additive commutative semigroup,
`f + g` is the additive morphism sending `x` to `f x + g x`."]
instance [Mul M] [CommSemigroup N] : Mul (M →ₙ* N) :=
⟨fun f g =>
{ toFun := fun m => f m * g m,
map_mul' := fun x y => by
show f (x * y) * g (x * y) = f x * g x * (f y * g y)
rw [f.map_mul, g.map_mul, ← mul_assoc, ← mul_assoc, mul_right_comm (f x)] }⟩
MulHom.mul_apply
theorem
{M N} [Mul M] [CommSemigroup N] (f g : M →ₙ* N) (x : M) : (f * g) x = f x * g x
@[to_additive (attr := simp)]
theorem mul_apply {M N} [Mul M] [CommSemigroup N] (f g : M →ₙ* N) (x : M) :
(f * g) x = f x * g x := rfl
MulHom.mul_comp
theorem
[Mul M] [Mul N] [CommSemigroup P] (g₁ g₂ : N →ₙ* P) (f : M →ₙ* N) : (g₁ * g₂).comp f = g₁.comp f * g₂.comp f
MulHom.comp_mul
theorem
[Mul M] [CommSemigroup N] [CommSemigroup P] (g : N →ₙ* P) (f₁ f₂ : M →ₙ* N) : g.comp (f₁ * f₂) = g.comp f₁ * g.comp f₂
@[to_additive]
theorem comp_mul [Mul M] [CommSemigroup N] [CommSemigroup P] (g : N →ₙ* P) (f₁ f₂ : M →ₙ* N) :
g.comp (f₁ * f₂) = g.comp f₁ * g.comp f₂ := by
ext
simp only [mul_apply, Function.comp_apply, map_mul, coe_comp]
injective_iff_map_eq_one
theorem
{G H} [Group G] [MulOneClass H] [FunLike F G H] [MonoidHomClass F G H] (f : F) :
Function.Injective f ↔ ∀ a, f a = 1 → a = 1
/-- A homomorphism from a group to a monoid is injective iff its kernel is trivial.
For the iff statement on the triviality of the kernel, see `injective_iff_map_eq_one'`. -/
@[to_additive
"A homomorphism from an additive group to an additive monoid is injective iff
its kernel is trivial. For the iff statement on the triviality of the kernel,
see `injective_iff_map_eq_zero'`."]
theorem _root_.injective_iff_map_eq_one {G H} [Group G] [MulOneClass H]
[FunLike F G H] [MonoidHomClass F G H]
(f : F) : Function.InjectiveFunction.Injective f ↔ ∀ a, f a = 1 → a = 1 :=
⟨fun h _ => (map_eq_one_iff f h).mp, fun h x y hxy =>
mul_inv_eq_one.1 <| h _ <| by rw [map_mul, hxy, ← map_mul, mul_inv_cancel, map_one]⟩
injective_iff_map_eq_one'
theorem
{G H} [Group G] [MulOneClass H] [FunLike F G H] [MonoidHomClass F G H] (f : F) :
Function.Injective f ↔ ∀ a, f a = 1 ↔ a = 1
/-- A homomorphism from a group to a monoid is injective iff its kernel is trivial,
stated as an iff on the triviality of the kernel.
For the implication, see `injective_iff_map_eq_one`. -/
@[to_additive
"A homomorphism from an additive group to an additive monoid is injective iff its
kernel is trivial, stated as an iff on the triviality of the kernel. For the implication, see
`injective_iff_map_eq_zero`."]
theorem _root_.injective_iff_map_eq_one' {G H} [Group G] [MulOneClass H]
[FunLike F G H] [MonoidHomClass F G H]
(f : F) : Function.InjectiveFunction.Injective f ↔ ∀ a, f a = 1 ↔ a = 1 :=
(injective_iff_map_eq_one f).trans <|
forall_congr' fun _ => ⟨fun h => ⟨h, fun H => H.symm ▸ map_one f⟩, Iff.mp⟩
MonoidHom.ofMapMulInv
definition
{H : Type*} [Group H] (f : G → H) (map_div : ∀ a b : G, f (a * b⁻¹) = f a * (f b)⁻¹) : G →* H
/-- Makes a group homomorphism from a proof that the map preserves right division
`fun x y => x * y⁻¹`. See also `MonoidHom.of_map_div` for a version using `fun x y => x / y`.
-/
@[to_additive
"Makes an additive group homomorphism from a proof that the map preserves
the operation `fun a b => a + -b`. See also `AddMonoidHom.ofMapSub` for a version using
`fun a b => a - b`."]
def ofMapMulInv {H : Type*} [Group H] (f : G → H)
(map_div : ∀ a b : G, f (a * b⁻¹) = f a * (f b)⁻¹) : G →* H :=
(mk' f) fun x y =>
calc
f (x * y) = f x * (f <| 1 * 1⁻¹ * y⁻¹)⁻¹ := by
{ simp only [one_mul, inv_one, ← map_div, inv_inv] }
_ = f x * f y := by
{ simp only [map_div]
simp only [mul_inv_cancel, one_mul, inv_inv] }
MonoidHom.coe_of_map_mul_inv
theorem
{H : Type*} [Group H] (f : G → H) (map_div : ∀ a b : G, f (a * b⁻¹) = f a * (f b)⁻¹) : ↑(ofMapMulInv f map_div) = f
@[to_additive (attr := simp)]
theorem coe_of_map_mul_inv {H : Type*} [Group H] (f : G → H)
(map_div : ∀ a b : G, f (a * b⁻¹) = f a * (f b)⁻¹) :
↑(ofMapMulInv f map_div) = f := rfl
MonoidHom.ofMapDiv
definition
{H : Type*} [Group H] (f : G → H) (hf : ∀ x y, f (x / y) = f x / f y) : G →* H
/-- Define a morphism of additive groups given a map which respects ratios. -/
@[to_additive "Define a morphism of additive groups given a map which respects difference."]
def ofMapDiv {H : Type*} [Group H] (f : G → H) (hf : ∀ x y, f (x / y) = f x / f y) : G →* H :=
ofMapMulInv f (by simpa only [div_eq_mul_inv] using hf)
MonoidHom.coe_of_map_div
theorem
{H : Type*} [Group H] (f : G → H) (hf : ∀ x y, f (x / y) = f x / f y) : ↑(ofMapDiv f hf) = f
@[to_additive (attr := simp)]
theorem coe_of_map_div {H : Type*} [Group H] (f : G → H) (hf : ∀ x y, f (x / y) = f x / f y) :
↑(ofMapDiv f hf) = f := rfl
MonoidHom.mul
instance
: Mul (M →* N)
/-- Given two monoid morphisms `f`, `g` to a commutative monoid, `f * g` is the monoid morphism
sending `x` to `f x * g x`. -/
@[to_additive]
instance mul : Mul (M →* N) :=
⟨fun f g =>
{ toFun := fun m => f m * g m,
map_one' := show f 1 * g 1 = 1 by simp,
map_mul' := fun x y => by
show f (x * y) * g (x * y) = f x * g x * (f y * g y)
rw [f.map_mul, g.map_mul, ← mul_assoc, ← mul_assoc, mul_right_comm (f x)] }⟩
MonoidHom.mul_apply
theorem
(f g : M →* N) (x : M) : (f * g) x = f x * g x
@[to_additive (attr := simp)] lemma mul_apply (f g : M →* N) (x : M) : (f * g) x = f x * g x := rfl
MonoidHom.mul_comp
theorem
[MulOneClass P] (g₁ g₂ : M →* N) (f : P →* M) : (g₁ * g₂).comp f = g₁.comp f * g₂.comp f
@[to_additive]
lemma mul_comp [MulOneClass P] (g₁ g₂ : M →* N) (f : P →* M) :
(g₁ * g₂).comp f = g₁.comp f * g₂.comp f := rfl
MonoidHom.comp_mul
theorem
[CommMonoid P] (g : N →* P) (f₁ f₂ : M →* N) : g.comp (f₁ * f₂) = g.comp f₁ * g.comp f₂
@[to_additive]
lemma comp_mul [CommMonoid P] (g : N →* P) (f₁ f₂ : M →* N) :
g.comp (f₁ * f₂) = g.comp f₁ * g.comp f₂ := by
ext; simp only [mul_apply, Function.comp_apply, map_mul, coe_comp]
MonoidHom.instInv
instance
: Inv (M →* G)
/-- If `f` is a monoid homomorphism to a commutative group, then `f⁻¹` is the homomorphism sending
`x` to `(f x)⁻¹`. -/
@[to_additive "If `f` is an additive monoid homomorphism to an additive commutative group,
then `-f` is the homomorphism sending `x` to `-(f x)`."]
instance : Inv (M →* G) where
inv f := mk' (fun g ↦ (f g)⁻¹) fun a b ↦ by simp_rw [← mul_inv, f.map_mul]
MonoidHom.inv_apply
theorem
(f : M →* G) (x : M) : f⁻¹ x = (f x)⁻¹
MonoidHom.inv_comp
theorem
(φ : N →* G) (ψ : M →* N) : φ⁻¹.comp ψ = (φ.comp ψ)⁻¹
@[to_additive (attr := simp)]
theorem inv_comp (φ : N →* G) (ψ : M →* N) : φ⁻¹.comp ψ = (φ.comp ψ)⁻¹ := rfl
MonoidHom.comp_inv
theorem
(φ : G →* H) (ψ : M →* G) : φ.comp ψ⁻¹ = (φ.comp ψ)⁻¹
@[to_additive (attr := simp)]
theorem comp_inv (φ : G →* H) (ψ : M →* G) : φ.comp ψ⁻¹ = (φ.comp ψ)⁻¹ := by
ext
simp only [Function.comp_apply, inv_apply, map_inv, coe_comp]
MonoidHom.instDiv
instance
: Div (M →* G)
/-- If `f` and `g` are monoid homomorphisms to a commutative group, then `f / g` is the homomorphism
sending `x` to `(f x) / (g x)`. -/
@[to_additive "If `f` and `g` are monoid homomorphisms to an additive commutative group,
then `f - g` is the homomorphism sending `x` to `(f x) - (g x)`."]
instance : Div (M →* G) where
div f g := mk' (fun x ↦ f x / g x) fun a b ↦ by
simp [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm]
MonoidHom.div_apply
theorem
(f g : M →* G) (x : M) : (f / g) x = f x / g x
@[to_additive (attr := simp)] lemma div_apply (f g : M →* G) (x : M) : (f / g) x = f x / g x := rfl
MonoidHom.div_comp
theorem
(f g : N →* G) (h : M →* N) : (f / g).comp h = f.comp h / g.comp h
MonoidHom.comp_div
theorem
(f : G →* H) (g h : M →* G) : f.comp (g / h) = f.comp g / f.comp h
MonoidHom.commGroupOfInjective
definition
[Group G] [CommGroup H] (f : G →* H) (hf : Function.Injective f) : CommGroup G
/-- If `H` is commutative and `G →* H` is injective, then `G` is commutative. -/
def commGroupOfInjective [Group G] [CommGroup H] (f : G →* H) (hf : Function.Injective f) :
CommGroup G :=
⟨by simp_rw [← hf.eq_iff, map_mul, mul_comm, implies_true]⟩
MonoidHom.commGroupOfSurjective
definition
[CommGroup G] [Group H] (f : G →* H) (hf : Function.Surjective f) : CommGroup H
/-- If `G` is commutative and `G →* H` is surjective, then `H` is commutative. -/
def commGroupOfSurjective [CommGroup G] [Group H] (f : G →* H) (hf : Function.Surjective f) :
CommGroup H :=
⟨by simp_rw [hf.forall₂, ← map_mul, mul_comm, implies_true]⟩