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

tactic: by_cases hx0 : x = 0
state_before: α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
⊢ count p (normalizedFactors x) = n

tactic: rw [← PartENat.natCast_inj]
state_before: case neg
α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ count p (normalizedFactors x) = n

tactic: convert (multiplicity_eq_count_normalizedFactors hp hx0).symm
state_before: case neg
α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ ↑(count p (normalizedFactors x)) = ↑n

tactic: exact (multiplicity.eq_coe_iff.mpr ⟨hle, hlt⟩).symm
state_before: case h.e'_3
α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ ↑n = multiplicity p x

tactic: simp [hx0] at hlt
state_before: case pos
α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : x = 0
⊢ count p (normalizedFactors x) = n

tactic: exact hnorm.symm
state_before: case h.e'_2.h.e'_3.h.e'_3
α : Type ?u.1059112
R : Type u_1
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ p = ↑normalize p