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] - refactor(data/set/pairwise): Indexed sets as arguments to set.pairwise_disjoint #9898

Closed
wants to merge 17 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented Oct 23, 2021

This will allow to express the bind operation: you can't currently express that the pairwise disjoint union of pairwise disjoint sets pairwise disjoint. Here's the corresponding statement with finset.sup_indep (defined in #9867):

lemma sup_indep.sup {s : finset ι'} {g : ι' → finset ι} {f : ι → α}
  (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
  (s.sup g).sup_indep f :=

You currently can't do set.pairwise_disjoint s (λ i, ⋃ x ∈ g i, f x).


Open in Gitpod

@eric-wieser
Copy link
Member

Can you expand a little upon the motivation in the PR description? The fact this introduces a bunch of ids in downstream uses makes it not so obviously an improvement to me.

@YaelDillies YaelDillies added the awaiting-review The author would like community review of the PR label Oct 23, 2021
@YaelDillies
Copy link
Collaborator Author

What do you think about it now? The fact that I had to add a bunch of id is misleading: All current uses of set.pairwise_disjoint were constrained by the fact you needed to use id, so me adding a bunch of them is expected. Note however that some lemmas do require the generalization I'm providing here, finset.prod_bUnion for example.

@jcommelin
Copy link
Member

@YaelDillies I think Eric's point is that the ids are now explicit. I understand that you are generalizing an existing thing. Should there be a wrapper for the old definition that hides the ids?

@YaelDillies
Copy link
Collaborator Author

YaelDillies commented Oct 25, 2021

I think not. The current definition isn't used much and my proposed generalization is quite light.
By wrapper, I assume you mean a new definition?

@eric-wieser
Copy link
Member

Note however that some lemmas do require the generalization I'm providing here, finset.prod_bUnion for example.

That's not included in this PR though, right?

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Oct 28, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Oct 29, 2021
@@ -303,20 +304,17 @@ end

@[to_additive]
lemma prod_bUnion [decidable_eq α] {s : finset γ} {t : γ → finset α} :
(∀ x ∈ s, ∀ y ∈ s, x ≠ y → disjoint (t x) (t y)) →
(set.pairwise_disjoint ↑s t) →
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a slightly worse lemma than the original, as now the caller has to deal with awkward coercions.

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 really is fine. After all, I managed to golf the proofs that were using it already.

@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Oct 31, 2021
# Conflicts:
#	src/data/set/pairwise.lean
#	src/measure_theory/covering/besicovitch.lean
#	src/measure_theory/covering/vitali.lean
#	src/topology/bases.lean
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Oct 31, 2021
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Nov 4, 2021
bors bot pushed a commit that referenced this pull request Nov 4, 2021
…se_disjoint` (#9898)

This will allow to express the bind operation: you can't currently express that the pairwise disjoint union of pairwise disjoint sets pairwise disjoint. Here's the corresponding statement with `finset.sup_indep` (defined in #9867):
```lean
lemma sup_indep.sup {s : finset ι'} {g : ι' → finset ι} {f : ι → α}
  (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
  (s.sup g).sup_indep f :=
```
You currently can't do `set.pairwise_disjoint s (λ i, ⋃ x ∈ g i, f x)`.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@bors
Copy link

bors bot commented Nov 4, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Nov 4, 2021
…se_disjoint` (#9898)

This will allow to express the bind operation: you can't currently express that the pairwise disjoint union of pairwise disjoint sets pairwise disjoint. Here's the corresponding statement with `finset.sup_indep` (defined in #9867):
```lean
lemma sup_indep.sup {s : finset ι'} {g : ι' → finset ι} {f : ι → α}
  (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
  (s.sup g).sup_indep f :=
```
You currently can't do `set.pairwise_disjoint s (λ i, ⋃ x ∈ g i, f x)`.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@bors
Copy link

bors bot commented Nov 4, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(data/set/pairwise): Indexed sets as arguments to set.pairwise_disjoint [Merged by Bors] - refactor(data/set/pairwise): Indexed sets as arguments to set.pairwise_disjoint Nov 4, 2021
@bors bors bot closed this Nov 4, 2021
@bors bors bot deleted the pw_disj_index branch November 4, 2021 18:48
ericrbg pushed a commit that referenced this pull request Nov 9, 2021
…se_disjoint` (#9898)

This will allow to express the bind operation: you can't currently express that the pairwise disjoint union of pairwise disjoint sets pairwise disjoint. Here's the corresponding statement with `finset.sup_indep` (defined in #9867):
```lean
lemma sup_indep.sup {s : finset ι'} {g : ι' → finset ι} {f : ι → α}
  (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
  (s.sup g).sup_indep f :=
```
You currently can't do `set.pairwise_disjoint s (λ i, ⋃ x ∈ g i, f x)`.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants