@@ -22,7 +22,8 @@ The best is to define a copy and select the instances best suited.
22
22
-/
23
23
import data.finset data.set.finite algebra.big_operators algebra.module
24
24
open finset
25
- variables {α : Type *} {β : Type *} {γ : Type *} {δ : Type *} {α₁ : Type *} {α₂ : Type *} {β₁ : Type *} {β₂ : Type *}
25
+ variables {α : Type *} {β : Type *} {γ : Type *} {δ : Type *} {ι : Type *}
26
+ {α₁ : Type *} {α₂ : Type *} {β₁ : Type *} {β₂ : Type *}
26
27
27
28
reserve infix ` →₀ `:25
28
29
@@ -342,6 +343,7 @@ lemma single_sum [has_zero γ] [add_comm_monoid β] [decidable_eq α] [decidable
342
343
(s : δ →₀ γ) (f : δ → γ → β) (a : α) : single a (s.sum f) = s.sum (λd c, single a (f d c)) :=
343
344
single_finset_sum _ _ _
344
345
346
+
345
347
@[to_additive finsupp.sum_neg_index]
346
348
lemma prod_neg_index [add_group β] [comm_monoid γ]
347
349
{g : α →₀ β} {h : α → β → γ} (h0 : ∀a, h a 0 = 1 ) :
@@ -449,7 +451,7 @@ calc (f - g).sum h = (f + - g).sum h : by simp
449
451
... = _ : by simp
450
452
451
453
@[to_additive finsupp.sum_finset_sum_index]
452
- lemma prod_finset_sum_index {ι : Type *} [add_comm_monoid β] [comm_monoid γ] [decidable_eq ι]
454
+ lemma prod_finset_sum_index [add_comm_monoid β] [comm_monoid γ] [decidable_eq ι]
453
455
{s : finset ι} {g : ι → α →₀ β}
454
456
{h : α → β → γ} (h_zero : ∀a, h a 0 = 1 ) (h_add : ∀a b₁ b₂, h a (b₁ + b₂) = h a b₁ * h a b₂):
455
457
s.prod (λi, (g i).prod h) = (s.sum g).prod h :=
@@ -465,6 +467,26 @@ lemma prod_sum_index
465
467
(f.sum g).prod h = f.prod (λa b, (g a b).prod h) :=
466
468
(prod_finset_sum_index h_zero h_add).symm
467
469
470
+ lemma multiset_sum_sum_index
471
+ [decidable_eq α] [decidable_eq β] [add_comm_monoid β] [add_comm_monoid γ]
472
+ (f : multiset (α →₀ β)) (h : α → β → γ)
473
+ (h₀ : ∀a, h a 0 = 0 ) (h₁ : ∀ (a : α) (b₁ b₂ : β), h a (b₁ + b₂) = h a b₁ + h a b₂) :
474
+ (f.sum.sum h) = (f.map $ λg:α →₀ β, g.sum h).sum :=
475
+ multiset.induction_on f (by simp [finsupp.sum_zero_index])
476
+ (assume a s ih, by simp [finsupp.sum_add_index h₀ h₁, ih] {contextual := tt})
477
+
478
+ lemma multiset_map_sum [has_zero β] {f : α →₀ β} {m : γ → δ} {h : α → β → multiset γ} :
479
+ multiset.map m (f.sum h) = f.sum (λa b, (h a b).map m) :=
480
+ (finset.sum_hom _ (multiset.map_zero m) (multiset.map_add m)).symm
481
+
482
+ lemma multiset_sum_sum [has_zero β] [add_comm_monoid γ] {f : α →₀ β} {h : α → β → multiset γ} :
483
+ multiset.sum (f.sum h) = f.sum (λa b, multiset.sum (h a b)) :=
484
+ begin
485
+ refine (finset.sum_hom multiset.sum _ _).symm,
486
+ exact multiset.sum_zero,
487
+ exact multiset.sum_add
488
+ end
489
+
468
490
section map_domain
469
491
variables [decidable_eq α₁] [decidable_eq α₂] [add_comm_monoid β] {v v₁ v₂ : α →₀ β}
470
492
@@ -494,8 +516,7 @@ finset.sum_congr rfl $ by simp [*] at * {contextual := tt}
494
516
lemma map_domain_add {f : α → α₂} : map_domain f (v₁ + v₂) = map_domain f v₁ + map_domain f v₂ :=
495
517
sum_add_index (by simp) (by simp)
496
518
497
- lemma map_domain_finset_sum {ι : Type *} [decidable_eq ι]
498
- {f : α → α₂} {s : finset ι} {v : ι → α →₀ β} :
519
+ lemma map_domain_finset_sum [decidable_eq ι] {f : α → α₂} {s : finset ι} {v : ι → α →₀ β} :
499
520
map_domain f (s.sum v) = s.sum (λi, map_domain f (v i)) :=
500
521
by refine (sum_finset_sum_index _ _).symm; simp
501
522
@@ -779,7 +800,7 @@ lemma single_mul_single [has_add α] [semiring β] {a₁ a₂ : α} {b₁ b₂ :
779
800
single a₁ b₁ * single a₂ b₂ = single (a₁ + a₂) (b₁ * b₂) :=
780
801
by simp [mul_def, sum_single_index]
781
802
782
- lemma prod_single {ι : Type x} [decidable_eq ι] [add_comm_monoid α] [comm_semiring β]
803
+ lemma prod_single [decidable_eq ι] [add_comm_monoid α] [comm_semiring β]
783
804
{s : finset ι} {a : ι → α} {b : ι → β} :
784
805
s.prod (λi, single (a i) (b i)) = single (s.sum a) (s.prod b) :=
785
806
finset.induction_on s (by simp [one_def]) (by simp [single_mul_single] {contextual := tt})
0 commit comments