Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

[Merged by Bors] - refactor(algebra/{group,group_with_zero/basic): Generalize lemmas to division monoids #14000

Closed
wants to merge 3 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented May 7, 2022

Generalize group and group_with_zero lemmas to division_monoid. We do not actually delete the original lemmas but make them one-liners from the new ones. The next PR will then delete the old lemmas and perform the renames in all files.

Lemmas are renamed because

  • one of the group or group_with_zero name has to go
  • the new API should have a consistent naming convention

Pre-emptive lemma renames

group lemma, group_with_zero lemma → new division_monoid/division_comm_monoid lemma

  • inv_eq_of_mul_eq_one, inv_eq_of_mul_left_eq_oneinv_eq_of_mul_eq_one_left
  • -, inv_eq_of_mul_right_eq_oneinv_eq_of_mul_eq_one_right
  • eq_inv_of_mul_eq_one, eq_inv_of_mul_left_eq_oneeq_inv_of_mul_eq_one_left
  • -, eq_inv_of_mul_right_eq_oneeq_inv_of_mul_eq_one_right
  • -, eq_one_div_of_mul_eq_oneeq_one_div_of_mul_eq_one_right
  • inv_div', inv_divinv_div
  • div_one', div_onediv_one
  • eq_of_div_eq_one', eq_of_div_eq_oneeq_of_div_eq_one
  • div_eq_inv_mul', div_eq_inv_muldiv_eq_inv_mul
  • div_right_comm', div_right_commdiv_right_comm
  • div_mul_eq_mul_div', div_mul_eq_mul_divdiv_mul_eq_mul_div
  • mul_comm_div', div_mul_eq_mul_div_commmul_comm_div
  • mul_inv, mul_inv₀mul_inv
  • inv_eq_one, inv_eq_one₀inv_eq_one
  • one_eq_inv, one_eq_inv₀one_eq_inv
  • div_div_div_comm, div_div_div_comm₀div_div_div_comm
  • div_mul_div_comm, div_mul_div_comm₀div_mul_div_comm
  • mul_div_comm', - → mul_div_mul_comm
  • one_inv, inv_oneinv_one
  • div_div, div_div_eq_div_muldiv_div
  • mul_div_left_comm, mul_div_commmul_div_left_comm
  • div_div_assoc_swap, div_div_eq_mul_divdiv_div_eq_mul_div

Other changes

  • Generalize left_inverse_inv and right_inverse_inv to has_involutive_inv, and div_eq_mul_one_div to div_inv_monoid.
  • Arguments order
  • Arguments implicitness

I found that splitting the refactor in this unusual way allowed me to have a cleaner diff and be systematically sure that I wasn't missing lemmas. The only problem is that I have to unsimp the old lemmas.

Here's what to look out for if you want to check for yourself:

  • All lemma renames are either because of the group/group_with_zero disparity or naming consistency within the new API.
  • simp and field_simp are copied correctly.
  • Every eligible group/group_with_zero lemma in the two files has been one-lined (some in other files haven't, but I will take care of them in another PR.
  • Every new division_monoid lemma is used to one-line an old lemma.
  • Arguments are explicit for unconditional equalities and implicit for implications and iffs.
  • Everything is additivized.

Open in Gitpod

@YaelDillies YaelDillies added awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. labels May 7, 2022
@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label May 7, 2022
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

I think your experiment is good. This diff looks clean!

bors merge

@leanprover-community-bot-assistant leanprover-community-bot-assistant added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels May 9, 2022
bors bot pushed a commit that referenced this pull request May 9, 2022
…division monoids (#14000)

Generalize `group` and `group_with_zero` lemmas to `division_monoid`. We do not actually delete the original lemmas but make them one-liners from the new ones. The next PR will then delete the old lemmas and perform the renames in all files.

Lemmas are renamed because
* one of the `group` or `group_with_zero` name has to go
* the new API should have a consistent naming convention

Pre-emptive lemma renames
@bors
Copy link

bors bot commented May 9, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(algebra/{group,group_with_zero/basic): Generalize lemmas to division monoids [Merged by Bors] - refactor(algebra/{group,group_with_zero/basic): Generalize lemmas to division monoids May 9, 2022
@bors bors bot closed this May 9, 2022
@bors bors bot deleted the division_monoid_group_lemmas branch May 9, 2022 02:37
bors bot pushed a commit that referenced this pull request May 10, 2022
…ized to division monoids (#14042)

Delete the `group` and `group_with_zero` lemmas which have been made one-liners in #14000.

Lemmas are renamed because
* one of the `group` or `group_with_zero` name has to go
* the new API should have a consistent naming convention

Lemma renames
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants