chore: add typeclasses to unify various add_top, add_eq_top, etc.#14598
chore: add typeclasses to unify various add_top, add_eq_top, etc.#14598Command-Master wants to merge 58 commits intomasterfrom
add_top, add_eq_top, etc.#14598Conversation
YaelDillies
left a comment
There was a problem hiding this comment.
Sorry, I am not yet convinced these classes are worth having. Can you remind me:
- What instances you want to have that involve these new typeclasses.
- What lemmas you expect these classes to generalise.
There was a problem hiding this comment.
Can you make these cleanups be a separate PR?
There was a problem hiding this comment.
Which cleanups? The instOrderTopAdditiveOrderDual and instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual changes are due to the changed definition of LinearOrderedAddCommMonoidWithTop, and I changed instLinearOrderedCommMonoidWithZeroMultiplicativeOrderDual because the previous version didn't work
|
It's really important that we can justify every typeclass we add to mathlib because, once a typeclass exists, people feel encouraged to generalise lemmas to it even when it is not mathematically useful to do so, and this makes those typeclasses look crucial when they are not, and also hard to remove. I worry that the typeclasses in the present PR generalise few lemmas (< 10) from few types (< 10) which are very different mathematically very different (in particular are not thought to be different incarnations of the same algebraic structure, the way eg |
Additionally, looking at
Directly equivalent:
|
|
Another instance of this I just noticed is that |
That's already covered by the fact that they are a canonically ordered monoid Do you still need this PR now that your SubtractionMonoid instance is merged? |
|
I don't need it, but I still think it's good |
Add the four typeclasses
IsTopAbsorbing,IsBotAbsorbing,NoTopSum,NoBotSum, as additive equivalents forMulZeroClassandNoZeroDivisors. Add instances of these forENNReal,WithTop α,WithBot α,PUnit,EReal,PartENat,Measure,IntervalandFilter.Also split
Algebra/Order/AddGroupWithToptoAlgebra/Order/Group/WithTopandAlgebra/Order/Monoid/WithTopPrevious usages of lemmas with quantified names like
WithTop.add_tophave to be changed to justadd_top.add_lt_topis@[simp], in accordance withENNReal.add_lt_topbeing@[simp]. This affectsWithTop.add_lt_topwhich previously hadn't been@[simp].