Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: port Algebra.BigOperators.Multiset.Lemmas (#1536)
- Loading branch information
1 parent
40d6bcd
commit 5f003c0
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/- | ||
Copyright (c) 2019 Chris Hughes. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Chris Hughes, Bhavik Mehta, Eric Wieser | ||
! This file was ported from Lean 3 source module algebra.big_operators.multiset.lemmas | ||
! leanprover-community/mathlib commit 9003f28797c0664a49e4179487267c494477d853 | ||
! Please do not edit these lines, except to modify the commit id | ||
! if you have ported upstream changes. | ||
-/ | ||
import Mathlib.Data.List.BigOperators.Lemmas | ||
import Mathlib.Algebra.BigOperators.Multiset.Basic | ||
|
||
/-! # Lemmas about `Multiset.sum` and `Multiset.prod` requiring extra algebra imports -/ | ||
|
||
|
||
variable {α : Type _} | ||
|
||
namespace Multiset | ||
|
||
theorem dvd_prod [CommMonoid α] {s : Multiset α} {a : α} : a ∈ s → a ∣ s.prod := | ||
Quotient.inductionOn s (fun l a h => by simpa using List.dvd_prod h) a | ||
#align multiset.dvd_prod Multiset.dvd_prod | ||
|
||
@[to_additive] | ||
theorem prod_eq_one_iff [CanonicallyOrderedMonoid α] {m : Multiset α} : | ||
m.prod = 1 ↔ ∀ x ∈ m, x = (1 : α) := | ||
Quotient.inductionOn m fun l => by simpa using List.prod_eq_one_iff l | ||
#align multiset.prod_eq_one_iff Multiset.prod_eq_one_iff | ||
|
||
end Multiset | ||
|
||
open Multiset | ||
|
||
namespace Commute | ||
|
||
variable [NonUnitalNonAssocSemiring α] (s : Multiset α) | ||
|
||
theorem multiset_sum_right (a : α) (h : ∀ b ∈ s, Commute a b) : Commute a s.sum := by | ||
induction s using Quotient.inductionOn | ||
rw [quot_mk_to_coe, coe_sum] | ||
exact Commute.list_sum_right _ _ h | ||
#align commute.multiset_sum_right Commute.multiset_sum_right | ||
|
||
theorem multiset_sum_left (b : α) (h : ∀ a ∈ s, Commute a b) : Commute s.sum b := | ||
((Commute.multiset_sum_right _ _) fun _ ha => (h _ ha).symm).symm | ||
#align commute.multiset_sum_left Commute.multiset_sum_left | ||
|
||
end Commute |