[GOAL]
α : Type u_1
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : IsNoetherianRing α
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
convert InvImage.wf (fun a => Ideal.span ({ a } : Set α)) (wellFounded_submodule_gt _ _)
[GOAL]
case h.e'_2
α : Type u_1
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : IsNoetherianRing α
⊢ DvdNotUnit = InvImage (fun x x_1 => x > x_1) fun a => Ideal.span {a}
[PROOFSTEP]
ext
[GOAL]
case h.e'_2.h.h.a
α : Type u_1
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : IsNoetherianRing α
x✝¹ x✝ : α
⊢ DvdNotUnit x✝¹ x✝ ↔ InvImage (fun x x_1 => x > x_1) (fun a => Ideal.span {a}) x✝¹ x✝
[PROOFSTEP]
exact Ideal.span_singleton_lt_span_singleton.symm
[GOAL]
α : Type u_1
inst✝ : CommMonoidWithZero α
h : WfDvdMonoid (Associates α)
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
refine' (Surjective.wellFounded_iff mk_surjective _).2 wellFounded_dvdNotUnit
[GOAL]
α : Type u_1
inst✝ : CommMonoidWithZero α
h : WfDvdMonoid (Associates α)
⊢ ∀ {a b : α}, DvdNotUnit a b ↔ DvdNotUnit (Associates.mk a) (Associates.mk b)
[PROOFSTEP]
intros
[GOAL]
α : Type u_1
inst✝ : CommMonoidWithZero α
h : WfDvdMonoid (Associates α)
a✝ b✝ : α
⊢ DvdNotUnit a✝ b✝ ↔ DvdNotUnit (Associates.mk a✝) (Associates.mk b✝)
[PROOFSTEP]
rw [mk_dvdNotUnit_mk_iff]
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
refine' (Surjective.wellFounded_iff mk_surjective _).1 wellFounded_dvdNotUnit
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
⊢ ∀ {a b : α}, DvdNotUnit a b ↔ DvdNotUnit (Associates.mk a) (Associates.mk b)
[PROOFSTEP]
intros
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
a✝ b✝ : α
⊢ DvdNotUnit a✝ b✝ ↔ DvdNotUnit (Associates.mk a✝) (Associates.mk b✝)
[PROOFSTEP]
rw [mk_dvdNotUnit_mk_iff]
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
a✝ a i : α
ha0 : a ≠ 0
hi : Irreducible i
ih : a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
x✝ : i * a ≠ 0
s : Multiset α
hs : (∀ (b : α), b ∈ s → Irreducible b) ∧ Multiset.prod s ~ᵤ a
⊢ Multiset.prod (i ::ₘ s) ~ᵤ i * a
[PROOFSTEP]
rw [s.prod_cons i]
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
a✝ a i : α
ha0 : a ≠ 0
hi : Irreducible i
ih : a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
x✝ : i * a ≠ 0
s : Multiset α
hs : (∀ (b : α), b ∈ s → Irreducible b) ∧ Multiset.prod s ~ᵤ a
⊢ i * Multiset.prod s ~ᵤ i * a
[PROOFSTEP]
exact hs.2.mul_left i
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
a : α
hn0 : a ≠ 0
hnu : ¬IsUnit a
⊢ ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f = a ∧ f ≠ ∅
[PROOFSTEP]
obtain ⟨f, hi, u, rfl⟩ := exists_factors a hn0
[GOAL]
case intro.intro.intro
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
⊢ ∃ f_1, (∀ (b : α), b ∈ f_1 → Irreducible b) ∧ Multiset.prod f_1 = Multiset.prod f * ↑u ∧ f_1 ≠ ∅
[PROOFSTEP]
obtain ⟨b, h⟩ := Multiset.exists_mem_of_ne_zero fun h : f = 0 => hnu <| by simp [h]
[GOAL]
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
h : f = 0
⊢ IsUnit (Multiset.prod f * ↑u)
[PROOFSTEP]
simp [h]
[GOAL]
case intro.intro.intro.intro
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
⊢ ∃ f_1, (∀ (b : α), b ∈ f_1 → Irreducible b) ∧ Multiset.prod f_1 = Multiset.prod f * ↑u ∧ f_1 ≠ ∅
[PROOFSTEP]
classical
refine' ⟨(f.erase b).cons (b * u), fun a ha => _, _, Multiset.cons_ne_zero⟩
· obtain rfl | ha := Multiset.mem_cons.1 ha
  exacts [Associated.irreducible ⟨u, rfl⟩ (hi b h), hi a (Multiset.mem_of_mem_erase ha)]
· rw [Multiset.prod_cons, mul_comm b, mul_assoc, Multiset.prod_erase h, mul_comm]
[GOAL]
case intro.intro.intro.intro
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
⊢ ∃ f_1, (∀ (b : α), b ∈ f_1 → Irreducible b) ∧ Multiset.prod f_1 = Multiset.prod f * ↑u ∧ f_1 ≠ ∅
[PROOFSTEP]
refine' ⟨(f.erase b).cons (b * u), fun a ha => _, _, Multiset.cons_ne_zero⟩
[GOAL]
case intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
a : α
ha : a ∈ b * ↑u ::ₘ Multiset.erase f b
⊢ Irreducible a
[PROOFSTEP]
obtain rfl | ha := Multiset.mem_cons.1 ha
[GOAL]
case intro.intro.intro.intro.refine'_1.inl
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
ha : b * ↑u ∈ b * ↑u ::ₘ Multiset.erase f b
⊢ Irreducible (b * ↑u)
case intro.intro.intro.intro.refine'_1.inr
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
a : α
ha✝ : a ∈ b * ↑u ::ₘ Multiset.erase f b
ha : a ∈ Multiset.erase f b
⊢ Irreducible a
[PROOFSTEP]
exacts [Associated.irreducible ⟨u, rfl⟩ (hi b h), hi a (Multiset.mem_of_mem_erase ha)]
[GOAL]
case intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝¹ : CommMonoidWithZero α
inst✝ : WfDvdMonoid α
f : Multiset α
hi : ∀ (b : α), b ∈ f → Irreducible b
u : αˣ
hn0 : Multiset.prod f * ↑u ≠ 0
hnu : ¬IsUnit (Multiset.prod f * ↑u)
b : α
h : b ∈ f
⊢ Multiset.prod (b * ↑u ::ₘ Multiset.erase f b) = Multiset.prod f * ↑u
[PROOFSTEP]
rw [Multiset.prod_cons, mul_comm b, mul_assoc, Multiset.prod_erase h, mul_comm]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
h : WellFounded fun x x_1 => x < x_1
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
convert h
[GOAL]
case h.e'_2.h.h.h.e
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
h : WellFounded fun x x_1 => x < x_1
x✝¹ x✝ : Associates α
⊢ DvdNotUnit = LT.lt
[PROOFSTEP]
ext
[GOAL]
case h.e'_2.h.h.h.e.h.h.a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
h : WellFounded fun x x_1 => x < x_1
x✝³ x✝² x✝¹ x✝ : Associates α
⊢ DvdNotUnit x✝¹ x✝ ↔ x✝¹ < x✝
[PROOFSTEP]
exact Associates.dvdNotUnit_iff_lt
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
⊢ WfDvdMonoid α → WellFounded fun x x_1 => x < x_1
[PROOFSTEP]
apply WfDvdMonoid.wellFounded_associates
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
src✝ : WfDvdMonoid (Associates α) := WfDvdMonoid.wfDvdMonoid_associates
⊢ ∀ {a : Associates α}, Irreducible a ↔ Prime a
[PROOFSTEP]
rw [← Associates.irreducible_iff_prime_iff]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
src✝ : WfDvdMonoid (Associates α) := WfDvdMonoid.wfDvdMonoid_associates
⊢ ∀ (a : α), Irreducible a ↔ Prime a
[PROOFSTEP]
apply UniqueFactorizationMonoid.irreducible_iff_prime
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
simp_rw [← UniqueFactorizationMonoid.irreducible_iff_prime]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
apply WfDvdMonoid.exists_factors a
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
P : α → Prop
a : α
h₁ : P 0
h₂ : ∀ (x : α), IsUnit x → P x
h₃ : ∀ (a p : α), a ≠ 0 → Prime p → P a → P (p * a)
⊢ P a
[PROOFSTEP]
simp_rw [← UniqueFactorizationMonoid.irreducible_iff_prime] at h₃
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : UniqueFactorizationMonoid α
P : α → Prop
a : α
h₁ : P 0
h₂ : ∀ (x : α), IsUnit x → P x
h₃ : ∀ (a p : α), a ≠ 0 → Irreducible p → P a → P (p * a)
⊢ P a
[PROOFSTEP]
exact WfDvdMonoid.induction_on_irreducible a h₁ h₂ h₃
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
⊢ ∀ {f g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
[PROOFSTEP]
classical
intro f
induction' f using Multiset.induction_on with p f ih
· intros g _ hg h
  exact
    Multiset.rel_zero_left.2 <|
      Multiset.eq_zero_of_forall_not_mem fun x hx =>
        have : IsUnit g.prod := by simpa [associated_one_iff_isUnit] using h.symm
        (hg x hx).not_unit <| isUnit_iff_dvd_one.2 <| (Multiset.dvd_prod hx).trans (isUnit_iff_dvd_one.1 this)
· intros g hf hg hfg
  let ⟨b, hbg, hb⟩ :=
    (exists_associated_mem_of_dvd_prod (hf p (by simp)) fun q hq => hg _ hq) <|
      hfg.dvd_iff_dvd_right.1 (show p ∣ (p ::ₘ f).prod by simp)
  haveI := Classical.decEq α
  rw [← Multiset.cons_erase hbg]
  exact
    Multiset.Rel.cons hb
      (ih (fun q hq => hf _ (by simp [hq])) (fun {q} (hq : q ∈ g.erase b) => hg q (Multiset.mem_of_mem_erase hq))
        (Associated.of_mul_left (by rwa [← Multiset.prod_cons, ← Multiset.prod_cons, Multiset.cons_erase hbg]) hb
          (hf p (by simp)).ne_zero))
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
⊢ ∀ {f g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
[PROOFSTEP]
intro f
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
f : Multiset α
⊢ ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
[PROOFSTEP]
induction' f using Multiset.induction_on with p f ih
[GOAL]
case empty
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
⊢ ∀ {g : Multiset α},
    (∀ (x : α), x ∈ 0 → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod 0 ~ᵤ Multiset.prod g → Multiset.Rel Associated 0 g
[PROOFSTEP]
intros g _ hg h
[GOAL]
case empty
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
g : Multiset α
a✝ : ∀ (x : α), x ∈ 0 → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
h : Multiset.prod 0 ~ᵤ Multiset.prod g
⊢ Multiset.Rel Associated 0 g
[PROOFSTEP]
exact
  Multiset.rel_zero_left.2 <|
    Multiset.eq_zero_of_forall_not_mem fun x hx =>
      have : IsUnit g.prod := by simpa [associated_one_iff_isUnit] using h.symm
      (hg x hx).not_unit <| isUnit_iff_dvd_one.2 <| (Multiset.dvd_prod hx).trans (isUnit_iff_dvd_one.1 this)
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
g : Multiset α
a✝ : ∀ (x : α), x ∈ 0 → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
h : Multiset.prod 0 ~ᵤ Multiset.prod g
x : α
hx : x ∈ g
⊢ IsUnit (Multiset.prod g)
[PROOFSTEP]
simpa [associated_one_iff_isUnit] using h.symm
[GOAL]
case cons
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
⊢ ∀ {g : Multiset α},
    (∀ (x : α), x ∈ p ::ₘ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g → Multiset.Rel Associated (p ::ₘ f) g
[PROOFSTEP]
intros g hf hg hfg
[GOAL]
case cons
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
⊢ Multiset.Rel Associated (p ::ₘ f) g
[PROOFSTEP]
let ⟨b, hbg, hb⟩ :=
  (exists_associated_mem_of_dvd_prod (hf p (by simp)) fun q hq => hg _ hq) <|
    hfg.dvd_iff_dvd_right.1 (show p ∣ (p ::ₘ f).prod by simp)
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
⊢ p ∈ p ::ₘ f
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
⊢ p ∣ Multiset.prod (p ::ₘ f)
[PROOFSTEP]
simp
[GOAL]
case cons
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
⊢ Multiset.Rel Associated (p ::ₘ f) g
[PROOFSTEP]
haveI := Classical.decEq α
[GOAL]
case cons
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
this : DecidableEq α
⊢ Multiset.Rel Associated (p ::ₘ f) g
[PROOFSTEP]
rw [← Multiset.cons_erase hbg]
[GOAL]
case cons
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
this : DecidableEq α
⊢ Multiset.Rel Associated (p ::ₘ f) (b ::ₘ Multiset.erase g b)
[PROOFSTEP]
exact
  Multiset.Rel.cons hb
    (ih (fun q hq => hf _ (by simp [hq])) (fun {q} (hq : q ∈ g.erase b) => hg q (Multiset.mem_of_mem_erase hq))
      (Associated.of_mul_left (by rwa [← Multiset.prod_cons, ← Multiset.prod_cons, Multiset.cons_erase hbg]) hb
        (hf p (by simp)).ne_zero))
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
this : DecidableEq α
q : α
hq : q ∈ f
⊢ q ∈ p ::ₘ f
[PROOFSTEP]
simp [hq]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
this : DecidableEq α
⊢ p * Multiset.prod f ~ᵤ b * Multiset.prod (Multiset.erase g b)
[PROOFSTEP]
rwa [← Multiset.prod_cons, ← Multiset.prod_cons, Multiset.cons_erase hbg]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
p : α
f : Multiset α
ih :
  ∀ {g : Multiset α},
    (∀ (x : α), x ∈ f → Prime x) →
      (∀ (x : α), x ∈ g → Prime x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
g : Multiset α
hf : ∀ (x : α), x ∈ p ::ₘ f → Prime x
hg : ∀ (x : α), x ∈ g → Prime x
hfg : Multiset.prod (p ::ₘ f) ~ᵤ Multiset.prod g
b : α
hbg : b ∈ g
hb : p ~ᵤ b
this : DecidableEq α
⊢ p ∈ p ::ₘ f
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ ∃ p, a ~ᵤ p ∧ f = {p}
[PROOFSTEP]
haveI := Classical.decEq α
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
⊢ ∃ p, a ~ᵤ p ∧ f = {p}
[PROOFSTEP]
refine
  @Multiset.induction_on _ (fun g => (g.prod ~ᵤ a) → (∀ b ∈ g, Prime b) → ∃ p, a ~ᵤ p ∧ g = { p }) f ?_ ?_ pfa.2 pfa.1
[GOAL]
case refine_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
⊢ (fun g => Multiset.prod g ~ᵤ a → (∀ (b : α), b ∈ g → Prime b) → ∃ p, a ~ᵤ p ∧ g = {p}) 0
[PROOFSTEP]
intro h
[GOAL]
case refine_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
h : Multiset.prod 0 ~ᵤ a
⊢ (∀ (b : α), b ∈ 0 → Prime b) → ∃ p, a ~ᵤ p ∧ 0 = {p}
[PROOFSTEP]
exact (ha.not_unit (associated_one_iff_isUnit.1 (Associated.symm h))).elim
[GOAL]
case refine_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
⊢ ∀ ⦃a_1 : α⦄ {s : Multiset α},
    (fun g => Multiset.prod g ~ᵤ a → (∀ (b : α), b ∈ g → Prime b) → ∃ p, a ~ᵤ p ∧ g = {p}) s →
      (fun g => Multiset.prod g ~ᵤ a → (∀ (b : α), b ∈ g → Prime b) → ∃ p, a ~ᵤ p ∧ g = {p}) (a_1 ::ₘ s)
[PROOFSTEP]
rintro p s _ ⟨u, hu⟩ hs
[GOAL]
case refine_2.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
⊢ ∃ p_1, a ~ᵤ p_1 ∧ p ::ₘ s = {p_1}
[PROOFSTEP]
use p
[GOAL]
case h
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
⊢ a ~ᵤ p ∧ p ::ₘ s = {p}
[PROOFSTEP]
have hs0 : s = 0 := by
  by_contra hs0
  obtain ⟨q, hq⟩ := Multiset.exists_mem_of_ne_zero hs0
  apply (hs q (by simp [hq])).2.1
  refine' (ha.isUnit_or_isUnit (_ : _ = p * ↑u * (s.erase q).prod * _)).resolve_left _
  · rw [mul_right_comm _ _ q, mul_assoc, ← Multiset.prod_cons, Multiset.cons_erase hq, ← hu, mul_comm, mul_comm p _,
      mul_assoc]
    simp
  apply mt isUnit_of_mul_isUnit_left (mt isUnit_of_mul_isUnit_left _)
  apply (hs p (Multiset.mem_cons_self _ _)).2.1
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
⊢ s = 0
[PROOFSTEP]
by_contra hs0
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
⊢ False
[PROOFSTEP]
obtain ⟨q, hq⟩ := Multiset.exists_mem_of_ne_zero hs0
[GOAL]
case intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ False
[PROOFSTEP]
apply (hs q (by simp [hq])).2.1
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ q ∈ p ::ₘ s
[PROOFSTEP]
simp [hq]
[GOAL]
case intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ IsUnit q
[PROOFSTEP]
refine' (ha.isUnit_or_isUnit (_ : _ = p * ↑u * (s.erase q).prod * _)).resolve_left _
[GOAL]
case intro.refine'_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ a = p * ↑u * Multiset.prod (Multiset.erase s q) * q
[PROOFSTEP]
rw [mul_right_comm _ _ q, mul_assoc, ← Multiset.prod_cons, Multiset.cons_erase hq, ← hu, mul_comm, mul_comm p _,
  mul_assoc]
[GOAL]
case intro.refine'_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ ↑u * Multiset.prod (p ::ₘ s) = ↑u * (p * Multiset.prod s)
[PROOFSTEP]
simp
[GOAL]
case intro.refine'_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ ¬IsUnit (p * ↑u * Multiset.prod (Multiset.erase s q))
[PROOFSTEP]
apply mt isUnit_of_mul_isUnit_left (mt isUnit_of_mul_isUnit_left _)
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : ¬s = 0
q : α
hq : q ∈ s
⊢ ¬IsUnit p
[PROOFSTEP]
apply (hs p (Multiset.mem_cons_self _ _)).2.1
[GOAL]
case h
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
a✝ : Multiset.prod s ~ᵤ a → (∀ (b : α), b ∈ s → Prime b) → ∃ p, a ~ᵤ p ∧ s = {p}
u : αˣ
hu : Multiset.prod (p ::ₘ s) * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ s → Prime b
hs0 : s = 0
⊢ a ~ᵤ p ∧ p ::ₘ s = {p}
[PROOFSTEP]
simp only [mul_one, Multiset.prod_cons, Multiset.prod_zero, hs0] at *
[GOAL]
case h
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : α
f : Multiset α
ha : Irreducible a
pfa : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
this : DecidableEq α
p : α
s : Multiset α
u : αˣ
a✝ : 1 ~ᵤ a → (∀ (b : α), b ∈ 0 → Prime b) → ∃ p, a ~ᵤ p ∧ 0 = {p}
hu : p * ↑u = a
hs : ∀ (b : α), b ∈ p ::ₘ 0 → Prime b
hs0 : True
⊢ a ~ᵤ p ∧ p ::ₘ 0 = {p}
[PROOFSTEP]
exact ⟨Associated.symm ⟨u, hu⟩, rfl⟩
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
classical
refine'
  RelHomClass.wellFounded (RelHom.mk _ _ : (DvdNotUnit : α → α → Prop) →r ((· < ·) : ℕ∞ → ℕ∞ → Prop))
    (WithTop.wellFounded_lt Nat.lt_wfRel.wf)
· intro a
  by_cases h : a = 0
  · exact ⊤
  exact ↑(Multiset.card (Classical.choose (pf a h)))
rintro a b ⟨ane0, ⟨c, hc, b_eq⟩⟩
rw [dif_neg ane0]
by_cases h : b = 0
· simp [h, lt_top_iff_ne_top]
· rw [dif_neg h]
  erw [WithTop.coe_lt_coe]
  have cne0 : c ≠ 0 := by
    refine' mt (fun con => _) h
    rw [b_eq, con, mul_zero]
  calc
    Multiset.card (Classical.choose (pf a ane0)) < _ + Multiset.card (Classical.choose (pf c cne0)) :=
      lt_add_of_pos_right _ (Multiset.card_pos.mpr fun con => hc (associated_one_iff_isUnit.mp ?_))
    _ = Multiset.card (Classical.choose (pf a ane0) + Classical.choose (pf c cne0)) := (Multiset.card_add _ _).symm
    _ = Multiset.card (Classical.choose (pf b h)) :=
      Multiset.card_eq_card_of_rel (prime_factors_unique ?_ (Classical.choose_spec (pf _ h)).1 ?_)
  · convert (Classical.choose_spec (pf c cne0)).2.symm
    rw [con, Multiset.prod_zero]
  · intro x hadd
    rw [Multiset.mem_add] at hadd
    cases' hadd with h h <;> apply (Classical.choose_spec (pf _ _)).1 _ h <;> assumption
  · rw [Multiset.prod_add]
    trans a * c
    · apply Associated.mul_mul <;> apply (Classical.choose_spec (pf _ _)).2 <;> assumption
    · rw [← b_eq]
      apply (Classical.choose_spec (pf _ _)).2.symm; assumption
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ WellFounded DvdNotUnit
[PROOFSTEP]
refine'
  RelHomClass.wellFounded (RelHom.mk _ _ : (DvdNotUnit : α → α → Prop) →r ((· < ·) : ℕ∞ → ℕ∞ → Prop))
    (WithTop.wellFounded_lt Nat.lt_wfRel.wf)
[GOAL]
case refine'_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ α → ℕ∞
[PROOFSTEP]
intro a
[GOAL]
case refine'_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : α
⊢ ℕ∞
[PROOFSTEP]
by_cases h : a = 0
[GOAL]
case pos
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : α
h : a = 0
⊢ ℕ∞
[PROOFSTEP]
exact ⊤
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : α
h : ¬a = 0
⊢ ℕ∞
[PROOFSTEP]
exact ↑(Multiset.card (Classical.choose (pf a h)))
[GOAL]
case refine'_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ ∀ {a b : α},
    DvdNotUnit a b →
      (if h : a = 0 then ⊤
        else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)))) <
        if h : b = 0 then ⊤
        else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
rintro a b ⟨ane0, ⟨c, hc, b_eq⟩⟩
[GOAL]
case refine'_2.intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
⊢ (if h : a = 0 then ⊤
    else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)))) <
    if h : b = 0 then ⊤
    else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
rw [dif_neg ane0]
[GOAL]
case refine'_2.intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    if h : b = 0 then ⊤
    else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
by_cases h : b = 0
[GOAL]
case pos
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : b = 0
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    if h : b = 0 then ⊤
    else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
simp [h, lt_top_iff_ne_top]
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    if h : b = 0 then ⊤
    else ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
rw [dif_neg h]
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
erw [WithTop.coe_lt_coe]
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
have cne0 : c ≠ 0 := by
  refine' mt (fun con => _) h
  rw [b_eq, con, mul_zero]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
⊢ c ≠ 0
[PROOFSTEP]
refine' mt (fun con => _) h
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
con : c = 0
⊢ b = 0
[PROOFSTEP]
rw [b_eq, con, mul_zero]
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) <
    ↑(↑Multiset.card (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b)))
[PROOFSTEP]
calc
  Multiset.card (Classical.choose (pf a ane0)) < _ + Multiset.card (Classical.choose (pf c cne0)) :=
    lt_add_of_pos_right _ (Multiset.card_pos.mpr fun con => hc (associated_one_iff_isUnit.mp ?_))
  _ = Multiset.card (Classical.choose (pf a ane0) + Classical.choose (pf c cne0)) := (Multiset.card_add _ _).symm
  _ = Multiset.card (Classical.choose (pf b h)) :=
    Multiset.card_eq_card_of_rel (prime_factors_unique ?_ (Classical.choose_spec (pf _ h)).1 ?_)
[GOAL]
case neg.calc_1
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
con : Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c) = 0
⊢ c ~ᵤ 1
[PROOFSTEP]
convert (Classical.choose_spec (pf c cne0)).2.symm
[GOAL]
case h.e'_4
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
con : Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c) = 0
⊢ 1 = Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c))
[PROOFSTEP]
rw [con, Multiset.prod_zero]
[GOAL]
case neg.calc_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ ∀ (x : α),
    x ∈
        Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a) +
          Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c) →
      Prime x
[PROOFSTEP]
intro x hadd
[GOAL]
case neg.calc_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
x : α
hadd :
  x ∈
    Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a) +
      Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)
⊢ Prime x
[PROOFSTEP]
rw [Multiset.mem_add] at hadd
[GOAL]
case neg.calc_2
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
x : α
hadd :
  x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a) ∨
    x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)
⊢ Prime x
[PROOFSTEP]
cases' hadd with h h
[GOAL]
case neg.calc_2.inl
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h✝ : ¬b = 0
cne0 : c ≠ 0
x : α
h : x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
⊢ Prime x
[PROOFSTEP]
apply (Classical.choose_spec (pf _ _)).1 _ h
[GOAL]
case neg.calc_2.inr
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h✝ : ¬b = 0
cne0 : c ≠ 0
x : α
h : x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)
⊢ Prime x
[PROOFSTEP]
apply (Classical.choose_spec (pf _ _)).1 _ h
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h✝ : ¬b = 0
cne0 : c ≠ 0
x : α
h : x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
⊢ a ≠ 0
[PROOFSTEP]
assumption
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h✝ : ¬b = 0
cne0 : c ≠ 0
x : α
h : x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)
⊢ c ≠ 0
[PROOFSTEP]
assumption
[GOAL]
case neg.calc_3
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ Multiset.prod
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a) +
        Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)) ~ᵤ
    Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b))
[PROOFSTEP]
rw [Multiset.prod_add]
[GOAL]
case neg.calc_3
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) *
      Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)) ~ᵤ
    Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b))
[PROOFSTEP]
trans a * c
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) *
      Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)) ~ᵤ
    a * c
