1-- Erdős problem 397: infinitely many coincidences among products of central2-- binomial coefficients3-- Part of Cumulus, the Grace17 mathematics library.4-- Copyright (c) 2026 Grant Passmore.5-- Released under the Apache License 2.0. See LICENSE in the repository root.6-- Authors: Grant Passmore78module Grace.Cumulus.NumberTheory.Erdos3979import Binomial1011-- Erdős and Graham asked whether the equation12-- ∏ᵢ C(2mᵢ, mᵢ) = ∏ⱼ C(2nⱼ, nⱼ)13-- has only finitely many solutions in distinct positive integers. The answer14-- is no: for every a ≥ 2, with c = 8a² + 8a + 1,15-- C(2a, a) · C(4a + 4, 2a + 2) · C(2c, c)16-- = C(2a + 2, a + 1) · C(4a, 2a) · C(2c + 2, c + 1).17-- The family was found by Neel Somani with ChatGPT in January 2026. This18-- module checks it from the axioms of set theory: the identity rests on one19-- step law for central binomial coefficients and a polynomial identity.2021-- The central binomial coefficient C(2n, n).22def central (n : Nat) : Nat:=2* n choose n2324theorem add_one.nonzero (x : Nat)25shows x +1≠026proof27arith2829-- Each step of the central binomial sequence:30-- C(2n + 2, n + 1) · (n + 1)² = C(2n, n) · (2n + 2)(2n + 1).31theorem central.step (n : Nat)32shows central(n +1) * ((n +1) * (n +1)) =33 central(n) * ((2* n +2) * (2* n +1))34proof35unfold central36have lower := choose.factorial at n with n37have upper := choose.factorial at n +1with n +138have outer := factorial.succ at n + n +1with*39have inner := factorial.succ at n + n with*40have step := factorial.succ at n with*41have nonzero := factorial.nonzero at n with*42have squareNonzero := mul.nonzero with nonzero, nonzero43have key : (n! * n!) * ((2* (n +1) choose n +1) * ((n +1) * (n +1))) =44 (n! * n!) * ((2* n choose n) * ((2* n +2) * (2* n +1)))45ring [upper, lower, outer, inner, step]46exact mul.left_cancel_positive with squareNonzero, key4748-- The identity behind every solution in the family: with c = 8a² + 8a + 1,49-- C(2a, a) · C(4a + 4, 2a + 2) · C(2c, c)50-- = C(2a + 2, a + 1) · C(4a, 2a) · C(2c + 2, c + 1).51-- Multiply both sides by (a + 1)²(2a + 1)²(2a + 2)²(c + 1)² and apply the52-- step law to each central binomial coefficient whose index is a successor.53theorem erdos397.identity (a : Nat)54shows central(a) * (central(2* a +2) * central(8* a * a +8* a +1)) =55 central(a +1) * (central(2* a) * central(8* a * a +8* a +2))56proof57have e1 : 2* a +2=2* a +1+1byring58have e2 : 8* a * a +8* a +2=8* a * a +8* a +1+1byring59rw [e1, e2]60have s1 := central.step at a with*61have s2 := central.step at2* a with*62have s3 := central.step at2* a +1with*63have s4 := central.step at8* a * a +8* a +1with*64have n1 := add_one.nonzero at a with*65have n2 := add_one.nonzero at2* a with*66have n3 := add_one.nonzero at2* a +1with*67have n4 := add_one.nonzero at8* a * a +8* a +1with*68have q1 := mul.nonzero with n1, n169have q2 := mul.nonzero with n2, n270have q3 := mul.nonzero with n3, n371have q4 := mul.nonzero with n4, n472have q34 := mul.nonzero with q3, q473have q234 := mul.nonzero with q2, q3474have nonzero := mul.nonzero with q1, q23475have key : ((a +1) * (a +1)) *76 (((2* a +1) * (2* a +1)) *77 (((2* a +1+1) * (2* a +1+1)) *78 ((8* a * a +8* a +1+1) * (8* a * a +8* a +1+1)))) *79 (central(a) *80 (central(2* a +1+1) * central(8* a * a +8* a +1))) =81 ((a +1) * (a +1)) *82 (((2* a +1) * (2* a +1)) *83 (((2* a +1+1) * (2* a +1+1)) *84 ((8* a * a +8* a +1+1) * (8* a * a +8* a +1+1)))) *85 (central(a +1) * (central(2* a) * central(8* a * a +8* a +1+1)))86ring [s1, s2, s3, s4]87exact mul.left_cancel_positive with nonzero, key8889-- For a ≥ 2 the three indices on each side are distinct, and the two sides90-- use different indices, so each a gives a genuine solution.91theorem erdos397.distinct (a : Nat)92requires large : 2≤ a93shows (a ≠2* a +2∧ a ≠8* a * a +8* a +1∧942* a +2≠8* a * a +8* a +1) ∧95 (a +1≠2* a ∧ a +1≠8* a * a +8* a +2∧962* a ≠8* a * a +8* a +2) ∧97 (a ≠ a +1∧ a ≠2* a ∧ a ≠8* a * a +8* a +2)98proof99arith100101-- Infinitely many solutions: beyond any bound there is another a.102theorem erdos397.unbounded (N : Nat)103shows∃ a ∈ ℕ, N < a ∧2≤ a ∧104 central(a) * (central(2* a +2) * central(8* a * a +8* a +1)) =105 central(a +1) * (central(2* a) * central(8* a * a +8* a +2))106proof107have witnessNat : Nat(N +2) bytypecheck108have member := nat.omega.forward with witnessNat109refine⟨N +2, member, ?_, ?_, erdos397.identity at N +2with*⟩110 . arith111 . arith112