Module docstring
{"# Non-zero divisors in a ring "}
{"# Non-zero divisors in a ring "}
mul_cancel_right_mem_nonZeroDivisors
      theorem
     (hr : r ∈ R⁰) : x * r = y * r ↔ x = y
        lemma mul_cancel_right_mem_nonZeroDivisors (hr : r ∈ R⁰) : x * r = y * r ↔ x = y := by
  refine ⟨fun h ↦ ?_, congrArg (· * r)⟩
  rw [← sub_eq_zero, ← mul_right_mem_nonZeroDivisors_eq_zero_iff hr, sub_mul, h, sub_self]
        mul_cancel_right_coe_nonZeroDivisors
      theorem
     {c : R⁰} : x * c = y * c ↔ x = y
        lemma mul_cancel_right_coe_nonZeroDivisors {c : R⁰} : x * c = y * c ↔ x = y :=
  mul_cancel_right_mem_nonZeroDivisors c.prop
        isLeftRegular_iff_mem_nonZeroDivisorsRight
      theorem
     : IsLeftRegular r ↔ r ∈ nonZeroDivisorsRight R
        
      isRightRegular_iff_mem_nonZeroDivisorsLeft
      theorem
     : IsRightRegular r ↔ r ∈ nonZeroDivisorsLeft R
        
      le_nonZeroDivisors_iff_isRightRegular
      theorem
     {S : Submonoid R} : S ≤ R⁰ ↔ ∀ s : S, IsRightRegular (s : R)
        
      le_nonZeroDivisors_iff_isRegular
      theorem
     {R} [CommRing R] {S : Submonoid R} : S ≤ R⁰ ↔ ∀ s : S, IsRegular (s : R)
        
      isUnit_iff_mem_nonZeroDivisors_of_finite
      theorem
     [Finite R] : IsUnit a ↔ a ∈ nonZeroDivisors R
        /-- In a finite ring, an element is a unit iff it is a non-zero-divisor. -/
lemma isUnit_iff_mem_nonZeroDivisors_of_finite [Finite R] : IsUnitIsUnit a ↔ a ∈ nonZeroDivisors R := by
  refine ⟨IsUnit.mem_nonZeroDivisors, fun ha ↦ ?_⟩
  rw [IsUnit.isUnit_iff_mulRight_bijective, ← Finite.injective_iff_bijective]
  intro b c hbc
  rw [← sub_eq_zero, ← sub_mul] at hbc
  exact sub_eq_zero.mp (ha _ hbc)
        mul_cancel_left_mem_nonZeroDivisors
      theorem
     (hr : r ∈ R⁰) : r * x = r * y ↔ x = y
        @[simp]
lemma mul_cancel_left_mem_nonZeroDivisors (hr : r ∈ R⁰) : r * x = r * y ↔ x = y := by
  simp_rw [mul_comm r, mul_cancel_right_mem_nonZeroDivisors hr]
        mul_cancel_left_coe_nonZeroDivisors
      theorem
     {c : R⁰} : (c : R) * x = c * y ↔ x = y
        lemma mul_cancel_left_coe_nonZeroDivisors {c : R⁰} : (c : R) * x = c * y ↔ x = y :=
  mul_cancel_left_mem_nonZeroDivisors c.prop
        dvd_cancel_right_mem_nonZeroDivisors
      theorem
     (hr : r ∈ R⁰) : x * r ∣ y * r ↔ x ∣ y
        
      dvd_cancel_right_coe_nonZeroDivisors
      theorem
     {c : R⁰} : x * c ∣ y * c ↔ x ∣ y
        lemma dvd_cancel_right_coe_nonZeroDivisors {c : R⁰} : x * c ∣ y * cx * c ∣ y * c ↔ x ∣ y :=
  dvd_cancel_right_mem_nonZeroDivisors c.prop
        dvd_cancel_left_mem_nonZeroDivisors
      theorem
     (hr : r ∈ R⁰) : r * x ∣ r * y ↔ x ∣ y
        
      dvd_cancel_left_coe_nonZeroDivisors
      theorem
     {c : R⁰} : c * x ∣ c * y ↔ x ∣ y
        lemma dvd_cancel_left_coe_nonZeroDivisors {c : R⁰} : c * x ∣ c * yc * x ∣ c * y ↔ x ∣ y :=
  dvd_cancel_left_mem_nonZeroDivisors c.prop