Theorem: Associates.eq_factors_of_eq_counts
File: Mathlib/RingTheory/UniqueFactorizationDomain.lean

Proof steps:
state_before: α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → p.count a.factors = p.count b.factors
⊢ a.factors = b.factors
state_after: case intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → p.count a.factors = p.count b.factors
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
⊢ a.factors = b.factors
tactic: obtain ⟨sa, h_sa⟩ := factors_eq_some_iff_ne_zero.mpr ha
state_before: case intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → p.count a.factors = p.count b.factors
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
⊢ a.factors = b.factors
state_after: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → p.count a.factors = p.count b.factors
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h_sb : b.factors = ↑sb
⊢ a.factors = b.factors
tactic: obtain ⟨sb, h_sb⟩ := factors_eq_some_iff_ne_zero.mpr hb
state_before: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → p.count a.factors = p.count b.factors
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h_sb : b.factors = ↑sb
⊢ a.factors = b.factors
state_after: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
⊢ ↑sa = ↑sb
tactic: rw [h_sa, h_sb] at h ⊢
state_before: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
⊢ ↑sa = ↑sb
state_after: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
⊢ sa = sb
tactic: rw [WithTop.coe_eq_coe]
state_before: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
⊢ sa = sb
state_after: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
⊢ sa = sb
tactic: have h_count : ∀ (p : Associates α) (hp : Irreducible p),
      sa.count ⟨p, hp⟩ = sb.count ⟨p, hp⟩ := by
    intro p hp
    rw [← count_some, ← count_some, h p hp]
state_before: case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
⊢ sa = sb
state_after: case intro.intro.a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
⊢ toFinsupp sa = toFinsupp sb
tactic: apply Multiset.toFinsupp.injective
state_before: case intro.intro.a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
⊢ toFinsupp sa = toFinsupp sb
state_after: case intro.intro.a.h.mk
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
p : Associates α
hp : Irreducible p
⊢ (toFinsupp sa) ⟨p, hp⟩ = (toFinsupp sb) ⟨p, hp⟩
tactic: ext ⟨p, hp⟩
state_before: case intro.intro.a.h.mk
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : (p : Associates α) → Decidable (Irreducible p)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : a.factors = ↑sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → p.count ↑sa = p.count ↑sb
h_sb : b.factors = ↑sb
h_count : ∀ (p : Associates α) (hp : Irreducible p), Multiset.count ⟨p, hp⟩ sa = Multiset.count ⟨p, hp⟩ sb
p : Associates α
hp : Irreducible p
⊢ (toFinsupp sa) ⟨p, hp⟩ = (toFinsupp sb) ⟨p, hp⟩
state_after: no goals
tactic: rw [Multiset.toFinsupp_apply, Multiset.toFinsupp_apply, h_count p hp]