Skip to content

[Merged by Bors] - fix(Algebra/Group/Defs): make to_additive play nice with pow and smul#706

Closed
j-loreaux wants to merge 5 commits intomasterfrom
j-loreaux/HSmul
Closed

[Merged by Bors] - fix(Algebra/Group/Defs): make to_additive play nice with pow and smul#706
j-loreaux wants to merge 5 commits intomasterfrom
j-loreaux/HSmul

Conversation

@j-loreaux
Copy link
Copy Markdown
Contributor

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

@fpvandoorn
Copy link
Copy Markdown
Member

LGTM

bors merge

Later today I'll try to add these instances to the naming heuristics of @[to_additive]

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)
@bors
Copy link
Copy Markdown

bors bot commented Nov 24, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title fix(Algebra/Group/Defs): make to_additive play nice with pow and smul [Merged by Bors] - fix(Algebra/Group/Defs): make to_additive play nice with pow and smul Nov 24, 2022
@bors bors bot closed this Nov 24, 2022
@bors bors bot deleted the j-loreaux/HSmul branch November 24, 2022 09:00
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants