Zulip Chat Archive
Stream: Is there code for X?
Topic: IsUnit_of_isUnit_mul
Andrew Yang (Nov 06 2024 at 04:29):
Do we really not have this?
import Mathlib.Algebra.Group.Units.Defs
import Mathlib.Tactic.Common
lemma isUnit_of_isUnit_mul {M : Type*} [Monoid M] (x y : M)
(h : Commute x y) (h' : IsUnit (x * y)) : IsUnit x := by
obtain ⟨⟨_, ixy, h₁, h₂⟩, rfl⟩ := h'
exact ⟨⟨_, y * ixy, by rwa [← mul_assoc],
by simpa only [mul_one, ← h.eq, h₁, mul_assoc] using congr(y * $h₂ * x * ixy)⟩, rfl⟩
Yury G. Kudryashov (Nov 06 2024 at 04:49):
Andrew Yang (Nov 06 2024 at 05:06):
Oh thanks!
Not sure how exact?
did not find it.
Kim Morrison (Nov 06 2024 at 05:24):
This lemma is an iff
that produces IsUnit x ∧ IsUnit y
. There's no way for apply
to get to IsUnit x
from that.
Yury G. Kudryashov (Nov 06 2024 at 05:36):
I found it using @loogle Commute, IsUnit (_ * _)
Also, it looks like I added it in 2021
loogle (Nov 06 2024 at 05:36):
:search: Commute.isUnit_mul_iff
Kim Morrison (Nov 06 2024 at 09:20):
If you add this (and the symmetric version) then exact?
will find it next time.
Yury G. Kudryashov (Nov 06 2024 at 15:30):
It can be called, e.g., IsUnit.left_of_mul
.
Ruben Van de Velde (Nov 06 2024 at 16:01):
Or Commute.isUnit_of_mul_left
? (or should it be right
, then)
Yaël Dillies (Nov 06 2024 at 16:04):
I think the Commute
doesn't really need to be part of the name, or rather than primarily, so that the name can be similar to the CommMonoid
lemma
Andrew Yang (Nov 06 2024 at 16:07):
There is already docs#isUnit_of_mul_isUnit_left which does not go through the non-commutative case, which was why I thought it didn't exist.
I'd prefer Commute.isUnit_of_mul_isUnit_left
to mirror the commmonoid lemma.
Yaël Dillies (Nov 06 2024 at 16:08):
I would call the CommMonoid
lemma IsUnit.left_of_mul
and the Commute
one IsUnit.left_of_mul_of_commute
Ruben Van de Velde (Nov 06 2024 at 16:19):
And rename docs#Commute.isUnit_mul_iff ?
Yaël Dillies (Nov 06 2024 at 16:19):
Don't really know about this one because no dot notation becomes available
Yury G. Kudryashov (Nov 06 2024 at 16:24):
I would leave Commute.isUnit_mul_iff
as is, because it can be used with dot notation now.
Last updated: May 02 2025 at 03:31 UTC