Skip to content

Commit

Permalink
feat(data/multiset): add prod_map_add
Browse files Browse the repository at this point in the history
  • Loading branch information
johoelzl committed Sep 5, 2018
1 parent abd6ab5 commit e105c9e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/multiset.lean
Expand Up @@ -1639,6 +1639,14 @@ end
by have := card_powerset s;
rwa [← diagonal_map_fst, card_map] at this

lemma prod_map_add [comm_semiring β] {s : multiset α} {f g : α → β} :
prod (s.map (λa, f a + g a)) = sum ((diagonal s).map (λp, (p.1.map f).prod * (p.2.map g).prod)) :=
begin
refine s.induction_on _ _,
{ simp },
{ assume a s ih, simp [ih, add_mul, mul_comm, mul_left_comm, mul_assoc, sum_map_mul_left.symm] },
end

/- countp -/

/-- `countp p s` counts the number of elements of `s` (with multiplicity) that
Expand Down

0 comments on commit e105c9e

Please sign in to comment.