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

Commit d412cfd

Browse files
committed
chore(algebra/ring): lemmas about units in a semiring (#2680)
The lemmas in non-localization files from #2675. (Apart from one, which wasn't relevant to #2675). (Edit: I am bad at git. I was hoping there would only be 1 commit here. I hope whatever I'm doing wrong is inconsequential...)
1 parent 03c272e commit d412cfd

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/algebra/group/is_unit.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,11 @@ units.mul_lift_right_inv (λ y, (classical.some_spec $ h y).symm) x
9292
@[simp, to_additive] lemma is_unit.lift_right_inv_mul [monoid M] [monoid N] (f : M →* N)
9393
(h : ∀ x, is_unit (f x)) (x) : ↑(is_unit.lift_right f h x)⁻¹ * f x = 1 :=
9494
units.lift_right_inv_mul (λ y, (classical.some_spec $ h y).symm) x
95+
96+
@[to_additive] theorem is_unit.mul_right_inj [monoid M] {a b c : M} (ha : is_unit a) :
97+
a * b = a * c ↔ b = c :=
98+
by cases ha with a ha; rw [ha, units.mul_right_inj]
99+
100+
@[to_additive] theorem is_unit.mul_left_inj [monoid M] {a b c : M} (ha : is_unit a) :
101+
b * a = c * a ↔ b = c :=
102+
by cases ha with a ha; rw [ha, units.mul_left_inj]

src/algebra/ring.lean

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,21 @@ end
669669

670670
namespace units
671671

672+
section semiring
673+
variables [semiring α]
674+
675+
@[simp] theorem mul_left_eq_zero_iff_eq_zero
676+
{r : α} (u : units α) : r * u = 0 ↔ r = 0 :=
677+
⟨λ h, (mul_left_inj u).1 $ (zero_mul (u : α)).symm ▸ h,
678+
λ h, h.symm ▸ zero_mul (u : α)⟩
679+
680+
@[simp] theorem mul_right_eq_zero_iff_eq_zero
681+
{r : α} (u : units α) : (u : α) * r = 0 ↔ r = 0 :=
682+
⟨λ h, (mul_right_inj u).1 $ (mul_zero (u : α)).symm ▸ h,
683+
λ h, h.symm ▸ mul_zero (u : α)⟩
684+
685+
end semiring
686+
672687
section comm_semiring
673688
variables [comm_semiring α] (a b : α) (u : units α)
674689

@@ -707,6 +722,23 @@ end domain
707722

708723
end units
709724

725+
namespace is_unit
726+
727+
section semiring
728+
variables [semiring α]
729+
730+
theorem mul_left_eq_zero_iff_eq_zero {r u : α}
731+
(hu : is_unit u) : r * u = 0 ↔ r = 0 :=
732+
by cases hu with u hu; exact hu.symm ▸ units.mul_left_eq_zero_iff_eq_zero u
733+
734+
theorem mul_right_eq_zero_iff_eq_zero {r u : α}
735+
(hu : is_unit u) : u * r = 0 ↔ r = 0 :=
736+
by cases hu with u hu; exact hu.symm ▸ units.mul_right_eq_zero_iff_eq_zero u
737+
738+
end semiring
739+
740+
end is_unit
741+
710742
/-- A predicate to express that a ring is an integral domain.
711743
712744
This is mainly useful because such a predicate does not contain data,

0 commit comments

Comments
 (0)