[PROOFSTEP]
apply Associated.mul_mul
[GOAL]
case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) ~ᵤ a
[PROOFSTEP]
apply (Classical.choose_spec (pf _ _)).2
[GOAL]
case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ c)) ~ᵤ c
[PROOFSTEP]
apply (Classical.choose_spec (pf _ _)).2
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ a ≠ 0
[PROOFSTEP]
assumption
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ c ≠ 0
[PROOFSTEP]
assumption
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ a * c ~ᵤ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b))
[PROOFSTEP]
rw [← b_eq]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ b ~ᵤ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ b))
[PROOFSTEP]
apply (Classical.choose_spec (pf _ _)).2.symm
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a b : α
ane0 : a ≠ 0
c : α
hc : ¬IsUnit c
b_eq : b = a * c
h : ¬b = 0
cne0 : c ≠ 0
⊢ b ≠ 0
[PROOFSTEP]
assumption
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
⊢ Irreducible p ↔ Prime p
[PROOFSTEP]
by_cases hp0 : p = 0
[GOAL]
case pos
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : p = 0
⊢ Irreducible p ↔ Prime p
[PROOFSTEP]
simp [hp0]
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : ¬p = 0
⊢ Irreducible p ↔ Prime p
[PROOFSTEP]
refine' ⟨fun h => _, Prime.irreducible⟩
[GOAL]
case neg
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : ¬p = 0
h : Irreducible p
⊢ Prime p
[PROOFSTEP]
obtain ⟨f, hf⟩ := pf p hp0
[GOAL]
case neg.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : ¬p = 0
h : Irreducible p
f : Multiset α
hf : (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ p
⊢ Prime p
[PROOFSTEP]
obtain ⟨q, hq, rfl⟩ := prime_factors_irreducible h hf
[GOAL]
case neg.intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : ¬p = 0
h : Irreducible p
q : α
hq : p ~ᵤ q
hf : (∀ (b : α), b ∈ {q} → Prime b) ∧ Multiset.prod {q} ~ᵤ p
⊢ Prime p
[PROOFSTEP]
rw [hq.prime_iff]
[GOAL]
case neg.intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
pf : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
p : α
hp0 : ¬p = 0
h : Irreducible p
q : α
hq : p ~ᵤ q
hf : (∀ (b : α), b ∈ {q} → Prime b) ∧ Multiset.prod {q} ~ᵤ p
⊢ Prime q
[PROOFSTEP]
exact hf.1 q (Multiset.mem_singleton_self _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : UniqueFactorizationMonoid α
⊢ UniqueFactorizationMonoid β
[PROOFSTEP]
rw [UniqueFactorizationMonoid.iff_exists_prime_factors] at hα ⊢
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
⊢ ∀ (a : β), a ≠ 0 → ∃ f, (∀ (b : β), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
intro a ha
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
⊢ ∃ f, (∀ (b : β), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
obtain ⟨w, hp, u, h⟩ :=
  hα (e.symm a) fun h =>
    ha <| by
      convert ← map_zero e
      simp [← h]
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
h : ↑(symm e) a = 0
⊢ a = 0
[PROOFSTEP]
convert ← map_zero e
[GOAL]
case h.e'_2
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
h : ↑(symm e) a = 0
⊢ ↑e 0 = a
[PROOFSTEP]
simp [← h]
[GOAL]
case intro.intro.intro
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
w : Multiset α
hp : ∀ (b : α), b ∈ w → Prime b
u : αˣ
h : Multiset.prod w * ↑u = ↑(symm e) a
⊢ ∃ f, (∀ (b : β), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
exact
  ⟨w.map e, fun b hb =>
    let ⟨c, hc, he⟩ := Multiset.mem_map.1 hb
    he ▸ e.prime_iff.1 (hp c hc),
    Units.map e.toMonoidHom u, by
    erw [Multiset.prod_hom, ← e.map_mul, h]
    simp⟩
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
w : Multiset α
hp : ∀ (b : α), b ∈ w → Prime b
u : αˣ
h : Multiset.prod w * ↑u = ↑(symm e) a
⊢ Multiset.prod (Multiset.map (↑e) w) * ↑(↑(Units.map (toMonoidHom e)) u) = a
[PROOFSTEP]
erw [Multiset.prod_hom, ← e.map_mul, h]
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : CancelCommMonoidWithZero β
e : α ≃* β
hα : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
a : β
ha : a ≠ 0
w : Multiset α
hp : ∀ (b : α), b ∈ w → Prime b
u : αˣ
h : Multiset.prod w * ↑u = ↑(symm e) a
⊢ ↑e (↑(symm e) a) = a
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : a * b = 0
ha0 : a = 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
simp [ha0]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : a * b = 0
hb0 : b = 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
simp [hb0]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
have hx0 : x ≠ 0 := fun hx0 => by simp_all
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x = 0
⊢ False
[PROOFSTEP]
simp_all
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
have ha0 : a ≠ 0 := left_ne_zero_of_mul hab0
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
have hb0 : b ≠ 0 := right_ne_zero_of_mul hab0
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
cases' eif x hx0 with fx hfx
[GOAL]
case intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
cases' eif a ha0 with fa hfa
[GOAL]
case intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
cases' eif b hb0 with fb hfb
[GOAL]
case intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
have h : Multiset.Rel Associated (p ::ₘ fx) (fa + fb) :=
  by
  apply uif
  · exact fun i hi => (Multiset.mem_cons.1 hi).elim (fun hip => hip.symm ▸ hpi) (hfx.1 _)
  · exact fun i hi => (Multiset.mem_add.1 hi).elim (hfa.1 _) (hfb.1 _)
  calc
    Multiset.prod (p ::ₘ fx) ~ᵤ a * b := by rw [hx, Multiset.prod_cons]; exact hfx.2.mul_left _
    _ ~ᵤ fa.prod * fb.prod := (hfa.2.symm.mul_mul hfb.2.symm)
    _ = _ := by rw [Multiset.prod_add]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.Rel Associated (p ::ₘ fx) (fa + fb)
[PROOFSTEP]
apply uif
[GOAL]
case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ ∀ (x : α), x ∈ p ::ₘ fx → Irreducible x
[PROOFSTEP]
exact fun i hi => (Multiset.mem_cons.1 hi).elim (fun hip => hip.symm ▸ hpi) (hfx.1 _)
[GOAL]
case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ ∀ (x : α), x ∈ fa + fb → Irreducible x
[PROOFSTEP]
exact fun i hi => (Multiset.mem_add.1 hi).elim (hfa.1 _) (hfb.1 _)
[GOAL]
case a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod (p ::ₘ fx) ~ᵤ Multiset.prod (fa + fb)
[PROOFSTEP]
calc
  Multiset.prod (p ::ₘ fx) ~ᵤ a * b := by rw [hx, Multiset.prod_cons]; exact hfx.2.mul_left _
  _ ~ᵤ fa.prod * fb.prod := (hfa.2.symm.mul_mul hfb.2.symm)
  _ = _ := by rw [Multiset.prod_add]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod (p ::ₘ fx) ~ᵤ a * b
[PROOFSTEP]
rw [hx, Multiset.prod_cons]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ p * Multiset.prod fx ~ᵤ p * x
[PROOFSTEP]
exact hfx.2.mul_left _
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
⊢ Multiset.prod fa * Multiset.prod fb = Multiset.prod (fa + fb)
[PROOFSTEP]
rw [Multiset.prod_add]
[GOAL]
case intro.intro.intro
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
p : α
this : DecidableEq α := Classical.decEq α
hpi : Irreducible p
a b : α
x✝ : p ∣ a * b
x : α
hx : a * b = p * x
hab0 : ¬a * b = 0
hx0 : x ≠ 0
ha0 : a ≠ 0
hb0 : b ≠ 0
fx : Multiset α
hfx : (∀ (b : α), b ∈ fx → Irreducible b) ∧ Multiset.prod fx ~ᵤ x
fa : Multiset α
hfa : (∀ (b : α), b ∈ fa → Irreducible b) ∧ Multiset.prod fa ~ᵤ a
fb : Multiset α
hfb : (∀ (b : α), b ∈ fb → Irreducible b) ∧ Multiset.prod fb ~ᵤ b
h : Multiset.Rel Associated (p ::ₘ fx) (fa + fb)
⊢ p ∣ a ∨ p ∣ b
[PROOFSTEP]
exact
  let ⟨q, hqf, hq⟩ := Multiset.exists_mem_of_rel_of_mem h (Multiset.mem_cons_self p _)
  (Multiset.mem_add.1 hqf).elim
    (fun hqa => Or.inl <| hq.dvd_iff_dvd_left.2 <| hfa.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqa)) fun hqb =>
    Or.inr <| hq.dvd_iff_dvd_left.2 <| hfb.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqb)
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
⊢ ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a
[PROOFSTEP]
convert eif using 7
[GOAL]
case h.h'.h.e'_2.h.h.e'_1.h.h'.a
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
eif : ∀ (a : α), a ≠ 0 → ∃ f, (∀ (b : α), b ∈ f → Irreducible b) ∧ Multiset.prod f ~ᵤ a
uif :
  ∀ (f g : Multiset α),
    (∀ (x : α), x ∈ f → Irreducible x) →
      (∀ (x : α), x ∈ g → Irreducible x) → Multiset.prod f ~ᵤ Multiset.prod g → Multiset.Rel Associated f g
a✝³ : α
a✝² : a✝³ ≠ 0
x✝ : Multiset α
a✝¹ : α
a✝ : a✝¹ ∈ x✝
⊢ Prime a✝¹ ↔ Irreducible a✝¹
[PROOFSTEP]
simp_rw [irreducible_iff_prime_of_exists_unique_irreducible_factors eif uif]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod (factors a) ~ᵤ a
[PROOFSTEP]
rw [factors, dif_neg ane0]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) ~ᵤ a
[PROOFSTEP]
exact (Classical.choose_spec (exists_prime_factors a ane0)).2
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
p a : α
h : p ∈ factors a
⊢ a ≠ 0
[PROOFSTEP]
intro ha
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
p a : α
h : p ∈ factors a
ha : a = 0
⊢ False
[PROOFSTEP]
rw [factors, dif_pos ha] at h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
p a : α
h : p ∈ 0
ha : a = 0
⊢ False
[PROOFSTEP]
exact Multiset.not_mem_zero _ h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a x : α
hx : x ∈ factors a
⊢ Prime x
[PROOFSTEP]
have ane0 := ne_zero_of_mem_factors hx
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a x : α
hx : x ∈ factors a
ane0 : a ≠ 0
⊢ Prime x
[PROOFSTEP]
rw [factors, dif_neg ane0] at hx
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a x : α
ane0 : a ≠ 0
hx : x ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
⊢ Prime x
[PROOFSTEP]
exact (Classical.choose_spec (UniqueFactorizationMonoid.exists_prime_factors a ane0)).1 x hx
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
⊢ factors 0 = 0
[PROOFSTEP]
simp [factors]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
⊢ factors 1 = 0
[PROOFSTEP]
nontriviality α using factors
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ factors 1 = 0
[PROOFSTEP]
rw [← Multiset.rel_zero_right]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ Multiset.Rel ?m.413739 (factors 1) 0
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ Type ?u.413736
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ α → ?m.413738 → Prop
[PROOFSTEP]
refine' factors_unique irreducible_of_factor (fun x hx => (Multiset.not_mem_zero x hx).elim) _
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ Multiset.prod (factors 1) ~ᵤ Multiset.prod 0
[PROOFSTEP]
rw [Multiset.prod_zero]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
✝ : Nontrivial α
⊢ Multiset.prod (factors 1) ~ᵤ 1
[PROOFSTEP]
exact factors_prod one_ne_zero
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b = 0
⊢ False
[PROOFSTEP]
simp_all
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
⊢ p * b ~ᵤ Multiset.prod (p ::ₘ factors b)
[PROOFSTEP]
rw [Multiset.prod_cons]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
⊢ p * b ~ᵤ p * Multiset.prod (factors b)
[PROOFSTEP]
exact (factors_prod hb0).symm.mul_left _
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
this : Multiset.Rel Associated (p ::ₘ factors b) (factors a)
⊢ p ∈ p ::ₘ factors b
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
⊢ ∃ p, p ∈ factors x
[PROOFSTEP]
obtain ⟨p', hp', hp'x⟩ := WfDvdMonoid.exists_irreducible_factor h hx
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p' : α
hp' : Irreducible p'
hp'x : p' ∣ x
⊢ ∃ p, p ∈ factors x
[PROOFSTEP]
obtain ⟨p, hp, _⟩ := exists_mem_factors_of_dvd hx hp' hp'x
[GOAL]
case intro.intro.intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p' : α
hp' : Irreducible p'
hp'x : p' ∣ x
p : α
hp : p ∈ factors x
right✝ : p' ~ᵤ p
⊢ ∃ p, p ∈ factors x
[PROOFSTEP]
exact ⟨p, hp⟩
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ Multiset.Rel Associated (factors (x * y)) (factors x + factors y)
[PROOFSTEP]
refine'
  factors_unique irreducible_of_factor
    (fun a ha => (Multiset.mem_add.mp ha).by_cases (irreducible_of_factor _) (irreducible_of_factor _))
    ((factors_prod (mul_ne_zero hx hy)).trans _)
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ x * y ~ᵤ Multiset.prod (factors x + factors y)
[PROOFSTEP]
rw [Multiset.prod_add]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ x * y ~ᵤ Multiset.prod (factors x) * Multiset.prod (factors y)
[PROOFSTEP]
exact (Associated.mul_mul (factors_prod hx) (factors_prod hy)).symm
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
⊢ Multiset.Rel Associated (factors (x ^ n)) (n • factors x)
[PROOFSTEP]
match n with
| 0 => rw [zero_smul, pow_zero, factors_one, Multiset.rel_zero_right]
| n + 1 =>
  · by_cases h0 : x = 0
    · simp [h0, zero_pow n.succ_pos, smul_zero]
    · rw [pow_succ, succ_nsmul]
      refine' Multiset.Rel.trans _ (factors_mul h0 (pow_ne_zero n h0)) _
      refine' Multiset.Rel.add _ <| factors_pow n
      exact Multiset.rel_refl_of_refl_on fun y _ => Associated.refl _
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
⊢ Multiset.Rel Associated (factors (x ^ 0)) (0 • factors x)
[PROOFSTEP]
rw [zero_smul, pow_zero, factors_one, Multiset.rel_zero_right]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
⊢ Multiset.Rel Associated (factors (x ^ (n + 1))) ((n + 1) • factors x)
[PROOFSTEP]
by_cases h0 : x = 0
[GOAL]
case pos
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
h0 : x = 0
⊢ Multiset.Rel Associated (factors (x ^ (n + 1))) ((n + 1) • factors x)
[PROOFSTEP]
simp [h0, zero_pow n.succ_pos, smul_zero]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
h0 : ¬x = 0
⊢ Multiset.Rel Associated (factors (x ^ (n + 1))) ((n + 1) • factors x)
[PROOFSTEP]
rw [pow_succ, succ_nsmul]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
h0 : ¬x = 0
⊢ Multiset.Rel Associated (factors (x * x ^ n)) (factors x + n • factors x)
[PROOFSTEP]
refine' Multiset.Rel.trans _ (factors_mul h0 (pow_ne_zero n h0)) _
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
h0 : ¬x = 0
⊢ Multiset.Rel Associated (factors x + factors (x ^ n)) (factors x + n • factors x)
[PROOFSTEP]
refine' Multiset.Rel.add _ <| factors_pow n
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
n✝ n : ℕ
h0 : ¬x = 0
⊢ Multiset.Rel Associated (factors x) (factors x)
[PROOFSTEP]
exact Multiset.rel_refl_of_refl_on fun y _ => Associated.refl _
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ 0 < factors x ↔ ¬IsUnit x
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ 0 < factors x → ¬IsUnit x
[PROOFSTEP]
intro h hx
[GOAL]
case mp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx✝ : x ≠ 0
h : 0 < factors x
hx : IsUnit x
⊢ False
[PROOFSTEP]
obtain ⟨p, hp⟩ := Multiset.exists_mem_of_ne_zero h.ne'
[GOAL]
case mp.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx✝ : x ≠ 0
h : 0 < factors x
hx : IsUnit x
p : α
hp : p ∈ factors x
⊢ False
[PROOFSTEP]
exact (prime_of_factor _ hp).not_unit (isUnit_of_dvd_unit (dvd_of_mem_factors hp) hx)
[GOAL]
case mpr
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ ¬IsUnit x → 0 < factors x
[PROOFSTEP]
intro h
[GOAL]
case mpr
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
⊢ 0 < factors x
[PROOFSTEP]
obtain ⟨p, hp⟩ := exists_mem_factors hx h
[GOAL]
case mpr.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : DecidableEq α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p : α
hp : p ∈ factors x
⊢ 0 < factors x
[PROOFSTEP]
exact bot_lt_iff_ne_bot.mpr (mt Multiset.eq_zero_iff_forall_not_mem.mp (not_forall.mpr ⟨p, not_not.mpr hp⟩))
[GOAL]
α : Type u_1
inst✝⁷ : CancelCommMonoidWithZero α
inst✝⁶ : DecidableEq α
inst✝⁵ : NormalizationMonoid α
inst✝⁴ : UniqueFactorizationMonoid α
M : Type u_2
inst✝³ : CancelCommMonoidWithZero M
inst✝² : DecidableEq M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Unique Mˣ
x : M
⊢ factors x = normalizedFactors x
[PROOFSTEP]
unfold normalizedFactors
[GOAL]
α : Type u_1
inst✝⁷ : CancelCommMonoidWithZero α
inst✝⁶ : DecidableEq α
inst✝⁵ : NormalizationMonoid α
inst✝⁴ : UniqueFactorizationMonoid α
M : Type u_2
inst✝³ : CancelCommMonoidWithZero M
inst✝² : DecidableEq M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Unique Mˣ
x : M
⊢ factors x = Multiset.map (↑normalize) (factors x)
[PROOFSTEP]
convert (Multiset.map_id (factors x)).symm
[GOAL]
case h.e'_3.a.h.e
α : Type u_1
inst✝⁷ : CancelCommMonoidWithZero α
inst✝⁶ : DecidableEq α
inst✝⁵ : NormalizationMonoid α
inst✝⁴ : UniqueFactorizationMonoid α
M : Type u_2
inst✝³ : CancelCommMonoidWithZero M
inst✝² : DecidableEq M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Unique Mˣ
x x✝ : M
a✝ : x✝ ∈ factors x
⊢ ↑normalize = id
[PROOFSTEP]
ext p
[GOAL]
case h.e'_3.a.h.e.h
α : Type u_1
inst✝⁷ : CancelCommMonoidWithZero α
inst✝⁶ : DecidableEq α
inst✝⁵ : NormalizationMonoid α
inst✝⁴ : UniqueFactorizationMonoid α
M : Type u_2
inst✝³ : CancelCommMonoidWithZero M
inst✝² : DecidableEq M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Unique Mˣ
x x✝ : M
a✝ : x✝ ∈ factors x
p : M
⊢ ↑normalize p = id p
[PROOFSTEP]
exact normalize_eq p
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod (normalizedFactors a) ~ᵤ a
[PROOFSTEP]
rw [normalizedFactors, factors, dif_neg ane0]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod
      (Multiset.map (↑normalize) (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) ~ᵤ
    a
[PROOFSTEP]
refine' Associated.trans _ (Classical.choose_spec (exists_prime_factors a ane0)).2
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod
      (Multiset.map (↑normalize) (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) ~ᵤ
    Multiset.prod (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
[PROOFSTEP]
rw [← Associates.mk_eq_mk_iff_associated, ← Associates.prod_mk, ← Associates.prod_mk, Multiset.map_map]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Multiset.prod
      (Multiset.map (Associates.mk ∘ ↑normalize)
        (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))) =
    Multiset.prod
      (Multiset.map Associates.mk (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)))
[PROOFSTEP]
congr 2
[GOAL]
case e_a.e_f
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
⊢ Associates.mk ∘ ↑normalize = Associates.mk
[PROOFSTEP]
ext
[GOAL]
case e_a.e_f.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a ≠ 0
x✝ : α
⊢ (Associates.mk ∘ ↑normalize) x✝ = Associates.mk x✝
[PROOFSTEP]
rw [Function.comp_apply, Associates.mk_normalize]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ ∀ (x : α), x ∈ normalizedFactors a → Prime x
[PROOFSTEP]
rw [normalizedFactors, factors]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ ∀ (x : α),
    x ∈
        Multiset.map (↑normalize)
          (if h : a = 0 then 0 else Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) →
      Prime x
[PROOFSTEP]
split_ifs with ane0
[GOAL]
case pos
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : a = 0
⊢ ∀ (x : α), x ∈ Multiset.map (fun x => ↑normalize x) 0 → Prime x
[PROOFSTEP]
simp
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : ¬a = 0
⊢ ∀ (x : α),
    x ∈
        Multiset.map (fun x => ↑normalize x)
          (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) →
      Prime x
[PROOFSTEP]
intro x hx
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : ¬a = 0
x : α
hx :
  x ∈
    Multiset.map (fun x => ↑normalize x)
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
⊢ Prime x
[PROOFSTEP]
rcases Multiset.mem_map.1 hx with ⟨y, ⟨hy, rfl⟩⟩
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : ¬a = 0
y : α
hy : y ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
hx :
  ↑normalize y ∈
    Multiset.map (fun x => ↑normalize x)
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
⊢ Prime (↑normalize y)
[PROOFSTEP]
rw [(normalize_associated _).prime_iff]
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ane0 : ¬a = 0
y : α
hy : y ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
hx :
  ↑normalize y ∈
    Multiset.map (fun x => ↑normalize x)
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
⊢ Prime y
[PROOFSTEP]
exact (Classical.choose_spec (UniqueFactorizationMonoid.exists_prime_factors a ane0)).1 y hy
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ ∀ (x : α), x ∈ normalizedFactors a → ↑normalize x = x
[PROOFSTEP]
rw [normalizedFactors, factors]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ ∀ (x : α),
    x ∈
        Multiset.map (↑normalize)
          (if h : a = 0 then 0 else Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) →
      ↑normalize x = x
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
h : a = 0
⊢ ∀ (x : α), x ∈ Multiset.map (fun x => ↑normalize x) 0 → ↑normalize x = x
[PROOFSTEP]
simp
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
h : ¬a = 0
⊢ ∀ (x : α),
    x ∈
        Multiset.map (fun x => ↑normalize x)
          (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)) →
      ↑normalize x = x
[PROOFSTEP]
intro x hx
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
h : ¬a = 0
x : α
hx :
  x ∈
    Multiset.map (fun x => ↑normalize x)
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
⊢ ↑normalize x = x
[PROOFSTEP]
obtain ⟨y, _, rfl⟩ := Multiset.mem_map.1 hx
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
h : ¬a = 0
y : α
left✝ : y ∈ Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a)
hx :
  ↑normalize y ∈
    Multiset.map (fun x => ↑normalize x)
      (Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ a))
⊢ ↑normalize (↑normalize y) = ↑normalize y
[PROOFSTEP]
apply normalize_idem
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
⊢ normalizedFactors a = {↑normalize a}
[PROOFSTEP]
obtain ⟨p, a_assoc, hp⟩ := prime_factors_irreducible ha ⟨prime_of_normalized_factor, normalizedFactors_prod ha.ne_zero⟩
[GOAL]
case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
p : α
a_assoc : a ~ᵤ p
hp : normalizedFactors a = {p}
⊢ normalizedFactors a = {↑normalize a}
[PROOFSTEP]
have p_mem : p ∈ normalizedFactors a := by
  rw [hp]
  exact Multiset.mem_singleton_self _
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
p : α
a_assoc : a ~ᵤ p
hp : normalizedFactors a = {p}
⊢ p ∈ normalizedFactors a
[PROOFSTEP]
rw [hp]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
p : α
a_assoc : a ~ᵤ p
hp : normalizedFactors a = {p}
⊢ p ∈ {p}
[PROOFSTEP]
exact Multiset.mem_singleton_self _
[GOAL]
case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
p : α
a_assoc : a ~ᵤ p
hp : normalizedFactors a = {p}
p_mem : p ∈ normalizedFactors a
⊢ normalizedFactors a = {↑normalize a}
[PROOFSTEP]
convert hp
[GOAL]
case h.e'_3.h.e'_4
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
ha : Irreducible a
p : α
a_assoc : a ~ᵤ p
hp : normalizedFactors a = {p}
p_mem : p ∈ normalizedFactors a
⊢ ↑normalize a = p
[PROOFSTEP]
rwa [← normalize_normalized_factor p p_mem, normalize_eq_normalize_iff, dvd_dvd_iff_associated]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a : α
⊢ ∀ (p : α), p ∈ normalizedFactors a → ∀ (q : α), q ∈ normalizedFactors a → p ∣ q → p = q
[PROOFSTEP]
intro p hp q hq hdvd
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ p = q
[PROOFSTEP]
convert
  normalize_eq_normalize hdvd
    ((prime_of_normalized_factor _ hp).irreducible.dvd_symm (prime_of_normalized_factor _ hq).irreducible hdvd)
[GOAL]
case h.e'_2
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ p = ↑normalize p
[PROOFSTEP]
apply (normalize_normalized_factor _ ‹_›).symm
[GOAL]
case h.e'_3
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ q = ↑normalize q
[PROOFSTEP]
apply (normalize_normalized_factor _ ‹_›).symm
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b = 0
⊢ False
[PROOFSTEP]
simp_all
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
⊢ p * b ~ᵤ Multiset.prod (p ::ₘ normalizedFactors b)
[PROOFSTEP]
rw [Multiset.prod_cons]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
⊢ p * b ~ᵤ p * Multiset.prod (normalizedFactors b)
[PROOFSTEP]
exact (normalizedFactors_prod hb0).symm.mul_left _
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
ha0 : a ≠ 0
hp : Irreducible p
x✝ : p ∣ a
b : α
hb : a = p * b
hb0 : b ≠ 0
this : Multiset.Rel Associated (p ::ₘ normalizedFactors b) (normalizedFactors a)
⊢ p ∈ p ::ₘ normalizedFactors b
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
⊢ ∃ p, p ∈ normalizedFactors x
[PROOFSTEP]
obtain ⟨p', hp', hp'x⟩ := WfDvdMonoid.exists_irreducible_factor h hx
[GOAL]
case intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p' : α
hp' : Irreducible p'
hp'x : p' ∣ x
⊢ ∃ p, p ∈ normalizedFactors x
[PROOFSTEP]
obtain ⟨p, hp, _⟩ := exists_mem_normalizedFactors_of_dvd hx hp' hp'x
[GOAL]
case intro.intro.intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p' : α
hp' : Irreducible p'
hp'x : p' ∣ x
p : α
hp : p ∈ normalizedFactors x
right✝ : p' ~ᵤ p
⊢ ∃ p, p ∈ normalizedFactors x
[PROOFSTEP]
exact ⟨p, hp⟩
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
⊢ normalizedFactors 0 = 0
[PROOFSTEP]
simp [normalizedFactors, factors]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
⊢ normalizedFactors 1 = 0
[PROOFSTEP]
cases' subsingleton_or_nontrivial α with h h
[GOAL]
case inl
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Subsingleton α
⊢ normalizedFactors 1 = 0
[PROOFSTEP]
dsimp [normalizedFactors, factors]
[GOAL]
case inl
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Subsingleton α
⊢ Multiset.map (↑normalize)
      (if h : 1 = 0 then 0 else Classical.choose (_ : ∃ f, (∀ (b : α), b ∈ f → Prime b) ∧ Multiset.prod f ~ᵤ 1)) =
    0
