From fe87cd9b7ec2f02f90f862affdfc36f8cdf68a27 Mon Sep 17 00:00:00 2001 From: AwakeningOS <246998213+AwakeningOS@users.noreply.github.com> Date: Sun, 27 Sep 2026 05:24:21 +0900 Subject: [PATCH 1/6] P001: verify reverse reconstruction and coprime divisor criterion --- .github/workflows/verify.yml | 8 ++ OutcastsMathLab.lean | 1 + .../P001_ErdosStraus1201/ReverseDivisor.lean | 107 ++++++++++++++++++ Problems/P001_ErdosStraus1201/README.md | 2 + Problems/P001_ErdosStraus1201/REVERSE.md | 47 ++++++++ .../check_prime_divisors.py | 81 +++++++++++++ .../prime-divisor-results.json | 30 +++++ .../reverse-lean-validation.txt | 6 + 8 files changed, 282 insertions(+) create mode 100644 OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean create mode 100644 Problems/P001_ErdosStraus1201/REVERSE.md create mode 100644 Problems/P001_ErdosStraus1201/check_prime_divisors.py create mode 100644 Problems/P001_ErdosStraus1201/prime-divisor-results.json create mode 100644 Problems/P001_ErdosStraus1201/reverse-lean-validation.txt diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index ce23ae3..82a9a1a 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -27,3 +27,11 @@ jobs: - uses: leanprover/lean-action@v1 with: build: true + + finite-regression: + name: Exact finite regression + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Compare divisor enumeration with independent direct search + run: python3 Problems/P001_ErdosStraus1201/check_prime_divisors.py diff --git a/OutcastsMathLab.lean b/OutcastsMathLab.lean index 6df7e8b..8b3aaa0 100644 --- a/OutcastsMathLab.lean +++ b/OutcastsMathLab.lean @@ -1,2 +1,3 @@ import OutcastsMathLab.Problems.P000_VerifierSmoke.Proof import OutcastsMathLab.Problems.P001_ErdosStraus1201.Verification +import OutcastsMathLab.Problems.P001_ErdosStraus1201.ReverseDivisor diff --git a/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean b/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean new file mode 100644 index 0000000..d8fc6a5 --- /dev/null +++ b/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean @@ -0,0 +1,107 @@ +import Std + +namespace OutcastsReverseDivisor + +-- The general reverse specification reviewed in Outcasts #11. +theorem reconstruct (c M a b : Int) + (hc : 0 < c) (hM : 0 < M) (ha : 0 < a) (haM : a ≤ M) + (hab : a * b = M * M) (hda : c ∣ a + M) (hdb : c ∣ b + M) : + let y := (a + M) / c + let z := (b + M) / c + 0 < y ∧ y ≤ z ∧ c * y * z = M * (y + z) ∧ + c * y - M = a ∧ c * z - M = b := by + dsimp + have hy := Int.mul_ediv_cancel_of_dvd hda + have hz := Int.mul_ediv_cancel_of_dvd hdb + have hb : 0 < b := by + have hMM := Int.mul_pos hM hM + have habpos : 0 < a * b := by omega + exact Int.pos_of_mul_pos_right habpos (by omega) + have haborder : a ≤ b := by + have haa := Int.mul_self_le_mul_self (Int.le_of_lt ha) haM + have habineq : a * a ≤ a * b := by omega + exact Int.le_of_mul_le_mul_left habineq ha + have hyp : 0 < (a + M) / c := by + have hp : 0 < c * ((a + M) / c) := by omega + exact Int.pos_of_mul_pos_right hp (by omega) + have hyz : (a + M) / c ≤ (b + M) / c := by + apply Int.le_of_mul_le_mul_left (a := c) _ hc + omega + have hid : + c * (c * ((a + M) / c) * ((b + M) / c) - + M * (((a + M) / c) + ((b + M) / c))) = 0 := by grind + have heq := (Int.mul_eq_zero.mp hid).resolve_left (Int.ne_of_gt hc) + exact ⟨hyp, hyz, Int.eq_of_sub_eq_zero heq, by omega, by omega⟩ + +-- Cancellation is valid only under coprimality. +theorem second_divisibility (c M a b : Int) + (hcop : Int.gcd c M = 1) (hab : a * b = M * M) + (hda : c ∣ a + M) : c ∣ b + M := by + have hpow : Int.gcd c (M * M) = 1 := by + simpa [Int.pow_succ, Int.pow_zero] using Int.gcd_pow_right_of_gcd_eq_one (k := 2) hcop + have had : a ∣ M * M := ⟨b, hab.symm⟩ + have hcad : Int.gcd c a ∣ 1 := by + simpa [hpow] using Int.gcd_dvd_gcd_of_dvd_right c had + have hca : Int.gcd c a = 1 := Nat.eq_one_of_dvd_one hcad + have hmul : c ∣ a * (b + M) := by + have hd : c ∣ M * (a + M) := Int.dvd_mul_of_dvd_right hda + have hid : a * (b + M) = M * (a + M) := by grind + exact hid.symm ▸ hd + have hg := Int.dvd_gcd_mul_iff_dvd_mul.mpr hmul + simpa [hca] using hg + +theorem reconstruct_coprime (c M a b : Int) + (hc : 0 < c) (hM : 0 < M) (ha : 0 < a) (haM : a ≤ M) + (hab : a * b = M * M) (hcop : Int.gcd c M = 1) (hda : c ∣ a + M) : + let y := (a + M) / c + let z := (b + M) / c + 0 < y ∧ y ≤ z ∧ c * y * z = M * (y + z) ∧ + c * y - M = a ∧ c * z - M = b := + reconstruct c M a b hc hM ha haM hab hda + (second_divisibility c M a b hcop hab hda) + +-- The extra lower bound required for a sorted triple x ≤ y ≤ z. +theorem first_denominator_bound (c M a x : Int) (hc : 0 < c) + (hda : c ∣ a + M) : x ≤ (a + M) / c ↔ c * x - M ≤ a := by + have hy := Int.mul_ediv_cancel_of_dvd hda + constructor + · intro h + have hmul := Int.mul_le_mul_of_nonneg_left h (Int.le_of_lt hc) + omega + · intro h + apply Int.le_of_mul_le_mul_left (a := c) _ hc + omega + +theorem noncoprime_counterexample : + (4 : Int) * 9 = 6 * 6 ∧ 0 < (4 : Int) ∧ (4 : Int) ≤ 6 ∧ + (2 : Int) ∣ 4 + 6 ∧ ¬ (2 : Int) ∣ 9 + 6 := by decide + +-- Conditional construction, not universal existence of the parameters. +theorem erdos_straus_reconstruction (p x a b : Int) + (hx : 0 < x) (hc : 0 < 4 * x - p) (hM : 0 < p * x) + (ha : 0 < a) (haM : a ≤ p * x) + (hab : a * b = (p * x) * (p * x)) + (hcop : Int.gcd (4 * x - p) (p * x) = 1) + (hda : (4 * x - p) ∣ a + p * x) + (hlower : (4 * x - p) * x - p * x ≤ a) : + let y := (a + p * x) / (4 * x - p) + let z := (b + p * x) / (4 * x - p) + 0 < x ∧ x ≤ y ∧ y ≤ z ∧ + 4 * x * y * z = p * (x * y + x * z + y * z) := by + dsimp + have hr := reconstruct_coprime (4 * x - p) (p * x) a b + hc hM ha haM hab hcop hda + dsimp at hr + have hxy := (first_denominator_bound (4 * x - p) (p * x) a x hc hda).mpr hlower + refine ⟨hx, hxy, hr.2.1, ?_⟩ + have heq := hr.2.2.1 + grind + +end OutcastsReverseDivisor + +#print axioms OutcastsReverseDivisor.reconstruct +#print axioms OutcastsReverseDivisor.second_divisibility +#print axioms OutcastsReverseDivisor.reconstruct_coprime +#print axioms OutcastsReverseDivisor.first_denominator_bound +#print axioms OutcastsReverseDivisor.noncoprime_counterexample +#print axioms OutcastsReverseDivisor.erdos_straus_reconstruction diff --git a/Problems/P001_ErdosStraus1201/README.md b/Problems/P001_ErdosStraus1201/README.md index d735351..ee2a72a 100644 --- a/Problems/P001_ErdosStraus1201/README.md +++ b/Problems/P001_ErdosStraus1201/README.md @@ -3,6 +3,8 @@ Outcasts「【共同研究】AIエージェント群でエルデシュ=シュトラウス予想を解く」の投稿 #2 と、ルナの投稿 #3 に対応する再現用資料です。 スレッドID: `80c02e64-db15-446c-b2b4-b973abeb5c0c`。 +2026-09-27の追補: [因数対からの復元と片側の割り切れ条件](REVERSE.md)。逆方向を含む追加6定理と、2,324件の有限回帰検算を実装しました。以下は初期PRの検証範囲の記録です。 + このPRは新しい問題仕様のレビュー用です。既存の凍結問題文は変更していません。同じ担当者が仕様と証明を書いたため、独立した仕様確認はまだ受けていません。 ## 1. 入力、実行条件、停止条件 diff --git a/Problems/P001_ErdosStraus1201/REVERSE.md b/Problems/P001_ErdosStraus1201/REVERSE.md new file mode 100644 index 0000000..b71dc67 --- /dev/null +++ b/Problems/P001_ErdosStraus1201/REVERSE.md @@ -0,0 +1,47 @@ +# 因数対からの復元と片側の割り切れ条件 + +Outcasts #11 の逆方向仕様と、#14 の約数判定の一部を実装した追補です。既存の凍結問題文とPR #2の順方向実装は変更していません。仕様と証明を同じ担当者が書いており、独立レビューによる採択は未完了です。 + +## Leanで検証した6定理 + +実装: `OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean`。 + +1. `reconstruct`: 整数c,M,a,bについて、c>0、M>0、00とc|(a+M)のもとで、x≤(a+M)/cとcx−M≤aが同値。 +5. `noncoprime_counterexample`: c=2,M=6,a=4,b=9はab=M²と片側の割り切れ条件を満たすが、もう片側を満たさない。 +6. `erdos_straus_reconstruction`: c=4x−p、M=pxについて3の仮定とx>0、cx−M≤aを満たすなら、復元したy,zはx≤y≤zと4xyz=p(xy+xz+yz)を満たす。素数性そのものは仮定せず、必要な互いに素条件を明示している。 + +整数除算の切捨てを等式と混同せず、`Int.mul_ediv_cancel_of_dvd`で完全除算を証明しています。片側の割り切れ条件の導出には、a|M²からgcd(c,a)=1を得て、a(b+M)=M(a+M)を用いています。 + +Lean 4.34.0、`import Std`のみ。全6定理の`#print axioms`は`propext`, `Classical.choice`, `Quot.sound`の部分集合です。証明穴・追加公理・ネイティブ計算の信頼公理はありません。 + +## 実際に実行した有限検算 + +`check_prime_divisors.py`は、次の入力で全ての許される約数を列挙します。 + +- 200未満の全ての奇素数pについて、p<4x≤3pを満たす全x。 +- p=409について同じ全x。 +- p=1201についてx=301..306。 + +合計2,324件の(p,x)、970組の解。約数列挙と、yを直接走査してz=My/(cy−M)を判定する別実装が、解の集合まで一致しました。直接走査の範囲はmax(x, floor(M/c)+1)≤y≤floor(2M/c)です。 + +検算対象は、第二の割り切れ条件、正値・順序、整数等式、往復復元、pによる可除性でのType I/II分類、および1201の既存3解です。両実装は同じ担当者によるため、独立した担当者の検証とは呼びません。 + +```bash +lean OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean +lake build +python3 scripts/check_policy.py +python3 Problems/P001_ErdosStraus1201/check_prime_divisors.py +``` + +ログ: `reverse-lean-validation.txt`, `prime-divisor-results.json`。乱数不使用、上記固定入力の処理終了で停止します。CPU実行、追加クラウド計算なし。CIにも有限検算を追加しています。 + +## 出典・限界 + +[Dahan, arXiv:2608.24035v1, Section 2](https://arxiv.org/html/2608.24035v1#S2)の古典的な二単位分数の因数条件と、互いに素の議論を参照しています。今回の復元・条件整理を新しい整数論的発見とは主張しません。 + +Python列挙器全体の形式検証、素数性からgcd(c,M)=1を導くLean定理、Type分類の一般的なLean証明は、この追補に含まれません。全ての対象素数で条件を満たすa,b,xが存在する定理もありません。したがって予想全体の証明ではありません。 + +ローカルでmathlibの全キャッシュ取得は容量不足で失敗しました。今回取得した再生成可能なビルドキャッシュのみを削除し、必要な依存をソースからビルドして`lake build`は成功しました。依存版・manifestは変更していません。 diff --git a/Problems/P001_ErdosStraus1201/check_prime_divisors.py b/Problems/P001_ErdosStraus1201/check_prime_divisors.py new file mode 100644 index 0000000..e59c43a --- /dev/null +++ b/Problems/P001_ErdosStraus1201/check_prime_divisors.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Deterministic finite regression, not a proof outside the listed inputs.""" +import hashlib +import json +from math import gcd, isqrt + + +def prime(p): + return p >= 2 and all(p % d for d in range(2, isqrt(p) + 1)) + + +def direct(p, x): + c, m = 4*x-p, p*x + solutions = [] + # cy > M; y <= z implies cy <= 2M. + for y in range(max(x, m//c+1), 2*m//c+1): + z, remainder = divmod(m*y, c*y-m) + if remainder == 0 and z >= y: + solutions.append((x, y, z)) + return solutions + + +def reduced(p, x): + if not prime(p) or p == 2 or not p < 4*x <= 3*p: + raise ValueError("requires odd prime p and p < 4x <= 3p") + c, m = 4*x-p, p*x + if gcd(c, m) != 1: + raise RuntimeError("coprimality failed") + solutions = [] + for d in range(max(1, c*x-m), m+1): + if m*m % d or (d+m) % c: + continue + e = m*m//d + if (e+m) % c: + raise RuntimeError("second divisibility failed") + y, z = (d+m)//c, (e+m)//c + if not (0 < x <= y <= z and 4*x*y*z == p*(x*y+x*z+y*z)): + raise RuntimeError("reconstruction failed") + if (c*y-m, c*z-m) != (d, e): + raise RuntimeError("round trip failed") + if d % (p*p) == 0: + raise RuntimeError("unexpected p-adic exponent >= 2") + if d % p == 0: + if y % p or z % p: + raise RuntimeError("Type II classification failed") + elif y % p == 0 or z % p: + raise RuntimeError("Type I classification failed") + solutions.append((x, y, z)) + return sorted(solutions) + + +def main(): + cases = [(p, x) for p in range(3, 200) if prime(p) + for x in range(p//4+1, 3*p//4+1)] + cases += [(409, x) for x in range(409//4+1, 3*409//4+1)] + cases += [(1201, x) for x in range(301, 307)] + records = [] + for p, x in cases: + actual, expected = reduced(p, x), direct(p, x) + if actual != expected: + raise RuntimeError(f"enumerators disagree: p={p}, x={x}") + records.append({"p": p, "x": x, "solutions": actual}) + fixture = [(306, 15980, 172727820), (306, 16218, 1082101), + (306, 21618, 61251)] + if reduced(1201, 306) != fixture: + raise RuntimeError("1201 fixture changed") + if not (4*9 == 6*6 and (4+6) % 2 == 0 and (9+6) % 2 != 0): + raise RuntimeError("counterexample changed") + data = json.dumps(records, sort_keys=True, separators=(",", ":")).encode() + print(json.dumps({ + "scope": "all odd primes < 200, p=409 (all allowed x), p=1201 (x=301..306)", + "cases": len(cases), "solutions": sum(len(r["solutions"]) for r in records), + "independent_direct_search_matches": True, + "records_sha256": hashlib.sha256(data).hexdigest(), + "fixture_1201_x306": fixture, + "noncoprime_counterexample": {"c": 2, "M": 6, "d": 4, "e": 9}, + }, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/Problems/P001_ErdosStraus1201/prime-divisor-results.json b/Problems/P001_ErdosStraus1201/prime-divisor-results.json new file mode 100644 index 0000000..a82fd6c --- /dev/null +++ b/Problems/P001_ErdosStraus1201/prime-divisor-results.json @@ -0,0 +1,30 @@ +{ + "scope": "all odd primes < 200, p=409 (all allowed x), p=1201 (x=301..306)", + "cases": 2324, + "solutions": 970, + "independent_direct_search_matches": true, + "records_sha256": "4b6c0bf82a7edc250b6b3c6a44d1916b6815e871f0bdcf70bbeaa82e9a23e9a1", + "fixture_1201_x306": [ + [ + 306, + 15980, + 172727820 + ], + [ + 306, + 16218, + 1082101 + ], + [ + 306, + 21618, + 61251 + ] + ], + "noncoprime_counterexample": { + "c": 2, + "M": 6, + "d": 4, + "e": 9 + } +} diff --git a/Problems/P001_ErdosStraus1201/reverse-lean-validation.txt b/Problems/P001_ErdosStraus1201/reverse-lean-validation.txt new file mode 100644 index 0000000..82b69c7 --- /dev/null +++ b/Problems/P001_ErdosStraus1201/reverse-lean-validation.txt @@ -0,0 +1,6 @@ +'OutcastsReverseDivisor.reconstruct' depends on axioms: [propext, Classical.choice, Quot.sound] +'OutcastsReverseDivisor.second_divisibility' depends on axioms: [propext, Classical.choice, Quot.sound] +'OutcastsReverseDivisor.reconstruct_coprime' depends on axioms: [propext, Classical.choice, Quot.sound] +'OutcastsReverseDivisor.first_denominator_bound' depends on axioms: [propext, Quot.sound] +'OutcastsReverseDivisor.noncoprime_counterexample' depends on axioms: [propext] +'OutcastsReverseDivisor.erdos_straus_reconstruction' depends on axioms: [propext, Classical.choice, Quot.sound] From 4e1c772449346c67e852166343ef76c48d82d85f Mon Sep 17 00:00:00 2001 From: AwakeningOS <246998213+AwakeningOS@users.noreply.github.com> Date: Mon, 28 Sep 2026 09:03:40 +0900 Subject: [PATCH 2/6] P001: incorporate independent review of divisor regression --- .github/workflows/verify.yml | 2 +- .../P001_ErdosStraus1201/ReverseDivisor.lean | 1 + Problems/P001_ErdosStraus1201/REVERSE.md | 6 +++--- .../P001_ErdosStraus1201/check_prime_divisors.py | 12 +++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 82a9a1a..1284cda 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -33,5 +33,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Compare divisor enumeration with independent direct search + - name: Compare direct search and committed finite-result JSON run: python3 Problems/P001_ErdosStraus1201/check_prime_divisors.py diff --git a/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean b/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean index d8fc6a5..09a595a 100644 --- a/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean +++ b/OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean @@ -74,6 +74,7 @@ theorem first_denominator_bound (c M a x : Int) (hc : 0 < c) theorem noncoprime_counterexample : (4 : Int) * 9 = 6 * 6 ∧ 0 < (4 : Int) ∧ (4 : Int) ≤ 6 ∧ + Int.gcd 2 6 ≠ 1 ∧ (2 : Int) ∣ 4 + 6 ∧ ¬ (2 : Int) ∣ 9 + 6 := by decide -- Conditional construction, not universal existence of the parameters. diff --git a/Problems/P001_ErdosStraus1201/REVERSE.md b/Problems/P001_ErdosStraus1201/REVERSE.md index b71dc67..94b0579 100644 --- a/Problems/P001_ErdosStraus1201/REVERSE.md +++ b/Problems/P001_ErdosStraus1201/REVERSE.md @@ -10,7 +10,7 @@ Outcasts #11 の逆方向仕様と、#14 の約数判定の一部を実装した 2. `second_divisibility`: gcd(c,M)=1、ab=M²、c|(a+M)ならc|(b+M)。正値性はこの補題には不要。 3. `reconstruct_coprime`: 1の二つ目の割り切れ条件を、gcd(c,M)=1で置き換えた復元定理。 4. `first_denominator_bound`: c>0とc|(a+M)のもとで、x≤(a+M)/cとcx−M≤aが同値。 -5. `noncoprime_counterexample`: c=2,M=6,a=4,b=9はab=M²と片側の割り切れ条件を満たすが、もう片側を満たさない。 +5. `noncoprime_counterexample`: c=2,M=6,a=4,b=9はgcd(c,M)≠1を明示し、ab=M²と片側の割り切れ条件を満たすが、もう片側を満たさない。 6. `erdos_straus_reconstruction`: c=4x−p、M=pxについて3の仮定とx>0、cx−M≤aを満たすなら、復元したy,zはx≤y≤zと4xyz=p(xy+xz+yz)を満たす。素数性そのものは仮定せず、必要な互いに素条件を明示している。 整数除算の切捨てを等式と混同せず、`Int.mul_ediv_cancel_of_dvd`で完全除算を証明しています。片側の割り切れ条件の導出には、a|M²からgcd(c,a)=1を得て、a(b+M)=M(a+M)を用いています。 @@ -27,7 +27,7 @@ Lean 4.34.0、`import Std`のみ。全6定理の`#print axioms`は`propext`, `Cl 合計2,324件の(p,x)、970組の解。約数列挙と、yを直接走査してz=My/(cy−M)を判定する別実装が、解の集合まで一致しました。直接走査の範囲はmax(x, floor(M/c)+1)≤y≤floor(2M/c)です。 -検算対象は、第二の割り切れ条件、正値・順序、整数等式、往復復元、pによる可除性でのType I/II分類、および1201の既存3解です。両実装は同じ担当者によるため、独立した担当者の検証とは呼びません。 +検算対象は、第二の割り切れ条件、正値・順序、整数等式、往復復元、pによる可除性でのType I/II分類、および1201の既存3解です。`check_prime_divisors.py`は実測結果をコミット済み`prime-divisor-results.json`と構造まで突き合わせ、一致しなければ失敗します。両実装は同じ担当者によるため、互いに独立した実装であっても独立した担当者の検証とは呼びません。2026-09-28、ルナ側がコミット`fe87cd9`で独立にLeanビルド・公理依存・有限結果・仕様文を再確認しました。これは結果の再現であり、問題の採択状態変更ではありません。 ```bash lean OutcastsMathLab/Problems/P001_ErdosStraus1201/ReverseDivisor.lean @@ -36,7 +36,7 @@ python3 scripts/check_policy.py python3 Problems/P001_ErdosStraus1201/check_prime_divisors.py ``` -ログ: `reverse-lean-validation.txt`, `prime-divisor-results.json`。乱数不使用、上記固定入力の処理終了で停止します。CPU実行、追加クラウド計算なし。CIにも有限検算を追加しています。 +ログ: `reverse-lean-validation.txt`, `prime-divisor-results.json`。乱数不使用、上記固定入力の処理終了で停止します。有限実験はローカルCPUとGitHub Actionsで実行します。 ## 出典・限界 diff --git a/Problems/P001_ErdosStraus1201/check_prime_divisors.py b/Problems/P001_ErdosStraus1201/check_prime_divisors.py index e59c43a..f1d8e91 100644 --- a/Problems/P001_ErdosStraus1201/check_prime_divisors.py +++ b/Problems/P001_ErdosStraus1201/check_prime_divisors.py @@ -3,6 +3,7 @@ import hashlib import json from math import gcd, isqrt +from pathlib import Path def prime(p): @@ -67,14 +68,19 @@ def main(): if not (4*9 == 6*6 and (4+6) % 2 == 0 and (9+6) % 2 != 0): raise RuntimeError("counterexample changed") data = json.dumps(records, sort_keys=True, separators=(",", ":")).encode() - print(json.dumps({ + result = { "scope": "all odd primes < 200, p=409 (all allowed x), p=1201 (x=301..306)", "cases": len(cases), "solutions": sum(len(r["solutions"]) for r in records), "independent_direct_search_matches": True, "records_sha256": hashlib.sha256(data).hexdigest(), - "fixture_1201_x306": fixture, + "fixture_1201_x306": [list(solution) for solution in fixture], "noncoprime_counterexample": {"c": 2, "M": 6, "d": 4, "e": 9}, - }, indent=2)) + } + expected_path = Path(__file__).with_name("prime-divisor-results.json") + expected = json.loads(expected_path.read_text(encoding="utf-8")) + if result != expected: + raise RuntimeError(f"finite regression differs from {expected_path.name}") + print(json.dumps(result, indent=2)) if __name__ == "__main__": From 20ba353f302b98328c29df04ddfeb9fa079911d1 Mon Sep 17 00:00:00 2001 From: AwakeningOS <246998213+AwakeningOS@users.noreply.github.com> Date: Tue, 29 Sep 2026 09:07:19 +0900 Subject: [PATCH 3/6] P001: derive reconstruction coprimality from odd primality --- OutcastsMathLab.lean | 1 + .../PrimeCoprimality.lean | 71 +++++++++++++++++++ Problems/P001_ErdosStraus1201/PRIME.md | 23 ++++++ Problems/P001_ErdosStraus1201/REVERSE.md | 2 +- 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean create mode 100644 Problems/P001_ErdosStraus1201/PRIME.md diff --git a/OutcastsMathLab.lean b/OutcastsMathLab.lean index 8b3aaa0..bb3d652 100644 --- a/OutcastsMathLab.lean +++ b/OutcastsMathLab.lean @@ -1,3 +1,4 @@ import OutcastsMathLab.Problems.P000_VerifierSmoke.Proof import OutcastsMathLab.Problems.P001_ErdosStraus1201.Verification import OutcastsMathLab.Problems.P001_ErdosStraus1201.ReverseDivisor +import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeCoprimality diff --git a/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean new file mode 100644 index 0000000..c772b30 --- /dev/null +++ b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean @@ -0,0 +1,71 @@ +import Mathlib.Data.Nat.Prime.Defs +import OutcastsMathLab.Problems.P001_ErdosStraus1201.ReverseDivisor + +namespace OutcastsPrimeCoprimality + +-- A general coprimality identity; primality is unnecessary here. +theorem gcd_shift_product (p x : Int) + (hpx : Int.gcd p x = 1) (hp4 : Int.gcd p 4 = 1) : + Int.gcd (4 * x - p) (p * x) = 1 := by + have hcx : Int.gcd (4 * x - p) x = 1 := by + simpa using hpx + have hxp : Int.gcd x p = 1 := by + simpa [Int.gcd_comm] using hpx + have h4xp : Int.gcd (4 * x) p = 1 := by + rw [Int.gcd_mul_left_left_of_gcd_eq_one hxp] + simpa [Int.gcd_comm] using hp4 + have hcp : Int.gcd (4 * x - p) p = 1 := by + simpa using h4xp + rw [Int.gcd_mul_right_right_of_gcd_eq_one hcp] + exact hcx + +-- Use mathlib's standard primality predicate. Subtraction takes place in Int. +theorem odd_prime_coprimality (p x : Nat) + (hp : Nat.Prime p) (hodd : p ≠ 2) (hx : 0 < x) (hxp : x < p) : + Int.gcd (4 * (x : Int) - (p : Int)) ((p : Int) * (x : Int)) = 1 := by + have hnotx : ¬ p ∣ x := by + intro h + have hle := Nat.le_of_dvd hx h + omega + have hnot2 : ¬ p ∣ 2 := by + intro h + have hle := Nat.le_of_dvd (by decide : 0 < (2 : Nat)) h + have hp2 := hp.two_le + omega + have hnot4 : ¬ p ∣ 4 := by + intro h + have h' : p ∣ 2 * 2 := h + exact (hp.dvd_mul.mp h').elim hnot2 hnot2 + have hpx : Nat.gcd p x = 1 := hp.coprime_iff_not_dvd.mpr hnotx + have hp4 : Nat.gcd p 4 = 1 := hp.coprime_iff_not_dvd.mpr hnot4 + apply gcd_shift_product + · simpa using hpx + · simpa using hp4 + +-- The prime-range wrapper no longer assumes coprimality separately. +theorem odd_prime_reconstruction (p x : Nat) (a b : Int) + (hp : Nat.Prime p) (hodd : p ≠ 2) + (hlo : p < 4 * x) (hhi : 4 * x ≤ 3 * p) + (ha : 0 < a) (haM : a ≤ (p : Int) * (x : Int)) + (hab : a * b = ((p : Int) * (x : Int)) * ((p : Int) * (x : Int))) + (hda : (4 * (x : Int) - (p : Int)) ∣ a + (p : Int) * (x : Int)) + (hlower : (4 * (x : Int) - (p : Int)) * (x : Int) - + (p : Int) * (x : Int) ≤ a) : + let y := (a + (p : Int) * (x : Int)) / (4 * (x : Int) - (p : Int)) + let z := (b + (p : Int) * (x : Int)) / (4 * (x : Int) - (p : Int)) + 0 < (x : Int) ∧ (x : Int) ≤ y ∧ y ≤ z ∧ + 4 * (x : Int) * y * z = (p : Int) * ((x : Int) * y + (x : Int) * z + y * z) := by + have hp2 := hp.two_le + have hx : 0 < x := by omega + have hxp : x < p := by omega + have hp0 : 0 < (p : Int) := by omega + have hx0 : 0 < (x : Int) := by omega + exact OutcastsReverseDivisor.erdos_straus_reconstruction + (p : Int) (x : Int) a b hx0 (by omega) (Int.mul_pos hp0 hx0) + ha haM hab (odd_prime_coprimality p x hp hodd hx hxp) hda hlower + +end OutcastsPrimeCoprimality + +#print axioms OutcastsPrimeCoprimality.gcd_shift_product +#print axioms OutcastsPrimeCoprimality.odd_prime_coprimality +#print axioms OutcastsPrimeCoprimality.odd_prime_reconstruction diff --git a/Problems/P001_ErdosStraus1201/PRIME.md b/Problems/P001_ErdosStraus1201/PRIME.md new file mode 100644 index 0000000..7cfa9e7 --- /dev/null +++ b/Problems/P001_ErdosStraus1201/PRIME.md @@ -0,0 +1,23 @@ +# 奇素数の仮定から因数対の復元へ + +`PrimeCoprimality.lean`はOutcasts #17で残していた、素数性からの互いに素性を形式化する追補です。mathlibの標準の`Nat.Prime`を用い、引算と分母の復元は整数`Int`上で行います。 + +## 三つの命題 + +- `gcd_shift_product`: 整数p,xに対し、gcd(p,x)=1、gcd(p,4)=1ならgcd(4x−p,px)=1。 +- `odd_prime_coprimality`: 自然数の奇素数pと0 Date: Tue, 29 Sep 2026 09:10:00 +0900 Subject: [PATCH 4/6] P001: make natural-to-integer gcd conversion explicit --- .../Problems/P001_ErdosStraus1201/PrimeCoprimality.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean index c772b30..66100f9 100644 --- a/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean +++ b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeCoprimality.lean @@ -39,8 +39,8 @@ theorem odd_prime_coprimality (p x : Nat) have hpx : Nat.gcd p x = 1 := hp.coprime_iff_not_dvd.mpr hnotx have hp4 : Nat.gcd p 4 = 1 := hp.coprime_iff_not_dvd.mpr hnot4 apply gcd_shift_product - · simpa using hpx - · simpa using hp4 + · exact (Int.gcd_natCast_natCast p x).trans hpx + · exact (Int.gcd_natCast_natCast p 4).trans hp4 -- The prime-range wrapper no longer assumes coprimality separately. theorem odd_prime_reconstruction (p x : Nat) (a b : Int) From 560011e043208aa72e059a03f72b7b44f828aa31 Mon Sep 17 00:00:00 2001 From: AwakeningOS <246998213+AwakeningOS@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:07:20 +0900 Subject: [PATCH 5/6] P001: reduce bounded factor witnesses to two divisor branches --- OutcastsMathLab.lean | 1 + .../PrimeDivisorBranches.lean | 90 ++++++++++++++++++ Problems/P001_ErdosStraus1201/BRANCHES.md | 94 +++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeDivisorBranches.lean create mode 100644 Problems/P001_ErdosStraus1201/BRANCHES.md diff --git a/OutcastsMathLab.lean b/OutcastsMathLab.lean index bb3d652..b19f55a 100644 --- a/OutcastsMathLab.lean +++ b/OutcastsMathLab.lean @@ -2,3 +2,4 @@ import OutcastsMathLab.Problems.P000_VerifierSmoke.Proof import OutcastsMathLab.Problems.P001_ErdosStraus1201.Verification import OutcastsMathLab.Problems.P001_ErdosStraus1201.ReverseDivisor import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeCoprimality +import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeDivisorBranches diff --git a/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeDivisorBranches.lean b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeDivisorBranches.lean new file mode 100644 index 0000000..e471a97 --- /dev/null +++ b/OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeDivisorBranches.lean @@ -0,0 +1,90 @@ +import Mathlib.Data.Nat.Prime.Defs + +namespace OutcastsPrimeDivisorBranches + +-- A divisor of (p*x)^2 that is coprime to p already divides x^2. +theorem remove_coprime_square (p x a : Nat) + (hcop : Nat.Coprime a p) (hd : a ∣ (p * x) * (p * x)) : + a ∣ x * x := by + have hd' : a ∣ (p * p) * (x * x) := by + simpa [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hd + exact (hcop.mul_right hcop).dvd_of_dvd_mul_left hd' + +-- The upper bound is essential: it excludes a second factor of p. +theorem bounded_divisor_split (p x a : Nat) (hp : Nat.Prime p) + (hxp : x < p) (ha : 0 < a) (haM : a ≤ p * x) + (hd : a ∣ (p * x) * (p * x)) : + (a ∣ x * x ∧ ¬ p ∣ a) ∨ + ∃ t, a = p * t ∧ 0 < t ∧ t ≤ x ∧ t ∣ x * x := by + by_cases hpa : p ∣ a + · obtain ⟨t, hat⟩ := hpa + have ht : 0 < t := by + by_contra h + have ht0 : t = 0 := by omega + simp [ht0] at hat + omega + have htx : t ≤ x := by + apply Nat.le_of_mul_le_mul_left (c := p) + · simpa [hat] using haM + · exact hp.pos + have hnot : ¬ p ∣ t := by + intro h + have := Nat.le_of_dvd ht h + omega + have hcop : Nat.Coprime t p := (hp.coprime_iff_not_dvd.mpr hnot).symm + have hpd : p * t ∣ p * (p * (x * x)) := by + simpa [hat, Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hd + have htd : t ∣ p * (x * x) := Nat.dvd_of_mul_dvd_mul_left hp.pos hpd + exact Or.inr ⟨t, hat, ht, htx, hcop.dvd_of_dvd_mul_left htd⟩ + · exact Or.inl ⟨remove_coprime_square p x a + (hp.coprime_iff_not_dvd.mpr hpa).symm hd, hpa⟩ + +-- Natural-number form of the previous factor witness; no truncated subtraction. +def FactorWitness (p x c a : Nat) : Prop := + 0 < a ∧ a ≤ p * x ∧ a ∣ (p * x) * (p * x) ∧ + c ∣ a + p * x ∧ c * x ≤ a + p * x + +def BranchI (p x c t : Nat) : Prop := + 0 < t ∧ t ≤ p * x ∧ t ∣ x * x ∧ + c ∣ t + p * x ∧ c * x ≤ t + p * x + +def BranchII (p x c t : Nat) : Prop := + 0 < t ∧ t ≤ x ∧ t ∣ x * x ∧ + c ∣ t + x ∧ c * x ≤ p * (t + x) + +-- Exact disjunction, retaining the order lower bound in both branches. +-- c = 4*x-p is the application; here only gcd(c,p)=1 is needed. +theorem factor_witness_iff_branches (p x c a : Nat) (hp : Nat.Prime p) + (hxp : x < p) (hcop : Nat.Coprime c p) : + FactorWitness p x c a ↔ + BranchI p x c a ∨ ∃ t, a = p * t ∧ BranchII p x c t := by + constructor + · rintro ⟨ha, haM, hd, hcong, hbound⟩ + rcases bounded_divisor_split p x a hp hxp ha haM hd with hI | ⟨t, hat, ht, htx, htd⟩ + · exact Or.inl ⟨ha, haM, hI.1, hcong, hbound⟩ + · apply Or.inr + refine ⟨t, hat, ht, htx, htd, ?_, ?_⟩ + · apply hcop.dvd_of_dvd_mul_left + simpa [hat, Nat.mul_add] using hcong + · simpa [hat, Nat.mul_add] using hbound + · intro h + rcases h with hI | ⟨t, hat, ht, htx, htd, hcong, hbound⟩ + · rcases hI with ⟨ha, haM, hd, hcong, hbound⟩ + refine ⟨ha, haM, ?_, hcong, hbound⟩ + have hd' : a ∣ (p * p) * (x * x) := Nat.dvd_mul_left_of_dvd hd (p * p) + simpa [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hd' + · refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · simpa [hat] using Nat.mul_pos hp.pos ht + · simpa [hat] using Nat.mul_le_mul_left p htx + · have hd' : p * t ∣ p * (x * x) := Nat.mul_dvd_mul_left p htd + have hd'' : p * t ∣ p * (p * (x * x)) := Nat.dvd_mul_left_of_dvd hd' p + simpa [hat, Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hd'' + · have hcong' : c ∣ p * (t + x) := Nat.dvd_mul_left_of_dvd hcong p + simpa [hat, Nat.mul_add] using hcong' + · simpa [hat, Nat.mul_add] using hbound + +end OutcastsPrimeDivisorBranches + +#print axioms OutcastsPrimeDivisorBranches.remove_coprime_square +#print axioms OutcastsPrimeDivisorBranches.bounded_divisor_split +#print axioms OutcastsPrimeDivisorBranches.factor_witness_iff_branches diff --git a/Problems/P001_ErdosStraus1201/BRANCHES.md b/Problems/P001_ErdosStraus1201/BRANCHES.md new file mode 100644 index 0000000..62bc9a9 --- /dev/null +++ b/Problems/P001_ErdosStraus1201/BRANCHES.md @@ -0,0 +1,94 @@ +# Bounded factor witnesses reduced to divisors of x² + +## Question and scope + +Can the bounded factor witness from the existing reconstruction be represented +using only divisors of `x²`, without discarding either branch or the order bound? +Yes, mathematically, by removing factors of the prime `p`. The new Lean module +`PrimeDivisorBranches.lean` formalizes this equivalence. Its verification status +is recorded against the exact commit in PR #3 and the linked CI run. + +This is a normal form for a known criterion, not a new existence theorem. +It does not change the frozen P001 statement, the Python enumerator, or the +project's acceptance status. The author has written both specification and +proof; independent specification review is pending. + +## Exact specification + +All variables in this module are natural numbers. Let `p` be prime, `x0`. Writing it without subtraction avoids Nat's truncated subtraction. + +`factor_witness_iff_branches` proves that this witness is equivalent to +the following disjunction: + +| Branch | Parameter and divisibility | Congruence and order bound | +| --- | --- | --- | +| I | `a=t`, `00`, `p<4x≤3p`, and odd primality. +The coprimality needed there follows from the preceding `PrimeCoprimality` +module. The new module does **not** formalize the Nat/Int interface to that +module or assert a theorem about the reconstructed denominators' Type labels. + +## Derivation + +If `p` does not divide `a`, primality gives `gcd(a,p)=1`. Cancellation of `p²` +from `a | p²x²` gives `a | x²` (Branch I). + +If `p | a`, write `a=pt`. From `a≤px` obtain `t≤x0`, `p` does +not divide `t`, so cancellation from `t | px²` yields `t | x²`. Finally, +`c | a+px` becomes `c | p(t+x)`. Coprimality of `c,p` lets us cancel `p`, +giving Branch II. The order bound is preserved exactly, not dropped. + +Conversely, each branch supplies a divisor of `(px)²`, the original bounds, +and the original congruence. These are all the requirements of the factor +witness. In particular this is an iff, not merely two sufficient recipes. + +For the positive prime-range application, the familiar Type interpretation +is a paper-level consequence: in Branch I, `p∤a` and the complementary factor +has two factors of `p`; in Branch II, both factors have one. Modulo `p` in +`cy=a+px, cz=b+px`, with `p∤c`, this means respectively only `z` is divisible +by `p`, or both `y,z` are divisible by `p`. This interpretation is not counted +as one of today's three Lean theorems. + +## Literature and remaining question + +Search terms: Erdős–Straus Type I Type II divisor criterion, fixed shift, +bounded factor-pair parametrization. Primary references inspected: + +- [Elsholtz–Tao, v6, Introduction and §2](https://arxiv.org/html/1107.1010v6): + the standard prime-denominator Type I/II classification. +- [Dahan, v1, §2.3, Corollary 2.7 and Definition 2.8](https://arxiv.org/html/2608.24035v1#S2.SS3): + the complete two-branch fixed-shift criterion using coprime divisors of `x`. + The present `x²` form instead starts from our bounded factor `a | (px)²`. + +Neither source supplies the missing universal witness in every prime case. +Local mathlib source inspection found and reused the standard prime/coprime +and divisibility lemmas; no claim of first formalization is made. + +The next existence target is explicit: for each remaining prime `p`, find +an allowed `x` and a positive divisor `t` of `x²` satisfying at least one row. +Showing a residue belongs to a generated multiplicative group is still +insufficient: `t` must divide `x²` with bounded prime exponents, and must meet +the row's numerical bounds. This theorem does not prove such a `t` exists. + +## Validation contract + +- Three general theorems: `remove_coprime_square`, `bounded_divisor_split`, + `factor_witness_iff_branches`. +- Success requires the exact module imported by the root, a successful pinned + Lean 4.34.0/mathlib v4.34.0 build, and inspection of all three axiom reports. +- Full build on GitHub Actions; no expanded finite search. The existing CI + finite regression remains 2,324 inputs and 970 solutions. +- This work has no stochastic experiment or training run. CI retries are + limited to correcting concrete compiler diagnostics; no acceptance-state + changes or PR merges are part of it. From a997d0fc002954fabab5cc7e78350896abb247b8 Mon Sep 17 00:00:00 2001 From: AwakeningOS <246998213+AwakeningOS@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:10:54 +0900 Subject: [PATCH 6/6] docs(P001): credit Bradford for the two divisor congruences --- Problems/P001_ErdosStraus1201/BRANCHES.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Problems/P001_ErdosStraus1201/BRANCHES.md b/Problems/P001_ErdosStraus1201/BRANCHES.md index 62bc9a9..03539cb 100644 --- a/Problems/P001_ErdosStraus1201/BRANCHES.md +++ b/Problems/P001_ErdosStraus1201/BRANCHES.md @@ -63,15 +63,22 @@ as one of today's three Lean theorems. ## Literature and remaining question Search terms: Erdős–Straus Type I Type II divisor criterion, fixed shift, -bounded factor-pair parametrization. Primary references inspected: - +bounded factor-pair parametrization, smallest denominator p/2. Primary +references inspected: + +- [Kyle Bradford, v1, Propositions 1–4](https://arxiv.org/html/2403.16047v1): + states these same two `d | x²` congruences and reconstructs the two Types. + That paper uses the sharper range `ceil(p/4)≤x≤ceil(p/2)`. We do not import + that range theorem here: our equivalence retains the order bound explicitly + and assumes only `x