Theorem: irreducible_iff_prime_of_exists_unique_irreducible_factors
File: Mathlib/RingTheory/UniqueFactorizationDomain.lean

tactic: simp [ha0]
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : a * b = 0
ha0 : a = 0
⊢ p ∣ a ∨ p ∣ b

tactic: simp [hb0]
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : a * b = 0
hb0 : b = 0
⊢ p ∣ a ∨ p ∣ b

tactic: have hx0 : x ≠ 0 := fun hx0 => by simp_all
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
⊢ p ∣ a ∨ p ∣ b

tactic: have ha0 : a ≠ 0 := left_ne_zero_of_mul hab0
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
⊢ p ∣ a ∨ p ∣ b

tactic: have hb0 : b ≠ 0 := right_ne_zero_of_mul hab0
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
⊢ p ∣ a ∨ p ∣ b

tactic: cases' eif x hx0 with fx hfx
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ p ∣ a ∨ p ∣ b

tactic: cases' eif a ha0 with fa hfa
state_before: case intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
⊢ p ∣ a ∨ p ∣ b

tactic: cases' eif b hb0 with fb hfb
state_before: case intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
⊢ p ∣ a ∨ p ∣ b

tactic: exact
  let ⟨q, hqf, hq⟩ := Multiset.exists_mem_of_rel_of_mem h (Multiset.mem_cons_self p _)
  (Multiset.mem_add.1 hqf).elim
    (fun hqa =>
      Or.inl <| hq.dvd_iff_dvd_left.2 <| hfa.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqa))
    fun hqb =>
    Or.inr <| hq.dvd_iff_dvd_left.2 <| hfb.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqb)
state_before: case intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
h : Multiset.Rel Associated (p ::ₘ fx) (fa + fb)
⊢ p ∣ a ∨ p ∣ b

tactic: simp_all
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x = 0
⊢ False

tactic: apply uif
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.Rel Associated (p ::ₘ fx) (fa + fb)

tactic: calc
  Multiset.prod (p ::ₘ fx) ~ᵤ a * b := by
    rw [hx, Multiset.prod_cons]; exact hfx.2.mul_left _
  _ ~ᵤ fa.prod * fb.prod := (hfa.2.symm.mul_mul hfb.2.symm)
  _ = _ := by rw [Multiset.prod_add]
state_before: case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod (p ::ₘ fx) ~ᵤ Multiset.prod (fa + fb)

tactic: exact fun i hi => (Multiset.mem_cons.1 hi).elim (fun hip => hip.symm ▸ hpi) (hfx.1 _)
state_before: case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ ∀ (x : α), x ∈ p ::ₘ fx → Irreducible x

tactic: exact fun i hi => (Multiset.mem_add.1 hi).elim (hfa.1 _) (hfb.1 _)
state_before: case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ ∀ (x : α), x ∈ fa + fb → Irreducible x

tactic: rw [hx, Multiset.prod_cons]
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod (p ::ₘ fx) ~ᵤ a * b

tactic: exact hfx.2.mul_left _
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ p * Multiset.prod fx ~ᵤ p * x

tactic: rw [Multiset.prod_add]
state_before: α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod fa * Multiset.prod fb = Multiset.prod (fa + fb)