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/mv_polynomial): add missing decidable_eq arguments to lemmas #18848

Closed
wants to merge 11 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Apr 21, 2023

This does not change the type of any definitions; the effect of this PR is to make the statement of the lemmas syntactically more general.

To ensure this catches them all, this removes open_locale classical from the beginning of every file in data/mv_polynomial and ring_theory/mv_polynomial.

For definitions which bake in a classical.dec_eq assumption, this adds a lemma proven by convert rfl that unfolds them to a version with an arbitrary decidable_eq instance, following a pattern established elsewhere.

Unlike previous refactors of this style this doesn't seemed to have helped any downstream proofs much.


Open in Gitpod

Unlike #18791, this does not:

  • make any changes to data/polynomial; I will do that in a separate PR
  • add decidable_eq to any defs; this is a much bigger change and not something worth exploring before the port is done

@github-actions github-actions bot added the modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. label Apr 21, 2023
@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. mathport For compatibility with Lean 4 changes, to simplify porting labels Apr 21, 2023
@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label Apr 21, 2023
Copy link
Collaborator

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

Thank you for taking care of this! It touches quite a few files so let's get this merged quickly.

bors d+

src/data/mv_polynomial/basic.lean Outdated Show resolved Hide resolved

lemma degree_of_def [decidable_eq σ] (n : σ) (p : mv_polynomial σ R) :
p.degree_of n = p.degrees.count n :=
by convert rfl
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't convert rfl just the same as congr?

Suggested change
by convert rfl
by congr

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this doesn't work.

@bors
Copy link

bors bot commented May 10, 2023

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

@eric-wieser
Copy link
Member Author

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 May 14, 2023
bors bot pushed a commit that referenced this pull request May 14, 2023
…as (#18848)

This does not change the type of any definitions; the effect of this PR is to make the *statement* of the lemmas syntactically more general.

To ensure this catches them all, this removes `open_locale classical` from the beginning of every file in `data/mv_polynomial` and `ring_theory/mv_polynomial`.

For definitions which bake in a `classical.dec_eq` assumption, this adds a lemma proven by `convert rfl` that unfolds them to a version with an arbitrary `decidable_eq` instance, following a pattern established elsewhere.

Unlike previous refactors of this style this doesn't seemed to have helped any downstream proofs much.
@bors
Copy link

bors bot commented May 15, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title fix(data/mv_polynomial): add missing decidable_eq arguments to lemmas [Merged by Bors] - fix(data/mv_polynomial): add missing decidable_eq arguments to lemmas May 15, 2023
@bors bors bot closed this May 15, 2023
@bors bors bot deleted the eric-wieser/mv_poly-basic-deceq branch May 15, 2023 00:36
eric-wieser added a commit to leanprover-community/mathlib4 that referenced this pull request May 15, 2023
This is currently just a placeholder
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 21, 2023
I've been someone sloppy about forward-porting the exact mathport here; a lot of the `classical` additions result in the whole proof being indented, which IMO just adds noise to the diff.

What's important is that:
* `open Classical` is removed from all the same files
* `[DecidableEq _]` is added in the same position to all the same lemmas. In theory mathport will detect if we mess this up, so it's not essential to catch this in review. The linter will tell us if it is added unnecessarily, and the build will fail if is not added someewhere it is needed; so only the argument order is at risk of being wrong.
* The new `foo_def` lemmas are all added in `variables.lean`
qawbecrdtey pushed a commit to qawbecrdtey/greedoid-mathlib4 that referenced this pull request Jun 12, 2023
…mmunity#4007)

I've been someone sloppy about forward-porting the exact mathport here; a lot of the `classical` additions result in the whole proof being indented, which IMO just adds noise to the diff.

What's important is that:
* `open Classical` is removed from all the same files
* `[DecidableEq _]` is added in the same position to all the same lemmas. In theory mathport will detect if we mess this up, so it's not essential to catch this in review. The linter will tell us if it is added unnecessarily, and the build will fail if is not added someewhere it is needed; so only the argument order is at risk of being wrong.
* The new `foo_def` lemmas are all added in `variables.lean`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mathport For compatibility with Lean 4 changes, to simplify porting modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. 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

2 participants