Skip to content

Commit

Permalink
prod_disjoint_filters_on_set
Browse files Browse the repository at this point in the history
  • Loading branch information
mans0954 committed Dec 4, 2024
1 parent aa37450 commit 32d9c90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Mathlib/Algebra/BigOperators/Group/Finset.lean
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,17 @@ theorem prod_disjiUnion (s : Finset ι) (t : ι → Finset α) (h) :
congr
exact prod_const_one.symm

@[to_additive]
theorem prod_disjoint_filters_on_set (s : Finset α) (p q : α → Prop) [DecidablePred p]
[DecidablePred q] (h : ∀ x ∈ s.filter (fun x => p x ∨ q x), ¬ (p x ∧ q x)) (f : α → β) :
(∏ x ∈ s with (p x ∨ q x), f x) = (∏ x ∈ s with p x, f x) * (∏ x ∈ s with q x, f x) := by
rw [← prod_disjUnion (disjoint_of_not_and_on_set (fun x ↦ p x) (fun x ↦ q x) h)]
exact prod_congr (by
ext _
simp only [mem_filter, mem_disjUnion]
exact and_or_left
) (fun _ _ ↦ rfl)

@[to_additive]
theorem prod_union_inter [DecidableEq α] :
(∏ x ∈ s₁ ∪ s₂, f x) * ∏ x ∈ s₁ ∩ s₂, f x = (∏ x ∈ s₁, f x) * ∏ x ∈ s₂, f x :=
Expand Down

0 comments on commit 32d9c90

Please sign in to comment.