Skip to content

Commit d3acd13

Browse files
committed
chore(RingTheory/Bialgebra/MonoidAlgebra): use to_additive (leanprover-community#33452)
1 parent 3452ccc commit d3acd13

2 files changed

Lines changed: 17 additions & 74 deletions

File tree

Mathlib/RingTheory/Bialgebra/MonoidAlgebra.lean

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace MonoidAlgebra
3636
variable [CommSemiring R] [Semiring A] [Bialgebra R A] [Monoid M] [Monoid N] [Monoid O]
3737

3838
variable (R A M) in
39+
@[to_additive (dont_translate := R A) (relevant_arg := M)]
3940
instance instBialgebra : Bialgebra R A[M] where
4041
counit_one := by simp only [one_def, counit_single, Bialgebra.counit_one]
4142
mul_compr₂_counit := by ext; simp
@@ -51,70 +52,37 @@ instance instBialgebra : Bialgebra R A[M] where
5152
LinearMap.compl₁₂_apply, LinearMap.coe_sum, Finset.sum_apply,
5253
Finset.sum_comm (s := (Coalgebra.Repr.arbitrary R b).index)]
5354

55+
-- TODO: Generalise to `A[M] →ₐc[R] A[N]` under `Bialgebra R A`
56+
variable (R) [AddMonoid M] [AddMonoid N] in
57+
/-- If `f : M → N` is a monoid hom, then `AddMonoidAlgebra.mapDomain f` is a bialgebra hom between
58+
their additive monoid algebras. -/
59+
noncomputable def _root_.AddMonoidAlgebra.mapDomainBialgHom (f : M →+ N) :
60+
AddMonoidAlgebra R M →ₐc[R] AddMonoidAlgebra R N :=
61+
.ofAlgHom (AddMonoidAlgebra.mapDomainAlgHom R R f) (by ext; simp) (by ext; simp)
62+
5463
-- TODO: Generalise to `A[M] →ₐc[R] A[N]` under `Bialgebra R A`
5564
variable (R) in
5665
/-- If `f : M → N` is a monoid hom, then `MonoidAlgebra.mapDomain f` is a bialgebra hom between
5766
their monoid algebras. -/
58-
@[simps!]
67+
@[to_additive existing (attr := simps!)]
5968
noncomputable def mapDomainBialgHom (f : M →* N) : R[M] →ₐc[R] R[N] :=
6069
.ofAlgHom (mapDomainAlgHom R R f) (by ext; simp) (by ext; simp)
6170

62-
@[simp] lemma mapDomainBialgHom_id : mapDomainBialgHom R (.id M) = .id R R[M] := by ext; simp
71+
@[to_additive (attr := simp)]
72+
lemma mapDomainBialgHom_id : mapDomainBialgHom R (.id M) = .id R R[M] := by ext; simp
6373

64-
@[simp]
74+
@[to_additive (attr := simp)]
6575
lemma mapDomainBialgHom_comp (f : N →* O) (g : M →* N) :
6676
mapDomainBialgHom R (f.comp g) = (mapDomainBialgHom R f).comp (mapDomainBialgHom R g) := by
6777
ext; simp [Finsupp.mapDomain_comp]
6878

79+
@[to_additive]
6980
lemma mapDomainBialgHom_mapDomainBialgHom (f : N →* O) (g : M →* N) (x : R[M]) :
7081
mapDomainBialgHom R f (mapDomainBialgHom R g x) = mapDomainBialgHom R (f.comp g) x := by
7182
ext; simp
7283

7384
end MonoidAlgebra
7485

