mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

chore(Data/List): Depend less on big operators

Open YaelDillies opened this issue 1 year ago • 1 comments

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

Open in Gitpod

YaelDillies avatar Mar 28 '24 11:03 YaelDillies

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 #11725)

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

YaelDillies avatar Mar 28 '24 16:03 YaelDillies

I suppose this PR indeed makes things strictly better than the current situation. Unfortunately my laptop is broken so I can't test that everything ended up moved correctly. @fpvandoorn, would you like to assign yourself and finish the review?

On 28 March 2024 17.53.17 CET, "Yaël Dillies" @.***> wrote:

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 #11725)

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

-- Reply to this email directly or view it on GitHub: https://github.com/leanprover-community/mathlib4/pull/11741#issuecomment-2025680801 You are receiving this because you were assigned.

Message ID: @.***>

Vierkantor avatar Mar 30 '24 09:03 Vierkantor

Thanks!

bors merge bors d+

fpvandoorn avatar Mar 31 '24 00:03 fpvandoorn

:v: 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.

mathlib-bors[bot] avatar Mar 31 '24 00:03 mathlib-bors[bot]

Pull request successfully merged into master.

Build succeeded:

mathlib-bors[bot] avatar Mar 31 '24 02:03 mathlib-bors[bot]