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] - fix(Data/Set/Image): simp confluence issues with image_subset_iff #8683

Closed
wants to merge 11 commits into from

Conversation

timotree3
Copy link
Collaborator

@timotree3 timotree3 commented Nov 28, 2023

image_subset_iff is a questionable simp lemma because it converts an application of Set.image into an application of Set.preimage unconditionally. This means that if any simp lemma applies to images, there must be a corresponding lemma for preimages. These lemmas are what I found missing after loogling.

I also added machine-checked examples of each confluence issue to a new file tests/simp_confluence.


Open in Gitpod

`image_subset_iff` is a questionable simp lemma because it converts
an application of image into preimage unconditionally. This means that if any
simp lemma applies to applications of images, there must be a corresponding
lemma for applications of preimage. These lemmas are what I found missing after
loogling.
@timotree3 timotree3 added awaiting-review The author would like community review of the PR easy < 20s of review time. See the lifecycle page for guidelines. labels Nov 28, 2023
@PatrickMassot PatrickMassot added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Nov 28, 2023
@timotree3 timotree3 added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes easy < 20s of review time. See the lifecycle page for guidelines. labels Nov 28, 2023
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
Mathlib/Data/Set/Image.lean Outdated Show resolved Hide resolved
@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Dec 12, 2023
@timotree3 timotree3 added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Feb 10, 2024
Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

I am now convinced this is a good change.

Would you mind checking that the analogous situations for Finset are confluent?

@@ -654,6 +654,7 @@ theorem empty_ne_univ [Nonempty α] : (∅ : Set α) ≠ univ := fun e =>
theorem subset_univ (s : Set α) : s ⊆ univ := fun _ _ => trivial
#align set.subset_univ Set.subset_univ

@[simp]
theorem univ_subset_iff {s : Set α} : univ ⊆ s ↔ s = univ :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you mind adding the corresponding lemma for Finset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

timotree3 and others added 2 commits February 10, 2024 11:19
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@timotree3
Copy link
Collaborator Author

I don't believe there is an analogous confluence issue for Finset because Finset.image_subset_iff_subset_preimage is not marked @[simp]

Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

maintainer merge

Copy link

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

Copy link
Contributor

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

bors r+

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Feb 12, 2024
mathlib-bors bot pushed a commit that referenced this pull request Feb 12, 2024
…8683)

`image_subset_iff` is a questionable simp lemma because it converts an application of `Set.image` into an application of `Set.preimage` unconditionally. This means that if any simp lemma applies to images, there must be a corresponding lemma for preimages. These lemmas are what I found missing after loogling.

I also added machine-checked examples of each confluence issue to a new file `tests/simp_confluence`.
@mathlib-bors
Copy link

mathlib-bors bot commented Feb 12, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title fix(Data/Set/Image): simp confluence issues with image_subset_iff [Merged by Bors] - fix(Data/Set/Image): simp confluence issues with image_subset_iff Feb 12, 2024
@mathlib-bors mathlib-bors bot closed this Feb 12, 2024
@mathlib-bors mathlib-bors bot deleted the TCB/image-subset-confl branch February 12, 2024 11:39
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
…8683)

`image_subset_iff` is a questionable simp lemma because it converts an application of `Set.image` into an application of `Set.preimage` unconditionally. This means that if any simp lemma applies to images, there must be a corresponding lemma for preimages. These lemmas are what I found missing after loogling.

I also added machine-checked examples of each confluence issue to a new file `tests/simp_confluence`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants