Skip to content

[Merged by Bors] - move(Algebra/Parity): Split file#12829

Closed
YaelDillies wants to merge 7 commits intomasterfrom
move_algebra_parity
Closed

[Merged by Bors] - move(Algebra/Parity): Split file#12829
YaelDillies wants to merge 7 commits intomasterfrom
move_algebra_parity

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

Parity of elements in a group/ring is a basic algebraic concept, but it currently requires importing a bunch of algebraic order theory. As a consequence, Algebra.Parity currently holds a bunch of lemmas that really belong in earlier files but cannot due to import cycles.

This PR moves the content of Algebra.Parity to

  • Algebra.Group.Even for the definition of IsSquare and Even
  • Algebra.Ring.Parity for the definition of Odd and ring properties of Even
  • Algebra.Order.Group.Abs, Algebra.Order.Ring.Abs, Algebra.Order.Ring.Canonical, Algebra.Order.Sub.Canonical, Algebra.GroupPower.Order for the various algebraic order properties of Even and Odd

As a result, Even/Odd are available much more widely without awkward dependencies and algebraic order lemmas are now in the correct files. The only slight downfall is that two lemmas in Algebra.Ring.Parity are stated using Set.range, hence I had to weaken a few assert_not_exists to forbidding Data.Set.Basic instead of Data.Set.Defs. This is inconsequential.

A side-effect of this PR is that I had to move some bit0/bit1 lemmas. I could not find anywhere sensible to put them, so I am currently keeping them in Algebra.Parity. As a result, I had to reprove a few lemmas in Algebra.GroupPower.Order. I took the opportunity to generalise them.

This is a followup to leanprover-community/mathlib3#17391 motivated by https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Mathlib.2EAlgebra.2EAssociated and the move-only part of #11863.


Open in Gitpod

Parity of elements in a group/ring is a basic algebraic concept, but it currently requires importing a bunch of algebraic order theory. As a consequence, `Algebra.Parity` currently holds a bunch of lemmas that really belong in earlier files but cannot due to import cycles.

This PR moves the content of `Algebra.Parity` to
* `Algebra.Group.Even` for the definition of `IsSquare` and `Even`
* `Algebra.Ring.Parity` for the definition of `Odd` and ring properties of `Even`
* `Algebra.Order.Group.Abs`, `Algebra.Order.Ring.Abs`, `Algebra.Order.Ring.Canonical`, `Algebra.Order.Sub.Canonical`, `Algebra.GroupPower.Order` for the various algebraic order properties of `Even` and `Odd`

As a result, `Even`/`Odd` are available much more widely without awkward dependencies and algebraic order lemmas are now in the correct files. The only slight downfall is that two lemmas in `Algebra.Ring.Parity` are stated using `Set.range`, hence I had to weaken a few `assert_not_exists` to forbidding `Data.Set.Basic` instead of `Data.Set.Defs`. This is inconsequential.

A side-effect of this PR is that I had to move some `bit0`/`bit1` lemmas. I could not find anywhere sensible to put them, so I am currently keeping them in `Algebra.Parity`. As a result, I had to reprove a few lemmas in `Algebra.GroupPower.Order`. I took the opportunity to generalise them.

This is a followup to leanprover-community/mathlib3#17391 motivated by https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Mathlib.2EAlgebra.2EAssociated and the move-only part of #11863.
@YaelDillies YaelDillies added awaiting-review t-algebra Algebra (groups, rings, fields, etc) labels May 11, 2024
@leanprover-community leanprover-community deleted a comment from github-actions bot May 11, 2024
@adomani
Copy link
Copy Markdown
Contributor

adomani commented May 12, 2024

Yaël, thank you for the new PR, as this gives me a way of testing some improvements to the no_lost_declarations script!

This is a summary of just the names that have changed in this PR:

+ Additive.instDecidablePredEven
- even_abs
+ isSquare_mabs
+ Multiplicative.instDecidablePredIsSquare

Does this seem a reasonable output?

@YaelDillies
Copy link
Copy Markdown
Contributor Author

- even_abs is incorrect as isSquare_mabs gets additivised to even_abs. I guess your script doesn't know about to_additive?

@adomani
Copy link
Copy Markdown
Contributor

adomani commented May 12, 2024

The script is just text-based and it is supposed to be a quick check that does not require CI to have run. So, I think that it is fair if it flags as missing a to_additivized lemma.