[PROOFSTEP]
simp [Subsingleton.elim (1 : α) 0]
[GOAL]
case inr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ normalizedFactors 1 = 0
[PROOFSTEP]
rw [← Multiset.rel_zero_right]
[GOAL]
case inr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ Multiset.Rel ?m.629311 (normalizedFactors 1) 0
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ Type ?u.629308
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ α → ?m.629310 → Prop
[PROOFSTEP]
apply factors_unique irreducible_of_normalized_factor
[GOAL]
case inr.hg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ ∀ (x : α), x ∈ 0 → Irreducible x
[PROOFSTEP]
intro x hx
[GOAL]
case inr.hg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
x : α
hx : x ∈ 0
⊢ Irreducible x
[PROOFSTEP]
exfalso
[GOAL]
case inr.hg.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
x : α
hx : x ∈ 0
⊢ False
[PROOFSTEP]
apply Multiset.not_mem_zero x hx
[GOAL]
case inr.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
h : Nontrivial α
⊢ Multiset.prod (normalizedFactors 1) ~ᵤ Multiset.prod 0
[PROOFSTEP]
apply normalizedFactors_prod one_ne_zero
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ normalizedFactors (x * y) = normalizedFactors x + normalizedFactors y
[PROOFSTEP]
have h : (normalize : α → α) = Associates.out ∘ Associates.mk :=
  by
  ext
  rw [Function.comp_apply, Associates.out_mk]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ ↑normalize = Associates.out ∘ Associates.mk
[PROOFSTEP]
ext
[GOAL]
case h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
x✝ : α
⊢ ↑normalize x✝ = (Associates.out ∘ Associates.mk) x✝
[PROOFSTEP]
rw [Function.comp_apply, Associates.out_mk]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ normalizedFactors (x * y) = normalizedFactors x + normalizedFactors y
[PROOFSTEP]
rw [← Multiset.map_id' (normalizedFactors (x * y)), ← Multiset.map_id' (normalizedFactors x), ←
  Multiset.map_id' (normalizedFactors y), ← Multiset.map_congr rfl normalize_normalized_factor, ←
  Multiset.map_congr rfl normalize_normalized_factor, ← Multiset.map_congr rfl normalize_normalized_factor, ←
  Multiset.map_add, h, ← Multiset.map_map Associates.out, eq_comm, ← Multiset.map_map Associates.out]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.map Associates.out (Multiset.map Associates.mk (normalizedFactors x + normalizedFactors y)) =
    Multiset.map Associates.out (Multiset.map Associates.mk (normalizedFactors (x * y)))
[PROOFSTEP]
refine' congr rfl _
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.map Associates.mk (normalizedFactors x + normalizedFactors y) =
    Multiset.map Associates.mk (normalizedFactors (x * y))
