Zulip Chat Archive

Stream: Is there code for X?

Topic: Iff implies Finset.prod eq


Edison Xie (Dec 01 2025 at 12:58):

Should we (if not already) have this in mathlib?

open scoped Classical in
@[to_additive]
lemma Finset.prod_filter_eq_of_iff {ι M : Type*} [CommMonoid M] {s : Finset ι}
    {p q : ι → Prop} (h : ∀ x ∈ s, p x ↔ q x) (f : ι → M) :
    ∏ i ∈ s with p i, f i = ∏ i ∈ s with q i, f i :=
  Finset.prod_congr (by ext; simp_all) fun _ _ ↦ rfl

Miyahara Kō (Dec 17 2025 at 15:41):

This lemma is not yet in mathlib but I think Finset.filter_congr is sufficient.

Eric Wieser (Dec 17 2025 at 21:25):

This is the downside of having notation which hides composition

Yaël Dillies (Dec 17 2025 at 22:08):

I agree, but the upside is too great


Last updated: Feb 28 2026 at 14:05 UTC