[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
induction' s using Finset.induction with i s his ih generalizing x y a
[GOAL]
case empty
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
exact ⟨∅, ∅, x, y, by simp [hx]⟩
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
simp [hx]
[GOAL]
case insert
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [prod_insert his, ← mul_assoc] at hx 
[GOAL]
case insert
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
have hpi : Prime (p i) := hp i (mem_insert_self _ _)
[GOAL]
case insert
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rcases ih (fun i hi ↦ hp i (mem_insert_of_mem hi)) hx with ⟨t, u, b, c, htus, htu, hbc, rfl, rfl⟩
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
have hit : i ∉ t := fun hit ↦ his (htus ▸ mem_union_left _ hit)
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
have hiu : i ∉ u := fun hiu ↦ his (htus ▸ mem_union_right _ hiu)
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
obtain ⟨d, rfl⟩ | ⟨d, rfl⟩ : p i ∣ b ∨ p i ∣ c
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
exact hpi.dvd_or_dvd ⟨a, by rw [← hbc, mul_comm]⟩
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [← hbc, mul_comm]
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro.inl.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [mul_assoc, mul_comm a, mul_right_inj' hpi.ne_zero] at hbc 
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro.inl.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
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]⟩
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [insert_union, htus]
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
simp [hbc, prod_insert hit, mul_assoc, mul_comm, mul_left_comm]
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro.inr.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [← mul_assoc, mul_right_comm b, mul_left_inj' hpi.ne_zero] at hbc 
[GOAL]
case insert.intro.intro.intro.intro.intro.intro.intro.intro.inr.intro
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
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]⟩
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
rw [union_insert, htus]
[GOAL]
R : Type u_1
inst✝¹ : CancelCommMonoidWithZero R
α : Type u_2
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
[PROOFSTEP]
simp [← hbc, prod_insert hiu, mul_assoc, mul_comm, mul_left_comm]
[GOAL]
R : Type u_1
inst✝ : CancelCommMonoidWithZero R
x y a p : R
n : ℕ
hp : Prime p
hx : x * y = a * p ^ n
⊢ ∃ i j b c, i + j = n ∧ a = b * c ∧ x = b * p ^ i ∧ y = c * p ^ j
[PROOFSTEP]
rcases mul_eq_mul_prime_prod (fun _ _ ↦ hp) (show x * y = a * (range n).prod fun _ ↦ p by simpa) with
  ⟨t, u, b, c, htus, htu, rfl, rfl, rfl⟩
[GOAL]
R : Type u_1
inst✝ : CancelCommMonoidWithZero R
x y a p : R
n : ℕ
hp : Prime p
hx : x * y = a * p ^ n
⊢ x * y = a * ∏ x in range n, p
[PROOFSTEP]
simpa
[GOAL]
case intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝ : CancelCommMonoidWithZero R
p : R
n : ℕ
hp : Prime p
t u : Finset ℕ
b c : R
htus : t ∪ u = range n
htu : Disjoint t u
hx : (b * ∏ i in t, p) * (c * ∏ i in u, p) = b * c * p ^ n
⊢ ∃ i j b_1 c_1, i + j = n ∧ b * c = b_1 * c_1 ∧ b * ∏ i in t, p = b_1 * p ^ i ∧ c * ∏ i in u, p = c_1 * p ^ j
[PROOFSTEP]
exact ⟨t.card, u.card, b, c, by rw [← card_disjoint_union htu, htus, card_range], by simp⟩
[GOAL]
R : Type u_1
inst✝ : CancelCommMonoidWithZero R
p : R
n : ℕ
hp : Prime p
t u : Finset ℕ
b c : R
htus : t ∪ u = range n
htu : Disjoint t u
hx : (b * ∏ i in t, p) * (c * ∏ i in u, p) = b * c * p ^ n
⊢ card t + card u = n
[PROOFSTEP]
rw [← card_disjoint_union htu, htus, card_range]
[GOAL]
R : Type u_1
inst✝ : CancelCommMonoidWithZero R
p : R
n : ℕ
hp : Prime p
t u : Finset ℕ
b c : R
htus : t ∪ u = range n
htu : Disjoint t u
hx : (b * ∏ i in t, p) * (c * ∏ i in u, p) = b * c * p ^ n
⊢ b * c = b * c ∧ b * ∏ i in t, p = b * p ^ card t ∧ c * ∏ i in u, p = c * p ^ card u
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CommRing α
p : α
hp : Prime p
⊢ Prime (-p)
[PROOFSTEP]
obtain ⟨h1, h2, h3⟩ := hp
[GOAL]
case intro.intro
α : Type u_1
inst✝ : CommRing α
p : α
h1 : p ≠ 0
h2 : ¬IsUnit p
h3 : ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
⊢ Prime (-p)
[PROOFSTEP]
exact ⟨neg_ne_zero.mpr h1, by rwa [IsUnit.neg_iff], by simpa [neg_dvd] using h3⟩
[GOAL]
α : Type u_1
inst✝ : CommRing α
p : α
h1 : p ≠ 0
h2 : ¬IsUnit p
h3 : ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
⊢ ¬IsUnit (-p)
[PROOFSTEP]
rwa [IsUnit.neg_iff]
[GOAL]
α : Type u_1
inst✝ : CommRing α
p : α
h1 : p ≠ 0
h2 : ¬IsUnit p
h3 : ∀ (a b : α), p ∣ a * b → p ∣ a ∨ p ∣ b
⊢ ∀ (a b : α), -p ∣ a * b → -p ∣ a ∨ -p ∣ b
[PROOFSTEP]
simpa [neg_dvd] using h3
[GOAL]
α : Type u_1
inst✝¹ : CommRing α
inst✝ : LinearOrder α
p : α
hp : Prime p
⊢ Prime |p|
[PROOFSTEP]
obtain h | h := abs_choice p
[GOAL]
case inl
α : Type u_1
inst✝¹ : CommRing α
inst✝ : LinearOrder α
p : α
hp : Prime p
h : |p| = p
⊢ Prime |p|
[PROOFSTEP]
rw [h]
[GOAL]
case inr
α : Type u_1
inst✝¹ : CommRing α
inst✝ : LinearOrder α
p : α
hp : Prime p
h : |p| = -p
⊢ Prime |p|
[PROOFSTEP]
rw [h]
[GOAL]
case inl
α : Type u_1
inst✝¹ : CommRing α
inst✝ : LinearOrder α
p : α
hp : Prime p
h : |p| = p
⊢ Prime p
[PROOFSTEP]
exact hp
[GOAL]
case inr
α : Type u_1
inst✝¹ : CommRing α
inst✝ : LinearOrder α
p : α
hp : Prime p
h : |p| = -p
⊢ Prime (-p)
[PROOFSTEP]
exact hp.neg
