Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: Unions and intersections indexed by Finset.sigma #10851

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Mathlib/Data/Fintype/Card.lean
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ theorem card_eq_zero_iff : card α = 0 ↔ IsEmpty α := by
card_eq_zero_iff.2 ‹_›
#align fintype.card_eq_zero Fintype.card_eq_zero

alias card_of_isEmpty := card_eq_zero

theorem card_eq_one_iff_nonempty_unique : card α = 1 ↔ Nonempty (Unique α) :=
⟨fun h =>
let ⟨d, h⟩ := Fintype.card_eq_one_iff.mp h
Expand Down
14 changes: 13 additions & 1 deletion Mathlib/Data/Fintype/Sigma.lean
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open Nat

universe u v

variable {α β γ : Type*}
variable {ι α β γ : Type*} {κ : ι → Type*} [∀ i, Fintype (κ i)]

open Finset Function

Expand All @@ -36,3 +36,15 @@ instance PSigma.fintype {α : Type*} {β : α → Type*} [Fintype α] [∀ a, Fi
Fintype (Σ'a, β a) :=
Fintype.ofEquiv _ (Equiv.psigmaEquivSigma _).symm
#align psigma.fintype PSigma.fintype

lemma Set.biUnion_finsetSigma_univ (s : Finset ι) (f : Sigma κ → Set α) :
⋃ ij ∈ s.sigma fun _ ↦ Finset.univ, f ij = ⋃ i ∈ s, ⋃ j, f ⟨i, j⟩ := by aesop

lemma Set.biUnion_finsetSigma_univ' (s : Finset ι) (f : ∀ i, κ i → Set α) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of the notatiion f : ∀ i, κ i → Set α, but I guess PiNotation is not available here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's available, actually, but I'm afraid using it is a lost cause. I can only find it in comments.

⋃ i ∈ s, ⋃ j, f i j = ⋃ ij ∈ s.sigma fun _ ↦ Finset.univ, f ij.1 ij.2 := by aesop

lemma Set.biInter_finsetSigma_univ (s : Finset ι) (f : Sigma κ → Set α) :
⋂ ij ∈ s.sigma fun _ ↦ Finset.univ, f ij = ⋂ i ∈ s, ⋂ j, f ⟨i, j⟩ := by aesop

lemma Set.biInter_finsetSigma_univ' (s : Finset ι) (f : ∀ i, κ i → Set α) :
⋂ i ∈ s, ⋂ j, f i j = ⋂ ij ∈ s.sigma fun _ ↦ Finset.univ, f ij.1 ij.2 := by aesop