-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: more sub lemmas for Nat
#203
Conversation
@YaelDillies, do you have an opinion here, or are able to review? |
This is the last in a series. They're mostly independent but it might be easier to start with #194. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with the deprecations. However I find it a bit sad to duplicate all this tsub
material in Std. Can we do some subset of the following suggestions?
- Not duplicate
tsub
lemma in Std - Put in the docstring of duplicate
Nat.sub_something
thattsub_something
exists in mathlib - Deprecate mathlib-wise (is that currently possible?) each
Nat.sub_something
in favor oftsub_something
- Put a big warning in
Std.Data.Nat.Lemmas
that if people want a lot of theory about truncated subtraction, then they should useMathlib.Algebra.Order.Sub.Canonical
instead of PRing more lemmas here
I'd rather we did none of the above. The tsub lemmas are more complex to understand, and elaborate. I think there should be no particular preference in mathlib for one over the other. Certainly there won't be a warning about not adding any more lemmas on Nat: tsub is only relevant if you care about other types with truncated subtraction like NNReal, and for a lot of users of Std that's just not relevant, while Nat is very relevant. |
If we had to only do one of my suggestions, I would like it to be
because I want mathlib users to be directed towards the API that's useful to them, avoiding ad hoc Std lemmas. |
@YaelDillies Note that However, I am happy with the fourth suggestion:
I will add a module doc to clarify the intended purpose of these lemmas and a pointer to Mathlib alternatives. I would like to hear what others think before implementing the first three suggestions. |
@YaelDillies Please see #237. |
I agree that module-docs are the way to go to explain the additional theory available in Mathlib. Any results that are needed or helpful for non-mathematical uses of Nat need to be here in Std, without expecting such users to know about the general theory of truncated subtraction. I am ambivalent about the "Mathlib-specific deprecation" suggestion, but don't think we should mention @fgdorais, as far as I'm concerned I think you can mark this back as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with modification:
succ_sub_one
,sub_lt_self
,sub_one_sub_lt
were undeprecated- deprecated theorems were moved after their respective undeprecated versions instead of in a separate section (if we want this it should be implemented in docgen)
Potentially breaking: * Changed parameters in `Nat.sub_le_sub_left` * Deprecated `Nat.add_le_to_le_sub` * Deprecated `Nat.succ_sub_one` * Deprecated `Nat.le_of_le_of_sub_le_sub_left` * Deprecated `Nat.le_of_le_of_sub_le_sub_right` * Deprecated `Nat.add_le_of_le_sub_left` * Deprecated `Nat.sub_lt_self` * Deprecated `Nat.sub_lt_succ` * Deprecated `Nat.sub_one_sub_lt` * Some implicit parameters may have been renamed or reordered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nat
) mathlib4#6216There's a bunch of deprecated lemmas, all of which have better alternatives except for one which appears to be a single purpose lemma that lost its purpose.