Skip to content

[Merged by Bors] - chore(Data/Set/Basic): deprecate lemmas that abuse the Set α := α → Prop defeq#25669

Closed
YaelDillies wants to merge 4 commits intomasterfrom
deprecate_set_aubuse
Closed

[Merged by Bors] - chore(Data/Set/Basic): deprecate lemmas that abuse the Set α := α → Prop defeq#25669
YaelDillies wants to merge 4 commits intomasterfrom
deprecate_set_aubuse

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies commented Jun 10, 2025


Open in Gitpod

@YaelDillies YaelDillies requested a review from eric-wieser June 10, 2025 16:16
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 10, 2025

PR summary 8024e6939a

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

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).

@YaelDillies YaelDillies force-pushed the deprecate_set_aubuse branch from 36306f9 to 0e5e4a7 Compare June 10, 2025 16:35
@b-mehta b-mehta added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Jun 10, 2025
@YaelDillies YaelDillies added the t-data Data (lists, quotients, numbers, etc) label Jun 11, 2025
@@ -152,13 +152,15 @@ theorem realize_genericPolyMapSurjOnOfInjOn
S.InjOn f ↔ ∀ x y, x ∈ S → y ∈ S → f x = f y → x = y := by
simp [Set.InjOn]; tauto
simp only [Sentence.Realize, Formula.Realize, genericPolyMapSurjOnOfInjOn, Formula.relabel,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Oof, this is way too huge of a simp only. That goes on my tech debt todo list.)

@YaelDillies YaelDillies force-pushed the deprecate_set_aubuse branch from 1c78c2b to 08be2b4 Compare June 11, 2025 10:04
@alreadydone
Copy link
Copy Markdown
Contributor

alreadydone commented Jun 11, 2025

Thanks for the PR! I've observed that when you apply defs involving Sets (example) to Subtypes, the set found by unification will actually be a predicate, so the lemmas deprecated in this PR becomes applicable. I haven't checked whether this issue contribute to the lengthening of some proofs in this PR. Is there a good way to solve this issue, maybe through some unification hint that inserts the setOf?

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@YaelDillies
Copy link
Copy Markdown
Contributor Author

I haven't checked whether this issue contribute to the lengthening of some proofs in this PR

What proofs that get longer do you have in mind? I think all changes in the diff right now are unambiguously improvements, except possibly
https://github.com/leanprover-community/mathlib4/pull/25669/files#diff-d3b8a65b336e621c5039606dc97cab4075b404f6559aedbbdb102e2d9288958eL369-R369
which is pretty minor anyway.

I've observed that when you apply defs involving Sets (example) to Subtypes, the set found by unification will actually be a predicate, so the lemmas deprecated in this PR becomes applicable

↥s is defined as {x // x ∈ s}, not {x // s x}, so everything is fine and the lemmas I am deleting do not apply.

Here's the criterion to decide whether some downstream proof is affected by the current PR: "Does making Set α a one-field structure break the proof?". Equiv.setCongr doesn't break if one does that, therefore it isn't affected.

@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Jun 11, 2025
Copy link
Copy Markdown
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 with Eric's suggestion.

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 12, 2025

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

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jun 12, 2025
@YaelDillies
Copy link
Copy Markdown
Contributor Author

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Jun 12, 2025
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 12, 2025

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request Jun 12, 2025
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 12, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Data/Set/Basic): deprecate lemmas that abuse the Set α := α → Prop defeq [Merged by Bors] - chore(Data/Set/Basic): deprecate lemmas that abuse the Set α := α → Prop defeq Jun 12, 2025
@mathlib-bors mathlib-bors bot closed this Jun 12, 2025
@mathlib-bors mathlib-bors bot deleted the deprecate_set_aubuse branch June 12, 2025 11:25
vlad902 added a commit to vlad902/mathlib4 that referenced this pull request Jun 12, 2025
* master: (447 commits)
  chore(Data/Set): move very basic lemmas earlier (leanprover-community#25707)
  feat: preserve draft status when migrating PRs to fork (leanprover-community#25777)
  chore(Data/Set/Basic): deprecate lemmas that abuse the `Set α := α → Prop` defeq (leanprover-community#25669)
  refactor: redefine `ProperCone` as an `abbrev` for `ClosedSubmodule` (leanprover-community#25204)
  feat: interaction between ContinuousLinearMap.coprod and ContinuousLinearEquiv.prodComm (leanprover-community#25564)
  fix: outdated docstring (leanprover-community#25717)
  feat(MeasureTheory): convolution of measures with densities  (leanprover-community#25718)
  feat: make sure that the simp normal form of equiv-like classes pushes `symm` and `trans` to the right (leanprover-community#25604)
  feat(ModelTheory): Formula.iSup and iInf (leanprover-community#21948)
  feat(RingTheory/Polynomial/ContentIdeal): the content ideal of a polynomial. (leanprover-community#25333)
  fix: typo in labels_from_comment.yml (leanprover-community#25727)
  feat: is{Inducing,Embedding}_prodMkLeft (leanprover-community#25705)
  feat: check that the mathlib options exist (leanprover-community#25687)
  feat(Algebra/Group/Even): Add missing lemmas (leanprover-community#20818)
  refactor: make `Matrix.kroneckerTMulAlgEquiv` heterogeneous (leanprover-community#25693)
  feat: allow contributors to remove labels with comments (leanprover-community#25723)
  chore: disable build.yml and bors.yml on forks (leanprover-community#25722)
  feat: improvements to user_activity_report.py (leanprover-community#25721)
  chore: update the migration script to check for necessary permissions and prefer ssh if possible (leanprover-community#25701)
  chore: update the migration script to check for necessary permissions and prefer ssh if possible (leanprover-community#25701)
  ...
@alreadydone
Copy link
Copy Markdown
Contributor

alreadydone commented Jun 12, 2025

What proofs that get longer do you have in mind?

I was referring to this comment but you've fixed it. I did confuse myself a bit when I wrote my previous comment, and I'm sorry for that. I realized that when dealing with Subtype that is not CoeSort of Set, I should use e.g. Equiv.subtypeEquivProp and Homeomorph.subtype instead of Equiv.setCongr and Homeomorph.setCongr. I recall that in some cases the Subtype version is missing and the Set version gets used in other decls about Subtype, resulting in the unification issue I described when trying to use those decls, but I don't have an example right now.

pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Jun 15, 2025
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Jun 15, 2025
callesonne pushed a commit to callesonne/mathlib4 that referenced this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants