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

tactic: obtain ⟨a0, hz, rfl⟩ := exists_non_zero_rep ha
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
k : ℕ
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p (factors a)
⊢ ∃ b, a = b ^ k

tactic: rw [factors_mk a0 hz] at hk
state_before: case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p (factors (Associates.mk a0))
⊢ ∃ b, Associates.mk a0 = b ^ k

tactic: have hk' : ∀ p, p ∈ factors' a0 → k ∣ (factors' a0).count p := by
  rintro p -
  have pp : p = ⟨p.val, p.2⟩ := by simp only [Subtype.coe_eta]
  rw [pp, ← count_some p.2]
  exact hk p.val p.2
state_before: case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
⊢ ∃ b, Associates.mk a0 = b ^ k

tactic: obtain ⟨u, hu⟩ := Multiset.exists_smul_of_dvd_count _ hk'
state_before: case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
⊢ ∃ b, Associates.mk a0 = b ^ k

tactic: use FactorSet.prod (u : FactorSet α)
state_before: case intro.intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ ∃ b, Associates.mk a0 = b ^ k

tactic: apply eq_of_factors_eq_factors
state_before: case intro.intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ Associates.mk a0 = FactorSet.prod ↑u ^ k

tactic: rw [pow_factors, prod_factors, factors_mk a0 hz, ← WithTop.some_eq_coe, hu]
state_before: case intro.intro.intro.h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ factors (Associates.mk a0) = factors (FactorSet.prod ↑u ^ k)

tactic: exact WithBot.coe_nsmul u k
state_before: case intro.intro.intro.h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ some (k • u) = k • ↑u

tactic: rintro p -
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
⊢ ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)

tactic: have pp : p = ⟨p.val, p.2⟩ := by simp only [Subtype.coe_eta]
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
⊢ k ∣ Multiset.count p (factors' a0)

tactic: rw [pp, ← count_some p.2]
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
pp : p = { val := ↑p, property := (_ : Irreducible ↑p) }
⊢ k ∣ Multiset.count p (factors' a0)

tactic: exact hk p.val p.2
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
pp : p = { val := ↑p, property := (_ : Irreducible ↑p) }
⊢ k ∣ count (↑p) (some (factors' a0))

tactic: simp only [Subtype.coe_eta]
state_before: α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
⊢ p = { val := ↑p, property := (_ : Irreducible ↑p) }