Theorem: mul_eq_mul_prime_prod
File: Mathlib/RingTheory/Prime.lean

tactic: induction' s using Finset.induction with i s his ih generalizing x y a
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a : R
s : Finset α
p : α → R
hp : ∀ (i : α), i ∈ s → Prime (p i)
hx : x * y = a * ∏ i in s, p i
⊢ ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i

tactic: exact ⟨∅, ∅, x, y, by simp [hx]⟩
state_before: case empty
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x✝ y✝ a✝ : R
s : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s → Prime (p i)
hx✝ : x✝ * y✝ = a✝ * ∏ i in s, p i
x y a : R
hp : ∀ (i : α), i ∈ ∅ → Prime (p i)
hx : x * y = a * ∏ i in ∅, p i
⊢ ∃ t u b c, t ∪ u = ∅ ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i

tactic: simp [hx]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x✝ y✝ a✝ : R
s : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s → Prime (p i)
hx✝ : x✝ * y✝ = a✝ * ∏ i in s, p i
x y a : R
hp : ∀ (i : α), i ∈ ∅ → Prime (p i)
hx : x * y = a * ∏ i in ∅, p i
⊢ ∅ ∪ ∅ = ∅ ∧ Disjoint ∅ ∅ ∧ a = x * y ∧ x = x * ∏ i in ∅, p i ∧ y = y * ∏ i in ∅, p i

tactic: rw [prod_insert his, ← mul_assoc] at hx
state_before: case insert
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x✝ y✝ a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x✝ * y✝ = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
x y a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hx : x * y = a * ∏ i in insert i s, p i
⊢ ∃ t u b c, t ∪ u = insert i s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i

tactic: have hpi : Prime (p i) := hp i (mem_insert_self _ _)
state_before: case insert
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x✝ y✝ a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x✝ * y✝ = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
x y a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hx : x * y = a * p i * ∏ x in s, p x
⊢ ∃ t u b c, t ∪ u = insert i s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i

tactic: rcases ih (fun i hi ↦ hp i (mem_insert_of_mem hi)) hx with
  ⟨t, u, b, c, htus, htu, hbc, rfl, rfl⟩
state_before: case insert
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x✝ y✝ a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x✝ * y✝ = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
x y a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hx : x * y = a * p i * ∏ x in s, p x
hpi : Prime (p i)
⊢ ∃ t u b c, t ∪ u = insert i s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i

