l3lab/ntp-mathlib huggingface dataset:
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ IsUnit A ∨ IsUnit B

Next tactic:
rw [← a.isUnit_units_mul]
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← a.isUnit_units_mul]
    

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ IsUnit (↑a * A) ∨ IsUnit B

Next tactic:
apply h
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← a.isUnit_units_mul]
    apply h
    

Proof state:
case refine'_1.a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), ↑a * b = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ ↑a * b = ↑a * A * B

Next tactic:
rw [mul_assoc, ← HAB]
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← a.isUnit_units_mul]
    apply h
    rw [mul_assoc, ← HAB]
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : ↑a * b = A * B
⊢ IsUnit A ∨ IsUnit B

Next tactic:
rw [← a⁻¹.isUnit_units_mul]
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← a.isUnit_units_mul]
    apply h
    rw [mul_assoc, ← HAB]
  · rw [← a⁻¹.isUnit_units_mul]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : ↑a * b = A * B
⊢ IsUnit (↑a⁻¹ * A) ∨ IsUnit B

Next tactic:
apply h
theorem irreducible_units_mul (a : αˣ) (b : α) : Irreducible (↑a * b) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_units_mul, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← a.isUnit_units_mul]
    apply h
    rw [mul_assoc, ← HAB]
  · rw [← a⁻¹.isUnit_units_mul]
    apply h
    

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : ↑a * b = A * B
⊢ b = ↑a⁻¹ * A * B

Next tactic:
rw [mul_assoc, ← HAB, Units.inv_mul_cancel_left]
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
⊢ Irreducible (b * ↑a) ↔ Irreducible b

Next tactic:
simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
⊢ ¬IsUnit b →
    ((∀ (a_2 b_1 : α), b * ↑a = a_2 * b_1 → IsUnit a_2 ∨ IsUnit b_1) ↔
      ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1)

Next tactic:
refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), b * ↑a = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ IsUnit A ∨ IsUnit B

Next tactic:
rw [← Units.isUnit_mul_units B a]
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← Units.isUnit_mul_units B a]
    

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), b * ↑a = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ IsUnit A ∨ IsUnit (B * ↑a)

Next tactic:
apply h
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← Units.isUnit_mul_units B a]
    apply h
    

Proof state:
case refine'_1.a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a_1 b_1 : α), b * ↑a = a_1 * b_1 → IsUnit a_1 ∨ IsUnit b_1
A B : α
HAB : b = A * B
⊢ b * ↑a = A * (B * ↑a)

Next tactic:
rw [← mul_assoc, ← HAB]
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← Units.isUnit_mul_units B a]
    apply h
    rw [← mul_assoc, ← HAB]
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : b * ↑a = A * B
⊢ IsUnit A ∨ IsUnit B

Next tactic:
rw [← Units.isUnit_mul_units B a⁻¹]
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← Units.isUnit_mul_units B a]
    apply h
    rw [← mul_assoc, ← HAB]
  · rw [← Units.isUnit_mul_units B a⁻¹]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : b * ↑a = A * B
⊢ IsUnit A ∨ IsUnit (B * ↑a⁻¹)

Next tactic:
apply h
theorem irreducible_mul_units (a : αˣ) (b : α) : Irreducible (b * ↑a) ↔ Irreducible b := by
  simp only [irreducible_iff, Units.isUnit_mul_units, and_congr_right_iff]
  refine' fun _ => ⟨fun h A B HAB => _, fun h A B HAB => _⟩
  · rw [← Units.isUnit_mul_units B a]
    apply h
    rw [← mul_assoc, ← HAB]
  · rw [← Units.isUnit_mul_units B a⁻¹]
    apply h
    

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a : αˣ
b : α
x✝ : ¬IsUnit b
h : ∀ (a b_1 : α), b = a * b_1 → IsUnit a ∨ IsUnit b_1
A B : α
HAB : b * ↑a = A * B
⊢ b = A * (B * ↑a⁻¹)

Next tactic:
rw [← mul_assoc, ← HAB, Units.mul_inv_cancel_right]
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
⊢ Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a

Next tactic:
constructor
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
⊢ Irreducible (a * b) → Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a

Next tactic:
refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
    · 

Proof state:
case mp.refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
h : Irreducible (a * b)
h' : IsUnit b
⊢ Irreducible a

