Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(algebra/invertible): add a missing lemma inv_of_eq_left_inv #8179

Closed
wants to merge 1 commit into from

Conversation

l534zhan
Copy link
Collaborator

@l534zhan l534zhan commented Jul 2, 2021

add "inv_of_eq_left_inv"


Open in Gitpod

add "inv_of_eq_left_inv"
@l534zhan l534zhan added easy < 20s of review time. See the lifecycle page for guidelines. awaiting-review The author would like community review of the PR labels Jul 2, 2021
Comment on lines +80 to +81
lemma inv_of_eq_left_inv [monoid α] {a b : α} [invertible a] (hac : b * a = 1) : ⅟a = b :=
(left_inv_eq_right_inv hac (mul_inv_of_self _)).symm
Copy link
Member

@eric-wieser eric-wieser Jul 2, 2021

Choose a reason for hiding this comment

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

For other reviewers: is this version better or worse?

Suggested change
lemma inv_of_eq_left_inv [monoid α] {a b : α} [invertible a] (hac : b * a = 1) : a = b :=
(left_inv_eq_right_inv hac (mul_inv_of_self _)).symm
lemma left_inv_eq_inv_of [monoid α] {a b : α} [invertible b] (hac : a * b = 1) : a = b :=
left_inv_eq_right_inv hac (mul_inv_of_self _)

My thoughts were that it doesn't swap a and b, but that's perhaps not important.

Copy link
Collaborator

@adomani adomani Jul 2, 2021

Choose a reason for hiding this comment

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

Eric, I think that your version is better. I can get close to a proof of this: in my opinion, the eq_comm at the end of the code below, almost certifies that there two sides should not be swapped!

lemma inv_mul_injective [monoid α] (a : α) [invertible a] : function.injective ((*) a) :=
λ b c bc, by simpa using congr_arg ((*) (⅟ a)) bc

lemma mul_inv_injective [monoid α] (a : α) [invertible a] : function.injective (flip (*) a) :=
λ b c bc, have h : b * a * ⅟ a= c * a * ⅟ a := congr_arg (flip (*) (⅟ a)) bc,
by simpa [mul_assoc] using h

lemma invertible.mul_eq_mul_iff_left [monoid α] (a : α) {b c : α} [invertible a] :
  a * b = a * c ↔ b = c :=
⟨λ h, inv_mul_injective a h, congr_arg ((*) a)⟩

lemma invertible.mul_eq_mul_iff_right [monoid α] (a : α) {b c : α} [invertible a] :
  b * a = c * a ↔ b = c :=
⟨λ h, mul_inv_injective a h, congr_arg (flip (*) a)⟩

lemma inv_of_eq_left_inv [monoid α] {a b : α} [invertible a] : b * a = 1 ↔ ⅟a = b :=
by { rw [← invertible.mul_eq_mul_iff_right (⅟ a)], simp [eq_comm] }

Copy link
Collaborator Author

@l534zhan l534zhan Jul 2, 2021

Choose a reason for hiding this comment

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

I am following the format of the existing "inv_of_eq_right_inv"
lemma inv_of_eq_right_inv [monoid α] {a b : α} [invertible a] (hac : a * b = 1) : ⅟a = b := left_inv_eq_right_inv (inv_of_mul_self _) hac
Should we change them both together (which may produce further problems) or stick to the current format.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's useful if the conclusion is of the form ⅟ foo = bar. That's the direction we will typically want to rw in. And for the rest, the statement should be the dual of inv_of_eq_right_inv. I don't have a strong opinion on whether or not to swap the a and the b in the statement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, Johan. Then how about stick to my current format which is the dual of the existing one and approving the PR?
@jcommelin

@eric-wieser
Copy link
Member

bors r+

I don't think it's worth spending any more time thinking about which version is best, since there's so little difference anyway. Let's just put in the version you suggested.

Thanks for the contribution!

@github-actions github-actions bot 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 Jul 3, 2021
bors bot pushed a commit that referenced this pull request Jul 3, 2021
@bors
Copy link

bors bot commented Jul 3, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(algebra/invertible): add a missing lemma inv_of_eq_left_inv [Merged by Bors] - feat(algebra/invertible): add a missing lemma inv_of_eq_left_inv Jul 3, 2021
@bors bors bot closed this Jul 3, 2021
@bors bors bot deleted the inv_lz branch July 3, 2021 12:19
b-mehta pushed a commit that referenced this pull request Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy < 20s of review time. See the lifecycle page for guidelines. 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

4 participants