Skip to content

Commit

Permalink
fix(algebra/big_operators/ring): finset.sum_mul_sum is true in a no…
Browse files Browse the repository at this point in the history
…n-assoc non-unital semiring (#8436)
  • Loading branch information
ADedecker committed Jul 27, 2021
1 parent 3b590f3 commit 7ae8da4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/algebra/big_operators/ring.lean
Expand Up @@ -34,6 +34,11 @@ lemma sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
lemma mul_sum : b * (∑ x in s, f x) = ∑ x in s, b * f x :=
(s.sum_hom _).symm

lemma sum_mul_sum {ι₁ : Type*} {ι₂ : Type*} (s₁ : finset ι₁) (s₂ : finset ι₂)
(f₁ : ι₁ → β) (f₂ : ι₂ → β) :
(∑ x₁ in s₁, f₁ x₁) * (∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁.product s₂, f₁ p.1 * f₂ p.2 :=
by { rw [sum_product, sum_mul, sum_congr rfl], intros, rw mul_sum }

end semiring

section semiring
Expand Down Expand Up @@ -88,11 +93,6 @@ begin
{ simp only [mem_image], rintro ⟨⟨_, hm⟩, _, rfl⟩, exact ha hm } }
end

lemma sum_mul_sum {ι₁ : Type*} {ι₂ : Type*} (s₁ : finset ι₁) (s₂ : finset ι₂)
(f₁ : ι₁ → β) (f₂ : ι₂ → β) :
(∑ x₁ in s₁, f₁ x₁) * (∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁.product s₂, f₁ p.1 * f₂ p.2 :=
by { rw [sum_product, sum_mul, sum_congr rfl], intros, rw mul_sum }

open_locale classical

/-- The product of `f a + g a` over all of `s` is the sum
Expand Down

0 comments on commit 7ae8da4

Please sign in to comment.