Theorem: UniqueFactorizationMonoid.normalizedFactors_mul
File: Mathlib/RingTheory/UniqueFactorizationDomain.lean

tactic: have h : (normalize : α → α) = Associates.out ∘ Associates.mk := by
  ext
  rw [Function.comp_apply, Associates.out_mk]
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ normalizedFactors (x * y) = normalizedFactors x + normalizedFactors y

tactic: rw [← Multiset.map_id' (normalizedFactors (x * y)), ← Multiset.map_id' (normalizedFactors x), ←
  Multiset.map_id' (normalizedFactors y), ← Multiset.map_congr rfl normalize_normalized_factor, ←
  Multiset.map_congr rfl normalize_normalized_factor, ←
  Multiset.map_congr rfl normalize_normalized_factor, ← Multiset.map_add, h, ←
  Multiset.map_map Associates.out, eq_comm, ← Multiset.map_map Associates.out]
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ normalizedFactors (x * y) = normalizedFactors x + normalizedFactors y

tactic: refine' congr rfl _
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.map Associates.out (Multiset.map Associates.mk (normalizedFactors x + normalizedFactors y)) =
    Multiset.map Associates.out (Multiset.map Associates.mk (normalizedFactors (x * y)))

tactic: apply Multiset.map_mk_eq_map_mk_of_rel
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.map Associates.mk (normalizedFactors x + normalizedFactors y) =
    Multiset.map Associates.mk (normalizedFactors (x * y))

tactic: apply factors_unique
state_before: case hst
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.Rel Setoid.r (normalizedFactors x + normalizedFactors y) (normalizedFactors (x * y))

tactic: ext
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ ↑normalize = Associates.out ∘ Associates.mk

tactic: rw [Function.comp_apply, Associates.out_mk]
state_before: case h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
x✝ : α
⊢ ↑normalize x✝ = (Associates.out ∘ Associates.mk) x✝

tactic: intro x hx
state_before: case hst.hf
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ ∀ (x_1 : α), x_1 ∈ normalizedFactors x + normalizedFactors y → Irreducible x_1

tactic: rcases Multiset.mem_add.1 hx with (hx | hx) <;> exact irreducible_of_normalized_factor x hx
state_before: case hst.hf
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x✝ y : α
hx✝ : x✝ ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
x : α
hx : x ∈ normalizedFactors x✝ + normalizedFactors y
⊢ Irreducible x

tactic: exact irreducible_of_normalized_factor
state_before: case hst.hg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ ∀ (x_1 : α), x_1 ∈ normalizedFactors (x * y) → Irreducible x_1

tactic: rw [Multiset.prod_add]
state_before: case hst.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.prod (normalizedFactors x + normalizedFactors y) ~ᵤ Multiset.prod (normalizedFactors (x * y))

tactic: exact
  ((normalizedFactors_prod hx).mul_mul (normalizedFactors_prod hy)).trans
    (normalizedFactors_prod (mul_ne_zero hx hy)).symm
state_before: case hst.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.prod (normalizedFactors x) * Multiset.prod (normalizedFactors y) ~ᵤ Multiset.prod (normalizedFactors (x * y))