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

feat: A disjoint union is finite iff all sets are finite, and all but finitely many are empty #20457

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sgouezel
Copy link
Contributor

@sgouezel sgouezel commented Jan 3, 2025

From the Carleson project


Open in Gitpod

Copy link

github-actions bot commented Jan 3, 2025

PR summary 67885573b4

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ PairwiseDisjoint.finite_biUnion_iff
+ PairwiseDisjoint.finite_iUnion_iff
+ finite_iUnion_iff
+ finite_iUnion_of_subsingleton

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label Jan 3, 2025
@sgouezel
Copy link
Contributor Author

sgouezel commented Jan 4, 2025

Thanks for the review!

finitely many are empty. -/
lemma PairwiseDisjoint.finite_biUnion_iff {f : β → Set α} {s : Set β}
(hs : s.PairwiseDisjoint f) :
Set.Finite (⋃ i ∈ s, f i)
Copy link
Member

Choose a reason for hiding this comment

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

I'd liked to have seen this be of the more general form

Suggested change
Set.Finite (⋃ i ∈ s, f i)
Set.Finite (⋃ (i) (h : i ∈ s, f i h)

but I guess the definition of PairwiseDisjoint doesn't permit this; so no action needed.

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

bors d+

Consider waiting a day or two to let @YaelDillies have a look for any other API like elim_set that can make this more concise

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 4, 2025

✌️ sgouezel can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

Comment on lines +184 to +189
/-- An indexed union of pairwise disjoint sets is finite iff all sets are finite, and all but
finitely many are empty. -/
lemma PairwiseDisjoint.finite_iUnion_iff {f : β → Set α} (hs : univ.PairwiseDisjoint f) :
Set.Finite (⋃ i, f i) ↔ (∀ i, Set.Finite (f i)) ∧ Set.Finite {i | (f i).Nonempty} := by
rw [← biUnion_univ, hs.finite_biUnion_iff]
simp
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this now duplicates finite_iUnion_iff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-data Data (lists, quotients, numbers, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants