Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 76658a4

Browse files
xrobloteric-wieser
andcommitted
feat(algebra/group/pi): add pi.monoid_hom (#17757)
Add the `monoid` version of `pi.ring_hom`. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent a1ce0bd commit 76658a4

3 files changed

Lines changed: 41 additions & 12 deletions

File tree

src/algebra/group/pi.lean

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@ end mul_hom
147147

148148
section mul_hom
149149

150+
/-- A family of mul_hom `f a : γ →ₙ* β a` defines a mul_hom `pi.mul_hom f : γ →ₙ* Π a, β a`
151+
given by `pi.mul_hom f x b = f b x`. -/
152+
@[to_additive "A family of add_hom `f a : γ → β a` defines a add_hom `pi.add_hom
153+
f : γ → Π a, β a` given by `pi.add_hom f x b = f b x`.", simps]
154+
def pi.mul_hom {γ : Type w} [Π i, has_mul (f i)] [has_mul γ]
155+
(g : Π i, γ →ₙ* f i) : γ →ₙ* Π i, f i :=
156+
{ to_fun := λ x i, g i x,
157+
map_mul' := λ x y, funext $ λ i, (g i).map_mul x y, }
158+
159+
@[to_additive]
160+
lemma pi.mul_hom_injective {γ : Type w} [nonempty I]
161+
[Π i, has_mul (f i)] [has_mul γ] (g : Π i, γ →ₙ* f i)
162+
(hg : ∀ i, function.injective (g i)) : function.injective (pi.mul_hom g) :=
163+
λ x y h, let ⟨i⟩ := ‹nonempty I› in hg i ((function.funext_iff.mp h : _) i)
164+
165+
/-- A family of monoid homomorphisms `f a : γ →* β a` defines a monoid homomorphism
166+
`pi.monoid_mul_hom f : γ →* Π a, β a` given by `pi.monoid_mul_hom f x b = f b x`. -/
167+
@[to_additive "A family of additive monoid homomorphisms `f a : γ →+ β a` defines a monoid
168+
homomorphism `pi.add_monoid_hom f : γ →+ Π a, β a` given by `pi.add_monoid_hom f x b
169+
= f b x`.", simps]
170+
def pi.monoid_hom {γ : Type w} [Π i, mul_one_class (f i)] [mul_one_class γ]
171+
(g : Π i, γ →* f i) : γ →* Π i, f i :=
172+
{ to_fun := λ x i, g i x,
173+
map_one' := funext $ λ i, (g i).map_one,
174+
.. pi.mul_hom (λ i, (g i).to_mul_hom) }
175+
176+
@[to_additive]
177+
lemma pi.monoid_hom_injective {γ : Type w} [nonempty I]
178+
[Π i, mul_one_class (f i)] [mul_one_class γ] (g : Π i, γ →* f i)
179+
(hg : ∀ i, function.injective (g i)) : function.injective (pi.monoid_hom g) :=
180+
pi.mul_hom_injective (λ i, (g i).to_mul_hom) hg
181+
150182
variables (f) [Π i, has_mul (f i)]
151183

152184
/-- Evaluation of functions into an indexed collection of semigroups at a point is a semigroup

src/algebra/ring/pi.lean

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,27 @@ homomorphism `pi.non_unital_ring_hom f : γ →+* Π a, β a` given by
9595
protected def non_unital_ring_hom {γ : Type w} [Π i, non_unital_non_assoc_semiring (f i)]
9696
[non_unital_non_assoc_semiring γ] (g : Π i, γ →ₙ+* f i) : γ →ₙ+* Π i, f i :=
9797
{ to_fun := λ x b, g b x,
98-
map_add' := λ x y, funext $ λ z, map_add (g z) x y,
99-
map_mul' := λ x y, funext $ λ z, map_mul (g z) x y,
100-
map_zero' := funext $ λ z, map_zero (g z) }
98+
.. pi.mul_hom (λ i, (g i).to_mul_hom),
99+
.. pi.add_monoid_hom (λ i, (g i).to_add_monoid_hom) }
101100

102101
lemma non_unital_ring_hom_injective {γ : Type w} [nonempty I]
103102
[Π i, non_unital_non_assoc_semiring (f i)] [non_unital_non_assoc_semiring γ] (g : Π i, γ →ₙ+* f i)
104103
(hg : ∀ i, function.injective (g i)) : function.injective (pi.non_unital_ring_hom g) :=
105-
λ x y h, let ⟨i⟩ := ‹nonempty I› in hg i ((function.funext_iff.mp h : _) i)
104+
mul_hom_injective (λ i, (g i).to_mul_hom) hg
106105

107106
/-- A family of ring homomorphisms `f a : γ →+* β a` defines a ring homomorphism
108107
`pi.ring_hom f : γ →+* Π a, β a` given by `pi.ring_hom f x b = f b x`. -/
109108
@[simps]
110109
protected def ring_hom {γ : Type w} [Π i, non_assoc_semiring (f i)] [non_assoc_semiring γ]
111110
(g : Π i, γ →+* f i) : γ →+* Π i, f i :=
112111
{ to_fun := λ x b, g b x,
113-
map_add' := λ x y, funext $ λ z, (g z).map_add x y,
114-
map_mul' := λ x y, funext $ λ z, (g z).map_mul x y,
115-
map_one' := funext $ λ z, (g z).map_one,
116-
map_zero' := funext $ λ z, (g z).map_zero }
112+
.. pi.monoid_hom (λ i, (g i).to_monoid_hom),
113+
.. pi.add_monoid_hom (λ i, (g i).to_add_monoid_hom) }
117114

118115
lemma ring_hom_injective {γ : Type w} [nonempty I] [Π i, non_assoc_semiring (f i)]
119116
[non_assoc_semiring γ] (g : Π i, γ →+* f i) (hg : ∀ i, function.injective (g i)) :
120117
function.injective (pi.ring_hom g) :=
121-
λ x y h, let ⟨i⟩ := ‹nonempty I› in hg i ((function.funext_iff.mp h : _) i)
118+
monoid_hom_injective (λ i, (g i).to_monoid_hom) hg
122119

123120
end pi
124121

src/linear_algebra/pi.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ variables [semiring R] [add_comm_monoid M₂] [module R M₂] [add_comm_monoid M
3939

4040
/-- `pi` construction for linear functions. From a family of linear functions it produces a linear
4141
function into a family of modules. -/
42-
def pi (f : Πi, M₂ →ₗ[R] φ i) : M₂ →ₗ[R] (Πi, φ i) :=
42+
def pi (f : Π i, M₂ →ₗ[R] φ i) : M₂ →ₗ[R] (Π i, φ i) :=
4343
{ to_fun := λ c i, f i c,
44-
map_add' := λ c d, funext $ λ i, (f i).map_add _ _,
45-
map_smul' := λ c d, funext $ λ i, (f i).map_smul _ _ }
44+
map_smul' := λ c d, funext $ λ i, (f i).map_smul _ _,
45+
.. pi.add_hom (λ i, (f i).to_add_hom) }
4646

4747
@[simp] lemma pi_apply (f : Πi, M₂ →ₗ[R] φ i) (c : M₂) (i : ι) :
4848
pi f c i = f i c := rfl

0 commit comments

Comments
 (0)