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/maximals for a relation that was not defeq to LE.le currently 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 definitions minimals and maximals and all their API, it required a total overhaul of the contents of Order.Minimal, and necessarily required updating all uses of maximals/minimals elsewhere. 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 outside Order.Minimal were:
  • redefinition of Ideal.minimalPrimes in RingTheory/Ideal/MinimalPrime to use Minimal rather than minimals, with the necessary minor changes to proofs that used the old definition, including in AlgebraicGeometry/PrimeSpectrum/Basic.
  • redefinition of irreducibleComponents in Topology/Irreducible to use Minimal rather than minimals, 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/Basic from maximals to Maximal, with the necessary changes to everywhere in Data/Matroid/* that a matroid was specified using the definition directly.
  • the necessary changes to two lemmas in Data/Finset/Lattice that used minimals/maximals in the statements. I attempted to clean up the API in Order.Minimal to work smoothly with the new definitions, but numerous judgment calls were needed; I removed a few lemmas about maximals/minimals that were used nowhere, and seemed unlikely to be useful with the new definition. Comment is welcome!

Estimated changes

deleted theorem IsAntichain.max_maximals
deleted theorem IsAntichain.max_minimals
deleted theorem IsAntichain.maximals_eq
deleted theorem IsAntichain.minimals_eq
added theorem IsGreatest.maximal
added theorem IsGreatest.maximal_iff
deleted theorem IsGreatest.maximals_eq
deleted theorem IsGreatest.mem_maximals
deleted theorem IsLeast.mem_minimals
added theorem IsLeast.minimal
added theorem IsLeast.minimal_iff
deleted theorem IsLeast.minimals_eq
added theorem Maximal.and_left
added theorem Maximal.and_right
added theorem Maximal.eq_of_ge
added theorem Maximal.eq_of_le
added theorem Maximal.eq_of_subset
added theorem Maximal.eq_of_superset
added theorem Maximal.le_of_ge
added theorem Maximal.mono
added theorem Maximal.not_gt
added theorem Maximal.not_prop_of_gt
added theorem Maximal.not_ssuperset
added theorem Maximal.or
added theorem Maximal.prop
added def Maximal
added theorem Minimal.and_left
added theorem Minimal.and_right
added theorem Minimal.eq_of_ge
added theorem Minimal.eq_of_le
added theorem Minimal.eq_of_subset
added theorem Minimal.eq_of_superset
added theorem Minimal.le_of_le
added theorem Minimal.mono
added theorem Minimal.not_lt
added theorem Minimal.not_prop_of_lt
added theorem Minimal.not_ssubset
added theorem Minimal.or
added theorem Minimal.prop
added def Minimal
deleted theorem OrderIso.map_mem_maximals
deleted theorem eq_of_mem_maximals
deleted theorem eq_of_mem_minimals
deleted theorem image_maximals_univ
deleted theorem image_minimals_univ
deleted theorem inter_maximals_subset
deleted theorem inter_minimals_subset
deleted theorem map_mem_maximals
deleted theorem map_mem_maximals_iff
deleted theorem map_mem_minimals
deleted theorem map_mem_minimals_iff
added theorem maximal_eq_iff
added theorem maximal_false
added theorem maximal_ge_iff
added theorem maximal_gt_iff
added theorem maximal_iff
added theorem maximal_iff_eq
added theorem maximal_iff_forall_gt
added theorem maximal_iff_isMax
added theorem maximal_le_iff
added theorem maximal_maximal
added theorem maximal_mem_Icc
added theorem maximal_mem_Ioc
added theorem maximal_mem_iff
added theorem maximal_subset_iff'
added theorem maximal_subset_iff
added theorem maximal_subtype
added theorem maximal_toDual
added theorem maximal_true
added theorem maximal_true_subtype
deleted def maximals
deleted theorem maximals_Icc
deleted theorem maximals_Iic
deleted theorem maximals_Ioc
deleted theorem maximals_antichain
deleted theorem maximals_empty
deleted theorem maximals_eq_minimals
deleted theorem maximals_idem
deleted theorem maximals_inter_subset
deleted theorem maximals_mono
deleted theorem maximals_of_symm
deleted theorem maximals_singleton
deleted theorem maximals_subset
deleted theorem maximals_swap
deleted theorem maximals_union
deleted theorem mem_maximals_iff
deleted theorem mem_maximals_setOf_iff
deleted theorem mem_minimals_iff
deleted theorem mem_minimals_setOf_iff
added theorem minimal_eq_iff
added theorem minimal_false
added theorem minimal_ge_iff
added theorem minimal_iff
added theorem minimal_iff_eq
added theorem minimal_iff_forall_lt
added theorem minimal_iff_isMin
added theorem minimal_le_iff
added theorem minimal_lt_iff
added theorem minimal_mem_Icc
added theorem minimal_mem_Ico
added theorem minimal_mem_iff
added theorem minimal_minimal
added theorem minimal_subset_iff'
added theorem minimal_subset_iff
added theorem minimal_subtype
added theorem minimal_toDual
added theorem minimal_true
added theorem minimal_true_subtype
deleted def minimals
deleted theorem minimals_Icc
deleted theorem minimals_Ici
deleted theorem minimals_Ico
deleted theorem minimals_antichain
deleted theorem minimals_empty
deleted theorem minimals_idem
deleted theorem minimals_inter_subset
deleted theorem minimals_mono
deleted theorem minimals_of_symm
deleted theorem minimals_singleton
deleted theorem minimals_subset
deleted theorem minimals_swap
deleted theorem minimals_union
added theorem not_maximal_iff
added theorem not_maximal_subset_iff
added theorem not_minimal_iff
added theorem not_minimal_subset_iff
added theorem setOf_maximal_subset
added theorem setOf_minimal_subset