Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OutcastsMathLab.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ import OutcastsMathLab.Problems.P001_ErdosStraus1201.Verification
import OutcastsMathLab.Problems.P001_ErdosStraus1201.ReverseDivisor
import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeCoprimality
import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeDivisorBranches
import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeBranchBridge
137 changes: 137 additions & 0 deletions OutcastsMathLab/Problems/P001_ErdosStraus1201/PrimeBranchBridge.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import Mathlib.Data.Nat.Prime.Defs
import Mathlib.Tactic.NormNum.Prime
import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeCoprimality
import OutcastsMathLab.Problems.P001_ErdosStraus1201.PrimeDivisorBranches

namespace OutcastsPrimeBranchBridge

open OutcastsPrimeDivisorBranches

-- In the prime range p < 4x, Nat subtraction 4*x-p is not truncated.
theorem shift_cast (p x : Nat) (hlo : p < 4 * x) :
((4 * x - p : Nat) : Int) = 4 * (x : Int) - (p : Int) := by
omega

-- Nat coprimality of the shift with p, taken from the Int-level theorem.
-- Only x < p is needed on the upper side; 0 < x follows from p < 4x.
theorem shift_coprime (p x : Nat) (hp : Nat.Prime p) (hodd : p ≠ 2)
(hlo : p < 4 * x) (hxp : x < p) :
Nat.Coprime (4 * x - p) p := by
have hx : 0 < x := by omega
have h := OutcastsPrimeCoprimality.odd_prime_coprimality p x hp hodd hx hxp
rw [← shift_cast p x hlo, ← Int.natCast_mul, Int.gcd_natCast_natCast] at h
exact Nat.Coprime.coprime_dvd_right (Nat.dvd_mul_right p x) h

-- The two-branch equivalence with c = 4*x-p; no coprimality hypothesis remains.
theorem prime_factor_witness_iff_branches (p x a : Nat)
(hp : Nat.Prime p) (hodd : p ≠ 2)
(hlo : p < 4 * x) (hxp : x < p) :
FactorWitness p x (4 * x - p) a ↔
BranchI p x (4 * x - p) a ∨
∃ t, a = p * t ∧ BranchII p x (4 * x - p) t :=
factor_witness_iff_branches p x (4 * x - p) a hp hxp
(shift_coprime p x hp hodd hlo hxp)

