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] - chore(Algebra/BigOperators/List): Use Std lemmas #11725

Closed
wants to merge 26 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented Mar 27, 2024

  • Make Algebra.BigOperators.List.Basic, Data.List.Chain not depend on Data.Nat.Order.Basic by using Nat-specific Std lemmas rather than general mathlib ones. I leave the Data.Nat.Basic import since Algebra.BigOperators.List.Basic is algebra territory.
  • Make Algebra.BigOperators.List.Basic not depend on Algebra.Divisibility.Basic. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
  • As a consequence, move the divisibility and MonoidWithZero lemmas from Algebra.BigOperators.List.Basic to Algebra.BigOperators.List.Lemmas.
  • Move the content of Algebra.BigOperators.List.Defs to Algebra.BigOperators.List.Basic since no file imported the former without the latter and their imports are becoming very close after this PR.
  • Make Data.List.Count, Data.List.Dedup, Data.List.ProdSigma, Data.List.Zip not depend on Algebra.BigOperators.List.Basic.
  • As a consequence, move the big operators lemmas that were in there to Algebra.BigOperators.List.Basic. For the lemmas that were Nat -specific, keep a version of them stated using Nat.sum.
  • To help with this, add Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum.

Open in Gitpod

@YaelDillies YaelDillies added awaiting-review The author would like community review of the PR awaiting-CI labels Mar 27, 2024
Mathlib.lean Outdated Show resolved Hide resolved
Mathlib.lean Outdated Show resolved Hide resolved
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Mar 27, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Mar 27, 2024
@eric-wieser
Copy link
Member

I'm not convinced that introducing Nat.sum into lemma statements is preferable; this creates a real inconvenience (unhelpfully stated lemmas) to resolve a mostly superficial one ("too many imports"(

@YaelDillies
Copy link
Collaborator Author

Note that the lemma statements haven't changed. It's just that there are a few extra lemmas stated using Nat.sum

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added blocked-by-other-PR This PR depends on another PR which is still in the queue. merge-conflict The PR has a merge conflict with master, and needs manual merging. labels Mar 28, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Mar 28, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added merge-conflict The PR has a merge conflict with master, and needs manual merging. blocked-by-other-PR This PR depends on another PR which is still in the queue. and removed blocked-by-other-PR This PR depends on another PR which is still in the queue. labels Mar 30, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed merge-conflict The PR has a merge conflict with master, and needs manual merging. blocked-by-other-PR This PR depends on another PR which is still in the queue. labels Mar 31, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Comment on lines +618 to +620
induction' l with a l ih
· simp only [Nat.zero_mod, map_nil]
· simpa only [map_cons, sum_cons, Nat.mod_add_mod, Nat.add_mod_mod] using congr((a + $ih) % n)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nat.add_mod rewrites infinitely on its own. I'm not sure how this proof ever worked.

Comment on lines +624 to +626
induction' l with a l ih
· simp only [Nat.zero_mod, map_nil]
· simpa only [prod_cons, map_cons, Nat.mod_mul_mod, Nat.mul_mod_mod] using congr((a * $ih) % n)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Similarly, simping with Nat.mul_mod is a terrible idea.

Copy link
Collaborator

@Ruben-VandeVelde Ruben-VandeVelde 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

github-actions bot commented Apr 5, 2024

🚀 Pull request has been placed on the maintainer queue by Ruben-VandeVelde.

@dupuisf
Copy link
Contributor

dupuisf commented Apr 5, 2024

bors r+

