feat(naming): document the ₀ suffix convention#870
Conversation
grunweg
left a comment
There was a problem hiding this comment.
Thanks for documenting this! I have one question about the example you're giving.
|
Also: is there any evidence of this convention being discussed previously? I trust your memory, but having an explicit source to consult (also down the line) will be very very helpful. |
|
Here is the PR which I believe introduced the naming convention: leanprover-community/mathlib3#9424 |
|
I feel it's important to mention here that the proposed change here is explicitly contradicted by existing documentation (eg https://leanprover-community.github.io/mathlib4_docs/Mathlib/Topology/Algebra/Group/Defs.html#ContinuousDiv or https://github.com/leanprover-community/mathlib4/blob/4176265817544b3530eca07e02a704b0316f2ab8/Mathlib/Data/Nat/Cast/Basic.lean#L97 or https://github.com/leanprover-community/mathlib4/blob/master/Mathlib/Algebra/BigOperators/GroupWithZero/Action.lean#L21), and followed the minority of the time in mathlib. As such, this PR isn't documenting a convention, but essentially proposing a new one, which doesn't reflect existing practice. |
|
Quoting @kim-em in the PR I linked to above:
I personally believe that the extra character for the common case is worth it to achieve consistency and clarity (remember that there are many other reasons to prime a name). |
|
Also note that I can't remove the |
|
Oh, I wasn't aware of that. |
Sure, I am not arguing against your change, but instead trying to make it clear that this is a change to the (both de jure and de facto) convention, not just "documenting existing practice". |
|
So, with my "process nerd" hat on, this sounds like a case for additional discussion. |
|
-awaiting-author |
|
Yep, no, doesn't work 😅 |
|
I think you might have meant to say that lemmas in series 1 and 3 can clash? E.g. mul_le_mul_left vs mul_le_mul_of_nonneg_left |
|
Thanks! Finally, can you update the PR description to reference the Zulip discussion (this I will insist on) and (would be nice, but optional) explain the trade-off that we make here (e.g. around linkifiers, unicode in identifiers, to_additive support versus longer names)? |
|
How about now? |
|
Looks good. I changed one word to be unambiguous. |
Many lemmas about
GroupWithZerohave an analogousGrouplemma (and similarly for weaker/stronger typeclasses). In cases where the former name doesn't mentionzero, it is prone to conflict with the latter. Historically, this was dealt with by priming the latter, which created a lot of primed lemmas and meant that theAddMonoidlemma name couldn't be inferred from theMonoidone automatically byto_additive.A while ago, there was a push to unprime the
Grouplemmas and add the suffix₀to theGroupWithZeroones, see leanprover-community/mathlib3#9424 among others. Unfortunately that new naming convention was never recorded and wasn't applied everywhere, meaning it wasn't subsequently consistently followed.This PR records the convention.
Pros of the convention:
to_additiveguesses the correct name for theAddGrouplemmasCons of the convention
GroupWithZerolemma is sometimes used more than theGroupone, but gets a longer name₀than', in particular in the docs. This could be fixed by making0search for₀.Zulip