Commit 2024-08-05 16:52 124f27e8
View on Github →refactor(Order/Minimal): change minimality to a predicate (#14721)
This PR changes the notion of minimality from being a set with an unbundled relation r (i.e. having type signature minimals (r : α → α → Prop) (s : Set α) : Set α) to being a predicate with a bundled order relation in a typeclass: Minimal [LE α] (P : α → Prop) : α → Prop.
It also does the same for maximality.
This is hopefully an improvement, for a few reasons :
- ergonomic API with dot notation (eg
Minimal.eq_of_le,Minimal.not_lt), - no need to specify a particular relation explicitly (no use of
minimals/maximalsfor a relation that was not defeq toLE.lecurrently appears anywhere in mathlib), - the potential in future to unify ad hoc notions of min/maximality appearing in various locations in mathlib (eg
zorn_preorder,Sylow.is_maximal'to name a couple of random examples). Since this change removes the definitionsminimalsandmaximalsand all their API, it required a total overhaul of the contents ofOrder.Minimal, and necessarily required updating all uses ofmaximals/minimalselsewhere. There were not all too many of these; this PR is designed to be the smallest it could be while making this change. The changes required outsideOrder.Minimalwere:
- redefinition of
Ideal.minimalPrimesinRingTheory/Ideal/MinimalPrimeto useMinimalrather thanminimals, with the necessary minor changes to proofs that used the old definition, including inAlgebraicGeometry/PrimeSpectrum/Basic. - redefinition of
irreducibleComponentsinTopology/Irreducibleto useMinimalrather thanminimals, with necessary minor changes to proofs that used the old definition. - updating of the maximality used in the definition of a matroid in
Data/Matroid/BasicfrommaximalstoMaximal, with the necessary changes to everywhere inData/Matroid/*that a matroid was specified using the definition directly. - the necessary changes to two lemmas in
Data/Finset/Latticethat usedminimals/maximalsin the statements. I attempted to clean up the API inOrder.Minimalto work smoothly with the new definitions, but numerous judgment calls were needed; I removed a few lemmas aboutmaximals/minimalsthat were used nowhere, and seemed unlikely to be useful with the new definition. Comment is welcome!