diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_BigOperators_Associated.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_BigOperators_Associated.jsonl" new file mode 100644--- /dev/null +++ "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_BigOperators_Associated.jsonl" @@ -0,0 +1,61 @@ +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : p ∣ Multiset.prod s → ∃ a ∈ s, p ∣ a\nh : p ∣ Multiset.prod (a ::ₘ s)\n⊢ p ∣ a * Multiset.prod s","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by ","nextTactic":"simpa using h","declUpToTactic":"theorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.31_0.AdwSghD3sWCb53j","decl":"theorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoidWithZero α\np : α\nhp : Prime p\ns : Multiset β\nf : β → α\nh : p ∣ Multiset.prod (Multiset.map f s)\n⊢ ∃ a ∈ s, p ∣ f a","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n ","nextTactic":"simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h","declUpToTactic":"theorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.41_0.AdwSghD3sWCb53j","decl":"theorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns : Finset ι\nf g : ι → M\nh : ∀ i ∈ s, f i ~ᵤ g i\n⊢ ∏ i in s, f i ~ᵤ ∏ i in s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n ","nextTactic":"induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns : Finset ι\nf g : ι → M\nh : ∀ i ∈ s, f i ~ᵤ g i\n⊢ ∏ i in s, f i ~ᵤ ∏ i in s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n ","nextTactic":"induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case empty\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\nf g : ι → M\nh : ∀ i ∈ ∅, f i ~ᵤ g i\n⊢ ∏ i in ∅, f i ~ᵤ ∏ i in ∅, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n ","nextTactic":"| empty =>\n simp only [Finset.prod_empty]\n rfl","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case empty\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\nf g : ι → M\nh : ∀ i ∈ ∅, f i ~ᵤ g i\n⊢ ∏ i in ∅, f i ~ᵤ ∏ i in ∅, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n ","nextTactic":"simp only [Finset.prod_empty]","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case empty\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\nf g : ι → M\nh : ∀ i ∈ ∅, f i ~ᵤ g i\n⊢ 1 ~ᵤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n ","nextTactic":"rfl","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ ∏ i in insert j s, f i ~ᵤ ∏ i in insert j s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n ","nextTactic":"| @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ ∏ i in insert j s, f i ~ᵤ ∏ i in insert j s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n ","nextTactic":"classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ ∏ i in insert j s, f i ~ᵤ ∏ i in insert j s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n ","nextTactic":"convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ ∏ i in insert j s, f i ~ᵤ ∏ i in insert j s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n ","nextTactic":"rw [Finset.prod_insert hjs]","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ f j * ∏ x in s, f x ~ᵤ ∏ i in insert j s, g i","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n ","nextTactic":"rw [Finset.prod_insert hjs]","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"case insert\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\nM : Type u_5\ninst✝ : CommMonoid M\nι : Type u_6\ns✝ : Finset ι\nf g : ι → M\nj : ι\ns : Finset ι\nhjs : j ∉ s\nIH : (∀ i ∈ s, f i ~ᵤ g i) → ∏ i in s, f i ~ᵤ ∏ i in s, g i\nh : ∀ i ∈ insert j s, f i ~ᵤ g i\n⊢ f j * ∏ x in s, f x ~ᵤ g j * ∏ x in s, g x","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n ","nextTactic":"exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))","declUpToTactic":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.60_0.AdwSghD3sWCb53j","decl":"theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns : Multiset α\n⊢ (∀ r ∈ 0, Prime r) → p ∣ Multiset.prod 0 → ∃ q ∈ 0, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by ","nextTactic":"simp [mt isUnit_iff_dvd_one.2 hp.not_unit]","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ Multiset.prod (a ::ₘ s)\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n ","nextTactic":"rw [Multiset.prod_cons] at hps","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ a * Multiset.prod s\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n ","nextTactic":"cases' hp.dvd_or_dvd hps with h h","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"case inl\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ a * Multiset.prod s\nh : p ∣ a\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · ","nextTactic":"have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"case inl\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ a * Multiset.prod s\nh : p ∣ a\nhap : Prime a\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n ","nextTactic":"exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"case inr\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ a * Multiset.prod s\nh : p ∣ Multiset.prod s\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · ","nextTactic":"rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"case inr.intro.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\np : α\nhp : Prime p\ns✝ : Multiset α\na : α\ns : Multiset α\nih : (∀ r ∈ s, Prime r) → p ∣ Multiset.prod s → ∃ q ∈ s, p ~ᵤ q\nhs : ∀ r ∈ a ::ₘ s, Prime r\nhps : p ∣ a * Multiset.prod s\nh : p ∣ Multiset.prod s\nq : α\nhq₁ : q ∈ s\nhq₂ : p ~ᵤ q\n⊢ ∃ q ∈ a ::ₘ s, p ~ᵤ q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n ","nextTactic":"exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩","declUpToTactic":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.74_0.AdwSghD3sWCb53j","decl":"theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\ns : Multiset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\nuniq : ∀ (a : α), countP (Associated a) s ≤ 1\n⊢ prod s ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n ","nextTactic":"induction' s using Multiset.induction_on with a s induct n primes divs generalizing n","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case empty\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\nn : α\nh : ∀ a ∈ 0, Prime a\ndiv : ∀ a ∈ 0, a ∣ n\nuniq : ∀ (a : α), countP (Associated a) 0 ≤ 1\n⊢ prod 0 ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · ","nextTactic":"simp only [Multiset.prod_zero, one_dvd]","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nn : α\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ n\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\n⊢ prod (a ::ₘ s) ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · ","nextTactic":"rw [Multiset.prod_cons]","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nn : α\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ n\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\n⊢ a * prod s ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n ","nextTactic":"obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\n⊢ a * prod s ∣ a * k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n ","nextTactic":"apply mul_dvd_mul_left a","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\n⊢ prod s ∣ k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n ","nextTactic":"refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\n⊢ b ∣ k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod ��� ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · ","nextTactic":"have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\n⊢ b ∣ k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n ","nextTactic":"have a_prime := h a (Multiset.mem_cons_self a s)","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\n⊢ b ∣ k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n ","nextTactic":"have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\nb_prime : Prime b\n⊢ b ∣ k","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n ","nextTactic":"refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\nb_prime : Prime b\nb_div_a : b ∣ a\n⊢ False","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n ","nextTactic":"have assoc := b_prime.associated_of_dvd a_prime b_div_a","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\nb_prime : Prime b\nb_div_a : b ∣ a\nassoc : b ~ᵤ a\n⊢ False","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n ","nextTactic":"have := uniq a","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\nb_prime : Prime b\nb_div_a : b ∣ a\nassoc : b ~ᵤ a\nthis : countP (Associated a) (a ::ₘ s) ≤ 1\n⊢ False","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n ","nextTactic":"rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"case cons.intro\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : (a : α) → DecidablePred (Associated a)\na : α\ns : Multiset α\ninduct : ∀ (n : α), (∀ a ∈ s, Prime a) → (∀ a ∈ s, a ∣ n) → (∀ (a : α), countP (Associated a) s ≤ 1) → prod s ∣ n\nh : ∀ a_1 ∈ a ::ₘ s, Prime a_1\nuniq : ∀ (a_1 : α), countP (Associated a_1) (a ::ₘ s) ≤ 1\nk : α\ndiv : ∀ a_1 ∈ a ::ₘ s, a_1 ∣ a * k\nb : α\nb_in_s : b ∈ s\nb_div_n : b ∣ a * k\na_prime : Prime a\nb_prime : Prime b\nb_div_a : b ∣ a\nassoc : b ~ᵤ a\nthis : ¬∃ a_1 ∈ s, a ~ᵤ a_1\n⊢ False","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n ","nextTactic":"exact this ⟨b, b_in_s, assoc.symm⟩","declUpToTactic":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.85_0.AdwSghD3sWCb53j","decl":"theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\n⊢ ∏ p in s, p ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n ","nextTactic":"classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\n⊢ ∏ p in s, p ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n ","nextTactic":"exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\n⊢ ∀ a ∈ Multiset.map (fun p => p) s.val, Prime a","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by ","nextTactic":"simpa only [Multiset.map_id', Finset.mem_def] using h","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\n⊢ ∀ a ∈ Multiset.map (fun p => p) s.val, a ∣ n","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by ","nextTactic":"simpa only [Multiset.map_id', Finset.mem_def] using div","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\n⊢ ∀ (a : α), Multiset.countP (Associated a) (Multiset.map (fun p => p) s.val) ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n ","nextTactic":"intro a","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\na : α\n⊢ Multiset.countP (Associated a) (Multiset.map (fun p => p) s.val) ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : �� → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n ","nextTactic":"simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\na : α\n⊢ Multiset.card (Multiset.filter (Eq a) s.val) ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n ","nextTactic":"change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\na : α\n⊢ Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n ","nextTactic":"apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\na : α\n⊢ Multiset.count a s.val ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n ","nextTactic":"apply Multiset.nodup_iff_count_le_one.mp","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"case a\nα : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝¹ : CancelCommMonoidWithZero α\ninst✝ : Unique αˣ\ns : Finset α\nn : α\nh : ∀ a ∈ s, Prime a\ndiv : ∀ a ∈ s, a ∣ n\na : α\n⊢ Multiset.Nodup s.val","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h���\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n ","nextTactic":"exact s.nodup","declUpToTactic":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.106_0.AdwSghD3sWCb53j","decl":"theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Multiset α\n⊢ Multiset.prod (Multiset.map Associates.mk 0) = Associates.mk (Multiset.prod 0)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by ","nextTactic":"simp","declUpToTactic":"theorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.130_0.AdwSghD3sWCb53j","decl":"theorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Multiset α\na : α\ns : Multiset α\nih : Multiset.prod (Multiset.map Associates.mk s) = Associates.mk (Multiset.prod s)\n⊢ Multiset.prod (Multiset.map Associates.mk (a ::ₘ s)) = Associates.mk (Multiset.prod (a ::ₘ s))","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by ","nextTactic":"simp [ih, Associates.mk_mul_mk]","declUpToTactic":"theorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.130_0.AdwSghD3sWCb53j","decl":"theorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Finset β\nf : β → α\n⊢ ∏ i in p, Associates.mk (f i) = Associates.mk (∏ i in p, f i)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n ","nextTactic":"have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply","declUpToTactic":"theorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.134_0.AdwSghD3sWCb53j","decl":"theorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Finset β\nf : β → α\nthis : (fun i => Associates.mk (f i)) = Associates.mk ∘ f\n⊢ ∏ i in p, Associates.mk (f i) = Associates.mk (∏ i in p, f i)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n ","nextTactic":"rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]","declUpToTactic":"theorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.134_0.AdwSghD3sWCb53j","decl":"theorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset α\n⊢ Multiset.Rel Associated p q ↔ Multiset.map Associates.mk p = Multiset.map Associates.mk q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n ","nextTactic":"rw [← Multiset.rel_eq]","declUpToTactic":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.143_0.AdwSghD3sWCb53j","decl":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset α\n⊢ Multiset.Rel Associated p q ↔\n Multiset.Rel (fun x x_1 => x = x_1) (Multiset.map Associates.mk p) (Multiset.map Associates.mk q)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n ","nextTactic":"rw [Multiset.rel_map]","declUpToTactic":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.143_0.AdwSghD3sWCb53j","decl":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset α\n⊢ Multiset.Rel Associated p q ↔ Multiset.Rel (fun a b => Associates.mk a = Associates.mk b) p q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n ","nextTactic":"simp only [mk_eq_mk_iff_associated]","declUpToTactic":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.143_0.AdwSghD3sWCb53j","decl":"theorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Multiset (Associates α)\n⊢ Multiset.prod 0 = 1 ↔ ∀ a ∈ 0, a = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by ","nextTactic":"simp","declUpToTactic":"theorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.150_0.AdwSghD3sWCb53j","decl":"theorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np : Multiset (Associates α)\n⊢ ∀ ⦃a : Associates α⦄ {s : Multiset (Associates α)},\n (Multiset.prod s = 1 ↔ ∀ a ∈ s, a = 1) → (Multiset.prod (a ::ₘ s) = 1 ↔ ∀ a_2 ∈ a ::ₘ s, a_2 = 1)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by ","nextTactic":"simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and]","declUpToTactic":"theorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.150_0.AdwSghD3sWCb53j","decl":"theorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\n⊢ Multiset.prod p ≤ Multiset.prod q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n ","nextTactic":"haveI := Classical.decEq (Associates α)","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis : DecidableEq (Associates α)\n⊢ Multiset.prod p ≤ Multiset.prod q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u���, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n ","nextTactic":"haveI := Classical.decEq α","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis✝ : DecidableEq (Associates α)\nthis : DecidableEq α\n⊢ Multiset.prod p ≤ Multiset.prod q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n ","nextTactic":"suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis✝¹ : DecidableEq (Associates α)\nthis✝ : DecidableEq α\nthis : Multiset.prod p ≤ Multiset.prod (p + (q - p))\n⊢ Multiset.prod p ≤ Multiset.prod q","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by ","nextTactic":"rwa [add_tsub_cancel_of_le h] at this","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis✝ : DecidableEq (Associates α)\nthis : DecidableEq α\n⊢ Multiset.prod p ≤ Multiset.prod (p + (q - p))","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n ","nextTactic":"suffices p.prod * 1 ≤ p.prod * (q - p).prod by simpa","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis✝¹ : DecidableEq (Associates α)\nthis✝ : DecidableEq α\nthis : Multiset.prod p * 1 ≤ Multiset.prod p * Multiset.prod (q - p)\n⊢ Multiset.prod p ≤ Multiset.prod (p + (q - p))","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n suffices p.prod * 1 ≤ p.prod * (q - p).prod by ","nextTactic":"simpa","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n suffices p.prod * 1 ≤ p.prod * (q - p).prod by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CommMonoid α\np q : Multiset (Associates α)\nh : p ≤ q\nthis✝ : DecidableEq (Associates α)\nthis : DecidableEq α\n⊢ Multiset.prod p * 1 ≤ Multiset.prod p * Multiset.prod (q - p)","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n suffices p.prod * 1 ≤ p.prod * (q - p).prod by simpa\n ","nextTactic":"exact mul_mono (le_refl p.prod) one_le","declUpToTactic":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n suffices p.prod * 1 ≤ p.prod * (q - p).prod by simpa\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.156_0.AdwSghD3sWCb53j","decl":"theorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod "} +{"state":"α : Type u_1\nβ : Type u_2\nγ : Type u_3\nδ : Type u_4\ninst✝ : CancelCommMonoidWithZero α\ns✝ : Multiset (Associates α)\np : Associates α\nhp : Prime p\na : Associates α\ns : Multiset (Associates α)\nih : p ≤ Multiset.prod s → ∃ a ∈ s, p ≤ a\nh : p ≤ Multiset.prod (a ::ₘ s)\n⊢ p ≤ a * Multiset.prod s","srcUpToTactic":"/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker, Anne Baanen\n-/\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.BigOperators.Finsupp\n\n#align_import algebra.big_operators.associated from \"leanprover-community/mathlib\"@\"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c\"\n\n/-!\n# Products of associated, prime, and irreducible elements.\n\nThis file contains some theorems relating definitions in `Algebra.Associated`\nand products of multisets, finsets, and finsupps.\n\n-/\n\n\nvariable {α β γ δ : Type*}\n\n-- the same local notation used in `Algebra.Associated`\nlocal infixl:50 \" ~ᵤ \" => Associated\n\nopen BigOperators\n\nnamespace Prime\n\nvariable [CommMonoidWithZero α] {p : α} (hp : Prime p)\n\ntheorem exists_mem_multiset_dvd {s : Multiset α} : p ∣ s.prod → ∃ a ∈ s, p ∣ a :=\n Multiset.induction_on s (fun h => (hp.not_dvd_one h).elim) fun a s ih h =>\n have : p ∣ a * s.prod := by simpa using h\n match hp.dvd_or_dvd this with\n | Or.inl h => ⟨a, Multiset.mem_cons_self a s, h⟩\n | Or.inr h =>\n let ⟨a, has, h⟩ := ih h\n ⟨a, Multiset.mem_cons_of_mem has, h⟩\n#align prime.exists_mem_multiset_dvd Prime.exists_mem_multiset_dvd\n\ntheorem exists_mem_multiset_map_dvd {s : Multiset β} {f : β → α} :\n p ∣ (s.map f).prod → ∃ a ∈ s, p ∣ f a := fun h => by\n simpa only [exists_prop, Multiset.mem_map, exists_exists_and_eq_and] using\n hp.exists_mem_multiset_dvd h\n#align prime.exists_mem_multiset_map_dvd Prime.exists_mem_multiset_map_dvd\n\ntheorem exists_mem_finset_dvd {s : Finset β} {f : β → α} : p ∣ s.prod f → ∃ i ∈ s, p ∣ f i :=\n hp.exists_mem_multiset_map_dvd\n#align prime.exists_mem_finset_dvd Prime.exists_mem_finset_dvd\n\nend Prime\n\ntheorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :\n x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=\n ⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,\n ⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,\n fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>\n ⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩\n\ntheorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)\n (g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i in s, f i) ~ᵤ (∏ i in s, g i) := by\n induction s using Finset.induction with\n | empty =>\n simp only [Finset.prod_empty]\n rfl\n | @insert j s hjs IH =>\n classical\n convert_to (∏ i in insert j s, f i) ~ᵤ (∏ i in insert j s, g i)\n rw [Finset.prod_insert hjs]\n rw [Finset.prod_insert hjs]\n exact Associated.mul_mul (h j (Finset.mem_insert_self j s))\n (IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))\n\ntheorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)\n {s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=\n Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by\n rw [Multiset.prod_cons] at hps\n cases' hp.dvd_or_dvd hps with h h\n · have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))\n exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩\n · rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩\n exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩\n#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod\n\ntheorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]\n [∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)\n (div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by\n induction' s using Multiset.induction_on with a s induct n primes divs generalizing n\n · simp only [Multiset.prod_zero, one_dvd]\n · rw [Multiset.prod_cons]\n obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)\n apply mul_dvd_mul_left a\n refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)\n fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)\n · have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)\n have a_prime := h a (Multiset.mem_cons_self a s)\n have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)\n refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _\n have assoc := b_prime.associated_of_dvd a_prime b_div_a\n have := uniq a\n rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,\n Multiset.countP_pos] at this\n exact this ⟨b, b_in_s, assoc.symm⟩\n#align multiset.prod_primes_dvd Multiset.prod_primes_dvd\n\ntheorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s : Finset α} (n : α)\n (h : ∀ a ∈ s, Prime a) (div : ∀ a ∈ s, a ∣ n) : (∏ p in s, p) ∣ n := by\n classical\n exact\n Multiset.prod_primes_dvd n (by simpa only [Multiset.map_id', Finset.mem_def] using h)\n (by simpa only [Multiset.map_id', Finset.mem_def] using div)\n (by\n -- POrting note: was\n -- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←\n -- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`\n intro a\n simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]\n change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1\n apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm\n apply Multiset.nodup_iff_count_le_one.mp\n exact s.nodup)\n#align finset.prod_primes_dvd Finset.prod_primes_dvd\n\nnamespace Associates\n\nsection CommMonoid\n\nvariable [CommMonoid α]\n\ntheorem prod_mk {p : Multiset α} : (p.map Associates.mk).prod = Associates.mk p.prod :=\n Multiset.induction_on p (by simp) fun a s ih => by simp [ih, Associates.mk_mul_mk]\n#align associates.prod_mk Associates.prod_mk\n\ntheorem finset_prod_mk {p : Finset β} {f : β → α} :\n (∏ i in p, Associates.mk (f i)) = Associates.mk (∏ i in p, f i) := by\n -- Porting note: added\n have : (fun i => Associates.mk (f i)) = Associates.mk ∘ f :=\n funext <| fun x => Function.comp_apply\n rw [Finset.prod_eq_multiset_prod, this, ← Multiset.map_map, prod_mk,\n ← Finset.prod_eq_multiset_prod]\n#align associates.finset_prod_mk Associates.finset_prod_mk\n\ntheorem rel_associated_iff_map_eq_map {p q : Multiset α} :\n Multiset.Rel Associated p q ↔ p.map Associates.mk = q.map Associates.mk := by\n rw [← Multiset.rel_eq]\n rw [Multiset.rel_map]\n simp only [mk_eq_mk_iff_associated]\n#align associates.rel_associated_iff_map_eq_map Associates.rel_associated_iff_map_eq_map\n\ntheorem prod_eq_one_iff {p : Multiset (Associates α)} :\n p.prod = 1 ↔ ∀ a ∈ p, (a : Associates α) = 1 :=\n Multiset.induction_on p (by simp)\n (by simp (config := { contextual := true }) [mul_eq_one_iff, or_imp, forall_and])\n#align associates.prod_eq_one_iff Associates.prod_eq_one_iff\n\ntheorem prod_le_prod {p q : Multiset (Associates α)} (h : p ≤ q) : p.prod ≤ q.prod := by\n haveI := Classical.decEq (Associates α)\n haveI := Classical.decEq α\n suffices p.prod ≤ (p + (q - p)).prod by rwa [add_tsub_cancel_of_le h] at this\n suffices p.prod * 1 ≤ p.prod * (q - p).prod by simpa\n exact mul_mono (le_refl p.prod) one_le\n#align associates.prod_le_prod Associates.prod_le_prod\n\nend CommMonoid\n\nsection CancelCommMonoidWithZero\n\nvariable [CancelCommMonoidWithZero α]\n\ntheorem exists_mem_multiset_le_of_prime {s : Multiset (Associates α)} {p : Associates α}\n (hp : Prime p) : p ≤ s.prod → ∃ a ∈ s, p ≤ a :=\n Multiset.induction_on s (fun ⟨d, Eq⟩ => (hp.ne_one (mul_eq_one_iff.1 Eq.symm).1).elim)\n fun a s ih h =>\n have : p ≤ a * s.prod := by ","nextTactic":"simpa using h","declUpToTactic":"theorem exists_mem_multiset_le_of_prime {s : Multiset (Associates α)} {p : Associates α}\n (hp : Prime p) : p ≤ s.prod → ∃ a ∈ s, p ≤ a :=\n Multiset.induction_on s (fun ⟨d, Eq⟩ => (hp.ne_one (mul_eq_one_iff.1 Eq.symm).1).elim)\n fun a s ih h =>\n have : p ≤ a * s.prod := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_BigOperators_Associated.170_0.AdwSghD3sWCb53j","decl":"theorem exists_mem_multiset_le_of_prime {s : Multiset (Associates α)} {p : Associates α}\n (hp : Prime p) : p ≤ s.prod → ∃ a ∈ s, p ≤ a "}