import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Linarith namespace Erdos295 /-- The four lists named denominators18 through denominators21 are Kyunghan Bae's October 2026 certificates. Source: github.com/qorud02/erdos-295-k18, revision f1edd92177bb2fda9910d802c2e4b018fb595d9b, certificates-extension.json. -/ def Valid (minimum terms : Nat) (xs : List Nat) : Prop := xs.length = terms ∧ xs.head? = some minimum ∧ xs.Pairwise (· < ·) ∧ (xs.map (fun d => (1 : Rat) / d)).sum = 1 def denominators18 : List Nat := [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 43, 44, 45, 46, 48, 50, 52, 54, 63, 275, 14143068, 10457416992] theorem upper18 : Valid 18 34 denominators18 := by unfold Valid decide +kernel def denominators19 : List Nat := [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 46, 48, 50, 52, 54, 55, 66, 70, 275, 14143068, 10457416992] theorem upper19 : Valid 19 36 denominators19 := by unfold Valid decide +kernel def denominators20 : List Nat := [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 50, 51, 52, 53, 54, 72, 9512, 316569706, 745735753538714400, 755732875917998385] theorem upper20 : Valid 20 38 denominators20 := by unfold Valid decide +kernel def denominators21 : List Nat := [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 64, 3162192, 13244735025984, 60692489317197426150] theorem upper21 : Valid 21 39 denominators21 := by unfold Valid decide +kernel /-- Two 37-term expansions found during the November 28 cutoff-20 search. The suffix counts refer to denominators strictly greater than 64. -/ def threeAbove64 : List Nat := [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 51, 52, 56, 58, 63, 1309176, 3213670446, 563565103518093600] def fourAbove64 : List Nat := [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 48, 50, 51, 52, 54, 55, 60, 62, 65, 87, 1976436, 112165995770400] theorem cutoff20_three : Valid 20 37 threeAbove64 := by unfold Valid decide +kernel theorem cutoff20_four : Valid 20 37 fourAbove64 := by unfold Valid decide +kernel theorem transfer20to22 : (1 : Rat)/20 + 1/21 = 1/50 + 1/55 + 1/60 + 1/66 + 1/70 + 1/75 := by decide +kernel /-- Replace 20 and 21 in threeAbove64 by the six unused denominators in transfer20to22. -/ def transferred22 : List Nat := [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 55, 56, 58, 60, 63, 66, 70, 75, 1309176, 3213670446, 563565103518093600] def direct22 : List Nat := [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 58, 59, 62, 69, 70, 6128628, 456571014807600, 21262333689208735200] theorem cutoff22_transfer : Valid 22 41 transferred22 := by unfold Valid decide +kernel theorem cutoff22_direct : Valid 22 41 direct22 := by unfold Valid decide +kernel /-- The greatest sum of 40 distinct reciprocals with minimum denominator 22 and at least 11 denominators above 70 uses 22..50 and 71..81. -/ theorem cutoff22_eleven_large_sum : ((List.range' 22 29 ++ List.range' 71 11).map (fun d : Nat => (1 : Rat) / d)).sum < 1 := by decide +kernel private def coreWith (tail : List Nat) : Rat := ((List.range' 22 34 ++ tail).map (fun d : Nat => (1 : Rat) / d)).sum /-- Rational comparisons in the short proof of the least positive deficit after 37 denominators. The written argument enumerates the possible triples. -/ theorem cutoff22_gap_comparisons : let best := coreWith [57, 58, 59] 1 - best = 273357930928650193 / 22589072645168372263200 ∧ ((List.range' 22 33 ++ [56, 57, 58, 59]).map (fun d : Nat => (1 : Rat) / d)).sum < best ∧ coreWith [56, 59, 60] < best ∧ 1 < coreWith [56, 57, 61] ∧ coreWith [56, 57, 62] < best ∧ 1 < coreWith [56, 58, 60] ∧ coreWith [56, 58, 61] < best ∧ 247906 ≤ 3 / (1 - best) ∧ 3 / (1 - best) < 247907 := by decide +kernel /-- Lowering the smaller denominator and preserving the product can only increase the sum of the reciprocals. -/ theorem move_product {u a b : Rat} (hu : 0 < u) (ha : u ≤ a) (hb : a ≤ b) : 1 / a + 1 / b ≤ 1 / u + u / (a * b) := by have a_pos : 0 < a := lt_of_lt_of_le hu ha have b_pos : 0 < b := lt_of_lt_of_le a_pos hb field_simp nlinarith [mul_nonneg (sub_nonneg.mpr ha) (sub_nonneg.mpr (le_trans ha hb))] theorem split_largest {d : Rat} (hd : 0 < d) : 1 / d = 1 / (d + 1) + 1 / (d * (d + 1)) := by field_simp #print axioms upper18 #print axioms upper19 #print axioms upper20 #print axioms upper21 #print axioms cutoff20_three #print axioms cutoff20_four #print axioms transfer20to22 #print axioms cutoff22_transfer #print axioms cutoff22_direct #print axioms cutoff22_gap_comparisons #print axioms cutoff22_eleven_large_sum #print axioms move_product #print axioms split_largest end Erdos295