leanprover-community / mathlib4

The math library of Lean 4
https://leanprover-community.github.io/mathlib4_docs
Apache License 2.0
1.52k stars 335 forks source link

Carve out Algebra, Data and Order sublibraries #11757

Open YaelDillies opened 7 months ago

YaelDillies commented 7 months ago

The bottom part of mathlib is quite a mess. Algebra, data structures and order theory could be developed separately (at least for a while) but are not. Instead, "horizontal" imports keep happening between what would otherwise be three disjoint trees.

The main sources of trouble are

The purpose of this issue is to collect the PRs doing at least one of the above:

Once all these issues will be fixed, we will be able to create three new Lean libraries Algebra, Data, Order, all still living in the current repository.

After such a split, these sublibraries would form a DAG in terms of dependencies. This adds some constraints to future refactors, as that DAG would essentially become immutable.

The benefits?

eric-wieser commented 7 months ago

it will be possible in lake to specify that you only want to depend on a subset of these libraries.

I don't understand why this is useful. Already, if you do lake build in your project, it only builds the bits of mathlib that you actually import. You can use lake exe cache in a similar way. So the "unused" bits of mathlib are already not meaningfully "depended" on.