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: isUnit_iff_eq_one #9706

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Mathlib/Algebra/Associated.lean
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,6 @@ section UniqueUnits

variable [Monoid α] [Unique αˣ]

theorem units_eq_one (u : αˣ) : u = 1 :=
Subsingleton.elim u 1
#align units_eq_one units_eq_one

theorem associated_iff_eq {x y : α} : x ~ᵤ y ↔ x = y := by
constructor
· rintro ⟨c, rfl⟩
Expand Down
7 changes: 7 additions & 0 deletions Mathlib/Algebra/Group/Units.lean
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,13 @@ lemma IsUnit.exists_left_inv [Monoid M] {a : M} (h : IsUnit a) : ∃ b, b * a =
#align is_unit.pow IsUnit.pow
#align is_add_unit.nsmul IsAddUnit.nsmul

theorem units_eq_one [Unique Mˣ] (u : Mˣ) : u = 1 :=
Subsingleton.elim u 1
#align units_eq_one units_eq_one

@[to_additive] lemma isUnit_iff_eq_one [Unique Mˣ] {x : M} : IsUnit x ↔ x = 1 :=
⟨fun ⟨u, hu⟩ ↦ by rw [← hu, Subsingleton.elim u 1, Units.val_one], fun h ↦ h ▸ isUnit_one⟩

end Monoid

@[to_additive]
Expand Down