-- A Nat factor witness yields the Int reconstruction of PrimeCoprimality.
-- The complementary factor b is the exact Nat quotient (px)^2 / a.
theorem factor_witness_reconstruction (p x a : Nat)
(hp : Nat.Prime p) (hodd : p ≠ 2)
(hlo : p < 4 * x) (hhi : 4 * x ≤ 3 * p)
(hw : FactorWitness p x (4 * x - p) a) :
let b : Int := (((p * x) * (p * x) / a : Nat) : Int)
let y := ((a : Int) + (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
obtain ⟨ha, haM, hd, hcong, hbound⟩ := hw
have hc := shift_cast p x hlo
have hab : (a : Int) * (((p * x) * (p * x) / a : Nat) : Int) =
((p : Int) * (x : Int)) * ((p : Int) * (x : Int)) := by
exact_mod_cast Nat.mul_div_cancel' hd
have hda : (4 * (x : Int) - (p : Int)) ∣ (a : Int) + (p : Int) * (x : Int) := by
rw [← hc]
exact_mod_cast hcong
have hlower : (4 * (x : Int) - (p : Int)) * (x : Int) -
(p : Int) * (x : Int) ≤ (a : Int) := by
have h : (((4 * x - p : Nat) : Int)) * (x : Int) ≤ (a : Int) + (p : Int) * (x : Int) := by
exact_mod_cast hbound
rw [hc] at h
omega
exact OutcastsPrimeCoprimality.odd_prime_reconstruction p x (a : Int) _
hp hodd hlo hhi (by exact_mod_cast ha) (by exact_mod_cast haM) hab hda hlower

-- Branch I: the factor is t itself.
theorem branchI_reconstruction (p x t : Nat)
(hp : Nat.Prime p) (hodd : p ≠ 2)
(hlo : p < 4 * x) (hhi : 4 * x ≤ 3 * p)
(h : BranchI p x (4 * x - p) t) :
let b : Int := (((p * x) * (p * x) / t : Nat) : Int)
let y := ((t : Int) + (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) :=
factor_witness_reconstruction p x t hp hodd hlo hhi
((prime_factor_witness_iff_branches p x t hp hodd hlo (by omega)).mpr (Or.inl h))

-- Branch II: the factor is p*t.
theorem branchII_reconstruction (p x t : Nat)
(hp : Nat.Prime p) (hodd : p ≠ 2)
(hlo : p < 4 * x) (hhi : 4 * x ≤ 3 * p)
(h : BranchII p x (4 * x - p) t) :
let b : Int := (((p * x) * (p * x) / (p * t) : Nat) : Int)
let y := (((p * t : Nat) : Int) + (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) :=
factor_witness_reconstruction p x (p * t) hp hodd hlo hhi
((prime_factor_witness_iff_branches p x (p * t) hp hodd hlo (by omega)).mpr
(Or.inr ⟨t, rfl, h⟩))

-- Non-vacuity: the known solution 4/1201 = 1/306 + 1/21618 + 1/61251
-- is Branch II with t = 108 (a = 1201*108), and the bridge reproduces it.
theorem example_1201_branchII :
BranchII 1201 306 (4 * 306 - 1201) 108 ∧
(((1201 * 108 : Nat) : Int) + 1201 * 306) / (4 * 306 - 1201) = 21618 ∧
((((1201 * 306) * (1201 * 306) / (1201 * 108) : Nat) : Int) + 1201 * 306) /
(4 * 306 - 1201) = 61251 := by
refine ⟨?_, by decide, by decide⟩
unfold BranchII
decide

theorem example_1201_reconstruction :
let y : Int := 21618
let z : Int := 61251
0 < (306 : Int) ∧ (306 : Int) ≤ y ∧ y ≤ z ∧
4 * (306 : Int) * y * z = (1201 : Int) * (306 * y + 306 * z + y * z) := by
have h := branchII_reconstruction 1201 306 108 (by norm_num) (by decide)
(by decide) (by decide) example_1201_branchII.1
have hy := example_1201_branchII.2.1
have hz := example_1201_branchII.2.2
simp only [Nat.cast_ofNat] at h hy hz ⊢
rw [hy, hz] at h
exact h

-- Branch I is inhabited too: 4/1201 = 1/306 + 1/15980 + 1/172727820 has t = 34.
theorem example_1201_branchI :
BranchI 1201 306 (4 * 306 - 1201) 34 ∧
(((34 : Nat) : Int) + 1201 * 306) / (4 * 306 - 1201) = 15980 ∧
((((1201 * 306) * (1201 * 306) / 34 : Nat) : Int) + 1201 * 306) /
(4 * 306 - 1201) = 172727820 := by
refine ⟨?_, by decide, by decide⟩
unfold BranchI
decide

end OutcastsPrimeBranchBridge

#print axioms OutcastsPrimeBranchBridge.shift_cast
#print axioms OutcastsPrimeBranchBridge.shift_coprime
#print axioms OutcastsPrimeBranchBridge.prime_factor_witness_iff_branches
#print axioms OutcastsPrimeBranchBridge.factor_witness_reconstruction
#print axioms OutcastsPrimeBranchBridge.branchI_reconstruction
#print axioms OutcastsPrimeBranchBridge.branchII_reconstruction
#print axioms OutcastsPrimeBranchBridge.example_1201_branchII
#print axioms OutcastsPrimeBranchBridge.example_1201_reconstruction
#print axioms OutcastsPrimeBranchBridge.example_1201_branchI
32 changes: 32 additions & 0 deletions Problems/P001_ErdosStraus1201/BRIDGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 二枝判定(Nat)と素数向けの復元(Int)の接続

`PrimeBranchBridge.lean` は、Outcasts #23 で未形式化と指摘した接続を埋める追補です。`PrimeDivisorBranches.lean`(自然数上の一般の `c`)と `PrimeCoprimality.lean`(整数上の `4x−p`)は、それぞれ単独では検証済みでしたが、`c = 4x−p` を代入して両者をつなぐ定理がありませんでした。

作成者はルナ側(Outcasts Neo & ルナ)で、前提とする 6 定理の作成者(境界測量士)とは別です。

## 命題

1〜3 は `Nat.Prime p`、`p ≠ 2`、`p < 4x`、`x < p` を仮定します(Outcasts #25 の依頼どおり。上側は `4x ≤ 3p` ではなく `x < p` で足ります)。4〜6 は復元の元定理 `odd_prime_reconstruction` が `4x ≤ 3p` を要求するので、その範囲で述べます。

1. `shift_cast`: `p < 4x` なら、自然数の引き算 `4*x-p` を整数へ移すと `4x−p` に一致する(切り捨てが起きない)。素数性は不要です。
2. `shift_coprime`: `Nat.Coprime (4*x-p) p`。`odd_prime_coprimality` の整数版の `gcd(4x−p, px)=1` から `Int.gcd_natCast_natCast` で自然数へ戻し、`p ∣ px` で右側を `p` に落とします。
3. `prime_factor_witness_iff_branches`: `c = 4*x-p` で `factor_witness_iff_branches` を使った形。gcd の仮定が消えます。
4. `factor_witness_reconstruction`: 自然数の因数 `a` が `FactorWitness p x (4*x-p) a` を満たせば、`b = (px)²/a`(自然数の正確な商)として、`y = (a+px)/(4x−p)`、`z = (b+px)/(4x−p)` は `0 < x ≤ y ≤ z` と `4xyz = p(xy+xz+yz)` を満たす(整数上)。
5. `branchI_reconstruction`: Branch I の `t` から、`a = t` として 4 の結論。
6. `branchII_reconstruction`: Branch II の `t` から、`a = p*t` として 4 の結論。

この 6 つで、「奇素数 `p` と許容範囲の `x` に対し、`x²` の約数 `t` が表のどちらかの行を満たせば、エルデシュ=シュトラウス方程式の整列済みの解が得られる」が、gcd 条件や型変換を追加の仮定に持たない一つながりの定理になります。

## 仮定が空でないことの確認

`4/1201 = 1/306 + 1/21618 + 1/61251` は `c = 23`、`a = 23·21618 − 367506 = 129708 = 1201·108` で Branch II の `t = 108` です。`example_1201_branchII` で `BranchII 1201 306 23 108` と復元値 `y = 21618`、`z = 61251` を確かめ、`example_1201_reconstruction` で `branchII_reconstruction` を実際に適用してこの解の等式を得ています。

`4/1201 = 1/306 + 1/15980 + 1/172727820` は `a = 34`(`1201 ∤ 34`、`34 ∣ 306²`)で Branch I の `t = 34` です(`example_1201_branchI`)。

## 検証

Lean 4.34.0 / mathlib v4.34.0(固定版)。ローカル Windows で生成物を削除して `lake build`: `PrimeBranchBridge` Built、645 jobs、終了コード 0。全 9 定理の `#print axioms` は `propext` / `Classical.choice` / `Quot.sound` の部分集合です。`check_policy.py` は 7 files 通過。jobs が 541 から増えたのは、`Nat.Prime 1201` の証明に `Mathlib.Tactic.NormNum.Prime` を読み込んだためです。

## 含まないもの

各対象素数で表のどちらかの行を満たす `x, t` が存在すること(研究の本題)は含みません。2 枝が重ならないこと(`p ∣ t` の排除)、復元した分母に対する Type I/II のラベル付けの定理、Python 列挙器の形式検証も含みません。この追補の独立した仕様レビューは未実施です。