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

Commit e63e332

Browse files
committed
feat(algebra/ring/basic): all non-zero elements in a non-trivial ring with no non-zero zero divisors are regular (#12947)
Besides what the PR description says, I also golfed two earlier proofs.
1 parent b30f25c commit e63e332

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/algebra/ring/basic.lean

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,9 +1147,7 @@ The typeclass that restricts all terms of `α` to have this property is `no_zero
11471147
lemma is_left_regular_of_non_zero_divisor [ring α] (k : α)
11481148
(h : ∀ (x : α), k * x = 0 → x = 0) : is_left_regular k :=
11491149
begin
1150-
intros x y h',
1151-
rw ←sub_eq_zero,
1152-
refine h _ _,
1150+
refine λ x y (h' : k * x = k * y), sub_eq_zero.mp (h _ _),
11531151
rw [mul_sub, sub_eq_zero, h']
11541152
end
11551153

@@ -1158,10 +1156,7 @@ The typeclass that restricts all terms of `α` to have this property is `no_zero
11581156
lemma is_right_regular_of_non_zero_divisor [ring α] (k : α)
11591157
(h : ∀ (x : α), x * k = 0 → x = 0) : is_right_regular k :=
11601158
begin
1161-
intros x y h',
1162-
simp only at h',
1163-
rw ←sub_eq_zero,
1164-
refine h _ _,
1159+
refine λ x y (h' : x * k = y * k), sub_eq_zero.mp (h _ _),
11651160
rw [sub_mul, sub_eq_zero, h']
11661161
end
11671162

@@ -1172,6 +1167,10 @@ lemma is_regular_of_ne_zero' [ring α] [no_zero_divisors α] {k : α} (hk : k
11721167
is_right_regular_of_non_zero_divisor k
11731168
(λ x h, (no_zero_divisors.eq_zero_or_eq_zero_of_mul_eq_zero h).resolve_right hk)⟩
11741169

1170+
lemma is_regular_iff_ne_zero' [nontrivial α] [ring α] [no_zero_divisors α] {k : α} :
1171+
is_regular k ↔ k ≠ 0 :=
1172+
⟨λ h, by { rintro rfl, exact not_not.mpr h.left not_is_left_regular_zero }, is_regular_of_ne_zero'⟩
1173+
11751174
/-- A ring with no zero divisors is a cancel_monoid_with_zero.
11761175
11771176
Note this is not an instance as it forms a typeclass loop. -/

0 commit comments

Comments
 (0)