[PROOFSTEP]
apply Multiset.map_mk_eq_map_mk_of_rel
[GOAL]
case hst
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.Rel Setoid.r (normalizedFactors x + normalizedFactors y) (normalizedFactors (x * y))
[PROOFSTEP]
apply factors_unique
[GOAL]
case hst.hf
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ ∀ (x_1 : α), x_1 ∈ normalizedFactors x + normalizedFactors y → Irreducible x_1
[PROOFSTEP]
intro x hx
[GOAL]
case hst.hf
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x✝ y : α
hx✝ : x✝ ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
x : α
hx : x ∈ normalizedFactors x✝ + normalizedFactors y
⊢ Irreducible x
[PROOFSTEP]
rcases Multiset.mem_add.1 hx with (hx | hx)
[GOAL]
case hst.hf.inl
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x✝ y : α
hx✝¹ : x✝ ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
x : α
hx✝ : x ∈ normalizedFactors x✝ + normalizedFactors y
hx : x ∈ normalizedFactors x✝
⊢ Irreducible x
[PROOFSTEP]
exact irreducible_of_normalized_factor x hx
[GOAL]
case hst.hf.inr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x✝ y : α
hx✝¹ : x✝ ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
x : α
hx✝ : x ∈ normalizedFactors x✝ + normalizedFactors y
hx : x ∈ normalizedFactors y
⊢ Irreducible x
[PROOFSTEP]
exact irreducible_of_normalized_factor x hx
[GOAL]
case hst.hg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ ∀ (x_1 : α), x_1 ∈ normalizedFactors (x * y) → Irreducible x_1
[PROOFSTEP]
exact irreducible_of_normalized_factor
[GOAL]
case hst.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.prod (normalizedFactors x + normalizedFactors y) ~ᵤ Multiset.prod (normalizedFactors (x * y))
[PROOFSTEP]
rw [Multiset.prod_add]
[GOAL]
case hst.h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : ↑normalize = Associates.out ∘ Associates.mk
⊢ Multiset.prod (normalizedFactors x) * Multiset.prod (normalizedFactors y) ~ᵤ Multiset.prod (normalizedFactors (x * y))
[PROOFSTEP]
exact
  ((normalizedFactors_prod hx).mul_mul (normalizedFactors_prod hy)).trans
    (normalizedFactors_prod (mul_ne_zero hx hy)).symm
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
⊢ normalizedFactors (x ^ n) = n • normalizedFactors x
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
⊢ normalizedFactors (x ^ Nat.zero) = Nat.zero • normalizedFactors x
[PROOFSTEP]
simp
[GOAL]
case succ
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
ih : normalizedFactors (x ^ n) = n • normalizedFactors x
⊢ normalizedFactors (x ^ Nat.succ n) = Nat.succ n • normalizedFactors x
[PROOFSTEP]
by_cases h0 : x = 0
[GOAL]
case pos
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
ih : normalizedFactors (x ^ n) = n • normalizedFactors x
h0 : x = 0
⊢ normalizedFactors (x ^ Nat.succ n) = Nat.succ n • normalizedFactors x
[PROOFSTEP]
simp [h0, zero_pow n.succ_pos, smul_zero]
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
n : ℕ
ih : normalizedFactors (x ^ n) = n • normalizedFactors x
h0 : ¬x = 0
⊢ normalizedFactors (x ^ Nat.succ n) = Nat.succ n • normalizedFactors x
[PROOFSTEP]
rw [pow_succ, succ_nsmul, normalizedFactors_mul h0 (pow_ne_zero _ h0), ih]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
p : α
hp : Irreducible p
k : ℕ
⊢ normalizedFactors (p ^ k) = Multiset.replicate k (↑normalize p)
[PROOFSTEP]
rw [UniqueFactorizationMonoid.normalizedFactors_pow, normalizedFactors_irreducible hp, Multiset.nsmul_singleton]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s : Multiset α
hs : ∀ (a : α), a ∈ s → Irreducible a
⊢ normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
[PROOFSTEP]
induction' s using Multiset.induction with a s ih
[GOAL]
case empty
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s : Multiset α
hs✝ : ∀ (a : α), a ∈ s → Irreducible a
hs : ∀ (a : α), a ∈ 0 → Irreducible a
⊢ normalizedFactors (Multiset.prod 0) = Multiset.map (↑normalize) 0
[PROOFSTEP]
rw [Multiset.prod_zero, normalizedFactors_one, Multiset.map_zero]
[GOAL]
case cons
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s✝ : Multiset α
hs✝ : ∀ (a : α), a ∈ s✝ → Irreducible a
a : α
s : Multiset α
ih : (∀ (a : α), a ∈ s → Irreducible a) → normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ s → Irreducible a_1
⊢ normalizedFactors (Multiset.prod (a ::ₘ s)) = Multiset.map (↑normalize) (a ::ₘ s)
[PROOFSTEP]
have ia := hs a (Multiset.mem_cons_self a _)
[GOAL]
case cons
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s✝ : Multiset α
hs✝ : ∀ (a : α), a ∈ s✝ → Irreducible a
a : α
s : Multiset α
ih : (∀ (a : α), a ∈ s → Irreducible a) → normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ s → Irreducible a_1
ia : Irreducible a
⊢ normalizedFactors (Multiset.prod (a ::ₘ s)) = Multiset.map (↑normalize) (a ::ₘ s)
[PROOFSTEP]
have ib := fun b h => hs b (Multiset.mem_cons_of_mem h)
[GOAL]
case cons
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s✝ : Multiset α
hs✝ : ∀ (a : α), a ∈ s✝ → Irreducible a
a : α
s : Multiset α
ih : (∀ (a : α), a ∈ s → Irreducible a) → normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ s → Irreducible a_1
ia : Irreducible a
ib : ∀ (b : α), b ∈ s → Irreducible b
⊢ normalizedFactors (Multiset.prod (a ::ₘ s)) = Multiset.map (↑normalize) (a ::ₘ s)
[PROOFSTEP]
obtain rfl | ⟨b, hb⟩ := s.empty_or_exists_mem
[GOAL]
case cons.inl
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s : Multiset α
hs✝ : ∀ (a : α), a ∈ s → Irreducible a
a : α
ia : Irreducible a
ih : (∀ (a : α), a ∈ 0 → Irreducible a) → normalizedFactors (Multiset.prod 0) = Multiset.map (↑normalize) 0
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ 0 → Irreducible a_1
ib : ∀ (b : α), b ∈ 0 → Irreducible b
⊢ normalizedFactors (Multiset.prod (a ::ₘ 0)) = Multiset.map (↑normalize) (a ::ₘ 0)
[PROOFSTEP]
rw [Multiset.cons_zero, Multiset.prod_singleton, Multiset.map_singleton, normalizedFactors_irreducible ia]
[GOAL]
case cons.inr.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s✝ : Multiset α
hs✝ : ∀ (a : α), a ∈ s✝ → Irreducible a
a : α
s : Multiset α
ih : (∀ (a : α), a ∈ s → Irreducible a) → normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ s → Irreducible a_1
ia : Irreducible a
ib : ∀ (b : α), b ∈ s → Irreducible b
b : α
hb : b ∈ s
⊢ normalizedFactors (Multiset.prod (a ::ₘ s)) = Multiset.map (↑normalize) (a ::ₘ s)
[PROOFSTEP]
haveI := nontrivial_of_ne b 0 (ib b hb).ne_zero
[GOAL]
case cons.inr.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
s✝ : Multiset α
hs✝ : ∀ (a : α), a ∈ s✝ → Irreducible a
a : α
s : Multiset α
ih : (∀ (a : α), a ∈ s → Irreducible a) → normalizedFactors (Multiset.prod s) = Multiset.map (↑normalize) s
hs : ∀ (a_1 : α), a_1 ∈ a ::ₘ s → Irreducible a_1
ia : Irreducible a
ib : ∀ (b : α), b ∈ s → Irreducible b
b : α
hb : b ∈ s
this : Nontrivial α
⊢ normalizedFactors (Multiset.prod (a ::ₘ s)) = Multiset.map (↑normalize) (a ::ₘ s)
[PROOFSTEP]
rw [Multiset.prod_cons, Multiset.map_cons,
  normalizedFactors_mul ia.ne_zero (Multiset.prod_ne_zero fun h => (ib 0 h).ne_zero rfl),
  normalizedFactors_irreducible ia, ih ib, Multiset.singleton_add]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ x ∣ y ↔ normalizedFactors x ≤ normalizedFactors y
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ x ∣ y → normalizedFactors x ≤ normalizedFactors y
[PROOFSTEP]
rintro ⟨c, rfl⟩
[GOAL]
case mp.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
c : α
hy : x * c ≠ 0
⊢ normalizedFactors x ≤ normalizedFactors (x * c)
[PROOFSTEP]
simp [hx, right_ne_zero_of_mul hy]
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ normalizedFactors x ≤ normalizedFactors y → x ∣ y
[PROOFSTEP]
rw [← (normalizedFactors_prod hx).dvd_iff_dvd_left, ← (normalizedFactors_prod hy).dvd_iff_dvd_right]
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ normalizedFactors x ≤ normalizedFactors y → Multiset.prod (normalizedFactors x) ∣ Multiset.prod (normalizedFactors y)
[PROOFSTEP]
apply Multiset.prod_dvd_prod_of_le
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ x ~ᵤ y ↔ normalizedFactors x = normalizedFactors y
[PROOFSTEP]
refine'
  ⟨fun h => _, fun h => (normalizedFactors_prod hx).symm.trans (_root_.trans (by rw [h]) (normalizedFactors_prod hy))⟩
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : normalizedFactors x = normalizedFactors y
⊢ Multiset.prod (normalizedFactors x) ~ᵤ Multiset.prod (normalizedFactors y)
[PROOFSTEP]
rw [h]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ normalizedFactors x = normalizedFactors y
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ normalizedFactors x ≤ normalizedFactors y
[PROOFSTEP]
rw [← dvd_iff_normalizedFactors_le_normalizedFactors]
[GOAL]
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ normalizedFactors y ≤ normalizedFactors x
[PROOFSTEP]
rw [← dvd_iff_normalizedFactors_le_normalizedFactors]
[GOAL]
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ∣ y
case a.hx
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ≠ 0
case a.hy
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ≠ 0
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ∣ x
case a.hx
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ≠ 0
case a.hy
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ≠ 0
[PROOFSTEP]
all_goals simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ∣ y
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a.hx
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ≠ 0
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a.hy
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ≠ 0
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ∣ x
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a.hx
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ y ≠ 0
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
case a.hy
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : x ~ᵤ y
⊢ x ≠ 0
[PROOFSTEP]
simp [*, h.dvd, h.symm.dvd]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
p : α
hp : Irreducible p
k : ℕ
⊢ normalizedFactors (p ^ k) = Multiset.replicate k (↑normalize p)
[PROOFSTEP]
rw [normalizedFactors_pow, normalizedFactors_irreducible hp, Multiset.nsmul_singleton]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
H : p ∈ normalizedFactors a
⊢ p ∣ a
[PROOFSTEP]
by_cases hcases : a = 0
[GOAL]
case pos
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
H : p ∈ normalizedFactors a
hcases : a = 0
⊢ p ∣ a
[PROOFSTEP]
rw [hcases]
[GOAL]
case pos
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
H : p ∈ normalizedFactors a
hcases : a = 0
⊢ p ∣ 0
[PROOFSTEP]
exact dvd_zero p
[GOAL]
case neg
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a p : α
H : p ∈ normalizedFactors a
hcases : ¬a = 0
⊢ p ∣ a
[PROOFSTEP]
exact dvd_trans (Multiset.dvd_prod H) (Associated.dvd (normalizedFactors_prod hcases))
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
p r : α
h : ∀ {m : α}, m ∈ normalizedFactors r → m = p
hr : r ≠ 0
⊢ ∃ i, p ^ i ~ᵤ r
[PROOFSTEP]
use Multiset.card.toFun (normalizedFactors r)
[GOAL]
case h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
p r : α
h : ∀ {m : α}, m ∈ normalizedFactors r → m = p
hr : r ≠ 0
⊢ p ^ ZeroHom.toFun (↑Multiset.card) (normalizedFactors r) ~ᵤ r
[PROOFSTEP]
have := UniqueFactorizationMonoid.normalizedFactors_prod hr
[GOAL]
case h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
p r : α
h : ∀ {m : α}, m ∈ normalizedFactors r → m = p
hr : r ≠ 0
this : Multiset.prod (normalizedFactors r) ~ᵤ r
⊢ p ^ ZeroHom.toFun (↑Multiset.card) (normalizedFactors r) ~ᵤ r
[PROOFSTEP]
rwa [Multiset.eq_replicate_of_mem fun b => h, Multiset.prod_replicate] at this
[GOAL]
α : Type u_1
inst✝⁵ : CancelCommMonoidWithZero α
inst✝⁴ : DecidableEq α
inst✝³ : NormalizationMonoid α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : Nontrivial α
inst✝ : Unique αˣ
m : Multiset α
h : ∀ (p : α), p ∈ m → Prime p
⊢ normalizedFactors (Multiset.prod m) = m
[PROOFSTEP]
simpa only [← Multiset.rel_eq, ← associated_eq_eq] using
  prime_factors_unique prime_of_normalized_factor h (normalizedFactors_prod (m.prod_ne_zero_of_prime h))
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a b c : α
ha : a ∈ normalizedFactors c
hb : b ∈ normalizedFactors c
h : a ~ᵤ b
⊢ a = b
[PROOFSTEP]
rw [← normalize_normalized_factor a ha, ← normalize_normalized_factor b hb, normalize_eq_normalize_iff]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
a b c : α
ha : a ∈ normalizedFactors c
hb : b ∈ normalizedFactors c
h : a ~ᵤ b
⊢ a ∣ b ∧ b ∣ a
[PROOFSTEP]
exact Associated.dvd_dvd h
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ 0 < normalizedFactors x ↔ ¬IsUnit x
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ 0 < normalizedFactors x → ¬IsUnit x
[PROOFSTEP]
intro h hx
[GOAL]
case mp
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx✝ : x ≠ 0
h : 0 < normalizedFactors x
hx : IsUnit x
⊢ False
[PROOFSTEP]
obtain ⟨p, hp⟩ := Multiset.exists_mem_of_ne_zero h.ne'
[GOAL]
case mp.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx✝ : x ≠ 0
h : 0 < normalizedFactors x
hx : IsUnit x
p : α
hp : p ∈ normalizedFactors x
⊢ False
[PROOFSTEP]
exact (prime_of_normalized_factor _ hp).not_unit (isUnit_of_dvd_unit (dvd_of_mem_normalizedFactors hp) hx)
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
⊢ ¬IsUnit x → 0 < normalizedFactors x
[PROOFSTEP]
intro h
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
⊢ 0 < normalizedFactors x
[PROOFSTEP]
obtain ⟨p, hp⟩ := exists_mem_normalizedFactors hx h
[GOAL]
case mpr.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx : x ≠ 0
h : ¬IsUnit x
p : α
hp : p ∈ normalizedFactors x
⊢ 0 < normalizedFactors x
[PROOFSTEP]
exact bot_lt_iff_ne_bot.mpr (mt Multiset.eq_zero_iff_forall_not_mem.mp (not_forall.mpr ⟨p, not_not.mpr hp⟩))
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ DvdNotUnit x y ↔ normalizedFactors x < normalizedFactors y
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ DvdNotUnit x y → normalizedFactors x < normalizedFactors y
[PROOFSTEP]
rintro ⟨_, c, hc, rfl⟩
[GOAL]
case mp.intro.intro.intro
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x : α
hx left✝ : x ≠ 0
c : α
hc : ¬IsUnit c
hy : x * c ≠ 0
⊢ normalizedFactors x < normalizedFactors (x * c)
[PROOFSTEP]
simp only [hx, right_ne_zero_of_mul hy, normalizedFactors_mul, Ne.def, not_false_iff, lt_add_iff_pos_right,
  normalizedFactors_pos, hc]
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
⊢ normalizedFactors x < normalizedFactors y → DvdNotUnit x y
[PROOFSTEP]
intro h
[GOAL]
case mpr
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : DecidableEq α
inst✝¹ : NormalizationMonoid α
inst✝ : UniqueFactorizationMonoid α
x y : α
hx : x ≠ 0
hy : y ≠ 0
h : normalizedFactors x < normalizedFactors y
⊢ DvdNotUnit x y
[PROOFSTEP]
exact
  dvdNotUnit_of_dvd_of_not_dvd ((dvd_iff_normalizedFactors_le_normalizedFactors hx hy).mpr h.le)
    (mt (dvd_iff_normalizedFactors_le_normalizedFactors hy hx).mp h.not_le)
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
⊢ (fun a =>
        if a = 0 then 0
        else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)))
      1 =
    1
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x y : Associates α
⊢ OneHom.toFun
      {
        toFun := fun a =>
          if a = 0 then 0
          else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
        map_one' :=
          (_ :
            (if 1 = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
              1) }
      (x * y) =
    OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        x *
      OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        y
[PROOFSTEP]
by_cases hx : x = 0
[GOAL]
case pos
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x y : Associates α
hx : x = 0
⊢ OneHom.toFun
      {
        toFun := fun a =>
          if a = 0 then 0
          else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
        map_one' :=
          (_ :
            (if 1 = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
              1) }
      (x * y) =
    OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        x *
      OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        y
[PROOFSTEP]
simp [hx]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x y : Associates α
hx : ¬x = 0
⊢ OneHom.toFun
      {
        toFun := fun a =>
          if a = 0 then 0
          else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
        map_one' :=
          (_ :
            (if 1 = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
              1) }
      (x * y) =
    OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        x *
      OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        y
[PROOFSTEP]
by_cases hy : y = 0
[GOAL]
case pos
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x y : Associates α
hx : ¬x = 0
hy : y = 0
⊢ OneHom.toFun
      {
        toFun := fun a =>
          if a = 0 then 0
          else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
        map_one' :=
          (_ :
            (if 1 = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
              1) }
      (x * y) =
    OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        x *
      OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        y
[PROOFSTEP]
simp [hy]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x y : Associates α
hx : ¬x = 0
hy : ¬y = 0
⊢ OneHom.toFun
      {
        toFun := fun a =>
          if a = 0 then 0
          else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
        map_one' :=
          (_ :
            (if 1 = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
              1) }
      (x * y) =
    OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        x *
      OneHom.toFun
        {
          toFun := fun a =>
            if a = 0 then 0
            else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
          map_one' :=
            (_ :
              (if 1 = 0 then 0
                else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                1) }
        y
[PROOFSTEP]
simp [hx, hy]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
⊢ Function.RightInverse
    (↑{
        toOneHom :=
          {
            toFun := fun a =>
              if a = 0 then 0
              else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
            map_one' :=
              (_ :
                (if 1 = 0 then 0
                  else
                    prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                  1) },
        map_mul' :=
          (_ :
            ∀ (x y : Associates α),
              OneHom.toFun
                  {
                    toFun := fun a =>
                      if a = 0 then 0
                      else
                        prod
                          (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
                    map_one' :=
                      (_ :
                        (if 1 = 0 then 0
                          else
                            prod
                              (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                (normalizedFactors 1))) =
                          1) }
                  (x * y) =
                OneHom.toFun
                    {
                      toFun := fun a =>
                        if a = 0 then 0
                        else
                          prod
                            (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
                      map_one' :=
                        (_ :
                          (if 1 = 0 then 0
                            else
                              prod
                                (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                  (normalizedFactors 1))) =
                            1) }
                    x *
                  OneHom.toFun
                    {
                      toFun := fun a =>
                        if a = 0 then 0
                        else
                          prod
                            (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
                      map_one' :=
                        (_ :
                          (if 1 = 0 then 0
                            else
                              prod
                                (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                  (normalizedFactors 1))) =
                            1) }
                    y) })
    Associates.mk
[PROOFSTEP]
intro x
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
⊢ Associates.mk
      (↑{
            toOneHom :=
              {
                toFun := fun a =>
                  if a = 0 then 0
                  else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors a)),
                map_one' :=
                  (_ :
                    (if 1 = 0 then 0
                      else
                        prod
                          (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors 1))) =
                      1) },
            map_mul' :=
              (_ :
                ∀ (x y : Associates α),
                  OneHom.toFun
                      {
                        toFun := fun a =>
                          if a = 0 then 0
                          else
                            prod
                              (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                (normalizedFactors a)),
                        map_one' :=
                          (_ :
                            (if 1 = 0 then 0
                              else
                                prod
                                  (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                    (normalizedFactors 1))) =
                              1) }
                      (x * y) =
                    OneHom.toFun
                        {
                          toFun := fun a =>
                            if a = 0 then 0
                            else
                              prod
                                (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                  (normalizedFactors a)),
                          map_one' :=
                            (_ :
                              (if 1 = 0 then 0
                                else
                                  prod
                                    (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                      (normalizedFactors 1))) =
                                1) }
                        x *
                      OneHom.toFun
                        {
                          toFun := fun a =>
                            if a = 0 then 0
                            else
                              prod
                                (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                  (normalizedFactors a)),
                          map_one' :=
                            (_ :
                              (if 1 = 0 then 0
                                else
                                  prod
                                    (map (Classical.choose (_ : Function.HasRightInverse Associates.mk))
                                      (normalizedFactors 1))) =
                                1) }
                        y) }
        x) =
    x
[PROOFSTEP]
dsimp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
⊢ Associates.mk
      (if x = 0 then 0
      else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors x))) =
    x
[PROOFSTEP]
by_cases hx : x = 0
[GOAL]
case pos
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
hx : x = 0
⊢ Associates.mk
      (if x = 0 then 0
      else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors x))) =
    x
[PROOFSTEP]
simp [hx]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
hx : ¬x = 0
⊢ Associates.mk
      (if x = 0 then 0
      else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors x))) =
    x
[PROOFSTEP]
have h : Associates.mkMonoidHom ∘ Classical.choose mk_surjective.hasRightInverse = (id : Associates α → Associates α) :=
  by
  ext x
  rw [Function.comp_apply, mkMonoidHom_apply, Classical.choose_spec mk_surjective.hasRightInverse x]
  rfl
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
hx : ¬x = 0
⊢ ↑Associates.mkMonoidHom ∘ Classical.choose (_ : Function.HasRightInverse Associates.mk) = id
[PROOFSTEP]
ext x
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x✝ : Associates α
hx : ¬x✝ = 0
x : Associates α
⊢ (↑Associates.mkMonoidHom ∘ Classical.choose (_ : Function.HasRightInverse Associates.mk)) x = id x
[PROOFSTEP]
rw [Function.comp_apply, mkMonoidHom_apply, Classical.choose_spec mk_surjective.hasRightInverse x]
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x✝ : Associates α
hx : ¬x✝ = 0
x : Associates α
⊢ x = id x
[PROOFSTEP]
rfl
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
hx : ¬x = 0
h : ↑Associates.mkMonoidHom ∘ Classical.choose (_ : Function.HasRightInverse Associates.mk) = id
⊢ Associates.mk
      (if x = 0 then 0
      else prod (map (Classical.choose (_ : Function.HasRightInverse Associates.mk)) (normalizedFactors x))) =
    x
[PROOFSTEP]
rw [if_neg hx, ← mkMonoidHom_apply, MonoidHom.map_multiset_prod, map_map, h, map_id, ← associated_iff_eq]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : Nontrivial α
inst✝ : UniqueFactorizationMonoid α
x : Associates α
hx : ¬x = 0
h : ↑Associates.mkMonoidHom ∘ Classical.choose (_ : Function.HasRightInverse Associates.mk) = id
⊢ prod (normalizedFactors x) ~ᵤ x
[PROOFSTEP]
apply normalizedFactors_prod hx
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b : R
ha : a ≠ 0
h : ∀ {d : R}, d ∣ a → d ∣ b → ¬Prime d
d : R
⊢ 0 ∣ a → 0 ∣ b → IsUnit 0
[PROOFSTEP]
simp only [zero_dvd_iff]
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b : R
ha : a ≠ 0
h : ∀ {d : R}, d ∣ a → d ∣ b → ¬Prime d
d : R
⊢ a = 0 → b = 0 → IsUnit 0
[PROOFSTEP]
intros
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b : R
ha : a ≠ 0
h : ∀ {d : R}, d ∣ a → d ∣ b → ¬Prime d
d : R
a✝¹ : a = 0
a✝ : b = 0
⊢ IsUnit 0
[PROOFSTEP]
contradiction
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
⊢ (∀ {d : R}, d ∣ a → d ∣ c → ¬Prime d) → a ∣ b * c → a ∣ b
[PROOFSTEP]
refine' induction_on_prime c _ _ _
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
⊢ (∀ {d : R}, d ∣ a → d ∣ 0 → ¬Prime d) → a ∣ b * 0 → a ∣ b
[PROOFSTEP]
intro no_factors
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
no_factors : ∀ {d : R}, d ∣ a → d ∣ 0 → ¬Prime d
⊢ a ∣ b * 0 → a ∣ b
[PROOFSTEP]
simp only [dvd_zero, mul_zero, forall_prop_of_true]
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
no_factors : ∀ {d : R}, d ∣ a → d ∣ 0 → ¬Prime d
⊢ a ∣ b
[PROOFSTEP]
haveI := Classical.propDecidable
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
no_factors : ∀ {d : R}, d ∣ a → d ∣ 0 → ¬Prime d
this : (a : Prop) → Decidable a
⊢ a ∣ b
[PROOFSTEP]
exact isUnit_iff_forall_dvd.mp (no_factors_of_no_prime_factors ha (@no_factors) (dvd_refl a) (dvd_zero a)) _
[GOAL]
case refine'_2
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
⊢ ∀ (x : R), IsUnit x → (∀ {d : R}, d ∣ a → d ∣ x → ¬Prime d) → a ∣ b * x → a ∣ b
[PROOFSTEP]
rintro _ ⟨x, rfl⟩ _ a_dvd_bx
[GOAL]
case refine'_2.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
x : Rˣ
a✝ : ∀ {d : R}, d ∣ a → d ∣ ↑x → ¬Prime d
a_dvd_bx : a ∣ b * ↑x
⊢ a ∣ b
[PROOFSTEP]
apply Units.dvd_mul_right.mp a_dvd_bx
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
⊢ ∀ (a_1 p : R),
    a_1 ≠ 0 →
      Prime p →
        ((∀ {d : R}, d ∣ a → d ∣ a_1 → ¬Prime d) → a ∣ b * a_1 → a ∣ b) →
          (∀ {d : R}, d ∣ a → d ∣ p * a_1 → ¬Prime d) → a ∣ b * (p * a_1) → a ∣ b
[PROOFSTEP]
intro c p _ hp ih no_factors a_dvd_bpc
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c✝ : R
ha : a ≠ 0
c p : R
a✝ : c ≠ 0
hp : Prime p
ih : (∀ {d : R}, d ∣ a → d ∣ c → ¬Prime d) → a ∣ b * c → a ∣ b
no_factors : ∀ {d : R}, d ∣ a → d ∣ p * c → ¬Prime d
a_dvd_bpc : a ∣ b * (p * c)
⊢ a ∣ b
[PROOFSTEP]
apply ih fun {q} dvd_a dvd_c hq => no_factors dvd_a (dvd_c.mul_left _) hq
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c✝ : R
ha : a ≠ 0
c p : R
a✝ : c ≠ 0
hp : Prime p
ih : (∀ {d : R}, d ∣ a → d ∣ c → ¬Prime d) → a ∣ b * c → a ∣ b
no_factors : ∀ {d : R}, d ∣ a → d ∣ p * c → ¬Prime d
a_dvd_bpc : a ∣ b * (p * c)
⊢ a ∣ b * c
[PROOFSTEP]
rw [mul_left_comm] at a_dvd_bpc
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c✝ : R
ha : a ≠ 0
c p : R
a✝ : c ≠ 0
hp : Prime p
ih : (∀ {d : R}, d ∣ a → d ∣ c → ¬Prime d) → a ∣ b * c → a ∣ b
no_factors : ∀ {d : R}, d ∣ a → d ∣ p * c → ¬Prime d
a_dvd_bpc : a ∣ p * (b * c)
⊢ a ∣ b * c
[PROOFSTEP]
refine' Or.resolve_left (hp.left_dvd_or_dvd_right_of_dvd_mul a_dvd_bpc) fun h => _
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c✝ : R
ha : a ≠ 0
c p : R
a✝ : c ≠ 0
hp : Prime p
ih : (∀ {d : R}, d ∣ a → d ∣ c → ¬Prime d) → a ∣ b * c → a ∣ b
no_factors : ∀ {d : R}, d ∣ a → d ∣ p * c → ¬Prime d
a_dvd_bpc : a ∣ p * (b * c)
h : p ∣ a
⊢ False
[PROOFSTEP]
exact no_factors h (dvd_mul_right p c) hp
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a b c : R
ha : a ≠ 0
no_factors : ∀ {d : R}, d ∣ a → d ∣ b → ¬Prime d
⊢ a ∣ b * c → a ∣ c
[PROOFSTEP]
simpa [mul_comm b c] using dvd_of_dvd_mul_left_of_no_prime_factors ha @no_factors
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
⊢ ∀ (a : R), a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
[PROOFSTEP]
haveI := Classical.propDecidable
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
⊢ ∀ (a : R), a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
[PROOFSTEP]
intro a
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a : R
⊢ a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
[PROOFSTEP]
refine' induction_on_prime a _ _ _
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a : R
⊢ 0 ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = 0 ∧ c' * b' = b
[PROOFSTEP]
intros
[GOAL]
case refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a : R
x✝ : 0 ≠ 0
b✝ : R
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = 0 ∧ c' * b' = b✝
[PROOFSTEP]
contradiction
[GOAL]
case refine'_2
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a : R
⊢ ∀ (x : R),
    IsUnit x → x ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = x ∧ c' * b' = b
[PROOFSTEP]
intro a a_unit _ b
[GOAL]
case refine'_2
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a : R
a_unit : IsUnit a
x✝ : a ≠ 0
b : R
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
[PROOFSTEP]
use a, b, 1
[GOAL]
case h
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a : R
a_unit : IsUnit a
x✝ : a ≠ 0
b : R
⊢ (∀ {d : R}, d ∣ a → d ∣ b → IsUnit d) ∧ 1 * a = a ∧ 1 * b = b
[PROOFSTEP]
constructor
[GOAL]
case h.left
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a : R
a_unit : IsUnit a
x✝ : a ≠ 0
b : R
⊢ ∀ {d : R}, d ∣ a → d ∣ b → IsUnit d
[PROOFSTEP]
intro p p_dvd_a _
[GOAL]
case h.left
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝¹ a : R
a_unit : IsUnit a
x✝ : a ≠ 0
b p : R
p_dvd_a : p ∣ a
a✝ : p ∣ b
⊢ IsUnit p
[PROOFSTEP]
exact isUnit_of_dvd_unit p_dvd_a a_unit
[GOAL]
case h.right
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a : R
a_unit : IsUnit a
x✝ : a ≠ 0
b : R
⊢ 1 * a = a ∧ 1 * b = b
[PROOFSTEP]
simp
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a : R
⊢ ∀ (a p : R),
    a ≠ 0 →
      Prime p →
        (a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b) →
          p * a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = b
[PROOFSTEP]
intro a p a_ne_zero p_prime ih_a pa_ne_zero b
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b : R
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = b
[PROOFSTEP]
by_cases p ∣ b
[GOAL]
case refine'_3
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b : R
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = b
[PROOFSTEP]
by_cases p ∣ b
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b : R
h : p ∣ b
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = b
[PROOFSTEP]
rcases h with ⟨b, rfl⟩
[GOAL]
case pos.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b : R
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = p * b
[PROOFSTEP]
obtain ⟨a', b', c', no_factor, ha', hb'⟩ := ih_a a_ne_zero b
[GOAL]
case pos.intro.intro.intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b a' b' c' : R
no_factor : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
ha' : c' * a' = a
hb' : c' * b' = b
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = p * b
[PROOFSTEP]
refine' ⟨a', b', p * c', @no_factor, _, _⟩
[GOAL]
case pos.intro.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b a' b' c' : R
no_factor : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
ha' : c' * a' = a
hb' : c' * b' = b
⊢ p * c' * a' = p * a
[PROOFSTEP]
rw [mul_assoc, ha']
[GOAL]
case pos.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b a' b' c' : R
no_factor : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
ha' : c' * a' = a
hb' : c' * b' = b
⊢ p * c' * b' = p * b
[PROOFSTEP]
rw [mul_assoc, hb']
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a✝ a p : R
a_ne_zero : a ≠ 0
p_prime : Prime p
ih_a : a ≠ 0 → ∀ (b : R), ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = a ∧ c' * b' = b
pa_ne_zero : p * a ≠ 0
b : R
h : ¬p ∣ b
⊢ ∃ a' b' c', (∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d) ∧ c' * a' = p * a ∧ c' * b' = b
[PROOFSTEP]
obtain ⟨a', b', c', coprime, rfl, rfl⟩ := ih_a a_ne_zero b
[GOAL]
case neg.intro.intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
⊢ ∃ a'_1 b'_1 c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b'_1 → IsUnit d) ∧ c'_1 * a'_1 = p * (c' * a') ∧ c'_1 * b'_1 = c' * b'
[PROOFSTEP]
refine' ⟨p * a', b', c', _, mul_left_comm _ _ _, rfl⟩
[GOAL]
case neg.intro.intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
⊢ ∀ {d : R}, d ∣ p * a' → d ∣ b' → IsUnit d
[PROOFSTEP]
intro q q_dvd_pa' q_dvd_b'
[GOAL]
case neg.intro.intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
q : R
q_dvd_pa' : q ∣ p * a'
q_dvd_b' : q ∣ b'
⊢ IsUnit q
[PROOFSTEP]
cases' p_prime.left_dvd_or_dvd_right_of_dvd_mul q_dvd_pa' with p_dvd_q q_dvd_a'
[GOAL]
case neg.intro.intro.intro.intro.intro.inl
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
q : R
q_dvd_pa' : q ∣ p * a'
q_dvd_b' : q ∣ b'
p_dvd_q : p ∣ q
⊢ IsUnit q
[PROOFSTEP]
have : p ∣ c' * b' := dvd_mul_of_dvd_right (p_dvd_q.trans q_dvd_b') _
[GOAL]
case neg.intro.intro.intro.intro.intro.inl
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this✝ : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
q : R
q_dvd_pa' : q ∣ p * a'
q_dvd_b' : q ∣ b'
p_dvd_q : p ∣ q
this : p ∣ c' * b'
⊢ IsUnit q
[PROOFSTEP]
contradiction
[GOAL]
case neg.intro.intro.intro.intro.intro.inr
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
this : (a : Prop) → Decidable a
a p : R
p_prime : Prime p
a' b' c' : R
coprime : ∀ {d : R}, d ∣ a' → d ∣ b' → IsUnit d
a_ne_zero : c' * a' ≠ 0
ih_a :
  c' * a' ≠ 0 →
    ∀ (b : R), ∃ a'_1 b' c'_1, (∀ {d : R}, d ∣ a'_1 → d ∣ b' → IsUnit d) ∧ c'_1 * a'_1 = c' * a' ∧ c'_1 * b' = b
pa_ne_zero : p * (c' * a') ≠ 0
h : ¬p ∣ c' * b'
q : R
q_dvd_pa' : q ∣ p * a'
q_dvd_b' : q ∣ b'
q_dvd_a' : q ∣ a'
⊢ IsUnit q
[PROOFSTEP]
exact coprime q_dvd_a' q_dvd_b'
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
⊢ Function.Injective ((fun x x_1 => x ^ x_1) a)
[PROOFSTEP]
letI := Classical.decEq R
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this : DecidableEq R := Classical.decEq R
⊢ Function.Injective ((fun x x_1 => x ^ x_1) a)
[PROOFSTEP]
intro i j hij
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
⊢ i = j
[PROOFSTEP]
letI : Nontrivial R := ⟨⟨a, 0, ha0⟩⟩
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝ : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
⊢ i = j
[PROOFSTEP]
letI : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
[GOAL]
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝¹ : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this✝ : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
this : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
⊢ i = j
[PROOFSTEP]
obtain ⟨p', hp', dvd'⟩ := WfDvdMonoid.exists_irreducible_factor ha1 ha0
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝¹ : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this✝ : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
this : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
p' : R
hp' : Irreducible p'
dvd' : p' ∣ a
⊢ i = j
[PROOFSTEP]
obtain ⟨p, mem, _⟩ := exists_mem_normalizedFactors_of_dvd ha0 hp' dvd'
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝¹ : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this✝ : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
this : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
p' : R
hp' : Irreducible p'
dvd' : p' ∣ a
p : R
mem : p ∈ normalizedFactors a
right✝ : p' ~ᵤ p
⊢ i = j
[PROOFSTEP]
have := congr_arg (fun x => Multiset.count p (normalizedFactors x)) hij
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝² : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this✝¹ : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
this✝ : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
p' : R
hp' : Irreducible p'
dvd' : p' ∣ a
p : R
mem : p ∈ normalizedFactors a
right✝ : p' ~ᵤ p
this :
  (fun x => Multiset.count p (normalizedFactors x)) ((fun x x_1 => x ^ x_1) a i) =
    (fun x => Multiset.count p (normalizedFactors x)) ((fun x x_1 => x ^ x_1) a j)
⊢ i = j
[PROOFSTEP]
simp only [normalizedFactors_pow, Multiset.count_nsmul] at this
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝¹ : CancelCommMonoidWithZero R
inst✝ : UniqueFactorizationMonoid R
a : R
ha0 : a ≠ 0
ha1 : ¬IsUnit a
this✝² : DecidableEq R := Classical.decEq R
i j : ℕ
hij : (fun x x_1 => x ^ x_1) a i = (fun x x_1 => x ^ x_1) a j
this✝¹ : Nontrivial R := { exists_pair_ne := Exists.intro a (Exists.intro 0 ha0) }
this✝ : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
p' : R
hp' : Irreducible p'
dvd' : p' ∣ a
p : R
mem : p ∈ normalizedFactors a
right✝ : p' ~ᵤ p
this : i * Multiset.count p (normalizedFactors a) = j * Multiset.count p (normalizedFactors a)
⊢ i = j
[PROOFSTEP]
exact mul_right_cancel₀ (Multiset.count_ne_zero.mpr mem) this
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
n : ℕ
ha : Irreducible a
hb : b ≠ 0
⊢ ↑n ≤ multiplicity a b ↔ replicate n (↑normalize a) ≤ normalizedFactors b
[PROOFSTEP]
rw [← pow_dvd_iff_le_multiplicity]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
n : ℕ
ha : Irreducible a
hb : b ≠ 0
⊢ a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b
[PROOFSTEP]
revert b
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
n : ℕ
ha : Irreducible a
⊢ ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
⊢ ∀ {b : R}, b ≠ 0 → (a ^ Nat.zero ∣ b ↔ replicate Nat.zero (↑normalize a) ≤ normalizedFactors b)
[PROOFSTEP]
simp
[GOAL]
case succ
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
⊢ ∀ {b : R}, b ≠ 0 → (a ^ Nat.succ n ∣ b ↔ replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors b)
[PROOFSTEP]
intro b hb
[GOAL]
case succ
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
⊢ a ^ Nat.succ n ∣ b ↔ replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors b
[PROOFSTEP]
constructor
[GOAL]
case succ.mp
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
⊢ a ^ Nat.succ n ∣ b → replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors b
[PROOFSTEP]
rintro ⟨c, rfl⟩
[GOAL]
case succ.mp.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
c : R
hb : a ^ Nat.succ n * c ≠ 0
⊢ replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors (a ^ Nat.succ n * c)
[PROOFSTEP]
rw [Ne.def, pow_succ, mul_assoc, mul_eq_zero, not_or] at hb
[GOAL]
case succ.mp.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
c : R
hb : ¬a = 0 ∧ ¬a ^ n * c = 0
⊢ replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors (a ^ Nat.succ n * c)
[PROOFSTEP]
rw [pow_succ, mul_assoc, normalizedFactors_mul hb.1 hb.2, replicate_succ, normalizedFactors_irreducible ha,
  singleton_add, cons_le_cons_iff, ← ih hb.2]
[GOAL]
case succ.mp.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
c : R
hb : ¬a = 0 ∧ ¬a ^ n * c = 0
⊢ a ^ n ∣ a ^ n * c
[PROOFSTEP]
apply Dvd.intro _ rfl
[GOAL]
case succ.mpr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
⊢ replicate (Nat.succ n) (↑normalize a) ≤ normalizedFactors b → a ^ Nat.succ n ∣ b
[PROOFSTEP]
rw [Multiset.le_iff_exists_add]
[GOAL]
case succ.mpr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
⊢ (∃ u, normalizedFactors b = replicate (Nat.succ n) (↑normalize a) + u) → a ^ Nat.succ n ∣ b
[PROOFSTEP]
rintro ⟨u, hu⟩
[GOAL]
case succ.mpr.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
u : Multiset ((fun x => R) a)
hu : normalizedFactors b = replicate (Nat.succ n) (↑normalize a) + u
⊢ a ^ Nat.succ n ∣ b
[PROOFSTEP]
rw [← (normalizedFactors_prod hb).dvd_iff_dvd_right, hu, prod_add, prod_replicate]
[GOAL]
case succ.mpr.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a : R
ha : Irreducible a
n : ℕ
ih : ∀ {b : R}, b ≠ 0 → (a ^ n ∣ b ↔ replicate n (↑normalize a) ≤ normalizedFactors b)
b : R
hb : b ≠ 0
u : Multiset ((fun x => R) a)
hu : normalizedFactors b = replicate (Nat.succ n) (↑normalize a) + u
⊢ a ^ Nat.succ n ∣ ↑normalize a ^ Nat.succ n * prod u
[PROOFSTEP]
exact (Associated.pow_pow <| associated_normalize a).dvd.trans (Dvd.intro u.prod rfl)
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
ha : Irreducible a
hb : b ≠ 0
⊢ multiplicity a b = ↑(count (↑normalize a) (normalizedFactors b))
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
ha : Irreducible a
hb : b ≠ 0
⊢ multiplicity a b ≤ ↑(count (↑normalize a) (normalizedFactors b))
[PROOFSTEP]
apply PartENat.le_of_lt_add_one
[GOAL]
case a.h
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
ha : Irreducible a
hb : b ≠ 0
⊢ multiplicity a b < ↑(count (↑normalize a) (normalizedFactors b)) + 1
[PROOFSTEP]
rw [← Nat.cast_one, ← Nat.cast_add, lt_iff_not_ge, ge_iff_le, le_multiplicity_iff_replicate_le_normalizedFactors ha hb,
  ← le_count_iff_replicate_le]
[GOAL]
case a.h
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
ha : Irreducible a
hb : b ≠ 0
⊢ ¬count (↑normalize a) (normalizedFactors b) + 1 ≤ count (↑normalize a) (normalizedFactors b)
[PROOFSTEP]
simp
[GOAL]
case a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
a b : R
ha : Irreducible a
hb : b ≠ 0
⊢ ↑(count (↑normalize a) (normalizedFactors b)) ≤ multiplicity a b
[PROOFSTEP]
rw [le_multiplicity_iff_replicate_le_normalizedFactors ha hb, ← le_count_iff_replicate_le]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
letI : DecidableRel ((· ∣ ·) : R → R → Prop) := fun _ _ => Classical.propDecidable _
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
by_cases hx0 : x = 0
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : x = 0
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
simp [hx0] at hlt
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
rw [← PartENat.natCast_inj]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ ↑(count p (normalizedFactors x)) = ↑n
[PROOFSTEP]
convert (multiplicity_eq_count_normalizedFactors hp hx0).symm
[GOAL]
case h.e'_2.h.e'_3.h.e'_3
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ p = ↑normalize p
[PROOFSTEP]
exact hnorm.symm
[GOAL]
case h.e'_3
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
this : DecidableRel fun x x_1 => x ∣ x_1 := fun x x_1 => Classical.propDecidable ((fun x x_2 => x ∣ x_2) x x_1)
hx0 : ¬x = 0
⊢ ↑n = multiplicity p x
[PROOFSTEP]
exact (multiplicity.eq_coe_iff.mpr ⟨hle, hlt⟩).symm
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hp : p = 0 ∨ Irreducible p
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
rcases hp with (rfl | hp)
[GOAL]
case inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
x : R
n : ℕ
hnorm : ↑normalize 0 = 0
hle : 0 ^ n ∣ x
hlt : ¬0 ^ (n + 1) ∣ x
⊢ count 0 (normalizedFactors x) = n
[PROOFSTEP]
cases n
[GOAL]
case inl.zero
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
x : R
hnorm : ↑normalize 0 = 0
hle : 0 ^ Nat.zero ∣ x
hlt : ¬0 ^ (Nat.zero + 1) ∣ x
⊢ count 0 (normalizedFactors x) = Nat.zero
[PROOFSTEP]
exact count_eq_zero.2 (zero_not_mem_normalizedFactors _)
[GOAL]
case inl.succ
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
x : R
hnorm : ↑normalize 0 = 0
n✝ : ℕ
hle : 0 ^ Nat.succ n✝ ∣ x
hlt : ¬0 ^ (Nat.succ n✝ + 1) ∣ x
⊢ count 0 (normalizedFactors x) = Nat.succ n✝
[PROOFSTEP]
rw [zero_pow (Nat.succ_pos _)] at hle hlt
[GOAL]
case inl.succ
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
x : R
hnorm : ↑normalize 0 = 0
n✝ : ℕ
hle : 0 ∣ x
hlt : ¬0 ∣ x
⊢ count 0 (normalizedFactors x) = Nat.succ n✝
[PROOFSTEP]
exact absurd hle hlt
[GOAL]
case inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : Nontrivial R
inst✝¹ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
inst✝ : DecidableEq R
p x : R
hnorm : ↑normalize p = p
n : ℕ
hle : p ^ n ∣ x
hlt : ¬p ^ (n + 1) ∣ x
hp : Irreducible p
⊢ count p (normalizedFactors x) = n
[PROOFSTEP]
exact count_normalizedFactors_eq hp hnorm hle hlt
[GOAL]
α : Type u_1
R : Type u_2
inst✝³ : CancelCommMonoidWithZero R
inst✝² : UniqueFactorizationMonoid R
inst✝¹ : Nontrivial R
inst✝ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
a₀ x : R
h : a₀ ≠ 0
hx : Irreducible x
⊢ ∃ n a, ¬x ∣ a ∧ a₀ = x ^ n * a
[PROOFSTEP]
classical
let n := (normalizedFactors a₀).count (normalize x)
obtain ⟨a, ha1, ha2⟩ :=
  @exists_eq_pow_mul_and_not_dvd R _ _ x a₀
    (ne_top_iff_finite.mp (PartENat.ne_top_iff.mpr ⟨n, multiplicity_eq_count_normalizedFactors hx h⟩))
simp_rw [← (multiplicity_eq_count_normalizedFactors hx h).symm] at ha1
use n, a, ha2, ha1
[GOAL]
α : Type u_1
R : Type u_2
inst✝³ : CancelCommMonoidWithZero R
inst✝² : UniqueFactorizationMonoid R
inst✝¹ : Nontrivial R
inst✝ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
a₀ x : R
h : a₀ ≠ 0
hx : Irreducible x
⊢ ∃ n a, ¬x ∣ a ∧ a₀ = x ^ n * a
[PROOFSTEP]
let n := (normalizedFactors a₀).count (normalize x)
[GOAL]
α : Type u_1
R : Type u_2
inst✝³ : CancelCommMonoidWithZero R
inst✝² : UniqueFactorizationMonoid R
inst✝¹ : Nontrivial R
inst✝ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
a₀ x : R
h : a₀ ≠ 0
hx : Irreducible x
n : ℕ := count (↑normalize x) (normalizedFactors a₀)
⊢ ∃ n a, ¬x ∣ a ∧ a₀ = x ^ n * a
[PROOFSTEP]
obtain ⟨a, ha1, ha2⟩ :=
  @exists_eq_pow_mul_and_not_dvd R _ _ x a₀
    (ne_top_iff_finite.mp (PartENat.ne_top_iff.mpr ⟨n, multiplicity_eq_count_normalizedFactors hx h⟩))
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝³ : CancelCommMonoidWithZero R
inst✝² : UniqueFactorizationMonoid R
inst✝¹ : Nontrivial R
inst✝ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
a₀ x : R
h : a₀ ≠ 0
hx : Irreducible x
n : ℕ := count (↑normalize x) (normalizedFactors a₀)
a : R
ha1 : a₀ = x ^ Part.get (multiplicity x a₀) (_ : multiplicity.Finite x a₀) * a
ha2 : ¬x ∣ a
⊢ ∃ n a, ¬x ∣ a ∧ a₀ = x ^ n * a
[PROOFSTEP]
simp_rw [← (multiplicity_eq_count_normalizedFactors hx h).symm] at ha1
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝³ : CancelCommMonoidWithZero R
inst✝² : UniqueFactorizationMonoid R
inst✝¹ : Nontrivial R
inst✝ : NormalizationMonoid R
dec_dvd : DecidableRel Dvd.dvd
a₀ x : R
h : a₀ ≠ 0
hx : Irreducible x
n : ℕ := count (↑normalize x) (normalizedFactors a₀)
a : R
ha2 : ¬x ∣ a
ha1 :
  a₀ =
    x ^
        Part.get ↑(count (↑normalize x) (normalizedFactors a₀))
          (_ : (↑(count (↑normalize x) (normalizedFactors a₀))).Dom) *
      a
⊢ ∃ n a, ¬x ∣ a ∧ a₀ = x ^ n * a
[PROOFSTEP]
use n, a, ha2, ha1
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
⊢ ∀ (q : α), q ∣ p ^ i p → q ∣ ∏ p' in s, p' ^ i p' → IsUnit q
[PROOFSTEP]
have hp := is_prime _ (Finset.mem_insert_self _ _)
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
⊢ ∀ (q : α), q ∣ p ^ i p → q ∣ ∏ p' in s, p' ^ i p' → IsUnit q
[PROOFSTEP]
refine' fun _ => no_factors_of_no_prime_factors (pow_ne_zero _ hp.ne_zero) _
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ : α
⊢ ∀ {d : α}, d ∣ p ^ i p → d ∣ ∏ p' in s, p' ^ i p' → ¬Prime d
[PROOFSTEP]
intro d hdp hdprod hd
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdp : d ∣ p ^ i p
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
⊢ False
[PROOFSTEP]
apply hps
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdp : d ∣ p ^ i p
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
⊢ p ∈ s
[PROOFSTEP]
replace hdp := hd.dvd_of_dvd_pow hdp
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
⊢ p ∈ s
[PROOFSTEP]
obtain ⟨q, q_mem', hdq⟩ := hd.exists_mem_multiset_dvd hdprod
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
q : α
q_mem' : q ∈ Multiset.map (fun p' => p' ^ i p') s.val
hdq : d ∣ q
⊢ p ∈ s
[PROOFSTEP]
obtain ⟨q, q_mem, rfl⟩ := Multiset.mem_map.mp q_mem'
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
q : α
q_mem : q ∈ s.val
q_mem' : q ^ i q ∈ Multiset.map (fun p' => p' ^ i p') s.val
hdq : d ∣ q ^ i q
⊢ p ∈ s
[PROOFSTEP]
replace hdq := hd.dvd_of_dvd_pow hdq
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
q : α
q_mem : q ∈ s.val
q_mem' : q ^ i q ∈ Multiset.map (fun p' => p' ^ i p') s.val
hdq : d ∣ q
⊢ p ∈ s
[PROOFSTEP]
have : p ∣ q := dvd_trans (hd.irreducible.dvd_symm hp.irreducible hdp) hdq
[GOAL]
case intro.intro.intro.intro
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
q : α
q_mem : q ∈ s.val
q_mem' : q ^ i q ∈ Multiset.map (fun p' => p' ^ i p') s.val
hdq : d ∣ q
this : p ∣ q
⊢ p ∈ s
[PROOFSTEP]
convert q_mem
[GOAL]
case a
α : Type u_1
R : Type u_2
inst✝⁵ : CancelCommMonoidWithZero R
inst✝⁴ : UniqueFactorizationMonoid R
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
β : Type u_3
inst✝¹ : CancelCommMonoidWithZero β
inst✝ : DecidableEq α
s : Finset α
i : α → ℕ
p : α
hps : ¬p ∈ s
is_prime : ∀ (q : α), q ∈ insert p s → Prime q
is_coprime : ∀ (q : α), q ∈ insert p s → ∀ (q' : α), q' ∈ insert p s → q ∣ q' → q = q'
hp : Prime p
x✝ d : α
hdprod : d ∣ ∏ p' in s, p' ^ i p'
hd : Prime d
hdp : d ∣ p
q : α
q_mem : q ∈ s.val
q_mem' : q ^ i q ∈ Multiset.map (fun p' => p' ^ i p') s.val
hdq : d ∣ q
this : p ∣ q
⊢ p ∈ s ↔ q ∈ s.val
[PROOFSTEP]
rw [Finset.mem_val, is_coprime _ (Finset.mem_insert_self p s) _ (Finset.mem_insert_of_mem q_mem) this]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
s : Finset α
i : α → ℕ
is_prime : ∀ (p : α), p ∈ s → Prime p
is_coprime : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
⊢ P (∏ p in s, p ^ i p)
[PROOFSTEP]
letI := Classical.decEq α
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
s : Finset α
i : α → ℕ
is_prime : ∀ (p : α), p ∈ s → Prime p
is_coprime : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
⊢ P (∏ p in s, p ^ i p)
[PROOFSTEP]
induction' s using Finset.induction_on with p f' hpf' ih
[GOAL]
case empty
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
s : Finset α
i : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
is_prime : ∀ (p : α), p ∈ ∅ → Prime p
is_coprime : ∀ (p : α), p ∈ ∅ → ∀ (q : α), q ∈ ∅ → p ∣ q → p = q
⊢ P (∏ p in ∅, p ^ i p)
[PROOFSTEP]
simpa using h1 isUnit_one
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
s : Finset α
i : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
p : α
f' : Finset α
hpf' : ¬p ∈ f'
ih : (∀ (p : α), p ∈ f' → Prime p) → (∀ (p : α), p ∈ f' → ∀ (q : α), q ∈ f' → p ∣ q → p = q) → P (∏ p in f', p ^ i p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p f' → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p f' → ∀ (q : α), q ∈ insert p f' → p_1 ∣ q → p_1 = q
⊢ P (∏ p in insert p f', p ^ i p)
[PROOFSTEP]
rw [Finset.prod_insert hpf']
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
s : Finset α
i : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
p : α
f' : Finset α
hpf' : ¬p ∈ f'
ih : (∀ (p : α), p ∈ f' → Prime p) → (∀ (p : α), p ∈ f' → ∀ (q : α), q ∈ f' → p ∣ q → p = q) → P (∏ p in f', p ^ i p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p f' → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p f' → ∀ (q : α), q ∈ insert p f' → p_1 ∣ q → p_1 = q
⊢ P (p ^ i p * ∏ x in f', x ^ i x)
[PROOFSTEP]
exact
  hcp (prime_pow_coprime_prod_of_coprime_insert i p hpf' is_prime is_coprime)
    (hpr (i p) (is_prime _ (Finset.mem_insert_self _ _)))
    (ih (fun q hq => is_prime _ (Finset.mem_insert_of_mem hq)) fun q hq q' hq' =>
      is_coprime _ (Finset.mem_insert_of_mem hq) _ (Finset.mem_insert_of_mem hq'))
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
⊢ P a
[PROOFSTEP]
letI := Classical.decEq α
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
⊢ P a
[PROOFSTEP]
have P_of_associated : ∀ {x y}, Associated x y → P x → P y :=
  by
  rintro x y ⟨u, rfl⟩ hx
  exact hcp (fun p _ hpx => isUnit_of_dvd_unit hpx u.isUnit) hx (h1 u.isUnit)
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
⊢ ∀ {x y : α}, x ~ᵤ y → P x → P y
[PROOFSTEP]
rintro x y ⟨u, rfl⟩ hx
[GOAL]
case intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
x : α
u : αˣ
hx : P x
⊢ P (x * ↑u)
[PROOFSTEP]
exact hcp (fun p _ hpx => isUnit_of_dvd_unit hpx u.isUnit) hx (h1 u.isUnit)
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
⊢ P a
[PROOFSTEP]
by_cases ha0 : a = 0
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : a = 0
⊢ P a
[PROOFSTEP]
rwa [ha0]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
⊢ P a
[PROOFSTEP]
haveI : Nontrivial α := ⟨⟨_, _, ha0⟩⟩
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this : Nontrivial α
⊢ P a
[PROOFSTEP]
letI : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ P a
[PROOFSTEP]
refine' P_of_associated (normalizedFactors_prod ha0) _
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ P (Multiset.prod (normalizedFactors a))
[PROOFSTEP]
rw [← (normalizedFactors a).map_id, Finset.prod_multiset_map_count]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ P (∏ m in Multiset.toFinset (normalizedFactors a), id m ^ Multiset.count m (normalizedFactors a))
[PROOFSTEP]
refine' induction_on_prime_power _ _ _ _ @h1 @hpr @hcp
[GOAL]
case neg.refine'_1
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ Multiset.toFinset (normalizedFactors a) → Prime p
[PROOFSTEP]
simp only [Multiset.mem_toFinset]
[GOAL]
case neg.refine'_2
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α),
    p ∈ Multiset.toFinset (normalizedFactors a) → ∀ (q : α), q ∈ Multiset.toFinset (normalizedFactors a) → p ∣ q → p = q
[PROOFSTEP]
simp only [Multiset.mem_toFinset]
[GOAL]
case neg.refine'_1
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ normalizedFactors a → Prime p
[PROOFSTEP]
apply prime_of_normalized_factor
[GOAL]
case neg.refine'_2
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
P : α → Prop
a : α
h0 : P 0
h1 : ∀ {x : α}, IsUnit x → P x
hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i)
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → P x → P y → P (x * y)
this✝¹ : DecidableEq α := Classical.decEq α
P_of_associated : ∀ {x y : α}, x ~ᵤ y → P x → P y
ha0 : ¬a = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ normalizedFactors a → ∀ (q : α), q ∈ normalizedFactors a → p ∣ q → p = q
[PROOFSTEP]
apply normalizedFactors_eq_of_dvd
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s : Finset α
i j : α → ℕ
is_prime : ∀ (p : α), p ∈ s → Prime p
is_coprime : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
⊢ f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
[PROOFSTEP]
letI := Classical.decEq α
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s : Finset α
i j : α → ℕ
is_prime : ∀ (p : α), p ∈ s → Prime p
is_coprime : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
⊢ f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
[PROOFSTEP]
induction' s using Finset.induction_on with p s hps ih
[GOAL]
case empty
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
is_prime : ∀ (p : α), p ∈ ∅ → Prime p
is_coprime : ∀ (p : α), p ∈ ∅ → ∀ (q : α), q ∈ ∅ → p ∣ q → p = q
⊢ f (∏ p in ∅, p ^ (i p + j p)) = f (∏ p in ∅, p ^ i p) * f (∏ p in ∅, p ^ j p)
[PROOFSTEP]
simpa using h1 isUnit_one
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s✝ : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s✝ → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s✝ → ∀ (q : α), q ∈ s✝ → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
p : α
s : Finset α
hps : ¬p ∈ s
ih :
  (∀ (p : α), p ∈ s → Prime p) →
    (∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q) →
      f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p s → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p s → ∀ (q : α), q ∈ insert p s → p_1 ∣ q → p_1 = q
⊢ f (∏ p in insert p s, p ^ (i p + j p)) = f (∏ p in insert p s, p ^ i p) * f (∏ p in insert p s, p ^ j p)
[PROOFSTEP]
have hpr_p := is_prime _ (Finset.mem_insert_self _ _)
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s✝ : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s✝ → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s✝ → ∀ (q : α), q ∈ s✝ → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
p : α
s : Finset α
hps : ¬p ∈ s
ih :
  (∀ (p : α), p ∈ s → Prime p) →
    (∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q) →
      f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p s → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p s → ∀ (q : α), q ∈ insert p s → p_1 ∣ q → p_1 = q
hpr_p : Prime p
⊢ f (∏ p in insert p s, p ^ (i p + j p)) = f (∏ p in insert p s, p ^ i p) * f (∏ p in insert p s, p ^ j p)
[PROOFSTEP]
have hpr_s : ∀ p ∈ s, Prime p := fun p hp => is_prime _ (Finset.mem_insert_of_mem hp)
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s✝ : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s✝ → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s✝ → ∀ (q : α), q ∈ s✝ → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
p : α
s : Finset α
hps : ¬p ∈ s
ih :
  (∀ (p : α), p ∈ s → Prime p) →
    (∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q) →
      f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p s → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p s → ∀ (q : α), q ∈ insert p s → p_1 ∣ q → p_1 = q
hpr_p : Prime p
hpr_s : ∀ (p : α), p ∈ s → Prime p
⊢ f (∏ p in insert p s, p ^ (i p + j p)) = f (∏ p in insert p s, p ^ i p) * f (∏ p in insert p s, p ^ j p)
[PROOFSTEP]
have hcp_p := fun i => prime_pow_coprime_prod_of_coprime_insert i p hps is_prime is_coprime
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s✝ : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s✝ → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s✝ → ∀ (q : α), q ∈ s✝ → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
p : α
s : Finset α
hps : ¬p ∈ s
ih :
  (∀ (p : α), p ∈ s → Prime p) →
    (∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q) →
      f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p s → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p s → ∀ (q : α), q ∈ insert p s → p_1 ∣ q → p_1 = q
hpr_p : Prime p
hpr_s : ∀ (p : α), p ∈ s → Prime p
hcp_p : ∀ (i : α → ℕ) (q : α), q ∣ p ^ i p → q ∣ ∏ p' in s, p' ^ i p' → IsUnit q
⊢ f (∏ p in insert p s, p ^ (i p + j p)) = f (∏ p in insert p s, p ^ i p) * f (∏ p in insert p s, p ^ j p)
[PROOFSTEP]
have hcp_s : ∀ (p) (_ : p ∈ s) (q) (_ : q ∈ s), p ∣ q → p = q := fun p hp q hq =>
  is_coprime p (Finset.mem_insert_of_mem hp) q (Finset.mem_insert_of_mem hq)
[GOAL]
case insert
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
s✝ : Finset α
i j : α → ℕ
is_prime✝ : ∀ (p : α), p ∈ s✝ → Prime p
is_coprime✝ : ∀ (p : α), p ∈ s✝ → ∀ (q : α), q ∈ s✝ → p ∣ q → p = q
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
p : α
s : Finset α
hps : ¬p ∈ s
ih :
  (∀ (p : α), p ∈ s → Prime p) →
    (∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q) →
      f (∏ p in s, p ^ (i p + j p)) = f (∏ p in s, p ^ i p) * f (∏ p in s, p ^ j p)
is_prime : ∀ (p_1 : α), p_1 ∈ insert p s → Prime p_1
is_coprime : ∀ (p_1 : α), p_1 ∈ insert p s → ∀ (q : α), q ∈ insert p s → p_1 ∣ q → p_1 = q
hpr_p : Prime p
hpr_s : ∀ (p : α), p ∈ s → Prime p
hcp_p : ∀ (i : α → ℕ) (q : α), q ∣ p ^ i p → q ∣ ∏ p' in s, p' ^ i p' → IsUnit q
hcp_s : ∀ (p : α), p ∈ s → ∀ (q : α), q ∈ s → p ∣ q → p = q
⊢ f (∏ p in insert p s, p ^ (i p + j p)) = f (∏ p in insert p s, p ^ i p) * f (∏ p in insert p s, p ^ j p)
[PROOFSTEP]
rw [Finset.prod_insert hps, Finset.prod_insert hps, Finset.prod_insert hps, hcp (hcp_p _), hpr _ hpr_p, hcp (hcp_p _),
  hpr _ hpr_p, hcp (hcp_p (fun p => i p + j p)), hpr _ hpr_p, ih hpr_s hcp_s, pow_add, mul_assoc,
  mul_left_comm (f p ^ j p), mul_assoc]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
⊢ f (a * b) = f a * f b
[PROOFSTEP]
letI := Classical.decEq α
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
⊢ f (a * b) = f a * f b
[PROOFSTEP]
by_cases ha0 : a = 0
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : a = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
rw [ha0, zero_mul, h0, zero_mul]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
by_cases hb0 : b = 0
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : b = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
rw [hb0, mul_zero, h0, mul_zero]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
by_cases hf1 : f 1 = 0
[GOAL]
case pos
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : f 1 = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
calc
  f (a * b) = f (a * b * 1) := by rw [mul_one]
  _ = 0 := by simp only [h1 isUnit_one, hf1, mul_zero]
  _ = f a * f (b * 1) := by simp only [h1 isUnit_one, hf1, mul_zero]
  _ = f a * f b := by rw [mul_one]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : f 1 = 0
⊢ f (a * b) = f (a * b * 1)
[PROOFSTEP]
rw [mul_one]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : f 1 = 0
⊢ f (a * b * 1) = 0
[PROOFSTEP]
simp only [h1 isUnit_one, hf1, mul_zero]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : f 1 = 0
⊢ 0 = f a * f (b * 1)
[PROOFSTEP]
simp only [h1 isUnit_one, hf1, mul_zero]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : f 1 = 0
⊢ f a * f (b * 1) = f a * f b
[PROOFSTEP]
rw [mul_one]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
⊢ f (a * b) = f a * f b
[PROOFSTEP]
haveI : Nontrivial α := ⟨⟨_, _, ha0⟩⟩
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this : Nontrivial α
⊢ f (a * b) = f a * f b
[PROOFSTEP]
letI : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ f (a * b) = f a * f b
[PROOFSTEP]
suffices
  f
      (∏ p in (normalizedFactors a).toFinset ∪ (normalizedFactors b).toFinset,
        p ^ ((normalizedFactors a).count p + (normalizedFactors b).count p)) =
    f (∏ p in (normalizedFactors a).toFinset ∪ (normalizedFactors b).toFinset, p ^ (normalizedFactors a).count p) *
      f (∏ p : α in (normalizedFactors a).toFinset ∪ (normalizedFactors b).toFinset, p ^ (normalizedFactors b).count p)
  by
  obtain ⟨ua, a_eq⟩ := normalizedFactors_prod ha0
  obtain ⟨ub, b_eq⟩ := normalizedFactors_prod hb0
  rw [← a_eq, ← b_eq,
    mul_right_comm (Multiset.prod (normalizedFactors a)) ua (Multiset.prod (normalizedFactors b) * ub), h1 ua.isUnit,
    h1 ub.isUnit, h1 ua.isUnit, ← mul_assoc, h1 ub.isUnit, mul_right_comm _ (f ua), ← mul_assoc]
  congr
  rw [← (normalizedFactors a).map_id, ← (normalizedFactors b).map_id, Finset.prod_multiset_map_count,
    Finset.prod_multiset_map_count, Finset.prod_subset (Finset.subset_union_left _ (normalizedFactors b).toFinset),
    Finset.prod_subset (Finset.subset_union_right _ (normalizedFactors b).toFinset), ← Finset.prod_mul_distrib]
  simp_rw [id.def, ← pow_add, this]
  all_goals simp only [Multiset.mem_toFinset]
  · intro p _ hpb
    simp [hpb]
  · intro p _ hpa
    simp [hpa]
[GOAL]
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
⊢ f (a * b) = f a * f b
[PROOFSTEP]
obtain ⟨ua, a_eq⟩ := normalizedFactors_prod ha0
[GOAL]
case intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
⊢ f (a * b) = f a * f b
[PROOFSTEP]
obtain ⟨ub, b_eq⟩ := normalizedFactors_prod hb0
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ f (a * b) = f a * f b
[PROOFSTEP]
rw [← a_eq, ← b_eq, mul_right_comm (Multiset.prod (normalizedFactors a)) ua (Multiset.prod (normalizedFactors b) * ub),
  h1 ua.isUnit, h1 ub.isUnit, h1 ua.isUnit, ← mul_assoc, h1 ub.isUnit, mul_right_comm _ (f ua), ← mul_assoc]
[GOAL]
case intro.intro
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ f (Multiset.prod (normalizedFactors a) * Multiset.prod (normalizedFactors b)) * f ↑ub * f ↑ua =
    f (Multiset.prod (normalizedFactors a)) * f (Multiset.prod (normalizedFactors b)) * f ↑ub * f ↑ua
[PROOFSTEP]
congr
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ f (Multiset.prod (normalizedFactors a) * Multiset.prod (normalizedFactors b)) =
    f (Multiset.prod (normalizedFactors a)) * f (Multiset.prod (normalizedFactors b))
[PROOFSTEP]
rw [← (normalizedFactors a).map_id, ← (normalizedFactors b).map_id, Finset.prod_multiset_map_count,
  Finset.prod_multiset_map_count, Finset.prod_subset (Finset.subset_union_left _ (normalizedFactors b).toFinset),
  Finset.prod_subset (Finset.subset_union_right _ (normalizedFactors b).toFinset), ← Finset.prod_mul_distrib]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ f
      (∏ x in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        id x ^ Multiset.count x (normalizedFactors a) * id x ^ Multiset.count x (normalizedFactors b)) =
    f
        (∏ x in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          id x ^ Multiset.count x (normalizedFactors a)) *
      f
        (∏ x in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          id x ^ Multiset.count x (normalizedFactors b))
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors b) → id x ^ Multiset.count x (normalizedFactors b) = 1
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors a) → id x ^ Multiset.count x (normalizedFactors a) = 1
[PROOFSTEP]
simp_rw [id.def, ← pow_add, this]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors b) → id x ^ Multiset.count x (normalizedFactors b) = 1
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors a) → id x ^ Multiset.count x (normalizedFactors a) = 1
[PROOFSTEP]
all_goals simp only [Multiset.mem_toFinset]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors b) → id x ^ Multiset.count x (normalizedFactors b) = 1
[PROOFSTEP]
simp only [Multiset.mem_toFinset]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ Multiset.toFinset (normalizedFactors a) → id x ^ Multiset.count x (normalizedFactors a) = 1
[PROOFSTEP]
simp only [Multiset.mem_toFinset]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ normalizedFactors b → id x ^ Multiset.count x (normalizedFactors b) = 1
[PROOFSTEP]
intro p _ hpb
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
p : α
a✝ : p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b)
hpb : ¬p ∈ normalizedFactors b
⊢ id p ^ Multiset.count p (normalizedFactors b) = 1
[PROOFSTEP]
simp [hpb]
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
⊢ ∀ (x : α),
    x ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ¬x ∈ normalizedFactors a → id x ^ Multiset.count x (normalizedFactors a) = 1