@github-actions github-actions 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 Apr 5, 2024
@YaelDillies YaelDillies changed the title chore(Data/List/BigOperators): Use Std lemmas chore(Algebra/BigOperators/List): Use Std lemmas Apr 5, 2024
mathlib-bors bot pushed a commit that referenced this pull request Apr 5, 2024
* Make `Algebra.BigOperators.List.Basic`, `Data.List.Chain` not depend on `Data.Nat.Order.Basic` by using `Nat`-specific Std lemmas rather than general mathlib ones. I leave the `Data.Nat.Basic` import since `Algebra.BigOperators.List.Basic` is algebra territory.
* Make `Algebra.BigOperators.List.Basic` not depend on `Algebra.Divisibility.Basic`. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
* As a consequence, move the divisibility and `MonoidWithZero` lemmas from `Algebra.BigOperators.List.Basic` to `Algebra.BigOperators.List.Lemmas`.
* Move the content of `Algebra.BigOperators.List.Defs` to `Algebra.BigOperators.List.Basic` since no file imported the former without the latter and their imports are becoming very close after this PR.
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Zip` not depend on `Algebra.BigOperators.List.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Algebra.BigOperators.List.Basic`. For the lemmas that were `Nat` -specific, keep a version of them stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
@mathlib-bors
Copy link

mathlib-bors bot commented Apr 6, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Algebra/BigOperators/List): Use Std lemmas [Merged by Bors] - chore(Algebra/BigOperators/List): Use Std lemmas Apr 6, 2024
@mathlib-bors mathlib-bors bot closed this Apr 6, 2024
@mathlib-bors mathlib-bors bot deleted the stdify_list_big_ops branch April 6, 2024 00:52
Louddy pushed a commit that referenced this pull request Apr 15, 2024
* Make `Algebra.BigOperators.List.Basic`, `Data.List.Chain` not depend on `Data.Nat.Order.Basic` by using `Nat`-specific Std lemmas rather than general mathlib ones. I leave the `Data.Nat.Basic` import since `Algebra.BigOperators.List.Basic` is algebra territory.
* Make `Algebra.BigOperators.List.Basic` not depend on `Algebra.Divisibility.Basic`. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
* As a consequence, move the divisibility and `MonoidWithZero` lemmas from `Algebra.BigOperators.List.Basic` to `Algebra.BigOperators.List.Lemmas`.
* Move the content of `Algebra.BigOperators.List.Defs` to `Algebra.BigOperators.List.Basic` since no file imported the former without the latter and their imports are becoming very close after this PR.
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Zip` not depend on `Algebra.BigOperators.List.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Algebra.BigOperators.List.Basic`. For the lemmas that were `Nat` -specific, keep a version of them stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
* Make `Algebra.BigOperators.List.Basic`, `Data.List.Chain` not depend on `Data.Nat.Order.Basic` by using `Nat`-specific Std lemmas rather than general mathlib ones. I leave the `Data.Nat.Basic` import since `Algebra.BigOperators.List.Basic` is algebra territory.
* Make `Algebra.BigOperators.List.Basic` not depend on `Algebra.Divisibility.Basic`. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
* As a consequence, move the divisibility and `MonoidWithZero` lemmas from `Algebra.BigOperators.List.Basic` to `Algebra.BigOperators.List.Lemmas`.
* Move the content of `Algebra.BigOperators.List.Defs` to `Algebra.BigOperators.List.Basic` since no file imported the former without the latter and their imports are becoming very close after this PR.
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Zip` not depend on `Algebra.BigOperators.List.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Algebra.BigOperators.List.Basic`. For the lemmas that were `Nat` -specific, keep a version of them stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
* Make `Algebra.BigOperators.List.Basic`, `Data.List.Chain` not depend on `Data.Nat.Order.Basic` by using `Nat`-specific Std lemmas rather than general mathlib ones. I leave the `Data.Nat.Basic` import since `Algebra.BigOperators.List.Basic` is algebra territory.
* Make `Algebra.BigOperators.List.Basic` not depend on `Algebra.Divisibility.Basic`. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
* As a consequence, move the divisibility and `MonoidWithZero` lemmas from `Algebra.BigOperators.List.Basic` to `Algebra.BigOperators.List.Lemmas`.
* Move the content of `Algebra.BigOperators.List.Defs` to `Algebra.BigOperators.List.Basic` since no file imported the former without the latter and their imports are becoming very close after this PR.
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Zip` not depend on `Algebra.BigOperators.List.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Algebra.BigOperators.List.Basic`. For the lemmas that were `Nat` -specific, keep a version of them stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
callesonne pushed a commit that referenced this pull request Apr 22, 2024
* Make `Algebra.BigOperators.List.Basic`, `Data.List.Chain` not depend on `Data.Nat.Order.Basic` by using `Nat`-specific Std lemmas rather than general mathlib ones. I leave the `Data.Nat.Basic` import since `Algebra.BigOperators.List.Basic` is algebra territory.
* Make `Algebra.BigOperators.List.Basic` not depend on `Algebra.Divisibility.Basic`. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.
* As a consequence, move the divisibility and `MonoidWithZero` lemmas from `Algebra.BigOperators.List.Basic` to `Algebra.BigOperators.List.Lemmas`.
* Move the content of `Algebra.BigOperators.List.Defs` to `Algebra.BigOperators.List.Basic` since no file imported the former without the latter and their imports are becoming very close after this PR.
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Zip` not depend on `Algebra.BigOperators.List.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Algebra.BigOperators.List.Basic`. For the lemmas that were `Nat` -specific, keep a version of them stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer-merge 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

5 participants