-- Mathlib/Algebra/Prime/Lemmas.lean
theorem irreducible_units_mul (a : Mˣ) (b : M) : Irreducible (↑a * b) ↔ Irreducible b

Proof state:
case refine_1
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ IsUnit (↑a * A) ∨ IsUnit B

Tactic:
apply h

Result:
case refine_1.a
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ ↑a * b = ↑a * A * B

Proof state:
case refine_1
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ IsUnit A ∨ IsUnit B

Tactic:
rw [← a.isUnit_units_mul]

Result:
case refine_1
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ IsUnit (↑a * A) ∨ IsUnit B

Proof state:
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
⊢ Irreducible (↑a * b) ↔ Irreducible b

Tactic:
simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]

Result:
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
⊢ ¬IsUnit b →
    ((∀ (a_2 b_1 : M), ↑a * b = a_2 * b_1 → IsUnit a_2 ∨ IsUnit b_1) ↔
      ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1)

Proof state:
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
⊢ ¬IsUnit b →
    ((∀ (a_2 b_1 : M), ↑a * b = a_2 * b_1 → IsUnit a_2 ∨ IsUnit b_1) ↔
      ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1)

Tactic:
refine fun _ => ⟨fun h A B HAB => ?_, fun h A B HAB => ?_⟩

Result:
case refine_1
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ IsUnit A ∨ IsUnit B

case refine_2
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ IsUnit A ∨ IsUnit B

Proof state:
case refine_2
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ IsUnit (↑a⁻¹ * A) ∨ IsUnit B

Tactic:
apply h

Result:
case refine_2.a
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ b = ↑a⁻¹ * A * B

Proof state:
case refine_2
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ IsUnit A ∨ IsUnit B

Tactic:
rw [← a⁻¹.isUnit_units_mul]

Result:
case refine_2
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ IsUnit (↑a⁻¹ * A) ∨ IsUnit B

Proof state:
case refine_1.a
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : M), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : M
HAB : b = A * B
⊢ ↑a * b = ↑a * A * B

Tactic:
rw [mul_assoc, ← HAB]

Result:
no goals

Proof state:
case refine_2.a
M : Type u_1
inst✝ : Monoid M
a : Mˣ
b : M
x✝ : ¬IsUnit b
h : ∀ (a b_1 : M), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : M
HAB : ↑a * b = A * B
⊢ b = ↑a⁻¹ * A * B

Tactic:
rw [mul_assoc, ← HAB, Units.inv_mul_cancel_left]

Result:
no goals