Skip to content

Commit 181601c

Browse files
Wikipedia/IdonealCompleteness: prove knownIdonealNumbers_are_idoneal (#4314)
Proves `knownIdonealNumbers_are_idoneal` — all 65 known idoneal numbers are in fact idoneal. The work is making the predicate decidable. `IsIdoneal n` is `0 < n ∧ ¬ ∃ a b c, 0 < a < b < c ∧ n = a*b + b*c + a*c`, and that existential ranges over unbounded `ℕ`. The helper `exists_triple_iff_bounded` reduces it to a bounded double-search: for a fixed pair `a, b ≤ n` the constraint pins `c = (n − a*b)/(a+b)` exactly, so only `a, b` are searched (over `Finset.range (n+1)`), with `a, b ≤ n` falling out of `nlinarith` on `0 < a < b < c`. The main proof then `fin_cases` over the 65 numbers, peels off the trivial `0 < n`, and discharges each bounded search. This one needs `native_decide`: plain `decide` is infeasible — the kernel's `Finset` reduction hits `maxRecDepth` on a bounded search as small as 100×100, long before the `n = 1848` cases. So `#print axioms` includes `Lean.ofReduceBool` (the compiler-checked-computation axiom) alongside the usual `[propext, Classical.choice, Quot.sound]`; no `sorryAx`. The file builds in ~13s. Only `knownIdonealNumbers_are_idoneal` is touched; the research-open `idoneal_numbers_completeness` keeps its `sorry`. Drafted with AI assistance and machine-checked by the Lean kernel.
1 parent ef4efd5 commit 181601c

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

FormalConjectures/Wikipedia/IdonealCompleteness.lean

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,44 @@ def knownIdonealNumbers : Finset ℕ :=
5454
112, 120, 130, 133, 165, 168, 177, 190, 210, 232, 240, 253, 273, 280, 312,
5555
330, 345, 357, 385, 408, 462, 520, 760, 840, 1320, 1365, 1848}
5656

57+
/--
58+
Reduces the unbounded search for a representation `n = a*b + b*c + a*c` (with
59+
`0 < a < b < c`) to a *bounded, decidable* double search over `a, b ∈ range (n+1)`.
60+
61+
The third variable is not searched: for a fixed pair `a, b` the equation
62+
`n = a*b + c*(a+b)` pins down `c = (n - a*b) / (a+b)`, so the witness `c` is
63+
recovered by exact division. The forward direction uses `a, b ≤ n` (each pairwise
64+
product is at most `n`) to land the pair in `range (n+1)`.
65+
-/
66+
@[category API, AMS 11]
67+
private theorem exists_triple_iff_bounded (n : ℕ) :
68+
(∃ a b c : ℕ, 0 < a ∧ a < b ∧ b < c ∧ n = a * b + b * c + a * c) ↔
69+
(∃ a ∈ Finset.range (n + 1), ∃ b ∈ Finset.range (n + 1),
70+
0 < a ∧ a < b ∧ b < (n - a * b) / (a + b) ∧
71+
n = a * b + b * ((n - a * b) / (a + b)) + a * ((n - a * b) / (a + b))) := by
72+
constructor
73+
· rintro ⟨a, b, c, ha, hab, hbc, heq⟩
74+
have hbn : b ≤ n := by nlinarith
75+
have han : a ≤ n := by nlinarith
76+
have hsum : n - a * b = c * (a + b) := by
77+
have : n = a * b + c * (a + b) := by ring_nf; ring_nf at heq; linarith
78+
omega
79+
have hpos : 0 < a + b := by omega
80+
have hc : (n - a * b) / (a + b) = c := by rw [hsum]; exact Nat.mul_div_cancel _ hpos
81+
exact ⟨a, Finset.mem_range.mpr (by omega), b, Finset.mem_range.mpr (by omega),
82+
ha, hab, hc ▸ hbc, hc ▸ heq⟩
83+
· rintro ⟨a, _, b, _, ha, hab, hbc, heq⟩
84+
exact ⟨a, b, (n - a * b) / (a + b), ha, hab, hbc, heq⟩
85+
86+
set_option maxRecDepth 4096 in
5787
/-- All 65 known idoneal numbers are indeed idoneal. -/
5888
@[category test, AMS 11]
5989
theorem knownIdonealNumbers_are_idoneal : ∀ n ∈ knownIdonealNumbers, IsIdoneal n := by
60-
sorry
90+
intro n hn
91+
fin_cases hn <;>
92+
refine ⟨by norm_num, ?_⟩ <;>
93+
rw [exists_triple_iff_bounded] <;>
94+
native_decide
6195

6296
/--
6397
Idoneal numbers completeness conjecture.

0 commit comments

Comments
 (0)