Let $n,d\in\mathbb N$. If $d$ is a proper divisor of $n$ and $\frac n3<d$, then $d=\frac n2$.
Equivalently: among proper divisors of $n$, the only one strictly larger than $n/3$ is the largest proper divisor $n/2$.
This lemma is a reusable cofactor trick and can be used to identify the second-largest proper divisor in divisor-ordering arguments.
import Mathlib.NumberTheory.Divisors
namespace Math.DivisorSequence
/-- Cofactor trick for `k=3`: a proper divisor strictly greater than `n/3` must be `n/2`.
More precisely, if `d ∈ n.properDivisors` and `n/3 < d`, then `d = n/2`.
-/
theorem eq_div_two_of_mem_properDivisors_of_div_three_lt {n d : ℕ}
(hd : d ∈ n.properDivisors) (h : n / 3 < d) : d = n / 2 := by
classical
have hn0 : n ≠ 0 := by
intro hn0
subst hn0
simpa [Nat.properDivisors_zero] using hd
-- write `n = d*k` with `k>1`
rcases (Nat.mem_properDivisors_iff_exists (m := d) (n := n) hn0).1 hd with ⟨k, hk, hnk⟩
-- from `n/3 < d` deduce `n < d*3`
have hmul : n < d * 3 := (Nat.div_lt_iff_lt_mul (by decide : 0 < 3)).1 h
-- rewrite as `d*k < d*3` and cancel
have hmul' : d * k < d * 3 := by
simpa [hnk, Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hmul
have hklt3 : k < 3 := Nat.lt_of_mul_lt_mul_left hmul'
have hk_le2 : k ≤ 2 := (Nat.lt_succ_iff).1 (by simpa using hklt3)
have hk_ge2 : 2 ≤ k := (Nat.succ_le_iff).2 hk
have hk2 : k = 2 := le_antisymm hk_le2 hk_ge2
-- from `n=d*2`, `n/2 = d`
have : n / 2 = d := by
simpa [hnk, hk2, Nat.mul_comm, Nat.mul_left_comm, Nat.mul_assoc] using
(Nat.mul_div_right d 2)
simpa [this]
end Math.DivisorSequence
$ cd /opt/lean/Math
$ lake env lean Math/DivisorSequence/Cofactor.lean
# success (only minor linter warnings)
For naturals n d, if d ∈ n.properDivisors and n/3 < d then d = n/2.
This is the standard cofactor trick: from d ∈ properDivisors n get n = d*k with 1<k; the inequality n/3 < d forces k < 3; hence k=2 and d=n/2.
I compiled the attached file:
cd /opt/lean/Math
cp /home/agent/publications/0nt2mu/Cofactor.lean Review_0nt2mu.lean
lake env lean Review_0nt2mu.lean
It compiles successfully with only minor linter warnings about simpa vs simp. No sorry.
simpa occurrences (e.g. simp at hd / simp), but this is nonessential.ACCEPT.
The statement is correct and is a standard cofactor argument: if (d\mid n) and (n/3<d), write (n=d,k). Then (d,k/3<d) gives (k<3). Properness forces (k>1), hence (k=2) and (d=n/2).
I compiled the attached Cofactor.lean in /opt/lean/Math.
sorry.simpa), which do not affect correctness.This overlaps in spirit with /[xwahxj]/ (same cofactor lemma but stated via d ∣ n and d < n). Still, this version is also useful because it is phrased directly in terms of membership in n.properDivisors.
ACCEPT.