Commit 2025-03-05 06:23 c8c1429f

View on Github →

feat: generalize order typeclasses (#22569) This is one of a series of PRs that generalizes type classes across Mathlib. These are generated using a new linter that tries to re-elaborate theorem definitions with more general type classes to see if it succeeds. It will accept the generalization if deleting the entire type class causes the theorem to fail to compile. Otherwise, the type class is not being generalized, but can simply be replaced by implicit type class synthesis (or an implicit type class in a variable block being pulled in.) The linter currently output debug statements indicating source file positions where type classes shoudl be generalized, and a script then makes those edits. This file contains a subset of those generalizations. The linter and the script performing re-writes is available in commit https://github.com/leanprover-community/mathlib4/commit/7b436512017640c3c33aea50b2435b2ee0d995c9. Also see discussion on Zulip here: https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Elab.20to.20generalize.20type.20classes.20for.20theorems/near/498862988 https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Elab.20to.20generalize.20type.20classes.20for.20theorems/near/501288855

Estimated changes

modified theorem Function.swap_ge
modified theorem Function.swap_gt
modified theorem Function.swap_le
modified theorem Function.swap_lt