[PROOFSTEP]
intro p _ hpa
[GOAL]
case intro.intro.e_a.e_a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝² : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝¹ : Nontrivial α
this✝ : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
this :
  f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
ua : αˣ
a_eq : Multiset.prod (normalizedFactors a) * ↑ua = a
ub : αˣ
b_eq : Multiset.prod (normalizedFactors b) * ↑ub = b
p : α
a✝ : p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b)
hpa : ¬p ∈ normalizedFactors a
⊢ id p ^ Multiset.count p (normalizedFactors a) = 1
[PROOFSTEP]
simp [hpa]
[GOAL]
case neg
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ f
      (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
        p ^ (Multiset.count p (normalizedFactors a) + Multiset.count p (normalizedFactors b))) =
    f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors a)) *
      f
        (∏ p in Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b),
          p ^ Multiset.count p (normalizedFactors b))
[PROOFSTEP]
refine' multiplicative_prime_power _ _ _ _ _ @h1 @hpr @hcp
[GOAL]
case neg.refine'_1
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) → Prime p
case neg.refine'_2
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α),
    p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ∀ (q : α), q ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) → p ∣ q → p = q
[PROOFSTEP]
all_goals simp only [Multiset.mem_toFinset, Finset.mem_union]
[GOAL]
case neg.refine'_1
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) → Prime p
[PROOFSTEP]
simp only [Multiset.mem_toFinset, Finset.mem_union]
[GOAL]
case neg.refine'_2
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α),
    p ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) →
      ∀ (q : α), q ∈ Multiset.toFinset (normalizedFactors a) ∪ Multiset.toFinset (normalizedFactors b) → p ∣ q → p = q
[PROOFSTEP]
simp only [Multiset.mem_toFinset, Finset.mem_union]
[GOAL]
case neg.refine'_1
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α), p ∈ normalizedFactors a ∨ p ∈ normalizedFactors b → Prime p
[PROOFSTEP]
rintro p (hpa | hpb)
[GOAL]
case neg.refine'_1.inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hpa : p ∈ normalizedFactors a
⊢ Prime p
[PROOFSTEP]
apply prime_of_normalized_factor
[GOAL]
case neg.refine'_1.inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hpb : p ∈ normalizedFactors b
⊢ Prime p
[PROOFSTEP]
apply prime_of_normalized_factor
[GOAL]
case neg.refine'_1.inl.a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hpa : p ∈ normalizedFactors a
⊢ p ∈ normalizedFactors ?neg.refine'_1.inl.a✝
[PROOFSTEP]
assumption
[GOAL]
case neg.refine'_1.inr.a
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hpb : p ∈ normalizedFactors b
⊢ p ∈ normalizedFactors ?neg.refine'_1.inr.a✝
[PROOFSTEP]
assumption
[GOAL]
case neg.refine'_2
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
⊢ ∀ (p : α),
    p ∈ normalizedFactors a ∨ p ∈ normalizedFactors b →
      ∀ (q : α), q ∈ normalizedFactors a ∨ q ∈ normalizedFactors b → p ∣ q → p = q
[PROOFSTEP]
rintro p (hp | hp) q (hq | hq) hdvd
[GOAL]
case neg.refine'_2.inl.inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ p = q
[PROOFSTEP]
rw [← normalize_normalized_factor _ hp, ← normalize_normalized_factor _ hq]
[GOAL]
case neg.refine'_2.inl.inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors b
hdvd : p ∣ q
⊢ p = q
[PROOFSTEP]
rw [← normalize_normalized_factor _ hp, ← normalize_normalized_factor _ hq]
[GOAL]
case neg.refine'_2.inr.inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors b
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ p = q
[PROOFSTEP]
rw [← normalize_normalized_factor _ hp, ← normalize_normalized_factor _ hq]
[GOAL]
case neg.refine'_2.inr.inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors b
q : α
hq : q ∈ normalizedFactors b
hdvd : p ∣ q
⊢ p = q
[PROOFSTEP]
rw [← normalize_normalized_factor _ hp, ← normalize_normalized_factor _ hq]
[GOAL]
case neg.refine'_2.inl.inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ ↑normalize p = ↑normalize q
[PROOFSTEP]
exact
  normalize_eq_normalize hdvd
    ((prime_of_normalized_factor _ hp).irreducible.dvd_symm (prime_of_normalized_factor _ hq).irreducible hdvd)
[GOAL]
case neg.refine'_2.inl.inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors a
q : α
hq : q ∈ normalizedFactors b
hdvd : p ∣ q
⊢ ↑normalize p = ↑normalize q
[PROOFSTEP]
exact
  normalize_eq_normalize hdvd
    ((prime_of_normalized_factor _ hp).irreducible.dvd_symm (prime_of_normalized_factor _ hq).irreducible hdvd)
[GOAL]
case neg.refine'_2.inr.inl
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors b
q : α
hq : q ∈ normalizedFactors a
hdvd : p ∣ q
⊢ ↑normalize p = ↑normalize q
[PROOFSTEP]
exact
  normalize_eq_normalize hdvd
    ((prime_of_normalized_factor _ hp).irreducible.dvd_symm (prime_of_normalized_factor _ hq).irreducible hdvd)
