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(Data/List): Depend less on big operators #11741

Closed
wants to merge 4 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented Mar 28, 2024

  • Make Data.List.Count, Data.List.Dedup, Data.List.ProdSigma, Data.List.Range, Data.List.Rotate, Data.List.Zip not depend on Data.List.BigOperators.Basic.
  • As a consequence, move the big operators lemmas that were in there to Data.List.BigOperators.Basic. For the lemmas that were Nat-specific, keep a version of them in the original file but stated using Nat.sum.
  • To help with this, add Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum.

Open in Gitpod

* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of themin the original file but stated using `Nat.sum`.
* To help with this, add `Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum`.
@Vierkantor Vierkantor self-assigned this Mar 28, 2024
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.

Once #11729 is merged, could you rebase / merge master? It seems likely to give merge conflicts.

I'm not convinced this move is the best way to go: List.BigOperators.Basic is (turning into) a random assortment of lemmas, I definitely have trouble parsing its internal structure. Moreover, feel like Finset.prod requires way too many imports already and this PR looks like that amount will increase even more.

On the other hand, the alternative would be lots of files named e.g. Algebra.BigOperators.List.Dedup that contain only a few results each is also an unsatisfying outcome. (Especially when we start working with more list operators.) In my opinion, that would be a better option but only marginally. Or do you have a better idea?

@YaelDillies
Copy link
Collaborator Author

To me this is a second-order concern: the primary concern is to stop algebra, order theory and finiteness from leaking into each other (this PR is specifically concerned about the algebra → finiteness leak, can you believe we need rings to define finite sets!). Organising each sublibrary is tomorrow's job, not today's.

Concretely, this means:

  • These lemmas have to move. They can't stay where they are because they concern algebra but are in finiteness files.
  • Data.List.BigOperators.Basic is a mess, but already was before, and it's not really this PR's job to make the situation better.

There are avenues to improve Data.List.BigOperators.Basic in the future:

  • Delete Data.List.BigOperators.Lemmas (this is the infamous "too much import for Basic" file every folder has)
  • Instead have files graded according to the algebra imports they need. Something like this would be much better than what we have now:
    • Monoid/group lemmas
    • Ring lemmas
    • Funkier stuff
  • Move the order stuff to a new Algebra.Order.BigOperators.List file (this is already done in [Merged by Bors] - chore(Algebra/BigOperators/List): Use Std lemmas #11725)

I could improve the situation in this PR but that would increase the diff.

@Vierkantor
Copy link
Contributor

Vierkantor commented Mar 30, 2024 via email

@fpvandoorn
Copy link
Member

Thanks!

bors merge
bors d+

@mathlib-bors
Copy link

mathlib-bors bot commented Mar 31, 2024

✌️ 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.

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. delegated and removed awaiting-review The author would like community review of the PR labels Mar 31, 2024
mathlib-bors bot pushed a commit that referenced this pull request Mar 31, 2024
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of them in the original file but 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 Mar 31, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Data/List): Depend less on big operators [Merged by Bors] - chore(Data/List): Depend less on big operators Mar 31, 2024
@mathlib-bors mathlib-bors bot closed this Mar 31, 2024
@mathlib-bors mathlib-bors bot deleted the list_no_big_ops branch March 31, 2024 02:01
Louddy pushed a commit that referenced this pull request Apr 15, 2024
* Make `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of them in the original file but 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 `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of them in the original file but 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 `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of them in the original file but 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 `Data.List.Count`, `Data.List.Dedup`, `Data.List.ProdSigma`, `Data.List.Range`, `Data.List.Rotate`, `Data.List.Zip` not depend on `Data.List.BigOperators.Basic`.
* As a consequence, move the big operators lemmas that were in there to `Data.List.BigOperators.Basic`. For the lemmas that were `Nat`-specific, keep a version of them in the original file but 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
delegated 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

4 participants