tactic: have hit : i ∉ t := fun hit ↦ his (htus ▸ mem_union_left _ hit)
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b c : R
htus : t ∪ u = s
htu : Disjoint t u
hbc : a * p i = b * c
hx : (b * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b_1 c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c_1 ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

tactic: have hiu : i ∉ u := fun hiu ↦ his (htus ▸ mem_union_right _ hiu)
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b c : R
htus : t ∪ u = s
htu : Disjoint t u
hbc : a * p i = b * c
hx : (b * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
hit : ¬i ∈ t
⊢ ∃ t_1 u_1 b_1 c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c_1 ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

tactic: obtain ⟨d, rfl⟩ | ⟨d, rfl⟩ : p i ∣ b ∨ p i ∣ c
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b c : R
htus : t ∪ u = s
htu : Disjoint t u
hbc : a * p i = b * c
hx : (b * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
hit : ¬i ∈ t
hiu : ¬i ∈ u
⊢ ∃ t_1 u_1 b_1 c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c_1 ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

tactic: exact hpi.dvd_or_dvd ⟨a, by rw [← hbc, mul_comm]⟩
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b c : R
htus : t ∪ u = s
htu : Disjoint t u
hbc : a * p i = b * c
hx : (b * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
hit : ¬i ∈ t
hiu : ¬i ∈ u
⊢ p i ∣ b ∨ p i ∣ c

case insert.intro.intro.intro.intro.intro.intro.intro.intro.inl.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
c : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a * p i = p i * d * c
hx : (p i * d * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b * c_1 ∧ p i * d * ∏ i in t, p i = b * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

case insert.intro.intro.intro.intro.intro.intro.intro.intro.inr.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a * p i = b * (p i * d)
hx : (b * ∏ i in t, p i) * (p i * d * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b_1 c,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ p i * d * ∏ i in u, p i = c * ∏ i in u_1, p i

tactic: rw [← hbc, mul_comm]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b c : R
htus : t ∪ u = s
htu : Disjoint t u
hbc : a * p i = b * c
hx : (b * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
hit : ¬i ∈ t
hiu : ¬i ∈ u
⊢ b * c = p i * a

tactic: rw [mul_assoc, mul_comm a, mul_right_inj' hpi.ne_zero] at hbc
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro.inl.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
c : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a * p i = p i * d * c
hx : (p i * d * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b * c_1 ∧ p i * d * ∏ i in t, p i = b * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

tactic: exact ⟨insert i t, u, d, c, by rw [insert_union, htus], disjoint_insert_left.2 ⟨hiu, htu⟩, by
    simp [hbc, prod_insert hit, mul_assoc, mul_comm, mul_left_comm]⟩
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro.inl.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
c : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = d * c
hx : (p i * d * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b c_1,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b * c_1 ∧ p i * d * ∏ i in t, p i = b * ∏ i in t_1, p i ∧ c * ∏ i in u, p i = c_1 * ∏ i in u_1, p i

tactic: rw [insert_union, htus]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
c : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = d * c
hx : (p i * d * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ insert i t ∪ u = insert i s

tactic: simp [hbc, prod_insert hit, mul_assoc, mul_comm, mul_left_comm]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
c : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = d * c
hx : (p i * d * ∏ i in t, p i) * (c * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ a = d * c ∧ p i * d * ∏ i in t, p i = d * ∏ i in insert i t, p i ∧ c * ∏ i in u, p i = c * ∏ i in u, p i

tactic: rw [← mul_assoc, mul_right_comm b, mul_left_inj' hpi.ne_zero] at hbc
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro.inr.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a * p i = b * (p i * d)
hx : (b * ∏ i in t, p i) * (p i * d * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b_1 c,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ p i * d * ∏ i in u, p i = c * ∏ i in u_1, p i

tactic: exact ⟨t, insert i u, b, d, by rw [union_insert, htus], disjoint_insert_right.2 ⟨hit, htu⟩, by
    simp [← hbc, prod_insert hiu, mul_assoc, mul_comm, mul_left_comm]⟩
state_before: case insert.intro.intro.intro.intro.intro.intro.intro.intro.inr.intro
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = b * d
hx : (b * ∏ i in t, p i) * (p i * d * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ ∃ t_1 u_1 b_1 c,
    t_1 ∪ u_1 = insert i s ∧
      Disjoint t_1 u_1 ∧
        a = b_1 * c ∧ b * ∏ i in t, p i = b_1 * ∏ i in t_1, p i ∧ p i * d * ∏ i in u, p i = c * ∏ i in u_1, p i

tactic: rw [union_insert, htus]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = b * d
hx : (b * ∏ i in t, p i) * (p i * d * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ t ∪ insert i u = insert i s

tactic: simp [← hbc, prod_insert hiu, mul_assoc, mul_comm, mul_left_comm]
state_before: R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_1
inst✝ : DecidableEq α
x y a✝ : R
s✝ : Finset α
p : α → R
hp✝ : ∀ (i : α), i ∈ s✝ → Prime (p i)
hx✝ : x * y = a✝ * ∏ i in s✝, p i
i : α
s : Finset α
his : ¬i ∈ s
ih :
  ∀ {x y a : R},
    (∀ (i : α), i ∈ s → Prime (p i)) →
      x * y = a * ∏ i in s, p i →
        ∃ t u b c, t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ x = b * ∏ i in t, p i ∧ y = c * ∏ i in u, p i
a : R
hp : ∀ (i_1 : α), i_1 ∈ insert i s → Prime (p i_1)
hpi : Prime (p i)
t u : Finset α
b : R
htus : t ∪ u = s
htu : Disjoint t u
hit : ¬i ∈ t
hiu : ¬i ∈ u
d : R
hbc : a = b * d
hx : (b * ∏ i in t, p i) * (p i * d * ∏ i in u, p i) = a * p i * ∏ x in s, p x
⊢ a = b * d ∧ b * ∏ i in t, p i = b * ∏ i in t, p i ∧ p i * d * ∏ i in u, p i = d * ∏ i in insert i u, p i