factorization_coarsening_signed_orderings_sum_zero
Lemma 5 of arXiv:2611.18194 in multiplicative form: if W is a multiset of at least two integers > 1 whose product is divisible by the prime q exactly once (W is pointed), then Σ over all coarsenings y of W of (-1)^{|y|-1} N(y) = 0, where N(y) = (|y|-1)!/(c_1!⋯c_s!) and c_i are the multiplicities of the distinct elements of y not divisible by q.
Statement
theorem factorization_coarsening_signed_orderings_sum_zero (q : ℕ) (hq : q.Prime) (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) (hdvd : q ∣ W.prod) (hsq : ¬ q ^ 2 ∣ W.prod) (hcard : 2 ≤ W.card) : ∑ᶠ (y : Multiset ℕ) (_ : IsFactorizationCoarsening W y), ((-1 : ℚ) ^ (y.card - 1) * ((y.card - 1).factorial : ℚ) / ∏ a ∈ (y.filter (fun a => ¬ q ∣ a)).toFinset, (((y.filter (fun a => ¬ q ∣ a)).count a).factorial : ℚ)) = 0
- Source
- arXiv:2611.18194 (The Möbius function of factorizations with a simple prime factor): sanity lemma for the factorization-poset definitions
- Verified
- 17 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 5
- IsFactorizationCoarseningA multiset y is a coarsening of a multiset x of positive integers if x can be partitioned into nonempty groups so that y is the multiset…
- LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - IsNatFactorizationA factorization of a natural number n is a multiset of integers greater than 1 whose product is n.
- setOf_isNatFactorization_finiteEvery natural number has only finitely many factorizations into integers greater than 1.
- Used by 1
- factorization_mobius_simple_primeTheorem 1 of arXiv:2611.18194. Let n = mq where q is a prime not dividing m, and let x be a factorization of n (a multiset of integers…
The proof, explained
The proof evaluates the signed sum of orderings over all factorization coarsenings of a pointed multiset $W = w :: W'$, where $w$ is the unique element divisible by the prime $q$. Each coarsening of $W$ contains a unique element divisible by $q$, either $w$ as a singleton block or $v \cdot w$ for some element $v$ of a base coarsening $z$ of $W'$. This establishes a bijection that fibers the set of all coarsenings of $W$ over the coarsenings $z$ of $W'$. Within each fiber, the isolated term $(-1)^{|z|} |z|! / P(z)$ and the sum of merged terms $\sum_{v \in z} (-1)^{|z|-1} (|z|-1)! \text{count}(v, z) / P(z)$ sum to zero by the identity $\sum_{v \in z} \text{count}(v, z) = |z|$. Summing these vanishing fiber sums over all base coarsenings $z$ shows that the total sum is zero.
The factorial product $P(z) = \prod_{a \in z} (\text{count}(a, z))!$ is strictly positive, and prepending an element $v$ scales $P(z)$ by $\text{count}(v, z) + 1$.
Positivity holds because the factorial of any natural number is strictly positive (`Nat.factorial_pos`). When prepending $v$ to $z$, the index set of distinct elements either gains $v$ or remains unchanged (`Finset.prod_subset`). Isolating the $v$ term (`Finset.mul_prod_erase`), its count increases by one (`Multiset.count_cons_self`), which factors out $\text{count}(v, z) + 1$ via $(n+1)! = (n+1)n!$ (`Nat.factorial_succ`), while for all other elements $a \ne v$ (`Finset.ne_of_mem_erase`) the counts remain unchanged (`Multiset.count_cons_of_ne`).
uses
Nat.factorial_pos,Finset.prod_subset,Finset.mul_prod_erase,Multiset.count_cons_self,Nat.factorial_succ,Finset.prod_congr,Finset.ne_of_mem_erase,Multiset.count_cons_of_nelemma P_pos (z : Multiset ℕ) : 0 < P z := Finset.prod_pos (fun a _ => by exact_mod_cast Nat.factorial_pos _) lemma P_cons (v : ℕ) (z : Multiset ℕ) : P (v ::ₘ z) = ((z.count v + 1 : ℕ) : ℚ) * P z := by unfold P have hsub : z.toFinset ⊆ (v ::ₘ z).toFinset := by intro a ha; simp only [Multiset.mem_toFinset] at ha ⊢; exact Multiset.mem_cons_of_mem ha rw [Finset.prod_subset (f := fun a => ((z.count a).factorial : ℚ)) hsub (fun a _ ha => by rw [Multiset.count_eq_zero.2 (fun h => ha (Multiset.mem_toFinset.2 h))]; simp)] have hv : v ∈ (v ::ₘ z).toFinset := by simp rw [← Finset.mul_prod_erase _ _ hv, ← Finset.mul_prod_erase _ (fun a => ((z.count a).factorial : ℚ)) hv] rw [Multiset.count_cons_self, Nat.factorial_succ] rw [Finset.prod_congr rfl (fun a ha => by have : a ≠ v := Finset.ne_of_mem_erase ha rw [Multiset.count_cons_of_ne this])] push_cast; ring
Factorization coarsenings preserve total products, preserve the condition that all elements exceed $1$, and reflect non-divisibility by $q$.
First, induction on multisets shows that the product of any nonempty multiset of integers strictly greater than $1$ is strictly greater than $1$ (`one_lt_prod_of`). By definition, a coarsening $y$ of $x$ partitions $x$ into nonempty blocks $G$ whose products form $y$. Since each block $g \in G$ satisfies $g \le G.\text{join} = x$ (`le_join_of_mem`), each element $b \in y$ is the product of some nonempty sub-multiset $g \le x$ (`coars_elems`). Consequently, coarsening preserves the total product, $\prod y = \prod x$ (`coars_prod`), every element of $y$ is strictly greater than $1$ whenever all elements of $x$ are (`coars_gt`), and if $q \nmid \prod x$, then $q$ divides no element of $y$ (`coars_ndvd`), because any divisor of $b = \prod g$ also divides $\prod x$ (`Multiset.prod_dvd_prod_of_le`).
uses
one_lt_prod_of,le_join_of_mem,coars_elems,coars_prod,coars_gt,coars_ndvd,Multiset.prod_dvd_prod_of_lelemma one_lt_prod_of {g : Multiset ℕ} (hg : g ≠ 0) (h : ∀ a ∈ g, 1 < a) : 1 < g.prod := by induction g using Multiset.induction_on with | empty => exact absurd rfl hg | cons a g ih => rw [Multiset.prod_cons] have ha := h a (Multiset.mem_cons_self a g) have hp : 0 < g.prod := Multiset.prod_pos (fun b hb => by have := h b (Multiset.mem_cons_of_mem hb); omega) nlinarith lemma le_join_of_mem {g : Multiset ℕ} {G : Multiset (Multiset ℕ)} (hg : g ∈ G) : g ≤ G.join := by obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ rw [Multiset.join_cons]; exact Multiset.le_add_right _ _ lemma coars_elems {x y : Multiset ℕ} (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, ∃ g : Multiset ℕ, g ≠ 0 ∧ g ≤ x ∧ g.prod = b := by obtain ⟨G, hG0, hJ, hM⟩ := h intro b hb rw [← hM, Multiset.mem_map] at hb obtain ⟨g, hg, rfl⟩ := hb exact ⟨g, hG0 g hg, hJ ▸ le_join_of_mem hg, rfl⟩ lemma coars_prod {x y : Multiset ℕ} (h : IsFactorizationCoarsening x y) : y.prod = x.prod := by obtain ⟨G, _, hJ, hM⟩ := h rw [← hM, ← hJ, Multiset.prod_join] lemma coars_gt {x y : Multiset ℕ} (hx : ∀ a ∈ x, 1 < a) (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, 1 < b := by intro b hb obtain ⟨g, hg0, hgx, rfl⟩ := coars_elems h b hb exact one_lt_prod_of hg0 (fun a ha => hx a (Multiset.mem_of_le hgx ha)) lemma coars_ndvd {q : ℕ} {x y : Multiset ℕ} (hx : ¬ q ∣ x.prod) (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, ¬ q ∣ b := by intro b hb hqb obtain ⟨g, _, hgx, rfl⟩ := coars_elems h b hb exact hx (hqb.trans (Multiset.prod_dvd_prod_of_le hgx))
The set of factorization coarsenings of $W$ is finite, and any coarsening of a nonempty multiset is nonempty.
Every coarsening $y$ of $W$ has product $\prod W$ (`coars_prod`) and elements strictly greater than $1$ (`coars_gt`), so $y$ is an integer factorization of $\prod W$. Since the set of integer factorizations of a fixed positive integer is finite (`setOf_isNatFactorization_finite`), the set of coarsenings of $W$ is finite (`coars_finite`). Furthermore, if $y = \emptyset$, then its block multiset $G = \emptyset$ (`Multiset.map_eq_zero`), so $x = G.\text{join} = \emptyset$, which contradicts $x \ne \emptyset$ (`coars_ne_zero`).
uses
setOf_isNatFactorization_finite,coars_finite,coars_ne_zero,Multiset.map_eq_zerolemma coars_finite (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) : {y : Multiset ℕ | IsFactorizationCoarsening W y}.Finite := (setOf_isNatFactorization_finite W.prod).subset (fun y hy => ⟨coars_gt hW hy, coars_prod hy⟩) lemma coars_ne_zero {x y : Multiset ℕ} (hx : x ≠ 0) (h : IsFactorizationCoarsening x y) : y ≠ 0 := by obtain ⟨G, _, hJ, hM⟩ := h rintro rfl rw [Multiset.map_eq_zero] at hM subst hM; simp at hJ; exact hx hJ.symm
Any coarsening $y$ of $w :: W'$ decomposes as $(w \cdot \prod g') :: y'$, where $g' \le W'$ is the block joined with $w$, and either $y'$ or $\prod g' :: y'$ coarsen $W'$.
In any partition $G$ of $w :: W'$, $w$ belongs to some block $g \in G$ (`Multiset.mem_join`). Writing $g = w :: g'$ with $g' \le W'$ and setting $G_0 = G \setminus \{g\}$, the block $g$ produces the element $w \cdot \prod g' \in y$, while $G_0$ produces $y'$. If $g' = \emptyset$, $G_0$ directly partitions $W'$, so $y'$ coarsen $W'$. If $g' \ne \emptyset$, $g' :: G_0$ partitions $W'$, so $\prod g' :: y'$ coarsen $W'$ (`C1`).
uses
C1,Multiset.mem_join,Multiset.join_cons,Multiset.cons_add,Multiset.cons_inj_rightlemma C1 {w : ℕ} {W' y : Multiset ℕ} (h : IsFactorizationCoarsening (w ::ₘ W') y) : ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ g' ≤ W' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') := by obtain ⟨G, hG0, hJ, hM⟩ := h have hw : w ∈ G.join := by rw [hJ]; exact Multiset.mem_cons_self _ _ obtain ⟨g, hg, hwg⟩ := Multiset.mem_join.1 hw obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ obtain ⟨g', rfl⟩ : ∃ g', g = w ::ₘ g' := ⟨g.erase w, (Multiset.cons_erase hwg).symm⟩ simp only [Multiset.join_cons, Multiset.cons_add] at hJ have hW' : W' = g' + G0.join := (Multiset.cons_inj_right w).1 hJ.symm subst hW' refine ⟨g', G0.map Multiset.prod, ?_, Multiset.le_add_right _ _, ?_⟩ · rw [← hM]; simp [Multiset.prod_cons] · have hG0' : ∀ h ∈ G0, h ≠ 0 := fun h hh => hG0 h (Multiset.mem_cons_of_mem hh) split_ifs with hg' · subst hg'; exact ⟨G0, hG0', by simp, rfl⟩ · refine ⟨g' ::ₘ G0, ?_, by simp, by simp⟩ intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · exact hg' · exact hG0' h hh
Given a coarsening $z$ of $W'$, both $w :: z$ and $(v \cdot w) :: (z \setminus \{v\})$ (for any $v \in z$) are valid coarsenings of $w :: W'$.
From a partition $G$ of $W'$ yielding products $z$, adding the singleton block $\{w\}$ to $G$ gives the coarsening $w :: z$ of $w :: W'$ (`C2a`). Alternatively, choosing the block $g \in G$ whose product is $v \in z$ and replacing it with $w :: g$ gives a partition of $w :: W'$ whose products are $(v \cdot w) :: (z \setminus \{v\})$ (`C2b`).
uses
C2a,C2blemma C2a {w : ℕ} {W' z : Multiset ℕ} (h : IsFactorizationCoarsening W' z) : IsFactorizationCoarsening (w ::ₘ W') (w ::ₘ z) := by obtain ⟨G, hG0, hJ, hM⟩ := h refine ⟨{w} ::ₘ G, ?_, ?_, ?_⟩ · intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · simp · exact hG0 h hh · simp [hJ] · simp [hM] lemma C2b {w v : ℕ} {W' z : Multiset ℕ} (h : IsFactorizationCoarsening W' z) (hv : v ∈ z) : IsFactorizationCoarsening (w ::ₘ W') ((v * w) ::ₘ z.erase v) := by obtain ⟨G, hG0, hJ, hM⟩ := h subst hM hJ obtain ⟨g, hg, rfl⟩ := Multiset.mem_map.1 hv obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ refine ⟨(w ::ₘ g) ::ₘ G0, ?_, ?_, ?_⟩ · intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · simp · exact hG0 h (Multiset.mem_cons_of_mem hh) · simp · simp [Multiset.prod_cons, mul_comm]
When $q \mid w$ and $q$ divides no element of $z$, the signed weights simplify to $(-1)^{|z|} |z|! / P(z)$ and $(-1)^{|z|-1} (|z|-1)! / P(z \setminus \{v\})$, and $P(z) = \text{count}(v, z) P(z \setminus \{v\})$.
The weight $fw(q, y)$ filters out elements divisible by $q$ in its denominator product $P$. For $w :: z$, $w$ is filtered out (`Multiset.filter_cons_of_neg`), leaving denominator $P(z)$ and numerator $(-1)^{|z|} |z|!$ (`fw_none`). For $(v \cdot w) :: (z \setminus \{v\})$, the product $v \cdot w$ is divisible by $q$ and filtered out, leaving denominator $P(z \setminus \{v\})$ and size $|z| - 1$ (`fw_some`). Applying `P_cons` to $v :: (z \setminus \{v\}) = z$ gives $P(z) = \text{count}(v, z) P(z \setminus \{v\})$ (`P_erase`).
uses
fw_none,fw_some,P_erase,P_cons,Multiset.filter_cons_of_neglemma fw_none {q w : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) : fw q (w ::ₘ z) = (-1 : ℚ) ^ z.card * (z.card.factorial : ℚ) / P z := by unfold fw rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqw), Multiset.filter_eq_self.2 hz, Multiset.card_cons, Nat.add_sub_cancel] rfl lemma fw_some {q w v : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) (hv : v ∈ z) : fw q ((v * w) ::ₘ z.erase v) = (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) / P (z.erase v) := by unfold fw rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 (dvd_mul_of_dvd_right hqw v)), Multiset.filter_eq_self.2 (fun b hb => hz b (Multiset.mem_of_mem_erase hb)), Multiset.card_cons, Nat.add_sub_cancel, Multiset.card_erase_of_mem hv] rfl lemma P_erase {v : ℕ} {z : Multiset ℕ} (hv : v ∈ z) : P z = ((z.count v : ℕ) : ℚ) * P (z.erase v) := by have h := P_cons v (z.erase v) rw [Multiset.cons_erase hv] at h rw [h] congr 2 rw [← Multiset.count_cons_self v (z.erase v), Multiset.cons_erase hv]
For any nonempty multiset $z$ with no elements divisible by $q$ and any $w$ divisible by $q$, the fiber sum vanishes: $fw(q, w :: z) + \sum_{v \in z.\text{toFinset}} fw(q, (v \cdot w) :: (z \setminus \{v\})) = 0$.
Using `fw_none` and `fw_some`, the sum is $(-1)^{|z|} |z|! / P(z) + \sum_{v \in z} (-1)^{|z|-1} (|z|-1)! / P(z \setminus \{v\})$. By `P_erase`, $1 / P(z \setminus \{v\}) = \text{count}(v, z) / P(z)$. Factoring out $(-1)^{|z|-1} (|z|-1)! / P(z)$, the sum over distinct $v \in z$ becomes $\sum_{v \in z.\text{toFinset}} \text{count}(v, z)$, which equals the total size $|z|$ (`Multiset.toFinset_sum_count_eq`). Since $(-1)^{|z|-1} (|z|-1)! \cdot |z| = - (-1)^{|z|} |z|!$ (`Nat.factorial_succ`), the isolated term and the merged terms cancel completely (`fibre_zero`).
uses
fibre_zero,fw_none,fw_some,P_pos,P_erase,Multiset.toFinset_sum_count_eq,Nat.factorial_succlemma fibre_zero {q w : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) (hz0 : z ≠ 0) : fw q (w ::ₘ z) + ∑ v ∈ z.toFinset, fw q ((v * w) ::ₘ z.erase v) = 0 := by rw [fw_none hqw hz, Finset.sum_congr rfl (fun v hv => fw_some hqw hz (Multiset.mem_toFinset.1 hv))] have hP := P_pos z have key : ∀ v ∈ z.toFinset, (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) / P (z.erase v) = (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) * ((z.count v : ℕ) : ℚ) / P z := by intro v hv have hv' := Multiset.mem_toFinset.1 hv have hc : ((z.count v : ℕ) : ℚ) ≠ 0 := by exact_mod_cast (Multiset.count_pos.2 hv').ne' have hPe := P_pos (z.erase v) rw [P_erase hv'] field_simp rw [Finset.sum_congr rfl key, ← Finset.sum_div, ← Finset.mul_sum, ← Nat.cast_sum, Multiset.toFinset_sum_count_eq] obtain ⟨k, hk⟩ : ∃ k, z.card = k + 1 := ⟨z.card - 1, by have := Multiset.card_pos.2 hz0; omega⟩ rw [hk, Nat.add_sub_cancel, Nat.factorial_succ] field_simp push_cast ring
In $W$, there is a unique element $w$ divisible by $q$; writing $W = w :: W'$, the sum over coarsenings is finite, and every coarsening has a canonical decomposition with respect to $w$.
Since $q$ is prime and $q \mid \prod W$ but $q^2 \nmid \prod W$ (`pow_two`, `mul_dvd_mul`), there is an element $w \in W$ divisible by $q$, so $W = w :: W'$ with $q \nmid \prod W'$ (`Multiset.prod_cons`). The finiteness of coarsenings (`coars_finite`) converts the sum into a finite sum over a `Finset` (`finsum_mem_eq_finite_toFinset_sum`). By `C1`, any coarsening $y$ of $w :: W'$ has the form $(w \cdot \prod g') :: y'$ with $g' \le W'$, where no element of $y'$ is divisible by $q$ (`coars_ndvd`), and $\prod g' > 1$ when $g' \ne 0$ (`one_lt_prod_of`).
uses
coars_finite,finsum_mem_eq_finite_toFinset_sum,C1,coars_ndvd,one_lt_prod_of,Multiset.prod_cons,pow_two,mul_dvd_multheorem lemma5 (q : ℕ) (hq : q.Prime) (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) (hdvd : q ∣ W.prod) (hsq : ¬ q ^ 2 ∣ W.prod) (hcard : 2 ≤ W.card) : ∑ᶠ (y : Multiset ℕ) (_ : IsFactorizationCoarsening W y), fw q y = 0 := by obtain ⟨w, hwW, hqw⟩ := hq.prime.exists_mem_multiset_dvd hdvd obtain ⟨W', rfl⟩ : ∃ W', W = w ::ₘ W' := ⟨W.erase w, (Multiset.cons_erase hwW).symm⟩ have hW'q : ¬ q ∣ W'.prod := by intro h; apply hsq; rw [Multiset.prod_cons, pow_two]; exact mul_dvd_mul hqw h have hW'gt : ∀ a ∈ W', 1 < a := fun a ha => hW a (Multiset.mem_cons_of_mem ha) have hw1 : 1 < w := hW w (Multiset.mem_cons_self _ _) have hW'ne : W' ≠ 0 := by rintro rfl; simp at hcard have hfin := coars_finite _ hW have hfin' := coars_finite _ hW'gt have hmem : ∀ y, y ∈ hfin.toFinset ↔ IsFactorizationCoarsening (w ::ₘ W') y := fun y => Set.Finite.mem_toFinset _ have hmem' : ∀ z, z ∈ hfin'.toFinset ↔ IsFactorizationCoarsening W' z := fun z => Set.Finite.mem_toFinset _ change ∑ᶠ y ∈ {y | IsFactorizationCoarsening (w ::ₘ W') y}, fw q y = 0 rw [finsum_mem_eq_finite_toFinset_sum _ hfin] -- structure of a coarsening have hstruct : ∀ y, IsFactorizationCoarsening (w ::ₘ W') y → ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') ∧ (∀ b ∈ y', ¬ q ∣ b) ∧ (g' ≠ 0 → 1 < g'.prod) := by intro y hy obtain ⟨g', y', rfl, hg'W, hco⟩ := C1 hy refine ⟨g', y', rfl, hco, ?_, fun h0 => one_lt_prod_of h0 (fun a ha => hW'gt a (Multiset.mem_of_le hg'W ha))⟩ intro b hb split_ifs at hco · exact coars_ndvd hW'q hco b hb · exact coars_ndvd hW'q hco b (Multiset.mem_cons_of_mem hb)
The forward map $ii$ assigns each coarsening $y$ of $W$ to a pair $(z, o) \in (\text{coarsenings of } W') \times \text{Option } \mathbb{N}$, and $jj$ reconstructs $y$ from $(z, o)$.
Let $tt(y)$ be the product of all elements of $y$ divisible by $q$. In any coarsening $y = (w \cdot \prod g') :: y'$, $tt(y) = w \cdot \prod g'$ is the unique element divisible by $q$ (`tt_eq`), and the remaining elements are $y'$ (`filt_eq`). If $tt(y) = w$ (so $g' = 0$), $ii(y) = (y', \text{none})$. If $tt(y) \ne w$ (so $g' \ne 0$), $tt(y)/w = \prod g' > 1$ (`dvd_mul_of_dvd_left`), so $ii(y) = (\prod g' :: y', \text{some } \prod g')$. Conversely, $jj(z, \text{none}) = w :: z$ and $jj(z, \text{some } v) = (v \cdot w) :: (z \setminus \{v\})$.
uses
tt_eq,filt_eq,dvd_mul_of_dvd_left,Multiset.filter_cons_of_pos,Multiset.filter_eq_nil,Multiset.filter_cons_of_neg,Multiset.filter_eq_selflet jj : (Σ _ : Multiset ℕ, Option ℕ) → Multiset ℕ := fun p => p.2.elim (w ::ₘ p.1) (fun v => (v * w) ::ₘ p.1.erase v) let tt : Multiset ℕ → ℕ := fun y => (y.filter (fun a => q ∣ a)).prod let ii : Multiset ℕ → (Σ _ : Multiset ℕ, Option ℕ) := fun y => if tt y = w then ⟨y.filter (fun a => ¬ q ∣ a), none⟩ else ⟨(tt y / w) ::ₘ y.filter (fun a => ¬ q ∣ a), some (tt y / w)⟩ have tt_eq : ∀ (t : ℕ) (y' : Multiset ℕ), q ∣ t → (∀ b ∈ y', ¬ q ∣ b) → tt (t ::ₘ y') = t := by intro t y' ht hy' simp only [tt] rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ ht, Multiset.filter_eq_nil.2 hy'] simp have filt_eq : ∀ (t : ℕ) (y' : Multiset ℕ), q ∣ t → (∀ b ∈ y', ¬ q ∣ b) → (t ::ₘ y').filter (fun a => ¬ q ∣ a) = y' := by intro t y' ht hy' rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 ht), Multiset.filter_eq_self.2 hy'] have hii : ∀ y, IsFactorizationCoarsening (w ::ₘ W') y → ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') ∧ (∀ b ∈ y', ¬ q ∣ b) ∧ ii y = (if g' = 0 then ⟨y', none⟩ else ⟨g'.prod ::ₘ y', some g'.prod⟩) := by intro y hy obtain ⟨g', y', rfl, hco, hy', hg1⟩ := hstruct y hy refine ⟨g', y', rfl, hco, hy', ?_⟩ have ht := tt_eq (w * g'.prod) y' (dvd_mul_of_dvd_left hqw _) hy' have hf := filt_eq (w * g'.prod) y' (dvd_mul_of_dvd_left hqw _) hy' simp only [ii, ht, hf] by_cases hg : g' = 0 · subst hg; simp · have h1 := hg1 hg have hne : w * g'.prod ≠ w := by intro h; have : w * g'.prod > w * 1 := Nat.mul_lt_mul_of_pos_left h1 (by omega) omega rw [if_neg hne, if_neg hg, Nat.mul_div_cancel_left _ (by omega : 0 < w)]
By the bijection $(ii, jj)$, the sum over coarsenings of $W$ decomposes into fiber sums over coarsenings $z$ of $W'$, each of which vanishes by `fibre_zero`.
`Finset.sum_nbij'` reindexes the sum over coarsenings of $w :: W'$ into a sum over pairs $(z, o)$ with $z$ coarsening $W'$ and $o \in \{\text{none}\} \cup \{\text{some } v \mid v \in z\}$ (`Finset.mem_sigma`). Splitting this into an iterated sum (`Finset.sum_sigma`, `Finset.sum_insertNone`), the inner sum for each fixed $z$ is $fw(q, w :: z) + \sum_{v \in z} fw(q, (v \cdot w) :: (z \setminus \{v\}))$, which vanishes by `fibre_zero` (using `coars_ndvd` and `coars_ne_zero`). The remaining subgoals verify the bijection hypotheses: $jj$ produces valid coarsenings (`C2a`, `C2b`), $ii$ and $jj$ are mutual inverses (`Option.elim`, `coars_gt`, `Multiset.mem_of_mem_erase`, `dvd_mul_of_dvd_right`, `Multiset.cons_erase`, `mul_comm`), and the summand is preserved, giving a total sum of zero (`Finset.sum_eq_zero`).
uses
Finset.sum_nbij',Finset.sum_sigma,Finset.sum_eq_zero,Finset.sum_insertNone,fibre_zero,coars_ndvd,coars_ne_zero,Finset.mem_sigma,C2a,C2b,Option.elim,coars_gt,Multiset.mem_of_mem_erase,dvd_mul_of_dvd_right,Multiset.cons_erase,mul_commrw [Finset.sum_nbij' ii jj (t := hfin'.toFinset.sigma (fun z => Finset.insertNone z.toFinset)) (g := fun p => fw q (jj p))] · rw [Finset.sum_sigma] apply Finset.sum_eq_zero intro z hz rw [hmem'] at hz rw [Finset.sum_insertNone] exact fibre_zero hqw (coars_ndvd hW'q hz) (coars_ne_zero hW'ne hz) · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy rw [hi, Finset.mem_sigma] split_ifs at hco ⊢ with hg · exact ⟨(hmem' _).2 hco, by simp⟩ · exact ⟨(hmem' _).2 hco, by simp⟩ · rintro ⟨z, o⟩ hp rw [Finset.mem_sigma, hmem'] at hp rw [hmem] obtain ⟨hz, ho⟩ := hp cases o with | none => exact C2a hz | some v => have hv : v ∈ z := by simpa using ho exact C2b hz hv · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy rw [hi] split_ifs with hg · subst hg; simp [jj] · simp [jj, mul_comm] · rintro ⟨z, o⟩ hp rw [Finset.mem_sigma, hmem'] at hp obtain ⟨hz, ho⟩ := hp have hzq := coars_ndvd hW'q hz cases o with | none => simp only [jj, Option.elim] simp only [ii, tt_eq w z hqw hzq, filt_eq w z hqw hzq, if_true] | some v => have hv : v ∈ z := by simpa using ho have hv1 : 1 < v := coars_gt hW'gt hz v hv have hzq' : ∀ b ∈ z.erase v, ¬ q ∣ b := fun b hb => hzq b (Multiset.mem_of_mem_erase hb) have hd : q ∣ v * w := dvd_mul_of_dvd_right hqw v simp only [jj, Option.elim] have hne : v * w ≠ w := by intro h; have : v * w > 1 * w := Nat.mul_lt_mul_of_pos_right hv1 (by omega) omega simp only [ii, tt_eq (v * w) (z.erase v) hd hzq', filt_eq (v * w) (z.erase v) hd hzq', if_neg hne, Nat.mul_div_cancel _ (by omega : 0 < w), Multiset.cons_erase hv] · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy simp only [hi] split_ifs with hg · subst hg; simp [jj] · simp [jj, mul_comm] end FactMobL5
The signed sum of orderings over all factorization coarsenings of $W$ equals zero.
The theorem's summand is by definition the weight function $fw(q, y)$. The result is therefore an immediate application of `FactMobL5.lemma5`.
uses
FactMobL5.lemma5theorem factorization_coarsening_signed_orderings_sum_zero (q : ℕ) (hq : q.Prime) (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) (hdvd : q ∣ W.prod) (hsq : ¬ q ^ 2 ∣ W.prod) (hcard : 2 ≤ W.card) : ∑ᶠ (y : Multiset ℕ) (_ : IsFactorizationCoarsening W y), ((-1 : ℚ) ^ (y.card - 1) * ((y.card - 1).factorial : ℚ) / ∏ a ∈ (y.filter (fun a => ¬ q ∣ a)).toFinset, (((y.filter (fun a => ¬ q ∣ a)).count a).factorial : ℚ)) = 0 := by exact FactMobL5.lemma5 q hq W hW hdvd hsq hcard
C1- Any coarsening $y$ of $w :: W'$ decomposes as $(w \cdot \prod g') :: y'$ with $g' \le W'$, where either $y'$ (if $g'=0$) or $\prod g' :: y'$ (if $g' \ne 0$) coarsen $W'$.
C2a- If $z$ coarsen $W'$, then $w :: z$ coarsen $w :: W'$.
C2b- If $z$ coarsen $W'$ and $v \in z$, then $(v \cdot w) :: (z \setminus \{v\})$ coarsen $w :: W'$.
FactMobL5.lemma5- For any pointed multiset $W$ with $|W| \ge 2$, the signed sum of orderings over all factorization coarsenings of $W$ equals zero.
Finset.sum_sigma- A sum over a dependent sum of finite sets can be expressed as an iterated double sum.
Finset.sum_eq_zero- A sum of zeros over a finite set equals zero.
Finset.sum_insertNone- A sum over `Finset.insertNone s` splits into the value at `none` plus the sum over $s$ at `some x`.
Finset.sum_nbij'- Two sums over finite sets are equal if there is a bijection between their index sets that preserves the summands.
Finset.prod_congr- Two products over equal finite sets are equal if their terms agree on all elements.
Finset.prod_subset- If $s_1 \subseteq s_2$ and a function $f$ evaluates to $1$ outside $s_1$, then $\prod_{x \in s_1} f(x) = \prod_{x \in s_2} f(x)$.
Finset.mul_prod_erase- Splitting an element $a \in s$ from a finite product gives $f(a) \cdot \prod_{x \in s \setminus \{a\}} f(x) = \prod_{x \in s} f(x)$.
Finset.ne_of_mem_erase- Any element in $s \setminus \{a\}$ is not equal to $a$.
Finset.mem_sigma- A dependent pair $\langle a, b \rangle$ belongs to $s.\text{sigma } t$ if and only if $a \in s$ and $b \in t(a)$.
Nat.factorial_pos- For every natural number $n$, its factorial $n!$ is strictly positive.
Nat.factorial_succ- The factorial recurrence $(n + 1)! = (n + 1) \cdot n!$.
Multiset.count_cons_self- Prepending $a$ to a multiset $s$ increases the multiplicity of $a$ by $1$.
Multiset.count_cons_of_ne- Prepending an element $b \ne a$ to a multiset $s$ does not change the multiplicity of $a$.
Multiset.prod_cons- The product of $a :: s$ is $a \cdot \prod s$.
le_join_of_mem- Every block $g$ in a multiset of multisets $G$ is a sub-multiset of the flattened union $G.\text{join}$.
coars_elems- In any coarsening $y$ of $x$, every element $b \in y$ is the product of some nonempty sub-multiset $g \le x$.
coars_prod- Any coarsening $y$ of $x$ has the same product as $x$, namely $\prod y = \prod x$.
coars_gt- If all elements of $x$ are strictly greater than $1$, then all elements of any coarsening $y$ of $x$ are strictly greater than $1$.
coars_ndvd- If $q$ does not divide $\prod x$, then $q$ does not divide any element of any coarsening $y$ of $x$.
Multiset.prod_dvd_prod_of_le- If $s \le t$ as multisets, then the product of $s$ divides the product of $t$.
one_lt_prod_of- The product of any nonempty multiset whose elements are all strictly greater than $1$ is strictly greater than $1$.
setOf_isNatFactorization_finite- For any integer $n$, the set of factorizations of $n$ into integers strictly greater than $1$ is finite.
coars_finite- The set of all factorization coarsenings of a multiset $W$ whose elements are strictly greater than $1$ is finite.
coars_ne_zero- Any coarsening of a nonempty multiset is nonempty.
Multiset.map_eq_zero- Applying a function to a multiset yields the empty multiset if and only if the original multiset is empty.
Multiset.mem_join- An element is in the flattened union $G.\text{join}$ if and only if it belongs to some multiset $g \in G$.
Multiset.join_cons- The flattened union of $s :: S$ is $s + S.\text{join}$.
Multiset.cons_add- Prepending $a$ to the sum of two multisets $s + t$ equals $(a :: s) + t$.
Multiset.cons_inj_right- Prepending $a$ to two multisets gives the same multiset if and only if the two multisets were equal.
fw_none- If $q \mid w$ and $q$ divides no element of $z$, then $fw(q, w :: z) = (-1)^{|z|} |z|! / P(z)$.
fw_some- If $q \mid w$, $q$ divides no element of $z$, and $v \in z$, then $fw(q, (v \cdot w) :: (z \setminus \{v\})) = (-1)^{|z|-1} (|z|-1)! / P(z \setminus \{v\})$.
P_erase- For any element $v \in z$, $P(z) = \text{count}(v, z) \cdot P(z \setminus \{v\})$.
P_cons- Prepending an element $v$ to $z$ scales $P(z)$ by $\text{count}(v, z) + 1$.
Multiset.filter_cons_of_neg- If predicate $p$ is false for $a$, then filtering $a :: s$ by $p$ gives the same result as filtering $s$.
fibre_zero- For $q \mid w$, $q \nmid z$, and $z \ne 0$, the fiber sum $fw(q, w :: z) + \sum_{v \in z.\text{toFinset}} fw(q, (v \cdot w) :: (z \setminus \{v\}))$ equals zero.
P_pos- For any multiset $z$, the denominator product $P(z)$ is strictly positive.
Multiset.toFinset_sum_count_eq- The sum of multiplicities $\text{count}(a, s)$ over all distinct elements in $s$ equals the cardinality $|s|$.
finsum_mem_eq_finite_toFinset_sum- The sum over a finite set defined via `∑ᶠ` equals the standard finite sum `Finset.sum` over its finite set representation.
pow_two- The square $a^2$ is equal to $a \cdot a$.
mul_dvd_mul- If $a \mid b$ and $c \mid d$, then $a c \mid b d$.
tt_eq- The product of elements divisible by $q$ in $t :: y'$ is $t$, provided $q \mid t$ and no element of $y'$ is divisible by $q$.
filt_eq- Filtering out elements divisible by $q$ from $t :: y'$ leaves $y'$, provided $q \mid t$ and no element of $y'$ is divisible by $q$.
dvd_mul_of_dvd_left- If $a \mid b$, then $a \mid b \cdot c$.
Multiset.filter_cons_of_pos- If predicate $p$ is true for $a$, then filtering $a :: s$ by $p$ prepends $a$ to the filtered $s$.
Multiset.filter_eq_nil- If no element of $s$ satisfies $p$, then filtering $s$ by $p$ yields the empty multiset.
Multiset.filter_eq_self- If every element of $s$ satisfies $p$, then filtering $s$ by $p$ yields $s$.
Option.elim- Eliminator for `Option`: evaluates to the default value on `none` and applies the function on `some x`.
Multiset.mem_of_mem_erase- Any element belonging to $s \setminus \{b\}$ also belongs to $s$.
dvd_mul_of_dvd_right- If $a \mid b$, then $a \mid c \cdot b$.
Multiset.cons_erase- For any element $a \in s$, inserting $a$ into $s \setminus \{a\}$ recovers $s$.
mul_comm- Multiplication is commutative: $a \cdot b = b \cdot a$.
- The sum over all coarsenings is formally stated as an infinite sum `∑ᶠ` over the subtype of coarsenings, which is converted via `finsum_mem_eq_finite_toFinset_sum` to a finite sum once finiteness of the set of coarsenings is proved.
- The fiber decomposition is formalized using a dependent pair `Σ z, Option ℕ` rather than an explicit disjoint union: `none` represents leaving $w$ isolated, while `some v` represents merging $w$ into the block containing $v$.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
namespace FactMobL5noncomputable def fw (q : ℕ) (y : Multiset ℕ) : ℚ := (-1 : ℚ) ^ (y.card - 1) * ((y.card - 1).factorial : ℚ) / ∏ a ∈ (y.filter (fun a => ¬ q ∣ a)).toFinset, (((y.filter (fun a => ¬ q ∣ a)).count a).factorial : ℚ)noncomputable def P (z : Multiset ℕ) : ℚ := ∏ a ∈ z.toFinset, ((z.count a).factorial : ℚ)lemma P_pos (z : Multiset ℕ) : 0 < P z := Finset.prod_pos (fun a _ => by exact_mod_cast Nat.factorial_pos _)lemma P_cons (v : ℕ) (z : Multiset ℕ) : P (v ::ₘ z) = ((z.count v + 1 : ℕ) : ℚ) * P z := by unfold P have hsub : z.toFinset ⊆ (v ::ₘ z).toFinset := by intro a ha; simp only [Multiset.mem_toFinset] at ha ⊢; exact Multiset.mem_cons_of_mem ha rw [Finset.prod_subset (f := fun a => ((z.count a).factorial : ℚ)) hsub (fun a _ ha => by rw [Multiset.count_eq_zero.2 (fun h => ha (Multiset.mem_toFinset.2 h))]; simp)] have hv : v ∈ (v ::ₘ z).toFinset := by simp rw [← Finset.mul_prod_erase _ _ hv, ← Finset.mul_prod_erase _ (fun a => ((z.count a).factorial : ℚ)) hv] rw [Multiset.count_cons_self, Nat.factorial_succ] rw [Finset.prod_congr rfl (fun a ha => by have : a ≠ v := Finset.ne_of_mem_erase ha rw [Multiset.count_cons_of_ne this])] push_cast; ringlemma one_lt_prod_of {g : Multiset ℕ} (hg : g ≠ 0) (h : ∀ a ∈ g, 1 < a) : 1 < g.prod := by induction g using Multiset.induction_on with | empty => exact absurd rfl hg | cons a g ih => rw [Multiset.prod_cons] have ha := h a (Multiset.mem_cons_self a g) have hp : 0 < g.prod := Multiset.prod_pos (fun b hb => by have := h b (Multiset.mem_cons_of_mem hb); omega) nlinarithlemma le_join_of_mem {g : Multiset ℕ} {G : Multiset (Multiset ℕ)} (hg : g ∈ G) : g ≤ G.join := by obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ rw [Multiset.join_cons]; exact Multiset.le_add_right _ _lemma coars_elems {x y : Multiset ℕ} (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, ∃ g : Multiset ℕ, g ≠ 0 ∧ g ≤ x ∧ g.prod = b := by obtain ⟨G, hG0, hJ, hM⟩ := h intro b hb rw [← hM, Multiset.mem_map] at hb obtain ⟨g, hg, rfl⟩ := hb exact ⟨g, hG0 g hg, hJ ▸ le_join_of_mem hg, rfl⟩lemma coars_prod {x y : Multiset ℕ} (h : IsFactorizationCoarsening x y) : y.prod = x.prod := by obtain ⟨G, _, hJ, hM⟩ := h rw [← hM, ← hJ, Multiset.prod_join]lemma coars_gt {x y : Multiset ℕ} (hx : ∀ a ∈ x, 1 < a) (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, 1 < b := by intro b hb obtain ⟨g, hg0, hgx, rfl⟩ := coars_elems h b hb exact one_lt_prod_of hg0 (fun a ha => hx a (Multiset.mem_of_le hgx ha))lemma coars_ndvd {q : ℕ} {x y : Multiset ℕ} (hx : ¬ q ∣ x.prod) (h : IsFactorizationCoarsening x y) : ∀ b ∈ y, ¬ q ∣ b := by intro b hb hqb obtain ⟨g, _, hgx, rfl⟩ := coars_elems h b hb exact hx (hqb.trans (Multiset.prod_dvd_prod_of_le hgx))lemma coars_finite (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) : {y : Multiset ℕ | IsFactorizationCoarsening W y}.Finite := (setOf_isNatFactorization_finite W.prod).subset (fun y hy => ⟨coars_gt hW hy, coars_prod hy⟩)lemma coars_ne_zero {x y : Multiset ℕ} (hx : x ≠ 0) (h : IsFactorizationCoarsening x y) : y ≠ 0 := by obtain ⟨G, _, hJ, hM⟩ := h rintro rfl rw [Multiset.map_eq_zero] at hM subst hM; simp at hJ; exact hx hJ.symmlemma C1 {w : ℕ} {W' y : Multiset ℕ} (h : IsFactorizationCoarsening (w ::ₘ W') y) : ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ g' ≤ W' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') := by obtain ⟨G, hG0, hJ, hM⟩ := h have hw : w ∈ G.join := by rw [hJ]; exact Multiset.mem_cons_self _ _ obtain ⟨g, hg, hwg⟩ := Multiset.mem_join.1 hw obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ obtain ⟨g', rfl⟩ : ∃ g', g = w ::ₘ g' := ⟨g.erase w, (Multiset.cons_erase hwg).symm⟩ simp only [Multiset.join_cons, Multiset.cons_add] at hJ have hW' : W' = g' + G0.join := (Multiset.cons_inj_right w).1 hJ.symm subst hW' refine ⟨g', G0.map Multiset.prod, ?_, Multiset.le_add_right _ _, ?_⟩ · rw [← hM]; simp [Multiset.prod_cons] · have hG0' : ∀ h ∈ G0, h ≠ 0 := fun h hh => hG0 h (Multiset.mem_cons_of_mem hh) split_ifs with hg' · subst hg'; exact ⟨G0, hG0', by simp, rfl⟩ · refine ⟨g' ::ₘ G0, ?_, by simp, by simp⟩ intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · exact hg' · exact hG0' h hhlemma C2a {w : ℕ} {W' z : Multiset ℕ} (h : IsFactorizationCoarsening W' z) : IsFactorizationCoarsening (w ::ₘ W') (w ::ₘ z) := by obtain ⟨G, hG0, hJ, hM⟩ := h refine ⟨{w} ::ₘ G, ?_, ?_, ?_⟩ · intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · simp · exact hG0 h hh · simp [hJ] · simp [hM]lemma C2b {w v : ℕ} {W' z : Multiset ℕ} (h : IsFactorizationCoarsening W' z) (hv : v ∈ z) : IsFactorizationCoarsening (w ::ₘ W') ((v * w) ::ₘ z.erase v) := by obtain ⟨G, hG0, hJ, hM⟩ := h subst hM hJ obtain ⟨g, hg, rfl⟩ := Multiset.mem_map.1 hv obtain ⟨G0, rfl⟩ : ∃ G0, G = g ::ₘ G0 := ⟨G.erase g, (Multiset.cons_erase hg).symm⟩ refine ⟨(w ::ₘ g) ::ₘ G0, ?_, ?_, ?_⟩ · intro h hh rcases Multiset.mem_cons.1 hh with rfl | hh · simp · exact hG0 h (Multiset.mem_cons_of_mem hh) · simp · simp [Multiset.prod_cons, mul_comm]lemma fw_none {q w : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) : fw q (w ::ₘ z) = (-1 : ℚ) ^ z.card * (z.card.factorial : ℚ) / P z := by unfold fw rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqw), Multiset.filter_eq_self.2 hz, Multiset.card_cons, Nat.add_sub_cancel] rfllemma fw_some {q w v : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) (hv : v ∈ z) : fw q ((v * w) ::ₘ z.erase v) = (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) / P (z.erase v) := by unfold fw rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 (dvd_mul_of_dvd_right hqw v)), Multiset.filter_eq_self.2 (fun b hb => hz b (Multiset.mem_of_mem_erase hb)), Multiset.card_cons, Nat.add_sub_cancel, Multiset.card_erase_of_mem hv] rfllemma P_erase {v : ℕ} {z : Multiset ℕ} (hv : v ∈ z) : P z = ((z.count v : ℕ) : ℚ) * P (z.erase v) := by have h := P_cons v (z.erase v) rw [Multiset.cons_erase hv] at h rw [h] congr 2 rw [← Multiset.count_cons_self v (z.erase v), Multiset.cons_erase hv]lemma fibre_zero {q w : ℕ} (hqw : q ∣ w) {z : Multiset ℕ} (hz : ∀ b ∈ z, ¬ q ∣ b) (hz0 : z ≠ 0) : fw q (w ::ₘ z) + ∑ v ∈ z.toFinset, fw q ((v * w) ::ₘ z.erase v) = 0 := by rw [fw_none hqw hz, Finset.sum_congr rfl (fun v hv => fw_some hqw hz (Multiset.mem_toFinset.1 hv))] have hP := P_pos z have key : ∀ v ∈ z.toFinset, (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) / P (z.erase v) = (-1 : ℚ) ^ (z.card - 1) * ((z.card - 1).factorial : ℚ) * ((z.count v : ℕ) : ℚ) / P z := by intro v hv have hv' := Multiset.mem_toFinset.1 hv have hc : ((z.count v : ℕ) : ℚ) ≠ 0 := by exact_mod_cast (Multiset.count_pos.2 hv').ne' have hPe := P_pos (z.erase v) rw [P_erase hv'] field_simp rw [Finset.sum_congr rfl key, ← Finset.sum_div, ← Finset.mul_sum, ← Nat.cast_sum, Multiset.toFinset_sum_count_eq] obtain ⟨k, hk⟩ : ∃ k, z.card = k + 1 := ⟨z.card - 1, by have := Multiset.card_pos.2 hz0; omega⟩ rw [hk, Nat.add_sub_cancel, Nat.factorial_succ] field_simp push_cast ringtheorem lemma5 (q : ℕ) (hq : q.Prime) (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) (hdvd : q ∣ W.prod) (hsq : ¬ q ^ 2 ∣ W.prod) (hcard : 2 ≤ W.card) : ∑ᶠ (y : Multiset ℕ) (_ : IsFactorizationCoarsening W y), fw q y = 0 := by obtain ⟨w, hwW, hqw⟩ := hq.prime.exists_mem_multiset_dvd hdvd obtain ⟨W', rfl⟩ : ∃ W', W = w ::ₘ W' := ⟨W.erase w, (Multiset.cons_erase hwW).symm⟩ have hW'q : ¬ q ∣ W'.prod := by intro h; apply hsq; rw [Multiset.prod_cons, pow_two]; exact mul_dvd_mul hqw h have hW'gt : ∀ a ∈ W', 1 < a := fun a ha => hW a (Multiset.mem_cons_of_mem ha) have hw1 : 1 < w := hW w (Multiset.mem_cons_self _ _) have hW'ne : W' ≠ 0 := by rintro rfl; simp at hcard have hfin := coars_finite _ hW have hfin' := coars_finite _ hW'gt have hmem : ∀ y, y ∈ hfin.toFinset ↔ IsFactorizationCoarsening (w ::ₘ W') y := fun y => Set.Finite.mem_toFinset _ have hmem' : ∀ z, z ∈ hfin'.toFinset ↔ IsFactorizationCoarsening W' z := fun z => Set.Finite.mem_toFinset _ change ∑ᶠ y ∈ {y | IsFactorizationCoarsening (w ::ₘ W') y}, fw q y = 0 rw [finsum_mem_eq_finite_toFinset_sum _ hfin] -- structure of a coarsening have hstruct : ∀ y, IsFactorizationCoarsening (w ::ₘ W') y → ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') ∧ (∀ b ∈ y', ¬ q ∣ b) ∧ (g' ≠ 0 → 1 < g'.prod) := by intro y hy obtain ⟨g', y', rfl, hg'W, hco⟩ := C1 hy refine ⟨g', y', rfl, hco, ?_, fun h0 => one_lt_prod_of h0 (fun a ha => hW'gt a (Multiset.mem_of_le hg'W ha))⟩ intro b hb split_ifs at hco · exact coars_ndvd hW'q hco b hb · exact coars_ndvd hW'q hco b (Multiset.mem_cons_of_mem hb) let jj : (Σ _ : Multiset ℕ, Option ℕ) → Multiset ℕ := fun p => p.2.elim (w ::ₘ p.1) (fun v => (v * w) ::ₘ p.1.erase v) let tt : Multiset ℕ → ℕ := fun y => (y.filter (fun a => q ∣ a)).prod let ii : Multiset ℕ → (Σ _ : Multiset ℕ, Option ℕ) := fun y => if tt y = w then ⟨y.filter (fun a => ¬ q ∣ a), none⟩ else ⟨(tt y / w) ::ₘ y.filter (fun a => ¬ q ∣ a), some (tt y / w)⟩ have tt_eq : ∀ (t : ℕ) (y' : Multiset ℕ), q ∣ t → (∀ b ∈ y', ¬ q ∣ b) → tt (t ::ₘ y') = t := by intro t y' ht hy' simp only [tt] rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ ht, Multiset.filter_eq_nil.2 hy'] simp have filt_eq : ∀ (t : ℕ) (y' : Multiset ℕ), q ∣ t → (∀ b ∈ y', ¬ q ∣ b) → (t ::ₘ y').filter (fun a => ¬ q ∣ a) = y' := by intro t y' ht hy' rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 ht), Multiset.filter_eq_self.2 hy'] have hii : ∀ y, IsFactorizationCoarsening (w ::ₘ W') y → ∃ g' y' : Multiset ℕ, y = (w * g'.prod) ::ₘ y' ∧ IsFactorizationCoarsening W' (if g' = 0 then y' else g'.prod ::ₘ y') ∧ (∀ b ∈ y', ¬ q ∣ b) ∧ ii y = (if g' = 0 then ⟨y', none⟩ else ⟨g'.prod ::ₘ y', some g'.prod⟩) := by intro y hy obtain ⟨g', y', rfl, hco, hy', hg1⟩ := hstruct y hy refine ⟨g', y', rfl, hco, hy', ?_⟩ have ht := tt_eq (w * g'.prod) y' (dvd_mul_of_dvd_left hqw _) hy' have hf := filt_eq (w * g'.prod) y' (dvd_mul_of_dvd_left hqw _) hy' simp only [ii, ht, hf] by_cases hg : g' = 0 · subst hg; simp · have h1 := hg1 hg have hne : w * g'.prod ≠ w := by intro h; have : w * g'.prod > w * 1 := Nat.mul_lt_mul_of_pos_left h1 (by omega) omega rw [if_neg hne, if_neg hg, Nat.mul_div_cancel_left _ (by omega : 0 < w)] rw [Finset.sum_nbij' ii jj (t := hfin'.toFinset.sigma (fun z => Finset.insertNone z.toFinset)) (g := fun p => fw q (jj p))] · rw [Finset.sum_sigma] apply Finset.sum_eq_zero intro z hz rw [hmem'] at hz rw [Finset.sum_insertNone] exact fibre_zero hqw (coars_ndvd hW'q hz) (coars_ne_zero hW'ne hz) · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy rw [hi, Finset.mem_sigma] split_ifs at hco ⊢ with hg · exact ⟨(hmem' _).2 hco, by simp⟩ · exact ⟨(hmem' _).2 hco, by simp⟩ · rintro ⟨z, o⟩ hp rw [Finset.mem_sigma, hmem'] at hp rw [hmem] obtain ⟨hz, ho⟩ := hp cases o with | none => exact C2a hz | some v => have hv : v ∈ z := by simpa using ho exact C2b hz hv · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy rw [hi] split_ifs with hg · subst hg; simp [jj] · simp [jj, mul_comm] · rintro ⟨z, o⟩ hp rw [Finset.mem_sigma, hmem'] at hp obtain ⟨hz, ho⟩ := hp have hzq := coars_ndvd hW'q hz cases o with | none => simp only [jj, Option.elim] simp only [ii, tt_eq w z hqw hzq, filt_eq w z hqw hzq, if_true] | some v => have hv : v ∈ z := by simpa using ho have hv1 : 1 < v := coars_gt hW'gt hz v hv have hzq' : ∀ b ∈ z.erase v, ¬ q ∣ b := fun b hb => hzq b (Multiset.mem_of_mem_erase hb) have hd : q ∣ v * w := dvd_mul_of_dvd_right hqw v simp only [jj, Option.elim] have hne : v * w ≠ w := by intro h; have : v * w > 1 * w := Nat.mul_lt_mul_of_pos_right hv1 (by omega) omega simp only [ii, tt_eq (v * w) (z.erase v) hd hzq', filt_eq (v * w) (z.erase v) hd hzq', if_neg hne, Nat.mul_div_cancel _ (by omega : 0 < w), Multiset.cons_erase hv] · intro y hy rw [hmem] at hy obtain ⟨g', y', rfl, hco, hy', hi⟩ := hii y hy simp only [hi] split_ifs with hg · subst hg; simp [jj] · simp [jj, mul_comm]end FactMobL5theorem factorization_coarsening_signed_orderings_sum_zero (q : ℕ) (hq : q.Prime) (W : Multiset ℕ) (hW : ∀ a ∈ W, 1 < a) (hdvd : q ∣ W.prod) (hsq : ¬ q ^ 2 ∣ W.prod) (hcard : 2 ≤ W.card) : ∑ᶠ (y : Multiset ℕ) (_ : IsFactorizationCoarsening W y), ((-1 : ℚ) ^ (y.card - 1) * ((y.card - 1).factorial : ℚ) / ∏ a ∈ (y.filter (fun a => ¬ q ∣ a)).toFinset, (((y.filter (fun a => ¬ q ∣ a)).count a).factorial : ℚ)) = 0 := by exact FactMobL5.lemma5 q hq W hW hdvd hsq hcard