-- Mathlib/Algebra/BigOperators/Associated.lean
theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]
    [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)
    (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n

Proof state:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
a_prime : Prime a
⊢ b ∣ k

Tactic:
have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)

Result:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
a_prime : Prime a
b_prime : Prime b
⊢ b ∣ k

Proof state:
case cons
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
n : α
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ n
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
⊢ a * s.prod ∣ n

Tactic:
obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)

Result:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
⊢ a * s.prod ∣ a * k

Proof state:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
⊢ b ∣ k

Tactic:
have a_prime := h a (Multiset.mem_cons_self a s)

Result:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
a_prime : Prime a
⊢ b ∣ k

Proof state:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
a_prime : Prime a
b_prime : Prime b
⊢ b ∣ k

Tactic:
refine (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => ?_

Result:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
b_div_n : b ∣ a * k
a_prime : Prime a
b_prime : Prime b
b_div_a : b ∣ a
⊢ False

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
s : Multiset α
n : α
h : ∀ a ∈ s, Prime a
div : ∀ a ∈ s, a ∣ n
uniq : ∀ (a : α), countP (Associated a) s ≤ 1
⊢ s.prod ∣ n

Tactic:
induction s using Multiset.induction_on generalizing n with
| empty => simp only [Multiset.prod_zero, one_dvd]
| cons a s induct =>
  rw [Multiset.prod_cons]
  obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)
  apply mul_dvd_mul_left a
  refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)
    fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)
  have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)
  have a_prime := h a (Multiset.mem_cons_self a s)
  have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)
  refine (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => ?_
  have assoc := b_prime.associated_of_dvd a_prime b_div_a
  have := uniq a
  rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,
    Multiset.countP_pos] at this
  exact this ⟨b, b_in_s, assoc.symm⟩

Result:
no goals

Proof state:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
⊢ s.prod ∣ k

Tactic:
refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)
  fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)

Result:
case cons.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : (a : α) → DecidablePred (Associated a)
a : α
s : Multiset α
induct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → s.prod ∣ n
h : ∀ a_1 ∈ a ::ₘ s, Prime a_1
uniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1
k : α
div : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k
b : α
b_in_s : b ∈ s
⊢ b ∣ k