Next tactic:
rwa [irreducible_mul_isUnit h'] at h
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
    · rwa [irreducible_mul_isUnit h'] at h
    · 

Proof state:
case mp.refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
h : Irreducible (a * b)
h' : IsUnit a
⊢ Irreducible b

Next tactic:
rwa [irreducible_isUnit_mul h'] at h
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
    · rwa [irreducible_mul_isUnit h'] at h
    · rwa [irreducible_isUnit_mul h'] at h
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
⊢ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a → Irreducible (a * b)

Next tactic:
rintro (⟨ha, hb⟩ | ⟨hb, ha⟩)
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
    · rwa [irreducible_mul_isUnit h'] at h
    · rwa [irreducible_isUnit_mul h'] at h
  · rintro (⟨ha, hb⟩ | ⟨hb, ha⟩)
    · 

Proof state:
case mpr.inl.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
ha : Irreducible a
hb : IsUnit b
⊢ Irreducible (a * b)

Next tactic:
rwa [irreducible_mul_isUnit hb]
theorem irreducible_mul_iff {a b : α} :
    Irreducible (a * b) ↔ Irreducible a ∧ IsUnit b ∨ Irreducible b ∧ IsUnit a := by
  constructor
  · refine' fun h => Or.imp (fun h' => ⟨_, h'⟩) (fun h' => ⟨_, h'⟩) (h.isUnit_or_isUnit rfl).symm
    · rwa [irreducible_mul_isUnit h'] at h
    · rwa [irreducible_isUnit_mul h'] at h
  · rintro (⟨ha, hb⟩ | ⟨hb, ha⟩)
    · rwa [irreducible_mul_isUnit hb]
    · 

Proof state:
case mpr.inr.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : Monoid α
a b : α
hb : Irreducible b
ha : IsUnit a
⊢ Irreducible (a * b)

Next tactic:
rwa [irreducible_isUnit_mul ha]
theorem Irreducible.not_square (ha : Irreducible a) : ¬IsSquare a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CommMonoid α
a : α
ha : Irreducible a
⊢ ¬IsSquare a

Next tactic:
rw [isSquare_iff_exists_sq]
theorem Irreducible.not_square (ha : Irreducible a) : ¬IsSquare a := by
  rw [isSquare_iff_exists_sq]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CommMonoid α
a : α
ha : Irreducible a
⊢ ¬∃ c, a = c ^ 2

Next tactic:
rintro ⟨b, rfl⟩
theorem Irreducible.not_square (ha : Irreducible a) : ¬IsSquare a := by
  rw [isSquare_iff_exists_sq]
  rintro ⟨b, rfl⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CommMonoid α
b : α
ha : Irreducible (b ^ 2)
⊢ False

Next tactic:
exact not_irreducible_pow one_lt_two.ne' ha
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
h : a = 0
⊢ False

Next tactic:
simp only [Prime, ne_eq, IsUnit.mul_iff] at *
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
h : a = 0
⊢ False

Next tactic:
rw [h, zero_mul] at hab
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = 0
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
h : a = 0
⊢ False

Next tactic:
have := hp.left
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = 0
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
h : a = 0
this : ¬p = 0
⊢ False

Next tactic:
contradiction
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
⊢ 1 * a = b * x * a

Next tactic:
conv =>
                    lhs
                    rw [hx]
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
| 1 * a = b * x * a

Next tactic:
lhs
                    rw [hx]
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
| 1 * a = b * x * a

Next tactic:
lhs
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
| 1 * a

Next tactic:
rw [hx]
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    rw [hx]
                · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ a
x : α
hx : a = a * b * x
⊢ 1 * (a * b * x) = b * x * a

Next tactic:
simp [mul_comm, mul_assoc, mul_left_comm]
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    rw [hx]
                · simp [mul_comm, mul_assoc, mul_left_comm]
                ⟩))
      fun ⟨x, hx⟩ =>
      Or.inl
        (isUnit_iff_dvd_one.2
          ⟨x,
            mul_right_cancel₀ (show b ≠ 0 from fun h => by
            

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : Prime p
a b : α
hab : p = a * b
x✝ : a * b ∣ b
x : α
hx : b = a * b * x
h : b = 0
⊢ False

Next tactic:
simp only [Prime, ne_eq, IsUnit.mul_iff] at *
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    rw [hx]
                · simp [mul_comm, mul_assoc, mul_left_comm]
                ⟩))
      fun ⟨x, hx⟩ =>
      Or.inl
        (isUnit_iff_dvd_one.2
          ⟨x,
            mul_right_cancel₀ (show b ≠ 0 from fun h => by
            simp only [Prime, ne_eq, IsUnit.mul_iff] at *
            

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = a * b
x✝ : a * b ∣ b
x : α
hx : b = a * b * x
h : b = 0
⊢ False

Next tactic:
rw [h, mul_zero] at hab
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    rw [hx]
                · simp [mul_comm, mul_assoc, mul_left_comm]
                ⟩))
      fun ⟨x, hx⟩ =>
      Or.inl
        (isUnit_iff_dvd_one.2
          ⟨x,
            mul_right_cancel₀ (show b ≠ 0 from fun h => by
            simp only [Prime, ne_eq, IsUnit.mul_iff] at *
            rw [h, mul_zero] at hab
            

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = 0
x✝ : a * b ∣ b
x : α
hx : b = a * b * x
h : b = 0
⊢ False

Next tactic:
have := hp.left
protected theorem Prime.irreducible (hp : Prime p) : Irreducible p :=
  ⟨hp.not_unit, fun a b hab =>
    (show a * b ∣ a ∨ a * b ∣ b from hab ▸ hp.dvd_or_dvd (hab ▸ dvd_rfl)).elim
      (fun ⟨x, hx⟩ =>
        Or.inr
          (isUnit_iff_dvd_one.2
            ⟨x,
              mul_right_cancel₀ (show a ≠ 0 from fun h => by
                simp only [Prime, ne_eq, IsUnit.mul_iff] at *
                rw [h, zero_mul] at hab
                have := hp.left
                contradiction
                ) <| by
                conv =>
                    lhs
                    rw [hx]
                · simp [mul_comm, mul_assoc, mul_left_comm]
                ⟩))
      fun ⟨x, hx⟩ =>
      Or.inl
        (isUnit_iff_dvd_one.2
          ⟨x,
            mul_right_cancel₀ (show b ≠ 0 from fun h => by
            simp only [Prime, ne_eq, IsUnit.mul_iff] at *
            rw [h, mul_zero] at hab
            have := hp.left
            

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : CancelCommMonoidWithZero α
a✝ p : α
hp : ¬p = 0 ∧ ¬IsUnit p ∧ ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
a b : α
hab : p = 0
x✝ : a * b ∣ b
x : α
hx : b = a * b * x
h : b = 0
this : ¬p = 0
⊢ False

Next tactic:
contradiction