[GOAL]
case neg.refine'_2.inr.inr
α : Type u_1
R : Type u_2
inst✝⁴ : CancelCommMonoidWithZero R
inst✝³ : UniqueFactorizationMonoid R
inst✝² : CancelCommMonoidWithZero α
inst✝¹ : UniqueFactorizationMonoid α
β : Type u_3
inst✝ : CancelCommMonoidWithZero β
f : α → β
a b : α
h0 : f 0 = 0
h1 : ∀ {x y : α}, IsUnit y → f (x * y) = f x * f y
hpr : ∀ {p : α} (i : ℕ), Prime p → f (p ^ i) = f p ^ i
hcp : ∀ {x y : α}, (∀ (p : α), p ∣ x → p ∣ y → IsUnit p) → f (x * y) = f x * f y
this✝¹ : DecidableEq α := Classical.decEq α
ha0 : ¬a = 0
hb0 : ¬b = 0
hf1 : ¬f 1 = 0
this✝ : Nontrivial α
this : NormalizationMonoid α := UniqueFactorizationMonoid.normalizationMonoid
p : α
hp : p ∈ normalizedFactors b
q : α
hq : q ∈ normalizedFactors b
hdvd : p ∣ q
⊢ ↑normalize p = ↑normalize q
[PROOFSTEP]
exact
  normalize_eq_normalize hdvd
    ((prime_of_normalized_factor _ hp).irreducible.dvd_symm (prime_of_normalized_factor _ hq).irreducible hdvd)
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a b : Multiset { a // Irreducible a }
⊢ ↑(a + b) = ↑a + ↑b
[PROOFSTEP]
norm_cast
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : DecidableEq (Associates α)
b : FactorSet α
⊢ ⊤ ⊔ b + ⊤ ⊓ b = ⊤ + b
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : DecidableEq (Associates α)
a : FactorSet α
⊢ a ⊔ ⊤ + a ⊓ ⊤ = a + ⊤
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : DecidableEq (Associates α)
a b : Multiset { a // Irreducible a }
⊢ ↑a ⊔ ↑b + ↑a ⊓ ↑b = ↑a + ↑b
[PROOFSTEP]
rw [← WithTop.coe_sup, ← WithTop.coe_inf, ← WithTop.coe_add, ← WithTop.coe_add, WithTop.coe_eq_coe]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : DecidableEq (Associates α)
a b : Multiset { a // Irreducible a }
⊢ a ⊔ b + a ⊓ b = a + b
[PROOFSTEP]
exact Multiset.union_add_inter _ _
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
b : FactorSet α
⊢ FactorSet.prod (⊤ + b) = FactorSet.prod ⊤ * FactorSet.prod b
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : FactorSet α
⊢ FactorSet.prod (a + ⊤) = FactorSet.prod a * FactorSet.prod ⊤
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a b : Multiset { a // Irreducible a }
⊢ FactorSet.prod (↑a + ↑b) = FactorSet.prod ↑a * FactorSet.prod ↑b
[PROOFSTEP]
rw [← FactorSet.coe_add, prod_coe, prod_coe, prod_coe, Multiset.map_add, Multiset.prod_add]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
b : FactorSet α
h : none ≤ b
⊢ FactorSet.prod none ≤ FactorSet.prod b
[PROOFSTEP]
have : b = ⊤ := top_unique h
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
b : FactorSet α
h : none ≤ b
this : b = ⊤
⊢ FactorSet.prod none ≤ FactorSet.prod b
[PROOFSTEP]
rw [this, prod_top]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
b : FactorSet α
h : none ≤ b
this : b = ⊤
⊢ FactorSet.prod none ≤ 0
[PROOFSTEP]
exact le_rfl
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : FactorSet α
x✝ : a ≤ none
⊢ FactorSet.prod a ≤ FactorSet.prod ⊤
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a : FactorSet α
x✝ : a ≤ none
⊢ FactorSet.prod a ≤ 0
[PROOFSTEP]
exact le_top
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Nontrivial α
p : FactorSet α
⊢ prod p = 0 ↔ p = ⊤
[PROOFSTEP]
induction p using WithTop.recTopCoe
[GOAL]
case top
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Nontrivial α
⊢ prod ⊤ = 0 ↔ ⊤ = ⊤
[PROOFSTEP]
simp only [iff_self_iff, eq_self_iff_true, Associates.prod_top]
[GOAL]
case coe
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Nontrivial α
a✝ : Multiset { a // Irreducible a }
⊢ prod ↑a✝ = 0 ↔ ↑a✝ = ⊤
[PROOFSTEP]
rw [prod_coe, Multiset.prod_eq_zero_iff, Multiset.mem_map, eq_false WithTop.coe_ne_top, iff_false_iff, not_exists]
[GOAL]
case coe
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Nontrivial α
a✝ : Multiset { a // Irreducible a }
⊢ ∀ (x : { a // Irreducible a }), ¬(x ∈ a✝ ∧ ↑x = 0)
[PROOFSTEP]
exact fun a => not_and_of_not_right _ a.prop.ne_zero
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
s : Multiset { a // Irreducible a }
⊢ count p (some s) = Multiset.count { val := p, property := hp } s
[PROOFSTEP]
dsimp only [count]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
s : Multiset { a // Irreducible a }
⊢ dite (Irreducible p) (fun hp => bcount { val := p, property := hp }) (fun hp => 0) (some s) =
    Multiset.count { val := p, property := hp } s
[PROOFSTEP]
split_ifs
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
s : Multiset { a // Irreducible a }
⊢ bcount { val := p, property := hp } (some s) = Multiset.count { val := p, property := hp } s
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
⊢ count p 0 = 0
[PROOFSTEP]
dsimp only [count]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
⊢ dite (Irreducible p) (fun hp => bcount { val := p, property := hp }) (fun hp => 0) 0 = 0
[PROOFSTEP]
split_ifs
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : DecidableEq (Associates α)
p : Associates α
hp : Irreducible p
⊢ bcount { val := p, property := hp } 0 = 0
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
⊢ p ∈ ⊤
[PROOFSTEP]
dsimp only [Membership.mem]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
⊢ FactorSetMem p ⊤
[PROOFSTEP]
dsimp only [FactorSetMem]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
⊢ if hp : Irreducible p then BfactorSetMem { val := p, property := hp } ⊤ else False
[PROOFSTEP]
split_ifs
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
⊢ BfactorSetMem { val := p, property := hp } ⊤
[PROOFSTEP]
exact trivial
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
l : Multiset { a // Irreducible a }
⊢ p ∈ ↑l ↔ { val := p, property := hp } ∈ l
[PROOFSTEP]
dsimp only [Membership.mem]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
l : Multiset { a // Irreducible a }
⊢ FactorSetMem p ↑l ↔ Mem { val := p, property := hp } l
[PROOFSTEP]
dsimp only [FactorSetMem]
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
l : Multiset { a // Irreducible a }
⊢ (if hp : Irreducible p then BfactorSetMem { val := p, property := hp } ↑l else False) ↔
    Mem { val := p, property := hp } l
[PROOFSTEP]
split_ifs
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : Irreducible p
l : Multiset { a // Irreducible a }
⊢ BfactorSetMem { val := p, property := hp } ↑l ↔ Mem { val := p, property := hp } l
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
p : Associates α
hp : ¬Irreducible p
s : FactorSet α
h : if hp : Irreducible p then BfactorSetMem { val := p, property := hp } s else False
⊢ False
[PROOFSTEP]
rwa [dif_neg hp] at h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
⊢ (∀ (a : Associates α), a ∈ p → Irreducible a) →
    (∀ (a : Associates α), a ∈ q → Irreducible a) → prod p = prod q → p = q
[PROOFSTEP]
apply Multiset.induction_on_multiset_quot p
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
⊢ ∀ (s : Multiset α),
    (∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a) →
      (∀ (a : Associates α), a ∈ q → Irreducible a) →
        prod (map (Quot.mk Setoid.r) s) = prod q → map (Quot.mk Setoid.r) s = q
[PROOFSTEP]
apply Multiset.induction_on_multiset_quot q
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
⊢ ∀ (s s_1 : Multiset α),
    (∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s_1 → Irreducible a) →
      (∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a) →
        prod (map (Quot.mk Setoid.r) s_1) = prod (map (Quot.mk Setoid.r) s) →
          map (Quot.mk Setoid.r) s_1 = map (Quot.mk Setoid.r) s
[PROOFSTEP]
intro s t hs ht eq
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
s t : Multiset α
hs : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) t → Irreducible a
ht : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a
eq : prod (map (Quot.mk Setoid.r) t) = prod (map (Quot.mk Setoid.r) s)
⊢ map (Quot.mk Setoid.r) t = map (Quot.mk Setoid.r) s
[PROOFSTEP]
refine' Multiset.map_mk_eq_map_mk_of_rel (UniqueFactorizationMonoid.factors_unique _ _ _)
[GOAL]
case refine'_1
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
s t : Multiset α
hs : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) t → Irreducible a
ht : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a
eq : prod (map (Quot.mk Setoid.r) t) = prod (map (Quot.mk Setoid.r) s)
⊢ ∀ (x : α), x ∈ t → Irreducible x
[PROOFSTEP]
exact fun a ha => (irreducible_mk _).1 <| hs _ <| Multiset.mem_map_of_mem _ ha
[GOAL]
case refine'_2
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
s t : Multiset α
hs : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) t → Irreducible a
ht : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a
eq : prod (map (Quot.mk Setoid.r) t) = prod (map (Quot.mk Setoid.r) s)
⊢ ∀ (x : α), x ∈ s → Irreducible x
[PROOFSTEP]
exact fun a ha => (irreducible_mk _).1 <| ht _ <| Multiset.mem_map_of_mem _ ha
[GOAL]
case refine'_3
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
s t : Multiset α
hs : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) t → Irreducible a
ht : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a
eq : prod (map (Quot.mk Setoid.r) t) = prod (map (Quot.mk Setoid.r) s)
⊢ prod t ~ᵤ prod s
[PROOFSTEP]
have eq' : (Quot.mk Setoid.r : α → Associates α) = Associates.mk := funext quot_mk_eq_mk
[GOAL]
case refine'_3
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
p q : Multiset (Associates α)
s t : Multiset α
hs : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) t → Irreducible a
ht : ∀ (a : Associates α), a ∈ map (Quot.mk Setoid.r) s → Irreducible a
eq : prod (map (Quot.mk Setoid.r) t) = prod (map (Quot.mk Setoid.r) s)
eq' : Quot.mk Setoid.r = Associates.mk
⊢ prod t ~ᵤ prod s
[PROOFSTEP]
rwa [eq', prod_mk, prod_mk, mk_eq_mk_iff_associated] at eq
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : FactorSet α
h : prod p = prod q
⊢ p = q
[PROOFSTEP]
induction p using WithTop.recTopCoe
[GOAL]
case top
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
q : FactorSet α
h : prod ⊤ = prod q
⊢ ⊤ = q
[PROOFSTEP]
induction q using WithTop.recTopCoe
[GOAL]
case coe
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
q : FactorSet α
a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝ = prod q
⊢ ↑a✝ = q
[PROOFSTEP]
induction q using WithTop.recTopCoe
[GOAL]
case top.top
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
h : prod ⊤ = prod ⊤
⊢ ⊤ = ⊤
[PROOFSTEP]
rfl
[GOAL]
case top.coe
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝ : Multiset { a // Irreducible a }
h : prod ⊤ = prod ↑a✝
⊢ ⊤ = ↑a✝
[PROOFSTEP]
rw [eq_comm, ← FactorSet.prod_eq_zero_iff, ← h, Associates.prod_top]
[GOAL]
case coe.top
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝ = prod ⊤
⊢ ↑a✝ = ⊤
[PROOFSTEP]
rw [← FactorSet.prod_eq_zero_iff, h, Associates.prod_top]
[GOAL]
case coe.coe
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
⊢ ↑a✝¹ = ↑a✝
[PROOFSTEP]
congr 1
[GOAL]
case coe.coe.e_a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
⊢ a✝¹ = a✝
[PROOFSTEP]
rw [← Multiset.map_eq_map Subtype.coe_injective]
[GOAL]
case coe.coe.e_a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
⊢ map (fun a => ↑a) a✝¹ = map (fun a => ↑a) a✝
[PROOFSTEP]
apply unique' _ _ h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
⊢ ∀ (a : Associates α), a ∈ map Subtype.val a✝¹ → Irreducible a
[PROOFSTEP]
intro a ha
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
a : Associates α
ha : a ∈ map Subtype.val a✝¹
⊢ Irreducible a
[PROOFSTEP]
obtain ⟨⟨a', irred⟩, -, rfl⟩ := Multiset.mem_map.mp ha
[GOAL]
case intro.mk.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
a' : Associates α
irred : Irreducible a'
ha : ↑{ val := a', property := irred } ∈ map Subtype.val a✝¹
⊢ Irreducible ↑{ val := a', property := irred }
[PROOFSTEP]
rwa [Subtype.coe_mk]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
⊢ ∀ (a : Associates α), a ∈ map Subtype.val a✝ → Irreducible a
[PROOFSTEP]
intro a ha
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
a : Associates α
ha : a ∈ map Subtype.val a✝
⊢ Irreducible a
[PROOFSTEP]
obtain ⟨⟨a', irred⟩, -, rfl⟩ := Multiset.mem_map.mp ha
[GOAL]
case intro.mk.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
a✝¹ a✝ : Multiset { a // Irreducible a }
h : prod ↑a✝¹ = prod ↑a✝
a' : Associates α
irred : Irreducible a'
ha : ↑{ val := a', property := irred } ∈ map Subtype.val a✝
⊢ Irreducible ↑{ val := a', property := irred }
[PROOFSTEP]
rwa [Subtype.coe_mk]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
⊢ prod p ≤ prod q → p ≤ q
[PROOFSTEP]
classical
rintro ⟨c, eqc⟩
refine' Multiset.le_iff_exists_add.2 ⟨factors c, unique' hq (fun x hx => _) _⟩
· obtain h | h := Multiset.mem_add.1 hx
  · exact hp x h
  · exact irreducible_of_factor _ h
· rw [eqc, Multiset.prod_add]
  congr
  refine' associated_iff_eq.mp (factors_prod fun hc => _).symm
  refine' not_irreducible_zero (hq _ _)
  rw [← prod_eq_zero_iff, eqc, hc, mul_zero]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
⊢ prod p ≤ prod q → p ≤ q
[PROOFSTEP]
rintro ⟨c, eqc⟩
[GOAL]
case intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
⊢ p ≤ q
[PROOFSTEP]
refine' Multiset.le_iff_exists_add.2 ⟨factors c, unique' hq (fun x hx => _) _⟩
[GOAL]
case intro.refine'_1
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
x : Associates α
hx : x ∈ p + factors c
⊢ Irreducible x
[PROOFSTEP]
obtain h | h := Multiset.mem_add.1 hx
[GOAL]
case intro.refine'_1.inl
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
x : Associates α
hx : x ∈ p + factors c
h : x ∈ p
⊢ Irreducible x
[PROOFSTEP]
exact hp x h
[GOAL]
case intro.refine'_1.inr
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
x : Associates α
hx : x ∈ p + factors c
h : x ∈ factors c
⊢ Irreducible x
[PROOFSTEP]
exact irreducible_of_factor _ h
[GOAL]
case intro.refine'_2
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
⊢ prod q = prod (p + factors c)
[PROOFSTEP]
rw [eqc, Multiset.prod_add]
[GOAL]
case intro.refine'_2
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
⊢ prod p * c = prod p * prod (factors c)
[PROOFSTEP]
congr
[GOAL]
case intro.refine'_2.e_a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
⊢ c = prod (factors c)
[PROOFSTEP]
refine' associated_iff_eq.mp (factors_prod fun hc => _).symm
[GOAL]
case intro.refine'_2.e_a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
hc : c = 0
⊢ False
[PROOFSTEP]
refine' not_irreducible_zero (hq _ _)
[GOAL]
case intro.refine'_2.e_a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
inst✝ : Nontrivial α
p q : Multiset (Associates α)
hp : ∀ (a : Associates α), a ∈ p → Irreducible a
hq : ∀ (a : Associates α), a ∈ q → Irreducible a
c : Associates α
eqc : prod q = prod p * c
hc : c = 0
⊢ 0 ∈ q
[PROOFSTEP]
rw [← prod_eq_zero_iff, eqc, hc, mul_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
⊢ map Subtype.val (factors' a) = map Associates.mk (factors a)
[PROOFSTEP]
simp [factors', Multiset.map_pmap, Multiset.pmap_eq_map]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
⊢ factors' a = factors' b
[PROOFSTEP]
obtain rfl | hb := eq_or_ne b 0
[GOAL]
case inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
h : a ~ᵤ 0
⊢ factors' a = factors' 0
[PROOFSTEP]
rw [associated_zero_iff_eq_zero] at h
[GOAL]
case inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
h : a = 0
⊢ factors' a = factors' 0
[PROOFSTEP]
rw [h]
[GOAL]
case inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
hb : b ≠ 0
⊢ factors' a = factors' b
[PROOFSTEP]
have ha : a ≠ 0 := by
  contrapose! hb with ha
  rw [← associated_zero_iff_eq_zero, ← ha]
  exact h.symm
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
hb : b ≠ 0
⊢ a ≠ 0
[PROOFSTEP]
contrapose! hb with ha
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
ha : a = 0
⊢ b = 0
[PROOFSTEP]
rw [← associated_zero_iff_eq_zero, ← ha]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
ha : a = 0
⊢ b ~ᵤ a
[PROOFSTEP]
exact h.symm
[GOAL]
case inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
hb : b ≠ 0
ha : a ≠ 0
⊢ factors' a = factors' b
[PROOFSTEP]
rw [← Multiset.map_eq_map Subtype.coe_injective, map_subtype_coe_factors', map_subtype_coe_factors', ←
  rel_associated_iff_map_eq_map]
[GOAL]
case inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
h : a ~ᵤ b
hb : b ≠ 0
ha : a ≠ 0
⊢ Rel Associated (factors a) (factors b)
[PROOFSTEP]
exact
  factors_unique irreducible_of_factor irreducible_of_factor
    ((factors_prod ha).trans <| h.trans <| (factors_prod hb).symm)
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
⊢ FactorSet α
[PROOFSTEP]
refine' if h : a = 0 then ⊤ else Quotient.hrecOn a (fun x _ => some <| factors' x) _ h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
h : ¬a = 0
⊢ ∀ (a b : α), a ≈ b → HEq (fun x => some (factors' a)) fun x => some (factors' b)
[PROOFSTEP]
intro a b hab
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a✝ : Associates α
h : ¬a✝ = 0
a b : α
hab : a ≈ b
⊢ HEq (fun x => some (factors' a)) fun x => some (factors' b)
[PROOFSTEP]
apply Function.hfunext
[GOAL]
case hα
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a✝ : Associates α
h : ¬a✝ = 0
a b : α
hab : a ≈ b
⊢ (¬Quotient.mk (Associated.setoid α) a = 0) = ¬Quotient.mk (Associated.setoid α) b = 0
[PROOFSTEP]
have : a ~ᵤ 0 ↔ b ~ᵤ 0 := Iff.intro (fun ha0 => hab.symm.trans ha0) fun hb0 => hab.trans hb0
[GOAL]
case hα
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a✝ : Associates α
h : ¬a✝ = 0
a b : α
hab : a ≈ b
this : a ~ᵤ 0 ↔ b ~ᵤ 0
⊢ (¬Quotient.mk (Associated.setoid α) a = 0) = ¬Quotient.mk (Associated.setoid α) b = 0
[PROOFSTEP]
simp only [associated_zero_iff_eq_zero] at this
[GOAL]
case hα
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a✝ : Associates α
h : ¬a✝ = 0
a b : α
hab : a ≈ b
this : a = 0 ↔ b = 0
⊢ (¬Quotient.mk (Associated.setoid α) a = 0) = ¬Quotient.mk (Associated.setoid α) b = 0
[PROOFSTEP]
simp only [quotient_mk_eq_mk, this, mk_eq_zero]
[GOAL]
case h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a✝ : Associates α
h : ¬a✝ = 0
a b : α
hab : a ≈ b
⊢ ∀ (a_1 : ¬Quotient.mk (Associated.setoid α) a = 0) (a' : ¬Quotient.mk (Associated.setoid α) b = 0),
    HEq a_1 a' → HEq (some (factors' a)) (some (factors' b))
[PROOFSTEP]
exact fun ha hb _ => heq_of_eq <| congr_arg some <| factors'_cong hab
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
h : a ≠ 0
⊢ factors (Associates.mk a) = ↑(factors' a)
[PROOFSTEP]
classical
apply dif_neg
apply mt mk_eq_zero.1 h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
h : a ≠ 0
⊢ factors (Associates.mk a) = ↑(factors' a)
[PROOFSTEP]
apply dif_neg
[GOAL]
case hnc
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
h : a ≠ 0
⊢ ¬Associates.mk a = 0
[PROOFSTEP]
apply mt mk_eq_zero.1 h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
b : α
this : Associates.mk b = 0
⊢ FactorSet.prod (factors (Quotient.mk (Associated.setoid α) b)) = Quotient.mk (Associated.setoid α) b
[PROOFSTEP]
simp [quotient_mk_eq_mk, this]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
b : α
x✝ : Associates.mk b ≠ 0
⊢ FactorSet.prod (factors (Quotient.mk (Associated.setoid α) b)) = Quotient.mk (Associated.setoid α) b
[PROOFSTEP]
have : b ≠ 0 := by simp_all
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
b : α
x✝ : Associates.mk b ≠ 0
⊢ b ≠ 0
[PROOFSTEP]
simp_all
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
b : α
x✝ : Associates.mk b ≠ 0
this : b ≠ 0
⊢ FactorSet.prod (factors (Quotient.mk (Associated.setoid α) b)) = Quotient.mk (Associated.setoid α) b
[PROOFSTEP]
simp [this, quotient_mk_eq_mk, prod_mk, mk_eq_mk_iff_associated.2 (UniqueFactorizationMonoid.factors_prod this)]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Subsingleton α
a : Associates α
⊢ factors a = none
[PROOFSTEP]
convert @factors_0 _ _ _ _ _
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
⊢ factors a = none ↔ a = 0
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
✝ : Nontrivial α
⊢ factors a = none ↔ a = 0
[PROOFSTEP]
exact ⟨fun h => by rwa [← factors_prod a, FactorSet.prod_eq_zero_iff], fun h => h.symm ▸ factors_0⟩
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
✝ : Nontrivial α
h : factors a = none
⊢ a = 0
[PROOFSTEP]
rwa [← factors_prod a, FactorSet.prod_eq_zero_iff]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
⊢ (∃ s, factors a = some s) ↔ a ≠ 0
[PROOFSTEP]
rw [← Option.isSome_iff_exists, ← Option.ne_none_iff_isSome, Ne.def, Ne.def, factors_eq_none_iff_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h : factors a = factors b
⊢ a = b
[PROOFSTEP]
have : a.factors.prod = b.factors.prod := by rw [h]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h : factors a = factors b
⊢ FactorSet.prod (factors a) = FactorSet.prod (factors b)
[PROOFSTEP]
rw [h]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h : factors a = factors b
this : FactorSet.prod (factors a) = FactorSet.prod (factors b)
⊢ a = b
[PROOFSTEP]
rwa [factors_prod, factors_prod] at this
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a = FactorSet.prod b
⊢ a = b
[PROOFSTEP]
classical
have : a.prod.factors = b.prod.factors := by rw [h]
rwa [prod_factors, prod_factors] at this
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a = FactorSet.prod b
⊢ a = b
[PROOFSTEP]
have : a.prod.factors = b.prod.factors := by rw [h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a = FactorSet.prod b
⊢ factors (FactorSet.prod a) = factors (FactorSet.prod b)
[PROOFSTEP]
rw [h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a = FactorSet.prod b
this : factors (FactorSet.prod a) = factors (FactorSet.prod b)
⊢ a = b
[PROOFSTEP]
rwa [prod_factors, prod_factors] at this
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → count p (factors a) = count p (factors b)
⊢ factors a = factors b
[PROOFSTEP]
obtain ⟨sa, h_sa⟩ := factors_eq_some_iff_ne_zero.mpr ha
[GOAL]
case intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → count p (factors a) = count p (factors b)
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
⊢ factors a = factors b
[PROOFSTEP]
obtain ⟨sb, h_sb⟩ := factors_eq_some_iff_ne_zero.mpr hb
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
h : ∀ (p : Associates α), Irreducible p → count p (factors a) = count p (factors b)
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h_sb : factors b = some sb
⊢ factors a = factors b
[PROOFSTEP]
rw [h_sa, h_sb] at h ⊢
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
⊢ some sa = some sb
[PROOFSTEP]
rw [Option.some_inj]
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
⊢ sa = sb
[PROOFSTEP]
have h_count : ∀ (p : Associates α) (hp : Irreducible p), sa.count ⟨p, hp⟩ = sb.count ⟨p, hp⟩ :=
  by
  intro p hp
  rw [← count_some, ← count_some, h p hp]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
⊢ ∀ (p : Associates α) (hp : Irreducible p),
    Multiset.count { val := p, property := hp } sa = Multiset.count { val := p, property := hp } sb
[PROOFSTEP]
intro p hp
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
p : Associates α
hp : Irreducible p
⊢ Multiset.count { val := p, property := hp } sa = Multiset.count { val := p, property := hp } sb
[PROOFSTEP]
rw [← count_some, ← count_some, h p hp]
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
h_count :
  ∀ (p : Associates α) (hp : Irreducible p),
    Multiset.count { val := p, property := hp } sa = Multiset.count { val := p, property := hp } sb
⊢ sa = sb
[PROOFSTEP]
apply Multiset.toFinsupp.injective
[GOAL]
case intro.intro.a
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
h_count :
  ∀ (p : Associates α) (hp : Irreducible p),
    Multiset.count { val := p, property := hp } sa = Multiset.count { val := p, property := hp } sb
⊢ ↑toFinsupp sa = ↑toFinsupp sb
[PROOFSTEP]
ext ⟨p, hp⟩
[GOAL]
case intro.intro.a.h.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : ∀ (p : Associates α), Irreducible p → count p (some sa) = count p (some sb)
h_sb : factors b = some sb
h_count :
  ∀ (p : Associates α) (hp : Irreducible p),
    Multiset.count { val := p, property := hp } sa = Multiset.count { val := p, property := hp } sb
p : Associates α
hp : Irreducible p
⊢ ↑(↑toFinsupp sa) { val := p, property := hp } = ↑(↑toFinsupp sb) { val := p, property := hp }
[PROOFSTEP]
rw [Multiset.toFinsupp_apply, Multiset.toFinsupp_apply, h_count p hp]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
h : factors a ≤ factors b
⊢ count p (factors a) ≤ count p (factors b)
[PROOFSTEP]
by_cases ha : a = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
h : factors a ≤ factors b
ha : a = 0
⊢ count p (factors a) ≤ count p (factors b)
[PROOFSTEP]
simp_all
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
h : factors a ≤ factors b
ha : ¬a = 0
⊢ count p (factors a) ≤ count p (factors b)
[PROOFSTEP]
obtain ⟨sa, h_sa⟩ := factors_eq_some_iff_ne_zero.mpr ha
[GOAL]
case neg.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
h : factors a ≤ factors b
ha : ¬a = 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
⊢ count p (factors a) ≤ count p (factors b)
[PROOFSTEP]
obtain ⟨sb, h_sb⟩ := factors_eq_some_iff_ne_zero.mpr hb
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
h : factors a ≤ factors b
ha : ¬a = 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h_sb : factors b = some sb
⊢ count p (factors a) ≤ count p (factors b)
[PROOFSTEP]
rw [h_sa, h_sb] at h ⊢
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
ha : ¬a = 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : some sa ≤ some sb
h_sb : factors b = some sb
⊢ count p (some sa) ≤ count p (some sb)
[PROOFSTEP]
rw [count_some hp, count_some hp]
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
ha : ¬a = 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : some sa ≤ some sb
h_sb : factors b = some sb
⊢ Multiset.count { val := p, property := hp } sa ≤ Multiset.count { val := p, property := hp } sb
[PROOFSTEP]
rw [WithTop.some_le_some] at h
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hb : b ≠ 0
hp : Irreducible p
ha : ¬a = 0
sa : Multiset { p // Irreducible p }
h_sa : factors a = some sa
sb : Multiset { p // Irreducible p }
h : sa ≤ sb
h_sb : factors b = some sb
⊢ Multiset.count { val := p, property := hp } sa ≤ Multiset.count { val := p, property := hp } sb
[PROOFSTEP]
exact Multiset.count_le_of_le _ h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
⊢ factors (a * b) = factors a + factors b
[PROOFSTEP]
cases subsingleton_or_nontrivial α
[GOAL]
case inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h✝ : Subsingleton α
⊢ factors (a * b) = factors a + factors b
[PROOFSTEP]
simp [Subsingleton.elim a 0]
[GOAL]
case inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h✝ : Nontrivial α
⊢ factors (a * b) = factors a + factors b
[PROOFSTEP]
refine' eq_of_prod_eq_prod (eq_of_factors_eq_factors _)
[GOAL]
case inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h✝ : Nontrivial α
⊢ factors (FactorSet.prod (factors (a * b))) = factors (FactorSet.prod (factors a + factors b))
[PROOFSTEP]
rw [prod_add, factors_prod, factors_prod, factors_prod]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
s t : Associates α
d : Associates α
eq : t = s * d
⊢ factors s ≤ factors t
[PROOFSTEP]
rw [eq, factors_mul]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
s t : Associates α
d : Associates α
eq : t = s * d
⊢ factors s ≤ factors s + factors d
[PROOFSTEP]
exact le_add_of_nonneg_right bot_le
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h : factors a ≤ factors b
⊢ a ≤ b
[PROOFSTEP]
have : a.factors.prod ≤ b.factors.prod := prod_mono h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
h : factors a ≤ factors b
this : FactorSet.prod (factors a) ≤ FactorSet.prod (factors b)
⊢ a ≤ b
[PROOFSTEP]
rwa [factors_prod, factors_prod] at this
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
⊢ FactorSet.prod a ≤ FactorSet.prod b ↔ a ≤ b
[PROOFSTEP]
classical exact
  Iff.intro
    (fun h => by
      have : a.prod.factors ≤ b.prod.factors := factors_mono h
      rwa [prod_factors, prod_factors] at this )
    prod_mono
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
⊢ FactorSet.prod a ≤ FactorSet.prod b ↔ a ≤ b
[PROOFSTEP]
exact
  Iff.intro
    (fun h => by
      have : a.prod.factors ≤ b.prod.factors := factors_mono h
      rwa [prod_factors, prod_factors] at this )
    prod_mono
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a ≤ FactorSet.prod b
⊢ a ≤ b
[PROOFSTEP]
have : a.prod.factors ≤ b.prod.factors := factors_mono h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : FactorSet α
h : FactorSet.prod a ≤ FactorSet.prod b
this : factors (FactorSet.prod a) ≤ factors (FactorSet.prod b)
⊢ a ≤ b
[PROOFSTEP]
rwa [prod_factors, prod_factors] at this
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
⊢ FactorSet.prod (factors a ⊔ factors b) * FactorSet.prod (factors a ⊓ factors b) = a * b
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
✝ : Nontrivial α
⊢ FactorSet.prod (factors a ⊔ factors b) * FactorSet.prod (factors a ⊓ factors b) = a * b
[PROOFSTEP]
refine' eq_of_factors_eq_factors _
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
✝ : Nontrivial α
⊢ factors (FactorSet.prod (factors a ⊔ factors b) * FactorSet.prod (factors a ⊓ factors b)) = factors (a * b)
[PROOFSTEP]
rw [← prod_add, prod_factors, factors_mul, FactorSet.sup_add_inf_eq_add]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
⊢ p ∣ a
[PROOFSTEP]
by_cases ha0 : a = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
ha0 : a = 0
⊢ p ∣ a
[PROOFSTEP]
rw [ha0]
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
ha0 : a = 0
⊢ p ∣ 0
[PROOFSTEP]
exact dvd_zero p
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
ha0 : ¬a = 0
⊢ p ∣ a
[PROOFSTEP]
obtain ⟨a0, nza, ha'⟩ := exists_non_zero_rep ha0
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
ha0 : ¬a = 0
a0 : α
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ p ∣ a
[PROOFSTEP]
rw [← Associates.factors_prod a]
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
hm : p ∈ factors a
ha0 : ¬a = 0
a0 : α
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ p ∣ FactorSet.prod (factors a)
[PROOFSTEP]
rw [← ha', factors_mk a0 nza] at hm ⊢
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
ha0 : ¬a = 0
a0 : α
hm : p ∈ ↑(factors' a0)
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ p ∣ FactorSet.prod ↑(factors' a0)
[PROOFSTEP]
rw [prod_coe]
[GOAL]
case neg.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
ha0 : ¬a = 0
a0 : α
hm : p ∈ ↑(factors' a0)
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ p ∣ prod (map Subtype.val (factors' a0))
[PROOFSTEP]
apply Multiset.dvd_prod
[GOAL]
case neg.intro.intro.a
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
ha0 : ¬a = 0
a0 : α
hm : p ∈ ↑(factors' a0)
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ p ∈ map Subtype.val (factors' a0)
[PROOFSTEP]
apply Multiset.mem_map.mpr
[GOAL]
case neg.intro.intro.a
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
ha0 : ¬a = 0
a0 : α
hm : p ∈ ↑(factors' a0)
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ ∃ a, a ∈ factors' a0 ∧ ↑a = p
[PROOFSTEP]
exact ⟨⟨p, hp⟩, mem_factorSet_some.mp hm, rfl⟩
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
p : Associates α
hp : Irreducible p
hz : a ≠ 0
h_mem : { val := p, property := hp } ∈ factors' a
⊢ p ∣ Associates.mk a
[PROOFSTEP]
haveI := Classical.decEq (Associates α)
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
p : Associates α
hp : Irreducible p
hz : a ≠ 0
h_mem : { val := p, property := hp } ∈ factors' a
this : DecidableEq (Associates α)
⊢ p ∣ Associates.mk a
[PROOFSTEP]
apply dvd_of_mem_factors (hp := hp)
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
p : Associates α
hp : Irreducible p
hz : a ≠ 0
h_mem : { val := p, property := hp } ∈ factors' a
this : DecidableEq (Associates α)
⊢ p ∈ factors (Associates.mk a)
[PROOFSTEP]
rw [factors_mk _ hz]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : α
p : Associates α
hp : Irreducible p
hz : a ≠ 0
h_mem : { val := p, property := hp } ∈ factors' a
this : DecidableEq (Associates α)
⊢ p ∈ ↑(factors' a)
[PROOFSTEP]
apply mem_factorSet_some.2 h_mem
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
⊢ { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a
[PROOFSTEP]
obtain ⟨q, hq, hpq⟩ := exists_mem_factors_of_dvd ha0 hp hd
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
q : α
hq : q ∈ UniqueFactorizationMonoid.factors a
hpq : p ~ᵤ q
⊢ { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a
[PROOFSTEP]
apply Multiset.mem_pmap.mpr
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
q : α
hq : q ∈ UniqueFactorizationMonoid.factors a
hpq : p ~ᵤ q
⊢ ∃ a_1 h,
    { val := Associates.mk a_1, property := (_ : Irreducible (Associates.mk a_1)) } =
      { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) }
[PROOFSTEP]
use q
[GOAL]
case h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
q : α
hq : q ∈ UniqueFactorizationMonoid.factors a
hpq : p ~ᵤ q
⊢ ∃ h,
    { val := Associates.mk q, property := (_ : Irreducible (Associates.mk q)) } =
      { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) }
[PROOFSTEP]
use hq
[GOAL]
case h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
q : α
hq : q ∈ UniqueFactorizationMonoid.factors a
hpq : p ~ᵤ q
⊢ { val := Associates.mk q, property := (_ : Irreducible (Associates.mk q)) } =
    { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) }
[PROOFSTEP]
exact Subtype.eq (Eq.symm (mk_eq_mk_iff_associated.mpr hpq))
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a ↔ p ∣ a
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a → p ∣ a
[PROOFSTEP]
rw [← mk_dvd_mk]
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a →
    Associates.mk p ∣ Associates.mk a
[PROOFSTEP]
apply dvd_of_mem_factors'
[GOAL]
case mp.hz
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ a ≠ 0
[PROOFSTEP]
apply ha0
[GOAL]
case mpr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ p ∣ a → { val := Associates.mk p, property := (_ : Irreducible (Associates.mk p)) } ∈ factors' a
[PROOFSTEP]
apply mem_factors'_of_dvd ha0 hp
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
⊢ Associates.mk p ∈ factors (Associates.mk a)
[PROOFSTEP]
rw [factors_mk _ ha0]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
hd : p ∣ a
⊢ Associates.mk p ∈ ↑(factors' a)
[PROOFSTEP]
exact mem_factorSet_some.mpr (mem_factors'_of_dvd ha0 hp hd)
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ Associates.mk p ∈ factors (Associates.mk a) ↔ p ∣ a
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ Associates.mk p ∈ factors (Associates.mk a) → p ∣ a
[PROOFSTEP]
rw [← mk_dvd_mk]
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ Associates.mk p ∈ factors (Associates.mk a) → Associates.mk p ∣ Associates.mk a
[PROOFSTEP]
apply dvd_of_mem_factors
[GOAL]
case mp.hp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ Irreducible (Associates.mk p)
[PROOFSTEP]
exact (irreducible_mk p).mpr hp
[GOAL]
case mpr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ p ∣ a → Associates.mk p ∈ factors (Associates.mk a)
[PROOFSTEP]
apply mem_factors_of_dvd ha0 hp
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
have hz : factors (Associates.mk a) ⊓ factors (Associates.mk b) ≠ 0 :=
  by
  contrapose! h with hf
  change (factors (Associates.mk a) ⊓ factors (Associates.mk b)).prod = 1
  rw [hf]
  exact Multiset.prod_zero
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
⊢ factors (Associates.mk a) ⊓ factors (Associates.mk b) ≠ 0
[PROOFSTEP]
contrapose! h with hf
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
hf : factors (Associates.mk a) ⊓ factors (Associates.mk b) = 0
⊢ Associates.mk a ⊓ Associates.mk b = 1
[PROOFSTEP]
change (factors (Associates.mk a) ⊓ factors (Associates.mk b)).prod = 1
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
hf : factors (Associates.mk a) ⊓ factors (Associates.mk b) = 0
⊢ FactorSet.prod (factors (Associates.mk a) ⊓ factors (Associates.mk b)) = 1
[PROOFSTEP]
rw [hf]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
hf : factors (Associates.mk a) ⊓ factors (Associates.mk b) = 0
⊢ FactorSet.prod 0 = 1
[PROOFSTEP]
exact Multiset.prod_zero
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : factors (Associates.mk a) ⊓ factors (Associates.mk b) ≠ 0
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
rw [factors_mk a ha, factors_mk b hb, ← WithTop.coe_inf] at hz
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
obtain ⟨⟨p0, p0_irr⟩, p0_mem⟩ := Multiset.exists_mem_of_ne_zero ((mt WithTop.coe_eq_coe.mpr) hz)
[GOAL]
case intro.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p0 : Associates α
p0_irr : Irreducible p0
p0_mem : { val := p0, property := p0_irr } ∈ factors' a ⊓ factors' b
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
rw [Multiset.inf_eq_inter] at p0_mem
[GOAL]
case intro.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p0 : Associates α
p0_irr : Irreducible p0
p0_mem : { val := p0, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
obtain ⟨p, rfl⟩ : ∃ p, Associates.mk p = p0 := Quot.exists_rep p0
[GOAL]
case intro.mk.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ ∃ p, Prime p ∧ p ∣ a ∧ p ∣ b
[PROOFSTEP]
refine' ⟨p, _, _, _⟩
[GOAL]
case intro.mk.intro.refine'_1
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ Prime p
[PROOFSTEP]
rw [← irreducible_iff_prime, ← irreducible_mk]
[GOAL]
case intro.mk.intro.refine'_1
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ Irreducible (Associates.mk p)
[PROOFSTEP]
exact p0_irr
[GOAL]
case intro.mk.intro.refine'_2
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ p ∣ a
[PROOFSTEP]
apply dvd_of_mk_le_mk
[GOAL]
case intro.mk.intro.refine'_2.a
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ Associates.mk p ≤ Associates.mk a
[PROOFSTEP]
apply dvd_of_mem_factors' (Multiset.mem_inter.mp p0_mem).left
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ a ≠ 0
[PROOFSTEP]
apply ha
[GOAL]
case intro.mk.intro.refine'_3
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ p ∣ b
[PROOFSTEP]
apply dvd_of_mk_le_mk
[GOAL]
case intro.mk.intro.refine'_3.a
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ Associates.mk p ≤ Associates.mk b
[PROOFSTEP]
apply dvd_of_mem_factors' (Multiset.mem_inter.mp p0_mem).right
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : Associates.mk a ⊓ Associates.mk b ≠ 1
hz : ↑(factors' a ⊓ factors' b) ≠ 0
p : α
p0_irr : Irreducible (Associates.mk p)
p0_mem : { val := Associates.mk p, property := p0_irr } ∈ factors' a ∩ factors' b
⊢ b ≠ 0
[PROOFSTEP]
apply hb
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ Associates.mk a ⊓ Associates.mk b = 1 ↔ ∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ Associates.mk a ⊓ Associates.mk b = 1 → ∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d
[PROOFSTEP]
intro hg p ha hb hp
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
hg : Associates.mk a ⊓ Associates.mk b = 1
p : α
ha : p ∣ a
hb : p ∣ b
hp : Prime p
⊢ False
[PROOFSTEP]
refine' ((Associates.prime_mk _).mpr hp).not_unit (isUnit_of_dvd_one _)
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
hg : Associates.mk a ⊓ Associates.mk b = 1
p : α
ha : p ∣ a
hb : p ∣ b
hp : Prime p
⊢ Associates.mk p ∣ 1
[PROOFSTEP]
rw [← hg]
[GOAL]
case mp
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
hg : Associates.mk a ⊓ Associates.mk b = 1
p : α
ha : p ∣ a
hb : p ∣ b
hp : Prime p
⊢ Associates.mk p ∣ Associates.mk a ⊓ Associates.mk b
[PROOFSTEP]
exact le_inf (mk_le_mk_of_dvd ha) (mk_le_mk_of_dvd hb)
[GOAL]
case mpr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ (∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d) → Associates.mk a ⊓ Associates.mk b = 1
[PROOFSTEP]
contrapose
[GOAL]
case mpr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
⊢ ¬Associates.mk a ⊓ Associates.mk b = 1 → ¬∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d
[PROOFSTEP]
intro hg hc
[GOAL]
case mpr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
hg : ¬Associates.mk a ⊓ Associates.mk b = 1
hc : ∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d
⊢ False
[PROOFSTEP]
obtain ⟨p, hp, hpa, hpb⟩ := exists_prime_dvd_of_not_inf_one ha0 hb0 hg
[GOAL]
case mpr.intro.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : α
ha0 : a ≠ 0
hb0 : b ≠ 0
hg : ¬Associates.mk a ⊓ Associates.mk b = 1
hc : ∀ {d : α}, d ∣ a → d ∣ b → ¬Prime d
p : α
hp : Prime p
hpa : p ∣ a
hpb : p ∣ b
⊢ False
[PROOFSTEP]
exact hc hpa hpb hp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
⊢ FactorSet.prod (factors p) = FactorSet.prod (some {{ val := p, property := hp }})
[PROOFSTEP]
rw [factors_prod, FactorSet.prod]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
⊢ p =
    match some {{ val := p, property := hp }} with
    | none => 0
    | some s => prod (map Subtype.val s)
[PROOFSTEP]
dsimp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
⊢ p = prod {p}
[PROOFSTEP]
rw [prod_singleton]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
k : ℕ
⊢ FactorSet.prod (factors (p ^ k)) = FactorSet.prod (some (replicate k { val := p, property := hp }))
[PROOFSTEP]
rw [Associates.factors_prod, FactorSet.prod]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
k : ℕ
⊢ p ^ k =
    match some (replicate k { val := p, property := hp }) with
    | none => 0
    | some s => prod (map Subtype.val s)
[PROOFSTEP]
dsimp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
k : ℕ
⊢ p ^ k = prod (map Subtype.val (replicate k { val := p, property := hp }))
[PROOFSTEP]
rw [Multiset.map_replicate, Multiset.prod_replicate, Subtype.coe_mk]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
m p : Associates α
h₁ : m ≠ 0
h₂ : Irreducible p
k : ℕ
⊢ p ^ k ≤ m ↔ k ≤ count p (factors m)
[PROOFSTEP]
obtain ⟨a, nz, rfl⟩ := Associates.exists_non_zero_rep h₁
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ p ^ k ≤ Associates.mk a ↔ k ≤ count p (factors (Associates.mk a))
[PROOFSTEP]
rw [factors_mk _ nz, ← WithTop.some_eq_coe, count_some, Multiset.le_count_iff_replicate_le, ← factors_le,
  factors_prime_pow h₂, factors_mk _ nz]
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ some (replicate k { val := p, property := h₂ }) ≤ ↑(factors' a) ↔
    replicate k { val := p, property := ?intro.intro.hp } ≤ factors' a
case intro.intro.hp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ Irreducible p
case intro.intro.hp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ Irreducible p
case intro.intro.hp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ Irreducible p
case intro.intro.hp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ Irreducible p
case intro.intro.hp
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
h₂ : Irreducible p
k : ℕ
a : α
nz : a ≠ 0
h₁ : Associates.mk a ≠ 0
⊢ Irreducible p
[PROOFSTEP]
exact WithTop.coe_le_coe
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
⊢ count p (factors m) ≠ 0 → p ≤ m
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
✝ : Nontrivial α
⊢ count p (factors m) ≠ 0 → p ≤ m
[PROOFSTEP]
rw [← pos_iff_ne_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
✝ : Nontrivial α
⊢ 0 < count p (factors m) → p ≤ m
[PROOFSTEP]
intro h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
✝ : Nontrivial α
h : 0 < count p (factors m)
⊢ p ≤ m
[PROOFSTEP]
rw [← pow_one p]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
✝ : Nontrivial α
h : 0 < count p (factors m)
⊢ p ^ 1 ≤ m
[PROOFSTEP]
apply (prime_pow_dvd_iff_le h0 hp).2
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
m p : Associates α
h0 : m ≠ 0
hp : Irreducible p
✝ : Nontrivial α
h : 0 < count p (factors m)
⊢ 1 ≤ count p (factors m)
[PROOFSTEP]
simpa only
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
⊢ count (Associates.mk p) (factors (Associates.mk a)) ≠ 0 ↔ p ∣ a
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
inst✝ : Nontrivial α
⊢ count (Associates.mk p) (factors (Associates.mk a)) ≠ 0 ↔ p ∣ a
[PROOFSTEP]
rw [← Associates.mk_le_mk_iff_dvd_iff]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
inst✝ : Nontrivial α
⊢ count (Associates.mk p) (factors (Associates.mk a)) ≠ 0 ↔ Associates.mk p ≤ Associates.mk a
[PROOFSTEP]
refine'
  ⟨fun h => Associates.le_of_count_ne_zero (Associates.mk_ne_zero.mpr ha0) ((Associates.irreducible_mk p).mpr hp) h,
    fun h => _⟩
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
inst✝ : Nontrivial α
h : Associates.mk p ≤ Associates.mk a
⊢ count (Associates.mk p) (factors (Associates.mk a)) ≠ 0
[PROOFSTEP]
rw [← pow_one (Associates.mk p),
  Associates.prime_pow_dvd_iff_le (Associates.mk_ne_zero.mpr ha0) ((Associates.irreducible_mk p).mpr hp)] at h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : α
ha0 : a ≠ 0
hp : Irreducible p
inst✝ : Nontrivial α
h : 1 ≤ count (Associates.mk p) (factors (Associates.mk a))
⊢ count (Associates.mk p) (factors (Associates.mk a)) ≠ 0
[PROOFSTEP]
exact (zero_lt_one.trans_le h).ne'
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
p : Associates α
hp : Irreducible p
⊢ count p (factors p) = 1
[PROOFSTEP]
simp [factors_self hp, Associates.count_some hp]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p q : Associates α
hp : Irreducible p
hq : Irreducible q
h : p ≠ q
h' : count p (factors q) ≠ 0
⊢ p ∣ q
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p q : Associates α
hp : Irreducible p
hq : Irreducible q
h : p ≠ q
h' : count p (factors q) ≠ 0
✝ : Nontrivial α
⊢ p ∣ q
[PROOFSTEP]
exact le_of_count_ne_zero hq.ne_zero hp h'
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
⊢ count p (factors (a * b)) = count p (factors a) + count p (factors b)
[PROOFSTEP]
obtain ⟨a0, nza, ha'⟩ := exists_non_zero_rep ha
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
a0 : α
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
⊢ count p (factors (a * b)) = count p (factors a) + count p (factors b)
[PROOFSTEP]
obtain ⟨b0, nzb, hb'⟩ := exists_non_zero_rep hb
[GOAL]
case intro.intro.intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
a0 : α
nza : a0 ≠ 0
ha' : Associates.mk a0 = a
b0 : α
nzb : b0 ≠ 0
hb' : Associates.mk b0 = b
⊢ count p (factors (a * b)) = count p (factors a) + count p (factors b)
[PROOFSTEP]
rw [factors_mul, ← ha', ← hb', factors_mk a0 nza, factors_mk b0 nzb, ← FactorSet.coe_add, ← WithTop.some_eq_coe, ←
  WithTop.some_eq_coe, ← WithTop.some_eq_coe, count_some hp, Multiset.count_add, count_some hp, count_some hp]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
p : Associates α
hp : Irreducible p
⊢ count p (factors a) = 0 ∨ count p (factors b) = 0
[PROOFSTEP]
rw [or_iff_not_imp_left, ← Ne.def]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
p : Associates α
hp : Irreducible p
⊢ count p (factors a) ≠ 0 → count p (factors b) = 0
[PROOFSTEP]
intro hca
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
p : Associates α
hp : Irreducible p
hca : count p (factors a) ≠ 0
⊢ count p (factors b) = 0
[PROOFSTEP]
contrapose! hab with hcb
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a : Associates α
ha : a ≠ 0
b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hca : count p (factors a) ≠ 0
hcb : count p (factors b) ≠ 0
⊢ ∃ d, d ∣ a ∧ d ∣ b ∧ Prime d
[PROOFSTEP]
exact ⟨p, le_of_count_ne_zero ha hp hca, le_of_count_ne_zero hb hp hcb, irreducible_iff_prime.mp hp⟩
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
⊢ count p (factors a) = 0 ∨ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
by_cases ha : a = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : a = 0
⊢ count p (factors a) = 0 ∨ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
simp [ha]
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
⊢ count p (factors a) = 0 ∨ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
cases' count_of_coprime ha hb hab hp with hz hb0
[GOAL]
case neg.inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hz : count p (factors a) = 0
⊢ count p (factors a) = 0 ∨ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
tauto
[GOAL]
case neg.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb0 : count p (factors b) = 0
⊢ count p (factors a) = 0 ∨ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
apply Or.intro_right
[GOAL]
case neg.inr.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb0 : count p (factors b) = 0
⊢ count p (factors a) = count p (factors (a * b))
[PROOFSTEP]
rw [count_mul ha hb hp, hb0, add_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
⊢ count p (factors (a * b)) = count p (factors a) ∨ count p (factors (a * b)) = count p (factors b)
[PROOFSTEP]
by_cases ha : a = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : a = 0
⊢ count p (factors (a * b)) = count p (factors a) ∨ count p (factors (a * b)) = count p (factors b)
[PROOFSTEP]
simp [ha]
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
⊢ count p (factors (a * b)) = count p (factors a) ∨ count p (factors (a * b)) = count p (factors b)
[PROOFSTEP]
by_cases hb : b = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : b = 0
⊢ count p (factors (a * b)) = count p (factors a) ∨ count p (factors (a * b)) = count p (factors b)
[PROOFSTEP]
simp [hb]
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
⊢ count p (factors (a * b)) = count p (factors a) ∨ count p (factors (a * b)) = count p (factors b)
[PROOFSTEP]
rw [count_mul ha hb hp]
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
⊢ count p (factors a) + count p (factors b) = count p (factors a) ∨
    count p (factors a) + count p (factors b) = count p (factors b)
[PROOFSTEP]
cases' count_of_coprime ha hb hab hp with ha0 hb0
[GOAL]
case neg.inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
ha0 : count p (factors a) = 0
⊢ count p (factors a) + count p (factors b) = count p (factors a) ∨
    count p (factors a) + count p (factors b) = count p (factors b)
[PROOFSTEP]
apply Or.intro_right
[GOAL]
case neg.inl.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
ha0 : count p (factors a) = 0
⊢ count p (factors a) + count p (factors b) = count p (factors b)
[PROOFSTEP]
rw [ha0, zero_add]
[GOAL]
case neg.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
hb0 : count p (factors b) = 0
⊢ count p (factors a) + count p (factors b) = count p (factors a) ∨
    count p (factors a) + count p (factors b) = count p (factors b)
[PROOFSTEP]
apply Or.intro_left
[GOAL]
case neg.inr.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
ha : ¬a = 0
hb : ¬b = 0
hb0 : count p (factors b) = 0
⊢ count p (factors a) + count p (factors b) = count p (factors a)
[PROOFSTEP]
rw [hb0, add_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
⊢ k ∣ count p (factors a)
[PROOFSTEP]
by_cases ha : a = 0
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
ha : a = 0
⊢ k ∣ count p (factors a)
[PROOFSTEP]
simpa [*] using habk
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
ha : ¬a = 0
⊢ k ∣ count p (factors a)
[PROOFSTEP]
cases' count_of_coprime ha hb hab hp with hz h
[GOAL]
case neg.inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
ha : ¬a = 0
hz : count p (factors a) = 0
⊢ k ∣ count p (factors a)
[PROOFSTEP]
rw [hz]
[GOAL]
case neg.inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
ha : ¬a = 0
hz : count p (factors a) = 0
⊢ k ∣ 0
[PROOFSTEP]
exact dvd_zero k
[GOAL]
case neg.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors (a * b))
ha : ¬a = 0
h : count p (factors b) = 0
⊢ k ∣ count p (factors a)
[PROOFSTEP]
rw [count_mul ha hb hp, h] at habk
[GOAL]
case neg.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a b : Associates α
hb : b ≠ 0
p : Associates α
hp : Irreducible p
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
habk : k ∣ count p (factors a) + 0
ha : ¬a = 0
h : count p (factors b) = 0
⊢ k ∣ count p (factors a)
[PROOFSTEP]
exact habk
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
⊢ factors 1 = 0
[PROOFSTEP]
apply eq_of_prod_eq_prod
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
⊢ FactorSet.prod (factors 1) = FactorSet.prod 0
[PROOFSTEP]
rw [Associates.factors_prod]
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
⊢ 1 = FactorSet.prod 0
[PROOFSTEP]
exact Multiset.prod_zero
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
k : ℕ
⊢ factors (a ^ k) = k • factors a
[PROOFSTEP]
induction' k with n h
[GOAL]
case zero
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
⊢ factors (a ^ Nat.zero) = Nat.zero • factors a
[PROOFSTEP]
rw [zero_nsmul, pow_zero]
[GOAL]
case zero
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
⊢ factors 1 = 0
[PROOFSTEP]
exact factors_one
[GOAL]
case succ
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
n : ℕ
h : factors (a ^ n) = n • factors a
⊢ factors (a ^ Nat.succ n) = Nat.succ n • factors a
[PROOFSTEP]
rw [pow_succ, succ_nsmul, factors_mul, h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
k : ℕ
⊢ count p (factors (a ^ k)) = k * count p (factors a)
[PROOFSTEP]
induction' k with n h
[GOAL]
case zero
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
⊢ count p (factors (a ^ Nat.zero)) = Nat.zero * count p (factors a)
[PROOFSTEP]
rw [pow_zero, factors_one, Nat.zero_eq, zero_mul, count_zero hp]
[GOAL]
case succ
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
n : ℕ
h : count p (factors (a ^ n)) = n * count p (factors a)
⊢ count p (factors (a ^ Nat.succ n)) = Nat.succ n * count p (factors a)
[PROOFSTEP]
rw [pow_succ, count_mul ha (pow_ne_zero _ ha) hp, h, Nat.succ_eq_add_one]
[GOAL]
case succ
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
n : ℕ
h : count p (factors (a ^ n)) = n * count p (factors a)
⊢ count p (factors a) + n * count p (factors a) = (n + 1) * count p (factors a)
[PROOFSTEP]
ring
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
k : ℕ
⊢ k ∣ count p (factors (a ^ k))
[PROOFSTEP]
rw [count_pow ha hp]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
p : Associates α
hp : Irreducible p
k : ℕ
⊢ k ∣ k * count p (factors a)
[PROOFSTEP]
apply dvd_mul_right
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a : Associates α
ha : a ≠ 0
k : ℕ
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p (factors a)
⊢ ∃ b, a = b ^ k
[PROOFSTEP]
obtain ⟨a0, hz, rfl⟩ := exists_non_zero_rep ha
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p (factors (Associates.mk a0))
⊢ ∃ b, Associates.mk a0 = b ^ k
[PROOFSTEP]
rw [factors_mk a0 hz] at hk
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
⊢ ∃ b, Associates.mk a0 = b ^ k
[PROOFSTEP]
have hk' : ∀ p, p ∈ factors' a0 → k ∣ (factors' a0).count p :=
  by
  rintro p -
  have pp : p = ⟨p.val, p.2⟩ := by simp only [Subtype.coe_eta]
  rw [pp, ← count_some p.2]
  exact hk p.val p.2
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
⊢ ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
[PROOFSTEP]
rintro p -
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
⊢ k ∣ Multiset.count p (factors' a0)
[PROOFSTEP]
have pp : p = ⟨p.val, p.2⟩ := by simp only [Subtype.coe_eta]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
⊢ p = { val := ↑p, property := (_ : Irreducible ↑p) }
[PROOFSTEP]
simp only [Subtype.coe_eta]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
pp : p = { val := ↑p, property := (_ : Irreducible ↑p) }
⊢ k ∣ Multiset.count p (factors' a0)
[PROOFSTEP]
rw [pp, ← count_some p.2]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
p : { a // Irreducible a }
pp : p = { val := ↑p, property := (_ : Irreducible ↑p) }
⊢ k ∣ count (↑p) (some (factors' a0))
[PROOFSTEP]
exact hk p.val p.2
[GOAL]
case intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
⊢ ∃ b, Associates.mk a0 = b ^ k
[PROOFSTEP]
obtain ⟨u, hu⟩ := Multiset.exists_smul_of_dvd_count _ hk'
[GOAL]
case intro.intro.intro
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ ∃ b, Associates.mk a0 = b ^ k
[PROOFSTEP]
use FactorSet.prod (u : FactorSet α)
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ Associates.mk a0 = FactorSet.prod ↑u ^ k
[PROOFSTEP]
apply eq_of_factors_eq_factors
[GOAL]
case h.h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ factors (Associates.mk a0) = factors (FactorSet.prod ↑u ^ k)
[PROOFSTEP]
rw [pow_factors, prod_factors, factors_mk a0 hz, ← WithTop.some_eq_coe, hu]
[GOAL]
case h.h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
k : ℕ
a0 : α
hz : a0 ≠ 0
ha : Associates.mk a0 ≠ 0
hk : ∀ (p : Associates α), Irreducible p → k ∣ count p ↑(factors' a0)
hk' : ∀ (p : { a // Irreducible a }), p ∈ factors' a0 → k ∣ Multiset.count p (factors' a0)
u : Multiset { a // Irreducible a }
hu : factors' a0 = k • u
⊢ some (k • u) = k • ↑u
[PROOFSTEP]
exact WithBot.coe_nsmul u k
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
⊢ a = p ^ count p (factors a)
[PROOFSTEP]
nontriviality α
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
⊢ a = p ^ count p (factors a)
[PROOFSTEP]
have hph := pow_ne_zero n hp.ne_zero
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
⊢ a = p ^ count p (factors a)
[PROOFSTEP]
have ha := ne_zero_of_dvd_ne_zero hph h
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
⊢ a = p ^ count p (factors a)
[PROOFSTEP]
apply eq_of_eq_counts ha (pow_ne_zero _ hp.ne_zero)
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
⊢ ∀ (p_1 : Associates α), Irreducible p_1 → count p_1 (factors a) = count p_1 (factors (p ^ count p (factors a)))
[PROOFSTEP]
have eq_zero_of_ne : ∀ q : Associates α, Irreducible q → q ≠ p → _ = 0 := fun q hq h' =>
  Nat.eq_zero_of_le_zero <| by
    convert count_le_count_of_le hph hq h
    symm
    rw [count_pow hp.ne_zero hq, count_eq_zero_of_ne hq hp h', mul_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
q : Associates α
hq : Irreducible q
h' : q ≠ p
⊢ ?m.3109694 q ≤ 0
[PROOFSTEP]
convert count_le_count_of_le hph hq h
[GOAL]
case h.e'_4
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
q : Associates α
hq : Irreducible q
h' : q ≠ p
⊢ 0 = count q (factors (p ^ n))
[PROOFSTEP]
symm
[GOAL]
case h.e'_4
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
q : Associates α
hq : Irreducible q
h' : q ≠ p
⊢ count q (factors (p ^ n)) = 0
[PROOFSTEP]
rw [count_pow hp.ne_zero hq, count_eq_zero_of_ne hq hp h', mul_zero]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
eq_zero_of_ne : ∀ (q : Associates α), Irreducible q → q ≠ p → count q (factors a) = 0
⊢ ∀ (p_1 : Associates α), Irreducible p_1 → count p_1 (factors a) = count p_1 (factors (p ^ count p (factors a)))
[PROOFSTEP]
intro q hq
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
eq_zero_of_ne : ∀ (q : Associates α), Irreducible q → q ≠ p → count q (factors a) = 0
q : Associates α
hq : Irreducible q
⊢ count q (factors a) = count q (factors (p ^ count p (factors a)))
[PROOFSTEP]
rw [count_pow hp.ne_zero hq]
[GOAL]
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
eq_zero_of_ne : ∀ (q : Associates α), Irreducible q → q ≠ p → count q (factors a) = 0
q : Associates α
hq : Irreducible q
⊢ count q (factors a) = count p (factors a) * count q (factors p)
[PROOFSTEP]
by_cases h : q = p
[GOAL]
case pos
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h✝ : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
eq_zero_of_ne : ∀ (q : Associates α), Irreducible q → q ≠ p → count q (factors a) = 0
q : Associates α
hq : Irreducible q
h : q = p
⊢ count q (factors a) = count p (factors a) * count q (factors p)
[PROOFSTEP]
rw [h, count_self hp, mul_one]
[GOAL]
case neg
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
p a : Associates α
hp : Irreducible p
n : ℕ
h✝ : a ∣ p ^ n
✝ : Nontrivial α
hph : p ^ n ≠ 0
ha : a ≠ 0
eq_zero_of_ne : ∀ (q : Associates α), Irreducible q → q ≠ p → count q (factors a) = 0
q : Associates α
hq : Irreducible q
h : ¬q = p
⊢ count q (factors a) = count p (factors a) * count q (factors p)
[PROOFSTEP]
rw [count_eq_zero_of_ne hq hp h, mul_zero, eq_zero_of_ne q hq h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) = count p (factors a)
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) ≤ count p (factors a)
[PROOFSTEP]
refine' Nat.find_le ⟨1, _⟩
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ p ^ count p (factors a) = a * 1
[PROOFSTEP]
rw [mul_one]
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ p ^ count p (factors a) = a
[PROOFSTEP]
symm
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ a = p ^ count p (factors a)
[PROOFSTEP]
exact eq_pow_count_factors_of_dvd_pow hp h
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ count p (factors a) ≤ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
have hph := pow_ne_zero (@Nat.find (fun n => a ∣ p ^ n) _ ⟨n, h⟩) hp.ne_zero
[GOAL]
case a
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
hph : p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) ≠ 0
⊢ count p (factors a) ≤ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
cases' subsingleton_or_nontrivial α with hα hα
[GOAL]
case a.inl
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
hph : p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) ≠ 0
hα : Subsingleton α
⊢ count p (factors a) ≤ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
simp at hph
[GOAL]
case a.inr
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
hph : p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) ≠ 0
hα : Nontrivial α
⊢ count p (factors a) ≤ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
convert count_le_count_of_le hph hp (@Nat.find_spec (fun n => a ∣ p ^ n) _ ⟨n, h⟩)
[GOAL]
case h.e'_4
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
hph : p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) ≠ 0
hα : Nontrivial α
⊢ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n) = count p (factors (p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)))
[PROOFSTEP]
rw [count_pow hp.ne_zero hp, count_self hp, mul_one]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
⊢ ∃ d, a = d ^ k
[PROOFSTEP]
classical
by_cases hk0 : k = 0
· use 1
  rw [hk0, pow_zero] at h ⊢
  apply (mul_eq_one_iff.1 h).1
· refine' is_pow_of_dvd_count ha _
  intro p hp
  apply dvd_count_of_dvd_count_mul hb hp hab
  rw [h]
  apply dvd_count_pow _ hp
  rintro rfl
  rw [zero_pow' _ hk0] at h
  cases mul_eq_zero.mp h <;> contradiction
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
⊢ ∃ d, a = d ^ k
[PROOFSTEP]
by_cases hk0 : k = 0
[GOAL]
case pos
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : k = 0
⊢ ∃ d, a = d ^ k
[PROOFSTEP]
use 1
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : k = 0
⊢ a = 1 ^ k
[PROOFSTEP]
rw [hk0, pow_zero] at h ⊢
[GOAL]
case h
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = 1
hk0 : k = 0
⊢ a = 1
[PROOFSTEP]
apply (mul_eq_one_iff.1 h).1
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
⊢ ∃ d, a = d ^ k
[PROOFSTEP]
refine' is_pow_of_dvd_count ha _
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
⊢ ∀ (p : Associates α), Irreducible p → k ∣ count p (factors a)
[PROOFSTEP]
intro p hp
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
⊢ k ∣ count p (factors a)
[PROOFSTEP]
apply dvd_count_of_dvd_count_mul hb hp hab
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
⊢ k ∣ count p (factors (a * b))
[PROOFSTEP]
rw [h]
[GOAL]
case neg
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
⊢ k ∣ count p (factors (c ^ k))
[PROOFSTEP]
apply dvd_count_pow _ hp
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b c : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
h : a * b = c ^ k
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
⊢ c ≠ 0
[PROOFSTEP]
rintro rfl
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
h : a * b = 0 ^ k
⊢ False
[PROOFSTEP]
rw [zero_pow' _ hk0] at h
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
h : a * b = 0
⊢ False
[PROOFSTEP]
cases mul_eq_zero.mp h
[GOAL]
case inl
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
h : a * b = 0
h✝ : a = 0
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case inr
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
inst✝ : Nontrivial α
a b : Associates α
ha : a ≠ 0
hb : b ≠ 0
hab : ∀ (d : Associates α), d ∣ a → d ∣ b → ¬Prime d
k : ℕ
hk0 : ¬k = 0
p : Associates α
hp : Irreducible p
h : a * b = 0
h✝ : b = 0
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ a = p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
classical rw [count_factors_eq_find_of_dvd_pow hp, ← eq_pow_count_factors_of_dvd_pow hp h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ a = p ^ Nat.find (_ : ∃ n, (fun n => a ∣ p ^ n) n)
[PROOFSTEP]
rw [count_factors_eq_find_of_dvd_pow hp, ← eq_pow_count_factors_of_dvd_pow hp h]
[GOAL]
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ a ∣ p ^ ?m.3699339
α : Type u_1
inst✝² : CancelCommMonoidWithZero α
dec_irr : (p : Associates α) → Decidable (Irreducible p)
inst✝¹ : UniqueFactorizationMonoid α
dec : DecidableEq α
dec' : DecidableEq (Associates α)
a p : Associates α
hp : Irreducible p
inst✝ : (n : ℕ) → Decidable (a ∣ p ^ n)
n : ℕ
h : a ∣ p ^ n
⊢ ℕ
[PROOFSTEP]
exact h
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝ : CommMonoid α
a : Associates α
⊢ Associates.mk (Quot.out a) = a
[PROOFSTEP]
rw [← quot_mk_eq_mk, Quot.out_eq]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b : α
⊢ (fun a b => Quot.out (Associates.mk a ⊓ Associates.mk b)) a b ∣ a
[PROOFSTEP]
rw [← mk_dvd_mk, (Associates.mk a ⊓ Associates.mk b).quot_out, congr_fun₂ dvd_eq_le]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b : α
⊢ Associates.mk a ⊓ Associates.mk b ≤ Associates.mk a
[PROOFSTEP]
exact inf_le_left
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b : α
⊢ (fun a b => Quot.out (Associates.mk a ⊓ Associates.mk b)) a b ∣ b
[PROOFSTEP]
rw [← mk_dvd_mk, (Associates.mk a ⊓ Associates.mk b).quot_out, congr_fun₂ dvd_eq_le]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b : α
⊢ Associates.mk a ⊓ Associates.mk b ≤ Associates.mk b
[PROOFSTEP]
exact inf_le_right
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b c : α
hac : a ∣ c
hab : a ∣ b
⊢ a ∣ (fun a b => Quot.out (Associates.mk a ⊓ Associates.mk b)) c b
[PROOFSTEP]
rw [← mk_dvd_mk, (Associates.mk c ⊓ Associates.mk b).quot_out, congr_fun₂ dvd_eq_le, le_inf_iff, mk_le_mk_iff_dvd_iff,
  mk_le_mk_iff_dvd_iff]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b c : α
hac : a ∣ c
hab : a ∣ b
⊢ a ∣ c ∧ a ∣ b
[PROOFSTEP]
exact ⟨hac, hab⟩
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a b : α
⊢ (fun a b => Quot.out (Associates.mk a ⊓ Associates.mk b)) a b *
      (fun a b => Quot.out (Associates.mk a ⊔ Associates.mk b)) a b ~ᵤ
    a * b
[PROOFSTEP]
rw [← mk_eq_mk_iff_associated, ← Associates.mk_mul_mk, ← associated_iff_eq, Associates.quot_out, Associates.quot_out,
  mul_comm, sup_mul_inf, Associates.mk_mul_mk]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
⊢ (fun a b => Quot.out (Associates.mk a ⊔ Associates.mk b)) 0 a = 0
[PROOFSTEP]
have : Associates.mk (0 : α) = ⊤ := rfl
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
this : Associates.mk 0 = ⊤
⊢ (fun a b => Quot.out (Associates.mk a ⊔ Associates.mk b)) 0 a = 0
[PROOFSTEP]
dsimp
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
this : Associates.mk 0 = ⊤
⊢ Quot.out (Associates.mk 0 ⊔ Associates.mk a) = 0
[PROOFSTEP]
rw [this, top_sup_eq, ← this, ← associated_zero_iff_eq_zero, ← mk_eq_mk_iff_associated, ← associated_iff_eq,
  Associates.quot_out]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
⊢ (fun a b => Quot.out (Associates.mk a ⊔ Associates.mk b)) a 0 = 0
[PROOFSTEP]
have : Associates.mk (0 : α) = ⊤ := rfl
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
this : Associates.mk 0 = ⊤
⊢ (fun a b => Quot.out (Associates.mk a ⊔ Associates.mk b)) a 0 = 0
[PROOFSTEP]
dsimp
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
a : α
this : Associates.mk 0 = ⊤
⊢ Quot.out (Associates.mk a ⊔ Associates.mk 0) = 0
[PROOFSTEP]
rw [this, sup_top_eq, ← this, ← associated_zero_iff_eq_zero, ← mk_eq_mk_iff_associated, ← associated_iff_eq,
  Associates.quot_out]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b c : α
hac : a ∣ c
hab : a ∣ b
⊢ a ∣ Associates.out (Associates.mk c ⊓ Associates.mk b)
[PROOFSTEP]
rw [dvd_out_iff, le_inf_iff, mk_le_mk_iff_dvd_iff, mk_le_mk_iff_dvd_iff]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b c : α
hac : a ∣ c
hab : a ∣ b
⊢ a ∣ c ∧ a ∣ b
[PROOFSTEP]
exact ⟨hac, hab⟩
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ (fun a b => Associates.out (Associates.mk a ⊓ Associates.mk b)) a b *
      (fun a b => Associates.out (Associates.mk a ⊔ Associates.mk b)) a b ~ᵤ
    a * b
[PROOFSTEP]
rw [← out_mul, mul_comm, sup_mul_inf, mk_mul_mk, out_mk]
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ ↑normalize (a * b) ~ᵤ a * b
[PROOFSTEP]
exact normalize_associated (a * b)
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a : α
⊢ Associates.out (⊤ ⊔ Associates.mk a) = 0
[PROOFSTEP]
simp
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a : α
⊢ Associates.out (Associates.mk a ⊔ ⊤) = 0
[PROOFSTEP]
simp
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ ↑normalize (gcd a b) = gcd a b
[PROOFSTEP]
congr
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ ↑normalize (gcd a b) = gcd a b
[PROOFSTEP]
apply normalize_out _
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ ↑normalize (lcm a b) = lcm a b
[PROOFSTEP]
congr
[GOAL]
α✝ : Type u_1
α : Type u_2
inst✝⁴ : CancelCommMonoidWithZero α
inst✝³ : UniqueFactorizationMonoid α
inst✝² : NormalizationMonoid α
inst✝¹ : DecidableEq (Associates α)
inst✝ : DecidableEq α
src✝ : NormalizationMonoid α := inst✝²
a b : α
⊢ ↑normalize (lcm a b) = lcm a b
[PROOFSTEP]
apply normalize_out _
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
⊢ Fintype { x // x ∣ y }
[PROOFSTEP]
haveI : Nontrivial M := ⟨⟨y, 0, hy⟩⟩
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this : Nontrivial M
⊢ Fintype { x // x ∣ y }
[PROOFSTEP]
haveI : NormalizationMonoid M := UniqueFactorizationMonoid.normalizationMonoid
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝ : Nontrivial M
this : NormalizationMonoid M
⊢ Fintype { x // x ∣ y }
[PROOFSTEP]
haveI := Classical.decEq M
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝¹ : Nontrivial M
this✝ : NormalizationMonoid M
this : DecidableEq M
⊢ Fintype { x // x ∣ y }
[PROOFSTEP]
haveI :=
  Classical.decEq
    (Associates M)
      -- We'll show `λ (u : Mˣ) (f ⊆ factors y) → u * Π f` is injective
        -- and has image exactly the divisors of `y`.
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
⊢ Fintype { x // x ∣ y }
[PROOFSTEP]
refine'
  Fintype.ofFinset
    (((normalizedFactors y).powerset.toFinset ×ˢ (Finset.univ : Finset Mˣ)).image fun s => (s.snd : M) * s.fst.prod)
    fun x => _
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
⊢ x ∈
      Finset.image (fun s => ↑s.snd * Multiset.prod s.fst)
        (Multiset.toFinset (Multiset.powerset (normalizedFactors y)) ×ˢ Finset.univ) ↔
    x ∈ fun x => ∃ c, y = x * c
[PROOFSTEP]
simp only [exists_prop, Finset.mem_image, Finset.mem_product, Finset.mem_univ, and_true_iff, Multiset.mem_toFinset,
  Multiset.mem_powerset, exists_eq_right, Multiset.mem_map]
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
⊢ (∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x) ↔ x ∈ fun x => ∃ c, y = x * c
[PROOFSTEP]
constructor
[GOAL]
case mp
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
⊢ (∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x) → x ∈ fun x => ∃ c, y = x * c
[PROOFSTEP]
rintro ⟨s, hs, rfl⟩
[GOAL]
case mp.intro.intro
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
s : Multiset M × Mˣ
hs : s.fst ≤ normalizedFactors y
⊢ ↑s.snd * Multiset.prod s.fst ∈ fun x => ∃ c, y = x * c
[PROOFSTEP]
show (s.snd : M) * s.fst.prod ∣ y
[GOAL]
case mp.intro.intro
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
s : Multiset M × Mˣ
hs : s.fst ≤ normalizedFactors y
⊢ ↑s.snd * Multiset.prod s.fst ∣ y
[PROOFSTEP]
rw [(unit_associated_one.mul_right s.fst.prod).dvd_iff_dvd_left, one_mul, ←
  (normalizedFactors_prod hy).dvd_iff_dvd_right]
[GOAL]
case mp.intro.intro
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
s : Multiset M × Mˣ
hs : s.fst ≤ normalizedFactors y
⊢ Multiset.prod s.fst ∣ Multiset.prod (normalizedFactors y)
[PROOFSTEP]
exact Multiset.prod_dvd_prod_of_le hs
[GOAL]
case mpr
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
⊢ (x ∈ fun x => ∃ c, y = x * c) → ∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x
[PROOFSTEP]
rintro (h : x ∣ y)
[GOAL]
case mpr
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
⊢ ∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x
[PROOFSTEP]
have hx : x ≠ 0 := by
  refine' mt (fun hx => _) hy
  rwa [hx, zero_dvd_iff] at h
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
⊢ x ≠ 0
[PROOFSTEP]
refine' mt (fun hx => _) hy
[GOAL]
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
hx : x = 0
⊢ y = 0
[PROOFSTEP]
rwa [hx, zero_dvd_iff] at h
[GOAL]
case mpr
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
hx : x ≠ 0
⊢ ∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x
[PROOFSTEP]
obtain ⟨u, hu⟩ := normalizedFactors_prod hx
[GOAL]
case mpr.intro
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
hx : x ≠ 0
u : Mˣ
hu : Multiset.prod (normalizedFactors x) * ↑u = x
⊢ ∃ a, a.fst ≤ normalizedFactors y ∧ ↑a.snd * Multiset.prod a.fst = x
[PROOFSTEP]
refine' ⟨⟨normalizedFactors x, u⟩, _, (mul_comm _ _).trans hu⟩
[GOAL]
case mpr.intro
α : Type u_1
M : Type u_2
inst✝² : CancelCommMonoidWithZero M
inst✝¹ : UniqueFactorizationMonoid M
inst✝ : Fintype Mˣ
y : M
hy : y ≠ 0
this✝² : Nontrivial M
this✝¹ : NormalizationMonoid M
this✝ : DecidableEq M
this : DecidableEq (Associates M)
x : M
h : x ∣ y
hx : x ≠ 0
u : Mˣ
hu : Multiset.prod (normalizedFactors x) * ↑u = x
⊢ (normalizedFactors x, u).fst ≤ normalizedFactors y
[PROOFSTEP]
exact (dvd_iff_normalizedFactors_le_normalizedFactors hx hy).mp h
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
n p : α
⊢ ↑(factorization n) p = Multiset.count p (normalizedFactors n)
[PROOFSTEP]
simp [factorization]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
⊢ factorization 0 = 0
[PROOFSTEP]
simp [factorization]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
⊢ factorization 1 = 0
[PROOFSTEP]
simp [factorization]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
n : α
⊢ (factorization n).support = Multiset.toFinset (normalizedFactors n)
[PROOFSTEP]
simp [factorization, Multiset.toFinsupp_support]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
a b : α
ha : a ≠ 0
hb : b ≠ 0
⊢ factorization (a * b) = factorization a + factorization b
[PROOFSTEP]
simp [factorization, normalizedFactors_mul ha hb]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
x : α
n : ℕ
⊢ factorization (x ^ n) = n • factorization x
[PROOFSTEP]
ext
[GOAL]
case h
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
x : α
n : ℕ
a✝ : α
⊢ ↑(factorization (x ^ n)) a✝ = ↑(n • factorization x) a✝
[PROOFSTEP]
simp [factorization]
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : factorization a = factorization b
⊢ a ~ᵤ b
[PROOFSTEP]
simp_rw [factorization, AddEquiv.apply_eq_iff_eq] at h
[GOAL]
α : Type u_1
inst✝³ : CancelCommMonoidWithZero α
inst✝² : UniqueFactorizationMonoid α
inst✝¹ : NormalizationMonoid α
inst✝ : DecidableEq α
a b : α
ha : a ≠ 0
hb : b ≠ 0
h : normalizedFactors a = normalizedFactors b
⊢ a ~ᵤ b
[PROOFSTEP]
rwa [associated_iff_normalizedFactors_eq_normalizedFactors ha hb]