total_abs_factorization_mobius_eq_sum_divisors
If q is a prime not dividing m ≥ 1, then a(mq) = Σ_{d | m} H(m/d).
Statement
theorem total_abs_factorization_mobius_eq_sum_divisors
(m q : ℕ) (hq : q.Prime) (hqm : ¬ q ∣ m) (hm : 0 < m) :
totalAbsFactorizationMobius (m * q) = ∑ d ∈ m.divisors, orderedFactorizationCount (m / d)- Source
- arXiv:2611.18194 (The Möbius function of factorizations with a simple prime factor), proof of Corollary 7 (first step)
- Verified
- 17 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 8
- totalAbsFactorizationMobiusFor a natural number n, totalAbsFactorizationMobius n is the natural number a(n) = Σ_x |factorizationMobiusToTop n x|: the sum, over all…
- 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…
- orderedFactorizationCountH(m), the number of ordered factorizations of m: the number of finite sequences of integers greater than 1 whose product is m, with H(1) =…
- setOf_isNatFactorization_finiteEvery natural number has only finitely many factorizations into integers greater than 1.
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - factorizationMobiusToTopFor a natural number n and a multiset x of natural numbers, factorizationMobiusToTop n x (n first, then x) is the integer defined by…
- IsNatFactorizationA factorization of a natural number n is a multiset of integers greater than 1 whose product is n.
- Used by 1
- total_abs_factorization_mobius_simple_primeCorollary 7 of arXiv:2611.18194. Let n = mq where q is a prime not dividing m and m > 1. Let a(n) = totalAbsFactorizationMobius n = Σ_x…
The proof, explained
The proof computes the total absolute factorization Möbius sum for m * q, where q is a prime not dividing m ≥ 1, by establishing a combinatorial bijection with ordered factorizations of divisors of m. Because q does not divide m, every factorization x of m * q contains a unique factor divisible by q, allowing x to split uniquely into x = (q * d) :: U, where d divides m and U is a factorization of m/d. An earlier formula shows that |μ(x)| equals |U|! / P(U), which is precisely the number of distinct ordered permutations of the multiset U. The assignment x ↦ (d, U) is a bijection between factorizations of m * q and pairs of a divisor d | m with a factorization U of m/d. Summing the permutation counts over all factorizations of m/d yields the ordered factorization count H(m/d), giving the result.
The factorial product denominator P(z) is strictly positive for every multiset z.
The definition P(z) is a product of factorials of element multiplicities over the support of z. Since every factorial is strictly positive, the finite product is strictly positive.
uses
Finset.prod_pos,Nat.factorial_poslemma P_pos (z : Multiset ℕ) : 0 < P z := Finset.prod_pos (fun a _ => by exact_mod_cast Nat.factorial_pos _)
P(v :: z) = (count(v, z) + 1) * P(z) for any element v and multiset z.
Prepending v increases the multiplicity of v by 1 while leaving the counts of all other elements unchanged. Factoring out the term for v from both products and applying (c + 1)! = (c + 1) * c! establishes the recurrence.
uses
Finset.prod_subset,Finset.mul_prod_erase,Multiset.count_cons_self,Nat.factorial_succ,Multiset.count_cons_of_nelemma 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
P(z) = count(v, z) * P(z with v erased) for any element v in z.
Applying the cons-recurrence to the multiset obtained by removing one occurrence of v, and noting that adding v back restores z, yields this formula directly.
uses
P_cons,Multiset.cons_eraselemma 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]
A list l belongs to S(M) if and only if its underlying multiset is M.
By definition S(M) is the finset of all permutations of M.toList. Two lists are permutations of each other if and only if they represent the exact same multiset.
uses
List.mem_permutations,Multiset.coe_eq_coe/-- the distinct orderings of a multiset -/ noncomputable def S (M : Multiset ℕ) : Finset (List ℕ) := M.toList.permutations.toFinset lemma mem_S {M : Multiset ℕ} {l : List ℕ} : l ∈ S M ↔ (l : Multiset ℕ) = M := by unfold S rw [List.mem_toFinset, List.mem_permutations] constructor · intro h; rw [← Multiset.coe_toList M]; exact Multiset.coe_eq_coe.2 h · intro h; subst h; exact Multiset.coe_eq_coe.1 (by simp)
For the empty multiset M = 0, |S(0)| = 0! / P(0) = 1.
The only permutation of the empty multiset is the empty list, giving |S(0)| = 1. Since 0! = 1 and the empty product P(0) = 1, the formula holds as the base case for strong induction.
uses
Nat.strong_induction_on,mem_Slemma S_card (M : Multiset ℕ) : ((S M).card : ℚ) = (M.card.factorial : ℚ) / P M := by induction h : M.card using Nat.strong_induction_on generalizing M with | _ k ih => by_cases hM : M = 0 · subst hM have : S 0 = {[]} := by ext l; rw [mem_S, Finset.mem_singleton]; simp rw [this]; simp at h; subst h; simp [P]
By strong induction, the number of distinct permutations of any multiset M is |S(M)| = |M|! / P(M).
Every non-empty permutation starts with some distinct element a in M followed by a permutation of M with a removed. Summing the induction hypothesis over all choices of a gives a sum of (|M|-1)! / P(M \ {a}) = (|M|-1)! * count(a, M) / P(M). Summing count(a, M) over all distinct elements gives |M|, and (|M|-1)! * |M| = |M|!.
uses
Finset.card_biUnion,Finset.card_image_of_injective,List.cons_injective,Multiset.card_erase_of_mem,P_erase,Multiset.toFinset_sum_count_eq· have hS : S M = M.toFinset.biUnion (fun a => (S (M.erase a)).image (List.cons a)) := by ext l simp only [mem_S, Finset.mem_biUnion, Finset.mem_image, Multiset.mem_toFinset] constructor · intro hl cases l with | nil => exact absurd hl.symm (by simpa using hM) | cons a l' => refine ⟨a, ?_, l', ?_, rfl⟩ · rw [← hl]; simp · rw [← hl]; simp · rintro ⟨a, ha, l', hl', rfl⟩ rw [← Multiset.cons_coe, hl', Multiset.cons_erase ha] rw [hS, Finset.card_biUnion] · push_cast rw [Finset.sum_congr rfl (fun a ha => by rw [Finset.card_image_of_injective _ (List.cons_injective)])] have hk : ∀ a ∈ M.toFinset, (M.erase a).card = k - 1 := by intro a ha; rw [Multiset.card_erase_of_mem (Multiset.mem_toFinset.1 ha), h]; rfl rw [Finset.sum_congr rfl (fun a ha => ih (k - 1) (by have := Multiset.card_pos.2 hM; omega) (M.erase a) (hk a ha))] have key : ∀ a ∈ M.toFinset, ((k - 1).factorial : ℚ) / P (M.erase a) = ((k - 1).factorial : ℚ) * ((M.count a : ℕ) : ℚ) / P M := by intro a ha have ha' := Multiset.mem_toFinset.1 ha have hc : ((M.count a : ℕ) : ℚ) ≠ 0 := by exact_mod_cast (Multiset.count_pos.2 ha').ne' have := P_pos (M.erase a) rw [P_erase ha'] field_simp rw [Finset.sum_congr rfl key, ← Finset.sum_div, ← Finset.mul_sum, ← Nat.cast_sum, Multiset.toFinset_sum_count_eq, h] obtain ⟨k', rfl⟩ : ∃ k', k = k' + 1 := ⟨k - 1, by have := Multiset.card_pos.2 hM; omega⟩ rw [Nat.add_sub_cancel, Nat.factorial_succ] push_cast; ring
Permutations of M with distinct first elements are mutually disjoint.
If two prepended lists a :: l and b :: l' are equal, their heads must be identical (a = b) by list injectivity. Thus sets of permutations classified by their initial element are pairwise disjoint.
uses
Finset.disjoint_left,List.cons.inj· intro a _ b _ hab simp only [Function.onFun] rw [Finset.disjoint_left] intro l hla hlb simp only [Finset.mem_image] at hla hlb obtain ⟨_, _, rfl⟩ := hla obtain ⟨_, _, h2⟩ := hlb exact hab (List.cons.inj h2).1.symm
Ordered factorizations partition into multiset permutations, giving H(n) = ∑_M |S(M)|.
Every ordered factorization (a list of integers > 1 multiplying to n) has a unique underlying multiset of factors M, which is an unordered factorization of n. The set of all ordered factorizations is the disjoint union of S(M) over all factorizations M of n.
uses
mem_S,Set.Finite.mem_toFinset,Nat.card_congr,Equiv.subtypeEquivRight,Finset.card_biUnion,Finset.disjoint_leftlemma H_eq (n : ℕ) : orderedFactorizationCount n = ∑ M ∈ (setOf_isNatFactorization_finite n).toFinset, (S M).card := by set T := (setOf_isNatFactorization_finite n).toFinset.biUnion S with hT have hmemT : ∀ l, l ∈ T ↔ ((∀ a ∈ l, 1 < a) ∧ l.prod = n) := by intro l rw [hT, Finset.mem_biUnion] constructor · rintro ⟨M, hM, hl⟩ rw [Set.Finite.mem_toFinset] at hM rw [mem_S] at hl; subst hl exact ⟨fun a ha => hM.1 a (Multiset.mem_coe.2 ha), by simpa using hM.2⟩ · rintro ⟨h1, h2⟩ refine ⟨(l : Multiset ℕ), ?_, mem_S.2 rfl⟩ rw [Set.Finite.mem_toFinset] exact ⟨fun a ha => h1 a (Multiset.mem_coe.1 ha), by simpa using h2⟩ unfold orderedFactorizationCount rw [Nat.card_congr (Equiv.subtypeEquivRight (fun l => (hmemT l).symm)), Nat.card_eq_fintype_card, Fintype.card_coe, hT, Finset.card_biUnion] intro M _ M' _ hMM' simp only [Function.onFun] rw [Finset.disjoint_left] intro l h1 h2 rw [mem_S] at h1 h2 exact hMM' (h1.symm.trans h2)
Every factorization x of m * q has a unique element t divisible by q, and all other elements are coprime to q.
Since q is prime and divides the product m * q, it must divide some factor t in x. If another factor b were also divisible by q, then q^2 would divide m * q, so q would divide m, contradicting q not dividing m. Hence t is unique and the remaining multiset U has no factors divisible by q.
uses
dvd_mul_left,Multiset.cons_erase,Multiset.prod_cons,mul_dvd_mul,Multiset.dvd_prod,Nat.dvd_of_mul_dvd_mul_rightlemma split_marked {m q : ℕ} (hq : q.Prime) (hqm : ¬ q ∣ m) {x : Multiset ℕ} (hx : IsNatFactorization (m * q) x) : ∃ t U, x = t ::ₘ U ∧ q ∣ t ∧ ∀ b ∈ U, ¬ q ∣ b := by have hd : q ∣ x.prod := by rw [hx.2]; exact dvd_mul_left q m obtain ⟨t, ht, hqt⟩ := hq.prime.exists_mem_multiset_dvd hd refine ⟨t, x.erase t, (Multiset.cons_erase ht).symm, hqt, fun b hb hqb => hqm ?_⟩ have h1 : q * q ∣ x.prod := by rw [← Multiset.cons_erase ht, Multiset.prod_cons] exact mul_dvd_mul hqt (hqb.trans (Multiset.dvd_prod hb)) rw [hx.2] at h1 exact Nat.dvd_of_mul_dvd_mul_right hq.pos h1
The absolute value of the Möbius function on a factorization x of m * q equals |S(U)|, where U consists of the factors coprime to q.
An established formula gives factorizationMobiusToTop(m * q, x) = (-1)^|U| * |U|! / P(U). Taking absolute values removes the sign (-1)^|U|, and by the permutation count formula |U|! / P(U) = |S(U)|.
uses
factorization_mobius_simple_prime,split_marked,S_card,P_poslemma abs_mu {m q : ℕ} (hq : q.Prime) (hqm : ¬ q ∣ m) {x : Multiset ℕ} (hx : IsNatFactorization (m * q) x) : (factorizationMobiusToTop (m * q) x).natAbs = (S (x.filter (fun a => ¬ q ∣ a))).card := by have h := factorization_mobius_simple_prime m q hq hqm x hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx have hf : (t ::ₘ U).filter (fun a => ¬ q ∣ a) = U := by rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] rw [hf] at h ⊢ rw [Multiset.card_cons, Nat.add_sub_cancel] at h have h' : (factorizationMobiusToTop (m * q) (t ::ₘ U) : ℚ) = (-1 : ℚ) ^ U.card * (U.card.factorial : ℚ) / P U := h have hc := S_card U have : (((factorizationMobiusToTop (m * q) (t ::ₘ U)).natAbs : ℕ) : ℚ) = ((S U).card : ℚ) := by rw [Nat.cast_natAbs, Int.cast_abs, h', hc, abs_div, abs_mul, abs_pow, abs_neg, abs_one, one_pow, one_mul, abs_of_pos (P_pos U), abs_of_nonneg (by positivity)] exact_mod_cast this
The total Möbius sum equals ∑_x |S(x_{q ∤})|, and the target divisor sum can be rewritten as a single sum over pairs (d, M) with d | m and M a factorization of m/d.
Applying the absolute Möbius identity converts the total sum into a sum of |S(x_{q ∤})|. Replacing H(m/d) by ∑_M |S(M)| expands the right-hand side into a sum over pairs (d, M) in the sigma type of factorizations indexed by divisors of m. It suffices to construct a bijection between the two index sets that preserves |S|.
uses
setOf_isNatFactorization_finite,finsum_mem_eq_finite_toFinset_sum,abs_mu,H_eq,Finset.sum_sigma,Finset.sum_nbij'theorem main (m q : ℕ) (hq : q.Prime) (hqm : ¬ q ∣ m) (hm : 0 < m) : totalAbsFactorizationMobius (m * q) = ∑ d ∈ m.divisors, orderedFactorizationCount (m / d) := by have hfin := setOf_isNatFactorization_finite (m * q) unfold totalAbsFactorizationMobius change ∑ᶠ x ∈ {x : Multiset ℕ | IsNatFactorization (m * q) x}, (factorizationMobiusToTop (m * q) x).natAbs = _ rw [finsum_mem_eq_finite_toFinset_sum _ hfin] rw [Finset.sum_congr rfl (fun x hx => abs_mu hq hqm (hfin.mem_toFinset.1 hx))] simp only [H_eq] rw [← Finset.sum_sigma (s := m.divisors) (t := fun d => (setOf_isNatFactorization_finite (m / d)).toFinset) (f := fun p : (Σ _ : ℕ, Multiset ℕ) => (S p.2).card)] have hq2 := hq.two_le apply Finset.sum_nbij' (fun x => (⟨(x.filter (fun a => q ∣ a)).prod / q, x.filter (fun a => ¬ q ∣ a)⟩ : Σ _ : ℕ, Multiset ℕ)) (fun p => (q * p.1) ::ₘ p.2)
The map sending x = t :: U to (t/q, U) produces a valid divisor d | m and factorization U of m/d.
Writing t = q * d, we have q * (d * prod(U)) = prod(x) = q * m, so d * prod(U) = m. Thus d divides m, and prod(U) = m/d. Since x consists of integers > 1, all elements of U are > 1, so U is a valid factorization of m/d.
uses
split_marked,Nat.mem_divisors,Multiset.prod_cons,Nat.mul_div_cancel_left,Nat.eq_of_mul_eq_mul_left· intro x hx rw [Set.Finite.mem_toFinset] at hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqt, Multiset.filter_eq_nil.2 hU, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] obtain ⟨d, rfl⟩ := hqt simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel_left _ hq.pos] have hprod := hx.2 rw [Multiset.prod_cons] at hprod have hdU : d * U.prod = m := by have : q * (d * U.prod) = q * m := by rw [← mul_assoc, hprod, mul_comm] exact Nat.eq_of_mul_eq_mul_left hq.pos this refine ⟨⟨⟨U.prod, hdU.symm⟩, hm.ne'⟩, fun a ha => hx.1 a (Multiset.mem_cons_of_mem ha), ?_⟩ rw [← hdU] have hd0 : 0 < d := by rcases Nat.eq_zero_or_pos d with h | h · subst h; simp at hdU; omega · exact h rw [Nat.mul_div_cancel_left _ hd0]
The inverse map sending (d, M) to (q * d) :: M produces a valid factorization of m * q.
Since q ≥ 2 and d ≥ 1, q * d > 1. All elements of M are already > 1. The product of (q * d) :: M is (q * d) * prod(M) = q * d * (m / d) = m * q. Thus (q * d) :: M is a valid factorization of m * q.
uses
Nat.mem_divisors,Nat.pos_of_dvd_of_pos,Multiset.mem_cons,Multiset.prod_cons,Nat.mul_div_cancel'· rintro ⟨d, M⟩ hp rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] at hp obtain ⟨⟨hdm, _⟩, hM⟩ := hp rw [Set.Finite.mem_toFinset] have hd0 : 0 < d := Nat.pos_of_dvd_of_pos hdm hm refine ⟨fun a ha => ?_, ?_⟩ · rcases Multiset.mem_cons.1 ha with rfl | ha · nlinarith · exact hM.1 a ha · rw [Multiset.prod_cons, hM.2, mul_assoc, Nat.mul_div_cancel' hdm, mul_comm]The forward and inverse maps are mutually inverse, and under this bijection the summands match.
In the forward direction, q * (t/q) = t restores the head factor. In the reverse direction, since every factor b in M divides m/d which divides m, q cannot divide any element of M (otherwise q | m). Thus q * d is the unique factor divisible by q, so filtering recovers d and M. Finally, the summand |S(x_{q ∤})| equals |S(M)| by definition.
uses
split_marked,Nat.mul_div_cancel',Nat.div_dvd_of_dvd,Nat.mul_div_cancel_left· intro x hx rw [Set.Finite.mem_toFinset] at hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx dsimp only rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqt, Multiset.filter_eq_nil.2 hU, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel' hqt] · rintro ⟨d, M⟩ hp rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] at hp obtain ⟨⟨hdm, _⟩, hM⟩ := hp have hMq : ∀ b ∈ M, ¬ q ∣ b := by intro b hb hqb apply hqm have h1 : b ∣ m / d := hM.2 ▸ Multiset.dvd_prod hb exact hqb.trans (h1.trans (Nat.div_dvd_of_dvd hdm)) have hqd : q ∣ q * d := dvd_mul_right q d dsimp only rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqd, Multiset.filter_eq_nil.2 hMq, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqd), Multiset.filter_eq_self.2 hMq] simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel_left _ hq.pos] · intro x hx rfl end TAFM
The main theorem totalAbsFactorizationMobius(m * q) = ∑_{d | m} H(m/d) holds.
This is immediate from TAFM.main, which proved the bijection and equality of sums.
uses
TAFM.maintheorem total_abs_factorization_mobius_eq_sum_divisors (m q : ℕ) (hq : q.Prime) (hqm : ¬ q ∣ m) (hm : 0 < m) : totalAbsFactorizationMobius (m * q) = ∑ d ∈ m.divisors, orderedFactorizationCount (m / d) := by exact TAFM.main m q hq hqm hm
Finset.prod_pos- For any finite set, if every element is strictly positive, their product is strictly positive.
Nat.factorial_pos- The factorial of any natural number is strictly positive.
Finset.prod_subset- A product over a subset equals the product over the ambient finite set provided all elements outside the subset evaluate to 1.
Finset.mul_prod_erase- A product over a finite set equals the value at a chosen element multiplied by the product over the set with that element removed.
Multiset.count_cons_self- Adding an element a to a multiset increases the count of a by 1.
Nat.factorial_succ- The factorial of n + 1 equals (n + 1) times n factorial.
Multiset.count_cons_of_ne- Adding an element b to a multiset does not change the multiplicity count of any distinct element a ≠ b.
P_cons- The denominator product P(v :: z) factors as (count(v, z) + 1) * P(z).
Multiset.cons_erase- For an element a in a multiset s, prepending a to s with a erased recovers the original multiset s.
List.mem_permutations- A list belongs to the permutations of another list if and only if they are permutations of each other.
Multiset.coe_eq_coe- Two lists coerce to the same multiset if and only if they are permutations of each other.
Nat.strong_induction_on- The principle of strong mathematical induction on the natural numbers.
mem_S- A list l belongs to S(M) if and only if its underlying multiset of elements is M.
Finset.card_biUnion- The cardinality of a disjoint union of finite sets is the sum of their individual cardinalities.
Finset.card_image_of_injective- The image of a finite set under an injective function has the same cardinality as the original set.
List.cons_injective- The operation of prepending a fixed element to a list is an injective function on lists.
Multiset.card_erase_of_mem- Erasing an element present in a multiset decreases its total cardinality by 1.
P_pos- The factorial product denominator P(z) is strictly positive for every multiset z.
P_erase- For an element v in a multiset z, P(z) equals count(v, z) times P(z with v erased).
Multiset.toFinset_sum_count_eq- The sum of the multiplicity counts of all distinct elements in a multiset equals the total cardinality of the multiset.
Finset.disjoint_left- Two finite sets are disjoint if and only if no element of the first belongs to the second.
List.cons.inj- If two lists with prepended elements are equal, their heads are equal and their tails are equal.
Set.Finite.mem_toFinset- An element belongs to the finset of a finite set if and only if it satisfies the set predicate.
Nat.card_congr- Equipotent types have identical cardinalities.
Equiv.subtypeEquivRight- Logically equivalent subtype predicates yield equivalent subtype types.
dvd_mul_left- Any element divides the product of any element with itself on the left.
Multiset.prod_cons- The product of elements of a :: s equals a times the product of elements of s.
mul_dvd_mul- Divisibility is preserved under pairwise multiplication: a | b and c | d implies a * c | b * d.
Multiset.dvd_prod- Any element of a multiset divides the product of all elements in the multiset.
Nat.dvd_of_mul_dvd_mul_right- For k > 0, if m * k divides n * k, then m divides n.
factorization_mobius_simple_prime- The Möbius function of a factorization x of m * q has an explicit multinomial-like formula when q is a prime not dividing m.
split_marked- Any factorization x of m * q decomposes uniquely into a factor t divisible by q and a sub-multiset U with no factor divisible by q.
S_card- The number of distinct permutations of a multiset M is |M|! / P(M).
setOf_isNatFactorization_finite- The set of factorizations of any natural number into factors strictly greater than 1 is finite.
finsum_mem_eq_finite_toFinset_sum- A finitely supported sum over a finite set equals the sum over its associated finset.
abs_mu- The absolute value of the Möbius function on a factorization x of m * q equals the number of distinct permutations of its factors coprime to q.
H_eq- The number of ordered factorizations H(n) is the sum over all unordered factorizations M of n of the number of distinct permutations |S(M)|.
Finset.sum_sigma- A sum over a dependent pair (sigma type) equals an iterated sum over the first index and the fiber.
Finset.sum_nbij'- Two finite sums are equal if there is a bijection between their index sets that preserves summand values.
Nat.mem_divisors- A natural number d belongs to m.divisors if and only if d divides m and m ≠ 0.
Nat.mul_div_cancel_left- For n > 0, (n * m) / n = m.
Nat.eq_of_mul_eq_mul_left- For k > 0, if k * a = k * b then a = b.
Nat.pos_of_dvd_of_pos- If m divides n and n > 0, then m > 0.
Multiset.mem_cons- An element belongs to a :: s if and only if it equals a or belongs to s.
Nat.mul_div_cancel'- If n divides m, then n * (m / n) = m.
Nat.div_dvd_of_dvd- If n divides m, then m / n divides m.
TAFM.main- For prime q not dividing m ≥ 1, the total absolute factorization Möbius sum on m * q equals the sum of H(m/d) over all divisors d of m.
- Permutations of a multiset are formalized as the finset of distinct lists that evaluate to that multiset, connecting unordered factorizations to ordered factorizations.
- The proof relies on automated algebra (ring, field_simp, omega, nlinarith) to simplify products of factorials and check nonnegativity and divisibility bounds.
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 TAFMnoncomputable 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 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]/-- the distinct orderings of a multiset -/noncomputable def S (M : Multiset ℕ) : Finset (List ℕ) := M.toList.permutations.toFinsetlemma mem_S {M : Multiset ℕ} {l : List ℕ} : l ∈ S M ↔ (l : Multiset ℕ) = M := by unfold S rw [List.mem_toFinset, List.mem_permutations] constructor · intro h; rw [← Multiset.coe_toList M]; exact Multiset.coe_eq_coe.2 h · intro h; subst h; exact Multiset.coe_eq_coe.1 (by simp)lemma S_card (M : Multiset ℕ) : ((S M).card : ℚ) = (M.card.factorial : ℚ) / P M := by induction h : M.card using Nat.strong_induction_on generalizing M with | _ k ih => by_cases hM : M = 0 · subst hM have : S 0 = {[]} := by ext l; rw [mem_S, Finset.mem_singleton]; simp rw [this]; simp at h; subst h; simp [P] · have hS : S M = M.toFinset.biUnion (fun a => (S (M.erase a)).image (List.cons a)) := by ext l simp only [mem_S, Finset.mem_biUnion, Finset.mem_image, Multiset.mem_toFinset] constructor · intro hl cases l with | nil => exact absurd hl.symm (by simpa using hM) | cons a l' => refine ⟨a, ?_, l', ?_, rfl⟩ · rw [← hl]; simp · rw [← hl]; simp · rintro ⟨a, ha, l', hl', rfl⟩ rw [← Multiset.cons_coe, hl', Multiset.cons_erase ha] rw [hS, Finset.card_biUnion] · push_cast rw [Finset.sum_congr rfl (fun a ha => by rw [Finset.card_image_of_injective _ (List.cons_injective)])] have hk : ∀ a ∈ M.toFinset, (M.erase a).card = k - 1 := by intro a ha; rw [Multiset.card_erase_of_mem (Multiset.mem_toFinset.1 ha), h]; rfl rw [Finset.sum_congr rfl (fun a ha => ih (k - 1) (by have := Multiset.card_pos.2 hM; omega) (M.erase a) (hk a ha))] have key : ∀ a ∈ M.toFinset, ((k - 1).factorial : ℚ) / P (M.erase a) = ((k - 1).factorial : ℚ) * ((M.count a : ℕ) : ℚ) / P M := by intro a ha have ha' := Multiset.mem_toFinset.1 ha have hc : ((M.count a : ℕ) : ℚ) ≠ 0 := by exact_mod_cast (Multiset.count_pos.2 ha').ne' have := P_pos (M.erase a) rw [P_erase ha'] field_simp rw [Finset.sum_congr rfl key, ← Finset.sum_div, ← Finset.mul_sum, ← Nat.cast_sum, Multiset.toFinset_sum_count_eq, h] obtain ⟨k', rfl⟩ : ∃ k', k = k' + 1 := ⟨k - 1, by have := Multiset.card_pos.2 hM; omega⟩ rw [Nat.add_sub_cancel, Nat.factorial_succ] push_cast; ring · intro a _ b _ hab simp only [Function.onFun] rw [Finset.disjoint_left] intro l hla hlb simp only [Finset.mem_image] at hla hlb obtain ⟨_, _, rfl⟩ := hla obtain ⟨_, _, h2⟩ := hlb exact hab (List.cons.inj h2).1.symmlemma H_eq (n : ℕ) : orderedFactorizationCount n = ∑ M ∈ (setOf_isNatFactorization_finite n).toFinset, (S M).card := by set T := (setOf_isNatFactorization_finite n).toFinset.biUnion S with hT have hmemT : ∀ l, l ∈ T ↔ ((∀ a ∈ l, 1 < a) ∧ l.prod = n) := by intro l rw [hT, Finset.mem_biUnion] constructor · rintro ⟨M, hM, hl⟩ rw [Set.Finite.mem_toFinset] at hM rw [mem_S] at hl; subst hl exact ⟨fun a ha => hM.1 a (Multiset.mem_coe.2 ha), by simpa using hM.2⟩ · rintro ⟨h1, h2⟩ refine ⟨(l : Multiset ℕ), ?_, mem_S.2 rfl⟩ rw [Set.Finite.mem_toFinset] exact ⟨fun a ha => h1 a (Multiset.mem_coe.1 ha), by simpa using h2⟩ unfold orderedFactorizationCount rw [Nat.card_congr (Equiv.subtypeEquivRight (fun l => (hmemT l).symm)), Nat.card_eq_fintype_card, Fintype.card_coe, hT, Finset.card_biUnion] intro M _ M' _ hMM' simp only [Function.onFun] rw [Finset.disjoint_left] intro l h1 h2 rw [mem_S] at h1 h2 exact hMM' (h1.symm.trans h2)lemma split_marked {m q : ℕ} (hq : q.Prime) (hqm : ¬ q ∣ m) {x : Multiset ℕ} (hx : IsNatFactorization (m * q) x) : ∃ t U, x = t ::ₘ U ∧ q ∣ t ∧ ∀ b ∈ U, ¬ q ∣ b := by have hd : q ∣ x.prod := by rw [hx.2]; exact dvd_mul_left q m obtain ⟨t, ht, hqt⟩ := hq.prime.exists_mem_multiset_dvd hd refine ⟨t, x.erase t, (Multiset.cons_erase ht).symm, hqt, fun b hb hqb => hqm ?_⟩ have h1 : q * q ∣ x.prod := by rw [← Multiset.cons_erase ht, Multiset.prod_cons] exact mul_dvd_mul hqt (hqb.trans (Multiset.dvd_prod hb)) rw [hx.2] at h1 exact Nat.dvd_of_mul_dvd_mul_right hq.pos h1lemma abs_mu {m q : ℕ} (hq : q.Prime) (hqm : ¬ q ∣ m) {x : Multiset ℕ} (hx : IsNatFactorization (m * q) x) : (factorizationMobiusToTop (m * q) x).natAbs = (S (x.filter (fun a => ¬ q ∣ a))).card := by have h := factorization_mobius_simple_prime m q hq hqm x hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx have hf : (t ::ₘ U).filter (fun a => ¬ q ∣ a) = U := by rw [Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] rw [hf] at h ⊢ rw [Multiset.card_cons, Nat.add_sub_cancel] at h have h' : (factorizationMobiusToTop (m * q) (t ::ₘ U) : ℚ) = (-1 : ℚ) ^ U.card * (U.card.factorial : ℚ) / P U := h have hc := S_card U have : (((factorizationMobiusToTop (m * q) (t ::ₘ U)).natAbs : ℕ) : ℚ) = ((S U).card : ℚ) := by rw [Nat.cast_natAbs, Int.cast_abs, h', hc, abs_div, abs_mul, abs_pow, abs_neg, abs_one, one_pow, one_mul, abs_of_pos (P_pos U), abs_of_nonneg (by positivity)] exact_mod_cast thistheorem main (m q : ℕ) (hq : q.Prime) (hqm : ¬ q ∣ m) (hm : 0 < m) : totalAbsFactorizationMobius (m * q) = ∑ d ∈ m.divisors, orderedFactorizationCount (m / d) := by have hfin := setOf_isNatFactorization_finite (m * q) unfold totalAbsFactorizationMobius change ∑ᶠ x ∈ {x : Multiset ℕ | IsNatFactorization (m * q) x}, (factorizationMobiusToTop (m * q) x).natAbs = _ rw [finsum_mem_eq_finite_toFinset_sum _ hfin] rw [Finset.sum_congr rfl (fun x hx => abs_mu hq hqm (hfin.mem_toFinset.1 hx))] simp only [H_eq] rw [← Finset.sum_sigma (s := m.divisors) (t := fun d => (setOf_isNatFactorization_finite (m / d)).toFinset) (f := fun p : (Σ _ : ℕ, Multiset ℕ) => (S p.2).card)] have hq2 := hq.two_le apply Finset.sum_nbij' (fun x => (⟨(x.filter (fun a => q ∣ a)).prod / q, x.filter (fun a => ¬ q ∣ a)⟩ : Σ _ : ℕ, Multiset ℕ)) (fun p => (q * p.1) ::ₘ p.2) · intro x hx rw [Set.Finite.mem_toFinset] at hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqt, Multiset.filter_eq_nil.2 hU, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] obtain ⟨d, rfl⟩ := hqt simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel_left _ hq.pos] have hprod := hx.2 rw [Multiset.prod_cons] at hprod have hdU : d * U.prod = m := by have : q * (d * U.prod) = q * m := by rw [← mul_assoc, hprod, mul_comm] exact Nat.eq_of_mul_eq_mul_left hq.pos this refine ⟨⟨⟨U.prod, hdU.symm⟩, hm.ne'⟩, fun a ha => hx.1 a (Multiset.mem_cons_of_mem ha), ?_⟩ rw [← hdU] have hd0 : 0 < d := by rcases Nat.eq_zero_or_pos d with h | h · subst h; simp at hdU; omega · exact h rw [Nat.mul_div_cancel_left _ hd0] · rintro ⟨d, M⟩ hp rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] at hp obtain ⟨⟨hdm, _⟩, hM⟩ := hp rw [Set.Finite.mem_toFinset] have hd0 : 0 < d := Nat.pos_of_dvd_of_pos hdm hm refine ⟨fun a ha => ?_, ?_⟩ · rcases Multiset.mem_cons.1 ha with rfl | ha · nlinarith · exact hM.1 a ha · rw [Multiset.prod_cons, hM.2, mul_assoc, Nat.mul_div_cancel' hdm, mul_comm] · intro x hx rw [Set.Finite.mem_toFinset] at hx obtain ⟨t, U, rfl, hqt, hU⟩ := split_marked hq hqm hx dsimp only rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqt, Multiset.filter_eq_nil.2 hU, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqt), Multiset.filter_eq_self.2 hU] simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel' hqt] · rintro ⟨d, M⟩ hp rw [Finset.mem_sigma, Set.Finite.mem_toFinset, Nat.mem_divisors] at hp obtain ⟨⟨hdm, _⟩, hM⟩ := hp have hMq : ∀ b ∈ M, ¬ q ∣ b := by intro b hb hqb apply hqm have h1 : b ∣ m / d := hM.2 ▸ Multiset.dvd_prod hb exact hqb.trans (h1.trans (Nat.div_dvd_of_dvd hdm)) have hqd : q ∣ q * d := dvd_mul_right q d dsimp only rw [Multiset.filter_cons_of_pos (p := fun a => q ∣ a) _ hqd, Multiset.filter_eq_nil.2 hMq, Multiset.filter_cons_of_neg (p := fun a => ¬ q ∣ a) _ (not_not.2 hqd), Multiset.filter_eq_self.2 hMq] simp only [Multiset.prod_cons, Multiset.prod_zero, mul_one] rw [Nat.mul_div_cancel_left _ hq.pos] · intro x hx rflend TAFMtheorem total_abs_factorization_mobius_eq_sum_divisors (m q : ℕ) (hq : q.Prime) (hqm : ¬ q ∣ m) (hm : 0 < m) : totalAbsFactorizationMobius (m * q) = ∑ d ∈ m.divisors, orderedFactorizationCount (m / d) := by exact TAFM.main m q hq hqm hm