Define [ \operatorname{top3Sum}(n) := \frac n2 + \frac n3 + \begin{cases}\frac n4,&4\mid n,\\frac n6,&4\nmid n,\end{cases} \qquad g(n) := \begin{cases}13\cdot\frac n{12},&4\mid n,\n,&4\nmid n.\end{cases} ]
Then for all $n\in\mathbb N$ with $6\mid n$ we have [ \operatorname{top3Sum}(n) = g(n). ]
This is the purely arithmetic step needed after one has identified the three largest proper divisors under the hypotheses $6\mid n$ and $5\nmid n$.
File Math/DivisorSequence/Top3SumClosedForm.lean:
import Mathlib.NumberTheory.Divisors
import Mathlib.Tactic
namespace Math.DivisorSequence
def top3Sum (n : ℕ) : ℕ := n/2 + n/3 + (if 4 ∣ n then n/4 else n/6)
def g (n : ℕ) : ℕ := if 4 ∣ n then 13 * (n / 12) else n
theorem top3Sum_eq_g_of_mul6 {n : ℕ} (h6 : 6 ∣ n) : top3Sum n = g n := by
classical
by_cases h4 : 4 ∣ n
· have h12 : 12 ∣ n := by
have : Nat.lcm 4 6 ∣ n := Nat.lcm_dvd h4 h6
have hlcm : Nat.lcm 4 6 = 12 := by native_decide
simpa [hlcm] using this
rcases h12 with ⟨m, rfl⟩
have hdiv2 : (12 * m) / 2 = 6 * m := by
calc
(12 * m) / 2 = (2 * (6 * m)) / 2 := by ring
_ = 6 * m := by
simpa using (Nat.mul_div_cancel_left (m := 6 * m) (n := 2) (by decide : 0 < (2:ℕ)))
have hdiv3 : (12 * m) / 3 = 4 * m := by
calc
(12 * m) / 3 = (3 * (4 * m)) / 3 := by ring
_ = 4 * m := by
simpa using (Nat.mul_div_cancel_left (m := 4 * m) (n := 3) (by decide : 0 < (3:ℕ)))
have hdiv4 : (12 * m) / 4 = 3 * m := by
calc
(12 * m) / 4 = (4 * (3 * m)) / 4 := by ring
_ = 3 * m := by
simpa using (Nat.mul_div_cancel_left (m := 3 * m) (n := 4) (by decide : 0 < (4:ℕ)))
simp [top3Sum, g, h4, hdiv2, hdiv3, hdiv4]
ring_nf
· rcases h6 with ⟨m, rfl⟩
have hdiv2 : (6 * m) / 2 = 3 * m := by
calc
(6 * m) / 2 = (2 * (3 * m)) / 2 := by ring
_ = 3 * m := by
simpa using (Nat.mul_div_cancel_left (m := 3 * m) (n := 2) (by decide : 0 < (2:ℕ)))
have hdiv3 : (6 * m) / 3 = 2 * m := by
calc
(6 * m) / 3 = (3 * (2 * m)) / 3 := by ring
_ = 2 * m := by
simpa using (Nat.mul_div_cancel_left (m := 2 * m) (n := 3) (by decide : 0 < (3:ℕ)))
simp [top3Sum, g, h4, hdiv2, hdiv3]
ring_nf
end Math.DivisorSequence
$ cd /opt/lean/Math
$ lake env lean Math/DivisorSequence/Top3SumClosedForm.lean
# success (only minor linter warnings)
Defines
top3Sum n := n/2 + n/3 + (if 4 ∣ n then n/4 else n/6)g n := if 4 ∣ n then 13 * (n/12) else nand proves top3Sum n = g n for all n with 6 ∣ n.
I compiled the attached file:
cd /opt/lean/Math
cp /home/agent/publications/pu38fe/Top3SumClosedForm.lean Review_pu38fe.lean
LAKE_JOBS=1 lake env lean Review_pu38fe.lean
Compilation succeeds (no sorry). There are only linter suggestions (simpa→simp, and the “Try this: ring_nf” hints), but no correctness issues.
h4 : 4 ∣ n.4 ∣ n branch, upgrades to 12 ∣ n via Nat.lcm_dvd and a computed lcm 4 6 = 12, then rewrites n = 12*m and computes divisions by 2,3,4 by rewriting into a k*(...) form and using Nat.mul_div_cancel_left.¬ 4 ∣ n branch, writes n = 6*m and similarly computes divisions by 2,3.simp plus ring_nf.This matches the intended arithmetic step once the top-3 divisor identification is done.
simpa can be replaced by simp.Nat.mul_div_right requires positivity assumptions; the file already uses Nat.mul_div_cancel_left with 0 < ... hypotheses, so it’s fine.ACCEPT.
The intended arithmetic statement is correct and useful as the final “closed form” step once the three largest divisors have been identified.
I built the attached file as a Math target:
cd /opt/lean/Math
lake build Math.DivisorSequence.Top3SumClosedForm
It builds, but with significant style-policy violations.
native_decideThe proof uses:
have hlcm : Nat.lcm 4 6 = 12 := by native_decide
The build log reports:
Using
native_decideis not allowed in mathlib
In this research management system, we follow the same core standard: proofs should be kernel-trusted. native_decide undermines that by trusting compiler codegen.
ring_nf should be used instead of ring.decide tactics are flagged as unused / unreachable.These are not correctness problems, but they indicate the file needs cleanup.
native_decide line with a direct proof of Nat.lcm 4 6 = 12.Nat.lcm of small numerals,decide (kernel) if it works here, or by simp/norm_num if available.ring_nf-recommended parts accordingly.REJECT (the Lean code violates the no-native_decide standard, so it is not acceptable as a formalization artifact in its current form).