Theorem: DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization.of_ufd_of_unique_irreducible
File: Mathlib/RingTheory/DiscreteValuationRing/Basic.lean

tactic: obtain ⟨p, hp⟩ := h₁
state_before: R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₁ : ∃ p, Irreducible p
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
⊢ HasUnitMulPowIrreducibleFactorization R

tactic: refine' ⟨p, hp, _⟩
state_before: case intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
⊢ HasUnitMulPowIrreducibleFactorization R

tactic: intro x hx
state_before: case intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
⊢ ∀ {x : R}, x ≠ 0 → ∃ n, Associated (p ^ n) x

tactic: cases' WfDvdMonoid.exists_factors x hx with fx hfx
state_before: case intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
⊢ ∃ n, Associated (p ^ n) x

tactic: refine' ⟨Multiset.card fx, _⟩
state_before: case intro.intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
⊢ ∃ n, Associated (p ^ n) x

tactic: have H := hfx.2
state_before: case intro.intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
⊢ Associated (p ^ ↑Multiset.card fx) x

tactic: rw [← Associates.mk_eq_mk_iff_associated] at H⊢
state_before: case intro.intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associated (Multiset.prod fx) x
⊢ Associated (p ^ ↑Multiset.card fx) x

tactic: rw [← H, ← Associates.prod_mk, Associates.mk_pow, ← Multiset.prod_replicate]
state_before: case intro.intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ Associates.mk (p ^ ↑Multiset.card fx) = Associates.mk x

tactic: congr 1
state_before: case intro.intro
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ Multiset.prod (Multiset.replicate (↑Multiset.card fx) (Associates.mk p)) =
    Multiset.prod (Multiset.map Associates.mk fx)

tactic: symm
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ Multiset.replicate (↑Multiset.card fx) (Associates.mk p) = Multiset.map Associates.mk fx

tactic: rw [Multiset.eq_replicate]
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ Multiset.map Associates.mk fx = Multiset.replicate (↑Multiset.card fx) (Associates.mk p)

tactic: simp only [true_and_iff, and_imp, Multiset.card_map, eq_self_iff_true, Multiset.mem_map,
  exists_imp]
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ ↑Multiset.card (Multiset.map Associates.mk fx) = ↑Multiset.card fx ∧
    ∀ (b : Associates R), b ∈ Multiset.map Associates.mk fx → b = Associates.mk p

tactic: rintro _ q hq rfl
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
⊢ ∀ (b : Associates R) (x : R), x ∈ fx → Associates.mk x = b → b = Associates.mk p

tactic: rw [Associates.mk_eq_mk_iff_associated]
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
q : R
hq : q ∈ fx
⊢ Associates.mk q = Associates.mk p

tactic: apply h₂ (hfx.1 _ hq) hp
state_before: case intro.intro.e_a
R : Type u_1
inst✝² : CommRing R
hR : HasUnitMulPowIrreducibleFactorization R
inst✝¹ : IsDomain R
inst✝ : UniqueFactorizationMonoid R
h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q
p : R
hp : Irreducible p
x : R
hx : x ≠ 0
fx : Multiset R
hfx : (∀ (b : R), b ∈ fx → Irreducible b) ∧ Associated (Multiset.prod fx) x
H : Associates.mk (Multiset.prod fx) = Associates.mk x
q : R
hq : q ∈ fx
⊢ Associated q p