The main idea is to help focus from the +474-478 lines to just checking the 4 highlighted lemmas.

This seems like a good simplification for reviewers.

@YaelDillies
Copy link
Copy Markdown
Contributor Author

Yeah, makes sense. The rest of the list looks good.

@YaelDillies YaelDillies requested a review from jcommelin May 12, 2024 11:36
@adomani
Copy link
Copy Markdown
Contributor

adomani commented May 12, 2024

Ok, thanks for confirming. I will make the very short diff available as an option, then.

@github-actions
Copy link
Copy Markdown

  • + Additive.instDecidablePredEven
  • + Multiplicative.instDecidablePredIsSquare
  • + isSquare_mabs
  • - even_abs
  • -``- [DecidablePred

Copy link
Copy Markdown
Contributor

@Ruben-VandeVelde Ruben-VandeVelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

maintainer merge

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by Ruben-VandeVelde.

@github-actions github-actions bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label May 13, 2024
@sgouezel
Copy link
Copy Markdown
Contributor

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels May 13, 2024
@YaelDillies
Copy link
Copy Markdown
Contributor Author

  • + Additive.instDecidablePredEven
  • + Multiplicative.instDecidablePredIsSquare
  • + isSquare_mabs
  • - even_abs
  • -``- [DecidablePred

@adomani, there seems to be a formatting issue

@adomani
Copy link
Copy Markdown
Contributor

adomani commented May 13, 2024

Thanks for the report!

I can remove the extra `` easily. I would have to think about omitting the [inst], though, since this is one place where there is no name after instance and then it is unclear what should be used for comparison.

@adomani
Copy link
Copy Markdown
Contributor

adomani commented May 13, 2024

#12866

@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 13, 2024
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented May 13, 2024

Merge conflict.

mathlib-bors bot pushed a commit that referenced this pull request May 13, 2024
Fixes a formatting issue in the output of `move-decls`.

As reported in #12829.

On that PR, the new script reports

***

* `+` Additive.instDecidablePredEven
* `--` [DecidablePred
* `-` even_abs
* `+` isSquare_mabs
* `+` Multiplicative.instDecidablePredIsSquare
@YaelDillies YaelDillies added awaiting-review and removed ready-to-merge This PR has been sent to bors. maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels May 13, 2024
@jcommelin
Copy link
Copy Markdown
Member

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels May 15, 2024
mathlib-bors bot pushed a commit that referenced this pull request May 15, 2024
Parity of elements in a group/ring is a basic algebraic concept, but it currently requires importing a bunch of algebraic order theory. As a consequence, `Algebra.Parity` currently holds a bunch of lemmas that really belong in earlier files but cannot due to import cycles.

This PR moves the content of `Algebra.Parity` to
* `Algebra.Group.Even` for the definition of `IsSquare` and `Even`
* `Algebra.Ring.Parity` for the definition of `Odd` and ring properties of `Even`
* `Algebra.Order.Group.Abs`, `Algebra.Order.Ring.Abs`, `Algebra.Order.Ring.Canonical`, `Algebra.Order.Sub.Canonical`, `Algebra.GroupPower.Order` for the various algebraic order properties of `Even` and `Odd`

As a result, `Even`/`Odd` are available much more widely without awkward dependencies and algebraic order lemmas are now in the correct files. The only slight downfall is that two lemmas in `Algebra.Ring.Parity` are stated using `Set.range`, hence I had to weaken a few `assert_not_exists` to forbidding `Data.Set.Basic` instead of `Data.Set.Defs`. This is inconsequential.

A side-effect of this PR is that I had to move some `bit0`/`bit1` lemmas. I could not find anywhere sensible to put them, so I am currently keeping them in `Algebra.Parity`. As a result, I had to reprove a few lemmas in `Algebra.GroupPower.Order`. I took the opportunity to generalise them.

This is a followup to leanprover-community/mathlib3#17391 motivated by https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Mathlib.2EAlgebra.2EAssociated and the move-only part of #11863.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented May 15, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title move(Algebra/Parity): Split file [Merged by Bors] - move(Algebra/Parity): Split file May 15, 2024
@mathlib-bors mathlib-bors bot closed this May 15, 2024
@mathlib-bors mathlib-bors bot deleted the move_algebra_parity branch May 15, 2024 10:47
callesonne pushed a commit that referenced this pull request May 16, 2024
Fixes a formatting issue in the output of `move-decls`.

As reported in #12829.

On that PR, the new script reports

***

* `+` Additive.instDecidablePredEven
* `--` [DecidablePred
* `-` even_abs
* `+` isSquare_mabs
* `+` Multiplicative.instDecidablePredIsSquare
callesonne pushed a commit that referenced this pull request May 16, 2024
Parity of elements in a group/ring is a basic algebraic concept, but it currently requires importing a bunch of algebraic order theory. As a consequence, `Algebra.Parity` currently holds a bunch of lemmas that really belong in earlier files but cannot due to import cycles.

This PR moves the content of `Algebra.Parity` to
* `Algebra.Group.Even` for the definition of `IsSquare` and `Even`
* `Algebra.Ring.Parity` for the definition of `Odd` and ring properties of `Even`
* `Algebra.Order.Group.Abs`, `Algebra.Order.Ring.Abs`, `Algebra.Order.Ring.Canonical`, `Algebra.Order.Sub.Canonical`, `Algebra.GroupPower.Order` for the various algebraic order properties of `Even` and `Odd`

As a result, `Even`/`Odd` are available much more widely without awkward dependencies and algebraic order lemmas are now in the correct files. The only slight downfall is that two lemmas in `Algebra.Ring.Parity` are stated using `Set.range`, hence I had to weaken a few `assert_not_exists` to forbidding `Data.Set.Basic` instead of `Data.Set.Defs`. This is inconsequential.

A side-effect of this PR is that I had to move some `bit0`/`bit1` lemmas. I could not find anywhere sensible to put them, so I am currently keeping them in `Algebra.Parity`. As a result, I had to reprove a few lemmas in `Algebra.GroupPower.Order`. I took the opportunity to generalise them.

This is a followup to leanprover-community/mathlib3#17391 motivated by https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Mathlib.2EAlgebra.2EAssociated and the move-only part of #11863.
grunweg pushed a commit that referenced this pull request May 17, 2024
Fixes a formatting issue in the output of `move-decls`.

As reported in #12829.

On that PR, the new script reports

***

* `+` Additive.instDecidablePredEven
* `--` [DecidablePred
* `-` even_abs
* `+` isSquare_mabs
* `+` Multiplicative.instDecidablePredIsSquare
grunweg pushed a commit that referenced this pull request May 17, 2024
Parity of elements in a group/ring is a basic algebraic concept, but it currently requires importing a bunch of algebraic order theory. As a consequence, `Algebra.Parity` currently holds a bunch of lemmas that really belong in earlier files but cannot due to import cycles.

This PR moves the content of `Algebra.Parity` to
* `Algebra.Group.Even` for the definition of `IsSquare` and `Even`
* `Algebra.Ring.Parity` for the definition of `Odd` and ring properties of `Even`
* `Algebra.Order.Group.Abs`, `Algebra.Order.Ring.Abs`, `Algebra.Order.Ring.Canonical`, `Algebra.Order.Sub.Canonical`, `Algebra.GroupPower.Order` for the various algebraic order properties of `Even` and `Odd`

As a result, `Even`/`Odd` are available much more widely without awkward dependencies and algebraic order lemmas are now in the correct files. The only slight downfall is that two lemmas in `Algebra.Ring.Parity` are stated using `Set.range`, hence I had to weaken a few `assert_not_exists` to forbidding `Data.Set.Basic` instead of `Data.Set.Defs`. This is inconsequential.

A side-effect of this PR is that I had to move some `bit0`/`bit1` lemmas. I could not find anywhere sensible to put them, so I am currently keeping them in `Algebra.Parity`. As a result, I had to reprove a few lemmas in `Algebra.GroupPower.Order`. I took the opportunity to generalise them.

This is a followup to leanprover-community/mathlib3#17391 motivated by https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Mathlib.2EAlgebra.2EAssociated and the move-only part of #11863.
mathlib-bors bot pushed a commit that referenced this pull request May 22, 2024
#12829 made `Algebra.Parity` almost empty. This PR deletes it.
callesonne pushed a commit that referenced this pull request Jun 4, 2024
#12829 made `Algebra.Parity` almost empty. This PR deletes it.
js2357 pushed a commit that referenced this pull request Jun 18, 2024
#12829 made `Algebra.Parity` almost empty. This PR deletes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants