Theorem: PrimeMultiset.factorMultiset_prod
File: Mathlib/Data/PNat/Factors.lean

tactic: apply PrimeMultiset.coeNat_injective
state_before: v : PrimeMultiset
⊢ v.prod.factorMultiset = v
state_after: case a
v : PrimeMultiset
⊢ Coe.coe v.prod.factorMultiset = Coe.coe v

tactic: suffices toNatMultiset (PNat.factorMultiset (prod v)) = toNatMultiset v by exact this
state_before: case a
v : PrimeMultiset
⊢ Coe.coe v.prod.factorMultiset = Coe.coe v
state_after: case a
v : PrimeMultiset
⊢ v.prod.factorMultiset.toNatMultiset = v.toNatMultiset

tactic: rw [v.prod.coeNat_factorMultiset, PrimeMultiset.coe_prod]
state_before: case a
v : PrimeMultiset
⊢ v.prod.factorMultiset.toNatMultiset = v.toNatMultiset
state_after: case a
v : PrimeMultiset
⊢ ↑v.toNatMultiset.prod.factors = v.toNatMultiset

tactic: rcases v with ⟨l⟩
state_before: case a
v : PrimeMultiset
⊢ ↑v.toNatMultiset.prod.factors = v.toNatMultiset
state_after: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(toNatMultiset (Quot.mk Setoid.r l)).prod.factors = toNatMultiset (Quot.mk Setoid.r l)

tactic: dsimp [PrimeMultiset.toNatMultiset]
state_before: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(toNatMultiset (Quot.mk Setoid.r l)).prod.factors = toNatMultiset (Quot.mk Setoid.r l)
state_after: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(↑(List.map Coe.coe l)).prod.factors = ↑(List.map Coe.coe l)

tactic: rw [Multiset.prod_coe]
state_before: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(↑(List.map Coe.coe l)).prod.factors = ↑(List.map Coe.coe l)
state_after: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)

tactic: let l' := l.map (Coe.coe : Nat.Primes → ℕ)
state_before: case a.mk
v : PrimeMultiset
l : List Nat.Primes
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)
state_after: case a.mk
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)

tactic: have : ∀ p : ℕ, p ∈ l' → p.Prime := fun p hp => by
  rcases List.mem_map.mp hp with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩
  exact h_eq ▸ hp'
state_before: case a.mk
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)
state_after: case a.mk
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
this : ∀ p ∈ l', Nat.Prime p
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)

tactic: exact Multiset.coe_eq_coe.mpr (@Nat.factors_unique _ l' rfl this).symm
state_before: case a.mk
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
this : ∀ p ∈ l', Nat.Prime p
⊢ ↑(List.map Coe.coe l).prod.factors = ↑(List.map Coe.coe l)
state_after: no goals

tactic: exact this
state_before: v : PrimeMultiset
this : v.prod.factorMultiset.toNatMultiset = v.toNatMultiset
⊢ Coe.coe v.prod.factorMultiset = Coe.coe v
state_after: no goals

tactic: rcases List.mem_map.mp hp with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩
state_before: v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
p : ℕ
hp : p ∈ l'
⊢ Nat.Prime p
state_after: case intro.mk.intro
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
p : ℕ
hp : p ∈ l'
val✝ : ℕ
hp' : Nat.Prime val✝
left✝ : ⟨val✝, hp'⟩ ∈ l
h_eq : Coe.coe ⟨val✝, hp'⟩ = p
⊢ Nat.Prime p

tactic: exact h_eq ▸ hp'
state_before: case intro.mk.intro
v : PrimeMultiset
l : List Nat.Primes
l' : List ℕ := List.map Coe.coe l
p : ℕ
hp : p ∈ l'
val✝ : ℕ
hp' : Nat.Prime val✝
left✝ : ⟨val✝, hp'⟩ ∈ l
h_eq : Coe.coe ⟨val✝, hp'⟩ = p
⊢ Nat.Prime p
state_after: no goals