feat(NumberTheory): add unitary divisors and unitary perfect numbers#33838
feat(NumberTheory): add unitary divisors and unitary perfect numbers#33838chainstart wants to merge 11 commits intoleanprover-community:masterfrom
Conversation
This PR adds the unitary divisor sum function σ* and proves that no odd unitary perfect numbers exist. **Main definitions:** - `Nat.UnitaryDivisor`: A divisor d of n is unitary if gcd(d, n/d) = 1 - `Nat.unitaryDivisors`: The finset of unitary divisors - `Nat.unitaryDivisorSum`: The sum σ*(n) of unitary divisors - `Nat.UnitaryPerfect`: A number n is unitary perfect if σ*(n) = 2n **Main theorems:** - `unitaryDivisorSum_mul`: Multiplicativity of σ* for coprime arguments - `unitaryDivisorSum_prime_pow`: For prime p, σ*(p^k) = p^k + 1 - `no_odd_unitary_perfect`: No odd unitary perfect numbers exist (Subbarao-Warren 1966) - `UnitaryPerfect.even`: Every unitary perfect number is even The proofs use explicit bijection constructions for multiplicativity and structural induction on prime factorizations for the main theorem. References: - Subbarao & Warren (1966), Canadian Mathematical Bulletin 9(2), 147-153 - Wall (1975), Canadian Mathematical Bulletin 18(1), 115-122
PR summary 76f94b4301Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
- Replace show with change (linter requirement) - Fix recOnPrimeCoprime branch names (h0/hp/h → zero/prime_pow/coprime) - Replace ring with ac_rfl (no Tactic import) - Replace interval_cases with omega - Fix simp+omega patterns for proper proof completion - Simplify calc chain for 4-divisibility proof
- Add 'module' keyword after copyright - Use 'public import' instead of 'import' - Add '@[expose] public section' before namespace - This follows mathlib4 module system requirements
| (Nat.divisors n).filter fun d => Nat.gcd d (n / d) = 1 | ||
|
|
||
| /-- The unitary divisor sum function `σ*(n)`, equal to the sum of all unitary divisors. -/ | ||
| def unitaryDivisorSum (n : ℕ) : ℕ := |
There was a problem hiding this comment.
Done. I've redefined unitaryDivisorSum as an ArithmeticFunction ℕ (see line 74). The notation is now scoped under ArithmeticFunction.UnitaryDivisorSum.
| This is proved by establishing a bijection between unitary divisors of `m*n` and | ||
| pairs `(d₁, d₂)` of unitary divisors of `m` and `n` respectively. The bijection is | ||
| `d ↦ (gcd(d,m), gcd(d,n))` with inverse `(d₁, d₂) ↦ d₁ * d₂`. -/ | ||
| theorem unitaryDivisorSum_mul {m n : ℕ} (hcoprime : Nat.Coprime m n) (hm : m ≠ 0) (hn : n ≠ 0) : |
There was a problem hiding this comment.
Can you prove ArithmeticFunction.IsMultiplicative?
There was a problem hiding this comment.
Done. Added isMultiplicative_unitaryDivisorSum theorem (see line 354) with the @[arith_mult] attribute. Thank you for the suggestions!
Address PR review feedback: - Redefine unitaryDivisorSum as ArithmeticFunction instead of plain function - Add isMultiplicative_unitaryDivisorSum theorem proving multiplicativity - Add ArithmeticFunction.Defs import - Update notation to use scoped namespace - Remove unnecessary Mathlib.Tactic import
Fix CI build error by restoring: - `module` keyword after copyright header - `public import` instead of plain `import` These are required by mathlib4's module system.
|
|
||
| This file defines unitary divisors and the unitary divisor sum function σ*. | ||
|
|
||
| A divisor `d` of `n` is called a *unitary divisor* if `gcd(d, n/d) = 1`. The unitary |
There was a problem hiding this comment.
Just noting that in group theory these are called Hall divisors.
There was a problem hiding this comment.
Thanks for the suggestion! Added a note mentioning Hall divisors.
|
Dear @chainstart, |
| exact absurd ⟨hn0, hsum⟩ (no_odd_unitary_perfect hodd hgt1) | ||
|
|
||
| /-- Every unitary perfect number can be written as `2^a * k` where `a ≥ 1` and `k` is odd. -/ | ||
| theorem UnitaryPerfect.eq_two_pow_mul_odd {n : ℕ} (h : UnitaryPerfect n) : |
There was a problem hiding this comment.
This is a property of any nonzero even natural number, so I'd suggest adding the following next to Nat.exists_eq_two_pow_mul_odd:
theorem Nat.eq_two_pow_mul_odd_of_even {n : ℕ} (h : Even n) (hn0 : n ≠ 0):
∃ a k : ℕ, a ≠ 0 ∧ Odd k ∧ n = 2 ^ a * k := by
obtain ⟨a, k, hk_odd, hdecomp⟩ := Nat.exists_eq_two_pow_mul_odd hn0
refine ⟨a, k, ?_, hk_odd, hdecomp⟩
rintro rfl
rw [hdecomp, pow_zero, one_mul, ← Nat.not_odd_iff_even] at h
contradictionThere was a problem hiding this comment.
Good point - this is indeed a general property of even numbers. I'll leave this for a separate PR to the core Nat files, as it would be more appropriate there.
|
|
||
| namespace Nat | ||
|
|
||
| open BigOperators |
There was a problem hiding this comment.
Don't think you need this anymore
|
|
||
| namespace Nat | ||
|
|
||
| open BigOperators Finset |
There was a problem hiding this comment.
| open BigOperators Finset | |
| open Finset |
| by_cases hn_eq_1 : n = 1 | ||
| · rw [hn_eq_1, unitaryDivisorSum_one] at hsum | ||
| omega | ||
| · have hgt1 : n > 1 := by | ||
| rcases n with _ | n' | ||
| · exact absurd rfl hn0 | ||
| · rcases n' with _ | _ | ||
| · exact absurd rfl hn_eq_1 | ||
| · omega | ||
| exact absurd ⟨hn0, hsum⟩ (no_odd_unitary_perfect hodd hgt1) |
There was a problem hiding this comment.
Could be
| by_cases hn_eq_1 : n = 1 | |
| · rw [hn_eq_1, unitaryDivisorSum_one] at hsum | |
| omega | |
| · have hgt1 : n > 1 := by | |
| rcases n with _ | n' | |
| · exact absurd rfl hn0 | |
| · rcases n' with _ | _ | |
| · exact absurd rfl hn_eq_1 | |
| · omega | |
| exact absurd ⟨hn0, hsum⟩ (no_odd_unitary_perfect hodd hgt1) | |
| cases (one_le_iff_ne_zero.mpr hn0).eq_or_lt' with | |
| | inl hn_eq_1 => | |
| rw [hn_eq_1, unitaryDivisorSum_one] at hsum | |
| omega | |
| | inr hgt1 => | |
| exact absurd ⟨hn0, hsum⟩ (no_odd_unitary_perfect hodd hgt1) |
Changes: - Add Hall divisors terminology note (tb65536) - Simplify open statements: use `open Finset` (Ruben-VandeVelde) - Remove unused `open BigOperators` (Ruben-VandeVelde) - Simplify UnitaryPerfect.even proof with cases syntax (Ruben-VandeVelde) - Add structure_divides_odd_part theorem: if m = 2^a × M is UPN, then (1 + 2^a) | M - Remove redundant theorems (unitaryDivisorSum_ge_self, unitaryDivisorSum_ge_succ, eq_two_pow_mul_odd)
- Add Hall divisors terminology note (tb65536) - Simplify open statements: remove BigOperators (Ruben-VandeVelde) - Simplify UnitaryPerfect.even proof with cases syntax (Ruben-VandeVelde)
|
Dear @riccardobrasca, Thank you for the question! Let me explain the motivation: I am currently working on Erdős Problem 1052, which asks whether there are only finitely many unitary perfect numbers. During this work, I found that Mathlib lacks the basic infrastructure for unitary divisors and the unitary divisor sum function σ*. So I developed these definitions and theorems both for my own proofs and for others working in this area. As I make further progress on the UPN problem, I plan to contribute more results to Mathlib. At that point, you can reassess our PR and whether it is worth merging into Mathlib. Thanks! |
|
Dear @chainstart I am inclined to to close this PR because unitary perfect numbers is a too specialized subject. I understand they appear in an Erdos problem, but as you know there are literally hundreds of them, and we simply don't have the energy to maintain a library of all such problems. What about submitting this to the formal conjecture repository? |
|
Hi @chainstart, Thanks for the PR. After a small discussion within reviewers, we agree with @riccardobrasca that we might not want this within Mathlib for now, as there are too many side definitions in Erdös problems, and that this might be material more fit for the formal conjecture repository. This might feel like a bit of a disappointment to you after the time invested in this PR, but please do not feel discouraged to open more PRs to Mathlib! |
Summary
This PR introduces the unitary divisor sum function σ* to Mathlib and proves that no odd unitary perfect numbers exist.
Main Definitions
Nat.UnitaryDivisor d n: A divisordofnis unitary ifgcd(d, n/d) = 1Nat.unitaryDivisors n: TheFinsetof all unitary divisors ofnNat.unitaryDivisorSum n(notationσ*): Sum of all unitary divisorsNat.UnitaryPerfect n:nis unitary perfect ifσ*(n) = 2nMain Theorems
Multiplicativity:
unitaryDivisorSum_mul: For coprimem,n,σ*(mn) = σ*(m) · σ*(n)mnand pairs of unitary divisorsPrime Powers:
unitaryDivisors_prime_pow: The unitary divisors ofp^kare exactly{1, p^k}unitaryDivisorSum_prime_pow: For primepandk ≥ 1,σ*(p^k) = p^k + 1Unitary Perfect Numbers:
no_odd_unitary_perfect: There are no odd unitary perfect numbers > 1 (Subbarao-Warren 1966)UnitaryPerfect.even: Every unitary perfect number is evenUnitaryPerfect.eq_two_pow_mul_odd: Every unitary perfect number has form2^a · kwitha ≥ 1,koddMathematical Background
A unitary perfect number is a positive integer
nsuch that the sum of its unitary divisors equals2n. This generalizes the classical perfect numbers. Only five unitary perfect numbers are known: 6, 60, 90, 87360, and one with 24 digits.The main theorem (no odd unitary perfect numbers) was originally proved by Subbarao & Warren (1966) using prime factorization arguments. Our formalization uses
Nat.recOnPrimeCoprimefor structural induction.References
Code Statistics
Checklist
sorryoradmit