Skip to content

Commit 2df5dcf

Browse files
committed
Wikipedia/IdonealCompleteness: prove knownIdonealNumbers_are_idoneal
Proves all 65 known idoneal numbers are idoneal. IsIdoneal's unbounded ∃ a b c is reduced to a bounded decidable double-search (helper exists_triple_iff_bounded: for fixed a,b ≤ n the constraint pins c = (n - a*b)/(a+b)), then fin_cases over the 65 numbers + native_decide. native_decide is required (plain decide hits maxRecDepth on the bounded search), so axioms include Lean.ofReduceBool alongside [propext, Classical.choice, Quot.sound]; no sorryAx. Drafted with AI assistance and machine-checked by the Lean kernel.
1 parent c4b3807 commit 2df5dcf

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)