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

Commit 4e87c84

Browse files
committed
feat(algebra/module/big_operators): Product of sums (#17818)
A few missing lemmas. `finset.sum_smul_sum` matches `finset.sum_mul_sum`. Unrelatingly, fix the copyright after the split in #17764. I list as authors: * Chris for #327 * Yury for #1910 * myself for this PR
1 parent 036348a commit 4e87c84

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/algebra/module/big_operators.lean

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
/-
2-
Copyright (c) 2015 Nathaniel Thomas. All rights reserved.
2+
Copyright (c) 2018 Chris Hughes. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Nathaniel Thomas, Jeremy Avigad, Johannes Hölzl, Mario Carneiro
4+
Authors: Chris Hughes, Yury Kudryashov, Yaël Dillies
55
-/
6-
76
import algebra.module.basic
8-
import algebra.big_operators.basic
7+
import group_theory.group_action.big_operators
98

109
/-!
1110
# Finite sums over modules over a ring
1211
-/
1312

1413
open_locale big_operators
1514

16-
universes u v
17-
variables {α R k S M M₂ M₃ ι : Type*}
15+
variables {α β R M ι : Type*}
16+
1817
section add_comm_monoid
1918
variables [semiring R] [add_comm_monoid M] [module R M] (r s : R) (x y : M)
20-
variables {R M}
19+
2120
lemma list.sum_smul {l : list R} {x : M} : l.sum • x = (l.map (λ r, r • x)).sum :=
2221
((smul_add_hom R M).flip x).map_list_sum l
2322

2423
lemma multiset.sum_smul {l : multiset R} {x : M} : l.sum • x = (l.map (λ r, r • x)).sum :=
2524
((smul_add_hom R M).flip x).map_multiset_sum l
2625

26+
lemma multiset.sum_smul_sum {s : multiset R} {t : multiset M} :
27+
s.sum • t.sum = ((s ×ˢ t).map $ λ p : R × M, p.fst • p.snd).sum :=
28+
begin
29+
induction s using multiset.induction with a s ih,
30+
{ simp },
31+
{ simp [add_smul, ih, ←multiset.smul_sum] }
32+
end
33+
2734
lemma finset.sum_smul {f : ι → R} {s : finset ι} {x : M} :
2835
(∑ i in s, f i) • x = (∑ i in s, (f i) • x) :=
2936
((smul_add_hom R M).flip x).map_sum f s
37+
38+
lemma finset.sum_smul_sum {f : α → R} {g : β → M} {s : finset α} {t : finset β} :
39+
(∑ i in s, f i) • (∑ i in t, g i) = ∑ p in s ×ˢ t, f p.fst • g p.snd :=
40+
by { rw [finset.sum_product, finset.sum_smul, finset.sum_congr rfl], intros, rw finset.smul_sum }
41+
3042
end add_comm_monoid
3143

3244
lemma finset.cast_card [comm_semiring R] (s : finset α) : (s.card : R) = ∑ a in s, 1 :=

src/data/multiset/bind.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@ infixr (name := multiset.product) ` ×ˢ `:82 := multiset.product
162162
by { rw [product, list.product, ←coe_bind], simp }
163163

164164
@[simp] lemma zero_product : @product α β 0 t = 0 := rfl
165-
--TODO: Add `product_zero`
166-
167-
@[simp] lemma cons_product : (a ::ₘ s) ×ˢ t = map (prod.mk a) t + s ×ˢ t :=
168-
by simp [product]
165+
@[simp] lemma cons_product : (a ::ₘ s) ×ˢ t = map (prod.mk a) t + s ×ˢ t := by simp [product]
166+
@[simp] lemma product_zero : s ×ˢ (0 : multiset β) = 0 := by simp [product]
167+
@[simp] lemma product_cons : s ×ˢ (b ::ₘ t) = s.map (λ a, (a, b)) + s ×ˢ t := by simp [product]
169168

170169
@[simp] lemma product_singleton : ({a} : multiset α) ×ˢ ({b} : multiset β) = {(a, b)} :=
171170
by simp only [product, bind_singleton, map_singleton]

0 commit comments

Comments
 (0)