[Merged by Bors] - fix(Algebra/Group/Defs): make to_additive play nice with pow and smul#706
Closed
[Merged by Bors] - fix(Algebra/Group/Defs): make to_additive play nice with pow and smul#706
to_additive play nice with pow and smul#706Conversation
Member
|
LGTM bors merge Later today I'll try to add these instances to the naming heuristics of |
bors bot
pushed a commit
that referenced
this pull request
Nov 24, 2022
…`smul` (#706) The additivization of `pow` was borked because `Pow.pow` is really `HPow.hPow` under the hood via the instance `instHPow`. Consequently, it was useful to create a heterogeneous `SMul` type class `HSMul`, through which the `•` notation now derives. The upshot is that `to_additive` can now handle lemmas involving `pow` as is seen in a few places in this PR, thereby fixing some TODOs. Note that this also makes it possible to port files rapidly approaching (e.g., `Algebra/Group/InjSurj.lean`) without resorting to nasty hacks or omitting the additive versions. See the discussion on [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/to_additive.20issues)
|
Pull request successfully merged into master. Build succeeded: |
to_additive play nice with pow and smulto_additive play nice with pow and smul
kmill
reviewed
Nov 24, 2022
bors bot
pushed a commit
that referenced
this pull request
Nov 25, 2022
* The heuristic to split names did it wrong on a long sequence of capital letters. The new heuristic is to have a sequence of "white-listed" names that only consist of capital letters (currently `["LE", "LT", "WF"]`). This new heuristic correctly splits `ZeroLEHAdd` and `HSMul` * translate `[h]pow` to `[h]smul` (see #706). I believe Mathlib4 never used the previous automatic translation `pow -> nsmul` (I used regex `@\[to_additive\]\n?.*(_p|P| p)ow` to search). Since capitalization goes wrong in this case, add some cases in `fixAbbreviation` to fix it. * Fix all places where the capitalization `Smul` was used instead of `SMul`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The additivization of
powwas borked becausePow.powis reallyHPow.hPowunder the hood via the instanceinstHPow. Consequently, it was useful to create a heterogeneousSMultype classHSMul, through which the•notation now derives. The upshot is thatto_additivecan now handle lemmas involvingpowas is seen in a few places in this PR, thereby fixing some TODOs. Note that this also makes it possible to port files rapidly approaching (e.g.,Algebra/Group/InjSurj.lean) without resorting to nasty hacks or omitting the additive versions. See the discussion on Zulip