75-
namespace AddMonoidAlgebra
76-
variable [CommSemiring R] [Semiring A] [Bialgebra R A] [AddMonoid M] [AddMonoid N] [AddMonoid O]
77-
78-
variable (R A M) in
79-
instance instBialgebra : Bialgebra R A[M] where
80-
counit_one := by simp only [one_def, counit_single, Bialgebra.counit_one]
81-
mul_compr₂_counit := by ext; simp [single_mul_single]
82-
comul_one := by
83-
simp only [one_def, comul_single, Bialgebra.comul_one, Algebra.TensorProduct.one_def,
84-
TensorProduct.map_tmul, lsingle_apply]
85-
mul_compr₂_comul := by
86-
ext a b c d
87-
simp only [Function.comp_apply, LinearMap.coe_comp, LinearMap.compr₂_apply,
88-
LinearMap.mul_apply', single_mul_single, comul_single, Bialgebra.comul_mul,
89-
← (Coalgebra.Repr.arbitrary R b).eq, ← (Coalgebra.Repr.arbitrary R d).eq, Finset.sum_mul_sum,
90-
Algebra.TensorProduct.tmul_mul_tmul, map_sum, TensorProduct.map_tmul, lsingle_apply,
91-
LinearMap.compl₁₂_apply, LinearMap.coe_sum, Finset.sum_apply,
92-
Finset.sum_comm (s := (Coalgebra.Repr.arbitrary R b).index)]
93-
94-
-- TODO: Generalise to `A[M] →ₐc[R] A[N]` under `Bialgebra R A`
95-
variable (R) in
96-
/-- If `f : M → N` is a monoid hom, then `AddMonoidAlgebra.mapDomain f` is a bialgebra hom between
97-
their monoid algebras. -/
98-
@[simps]
99-
noncomputable def mapDomainBialgHom (f : M →+ N) : R[M] →ₐc[R] R[N] where
100-
__ := mapDomainAlgHom R R f
101-
map_smul' m x := by simp
102-
counit_comp := by ext; simp
103-
map_comp_comul := by ext; simp
104-
105-
@[simp] lemma mapDomainBialgHom_id : mapDomainBialgHom R (.id M) = .id _ _ := by ext; simp
106-
107-
@[simp]
108-
lemma mapDomainBialgHom_comp (f : N →+ O) (g : M →+ N) :
109-
mapDomainBialgHom R (f.comp g) = (mapDomainBialgHom R f).comp (mapDomainBialgHom R g) := by
110-
ext; simp
111-
112-
lemma mapDomainBialgHom_mapDomainBialgHom (f : N →+ O) (g : M →+ N) (x : R[M]) :
113-
mapDomainBialgHom R f (mapDomainBialgHom R g x) = mapDomainBialgHom R (f.comp g) x := by
114-
ext; simp
115-
116-
end AddMonoidAlgebra
117-
11886
namespace LaurentPolynomial
11987

12088
open AddMonoidAlgebra

Mathlib/RingTheory/HopfAlgebra/MonoidAlgebra.lean

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ variable {R A : Type*} [CommSemiring R] [Semiring A] [HopfAlgebra R A]
3636
variable {G : Type*} [Group G]
3737

3838
variable (R A G) in
39+
@[to_additive (dont_translate := R) (relevant_arg := G)]
3940
instance instHopfAlgebraStruct : HopfAlgebraStruct R A[G] where
4041
antipode := Finsupp.lsum R fun g => Finsupp.lsingle g⁻¹ ∘ₗ antipode R
4142

42-
@[simp]
43+
@[to_additive (attr := simp)]
4344
lemma antipode_single (g : G) (a : A) :
4445
antipode R (single g a) = single g⁻¹ (antipode R a) := by
4546
simp [MonoidAlgebra, antipode]
4647

4748
open Coalgebra in
49+
@[to_additive (dont_translate := R A) (relevant_arg := G)]
4850
instance instHopfAlgebra : HopfAlgebra R A[G] where
4951
mul_antipode_rTensor_comul := by
5052
ext a b : 2
@@ -57,33 +59,6 @@ instance instHopfAlgebra : HopfAlgebra R A[G] where
5759

5860
end MonoidAlgebra
5961

60-
namespace AddMonoidAlgebra
61-
62-
variable {R A : Type*} [CommSemiring R] [Semiring A] [HopfAlgebra R A]
63-
variable {G : Type*} [AddGroup G]
64-
65-
variable (R A G) in
66-
instance instHopfAlgebraStruct : HopfAlgebraStruct R A[G] where
67-
antipode := Finsupp.lsum R fun g => Finsupp.lsingle (-g) ∘ₗ antipode R
68-
69-
@[simp]
70-
lemma antipode_single (g : G) (a : A) :
71-
antipode R (single g a) = single (-g) (antipode R a) := by
72-
simp [AddMonoidAlgebra, antipode]
73-
74-
open Coalgebra in
75-
instance instHopfAlgebra : HopfAlgebra R A[G] where
76-
mul_antipode_rTensor_comul := by
77-
ext a b : 2
78-
simpa [← (ℛ R b).eq, single_mul_single] using congr(lsingle (R := R) (0 : G)
79-
$(sum_antipode_mul_eq_algebraMap_counit (ℛ R b)))
80-
mul_antipode_lTensor_comul := by
81-
ext a b : 2
82-
simpa [← (ℛ R b).eq, single_mul_single] using congr(lsingle (R := R) (0 : G)
83-
$(sum_mul_antipode_eq_algebraMap_counit (ℛ R b)))
84-
85-
end AddMonoidAlgebra
86-
8762
namespace LaurentPolynomial
8863

8964
open Finsupp

0 commit comments

Comments
 (0)