[Merged by Bors] - refactor: Multiplicativise abs#9553
Closed
YaelDillies wants to merge 12 commits intomasterfrom
Closed
[Merged by Bors] - refactor: Multiplicativise abs#9553YaelDillies wants to merge 12 commits intomasterfrom
abs#9553YaelDillies wants to merge 12 commits intomasterfrom
Conversation
The current design for `abs` is flawed: * The `Abs` notation typeclass has exactly two instances: one for `[Neg α] [Sup α]`, one for `[Inv α] [Sup α]`. This means that: * We can't write a meaningful hover for `Abs.abs` * Fields have two `Abs` instances! * We have the multiplicative definition but: * All the lemmas in `Algebra.Order.Group.Abs` are about the additive version. * The only lemmas about the multiplicative version are in `Algebra.Order.Group.PosPart`, and they get additivised to duplicates of the lemmas in `Algebra.Order.Group.Abs`! This PR changes the notation typeclass with two new definitions (related through `to_additive`): `mabs` and `abs`. `abs` inherits the `|a|` notation and `mabs` gets `|a|ₘ` instead. The first half of `Algebra.Order.Group.Abs` gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in `Algebra.Order.Group.PosPart`. Part of #9411
21 tasks
jcommelin
approved these changes
Jan 13, 2024
Member
jcommelin
left a comment
There was a problem hiding this comment.
Thanks a lot for cleaning this up!!
bors merge
mathlib-bors bot
pushed a commit
that referenced
this pull request
Jan 13, 2024
The current design for `abs` is flawed: * The `Abs` notation typeclass has exactly two instances: one for `[Neg α] [Sup α]`, one for `[Inv α] [Sup α]`. This means that: * We can't write a meaningful hover for `Abs.abs` * Fields have two `Abs` instances! * We have the multiplicative definition but: * All the lemmas in `Algebra.Order.Group.Abs` are about the additive version. * The only lemmas about the multiplicative version are in `Algebra.Order.Group.PosPart`, and they get additivised to duplicates of the lemmas in `Algebra.Order.Group.Abs`! This PR changes the notation typeclass with two new definitions (related through `to_additive`): `mabs` and `abs`. `abs` inherits the `|a|` notation and `mabs` gets `|a|ₘ` instead. The first half of `Algebra.Order.Group.Abs` gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in `Algebra.Order.Group.PosPart`. Part of #9411. Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
Contributor
|
Pull request successfully merged into master. Build succeeded: |
absabs
YaelDillies
added a commit
that referenced
this pull request
Jan 14, 2024
This changes the typeclass notation approach with plain functions. Followup to #9553
linesthatinterlace
pushed a commit
that referenced
this pull request
Jan 16, 2024
The current design for `abs` is flawed: * The `Abs` notation typeclass has exactly two instances: one for `[Neg α] [Sup α]`, one for `[Inv α] [Sup α]`. This means that: * We can't write a meaningful hover for `Abs.abs` * Fields have two `Abs` instances! * We have the multiplicative definition but: * All the lemmas in `Algebra.Order.Group.Abs` are about the additive version. * The only lemmas about the multiplicative version are in `Algebra.Order.Group.PosPart`, and they get additivised to duplicates of the lemmas in `Algebra.Order.Group.Abs`! This PR changes the notation typeclass with two new definitions (related through `to_additive`): `mabs` and `abs`. `abs` inherits the `|a|` notation and `mabs` gets `|a|ₘ` instead. The first half of `Algebra.Order.Group.Abs` gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in `Algebra.Order.Group.PosPart`. Part of #9411. Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
mathlib-bors bot
pushed a commit
that referenced
this pull request
Jan 30, 2024
`Algebra.GroupPower.Lemmas` used to be a big bag of lemmas that made it there on the criterion that they needed "more imports". This was completely untrue, as all lemmas could be moved to earlier files in PRs: - #9440 - #9442 - #9443 - #9455 - #9456 - #9457 - #9459 - #9461 - #9463 - #9466 - #9501 - #9502 - #9503 - #9505 - #9551 - #9553 - #9720 - #9739 - #9740 - #9805 - #9806 - and this one There are several reasons for this: * Necessary lemmas have been moved to earlier files since lemmas were dumped in `Algebra.GroupPower.Lemmas` * In the Lean 3 → Lean 4 transition, Std acquired basic `Int` and `Nat` lemmas which let us shortcircuit the part of the algebraic order hierarchy on which the corresponding general lemmas rest * Some proofs were overpowered * Some earlier files were tangled and I have untangled them This PR finishes the job by moving the last few lemmas out of `Algebra.GroupPower.Lemmas`, which is therefore deleted.
mathlib-bors bot
pushed a commit
that referenced
this pull request
Jan 30, 2024
`Algebra.GroupPower.Lemmas` used to be a big bag of lemmas that made it there on the criterion that they needed "more imports". This was completely untrue, as all lemmas could be moved to earlier files in PRs: - #9440 - #9442 - #9443 - #9455 - #9456 - #9457 - #9459 - #9461 - #9463 - #9466 - #9501 - #9502 - #9503 - #9505 - #9551 - #9553 - #9720 - #9739 - #9740 - #9805 - #9806 - and this one There are several reasons for this: * Necessary lemmas have been moved to earlier files since lemmas were dumped in `Algebra.GroupPower.Lemmas` * In the Lean 3 → Lean 4 transition, Std acquired basic `Int` and `Nat` lemmas which let us shortcircuit the part of the algebraic order hierarchy on which the corresponding general lemmas rest * Some proofs were overpowered * Some earlier files were tangled and I have untangled them This PR finishes the job by moving the last few lemmas out of `Algebra.GroupPower.Lemmas`, which is therefore deleted.
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 current design for
absis flawed:Absnotation typeclass has exactly two instances: one for[Neg α] [Sup α], one for[Inv α] [Sup α]. This means that:Abs.absAbsinstances!Algebra.Order.Group.Absare about the additive version.Algebra.Order.Group.PosPart, and they get additivised to duplicates of the lemmas inAlgebra.Order.Group.Abs!This PR changes the notation typeclass with two new definitions (related through
to_additive):mabsandabs.absinherits the|a|notation andmabsgets|a|ₘinstead.The first half of
Algebra.Order.Group.Absgets multiplicativised. A later PR will multiplicativise the second half, and another one #9740 will deduplicate the lemmas inAlgebra.Order.Group.PosPart.Part of #9411. Closes #6376.