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

Commit 140e17b

Browse files
feat(algebra/direct_sum_graded): a direct_sum of copies of a ring is itself a ring (#7420)
Once this is in, it's straightforward to show `add_monoid_algebra R ι ≃+* ⨁ i : ι, R` Co-authored-by: Johan Commelin <johan@commelin.net>
1 parent 51bc1ca commit 140e17b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/algebra/direct_sum_graded.lean

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,32 @@ end direct_sum
651651

652652
/-! ### Concrete instances -/
653653

654+
/-- A direct sum of copies of a `semiring` inherits the multiplication structure. -/
655+
instance semiring.direct_sum_gmonoid {R : Type*} [add_monoid ι] [semiring R] :
656+
direct_sum.gmonoid (λ i : ι, R) :=
657+
{ mul := λ i j, add_monoid_hom.mul,
658+
one_mul := λ a, sigma.ext (zero_add _) (heq_of_eq (one_mul _)),
659+
mul_one := λ a, sigma.ext (add_zero _) (heq_of_eq (mul_one _)),
660+
mul_assoc := λ a b c, sigma.ext (add_assoc _ _ _) (heq_of_eq (mul_assoc _ _ _)),
661+
one := 1 }
662+
663+
@[simp] lemma semiring.direct_sum_mul {R : Type*} [add_monoid ι] [semiring R] {i j} (x y : R) :
664+
@direct_sum.ghas_mul.mul _ _ (λ _ : ι, R) _ _ _ i j x y = x * y := rfl
665+
666+
open_locale direct_sum
667+
668+
-- To check the lemma above does match
669+
example {R : Type*} [add_monoid ι] [semiring R] (i j : ι) (a b : R) :
670+
(direct_sum.of _ i a * direct_sum.of _ j b : ⨁ i, R) = direct_sum.of _ (i + j) (by exact a * b) :=
671+
by rw [direct_sum.of_mul_of, semiring.direct_sum_mul]
672+
673+
/-- A direct sum of copies of a `comm_semiring` inherits the commutative multiplication structure.
674+
-/
675+
instance comm_semiring.direct_sum_gcomm_monoid {R : Type*} [add_comm_monoid ι] [comm_semiring R] :
676+
direct_sum.gcomm_monoid (λ i : ι, R) :=
677+
{ mul_comm := λ a b, sigma.ext (add_comm _ _) (heq_of_eq (mul_comm _ _)),
678+
.. semiring.direct_sum_gmonoid }
679+
654680
namespace submodule
655681

656682
variables {R A : Type*} [comm_semiring R]

0 commit comments

Comments
 (0)